83d36242f5c7d3d19840881690bef87e51845ee8
[o-du/l2.git] / src / 5gnrsch / sch_msg_router.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:     NR-SCH layer
22   
23      Type:     C source file
24   
25      Desc:     C source code SSI Interface Implementation
26   
27      File:     sch_msg_router.c
28   
29 **********************************************************************/
30
31 /** @file sch_msg_router.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 S16 schActvTsk
77 (
78 Pst     *pst,                       /* post structure       */
79 Buffer  *mBuf                       /* message buffer       */
80 )
81 {
82    switch(pst->srcEnt)
83    {
84       /* The originator of this message is the stack manager,
85        * unpack and go to the respective primitive processing function */
86       case ENTSM:
87          switch(pst->event)
88          {
89 #ifdef LCRGMILRG
90             case EVTMACSCHGENCFGREQ:
91                /* Process a config. request */
92                cmUnpkLrgSchCfgReq(SchProcGenCfgReq, pst, mBuf);
93                break;
94             case EVTLRGSCHCNTRLREQ:
95                /* Process a control request */
96                cmUnpkLrgSchCntrlReq(RgMiLrgSchCntrlReq, pst, mBuf);
97                break;
98             case EVTLRGSCHSTAIND:
99                /* Process a control request */
100                cmUnpkLrgSchStaInd(RgMiLrgSchStaInd, pst, mBuf);
101                break;
102 #ifdef LTE_L2_MEAS
103             case EVTLRGSCHL2MEASREQ:
104                /* Process L2 Measurement request */
105                cmUnpkLrgSchL2MeasReq(RgMiLrgSchL2MeasReq, pst, mBuf);
106                break;
107             case EVTLRGSCHL2MEASSTOPREQ:
108                /* Process L2 Measurement Stop request */
109                cmUnpkLrgSchL2MeasStopReq(RgMiLrgSchL2MeasStopReq, pst, mBuf);
110                break;
111             case EVTLRGSCHL2MEASSENDREQ:
112                /* Process L2 Measurement Send  request */
113                cmUnpkLrgSchL2MeasSendReq(RgMiLrgSchL2MeasSendReq, pst, mBuf);
114                break;
115 #endif
116 #endif /* LCRGMILRG */
117             default:
118                RGSCH_FREE_MSG(mBuf);
119                break;
120          }
121          break;
122      case ENTNX:
123          switch(pst->event)
124          {
125 #ifdef LCRGUIRGR
126             case EVTRGRBNDREQ:
127                cmUnpkRgrBndReq(RgUiRgrBndReq, pst, mBuf);
128                break;
129             case EVTRGRUBNDREQ:
130                cmUnpkRgrUbndReq(RgUiRgrUbndReq, pst, mBuf);
131                break;
132 #ifdef RGR_SI_SCH
133             case EVTRGRSICFGREQ:
134                cmUnpkRgrSiCfgReq(RgUiRgrSiCfgReq, pst, mBuf);
135                break;
136             case EVTRGRWARNINGSICFGREQ:
137                cmUnpkRgrWarningSiCfgReq(RgUiRgrWarningSiCfgReq, pst, mBuf);
138                break;
139
140             case EVTRGRWARNINGSISTOPREQ:
141                cmUnpkRgrWarningSiStopReq(RgUiRgrWarningSiStopReq, pst, mBuf);
142                break;
143 #endif/*RGR_SI_SCH */
144                /* LTE_ADV_FLAG_REMOVED_START */
145             case EVTRGRLOADINFREQ:
146                cmUnpkRgrLoadInfReq(RgUiRgrLoadInfReq, pst, mBuf);
147                break;
148                /* LTE_ADV_FLAG_REMOVED_END */
149 #endif            
150             default:
151                RGSCH_FREE_MSG(mBuf);
152                break;
153          }
154          break;
155       case ENTMAC: /* When MAC sends a msg to Scheduler instance */
156          switch(pst->event)
157          {
158 #ifdef LCSCH
159             case EVTINFDEDBOUPDTREQ:
160                cmUnpkMacSchDedBoUpdtReq(RgMacSchDedBoUpdtReq, pst, mBuf);
161                break;
162             case EVTINFCMNBOUPDTREQ:
163                cmUnpkMacSchCmnBoUpdtReq(RgMacSchCmnBoUpdtReq, pst, mBuf);
164                break;   
165             case EVTINFSFRECPIND:
166                cmUnpkMacSchSfRecpInd(RgMacSchSfRecpInd, pst, mBuf);
167                break;
168                /*Fix: start: Inform UE delete to scheduler*/
169             case EVTINFUEDELIND:
170                cmUnpkMacSchUeDelInd(RgMacSchUeDelInd, pst, mBuf);
171                break;
172             /*Fix: end: Inform UE delete to scheduler*/
173 #ifdef LTE_L2_MEAS
174             case EVTINFL2MEASCFM:
175                cmUnpkMacSchL2MeasCfm(RgMacSchL2MeasCfm, pst, mBuf);
176                break;
177             case EVTINFL2MEASSTOPCFM:
178                cmUnpkMacSchL2MeasCfm(RgMacSchL2MeasStopCfm, pst, mBuf);
179                break;
180 #endif
181 #endif            
182             case EVENT_SLOT_IND_TO_SCH:
183                unpackMacSchSlotInd(MacSchSlotInd, pst, mBuf);
184                break;
185             default:
186                RGSCH_FREE_MSG(mBuf);
187                break;
188          }
189          break;
190       case ENTRM: /* When RRM sends msg to scheduler */
191          switch(pst->event)
192          {
193             case EVTRGMBNDREQ:
194                cmUnpkRgmBndReq(RgUiRgmBndReq, pst, mBuf); 
195                break;
196             case EVTRGMUBNDREQ:
197                cmUnpkRgmUbndReq(RgUiRgmUbndReq, pst, mBuf); 
198                break;
199             case EVTRGMCFGPRBRPRT:
200                cmUnpkRgmCfgPrbRprt(RgUiRgmCfgPrbRprt, pst, mBuf);
201                break;
202             default:
203                RGSCH_FREE_MSG(mBuf);
204                break;
205          }
206          break;
207       default:
208           RGSCH_FREE_MSG(mBuf);
209           break;
210    }
211    ODU_EXIT_TASK();
212    return ROK;
213 }/* end of schActvTsk */
214
215 \f
216 /**********************************************************************
217  
218          End of file
219 **********************************************************************/