U8, U16, U32 data type changes
[o-du/l2.git] / src / 5gnrsch / rg_sch_l2m.c
index 6e632dc..e9cab73 100755 (executable)
@@ -14,7 +14,7 @@
 #   See the License for the specific language governing permissions and        #
 #   limitations under the License.                                             #
 ################################################################################
-*******************************************************************************
+*******************************************************************************/
 
 /************************************************************************
  
 */
 
 /* header include files -- defines (.h) */
-#include "envopt.h"        /* environment options */
-#include "envdep.h"        /* environment dependent */
-#include "envind.h"        /* environment independent */
-#include "gen.h"           /* general layer */
-#include "ssi.h"           /* system service interface */
-#include "cm_hash.h"       /* common hash list */
-#include "cm_llist.h"      /* common linked list library */
-#include "cm_err.h"        /* common error */
-#include "cm_lte.h"        /* common LTE */
+#include "common_def.h"
 #include "lrg.h"
 #include "rgr.h"
 #include "rgm.h"
 #include "rl_common.h"
 
 /* header/extern include files (.x) */
-#include "gen.x"           /* general layer typedefs */
-#include "ssi.x"           /* system services typedefs */
-#include "cm5.x"           /* common timers */
-#include "cm_hash.x"       /* common hash list */
-#include "cm_lib.x"        /* common library */
-#include "cm_llist.x"      /* common linked list */
-#include "cm_mblk.x"       /* memory management */
-#include "cm_tkns.x"       /* common tokens */
-#include "cm_lte.x"        /* common tokens */
 #include "tfu.x"           /* TFU types */
 #include "lrg.x"           /* layer management typedefs for MAC */
 #include "rgr.x"           /* layer management typedefs for MAC */
@@ -72,7 +55,7 @@
 #include "rg_sch.x"        /* typedefs for Scheduler */
 #include "rg_sch_cmn.x"    /* typedefs for Scheduler */
 /* local defines */
-U32 dlPrbCnt;
+uint32_t dlPrbCnt;
 #ifdef LTE_L2_MEAS
 
 static const char* RLOG_MODULE_NAME="MAC";
