Jira id - ODUHIGH-227
[o-du/l2.git] / src / 5gnrrlc / kw_tmm_ul.c
index b60d717..6777cdf 100755 (executable)
@@ -25,9 +25,9 @@
      Desc:     Source code for RLC Transparent mode assembly and
                reassembly.This file contains following functions
                 
-                  --kwTmmQSdu
-                  --kwTmmSndToLi
-                  --kwTmmRcvFrmLi
+                  --rlcTmmQSdu
+                  --rlcTmmSndToLi
+                  --rlcTmmRcvFrmLi
                   --kwTmmReEstablish 
 
      File:     kw_tmm_ul.c
@@ -61,6 +61,9 @@ static int RLOG_FILE_ID=201;
 
 #include "kw.x"
 #include "kw_ul.x"
+#include "du_app_rlc_inf.h"
+#include "rlc_utils.h"
+#include "rlc_upr_inf_api.h"
 
 #if defined(PRE_DEF_UE_CTX) || defined(PRE_DEF_UE_CTX_HO)
 #ifdef EG_GEN_LOAD_5GTF
@@ -69,13 +72,13 @@ extern U32 loadStart;
 
 EXTERN S16 PjUiPjuDatInd(Pst* pst,SuId suId,CmLtePdcpId * pdcpId,Buffer *mBuf);
 #ifdef ANSI
-PUBLIC Void AddUeContext
+Void AddUeContext
 (
 CmLteRnti   crnti,
 U8 rrcMsgType
 )
 #else
-PUBLIC Void AddUeContext(crnti,rrcMsgType)
+Void AddUeContext(crnti,rrcMsgType)
 CmLteRnti   crnti,
 U8 rrcMsgType 
 #endif
@@ -106,7 +109,7 @@ U8 rrcUeCapabilityInfo[] =
 #ifdef PJ
    Pst ulPst2 ={100,100,217,0,216,0,PRIOR0,0,68,0,1,0,0};
 #endif
