MAC Clean-up [Issue-ID: ODUHIGH-212]
[o-du/l2.git] / src / 5gnrmac / mac_stop_ind.c
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
5 #   Licensed under the Apache License, Version 2.0 (the "License");            #
6 #   you may not use this file except in compliance with the License.           #
7 #   You may obtain a copy of the License at                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
11 #   Unless required by applicable law or agreed to in writing, software        #
12 #   distributed under the License is distributed on an "AS IS" BASIS,          #
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
14 #   See the License for the specific language governing permissions and        #
15 #   limitations under the License.                                             #
16 ################################################################################
17  *******************************************************************************/
18 /* header include files (.h) */
19 #include "common_def.h"
20 #include "lrg.h"
21 #include "lrg.x"
22 #include "du_app_mac_inf.h"
23 #include "mac_sch_interface.h"
24 #include "lwr_mac_upr_inf.h"
25 #include "mac.h"
26 #include "mac_upr_inf_api.h"
27 #include "mac_utils.h"
28
29 /*******************************************************************
30  *
31  * @brief Send stop indication to DU APP
32  *
33  * @details
34  *
35  *    Function : sendStopIndToDuApp
36  *
37  *    Functionality:
38  *       Send stop indication to DU APP
39  *
40  * @params[in] Pst info
41  * @return ROK     - success
42  *         RFAILED - failure
43  *
44  * ****************************************************************/
45 uint8_t sendStopIndToDuApp(uint16_t cellId)
46 {
47    Pst pst;
48    uint8_t ret = ROK;
49    MacCellStopInfo *cellStopInd;
50
51    /*  Allocate sharable memory */
52    MAC_ALLOC_SHRABL_BUF(cellStopInd, sizeof(MacCellStopInfo));
53    if(!cellStopInd)
54    {
55       DU_LOG("\nMAC : Stop Indication memory allocation failed");
56       return RFAILED;
57    }
58    cellStopInd->cellId = cellId;
59
60    /* Fill Pst */
61    FILL_PST_MAC_TO_DUAPP(pst, EVENT_MAC_STOP_IND);
62
63    ret = MacDuAppStopInd(&pst, cellStopInd);
64    if(ret != ROK)
65    {
66       DU_LOG("\nMAC: Failed to send stop indication to DU APP");
67       MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, cellStopInd, sizeof(MacCellStopInfo));
68    }
69    return ROK;
70 }
71
72 /*******************************************************************
73  * @brief process Stop indication to MAC
74  *
75  * @details
76  *
77  *     Function : fapiMacStopInd 
78  *      
79  *  @param[in]  Pst            *pst
80  *  @return 
81  *      -# ROK 
82  *      -# RFAILED 
83  ******************************************************************/
84 uint8_t fapiMacStopInd(Pst *pst, uint16_t cellId) 
85 {
86    uint8_t ret = ROK;
87    ret = sendStopIndToDuApp(cellId);
88    return ret;
89 }
90
91 /**********************************************************************
92   End of file
93  ***********************************************************************/