Merging changes from ODU_Dev_Bronze_Rel to master
[o-du/l2.git] / src / du_app / du_cfg.c
index d619686..4fd8612 100644 (file)
 
 /* This file contains all utility functions */
 #include "du_cfg.h"
+#include "MIB.h"
+#include "PLMN-IdentityInfo.h"
+#include "odu_common_codec.h"
 
 extern DuCfgParams duCfgParam;
+extern char encBuf[ENC_BUF_MAX_LEN];
 
 
 /* Filling Slot configuration as :
@@ -202,6 +206,8 @@ S16 readCfg()
 {
    U8 i,j,k;
    U32 ipv4_du, ipv4_cu;
+       MibParams mib;
+   Sib1Params sib1;    
 
    cmInetAddr((S8*)DU_IP_V4_ADDR, &ipv4_du);
    cmInetAddr((S8*)CU_IP_V4_ADDR, &ipv4_cu);
@@ -232,6 +238,32 @@ S16 readCfg()
    duCfgParam.duId = DU_ID;    
    strcpy((char*)duCfgParam.duName,DU_NAME);
 
+   /* Mib Params */
+       mib.sysFrmNum = SYS_FRAME_NUM;
+       mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs15or60;
+       mib.ssb_SubcarrierOffset = SSB_SC_OFFSET; 
+       mib.dmrs_TypeA_Position = MIB__dmrs_TypeA_Position_pos2;
+       mib.controlResourceSetZero = CORESET_ZERO;
+       mib.searchSpaceZero = SEARCH_SPACE_ZERO;
+       mib.cellBarred = MIB__cellBarred_barred;
+       mib.intraFreqReselection =
+               MIB__intraFreqReselection_notAllowed;
+       duCfgParam.mibParams = mib;
+
+   /* SIB1 Params */
+       sib1.plmn.mcc[0] = PLMN_MCC0;
+       sib1.plmn.mcc[1] = PLMN_MCC1;
+       sib1.plmn.mcc[2] = PLMN_MCC2;
+       sib1.plmn.mnc[0] = PLMN_MNC0;
+       sib1.plmn.mnc[1] = PLMN_MNC1;
+       sib1.plmn.mnc[2] = PLMN_MNC2;
+       sib1.tac = DU_TAC;
+       sib1.ranac = DU_RANAC;
+       sib1.cellIdentity = CELL_IDENTITY;
+       sib1.cellResvdForOpUse =\ 
+               PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved;
+       duCfgParam.sib1Params = sib1;
+
    for(i=0; i<DEFAULT_CELLS; i++)
    { 
       duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.nrCgi.plmn.mcc[0] = PLMN_MCC0;
@@ -357,14 +389,33 @@ S16 readCfg()
          duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].ranac = NR_RANAC;
       }
 
-      /*gnb DU System Info */
-      //TODO: uncomment duCfgParam.srvdCellLst[i].duSysInfo.mibMsg;  //to do
-      //TODO: uncomment duCfgParam.srvdCellLst[i].duSysInfo.sib1Msg; //to do
-   }
+      /*gnb DU System Info mib msg*/
+          BuildMibMsg();
+               DU_ALLOC(duCfgParam.srvdCellLst[i].duSysInfo.mibMsg,\
+                               strlen(encBuf));
+          if(!(duCfgParam.srvdCellLst[i].duSysInfo.mibMsg))
+               {
+         DU_LOG("\nDU_APP: Memory allocation failure");
+                       return RFAILED;
+               }
+               strcpy(duCfgParam.srvdCellLst[i].duSysInfo.mibMsg, encBuf);
+
+      /*gnb DU System Info mib msg*/
+      BuildSib1Msg();
+               DU_ALLOC(duCfgParam.srvdCellLst[i].duSysInfo.sib1Msg,\
+                               encBufSize);
+          if(!(duCfgParam.srvdCellLst[i].duSysInfo.sib1Msg))
+               {
+         DU_LOG("\nDU_APP: Memory allocation failure");
+                       return RFAILED;
+               }
+               for(int x=0; x<encBufSize; x++)
+               {
+                  duCfgParam.srvdCellLst[i].duSysInfo.sib1Msg[x]=\
+                       encBuf[x];
+          }
 
-   /* RRC Version,Extended RRC Version */
-   //TODO: uncomment duCfgParam.rrcVersion.rrcVer; //to do
-   //TODO: uncomment duCfgParam.rrcVersion.extRrcVer; //to do
+   }
 
    if(readClCfg() != ROK)
    {