fixed tbSize issue
[o-du/l2.git] / src / cm / rgu.c
index 25cd9ff..c4a796d 100755 (executable)
 */
 
 /* header include files (.h) */
-#include "envopt.h"        /* environment options */
-#include "envdep.h"        /* environment dependent */
-#include "envind.h"        /* environment independent */
-#include "gen.h"           /* general */
-#include "ssi.h"           /* system services */
-#include "cm_tkns.h"       /* Common Token Defines */
-#include "cm_llist.h"      /* Common Link List Defines */
-#include "cm_hash.h"       /* Common Hash List Defines */
-#include "cm_lte.h"        /* Common LTE Defines */
+#include "common_def.h"
 #include "rgu.h"           /* RGU Interface defines */
 
 /* header/extern include files (.x) */
-#include "gen.x"           /* general */
-#include "ssi.x"           /* system services */
-#include "cm_tkns.x"       /* Common Token Definitions */
-#include "cm_llist.x"      /* Common Link List Definitions */
-#include "cm_lib.x"        /* Common Library Definitions */
-#include "cm_hash.x"       /* Common Hash List Definitions */
-#include "cm_lte.x"        /* Common LTE Defines */
 #include "rgu.x"           /* RGU Interface includes */
 
 #ifdef SS_RBUF
@@ -428,19 +413,12 @@ Buffer *mBuf;
 *  @return   S16
 *      -# ROK
 **/
-#ifdef ANSI
-PUBLIC S16 packDlData
+PUBLIC uint16_t packDlData
 (
 Pst* pst,
 SpId spId,
 RlcMacData  *dlData
 )
-#else
-PUBLIC S16 packDlData(pst, spId, dlData)
-Pst* pst;
-SpId spId;
-RlcMacData  dlData;
-#endif
 {
    Buffer *mBuf = NULLP;
    TRC3(packDlData)
@@ -455,7 +433,7 @@ RlcMacData  dlData;
       RETVALUE(RFAILED);
    }
 
-   if (pst->selector == RGU_SEL_LWLC)
+   if (pst->selector == ODU_SELECTOR_LWLC)
    {
       CMCHKPK(cmPkPtr,(PTR) dlData, mBuf);
    }
@@ -497,7 +475,7 @@ RlcMacData  dlData;
           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
           (ErrVal)ERGU024, (ErrVal)0, "Packing failed");
 #endif      
-      if (dlData != NULLP);
+      if (dlData != NULLP)
       {
          SPutSBuf(pst->region, pst->pool, 
                   (Data *)dlData, sizeof(RlcMacData));
@@ -524,22 +502,14 @@ RlcMacData  dlData;
 *  @return   S16
 *      -# ROK
 **/
-#ifdef ANSI
 PUBLIC S16 unpackDlData
 (
-RguDDatReq func,
+RlcMacDlData func,
 Pst *pst,
 Buffer *mBuf
 )
-#else
-PUBLIC S16 unpackDlData(func, pst, mBuf)
-RguDDatReq func;
-Pst *pst;
-Buffer *mBuf;
-#endif
 {
    SpId spId;
-//   RguDDatReqInfo *datReq;
    RlcMacData *dlData;
    
    TRC3(unpackDlData)
@@ -549,7 +519,7 @@ Buffer *mBuf;
       RETVALUE(RFAILED);
    }
 
-   if (pst->selector == RGU_SEL_LWLC)
+   if (pst->selector == ODU_SELECTOR_LWLC)
    {
       CMCHKUNPK(cmUnpkPtr,(PTR *) &dlData, mBuf);
    }
@@ -607,22 +577,9 @@ Buffer *mBuf;
 *  @return   S16
 *      -# ROK
 **/
-#ifdef ANSI
-PUBLIC S16 packRcvdUlData
-(
-Pst* pst,
-SuId suId,
-RlcMacData  *ulData
-)
-#else
-PUBLIC S16 packRcvdUlData(pst, suId, ulData)
-Pst* pst;
-SuId suId;
-RlcMacData  *ulData;
-#endif
+uint8_t packRlcUlData(Pst* pst, RlcMacData  *ulData)
 {
    Buffer *mBuf = NULLP;
-   TRC3(packRcvdUlData)
 
    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
 #if (ERRCLASS & ERRCLS_ADD_RES)      
@@ -634,7 +591,7 @@ RlcMacData  *ulData;
       RETVALUE(RFAILED);
    }
 
-   if (pst->selector == RGU_SEL_LWLC)
+   if (pst->selector == ODU_SELECTOR_LWLC)
    {
       CMCHKPK(cmPkPtr,(PTR)ulData, mBuf);
    }
@@ -663,17 +620,6 @@ RlcMacData  *ulData;
       }
       ulData = NULLP;
    }
