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