1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
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 #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
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 *******************************************************************************/
19 /************************************************************************
25 Desc: C source code SSI Interface Implementation
27 File: sch_msg_router.c
29 **********************************************************************/
31 #include "common_def.h"
36 #include "rg_sch_inf.h"
38 #include "mac_sch_interface.h"
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 */
48 * @brief Task Initiation function.
52 * Function : schActvInit
54 * This function is supplied as one of parameters during MAC's
55 * task registration. MAC will invoke this function once, after
56 * it creates and attaches this TAPA Task to a system task.
58 * @param[in] Ent Entity, the entity ID of this task.
59 * @param[in] Inst Inst, the instance ID of this task.
60 * @param[in] Region Region, the region ID registered for memory
62 * @param[in] Reason Reason.
66 uint8_t schActvInit(Ent entity, Inst instId, Region region, Reason reason)
68 Inst inst = (instId - SCH_INST_START);
70 /* Initialize the MAC TskInit structure to zero */
71 memset ((uint8_t *)&schCb[inst], 0, sizeof(schCb));
73 /* Initialize the MAC TskInit with received values */
74 schCb[inst].schInit.ent = entity;
75 schCb[inst].schInit.inst = inst;
76 schCb[inst].schInit.region = region;
77 schCb[inst].schInit.pool = 0;
78 schCb[inst].schInit.reason = reason;
79 schCb[inst].schInit.cfgDone = FALSE;
80 schCb[inst].schInit.acnt = FALSE;
81 schCb[inst].schInit.usta = FALSE;
82 schCb[inst].schInit.trc = FALSE;
83 schCb[inst].schInit.procId = ODU_GET_PROCID();
89 * @brief Task Activation callback function.
93 * Function : schActvTsk
95 * Primitives invoked by SCH's users/providers through
96 * a loosely coupled interface arrive here by means of
97 * SSI's message handling. This API is registered with
98 * SSI during the Task Registration of SCH.
100 * @param[in] Pst *pst, Post structure of the primitive.
101 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
102 * @param[in] Reason reason.
106 uint8_t schActvTsk(Pst *pst, Buffer *mBuf)
108 SchMessageRouter(pst, (void *)mBuf);
114 #ifdef CALL_FLOW_DEBUG_LOG
116 * @brief Function prints src, dest, msg infor about all the msgs that received.
120 * Function : callFlowSchMsgRouter
122 * Function prints src, dest, msg infor about all the msgs that received
124 * @param[in] Pst *pst, Post structure of the primitive.
129 void callFlowSchMsgRouter(Pst *pst)
132 char destTask[50]="ENTSCH";
135 strcpy(sourceTask,"ENTMAC");
138 case EVENT_SCH_GEN_CFG:
140 strcpy(message,"EVENT_SCH_GEN_CFG");
143 case EVENT_SLICE_CFG_REQ_TO_SCH:
145 strcpy(message,"EVENT_SLICE_CFG_REQ_TO_SCH");
148 case EVENT_SLICE_RECFG_REQ_TO_SCH:
150 strcpy(message,"EVENT_SLICE_RECFG_REQ_TO_SCH");
153 case EVENT_SCH_CELL_CFG:
155 strcpy(message,"EVENT_SCH_CELL_CFG");
158 case EVENT_SLOT_IND_TO_SCH:
160 strcpy(message,"EVENT_SLOT_IND_TO_SCH");
163 case EVENT_ADD_UE_CONFIG_REQ_TO_SCH:
165 strcpy(message,"EVENT_ADD_UE_CONFIG_REQ_TO_SCH");
168 case EVENT_MODIFY_UE_CONFIG_REQ_TO_SCH:
170 strcpy(message,"EVENT_MODIFY_UE_CONFIG_REQ_TO_SCH");
173 case EVENT_UL_CQI_TO_SCH:
175 strcpy(message,"EVENT_UL_CQI_TO_SCH");
178 case EVENT_DL_CQI_TO_SCH:
180 strcpy(message,"EVENT_DL_CQI_TO_SCH");
183 case EVENT_PHR_IND_TO_SCH
185 strcpy(message,"EVENT_PHR_IND_TO_SCH");
187 case EVENT_RACH_IND_TO_SCH:
189 strcpy(message,"EVENT_RACH_IND_TO_SCH");
192 case EVENT_CRC_IND_TO_SCH:
194 strcpy(message,"EVENT_CRC_IND_TO_SCH");
197 case EVENT_DL_RLC_BO_INFO_TO_SCH:
199 strcpy(message,"EVENT_DL_RLC_BO_INFO_TO_SCH");
202 case EVENT_SHORT_BSR:
204 strcpy(message,"EVENT_SHORT_BSR");
209 strcpy(message,"EVENT_LONG_BSR");
212 case EVENT_UCI_IND_TO_SCH:
214 strcpy(message,"EVENT_UCI_IND_TO_SCH");
217 case EVENT_UE_DELETE_REQ_TO_SCH:
219 strcpy(message,"EVENT_UE_DELETE_REQ_TO_SCH");
222 case EVENT_CELL_DELETE_REQ_TO_SCH:
224 strcpy(message,"EVENT_CELL_DELETE_REQ_TO_SCH");
227 case EVENT_RACH_RESOURCE_REQUEST_TO_SCH:
229 strcpy(message,"EVENT_RACH_RESOURCE_REQUEST_TO_SCH");
232 case EVENT_RACH_RESOURCE_RELEASE_TO_SCH:
234 strcpy(message,"EVENT_RACH_RESOURCE_RELEASE_TO_SCH");
237 case EVENT_PAGING_IND_TO_SCH:
239 strcpy(message,"EVENT_PAGING_IND_TO_SCH");
242 case EVENT_DL_HARQ_IND_TO_SCH:
244 strcpy(message,"EVENT_DL_HARQ_IND_TO_SCH");
247 case EVENT_STATISTICS_REQ_TO_SCH:
249 strcpy(message,"EVENT_STATISTICS_REQ_TO_SCH");
253 strcpy(message,"Invalid Event");
256 DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);
260 uint8_t SchMessageRouter(Pst *pst, void *msg)
262 #ifdef CALL_FLOW_DEBUG_LOG
263 callFlowSchMsgRouter(pst);
268 case EVENT_SCH_GEN_CFG:
270 SchProcGenCfgReq(pst, (RgMngmt *)msg);
273 case EVENT_SLICE_CFG_REQ_TO_SCH:
275 SchProcSliceCfgReq(pst, (SchSliceCfgReq *)msg);
278 case EVENT_SLICE_RECFG_REQ_TO_SCH:
280 SchProcSliceRecfgReq(pst, (SchSliceRecfgReq *)msg);
283 case EVENT_SCH_CELL_CFG:
285 SchProcCellCfgReq(pst, (SchCellCfg *)msg);
288 case EVENT_SLOT_IND_TO_SCH:
290 SchProcSlotInd(pst, (SlotTimingInfo *)msg);
293 case EVENT_ADD_UE_CONFIG_REQ_TO_SCH:
295 SchAddUeConfigReq(pst, (SchUeCfgReq *)msg);
298 case EVENT_MODIFY_UE_CONFIG_REQ_TO_SCH:
300 SchModUeConfigReq(pst, (SchUeRecfgReq *)msg);
303 case EVENT_UL_CQI_TO_SCH:
305 SchProcUlCqiInd(pst, (SchUlCqiInd *)msg);
308 case EVENT_DL_CQI_TO_SCH:
310 SchProcDlCqiInd(pst, (SchDlCqiInd *)msg);
313 case EVENT_PHR_IND_TO_SCH:
315 SchProcPhrInd(pst, (SchPwrHeadroomInd *)msg);
318 case EVENT_RACH_IND_TO_SCH:
320 SchProcRachInd(pst, (RachIndInfo *)msg);
323 case EVENT_CRC_IND_TO_SCH:
325 SchProcCrcInd(pst, (CrcIndInfo *)msg);
328 case EVENT_DL_RLC_BO_INFO_TO_SCH:
330 SchProcDlRlcBoInfo(pst, (DlRlcBoInfo *)msg);
333 case EVENT_SHORT_BSR:
336 SchProcBsr(pst, (UlBufferStatusRptInd *)msg);
339 case EVENT_UCI_IND_TO_SCH:
341 SchProcSrUciInd(pst, (SrUciIndInfo *)msg);
344 case EVENT_UE_DELETE_REQ_TO_SCH:
346 SchProcUeDeleteReq(pst, (SchUeDelete *)msg);
349 case EVENT_CELL_DELETE_REQ_TO_SCH:
351 SchProcCellDeleteReq(pst, (SchCellDeleteReq *)msg);
354 case EVENT_RACH_RESOURCE_REQUEST_TO_SCH:
356 SchProcRachRsrcReq(pst, (SchRachRsrcReq *)msg);
359 case EVENT_RACH_RESOURCE_RELEASE_TO_SCH:
361 SchProcRachRsrcRel(pst, (SchRachRsrcRel *)msg);
364 case EVENT_PAGING_IND_TO_SCH:
366 SchProcPagingInd(pst, (SchPageInd *)msg);
369 case EVENT_DL_HARQ_IND_TO_SCH:
371 SchProcDlHarqInd(pst, (DlHarqInd *)msg);
374 case EVENT_STATISTICS_REQ_TO_SCH:
376 SchProcStatsReq(pst, (SchStatsReq *)msg);
381 DU_LOG("\nERROR --> SCH : SchMessageRouter(): Invalid event [%d] received", pst->event);
389 /**********************************************************************
392 **********************************************************************/