-   if (SPkS16(suId, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)      
-      SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
-          __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
-          (ErrVal)ERGU037, (ErrVal)0, "Packing failed");
-#endif      
-      SPutStaticBuffer(pst->region, pst->pool, (Data *)ulData, sizeof(RlcMacData),0);
-      SPutMsg(mBuf);
-      RETVALUE(RFAILED);
-   }
-
    pst->event = (Event) EVTRLCULDAT;
    RETVALUE(SPstTsk(pst,mBuf));
 }
@@ -693,36 +639,13 @@ RlcMacData  *ulData;
 *  @return   S16
 *      -# ROK
 **/
-#ifdef ANSI
-PUBLIC S16 unpackRcvdUlData
-(
-RguDDatInd func,
-Pst *pst,
-Buffer *mBuf
-)
-#else
-PUBLIC S16 unpackRcvdUlData(func, pst, mBuf)
-RguDDatInd func;
-Pst *pst;
-Buffer *mBuf;
-#endif
+uint8_t unpackRcvdUlData(RlcMacUlDataFunc func, Pst *pst, Buffer *mBuf)
 {
-   SuId suId;
    RlcMacData *ulData;
    
    TRC3(unpackRcvdUlData)
 
-   if (SUnpkS16(&suId, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)      
-      SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
-          __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
-          (ErrVal)ERGU039, (ErrVal)0, "UnPacking failed");
-#endif      
-      SPutMsg(mBuf);
-      RETVALUE(RFAILED);
-   }
-
-   if (pst->selector == RGU_SEL_LWLC)
+   if (pst->selector == ODU_SELECTOR_LWLC)
    {
       CMCHKUNPK(cmUnpkPtr,(PTR *) &ulData, mBuf);
    }
@@ -751,7 +674,7 @@ Buffer *mBuf;
       }
    }
    SPutMsg(mBuf);
-   RETVALUE((*func)(pst, suId, ulData));
+   RETVALUE((*func)(pst, ulData));
 }
 
 
@@ -885,7 +808,7 @@ RguL2MUlThrpMeasReqInfo* measReq;
       SPutSBuf(pst->region, pst->pool, (Data *)measReq, sizeof(RguL2MUlThrpMeasReqInfo));
       RETVALUE(RFAILED);
    }
-   if (pst->selector == RGU_SEL_LWLC)
+   if (pst->selector == ODU_SELECTOR_LWLC)
    {
       CMCHKPK(cmPkPtr,(PTR) measReq, mBuf);
    }
@@ -978,7 +901,7 @@ Buffer *mBuf;
       SPutMsg(mBuf);
       RETVALUE(RFAILED);
    }
-   if (pst->selector == RGU_SEL_LWLC)
+   if (pst->selector == ODU_SELECTOR_LWLC)
    {
       CMCHKUNPK(cmUnpkPtr,(PTR *) &measReq, mBuf);
    }
@@ -1029,19 +952,12 @@ Buffer *mBuf;
 *  @return   S16
 *      -# ROK
 **/
-#ifdef ANSI
-PUBLIC S16 packBOStatus
+PUBLIC uint16_t packBOStatus
 (
 Pst* pst,
 SpId spId,
 RlcMacBOStatus  *boStatus
 )
-#else
-PUBLIC S16 packBOStatus(pst, spId, staRsp)
-Pst* pst;
-SpId spId;
-RlcMacBOStatus  *boStatus;
-#endif
 {
    RlcMacBOStatus  *boStaInfo = NULL;
    Buffer *mBuf = NULLP;
@@ -1073,7 +989,7 @@ RlcMacBOStatus  *boStatus;
 
       RETVALUE(RFAILED);
    }
