Added code for MAC-PHY interface, DU_APP, F1AP, SCTP and CU stub
[o-du/l2.git] / src / du_app / du_mgr_ex_ms.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
19 /* This file contains message handling functionality for DU cell management */
20
21 #include "du_mgr.h"
22
23 /**************************************************************************
24  * @brief Task Initiation callback function. 
25  *
26  * @details
27  *
28  *     Function : duActvInit 
29  *    
30  *     Functionality:
31  *             This function is supplied as one of parameters during DU APP's 
32  *             task registration. SSI will invoke this function once, after
33  *             it creates and attaches this TAPA Task to a system task.
34  *     
35  * @param[in]  Ent entity, the entity ID of this task.     
36  * @param[in]  Inst inst, the instance ID of this task.
37  * @param[in]  Region region, the region ID registered for memory 
38  *              usage of this task.
39  * @param[in]  Reason reason.
40  * @return ROK     - success
41  *         RFAILED - failure
42  ***************************************************************************/
43 S16 duActvInit(Ent entity, Inst inst, Region region, Reason reason)
44 {
45 //TODO: TBD
46
47    return ROK;
48
49 }
50
51 /**************************************************************************
52  * @brief Task Activation callback function. 
53  *
54  * @details
55  *
56  *      Function : duActvTsk 
57  * 
58  *      Functionality:
59  *           Primitives invoked by DU APP's users/providers through
60  *           a loosely coupled interface arrive here by means of 
61  *           SSI's message handling. This API is registered with
62  *           SSI during the Task Registration of DU APP.
63  *     
64  * @param[in]  Pst     *pst, Post structure of the primitive.     
65  * @param[in]  Buffer *mBuf, Packed primitive parameters in the
66  *  buffer.
67  * @return ROK     - success
68  *         RFAILED - failure
69  *
70  ***************************************************************************/
71 S16 duActvTsk(Pst *pst, Buffer *mBuf)
72 {
73    S16 ret = ROK;
74
75    switch(pst->srcEnt)
76    {
77       case ENTDUAPP:
78          {
79             switch(pst->event)
80             {
81                case EVTCFG:
82                   {
83                      duProcCfgComplete();
84                      SPutMsg(mBuf);
85                      break;
86                   }
87                default:
88                   {
89                      printf("\nInvalid event received at duActvTsk from ENTDUAPP");
90                      SPutMsg(mBuf);
91                      ret = RFAILED;
92                   }
93             }
94
95             break;
96          }
97       case ENTF1AP:
98          {
99
100             break;
101          }
102       case ENTRG: //TODO: Layer cfg for RLC UL, DL and MAC must be done
103          {
104             switch(pst->event)
105             {
106                //Config complete
107                case EVTCFG:
108                   {
109                      //TODO: Implement duEstablishSctpToCu();
110                      SPutMsg(mBuf);
111                      break;
112                   }
113                default:
114                   {
115                      printf("\nInvalid event received at duActvTsk from ENTRG");
116                      SPutMsg(mBuf);
117                      ret = RFAILED;
118                   }
119             }
120
121             break;
122          }
123       case ENTSCTP:
124          {
125             switch(pst->event)
126             {
127                case EVTSCTPUP:
128                   {
129                      //Setup F1-C
130                      SPutMsg(mBuf);
131                      break;
132                   }
133                default:
134                   {
135                      printf("\nInvalid event received at duActvTsk from ENTRG");
136                      SPutMsg(mBuf);
137                      ret = RFAILED;
138                   }
139
140             }
141          }
142       default:
143          {
144             printf("\n DU APP can not process message from Entity %d", pst->srcEnt);
145             SPutMsg(mBuf);
146             ret = RFAILED;
147          }
148
149    }
150
151    SExitTsk();
152    return ret;
153 }
154
155 /**************************************************************************
156  * @brief Function to invoke DU Layer Configs
157  *
158  * @details
159  *
160  *      Function : duProcCfgComplete 
161  * 
162  *      Functionality:
163  *           Initiates Configs towards layers of DU
164  *     
165  * @param[in]  void
166  * @return ROK     - success
167  *         RFAILED - failure
168  *
169  ***************************************************************************/
170 S16 duProcCfgComplete()
171 {
172 //TBD: invoke SCTP/layer config
173
174 //   duHdlRlcUlCfgEvent();
175
176    return ROK;
177 }
178
179 /**********************************************************************
180          End of file
181 **********************************************************************/