U8, U16, U32 data type changes
[o-du/l2.git] / src / 5gnrmac / rg_dhm.c
index 493a4e5..87b9d1c 100755 (executable)
@@ -36,49 +36,30 @@ static const char* RLOG_MODULE_NAME="MAC";
 static int RLOG_FILE_ID=279;
 static int RLOG_MODULE_ID=4096;
 /* 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 "common_def.h"
 #ifdef L2_OPTMZ
 #include "ss_strm.h"
 #endif
-#include "cm5.h"           /* common timers */
-#include "cm_hash.h"       /* common hash list */
-#include "cm_mblk.h"       /* common memory link list library */
-#include "cm_llist.h"      /* common linked list library */
-#include "cm_err.h"        /* common error */
-#include "cm_lte.h"        /* common LTE */
 #include "lrg.h"
 #include "crg.h"
-#include "rgu.h"
 #include "tfu.h"
+#include "rgu.h"
 #include "rg_sch_inf.h"
 #include "rg_env.h"
 #include "rg_err.h"
 #include "rg.h"
+#include "du_app_mac_inf.h"
 
 /* header/extern include files (.x) */
-#include "gen.x"           /* general layer */
-#include "ssi.x"           /* system service interface */
 #ifdef L2_OPTMZ
 #include "ss_strm.x"
 #endif
-#include "cm5.x"           /* common timers */
-#include "cm_lib.x"        /* common library */
-#include "cm_hash.x"       /* common hash list */
-#include "cm_llist.x"      /* common linked list library */
-#include "cm_mblk.x"       /* memory management */
-#include "cm_tkns.x"       /* common tokens */
-#include "cm_lte.x"        /* common LTE */
 #include "lrg.x"
 #include "crg.x"
-#include "rgu.x"
 #include "tfu.x"
+#include "rgu.x"
 #include "rg_sch_inf.x"
 #include "rg_prg.x"        /* PRG interface typedefs */
-#include "mac_interface.h"
 #include "rg.x"
 
 #ifdef L2_OPTMZ
@@ -100,10 +81,10 @@ PRIVATE Void rgDHMBldTfuDatReq ARGS((RgCellCb *cellCb, RgDlSf *dlSf, RgDlHqProcC
                            RgTfuDatReqPduInfo *datReq));
 
 #ifdef L2_OPTMZ
-PUBLIC S16 rgDHMFreeHqProcTB
+S16 rgDHMFreeHqProcTB
 (
 RgDlHqProcCb         *hqP,
-U8                   tbIndex
+uint8_t              tbIndex
 );
 
 #endif
@@ -131,27 +112,25 @@ U8                   tbIndex
  *
  **/
 #ifdef ANSI
-PUBLIC S16 rgDHMHqEntInit
+S16 rgDHMHqEntInit
 (
 Inst               inst,
 RgDlHqEnt          *hqE,
-U8                 maxHqProcs
+uint8_t            maxHqProcs
 )
 #else
-PUBLIC S16 rgDHMHqEntInit(inst,hqE, maxHqProcs)
+S16 rgDHMHqEntInit(inst,hqE, maxHqProcs)
 Inst               inst,
 RgDlHqEnt          *hqE;
-U8                 maxHqProcs;
+uint8_t            maxHqProcs;
 #endif
 {
-   U8 idx1,idx2;
+   uint8_t idx1,idx2;
 #ifdef L2_OPTMZ
    Buffer  *hdrDBuf = NULLP;
    Buffer  *ceDBuf = NULLP;
 #endif
 
-   TRC2(rgDHMHqEntInit)
-
    hqE->numHqProcs = maxHqProcs;
    /* for each harq process */
    for (idx1 = 0; idx1 < hqE->numHqProcs; idx1++)
@@ -163,7 +142,7 @@ U8                 maxHqProcs;
             rgFreeSBuf(inst,(Data **)&(hqE->procs[idx1]), sizeof(RgDlHqProcCb));
          }
          RLOG0(L_ERROR, "Memory Alloc Failure for RgDlHqProcCb");        
-         RETVALUE(RFAILED);
+         return RFAILED;
       }
 
       hqE->procs[idx1]->procId      = idx1;
@@ -199,7 +178,7 @@ U8                 maxHqProcs;
    }
 
 
-   RETVALUE(ROK);
+   return ROK;
 } /* rgDHMHqEntInit */
 
 /**
@@ -217,20 +196,18 @@ U8                 maxHqProcs;
  *
  **/
 #ifdef ANSI
-PUBLIC Void rgDHMUeReset
+Void rgDHMUeReset
 (
 RgCellCb *cell,
 RgDlHqEnt          *hqE
 )
 #else
-PUBLIC Void rgDHMUeReset(cell, hqE)
+Void rgDHMUeReset(cell, hqE)
 RgCellCb *cell;
 RgDlHqEnt          *hqE;
 #endif
 {
-   U8       i = 0;
-
-   TRC2(rgDHMUeReset)
+   uint8_t       i = 0;
 
    if(hqE->procs[0])
    {
@@ -245,7 +222,7 @@ RgDlHqEnt          *hqE;
 #endif
       }
    }
