1718c386ac35060dc918cf8c43d1ae2ba0184c2e
[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 "rgu.h"
23 #include "rgu.x"
24 #include "du_app_mac_inf.h"
25 #include "mac_sch_interface.h"
26 #include "lwr_mac_upr_inf.h"
27 #include "mac.h"
28 #include "mac_upr_inf_api.h"
29 #include "mac_utils.h"
30
31 /*******************************************************************
32  *
33  * @brief Send stop indication to DU APP
34  *
35  * @details
36  *
37  *    Function : sendStopIndToDuApp
38  *
39  *    Functionality:
40  *       Send stop indication to DU APP
41  *
42  * @params[in] Pst info
43  * @return ROK     - success
44  *         RFAILED - failure
45  *
46  * ****************************************************************/
47 uint8_t sendStopIndToDuApp(uint16_t cellId)
48 {
49    Pst pst;
50    uint8_t ret = ROK;
51    MacCellStopInfo *cellStopInd;
52
53    /*  Allocate sharable memory */
54    MAC_ALLOC_SHRABL_BUF(cellStopInd, sizeof(MacCellStopInfo));
55    if(!cellStopInd)
56    {
57       DU_LOG("\nMAC : Stop Indication memory allocation failed");
58       return RFAILED;
59    }
60    cellStopInd->cellId = cellId;
61
62    /* Fill Pst */
63    FILL_PST_MAC_TO_DUAPP(pst, EVENT_MAC_STOP_IND);
64
65    ret = MacDuAppStopInd(&pst, cellStopInd);
66    if(ret != ROK)
67    {
68       DU_LOG("\nMAC: Failed to send stop indication to DU APP");
69       MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, cellStopInd, sizeof(MacCellStopInfo));
70    }
71    return ROK;
72 }
73
74 /*******************************************************************
75  * @brief process Stop indication to MAC
76  *
77  * @details
78  *
79  *     Function : fapiMacStopInd 
80  *      
81  *  @param[in]  Pst            *pst
82  *  @return 
83  *      -# ROK 
84  *      -# RFAILED 
85  ******************************************************************/
86 uint8_t fapiMacStopInd(Pst *pst, uint16_t cellId) 
87 {
88    uint8_t ret = ROK;
89    ret = sendStopIndToDuApp(cellId);
90    return ret;
91 }
92
93 /**********************************************************************
94   End of file
95  ***********************************************************************/