Moving all common header file into common_def.h file
[o-du/l2.git] / src / 5gnrsch / rg_sch_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 /************************************************************************
20  
21      Name:     LTE-MAC layer
22   
23      Type:     C source file
24   
25      Desc:     C source code SSI Interface Implementation
26   
27      File:     rg_sch_ex_ms.c 
28   
29 **********************************************************************/
30
31 /** @file rg_ex_ms.c
32 @brief This file contains the implementation of callback functions 
33 registered with SSI during the LTE MAC Task initialization.
34 */
35 /* header include files -- defines (.h) */
36 #include "common_def.h"
37 #include "tfu.h"           /* RGU defines */
38 #include "lrg.h"           /* layer management defines for LTE-MAC */
39 #include "rgr.h"           /* layer management defines for LTE-MAC */
40 #include "rgm.h"           /* layer management defines for LTE-MAC */
41 #include "rg_env.h"        /* customisable defines and macros for LTE-MAC */
42 #include "rg_sch_err.h"        /* defines and macros for Scheduler */
43 #include "rg_sch_inf.h"        /* defines and macros for Scheduler */
44 #include "rg_sch.h"        /* defines and macros for Scheduler */
45
46
47 /* header/extern include files (.x) */
48 #include "tfu.x"           /* RGU types */
49 #include "lrg.x"           /* layer management typedefs for MAC */
50 #include "rgr.x"           /* layer management typedefs for MAC */
51 #include "rgm.x"           /* layer management typedefs for MAC */
52 #include "rg_sch_inf.x"        /* typedefs for Scheduler */
53 #include "rg_sch.x"        /* typedefs for Scheduler */
54
55
56
57 \f
58 /**
59  * @brief Task Activation callback function. 
60  *
61  * @details
62  *
63  *     Function : schActvTsk
64  *     
65  *     Primitives invoked by MAC's users/providers through
66  *     a loosely coupled interface arrive here by means of 
67  *     SSI's message handling. This API is registered with
68  *     SSI during the Task Registration of MAC.
69  *     
70  *  @param[in]  Pst     *pst, post structure of the Primitive.     
71  *  @param[in]  Buffer *mBuf, Packed primitive parameters in the buffer.
72  *  @param[in]  Reason reason.
73  *  @return  S16
74  *      -# ROK
75  **/
76 #ifdef ANSI
77 PUBLIC S16 schActvTsk
78 (
79 Pst     *pst,                       /* post structure       */
80 Buffer  *mBuf                       /* message buffer       */
81 )
82 #else
83 PUBLIC S16 schActvTsk(pst, mBuf)
84 Pst     *pst;                       /* post structure       */
85 Buffer  *mBuf;                      /* message buffer       */
86 #endif
87 {
88    TRC2(schActvTsk)
89
90    switch(pst->srcEnt)
91    {
92       /* The originator of this message is the stack manager,
93        * unpack and go to the respective primitive processing function */
94       case ENTSM:
95          switch(pst->event)
96          {
97 #ifdef LCRGMILRG
98             case EVTMACSCHGENCFGREQ:
99                /* Process a config. request */
100                cmUnpkLrgSchCfgReq(HandleSchGenCfgReq, pst, mBuf);
101                break;
102             case EVTLRGSCHCNTRLREQ:
103                /* Process a control request */
104                cmUnpkLrgSchCntrlReq(RgMiLrgSchCntrlReq, pst, mBuf);
105                break;
106             case EVTLRGSCHSTAIND:
107                /* Process a control request */
108                cmUnpkLrgSchStaInd(RgMiLrgSchStaInd, pst, mBuf);
109                break;
110 #ifdef LTE_L2_MEAS
111             case EVTLRGSCHL2MEASREQ:
112                /* Process L2 Measurement request */
113                cmUnpkLrgSchL2MeasReq(RgMiLrgSchL2MeasReq, pst, mBuf);
114                break;
115             case EVTLRGSCHL2MEASSTOPREQ:
116                /* Process L2 Measurement Stop request */
117                cmUnpkLrgSchL2MeasStopReq(RgMiLrgSchL2MeasStopReq, pst, mBuf);
118                break;
119             case EVTLRGSCHL2MEASSENDREQ:
120                /* Process L2 Measurement Send  request */
121                cmUnpkLrgSchL2MeasSendReq(RgMiLrgSchL2MeasSendReq, pst, mBuf);
122                break;
123 #endif
124 #endif /* LCRGMILRG */
125             default:
126                RGSCH_FREE_MSG(mBuf);
127                break;
128          }
129          break;
130      case ENTNX:
131          switch(pst->event)
132          {
133 #ifdef LCRGUIRGR
134             case EVTRGRBNDREQ:
135                cmUnpkRgrBndReq(RgUiRgrBndReq, pst, mBuf);
136                break;
137             case EVTRGRUBNDREQ:
138                cmUnpkRgrUbndReq(RgUiRgrUbndReq, pst, mBuf);
139                break;
140 #ifdef RGR_SI_SCH
141             case EVTRGRSICFGREQ:
142                cmUnpkRgrSiCfgReq(RgUiRgrSiCfgReq, pst, mBuf);
143                break;
144             case EVTRGRWARNINGSICFGREQ:
145                cmUnpkRgrWarningSiCfgReq(RgUiRgrWarningSiCfgReq, pst, mBuf);
146                break;
147
148             case EVTRGRWARNINGSISTOPREQ:
149                cmUnpkRgrWarningSiStopReq(RgUiRgrWarningSiStopReq, pst, mBuf);
150                break;
151 #endif/*RGR_SI_SCH */
152                /* LTE_ADV_FLAG_REMOVED_START */
153             case EVTRGRLOADINFREQ:
154                cmUnpkRgrLoadInfReq(RgUiRgrLoadInfReq, pst, mBuf);
155                break;
156                /* LTE_ADV_FLAG_REMOVED_END */
157 #endif            
158             default:
159                RGSCH_FREE_MSG(mBuf);
160                break;
161          }
162          break;
163       case ENTTF:
164          switch(pst->event)
165          {
166 /*#ifdef LCRGLITFU L2Split */
167 #if (defined(LCRGLITFU) || defined(LWLCRGLITFU)) 
168             case EVTTFUSCHBNDCFM:
169                cmUnpkTfuBndCfm(RgLiTfuSchBndCfm, pst, mBuf);
170                break;
171             case EVTTFURAREQIND:
172                cmUnpkTfuRaReqInd(RgLiTfuRaReqInd, pst, mBuf);
173                break;
174             case EVTTFUULCQIIND:
175                cmUnpkTfuUlCqiInd(RgLiTfuUlCqiInd, pst, mBuf);
176                break;
177             case EVTTFUHQIND:
178                cmUnpkTfuHqInd(RgLiTfuHqInd, pst, mBuf);
179                break;
180             case EVTTFUSRIND:
181                cmUnpkTfuSrInd(RgLiTfuSrInd, pst, mBuf);
182                break;
183             case EVTTFUDLCQIIND:
184                cmUnpkTfuDlCqiInd(RgLiTfuDlCqiInd, pst, mBuf);
185                break;
186             case EVTTFUCRCIND:
187                /*cmUnpkTfuCrcIndInfo(RgLiTfuCrcInd, pst, mBuf); */
188                cmUnpkTfuCrcInd(RgLiTfuCrcInd, pst, mBuf);
189                break;
190             case EVTTFUTIMINGADVIND:
191                cmUnpkTfuTimingAdvInd(RgLiTfuTimingAdvInd, pst, mBuf);
192                break;
193             case EVTTFUPUCCHDELPWR:
194                cmUnpkTfuPucchDeltaPwr(RgLiTfuPucchDeltaPwrInd, pst, mBuf);
195                break;
196             case EVTTFUDOAIND:
197                cmUnpkTfuDoaInd(RgLiTfuDoaInd, pst, mBuf);
198                break;
199 #ifdef TFU_UPGRADE
200             case EVTTFURAWCQIIND:
201                cmUnpkTfuRawCqiInd(RgLiTfuRawCqiInd, pst, mBuf);
202                break;
203             case EVTTFUSRSIND:
204                cmUnpkTfuSrsInd(RgLiTfuSrsInd, pst, mBuf);
205                break;
206 #endif 
207                /*LAA: Error Indication on SCell*/
208             case EVTTFUERRIND:
209                cmUnpkTfuErrInd(RgLiTfuErrInd, pst, mBuf);
210                break;
211 #endif            
212             default:
213                RGSCH_FREE_MSG(mBuf);
214                break;
215          }
216          break;
217       case ENTRG: /* When MAC sends a msg to Scheduler instance */
218          switch(pst->event)
219          {
220 #ifdef LCSCH
221             case EVTINFDEDBOUPDTREQ:
222                cmUnpkMacSchDedBoUpdtReq(RgMacSchDedBoUpdtReq, pst, mBuf);
223                break;
224             case EVTINFCMNBOUPDTREQ:
225                cmUnpkMacSchCmnBoUpdtReq(RgMacSchCmnBoUpdtReq, pst, mBuf);
226                break;   
227             case EVTINFSFRECPIND:
228                cmUnpkMacSchSfRecpInd(RgMacSchSfRecpInd, pst, mBuf);
229                break;
230                /*Fix: start: Inform UE delete to scheduler*/
231             case EVTINFUEDELIND:
232                cmUnpkMacSchUeDelInd(RgMacSchUeDelInd, pst, mBuf);
233                break;
234             /*Fix: end: Inform UE delete to scheduler*/
235 #ifdef LTE_L2_MEAS
236             case EVTINFL2MEASCFM:
237                cmUnpkMacSchL2MeasCfm(RgMacSchL2MeasCfm, pst, mBuf);
238                break;
239             case EVTINFL2MEASSTOPCFM:
240                cmUnpkMacSchL2MeasCfm(RgMacSchL2MeasStopCfm, pst, mBuf);
241                break;
242 #endif
243 #endif            
244             case EVENT_SLOT_IND_TO_SCH:
245                cmUnpackMacSchSlotInd(macSchSlotInd, pst, mBuf);
246                break;
247             default:
248                RGSCH_FREE_MSG(mBuf);
249                break;
250          }
251          break;
252       case ENTRM: /* When RRM sends msg to scheduler */
253          switch(pst->event)
254          {
255             case EVTRGMBNDREQ:
256                cmUnpkRgmBndReq(RgUiRgmBndReq, pst, mBuf); 
257                break;
258             case EVTRGMUBNDREQ:
259                cmUnpkRgmUbndReq(RgUiRgmUbndReq, pst, mBuf); 
260                break;
261             case EVTRGMCFGPRBRPRT:
262                cmUnpkRgmCfgPrbRprt(RgUiRgmCfgPrbRprt, pst, mBuf);
263                break;
264             default:
265                RGSCH_FREE_MSG(mBuf);
266                break;
267          }
268          break;
269       default:
270           RGSCH_FREE_MSG(mBuf);
271           break;
272    }
273    SExitTsk();
274    RETVALUE(ROK);
275 }/* end of schActvTsk */
276
277 \f
278 /**********************************************************************
279  
280          End of file
281 **********************************************************************/