remove/replaced PRIVATE and EXTERN keywords
[o-du/l2.git] / src / 5gnrmac / rg_dhm.c
index cb6267d..84e4746 100755 (executable)
@@ -68,23 +68,23 @@ static int RLOG_MODULE_ID=4096;
 #include "ss_task.x"
 #include "ss_msg.x"            /* MAC includes */
 /* local defines */
-//EXTERN  S16 ssGetDBufOfSize(Region region,Size size,Buffer **dBuf);
+// S16 ssGetDBufOfSize(Region region,Size size,Buffer **dBuf);
 //void prc_trace_format_string(UINT32 group_mask, UINT16 level, const char *format, ...);
 #endif
 
 /* local typedefs */
  
 /* local externs */
-EXTERN S16 SIncMsgRef(Buffer *srcBuf,Region dstRegion, Pool dstPool,Buffer **dstBuf);
+S16 SIncMsgRef(Buffer *srcBuf,Region dstRegion, Pool dstPool,Buffer **dstBuf);
 
-PRIVATE Void rgDHMBldTfuDatReq ARGS((RgCellCb *cellCb, RgDlSf *dlSf, RgDlHqProcCb *hqP,
+static Void rgDHMBldTfuDatReq ARGS((RgCellCb *cellCb, RgDlSf *dlSf, RgDlHqProcCb *hqP,
                            RgTfuDatReqPduInfo *datReq));
 
 #ifdef L2_OPTMZ
 S16 rgDHMFreeHqProcTB
 (
 RgDlHqProcCb         *hqP,
-U8                   tbIndex
+uint8_t              tbIndex
 );
 
 #endif
@@ -116,23 +116,21 @@ S16 rgDHMHqEntInit
 (
 Inst               inst,
 RgDlHqEnt          *hqE,
-U8                 maxHqProcs
+uint8_t            maxHqProcs
 )
 #else
 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++)
@@ -209,9 +207,7 @@ RgCellCb *cell;
 RgDlHqEnt          *hqE;
 #endif
 {
-   U8       i = 0;
-
-   TRC2(rgDHMUeReset)
+   uint8_t       i = 0;
 
    if(hqE->procs[0])
    {
@@ -226,7 +222,7 @@ RgDlHqEnt          *hqE;
 #endif
       }
    }
-   RETVOID;
+   return;
 } /* rgDHMUeReset*/
 
 /**
@@ -257,7 +253,6 @@ Inst inst;
 #endif
 {
    RgCb *rgCbP = &rgCb[inst];
-   TRC2(rgDHMHdlBufFree)
 
    if (rgCbP->bufCnt < RG_MAX_DFRD_FREE_BUFS)
    {
@@ -272,7 +267,7 @@ Inst inst;
    {
       RG_FREE_MSG(*mBuf);
    }
-   RETVOID;
+   return;
 }
 /**
  * @brief This function is called to release the 
@@ -303,10 +298,8 @@ 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)
    {
@@ -322,7 +315,7 @@ Inst inst;
       SPutMsg(rgCbP->bufToFree[start]);
    }
    rgCbP->bufCnt = end;
-   RETVOID;
+   return;
 } /* rgDHMFreeTbBufs */
 
 #ifdef ANSI
@@ -336,10 +329,8 @@ 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)
    {
@@ -347,7 +338,7 @@ Inst inst;
       SPutMsg(rgCbP->bufToFree[start]);
    }
    rgCbP->bufCnt = end;
-   RETVOID;
+   return;
 } /* rgDHMFreeTbBufs */
 
 
@@ -372,23 +363,21 @@ S16 rgDHMRlsHqProcTB
 (
 RgCellCb             *cell,
 RgDlHqProcCb         *hqP,
-U8                   tbIndex
+uint8_t              tbIndex
 )
 #else
 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))
    {
@@ -451,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
@@ -462,25 +451,23 @@ U8                   tbIndex;
 S16 rgDHMGetHqProcFrmId
 (
 RgUeCb               *ue,
-U8                   idx,
+uint8_t              idx,
 RgDlHqProcCb         **hqP
 )
 #else
 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]);
 
    return ROK;
 } /* rgDHMGetHqProcFrmId */
 
