replaced cmMemSet, cmMemcpy with memset and memcpy resp AND Removed TRC() traces...
[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 #include "mac_sch_interface.h"
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 S16 schActvTsk
78 (
79 Pst     *pst,                       /* post structure       */
80 Buffer  *mBuf                       /* message buffer       */
81 )
82 #else
83 S16 schActvTsk(pst, mBuf)
84 Pst     *pst;                       /* post structure       */
85 Buffer  *mBuf;                      /* message buffer       */
86 #endif
87 {
88    switch(pst->srcEnt)
89    {
90       /* The originator of this message is the stack manager,
91        * unpack and go to the respective primitive processing function */
92       case ENTSM:
93          switch(pst->event)
94          {
95 #ifdef LCRGMILRG
96             case EVTMACSCHGENCFGREQ:
97                /* Process a config. request */
98                cmUnpkLrgSchCfgReq(SchProcGenCfgReq, pst, mBuf);
99                break;
100             case EVTLRGSCHCNTRLREQ:
101                /* Process a control request */
102                cmUnpkLrgSchCntrlReq(RgMiLrgSchCntrlReq, pst, mBuf);
103                break;
104             case EVTLRGSCHSTAIND:
105                /* Process a control request */
106                cmUnpkLrgSchStaInd(RgMiLrgSchStaInd, pst, mBuf);
107                break;
108 #ifdef LTE_L2_MEAS
109             case EVTLRGSCHL2MEASREQ:
110                /* Process L2 Measurement request */
111                cmUnpkLrgSchL2MeasReq(RgMiLrgSchL2MeasReq, pst, mBuf);
112                break;
113             case EVTLRGSCHL2MEASSTOPREQ:
114                /* Process L2 Measurement Stop request */
115                cmUnpkLrgSchL2MeasStopReq(RgMiLrgSchL2MeasStopReq, pst, mBuf);
116                break;
117             case EVTLRGSCHL2MEASSENDREQ:
118                /* Process L2 Measurement Send  request */
119                cmUnpkLrgSchL2MeasSendReq(RgMiLrgSchL2MeasSendReq, pst, mBuf);
120                break;
121 #endif
122 #endif /* LCRGMILRG */
123             default:
124                RGSCH_FREE_MSG(mBuf);
125                break;
126          }
127          break;
128      case ENTNX:
129          switch(pst->event)
130          {
131 #ifdef LCRGUIRGR
132             case EVTRGRBNDREQ:
133                cmUnpkRgrBndReq(RgUiRgrBndReq, pst, mBuf);
134                break;
135             case EVTRGRUBNDREQ:
136                cmUnpkRgrUbndReq(RgUiRgrUbndReq, pst, mBuf);
137                break;
138 #ifdef RGR_SI_SCH
139             case EVTRGRSICFGREQ:
140                cmUnpkRgrSiCfgReq(RgUiRgrSiCfgReq, pst, mBuf);
141                break;
142             case EVTRGRWARNINGSICFGREQ:
143                cmUnpkRgrWarningSiCfgReq(RgUiRgrWarningSiCfgReq, pst, mBuf);
144                break;
145
146             case EVTRGRWARNINGSISTOPREQ:
147                cmUnpkRgrWarningSiStopReq(RgUiRgrWarningSiStopReq, pst, mBuf);
148                break;
149 #endif/*RGR_SI_SCH */
150                /* LTE_ADV_FLAG_REMOVED_START */
151             case EVTRGRLOADINFREQ:
152                cmUnpkRgrLoadInfReq(RgUiRgrLoadInfReq, pst, mBuf);
153                break;
154                /* LTE_ADV_FLAG_REMOVED_END */
155 #endif            
156             default:
157                RGSCH_FREE_MSG(mBuf);
158                break;
159          }
160          break;
161       case ENTLWRMAC:
162          switch(pst->event)
163          {
164 /*#ifdef LCRGLITFU L2Split */
165 #if (defined(LCRGLITFU) || defined(LWLCRGLITFU)) 
166             case EVTTFUSCHBNDCFM:
167                cmUnpkTfuBndCfm(RgLiTfuSchBndCfm, pst, mBuf);
168                break;
169             case EVTTFURAREQIND:
170                cmUnpkTfuRaReqInd(RgLiTfuRaReqInd, pst, mBuf);
171                break;
172             case EVTTFUULCQIIND:
173                cmUnpkTfuUlCqiInd(RgLiTfuUlCqiInd, pst, mBuf);
174                break;
175             case EVTTFUHQIND:
176                cmUnpkTfuHqInd(RgLiTfuHqInd, pst, mBuf);
177                break;
178             case EVTTFUSRIND:
179                cmUnpkTfuSrInd(RgLiTfuSrInd, pst, mBuf);
180                break;
181             case EVTTFUDLCQIIND:
182                cmUnpkTfuDlCqiInd(RgLiTfuDlCqiInd, pst, mBuf);
183                break;
184             case EVTTFUCRCIND:
185                /*cmUnpkTfuCrcIndInfo(RgLiTfuCrcInd, pst, mBuf); */
186                cmUnpkTfuCrcInd(RgLiTfuCrcInd, pst, mBuf);
187                break;
188             case EVTTFUTIMINGADVIND:
189                cmUnpkTfuTimingAdvInd(RgLiTfuTimingAdvInd, pst, mBuf);
190                break;
191             case EVTTFUPUCCHDELPWR:
192                cmUnpkTfuPucchDeltaPwr(RgLiTfuPucchDeltaPwrInd, pst, mBuf);
193                break;
194             case EVTTFUDOAIND:
195                cmUnpkTfuDoaInd(RgLiTfuDoaInd, pst, mBuf);
196                break;
197 #ifdef TFU_UPGRADE
198             case EVTTFURAWCQIIND:
199                cmUnpkTfuRawCqiInd(RgLiTfuRawCqiInd, pst, mBuf);
200                break;
201             case EVTTFUSRSIND:
202                cmUnpkTfuSrsInd(RgLiTfuSrsInd, pst, mBuf);
203                break;
204 #endif 
205                /*LAA: Error Indication on SCell*/
206             case EVTTFUERRIND:
207                cmUnpkTfuErrInd(RgLiTfuErrInd, pst, mBuf);
208                break;
209 #endif            
210             default:
211                RGSCH_FREE_MSG(mBuf);
212                break;
213          }
214          break;
215       case ENTMAC: /* When MAC sends a msg to Scheduler instance */
216          switch(pst->event)
217          {
218 #ifdef LCSCH
219             case EVTINFDEDBOUPDTREQ:
220                cmUnpkMacSchDedBoUpdtReq(RgMacSchDedBoUpdtReq, pst, mBuf);
221                break;
222             case EVTINFCMNBOUPDTREQ:
223                cmUnpkMacSchCmnBoUpdtReq(RgMacSchCmnBoUpdtReq, pst, mBuf);
224                break;   
225             case EVTINFSFRECPIND:
226                cmUnpkMacSchSfRecpInd(RgMacSchSfRecpInd, pst, mBuf);
227                break;
228                /*Fix: start: Inform UE delete to scheduler*/
229             case EVTINFUEDELIND:
230                cmUnpkMacSchUeDelInd(RgMacSchUeDelInd, pst, mBuf);
231                break;
232             /*Fix: end: Inform UE delete to scheduler*/
233 #ifdef LTE_L2_MEAS
234             case EVTINFL2MEASCFM:
235                cmUnpkMacSchL2MeasCfm(RgMacSchL2MeasCfm, pst, mBuf);
236                break;
237             case EVTINFL2MEASSTOPCFM:
238                cmUnpkMacSchL2MeasCfm(RgMacSchL2MeasStopCfm, pst, mBuf);
239                break;
240 #endif
241 #endif            
242             case EVENT_SLOT_IND_TO_SCH:
243                unpackMacSchSlotInd(MacSchSlotInd, pst, mBuf);
244                break;
245             default:
246                RGSCH_FREE_MSG(mBuf);
247                break;
248          }
249          break;
250       case ENTRM: /* When RRM sends msg to scheduler */
251          switch(pst->event)
252          {
253             case EVTRGMBNDREQ:
254                cmUnpkRgmBndReq(RgUiRgmBndReq, pst, mBuf); 
255                break;
256             case EVTRGMUBNDREQ:
257                cmUnpkRgmUbndReq(RgUiRgmUbndReq, pst, mBuf); 
258                break;
259             case EVTRGMCFGPRBRPRT:
260                cmUnpkRgmCfgPrbRprt(RgUiRgmCfgPrbRprt, pst, mBuf);
261                break;
262             default:
263                RGSCH_FREE_MSG(mBuf);
264                break;
265          }
266          break;
267       default:
268           RGSCH_FREE_MSG(mBuf);
269           break;
270    }
271    ODU_EXIT_TASK();
272    return ROK;
273 }/* end of schActvTsk */
274
275 \f
276 /**********************************************************************
277  
278          End of file
279 **********************************************************************/