-   if (pst->selector == RGU_SEL_LWLC)
+   if (pst->selector == ODU_SELECTOR_LWLC)
    {
       CMCHKPK(cmPkPtr,(PTR) boStaInfo, mBuf);
    }
@@ -1123,19 +1039,12 @@ RlcMacBOStatus  *boStatus;
 *  @return   S16
 *      -# ROK
 **/
-#ifdef ANSI
-PUBLIC S16 unpackBOStatus
+PUBLIC uint16_t unpackBOStatus
 (
-RguDStaRsp func,
+RlcMacBoStatus func,
 Pst *pst,
 Buffer *mBuf
 )
-#else
-PUBLIC S16 unpackBOStatus(func, pst, mBuf)
-RguDStaRsp func;
-Pst *pst;
-Buffer *mBuf;
-#endif
 {
    SpId spId;
    RlcMacBOStatus *boSta;
@@ -1152,7 +1061,7 @@ Buffer *mBuf;
       RETVALUE(RFAILED);
    }
 
-   if (pst->selector == RGU_SEL_LWLC)
+   if (pst->selector == ODU_SELECTOR_LWLC)
    {
       CMCHKUNPK(cmUnpkPtr,(PTR *) &boSta, mBuf);
    }
@@ -1253,7 +1162,7 @@ RguHarqStatusInd  *harqStatusInd;
       RETVALUE(RFAILED);
    }
 
-   if (pst->selector == RGU_SEL_LWLC)
+   if (pst->selector == ODU_SELECTOR_LWLC)
    {
       CMCHKPK(cmPkPtr,(PTR) harqStaInd, mBuf); 
    }
