Using TAPA Task to generated PHY Stub's slot indication [Issue-Id: ODUHIGH-348]
[o-du/l2.git] / src / 5gnrmac / lwr_mac_ex_ms.c
index 052e450..fd7dedf 100644 (file)
 /* This file is the entry point for Lower MAC */\r
 \r
 #include "common_def.h"\r
+#include "mac_utils.h"\r
 #include "lwr_mac_fsm.h"\r
 #include "lwr_mac_phy.h"\r
+#ifdef INTEL_FAPI\r
+#include "fapi.h"\r
+#include "fapi_vendor_extension.h"\r
+#endif\r
+#ifndef INTEL_WLS_MEM\r
+#include "lwr_mac_phy_stub_inf.h"\r
+#endif\r
 \r
 /**************************************************************************\r
  * @brief Task Initiation callback function. \r
@@ -74,38 +82,75 @@ uint8_t lwrMacActvTsk(Pst *pst, Buffer *mBuf)
    switch(pst->srcEnt)\r
    {\r
       case ENTLWRMAC:\r
-        {\r
-           switch(pst->event)\r
-           {\r
+         {\r
+            switch(pst->event)\r
+            {\r
 #ifdef INTEL_WLS_MEM\r
-              case EVT_START_WLS_RCVR:\r
-                 {\r
-                    ODU_PUT_MSG_BUF(mBuf);\r
+               case EVT_START_WLS_RCVR:\r
+                  {\r
+                     ODU_PUT_MSG_BUF(mBuf);\r
 \r
-                    /* Allocate memory for intial UL transmission */\r
-                    LwrMacEnqueueWlsBlock();\r
+                     /* Allocate memory for intial UL transmission */\r
+                     LwrMacEnqueueWlsBlock();\r
 \r
-                    /* Start thread to receive from L1 */\r
-                    DU_LOG("\nINFO  -->  LWR MAC: Starting WLS receiver thread");\r
-                    LwrMacRecvPhyMsg();\r
-                    break;\r
-                 }\r
+                     /* Start thread to receive from L1 */\r
+                     DU_LOG("\nINFO  -->  LWR MAC: Starting WLS receiver thread");\r
+                     LwrMacRecvPhyMsg();\r
+                     break;\r
+                  }\r
 #endif\r
-              default:\r
-                 {\r
-                    SPutMsg(mBuf);\r
-                    DU_LOG("\nERROR  -->  LWR MAC: Invalid event %d received", pst->event);\r
-                    ret = RFAILED;\r
-                 }\r
-           }\r
-           break;\r
-        }\r
+               default:\r
+                  {\r
+                     SPutMsg(mBuf);\r
+                     DU_LOG("\nERROR  -->  LWR MAC: Invalid event %d received", pst->event);\r
+                     ret = RFAILED;\r
+                  }\r
+            }\r
+            break;\r
+         }\r
+\r
+#ifndef INTEL_WLS_MEM\r
+      case ENTPHYSTUB:\r
+         {\r
+            switch(pst->event)\r
+            {\r
+               case EVT_PHY_STUB_SLOT_IND:\r
+                  {\r
+                     fapi_slot_ind_t *slotIndMsg;\r
+\r
+                     CMCHKUNPK(oduUnpackPointer, (PTR *)&slotIndMsg, mBuf);\r
+                     ODU_PUT_MSG_BUF(mBuf);\r
+\r
+                     procPhyMessages(slotIndMsg->header.msg_id, sizeof(fapi_slot_ind_t), (void*)slotIndMsg);\r
+                     MAC_FREE_SHRABL_BUF(pst->region, pst->pool, slotIndMsg, sizeof(fapi_slot_ind_t));\r
+                     break;\r
+                  }\r
+\r
+               case EVT_PHY_STUB_STOP_IND:\r
+                 {\r
+                    fapi_stop_ind_t *stopIndMsg;\r
+                    CMCHKUNPK(oduUnpackPointer, (PTR *)&stopIndMsg, mBuf);\r
+                    ODU_PUT_MSG_BUF(mBuf);\r
+\r
+                    procPhyMessages(stopIndMsg->header.msg_id, sizeof(fapi_stop_ind_t), (void*)stopIndMsg);\r
+                    MAC_FREE_SHRABL_BUF(pst->region, pst->pool, stopIndMsg, sizeof(fapi_stop_ind_t));\r
+                    break;\r
+                 }\r
+               default:\r
+                  {\r
+                     DU_LOG("\nERROR  -->  LWR_MAC: Invalid event %d received from PHY STUB", pst->event);\r
+                  }\r
+            }\r
+            break;\r
+         }\r
+#endif\r
+\r
       default:\r
-        {\r
-           SPutMsg(mBuf);\r
-           DU_LOG("\nERROR  -->  LWR MAC: Message from invalid source entity %d", pst->srcEnt);\r
-           ret = RFAILED;\r
-        }\r
+         {\r
+            SPutMsg(mBuf);\r
+            DU_LOG("\nERROR  -->  LWR MAC: Message from invalid source entity %d", pst->srcEnt);\r
+            ret = RFAILED;\r
+         }\r
    }\r
    return ret;\r
 }\r