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
69 S16 cmPkPrgPMacSMacUeSCellCfgReq
72 RgPrgUeSCellCfgInfo *ueSCellCfgInfo
75 S16 cmPkPrgPMacSMacUeSCellCfgReq(pst, ueSCellCfgInfo)
77 RgPrgUeSCellCfgInfo *ueSCellCfgInfo;
82 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
87 if(SAddPstMsgMult((Data *)ueSCellCfgInfo, sizeof(RgPrgUeSCellCfgInfo),\
94 pst->event = (Event) EVTPRGUESCELLCFGREQ;
95 return (SPstTsk(pst,mBuf));
99 * @brief Ue SCell Cfg Req from PMac to SMac.
100 * @details This primitive is used for light-weight loose coupling.
104 * Function : cmUnpkPrgPMacSMacUeSCellCfgReq
106 * @param[in] Pst* pst
107 * @param[in] RgPrgUeSCellCfgInfo *ueSCellCfgInfo
112 S16 cmUnpkPrgPMacSMacUeSCellCfgReq
114 RgPrgUeSCellCfgReq func,
119 S16 cmUnpkPrgPMacSMacUeSCellCfgReq(func, pst, mBuf)
120 RgPrgUeSCellCfgReq func;
125 RgPrgUeSCellCfgInfo ueSCellCfgInfo;
127 if(SRemPreMsgMult((Data *)&ueSCellCfgInfo, sizeof(RgPrgUeSCellCfgInfo), mBuf) != ROK)
129 RGPRG_FREE_MSG(mBuf);
133 RGPRG_FREE_MSG(mBuf);
134 return ((*func)(pst, &ueSCellCfgInfo));
138 * @brief Config confirm for Ue SCell config Req.
139 * @details This primitive is used for light-weight loose coupling.
143 * Function : cmPkPrgSMacPMacCfgCfm
145 * @param[in] Pst *pst
146 * @param[in] RgPrgCfgCfmInfo *cfgCfm
151 S16 cmPkPrgSMacPMacCfgCfm
154 RgPrgCfgCfmInfo *cfgCfm
157 S16 cmPkPrgSMacPMacCfgCfm(pst, cfgCfm)
159 RgPrgCfgCfmInfo *cfgCfm;
162 Buffer *mBuf = NULLP;
164 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
169 if(SAddPstMsgMult((Data *)cfgCfm, sizeof(RgPrgCfgCfmInfo), mBuf) != ROK)
171 RGPRG_FREE_MSG(mBuf);
174 switch(cfgCfm->event)
176 case EVTPRGUESCELLLCHMODCFM : /*cfm for Lch recfg */
178 pst->event = (Event) EVTPRGUESCELLLCHMODCFM;
181 case EVTPRGUESCELLCFGCFM : /*cfm for Adding Scell */
183 pst->event = (Event) EVTPRGUESCELLCFGCFM;
186 case EVTPRGUESCELLLCHDELCFM : /* cfm for deleting Lch */
188 pst->event = (Event) EVTPRGUESCELLLCHDELCFM;
191 case EVTPRGUESCELLLCHADDCFM: /* cfm for adding of LCh */
193 pst->event = (Event) EVTPRGUESCELLLCHADDCFM;
197 return (SPstTsk(pst,mBuf));
201 * @brief Config confirm for SCell addd Req.
202 * @details This primitive is used for light-weight loose coupling.
206 * Function : cmUnpkPrgSMacPMacCfgCfm
208 * @param[in] CfgCfm fun
209 * @param[in] Pst* pst
210 * @param[in] RgPrgCfgCfmInfo *cfgCfm
215 S16 cmUnpkPrgSMacPMacCfgCfm
217 RgSMacPMacCfgCfm func,
222 S16 cmUnpkPrgSMacPMacCfgCfm(func, pst, mBuf)
223 RgSMacPMacCfgCfm func;
228 RgPrgCfgCfmInfo cfgCfm;
230 if(SRemPreMsgMult((Data *)&cfgCfm, sizeof(RgPrgCfgCfmInfo), mBuf) != ROK)
232 RGPRG_FREE_MSG(mBuf);
236 RGPRG_FREE_MSG(mBuf);
237 return ((*func)(pst, &cfgCfm));
241 * @brief SCell Ue Delete Req/UeId change req from PMac to SMac.
242 * @details This primitive is used for light-weight loose coupling.
246 * Function : cmPkPrgPMacSMacUeSCellDelReq
248 * @param[in] Pst *pst
249 * @param[in] RgPrgUeSCellDelInfo *ueSCellDelInfo
254 S16 cmPkPrgPMacSMacUeSCellDelReq
257 RgPrgUeSCellDelInfo *ueSCellDelInfo
260 S16 cmPkPrgPMacSMacUeSCellDelReq(pst, ueSCellDelInfo)
262 RgPrgUeSCellDelInfo *ueSCellDelInfo;
265 Buffer *mBuf = NULLP;
267 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
272 if(SAddPstMsgMult((Data *)ueSCellDelInfo, sizeof(RgPrgUeSCellDelInfo), mBuf)\
275 RGPRG_FREE_MSG(mBuf);
279 pst->event = (Event) EVTPRGUESCELLDELREQ;
280 return (SPstTsk(pst,mBuf));
284 * @brief Unpacking for SCell UE delete/Ue Id Change Req to SMAC.
285 * @details This primitive is used for light-weight loose coupling.
289 * Function : cmUnpkPrgPMacSMacUeSCellDelReq
291 * @param[in] CfgCfm fun
292 * @param[in] Pst* pst
293 * @param[in] Buffer *mBuf
298 S16 cmUnpkPrgPMacSMacUeSCellDelReq
300 RgUeSCellDelReq func,
305 S16 cmUnpkPrgPMacSMacUeSCellDelReq(func, pst, mBuf)
306 RgUeSCellDelReq func;
311 RgPrgUeSCellDelInfo ueSCellDelInfo;
313 if(SRemPreMsgMult((Data *)&ueSCellDelInfo, sizeof(RgPrgUeSCellDelInfo),\
316 RGPRG_FREE_MSG(mBuf);
320 RGPRG_FREE_MSG(mBuf);
321 return ((*func)(pst, &ueSCellDelInfo));
325 * @brief Ue Lch Addition Req from PMac to SMac.
326 * @details This primitive is used for light-weight loose coupling.
330 * Function : cmPkPrgPMacSMacUeSCellLchAddReq
332 * @param[in] Pst* pst
333 * @param[in] RgPrgUeSCellLchAddInfo *lchCfgInfo
338 S16 cmPkPrgPMacSMacUeSCellLchAddReq
341 RgPrgUeSCellLchAddInfo *lchCfgInfo,
344 S16 cmPkPrgPMacSMacUeSCellLchAddReq(pst, lchCfgInfo)
346 RgPrgUeSCellLchAddInfo *lchCfgInfo;
349 Buffer *mBuf = NULLP;
351 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
356 if(SAddPstMsgMult((Data *)lchCfgInfo, sizeof(RgPrgUeSCellLchAddInfo),\
359 RGPRG_FREE_MSG(mBuf);
363 pst->event = (Event) EVTPRGUESCELLLCHADDREQ;
364 return (SPstTsk(pst,mBuf));
368 * @brief LCH Addition Req from PMac to SMac.
369 * @details This primitive is used for light-weight loose coupling.
373 * Function : cmUnpkPrgPMacSMacUeSCellLchAddReq
375 * @param[in] Pst* pst
376 * @param[in] RgPrgUeSCellLchAddInfo *lchCfgInfo
377 * @param[in]Buffer *mBuf
382 S16 cmUnpkPrgPMacSMacUeSCellLchAddReq
384 RgPrgUeSCellLchAddInfo func,
389 S16 cmUnpkPrgPMacSMacUeSCellLchAddReq(func, pst, mBuf)
390 RgPrgUeSCellLchAddInfo func;
395 RgPrgLchRecfgInfo lchCfgInfo;
397 if(SRemPreMsgMult((Data *)&lchCfgInfo, sizeof(RgPrgUeSCellLchAddInfo), mBuf) != ROK)
399 RGPRG_FREE_MSG(mBuf);
403 RGPRG_FREE_MSG(mBuf);
404 return ((*func)(pst, &lchCfgInfo));
408 * @brief Ue SCell Delete Req from PMac to SMac.
409 * @details This primitive is used for light-weight loose coupling.
413 * Function : cmPkPrgPMacSMacUeSCellLchDelReq
415 * @param[in] Pst *pst
416 * @param[in] RgPrgUeSCellLchDelInfo *delLcCb
421 S16 cmPkPrgPMacSMacUeSCellLchDelReq
424 RgPrgUeSCellLchDelInfo *delLcCb
427 S16 cmPkPrgPMacSMacUeSCellLchDelReq(pst, delLcCb)
429 RgPrgUeSCellLchDelInfo *delLcCb;
432 Buffer *mBuf = NULLP;
434 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
439 if(SAddPstMsgMult((Data *)delLcCb, sizeof(RgPrgUeSCellLchDelInfo),\
442 RGPRG_FREE_MSG(mBuf);
446 pst->event = (Event) EVTPRGUESCELLLCHDELREQ;
447 return (SPstTsk(pst,mBuf));
452 * @brief Ue Lch reCfg Req from PMac to SMac.
453 * @details This primitive is used for light-weight loose coupling.
457 * Function : cmPkPrgPMacSMacUeSCellLchModReq
459 * @param[in] Pst *pst
460 * @param[in] RgPrgUeSCellLchModInfo *lchCfgInfo
465 S16 cmPkPrgPMacSMacUeSCellLchModReq
468 RgPrgUeSCellLchModInfo *lchCfgInfo
471 S16 cmPkPrgPMacSMacUeSCellLchModReq(pst, lchCfgInfo)
473 RgPrgUeSCellLchModInfo *lchCfgInfo;
476 Buffer *mBuf = NULLP;
478 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
483 if(SAddPstMsgMult((Data *)lchCfgInfo, sizeof(RgPrgUeSCellLchModInfo),\
486 RGPRG_FREE_MSG(mBuf);
490 pst->event = (Event) EVTPRGUESCELLLCHMODREQ;
491 return (SPstTsk(pst,mBuf));
496 * @brief LCH Cfg Req from PMac to SMac.
497 * @details This primitive is used for light-weight loose coupling.
501 * Function : cmUnpkPrgPMacSMacUeSCellLchModReq
503 * @param[in] Pst* pst
504 * @param[in] RgPrgLchRecfgInfo *lchCfgInfo
505 * @param[in] Buffer *mBuf
510 S16 cmUnpkPrgPMacSMacUeSCellLchModReq
512 RgPrgUeScellModLchReq func,
517 S16 cmUnpkPrgPMacSMacAddLchCfgReq(func, pst, mBuf)
518 RgPrgUeScellModLchReq func;
523 RgPrgUeSCellLchModInfo lchCfgInfo;
525 if(SRemPreMsgMult((Data *)&lchCfgInfo, sizeof(RgPrgUeSCellLchModInfo), mBuf) != ROK)
527 RGPRG_FREE_MSG(mBuf);
531 RGPRG_FREE_MSG(mBuf);
532 return ((*func)(pst, &lchCfgInfo));
537 * @brief LCH Del Req from PMac to SMac.
538 * @details This primitive is used for light-weight loose coupling.
542 * Function : cmUnpkPrgPMacSMacUeSCellLchDelReq
544 * @param[in] Pst* pst
545 * @param[in] RgPrgUeScellDelLchReq func;
546 * @param[in] Buffer *mBuf;
551 S16 cmUnpkPrgPMacSMacUeSCellLchDelReq
553 RgPrgUeScellDelLchReq func,
558 S16 cmUnpkPrgPMacSMacUeSCellLchDelReq(func, pst, mBuf)
559 RgPrgUeScellDelLchReq func;
564 RgPrgUeSCellLchDelInfo lchCfgInfo;
566 if(SRemPreMsgMult((Data *)&lchCfgInfo, sizeof(RgPrgUeSCellLchDelInfo), mBuf) != ROK)
568 RGPRG_FREE_MSG(mBuf);
572 RGPRG_FREE_MSG(mBuf);
573 return ((*func)(pst, &lchCfgInfo));
579 /**********************************************************************
582 **********************************************************************/