Stop Req and Stop Ind code changes
[o-du/l2.git] / src / 5gnrmac / lwr_mac_fsm.c
index 29d458a..4b722e5 100644 (file)
@@ -2138,11 +2138,40 @@ S16 lwr_mac_handleStartReqEvt(void *msg)
    return ROK;
 } /* lwr_mac_handleStartReqEvt */
 
+ /*******************************************************************
+  *
+  * @brief Sends FAPI Stop Req to PHY
+  *
+  * @details
+  *
+  *    Function : lwr_mac_handleStopReqEvt
+  *
+  *    Functionality:
+  *         -Sends FAPI Stop Req to PHY
+  *
+  * @params[in]
+  * @return ROK     - success
+  *         RFAILED - failure
+  *
+  ********************************************************************/
+
 S16 lwr_mac_handleStopReqEvt(void *msg)
 {
 #ifdef FAPI
-   /* stop TX and RX operation return PHy to configured State
-      send stop.indication to l2/l3 */
+   uint32_t msgLen = 0;
+   fapi_stop_req_t *stopReq = NULLP;
+   LWR_MAC_ALLOC(stopReq, sizeof(fapi_stop_req_t));
+   if(stopReq != NULLP)
+   {
+      fillMsgHeader(&stopReq->header, FAPI_STOP_REQUEST, msgLen);
+      DU_LOG("\nLOWER MAC: Sending Stop Request to PHY");
+      LwrMacSendToPhy(stopReq->header.message_type_id, sizeof(fapi_stop_req_t), (void *)stopReq);
+   }
+   else
+   {
+      DU_LOG("\nLOWER MAC: Failed to allocate memory for Stop Request");
+      return RFAILED;
+   }
 #endif
    return ROK;
 }
@@ -3287,6 +3316,7 @@ lwrMacFsmHdlr fapiEvtHdlr[MAX_STATE][MAX_EVENT] =
        lwr_mac_handleConfigReqEvt,
        lwr_mac_handleConfigRspEvt,
        lwr_mac_handleInvalidEvt,
+       lwr_mac_handleInvalidEvt,
    },
    {
        /* PHY_STATE_CONFIGURED */
@@ -3295,6 +3325,7 @@ lwrMacFsmHdlr fapiEvtHdlr[MAX_STATE][MAX_EVENT] =
        lwr_mac_handleConfigReqEvt,
        lwr_mac_handleConfigRspEvt,
        lwr_mac_handleStartReqEvt,
+       lwr_mac_handleInvalidEvt,
    },
    {
        /* PHY_STATE_RUNNING */
@@ -3303,6 +3334,7 @@ lwrMacFsmHdlr fapiEvtHdlr[MAX_STATE][MAX_EVENT] =
        lwr_mac_handleConfigReqEvt,
        lwr_mac_handleConfigRspEvt,
        lwr_mac_handleInvalidEvt,
+       lwr_mac_handleStopReqEvt,
    }
 };