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 /* header include files (.h) */
20 #include "envopt.h" /* environment options */
21 #include "envdep.h" /* environment dependent */
22 #include "envind.h" /* environment independent */
23 #include "gen.h" /* general */
24 #include "ssi.h" /* system services */
25 #include "cm_tkns.h" /* Common Token Defines */
26 #include "cm_llist.h" /* Common Link List Defines */
27 #include "cm_hash.h" /* Common Hash List Defines */
28 #include "cm_lte.h" /* Common LTE Defines */
29 #include "cm_mblk.h" /* Common LTE Defines */
30 #include "tfu.h" /* RGU Interface defines */
36 /* header/extern include files (.x) */
37 #include "gen.x" /* general */
38 #include "ssi.x" /* system services */
39 #include "cm_tkns.x" /* Common Token Definitions */
40 #include "cm_llist.x" /* Common Link List Definitions */
41 #include "cm_lib.x" /* Common Library Definitions */
42 #include "cm_hash.x" /* Common Hash List Definitions */
43 #include "cm_lte.x" /* Common LTE Defines */
44 #include "cm_mblk.x" /* Common LTE Defines */
45 #include "tfu.x" /* RGU Interface includes */
51 /* function pointers for packing macCellCfg Request */
52 typedef S16 (*packSlotIndMsg) ARGS((
54 fapi_slot_ind_t *slotInd
57 S16 packLcSlotInd (Pst *pst, SlotIndInfo *slotInd);
58 S16 packTcSlotInd (Pst *pst, fapi_slot_ind_t *slotInd);
59 S16 packLwlcSlotInd (Pst *pst, fapi_slot_ind_t *slotInd);
61 packSlotIndMsg packSlotIndOpts[] =
63 packLcSlotInd, /* packing for loosely coupled */
64 fapiMacSlotInd, /* packing for tightly coupled */
65 packLwlcSlotInd, /* packing for light weight loosly coupled */
68 S16 packLcSlotInd (Pst *pst, SlotIndInfo *slotInd)
71 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
76 /* pack SFN and slot value */
77 CMCHKPK(SPkU16,slotInd->sfn, mBuf);
78 CMCHKPK(SPkU16,slotInd->slot, mBuf);
80 RETVALUE(SPstTsk(pst,mBuf));
83 S16 packTcSlotInd (Pst *pst, fapi_slot_ind_t *slotInd)
88 S16 packLwlcSlotInd (Pst *pst, fapi_slot_ind_t *slotInd)
93 U16 handleSlotInd(fapi_slot_ind_t *fapiSlotInd)
95 /* fill Pst structure to send to lwr_mac to MAC */
105 pst.event = EVENT_SLOT_IND_TO_MAC;
108 pst.selector = MAC_SELECTOR_TC;
110 slotInd.sfn = fapiSlotInd->sfn;
111 slotInd.slot = fapiSlotInd->slot;
113 return (*packSlotIndOpts[pst.selector])(&pst, &slotInd);
117 void handlePhyMessages(void *msg)
120 /* extract the header */
122 header = (fapi_msg_t *)msg;
124 switch(header->message_type_id)
126 case FAPI_SLOT_INDICATION:
128 if(clGlobalCp.phyState == PHY_STATE_CONFIGURED)
130 DU_LOG("\nLOWER MAC: PHY has moved to running state \n");
131 clGlobalCp.phyState = PHY_STATE_RUNNING;
134 fapi_slot_ind_t *slotInd;
135 slotInd = (fapi_slot_ind_t *)msg;
136 handleSlotInd(slotInd);
139 case FAPI_ERROR_INDICATION:
143 case FAPI_RX_DATA_INDICATION:
147 case FAPI_CRC_INDICATION:
151 case FAPI_UCI_INDICATION:
155 case FAPI_SRS_INDICATION:
159 case FAPI_RACH_INDICATION:
167 /**********************************************************************
169 **********************************************************************/