@@ -104,28 +87,26 @@ PRIVATE RgSchL2MeasCb * rgSchL2mAllocMeasCb ARGS((
  * @return  Void
  */
 #ifdef ANSI
-PUBLIC S16 rgSchFillL2MeasCfm
+S16 rgSchFillL2MeasCfm
 (
 RgSchCellCb       *cell,
 RgSchL2MeasCb     *measCb,
 LrgSchMeasCfmInfo *cfm,
-U32               measTime   
+uint32_t               measTime   
 )
 #else
-PUBLIC S16 rgSchFillL2MeasCfm(cell, measCb, cfm, measTime)
+S16 rgSchFillL2MeasCfm(cell, measCb, cfm, measTime)
 RgSchCellCb       *cell;
 RgSchL2MeasCb     *measCb;
 LrgSchMeasCfmInfo *cfm;
-U32               measTime;
+uint32_t               measTime;
 #endif
 {
-   U8                 idx;
+   uint8_t                 idx;
    LrgSchMeasReqInfo  *measInfo;
-   U8                 qciVal = 0;
-   U32                 sampOc = 0;
+   uint8_t                 qciVal = 0;
+   uint32_t                 sampOc = 0;
 
-   TRC3(rgSchFillL2MeasCfm)
-   
    measInfo = &measCb->measReq;   
 
    cfm->hdr.transId  = measInfo->hdr.transId;
@@ -321,7 +302,7 @@ U32               measTime;
    measCb->dlTotalBw = 0;
    measCb->ulTotalBw = 0;
 
-   RETVALUE(ROK);
+   return ROK;
 } /* rgSchFillL2MeasCfm */
 
 /** @brief This function sends the L2 measurement confirm to LM 
@@ -337,7 +318,7 @@ U32               measTime;
  * @return  Void
  */
 #ifdef ANSI
-PUBLIC S16 rgSchL2mSndCfm
+S16 rgSchL2mSndCfm
 (
 Pst               *pst,
 RgSchL2MeasCb     *measCb,
@@ -345,7 +326,7 @@ LrgSchMeasReqInfo *measInfo,
 Bool              isErr
 )
 #else
-PUBLIC S16 rgSchL2mSndCfm(pst, measCb, measInfo, isErr)
+S16 rgSchL2mSndCfm(pst, measCb, measInfo, isErr)
 Pst               *pst;
 RgSchL2MeasCb     *measCb;
 LrgSchMeasReqInfo *measInfo;
@@ -354,9 +335,7 @@ Bool              isErr;
 {
    LrgSchMeasCfmInfo   cfm;
 
-   TRC3(rgSchL2mSndCfm)
-
-   cmMemset((U8 *)&cfm, (U8)0, sizeof(LrgSchMeasCfmInfo));
+   memset(&cfm, 0, sizeof(LrgSchMeasCfmInfo));
    cfm.hdr.transId  = measInfo->hdr.transId;
    cfm.measType     = measInfo->measType;
    cfm.cellId       = measInfo->cellId;
@@ -366,9 +345,9 @@ Bool              isErr;
       cfm.cfm.status   = LCM_PRIM_NOK;
       cfm.cfm.reason   = LCM_REASON_INVALID_PAR_VAL;
       RgMiLrgSchL2MeasCfm(pst, &cfm);
-      RETVALUE(ROK);
+      return ROK;
    }
-   RETVALUE(ROK);
+   return ROK;
 } /* rgSchL2mSndCfm */
 
 /** @brief This function fills the LM confirmation pst structure 
@@ -383,24 +362,20 @@ Bool              isErr;
  * @return  Void
  */
 #ifdef ANSI
-PUBLIC Void rgSchL2mFillCfmPst
+Void rgSchL2mFillCfmPst
 (
 Pst    *pst,
 Pst    *cfmPst,
 LrgSchMeasReqInfo *measInfo 
 )
 #else
-PUBLIC Void rgSchL2mFillCfmPst(pst, cfmPst, measInfo)
+Void rgSchL2mFillCfmPst(pst, cfmPst, measInfo)
 Pst    *pst;
 Pst    *cfmPst;
 LrgSchMeasReqInfo *measInfo;
 #endif
 {
  
-
-   TRC3(rgSchL2mFillCfmPst)
-
-
    cfmPst->srcEnt    = pst->dstEnt;
    cfmPst->srcInst   = pst->dstInst;
    cfmPst->srcProcId = pst->dstProcId;
@@ -414,7 +389,7 @@ LrgSchMeasReqInfo *measInfo;
    cfmPst->region    = measInfo->hdr.response.mem.region;
    cfmPst->pool      = measInfo->hdr.response.mem.pool;
 
-   RETVOID;
+   return;
 } /* rgSchL2mFillCfmPst */
 
 /** @brief This function inserts the MeasCb in to data base
@@ -446,9 +421,8 @@ LrgSchMeasReqInfo *measInfo;
 {
    CmLList   *lnk, *node;
    RgSchL2MeasCb   *oldMeasCb;
-   U32              diffTime;
+   uint32_t              diffTime;
    
-   TRC3(rgSchL2mInsertMeasCb)
    /* 
     * 1. Check if l2mList has any entries.
     * 2. If yes 
@@ -472,7 +446,7 @@ LrgSchMeasReqInfo *measInfo;
       {
          cell->l2mList.crnt = lnk;
          cmLListInsCrnt(&(cell->l2mList), node);
-         RETVALUE(ROK);
+         return ROK;
       }
       else
       {
@@ -480,7 +454,7 @@ LrgSchMeasReqInfo *measInfo;
       }
    }  /* End of While */
    cmLListAdd2Tail(&(cell->l2mList), node);
-   RETVALUE(ROK);
+   return ROK;
 } /* rgSchL2mInsertMeasCb */
 
 /** @brief This function calculates the Down link prb count 
@@ -505,16 +479,14 @@ RgSchCellCb       *cell;
    CmLteTimingInfo    frm;
    RgSchDlSf          *sf = NULLP;
 #ifdef LTE_TDD
-   U8                 idx;
+   uint8_t                 idx;
 #endif
 
-   TRC3(rgSchL2CalDlPrbCount)
-
    frm   = cell->crntTime;
    RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA);
    sf = rgSCHUtlSubFrmGet(cell, frm);
 #ifdef LTE_TDD
-   idx = (cell->crntTime.subframe + RG_SCH_CMN_DL_DELTA) % 
+   idx = (cell->crntTime.slot + RG_SCH_CMN_DL_DELTA) % 
                   RGSCH_NUM_SUB_FRAMES;
    if(RG_SCH_CMN_CHK_DL_DATA_ALLOWED(cell, idx)) 
    {
@@ -524,7 +496,7 @@ RgSchCellCb       *cell;
 #else
    cell->avgPrbDl.prbCount += sf->bwAssigned;
 #endif
-   RETVOID;
+   return;
 }
 
 /** @brief This function calculates the up link prb count 
@@ -549,11 +521,9 @@ RgSchCellCb       *cell;
    RgSchUlSf        *sf = NULLP;
    RgSchCmnUlCell   *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
 #ifdef LTE_TDD
-   U8                 idx;
+   uint8_t                 idx;
 #endif
 
-   TRC3(rgSchL2CalUlPrbCount)
-
 #ifdef LTE_TDD
    idx = cellUl->schdIdx;
    if(idx < cellUl->numUlSubfrms)
@@ -565,7 +535,7 @@ RgSchCellCb       *cell;
    sf = &cellUl->ulSfArr[cellUl->schdIdx];
    cell->avgPrbUl.prbCount += sf->totPrb;
 #endif
-   RETVOID;
+   return;
 }
 /** @brief This function allocates memory from the heap
  *
@@ -595,22 +565,21 @@ RgSchErrInfo      err;
    RgSchL2MeasCb       *measCb = NULLP;
    Inst                inst = cell->instIdx;
    UNUSED(err);
-   TRC3(rgSchL2mAllocMeasCb)
 
    if((rgSCHUtlAllocSBuf(inst, (Data **)&measCb,
                    sizeof(RgSchL2MeasCb))) == RFAILED)
    {
       RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSchL2mAllocMeasCb():"
                   "Allocation of RgSchL2MeasCb failed");
-      RETVALUE(NULLP);
+      return (NULLP);
    }
-   cmMemcpy((U8 *)&measCb->measReq, (U8 *)measInfo, sizeof(LrgSchMeasReqInfo));
+   memcpy(&measCb->measReq, measInfo, sizeof(LrgSchMeasReqInfo));
    RGSCHCPYTIMEINFO(cell->crntTime, measCb->startTime);
 
    measCb->dlTotalBw = 0;
    measCb->ulTotalBw = 0;
 
-   RETVALUE(measCb);
+   return (measCb);
 } /* rgSchL2mAllocMeasCb */
 
 /**
@@ -633,24 +602,23 @@ RgSchErrInfo      err;
  *      -# RFAILED
  **/
 #ifdef ANSI