-  TRC2(kwTmmRcvFrmLi) 
+  TRC2(rlcTmmRcvFrmLi) 
 
   if(1 == rrcMsgType)
   {
@@ -126,7 +129,7 @@ U8 rrcUeCapabilityInfo[] =
 
    RLOG1(L_INFO,"Profiling Framework Sending RRC Connection Req to RRC for UE :%d\n",crnti);
    printf("Profiling Framework Sending RRC Connection Req to RRC for UE :%d\n",crnti);
-   KwUiKwuDatInd(&ulPst1, datIndInfo, pdu);
+   RlcUiKwuDatInd(&ulPst1, datIndInfo, pdu);
  }
  else if(2 == rrcMsgType)
  {
@@ -220,7 +223,7 @@ U8 rrcUeCapabilityInfo[] =
 /** @addtogroup tmmode */
 /*@{*/
 
-#define KW_MODULE (KW_DBGMASK_TM | KW_DBGMASK_UL)
+#define RLC_MODULE (RLC_DBGMASK_TM | RLC_DBGMASK_UL)
 
 /**
  * @brief
@@ -243,7 +246,7 @@ U8 rrcUeCapabilityInfo[] =
  */
 #ifdef CCPU_OPT
 #ifdef ANSI
-PUBLIC Void kwTmmRcvFrmLi
+Void rlcTmmRcvFrmLi
 (
 RlcCb        *gCb,
 RlcUlRbCb    *rbCb,  
@@ -251,7 +254,7 @@ CmLteRnti   tCrnti,
 Buffer      *pdu      
 )
 #else
-PUBLIC Void kwTmmRcvFrmLi(gCb,rbCb, tCrnti, pdu)
+Void rlcTmmRcvFrmLi(gCb,rbCb, tCrnti, pdu)
 RlcCb        *gCb;
 RlcUlRbCb    *rbCb;  
 CmLteRnti   tCrnti; 
@@ -259,59 +262,67 @@ Buffer      *pdu;
 #endif
 #else
 #ifdef ANSI
-PUBLIC Void kwTmmRcvFrmLi
+Void rlcTmmRcvFrmLi
 (
 RlcCb       *gCb,
 RlcUlRbCb   *rbCb,         
 Buffer     *pdu            
 )
 #else
-PUBLIC Void kwTmmRcvFrmLi(gCb,rbCb, pdu)
+Void rlcTmmRcvFrmLi(gCb,rbCb, pdu)
 RlcCb       *gCb;
 RlcUlRbCb   *rbCb;         
 Buffer     *pdu;         
 #endif
 #endif 
 {
-   KwuDatIndInfo   *datIndInfo;   /* Data Indication Information */
-   MsgLen          msgLen;
+   RlcUlRrcMsgInfo  *ulRrcMsgInfo;
+   uint16_t         msgLen;
+   uint16_t         copyLen;    /* Number of bytes copied */
+   Pst              pst;
  
-   TRC2(kwTmmRcvFrmLi) 
+   TRC2(rlcTmmRcvFrmLi) 
 
-   /* Creating static memory for KwuDatIndInfo. #else will be 
-    * removed once the sanity testing is performed for all platforms */
-   KwuDatIndInfo datIndInfoTmp;
-   datIndInfo = &datIndInfoTmp;
-#if (ERRCLASS & ERRCLS_ADD_RES)
-   if ( datIndInfo == NULLP )
-   {   
-      RLOG_ARG2(L_FATAL,DBG_RBID,rbCb->rlcId.rbId,
-            "Memory Allocation failed UEID:%d CELLID:%d",
-            rbCb->rlcId.ueId,
-            rbCb->rlcId.cellId);   
-      RETVOID;
-   }
-#endif /* ERRCLASS & ERRCLS_ADD_RES */
-   KW_MEM_CPY(&(datIndInfo->rlcId),&(rbCb->rlcId),sizeof(CmLteRlcId));
-#ifdef CCPU_OPT 
-   if ( rbCb->lch.lChType == CM_LTE_LCH_CCCH ) 
-   {
-      datIndInfo->tCrnti = tCrnti;
-   }
-#endif 
    gCb->genSts.pdusRecv++;
-   SFndLenMsg(pdu, &msgLen);
+   SFndLenMsg(pdu, (MsgLen *)&msgLen);
    gCb->genSts.bytesRecv += msgLen;
    /* If trace flag is enabled send the trace indication */
    if(gCb->init.trc == TRUE)
    {
       /* Populate the trace params */
-      kwLmmSendTrc(gCb,KWU_EVT_DAT_IND, pdu);
+      rlcLmmSendTrc(gCb, EVENT_UL_RRC_MSG_TRANS_TO_DU, pdu);
    }
-   KwUiKwuDatInd( &gCb->u.ulCb->kwuUlSap->pst, 
-                  //gCb->u.ulCb->kwuUlSap->suId, 
-                  datIndInfo, pdu);
-   
+  
+   /* Filling UL RRC Message Info */
+   RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL,
+      ulRrcMsgInfo, sizeof(RlcUlRrcMsgInfo));
+   if (ulRrcMsgInfo)
+   {
+      ulRrcMsgInfo->cellId = rbCb->rlcId.cellId;
+      ulRrcMsgInfo->ueIdx = rbCb->rlcId.ueId;
+      ulRrcMsgInfo->lcId = rbCb->lch.lChId;
+      RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL,
+         ulRrcMsgInfo->rrcMsg, msgLen);
+      if (ulRrcMsgInfo->rrcMsg)
+      {
+         SCpyMsgFix(pdu, 0, msgLen, ulRrcMsgInfo->rrcMsg, (MsgLen *)&copyLen);
+         ulRrcMsgInfo->msgLen = msgLen;
+
+         /* Sending UL RRC Message transfeer to DU APP */
+         memset(&pst, 0, sizeof(Pst));
+         FILL_PST_RLC_TO_DUAPP(pst, SFndProcId(), RLC_UL_INST, EVENT_UL_RRC_MSG_TRANS_TO_DU);
+         rlcSendUlRrcMsgToDu(&pst, ulRrcMsgInfo);
+      }
+      else
+      {
+         DU_LOG("\nRLC : Memory allocation failed");
+      }
+   }
+   else
+   {
+      DU_LOG("\nRLC : Memory allocation failed");
+   }
    RETVOID;
 }
 
@@ -329,15 +340,15 @@ Buffer     *pdu;
  *       
  **/
 #ifdef ANSI
-PUBLIC Void kwTmmUlReEstablish
+Void rlcTmmUlReEstablish
 (
 RlcCb        *gCb,
 RlcUlRbCb    *rbCb        
 )
 #else
-PUBLIC Void kwTmmUlReEstablish(rbCb)
+Void rlcTmmUlReEstablish(rbCb)
 RlcCb        *gCb;
-KwRbCb      *rbCb;          
+RlcUlRbCb    *rbCb;          
 #endif
 {
    TRC2(rlcUlTmmReEstablish)