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: mac_msg_router.c
29 **********************************************************************/
31 /** @file mac_msg_router.c
32 @brief This file contains the implementation of callback functions
33 registered with SSI during the LTE MAC Task initialization.
35 /* header include files -- defines (.h) */
36 #include "common_def.h"
37 #include "rgu.h" /* RGU defines */
38 #include "tfu.h" /* RGU defines */
39 #include "lrg.h" /* layer management defines for LTE-MAC */
40 #include "rgr.h" /* layer management defines for LTE-MAC */
41 #include "crg.h" /* CRG interface includes */
42 #include "rg_sch_inf.h" /* SCH interface includes */
43 #include "rg_prg.h" /* PRG interface includes */
44 #include "rg_env.h" /* customisable defines and macros for LTE-MAC */
45 #include "rg.h" /* defines and macros for MAC */
46 #include "rgr.h" /* defines and macros for SCH */
49 /* header/extern include files (.x) */
50 #include "rgu.x" /* RGU types */
51 #include "tfu.x" /* RGU types */
52 #include "lrg.x" /* layer management typedefs for MAC */
53 #include "rgr.x" /* layer management typedefs for MAC */
54 #include "crg.x" /* CRG interface typedes */
55 #include "rg_sch_inf.x" /* SCH interface typedefs */
56 #include "rg_prg.x" /*PRG interface includes*/
57 #include "du_app_mac_inf.h"
58 #include "rg.x" /* typedefs for MAC */
59 #include "rlc_mac_inf.h"
60 #include "lwr_mac_upr_inf.h"
63 * @brief Task Activation callback function Entity SM.
67 * Function : rgHdlSMEvents
69 * Process Messages received from Entity SM
71 * @param[in] Pst *pst, Post structure of the primitive.
72 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
73 * @param[in] Reason reason.
76 static inline void rgHdlSMEvents
78 Pst *pst, /* post structure */
79 Buffer *mBuf /* message buffer */
86 /* Process a config. request */
87 cmUnpkLrgCfgReq(RgMiLrgCfgReq, pst, mBuf);
89 case EVTMACSCHGENCFGREQ:
90 /* Process a config. request */
91 cmUnpkLrgSchCfgReq(MacSchGenCfgReq, pst, mBuf);
94 /* Process a statistics request */
95 cmUnpkLrgStsReq(RgMiLrgStsReq, pst, mBuf);
97 #endif /* LCRGMILRG */
98 case EVENT_MAC_CELL_CONFIG_REQ:
100 /* Process MAC cell config */
101 unpackDuMacCellCfg(MacProcCellCfgReq, pst, mBuf);
104 case EVENT_MAC_CELL_START:
106 /* Process MAC cell start request */
107 unpackMacCellStart(MacProcCellStart, pst, mBuf);
110 case EVENT_MAC_CELL_STOP:
112 /* Process MAC cell stop request */
113 unpackMacCellStop(MacProcCellStop, pst, mBuf);
116 case EVENT_MAC_DL_CCCH_IND:
118 /* Process DL CCCH Ind */
119 unpackMacDlCcchInd(MacProcDlCcchInd, pst, mBuf);
122 case EVENT_MAC_UE_CREATE_REQ:
124 /* Process Ue Create Request */
125 unpackMacUeCreateReq(MacProcUeCreateReq, pst, mBuf);
128 case EVENT_MAC_UE_RECONFIG_REQ:
130 /* Process Ue Reconfig Request */
131 unpackMacUeReconfigReq(MacProcUeReconfigReq, pst, mBuf);
134 case EVENT_MAC_UE_DELETE_REQ:
136 /* Process UE Delete Request */
137 unpackMacUeDeleteReq(MacProcUeDeleteReq, pst, mBuf);
140 case EVENT_MAC_CELL_DELETE_REQ:
142 /* Process Cell Delete Request */
143 unpackMacCellDeleteReq(MacProcCellDeleteReq, pst, mBuf);
146 case EVENT_MAC_SLICE_CFG_REQ:
148 /* Process Slice Configuration Request */
149 unpackMacSliceCfgReq(MacProcSliceCfgReq, pst, mBuf);
152 case EVENT_MAC_SLICE_RECFG_REQ:
154 /* Process Slice Reconfiguration Request */
155 unpackMacSliceRecfgReq(MacProcSliceRecfgReq, pst, mBuf);
158 case EVENT_MAC_RACH_RESOURCE_REQ:
160 /* Process Rach Resource Request */
161 unpackMacRachRsrcReq(MacProcRachRsrcReq, pst, mBuf);
164 case EVENT_MAC_RACH_RESOURCE_REL:
166 /* Process Rach Resource Release */
167 unpackMacRachRsrcRel(MacProcRachRsrcRel, pst, mBuf);
170 case EVENT_MAC_DL_PCCH_IND:
172 /* Process Pcch indication */
173 unpackMacDlPcchInd(MacProcDlPcchInd, pst, mBuf);
185 * @brief Task Activation callback function Entity NH.
189 * Function : rgHdlNHEvents
191 * Process Messages received from Entity NH
193 * @param[in] Pst *pst, Post structure of the primitive.
194 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
195 * @param[in] Reason reason.
198 static inline void rgHdlNHEvents
200 Pst *pst, /* post structure */
201 Buffer *mBuf /* message buffer */
208 cmUnpkCrgBndReq(RgUiCrgBndReq, pst, mBuf);
211 cmUnpkCrgUbndReq(RgUiCrgUbndReq, pst, mBuf);
221 * @brief Task Activation callback function Entity KW.
225 * Function : rgHdlKWEvents
227 * Process Messages received from Entity KW
229 * @param[in] Pst *pst, Post structure of the primitive.
230 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
231 * @param[in] Reason reason.
234 static inline void rgHdlKWEvents
236 Pst *pst, /* post structure */
237 Buffer *mBuf /* message buffer */
244 cmUnpkRguBndReq(RgUiRguBndReq, pst, mBuf);
247 cmUnpkRguUbndReq(RgUiRguUbndReq, pst, mBuf);
249 case EVENT_DL_DATA_TO_MAC:
250 unpackRlcDlData(MacProcRlcDlData, pst, mBuf);
252 case EVENT_BO_STATUS_TO_MAC:
253 unpackRlcBoStatus(MacProcRlcBoStatus, pst, mBuf);
257 case EVTRGUL2MULTHRPMEASREQ:
258 cmUnpkRguL2MUlThrpMeasReq(RgUiRguL2MUlThrpMeasReq, pst,mBuf);
270 * @brief Task Activation callback function Entity TF.
274 * Function : rgHdlTFEvents
276 * Process Messages received from Entity TF
278 * @param[in] Pst *pst, Post structure of the primitive.
279 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
280 * @param[in] Reason reason.
283 static inline void rgHdlTFEvents
285 Pst *pst, /* post structure */
286 Buffer *mBuf /* message buffer */
291 case EVENT_SLOT_IND_TO_MAC:
292 unpackSlotInd(fapiMacSlotInd, pst, mBuf);
294 case EVENT_STOP_IND_TO_MAC:
295 unpackStopInd(fapiMacStopInd, pst, mBuf);
297 case EVENT_RACH_IND_TO_MAC:
298 unpackRachInd(fapiMacRachInd, pst, mBuf);
300 case EVENT_CRC_IND_TO_MAC:
301 unpackCrcInd(fapiMacCrcInd, pst, mBuf);
303 case EVENT_RX_DATA_IND_TO_MAC:
304 unpackRxDataInd(fapiMacRxDataInd, pst, mBuf);
306 case EVENT_UCI_IND_TO_MAC:
307 unpackUciInd(FapiMacUciInd, pst, mBuf);
317 * @brief Task Activation callback function Entity RG SCH.
321 * Function : rgHdlRGEvents
323 * Process Messages received from Entity RG SCH
325 * @param[in] Pst *pst, Post structure of the primitive.
326 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
327 * @param[in] Reason reason.
330 static inline void rgHdlRGEvents
332 Pst *pst, /* post structure */
333 Buffer *mBuf /* message buffer */
339 case EVTINFCELLREGREQ:
340 cmUnpkSchMacCellRegReq(RgSchMacCellRegReq, pst, mBuf);
342 case EVTINFSFALLOCREQ:
343 cmUnpkSchMacSfAllocReq(RgSchMacSfAllocReq, pst, mBuf);
346 cmUnpkSchMacRlsHqReq(RgSchMacRlsHqReq, pst, mBuf);
348 case EVTINFHQENTRESET:
349 cmUnpkSchMacRstHqEntReq(RgSchMacRstHqEntReq, pst, mBuf);
351 case EVTINFRLSRNTIREQ:
352 cmUnpkSchMacRlsRntiReq(RgSchMacRlsRntiReq, pst, mBuf);
355 case EVTINFL2MEASREQ:
356 cmUnpkSchMacL2MeasReq(RgSchMacL2MeasReq, pst, mBuf);
358 case EVTINFL2MEASSENDREQ :
359 cmUnpkSchMacL2MeasSendReq(RgSchMacL2MeasSendReq, pst , mBuf);
361 case EVTINFL2MEASSTOPREQ:
362 cmUnpkSchMacL2MeasStopReq(RgSchMacL2MeasStopReq, pst , mBuf);
364 #endif/* LTE_L2_MEAS */
366 #if defined(LTE_ADV) && defined(LCPRG)
367 case EVTPRGUESCELLCFGREQ:
369 cmUnpkPrgPMacSMacUeSCellCfgReq(RgPrgPMacSMacUeSCellCfgReq, pst, mBuf);
372 case EVTPRGUESCELLCFGCFM:
373 case EVTPRGUESCELLLCHMODCFM:
374 case EVTPRGUESCELLLCHDELCFMDEL:
375 case EVTPRGUESCELLLCHADDCFM:
377 cmUnpkPrgSMacPMacCfgCfm(RgPrgSMacPMacCfgCfm, pst, mBuf);
380 case EVTPRGUESCELLDELREQ:
382 cmUnpkPrgPMacSMacUeSCellDelReq(RgPrgPMacSMacUeSCellDelReq, pst, mBuf);
385 case EVTPRGUESCELLLCHMODREQ:
387 cmUnpkPrgPMacSMacUeSCellLchModReq(RgPrgPMacSMacUeSCellLchModReq, pst,
391 case EVTPRGUESCELLLCHDELREQ:
393 cmUnpkPrgPMacSMacUeSCellLchDelReq(RgPrgPMacSMacUeSCellLchDelReq, pst,
397 case EVTPRGUESCELLLCHADDREQ:
399 cmUnpkPrgPMacSMacUeSCellLchAddReq(RgPrgPMacSMacUeSCellLchAddReq, pst,
414 #ifdef CALL_FLOW_DEBUG_LOG
416 * @brief Function prints src, dest, msg infor about all the msgs that received.
420 * Function : callFlowRgActvTsk
422 * Function prints src, dest, msg infor about all the msgs that received
424 * @param[in] Pst *pst, Post structure of the primitive.
429 void callFlowRgActvTsk(Pst *pst)
432 char destTask[50]="ENTMAC";
439 strcpy(sourceTask,"ENTDUAPP");
444 strcpy(message,"EVTLRGCFGREQ");
446 case EVTMACSCHGENCFGREQ:
447 strcpy(message,"EVTMACSCHGENCFGREQ");
449 #endif /* LCRGMILRG */
450 case EVENT_MAC_CELL_CONFIG_REQ:
451 strcpy(message,"EVENT_MAC_CELL_CONFIG_REQ");
453 case EVENT_MAC_CELL_START:
454 strcpy(message,"EVENT_MAC_CELL_START");
456 case EVENT_MAC_CELL_STOP:
457 strcpy(message,"EVENT_MAC_CELL_STOP");
459 case EVENT_MAC_DL_CCCH_IND:
460 strcpy(message,"EVENT_MAC_DL_CCCH_IND");
462 case EVENT_MAC_UE_CREATE_REQ:
463 strcpy(message,"EVENT_MAC_UE_CREATE_REQ");
465 case EVENT_MAC_UE_RECONFIG_REQ:
466 strcpy(message,"EVENT_MAC_UE_RECONFIG_REQ");
468 case EVENT_MAC_UE_DELETE_REQ:
469 strcpy(message,"EVENT_MAC_UE_DELETE_REQ");
471 case EVENT_MAC_CELL_DELETE_REQ:
472 strcpy(message,"EVENT_MAC_CELL_DELETE_REQ");
474 case EVENT_MAC_SLICE_CFG_REQ:
475 strcpy(message,"EVENT_MAC_SLICE_CFG_REQ");
477 case EVENT_MAC_SLICE_RECFG_REQ:
478 strcpy(message,"EVENT_MAC_SLICE_RECFG_REQ");
481 strcpy(message,"Invalid Event");
488 strcpy(sourceTask,"ENTRLC");
493 strcpy(message,"EVTRGUBNDREQ");
496 strcpy(message,"EVTRGUUBNDREQ");
498 case EVENT_DL_DATA_TO_MAC:
499 strcpy(message,"EVENT_DL_DATA_TO_MAC");
501 case EVENT_BO_STATUS_TO_MAC:
502 strcpy(message,"EVENT_BO_STATUS_TO_MAC");
506 strcpy(message,"Invalid Event");
514 strcpy(sourceTask,"ENTLWRMAC");
517 case EVENT_SLOT_IND_TO_MAC:
518 strcpy(message,"EVENT_SLOT_IND_TO_MAC");
520 case EVENT_STOP_IND_TO_MAC:
521 strcpy(message,"EVENT_STOP_IND_TO_MAC");
523 case EVENT_RACH_IND_TO_MAC:
524 strcpy(message,"EVENT_RACH_IND_TO_MAC");
526 case EVENT_CRC_IND_TO_MAC:
527 strcpy(message,"EVENT_CRC_IND_TO_MAC");
529 case EVENT_RX_DATA_IND_TO_MAC:
530 strcpy(message,"EVENT_RX_DATA_IND_TO_MAC");
532 case EVENT_UCI_IND_TO_MAC:
533 strcpy(message,"EVENT_UCI_IND_TO_MAC");
536 strcpy(message,"Invalid Event");
542 case ENTMAC: /* When scheduler instance sends msg to MAC */
544 strcpy(sourceTask,"ENTMAC");
548 case EVTINFCELLREGREQ:
549 strcpy(message,"EVTINFCELLREGREQ");
551 case EVTINFSFALLOCREQ:
552 strcpy(message,"EVTINFSFALLOCREQ");
555 strcpy(message,"EVTINFRLSHQREQ");
557 case EVTINFHQENTRESET:
558 strcpy(message,"EVTINFHQENTRESET");
560 case EVTINFRLSRNTIREQ:
561 strcpy(message,"EVTINFRLSRNTIREQ");
564 #if defined(LTE_ADV) && defined(LCPRG)
565 case EVTPRGUESCELLCFGREQ:
566 strcpy(message,"EVTPRGUESCELLCFGREQ");
568 case EVTPRGUESCELLCFGCFM:
569 strcpy(message,"EVTPRGUESCELLCFGCFM");
571 case EVTPRGUESCELLLCHMODCFM:
572 strcpy(message,"EVTPRGUESCELLLCHMODCFM");
574 case EVTPRGUESCELLLCHDELCFMDEL:
575 strcpy(message,"EVTPRGUESCELLLCHDELCFMDEL");
577 case EVTPRGUESCELLLCHADDCFM:
578 strcpy(message,"EVTPRGUESCELLLCHADDCFM");
580 case EVTPRGUESCELLDELREQ:
581 strcpy(message,"EVTPRGUESCELLDELREQ");
583 case EVTPRGUESCELLLCHMODREQ:
584 strcpy(message,"EVTPRGUESCELLLCHMODREQ");
586 case EVTPRGUESCELLLCHDELREQ:
587 strcpy(message,"EVTPRGUESCELLLCHDELREQ");
589 case EVTPRGUESCELLLCHADDREQ:
590 strcpy(message,"EVTPRGUESCELLLCHADDREQ");
595 strcpy(message,"Invalid Event");
603 strcpy(sourceTask,"Invalid Source Entity Id");
607 DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);
613 * @brief Task Activation callback function.
617 * Function : rgActvTsk
619 * Primitives invoked by MAC's users/providers through
620 * a loosely coupled interface arrive here by means of
621 * SSI's message handling. This API is registered with
622 * SSI during the Task Registration of MAC.
624 * @param[in] Pst *pst, Post structure of the primitive.
625 * @param[in] Buffer *mBuf, Packed primitive parameters in the buffer.
626 * @param[in] Reason reason.
632 Pst *pst, /* post structure */
633 Buffer *mBuf /* message buffer */
637 #ifdef CALL_FLOW_DEBUG_LOG
638 callFlowRgActvTsk(pst);
643 /* The originator of this message is the stack manager,
644 * unpack and go to the respective primitive processing function */
646 rgHdlSMEvents(pst, mBuf);
649 rgHdlNHEvents(pst, mBuf);
652 rgHdlKWEvents(pst, mBuf);
655 rgHdlTFEvents(pst, mBuf);
657 case ENTMAC: /* When scheduler instance sends msg to MAC */
658 rgHdlRGEvents(pst, mBuf);
666 }/* end of rgActvTsk */
669 /**********************************************************************
672 **********************************************************************/