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 *******************************************************************************/
18 /* This file define APIs at RLC-MAC interface */
19 #include "common_def.h"
20 #include "rlc_mac_inf.h"
23 * @brief Primitive invoked from RLC to MAC to
24 * inform the BO report for dedicated channels
28 * Function : packBOStatus,
31 * @param[in] RlcMacBOStatus * staRsp
35 uint8_t packRlcBoStatus(Pst* pst, RlcBoStatus *boStatus)
39 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
41 DU_LOG("\nERROR --> RLC: Memory allocation failed at packBOStatus");
45 if (pst->selector == ODU_SELECTOR_LWLC)
47 /* light weight loose coupling */
48 CMCHKPK(oduPackPointer,(PTR) boStatus, mBuf);
56 return ODU_POST_TASK(pst,mBuf);
60 * @brief Primitive invoked from RLC to MAC to
61 * inform the BO report for dedicated channels
65 * Function : unpackBOStatus
68 * @param[in] RlcMacBOStatus * staRsp
72 uint8_t unpackRlcBoStatus(RlcMacBoStatusFunc func, Pst *pst, Buffer *mBuf)
76 if (pst->selector == ODU_SELECTOR_LWLC)
78 /* Light weight loose coupling */
79 CMCHKUNPK(oduUnpackPointer,(PTR *) &boSta, mBuf);
86 ODU_PUT_MSG_BUF(mBuf);
87 return (*func)(pst, boSta);
91 * @brief Status Indication from MAC to RLC
92 * as a response to the staRsp primitive from RLC.
93 * Informs RLC of the totalBufferSize and Timing Info
94 * for the transmission on dedicated channels.
98 * Function : packSchedRep
100 * @param[in] Pst* pst
101 * @param[in] SuId suId
102 * @param[in] RlcMacSchedRep* schRep
106 uint8_t packRlcSchedResultRpt(Pst* pst, RlcSchedResultRpt *schRep)
108 Buffer *mBuf = NULLP;
110 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
112 DU_LOG("\nERROR --> MAC : Memory allocation failed at packSchResultRep");
115 if (pst->selector == ODU_SELECTOR_LWLC)
117 CMCHKPK(oduPackPointer,(PTR) schRep, mBuf);
124 return ODU_POST_TASK(pst,mBuf);
128 * @brief Status Indication from MAC to RLC
129 * as a response to the staRsp primitive from RLC.
130 * Informs RLC of the totalBufferSize and Timing Info
131 * for the transmission on dedicated channels.
135 * Function : unpackSchResultRpt
137 * @param[in] Pst* pst
138 * @param[in] SuId suId
139 * @param[in] RguDStaIndInfo * staInd
143 uint8_t unpackSchedResultRpt(RlcMacSchedResultRptFunc func, Pst *pst, Buffer *mBuf)
145 RlcSchedResultRpt *schRep;
147 if (pst->selector == ODU_SELECTOR_LWLC)
149 CMCHKUNPK(oduUnpackPointer,(PTR *) &schRep, mBuf);
155 ODU_PUT_MSG_BUF(mBuf);
156 return (*func)(pst, schRep);
159 /*******************************************************************
161 * @brief Pack and send DL Data from RLC to MAC
165 * Function : packRlcDlData
167 * Functionality: Pack and send DL Data from RLC to MAC
170 * @return ROK - success
173 * ****************************************************************/
174 uint8_t packRlcDlData(Pst* pst, RlcData *dlData)
176 Buffer *mBuf = NULLP;
178 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
180 DU_LOG("\nERROR --> RLC : Memory allocation failed at packRlcDlData");
184 if (pst->selector == ODU_SELECTOR_LWLC)
186 CMCHKPK(oduPackPointer,(PTR) dlData, mBuf);
192 return ODU_POST_TASK(pst,mBuf);
196 /*******************************************************************
198 * @brief unpack RLC DL data
202 * Function : unpackRlcDlData
204 * Functionality: unpack RLC DL data
207 * @return ROK - success
210 * ****************************************************************/
211 uint8_t unpackRlcDlData(RlcMacDlDataFunc func, Pst *pst, Buffer *mBuf)
215 if (pst->selector == ODU_SELECTOR_LWLC)
217 CMCHKUNPK(oduUnpackPointer, (PTR *) &dlData, mBuf);
223 ODU_PUT_MSG_BUF(mBuf);
224 return((*func)(pst, dlData));
227 /*******************************************************************
229 * @brief Pack and send UL data from MAC to RLC
233 * Function : packRlcUlData
235 * Functionality: Pack and send UL data from MAC to RLC
238 * @return ROK - success
241 * ****************************************************************/
242 uint8_t packRlcUlData(Pst* pst, RlcData *ulData)
244 Buffer *mBuf = NULLP;
246 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
248 DU_LOG("\nERROR --> MAC : Memory allocation failed at packRlcUlData");
252 if (pst->selector == ODU_SELECTOR_LWLC)
254 CMCHKPK(oduPackPointer,(PTR)ulData, mBuf);
261 pst->event = (Event)EVENT_UL_DATA_TO_RLC;
262 return ODU_POST_TASK(pst,mBuf);
265 /*******************************************************************
267 * @brief Unpack RLC UL data
271 * Function : unpackRlcUlData
273 * Functionality: Unpack RLC UL data
276 * @return ROK - success
279 * ****************************************************************/
280 uint8_t unpackRlcUlData(RlcMacUlDataFunc func, Pst *pst, Buffer *mBuf)
284 if (pst->selector == ODU_SELECTOR_LWLC)
286 CMCHKUNPK(oduUnpackPointer,(PTR *) &ulData, mBuf);
292 ODU_PUT_MSG_BUF(mBuf);
293 return (*func)(pst, ulData);
296 /**********************************************************************
298 **********************************************************************/