-   RETVOID;
+   return;
 } /* rgDHMUeReset*/
 
 /**
@@ -265,18 +242,17 @@ RgDlHqEnt          *hqE;
  *
  **/
 #ifdef ANSI
-PUBLIC Void rgDHMHdlBufFree
+Void rgDHMHdlBufFree
 (
 Inst inst,
 Buffer **mBuf
 )
 #else
-PUBLIC Void rgDHMHdlBufFree(Inst inst, Buffer **mBuf)
+Void rgDHMHdlBufFree(Inst inst, Buffer **mBuf)
 Inst inst;
 #endif
 {
    RgCb *rgCbP = &rgCb[inst];
-   TRC2(rgDHMHdlBufFree)
 
    if (rgCbP->bufCnt < RG_MAX_DFRD_FREE_BUFS)
    {
@@ -291,7 +267,7 @@ Inst inst;
    {
       RG_FREE_MSG(*mBuf);
    }
-   RETVOID;
+   return;
 }
 /**
  * @brief This function is called to release the 
@@ -312,20 +288,18 @@ Inst inst;
  *
  **/
 #ifdef ANSI
-PUBLIC Void rgDHMFreeTbBufs
+Void rgDHMFreeTbBufs
 (
 Inst inst
 )
 #else
-PUBLIC Void rgDHMFreeTbBufs(inst)
+Void rgDHMFreeTbBufs(inst)
 Inst inst;
 #endif
 {
    RgCb *rgCbP = &rgCb[inst];
-   U8 start = rgCbP->bufCnt;
-   U8 end = 0;
-
-   TRC2(rgDHMFreeTbBufs)
+   uint8_t start = rgCbP->bufCnt;
+   uint8_t end = 0;
 
    if (rgCbP->bufCnt < RG_MAX_FREE_BUFS_PERTTI)
    {
@@ -341,24 +315,22 @@ Inst inst;
       SPutMsg(rgCbP->bufToFree[start]);
    }
    rgCbP->bufCnt = end;
-   RETVOID;
+   return;
 } /* rgDHMFreeTbBufs */
 
 #ifdef ANSI
-PUBLIC Void rgDHMFreeAllTbBufs
+Void rgDHMFreeAllTbBufs
 (
 Inst inst
 )
 #else
-PUBLIC Void rgDHMFreeAllTbBufs(inst)
+Void rgDHMFreeAllTbBufs(inst)
 Inst inst;
 #endif
 {
    RgCb *rgCbP = &rgCb[inst];
-   U8 start = rgCbP->bufCnt;
-   U8 end = 0;
-
-   TRC2(rgDHMFreeAllTbBufs)
+   uint8_t start = rgCbP->bufCnt;
+   uint8_t end = 0;
 
    while (start != end)
    {
@@ -366,7 +338,7 @@ Inst inst;
       SPutMsg(rgCbP->bufToFree[start]);
    }
    rgCbP->bufCnt = end;
-   RETVOID;
+   return;
 } /* rgDHMFreeTbBufs */
 
 
@@ -387,31 +359,29 @@ Inst inst;
  *
  **/
 #ifdef ANSI
-PUBLIC S16 rgDHMRlsHqProcTB
+S16 rgDHMRlsHqProcTB
 (
 RgCellCb             *cell,
 RgDlHqProcCb         *hqP,
-U8                   tbIndex
+uint8_t              tbIndex
 )
 #else
-PUBLIC S16 rgDHMRlsHqProcTB(cell, hqP, tbIndex)
+S16 rgDHMRlsHqProcTB(cell, hqP, tbIndex)
 RgCellCb             *cell;
 RgDlHqProcCb         *hqP;
-U8                   tbIndex;
+uint8_t              tbIndex;
 #endif
 {
-    U8                    idx;
+    uint8_t          idx;
 #ifdef L2_OPTMZ
     RgTfuDatReqTbInfo     *tb;   /* TB to be sent to CL/PHY*/
-   // U32 lchIdx, pduIdx;
+   // uint32_t lchIdx, pduIdx;
 #endif
 
-   TRC2(rgDHMRlsHqProcTB)
-
    if((tbIndex > RG_MAX_TB_PER_UE) ||
       (tbIndex == 0))
    {
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    hqP->tbInfo[tbIndex-1].numSchLch = 0;
@@ -457,7 +427,7 @@ U8                   tbIndex;
    hqP->tbInfo[tbIndex-1].contResCe = NOTPRSNT;
    hqP->tbInfo[tbIndex-1].contResId = NULLP;
 
-   RETVALUE(ROK);
+   return ROK;
 } /* rgDHMRlsHqProc */
 
 /**
@@ -470,7 +440,7 @@ U8                   tbIndex;
  *     Invoked by: ROM
  *     
  *  @param[in]  RgUeCb        *ue
- *  @param[in]  U8            idx
+ *  @param[in]  uint8_t            idx
  *  @param[in]  RgDlHqProc    **hqP
  *  @return  S16       
  *         -#   ROK     if successful
@@ -478,28 +448,26 @@ U8                   tbIndex;
  *
  **/
 #ifdef ANSI
-PUBLIC S16 rgDHMGetHqProcFrmId
+S16 rgDHMGetHqProcFrmId
 (
 RgUeCb               *ue,
-U8                   idx,
+uint8_t              idx,
 RgDlHqProcCb         **hqP
 )
 #else
-PUBLIC S16 rgDHMGetHqProcFrmId(ue, idx, hqP)
+S16 rgDHMGetHqProcFrmId(ue, idx, hqP)
 RgUeCb               *ue;
-U8                   idx;
+uint8_t              idx;
 RgDlHqProcCb         **hqP;
 #endif
 {
-   TRC2(rgDHMGetHqProcFrmId)
-
    /* Pick the proc based on the index provided */
    *hqP = (ue->dl.hqEnt.procs[idx]);
 
-   RETVALUE(ROK);
+   return ROK;
 } /* rgDHMGetHqProcFrmId */
 
-/*PRIVATE U32 dataAvl; */
+/*PRIVATE uint32_t dataAvl; */
 /**
  * @brief Handler for sending data to PHY
  *
@@ -520,7 +488,7 @@ RgDlHqProcCb         **hqP;
  *      -#RFAILED 
  **/
 #ifdef ANSI
-PUBLIC S16 rgDHMSndDatReq
+S16 rgDHMSndDatReq
 (
 RgCellCb        *cellCb,
 RgDlSf          *dlSf,
@@ -529,7 +497,7 @@ RgDlHqProcCb   *hqP,
 RgErrInfo      *err 
 )
 #else
-PUBLIC S16 rgDHMSndDatReq(cellCb, dlSf, datInfo, hqP, err)
+S16 rgDHMSndDatReq(cellCb, dlSf, datInfo, hqP, err)
 RgCellCb        *cellCb;
 RgDlSf          *dlSf;
 RgTfuDatReqInfo *datInfo;
@@ -537,16 +505,14 @@ RgDlHqProcCb    *hqP;
 RgErrInfo       *err;
 #endif
 {
-   U8 i;
-   Inst               inst = cellCb->macInst - RG_INST_START;
+   uint8_t i;
+   Inst    inst = cellCb->macInst - RG_INST_START;
    RgTfuDatReqPduInfo   *datReq;
    RgBldPduInfo      bldPdu;
    /*Added this variable to figure out that whether this UE data
      has to be inclueded in the TFU Data request.*/
    Bool  dataAvlblUe;
 
-   TRC2(rgDHMSndDatReq)
-  
    dataAvlblUe = TRUE;
    for(i=0;i< RG_MAX_TB_PER_UE;i++)
    {
@@ -554,15 +520,15 @@ RgErrInfo       *err;
                 "macCell(sfn sf): (%d %d) tbTimingInfo(sfn sf): (%d %d)\n"
                 "dlSf %p dlSf->tbs.count %d hqp %p tb %p\n",
                              hqP->tbInfo[i].pdcch.rnti,
-                             dlSf->schdTime.sfn, dlSf->schdTime.subframe,
-                             cellCb->crntTime.sfn, cellCb->crntTime.subframe,
+                             dlSf->schdTime.sfn, dlSf->schdTime.slot,
+                             cellCb->crntTime.sfn, cellCb->crntTime.slot,
                              hqP->tbInfo[i].timingInfo.sfn, 
-                             hqP->tbInfo[i].timingInfo.subframe,
+                             hqP->tbInfo[i].timingInfo.slot,
                              (Void *)dlSf, dlSf->tbs.count,
                              (Void *)hqP,
                              (Void *)hqP->tbInfo[i].tb);*/
       /* Mukesh :: in case of rpepetiton this is not rerd*/
-      if (hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.subframe % 2].sf == dlSf)
+      if (hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf == dlSf)
       {
          /* Check if data from RLC had been received and got muxed. */
 #ifndef L2_OPTMZ
@@ -583,7 +549,7 @@ RgErrInfo       *err;
                /* Data not received but ta needs to be sent. */
                /* MUX TA and send it */
                bldPdu.datReq    =  NULLP;
-               bldPdu.reqType   =  EVTTFUTTIIND;
+               //bldPdu.reqType   =  EVENT_SLOT_IND_TO_MAC;
                bldPdu.schdTbSz  =  hqP->tbInfo[i].tbSz;
                bldPdu.ta        =  hqP->tbInfo[i].schdTa;
 #ifdef LTE_ADV
@@ -596,10 +562,10 @@ RgErrInfo       *err;
                   RLOG1(L_ERROR, "MUXing failed for:  MacInst %d", inst);
                   RLOG4(L_ERROR, "MUXing failed for:  time: %d/%d\
                   procId %d ueId %d", hqP->tbInfo[i].timingInfo.sfn,
-                  hqP->tbInfo[i].timingInfo.subframe, hqP->procId, 
+                  hqP->tbInfo[i].timingInfo.slot, hqP->procId, 
                   hqP->tbInfo[i].pdcch.rnti);
 
-                  RETVALUE(RFAILED);
+                  return RFAILED;
                }
             }
             else   
@@ -607,7 +573,7 @@ RgErrInfo       *err;
 #ifdef LTEMAC_RGU_PAD
                /* Data not received from RLC. Padding at MAC */
                bldPdu.datReq    =  NULLP;
-               bldPdu.reqType   =  EVTTFUTTIIND;
+               //bldPdu.reqType   =  EVENT_SLOT_IND_TO_MAC;
                bldPdu.schdTbSz  =  hqP->tbInfo[i].tbSz;
                bldPdu.ta        =  hqP->tbInfo[i].schdTa;
 #ifdef LTE_ADV
@@ -621,10 +587,10 @@ RgErrInfo       *err;
                   RLOG1(L_ERROR, "MUXing failed for:  MacInst %d", inst);
                   RLOG4(L_ERROR, "MUXing failed for:  time: %d/%d\
                   procId %d ueId %d", hqP->tbInfo[i].timingInfo.sfn,
-                  hqP->tbInfo[i].timingInfo.subframe, hqP->procId, 
+                  hqP->tbInfo[i].timingInfo.slot, hqP->procId, 
                   hqP->tbInfo[i].pdcch.rnti);
                   
-                  RETVALUE(RFAILED);
+                  return RFAILED;
                }
 #else
                /*Padding is not done so data for this UE will not be
@@ -654,13 +620,13 @@ RgErrInfo       *err;
          rgDHMRlsHqProcTB(cellCb, hqP, 2);
       }
       
-      RETVALUE(ROK);
+      return ROK;
    }
 
    if (rgGetEventMem(inst,(Ptr *)&datReq, sizeof(TfuDatReqPduInfo),
             &(datInfo->memCp)) != ROK)
    {
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
    /* Fill the TFU Dat Req with information from Harq Proc */
   
