Mux Code Changes
[o-du/l2.git] / src / 5gnrmac / rg_tom.c
index dd3b1e0..f4cd5d9 100755 (executable)
@@ -36,17 +36,8 @@ static int RLOG_MODULE_ID=4096;
 invoked by PHY towards MAC
 */
 /* 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 services */
-#include "cm5.h"           /* common timers defines */
-#include "cm_hash.h"       /* common hash list defines */
-#include "cm_llist.h"      /* common linked list defines */
-#include "cm_mblk.h"       /* memory management */
-#include "cm_tkns.h"       /* common tokens */
-#include "cm_lte.h"       /* common tokens */
+#include "common_def.h"
+#include "du_app_mac_inf.h"
 #include "rgu.h"           /* RGU defines */
 #include "tfu.h"           /* RGU defines */
 #include "lrg.h"           /* layer management defines for LTE-MAC */
@@ -55,34 +46,27 @@ invoked by PHY towards MAC
 #include "rg.h"            /* defines and macros for MAC */
 #include "rg_env.h"            /* defines and macros for MAC */
 #include "rg_err.h"            /* defines and macros for MAC */
-
+#include "rgm.h"           /* layer management typedefs for MAC */
 
 /* header/extern include files (.x) */
-#include "gen.x"           /* general layer typedefs */
-#include "ssi.x"           /* system services typedefs */
-#include "cm5.x"           /* common timers */
-#include "cm_hash.x"       /* common hash list */
-#include "cm_lib.x"        /* common library */
-#include "cm_llist.x"      /* common linked list */
-#include "cm_mblk.x"       /* memory management */
-#include "cm_tkns.x"       /* common tokens */
-#include "cm_lte.x"       /* common tokens */
+#include "crg.x"           /* CRG interface typedefs */
 #include "rgu.x"           /* RGU types */
 #include "tfu.x"           /* RGU types */
 #include "lrg.x"           /* layer management typedefs for MAC */
-#include "crg.x"           /* CRG interface typedefs */
 #include "rg_sch_inf.x"    /* SCH interface typedefs */
 #include "rg_prg.x"        /* PRG interface typedefs */
 #include "rgm.x"           /* layer management typedefs for MAC */
-#include "rgm.h"           /* layer management typedefs for MAC */
-#include "du_app_mac_inf.h"
 #include "rg.x"            /* typedefs for MAC */
-
+#include "mac.h"
+#include "lwr_mac_fsm.h"
 #ifdef MAC_RLC_UL_RBUF
 #include "ss_rbuf.h"
 #include "ss_rbuf.x"
 #endif
 
+uint16_t handleDlTtiReq(SlotIndInfo currTimingInfo);
+uint16_t handleUlTtiReq(SlotIndInfo currTimingInfo);
+
 /* ADD Changes for Downlink UE Timing Optimization */
 #ifndef LTEMAC_DLUE_TMGOPTMZ 
 PRIVATE S16 rgTOMUtlProcDlSf ARGS(( RgDlSf *dlSf, RgCellCb   *cellCb,
@@ -611,6 +595,25 @@ SlotIndInfo slotInd
       }
    }
 #endif
+
+   /* Mux Pdu for Msg4 */
+   SlotIndInfo muxTimingInfo;
+   memset(&muxTimingInfo, 0, sizeof(SlotIndInfo));
+   MacDlSlot *currDlSlot = NULLP;
+   ADD_DELTA_TO_TIME(slotInd, muxTimingInfo, PHY_DELTA);
+   currDlSlot = &macCb.macCell->dlSlot[muxTimingInfo.slot];
+   if(currDlSlot->dlInfo.msg4Alloc)
+       {
+      BuildAndSendMsg4MuxPdu(currDlSlot->dlInfo.msg4Alloc);
+               currDlSlot = NULLP;
+   }
+   
+   /* Trigger for DL TTI REQ */
+   handleDlTtiReq(slotInd);
+
+   /* Trigger for UL TTI REQ */
+   handleUlTtiReq(slotInd);
+
    dlSf = &cellCb->subFrms[(slotInd.slot % RG_NUM_SUB_FRAMES)];
 
    if((dlSf->txDone == TRUE) ||
@@ -1504,8 +1507,8 @@ Inst             inst;
 #ifdef LTEMAC_SPS
    Bool              isSpsRnti=FALSE;
    Pst               schPst1;  
-   RgInfSpsRelInfo   relInfo;
-   Bool              spsToBeActvtd = FALSE;
+  // RgInfSpsRelInfo   relInfo;
+       Bool              spsToBeActvtd = FALSE;
    U16               sduSize = 0;
 #endif
    U32               lcgBytes[RGINF_MAX_LCG_PER_UE];
@@ -1657,10 +1660,12 @@ Inst             inst;
 
                      ueCb->ul.implRelCntr = 0;
                      ueCb->ul.explRelCntr = 0;
-                     relInfo.cellSapId = cellCb->schInstMap.cellSapId;
+#if 0                     
+                                                       relInfo.cellSapId = cellCb->schInstMap.cellSapId;
                      relInfo.cRnti = ueCb->ueId;
-                     relInfo.isExplRel = FALSE;
+                                                       relInfo.isExplRel= FALSE;
                      //TODO: commented for compilation without SCH RgMacSchSpsRel(&schPst1, &relInfo);
+#endif  
                   }
                }
                else