1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /* This file contains ASN codec for MIB and SIB1 msgs */
20 #include "common_def.h"
25 #include "du_app_mac_inf.h"
27 #include "du_app_rlc_inf.h"
30 #include "BCCH-BCH-Message.h"
32 #include "PLMN-IdentityInfo.h"
33 #include "PLMN-IdentitY.h"
34 #include "SIB-TypeInfo.h"
35 #include "SchedulingInfo.h"
36 #include "SI-SchedulingInfo.h"
37 #include "ConnEstFailureControl.h"
38 #include "FrequencyInfoDL-SIB.h"
39 #include "SearchSpace.h"
40 #include "SCS-SpecificCarrier.h"
41 #include "NR-MultiBandInfo.h"
42 #include "PDCCH-ConfigCommon.h"
43 #include "PDSCH-TimeDomainResourceAllocation.h"
44 #include "PDSCH-TimeDomainResourceAllocationList.h"
45 #include "PDSCH-ConfigCommon.h"
46 #include "BWP-DownlinkCommon.h"
47 #include "DownlinkConfigCommonSIB.h"
48 #include "RACH-ConfigCommon.h"
49 #include "PUSCH-TimeDomainResourceAllocation.h"
50 #include "PUSCH-TimeDomainResourceAllocationList.h"
51 #include "PUSCH-ConfigCommon.h"
52 #include "PUCCH-ConfigCommon.h"
53 #include "UplinkConfigCommonSIB.h"
54 #include "TDD-UL-DL-ConfigCommon.h"
55 #include "ServingCellConfigCommonSIB.h"
58 #include "odu_common_codec.h"
59 #include "BCCH-DL-SCH-Message.h"
60 #include "du_f1ap_conversions.h"
61 #include "du_sys_info_hdl.h"
63 void FreeSib1Msg(SIB1_t *sib1Msg);
64 uint8_t FreqInfoUlret = RFAILED;
65 uint8_t RachCfgCommonret = RFAILED;
66 uint8_t PuschCfgCommonret = RFAILED;
67 uint8_t UlCfgCommSibret = RFAILED;
68 uint8_t FreqInfoDlret = RFAILED;
69 uint8_t DlCfgCommSibret = RFAILED;
70 uint8_t CommonSerachSpaceListret = RFAILED;
72 /*******************************************************************
80 * Functionality: Building MIB
82 * @return ROK - success
85 * ****************************************************************/
86 uint8_t BuildMib(MIB_t *mib)
88 mib->systemFrameNumber.size = sizeof(uint8_t);
89 DU_ALLOC(mib->systemFrameNumber.buf, mib->systemFrameNumber.size);
90 if(!(mib->systemFrameNumber.buf))
92 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
96 *(mib->systemFrameNumber.buf) = duCfgParam.mibParams.sysFrmNum;
97 mib->systemFrameNumber.bits_unused = ODU_VALUE_TWO;
99 mib->subCarrierSpacingCommon = duCfgParam.mibParams.subCarrierSpacingCommon;
100 mib->ssb_SubcarrierOffset = duCfgParam.mibParams.ssb_SubcarrierOffset;
101 mib->dmrs_TypeA_Position = duCfgParam.mibParams.dmrs_TypeA_Position;
102 mib->pdcch_ConfigSIB1.controlResourceSetZero = duCfgParam.mibParams.controlResourceSetZero;
103 mib->pdcch_ConfigSIB1.searchSpaceZero = duCfgParam.mibParams.searchSpaceZero;
104 mib->cellBarred = duCfgParam.mibParams.cellBarred;
105 mib->intraFreqReselection = duCfgParam.mibParams.intraFreqReselection;
106 mib->spare.size = sizeof(uint8_t);
107 DU_ALLOC(mib->spare.buf, mib->spare.size);
110 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
113 *(mib->spare.buf) = SPARE;
114 mib->spare.bits_unused = ODU_VALUE_SEVEN;
117 /*******************************************************************
119 * @brief Free MIB PDU for broadcast
123 * Function : FreeMibPdu
125 * Functionality: Deallocating MIB PDU for system broadcast
127 * @param[in]: BCCH_BCH_Message_t *bcchMsg
131 * ****************************************************************/
132 void FreeMibPdu(BCCH_BCH_Message_t *bcchMsg)
136 if(bcchMsg->message.choice.mib)
138 if((bcchMsg->message.choice.mib->systemFrameNumber.buf))
140 if(bcchMsg->message.choice.mib->spare.buf)
142 DU_FREE(bcchMsg->message.choice.mib->spare.buf,\
143 bcchMsg->message.choice.mib->spare.size);
145 DU_FREE(bcchMsg->message.choice.mib->systemFrameNumber.buf,
146 bcchMsg->message.choice.mib->systemFrameNumber.size);
148 DU_FREE(bcchMsg->message.choice.mib, sizeof(MIB_t));
150 DU_FREE(bcchMsg, sizeof(BCCH_BCH_Message_t));
153 /*******************************************************************
155 * @brief Builds MIB PDU for broadcast
159 * Function : BuildMibPdu
161 * Functionality: Building MIB PDU for system broadcast
163 * @return ROK - success
166 * ****************************************************************/
167 uint8_t BuildMibPdu()
169 uint8_t ret = RFAILED;
170 BCCH_BCH_Message_t *bcchMsg;
171 asn_enc_rval_t encRetVal; /* Encoder return value */
174 DU_ALLOC(bcchMsg, sizeof(BCCH_BCH_Message_t));
177 DU_LOG("\nERROR --> Memory allocation failure in BuildMibPdu");
181 bcchMsg->message.present = BCCH_BCH_MessageType_PR_mib;
182 DU_ALLOC(bcchMsg->message.choice.mib, sizeof(MIB_t));
183 if(!bcchMsg->message.choice.mib)
185 DU_LOG("\nERROR --> Memory allocation failure in BuildMibPdu");
188 if(BuildMib(bcchMsg->message.choice.mib) != ROK)
192 xer_fprint(stdout, &asn_DEF_BCCH_BCH_Message, bcchMsg);
193 memset(encBuf, 0, ENC_BUF_MAX_LEN);
195 encRetVal = uper_encode(&asn_DEF_BCCH_BCH_Message, 0,
196 bcchMsg, PrepFinalEncBuf, encBuf);
197 printf("\nencbufSize:%d\n", encBufSize);
198 if(encRetVal.encoded == -1)
200 DU_LOG("\nERROR --> DU APP: Could not encode BCCH BCH Message Type structure(at %s)\n",
201 encRetVal.failed_type?\
202 encRetVal.failed_type->name
207 #ifdef DEBUG_ASN_PRINT
208 /* Print encoded buffer */
209 for(int i=0; i< encBufSize; i++)
211 printf("%x\t",encBuf[i]);
219 /* Free allocated memory */
225 /*******************************************************************
227 * @brief free MIB message in Served Cell Info
231 * Function : FreeMibMsg
233 * Functionality: deallocating MIB message in Served Cell Info
235 * @param[in] MIB_t *mibMsg
240 * ****************************************************************/
241 void FreeMibMsg( MIB_t *mibMsg)
245 if((mibMsg->systemFrameNumber.buf))
247 if(mibMsg->spare.buf)
249 DU_FREE(mibMsg->spare.buf, mibMsg->spare.size);
251 DU_FREE(mibMsg->systemFrameNumber.buf,
252 mibMsg->systemFrameNumber.size);
254 DU_FREE(mibMsg, sizeof(MIB_t));
257 /*******************************************************************
259 * @brief Builds MIB message in Served Cell Info
263 * Function : BuildMibMsg
265 * Functionality: Building MIB message in Served Cell Info
267 * @return ROK - success
270 * ****************************************************************/
271 uint8_t BuildMibMsg()
274 asn_enc_rval_t encRetVal; /* Encoder return value */
275 uint8_t ret = RFAILED;
278 DU_ALLOC(mibMsg, sizeof(MIB_t));
281 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
284 if(BuildMib(mibMsg) != ROK)
288 xer_fprint(stdout, &asn_DEF_MIB, mibMsg);
289 memset(encBuf, 0, ENC_BUF_MAX_LEN);
291 encRetVal = uper_encode(&asn_DEF_MIB, 0,
292 mibMsg, PrepFinalEncBuf, encBuf);
293 printf("\nencbufSize:%d\n", encBufSize);
294 if(encRetVal.encoded == -1)
296 DU_LOG("\nERROR --> DU APP: Could not encode MIB structure(at %s)\n",
297 encRetVal.failed_type?\
298 encRetVal.failed_type->name
303 #ifdef DEBUG_ASN_PRINT
304 /* Print encoded buffer */
305 for(int i=0; i< encBufSize; i++)
307 printf("%x\t",encBuf[i]);
312 /* Free allocated memory */
323 /*******************************************************************
325 * @brief Builds CellIdentity within SIB1 message
329 * Function : BuildCellIdentity
331 * Functionality: Building RAN area code in SIB1 message
333 * @params[in] RAN_AreaCode_t **ranAreaCode
334 * @return ROK - success
337 * ****************************************************************/
338 uint8_t BuildCellIdentity(CellIdentity_t *cellIdentity)
340 cellIdentity->size = ODU_VALUE_FIVE*sizeof(uint8_t);
342 DU_ALLOC(cellIdentity->buf, cellIdentity->size);
343 if(!cellIdentity->buf)
345 DU_LOG("\nERROR --> DU APP: CellIdentity memory allocation failure");
348 fillBitString(cellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity);
352 /*******************************************************************
354 * @brief Builds RANAC within SIB1 message
358 * Function : BuildRanac
360 * Functionality: Building RAN area code in SIB1 message
362 * @params[in] RAN_AreaCode_t **ranAreaCode
363 * @return ROK - success
366 * ****************************************************************/
367 uint8_t BuildRanac(RAN_AreaCode_t **ranAreaCode)
369 RAN_AreaCode_t *ranac;
370 DU_ALLOC(ranac, sizeof(RAN_AreaCode_t));
373 DU_LOG("\nERROR --> DU APP: RANAC memory allocation failure");
376 *ranac = duCfgParam.sib1Params.ranac;
377 *ranAreaCode = ranac;
380 /*******************************************************************
382 * @brief Builds TAC within SIB1 message
386 * Function : BuildTac
388 * Functionality: Building Tracking area code in SIB1 message
390 * @params[in] TrackingAreaCode_t **tac
391 * @return ROK - success
394 * ****************************************************************/
395 uint8_t BuildTac(TrackingAreaCode_t **trackAreaCode)
397 TrackingAreaCode_t *tac;
400 DU_ALLOC(tac, sizeof(TrackingAreaCode_t));
403 DU_LOG("\nERROR --> DU APP: TAC memory allocation failure");
407 tac->size = ODU_VALUE_THREE*sizeof(uint8_t);
408 DU_ALLOC(tac->buf, tac->size);
411 DU_LOG("\nERROR --> DU APP: TAC memory allocation failure");
414 *(tac->buf) = duCfgParam.sib1Params.tac;
415 tac->bits_unused = ODU_VALUE_ZERO;
416 *trackAreaCode = tac;
421 /*******************************************************************
423 * @brief Builds PLMN list within SIB1 message
427 * Function : BuildPlmnList
429 * Functionality: Building PLMN list in SIB1 message
431 * @params[in] CellAccessRelatedInfo_t *cellAccessInfo
432 * @return ROK - success
435 * ****************************************************************/
436 uint8_t BuildPlmnList(CellAccessRelatedInfo_t *cellAccessInfo)
442 TrackingAreaCode_t **tac;
443 RAN_AreaCode_t **ranac;
444 CellIdentity_t *cellIdentity;
446 struct PLMN_IdentityInfo__plmn_IdentityList
449 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array,
450 cellAccessInfo->plmn_IdentityList.list.size);
451 if(!cellAccessInfo->plmn_IdentityList.list.array)
453 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
457 elementCnt = cellAccessInfo->plmn_IdentityList.list.count;
458 for(idx=0; idx<elementCnt; idx++)
460 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array[idx],
461 sizeof(PLMN_IdentityInfo_t));
462 if(!cellAccessInfo->plmn_IdentityList.list.array[idx])
464 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
471 elementCnt = ODU_VALUE_ONE;
473 plmnIdInfo = &cellAccessInfo->plmn_IdentityList.list.array[idx]->plmn_IdentityList;
474 plmnIdInfo->list.count = elementCnt;
475 plmnIdInfo->list.size = elementCnt * sizeof(PLMN_IdentitY_t *);
476 DU_ALLOC(plmnIdInfo->list.array, plmnIdInfo->list.size);
477 if(!plmnIdInfo->list.array)
479 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
483 for(idx1=0; idx1<elementCnt; idx1++)
485 DU_ALLOC(plmnIdInfo->list.array[idx1], sizeof(PLMN_IdentitY_t));
486 if(!(plmnIdInfo->list.array[idx1]))
488 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
493 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc, sizeof(MCC_t));
494 if(!plmnIdInfo->list.array[idx1]->mcc)
496 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
500 elementCnt = ODU_VALUE_THREE;
501 plmnIdInfo->list.array[idx1]->mcc->list.count = elementCnt;
502 plmnIdInfo->list.array[idx1]->mcc->list.size = elementCnt * sizeof(MCC_MNC_Digit_t *);
503 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array, plmnIdInfo->list.array[idx1]->mcc->list.size);
504 if(!(plmnIdInfo->list.array[idx1]->mcc->list.array))
506 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
509 for(idx2=0; idx2<elementCnt; idx2++)
511 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2],
512 sizeof(MCC_MNC_Digit_t));
513 if(!plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])
515 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
518 *(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])=\
519 duCfgParam.sib1Params.plmn.mcc[idx2];
522 plmnIdInfo->list.array[idx1]->mnc.list.count = elementCnt;
523 plmnIdInfo->list.array[idx1]->mnc.list.size =\
524 elementCnt * sizeof(MCC_MNC_Digit_t *);
525 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array,\
526 plmnIdInfo->list.array[idx1]->mnc.list.size);
527 if(!plmnIdInfo->list.array[idx1]->mnc.list.array)
529 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
532 for(idx2=0; idx2<elementCnt; idx2++)
534 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
535 sizeof(MCC_MNC_Digit_t));
536 if(!plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])
538 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
541 *(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])=\
542 duCfgParam.sib1Params.plmn.mnc[idx2];
545 /* Tracking Area Code */
546 tac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode;
554 ranac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac;
555 ret=BuildRanac(ranac);
562 cellIdentity = &cellAccessInfo->plmn_IdentityList.list.array[idx]->cellIdentity;
563 ret=BuildCellIdentity(cellIdentity);
569 /* cellReservedForOperatorUse */
570 cellAccessInfo->plmn_IdentityList.list.array[idx]->\
571 cellReservedForOperatorUse = duCfgParam.sib1Params.cellResvdForOpUse;
577 /*******************************************************************
579 * @brief Build SIB Map Info List
583 * Function : BuildSibMapInfoList
586 * Build SIB MapInfo List
588 * @params[in] SIB_Mapping_t pointer
589 * @return ROK - success
592 * ****************************************************************/
593 uint8_t BuildSibMapInfoList(SIB_Mapping_t *sibMapInfo)
595 uint8_t itr; /* List iterator */
596 uint8_t elementCnt; /* Number of elements in list */
597 SIB_TypeInfo_t *sibTypeInfo; /* Scheduling info */
599 /* SI scheduling info list */
600 DU_ALLOC(sibMapInfo->list.array, sibMapInfo->list.size);
601 if(!sibMapInfo->list.array)
603 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
607 elementCnt = sibMapInfo->list.count;
608 for(itr = 0; itr < elementCnt; itr++)
610 DU_ALLOC(sibMapInfo->list.array[itr], sizeof(SIB_TypeInfo_t));
611 if(!sibMapInfo->list.array[itr])
613 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
619 sibTypeInfo = sibMapInfo->list.array[itr];
620 sibTypeInfo->type = duCfgParam.sib1Params.siSchedInfo.sibType;
621 DU_ALLOC(sibTypeInfo->valueTag, sizeof(long));
622 if(!sibTypeInfo->valueTag)
624 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
628 *sibTypeInfo->valueTag = duCfgParam.sib1Params.siSchedInfo.sibValTag;
633 /*******************************************************************
635 * @brief Builds SI Scheduling info list within SIB1 message
639 * Function : BuildSiSchedInfoList
642 * Building SI Scheduling info list in SIB1 message
644 * @params[in] struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfo
645 * @return ROK - success
648 * ****************************************************************/
649 uint8_t BuildSiSchedInfoList(struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfoList)
651 uint8_t itr; /* List iterator */
652 uint8_t elementCnt; /* Number of elements in list */
654 SchedulingInfo_t *schedInfo; /* Scheduling info */
656 /* SI scheduling info list */
657 DU_ALLOC(si_SchedulingInfoList->list.array, si_SchedulingInfoList->list.size);
658 if(!si_SchedulingInfoList->list.array)
660 DU_LOG("\nERROR --> DU APP: BuildSiSchedInfoList memory allocation failure");
664 elementCnt = si_SchedulingInfoList->list.count;
665 for(itr = 0; itr < elementCnt; itr++)
667 DU_ALLOC(si_SchedulingInfoList->list.array[itr], sizeof(struct SchedulingInfo));
668 if(!si_SchedulingInfoList->list.array[itr])
670 DU_LOG("\nERROR --> DU APP: BuildSiSchedInfoList memory allocation failure");
676 schedInfo = si_SchedulingInfoList->list.array[itr];
677 schedInfo->si_BroadcastStatus = duCfgParam.sib1Params.siSchedInfo.broadcastSta;
678 schedInfo->si_Periodicity = duCfgParam.sib1Params.siSchedInfo.preiodicity;
680 elementCnt = ODU_VALUE_ONE;
681 schedInfo->sib_MappingInfo.list.count = elementCnt;
682 schedInfo->sib_MappingInfo.list.size = elementCnt * sizeof(SIB_TypeInfo_t *);
684 ret = BuildSibMapInfoList(&schedInfo->sib_MappingInfo);
693 /*******************************************************************
695 * @brief Builds SCS Specific carrier list for DL
699 * Function : BuildScsSpecificCarrierListDlSib
702 * Builds Subcarrier specific carrier list for downlink
704 * @params[in] FrequencyInfoDL_SIB__scs_SpecificCarrierList pointer
705 * @return ROK - success
708 * ****************************************************************/
709 uint8_t BuildScsSpecificCarrierListDlSib( struct FrequencyInfoDL_SIB__scs_SpecificCarrierList *scsCarrierList)
712 ScsSpecCarrier duScsSpecCarrier;
714 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.dlScsCarrier;
716 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
717 if(!scsCarrierList->list.array)
719 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
723 for(idx = 0; idx < scsCarrierList->list.count; idx++)
725 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
726 if(!scsCarrierList->list.array[idx])
728 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
734 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
735 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
736 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
739 } /* End of BuildScsSpecificCarrierListDlSib */
741 /*******************************************************************
743 * @brief Builds common search space list
747 * Function : BuildCommonSerachSpaceList
750 * Builds common search space list
752 * @params[in] PDCCH_ConfigCommon__commonSearchSpaceList pointer
753 * @return ROK - success
756 * ****************************************************************/
757 uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist)
760 SearchSpace_t *searchSpace;
761 PdcchCfgCommon duPdcchCfg;
763 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
765 DU_ALLOC(searchSpclist->list.array, searchSpclist->list.size);
766 if(!searchSpclist->list.array)
768 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
772 for(idx = 0; idx < searchSpclist->list.count; idx++)
774 DU_ALLOC(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
775 if(!searchSpclist->list.array[idx])
777 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
783 searchSpace = searchSpclist->list.array[idx];
785 /* Search Space id */
786 searchSpace->searchSpaceId = duPdcchCfg.searchSpcId;
788 /* Control Resource Set Id */
789 DU_ALLOC(searchSpace->controlResourceSetId, sizeof(ControlResourceSetId_t));
790 if(!searchSpace->controlResourceSetId)
792 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
795 *searchSpace->controlResourceSetId = duPdcchCfg.ctrlRsrcSetId;
797 /* Monitoring Slot periodicity and offset */
798 DU_ALLOC(searchSpace->monitoringSlotPeriodicityAndOffset,\
799 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
800 if(!searchSpace->monitoringSlotPeriodicityAndOffset)
802 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
805 searchSpace->monitoringSlotPeriodicityAndOffset->present = duPdcchCfg.monitorSlotPrdAndOffPresent;
807 switch(searchSpace->monitoringSlotPeriodicityAndOffset->present)
809 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1:
811 //searchSpace->monitoringSlotPeriodicityAndOffset->choice.s11 = duPdcchCfg.monitorSlotPrdAndOff;
814 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2:
819 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl4:
824 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl5:
829 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl8:
834 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl10:
839 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl16:
844 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl20:
849 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl40:
854 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl80:
859 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl160:
864 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl320:
869 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl640:
874 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1280:
879 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2560:
886 DU_LOG("\nERROR --> DU APP : Invalid value:Montoring slot periodicity and offset");
891 /* Monitoring Symbols Within Slot */
892 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot, sizeof(BIT_STRING_t));
893 if(!searchSpace->monitoringSymbolsWithinSlot)
895 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
898 searchSpace->monitoringSymbolsWithinSlot->size = 2 * sizeof(uint8_t);
900 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot->buf, searchSpace->monitoringSymbolsWithinSlot->size);
901 if(!searchSpace->monitoringSymbolsWithinSlot->buf)
903 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
906 searchSpace->monitoringSymbolsWithinSlot->buf[0] = duPdcchCfg.monitorSymbolsInSlot[0];
907 searchSpace->monitoringSymbolsWithinSlot->buf[1] = duPdcchCfg.monitorSymbolsInSlot[1];
908 searchSpace->monitoringSymbolsWithinSlot->bits_unused = 2;
910 /* Number of candidates per aggregation level */
911 DU_ALLOC(searchSpace->nrofCandidates, sizeof(struct SearchSpace__nrofCandidates));
912 if(!searchSpace->nrofCandidates)
914 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
917 searchSpace->nrofCandidates->aggregationLevel1 = duPdcchCfg.numCandAggLvl1;
918 searchSpace->nrofCandidates->aggregationLevel2 = duPdcchCfg.numCandAggLvl2;
919 searchSpace->nrofCandidates->aggregationLevel4 = duPdcchCfg.numCandAggLvl4;
920 searchSpace->nrofCandidates->aggregationLevel8 = duPdcchCfg.numCandAggLvl8;
921 searchSpace->nrofCandidates->aggregationLevel16 = duPdcchCfg.numCandAggLvl16;
923 /* Commented due to ASN decode failure in wireshark.
924 * Parameters like dci_Format0_0_AndFormat1_0 which are pointer to a structure that
925 * does not have any member parameter lead to decode failure in wireshark.
926 * The issue has been reported to Nokia.
927 * The following code will be uncommented once the issue is resolved */
929 /* Search Space type and DCI Format */
930 DU_ALLOC(searchSpace->searchSpaceType, sizeof( struct SearchSpace__searchSpaceType));
931 if(!searchSpace->searchSpaceType)
933 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
937 searchSpace->searchSpaceType->present = duPdcchCfg.searchSpcType;
938 switch(searchSpace->searchSpaceType->present)
940 case SearchSpace__searchSpaceType_PR_NOTHING:
945 case SearchSpace__searchSpaceType_PR_common:
947 DU_ALLOC(searchSpace->searchSpaceType->choice.common, sizeof(struct SearchSpace__searchSpaceType__common));
948 if(!searchSpace->searchSpaceType->choice.common)
950 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
954 searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = NULLP;
955 DU_ALLOC(searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0, \
956 sizeof(struct SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
957 if(!searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)
959 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
963 searchSpace->searchSpaceType->choice.common->dci_Format2_0 = NULLP;
964 searchSpace->searchSpaceType->choice.common->dci_Format2_1 = NULLP;
965 searchSpace->searchSpaceType->choice.common->dci_Format2_2 = NULLP;
966 searchSpace->searchSpaceType->choice.common->dci_Format2_3 = NULLP;
969 case SearchSpace__searchSpaceType_PR_ue_Specific:
975 DU_LOG("\nERROR --> DU_APP: Invalid Search Space type");
982 }/* BuildCommonSerachSpaceList */
984 /*******************************************************************
986 * @brief Builds PDCCH configuration common
990 * Function : BuildPdcchCfgCommon
993 * Builds PDCCH configuration common
995 * @params[in] BWP_DownlinkCommon__pdcch_ConfigCommon pointer
996 * @return ROK - success
999 * ****************************************************************/
1000 uint8_t BuildPdcchCfgCommon(struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg)
1004 PdcchCfgCommon duPdcchCfg;
1005 PDCCH_ConfigCommon_t *pdcchSetup;
1007 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
1009 pdcchCfg->present = duPdcchCfg.present;
1011 switch(pdcchCfg->present)
1013 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
1018 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
1023 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
1025 DU_ALLOC(pdcchCfg->choice.setup, sizeof(PDCCH_ConfigCommon_t));
1026 if(!pdcchCfg->choice.setup)
1028 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1031 pdcchSetup = pdcchCfg->choice.setup;
1033 /* Control Resource Set Zero */
1034 DU_ALLOC(pdcchSetup->controlResourceSetZero, sizeof(ControlResourceSetZero_t));
1035 if(!pdcchSetup->controlResourceSetZero)
1037 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1040 *pdcchSetup->controlResourceSetZero = duPdcchCfg.ctrlRsrcSetZero;
1042 /* Search space zero */
1043 DU_ALLOC(pdcchSetup->searchSpaceZero, sizeof(SearchSpaceZero_t));
1044 if(!pdcchSetup->searchSpaceZero)
1046 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1049 *pdcchSetup->searchSpaceZero = duPdcchCfg.searchSpcZero;
1051 /* Common Search Space List */
1052 DU_ALLOC(pdcchSetup->commonSearchSpaceList, sizeof(struct PDCCH_ConfigCommon__commonSearchSpaceList));
1053 if(!pdcchSetup->commonSearchSpaceList)
1055 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1058 elementCnt = ODU_VALUE_ONE;
1059 pdcchSetup->commonSearchSpaceList->list.count = elementCnt;
1060 pdcchSetup->commonSearchSpaceList->list.size = elementCnt * sizeof(SearchSpace_t *);
1061 ret = BuildCommonSerachSpaceList(pdcchSetup->commonSearchSpaceList);
1064 DU_LOG("\nERROR --> DU APP : Failed to fill common search space list");
1067 CommonSerachSpaceListret=ROK;
1069 /* Search Space for SIB1 */
1070 DU_ALLOC(pdcchSetup->searchSpaceSIB1, sizeof(SearchSpaceId_t));
1071 if(!pdcchSetup->searchSpaceSIB1)
1073 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1076 *pdcchSetup->searchSpaceSIB1 = duPdcchCfg.searchSpcSib1;
1078 /* Search Space for Paging */
1079 DU_ALLOC(pdcchSetup->pagingSearchSpace, sizeof(SearchSpaceId_t));
1080 if(!pdcchSetup->pagingSearchSpace)
1082 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1085 *pdcchSetup->pagingSearchSpace = duPdcchCfg.pagingSearchSpc;
1087 /* Search space for Random Access */
1088 DU_ALLOC(pdcchSetup->ra_SearchSpace, sizeof(SearchSpaceId_t));
1089 if(!pdcchSetup->ra_SearchSpace)
1091 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1094 *pdcchSetup->ra_SearchSpace = duPdcchCfg.raSearchSpc;
1099 DU_LOG("\nERROR --> DU APP : Invalid PDCCH Config type");
1105 } /* BuildPdcchCfgCommon */
1107 /*******************************************************************
1109 * @brief Builds PDSCH configuration common
1113 * Function : BuildPdschCfgCommon
1116 * Builds PDSCH configuration common
1118 * @params[in] BWP_DownlinkCommon__pdsch_ConfigCommon pointer
1119 * @return ROK - success
1122 * ****************************************************************/
1123 uint8_t BuildPdschCfgCommon(struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg)
1127 PdschCfgCommon duPdschCfg;
1128 PDSCH_ConfigCommon_t *pdschSetup;
1129 PDSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo;
1131 duPdschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg;
1133 pdschCfg->present = duPdschCfg.present;
1135 switch(pdschCfg->present)
1137 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
1142 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
1147 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
1149 DU_ALLOC(pdschCfg->choice.setup, sizeof(PDSCH_ConfigCommon_t));
1150 if(!pdschCfg->choice.setup)
1152 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1155 pdschSetup = pdschCfg->choice.setup;
1157 /* Time Domain Allocation List */
1158 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList, sizeof(PDSCH_TimeDomainResourceAllocationList_t));
1159 if(!pdschSetup->pdsch_TimeDomainAllocationList)
1161 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1165 elementCnt = duPdschCfg.numTimeDomRsrcAlloc;
1166 pdschSetup->pdsch_TimeDomainAllocationList->list.count = elementCnt;
1167 pdschSetup->pdsch_TimeDomainAllocationList->list.size = \
1168 elementCnt * sizeof(PDSCH_TimeDomainResourceAllocation_t *);
1170 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array,\
1171 pdschSetup->pdsch_TimeDomainAllocationList->list.size);
1172 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array)
1174 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1178 for(idx=0; idx<elementCnt; idx++)
1180 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx],\
1181 sizeof(PDSCH_TimeDomainResourceAllocation_t));
1182 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx])
1184 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1189 for(idx = 0; idx < pdschSetup->pdsch_TimeDomainAllocationList->list.count; idx++)
1191 timeDomRsrcAllocInfo = pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx];
1194 DU_ALLOC(timeDomRsrcAllocInfo->k0, sizeof(long));
1195 if(!timeDomRsrcAllocInfo->k0)
1197 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1200 *timeDomRsrcAllocInfo->k0 = duPdschCfg.timeDomAlloc[idx].k0;
1202 timeDomRsrcAllocInfo->mappingType = duPdschCfg.timeDomAlloc[idx].mapType;
1203 timeDomRsrcAllocInfo->startSymbolAndLength = duPdschCfg.timeDomAlloc[idx].sliv;
1209 DU_LOG("\nERROR --> DU APP: Invalid PDSCH Configuration type");
1215 }/* BuildPdschCfgCommon */
1217 /*******************************************************************
1219 * @brief Builds DL BWP common
1223 * Function : BuildBwpDlCommon
1226 * Builds DL BWP common
1228 * @params[in] BWP_DownlinkCommon_t pointer
1229 * @return ROK - success
1232 * ****************************************************************/
1233 uint8_t BuildBwpDlCommon(BWP_DownlinkCommon_t *bwp)
1235 DlCfgCommon duDlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1237 /* Generic Parameters */
1238 bwp->genericParameters.locationAndBandwidth = duDlCfg.locAndBw;
1239 bwp->genericParameters.subcarrierSpacing = duDlCfg.dlScsCarrier.scs;
1241 /* PDCCH Config Common */
1242 DU_ALLOC(bwp->pdcch_ConfigCommon, sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
1243 if(!bwp->pdcch_ConfigCommon)
1245 DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed");
1248 if((BuildPdcchCfgCommon(bwp->pdcch_ConfigCommon)) != ROK)
1250 DU_LOG("\nERROR --> DU APP : Failed to fill PDCCH config common in BuildBwpDlCommon()");
1254 /* PDSCH Config Common */
1255 DU_ALLOC(bwp->pdsch_ConfigCommon, sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
1256 if(!bwp->pdsch_ConfigCommon)
1258 DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed");
1262 if((BuildPdschCfgCommon(bwp->pdsch_ConfigCommon)) != ROK)
1264 DU_LOG("\nERROR --> DU APP : Failed to fill PDSCH config common in BuildBwpDlCommon()");
1269 } /* BuildBwpDlCommon */
1271 /*******************************************************************
1273 * @brief Build BCCH configuration
1277 * Function : BuildBcchConfig
1280 * Build BCCH configuration
1282 * @params[in] BCCH_Config_t pointer
1283 * @return ROK - success
1286 * ****************************************************************/
1288 uint8_t BuildBcchConfig(BCCH_Config_t *bcchCfg)
1292 duBcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.bcchCfg;
1294 bcchCfg->modificationPeriodCoeff = duBcchCfg.modPrdCoeff;
1297 }/* BuildBcchConfig */
1299 /*******************************************************************
1301 * @brief fills First PDCCH monitoring Paging occasions
1305 * Function : fillFirstPdcchMonitoringOcc
1308 * Fills PDCCH Monitoring PO in PCCH configuration
1311 * @return ROK - success
1314 * ****************************************************************/
1315 uint8_t fillFirstPdcchMonitoringOcc(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO *firstPO,\
1316 PcchCfg *srcPcchCfg)
1318 uint8_t numPO = 0, poIdx = 0;
1320 firstPO->present = srcPcchCfg->firstPDCCHMontioringType;
1322 numPO = srcPcchCfg->ns;
1325 DU_LOG("\nINFO --> DU APP : Paging Occasions is ZERO, no need to fill further");
1329 /*Note: Valid values for each number of PO is from Spec 36.331: PCCH-COnfig*/
1330 switch(firstPO->present)
1332 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_NOTHING:
1336 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS15KHZoneT:
1338 DU_ALLOC(firstPO->choice.sCS15KHZoneT, \
1339 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS15KHZoneT));
1341 if(firstPO->choice.sCS15KHZoneT == NULLP)
1343 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1346 firstPO->choice.sCS15KHZoneT->list.count = numPO;
1347 firstPO->choice.sCS15KHZoneT->list.size = numPO * sizeof(long *);
1349 DU_ALLOC(firstPO->choice.sCS15KHZoneT->list.array, firstPO->choice.sCS15KHZoneT->list.size);
1350 if(!firstPO->choice.sCS15KHZoneT->list.array)
1352 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1356 for(poIdx = 0; poIdx < numPO; poIdx++)
1358 /* Spec 36.331: PCCH-Config: firstPDCCH-MonitoringOccasionOfPO [MAX of sCS15KHZoneT]
1359 * Since FirstPDCCHMonitoring_PO is not valid thus no need to continue further*/
1360 if(srcPcchCfg->firstPDCCHMontioringInfo[poIdx] > 139)
1362 DU_LOG("\nERROR --> DU APP : Invalid Paging Ocassion value for 15kHz");
1365 DU_ALLOC(firstPO->choice.sCS15KHZoneT->list.array[poIdx], sizeof(long));
1366 if(!firstPO->choice.sCS15KHZoneT->list.array[poIdx])
1368 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1374 *firstPO->choice.sCS15KHZoneT->list.array[poIdx] = srcPcchCfg->firstPDCCHMontioringInfo[poIdx];
1378 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS30KHZoneT_SCS15KHZhalfT:
1380 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT, \
1381 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS30KHZoneT_SCS15KHZhalfT));
1383 if(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT == NULLP)
1385 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1388 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.count = numPO;
1389 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.size = numPO * sizeof(long *);
1391 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array, \
1392 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.size);
1394 if(!firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array)
1396 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1400 for(poIdx = 0; poIdx < numPO; poIdx++)
1402 /* Spec 36.331: PCCH-Config:firstPDCCH-MonitoringOccasionOfPO [MAX of sCS30KHZoneT-SCS15KHZhalfT]
1403 * Since FirstPDCCHMonitoring_PO is not valid thus no need to continue further*/
1404 if(srcPcchCfg->firstPDCCHMontioringInfo[poIdx] > 279)
1406 DU_LOG("\nERROR --> DU APP : Invalid Paging Ocassion value for 30kHz or 15kHz HAlFT");
1409 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx], sizeof(long));
1410 if(!firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx])
1412 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1418 *firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx] = srcPcchCfg->firstPDCCHMontioringInfo[poIdx];
1421 //TODO for other cases
1424 DU_LOG("\nERROR --> DU APP : Invalid firstPDCCH-MonitoringOccasionOfPO");
1432 /*******************************************************************
1434 * @brief Builds PCCH configuration
1438 * Function : BuildPcchConfig
1441 * Builds PCCH configuration
1444 * @return ROK - success
1447 * ****************************************************************/
1448 uint8_t BuildPcchConfig(PCCH_Config_t *pcchCfg)
1452 duPcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg;
1454 pcchCfg->defaultPagingCycle = convertPagingCycleValueToEnum(duPcchCfg.dfltPagingCycle);
1455 pcchCfg->nAndPagingFrameOffset.present = duPcchCfg.nAndPagingFrmOffsetType;
1456 switch(pcchCfg->nAndPagingFrameOffset.present)
1458 /**Note: PagingFrame Offset Value differs for each Paging Duration
1459 *(oneT, halfT,...). The Range of Offset given in Spec 38.331,Pcch-Config*/
1460 case PCCH_Config__nAndPagingFrameOffset_PR_NOTHING:
1465 case PCCH_Config__nAndPagingFrameOffset_PR_oneT:
1467 pcchCfg->nAndPagingFrameOffset.choice.oneT = NULLD;
1470 case PCCH_Config__nAndPagingFrameOffset_PR_halfT:
1472 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of halfT] */
1473 if(duPcchCfg.pageFrameOffset > 1)
1475 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for HALF_T");
1478 pcchCfg->nAndPagingFrameOffset.choice.halfT = duPcchCfg.pageFrameOffset;
1481 case PCCH_Config__nAndPagingFrameOffset_PR_quarterT:
1483 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of quarterT] */
1484 if(duPcchCfg.pageFrameOffset > 3)
1486 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for QUARTER_T");
1489 pcchCfg->nAndPagingFrameOffset.choice.quarterT = duPcchCfg.pageFrameOffset;
1492 case PCCH_Config__nAndPagingFrameOffset_PR_oneEighthT:
1494 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of oneEighthT] */
1495 if(duPcchCfg.pageFrameOffset > 7)
1497 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for ONE_EIGHTH_T");
1500 pcchCfg->nAndPagingFrameOffset.choice.oneEighthT = duPcchCfg.pageFrameOffset;
1503 case PCCH_Config__nAndPagingFrameOffset_PR_oneSixteenthT:
1505 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of oneSixteenthT] */
1506 if(duPcchCfg.pageFrameOffset > 15)
1508 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for ONE_SIXTEENTH_T");
1511 pcchCfg->nAndPagingFrameOffset.choice.oneSixteenthT = duPcchCfg.pageFrameOffset;
1516 DU_LOG("\nERROR --> DU APP : Invalid nAndPagingFrameOffset configuration");
1520 pcchCfg->ns = convertNsValueToEnum(duPcchCfg.ns);
1522 DU_ALLOC(pcchCfg->firstPDCCH_MonitoringOccasionOfPO, \
1523 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO));
1524 if(pcchCfg->firstPDCCH_MonitoringOccasionOfPO == NULLP)
1526 DU_LOG("\nERROR --> DU APP : BuildPcchConfig >> Memory Allocation fails");
1530 if(fillFirstPdcchMonitoringOcc(pcchCfg->firstPDCCH_MonitoringOccasionOfPO, &duPcchCfg) == RFAILED)
1532 DU_LOG("\nERROR --> DU APP : BuildPcchConfig >> Filling of Paging Occ failed");
1536 }/* BuildPcchConfig */
1538 /*******************************************************************
1540 * @brief Builds Frequency Info for Downlink
1544 * Function : BuildFreqInfoDlSib
1547 * Builds Frequency Info for Downlink
1550 * @return ROK - success
1553 * ****************************************************************/
1555 uint8_t BuildFreqInfoDlSib(FrequencyInfoDL_SIB_t *frequencyInfoDL)
1561 NR_MultiBandInfo_t *multiBandInfo;
1563 dlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1565 /* NR Multi-Band Info */
1566 elementCnt = ODU_VALUE_ONE;
1567 frequencyInfoDL->frequencyBandList.list.count = elementCnt;
1568 frequencyInfoDL->frequencyBandList.list.size = \
1569 elementCnt * sizeof(NR_MultiBandInfo_t *);
1571 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array, \
1572 frequencyInfoDL->frequencyBandList.list.size);
1573 if(!frequencyInfoDL->frequencyBandList.list.array)
1575 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1579 for(idx = 0; idx < elementCnt; idx++)
1581 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array[idx],\
1582 sizeof(NR_MultiBandInfo_t));
1583 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
1585 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1591 multiBandInfo = frequencyInfoDL->frequencyBandList.list.array[idx];
1593 /* Frequency band indicator */
1594 DU_ALLOC(multiBandInfo->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
1595 if(!multiBandInfo->freqBandIndicatorNR)
1597 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1600 *multiBandInfo->freqBandIndicatorNR = dlCfg.freqBandInd;
1602 /* Offset to Point A */
1603 frequencyInfoDL->offsetToPointA = dlCfg.offsetToPointA;
1605 /* Subcarrier Spacing specifc carrier */
1606 elementCnt = ODU_VALUE_ONE;
1607 frequencyInfoDL->scs_SpecificCarrierList.list.count = elementCnt;
1608 frequencyInfoDL->scs_SpecificCarrierList.list.size = \
1609 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1610 ret= BuildScsSpecificCarrierListDlSib(&frequencyInfoDL->scs_SpecificCarrierList);
1617 }/* BuildFreqInfoDl */
1619 /*******************************************************************
1621 * @brief Builds DL configuration common for SIB
1625 * Function : BuildDlCfgCommSib
1628 * Builds DL configuration common for SIB
1630 * @params[in] DownlinkConfigCommonSIB_t pointer
1631 * @return ROK - success
1634 * ****************************************************************/
1636 uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg)
1638 /* DL frequency info */
1640 ret = BuildFreqInfoDlSib(&dlCfg->frequencyInfoDL);
1646 /* BWP Downlink Common */
1647 ret = BuildBwpDlCommon(&dlCfg->initialDownlinkBWP);
1653 ret = BuildBcchConfig(&dlCfg->bcch_Config);
1659 ret = BuildPcchConfig(&dlCfg->pcch_Config);
1665 } /* BuildDlCfgCommSib */
1667 /*******************************************************************
1669 * @brief Builds SCS specific carrier list for UL
1673 * Function : BuildScsSpecificCarrierListUlSib
1676 * Builds SCS specific carrier list for UL
1679 * @return ROK - success
1682 * ****************************************************************/
1684 uint8_t BuildScsSpecificCarrierListUlSib(struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList)
1687 ScsSpecCarrier duScsSpecCarrier;
1689 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.ulScsCarrier;
1691 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
1692 if(!scsCarrierList->list.array)
1694 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
1698 for(idx = 0; idx < scsCarrierList->list.count; idx++)
1700 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
1701 if(!scsCarrierList->list.array[idx])
1703 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
1708 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
1709 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
1710 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
1713 } /* End of BuildScsSpecificCarrierListUlSib */
1715 /*******************************************************************
1717 * @brief Builds frequency infor for UL
1721 * Function : BuildFreqInfoUlSib
1724 * Builds frequency infor for UL
1726 * @params[in] FrequencyInfoUL_SIB_t pointer
1727 * @return ROK - success
1730 * ****************************************************************/
1732 uint8_t BuildFreqInfoUlSib(FrequencyInfoUL_SIB_t *frequencyInfoUL)
1737 ulCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
1739 /* Subcarrier Spacing specifc carrier */
1740 elementCnt = ODU_VALUE_ONE;
1741 frequencyInfoUL->scs_SpecificCarrierList.list.count = elementCnt;
1742 frequencyInfoUL->scs_SpecificCarrierList.list.size = \
1743 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1744 ret=BuildScsSpecificCarrierListUlSib(&frequencyInfoUL->scs_SpecificCarrierList);
1750 DU_ALLOC(frequencyInfoUL->p_Max, sizeof(P_Max_t));
1751 if(!frequencyInfoUL->p_Max)
1753 DU_LOG("\nERROR --> DU APP : UL Frequency Infoo memory allocation failure");
1756 *frequencyInfoUL->p_Max = ulCfg.pMax;
1759 }/* BuildFreqInfoUlSib */
1761 /*******************************************************************
1763 * @brief Builds RACH configuration common
1767 * Function : BuildRachCfgCommon
1770 * Builds RACH configuration common
1772 * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer
1773 * @return ROK - success
1776 * ****************************************************************/
1778 uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg)
1780 RachCfgCommon duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg;
1781 RACH_ConfigCommon_t *setup = NULLP;
1783 rachCfg->present = duRachCfg.present;
1784 switch(rachCfg->present)
1786 case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
1791 case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
1796 case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
1798 DU_ALLOC(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t));
1799 if(!rachCfg->choice.setup)
1801 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1804 setup = rachCfg->choice.setup;
1806 /* Generic RACH Configuration */
1807 setup->rach_ConfigGeneric.prach_ConfigurationIndex = duRachCfg.prachCfgIdx;
1808 setup->rach_ConfigGeneric.msg1_FDM = duRachCfg.msg1Fdm;
1809 setup->rach_ConfigGeneric.msg1_FrequencyStart = duRachCfg.msg1FreqStart;
1810 setup->rach_ConfigGeneric.zeroCorrelationZoneConfig = duRachCfg.zeroCorrZoneCfg;
1811 setup->rach_ConfigGeneric.preambleReceivedTargetPower = duRachCfg.preambleRcvdTgtPwr;
1812 setup->rach_ConfigGeneric.preambleTransMax = duRachCfg.preambleTransMax;
1813 setup->rach_ConfigGeneric.powerRampingStep = duRachCfg.pwrRampingStep;
1814 setup->rach_ConfigGeneric.ra_ResponseWindow = duRachCfg.raRspWindow;
1816 /* Total number of RA preambles */
1817 DU_ALLOC(setup->totalNumberOfRA_Preambles, sizeof(long));
1818 if(!setup->totalNumberOfRA_Preambles)
1820 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1823 *setup->totalNumberOfRA_Preambles = duRachCfg.numRaPreamble;
1825 /* SSB per RACH occassion and CB Preambles per SSB */
1826 DU_ALLOC(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
1827 sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
1828 if(!setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
1830 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1833 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present = duRachCfg.numSsbPerRachOcc;
1835 switch(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present)
1837 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_NOTHING:
1842 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth:
1847 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth:
1852 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf:
1857 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one:
1859 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one = \
1860 convertCbPreamblePerSsbValueToEnum(duRachCfg.numCbPreamblePerSsb);
1862 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two:
1867 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four:
1872 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight:
1877 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen:
1884 DU_LOG("\nERROR --> DU APP: Invalid value for ssb_PerRach_OccassionAndCB_PreamblesPerSSB");
1889 /* RA Contention Resolution Timer */
1890 setup->ra_ContentionResolutionTimer = duRachCfg.contResTimer;
1892 /* RSRP Threshold SSB */
1893 DU_ALLOC(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
1894 if(!setup->rsrp_ThresholdSSB)
1896 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1899 *setup->rsrp_ThresholdSSB = duRachCfg.rsrpThreshSsb;
1901 /* Root Sequence index */
1902 setup->prach_RootSequenceIndex.present = duRachCfg.rootSeqIdxPresent;
1903 switch(setup->prach_RootSequenceIndex.present)
1905 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_NOTHING:
1910 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839:
1915 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139:
1917 setup->prach_RootSequenceIndex.choice.l139 = duRachCfg.rootSeqIdx;
1922 DU_LOG("\nERROR --> DU APP: Inavlid PRACH root sequence index type");
1927 /* Msg 1 Subcarrier spacing */
1928 DU_ALLOC(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
1929 if(!setup->msg1_SubcarrierSpacing)
1931 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1934 *setup->msg1_SubcarrierSpacing = duRachCfg.msg1Scs;
1936 /* Restricted Set Config */
1937 setup->restrictedSetConfig = duRachCfg.restrictedSetCfg;
1943 DU_LOG("\nERROR --> DU APP : Invalid RACH Config type ");
1948 }/* BuildRachCfgCommon */
1950 /*******************************************************************
1952 * @brief Builds PUSCH configuration for common
1956 * Function : BuildPuschCfgCommon
1959 * Builds PUSCH configuration for common
1962 * @return ROK - success
1965 * ****************************************************************/
1967 uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg)
1970 uint8_t elementCnt = 0;
1971 PuschCfgCommon duPuschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.puschCfg;
1972 PUSCH_ConfigCommon_t *setup = NULLP;
1973 PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo = NULLP;
1976 puschCfg->present = duPuschCfg.puschCfgPresent;
1977 switch(puschCfg->present)
1979 case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
1984 case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
1989 case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
1991 DU_ALLOC(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
1992 if(!puschCfg->choice.setup)
1994 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1997 setup = puschCfg->choice.setup;
1999 /* Time Domain Resource Allocation List */
2000 DU_ALLOC(setup->pusch_TimeDomainAllocationList, sizeof(PUSCH_TimeDomainResourceAllocationList_t));
2001 if(!setup->pusch_TimeDomainAllocationList)
2003 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2006 elementCnt = duPuschCfg.numTimeDomRsrcAlloc;
2007 setup->pusch_TimeDomainAllocationList->list.count = elementCnt;
2008 setup->pusch_TimeDomainAllocationList->list.size = elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *);
2010 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array, setup->pusch_TimeDomainAllocationList->list.size);
2011 if(!setup->pusch_TimeDomainAllocationList->list.array)
2013 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2017 for(idx=0; idx<elementCnt; idx++)
2019 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array[idx],\
2020 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2021 if(!setup->pusch_TimeDomainAllocationList->list.array[idx])
2023 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2028 for(idx = 0; idx < elementCnt; idx++)
2030 timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx];
2033 DU_ALLOC(timeDomRsrcAllocInfo->k2, sizeof(long));
2034 if(!timeDomRsrcAllocInfo->k2)
2036 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2039 *timeDomRsrcAllocInfo->k2 = duPuschCfg.timeDomAllocList[idx].k2;
2040 timeDomRsrcAllocInfo->mappingType = duPuschCfg.timeDomAllocList[idx].mapType;
2041 timeDomRsrcAllocInfo->startSymbolAndLength = duPuschCfg.timeDomAllocList[idx].sliv;
2044 /* Msg3 Delta Preamble */
2045 DU_ALLOC(setup->msg3_DeltaPreamble, sizeof(long));
2046 if(!setup->msg3_DeltaPreamble)
2048 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2051 *setup->msg3_DeltaPreamble = duPuschCfg.msg3DeltaPreamble;
2053 /* P0 Nominal with grant */
2054 DU_ALLOC(setup->p0_NominalWithGrant, sizeof(long));
2055 if(!setup->p0_NominalWithGrant)
2057 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2060 *setup->p0_NominalWithGrant = duPuschCfg.p0NominalWithGrant;
2066 DU_LOG("\nERROR --> DU APP : Invalid PUSCH configuration type ");
2072 }/* BuildPuschCfgCommon */
2074 /*******************************************************************
2076 * @brief Builds PUCCH configuration common
2080 * Function : BuildPucchCfgCommon
2083 * Builds PUCCH configuration common
2086 * @return ROK - success
2089 * ****************************************************************/
2091 uint8_t BuildPucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg)
2093 PucchCfgCommon duPucchCfg;
2094 PUCCH_ConfigCommon_t *setup;
2096 duPucchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.pucchCfg;
2098 pucchCfg->present = duPucchCfg.present;
2099 switch(pucchCfg->present)
2101 case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
2106 case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
2111 case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
2113 DU_ALLOC(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
2114 if(!pucchCfg->choice.setup)
2116 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2119 setup = pucchCfg->choice.setup;
2121 /* Resource Common */
2122 DU_ALLOC(setup->pucch_ResourceCommon, sizeof(long));
2123 if(!setup->pucch_ResourceCommon)
2125 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2128 *setup->pucch_ResourceCommon = duPucchCfg.rsrcComm;
2131 setup->pucch_GroupHopping = duPucchCfg.grpHop;
2134 DU_ALLOC(setup->p0_nominal, sizeof(long));
2135 if(!setup->p0_nominal)
2137 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2140 *setup->p0_nominal = duPucchCfg.p0Nominal;
2146 DU_LOG("\nERROR --> DU APP : Invalid PUCCH Config type");
2151 }/* BuildPucchCfgCommon */
2153 /*******************************************************************
2155 * @brief Builds UL BWP Common
2159 * Function : BuildBwpUlCommon
2162 * Builds UL BWP Common
2164 * @params[in] BWP_UplinkCommon_t pointer
2165 * @return ROK - success
2168 * ****************************************************************/
2170 uint8_t BuildBwpUlCommon(BWP_UplinkCommon_t *bwp)
2172 UlCfgCommon duUlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
2174 /* Generic Parameters */
2175 bwp->genericParameters.locationAndBandwidth = duUlCfg.locAndBw;
2176 bwp->genericParameters.subcarrierSpacing = duUlCfg.ulScsCarrier.scs;
2178 /* RACH Config Common */
2179 DU_ALLOC(bwp->rach_ConfigCommon, sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2180 if(!bwp->rach_ConfigCommon)
2182 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2186 if((BuildRachCfgCommon(bwp->rach_ConfigCommon)) != ROK)
2188 DU_LOG("\nERROR --> DU APP : Failed to fill RACH config common in BuildBwpUlCommon()");
2191 RachCfgCommonret=ROK;
2193 /* PUSCH Config Common */
2194 DU_ALLOC(bwp->pusch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2195 if(!bwp->pusch_ConfigCommon)
2197 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2201 if((BuildPuschCfgCommon(bwp->pusch_ConfigCommon)) != ROK)
2203 DU_LOG("\nERROR --> DU APP : Failed to fill PUSCH config common in BuildBwpUlCommon()");
2206 PuschCfgCommonret = ROK;
2208 /* PUCCH Config Common */
2209 DU_ALLOC(bwp->pucch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2210 if(!bwp->pucch_ConfigCommon)
2212 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2216 if((BuildPucchCfgCommon(bwp->pucch_ConfigCommon)) != ROK)
2218 DU_LOG("\nERROR --> DU APP : Failed to fill PUCCH config common in BuildBwpUlCommon()");
2223 }/* BuildBwpUlCommon */
2225 /*******************************************************************
2227 * @brief Builds UL config common for SIB
2231 * Function : BuildUlCfgCommSib
2234 * Builds UL config common for SIB
2236 * @params[in] UplinkConfigCommonSIB_t pointer
2237 * @return ROK - success
2240 * ****************************************************************/
2242 uint8_t BuildUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2245 /* UL frequency info */
2246 ret = BuildFreqInfoUlSib(&ulCfg->frequencyInfoUL);
2251 /* BWP Uplink Common */
2252 ret = BuildBwpUlCommon(&ulCfg->initialUplinkBWP);
2257 /* Time Alignment timer */
2258 ulCfg->timeAlignmentTimerCommon = \
2259 duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.timeAlignTimerComm;
2262 }/* BuildUlCfgCommSib */
2264 /*******************************************************************
2266 * @brief Builds TDD UL DL configuration common
2270 * Function : BuildTddUlDlCfgComm
2273 * Builds TDD UL DL configuration common
2275 * @params[in] TDD_UL_DL_ConfigCommon_t pointer
2276 * @return ROK - success
2279 * ****************************************************************/
2281 uint8_t BuildTddUlDlCfgComm(TDD_UL_DL_ConfigCommon_t *tddCfg)
2283 TddUlDlCfgCommon duTddCfg = duCfgParam.sib1Params.srvCellCfgCommSib.tddCfg;
2285 /* Reference Subcarrier spacing */
2286 tddCfg->referenceSubcarrierSpacing = duTddCfg.refScs;
2289 tddCfg->pattern1.dl_UL_TransmissionPeriodicity = duTddCfg.txPrd;
2290 tddCfg->pattern1.nrofDownlinkSlots = duTddCfg.numDlSlots;
2291 tddCfg->pattern1.nrofDownlinkSymbols = duTddCfg.numDlSymbols;
2292 tddCfg->pattern1.nrofUplinkSlots = duTddCfg.numUlSlots;
2293 tddCfg->pattern1.nrofUplinkSymbols = duTddCfg.numUlSymbols;
2297 }/* BuildTddUlDlCfgComm */
2299 /*******************************************************************
2301 * @brief Builds Serving cell config common in SIB1 message
2305 * Function : BuildServCellCfgCommonSib
2308 * Building Serving cell config common in SIB1 message
2310 * @params[in] ServingCellConfigCommonSIB_t pointer
2311 * @return ROK - success
2314 * ****************************************************************/
2315 uint8_t BuildServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
2317 SrvCellCfgCommSib duSrvCellCfg;
2318 BIT_STRING_t *ssbPosInBurst;
2320 duSrvCellCfg = duCfgParam.sib1Params.srvCellCfgCommSib;
2322 /* SSB Position in Burst */
2323 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
2324 ssbPosInBurst->size = 1;
2325 DU_ALLOC(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
2326 if(!ssbPosInBurst->buf)
2328 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2331 ssbPosInBurst->buf[0] = duSrvCellCfg.ssbPosInBurst;
2332 ssbPosInBurst->bits_unused = 0;
2334 srvCellCfg->ssb_PeriodicityServingCell = convertSsbPeriodicityValueToEnumForSib(duSrvCellCfg.ssbPrdServingCell);
2335 srvCellCfg->ss_PBCH_BlockPower = duSrvCellCfg.ssPbchBlockPwr;
2337 /* Downlink config common */
2338 ret = BuildDlCfgCommSib(&srvCellCfg->downlinkConfigCommon);
2343 DlCfgCommSibret = ROK;
2345 /* Uplink Config Comm */
2346 DU_ALLOC(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
2347 if(!srvCellCfg->uplinkConfigCommon)
2349 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2352 ret = BuildUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
2357 UlCfgCommSibret=ROK;
2359 /* TDD UL DL Config Comm */
2360 DU_ALLOC(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
2361 if(!srvCellCfg->tdd_UL_DL_ConfigurationCommon)
2363 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2366 ret = BuildTddUlDlCfgComm(srvCellCfg->tdd_UL_DL_ConfigurationCommon);
2374 /*******************************************************************
2376 * @brief Builds SIB message in Served Cell Info
2380 * Function : BuildSib1Msg
2382 * Functionality: Building SIB message in Served Cell Info
2384 * @return ROK - success
2387 * ****************************************************************/
2388 uint8_t BuildSib1Msg()
2390 BCCH_DL_SCH_Message_t bcchMsg;
2392 CellAccessRelatedInfo_t *cellAccessInfo;
2395 asn_enc_rval_t encRetVal;
2396 uint8_t ret = RFAILED;
2400 bcchMsg.message.present = BCCH_DL_SCH_MessageType_PR_c1;
2402 DU_ALLOC(bcchMsg.message.choice.c1, sizeof(struct BCCH_DL_SCH_MessageType__c1));
2403 if(!bcchMsg.message.choice.c1)
2405 DU_LOG("\nERROR --> DU APP: BCCH-DL-SCH msg memory allocation failure");
2408 bcchMsg.message.choice.c1->present = BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1;
2409 DU_ALLOC(bcchMsg.message.choice.c1->choice.systemInformationBlockType1, sizeof(SIB1_t));
2410 if(!bcchMsg.message.choice.c1->choice.systemInformationBlockType1)
2412 DU_LOG("\nERROR --> DU APP: SIB1 msg memory allocation failure");
2415 sib1Msg = bcchMsg.message.choice.c1->choice.systemInformationBlockType1;
2416 elementCnt = ODU_VALUE_ONE;
2418 /* Cell Selection Info */
2419 DU_ALLOC(sib1Msg->cellSelectionInfo, sizeof(struct SIB1__cellSelectionInfo));
2420 if(!sib1Msg->cellSelectionInfo)
2422 DU_LOG("\nERROR --> DU APP: SIB1 Cell Selection Info memory allocation failed");
2426 sib1Msg->cellSelectionInfo->q_RxLevMin = -50;
2428 DU_ALLOC(sib1Msg->cellSelectionInfo->q_RxLevMinSUL, sizeof(Q_RxLevMin_t));
2429 if(!sib1Msg->cellSelectionInfo->q_RxLevMinSUL)
2431 DU_LOG("\nERROR --> DU APP: BuildSib1Msg(): Memory allocation failed for q_RxLevMinSUL");
2434 *(sib1Msg->cellSelectionInfo->q_RxLevMinSUL) = -50;
2436 DU_ALLOC(sib1Msg->cellSelectionInfo->q_QualMin, sizeof(Q_QualMin_t));
2437 if(!sib1Msg->cellSelectionInfo->q_QualMin)
2439 DU_LOG("\nERROR --> DU APP: BuildSib1Msg(): Memory allocation failed for q_QualMin");
2442 *(sib1Msg->cellSelectionInfo->q_QualMin) = -30;
2445 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
2446 cellAccessInfo->plmn_IdentityList.list.count = elementCnt;
2447 cellAccessInfo->plmn_IdentityList.list.size = elementCnt * sizeof(PLMN_IdentityInfo_t *);
2449 ret1 = BuildPlmnList(cellAccessInfo);
2454 /* Connection Establish Failure Control */
2455 DU_ALLOC(sib1Msg->connEstFailureControl, sizeof(ConnEstFailureControl_t));
2456 if(!sib1Msg->connEstFailureControl)
2458 DU_LOG("\nERROR --> DU APP: sib1Msg->connEstFailureControl memory allocation failure");
2461 sib1Msg->connEstFailureControl->connEstFailCount = duCfgParam.sib1Params.connEstFailCnt;
2462 sib1Msg->connEstFailureControl->connEstFailOffsetValidity = duCfgParam.sib1Params.connEstFailOffValidity;
2464 DU_ALLOC(sib1Msg->connEstFailureControl->connEstFailOffset, sizeof(long));
2465 if(!sib1Msg->connEstFailureControl->connEstFailOffset)
2467 DU_LOG("\nERROR --> DU APP: BuildSib1Msg(): Memory allocation failed for connEstFailOffset");
2470 *(sib1Msg->connEstFailureControl->connEstFailOffset) = duCfgParam.sib1Params.connEstFailOffset;
2472 /* SI Scheduling Info */
2473 DU_ALLOC(sib1Msg->si_SchedulingInfo, sizeof(SI_SchedulingInfo_t));
2474 if(!sib1Msg->si_SchedulingInfo)
2476 DU_LOG("\nERROR --> DU APP: sib1Msg->si_SchedulingInfo memory allocation failure");
2479 elementCnt = ODU_VALUE_ONE;
2480 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count = elementCnt;
2481 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size = elementCnt *
2482 sizeof(struct SchedulingInfo *);
2483 ret1 = BuildSiSchedInfoList(&sib1Msg->si_SchedulingInfo->schedulingInfoList);
2488 sib1Msg->si_SchedulingInfo->si_WindowLength = duCfgParam.sib1Params.siSchedInfo.winLen;
2490 /* Serving Cell Config Common */
2491 DU_ALLOC(sib1Msg->servingCellConfigCommon, sizeof(ServingCellConfigCommonSIB_t));
2492 if(!sib1Msg->servingCellConfigCommon)
2494 DU_LOG("\nERROR --> DU APP: sib1Msg->servingCellConfigCommon memory allocation failure");
2497 ret1 = BuildServCellCfgCommonSib(sib1Msg->servingCellConfigCommon);
2503 xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, &bcchMsg);
2505 /* Encode the F1SetupRequest type as APER */
2506 memset(encBuf, 0, ENC_BUF_MAX_LEN);
2508 encRetVal = uper_encode(&asn_DEF_BCCH_DL_SCH_Message, 0, &bcchMsg, PrepFinalEncBuf,\
2510 printf("\nencbufSize: %d\n", encBufSize);
2511 if(encRetVal.encoded == -1)
2513 DU_LOG("\nERROR --> DU APP : Could not encode BCCH-DL-SCH structure (at %s)\n",\
2514 encRetVal.failed_type ?
2515 encRetVal.failed_type->name :
2519 #ifdef DEBUG_ASN_PRINT
2520 for(int i=0; i< encBufSize; i++)
2522 printf("%x\t",encBuf[i]);
2531 FreeBcchDlSchMsg(bcchMsg);
2536 /*******************************************************************
2538 * @brief : deallocating the memory of BuildSib1Msg
2542 * Function : FreeFreqInfoDlSib
2544 * Functionality: Freeing memory of BuildFreqInfoDlSib
2546 * @params[in] : FrequencyInfoDL_SIB_t *frequencyInfoDL
2549 *******************************************************************/
2550 void FreeFreqInfoDlSib(FrequencyInfoDL_SIB_t *frequencyInfoDL)
2555 /* Free DL frequency info */
2556 if(frequencyInfoDL->frequencyBandList.list.array)
2558 /*Free Frequency band indicator */
2559 if(frequencyInfoDL->frequencyBandList.list.array[idx])
2561 if(frequencyInfoDL->frequencyBandList.list.array[idx]->\
2562 freqBandIndicatorNR)
2564 if(frequencyInfoDL->scs_SpecificCarrierList.list.array)
2566 for(idx1 = 0;idx1<frequencyInfoDL->scs_SpecificCarrierList.list.count;idx1++)
2568 if(frequencyInfoDL->scs_SpecificCarrierList.list.array[idx1])
2570 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.\
2571 array[idx1], sizeof(SCS_SpecificCarrier_t));
2574 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.array,
2575 frequencyInfoDL->scs_SpecificCarrierList.list.size);
2577 DU_FREE(frequencyInfoDL->frequencyBandList.list.\
2578 array[idx]->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
2581 for(idx = 0; idx <frequencyInfoDL->frequencyBandList.list.count; idx++)
2583 if(frequencyInfoDL->frequencyBandList.list.array[idx])
2585 DU_FREE(frequencyInfoDL->frequencyBandList.list.array[idx],\
2586 sizeof(NR_MultiBandInfo_t));
2589 DU_FREE(frequencyInfoDL->frequencyBandList.list.array,\
2590 frequencyInfoDL->frequencyBandList.list.size);
2593 /*******************************************************************
2595 * @brief : deallocating the memory of BuildSib1Msg
2599 * Function : FreeCommonSerachSpaceList
2601 * Functionality: deallocating the memory of BuildCommonSerachSpaceList
2603 * @params[in] :struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist
2606 *******************************************************************/
2607 void FreeCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList
2611 SearchSpace_t *searchSpace= NULLP;
2613 if(searchSpclist->list.array)
2615 if( searchSpclist->list.array[idx] != NULLP)
2617 searchSpace= searchSpclist->list.array[idx];
2618 if(searchSpace->controlResourceSetId)
2620 if(searchSpace->monitoringSlotPeriodicityAndOffset)
2622 if(searchSpace->monitoringSymbolsWithinSlot)
2624 if(searchSpace->monitoringSymbolsWithinSlot->buf)
2626 if(searchSpace->nrofCandidates)
2628 if(searchSpace->searchSpaceType)
2630 switch(searchSpace->searchSpaceType->present)
2632 case SearchSpace__searchSpaceType_PR_NOTHING:
2634 case SearchSpace__searchSpaceType_PR_common:
2636 if(searchSpace->searchSpaceType->choice.common)
2638 if(searchSpace->searchSpaceType->choice.\
2639 common->dci_Format0_0_AndFormat1_0)
2641 DU_FREE(searchSpace->searchSpaceType->choice.\
2642 common->dci_Format0_0_AndFormat1_0,sizeof(struct\
2643 SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
2645 DU_FREE(searchSpace->searchSpaceType->choice.common,\
2646 sizeof(struct SearchSpace__searchSpaceType__common));
2650 case SearchSpace__searchSpaceType_PR_ue_Specific:
2655 DU_FREE(searchSpace->searchSpaceType,\
2656 sizeof( struct SearchSpace__searchSpaceType));
2658 DU_FREE(searchSpace->nrofCandidates,\
2659 sizeof(struct SearchSpace__nrofCandidates));
2661 DU_FREE(searchSpace->monitoringSymbolsWithinSlot->buf,\
2662 searchSpace->monitoringSymbolsWithinSlot->size);
2664 DU_FREE(searchSpace->monitoringSymbolsWithinSlot,\
2665 sizeof(BIT_STRING_t));
2667 DU_FREE(searchSpace->monitoringSlotPeriodicityAndOffset,\
2668 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
2670 DU_FREE(searchSpace->controlResourceSetId,sizeof(ControlResourceSetId_t));
2673 for(idx = 0; idx < searchSpclist->list.count; idx++)
2675 if(searchSpclist->list.array[idx])
2677 DU_FREE(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
2680 DU_FREE(searchSpclist->list.array, searchSpclist->list.size)
2683 /*******************************************************************
2685 * @brief : deallocating the memory of BuildSib1Msg
2689 * Function : FreeBwpDlCommon
2691 * Functionality :Deallocating memory of BuildBwpDlCommon
2693 * @params[in] : BWP_DownlinkCommon_t *bwp
2697 *******************************************************************/
2698 void FreeBwpDlCommon(BWP_DownlinkCommon_t *bwp)
2701 struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg=bwp->pdsch_ConfigCommon;
2702 struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg=bwp->pdcch_ConfigCommon;
2703 pdcchCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg.present;
2704 pdschCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg.present;
2706 if(bwp->pdcch_ConfigCommon)
2708 if(bwp->pdsch_ConfigCommon)
2710 switch( pdschCfg->present)
2712 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
2717 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
2722 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
2724 if(pdschCfg->choice.setup)
2726 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList)
2728 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array)
2731 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2733 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!= NULLP)
2735 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0)
2737 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0,\
2742 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2744 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!=
2747 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx],\
2748 sizeof(PDSCH_TimeDomainResourceAllocation_t));
2751 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array,\
2752 pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.size);
2754 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList,\
2755 sizeof(PDSCH_TimeDomainResourceAllocationList_t));
2757 DU_FREE(pdschCfg->choice.setup,
2758 sizeof(PDSCH_ConfigCommon_t));
2764 DU_FREE(bwp->pdsch_ConfigCommon,\
2765 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
2768 switch(pdcchCfg->present)
2770 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
2775 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
2780 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
2782 if(pdcchCfg->choice.setup)
2784 /* Control Resource Set Zero */
2785 if( pdcchCfg->choice.setup->controlResourceSetZero)
2787 /* Search space zero */
2788 if( pdcchCfg->choice.setup->searchSpaceZero)
2790 /* Common Search Space List */
2791 if( pdcchCfg->choice.setup->commonSearchSpaceList)
2793 if(CommonSerachSpaceListret==ROK)
2795 if(pdcchCfg->choice.setup->searchSpaceSIB1)
2797 if(pdcchCfg->choice.setup->pagingSearchSpace)
2799 if(pdcchCfg->choice.setup->ra_SearchSpace)
2801 DU_FREE(pdcchCfg->choice.setup->ra_SearchSpace,
2802 sizeof(SearchSpaceId_t));
2804 DU_FREE( pdcchCfg->choice.setup->pagingSearchSpace,
2805 sizeof(SearchSpaceId_t));
2807 DU_FREE( pdcchCfg->choice.setup->searchSpaceSIB1,
2808 sizeof(SearchSpaceId_t));
2812 FreeCommonSerachSpaceList(pdcchCfg->choice.setup->commonSearchSpaceList);
2814 DU_FREE( pdcchCfg->choice.setup->commonSearchSpaceList,\
2816 PDCCH_ConfigCommon__commonSearchSpaceList));
2818 DU_FREE( pdcchCfg->choice.setup->searchSpaceZero,
2819 sizeof(SearchSpaceZero_t));
2821 DU_FREE( pdcchCfg->choice.setup->controlResourceSetZero,
2822 sizeof(ControlResourceSetZero_t));
2824 DU_FREE(pdcchCfg->choice.setup,
2825 sizeof(PDCCH_ConfigCommon_t));
2832 DU_FREE(bwp->pdcch_ConfigCommon,sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
2836 /*******************************************************************
2838 * @brief Free PUCCH configuration common
2842 * Function : FreePucchCfgCommon
2845 * Free PUCCH configuration common
2847 * @params[in] Pointer to struct BWP_UplinkCommon__pucch_ConfigCommon
2850 * ****************************************************************/
2851 void FreePucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg)
2853 PUCCH_ConfigCommon_t *setup;
2855 if(pucchCfg->choice.setup)
2857 setup = pucchCfg->choice.setup;
2859 /* Resource Common */
2860 DU_FREE(setup->pucch_ResourceCommon, sizeof(long));
2863 DU_FREE(setup->p0_nominal, sizeof(long));
2865 DU_FREE(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
2867 }/* FreePucchCfgCommon */
2869 /*******************************************************************
2871 * @brief Free PUSCH configuration for common
2875 * Function : FreePuschCfgCommon
2878 * Free PUSCH configuration for common
2880 * @params[in] Pointer to struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg
2883 * ****************************************************************/
2884 void FreePuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg)
2887 PUSCH_ConfigCommon_t *setup = NULLP;
2888 PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo = NULLP;
2890 if(puschCfg->choice.setup)
2892 setup = puschCfg->choice.setup;
2894 /* Time Domain Resource Allocation List */
2895 if(setup->pusch_TimeDomainAllocationList)
2897 if(setup->pusch_TimeDomainAllocationList->list.array)
2899 for(idx=0; idx < setup->pusch_TimeDomainAllocationList->list.count; idx++)
2901 if(setup->pusch_TimeDomainAllocationList->list.array[idx])
2903 timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx];
2906 DU_FREE(timeDomRsrcAllocInfo->k2, sizeof(long));
2907 DU_FREE(setup->pusch_TimeDomainAllocationList->list.array[idx],\
2908 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2911 DU_FREE(setup->pusch_TimeDomainAllocationList->list.array, setup->pusch_TimeDomainAllocationList->list.size);
2913 DU_FREE(setup->pusch_TimeDomainAllocationList, sizeof(PUSCH_TimeDomainResourceAllocationList_t));
2916 /* Msg3 Delta Preamble */
2917 DU_FREE(setup->msg3_DeltaPreamble, sizeof(long));
2919 /* P0 Nominal with grant */
2920 DU_FREE(setup->p0_NominalWithGrant, sizeof(long));
2922 DU_FREE(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
2924 }/* BuildPuschCfgCommon */
2926 /*******************************************************************
2928 * @brief Free RACH configuration common
2932 * Function : FreeRachCfgCommon
2935 * Free RACH configuration common
2937 * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer
2940 * ****************************************************************/
2942 void FreeRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg)
2944 RACH_ConfigCommon_t *setup = NULLP;
2946 if(rachCfg->choice.setup)
2948 setup = rachCfg->choice.setup;
2950 /* Total number of RA preambles */
2951 DU_FREE(setup->totalNumberOfRA_Preambles, sizeof(long));
2953 /* SSB per RACH occassion and CB Preambles per SSB */
2954 DU_FREE(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
2955 sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
2957 /* RSRP Threshold SSB */
2958 DU_FREE(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
2960 /* Msg 1 Subcarrier spacing */
2961 DU_FREE(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
2963 DU_FREE(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t));
2965 }/* FreeRachCfgCommon */
2967 /*******************************************************************
2969 * @brief Free UL BWP Common
2973 * Function : FreeBwpUlCommon
2976 * Free UL BWP Common
2978 * @params[in] BWP_UplinkCommon_t pointer
2981 * ****************************************************************/
2982 void FreeBwpUlCommon(BWP_UplinkCommon_t *bwp)
2984 /* RACH Config Common */
2985 if(bwp->rach_ConfigCommon)
2987 FreeRachCfgCommon(bwp->rach_ConfigCommon);
2988 DU_FREE(bwp->rach_ConfigCommon, sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2991 /* PUSCH Config Common */
2992 if(bwp->pusch_ConfigCommon)
2994 FreePuschCfgCommon(bwp->pusch_ConfigCommon);
2995 DU_FREE(bwp->pusch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2998 /* PUCCH Config Common */
2999 if(bwp->pucch_ConfigCommon)
3001 FreePucchCfgCommon(bwp->pucch_ConfigCommon);
3002 DU_FREE(bwp->pucch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
3004 }/* FreeBwpUlCommon */
3006 /*******************************************************************
3008 * @brief Free frequency infor for UL
3012 * Function : FreeFreqInfoUlSib
3015 * Free frequency infor for UL
3017 * @params[in] FrequencyInfoUL_SIB_t pointer
3020 * ****************************************************************/
3022 void FreeFreqInfoUlSib(FrequencyInfoUL_SIB_t *frequencyInfoUL)
3025 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList = &frequencyInfoUL->scs_SpecificCarrierList;
3027 /* Subcarrier Spacing specifc carrier */
3028 if(scsCarrierList->list.array)
3030 for(idx = 0; idx < scsCarrierList->list.count; idx++)
3032 DU_FREE(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
3034 DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
3038 DU_FREE(frequencyInfoUL->p_Max, sizeof(P_Max_t));
3039 }/* FreeFreqInfoUlSib */
3041 /*******************************************************************
3043 * @brief : Deallocating memory of SIB1 message
3047 * Function : FreeServCellCfgCommonSib
3049 * Functionality: Deallocating memory of BuildServCellCfgCommonSib
3051 * @params[in] : ServingCellConfigCommonSIB_t *srvCellCfg
3054 *******************************************************************/
3055 void FreeServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
3057 BIT_STRING_t *ssbPosInBurst = NULLP;
3058 DownlinkConfigCommonSIB_t *dlCfg = NULLP;
3059 UplinkConfigCommonSIB_t *ulCfg = NULLP;
3061 /* SSB Position in Burst buffer */
3062 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
3063 DU_FREE(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
3065 /* Free Donwlink config common SIB */
3066 dlCfg = &srvCellCfg->downlinkConfigCommon;
3067 FreeFreqInfoDlSib(&dlCfg->frequencyInfoDL);
3068 FreeBwpDlCommon(&dlCfg->initialDownlinkBWP);
3070 /* Uplink Config Comm */
3071 if(srvCellCfg->uplinkConfigCommon)
3073 ulCfg = srvCellCfg->uplinkConfigCommon;
3074 FreeFreqInfoUlSib(&ulCfg->frequencyInfoUL);
3075 FreeBwpUlCommon(&ulCfg->initialUplinkBWP);
3076 DU_FREE(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
3079 /* TDD UL DL Config Comm */
3080 DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
3083 /*******************************************************************
3085 * @brief : Deallcating memory of the function BuildSib1Msg
3089 * Function : FreeSib1Msg
3091 * Functionality: Deallcating memory of the function BuildSib1Msg
3093 * @params[in] ServingCellConfigCommonSIB_t pointer
3096 *******************************************************************/
3097 void FreeSib1Msg(SIB1_t *sib1Msg)
3101 uint8_t idx2=0, arrIdx =0, sibMapInfoIdx=0;
3102 CellIdentity_t *cellIdentity = NULLP;
3103 SchedulingInfo_t *schedInfo;
3104 CellAccessRelatedInfo_t *cellAccessInfo ;
3105 struct PLMN_IdentityInfo__plmn_IdentityList *plmnIdInfo;
3108 if(sib1Msg != NULLP)
3110 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
3111 if(cellAccessInfo->plmn_IdentityList.list.array !=NULLP)
3113 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3116 &cellAccessInfo->plmn_IdentityList.list.array[idx]->plmn_IdentityList;
3118 if(plmnIdInfo->list.array !=NULLP)
3120 if(plmnIdInfo->list.array[idx])
3122 if(plmnIdInfo->list.array[idx]->mcc)
3124 if((plmnIdInfo->list.array[idx]->mcc->list.array))
3126 if(plmnIdInfo->list.array[idx]->mnc.list.array)
3128 /*Free Tracking Area Code */
3129 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode)
3132 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf)
3134 /* Free CellIdentity */
3135 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac)
3138 =&cellAccessInfo->plmn_IdentityList.\
3139 list.array[idx]->cellIdentity;
3140 if(cellIdentity->buf)
3142 /*Free Connection Establish Failure Control */
3143 if(sib1Msg->connEstFailureControl)
3145 /*Free Serving Cell Config Common */
3146 if(sib1Msg->si_SchedulingInfo)
3148 /* Free Serving Cell Config Common* */
3149 if(sib1Msg->servingCellConfigCommon)
3151 /*Free BuildServCellCfgCommonSib*/
3152 FreeServCellCfgCommonSib(\
3153 sib1Msg->servingCellConfigCommon);
3155 DU_FREE(sib1Msg->servingCellConfigCommon,
3156 sizeof(ServingCellConfigCommonSIB_t));
3159 if(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array)
3161 for(arrIdx = 0; arrIdx < sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count; arrIdx++)
3163 schedInfo = sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array[arrIdx];
3164 if(schedInfo->sib_MappingInfo.list.array)
3166 for(sibMapInfoIdx = 0; sibMapInfoIdx< schedInfo->sib_MappingInfo.list.count; sibMapInfoIdx++)
3168 DU_FREE(schedInfo->sib_MappingInfo.list.array[sibMapInfoIdx]->valueTag, sizeof(long));
3169 DU_FREE(schedInfo->sib_MappingInfo.list.array[sibMapInfoIdx], sizeof(SIB_TypeInfo_t));
3171 DU_FREE(schedInfo->sib_MappingInfo.list.array, schedInfo->sib_MappingInfo.list.size)
3173 DU_FREE(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array[arrIdx], sizeof(struct SchedulingInfo));
3175 DU_FREE(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array,\
3176 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size);
3179 DU_FREE(sib1Msg->si_SchedulingInfo,
3180 sizeof(SI_SchedulingInfo_t));
3183 DU_FREE(sib1Msg->connEstFailureControl,
3184 sizeof(ConnEstFailureControl_t));
3186 DU_FREE(cellIdentity->buf,cellIdentity->size);
3189 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac, sizeof(RAN_AreaCode_t));
3192 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf,\
3193 cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->size);
3196 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode\
3197 , sizeof(TrackingAreaCode_t));
3200 for(idx2=0; idx2<plmnIdInfo->list.array[idx1]->mnc.list.count; idx2++)
3202 if(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])
3204 DU_FREE(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
3205 sizeof(MCC_MNC_Digit_t));
3208 DU_FREE(plmnIdInfo->list.array[idx]->mnc.list.array,
3209 plmnIdInfo->list.array[idx1]->mnc.list.size);
3212 for(idx1=0; idx1<plmnIdInfo->list.array[idx]->mcc->list.count; idx1++)
3214 if(plmnIdInfo->list.array[idx]->mcc->list.array[idx1]!=NULLP)
3216 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array[idx1],\
3217 sizeof(MCC_MNC_Digit_t));
3221 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array,\
3222 plmnIdInfo->list.array[idx]->mcc->list.size)
3224 DU_FREE(plmnIdInfo->list.array[idx]->mcc,sizeof(MCC_t));
3227 for(idx1=0; idx1<plmnIdInfo->list.count; idx1++)
3229 if((plmnIdInfo->list.array[idx1]))
3231 DU_FREE(plmnIdInfo->list.array[idx1],
3232 sizeof(PLMN_IdentitY_t));
3235 DU_FREE(plmnIdInfo->list.array, plmnIdInfo->list.size);
3238 for(idx=0; idx<cellAccessInfo->plmn_IdentityList.list.count; idx++)
3240 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3242 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx],
3243 sizeof(PLMN_IdentityInfo_t));
3246 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array,
3247 cellAccessInfo->plmn_IdentityList.list.size);
3249 DU_FREE(sib1Msg, sizeof(SIB1_t));
3254 /*******************************************************************
3256 * @brief : Deallocation of BCCH_DL_SCH_Message_t
3260 * Function : FreeBcchDlSchMsg
3262 * Functionality: Freeing memory of BCCH DL SCH Message
3264 * @params[in] : BCCH_DL_SCH_Message_t bcchMsg
3267 *******************************************************************/
3268 void FreeBcchDlSchMsg(BCCH_DL_SCH_Message_t bcchMsg)
3270 switch(bcchMsg.message.present)
3272 case BCCH_DL_SCH_MessageType_PR_c1:
3274 switch(bcchMsg.message.choice.c1->present)
3276 case BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1:
3278 FreeSib1Msg(bcchMsg.message.choice.c1->choice.systemInformationBlockType1);
3281 case BCCH_DL_SCH_MessageType__c1_PR_systemInformation:
3283 case BCCH_DL_SCH_MessageType__c1_PR_NOTHING:
3286 DU_FREE(bcchMsg.message.choice.c1, sizeof(struct BCCH_DL_SCH_MessageType__c1));
3289 case BCCH_DL_SCH_MessageType_PR_messageClassExtension:
3291 case BCCH_DL_SCH_MessageType_PR_NOTHING:
3296 /**********************************************************************
3298 **********************************************************************/