-PUBLIC S16 rgSchL2mMeasReq 
+S16 rgSchL2mMeasReq 
 (
 RgSchCellCb       *cell,
 LrgSchMeasReqInfo *measInfo,
 RgSchErrInfo      err
 )
 #else
-PUBLIC S16 rgSchL2mMeasReq(cell, measInfo, err)
+S16 rgSchL2mMeasReq(cell, measInfo, err)
 RgSchCellCb       *cell;
 LrgSchMeasReqInfo *measInfo;
 RgSchErrInfo      err;
 #endif    
 {
    RgSchL2MeasCb *measCb;
-   U8            idx;
-   U8            qciVal;
+   uint8_t            idx;
+   uint8_t            qciVal;
 
-   TRC3(rgSchL2mMeasReq)
 
    qciVal = 0;
    if ((measCb = rgSchL2mAllocMeasCb(cell, measInfo, err)) == NULLP)
@@ -659,9 +627,9 @@ RgSchErrInfo      err;
                     RGSCHERR_SCH_ALLOC_FAILED);
        RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "rgSchL2mMeasReq():"
                 "Allocation of RgSchL2MeasCb failed");
-       RETVALUE(RFAILED);
+       return RFAILED;
    }
-   /*cmMemcpy((U8 *)&measCb->measReq, (CONSTANT U8 *)measInfo,\
+   /*memcpy(&measCb->measReq, measInfo,\
              sizeof(LrgSchMeasReqInfo));*/
    rgSchL2mInsertMeasCb(cell, measCb, measInfo);
   
@@ -698,7 +666,7 @@ RgSchErrInfo      err;
    {
       RgInfL2MeasReq    measReq;
       Pst               pst;
-      cmMemset((U8 *)&measReq, 0, sizeof(RgInfL2MeasReq));
+      memset(&measReq, 0, sizeof(RgInfL2MeasReq));
       measReq.transId  = measInfo->hdr.transId;
       measReq.measType = measInfo->measType;
       measReq.timePrd  = measInfo->timePrd;
@@ -712,7 +680,7 @@ RgSchErrInfo      err;
       rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], cell->macInst);
       RgSchMacL2Meas(&pst, &measReq);
    }