@@ -669,19 +635,19 @@ RgErrInfo       *err;
    /* MS_WORKAROUND for ccpu00122894 */
    for(i=0;i< RG_MAX_TB_PER_UE;i++)
    {
-      if (hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.subframe % 2].sf == dlSf)
+      if (hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf == dlSf)
       {
-         cmLListDelFrm(&dlSf->tbs, &(hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.subframe % 2].sfLnk));
-         hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.subframe % 2].sfLnk.node = NULLP;
+         cmLListDelFrm(&dlSf->tbs, &(hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk));
+         hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk.node = NULLP;
          
         
-        hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.subframe % 2].sf = NULLP;
+        hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf = NULLP;
       }
    }
    cmLListAdd2Tail(&datInfo->pdus, &(datReq->lnk));
    datReq->lnk.node = (PTR)datReq;
 
-   RETVALUE(ROK);
+   return ROK;
 }  /* rgDHMSndDatReq */
 
 /**
@@ -705,7 +671,7 @@ RgErrInfo       *err;
  *      -# RFAILED 
  **/
 #ifdef ANSI
-PUBLIC S16 rgDHMHndlDedDatReq
+S16 rgDHMHndlDedDatReq
 (
 Inst           inst,
 RgDlHqProcCb   *hqProc,
@@ -714,7 +680,7 @@ RgDlSf            *dlSf,
 RgErrInfo      *err
 )
 #else
