[EPIC-ID: ODUHIGH-488][TASK-ID: ODUHIGH-494]SCH framework update to support different...
[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 #include "common_def.h"
32 #include "lrg.h"
33 #include "tfu.h"
34 #include "du_log.h"
35 #include "rgr.h"
36 #include "rg_sch_inf.h"
37 #include "rg_sch.h"
38 #include "mac_sch_interface.h"
39
40 #include "tfu.x"           /* TFU types */
41 #include "lrg.x"           /* layer management typedefs for MAC */
42 #include "rgr.x"           /* layer management typedefs for MAC */
43 #include "rg_sch_inf.x"         /* typedefs for Scheduler */
44 #include "sch.h"
45
46 #ifdef CALL_FLOW_DEBUG_LOG
47 /**
48 * @brief Function prints src, dest, msg infor about all the msgs that received.
49 *
50 * @details
51 *
52 *     Function : callFlowSchMsgRouter 
53 *
54 *     Function prints src, dest, msg infor about all the msgs that received
55 *
56 *  @param[in]  Pst     *pst, Post structure of the primitive.
57 *
58 *  @return  void
59 **/
60
61 void callFlowSchMsgRouter(Pst *pst)
62 {
63    char sourceTask[50];
64    char destTask[50]="ENTSCH";
65    char message[100];
66
67    strcpy(sourceTask,"ENTMAC");
68    switch(pst->event)
69    {
70       case EVENT_SCH_GEN_CFG:
71          {
72             strcpy(message,"EVENT_SCH_GEN_CFG");
73             break;
74          }   
75       case EVENT_SLICE_CFG_REQ_TO_SCH:
76          {      
77             strcpy(message,"EVENT_SLICE_CFG_REQ_TO_SCH");
78             break;
79          }      
80       case EVENT_SLICE_RECFG_REQ_TO_SCH:
81          {      
82             strcpy(message,"EVENT_SLICE_RECFG_REQ_TO_SCH");
83             break;
84          }   
85       case EVENT_SCH_CELL_CFG:
86          {
87             strcpy(message,"EVENT_SCH_CELL_CFG");
88             break;
89          }   
90       case EVENT_SLOT_IND_TO_SCH:
91          {
92             strcpy(message,"EVENT_SLOT_IND_TO_SCH");
93             break;
94          }   
95       case EVENT_ADD_UE_CONFIG_REQ_TO_SCH:
96          {   
97             strcpy(message,"EVENT_ADD_UE_CONFIG_REQ_TO_SCH");
98             break;
99          }   
100       case EVENT_MODIFY_UE_CONFIG_REQ_TO_SCH:
101          {   
102             strcpy(message,"EVENT_MODIFY_UE_CONFIG_REQ_TO_SCH");
103             break;
104          }
105       case EVENT_RACH_IND_TO_SCH:
106          {
107             strcpy(message,"EVENT_RACH_IND_TO_SCH");
108             break;
109          }
110       case EVENT_CRC_IND_TO_SCH:
111          {
112             strcpy(message,"EVENT_CRC_IND_TO_SCH");
113             break;
114          }
115       case EVENT_DL_RLC_BO_INFO_TO_SCH:
116          {
117             strcpy(message,"EVENT_DL_RLC_BO_INFO_TO_SCH");
118             break;
119          }
120       case EVENT_SHORT_BSR:
121          {
122             strcpy(message,"EVENT_SHORT_BSR");
123             break;
124          }
125       case EVENT_LONG_BSR:
126          {
127             strcpy(message,"EVENT_LONG_BSR");
128             break;
129          }
130       case EVENT_UCI_IND_TO_SCH:
131          {
132             strcpy(message,"EVENT_UCI_IND_TO_SCH");
133             break;
134          }
135       case EVENT_UE_DELETE_REQ_TO_SCH:
136          {
137             strcpy(message,"EVENT_UE_DELETE_REQ_TO_SCH");
138             break;
139          }
140       case EVENT_CELL_DELETE_REQ_TO_SCH:
141          {
142             strcpy(message,"EVENT_CELL_DELETE_REQ_TO_SCH");
143             break;
144          }
145       case EVENT_RACH_RESOURCE_REQUEST_TO_SCH:
146          {
147             strcpy(message,"EVENT_RACH_RESOURCE_REQUEST_TO_SCH");
148             break;
149          }
150       case EVENT_RACH_RESOURCE_RELEASE_TO_SCH:
151          {
152             strcpy(message,"EVENT_RACH_RESOURCE_RELEASE_TO_SCH");
153             break;
154          }
155       case EVENT_PAGING_IND_TO_SCH:
156          {
157             strcpy(message,"EVENT_PAGING_IND_TO_SCH");
158             break;
159          }
160       case EVENT_DL_HARQ_IND_TO_SCH:
161          {
162             strcpy(message,"EVENT_DL_HARQ_IND_TO_SCH");
163             break;
164          }
165       default:
166          strcpy(message,"Invalid Event");
167          break;
168    }
169    DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);
170 }
171 #endif
172
173 uint8_t SchMessageRouter(Pst *pst, void *msg)
174 {
175 #ifdef CALL_FLOW_DEBUG_LOG
176    callFlowSchMsgRouter(pst);
177 #endif
178
179    switch(pst->event)
180    {
181       case EVENT_SCH_GEN_CFG:
182          {
183             SchProcGenCfgReq(pst, (RgMngmt *)msg);
184          break;
185       }
186       case EVENT_SLICE_CFG_REQ_TO_SCH:
187       {    
188          SchProcSliceCfgReq(pst, (SchSliceCfgReq *)msg);
189          break;
190       }    
191       case EVENT_SLICE_RECFG_REQ_TO_SCH:
192       {    
193          SchProcSliceRecfgReq(pst, (SchSliceRecfgReq *)msg);
194          break;
195       }
196       case EVENT_SCH_CELL_CFG:
197       {
198          SchProcCellCfgReq(pst, (SchCellCfg *)msg);
199          break;
200       }
201       case EVENT_SLOT_IND_TO_SCH:
202       {
203          SchProcSlotInd(pst, (SlotTimingInfo *)msg);
204          break;
205       }
206       case EVENT_ADD_UE_CONFIG_REQ_TO_SCH:
207       {
208          SchAddUeConfigReq(pst, (SchUeCfgReq *)msg);
209          break;
210       }
211       case EVENT_MODIFY_UE_CONFIG_REQ_TO_SCH:
212       {
213          SchModUeConfigReq(pst, (SchUeRecfgReq *)msg);
214          break;
215       }
216       case EVENT_RACH_IND_TO_SCH:
217       {
218          SchProcRachInd(pst, (RachIndInfo *)msg);
219          break;
220       }
221       case EVENT_CRC_IND_TO_SCH:
222       {
223          SchProcCrcInd(pst, (CrcIndInfo *)msg);
224          break;
225       }
226       case EVENT_DL_RLC_BO_INFO_TO_SCH:
227       {
228          SchProcDlRlcBoInfo(pst, (DlRlcBoInfo *)msg);
229          break;
230       }
231       case EVENT_SHORT_BSR:
232       case EVENT_LONG_BSR:
233       {
234          SchProcBsr(pst, (UlBufferStatusRptInd *)msg);
235          break;
236       }
237       case EVENT_UCI_IND_TO_SCH:
238       {
239          SchProcSrUciInd(pst, (SrUciIndInfo *)msg);
240          break;
241       }
242       case EVENT_UE_DELETE_REQ_TO_SCH:
243       {
244          SchProcUeDeleteReq(pst, (SchUeDelete *)msg);
245          break;
246       }
247       case EVENT_CELL_DELETE_REQ_TO_SCH:
248       {
249          SchProcCellDeleteReq(pst, (SchCellDeleteReq *)msg);
250          break;
251       }
252       case EVENT_RACH_RESOURCE_REQUEST_TO_SCH:
253       {
254          SchProcRachRsrcReq(pst, (SchRachRsrcReq *)msg);
255          break;
256       }
257       case EVENT_RACH_RESOURCE_RELEASE_TO_SCH:
258       {
259          SchProcRachRsrcRel(pst, (SchRachRsrcRel *)msg);
260          break;
261       }
262       case EVENT_PAGING_IND_TO_SCH:
263       {
264          SchProcPagingInd(pst, (SchPageInd *)msg);
265          break;
266       }
267       case EVENT_DL_HARQ_IND_TO_SCH:
268       {
269          SchProcDlHarqInd(pst, (DlHarqInd *)msg);
270          break;
271       }
272       default:
273       {
274          DU_LOG("\nERROR  -->  SCH : SchMessageRouter(): Invalid event [%d] received", pst->event);
275          return RFAILED;
276       }
277    }
278    return ROK;
279 }
280
281 \f
282 /**********************************************************************
283  
284          End of file
285 **********************************************************************/