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 *******************************************************************************/
20 /************************************************************************
26 Desc: C source code for packing/unpacking of RGM interface
31 **********************************************************************/
34 @brief This file contains the packing/unpacking code for the RGM interface
38 /* header include files (.h) */
39 #include "common_def.h"
40 #include "rgm.h" /* RGM Interface defines */
41 /* header/extern include files (.x) */
42 #include "rgm.x" /* RGM Interface includes */
46 * @brief Packing of PRB Usage Report for qci for sending
51 * Function : cmPkRgmPrbQciRpt
53 * @param[in] RgmPrbRptPerQci * qciPrbRprt
54 * @param[out] Buffer *mBuf
60 RgmPrbRptPerQci *qciPrbRprt,
64 CMCHKPK(oduPackUInt8, qciPrbRprt->bQci, mBuf);
65 CMCHKPK(oduPackUInt8, qciPrbRprt->bAvgPrbUlUsage, mBuf);
66 CMCHKPK(oduPackUInt8, qciPrbRprt->bAvgPrbDlUsage, mBuf);
72 * @brief Unpacking of PRB Usage Report for qci received from MAC
76 * Function : cmUnpkRgmPrbQciRpt
78 * @param[out] RgmPrbRptPerQci * qciPrbRprt
79 * @param[in] Buffer *mBuf
83 S16 cmUnpkRgmPrbQciRpt
85 RgmPrbRptPerQci *qciPrbRprt,
89 CMCHKUNPK(oduUnpackUInt8, &qciPrbRprt->bAvgPrbDlUsage, mBuf);
90 CMCHKUNPK(oduUnpackUInt8, &qciPrbRprt->bAvgPrbUlUsage, mBuf);
91 CMCHKUNPK(oduUnpackUInt8, &qciPrbRprt->bQci, mBuf);
98 * @brief PRB Usage Report Indication from MAC to RRM
102 * Function : cmPkPrbRprtInd
104 * @param[in] RgmPrbRprtInd * prbRprtInd
105 * @param[in] Buffer *mBuf
111 RgmPrbRprtInd * prbRprtInd,
119 for(idx = RGM_MAX_QCI_REPORTS-1; idx >= 0; idx--)
121 CMCHKPK(cmPkRgmPrbQciRpt, &prbRprtInd->stQciPrbRpts[idx], mBuf);
123 CMCHKPK(oduPackUInt8, prbRprtInd->bPrbUsageMask, mBuf);
124 CMCHKPK(oduPackUInt8, prbRprtInd->bCellId, mBuf);
130 * @brief PRB Usage Report Indication from MAC to RRM
134 * Function : cmUnpkPrbRprtInd
136 * @param[in] RgmPrbRprtInd * prbRprtInd
137 * @param[in] Buffer *mBuf
143 RgmPrbRprtInd * prbRprtInd,
151 CMCHKUNPK(oduUnpackUInt8, &prbRprtInd->bCellId, mBuf);
152 CMCHKUNPK(oduUnpackUInt8, &prbRprtInd->bPrbUsageMask, mBuf);
153 for(idx = 0; idx < RGM_MAX_QCI_REPORTS; idx++)
155 CMCHKUNPK(cmUnpkRgmPrbQciRpt, &prbRprtInd->stQciPrbRpts[idx], mBuf);
165 * @brief PRB Usage Report Indication from MAC to RRM
169 * Function : cmPkRgmPrbRprtInd
171 * @param[in] Pst* pst
172 * @param[in] SuId suId
173 * @param[in] RgmPrbRprtInd * prbRprtInd
177 S16 cmPkRgmPrbRprtInd
181 RgmPrbRprtInd * prbRprtInd
184 Buffer *mBuf = NULLP;
187 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
188 SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)prbRprtInd, sizeof(RgmPrbRprtInd));
192 if(cmPkPrbRprtInd(prbRprtInd, mBuf) != ROK)
194 SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)prbRprtInd, sizeof(RgmPrbRprtInd));
199 if (SPkS16(suId, mBuf) != ROK)
201 SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)prbRprtInd, sizeof(RgmPrbRprtInd));
206 SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)prbRprtInd, sizeof(RgmPrbRprtInd));
208 pst->event = (Event) EVTRGMPRBRPRTIND;
209 return (SPstTsk(pst,mBuf));
212 * @brief PRB Usage Report Indication from MAC to RRM
216 * Function : cmUnpkRgmPrbRprtInd
218 * @param[in] Pst* pst
219 * @param[in] SuId suId
220 * @param[in] RgmPrbRprtInd * prbRprtInd
224 S16 cmUnpkRgmPrbRprtInd
226 RgmPrbRprtIndFptr func,
232 RgmPrbRprtInd prbRprtInd;
235 if (SUnpkS16(&suId, mBuf) != ROK)
241 if (cmUnpkPrbRprtInd(&prbRprtInd, mBuf) != ROK)
248 return ((*func)(pst, suId, &prbRprtInd));
252 * @brief Transmission Mode Change Indication from MAC to RRM
256 * Function : cmPkTransModeInd
258 * @param[in] RgmTransModeInd *transModeInd
259 * @param[in] Buffer *mBuf
265 RgmTransModeInd *transModeInd,
269 CMCHKPK(oduPackUInt32, transModeInd->eMode, mBuf);
270 CMCHKPK(oduPackUInt16, transModeInd->usCrnti, mBuf);
271 CMCHKPK(oduPackUInt8, transModeInd->bCellId, mBuf);
276 * @brief Transmission Mode Change Indication from MAC to RRM
280 * Function : cmUnpkTransModeInd
282 * @param[in] RgmTransModeInd *transModeInd
283 * @param[in] Buffer *mBuf
287 S16 cmUnpkTransModeInd
289 RgmTransModeInd *transModeInd,
293 uint32_t tmpModeEnum;
294 CMCHKUNPK(oduUnpackUInt8, &transModeInd->bCellId, mBuf);
295 CMCHKUNPK(oduUnpackUInt16, &transModeInd->usCrnti, mBuf);
296 CMCHKUNPK(oduUnpackUInt32, (uint32_t *)&tmpModeEnum, mBuf);
297 transModeInd->eMode = (RgmTxnMode)tmpModeEnum;
301 * @brief Transmission Mode Change Indication from MAC to RRM
305 * Function : cmPkRgmTransModeInd
307 * @param[in] Pst* pst
308 * @param[in] SuId suId
309 * @param[in] RgmTransModeInd *transModeInd
314 S16 cmPkRgmTransModeInd
318 RgmTransModeInd *transModeInd
321 Buffer *mBuf = NULLP;
324 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
325 SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)transModeInd, sizeof(RgmTransModeInd));
329 if(cmPkTransModeInd(transModeInd, mBuf) != ROK)
331 SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)transModeInd, sizeof(RgmTransModeInd));
336 if (SPkS16(suId, mBuf) != ROK)
338 SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)transModeInd, sizeof(RgmTransModeInd));
343 SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)transModeInd, sizeof(RgmTransModeInd));
345 pst->event = (Event) EVTRGMTRANSMODEIND;
346 return (SPstTsk(pst,mBuf));
349 * @brief Transmission Mode Change Indication from MAC to RRM
353 * Function : cmUnpkRgmTransModeInd
355 * @param[in] Pst* pst
356 * @param[in] SuId suId
357 * @param[in] RgmTransModeInd *transModeInd
361 S16 cmUnpkRgmTransModeInd
363 RgmTransModeIndFptr func,
369 RgmTransModeInd transModeInd;
372 if (SUnpkS16(&suId, mBuf) != ROK)
378 if (cmUnpkTransModeInd(&transModeInd, mBuf) != ROK)
385 return ((*func)(pst, suId, &transModeInd));
387 /**********************************************************************
391 **********************************************************************/