1 /*******************************************************************************
\r
2 ################################################################################
\r
3 # Copyright (c) [2017-2019] [Radisys] #
\r
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
\r
6 # you may not use this file except in compliance with the License. #
\r
7 # You may obtain a copy of the License at #
\r
9 # http://www.apache.org/licenses/LICENSE-2.0 #
\r
11 # Unless required by applicable law or agreed to in writing, software #
\r
12 # distributed under the License is distributed on an "AS IS" BASIS, #
\r
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
\r
14 # See the License for the specific language governing permissions and #
\r
15 # limitations under the License. #
\r
16 ################################################################################
\r
17 *******************************************************************************/
\r
19 /* This file is the entry point for Lower MAC */
\r
21 #include "common_def.h"
\r
22 #include "mac_utils.h"
\r
23 #include "lwr_mac_fsm.h"
\r
24 #include "lwr_mac_phy.h"
\r
27 #include "fapi_vendor_extension.h"
\r
29 #ifndef INTEL_WLS_MEM
\r
30 #include "lwr_mac_phy_stub_inf.h"
\r
33 /**************************************************************************
\r
34 * @brief Task Initiation callback function.
\r
38 * Function : lwrMacActvInit
\r
41 * This function is supplied as one of parameters during Lower MAC's
\r
42 * task registration. SSI will invoke this function once, after
\r
43 * it creates and attaches this TAPA Task to a system task.
\r
45 * @param[in] Ent entity, the entity ID of this task.
\r
46 * @param[in] Inst inst, the instance ID of this task.
\r
47 * @param[in] Region region, the region ID registered for memory
\r
48 * usage of this task.
\r
49 * @param[in] Reason reason.
\r
50 * @return ROK - success
\r
52 ***************************************************************************/
\r
53 uint8_t lwrMacActvInit(Ent entity, Inst inst, Region region, Reason reason)
\r
58 /**************************************************************************
\r
59 * @brief function prints src, dest, msg info about all the msgs received
\r
63 * Function : callFlowlwrMacActvTsk
\r
66 * function prints src, dest, msg info about all the msgs received
\r
68 * @param[in] Pst *pst
\r
71 ***************************************************************************/
\r
73 void callFlowlwrMacActvTsk(Pst *pst)
\r
75 char sourceTask[50];
\r
76 char destTask[50]="ENTLWRMAC";
\r
83 strcpy(sourceTask,"ENTLWRMAC");
\r
86 #ifdef INTEL_WLS_MEM
\r
87 case EVT_START_WLS_RCVR:
\r
89 strcpy(message,"EVT_START_WLS_RCVR");
\r
95 strcpy(message,"Invalid Event");
\r
102 #ifndef INTEL_WLS_MEM
\r
105 strcpy(sourceTask,"PHY");
\r
108 case EVT_PHY_STUB_SLOT_IND:
\r
110 strcpy(message,"EVT_PHY_STUB_SLOT_IND");
\r
114 case EVT_PHY_STUB_STOP_IND:
\r
116 strcpy(message,"EVT_PHY_STUB_STOP_IND");
\r
121 strcpy(message,"Invalid Event");
\r
131 strcpy(sourceTask,"Invalid Source Entity Id");
\r
134 DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);
\r
136 /**************************************************************************
\r
137 * @brief Task Activation callback function.
\r
141 * Function : lwrMacActvTsk
\r
144 * Primitives invoked by Lower MAC's users/providers through
\r
145 * a loosely coupled interface arrive here by means of
\r
146 * SSI's message handling. This API is registered with
\r
147 * SSI during the Task Registration of DU APP.
\r
149 * @param[in] Pst *pst, Post structure of the primitive.
\r
150 * @param[in] Buffer *mBuf, Packed primitive parameters in the
\r
152 * @return ROK - success
\r
153 * RFAILED - failure
\r
155 ***************************************************************************/
\r
156 uint8_t lwrMacActvTsk(Pst *pst, Buffer *mBuf)
\r
160 #ifdef CALL_FLOW_DEBUG_LOG
\r
161 callFlowlwrMacActvTsk(pst);
\r
164 switch(pst->srcEnt)
\r
170 #ifdef INTEL_WLS_MEM
\r
171 case EVT_START_WLS_RCVR:
\r
173 ODU_PUT_MSG_BUF(mBuf);
\r
175 /* Allocate memory for intial UL transmission */
\r
176 LwrMacEnqueueWlsBlock();
\r
178 /* Start thread to receive from L1 */
\r
179 DU_LOG("\nINFO --> LWR MAC: Starting WLS receiver thread");
\r
180 LwrMacRecvPhyMsg();
\r
186 ODU_PUT_MSG_BUF(mBuf);
\r
187 DU_LOG("\nERROR --> LWR MAC: Invalid event %d received", pst->event);
\r
194 #ifndef INTEL_WLS_MEM
\r
199 case EVT_PHY_STUB_SLOT_IND:
\r
201 fapi_slot_ind_t *slotIndMsg;
\r
203 CMCHKUNPK(oduUnpackPointer, (PTR *)&slotIndMsg, mBuf);
\r
204 ODU_PUT_MSG_BUF(mBuf);
\r
206 procPhyMessages(slotIndMsg->header.msg_id, sizeof(fapi_slot_ind_t), (void*)slotIndMsg);
\r
207 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, slotIndMsg, sizeof(fapi_slot_ind_t));
\r
211 case EVT_PHY_STUB_STOP_IND:
\r
213 fapi_stop_ind_t *stopIndMsg;
\r
214 CMCHKUNPK(oduUnpackPointer, (PTR *)&stopIndMsg, mBuf);
\r
215 ODU_PUT_MSG_BUF(mBuf);
\r
217 procPhyMessages(stopIndMsg->header.msg_id, sizeof(fapi_stop_ind_t), (void*)stopIndMsg);
\r
218 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, stopIndMsg, sizeof(fapi_stop_ind_t));
\r
223 DU_LOG("\nERROR --> LWR_MAC: Invalid event %d received from PHY STUB", pst->event);
\r
232 ODU_PUT_MSG_BUF(mBuf);
\r
233 DU_LOG("\nERROR --> LWR MAC: Message from invalid source entity %d", pst->srcEnt);
\r
240 /**********************************************************************
\r
242 **********************************************************************/
\r