@@ -1290,7 +1199,7 @@ RguHarqStatusInd  *harqStatusInd;
    if (SPutSBuf(pst->region, pst->pool, (Data *)harqStaInd,
             sizeof(RguHarqStatusInd)) != ROK) {
 #else   
-   if (pst->selector != RGU_SEL_LWLC)
+   if (pst->selector != ODU_SELECTOR_LWLC)
    {
       if(SPutStaticBuffer(pst->region, pst->pool, (Data *)harqStaInd, 
                sizeof(RguHarqStatusInd), 0) != ROK)
@@ -1359,7 +1268,7 @@ Buffer *mBuf;
    if ((SGetSBuf(pst->region, pst->pool, (Data **)&hqStaInd, 
         sizeof(RguHarqStatusInd))) != ROK) {
 #else   
-   if (pst->selector == RGU_SEL_LWLC)
+   if (pst->selector == ODU_SELECTOR_LWLC)
    {
       CMCHKUNPK(cmUnpkPtr,(PTR *) &hqStaInd, mBuf);
    }  
@@ -1419,19 +1328,12 @@ Buffer *mBuf;
 *  @return   S16
 *      -# ROK
 **/
-#ifdef ANSI
 PUBLIC S16 packSchedRep
 (
 Pst* pst,
 SuId suId,
-RlcMacSchedRep  * schRep
+RlcMacSchedRepInfo  * schRep
 )
-#else
-PUBLIC S16 packSchedRep(pst, suId, staInd)
-Pst* pst;
-SuId suId;
-RlcMacSchedRep  * schRep;
-#endif
 {
    Buffer *mBuf = NULLP;
    TRC3(packSchedRep)
@@ -1442,10 +1344,10 @@ RlcMacSchedRep  * schRep;
           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
           (ErrVal)ERGU076, (ErrVal)0, "Packing failed");
 #endif      
-      SPutSBuf(pst->region, pst->pool, (Data *)schRep, sizeof(RlcMacSchedRep));
+      SPutSBuf(pst->region, pst->pool, (Data *)schRep, sizeof(RlcMacSchedRepInfo));
       RETVALUE(RFAILED);
    }
-   if (pst->selector == RGU_SEL_LWLC)
+   if (pst->selector == ODU_SELECTOR_LWLC)
    {
       CMCHKPK(cmPkPtr,(PTR) schRep, mBuf);
    }
@@ -1458,12 +1360,12 @@ RlcMacSchedRep  * schRep;
                (ErrVal)ERGU077, (ErrVal)0, "Packing failed");
 #endif      
         SPutSBuf(pst->region, pst->pool, (Data *)schRep, 
-                                         sizeof(RlcMacSchedRep));
+                                         sizeof(RlcMacSchedRepInfo));
          SPutMsg(mBuf);
          RETVALUE(RFAILED);
       } 
       if (SPutSBuf(pst->region, pst->pool, (Data *)schRep,
-                                  sizeof(RlcMacSchedRep)) != ROK) {
+                                  sizeof(RlcMacSchedRepInfo)) != ROK) {
 #if (ERRCLASS & ERRCLS_ADD_RES)      
          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
@@ -1482,7 +1384,7 @@ RlcMacSchedRep  * schRep;
 #endif      
       if (schRep != NULLP)
       {
-         SPutSBuf(pst->region, pst->pool, (Data *)schRep, sizeof(RlcMacSchedRep));
+         SPutSBuf(pst->region, pst->pool, (Data *)schRep, sizeof(RlcMacSchedRepInfo));
       }
       SPutMsg(mBuf);
       RETVALUE(RFAILED);
@@ -1509,23 +1411,15 @@ RlcMacSchedRep  * schRep;
 *  @return   S16
 *      -# ROK
 **/
-#ifdef ANSI
 PUBLIC S16 unpackSchedRep
 (
-RguDStaInd func,
+RlcMacSchedRep func,
 Pst *pst,
 Buffer *mBuf
 )
-#else
-PUBLIC S16 unpackSchedRep(func, pst, mBuf)
-RguDStaInd func;
-Pst *pst;
-Buffer *mBuf;
-#endif
 {
    SuId suId;
-//   RguDStaIndInfo *staInd;
-   RlcMacSchedRep *schRep;
+   RlcMacSchedRepInfo *schRep;
    
    TRC3(unpackSchedRep)
 
@@ -1538,13 +1432,13 @@ Buffer *mBuf;
       SPutMsg(mBuf);
       RETVALUE(RFAILED);
    }
-   if (pst->selector == RGU_SEL_LWLC)
+   if (pst->selector == ODU_SELECTOR_LWLC)
    {
       CMCHKUNPK(cmUnpkPtr,(PTR *) &schRep, mBuf);
    }
    else 
    {
-      if ((SGetSBuf(pst->region, pst->pool, (Data **)&schRep, sizeof(RlcMacSchedRep))) != ROK) {
+      if ((SGetSBuf(pst->region, pst->pool, (Data **)&schRep, sizeof(RlcMacSchedRepInfo))) != ROK) {
 #if (ERRCLASS & ERRCLS_ADD_RES)      
          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
          __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
@@ -1560,7 +1454,7 @@ Buffer *mBuf;
              (ErrVal)ERGU082, (ErrVal)0, "UnPacking failed");
 #endif      
          SPutMsg(mBuf);
-         SPutSBuf(pst->region, pst->pool, (Data *)schRep, sizeof(RlcMacSchedRep));
+         SPutSBuf(pst->region, pst->pool, (Data *)schRep, sizeof(RlcMacSchedRepInfo));
          RETVALUE(RFAILED);
       }
    }
@@ -1678,7 +1572,7 @@ RguFlowCntrlInd   *flowCntrlInd;
 #endif      
       RETVALUE(RFAILED);
    }
-   if (pst->selector == RGU_SEL_LWLC)
+   if (pst->selector == ODU_SELECTOR_LWLC)
    {
       CMCHKPK(cmPkPtr,(PTR) flowCntrlInd, mBuf);
    }
@@ -1819,7 +1713,7 @@ Buffer *mBuf;
       SPutMsg(mBuf);
       RETVALUE(RFAILED);
    }
-   if (pst->selector == RGU_SEL_LWLC)
+   if (pst->selector == ODU_SELECTOR_LWLC)
    {
       CMCHKUNPK(cmUnpkPtr,(PTR *) &flowCntrlInd, mBuf);
    }
@@ -2700,21 +2594,21 @@ Buffer *mBuf;
 
    TRC3(packRlcMacDataInfo);
 
