MAC Clean-up [Issue-ID: ODUHIGH-212]
[o-du/l2.git] / src / du_app / du_cfg.c
index 72b60e9..a076ffa 100644 (file)
 #include "lrg.h"
 #include "lkw.x"
 #include "lrg.x"
+#include "du_app_mac_inf.h"
 #include "du_cfg.h"
 #include "du_mgr.h"
+#include "du_utils.h"
+#include "OCTET_STRING.h"
+#include "BIT_STRING.h"
+#include "odu_common_codec.h"
 #include "du_sys_info_hdl.h"
 #include "MIB.h"
 #include "SearchSpace.h"
@@ -32,7 +37,6 @@
 #include "SI-SchedulingInfo.h"
 #include "ConnEstFailureControl.h"
 #include "PLMN-IdentityInfo.h"
-#include "odu_common_codec.h"
 #include "PDSCH-TimeDomainResourceAllocation.h"
 #include "BCCH-Config.h"
 #include "PagingCycle.h"
@@ -200,15 +204,15 @@ S16 readMacCfg()
    duCfgParam.macCellCfg.prachCfg.fdm[0].numUnusedRootSeq = NUM_UNUSED_ROOT_SEQ;
    if(duCfgParam.macCellCfg.prachCfg.fdm[0].numUnusedRootSeq != 0)
    {
-      DU_ALLOC(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq, 
-           NUM_UNUSED_ROOT_SEQ * sizeof(U8));
-      if(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq == NULLP)
-      {
-        DU_LOG("\nDU_APP : Memory allocation failed");
-        RETVALUE(RFAILED);
-      }
-      *(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq) = UNUSED_ROOT_SEQ;
-   }
+       DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq, 
+       NUM_UNUSED_ROOT_SEQ * sizeof(uint8_t));
+        if(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq == NULLP)
+       {
+           DU_LOG("\nDU_APP : Memory allocation failed");
+           RETVALUE(RFAILED);
+       }
+       *(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq) = UNUSED_ROOT_SEQ;
+    }
    duCfgParam.macCellCfg.prachCfg.ssbPerRach = SSB_PER_RACH;
    duCfgParam.macCellCfg.prachCfg.prachMultCarrBand = PRACH_MULT_CARRIER_BAND;
    duCfgParam.macCellCfg.prachCfg.raContResTmr = RA_CONT_RES_TIMER;
@@ -226,7 +230,7 @@ S16 readMacCfg()
 
    /* fill SIB1 configuration */
    duCfgParam.macCellCfg.sib1Cfg.sib1PduLen = duCfgParam.srvdCellLst[0].duSysInfo.sib1Len;
-   DU_ALLOC(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu,duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
+   DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu,duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
    memcpy(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu, duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg, \
         duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
    duCfgParam.macCellCfg.sib1Cfg.sib1NewTxPeriod = SIB1_NEW_TX_PERIOD;
@@ -800,44 +804,6 @@ S16 duReadCfg()
    return ROK;
 }
 
-/*******************************************************************
- *
- * @brief Converts bit strings to integer
- *
- * @details
- *
- *    Function : bitStringToInt
- *
- *    Functionality:
- *      - Converts ASN bit string format IEs to integer type
- *
- * @params[in] void
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-S16 bitStringToInt(BIT_STRING_t *bitString, U16 *val)
-{
-   U16 idx;
-   if(bitString->buf == NULL || bitString->size <= 0)
-   {
-      DU_LOG("\nDU_APP : Bit string is empty");
-      return RFAILED;
-   }
-
-   for(idx=0; idx< bitString->size-1; idx++)
-   {
-      *val |= bitString->buf[idx];
-      *val <<= 8;
-   }
-
-   *val |= bitString->buf[idx];
-   *val >>= bitString->bits_unused;
-
-   return ROK;
-}
-
-
 /**********************************************************************
   End of file
  **********************************************************************/