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 /************************************************************************
25 Desc: C source code for packing/unpacking of MAC to MAC interface
30 **********************************************************************/
31 /* header include files -- defines (.h) */
32 #include "common_def.h"
37 #include "rg_sch_inf.h"
43 /* header/extern include files (.x) */
44 #include "rgu.x" /* RGU types */
45 #include "tfu.x" /* RGU types */
46 #include "lrg.x" /* layer management typedefs for MAC */
47 #include "crg.x" /* layer management typedefs for MAC */
48 #include "rg_sch_inf.x" /* layer management typedefs for MAC */
49 #include "rg_prg.x" /* Prg(MAC-MAC)interface includes */
50 #include "du_app_mac_inf.h"
51 #include "rg.x" /* typedefs for MAC */
56 * @brief Ue SCell Cfg Req from PMac to SMac.
57 * @details This primitive is used for light-weight loose coupling.
61 * Function : cmPkPrgPMacSMacUeSCellCfgReq
64 * @param[in] RgPrgUeSCellCfgInfo *ueSCellCfgInfo
68 S16 cmPkPrgPMacSMacUeSCellCfgReq(Pst *pst,RgPrgUeSCellCfgInfo *ueSCellCfgInfo)
72 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
77 if(SAddPstMsgMult((Data *)ueSCellCfgInfo, sizeof(RgPrgUeSCellCfgInfo),\
84 pst->event = (Event) EVTPRGUESCELLCFGREQ;
85 return (SPstTsk(pst,mBuf));
89 * @brief Ue SCell Cfg Req from PMac to SMac.
90 * @details This primitive is used for light-weight loose coupling.
94 * Function : cmUnpkPrgPMacSMacUeSCellCfgReq
97 * @param[in] RgPrgUeSCellCfgInfo *ueSCellCfgInfo
101 S16 cmUnpkPrgPMacSMacUeSCellCfgReq(RgPrgUeSCellCfgReq func,Pst *pst,Buffer *mBuf)
103 RgPrgUeSCellCfgInfo ueSCellCfgInfo;
105 if(SRemPreMsgMult((Data *)&ueSCellCfgInfo, sizeof(RgPrgUeSCellCfgInfo), mBuf) != ROK)
107 RGPRG_FREE_MSG(mBuf);
111 RGPRG_FREE_MSG(mBuf);
112 return ((*func)(pst, &ueSCellCfgInfo));
116 * @brief Config confirm for Ue SCell config Req.
117 * @details This primitive is used for light-weight loose coupling.
121 * Function : cmPkPrgSMacPMacCfgCfm
123 * @param[in] Pst *pst
124 * @param[in] RgPrgCfgCfmInfo *cfgCfm
128 S16 cmPkPrgSMacPMacCfgCfm(Pst *pst,RgPrgCfgCfmInfo *cfgCfm)
130 Buffer *mBuf = NULLP;
132 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
137 if(SAddPstMsgMult((Data *)cfgCfm, sizeof(RgPrgCfgCfmInfo), mBuf) != ROK)
139 RGPRG_FREE_MSG(mBuf);
142 switch(cfgCfm->event)
144 case EVTPRGUESCELLLCHMODCFM : /*cfm for Lch recfg */
146 pst->event = (Event) EVTPRGUESCELLLCHMODCFM;
149 case EVTPRGUESCELLCFGCFM : /*cfm for Adding Scell */
151 pst->event = (Event) EVTPRGUESCELLCFGCFM;
154 case EVTPRGUESCELLLCHDELCFM : /* cfm for deleting Lch */
156 pst->event = (Event) EVTPRGUESCELLLCHDELCFM;
159 case EVTPRGUESCELLLCHADDCFM: /* cfm for adding of LCh */
161 pst->event = (Event) EVTPRGUESCELLLCHADDCFM;
165 return (SPstTsk(pst,mBuf));
169 * @brief Config confirm for SCell addd Req.
170 * @details This primitive is used for light-weight loose coupling.
174 * Function : cmUnpkPrgSMacPMacCfgCfm
176 * @param[in] CfgCfm fun
177 * @param[in] Pst* pst
178 * @param[in] RgPrgCfgCfmInfo *cfgCfm
182 S16 cmUnpkPrgSMacPMacCfgCfm
184 RgSMacPMacCfgCfm func,
189 RgPrgCfgCfmInfo cfgCfm;
191 if(SRemPreMsgMult((Data *)&cfgCfm, sizeof(RgPrgCfgCfmInfo), mBuf) != ROK)
193 RGPRG_FREE_MSG(mBuf);
197 RGPRG_FREE_MSG(mBuf);
198 return ((*func)(pst, &cfgCfm));
202 * @brief SCell Ue Delete Req/UeId change req from PMac to SMac.
203 * @details This primitive is used for light-weight loose coupling.
207 * Function : cmPkPrgPMacSMacUeSCellDelReq
209 * @param[in] Pst *pst
210 * @param[in] RgPrgUeSCellDelInfo *ueSCellDelInfo
214 S16 cmPkPrgPMacSMacUeSCellDelReq(Pst *pst,RgPrgUeSCellDelInfo *ueSCellDelInfo)
216 Buffer *mBuf = NULLP;
218 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
223 if(SAddPstMsgMult((Data *)ueSCellDelInfo, sizeof(RgPrgUeSCellDelInfo), mBuf)\
226 RGPRG_FREE_MSG(mBuf);
230 pst->event = (Event) EVTPRGUESCELLDELREQ;
231 return (SPstTsk(pst,mBuf));
235 * @brief Unpacking for SCell UE delete/Ue Id Change Req to SMAC.
236 * @details This primitive is used for light-weight loose coupling.
240 * Function : cmUnpkPrgPMacSMacUeSCellDelReq
242 * @param[in] CfgCfm fun
243 * @param[in] Pst* pst
244 * @param[in] Buffer *mBuf
248 S16 cmUnpkPrgPMacSMacUeSCellDelReq
250 RgUeSCellDelReq func,
255 RgPrgUeSCellDelInfo ueSCellDelInfo;
257 if(SRemPreMsgMult((Data *)&ueSCellDelInfo, sizeof(RgPrgUeSCellDelInfo),\
260 RGPRG_FREE_MSG(mBuf);
264 RGPRG_FREE_MSG(mBuf);
265 return ((*func)(pst, &ueSCellDelInfo));
269 * @brief Ue Lch Addition Req from PMac to SMac.
270 * @details This primitive is used for light-weight loose coupling.
274 * Function : cmPkPrgPMacSMacUeSCellLchAddReq
276 * @param[in] Pst* pst
277 * @param[in] RgPrgUeSCellLchAddInfo *lchCfgInfo
281 S16 cmPkPrgPMacSMacUeSCellLchAddReq(Pst *pst,RgPrgUeSCellLchAddInfo *lchCfgInfo)
283 Buffer *mBuf = NULLP;
285 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
290 if(SAddPstMsgMult((Data *)lchCfgInfo, sizeof(RgPrgUeSCellLchAddInfo),\
293 RGPRG_FREE_MSG(mBuf);
297 pst->event = (Event) EVTPRGUESCELLLCHADDREQ;
298 return (SPstTsk(pst,mBuf));
302 * @brief LCH Addition Req from PMac to SMac.
303 * @details This primitive is used for light-weight loose coupling.
307 * Function : cmUnpkPrgPMacSMacUeSCellLchAddReq
309 * @param[in] Pst* pst
310 * @param[in] RgPrgUeSCellLchAddInfo *lchCfgInfo
311 * @param[in]Buffer *mBuf
315 S16 cmUnpkPrgPMacSMacUeSCellLchAddReq
317 RgPrgUeSCellLchAddInfo func,
322 RgPrgLchRecfgInfo lchCfgInfo;
324 if(SRemPreMsgMult((Data *)&lchCfgInfo, sizeof(RgPrgUeSCellLchAddInfo), mBuf) != ROK)
326 RGPRG_FREE_MSG(mBuf);
330 RGPRG_FREE_MSG(mBuf);
331 return ((*func)(pst, &lchCfgInfo));
335 * @brief Ue SCell Delete Req from PMac to SMac.
336 * @details This primitive is used for light-weight loose coupling.
340 * Function : cmPkPrgPMacSMacUeSCellLchDelReq
342 * @param[in] Pst *pst
343 * @param[in] RgPrgUeSCellLchDelInfo *delLcCb
347 S16 cmPkPrgPMacSMacUeSCellLchDelReq(Pst *pst,RgPrgUeSCellLchDelInfo *delLcCb)
349 Buffer *mBuf = NULLP;
351 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
356 if(SAddPstMsgMult((Data *)delLcCb, sizeof(RgPrgUeSCellLchDelInfo),\
359 RGPRG_FREE_MSG(mBuf);
363 pst->event = (Event) EVTPRGUESCELLLCHDELREQ;
364 return (SPstTsk(pst,mBuf));
369 * @brief Ue Lch reCfg Req from PMac to SMac.
370 * @details This primitive is used for light-weight loose coupling.
374 * Function : cmPkPrgPMacSMacUeSCellLchModReq
376 * @param[in] Pst *pst
377 * @param[in] RgPrgUeSCellLchModInfo *lchCfgInfo
381 S16 cmPkPrgPMacSMacUeSCellLchModReq(Pst *pst,RgPrgUeSCellLchModInfo *lchCfgInfo)
383 Buffer *mBuf = NULLP;
385 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
390 if(SAddPstMsgMult((Data *)lchCfgInfo, sizeof(RgPrgUeSCellLchModInfo),\
393 RGPRG_FREE_MSG(mBuf);
397 pst->event = (Event) EVTPRGUESCELLLCHMODREQ;
398 return (SPstTsk(pst,mBuf));
403 * @brief LCH Cfg Req from PMac to SMac.
404 * @details This primitive is used for light-weight loose coupling.
408 * Function : cmUnpkPrgPMacSMacUeSCellLchModReq
410 * @param[in] Pst* pst
411 * @param[in] RgPrgLchRecfgInfo *lchCfgInfo
412 * @param[in] Buffer *mBuf
416 S16 cmUnpkPrgPMacSMacUeSCellLchModReq
418 RgPrgUeScellModLchReq func,
423 RgPrgUeSCellLchModInfo lchCfgInfo;
425 if(SRemPreMsgMult((Data *)&lchCfgInfo, sizeof(RgPrgUeSCellLchModInfo), mBuf) != ROK)
427 RGPRG_FREE_MSG(mBuf);
431 RGPRG_FREE_MSG(mBuf);
432 return ((*func)(pst, &lchCfgInfo));
437 * @brief LCH Del Req from PMac to SMac.
438 * @details This primitive is used for light-weight loose coupling.
442 * Function : cmUnpkPrgPMacSMacUeSCellLchDelReq
444 * @param[in] Pst* pst
445 * @param[in] RgPrgUeScellDelLchReq func;
446 * @param[in] Buffer *mBuf;
450 S16 cmUnpkPrgPMacSMacUeSCellLchDelReq
452 RgPrgUeScellDelLchReq func,
457 RgPrgUeSCellLchDelInfo lchCfgInfo;
459 if(SRemPreMsgMult((Data *)&lchCfgInfo, sizeof(RgPrgUeSCellLchDelInfo), mBuf) != ROK)
461 RGPRG_FREE_MSG(mBuf);
465 RGPRG_FREE_MSG(mBuf);
466 return ((*func)(pst, &lchCfgInfo));
472 /**********************************************************************
475 **********************************************************************/