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