-PUBLIC S16 rgDHMHndlDedDatReq(inst,hqProc, datReq, dlSf, err)
+S16 rgDHMHndlDedDatReq(inst,hqProc, datReq, dlSf, err)
 Inst           inst;
 RgDlHqProcCb   *hqProc;
 RgRguDDatReqPerUe *datReq;
@@ -722,18 +688,17 @@ RgDlSf            *dlSf;
 RgErrInfo      *err;
 #endif
 {
-//   U32            len;
-   U8             i;
-   U8             j;
+//   uint32_t            len;
+   uint8_t        i;
+   uint8_t        j;
    RgBldPduInfo   bldPdu;
-   U8             tbIndex;
+   uint8_t        tbIndex;
 #ifdef L2_OPTMZ
    RgTfuDatReqTbInfo     *tb;
 #endif
 
-   TRC2(rgDHMHndlDedDatReq);
 
-   tbIndex = (U8)(datReq->transId & 0x03);
+   tbIndex = (uint8_t)(datReq->transId & 0x03);
    /* Accept all the data requests even if delayed in case nothing
     * has been sent earlier on the harq proc.
     */
@@ -747,9 +712,9 @@ RgErrInfo      *err;
          {
             j++;
          } 
-         rgDHMRlsHqProcTB(rgCb[inst].cell, hqProc, (U8)(j+1));
+         rgDHMRlsHqProcTB(rgCb[inst].cell, hqProc, (uint8_t)(j+1));
       }
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    for(i=0;i<datReq->nmbOfTbs;i++)
@@ -761,7 +726,7 @@ RgErrInfo      *err;
       {
           continue;
       }
