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 Task Activation callback function.
\r
63 * Function : lwrMacActvTsk
\r
66 * Primitives invoked by Lower MAC's users/providers through
\r
67 * a loosely coupled interface arrive here by means of
\r
68 * SSI's message handling. This API is registered with
\r
69 * SSI during the Task Registration of DU APP.
\r
71 * @param[in] Pst *pst, Post structure of the primitive.
\r
72 * @param[in] Buffer *mBuf, Packed primitive parameters in the
\r
74 * @return ROK - success
\r
77 ***************************************************************************/
\r
78 uint8_t lwrMacActvTsk(Pst *pst, Buffer *mBuf)
\r
88 #ifdef INTEL_WLS_MEM
\r
89 case EVT_START_WLS_RCVR:
\r
91 ODU_PUT_MSG_BUF(mBuf);
\r
93 /* Allocate memory for intial UL transmission */
\r
94 LwrMacEnqueueWlsBlock();
\r
96 /* Start thread to receive from L1 */
\r
97 DU_LOG("\nINFO --> LWR MAC: Starting WLS receiver thread");
\r
105 DU_LOG("\nERROR --> LWR MAC: Invalid event %d received", pst->event);
\r
112 #ifndef INTEL_WLS_MEM
\r
117 case EVT_PHY_STUB_SLOT_IND:
\r
119 fapi_slot_ind_t *slotIndMsg;
\r
121 CMCHKUNPK(oduUnpackPointer, (PTR *)&slotIndMsg, mBuf);
\r
122 ODU_PUT_MSG_BUF(mBuf);
\r
124 procPhyMessages(slotIndMsg->header.msg_id, sizeof(fapi_slot_ind_t), (void*)slotIndMsg);
\r
125 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, slotIndMsg, sizeof(fapi_slot_ind_t));
\r
129 case EVT_PHY_STUB_STOP_IND:
\r
131 fapi_stop_ind_t *stopIndMsg;
\r
132 CMCHKUNPK(oduUnpackPointer, (PTR *)&stopIndMsg, mBuf);
\r
133 ODU_PUT_MSG_BUF(mBuf);
\r
135 procPhyMessages(stopIndMsg->header.msg_id, sizeof(fapi_stop_ind_t), (void*)stopIndMsg);
\r
136 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, stopIndMsg, sizeof(fapi_stop_ind_t));
\r
141 DU_LOG("\nERROR --> LWR_MAC: Invalid event %d received from PHY STUB", pst->event);
\r
151 DU_LOG("\nERROR --> LWR MAC: Message from invalid source entity %d", pst->srcEnt);
\r
158 /**********************************************************************
\r
160 **********************************************************************/
\r