-/*PRIVATE U32 dataAvl; */
+/*static uint32_t dataAvl; */
 /**
  * @brief Handler for sending data to PHY
  *
@@ -518,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++)
    {
@@ -703,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.
     */
@@ -728,7 +712,7 @@ RgErrInfo      *err;
          {
             j++;
          } 
-         rgDHMRlsHqProcTB(rgCb[inst].cell, hqProc, (U8)(j+1));
+         rgDHMRlsHqProcTB(rgCb[inst].cell, hqProc, (uint8_t)(j+1));
       }
       return RFAILED;
    }
@@ -751,7 +735,7 @@ 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);
          }
          return RFAILED;
@@ -800,7 +784,7 @@ RgErrInfo      *err;
             {
                j++;
             }
-            rgDHMRlsHqProcTB(rgCb[inst].cell, hqProc, (U8)(j+1));
+            rgDHMRlsHqProcTB(rgCb[inst].cell, hqProc, (uint8_t)(j+1));
          }
          return RFAILED;
       }
@@ -850,8 +834,6 @@ RgErrInfo      *err;
    RgUstaDgn      dgn;
    RgBldPduInfo   bldPdu;
 
-   TRC2(rgDHMHndlCmnDatReq)
-
 #ifndef L2_OPTMZ
       if (hqProc->tbInfo[0].tb != NULLP)
 #else
@@ -931,10 +913,10 @@ RgErrInfo       *err;
 #endif
 {
    SuId            rguDlSpId;/*need to use spID instead of suID*/
-   U8              idx;
-   U8              ueIdx;
-   U8              lcIdx;
-   U8              tbIndex=0,idx1;
+   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;
@@ -945,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
@@ -954,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++)
@@ -1280,9 +1261,9 @@ RgErrInfo       *err;
  *  @return     Void
  *              None 
  **/
-//U8 crashFlag = 0;
+//uint8_t crashFlag = 0;
 #ifdef ANSI
-PRIVATE Void rgDHMBldTfuDatReq
+static Void rgDHMBldTfuDatReq
 (
 RgCellCb           *cellCb,
 RgDlSf             *dlSf,
@@ -1290,7 +1271,7 @@ RgDlHqProcCb       *hqP,
 RgTfuDatReqPduInfo *datReq
 )
 #else
-PRIVATE Void rgDHMBldTfuDatReq(cellCb, dlSf, hqP, datReq)
+static Void rgDHMBldTfuDatReq(cellCb, dlSf, hqP, datReq)
 RgCellCb           *cellCb;
 RgDlSf             *dlSf;
 RgDlHqProcCb       *hqP;
@@ -1306,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
@@ -1430,7 +1410,7 @@ RgTfuDatReqPduInfo *datReq;
          datReq->nmbOfTBs++;
       }
    }
-   RETVOID;
+   return;
 }  /* rgDHMBldTfuDatReq */
 
 
@@ -1455,18 +1435,16 @@ RgTfuDatReqPduInfo *datReq;
 S16 rgDHMFreeHqProcTB
 (
 RgDlHqProcCb         *hqP,
-U8                   tbIndex
+uint8_t              tbIndex
 )
 #else
 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))
@@ -1522,8 +1500,7 @@ Inst               inst;
 RgDlHqEnt          *hqE;
 #endif
 {
-   U8             i;
-   TRC2(rgDHMFreeUe)
+   uint8_t             i;
 
    if(hqE->procs)
    {
@@ -1548,7 +1525,7 @@ RgDlHqEnt          *hqE;
                             assignment */
    }
 
-   RETVOID;
+   return;
 
 }  /* rgDHMFreeUe */
 /**
@@ -1605,7 +1582,7 @@ RgInfResetHqEnt*     hqEntInfo;
 
    return ROK;
 }
-U32 gSaveVal;
+uint32_t gSaveVal;
 \f
 /**
  * @brief Function for handling RaResp request received from scheduler to MAC
@@ -1642,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;