-      if (hqProc->tbInfo[i].sfLnkInfo[dlSf->schdTime.subframe % 2].sfLnk.node == NULLP)
+      if (hqProc->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk.node == NULLP)
       {
          /* release corresponding TBs from SF tbs List */
          for(j=0;j<datReq->nmbOfTbs;j++)
@@ -770,10 +735,10 @@ RgErrInfo      *err;
             {
                j++;
             }
-            rgDHMRlsHqProcTB(rgCb[inst].cell, hqProc, (U8)(j+1));
+            rgDHMRlsHqProcTB(rgCb[inst].cell, hqProc, (uint8_t)(j+1));
             printf("\nrgDHMHndlDedDatReq:: hqP %p \n", (Void *)hqProc);
          }
-         RETVALUE(RFAILED);
+         return RFAILED;
 
       }
 #ifndef L2_OPTMZ
@@ -809,7 +774,7 @@ RgErrInfo      *err;
          RLOG1(L_ERROR, "MUXing failed for:  MacInst %d", inst);
          RLOG4(L_ERROR, "MUXing failed for:  time: %d/%d\
                procId %d ueId %d", hqProc->tbInfo[i].timingInfo.sfn,
-               hqProc->tbInfo[i].timingInfo.subframe, hqProc->procId, 
+               hqProc->tbInfo[i].timingInfo.slot, hqProc->procId, 
                hqProc->tbInfo[i].pdcch.rnti);
 
          /* release corresponding TBs from SF tbs List */
@@ -819,15 +784,15 @@ RgErrInfo      *err;
             {
                j++;
             }
-            rgDHMRlsHqProcTB(rgCb[inst].cell, hqProc, (U8)(j+1));
+            rgDHMRlsHqProcTB(rgCb[inst].cell, hqProc, (uint8_t)(j+1));
          }
-         RETVALUE(RFAILED);
+         return RFAILED;
       }
       /*
       SFndLenMsg(hqProc->tbInfo[i].tb, &len);
       */
    }
-   RETVALUE(ROK);
+   return ROK;
 }  /* rgDHMHndlDedDatReq */
 
 /**
@@ -851,7 +816,7 @@ RgErrInfo      *err;
  *      -# RFAILED 
  **/
 #ifdef ANSI
-PUBLIC S16 rgDHMHndlCmnDatReq
+S16 rgDHMHndlCmnDatReq
 (
 Inst           inst,
 RgDlHqProcCb   *hqProc,
@@ -859,7 +824,7 @@ RgRguCmnDatReq *datReq,
 RgErrInfo      *err
 )
 #else
-PUBLIC S16 rgDHMHndlCmnDatReq(inst,hqProc, datReq, err)
+S16 rgDHMHndlCmnDatReq(inst,hqProc, datReq, err)
 Inst           inst;
 RgDlHqProcCb   *hqProc;
 RgRguCmnDatReq *datReq;
@@ -869,8 +834,6 @@ RgErrInfo      *err;
    RgUstaDgn      dgn;
    RgBldPduInfo   bldPdu;
 
-   TRC2(rgDHMHndlCmnDatReq)
-
 #ifndef L2_OPTMZ
       if (hqProc->tbInfo[0].tb != NULLP)
 #else
@@ -882,7 +845,7 @@ RgErrInfo      *err;
          rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_HARQ); 
          rgLMMStaInd(inst,LCM_CATEGORY_PROTOCOL, LCM_EVENT_UI_INV_EVT,
                LRG_CAUSE_HQ_PROC_BUSY, &dgn);
-         RETVALUE(RFAILED);
+         return RFAILED;
       }
 
    bldPdu.datReq    =  datReq;
@@ -900,14 +863,14 @@ RgErrInfo      *err;
       RLOG1(L_ERROR, "MUXing failed for:  MacInst %d", inst); 
       RLOG4(L_ERROR, "MUXing failed for: time: %d/%d\
                procId %d ueId %d", hqProc->tbInfo[0].timingInfo.sfn,
-            hqProc->tbInfo[0].timingInfo.subframe, hqProc->procId, 
+            hqProc->tbInfo[0].timingInfo.slot, hqProc->procId, 
             hqProc->tbInfo[0].pdcch.rnti);
 
       RG_FREE_MSG(datReq->pdu);
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
-   RETVALUE(ROK);
+   return ROK;
 }  /* rgDHMHndlCmnDatReq */
 
 /**
@@ -934,7 +897,7 @@ RgErrInfo      *err;
  **/
  RgUeCb  *gUe =NULLP;
 #ifdef ANSI
-PUBLIC S16 rgDHMSndConsolidatedStaInd
+S16 rgDHMSndConsolidatedStaInd
 (
 RgCellCb        *cell,
 RgInfUeInfo     *ueInfo,
@@ -942,7 +905,7 @@ CmLteTimingInfo timingInfo,
 RgErrInfo       *err
 )
 #else