-   RETVALUE(ROK);
+   return ROK;
 } /* rgSchL2mMeasReq */
 
 /**
@@ -729,40 +697,39 @@ RgSchErrInfo      err;
  *      -# RFAILED
  **/
 #ifdef ANSI
-PUBLIC S16 rgSCHL2Meas
+S16 rgSCHL2Meas
 (
 RgSchCellCb  *cell,
-U8 isCalrCrcInd
+uint8_t isCalrCrcInd
 )
 #else
-PUBLIC S16 rgschL2Meas(cell,isCalrCrcInd)
+S16 rgschL2Meas(cell,isCalrCrcInd)
 RgSchCellCb  *cell;
-U8 isCalrCrcInd
+uint8_t isCalrCrcInd
 #endif
 {
    CmLList           *node = NULLP;
    RgSchL2MeasCb     *measCb = NULLP;
-   U8                idx;
+   uint8_t                idx;
    LrgSchMeasCfmInfo measCfm;
-   U8                qciVal = 0;
-   U32               sfDiff;
-   U32               meas;
+   uint8_t                qciVal = 0;
+   uint32_t               sfDiff;
+   uint32_t               meas;
 #ifdef LTE_TDD
-   U8                sfIdx;
+   uint8_t                sfIdx;
    Bool              isDlDataAllowed;  
-   U8                rem;
-   U32               numDlSf;
-   U32               numUlSf;
+   uint8_t                rem;
+   uint32_t               numDlSf;
+   uint32_t               numUlSf;
 #endif
-   TRC3(rgSCHL2Meas)
 
-      node = cell->l2mList.first;
-   cmMemset((U8 *)&measCfm, 0, sizeof(LrgSchMeasCfmInfo));
+   node = cell->l2mList.first;
+   memset(&measCfm, 0, sizeof(LrgSchMeasCfmInfo));
    while(node != NULLP)
    {
       measCb = (RgSchL2MeasCb *)node->node;
       node = node->next;
-      if(cell->crntTime.sfn == 1023 && cell->crntTime.subframe == 9)  
+      if(cell->crntTime.sfn == 1023 && cell->crntTime.slot == 9)  
       {
          /*calculates diff between crnt time and start time*/
          meas = RGSCH_CALC_SFN_SF_DIFF(cell->crntTime, 
@@ -784,7 +751,7 @@ U8 isCalrCrcInd
          numDlSf = (meas / RGSCH_NUM_SUB_FRAMES) * rgSchTddNumDlSubfrmTbl[cell->ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1];
          numUlSf = (meas / RGSCH_NUM_SUB_FRAMES) * rgSchTddNumUlSubfrmTbl[cell->ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1];
 
-         sfIdx = (measCb->startTime.subframe + 1) % RGSCH_NUM_SUB_FRAMES;
+         sfIdx = (measCb->startTime.slot + 1) % RGSCH_NUM_SUB_FRAMES;
 
          while(rem)
          {
@@ -826,7 +793,7 @@ U8 isCalrCrcInd
          }
          RgMiLrgSchL2MeasCfm(&(rgSchCb[cell->instIdx].rgSchInit.lmPst),
                &measCfm);
-         cmMemset((U8 *)&measCfm, 0, sizeof(LrgSchMeasCfmInfo));
+         memset(&measCfm, 0, sizeof(LrgSchMeasCfmInfo));
          
          /* Delete this measCb from the list */
          if(measCb->measReq.timePrd > 0)
@@ -840,7 +807,7 @@ U8 isCalrCrcInd
             measCb->startTime = cell->crntTime;
             measCb->sfnCycle = 0;
             measCb->cfmRcvd = FALSE;
-            cmMemset((U8 *)&measCb->avgPrbQciUl, 0, sizeof(LrgAvgPrbQCICfm));
+            memset(&measCb->avgPrbQciUl, 0, sizeof(LrgAvgPrbQCICfm));
             cell->sndL2Meas = FALSE;
          } 
          /* ccpu00117052 - MOD - Passing double pointer
@@ -925,7 +892,7 @@ U8 isCalrCrcInd
          }
       }
    }/* end of while */
-   RETVALUE(ROK);
+   return ROK;
 } /* rgSCHL2MEas */
 #endif /* LTE_L2_MEAS */
 /**********************************************************************