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 "envopt.h" /* environment options */
33 #include "envdep.h" /* environment dependent */
34 #include "envind.h" /* environment independent */
35 #include "gen.h" /* general layer */
36 #include "ssi.h" /* system service interface */
37 #include "cm_hash.h" /* common hash list */
38 #include "cm_mblk.h" /* common memory link list library */
39 #include "cm_llist.h" /* common linked list library */
40 #include "cm_err.h" /* common error */
41 #include "cm_lte.h" /* common LTE */
46 #include "rg_sch_inf.h"
52 /* header/extern include files (.x) */
53 #include "gen.x" /* general layer typedefs */
54 #include "ssi.x" /* system services typedefs */
55 #include "cm5.x" /* common timers */
56 #include "cm_hash.x" /* common hash list */
57 #include "cm_lib.x" /* common library */
58 #include "cm_llist.x" /* common linked list */
59 #include "cm_mblk.x" /* memory management */
60 #include "cm_tkns.x" /* common tokens */
61 #include "cm_lte.x" /* common tokens */
62 #include "rgu.x" /* RGU types */
63 #include "tfu.x" /* RGU types */
64 #include "lrg.x" /* layer management typedefs for MAC */
65 #include "crg.x" /* layer management typedefs for MAC */
66 #include "rg_sch_inf.x" /* layer management typedefs for MAC */
67 #include "rg_prg.x" /* Prg(MAC-MAC)interface includes */
68 #include "du_app_mac_inf.h"
69 #include "rg.x" /* typedefs for MAC */
74 * @brief Ue SCell Cfg Req from PMac to SMac.
75 * @details This primitive is used for light-weight loose coupling.
79 * Function : cmPkPrgPMacSMacUeSCellCfgReq
82 * @param[in] RgPrgUeSCellCfgInfo *ueSCellCfgInfo
87 PUBLIC S16 cmPkPrgPMacSMacUeSCellCfgReq
90 RgPrgUeSCellCfgInfo *ueSCellCfgInfo
93 PUBLIC S16 cmPkPrgPMacSMacUeSCellCfgReq(pst, ueSCellCfgInfo)
95 RgPrgUeSCellCfgInfo *ueSCellCfgInfo;
100 TRC2(cmPkPrgPMacSMacUeSCellCfgReq)
102 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
107 if(SAddPstMsgMult((Data *)ueSCellCfgInfo, sizeof(RgPrgUeSCellCfgInfo),\
110 RGPRG_FREE_MSG(mBuf);
114 pst->event = (Event) EVTPRGUESCELLCFGREQ;
115 RETVALUE(SPstTsk(pst,mBuf));
119 * @brief Ue SCell Cfg Req from PMac to SMac.
120 * @details This primitive is used for light-weight loose coupling.
124 * Function : cmUnpkPrgPMacSMacUeSCellCfgReq
126 * @param[in] Pst* pst
127 * @param[in] RgPrgUeSCellCfgInfo *ueSCellCfgInfo
132 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellCfgReq
134 RgPrgUeSCellCfgReq func,
139 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellCfgReq(func, pst, mBuf)
140 RgPrgUeSCellCfgReq func;
145 RgPrgUeSCellCfgInfo ueSCellCfgInfo;
147 TRC2(cmUnpkPrgPMacSMacUeSCellCfgReq)
149 if(SRemPreMsgMult((Data *)&ueSCellCfgInfo, sizeof(RgPrgUeSCellCfgInfo), mBuf) != ROK)
151 RGPRG_FREE_MSG(mBuf);
155 RGPRG_FREE_MSG(mBuf);
156 RETVALUE((*func)(pst, &ueSCellCfgInfo));
160 * @brief Config confirm for Ue SCell config Req.
161 * @details This primitive is used for light-weight loose coupling.
165 * Function : cmPkPrgSMacPMacCfgCfm
167 * @param[in] Pst *pst
168 * @param[in] RgPrgCfgCfmInfo *cfgCfm
173 PUBLIC S16 cmPkPrgSMacPMacCfgCfm
176 RgPrgCfgCfmInfo *cfgCfm
179 PUBLIC S16 cmPkPrgSMacPMacCfgCfm(pst, cfgCfm)
181 RgPrgCfgCfmInfo *cfgCfm;
184 Buffer *mBuf = NULLP;
186 TRC2(cmPkPrgSMacPMacCfgCfm)
188 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
193 if(SAddPstMsgMult((Data *)cfgCfm, sizeof(RgPrgCfgCfmInfo), mBuf) != ROK)
195 RGPRG_FREE_MSG(mBuf);
198 switch(cfgCfm->event)
200 case EVTPRGUESCELLLCHMODCFM : /*cfm for Lch recfg */
202 pst->event = (Event) EVTPRGUESCELLLCHMODCFM;
205 case EVTPRGUESCELLCFGCFM : /*cfm for Adding Scell */
207 pst->event = (Event) EVTPRGUESCELLCFGCFM;
210 case EVTPRGUESCELLLCHDELCFM : /* cfm for deleting Lch */
212 pst->event = (Event) EVTPRGUESCELLLCHDELCFM;
215 case EVTPRGUESCELLLCHADDCFM: /* cfm for adding of LCh */
217 pst->event = (Event) EVTPRGUESCELLLCHADDCFM;
221 RETVALUE(SPstTsk(pst,mBuf));
225 * @brief Config confirm for SCell addd Req.
226 * @details This primitive is used for light-weight loose coupling.
230 * Function : cmUnpkPrgSMacPMacCfgCfm
232 * @param[in] CfgCfm fun
233 * @param[in] Pst* pst
234 * @param[in] RgPrgCfgCfmInfo *cfgCfm
239 PUBLIC S16 cmUnpkPrgSMacPMacCfgCfm
241 RgSMacPMacCfgCfm func,
246 PUBLIC S16 cmUnpkPrgSMacPMacCfgCfm(func, pst, mBuf)
247 RgSMacPMacCfgCfm func;
252 RgPrgCfgCfmInfo cfgCfm;
254 TRC2(cmUnpkPrgSMacPMacCfgCfm)
256 if(SRemPreMsgMult((Data *)&cfgCfm, sizeof(RgPrgCfgCfmInfo), mBuf) != ROK)
258 RGPRG_FREE_MSG(mBuf);
262 RGPRG_FREE_MSG(mBuf);
263 RETVALUE((*func)(pst, &cfgCfm));
267 * @brief SCell Ue Delete Req/UeId change req from PMac to SMac.
268 * @details This primitive is used for light-weight loose coupling.
272 * Function : cmPkPrgPMacSMacUeSCellDelReq
274 * @param[in] Pst *pst
275 * @param[in] RgPrgUeSCellDelInfo *ueSCellDelInfo
280 PUBLIC S16 cmPkPrgPMacSMacUeSCellDelReq
283 RgPrgUeSCellDelInfo *ueSCellDelInfo
286 PUBLIC S16 cmPkPrgPMacSMacUeSCellDelReq(pst, ueSCellDelInfo)
288 RgPrgUeSCellDelInfo *ueSCellDelInfo;
291 Buffer *mBuf = NULLP;
293 TRC2(cmPkPrgPMacSMacUeSCellDelReq)
295 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
300 if(SAddPstMsgMult((Data *)ueSCellDelInfo, sizeof(RgPrgUeSCellDelInfo), mBuf)\
303 RGPRG_FREE_MSG(mBuf);
307 pst->event = (Event) EVTPRGUESCELLDELREQ;
308 RETVALUE(SPstTsk(pst,mBuf));
312 * @brief Unpacking for SCell UE delete/Ue Id Change Req to SMAC.
313 * @details This primitive is used for light-weight loose coupling.
317 * Function : cmUnpkPrgPMacSMacUeSCellDelReq
319 * @param[in] CfgCfm fun
320 * @param[in] Pst* pst
321 * @param[in] Buffer *mBuf
326 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellDelReq
328 RgUeSCellDelReq func,
333 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellDelReq(func, pst, mBuf)
334 RgUeSCellDelReq func;
339 RgPrgUeSCellDelInfo ueSCellDelInfo;
341 TRC2(cmUnpkPrgPMacSMacUeSCellDelReq)
343 if(SRemPreMsgMult((Data *)&ueSCellDelInfo, sizeof(RgPrgUeSCellDelInfo),\
346 RGPRG_FREE_MSG(mBuf);
350 RGPRG_FREE_MSG(mBuf);
351 RETVALUE((*func)(pst, &ueSCellDelInfo));
355 * @brief Ue Lch Addition Req from PMac to SMac.
356 * @details This primitive is used for light-weight loose coupling.
360 * Function : cmPkPrgPMacSMacUeSCellLchAddReq
362 * @param[in] Pst* pst
363 * @param[in] RgPrgUeSCellLchAddInfo *lchCfgInfo
368 PUBLIC S16 cmPkPrgPMacSMacUeSCellLchAddReq
371 RgPrgUeSCellLchAddInfo *lchCfgInfo,
374 PUBLIC S16 cmPkPrgPMacSMacUeSCellLchAddReq(pst, lchCfgInfo)
376 RgPrgUeSCellLchAddInfo *lchCfgInfo;
379 Buffer *mBuf = NULLP;
381 TRC2(cmPkPrgPMacSMacUeSCellLchAddReq)
383 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
388 if(SAddPstMsgMult((Data *)lchCfgInfo, sizeof(RgPrgUeSCellLchAddInfo),\
391 RGPRG_FREE_MSG(mBuf);
395 pst->event = (Event) EVTPRGUESCELLLCHADDREQ;
396 RETVALUE(SPstTsk(pst,mBuf));
400 * @brief LCH Addition Req from PMac to SMac.
401 * @details This primitive is used for light-weight loose coupling.
405 * Function : cmUnpkPrgPMacSMacUeSCellLchAddReq
407 * @param[in] Pst* pst
408 * @param[in] RgPrgUeSCellLchAddInfo *lchCfgInfo
409 * @param[in]Buffer *mBuf
414 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellLchAddReq
416 RgPrgUeSCellLchAddInfo func,
421 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellLchAddReq(func, pst, mBuf)
422 RgPrgUeSCellLchAddInfo func;
427 RgPrgLchRecfgInfo lchCfgInfo;
429 TRC2(cmUnpkPrgPMacSMacUeSCellLchAddReq)
431 if(SRemPreMsgMult((Data *)&lchCfgInfo, sizeof(RgPrgUeSCellLchAddInfo), mBuf) != ROK)
433 RGPRG_FREE_MSG(mBuf);
437 RGPRG_FREE_MSG(mBuf);
438 RETVALUE((*func)(pst, &lchCfgInfo));
442 * @brief Ue SCell Delete Req from PMac to SMac.
443 * @details This primitive is used for light-weight loose coupling.
447 * Function : cmPkPrgPMacSMacUeSCellLchDelReq
449 * @param[in] Pst *pst
450 * @param[in] RgPrgUeSCellLchDelInfo *delLcCb
455 PUBLIC S16 cmPkPrgPMacSMacUeSCellLchDelReq
458 RgPrgUeSCellLchDelInfo *delLcCb
461 PUBLIC S16 cmPkPrgPMacSMacUeSCellLchDelReq(pst, delLcCb)
463 RgPrgUeSCellLchDelInfo *delLcCb;
466 Buffer *mBuf = NULLP;
468 TRC2(cmPkPrgPMacSMacUeSCellLchDelReq)
470 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
475 if(SAddPstMsgMult((Data *)delLcCb, sizeof(RgPrgUeSCellLchDelInfo),\
478 RGPRG_FREE_MSG(mBuf);
482 pst->event = (Event) EVTPRGUESCELLLCHDELREQ;
483 RETVALUE(SPstTsk(pst,mBuf));
488 * @brief Ue Lch reCfg Req from PMac to SMac.
489 * @details This primitive is used for light-weight loose coupling.
493 * Function : cmPkPrgPMacSMacUeSCellLchModReq
495 * @param[in] Pst *pst
496 * @param[in] RgPrgUeSCellLchModInfo *lchCfgInfo
501 PUBLIC S16 cmPkPrgPMacSMacUeSCellLchModReq
504 RgPrgUeSCellLchModInfo *lchCfgInfo
507 PUBLIC S16 cmPkPrgPMacSMacUeSCellLchModReq(pst, lchCfgInfo)
509 RgPrgUeSCellLchModInfo *lchCfgInfo;
512 Buffer *mBuf = NULLP;
514 TRC2(cmPkPrgPMacSMacUeSCellLchModReq)
516 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
521 if(SAddPstMsgMult((Data *)lchCfgInfo, sizeof(RgPrgUeSCellLchModInfo),\
524 RGPRG_FREE_MSG(mBuf);
528 pst->event = (Event) EVTPRGUESCELLLCHMODREQ;
529 RETVALUE(SPstTsk(pst,mBuf));
534 * @brief LCH Cfg Req from PMac to SMac.
535 * @details This primitive is used for light-weight loose coupling.
539 * Function : cmUnpkPrgPMacSMacUeSCellLchModReq
541 * @param[in] Pst* pst
542 * @param[in] RgPrgLchRecfgInfo *lchCfgInfo
543 * @param[in] Buffer *mBuf
548 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellLchModReq
550 RgPrgUeScellModLchReq func,
555 PUBLIC S16 cmUnpkPrgPMacSMacAddLchCfgReq(func, pst, mBuf)
556 RgPrgUeScellModLchReq func;
561 RgPrgUeSCellLchModInfo lchCfgInfo;
563 TRC2(cmUnpkPrgPMacSMacAddLchCfgReq)
565 if(SRemPreMsgMult((Data *)&lchCfgInfo, sizeof(RgPrgUeSCellLchModInfo), mBuf) != ROK)
567 RGPRG_FREE_MSG(mBuf);
571 RGPRG_FREE_MSG(mBuf);
572 RETVALUE((*func)(pst, &lchCfgInfo));
577 * @brief LCH Del Req from PMac to SMac.
578 * @details This primitive is used for light-weight loose coupling.
582 * Function : cmUnpkPrgPMacSMacUeSCellLchDelReq
584 * @param[in] Pst* pst
585 * @param[in] RgPrgUeScellDelLchReq func;
586 * @param[in] Buffer *mBuf;
591 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellLchDelReq
593 RgPrgUeScellDelLchReq func,
598 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellLchDelReq(func, pst, mBuf)
599 RgPrgUeScellDelLchReq func;
604 RgPrgUeSCellLchDelInfo lchCfgInfo;
606 TRC2(cmUnpkPrgPMacSMacUeSCellLchDelReq)
608 if(SRemPreMsgMult((Data *)&lchCfgInfo, sizeof(RgPrgUeSCellLchDelInfo), mBuf) != ROK)
610 RGPRG_FREE_MSG(mBuf);
614 RGPRG_FREE_MSG(mBuf);
615 RETVALUE((*func)(pst, &lchCfgInfo));
621 /**********************************************************************
624 **********************************************************************/