-PUBLIC S16 rgDHMSndConsolidatedStaInd(cell, ueInfo, timingInfo, err)
+S16 rgDHMSndConsolidatedStaInd(cell, ueInfo, timingInfo, err)
 RgCellCb        *cell;
 RgInfUeInfo     *ueInfo;
 CmLteTimingInfo timingInfo;
@@ -950,11 +913,11 @@ RgErrInfo       *err;
 #endif
 {
    SuId            rguDlSpId;/*need to use spID instead of suID*/
-   U8              idx;
-   U8              ueIdx;
-   U8              lcIdx;
-   U8              tbIndex=0,idx1;
-   RgDlSf          *dlSf = &cell->subFrms[(timingInfo.subframe % RG_NUM_SUB_FRAMES)];
+   uint8_t         idx;
+   uint8_t         ueIdx;
+   uint8_t         lcIdx;
+   uint8_t         tbIndex=0,idx1;
+   RgDlSf          *dlSf = &cell->subFrms[(timingInfo.slot % RG_NUM_SUB_FRAMES)];
    Inst            inst = cell->macInst - RG_INST_START;
 //   Bool            isDStaReqrd = FALSE;
    RgRguDedStaInd  *dStaInd[rgCb[inst].numRguSaps] ;
@@ -964,8 +927,8 @@ RgErrInfo       *err;
    RgUeCb         *ue;
    RgDlHqProcCb   *hqP;
    RgInfUeAlloc   *allocInfo;
-   U8             activeSapCnt = 0;
-   U8             staIndCnt    = 0;
+   uint8_t        activeSapCnt = 0;
+   uint8_t        staIndCnt    = 0;
 #ifdef LTE_ADV
    Bool           hqPAdded     = FALSE;
 #endif
@@ -973,9 +936,8 @@ RgErrInfo       *err;
    RgTfuDatReqTbInfo     *tb;   /* TB to be sent to CL/PHY*/
 #endif
 
-   TRC2(rgDHMSndConsolidatedStaInd)
-   cmMemset ((U8 *)dStaInd, 0, (sizeof(RgRguDedStaInd *) * rgCb[inst].numRguSaps));
-   cmMemset ((U8 *)rguDlSap, 0, (sizeof(RgUpSapCb  *) * rgCb[inst].numRguSaps));
+   memset (dStaInd, 0, (sizeof(RgRguDedStaInd *) * rgCb[inst].numRguSaps));
+   memset (rguDlSap, 0, (sizeof(RgUpSapCb  *) * rgCb[inst].numRguSaps));
 
    /* Send StaInd for the scheduled UEs */
    for(ueIdx = 0; ueIdx < ueInfo->numUes; ueIdx++)
@@ -1042,9 +1004,9 @@ RgErrInfo       *err;
 #endif
 
          hqP->numOfTBs =  allocInfo->nmbOfTBs;
-         hqP->tbInfo[idx].sfLnkInfo[dlSf->schdTime.subframe % 2].sfLnk.node = (PTR)hqP;
-         hqP->tbInfo[idx].sfLnkInfo[dlSf->schdTime.subframe % 2].sf = dlSf;
-         cmLListAdd2Tail(&dlSf->tbs,&(hqP->tbInfo[idx].sfLnkInfo[dlSf->schdTime.subframe % 2].sfLnk));
+         hqP->tbInfo[idx].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk.node = (PTR)hqP;
+         hqP->tbInfo[idx].sfLnkInfo[dlSf->schdTime.slot % 2].sf = dlSf;
+         cmLListAdd2Tail(&dlSf->tbs,&(hqP->tbInfo[idx].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk));
          /* Changes as part of performance testing*/
          /*   hqP->numOfTBs++;*/
          hqP->tbInfo[idx].doa = allocInfo->doa;
@@ -1142,7 +1104,7 @@ RgErrInfo       *err;
                {
                   err->errType  = RGERR_DHM_SND_STA_IND;
                   err->errCause = RG_DHM_MEM_ALLOC_FAIL;
-                  RETVALUE(RFAILED)
+                  return RFAILED
                }
             }
 
@@ -1152,7 +1114,7 @@ RgErrInfo       *err;
             cStaInd->rnti      = allocInfo->rnti;
             cStaInd->lcId      = cell->dlCcchId;
             cStaInd->transId   = (timingInfo.sfn << 16) | 
-                                 (timingInfo.subframe << 8) | idx1;
+                                 (timingInfo.slot << 8) | idx1;
                /* ADD Changes for Downlink UE Timing Optimization */
 #ifdef LTEMAC_DLUE_TMGOPTMZ
             dlSf->remDatReqCnt++;
@@ -1191,7 +1153,7 @@ RgErrInfo       *err;
                   err->errType  = RGERR_DHM_SND_STA_IND;
                   err->errCause = RG_DHM_MEM_ALLOC_FAIL;
                   /* Need to return as memory allocation will fail for other UEs also*/
