[Epic-ID: ODUHIGH-488][Task-ID: ODUHIGH-501] WG8 Alignment | Added Skeleton for UL...
[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_UL_CQI_TO_SCH:
106          {
107             strcpy(message,"EVENT_UL_CQI_TO_SCH");
108             break;
109          }
110       case EVENT_DL_CQI_TO_SCH:
111          {
112             strcpy(message,"EVENT_DL_CQI_TO_SCH");
113             break;
114          }
115       case EVENT_PHR_IND_TO_SCH
116          {
117             strcpy(message,"EVENT_PHR_IND_TO_SCH");
118          }
119       case EVENT_RACH_IND_TO_SCH:
120          {
121             strcpy(message,"EVENT_RACH_IND_TO_SCH");
122             break;
123          }
124       case EVENT_CRC_IND_TO_SCH:
125          {
126             strcpy(message,"EVENT_CRC_IND_TO_SCH");
127             break;
128          }
129       case EVENT_DL_RLC_BO_INFO_TO_SCH:
130          {
131             strcpy(message,"EVENT_DL_RLC_BO_INFO_TO_SCH");
132             break;
133          }
134       case EVENT_SHORT_BSR:
135          {
136             strcpy(message,"EVENT_SHORT_BSR");
137             break;
138          }
139       case EVENT_LONG_BSR:
140          {
141             strcpy(message,"EVENT_LONG_BSR");
142             break;
143          }
144       case EVENT_UCI_IND_TO_SCH:
145          {
146             strcpy(message,"EVENT_UCI_IND_TO_SCH");
147             break;
148          }
149       case EVENT_UE_DELETE_REQ_TO_SCH:
150          {
151             strcpy(message,"EVENT_UE_DELETE_REQ_TO_SCH");
152             break;
153          }
154       case EVENT_CELL_DELETE_REQ_TO_SCH:
155          {
156             strcpy(message,"EVENT_CELL_DELETE_REQ_TO_SCH");
157             break;
158          }
159       case EVENT_RACH_RESOURCE_REQUEST_TO_SCH:
160          {
161             strcpy(message,"EVENT_RACH_RESOURCE_REQUEST_TO_SCH");
162             break;
163          }
164       case EVENT_RACH_RESOURCE_RELEASE_TO_SCH:
165          {
166             strcpy(message,"EVENT_RACH_RESOURCE_RELEASE_TO_SCH");
167             break;
168          }
169       case EVENT_PAGING_IND_TO_SCH:
170          {
171             strcpy(message,"EVENT_PAGING_IND_TO_SCH");
172             break;
173          }
174       case EVENT_DL_HARQ_IND_TO_SCH:
175          {
176             strcpy(message,"EVENT_DL_HARQ_IND_TO_SCH");
177             break;
178          }
179       default:
180          strcpy(message,"Invalid Event");
181          break;
182    }
183    DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);
184 }
185 #endif
186
187 uint8_t SchMessageRouter(Pst *pst, void *msg)
188 {
189 #ifdef CALL_FLOW_DEBUG_LOG
190    callFlowSchMsgRouter(pst);
191 #endif
192
193    switch(pst->event)
194    {
195       case EVENT_SCH_GEN_CFG:
196       {
197             SchProcGenCfgReq(pst, (RgMngmt *)msg);
198          break;
199       }
200       case EVENT_SLICE_CFG_REQ_TO_SCH:
201       {    
202          SchProcSliceCfgReq(pst, (SchSliceCfgReq *)msg);
203          break;
204       }    
205       case EVENT_SLICE_RECFG_REQ_TO_SCH:
206       {    
207          SchProcSliceRecfgReq(pst, (SchSliceRecfgReq *)msg);
208          break;
209       }
210       case EVENT_SCH_CELL_CFG:
211       {
212          SchProcCellCfgReq(pst, (SchCellCfg *)msg);
213          break;
214       }
215       case EVENT_SLOT_IND_TO_SCH:
216       {
217          SchProcSlotInd(pst, (SlotTimingInfo *)msg);
218          break;
219       }
220       case EVENT_ADD_UE_CONFIG_REQ_TO_SCH:
221       {
222          SchAddUeConfigReq(pst, (SchUeCfgReq *)msg);
223          break;
224       }
225       case EVENT_MODIFY_UE_CONFIG_REQ_TO_SCH:
226       {
227          SchModUeConfigReq(pst, (SchUeRecfgReq *)msg);
228          break;
229       }
230       case EVENT_UL_CQI_TO_SCH:
231       {
232          SchProcUlCqiInd(pst, (SchUlCqiInd *)msg);
233          break;
234       }
235       case EVENT_DL_CQI_TO_SCH:
236       {
237          SchProcDlCqiInd(pst, (SchDlCqiInd *)msg);
238          break;
239       }
240       case EVENT_PHR_IND_TO_SCH:
241       {
242          SchProcPhrInd(pst, (SchPwrHeadroomInd *)msg);
243          break;
244       }
245       case EVENT_RACH_IND_TO_SCH:
246       {
247          SchProcRachInd(pst, (RachIndInfo *)msg);
248          break;
249       }
250       case EVENT_CRC_IND_TO_SCH:
251       {
252          SchProcCrcInd(pst, (CrcIndInfo *)msg);
253          break;
254       }
255       case EVENT_DL_RLC_BO_INFO_TO_SCH:
256       {
257          SchProcDlRlcBoInfo(pst, (DlRlcBoInfo *)msg);
258          break;
259       }
260       case EVENT_SHORT_BSR:
261       case EVENT_LONG_BSR:
262       {
263          SchProcBsr(pst, (UlBufferStatusRptInd *)msg);
264          break;
265       }
266       case EVENT_UCI_IND_TO_SCH:
267       {
268          SchProcSrUciInd(pst, (SrUciIndInfo *)msg);
269          break;
270       }
271       case EVENT_UE_DELETE_REQ_TO_SCH:
272       {
273          SchProcUeDeleteReq(pst, (SchUeDelete *)msg);
274          break;
275       }
276       case EVENT_CELL_DELETE_REQ_TO_SCH:
277       {
278          SchProcCellDeleteReq(pst, (SchCellDeleteReq *)msg);
279          break;
280       }
281       case EVENT_RACH_RESOURCE_REQUEST_TO_SCH:
282       {
283          SchProcRachRsrcReq(pst, (SchRachRsrcReq *)msg);
284          break;
285       }
286       case EVENT_RACH_RESOURCE_RELEASE_TO_SCH:
287       {
288          SchProcRachRsrcRel(pst, (SchRachRsrcRel *)msg);
289          break;
290       }
291       case EVENT_PAGING_IND_TO_SCH:
292       {
293          SchProcPagingInd(pst, (SchPageInd *)msg);
294          break;
295       }
296       case EVENT_DL_HARQ_IND_TO_SCH:
297       {
298          SchProcDlHarqInd(pst, (DlHarqInd *)msg);
299          break;
300       }
301       default:
302       {
303          DU_LOG("\nERROR  -->  SCH : SchMessageRouter(): Invalid event [%d] received", pst->event);
304          return RFAILED;
305       }
306    }
307    return ROK;
308 }
309
310 \f
311 /**********************************************************************
312  
313          End of file
314 **********************************************************************/