SIB1 optional parameters, Cell start request, stop request and slot indication
[o-du/l2.git] / src / 5gnrrlc / kw_tmm_dl.c
index 730f365..e144db0 100755 (executable)
@@ -148,7 +148,7 @@ Buffer          *mBuf;
         rbCb->lch.lChType == CM_LTE_LCH_PCCH )
    {
       sdu->mode.tm.sfn = datReqInfo->tm.tmg.sfn;
         rbCb->lch.lChType == CM_LTE_LCH_PCCH )
    {
       sdu->mode.tm.sfn = datReqInfo->tm.tmg.sfn;
-      sdu->mode.tm.subframe = datReqInfo->tm.tmg.subframe;
+      sdu->mode.tm.slot = datReqInfo->tm.tmg.slot;
 #ifdef EMTC_ENABLE
      if(rbCb->lch.lChType == CM_LTE_LCH_PCCH)
      {
 #ifdef EMTC_ENABLE
      if(rbCb->lch.lChType == CM_LTE_LCH_PCCH)
      {
@@ -206,7 +206,7 @@ RguCStaIndInfo   *staInd;
 {
    CmLList          *node;          /* Current Link List Node */
    KwSdu            *sdu;           /* SDU */
 {
    CmLList          *node;          /* Current Link List Node */
    KwSdu            *sdu;           /* SDU */
-   RguCDatReqInfo   *cDatReqInfo;   /* Data Request Information */
+   RlcMacData       *dlData;
    S16   timeDiff = 0;
    Ticks curTime  = 0;
 
    S16   timeDiff = 0;
    Ticks curTime  = 0;
 
@@ -216,35 +216,35 @@ RguCStaIndInfo   *staInd;
    CM_LLIST_FIRST_NODE(&(rbCb->m.tm.sduQ), 
                        node);
 
    CM_LLIST_FIRST_NODE(&(rbCb->m.tm.sduQ), 
                        node);
 
-   /* (Sfn,subframe) at which the message should be transmitted is 
-    * validated with alloted (sfn,subframe)in the MAC layer */
+   /* (Sfn,slot) at which the message should be transmitted is 
+    * validated with alloted (sfn,slot)in the MAC layer */
    while (node != NULLP)
    {
       sdu = (KwSdu *)(node->node);
       if ( rbCb->lch.lChType == CM_LTE_LCH_BCCH ||
             rbCb->lch.lChType == CM_LTE_LCH_PCCH )
       {
    while (node != NULLP)
    {
       sdu = (KwSdu *)(node->node);
       if ( rbCb->lch.lChType == CM_LTE_LCH_BCCH ||
             rbCb->lch.lChType == CM_LTE_LCH_PCCH )
       {
-         U16 sfn, subframe;
+         U16 sfn, slot;
          /* MS_FIX: syed sfn is of 10 bytes rather than 8 */
 #ifdef EMTC_ENABLE
          /* MS_FIX: syed sfn is of 10 bytes rather than 8 */
 #ifdef EMTC_ENABLE
-         /* As part of CATM feature cross subframe scheduling is implemented , so there is some delta(currently 2)
+         /* As part of CATM feature cross slot scheduling is implemented , so there is some delta(currently 2)
             between MPDCCH and PDSCH,RLC expects cell crntTime of transmission of control dlsf, so one extra 
             between MPDCCH and PDSCH,RLC expects cell crntTime of transmission of control dlsf, so one extra 
-            information is provided in staInd, so that sfn,subframe should calculate from paging Timing information 
+            information is provided in staInd, so that sfn,slot should calculate from paging Timing information 
             in case of EMTC paging, instead of transId */
          if(staInd->isEmtcPaging)
          {
             sfn      = staInd->pagingTimingInfo.sfn;
             in case of EMTC paging, instead of transId */
          if(staInd->isEmtcPaging)
          {
             sfn      = staInd->pagingTimingInfo.sfn;
-            subframe = staInd->pagingTimingInfo.subframe;
+            slot = staInd->pagingTimingInfo.slot;
          }
          else
 #endif
          {
             sfn = (staInd->transId >> 8) & 0x3FF;
          }
          else
 #endif
          {
             sfn = (staInd->transId >> 8) & 0x3FF;
-            subframe = staInd->transId & 0xFF;
+            slot = staInd->transId & 0xFF;
          }
 
          /* Table
          }
 
          /* Table
-          * tm.subframe - current subframe 
+          * tm.slot - current slot 
           * 0,sfn        7,sfn-1
           * 4,sfn        1,sfn
           * 5,sfn        2,sfn
           * 0,sfn        7,sfn-1
           * 4,sfn        1,sfn
           * 5,sfn        2,sfn
@@ -254,13 +254,13 @@ RguCStaIndInfo   *staInd;
           * Take care of SFN wraparound. TODO: It is better for RLC
           * not to be aware of SCH DELTAs. So we should look for 
           * sending actual transmission time to RLC. */
           * Take care of SFN wraparound. TODO: It is better for RLC
           * not to be aware of SCH DELTAs. So we should look for 
           * sending actual transmission time to RLC. */
-         if ((subframe + TFU_DELTA) >= 10)
+         if ((slot + TFU_DELTA) >= 10)
          {
             sfn = (sfn + 1)%1024;
          }
 
          if ((sdu->mode.tm.sfn != sfn) ||
          {
             sfn = (sfn + 1)%1024;
          }
 
          if ((sdu->mode.tm.sfn != sfn) ||
-               (sdu->mode.tm.subframe != ((subframe+TFU_DELTA)%10)))
+               (sdu->mode.tm.slot != ((slot+TFU_DELTA)%10)))
          {
             node = node->next;
             RLOG_ARG4(L_DEBUG,DBG_RBID,rbCb->rlcId.rbId,
          {
             node = node->next;
             RLOG_ARG4(L_DEBUG,DBG_RBID,rbCb->rlcId.rbId,
@@ -270,9 +270,9 @@ RguCStaIndInfo   *staInd;
                   rbCb->rlcId.ueId,
                   rbCb->rlcId.cellId);   
             RLOG_ARG4(L_DEBUG,DBG_RBID,rbCb->rlcId.rbId,
                   rbCb->rlcId.ueId,
                   rbCb->rlcId.cellId);   
             RLOG_ARG4(L_DEBUG,DBG_RBID,rbCb->rlcId.rbId,
-                  "sfn %d subframe %d  UEID:%d CELLID:%d",
+                  "sfn %d slot %d  UEID:%d CELLID:%d",
                   sfn, 
                   sfn, 
-                  subframe,
+                  slot,
                   rbCb->rlcId.ueId,
                   rbCb->rlcId.cellId);   
             cmLListDelFrm(&(rbCb->m.tm.sduQ), &sdu->lstEnt);
                   rbCb->rlcId.ueId,
                   rbCb->rlcId.cellId);   
             cmLListDelFrm(&(rbCb->m.tm.sduQ), &sdu->lstEnt);
@@ -376,9 +376,9 @@ RguCStaIndInfo   *staInd;
 
     KW_ALLOC_SHRABL_BUF(gCb->u.dlCb->rguDlSap[suId].pst.region,
                         gCb->u.dlCb->rguDlSap[suId].pst.pool,
 
     KW_ALLOC_SHRABL_BUF(gCb->u.dlCb->rguDlSap[suId].pst.region,
                         gCb->u.dlCb->rguDlSap[suId].pst.pool,
-                        cDatReqInfo,(Size)sizeof(RguCDatReqInfo));
+                        dlData,(Size)sizeof(RlcMacData));
 #if (ERRCLASS & ERRCLS_ADD_RES)
 #if (ERRCLASS & ERRCLS_ADD_RES)
-   if ( cDatReqInfo == NULLP )
+   if ( dlData == NULLP )
    {
       RLOG_ARG2(L_FATAL,DBG_RBID,rbCb->rlcId.rbId,
             "Memory Allocation failed UEID:%d CELLID:%d",   
    {
       RLOG_ARG2(L_FATAL,DBG_RBID,rbCb->rlcId.rbId,
             "Memory Allocation failed UEID:%d CELLID:%d",   
@@ -387,29 +387,15 @@ RguCStaIndInfo   *staInd;
       RETVOID; 
    }
 #endif /* ERRCLASS & ERRCLS_ADD_RES */
       RETVOID; 
    }
 #endif /* ERRCLASS & ERRCLS_ADD_RES */
-#ifdef CCPU_OPT
-   if ( rbCb->lch.lChType == CM_LTE_LCH_BCCH ||  
-        rbCb->lch.lChType == CM_LTE_LCH_PCCH )
-   {
-      cDatReqInfo->u.timeToTx.sfn = sdu->mode.tm.sfn;
-      cDatReqInfo->u.timeToTx.subframe = sdu->mode.tm.subframe;
-#ifdef EMTC_ENABLE
-       if(rbCb->lch.lChType == CM_LTE_LCH_PCCH)
-       {
-         cDatReqInfo->pnb = sdu->mode.tm.pnb; 
-       }
-#endif
-   }
-   else
-   {
-      cDatReqInfo->u.rnti = sdu->mode.tm.rnti;
-   }
-#endif 
-   cDatReqInfo->pdu = sdu->mBuf; 
-   cDatReqInfo->transId = rbCb->transId;
-   cDatReqInfo->cellId  = rbCb->rlcId.cellId;
-   cDatReqInfo->lcId   = rbCb->lch.lChId; 
-   cDatReqInfo->lcType = rbCb->lch.lChType; 
+
+   dlData->timeToTx.sfn = sdu->mode.tm.sfn;
+   dlData->timeToTx.slot = sdu->mode.tm.slot;
+   dlData->cellId = rbCb->rlcId.cellId;
+   dlData->rnti = sdu->mode.tm.rnti;
+   dlData->nmbPdu = 1;
+   dlData->pduInfo[0].commCh = TRUE;
+   dlData->pduInfo[0].lcId = rbCb->lch.lChId;
+   dlData->pduInfo[0].pduBuf =  sdu->mBuf;
 
    /* kw005.201 ccpu00117318, updating the statistics */
    gCb->genSts.bytesSent += sdu->sduSz;
 
    /* kw005.201 ccpu00117318, updating the statistics */
    gCb->genSts.bytesSent += sdu->sduSz;
@@ -427,12 +413,12 @@ RguCStaIndInfo   *staInd;
    if(gCb->init.trc == TRUE)
    {
       /* Populate the trace params */
    if(gCb->init.trc == TRUE)
    {
       /* Populate the trace params */
-      kwLmmSendTrc(gCb,EVTRGUCDATREQ, NULLP);
+      kwLmmSendTrc(gCb,EVTRLCDLDAT, NULLP);
    }
    }
-   KwLiRguCDatReq (&(gCb->u.dlCb->rguDlSap[suId].pst), 
-                   gCb->u.dlCb->rguDlSap[suId].spId, 
-                   cDatReqInfo);
    
    
+   RlcMacSendDlData(&(gCb->u.dlCb->rguDlSap[suId].pst),
+                   gCb->u.dlCb->rguDlSap[suId].spId,
+                   dlData);
    RETVOID;
 }
 
    RETVOID;
 }
 
@@ -509,7 +495,8 @@ MsgLen          bo;
 KwuDatReqInfo   *datReqInfo;   
 #endif
 {
 KwuDatReqInfo   *datReqInfo;   
 #endif
 {
-   RguCStaRspInfo   *staRspInfo;   /* Status Response Information */
+//   RguCStaRspInfo   *staRspInfo;   /* Status Response Information */
+   RlcMacBOStatus   *boStatus;      /* Buffer occupancy status information */
    KwRguSapCb       *rguSap;       /* SAP Information */
 
    TRC3(kwTmmSndStaRsp)
    KwRguSapCb       *rguSap;       /* SAP Information */
 
    TRC3(kwTmmSndStaRsp)
@@ -519,9 +506,9 @@ KwuDatReqInfo   *datReqInfo;
 
    KW_ALLOC_SHRABL_BUF(gCb->u.dlCb->rguDlSap[rbCb->rguSapId].pst.region,
                        gCb->u.dlCb->rguDlSap[rbCb->rguSapId].pst.pool,
 
    KW_ALLOC_SHRABL_BUF(gCb->u.dlCb->rguDlSap[rbCb->rguSapId].pst.region,
                        gCb->u.dlCb->rguDlSap[rbCb->rguSapId].pst.pool,
-                       staRspInfo,sizeof(RguCStaRspInfo));
+                       boStatus, sizeof(RguCStaRspInfo));
 #if (ERRCLASS & ERRCLS_ADD_RES)
 #if (ERRCLASS & ERRCLS_ADD_RES)
-   if ( staRspInfo == NULLP )
+   if ( boStatus == NULLP )
    {
       RLOG_ARG2(L_FATAL,DBG_RBID,rbCb->rlcId.rbId,
             "Memory Allocation failed UEID:%d CELLID:%d",
    {
       RLOG_ARG2(L_FATAL,DBG_RBID,rbCb->rlcId.rbId,
             "Memory Allocation failed UEID:%d CELLID:%d",
@@ -530,38 +517,21 @@ KwuDatReqInfo   *datReqInfo;
       RETVOID;
    }
 #endif /* ERRCLASS & ERRCLS_ADD_RES */
       RETVOID;
    }
 #endif /* ERRCLASS & ERRCLS_ADD_RES */
-   staRspInfo->bo = bo;
-   staRspInfo->cellId = rbCb->rlcId.cellId;
-   staRspInfo->lcId   = rbCb->lch.lChId;
-   staRspInfo->lcType = rbCb->lch.lChType;
-#ifdef CCPU_OPT    
-   if ( rbCb->lch.lChType == CM_LTE_LCH_BCCH ||
-        rbCb->lch.lChType == CM_LTE_LCH_PCCH )
-   {
-      staRspInfo->u.timeToTx.sfn      = datReqInfo->tm.tmg.sfn;
-      staRspInfo->u.timeToTx.subframe = datReqInfo->tm.tmg.subframe;
-#ifdef EMTC_ENABLE
-      if(rbCb->lch.lChType == CM_LTE_LCH_PCCH)
-      {
-         staRspInfo->emtcDiReason = datReqInfo->emtcDiReason;
-         staRspInfo->pnb = datReqInfo->pnb;
-      }
-#endif
-   }
-   else if ( rbCb->lch.lChType == CM_LTE_LCH_CCCH )
-   {
-       staRspInfo->u.rnti = datReqInfo->tm.rnti;
-   }
-#endif
+
+   boStatus->cellId = rbCb->rlcId.cellId;
+   boStatus->rnti = rbCb->rlcId.ueId;
+   boStatus->commCh = TRUE;
+   boStatus->lcId = rbCb->lch.lChId;
+   boStatus->bo = bo;
 
    /* If trace flag is enabled send the trace indication */
    if(gCb->init.trc == TRUE)
    {
       /* Populate the trace params */
 
    /* If trace flag is enabled send the trace indication */
    if(gCb->init.trc == TRUE)
    {
       /* Populate the trace params */
-      kwLmmSendTrc(gCb,EVTRGUCSTARSP, NULLP);
+      kwLmmSendTrc(gCb, EVTRLCBOSTA, NULLP);
    }
 
    }
 
-   KwLiRguCStaRsp(&rguSap->pst,rguSap->spId,staRspInfo);
+   RlcMacSendBOStatus(&rguSap->pst, rguSap->spId, boStatus);
 
    RETVOID;
 } 
 
    RETVOID;
 }