-                  RETVALUE(RFAILED);
+                  return RFAILED;
                }
                dStaInd[rguDlSpId]->nmbOfUeGrantPerTti = 0;
                rguDlSap[rguDlSpId] = ue->rguDlSap;
@@ -1245,10 +1207,10 @@ RgErrInfo       *err;
          dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].rnti    = allocInfo->rnti;
          /*
             dStaInd->transId = (hqP->timingInfo.sfn << 16) | 
-            (hqP->timingInfo.subframe << 8) | hqP->procId;
+            (hqP->timingInfo.slot << 8) | hqP->procId;
           */
          dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].transId = (timingInfo.sfn << 16) | 
-            (timingInfo.subframe << 8) | idx1;
+            (timingInfo.slot << 8) | idx1;
          dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].nmbOfTbs = hqP->numOfTBs;
 #ifdef LTE_ADV
          dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].fillCtrlPdu = allocInfo->fillCtrlPdu;
@@ -1280,7 +1242,7 @@ RgErrInfo       *err;
       }
 
    }
-   RETVALUE(ROK);
+   return ROK;
 }  /* rgDHMSndConsolidatedStaInd */
 
 
@@ -1299,7 +1261,7 @@ RgErrInfo       *err;
  *  @return     Void
  *              None 
  **/
-//U8 crashFlag = 0;
+//uint8_t crashFlag = 0;
 #ifdef ANSI
 PRIVATE Void rgDHMBldTfuDatReq
 (
@@ -1325,12 +1287,11 @@ RgTfuDatReqPduInfo *datReq;
 #endif
 #endif
 
-   U8 i;
+   uint8_t i;
 
 #ifdef L2_OPTMZ
-   U32 lchIdx, pduIdx;
+   uint32_t lchIdx, pduIdx;
 #endif
-   TRC2(rgDHMBldTfuDatReq)
  
    datReq->nmbOfTBs = 0;
 #ifndef L2_OPTMZ
@@ -1352,10 +1313,10 @@ RgTfuDatReqPduInfo *datReq;
    for(i=0;i<RG_MAX_TB_PER_UE;i++)
    {
 #ifndef L2_OPTMZ
-      if ((hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.subframe % 2].sf == dlSf) &&
+      if ((hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf == dlSf) &&
           (hqP->tbInfo[i].tb != NULLP))
 #else
-      if ((hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.subframe % 2].sf == dlSf) &&
+      if ((hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf == dlSf) &&
            RgUtlIsTbMuxed(&(hqP->tbInfo[i].tb)))
 #endif
       {
@@ -1406,10 +1367,10 @@ RgTfuDatReqPduInfo *datReq;
                if(dbgBufLen == 0)
                {              
                   RLOG_ARG4(L_ERROR,DBG_CELLID,cellCb->cellId,
-                                         "RNTI:%d SFN:%d subframe:%d tbIdx:%d Sdu Length 0 ",
+                                         "RNTI:%d SFN:%d slot:%d tbIdx:%d Sdu Length 0 ",
                              datReq->rnti,
                                      hqP->tbInfo[i].timingInfo.sfn,
-                                         hqP->tbInfo[i].timingInfo.subframe,i);
+                                         hqP->tbInfo[i].timingInfo.slot,i);
                   RLOG_ARG3(L_ERROR,DBG_CELLID,cellCb->cellId,
                              "taPres [%d] numOfTbs [%d] format[%d]",
                              datReq->isTApres, 
@@ -1449,7 +1410,7 @@ RgTfuDatReqPduInfo *datReq;
          datReq->nmbOfTBs++;
       }
    }
-   RETVOID;
+   return;
 }  /* rgDHMBldTfuDatReq */
 
 
@@ -1471,26 +1432,24 @@ RgTfuDatReqPduInfo *datReq;
  *
  **/
 #ifdef ANSI
-PUBLIC S16 rgDHMFreeHqProcTB
+S16 rgDHMFreeHqProcTB
 (
 RgDlHqProcCb         *hqP,
-U8                   tbIndex
+uint8_t              tbIndex
 )
 #else
-PUBLIC S16 rgDHMFreeHqProcTB(hqP, tbIndex)
+S16 rgDHMFreeHqProcTB(hqP, tbIndex)
 RgDlHqProcCb         *hqP;
-U8                   tbIndex;
+uint8_t              tbIndex;
 #endif
 {
    RgTfuDatReqTbInfo     *tb;   /* TB to be sent to CL/PHY*/
-   U8                    idx;
-
-   TRC2(rgDHMFreeHqProcTB)
+   uint8_t               idx;
 
    if((tbIndex > RG_MAX_TB_PER_UE) ||
       (tbIndex == 0))
    {
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    tb = &(hqP->tbInfo[tbIndex-1].tb);
@@ -1508,7 +1467,7 @@ U8                   tbIndex;
    }
       hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sf = NULLP;
    }
-   RETVALUE(ROK);
+   return ROK;
 }
 #endif
 
@@ -1530,19 +1489,18 @@ U8                   tbIndex;
  *
  **/
 #ifdef ANSI
