ecf04e73f18298cd677859197cd131db513ac9f3
[o-du/l2.git] / src / du_app / du_sys_info_hdl.c
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
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                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
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 *******************************************************************************/
18
19 /* This file contains ASN codec for MIB and SIB1 msgs */
20 #include "common_def.h"
21 #include "lrg.h"
22 #include "lkw.x"
23 #include "lrg.x"
24 #include "legtp.h"
25 #include "du_app_mac_inf.h"
26 #include "du_cfg.h"
27 #include "du_utils.h"
28 #include "BCCH-BCH-Message.h"
29 #include "MIB.h"
30 #include "PLMN-IdentityInfo.h"
31 #include "PLMN-IdentitY.h"
32 #include "SIB-TypeInfo.h"
33 #include "SchedulingInfo.h"
34 #include "SI-SchedulingInfo.h"
35 #include "ConnEstFailureControl.h"
36 #include "FrequencyInfoDL-SIB.h"
37 #include "SearchSpace.h"
38 #include "SCS-SpecificCarrier.h"
39 #include "NR-MultiBandInfo.h"
40 #include "PDCCH-ConfigCommon.h"
41 #include "PDSCH-TimeDomainResourceAllocation.h"
42 #include "PDSCH-TimeDomainResourceAllocationList.h"
43 #include "PDSCH-ConfigCommon.h"
44 #include "BWP-DownlinkCommon.h"
45 #include "DownlinkConfigCommonSIB.h"
46 #include "RACH-ConfigCommon.h"
47 #include "PUSCH-TimeDomainResourceAllocation.h"
48 #include "PUSCH-TimeDomainResourceAllocationList.h"
49 #include "PUSCH-ConfigCommon.h"
50 #include "PUCCH-ConfigCommon.h"
51 #include "UplinkConfigCommonSIB.h"
52 #include "TDD-UL-DL-ConfigCommon.h"
53 #include "ServingCellConfigCommonSIB.h"
54 #include "MCC.h"
55 #include "SIB1.h"
56 #include "odu_common_codec.h"
57 #include "du_sys_info_hdl.h"
58
59 void FreeSib1Msg(SIB1_t *sib1Msg);
60 uint8_t FreqInfoUlret = RFAILED;
61 uint8_t RachCfgCommonret = RFAILED;
62 uint8_t PuschCfgCommonret = RFAILED;
63 uint8_t UlCfgCommSibret = RFAILED;
64 uint8_t FreqInfoDlret = RFAILED;
65 uint8_t DlCfgCommSibret = RFAILED;
66 uint8_t CommonSerachSpaceListret = RFAILED;
67
68 /*******************************************************************
69  *
70  * @brief Builds MIB
71  *
72  * @details
73  *
74  *    Function : BuildMib
75  *
76  *    Functionality: Building MIB
77  *
78  * @return ROK     - success
79  *         RFAILED - failure
80  *
81  * ****************************************************************/
82 uint8_t BuildMib(MIB_t *mib)
83 {
84    mib->systemFrameNumber.size = sizeof(uint8_t);
85    DU_ALLOC(mib->systemFrameNumber.buf, mib->systemFrameNumber.size);
86    if(!(mib->systemFrameNumber.buf))
87    {
88       DU_LOG("\nERROR  -->  DU APP: MIB msg memory allocation failure");
89       return RFAILED;
90    }
91
92    *(mib->systemFrameNumber.buf) =  duCfgParam.mibParams.sysFrmNum;
93    mib->systemFrameNumber.bits_unused = ODU_VALUE_TWO;
94
95    mib->subCarrierSpacingCommon = duCfgParam.mibParams.subCarrierSpacingCommon;
96    mib->ssb_SubcarrierOffset = duCfgParam.mibParams.ssb_SubcarrierOffset;
97    mib->dmrs_TypeA_Position = duCfgParam.mibParams.dmrs_TypeA_Position;
98    mib->pdcch_ConfigSIB1.controlResourceSetZero = duCfgParam.mibParams.controlResourceSetZero;
99    mib->pdcch_ConfigSIB1.searchSpaceZero = duCfgParam.mibParams.searchSpaceZero;
100    mib->cellBarred = duCfgParam.mibParams.cellBarred;
101    mib->intraFreqReselection = duCfgParam.mibParams.intraFreqReselection;
102    mib->spare.size = sizeof(uint8_t);
103    DU_ALLOC(mib->spare.buf, mib->spare.size);
104    if(!mib->spare.buf)
105    {
106       DU_LOG("\nERROR  -->  DU APP: MIB msg memory allocation failure");
107       return RFAILED;
108    }
109    *(mib->spare.buf) = SPARE;
110    mib->spare.bits_unused = ODU_VALUE_SEVEN;
111    return ROK;
112 }
113 /*******************************************************************
114  *
115  * @brief Free MIB PDU for broadcast
116  *
117  * @details
118  *
119  *    Function : FreeMibPdu
120  *
121  *    Functionality: Deallocating MIB PDU for system broadcast
122  *
123  * @param[in]: BCCH_BCH_Message_t *bcchMsg
124  *
125  * @return void         
126  *
127  * ****************************************************************/
128 void FreeMibPdu(BCCH_BCH_Message_t *bcchMsg)
129 {
130    if(!bcchMsg)
131    {
132       if(!bcchMsg->message.choice.mib)
133       {
134          if(!(bcchMsg->message.choice.mib->systemFrameNumber.buf))
135          {
136             if(!bcchMsg->message.choice.mib->spare.buf)
137             {
138                DU_FREE(bcchMsg->message.choice.mib->spare.buf,\
139                      bcchMsg->message.choice.mib->spare.size);
140             }
141             DU_FREE(bcchMsg->message.choice.mib->systemFrameNumber.buf,
142                   bcchMsg->message.choice.mib->systemFrameNumber.size);
143          }
144          DU_FREE(bcchMsg->message.choice.mib, sizeof(MIB_t));
145       }
146       DU_FREE(bcchMsg, sizeof(BCCH_BCH_Message_t));
147    }
148 }
149 /*******************************************************************
150  *
151  * @brief Builds MIB PDU for broadcast
152  *
153  * @details
154  *
155  *    Function : BuildMibPdu
156  *
157  *    Functionality: Building MIB PDU for system broadcast
158  *
159  * @return ROK     - success
160  *         RFAILED - failure
161  *
162  * ****************************************************************/
163 uint8_t BuildMibPdu()
164 {
165    uint8_t ret = RFAILED;
166    BCCH_BCH_Message_t *bcchMsg;
167    asn_enc_rval_t encRetVal;        /* Encoder return value */
168    while(true)
169    {
170       DU_ALLOC(bcchMsg, sizeof(BCCH_BCH_Message_t));
171       if(!bcchMsg)
172       {
173          DU_LOG("\nERROR  -->  Memory allocation failure in BuildMibPdu");
174          break;
175       }
176
177       bcchMsg->message.present = BCCH_BCH_MessageType_PR_mib;
178       DU_ALLOC(bcchMsg->message.choice.mib, sizeof(MIB_t));
179       if(!bcchMsg->message.choice.mib)
180       {
181          DU_LOG("\nERROR  -->  Memory allocation failure in BuildMibPdu");
182          break;
183       }
184       if(BuildMib(bcchMsg->message.choice.mib) != ROK)
185       {
186          break;
187       }
188       xer_fprint(stdout, &asn_DEF_BCCH_BCH_Message, bcchMsg);
189       memset(encBuf, 0, ENC_BUF_MAX_LEN);
190       encBufSize = 0;
191       encRetVal = aper_encode(&asn_DEF_BCCH_BCH_Message, 0,
192             bcchMsg, PrepFinalEncBuf, encBuf);
193       printf("\nencbufSize:%d\n", encBufSize);
194       if(encRetVal.encoded == -1) 
195       {   
196          DU_LOG("\nERROR  -->  DU APP: Could not encode BCCH BCH Message Type structure(at %s)\n", 
197                encRetVal.failed_type?\
198                encRetVal.failed_type->name
199                :"unknown");
200          break;
201       }    
202
203       /* Print encoded buffer */
204       for(int i=0; i< encBufSize; i++)
205       {
206          printf("%x\t",encBuf[i]);
207       } 
208       printf("\n");
209
210       ret = ROK;
211       break;
212    }
213    /* Free allocated memory */
214    FreeMibPdu(bcchMsg);
215
216    return ret;
217
218 }
219 /*******************************************************************
220  *
221  * @brief free MIB message in Served Cell Info
222  *
223  * @details
224  *
225  *    Function : FreeMibMsg
226  *
227  *    Functionality: deallocating MIB message in Served Cell Info
228  *
229  * @param[in]   MIB_t *mibMsg
230  *
231  * @return void
232  *        
233  *
234  * ****************************************************************/
235 void FreeMibMsg( MIB_t *mibMsg)
236 {
237    if(!mibMsg)
238    {
239       if(!(mibMsg->systemFrameNumber.buf))
240       {   
241          if(!mibMsg->spare.buf)
242          {
243             DU_FREE(mibMsg->spare.buf, mibMsg->spare.size);
244          }
245          DU_FREE(mibMsg->systemFrameNumber.buf,
246                mibMsg->systemFrameNumber.size);
247       }
248       DU_FREE(mibMsg, sizeof(MIB_t));
249    }
250 }
251 /*******************************************************************
252  *
253  * @brief Builds MIB message in Served Cell Info
254  *
255  * @details
256  *
257  *    Function : BuildMibMsg
258  *
259  *    Functionality: Building MIB message in Served Cell Info
260  *
261  * @return ROK     - success
262  *         RFAILED - failure
263  *
264  * ****************************************************************/
265 uint8_t BuildMibMsg()
266 {
267    MIB_t          *mibMsg;
268    asn_enc_rval_t encRetVal;        /* Encoder return value */
269    uint8_t ret = RFAILED;
270    while(true)
271    {
272       DU_ALLOC(mibMsg, sizeof(MIB_t));
273       if(!mibMsg)
274       {
275          DU_LOG("\nERROR  -->  DU APP: MIB msg memory allocation failure");
276          return RFAILED;
277       }
278       if(BuildMib(mibMsg) != ROK)
279       {
280          break;
281       }
282       xer_fprint(stdout, &asn_DEF_MIB, mibMsg);
283       memset(encBuf, 0, ENC_BUF_MAX_LEN);
284       encBufSize = 0;
285       encRetVal = aper_encode(&asn_DEF_MIB, 0,
286             mibMsg, PrepFinalEncBuf, encBuf);
287       printf("\nencbufSize:%d\n", encBufSize);
288       if(encRetVal.encoded      == -1) 
289       {   
290          DU_LOG("\nERROR  -->  DU APP: Could not encode MIB structure(at %s)\n", 
291                encRetVal.failed_type?\
292                encRetVal.failed_type->name
293                :"unknown");
294          break;
295       }  
296
297       /* Print encoded buffer */
298       for(int i=0; i< encBufSize; i++)
299       {
300          printf("%x\t",encBuf[i]);
301       } 
302       printf("\n");
303
304       /* Free allocated memory */
305       ret = ROK;
306       break;
307    }
308
309    FreeMibMsg(mibMsg);
310
311    return ret;
312
313 }
314
315 /*******************************************************************
316  *
317  * @brief Builds CellIdentity  within SIB1 message
318  *
319  * @details
320  *
321  *    Function : BuildCellIdentity
322  *
323  *    Functionality: Building RAN area code in SIB1 message 
324  *
325  * @params[in] RAN_AreaCode_t **ranAreaCode 
326  * @return ROK     - success
327  *         RFAILED - failure
328  *
329  * ****************************************************************/
330 uint8_t BuildCellIdentity(CellIdentity_t  *cellIdentity)
331 {
332    cellIdentity->size = ODU_VALUE_FIVE*sizeof(uint8_t);
333    cellIdentity->bits_unused = ODU_VALUE_FOUR;
334
335    DU_ALLOC(cellIdentity->buf, cellIdentity->size);
336    if(!cellIdentity->buf)
337    {   
338       DU_LOG("\nERROR  -->  DU APP: CellIdentity memory allocation failure");
339       return RFAILED;
340    }
341    memset(cellIdentity->buf, 0,  cellIdentity->size);
342    cellIdentity->buf[4] = duCfgParam.sib1Params.cellIdentity;
343
344    return ROK;
345 }
346 /*******************************************************************
347  *
348  * @brief Builds RANAC within SIB1 message
349  *
350  * @details
351  *
352  *    Function : BuildRanac
353  *
354  *    Functionality: Building RAN area code in SIB1 message 
355  *
356  * @params[in] RAN_AreaCode_t **ranAreaCode 
357  * @return ROK     - success
358  *         RFAILED - failure
359  *
360  * ****************************************************************/
361 uint8_t BuildRanac(RAN_AreaCode_t **ranAreaCode)
362 {
363    RAN_AreaCode_t *ranac;
364    DU_ALLOC(ranac, sizeof(RAN_AreaCode_t));
365    if(!ranac)
366    {   
367       DU_LOG("\nERROR  -->  DU APP: RANAC memory allocation failure");
368       return RFAILED;
369    }   
370    *ranac = duCfgParam.sib1Params.ranac;
371    *ranAreaCode = ranac;
372    return ROK;
373 }
374 /*******************************************************************
375  *
376  * @brief Builds TAC within SIB1 message
377  *
378  * @details
379  *
380  *    Function : BuildTac
381  *
382  *    Functionality: Building Tracking area code in SIB1 message 
383  *
384  * @params[in] TrackingAreaCode_t **tac 
385  * @return ROK     - success
386  *         RFAILED - failure
387  *
388  * ****************************************************************/
389 uint8_t BuildTac(TrackingAreaCode_t **trackAreaCode)
390 {
391    TrackingAreaCode_t *tac;
392
393
394    DU_ALLOC(tac, sizeof(TrackingAreaCode_t));
395    if(!tac)
396    {   
397       DU_LOG("\nERROR  -->  DU APP: TAC memory allocation failure");
398       return RFAILED;
399    }   
400
401    tac->size = ODU_VALUE_THREE*sizeof(uint8_t);
402    DU_ALLOC(tac->buf, tac->size);
403    if(!tac->buf)
404    {   
405       DU_LOG("\nERROR  -->  DU APP: TAC memory allocation failure");
406       return RFAILED;
407    }   
408    *(tac->buf) = duCfgParam.sib1Params.tac;
409    tac->bits_unused = ODU_VALUE_ZERO;
410    *trackAreaCode = tac;
411
412    return ROK;
413 }
414
415 /*******************************************************************
416  *
417  * @brief Builds PLMN list within SIB1 message
418  *
419  * @details
420  *
421  *    Function : BuildPlmnList
422  *
423  *    Functionality: Building PLMN list in SIB1 message 
424  *
425  * @params[in] CellAccessRelatedInfo_t *cellAccessInfo 
426  * @return ROK     - success
427  *         RFAILED - failure
428  *
429  * ****************************************************************/
430 uint8_t BuildPlmnList(CellAccessRelatedInfo_t *cellAccessInfo)
431 {
432    uint8_t            idx;
433    uint8_t            idx1;
434    uint8_t            idx2;
435    uint8_t            elementCnt;
436    TrackingAreaCode_t **tac;
437    RAN_AreaCode_t     **ranac;
438    CellIdentity_t     *cellIdentity;
439    uint8_t            ret;      
440    struct PLMN_IdentityInfo__plmn_IdentityList
441       *plmnIdInfo;
442
443    DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array,
444          cellAccessInfo->plmn_IdentityList.list.size);
445    if(!cellAccessInfo->plmn_IdentityList.list.array)
446    {   
447       DU_LOG("\nERROR  -->  DU APP: BuildPlmnList memory allocation failure");
448       return RFAILED;
449    }   
450    elementCnt = cellAccessInfo->plmn_IdentityList.list.count; 
451    for(idx=0; idx<elementCnt; idx++)
452    {   
453       DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array[idx],
454             sizeof(PLMN_IdentityInfo_t));
455       if(!cellAccessInfo->plmn_IdentityList.list.array[idx])
456       {
457          DU_LOG("\nERROR  -->  DU APP: BuildPlmnList memory allocation failure");
458          return RFAILED;
459       }
460    }
461
462    idx = 0;
463    /* PLMN list */
464    elementCnt = ODU_VALUE_ONE;
465
466    plmnIdInfo = &cellAccessInfo->plmn_IdentityList.list.array[idx]->\
467                 plmn_IdentityList;
468    plmnIdInfo->list.count = elementCnt;
469    plmnIdInfo->list.size  = elementCnt * sizeof(PLMN_IdentitY_t *);
470    DU_ALLOC(plmnIdInfo->list.array, plmnIdInfo->list.size);
471    if(!plmnIdInfo->list.array)
472    {
473       DU_LOG("\nERROR  -->  DU APP: BuildPlmnList memory allocation failure");
474       return RFAILED;
475    }
476
477    for(idx1=0; idx1<elementCnt; idx1++)
478    {
479       DU_ALLOC(plmnIdInfo->list.array[idx1],
480             sizeof(PLMN_IdentitY_t));
481       if(!(plmnIdInfo->list.array[idx1]))
482       {
483          DU_LOG("\nERROR  -->  DU APP: BuildPlmnList memory allocation failure");
484          return RFAILED;
485       }
486    }
487    idx1 = 0;
488    DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc,
489          sizeof(MCC_t));
490    if(!plmnIdInfo->list.array[idx1]->mcc)
491    {
492       DU_LOG("\nERROR  -->  DU APP: BuildPlmnList memory allocation failure");
493       return RFAILED;
494    }
495
496    elementCnt = ODU_VALUE_THREE;
497    plmnIdInfo->list.array[idx1]->mcc->list.count = elementCnt;
498    plmnIdInfo->list.array[idx1]->mcc->list.size =\
499    elementCnt * sizeof(MCC_MNC_Digit_t *);
500    DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array,
501          plmnIdInfo->list.array[idx1]->mcc->list.size)
502       if(!(plmnIdInfo->list.array[idx1]->mcc->list.array))
503       {
504          DU_LOG("\nERROR  -->  DU APP: BuildPlmnList memory allocation failure");
505          return RFAILED;
506       }
507    for(idx2=0; idx2<elementCnt; idx2++)
508    {
509       DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2],
510             sizeof(MCC_MNC_Digit_t));
511       if(!plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])
512       {
513          DU_LOG("\nERROR  -->  DU APP: BuildPlmnList memory allocation failure");
514          return RFAILED;
515       }
516       *(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])=\
517       duCfgParam.sib1Params.plmn.mcc[idx2];
518    }
519    idx2 = 0;
520    plmnIdInfo->list.array[idx1]->mnc.list.count = elementCnt;
521    plmnIdInfo->list.array[idx1]->mnc.list.size =\
522    elementCnt * sizeof(MCC_MNC_Digit_t *);
523    DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array,\
524    plmnIdInfo->list.array[idx1]->mnc.list.size);
525    if(!plmnIdInfo->list.array[idx1]->mnc.list.array)
526    {
527       DU_LOG("\nERROR  -->  DU APP: BuildPlmnList memory allocation failure");
528       return RFAILED;
529    }
530    for(idx2=0; idx2<elementCnt; idx2++)
531    {
532       DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
533             sizeof(MCC_MNC_Digit_t));
534       if(!plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])
535       {
536          DU_LOG("\nERROR  -->  DU APP: BuildPlmnList memory allocation failure");
537          return RFAILED;
538       }
539       *(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])=\
540       duCfgParam.sib1Params.plmn.mnc[idx2];
541    }
542
543    /* Tracking Area Code */
544    tac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode;
545    ret = BuildTac(tac);
546    if(ret != ROK)
547    {
548       return RFAILED;
549    }
550
551    /* RANAC */
552    ranac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac;
553    ret=BuildRanac(ranac);
554    if(ret != ROK)
555    {
556       return RFAILED;
557    }
558
559    /* CellIdentity */
560    cellIdentity = &cellAccessInfo->plmn_IdentityList.list.array[idx]->cellIdentity;
561    ret=BuildCellIdentity(cellIdentity);
562    if(ret != ROK)
563    {
564       return RFAILED;
565    }
566
567    /* cellReservedForOperatorUse */
568    cellAccessInfo->plmn_IdentityList.list.array[idx]->\
569    cellReservedForOperatorUse = duCfgParam.sib1Params.cellResvdForOpUse;
570
571
572    return ROK;
573 }
574
575 /*******************************************************************
576  *
577  * @brief  Build SIB Map Info List
578  *
579  * @details
580  *
581  *    Function : BuildSibMapInfoList
582  *
583  *    Functionality:
584  *       Build SIB MapInfo List
585  *
586  * @params[in] SIB_Mapping_t pointer
587  * @return ROK     - success
588  *         RFAILED - failure
589  *
590  * ****************************************************************/
591 uint8_t BuildSibMapInfoList(SIB_Mapping_t *sibMapInfo)
592 {
593    uint8_t   itr;         /* List iterator */
594    uint8_t   elementCnt;  /* Number of elements in list */
595    SIB_TypeInfo_t *sibTypeInfo;  /* Scheduling info */
596
597    /* SI scheduling info list */
598    DU_ALLOC(sibMapInfo->list.array, sibMapInfo->list.size);
599    if(!sibMapInfo->list.array)
600    {
601       DU_LOG("\nERROR  -->  DU APP: BuildSibMapInfoList memory allocation failure");
602       return RFAILED;
603    }
604
605    elementCnt = sibMapInfo->list.count;
606    for(itr = 0; itr < elementCnt; itr++)
607    {
608       DU_ALLOC(sibMapInfo->list.array[itr], sizeof(SIB_TypeInfo_t));
609       if(!sibMapInfo->list.array[itr])
610       {
611          DU_LOG("\nERROR  -->  DU APP: BuildSibMapInfoList memory allocation failure");
612          return RFAILED;
613       }
614    }
615
616    itr = 0;
617    sibTypeInfo = sibMapInfo->list.array[itr];
618    sibTypeInfo->type = duCfgParam.sib1Params.siSchedInfo.sibType;
619    DU_ALLOC(sibTypeInfo->valueTag, sizeof(long));
620    if(!sibTypeInfo->valueTag)
621    {
622       DU_LOG("\nERROR  -->  DU APP: BuildSibMapInfoList memory allocation failure");
623       return RFAILED;
624    }
625
626    *sibTypeInfo->valueTag = duCfgParam.sib1Params.siSchedInfo.sibValTag;
627
628    return ROK;
629 }
630
631 /*******************************************************************
632  *
633  * @brief Builds SI Scheduling info list within SIB1 message 
634  *
635  * @details
636  *
637  *    Function : BuildSiSchedInfoList 
638  *
639  *    Functionality: 
640  *        Building SI Scheduling info list in SIB1 message
641  *
642  * @params[in] struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfo
643  * @return ROK     - success
644  *         RFAILED - failure
645  *
646  * ****************************************************************/
647 uint8_t BuildSiSchedInfoList(struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfoList)
648 {
649    uint8_t   itr;         /* List iterator */
650    uint8_t   elementCnt;  /* Number of elements in list */
651    uint8_t   ret;
652    SchedulingInfo_t *schedInfo;  /* Scheduling info */
653
654    /* SI scheduling info list */
655    DU_ALLOC(si_SchedulingInfoList->list.array, si_SchedulingInfoList->list.size);
656    if(!si_SchedulingInfoList->list.array)
657    {
658       DU_LOG("\nERROR  -->  DU APP: BuildSiSchedInfoList memory allocation failure");
659       return RFAILED;
660    }
661
662    elementCnt = si_SchedulingInfoList->list.count;
663    for(itr = 0; itr < elementCnt; itr++)
664    {
665       DU_ALLOC(si_SchedulingInfoList->list.array[itr], sizeof(struct SchedulingInfo));
666       if(!si_SchedulingInfoList->list.array[itr])
667       {
668          DU_LOG("\nERROR  -->  DU APP: BuildSiSchedInfoList memory allocation failure");
669          return RFAILED;
670       }
671    }
672
673    itr = 0;
674    schedInfo = si_SchedulingInfoList->list.array[itr];
675    schedInfo->si_BroadcastStatus = duCfgParam.sib1Params.siSchedInfo.broadcastSta;
676    schedInfo->si_Periodicity = duCfgParam.sib1Params.siSchedInfo.preiodicity;
677
678    elementCnt = ODU_VALUE_ONE; 
679    schedInfo->sib_MappingInfo.list.count = elementCnt;
680    schedInfo->sib_MappingInfo.list.size = elementCnt * sizeof(SIB_TypeInfo_t *);
681
682    ret = BuildSibMapInfoList(&schedInfo->sib_MappingInfo);
683    if(ret != ROK)
684    {
685       return RFAILED;
686    }
687
688    return ROK;
689 }
690
691 /*******************************************************************
692  *
693  * @brief Builds SCS Specific carrier list for DL 
694  *
695  * @details
696  *
697  *    Function : BuildScsSpecificCarrierListDl
698  *
699  *    Functionality:
700  *       Builds Subcarrier specific carrier list for downlink
701  *
702  * @params[in] FrequencyInfoDL_SIB__scs_SpecificCarrierList pointer
703  * @return ROK     - success
704  *         RFAILED - failure
705  *
706  * ****************************************************************/
707 uint8_t BuildScsSpecificCarrierListDl( struct FrequencyInfoDL_SIB__scs_SpecificCarrierList *scsCarrierList)
708 {
709    uint8_t idx;
710    ScsSpecCarrier   duScsSpecCarrier;
711
712    duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.dlScsCarrier;
713
714    DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
715    if(!scsCarrierList->list.array)
716    {
717       DU_LOG("\nERROR  -->  DU APP : SCS Specific Carrier list memory allocation failed"); 
718       return RFAILED;
719    }
720
721    for(idx = 0; idx < scsCarrierList->list.count; idx++)
722    {
723       DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
724       if(!scsCarrierList->list.array[idx])
725       {
726          DU_LOG("\nERROR  -->  DU APP : SCS Specific Carrier list memory allocation failed");
727          return RFAILED;
728       }
729    }
730
731    idx = 0;
732    scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset; 
733    scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
734    scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
735
736    return ROK;
737 } /* End of BuildScsSpecificCarrierListDl */
738
739 /*******************************************************************
740  *
741  * @brief Builds common search space list 
742  *
743  * @details
744  *
745  *    Function : BuildCommonSerachSpaceList
746  *
747  *    Functionality:
748  *      Builds common search space list
749  *
750  * @params[in] PDCCH_ConfigCommon__commonSearchSpaceList pointer
751  * @return ROK     - success
752  *         RFAILED - failure
753  *
754  * ****************************************************************/
755 uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist)
756 {
757    uint8_t idx;
758    SearchSpace_t    *searchSpace;
759    PdcchCfgCommon   duPdcchCfg;
760
761    duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
762
763    DU_ALLOC(searchSpclist->list.array, searchSpclist->list.size)
764    if(!searchSpclist->list.array)
765    {
766       DU_LOG("\nERROR  -->  DU APP : Common search space list memory alloc failed");
767       return RFAILED;
768    }
769
770    for(idx = 0; idx < searchSpclist->list.count; idx++)
771    {
772       DU_ALLOC(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
773       if(!searchSpclist->list.array[idx])
774       {
775          DU_LOG("\nERROR  -->  DU APP : Common search space list memory alloc failed");
776          return RFAILED;
777       }
778    }
779
780    idx = 0;
781    searchSpace = searchSpclist->list.array[idx];
782
783    /* Search Space id */
784    searchSpace->searchSpaceId = duPdcchCfg.searchSpcId;
785
786    /* Control Resource Set Id */
787    DU_ALLOC(searchSpace->controlResourceSetId, sizeof(ControlResourceSetId_t));
788    if(!searchSpace->controlResourceSetId)
789    {
790       DU_LOG("\nERROR  -->  DU APP : Common search space list memory alloc failed");
791       return RFAILED;
792    }
793    *searchSpace->controlResourceSetId = duPdcchCfg.ctrlRsrcSetId;
794
795    /* Monitoring Slot periodicity and offset */
796    DU_ALLOC(searchSpace->monitoringSlotPeriodicityAndOffset,\
797    sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
798    if(!searchSpace->monitoringSlotPeriodicityAndOffset)
799    {
800       DU_LOG("\nERROR  -->  DU APP : Common search space list memory alloc failed");
801       return RFAILED;
802    }
803    searchSpace->monitoringSlotPeriodicityAndOffset->present = \
804    duPdcchCfg.monitorSlotPrdAndOffPresent;
805    switch(searchSpace->monitoringSlotPeriodicityAndOffset->present)
806    {
807       case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1:
808       {
809          //searchSpace->monitoringSlotPeriodicityAndOffset->choice.s11 =  duPdcchCfg.monitorSlotPrdAndOff;
810          break;
811       }
812       case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2:
813       {
814          //TODO
815          break;
816       }
817       case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl4:
818       {
819          //TODO
820          break;
821       }
822       case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl5:
823       {
824          //TODO
825          break;
826       }
827       case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl8:
828       {
829          //TODO
830          break;
831       }
832       case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl10:
833       {
834          //TODO
835          break;
836       }
837       case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl16:
838       {
839          //TODO;
840          break;
841       }
842       case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl20:
843       {
844          //TODO
845          break;
846       }
847       case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl40:
848       {
849          //TODO
850          break;
851       }
852       case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl80:
853       {
854          //TODO
855          break;
856       }
857       case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl160:
858       {
859          //TODO
860          break;
861       }
862       case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl320:
863       {
864         //TODO
865          break;
866       }
867       case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl640:
868       {
869          //TODO
870          break;
871       }
872       case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1280:
873       {
874          //TODO
875          break;
876       }
877       case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2560:
878       {
879          //TODO
880          break;
881       }
882       default:
883       {
884          DU_LOG("\nERROR  -->  DU APP : Invalid value:Montoring slot periodicity and offset");
885          return RFAILED;
886       }
887    }
888
889    /* Monitoring Symbols Within Slot */
890    DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot,\
891    sizeof(BIT_STRING_t));
892    if(!searchSpace->monitoringSymbolsWithinSlot)
893    {
894       DU_LOG("\nERROR  -->  DU APP : Common search space list memory alloc failed");
895       return RFAILED;
896    }
897    searchSpace->monitoringSymbolsWithinSlot->size = 2*sizeof(uint8_t);
898    DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot->buf, \
899    searchSpace->monitoringSymbolsWithinSlot->size );
900    if(!searchSpace->monitoringSymbolsWithinSlot->buf)
901    {  
902       DU_LOG("\nERROR  -->  DU APP : Common search space list memory alloc failed");
903       return RFAILED;
904    }
905    searchSpace->monitoringSymbolsWithinSlot->buf[0] = duPdcchCfg.monitorSymbolsInSlot[0];
906    searchSpace->monitoringSymbolsWithinSlot->buf[1] = duPdcchCfg.monitorSymbolsInSlot[1];
907    searchSpace->monitoringSymbolsWithinSlot->bits_unused = 2;
908
909    /* Number of candidates per aggregation level */
910    DU_ALLOC(searchSpace->nrofCandidates,\
911          sizeof(struct SearchSpace__nrofCandidates));
912    if(!searchSpace->nrofCandidates)
913    {
914       DU_LOG("\nERROR  -->  DU APP : Common search space list memory alloc failed");
915       return RFAILED;
916    }
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;
922
923    /* Search Space type and  DCI Format */
924    DU_ALLOC(searchSpace->searchSpaceType,\
925    sizeof( struct SearchSpace__searchSpaceType));
926    if(!searchSpace->searchSpaceType)
927    {
928       DU_LOG("\nERROR  -->  DU APP : Common search space list memory alloc failed");
929       return RFAILED;
930    }
931
932    searchSpace->searchSpaceType->present = duPdcchCfg.searchSpcType; 
933    switch(searchSpace->searchSpaceType->present)
934    {
935       case SearchSpace__searchSpaceType_PR_NOTHING:
936       {
937          //TODO
938          break;
939       }
940       case SearchSpace__searchSpaceType_PR_common:
941       {
942          DU_ALLOC(searchSpace->searchSpaceType->choice.common, sizeof(struct SearchSpace__searchSpaceType__common));
943          if(!searchSpace->searchSpaceType->choice.common)
944          {
945             DU_LOG("\nERROR  -->  DU APP : Common search space list memory alloc failed");
946             return RFAILED;
947          }
948
949          DU_ALLOC(searchSpace->searchSpaceType->choice.common->\
950          dci_Format0_0_AndFormat1_0, sizeof(struct \
951          SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
952          if(!searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)
953          {
954             DU_LOG("\nERROR  -->  DU APP : Common search space list memory alloc failed");
955             return RFAILED;
956          }
957          break;
958       }
959       case SearchSpace__searchSpaceType_PR_ue_Specific:
960       {
961          break;
962       }
963       default:
964       {
965          DU_LOG("\nERROR  -->  DU_APP: Invalid Search Space type");
966          return RFAILED;
967       }
968    }
969
970    return ROK;
971 }/* BuildCommonSerachSpaceList */
972
973 /*******************************************************************
974  *
975  * @brief Builds PDCCH configuration common 
976  *
977  * @details
978  *
979  *    Function : BuildPdcchCfgCommon
980  *
981  *    Functionality:
982  *      Builds PDCCH configuration common
983  *
984  * @params[in] BWP_DownlinkCommon__pdcch_ConfigCommon pointer
985  * @return ROK     - success
986  *         RFAILED - failure
987  *
988  * ****************************************************************/
989 uint8_t BuildPdcchCfgCommon(struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg)
990 {
991    uint8_t   ret;
992    uint8_t   elementCnt;
993    PdcchCfgCommon   duPdcchCfg;
994    PDCCH_ConfigCommon_t  *pdcchSetup;
995
996    duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
997
998    pdcchCfg->present = duPdcchCfg.present;
999
1000    switch(pdcchCfg->present)
1001    {
1002       case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
1003       {
1004          //TODO
1005          break;
1006       }
1007       case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
1008       {
1009          //TODO
1010          break;
1011       }
1012       case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
1013       {
1014          DU_ALLOC(pdcchCfg->choice.setup, sizeof(PDCCH_ConfigCommon_t));
1015          if(!pdcchCfg->choice.setup)
1016          {
1017             DU_LOG("\nERROR  -->  DU APP : PDCCH Config memory alloc failed");
1018             return RFAILED;
1019          }
1020          pdcchSetup = pdcchCfg->choice.setup;
1021
1022          /* Control Resource Set Zero */
1023          DU_ALLOC(pdcchSetup->controlResourceSetZero, sizeof(ControlResourceSetZero_t)); 
1024          if(!pdcchSetup->controlResourceSetZero)
1025          {
1026             DU_LOG("\nERROR  -->  DU APP : PDCCH Config memory alloc failed");
1027             return RFAILED;
1028          }
1029          *pdcchSetup->controlResourceSetZero = duPdcchCfg.ctrlRsrcSetZero;
1030
1031          /* Search space zero */
1032          DU_ALLOC(pdcchSetup->searchSpaceZero, sizeof(SearchSpaceZero_t));
1033          if(!pdcchSetup->searchSpaceZero)
1034          {
1035             DU_LOG("\nERROR  -->  DU APP : PDCCH Config memory alloc failed");
1036             return RFAILED;
1037          }
1038          *pdcchSetup->searchSpaceZero = duPdcchCfg.searchSpcZero;
1039
1040          /* Common Search Space List */
1041          DU_ALLOC(pdcchSetup->commonSearchSpaceList,\
1042                   sizeof(struct PDCCH_ConfigCommon__commonSearchSpaceList));
1043          if(!pdcchSetup->commonSearchSpaceList)
1044          {
1045             DU_LOG("\nERROR  -->  DU APP : PDCCH Config memory alloc failed");
1046             return RFAILED;
1047          }
1048          elementCnt = ODU_VALUE_ONE;
1049          pdcchSetup->commonSearchSpaceList->list.count = elementCnt;
1050          pdcchSetup->commonSearchSpaceList->list.size =  elementCnt * sizeof(SearchSpace_t *);
1051          ret = BuildCommonSerachSpaceList(pdcchSetup->commonSearchSpaceList);
1052          if(ret != ROK)
1053          {
1054             return RFAILED;
1055          }
1056          CommonSerachSpaceListret=ROK;
1057
1058          /* Search Space for SIB1 */
1059          DU_ALLOC(pdcchSetup->searchSpaceSIB1, sizeof(SearchSpaceId_t));
1060          if(!pdcchSetup->searchSpaceSIB1)
1061          {
1062             DU_LOG("\nERROR  -->  DU APP : PDCCH Config memory alloc failed");
1063             return RFAILED;
1064          }
1065          *pdcchSetup->searchSpaceSIB1 = duPdcchCfg.searchSpcSib1;
1066
1067          /* Serach Space for Paging */
1068          DU_ALLOC(pdcchSetup->pagingSearchSpace, sizeof(SearchSpaceId_t));
1069          if(!pdcchSetup->pagingSearchSpace)
1070          {
1071             DU_LOG("\nERROR  -->  DU APP : PDCCH Config memory alloc failed");
1072             return RFAILED;
1073          }  
1074          *pdcchSetup->pagingSearchSpace = duPdcchCfg.pagingSearchSpc;
1075
1076          /* Search space for Random Access */
1077          DU_ALLOC(pdcchSetup->ra_SearchSpace, sizeof(SearchSpaceId_t));
1078          if(!pdcchSetup->ra_SearchSpace)
1079          {
1080             DU_LOG("\nERROR  -->  DU APP : PDCCH Config memory alloc failed");
1081             return RFAILED;
1082          }             
1083          *pdcchSetup->ra_SearchSpace = duPdcchCfg.raSearchSpc;
1084
1085          break;
1086       }
1087       default :
1088       {
1089          DU_LOG("\nERROR  -->  DU APP : Invalid PDCCH Config type");
1090          return RFAILED; 
1091       }
1092    }
1093
1094    return ROK;
1095 } /* BuildPdcchCfgCommon */
1096
1097 /*******************************************************************
1098  *
1099  * @brief Builds PDSCH configuration common 
1100  *
1101  * @details
1102  *
1103  *    Function : BuildPdschCfgCommon
1104  *
1105  *    Functionality:
1106  *       Builds PDSCH configuration common
1107  *
1108  * @params[in] BWP_DownlinkCommon__pdsch_ConfigCommon pointer
1109  * @return ROK     - success
1110  *         RFAILED - failure
1111  *
1112  * ****************************************************************/
1113 uint8_t BuildPdschCfgCommon(struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg)
1114 {
1115    uint8_t   idx;
1116    uint8_t   elementCnt;
1117    PdschCfgCommon   duPdschCfg;
1118    PDSCH_ConfigCommon_t  *pdschSetup;
1119    PDSCH_TimeDomainResourceAllocation_t  *timeDomRsrcAllocInfo;
1120
1121    duPdschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg;
1122
1123    pdschCfg->present = duPdschCfg.present;
1124
1125    switch(pdschCfg->present)
1126    {
1127       case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
1128       {
1129          //TODO
1130          break;
1131       }
1132       case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
1133       {
1134          //TODO
1135          break;
1136       }
1137       case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
1138       {
1139          DU_ALLOC(pdschCfg->choice.setup, sizeof(PDSCH_ConfigCommon_t));
1140          if(!pdschCfg->choice.setup)
1141          {
1142             DU_LOG("\nERROR  -->  DU APP : PDCCH Config memory alloc failed");
1143             return RFAILED;
1144          }
1145          pdschSetup = pdschCfg->choice.setup; 
1146
1147          /* Time Domain Allocation List */
1148          DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList, \
1149                   sizeof(PDSCH_TimeDomainResourceAllocationList_t));
1150          if(!pdschSetup->pdsch_TimeDomainAllocationList)
1151          {
1152             DU_LOG("\nERROR  -->  DU APP : PDCCH Config memory alloc failed");
1153             return RFAILED;
1154          }
1155          elementCnt = duPdschCfg.numTimeDomRsrcAlloc;
1156          pdschSetup->pdsch_TimeDomainAllocationList->list.count = elementCnt;
1157          pdschSetup->pdsch_TimeDomainAllocationList->list.size =  elementCnt * sizeof(PDSCH_TimeDomainResourceAllocation_t *);
1158
1159          DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array,\
1160          pdschSetup->pdsch_TimeDomainAllocationList->list.size);
1161          if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array)
1162          {
1163             DU_LOG("\nERROR  -->  DU APP : PDCCH Config memory alloc failed");
1164             return RFAILED;
1165          }
1166
1167          for(idx=0; idx<elementCnt; idx++)
1168          {
1169             DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx],\
1170             sizeof(PDSCH_TimeDomainResourceAllocation_t));
1171             if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx])
1172             {
1173                DU_LOG("\nERROR  -->  DU APP : PDCCH Config memory alloc failed");
1174                return RFAILED;
1175             }
1176          }
1177
1178     for(idx = 0; idx < pdschSetup->pdsch_TimeDomainAllocationList->list.count; idx++)
1179     {
1180        timeDomRsrcAllocInfo = pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx];
1181
1182        /* K0 */
1183        DU_ALLOC(timeDomRsrcAllocInfo->k0, sizeof(long));
1184        if(!timeDomRsrcAllocInfo->k0)
1185        {
1186           DU_LOG("\nERROR  -->  DU APP : PDCCH Config memory alloc failed");
1187           return RFAILED;
1188        }
1189        *timeDomRsrcAllocInfo->k0 = duPdschCfg.timeDomAlloc[idx].k0;
1190
1191        timeDomRsrcAllocInfo->mappingType = duPdschCfg.timeDomAlloc[idx].mapType;
1192        timeDomRsrcAllocInfo->startSymbolAndLength = duPdschCfg.timeDomAlloc[idx].sliv;
1193     }
1194          break;
1195       }
1196       default:
1197       {
1198          DU_LOG("\nERROR  -->  DU APP: Invalid PDSCH Configuration type");
1199          return RFAILED;
1200       }
1201    }
1202
1203    return ROK;
1204 }/* BuildPdschCfgCommon */
1205
1206 /*******************************************************************
1207  *
1208  * @brief Builds DL BWP common 
1209  *
1210  * @details
1211  *
1212  *    Function : BuildBwpDlCommon
1213  *
1214  *    Functionality:
1215  *      Builds DL BWP common
1216  *
1217  * @params[in] BWP_DownlinkCommon_t pointer
1218  * @return ROK     - success
1219  *         RFAILED - failure
1220  *
1221  * ****************************************************************/
1222 uint8_t BuildBwpDlCommon(BWP_DownlinkCommon_t *bwp)
1223 {
1224    uint8_t ret;
1225    DlCfgCommon duDlCfg;
1226
1227    duDlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1228
1229    bwp->genericParameters.locationAndBandwidth = duDlCfg.locAndBw;
1230    bwp->genericParameters.subcarrierSpacing = duDlCfg.dlScsCarrier.scs;
1231
1232    /* PDCCH Config Common */
1233    DU_ALLOC(bwp->pdcch_ConfigCommon, \
1234          sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
1235    if(!bwp->pdcch_ConfigCommon)
1236    {
1237       DU_LOG("\nERROR  -->  DU APP : DL BWP memory allocation failed");
1238       return RFAILED;
1239    }
1240    ret=BuildPdcchCfgCommon(bwp->pdcch_ConfigCommon);
1241    if(ret != ROK)
1242    {
1243       return RFAILED;
1244    }
1245    /* PDSCH Config Common */
1246    DU_ALLOC(bwp->pdsch_ConfigCommon, \
1247          sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
1248    if(!bwp->pdsch_ConfigCommon)
1249    {
1250       DU_LOG("\nERROR  -->  DU APP : DL BWP memory allocation failed");
1251       return RFAILED;
1252    }
1253    ret=BuildPdschCfgCommon(bwp->pdsch_ConfigCommon);
1254    if(ret != ROK)
1255    {
1256       return RFAILED;
1257    }
1258    return ROK;
1259 } /* BuildBwpDlCommon */
1260
1261 /*******************************************************************
1262  *
1263  * @brief Build BCCH configuration 
1264  *
1265  * @details
1266  *
1267  *    Function : BuildBcchConfig
1268  *
1269  *    Functionality:
1270  *      Build BCCH configuration
1271  *
1272  * @params[in] BCCH_Config_t pointer
1273  * @return ROK     - success
1274  *         RFAILED - failure
1275  *
1276  * ****************************************************************/
1277
1278 uint8_t BuildBcchConfig(BCCH_Config_t *bcchCfg)
1279 {
1280    BcchCfg   duBcchCfg;
1281
1282    duBcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.bcchCfg;
1283
1284    bcchCfg->modificationPeriodCoeff = duBcchCfg.modPrdCoeff;
1285
1286    return ROK;
1287 }/* BuildBcchConfig */
1288
1289 /*******************************************************************
1290  *
1291  * @brief Builds PCCH configuration 
1292  *
1293  * @details
1294  *
1295  *    Function : BuildPcchConfig
1296  *
1297  *    Functionality:
1298  *        Builds PCCH configuration
1299  *
1300  * @params[in] 
1301  * @return ROK     - success
1302  *         RFAILED - failure
1303  *
1304  * ****************************************************************/
1305 uint8_t BuildPcchConfig(PCCH_Config_t *pcchCfg)
1306 {
1307    PcchCfg   duPcchCfg;
1308
1309    duPcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg;
1310
1311    pcchCfg->defaultPagingCycle = duPcchCfg.dfltPagingCycle;
1312    pcchCfg->nAndPagingFrameOffset.present =  duPcchCfg.nAndPagingFrmOffPresent;
1313    switch(pcchCfg->nAndPagingFrameOffset.present)
1314    {
1315       case PCCH_Config__nAndPagingFrameOffset_PR_NOTHING:
1316       {
1317          //TODO
1318          break;
1319       }
1320       case PCCH_Config__nAndPagingFrameOffset_PR_oneT:
1321       {
1322          //TODO
1323          break;
1324       }
1325       case PCCH_Config__nAndPagingFrameOffset_PR_halfT:
1326       {
1327          //TODO
1328          break;
1329       }
1330       case PCCH_Config__nAndPagingFrameOffset_PR_quarterT:
1331       {
1332          //TODO
1333          break;
1334       }
1335       case PCCH_Config__nAndPagingFrameOffset_PR_oneEighthT:
1336       {
1337          //TODO
1338          break;
1339       }
1340       case PCCH_Config__nAndPagingFrameOffset_PR_oneSixteenthT:
1341       {
1342          //TODO
1343          break;
1344       }
1345       default:
1346       {
1347          DU_LOG("\nERROR  -->  DU APP : Invalid nAndPagingFrameOffset configuration");
1348          return RFAILED;
1349       }
1350    }
1351    pcchCfg->ns = duPcchCfg.numPagingOcc;
1352
1353    return ROK;
1354 }/* BuildPcchConfig */
1355
1356 /*******************************************************************
1357  *
1358  * @brief Builds Frequency Info for Downlink 
1359  *
1360  * @details
1361  *
1362  *    Function : BuildFreqInfoDl
1363  *
1364  *    Functionality:
1365  *     Builds Frequency Info for Downlink
1366  *
1367  * @params[in] 
1368  * @return ROK     - success
1369  *         RFAILED - failure
1370  *
1371  * ****************************************************************/
1372
1373 uint8_t BuildFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL)
1374 {
1375    uint8_t ret;
1376    uint8_t idx;
1377    uint8_t elementCnt;
1378    DlCfgCommon  dlCfg;
1379    NR_MultiBandInfo_t  *multiBandInfo;
1380
1381    dlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1382
1383    /* NR Multi-Band Info */
1384    elementCnt = ODU_VALUE_ONE;   
1385    frequencyInfoDL->frequencyBandList.list.count = elementCnt;  
1386    frequencyInfoDL->frequencyBandList.list.size = \
1387    elementCnt * sizeof(NR_MultiBandInfo_t *);
1388
1389    DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array, \
1390    frequencyInfoDL->frequencyBandList.list.size);
1391    if(!frequencyInfoDL->frequencyBandList.list.array)
1392    {
1393       DU_LOG("\nERROR  -->  DU APP : SIB1 DL Configuration memory allocation failed");
1394       return RFAILED;
1395    }
1396
1397    for(idx = 0; idx < elementCnt; idx++)
1398    {
1399       DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array[idx],\
1400       sizeof(NR_MultiBandInfo_t));
1401       if(!frequencyInfoDL->frequencyBandList.list.array[idx])
1402       {
1403          DU_LOG("\nERROR  -->  DU APP : SIB1 DL Configuration memory allocation failed");
1404          return RFAILED;
1405       }
1406    }
1407
1408    idx = 0;
1409    multiBandInfo = frequencyInfoDL->frequencyBandList.list.array[idx];
1410
1411    /* Frequency band indicator */
1412    DU_ALLOC(multiBandInfo->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
1413    if(!multiBandInfo->freqBandIndicatorNR)
1414    {
1415       DU_LOG("\nERROR  -->  DU APP : SIB1 DL Configuration memory allocation failed");
1416       return RFAILED;
1417    }
1418    *multiBandInfo->freqBandIndicatorNR = dlCfg.freqBandInd;
1419
1420    /* Offset to Point A */
1421    frequencyInfoDL->offsetToPointA = dlCfg.offsetToPointA;
1422
1423    /* Subcarrier Spacing specifc carrier */
1424    elementCnt = ODU_VALUE_ONE;
1425    frequencyInfoDL->scs_SpecificCarrierList.list.count = elementCnt;
1426    frequencyInfoDL->scs_SpecificCarrierList.list.size = \
1427    elementCnt * sizeof(SCS_SpecificCarrier_t *);
1428    ret= BuildScsSpecificCarrierListDl(&frequencyInfoDL->scs_SpecificCarrierList);
1429
1430    if(ret != ROK)
1431    {
1432       return RFAILED;
1433    }
1434    return ROK;
1435 }/* BuildFreqInfoDl */
1436
1437 /*******************************************************************
1438  *
1439  * @brief Builds DL configuration common for SIB
1440  *
1441  * @details
1442  *
1443  *    Function : BuildDlCfgCommSib
1444  *
1445  *    Functionality:
1446  *     Builds DL configuration common for SIB
1447  *
1448  * @params[in] DownlinkConfigCommonSIB_t pointer 
1449  * @return ROK     - success
1450  *         RFAILED - failure
1451  *
1452  * ****************************************************************/
1453
1454 uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg)
1455 {
1456    /* DL frequency info */
1457    uint8_t ret;
1458    ret = BuildFreqInfoDl(&dlCfg->frequencyInfoDL);
1459    if(ret != ROK)
1460    {
1461       return RFAILED;
1462    }
1463    FreqInfoDlret=ROK;
1464    /* BWP Downlink Common */
1465    ret = BuildBwpDlCommon(&dlCfg->initialDownlinkBWP);
1466    if(ret != ROK)
1467    {
1468       return RFAILED;
1469    }
1470    /* BCCH Config */
1471    ret = BuildBcchConfig(&dlCfg->bcch_Config);
1472    if(ret != ROK)
1473    {
1474       return RFAILED;
1475    }
1476    /* PCCH Config */
1477    ret = BuildPcchConfig(&dlCfg->pcch_Config);
1478    if(ret != ROK)
1479    {
1480       return RFAILED;
1481    }
1482    return ROK;
1483 } /* BuildDlCfgCommSib */
1484
1485 /*******************************************************************
1486  *
1487  * @brief Builds SCS specific carrier list for UL 
1488  *
1489  * @details
1490  *
1491  *    Function : BuildScsSpecificCarrierListUl
1492  *
1493  *    Functionality:
1494  *       Builds SCS specific carrier list for UL
1495  *
1496  * @params[in] 
1497  * @return ROK     - success
1498  *         RFAILED - failure
1499  *
1500  * ****************************************************************/
1501
1502 uint8_t BuildScsSpecificCarrierListUl
1503 (
1504 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList
1505 )
1506 {
1507    uint8_t idx;
1508    ScsSpecCarrier   duScsSpecCarrier;
1509
1510    duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.ulScsCarrier;
1511
1512    DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
1513    if(!scsCarrierList->list.array)
1514    {
1515       DU_LOG("\nERROR  -->  DU APP : SCS Specific Carrier list memory allocation failed");
1516       return RFAILED;
1517    }
1518
1519    for(idx = 0; idx < scsCarrierList->list.count; idx++)
1520    {
1521       DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
1522       if(!scsCarrierList->list.array[idx])
1523       {
1524          DU_LOG("\nERROR  -->  DU APP : SCS Specific Carrier list memory allocation failed");
1525          return RFAILED;
1526       }
1527    }
1528    idx = 0;
1529    scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
1530    scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
1531    scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
1532
1533    return ROK;
1534 } /* End of BuildScsSpecificCarrierListUl */
1535
1536 /*******************************************************************
1537  *
1538  * @brief Builds frequency infor for UL 
1539  *
1540  * @details
1541  *
1542  *    Function : BuildFreqInfoUl
1543  *
1544  *    Functionality:
1545  *       Builds frequency infor for UL
1546  *
1547  * @params[in] FrequencyInfoUL_SIB_t pointer
1548  * @return ROK     - success
1549  *         RFAILED - failure
1550  *
1551  * ****************************************************************/
1552
1553 uint8_t BuildFreqInfoUl(FrequencyInfoUL_SIB_t *frequencyInfoUL)
1554 {
1555    uint8_t      elementCnt;
1556    UlCfgCommon  ulCfg;
1557    uint8_t      ret;
1558    ulCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
1559
1560    /* Subcarrier Spacing specifc carrier */
1561    elementCnt = ODU_VALUE_ONE;
1562    frequencyInfoUL->scs_SpecificCarrierList.list.count = elementCnt;
1563    frequencyInfoUL->scs_SpecificCarrierList.list.size = \
1564    elementCnt * sizeof(SCS_SpecificCarrier_t *);
1565    ret=BuildScsSpecificCarrierListUl(&frequencyInfoUL->scs_SpecificCarrierList);
1566    if(ret != ROK)
1567    {
1568       return RFAILED;
1569    }
1570    /* P-MAX */
1571    DU_ALLOC(frequencyInfoUL->p_Max, sizeof(P_Max_t));
1572    if(!frequencyInfoUL->p_Max)
1573    {
1574       DU_LOG("\nERROR  -->  DU APP : UL Frequency Infoo  memory allocation failure");
1575       return RFAILED;
1576    }
1577    *frequencyInfoUL->p_Max = ulCfg.pMax;
1578    FreqInfoUlret=ROK;
1579    return ROK;
1580 }/* BuildFreqInfoUl */
1581
1582 /*******************************************************************
1583  *
1584  * @brief Builds RACH configuration common 
1585  *
1586  * @details
1587  *
1588  *    Function : BuildRachCfgCommon
1589  *
1590  *    Functionality:
1591  *      Builds RACH configuration common
1592  *
1593  * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer
1594  * @return ROK     - success
1595  *         RFAILED - failure
1596  *
1597  * ****************************************************************/
1598
1599 uint8_t  BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg)
1600 {
1601    RachCfgCommon    duRachCfg;
1602    RACH_ConfigCommon_t  *setup;
1603
1604    duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg;
1605
1606    rachCfg->present = duRachCfg.present;
1607    switch(rachCfg->present)
1608    {
1609       case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
1610       {
1611          //TODO
1612          break;
1613       }
1614       case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
1615       {
1616          //TODO
1617          break;
1618       }
1619       case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
1620       {
1621          DU_ALLOC(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t)); 
1622          if(!rachCfg->choice.setup)
1623          {
1624             DU_LOG("\nERROR  -->  DU APP : Rach Config memory alloc failed");
1625             return RFAILED;
1626          }
1627          setup = rachCfg->choice.setup;
1628
1629          /* Generic RACH Configuration */
1630          setup->rach_ConfigGeneric.prach_ConfigurationIndex = duRachCfg.prachCfgIdx;
1631          setup->rach_ConfigGeneric.msg1_FDM = duRachCfg.msg1Fdm;
1632          setup->rach_ConfigGeneric.msg1_FrequencyStart = duRachCfg.msg1FreqStart;
1633          setup->rach_ConfigGeneric.zeroCorrelationZoneConfig = duRachCfg.zeroCorrZoneCfg;
1634          setup->rach_ConfigGeneric.preambleReceivedTargetPower = duRachCfg.preambleRcvdTgtPwr; 
1635          setup->rach_ConfigGeneric.preambleTransMax = duRachCfg.preambleTransMax;
1636          setup->rach_ConfigGeneric.powerRampingStep = duRachCfg.pwrRampingStep;
1637          setup->rach_ConfigGeneric.ra_ResponseWindow = duRachCfg.raRspWindow;
1638
1639          /* Total number of RA preambles */
1640          DU_ALLOC(setup->totalNumberOfRA_Preambles, sizeof(long));
1641          if(!setup->totalNumberOfRA_Preambles)
1642          {
1643             DU_LOG("\nERROR  -->  DU APP : Rach Config memory alloc failed");
1644             return RFAILED;
1645          }
1646          *setup->totalNumberOfRA_Preambles = duRachCfg.numRaPreamble;
1647
1648          /* SSB per RACH occassion and CB Preambles per SSB */
1649          DU_ALLOC(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
1650          sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
1651          if(!setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
1652          {
1653             DU_LOG("\nERROR  -->  DU APP : Rach Config memory alloc failed");
1654             return RFAILED;
1655          }
1656          setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present = \
1657          duRachCfg.ssbPerRachOccPresent;
1658          switch(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present)
1659          {
1660             case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_NOTHING:
1661             {
1662                //TODO
1663                break;
1664             }
1665             case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth:
1666             {
1667                //TODO
1668                break;
1669             }
1670             case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth:
1671             {
1672                //TODO
1673                break;
1674             }
1675             case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf:
1676             {
1677                //TODO
1678                break;
1679             }
1680             case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one:
1681             {
1682               setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one =\
1683               duRachCfg.numSsbPerRachOcc;
1684             }
1685             case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two:
1686             {
1687                //TODO
1688                break;
1689             }
1690             case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four:
1691             {
1692                //TODO
1693                break;
1694             }
1695             case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight:
1696             {
1697                //TODO
1698                 break;
1699             }
1700             case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen:
1701             {
1702                //TODO
1703                break;
1704             }
1705             default:
1706             {
1707                DU_LOG("\nERROR  -->  DU APP: Invalid value for \
1708                ssb_PerRach_OccassionAndCB_PreamblesPerSSB");
1709                return RFAILED;
1710             }
1711          }
1712
1713          /* RA Contention Resolution Timer */
1714          setup->ra_ContentionResolutionTimer = duRachCfg.contResTimer;
1715
1716          /* RSRP Threshold SSB */
1717          DU_ALLOC(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
1718          if(!setup->rsrp_ThresholdSSB)
1719          {
1720             DU_LOG("\nERROR  -->  DU APP : Rach Config memory alloc failed");
1721             return RFAILED;
1722          }
1723          *setup->rsrp_ThresholdSSB = duRachCfg.rsrpThreshSsb;
1724
1725          /* Root Sequence index */
1726          setup->prach_RootSequenceIndex.present = duRachCfg.rootSeqIdxPresent;
1727          switch(setup->prach_RootSequenceIndex.present)
1728          {
1729             case RACH_ConfigCommon__prach_RootSequenceIndex_PR_NOTHING:
1730             {
1731                //TODO
1732                break;
1733             }
1734             case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839:
1735             {
1736                //TODO
1737                break;
1738             }
1739             case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139:
1740             {
1741                setup->prach_RootSequenceIndex.choice.l139 = duRachCfg.rootSeqIdx;
1742                break;
1743             }
1744             default:
1745             {
1746                DU_LOG("\nERROR  -->  DU APP: Inavlid PRACH root sequence index type");
1747                return RFAILED;
1748             }
1749          }
1750
1751          /* Msg 1 Subcarrier spacing */
1752          DU_ALLOC(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
1753          if(!setup->msg1_SubcarrierSpacing)
1754          {
1755             DU_LOG("\nERROR  -->  DU APP : Rach Config memory alloc failed");
1756             return RFAILED;
1757          }
1758          *setup->msg1_SubcarrierSpacing = duRachCfg.msg1Scs;
1759
1760          /* Restricted Set Config */
1761          setup->restrictedSetConfig = duRachCfg.restrictedSetCfg;
1762
1763          break;
1764       }
1765       default:
1766       {
1767          DU_LOG("\nERROR  -->  DU APP : Invalid RACH Config type ");
1768          return RFAILED;
1769       }
1770    }
1771    return ROK;
1772 }/* BuildRachCfgCommon */
1773
1774 /*******************************************************************
1775  *
1776  * @brief Builds PUSCH configuration for common 
1777  *
1778  * @details
1779  *
1780  *    Function : BuildPuschCfgCommon
1781  *
1782  *    Functionality:
1783  *      Builds PUSCH configuration for common
1784  *
1785  * @params[in] 
1786  * @return ROK     - success
1787  *         RFAILED - failure
1788  *
1789  * ****************************************************************/
1790
1791 uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg)
1792 {
1793    uint8_t           idx;
1794    uint8_t           elementCnt;   
1795    PuschCfgCommon    duPuschCfg;
1796    PUSCH_ConfigCommon_t *setup;
1797    PUSCH_TimeDomainResourceAllocation_t  *timeDomRsrcAllocInfo;
1798
1799    duPuschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.puschCfg;
1800
1801    puschCfg->present = duPuschCfg.puschCfgPresent;
1802    switch(puschCfg->present)
1803    {
1804       case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
1805       {
1806          //TODO
1807          break;
1808       }
1809       case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
1810       {
1811          //TODO
1812          break;
1813       }
1814       case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
1815       {
1816          DU_ALLOC(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
1817          if(!puschCfg->choice.setup)
1818          {
1819             DU_LOG("\nERROR  -->  DU APP : PUSCH Config memory alloc failed");
1820             return RFAILED;
1821          }
1822          setup = puschCfg->choice.setup;
1823
1824          /* Time Domain Resource Allocation List */
1825          DU_ALLOC(setup->pusch_TimeDomainAllocationList,\
1826          sizeof(PUSCH_TimeDomainResourceAllocationList_t)); 
1827          if(!setup->pusch_TimeDomainAllocationList)
1828          {
1829             DU_LOG("\nERROR  -->  DU APP : PUSCH Config memory alloc failed");
1830             return RFAILED;
1831          }
1832          elementCnt = duPuschCfg.numTimeDomRsrcAlloc;
1833          setup->pusch_TimeDomainAllocationList->list.count = elementCnt;
1834          setup->pusch_TimeDomainAllocationList->list.size = \
1835          elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *);
1836
1837          DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array, \
1838          setup->pusch_TimeDomainAllocationList->list.size);
1839          if(!setup->pusch_TimeDomainAllocationList->list.array)
1840          {
1841             DU_LOG("\nERROR  -->  DU APP : PUSCH Config memory alloc failed");
1842             return RFAILED;
1843          }
1844
1845          for(idx=0; idx<elementCnt; idx++)
1846          {
1847             DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array[idx],\
1848             sizeof(PUSCH_TimeDomainResourceAllocation_t));
1849             if(!setup->pusch_TimeDomainAllocationList->list.array[idx])
1850             {
1851                DU_LOG("\nERROR  -->  DU APP : PUSCH Config memory alloc failed");
1852                return RFAILED;
1853             }
1854          }
1855
1856          for(idx = 0; idx < elementCnt; idx++)
1857     {
1858        timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx];
1859
1860        /* K2 */
1861        DU_ALLOC(timeDomRsrcAllocInfo->k2, sizeof(long));
1862        if(!timeDomRsrcAllocInfo->k2)
1863        {
1864           DU_LOG("\nERROR  -->  DU APP : PUSCH Config memory alloc failed");
1865           return RFAILED;
1866        }
1867        *timeDomRsrcAllocInfo->k2 = duPuschCfg.timeDomAllocList[idx].k2;
1868        timeDomRsrcAllocInfo->mappingType = duPuschCfg.timeDomAllocList[idx].mapType;
1869        timeDomRsrcAllocInfo->startSymbolAndLength = duPuschCfg.timeDomAllocList[idx].sliv;
1870     }
1871          /* Msg3 Delta Preamble */
1872          DU_ALLOC(setup->msg3_DeltaPreamble, sizeof(long));
1873          if(!setup->msg3_DeltaPreamble)
1874          {
1875             DU_LOG("\nERROR  -->  DU APP : PUSCH Config memory alloc failed");
1876             return RFAILED;
1877          }
1878          *setup->msg3_DeltaPreamble = duPuschCfg.msg3DeltaPreamble;
1879
1880          /* P0 Nominal with grnat */
1881          DU_ALLOC(setup->p0_NominalWithGrant, sizeof(long));
1882          if(!setup->p0_NominalWithGrant)
1883          {
1884             DU_LOG("\nERROR  -->  DU APP : PUSCH Config memory alloc failed");
1885             return RFAILED;
1886          }
1887          *setup->p0_NominalWithGrant = duPuschCfg.p0NominalWithGrant;
1888
1889          break;
1890       }
1891       default:
1892       {
1893          DU_LOG("\nERROR  -->  DU APP : Invalid PUSCH configuration type ");
1894          return RFAILED;
1895       }
1896    }
1897
1898    return ROK;
1899 }/* BuildPuschCfgCommon */
1900
1901 /*******************************************************************
1902  *
1903  * @brief  Builds PUCCH configuration common
1904  *
1905  * @details
1906  *
1907  *    Function : BuildPucchCfgCommon
1908  *
1909  *    Functionality:
1910  *      Builds PUCCH configuration common
1911  *
1912  * @params[in] 
1913  * @return ROK     - success
1914  *         RFAILED - failure
1915  *
1916  * ****************************************************************/
1917
1918 uint8_t BuildPucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg)
1919 {
1920    PucchCfgCommon    duPucchCfg;
1921    PUCCH_ConfigCommon_t *setup;
1922
1923    duPucchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.pucchCfg;
1924
1925    pucchCfg->present = duPucchCfg.present;
1926    switch(pucchCfg->present)
1927    {
1928       case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
1929       {
1930          //TODO
1931          break;
1932       }
1933       case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
1934       {
1935          //TODO
1936          break;
1937       }
1938       case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
1939       {
1940          DU_ALLOC(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
1941          if(!pucchCfg->choice.setup)
1942          {
1943             DU_LOG("\nERROR  -->  DU APP : PUCCH Config memory alloc failed");
1944             return RFAILED;
1945          }
1946          setup = pucchCfg->choice.setup;
1947
1948          /* Resource Common */
1949          DU_ALLOC(setup->pucch_ResourceCommon, sizeof(long));
1950          if(!setup->pucch_ResourceCommon)
1951          {
1952             DU_LOG("\nERROR  -->  DU APP : PUCCH Config memory alloc failed");
1953             return RFAILED;
1954          }
1955          *setup->pucch_ResourceCommon = duPucchCfg.rsrcComm;
1956
1957          /* Group hopping */
1958          setup->pucch_GroupHopping = duPucchCfg.grpHop;
1959
1960          /* P0 nominal */
1961          DU_ALLOC(setup->p0_nominal, sizeof(long));
1962          if(!setup->p0_nominal)
1963          {
1964             DU_LOG("\nERROR  -->  DU APP : PUCCH Config memory alloc failed");
1965             return RFAILED;
1966          }
1967          *setup->p0_nominal = duPucchCfg.p0Nominal;
1968
1969          break;
1970       }
1971       default:
1972       {
1973          DU_LOG("\nERROR  -->  DU APP : Invalid PUCCH Config type");
1974          return RFAILED;
1975       }
1976    }
1977    return ROK;
1978 }/* BuildPucchCfgCommon */
1979
1980 /*******************************************************************
1981  *
1982  * @brief Builds UL BWP Common 
1983  *
1984  * @details
1985  *
1986  *    Function : BuildBwpUlCommon
1987  *
1988  *    Functionality:
1989  *      Builds UL BWP Common 
1990  *
1991  * @params[in] BWP_UplinkCommon_t pointer
1992  * @return ROK     - success
1993  *         RFAILED - failure
1994  *
1995  * ****************************************************************/
1996
1997 uint8_t BuildBwpUlCommon(BWP_UplinkCommon_t *bwp)
1998 {
1999    uint8_t     ret;
2000    UlCfgCommon duUlCfg;
2001
2002    duUlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
2003
2004    bwp->genericParameters.locationAndBandwidth = duUlCfg.locAndBw;
2005    bwp->genericParameters.subcarrierSpacing = duUlCfg.ulScsCarrier.scs;
2006
2007    /* RACH Config Common */
2008    DU_ALLOC(bwp->rach_ConfigCommon,\
2009    sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2010    if(!bwp->rach_ConfigCommon)
2011    {
2012       DU_LOG("\nERROR  -->  DU APP : UL BWP memory allocation failed");
2013       return RFAILED;
2014    }
2015    ret = BuildRachCfgCommon(bwp->rach_ConfigCommon);
2016    if(ret != ROK)
2017    {
2018       return RFAILED;
2019    }
2020    RachCfgCommonret=ROK;
2021
2022    /* PUSCH Config Common */
2023    DU_ALLOC(bwp->pusch_ConfigCommon,\
2024    sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2025    if(!bwp->pusch_ConfigCommon)
2026    {
2027       DU_LOG("\nERROR  -->  DU APP : UL BWP memory allocation failed");
2028       return RFAILED;
2029    } 
2030    ret = BuildPuschCfgCommon(bwp->pusch_ConfigCommon);
2031    if(ret != ROK)
2032    {
2033       return RFAILED;
2034    }
2035    PuschCfgCommonret = ROK;
2036
2037    /* PUCCH Config Common */
2038    DU_ALLOC(bwp->pucch_ConfigCommon,\
2039    sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2040    if(!bwp->pucch_ConfigCommon)
2041    {
2042       DU_LOG("\nERROR  -->  DU APP : UL BWP memory allocation failed");
2043       return RFAILED;
2044    } 
2045    ret = BuildPucchCfgCommon(bwp->pucch_ConfigCommon);
2046    if(ret != ROK)
2047    {
2048       return RFAILED;
2049    }
2050    return ROK;
2051 }/* BuildBwpUlCommon */
2052
2053 /*******************************************************************
2054  *
2055  * @brief Builds UL config common for SIB 
2056  *
2057  * @details
2058  *
2059  *    Function : BuildUlCfgCommSib
2060  *
2061  *    Functionality:
2062  *      Builds UL config common for SIB
2063  *
2064  * @params[in] UplinkConfigCommonSIB_t pointer
2065  * @return ROK     - success
2066  *         RFAILED - failure
2067  *
2068  * ****************************************************************/
2069
2070 uint8_t BuildUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2071 {
2072    uint8_t ret;
2073    /* UL frequency info */
2074    ret = BuildFreqInfoUl(&ulCfg->frequencyInfoUL);
2075    if(ret != ROK)
2076    {
2077       return RFAILED;
2078    }
2079    /* BWP Uplink Common */
2080    ret = BuildBwpUlCommon(&ulCfg->initialUplinkBWP);
2081    if(ret != ROK)
2082    {
2083       return RFAILED;
2084    }
2085    /* Time Alignment timer */
2086    ulCfg->timeAlignmentTimerCommon = \
2087    duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.timeAlignTimerComm;
2088
2089    return ROK;
2090 }/* BuildUlCfgCommSib */
2091
2092 /*******************************************************************
2093  *
2094  * @brief Builds TDD UL DL configuration common 
2095  *
2096  * @details
2097  *
2098  *    Function : BuildTddUlDlCfgComm
2099  *
2100  *    Functionality:
2101  *      Builds TDD UL DL configuration common
2102  *
2103  * @params[in] TDD_UL_DL_ConfigCommon_t pointer 
2104  * @return ROK     - success
2105  *         RFAILED - failure
2106  *
2107  * ****************************************************************/
2108
2109 uint8_t BuildTddUlDlCfgComm(TDD_UL_DL_ConfigCommon_t *tddCfg)
2110 {
2111    TddUlDlCfgCommon duTddCfg;
2112
2113    duTddCfg = duCfgParam.sib1Params.srvCellCfgCommSib.tddCfg;
2114
2115    /* Reference Subcarrier spacing */
2116    tddCfg->referenceSubcarrierSpacing = duTddCfg.refScs;
2117
2118    /* Pattern 1*/
2119    tddCfg->pattern1.dl_UL_TransmissionPeriodicity = duTddCfg.txPrd;
2120    tddCfg->pattern1.nrofDownlinkSlots = duTddCfg.numDlSlots;
2121    tddCfg->pattern1.nrofDownlinkSymbols = duTddCfg.numDlSymbols;
2122    tddCfg->pattern1.nrofUplinkSlots = duTddCfg.numUlSlots;
2123    tddCfg->pattern1.nrofUplinkSymbols = duTddCfg.numUlSymbols;
2124
2125    return ROK;
2126
2127 }/* BuildTddUlDlCfgComm */
2128
2129 /*******************************************************************
2130  * 
2131  * @brief Builds Serving cell config common in SIB1 message 
2132  * 
2133  * @details
2134  * 
2135  *     Function : BuildServCellCfgCommonSib
2136  * 
2137  *    Functionality: 
2138  *       Building Serving cell config common in SIB1 message
2139  *
2140  * @params[in] ServingCellConfigCommonSIB_t pointer
2141  * @return ROK     - success
2142  *         RFAILED - failure
2143  *
2144  * ****************************************************************/
2145 uint8_t BuildServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
2146 {
2147    SrvCellCfgCommSib    duSrvCellCfg;
2148    BIT_STRING_t         *ssbPosInBurst;
2149    uint8_t              ret;
2150    duSrvCellCfg = duCfgParam.sib1Params.srvCellCfgCommSib;
2151
2152    /* SSB Position in Burst */
2153    ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
2154    ssbPosInBurst->size = 1;
2155    DU_ALLOC(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
2156    if(!ssbPosInBurst->buf)
2157    {
2158       DU_LOG("\nERROR  -->  DU APP : Serving cell config common  memory allocation failure");
2159       return RFAILED;
2160    } 
2161    ssbPosInBurst->buf[0] = duSrvCellCfg.ssbPosInBurst;  
2162    ssbPosInBurst->bits_unused = 0;
2163
2164    switch(duSrvCellCfg.ssbPrdServingCell)
2165    {
2166       case SSB_PERIODICITY_5MS:
2167          srvCellCfg->ssb_PeriodicityServingCell = \
2168          ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms5;
2169          break;
2170       case SSB_PERIODICITY_10MS:
2171          srvCellCfg->ssb_PeriodicityServingCell = \
2172          ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms10;
2173          break;
2174       case SSB_PERIODICITY_20MS:
2175          srvCellCfg->ssb_PeriodicityServingCell = \
2176          ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms20;
2177          break;
2178       case SSB_PERIODICITY_40MS:
2179          srvCellCfg->ssb_PeriodicityServingCell = \
2180          ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms40;
2181          break;
2182       case SSB_PERIODICITY_80MS:
2183          srvCellCfg->ssb_PeriodicityServingCell = \
2184          ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms80;
2185          break;
2186       case SSB_PERIODICITY_160MS:
2187          srvCellCfg->ssb_PeriodicityServingCell = \
2188          ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms160;
2189          break;
2190    }
2191
2192    srvCellCfg->ss_PBCH_BlockPower = duSrvCellCfg.ssPbchBlockPwr;
2193
2194    /* Downlink config common */
2195    ret = BuildDlCfgCommSib(&srvCellCfg->downlinkConfigCommon);
2196    if(ret != ROK)
2197    {
2198       return RFAILED;
2199    }
2200    DlCfgCommSibret = ROK;
2201
2202    /* Uplink Config Comm */
2203    DU_ALLOC(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
2204    if(!srvCellCfg->uplinkConfigCommon)
2205    {
2206       DU_LOG("\nERROR  -->  DU APP : Serving cell config common  memory allocation failure");
2207       return RFAILED;
2208    }
2209    ret = BuildUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
2210    if(ret != ROK)
2211    {
2212       return RFAILED;
2213    }
2214    UlCfgCommSibret=ROK;
2215
2216    /* TDD UL DL Config Comm */
2217    DU_ALLOC(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
2218    if(!srvCellCfg->tdd_UL_DL_ConfigurationCommon)
2219    {
2220       DU_LOG("\nERROR  -->  DU APP : Serving cell config common  memory allocation failure");
2221       return RFAILED;
2222    }
2223    ret = BuildTddUlDlCfgComm(srvCellCfg->tdd_UL_DL_ConfigurationCommon);
2224    if(ret != ROK)
2225    {
2226       return RFAILED;
2227    }
2228    return ROK;
2229 }
2230
2231 /*******************************************************************
2232  *
2233  * @brief Builds SIB message in Served Cell Info
2234  *
2235  * @details
2236  *
2237  *    Function : BuildSib1Msg
2238  *
2239  *    Functionality: Building SIB message in Served Cell Info
2240  *
2241  * @return ROK     - success
2242  *         RFAILED - failure
2243  *
2244  * ****************************************************************/
2245 uint8_t BuildSib1Msg()
2246 {
2247    SIB1_t                   *sib1Msg;
2248    CellAccessRelatedInfo_t  *cellAccessInfo;
2249    uint8_t                  elementCnt;
2250    uint8_t                  ret1;
2251    asn_enc_rval_t           encRetVal; 
2252    uint8_t                  ret = RFAILED;
2253
2254    do
2255    {
2256       DU_ALLOC(sib1Msg, sizeof(SIB1_t));
2257       if(!sib1Msg)
2258       {   
2259          DU_LOG("\nERROR  -->  DU APP: SIB1 msg memory allocation failure");
2260          break;
2261       }   
2262
2263       elementCnt = ODU_VALUE_ONE;
2264
2265       /* PLMN list */
2266       cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
2267       cellAccessInfo->plmn_IdentityList.list.count = elementCnt;
2268       cellAccessInfo->plmn_IdentityList.list.size = elementCnt * sizeof(PLMN_IdentityInfo_t *);
2269
2270       ret1 =  BuildPlmnList(cellAccessInfo);
2271       if(ret1 != ROK)
2272       {
2273          break;
2274       }
2275       /* Connection Establish Failure Control */
2276       DU_ALLOC(sib1Msg->connEstFailureControl, sizeof(ConnEstFailureControl_t));
2277       if(!sib1Msg->connEstFailureControl)
2278       {
2279          DU_LOG("\nERROR  -->  DU APP: sib1Msg->connEstFailureControl memory allocation failure");
2280          break;
2281       }
2282       sib1Msg->connEstFailureControl->connEstFailCount =\
2283       duCfgParam.sib1Params.connEstFailCnt;
2284       sib1Msg->connEstFailureControl->connEstFailOffsetValidity =\
2285       duCfgParam.sib1Params.connEstFailOffValidity;
2286
2287       /* SI Scheduling Info */
2288       DU_ALLOC(sib1Msg->si_SchedulingInfo, sizeof(SI_SchedulingInfo_t));
2289       if(!sib1Msg->si_SchedulingInfo)
2290       {
2291          DU_LOG("\nERROR  -->  DU APP: sib1Msg->si_SchedulingInfo memory allocation failure");
2292          break;
2293       } 
2294       elementCnt = ODU_VALUE_ONE;
2295       sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count = elementCnt;
2296       sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size = elementCnt *
2297          sizeof(struct SchedulingInfo *);
2298       ret1 = BuildSiSchedInfoList(&sib1Msg->si_SchedulingInfo->schedulingInfoList);
2299       if(ret1 != ROK)
2300       {
2301          break;
2302       }
2303       sib1Msg->si_SchedulingInfo->si_WindowLength = duCfgParam.sib1Params.siSchedInfo.winLen;
2304
2305       /* Serving Cell Config Common */
2306       DU_ALLOC(sib1Msg->servingCellConfigCommon, sizeof(ServingCellConfigCommonSIB_t));
2307       if(!sib1Msg->servingCellConfigCommon)
2308       {
2309          DU_LOG("\nERROR  -->  DU APP: sib1Msg->servingCellConfigCommon memory allocation failure");
2310          break;
2311       }
2312       ret1 =  BuildServCellCfgCommonSib(sib1Msg->servingCellConfigCommon);
2313       if(ret1 != ROK)
2314       {
2315          break;
2316       }
2317
2318       xer_fprint(stdout, &asn_DEF_SIB1, sib1Msg);
2319
2320       /* Encode the F1SetupRequest type as APER */
2321       memset(encBuf, 0, ENC_BUF_MAX_LEN);
2322       encBufSize = 0;
2323       encRetVal = aper_encode(&asn_DEF_SIB1, 0, sib1Msg, PrepFinalEncBuf,\
2324             encBuf);
2325       printf("\nencbufSize: %d\n", encBufSize);
2326       if(encRetVal.encoded == -1)
2327       {
2328          DU_LOG("\nERROR  -->  DU APP : Could not encode SIB1 structure (at %s)\n",\
2329                encRetVal.failed_type ?
2330                encRetVal.failed_type->name :
2331                "unknown");
2332          break;
2333       }
2334       for(int i=0; i< encBufSize; i++)
2335       {
2336          printf("%x\t",encBuf[i]);
2337       }
2338       printf("\n");
2339
2340       ret = ROK;
2341       break; 
2342    }while(true);
2343
2344    FreeSib1Msg(sib1Msg);
2345
2346    return ret;
2347
2348
2349 }
2350 /*******************************************************************
2351  *
2352  * @brief      :  deallocating the memory of BuildSib1Msg 
2353  *
2354  * @details
2355  *
2356  *     Function : FreeFreqInfoDl
2357  *
2358  *    Functionality: Freeing memory of BuildFreqInfoDl 
2359  *
2360  * @params[in] : FrequencyInfoDL_SIB_t *frequencyInfoDL
2361  * @return     :  void
2362  *
2363  *******************************************************************/
2364 void FreeFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL)
2365 {
2366    uint8_t idx=0;
2367    uint8_t idx1=0;
2368
2369    /* Free DL frequency info */
2370    if(!frequencyInfoDL->frequencyBandList.list.array)
2371    {
2372       /*Free Frequency band indicator */
2373       if(!frequencyInfoDL->frequencyBandList.list.array[idx])
2374       {
2375          if(!frequencyInfoDL->frequencyBandList.list.array[idx]->\
2376                freqBandIndicatorNR)
2377          { 
2378             if(!frequencyInfoDL->scs_SpecificCarrierList.list.array)
2379             {
2380                for(idx1 = 0;idx1<frequencyInfoDL->scs_SpecificCarrierList.list.count;idx1++)
2381                {
2382                   if(!frequencyInfoDL->scs_SpecificCarrierList.list.array[idx1])
2383                   {
2384                      DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.\
2385                            array[idx1], sizeof(SCS_SpecificCarrier_t));
2386                   }
2387                }
2388                DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.array,
2389                      frequencyInfoDL->scs_SpecificCarrierList.list.size);
2390             }
2391             DU_FREE(frequencyInfoDL->frequencyBandList.list.\
2392                   array[idx]->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
2393          }
2394       }
2395       for(idx = 0; idx <frequencyInfoDL->frequencyBandList.list.count; idx++)
2396       {
2397          if(!frequencyInfoDL->frequencyBandList.list.array[idx])
2398          { 
2399             DU_FREE(frequencyInfoDL->frequencyBandList.list.array[idx],\
2400                   sizeof(NR_MultiBandInfo_t));
2401          }
2402       }
2403       DU_FREE(frequencyInfoDL->frequencyBandList.list.array,\
2404             frequencyInfoDL->frequencyBandList.list.size);
2405    }
2406 }
2407 /*******************************************************************
2408  *
2409  * @brief  :  deallocating the memory of BuildSib1Msg
2410  *
2411  * @details
2412  *
2413  *     Function :  FreeCommonSerachSpaceList
2414  *
2415  *     Functionality:  deallocating the memory of BuildCommonSerachSpaceList
2416  *
2417  * @params[in] :struct PDCCH_ConfigCommon__commonSearchSpaceList  *searchSpclist
2418  * @return  : void
2419  *
2420  *******************************************************************/
2421 void FreeCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList
2422       *searchSpclist)
2423 {
2424    uint8_t idx=0;
2425    SearchSpace_t *searchSpace= NULLP;
2426
2427    if(!searchSpclist->list.array)
2428    {
2429       if( searchSpclist->list.array[idx] != NULLP)
2430       {
2431          searchSpace= searchSpclist->list.array[idx];
2432          if(!searchSpace->controlResourceSetId)
2433          {
2434             if(!searchSpace->monitoringSlotPeriodicityAndOffset)
2435             {
2436                if(!searchSpace->monitoringSymbolsWithinSlot)
2437                {
2438                   if(!searchSpace->monitoringSymbolsWithinSlot->buf)
2439                   {
2440                      if(!searchSpace->nrofCandidates)
2441                      {
2442                         if(!searchSpace->searchSpaceType)
2443                         {
2444                            switch(searchSpace->searchSpaceType->present)
2445                            {
2446                               case SearchSpace__searchSpaceType_PR_NOTHING:
2447                                  break;
2448                               case SearchSpace__searchSpaceType_PR_common:
2449                               {    
2450                                  if(!searchSpace->searchSpaceType->choice.common)
2451                                  {
2452                                     if(!searchSpace->searchSpaceType->choice.\
2453                                           common->dci_Format0_0_AndFormat1_0)
2454                                     {
2455                                        DU_FREE(searchSpace->searchSpaceType->choice.\
2456                                              common->dci_Format0_0_AndFormat1_0,sizeof(struct\
2457                                                 SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
2458                                     }
2459                                     DU_FREE(searchSpace->searchSpaceType->choice.common,\
2460                                           sizeof(struct SearchSpace__searchSpaceType__common));
2461                                  }
2462                                  break;
2463                               }
2464                               case SearchSpace__searchSpaceType_PR_ue_Specific:
2465                                  break;
2466                               default:
2467                                  break;
2468                            }
2469                            DU_FREE(searchSpace->searchSpaceType,\
2470                                  sizeof( struct SearchSpace__searchSpaceType));
2471                         }
2472                         DU_FREE(searchSpace->nrofCandidates,\
2473                               sizeof(struct SearchSpace__nrofCandidates));
2474                      }
2475                      DU_FREE(searchSpace->monitoringSymbolsWithinSlot->buf,\
2476                            searchSpace->monitoringSymbolsWithinSlot->size);
2477                   }
2478                   DU_FREE(searchSpace->monitoringSymbolsWithinSlot,\
2479                         sizeof(BIT_STRING_t));
2480                }
2481                DU_FREE(searchSpace->monitoringSlotPeriodicityAndOffset,\
2482                      sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
2483             }
2484             DU_FREE(searchSpace->controlResourceSetId,sizeof(ControlResourceSetId_t));
2485          }
2486       }  
2487       for(idx = 0; idx < searchSpclist->list.count; idx++)
2488       {  
2489          if(!searchSpclist->list.array[idx])
2490          { 
2491             DU_FREE(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
2492          }
2493       }
2494       DU_FREE(searchSpclist->list.array, searchSpclist->list.size)
2495    }
2496 }
2497 /*******************************************************************
2498  *
2499  * @brief : deallocating the memory of BuildSib1Msg
2500  *
2501  * @details
2502  *
2503  *     Function : FreeBwpDlCommon
2504  *
2505  *     Functionality :Deallocating memory of BuildBwpDlCommon
2506  *
2507  * @params[in] : BWP_DownlinkCommon_t *bwp
2508  *
2509  * @return      : void
2510  *
2511  *******************************************************************/
2512 void FreeBwpDlCommon(BWP_DownlinkCommon_t *bwp)
2513 {
2514    uint8_t idx =0;
2515    struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg=bwp->pdsch_ConfigCommon;
2516    struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg=bwp->pdcch_ConfigCommon;
2517    pdcchCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg.present; 
2518    pdschCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg.present;
2519
2520    if(!bwp->pdcch_ConfigCommon)
2521    {
2522       if(!bwp->pdsch_ConfigCommon)
2523       {
2524          switch( pdschCfg->present)
2525          {
2526             case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
2527             {
2528                //TODO
2529                break;
2530             }
2531             case  BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
2532             { 
2533                //TODO
2534                break;
2535             }
2536             case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
2537             {
2538                if(!pdschCfg->choice.setup)
2539                {
2540                   if(!pdschCfg->choice.setup->pdsch_TimeDomainAllocationList)
2541                   {
2542                      if(!pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array)
2543                      {
2544                         if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!= NULLP)
2545                         {
2546                            if(!pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0)
2547                            {
2548                               DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0,\
2549                                     sizeof(long)); 
2550                            }
2551                         }
2552                         for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2553                         {
2554                            if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!=
2555                                  NULLP)
2556                            {
2557                               DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx],\
2558                                     sizeof(PDSCH_TimeDomainResourceAllocation_t));
2559                            }
2560                         }
2561                         DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array,\
2562                               pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.size);
2563                      }
2564                      DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList,\
2565                            sizeof(PDSCH_TimeDomainResourceAllocationList_t));
2566                   }
2567                   DU_FREE(pdschCfg->choice.setup,
2568                         sizeof(PDSCH_ConfigCommon_t));
2569                }
2570             }
2571             default:
2572                break;
2573          }
2574          DU_FREE(bwp->pdsch_ConfigCommon,\
2575                sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
2576       }
2577
2578       switch(pdcchCfg->present)
2579       {
2580          case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
2581          {
2582             //TODO
2583             break;
2584          }
2585          case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
2586          {
2587             //TODO
2588             break;
2589          }
2590          case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
2591          {
2592             if(!pdcchCfg->choice.setup)
2593             {
2594                /* Control Resource Set Zero */
2595                if(! pdcchCfg->choice.setup->controlResourceSetZero)
2596                {
2597                   /* Search space zero */
2598                   if(! pdcchCfg->choice.setup->searchSpaceZero)
2599                   {
2600                      /* Common Search Space List */
2601                      if(! pdcchCfg->choice.setup->commonSearchSpaceList)
2602                      {
2603                         if(CommonSerachSpaceListret==ROK)
2604                         {
2605                            if(!pdcchCfg->choice.setup->searchSpaceSIB1)
2606                            {
2607                               if(!pdcchCfg->choice.setup->pagingSearchSpace)
2608                               {
2609                                  if(!pdcchCfg->choice.setup->ra_SearchSpace)
2610                                  {
2611                                     DU_FREE(pdcchCfg->choice.setup->ra_SearchSpace,
2612                                           sizeof(SearchSpaceId_t));
2613                                  }
2614                                  DU_FREE( pdcchCfg->choice.setup->pagingSearchSpace,
2615                                        sizeof(SearchSpaceId_t));
2616                               }
2617                               DU_FREE( pdcchCfg->choice.setup->searchSpaceSIB1,
2618                                     sizeof(SearchSpaceId_t));
2619                            }
2620                         }
2621
2622                         FreeCommonSerachSpaceList(pdcchCfg->choice.setup->commonSearchSpaceList);
2623
2624                         DU_FREE( pdcchCfg->choice.setup->commonSearchSpaceList,\
2625                               sizeof(struct
2626                                  PDCCH_ConfigCommon__commonSearchSpaceList));
2627                      }
2628                      DU_FREE( pdcchCfg->choice.setup->searchSpaceZero,
2629                            sizeof(SearchSpaceZero_t));
2630                   }
2631                   DU_FREE( pdcchCfg->choice.setup->controlResourceSetZero,
2632                         sizeof(ControlResourceSetZero_t));
2633                }
2634                DU_FREE(pdcchCfg->choice.setup,
2635                      sizeof(PDCCH_ConfigCommon_t));
2636             }
2637             break;
2638          }
2639          default:
2640             break;
2641       }
2642       DU_FREE(bwp->pdcch_ConfigCommon,sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
2643    }
2644 }
2645 /*******************************************************************
2646  *
2647  * @brief  deallocating the memory of BuildSib1Msg
2648  *
2649  * @details
2650  *
2651  *     Function: FreeUlCfgCommSib
2652  *
2653  *     Functionality deallocating the memory of BuildUlCfgCommSib
2654  *
2655  * @params[in] : UplinkConfigCommonSIB_t *ulCfg
2656  *
2657  * @return : void
2658  *
2659  *******************************************************************/
2660 void FreeUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2661 {
2662    uint8_t                 idx=0;
2663    RACH_ConfigCommon_t    *setup;
2664    BWP_UplinkCommon_t     *bwp=&ulCfg->initialUplinkBWP;
2665    struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList;
2666    struct BWP_UplinkCommon__rach_ConfigCommon  *rachCfg;
2667    struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg;
2668    struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg;
2669    puschCfg=ulCfg->initialUplinkBWP.pusch_ConfigCommon;
2670    rachCfg =bwp->rach_ConfigCommon;
2671    scsCarrierList    = &ulCfg->frequencyInfoUL.scs_SpecificCarrierList;
2672
2673    if(!scsCarrierList->list.array)
2674    {
2675       if(!ulCfg->frequencyInfoUL.p_Max)
2676       {
2677          if(FreqInfoUlret == ROK)
2678          {
2679             if(!bwp->rach_ConfigCommon)
2680             {
2681                if(RachCfgCommonret== ROK)
2682                {
2683                   if(!bwp->pusch_ConfigCommon)
2684                   {
2685
2686                      if(PuschCfgCommonret==ROK)
2687                      {
2688                         if(!bwp->pucch_ConfigCommon)
2689                         {
2690                            pucchCfg=bwp->pucch_ConfigCommon;
2691                            switch(pucchCfg->present)
2692                            {
2693                               case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
2694                                  break;
2695                               case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
2696                                  break;
2697                               case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
2698                               {
2699                                  if(!pucchCfg->choice.setup)
2700                                  {
2701
2702                                     if(!pucchCfg->choice.setup->pucch_ResourceCommon)
2703                                     {
2704                                        if(!pucchCfg->choice.setup->p0_nominal)
2705                                        {
2706                                           DU_FREE(pucchCfg->choice.setup->p0_nominal,
2707                                                 sizeof(long));
2708                                        }
2709                                        DU_FREE(pucchCfg->choice.setup->pucch_ResourceCommon,
2710                                              sizeof(long));
2711                                     }
2712                                     DU_FREE(pucchCfg->choice.setup,
2713                                           sizeof(PUCCH_ConfigCommon_t));
2714                                  }
2715                               }
2716                               default:
2717                                  break;
2718                            }
2719                            DU_FREE(bwp->pucch_ConfigCommon,\
2720                            sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2721                         }
2722                      }
2723                      switch(puschCfg->present)
2724                      {
2725                         case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
2726                            break;
2727                         case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
2728                            break;
2729                         case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
2730                         {
2731                            if(!puschCfg->choice.setup)
2732                            {
2733
2734                               if(! puschCfg->choice.setup->pusch_TimeDomainAllocationList)
2735                               {
2736                                  if(! puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array)
2737                                  {
2738                                     if(!puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx])
2739                                     {
2740                                        if(!puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx]->k2)
2741                                        {
2742                                           if(! puschCfg->choice.setup->msg3_DeltaPreamble)
2743                                           {
2744                                              if(!puschCfg->choice.setup->p0_NominalWithGrant)
2745                                              {
2746                                                 DU_FREE(puschCfg->choice.setup->p0_NominalWithGrant,
2747                                                       sizeof(long));
2748                                              }
2749                                              DU_FREE(puschCfg->choice.setup->msg3_DeltaPreamble,
2750                                                    sizeof(long));
2751                                           }
2752                                           DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.\
2753                                                 array[idx]->k2, sizeof(long));
2754                                        }
2755                                     }
2756                                     for(idx=0;
2757                                           idx<puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.count;
2758                                           idx++)
2759                                     {
2760                                        if(!puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx])
2761                                        {
2762                                           DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx],\
2763                                                 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2764                                        }
2765                                     }
2766                                     DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array,\
2767                                           puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.size);
2768                                  }
2769                                  DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList,\
2770                                        sizeof(PUSCH_TimeDomainResourceAllocationList_t));
2771                               }
2772                               DU_FREE(puschCfg->choice.setup,
2773                                     sizeof(PUSCH_ConfigCommon_t));
2774                            }
2775                         }
2776                         default :
2777                            break;
2778                      }
2779
2780                      DU_FREE(bwp->pusch_ConfigCommon,\
2781                            sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2782                   }
2783                }
2784                switch(rachCfg->present)
2785                {
2786                   case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
2787                      break;
2788                   case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
2789                      break;
2790                   case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
2791                   {
2792                      if(!rachCfg->choice.setup)
2793                      {
2794                         setup = rachCfg->choice.setup;
2795                         if(!setup->totalNumberOfRA_Preambles)
2796                         {
2797                            if(!setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
2798                            {
2799                               if(!setup->rsrp_ThresholdSSB)
2800                               {
2801                                  if(!setup->msg1_SubcarrierSpacing)
2802                                  {
2803                                     DU_FREE(setup->msg1_SubcarrierSpacing,
2804                                           sizeof(SubcarrierSpacing_t));
2805                                  }
2806                                  DU_FREE(setup->rsrp_ThresholdSSB,
2807                                        sizeof(RSRP_Range_t));
2808                               }
2809                               DU_FREE(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
2810                                     sizeof(struct
2811                                        RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
2812                            }
2813                            DU_FREE(setup->totalNumberOfRA_Preambles,
2814                                  sizeof(long));
2815                         }
2816
2817                         DU_FREE(rachCfg->choice.setup,
2818                               sizeof(RACH_ConfigCommon_t));
2819                      }
2820                   }
2821                   default:
2822                      break;
2823                }
2824                DU_FREE(bwp->rach_ConfigCommon,\
2825                sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2826             }
2827          }
2828          DU_FREE(ulCfg->frequencyInfoUL.p_Max, sizeof(P_Max_t));
2829       }    
2830       for(idx = 0; idx < scsCarrierList->list.count; idx++)
2831       {
2832          if(!scsCarrierList->list.array[idx])
2833          {
2834             DU_FREE(scsCarrierList->list.array[idx],
2835                   sizeof(SCS_SpecificCarrier_t));
2836          }
2837       }
2838       DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
2839    }
2840 }
2841 /*******************************************************************
2842  *
2843  * @brief : Deallocating memory of  SIB1 message
2844  *
2845  * @details
2846  *
2847  *   Function : FreeServCellCfgCommonSib
2848  *
2849  *   Functionality: Deallocating memory of BuildServCellCfgCommonSib
2850  *
2851  * @params[in] : ServingCellConfigCommonSIB_t *srvCellCfg
2852  * @return     : void
2853  *
2854  *******************************************************************/
2855 void FreeServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
2856 {
2857    BIT_STRING_t         *ssbPosInBurst;
2858    ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
2859    DownlinkConfigCommonSIB_t *dlCfg=&srvCellCfg->downlinkConfigCommon;
2860
2861    if(!ssbPosInBurst->buf)
2862    {
2863       /* Free DL frequency info */
2864       if(FreqInfoDlret == ROK)
2865       {
2866          if(DlCfgCommSibret == ROK)
2867          {
2868             /* Uplink Config Comm */
2869             if(!srvCellCfg->uplinkConfigCommon)
2870             {
2871                if(UlCfgCommSibret==ROK)
2872                {
2873                   /* TDD UL DL Config Comm */
2874                   if(!srvCellCfg->tdd_UL_DL_ConfigurationCommon)
2875                   {
2876                      DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationCommon,
2877                            sizeof(TDD_UL_DL_ConfigCommon_t));
2878                   }
2879                }
2880                FreeUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
2881                DU_FREE(srvCellCfg->uplinkConfigCommon,
2882                      sizeof(UplinkConfigCommonSIB_t));  
2883             }
2884          }
2885          FreeBwpDlCommon(&dlCfg->initialDownlinkBWP);
2886       }
2887       FreeFreqInfoDl(&dlCfg->frequencyInfoDL);
2888       DU_FREE(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
2889    }
2890 }
2891 /*******************************************************************
2892  *
2893  * @brief   : Deallcating memory of the function BuildSib1Msg
2894  *
2895  * @details
2896  *
2897  *     Function :  FreeSib1Msg
2898  *
2899  *    Functionality: Deallcating memory of the function BuildSib1Msg
2900  *
2901  * @params[in] ServingCellConfigCommonSIB_t pointer
2902  * @return   void
2903  *
2904  *******************************************************************/
2905 void FreeSib1Msg(SIB1_t *sib1Msg)
2906 {
2907    uint8_t idx=0;
2908    uint8_t idx1=0;
2909    uint8_t idx2=0; 
2910    CellIdentity_t           *cellIdentity = NULLP;
2911    CellAccessRelatedInfo_t  *cellAccessInfo ;
2912    struct PLMN_IdentityInfo__plmn_IdentityList     *plmnIdInfo;
2913
2914
2915    if(sib1Msg != NULLP)
2916    {
2917       cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
2918       if(cellAccessInfo->plmn_IdentityList.list.array !=NULLP)
2919       {
2920          if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
2921          {
2922             plmnIdInfo =
2923                &cellAccessInfo->plmn_IdentityList.list.array[idx]->plmn_IdentityList;
2924
2925             if(plmnIdInfo->list.array !=NULLP)
2926             {
2927                if(!plmnIdInfo->list.array[idx])
2928                {
2929                   if(!plmnIdInfo->list.array[idx]->mcc)
2930                   {
2931                      if(!(plmnIdInfo->list.array[idx]->mcc->list.array))
2932                      {
2933                         if(!plmnIdInfo->list.array[idx]->mnc.list.array)
2934                         {             
2935                            /*Free Tracking Area Code */
2936                            if(!cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode)
2937                            {        
2938                               /*Free RANAC */
2939                               if(!cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf)
2940                               {    
2941                                  /* Free CellIdentity */
2942                                  if(!cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac)
2943                                  {
2944                                     cellIdentity
2945                                        =&cellAccessInfo->plmn_IdentityList.\
2946                                        list.array[idx]->cellIdentity;
2947                                     if(!cellIdentity->buf)
2948                                     {
2949                                        /*Free Connection Establish Failure Control */
2950                                        if(!sib1Msg->connEstFailureControl)
2951                                        {
2952                                           /*Free Serving Cell Config Common */
2953                                           if(!sib1Msg->si_SchedulingInfo)
2954                                           {
2955                                              /* Free Serving Cell Config Common* */
2956                                              if(!sib1Msg->servingCellConfigCommon)
2957                                              {
2958                                                 /*Free BuildServCellCfgCommonSib*/
2959                                                 FreeServCellCfgCommonSib(\
2960                                                       sib1Msg->servingCellConfigCommon);
2961
2962                                                 DU_FREE(sib1Msg->servingCellConfigCommon,
2963                                                       sizeof(ServingCellConfigCommonSIB_t));
2964                                              }
2965
2966                                              DU_FREE(sib1Msg->si_SchedulingInfo,
2967                                                    sizeof(SI_SchedulingInfo_t));
2968                                           }
2969
2970                                           DU_FREE(sib1Msg->connEstFailureControl,
2971                                                 sizeof(ConnEstFailureControl_t));
2972                                        }
2973                                        DU_FREE(cellIdentity->buf,cellIdentity->size);
2974
2975                                     }
2976                                     DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac, sizeof(RAN_AreaCode_t)); 
2977
2978                                  }
2979                                  DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf,\
2980                                        cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->size);
2981
2982                               }
2983                               DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode\
2984                                     , sizeof(TrackingAreaCode_t));
2985                            }
2986
2987                            for(idx2=0; idx2<plmnIdInfo->list.array[idx1]->mnc.list.count; idx2++)
2988                            {
2989                               if(!plmnIdInfo->list.array[idx2]->mnc.list.array[idx2])
2990                               {
2991                                  DU_FREE(plmnIdInfo->list.array[idx2]->mnc.list.array[idx2],
2992                                        sizeof(MCC_MNC_Digit_t));
2993                               } 
2994                            }
2995                            DU_FREE(plmnIdInfo->list.array[idx]->mnc.list.array,
2996                                  plmnIdInfo->list.array[idx1]->mnc.list.size);
2997                         }
2998
2999                         for(idx1=0; idx1<plmnIdInfo->list.array[idx]->mcc->list.count; idx1++)
3000                         {
3001                            if(plmnIdInfo->list.array[idx]->mcc->list.array[idx1]!=NULLP)
3002                            {
3003                               DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array[idx1],\
3004                                     sizeof(MCC_MNC_Digit_t));
3005                            }
3006
3007                         }
3008                         DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array,\
3009                               plmnIdInfo->list.array[idx]->mcc->list.size)
3010                      }
3011                      DU_FREE(plmnIdInfo->list.array[idx]->mcc,sizeof(MCC_t));
3012                   }
3013                }
3014                for(idx1=0; idx1<plmnIdInfo->list.count; idx1++)
3015                {
3016                   if(!(plmnIdInfo->list.array[idx1]))
3017                   {
3018                      DU_FREE(plmnIdInfo->list.array[idx1],
3019                            sizeof(PLMN_IdentitY_t));
3020                   }
3021                }
3022                DU_FREE(plmnIdInfo->list.array, plmnIdInfo->list.size);
3023             }
3024          }
3025          for(idx=0; idx<cellAccessInfo->plmn_IdentityList.list.count; idx++)
3026          {
3027             if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3028             { 
3029                DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx],
3030                      sizeof(PLMN_IdentityInfo_t));
3031             }
3032          }
3033          DU_FREE(cellAccessInfo->plmn_IdentityList.list.array,
3034                cellAccessInfo->plmn_IdentityList.list.size);
3035       }
3036       DU_FREE(sib1Msg, sizeof(SIB1_t)); 
3037    }
3038
3039 }
3040
3041 /**********************************************************************
3042   End of file
3043  **********************************************************************/