-   for (i=param->nmbPdu-1; i >= 0; i--)
+   for (i=param->numPdu-1; i >= 0; i--)
    {
-      MsgLen msgLen = 0;
-      if (SFndLenMsg(param->pduInfo[i].pduBuf, &msgLen) != ROK)
-         RETVALUE(RFAILED);
-      if (SCatMsg(mBuf, param->pduInfo[i].pduBuf, M1M2) != ROK)
-          RETVALUE(RFAILED);      
+      msgLen = 0;
+      //if (SFndLenMsg(param->pduInfo[i].pduBuf, &msgLen) != ROK)
+      //   RETVALUE(RFAILED);
+      //if (SCatMsg(mBuf, param->pduInfo[i].pduBuf, M1M2) != ROK)
+      //    RETVALUE(RFAILED);      
       CMCHKPK(cmPkMsgLen, msgLen, mBuf);
       CMCHKPK(cmPkLteLcId, param->pduInfo[i].lcId, mBuf);
       CMCHKPK(cmPkBool, param->pduInfo[i].commCh, mBuf);
    }
-   CMCHKPK(SPkU8, param->nmbPdu, mBuf);
+   CMCHKPK(SPkU8, param->numPdu, mBuf);
    CMCHKPK(cmPkLteRnti, param->rnti, mBuf);
    CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
-   CMCHKPK(cmPkLteTimingInfo, &param->timeToTx, mBuf);
+   //CMCHKPK(cmPkLteTimingInfo, &param->timeToTx, mBuf);
    RETVALUE(ROK);
 }
 
@@ -2752,21 +2646,21 @@ Buffer *mBuf;
 
    TRC3(unpackRlcMacDataInfo);
    
-   CMCHKUNPK(cmUnpkLteTimingInfo, &param->timeToTx, mBuf);
+   //CMCHKUNPK(cmUnpkLteTimingInfo, &param->timeToTx, mBuf);
    CMCHKUNPK(cmUnpkLteCellId, &param->cellId, mBuf);
    CMCHKUNPK(cmUnpkLteRnti, &param->rnti, mBuf);
-   CMCHKUNPK(SUnpkU8, &param->nmbPdu, mBuf);
-   for (i=0; i<param->nmbPdu; i++) 
+   CMCHKUNPK(SUnpkU8, &param->numPdu, mBuf);
+   for (i=0; i<param->numPdu; i++) 
    {
       MsgLen totalMsgLen;
 
       CMCHKUNPK(cmUnpkBool, &param->pduInfo[i].commCh, mBuf);
       CMCHKUNPK(cmUnpkLteLcId, &param->pduInfo[i].lcId, mBuf);
-      CMCHKUNPK(cmPkMsgLen, &param->pduInfo[i].pduLen, mBuf);
+      CMCHKUNPK(cmUnpkMsgLen, &param->pduInfo[i].pduLen, mBuf);
       if (SFndLenMsg(mBuf, &totalMsgLen) != ROK)
          RETVALUE(RFAILED);
-      if (SSegMsg(mBuf, totalMsgLen-param->pduInfo[i].pduLen, &param->pduInfo[i].pduBuf) != ROK)
-         RETVALUE(RFAILED);
+      //if (SSegMsg(mBuf, totalMsgLen-param->pduInfo[i].pduLen, &param->pduInfo[i].pduBuf) != ROK)
+      //   RETVALUE(RFAILED);
    }
    RETVALUE(ROK);
 }
@@ -3143,19 +3037,12 @@ Buffer *mBuf;
 *     File  : 
 *
 **********************************************************/
-#ifdef ANSI
 PUBLIC S16 packSchedRepInfo
 (
-RlcMacSchedRep *param,
+RlcMacSchedRepInfo *param,
 Buffer *mBuf
 )
-#else
-PUBLIC S16 packSchedRepInfo(param, mBuf)
-RlcMacSchedRep *param;
-Buffer *mBuf;
-#endif
 {
-   S32 i;
    S32 idx;
 
    TRC3(packSchedRepInfo);
@@ -3191,19 +3078,12 @@ Buffer *mBuf;
 *     File  : 
 *
 **********************************************************/
-#ifdef ANSI
 PUBLIC S16 unpackSchedRepInfo
 (
-RlcMacSchedRep *param,
+RlcMacSchedRepInfo *param,
 Buffer *mBuf
 )
-#else
-PUBLIC S16 unpackSchedRepInfo(param, mBuf)
-RlcMacSchedRep *param;
-Buffer *mBuf;
-#endif
 {
-   S32 i;
    S32 idx;
 
    TRC3(unpackSchedRepInfo);