-PUBLIC Void rgDHMFreeUe
+Void rgDHMFreeUe
 (
 Inst               inst,
 RgDlHqEnt          *hqE
 )
 #else
-PUBLIC Void rgDHMFreeUe(inst,hqE)
+Void rgDHMFreeUe(inst,hqE)
 Inst               inst;
 RgDlHqEnt          *hqE;
 #endif
 {
-   U8             i;
-   TRC2(rgDHMFreeUe)
+   uint8_t             i;
 
    if(hqE->procs)
    {
@@ -1567,7 +1525,7 @@ RgDlHqEnt          *hqE;
                             assignment */
    }
 
-   RETVOID;
+   return;
 
 }  /* rgDHMFreeUe */
 /**
@@ -1588,13 +1546,13 @@ RgDlHqEnt          *hqE;
  *      -# ROK 
  **/
 #ifdef ANSI
-PUBLIC S16 RgSchMacRstHqEntReq
+S16 RgSchMacRstHqEntReq
 (
 Pst*                 pst,    
 RgInfResetHqEnt*     hqEntInfo
 )
 #else
-PUBLIC S16 RgSchMacRstHqEntReq(pst, hqEntInfo)
+S16 RgSchMacRstHqEntReq(pst, hqEntInfo)
 Pst*                 pst;
 RgInfResetHqEnt*     hqEntInfo;
 #endif
@@ -1610,21 +1568,21 @@ RgInfResetHqEnt*     hqEntInfo;
    {
       RGDBGERRNEW(inst,(rgPBuf(inst), "For user [%d]Cell does not exist %d\n",
                 hqEntInfo->crnti,hqEntInfo->cellId));
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    if ((ue = rgDBMGetUeCb(cell, hqEntInfo->crnti)) == NULLP)
    {
       RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]UE does not exist for this hqEntInfo\n",
                        hqEntInfo->crnti));
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    rgDHMUeReset(cell, &ue->dl.hqEnt);
 
-   RETVALUE(ROK);
+   return ROK;
 }
-U32 gSaveVal;
+uint32_t gSaveVal;
 \f
 /**
  * @brief Function for handling RaResp request received from scheduler to MAC
@@ -1634,7 +1592,7 @@ U32 gSaveVal;
  *     Function : RgSchMacRlsHqReq
  *     
  *     This function shall be invoked whenever scheduler is done with the
- *     allocations of random access responses for a subframe.
+ *     allocations of random access responses for a slot.
  *     This shall invoke RAM to create ueCbs for all the rapIds allocated and 
  *     shall invoke MUX to create RAR PDUs for raRntis allocated.
  *     
@@ -1646,13 +1604,13 @@ U32 gSaveVal;
  *      -# ROK 
  **/
 #ifdef ANSI
-PUBLIC S16 RgSchMacRlsHqReq
+S16 RgSchMacRlsHqReq
 (
 Pst                 *pst,
 RgInfRlsHqInfo      *rlshqUeInfo
 )
 #else
-PUBLIC S16 RgSchMacRlsHqReq(pst, rlshqUeInfo)
+S16 RgSchMacRlsHqReq(pst, rlshqUeInfo)
 Pst                 *pst;
 RgInfRlsHqInfo      *rlshqUeInfo;
 #endif
@@ -1661,16 +1619,14 @@ RgInfRlsHqInfo      *rlshqUeInfo;
    RgCellCb       *cell = NULLP;
    RgUeCb         *ue;
    RgDlHqProcCb   *hqP;
-   U8             idx1,idx2;
+   uint8_t        idx1,idx2;
 #ifdef LTE_L2_MEAS
-   U8                tbId;
+   uint8_t           tbId;
    RguHarqStatusInd  hqStaInd;
    Bool              isValidTbId = FALSE;
 #endif
-   U32        startTime=0;
+   uint32_t        startTime=0;
    
-   TRC2(RgSchMacRlsHqReq)
-
    RG_IS_INST_VALID(pst->dstInst);
    inst = pst->dstInst - RG_INST_START;
    cell  = rgCb[inst].cell;
@@ -1679,7 +1635,7 @@ RgInfRlsHqInfo      *rlshqUeInfo;
 
    if(NULLP == rlshqUeInfo)
    {
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    if((cell  == NULLP)
@@ -1688,12 +1644,12 @@ RgInfRlsHqInfo      *rlshqUeInfo;
        
       RLOG_ARG0(L_ERROR,DBG_CELLID,rlshqUeInfo->cellId,
                 "No cellCb found with cellId");
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    if(NULLP == rlshqUeInfo->ueHqInfo)
    {
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    for(idx1 = 0; idx1 < rlshqUeInfo->numUes; idx1++)
@@ -1802,7 +1758,7 @@ RgInfRlsHqInfo      *rlshqUeInfo;
    /*starting Task*/
    SStopTask(startTime,PID_MAC_AM_HARQ_RLS);
 
-   RETVALUE(ROK);
+   return ROK;
 } /* end of RgSchMacRlsHqReq */