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 PUBLIC S16 cmPkPrgPMacSMacUeSCellCfgReq
72 RgPrgUeSCellCfgInfo *ueSCellCfgInfo
75 PUBLIC S16 cmPkPrgPMacSMacUeSCellCfgReq(pst, ueSCellCfgInfo)
77 RgPrgUeSCellCfgInfo *ueSCellCfgInfo;
82 TRC2(cmPkPrgPMacSMacUeSCellCfgReq)
84 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
89 if(SAddPstMsgMult((Data *)ueSCellCfgInfo, sizeof(RgPrgUeSCellCfgInfo),\
96 pst->event = (Event) EVTPRGUESCELLCFGREQ;
97 RETVALUE(SPstTsk(pst,mBuf));
101 * @brief Ue SCell Cfg Req from PMac to SMac.
102 * @details This primitive is used for light-weight loose coupling.
106 * Function : cmUnpkPrgPMacSMacUeSCellCfgReq
108 * @param[in] Pst* pst
109 * @param[in] RgPrgUeSCellCfgInfo *ueSCellCfgInfo
114 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellCfgReq
116 RgPrgUeSCellCfgReq func,
121 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellCfgReq(func, pst, mBuf)
122 RgPrgUeSCellCfgReq func;
127 RgPrgUeSCellCfgInfo ueSCellCfgInfo;
129 TRC2(cmUnpkPrgPMacSMacUeSCellCfgReq)
131 if(SRemPreMsgMult((Data *)&ueSCellCfgInfo, sizeof(RgPrgUeSCellCfgInfo), mBuf) != ROK)
133 RGPRG_FREE_MSG(mBuf);
137 RGPRG_FREE_MSG(mBuf);
138 RETVALUE((*func)(pst, &ueSCellCfgInfo));
142 * @brief Config confirm for Ue SCell config Req.
143 * @details This primitive is used for light-weight loose coupling.
147 * Function : cmPkPrgSMacPMacCfgCfm
149 * @param[in] Pst *pst
150 * @param[in] RgPrgCfgCfmInfo *cfgCfm
155 PUBLIC S16 cmPkPrgSMacPMacCfgCfm
158 RgPrgCfgCfmInfo *cfgCfm
161 PUBLIC S16 cmPkPrgSMacPMacCfgCfm(pst, cfgCfm)
163 RgPrgCfgCfmInfo *cfgCfm;
166 Buffer *mBuf = NULLP;
168 TRC2(cmPkPrgSMacPMacCfgCfm)
170 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
175 if(SAddPstMsgMult((Data *)cfgCfm, sizeof(RgPrgCfgCfmInfo), mBuf) != ROK)
177 RGPRG_FREE_MSG(mBuf);
180 switch(cfgCfm->event)
182 case EVTPRGUESCELLLCHMODCFM : /*cfm for Lch recfg */
184 pst->event = (Event) EVTPRGUESCELLLCHMODCFM;
187 case EVTPRGUESCELLCFGCFM : /*cfm for Adding Scell */
189 pst->event = (Event) EVTPRGUESCELLCFGCFM;
192 case EVTPRGUESCELLLCHDELCFM : /* cfm for deleting Lch */
194 pst->event = (Event) EVTPRGUESCELLLCHDELCFM;
197 case EVTPRGUESCELLLCHADDCFM: /* cfm for adding of LCh */
199 pst->event = (Event) EVTPRGUESCELLLCHADDCFM;
203 RETVALUE(SPstTsk(pst,mBuf));
207 * @brief Config confirm for SCell addd Req.
208 * @details This primitive is used for light-weight loose coupling.
212 * Function : cmUnpkPrgSMacPMacCfgCfm
214 * @param[in] CfgCfm fun
215 * @param[in] Pst* pst
216 * @param[in] RgPrgCfgCfmInfo *cfgCfm
221 PUBLIC S16 cmUnpkPrgSMacPMacCfgCfm
223 RgSMacPMacCfgCfm func,
228 PUBLIC S16 cmUnpkPrgSMacPMacCfgCfm(func, pst, mBuf)
229 RgSMacPMacCfgCfm func;
234 RgPrgCfgCfmInfo cfgCfm;
236 TRC2(cmUnpkPrgSMacPMacCfgCfm)
238 if(SRemPreMsgMult((Data *)&cfgCfm, sizeof(RgPrgCfgCfmInfo), mBuf) != ROK)
240 RGPRG_FREE_MSG(mBuf);
244 RGPRG_FREE_MSG(mBuf);
245 RETVALUE((*func)(pst, &cfgCfm));
249 * @brief SCell Ue Delete Req/UeId change req from PMac to SMac.
250 * @details This primitive is used for light-weight loose coupling.
254 * Function : cmPkPrgPMacSMacUeSCellDelReq
256 * @param[in] Pst *pst
257 * @param[in] RgPrgUeSCellDelInfo *ueSCellDelInfo
262 PUBLIC S16 cmPkPrgPMacSMacUeSCellDelReq
265 RgPrgUeSCellDelInfo *ueSCellDelInfo
268 PUBLIC S16 cmPkPrgPMacSMacUeSCellDelReq(pst, ueSCellDelInfo)
270 RgPrgUeSCellDelInfo *ueSCellDelInfo;
273 Buffer *mBuf = NULLP;
275 TRC2(cmPkPrgPMacSMacUeSCellDelReq)
277 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
282 if(SAddPstMsgMult((Data *)ueSCellDelInfo, sizeof(RgPrgUeSCellDelInfo), mBuf)\
285 RGPRG_FREE_MSG(mBuf);
289 pst->event = (Event) EVTPRGUESCELLDELREQ;
290 RETVALUE(SPstTsk(pst,mBuf));
294 * @brief Unpacking for SCell UE delete/Ue Id Change Req to SMAC.
295 * @details This primitive is used for light-weight loose coupling.
299 * Function : cmUnpkPrgPMacSMacUeSCellDelReq
301 * @param[in] CfgCfm fun
302 * @param[in] Pst* pst
303 * @param[in] Buffer *mBuf
308 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellDelReq
310 RgUeSCellDelReq func,
315 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellDelReq(func, pst, mBuf)
316 RgUeSCellDelReq func;
321 RgPrgUeSCellDelInfo ueSCellDelInfo;
323 TRC2(cmUnpkPrgPMacSMacUeSCellDelReq)
325 if(SRemPreMsgMult((Data *)&ueSCellDelInfo, sizeof(RgPrgUeSCellDelInfo),\
328 RGPRG_FREE_MSG(mBuf);
332 RGPRG_FREE_MSG(mBuf);
333 RETVALUE((*func)(pst, &ueSCellDelInfo));
337 * @brief Ue Lch Addition Req from PMac to SMac.
338 * @details This primitive is used for light-weight loose coupling.
342 * Function : cmPkPrgPMacSMacUeSCellLchAddReq
344 * @param[in] Pst* pst
345 * @param[in] RgPrgUeSCellLchAddInfo *lchCfgInfo
350 PUBLIC S16 cmPkPrgPMacSMacUeSCellLchAddReq
353 RgPrgUeSCellLchAddInfo *lchCfgInfo,
356 PUBLIC S16 cmPkPrgPMacSMacUeSCellLchAddReq(pst, lchCfgInfo)
358 RgPrgUeSCellLchAddInfo *lchCfgInfo;
361 Buffer *mBuf = NULLP;
363 TRC2(cmPkPrgPMacSMacUeSCellLchAddReq)
365 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
370 if(SAddPstMsgMult((Data *)lchCfgInfo, sizeof(RgPrgUeSCellLchAddInfo),\
373 RGPRG_FREE_MSG(mBuf);
377 pst->event = (Event) EVTPRGUESCELLLCHADDREQ;
378 RETVALUE(SPstTsk(pst,mBuf));
382 * @brief LCH Addition Req from PMac to SMac.
383 * @details This primitive is used for light-weight loose coupling.
387 * Function : cmUnpkPrgPMacSMacUeSCellLchAddReq
389 * @param[in] Pst* pst
390 * @param[in] RgPrgUeSCellLchAddInfo *lchCfgInfo
391 * @param[in]Buffer *mBuf
396 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellLchAddReq
398 RgPrgUeSCellLchAddInfo func,
403 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellLchAddReq(func, pst, mBuf)
404 RgPrgUeSCellLchAddInfo func;
409 RgPrgLchRecfgInfo lchCfgInfo;
411 TRC2(cmUnpkPrgPMacSMacUeSCellLchAddReq)
413 if(SRemPreMsgMult((Data *)&lchCfgInfo, sizeof(RgPrgUeSCellLchAddInfo), mBuf) != ROK)
415 RGPRG_FREE_MSG(mBuf);
419 RGPRG_FREE_MSG(mBuf);
420 RETVALUE((*func)(pst, &lchCfgInfo));
424 * @brief Ue SCell Delete Req from PMac to SMac.
425 * @details This primitive is used for light-weight loose coupling.
429 * Function : cmPkPrgPMacSMacUeSCellLchDelReq
431 * @param[in] Pst *pst
432 * @param[in] RgPrgUeSCellLchDelInfo *delLcCb
437 PUBLIC S16 cmPkPrgPMacSMacUeSCellLchDelReq
440 RgPrgUeSCellLchDelInfo *delLcCb
443 PUBLIC S16 cmPkPrgPMacSMacUeSCellLchDelReq(pst, delLcCb)
445 RgPrgUeSCellLchDelInfo *delLcCb;
448 Buffer *mBuf = NULLP;
450 TRC2(cmPkPrgPMacSMacUeSCellLchDelReq)
452 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
457 if(SAddPstMsgMult((Data *)delLcCb, sizeof(RgPrgUeSCellLchDelInfo),\
460 RGPRG_FREE_MSG(mBuf);
464 pst->event = (Event) EVTPRGUESCELLLCHDELREQ;
465 RETVALUE(SPstTsk(pst,mBuf));
470 * @brief Ue Lch reCfg Req from PMac to SMac.
471 * @details This primitive is used for light-weight loose coupling.
475 * Function : cmPkPrgPMacSMacUeSCellLchModReq
477 * @param[in] Pst *pst
478 * @param[in] RgPrgUeSCellLchModInfo *lchCfgInfo
483 PUBLIC S16 cmPkPrgPMacSMacUeSCellLchModReq
486 RgPrgUeSCellLchModInfo *lchCfgInfo
489 PUBLIC S16 cmPkPrgPMacSMacUeSCellLchModReq(pst, lchCfgInfo)
491 RgPrgUeSCellLchModInfo *lchCfgInfo;
494 Buffer *mBuf = NULLP;
496 TRC2(cmPkPrgPMacSMacUeSCellLchModReq)
498 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
503 if(SAddPstMsgMult((Data *)lchCfgInfo, sizeof(RgPrgUeSCellLchModInfo),\
506 RGPRG_FREE_MSG(mBuf);
510 pst->event = (Event) EVTPRGUESCELLLCHMODREQ;
511 RETVALUE(SPstTsk(pst,mBuf));
516 * @brief LCH Cfg Req from PMac to SMac.
517 * @details This primitive is used for light-weight loose coupling.
521 * Function : cmUnpkPrgPMacSMacUeSCellLchModReq
523 * @param[in] Pst* pst
524 * @param[in] RgPrgLchRecfgInfo *lchCfgInfo
525 * @param[in] Buffer *mBuf
530 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellLchModReq
532 RgPrgUeScellModLchReq func,
537 PUBLIC S16 cmUnpkPrgPMacSMacAddLchCfgReq(func, pst, mBuf)
538 RgPrgUeScellModLchReq func;
543 RgPrgUeSCellLchModInfo lchCfgInfo;
545 TRC2(cmUnpkPrgPMacSMacAddLchCfgReq)
547 if(SRemPreMsgMult((Data *)&lchCfgInfo, sizeof(RgPrgUeSCellLchModInfo), mBuf) != ROK)
549 RGPRG_FREE_MSG(mBuf);
553 RGPRG_FREE_MSG(mBuf);
554 RETVALUE((*func)(pst, &lchCfgInfo));
559 * @brief LCH Del Req from PMac to SMac.
560 * @details This primitive is used for light-weight loose coupling.
564 * Function : cmUnpkPrgPMacSMacUeSCellLchDelReq
566 * @param[in] Pst* pst
567 * @param[in] RgPrgUeScellDelLchReq func;
568 * @param[in] Buffer *mBuf;
573 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellLchDelReq
575 RgPrgUeScellDelLchReq func,
580 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellLchDelReq(func, pst, mBuf)
581 RgPrgUeScellDelLchReq func;
586 RgPrgUeSCellLchDelInfo lchCfgInfo;
588 TRC2(cmUnpkPrgPMacSMacUeSCellLchDelReq)
590 if(SRemPreMsgMult((Data *)&lchCfgInfo, sizeof(RgPrgUeSCellLchDelInfo), mBuf) != ROK)
592 RGPRG_FREE_MSG(mBuf);
596 RGPRG_FREE_MSG(mBuf);
597 RETVALUE((*func)(pst, &lchCfgInfo));
603 /**********************************************************************
606 **********************************************************************/