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 "rg.x" /* typedefs for MAC */
73 * @brief Ue SCell Cfg Req from PMac to SMac.
74 * @details This primitive is used for light-weight loose coupling.
78 * Function : cmPkPrgPMacSMacUeSCellCfgReq
81 * @param[in] RgPrgUeSCellCfgInfo *ueSCellCfgInfo
86 PUBLIC S16 cmPkPrgPMacSMacUeSCellCfgReq
89 RgPrgUeSCellCfgInfo *ueSCellCfgInfo
92 PUBLIC S16 cmPkPrgPMacSMacUeSCellCfgReq(pst, ueSCellCfgInfo)
94 RgPrgUeSCellCfgInfo *ueSCellCfgInfo;
99 TRC2(cmPkPrgPMacSMacUeSCellCfgReq)
101 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
106 if(SAddPstMsgMult((Data *)ueSCellCfgInfo, sizeof(RgPrgUeSCellCfgInfo),\
109 RGPRG_FREE_MSG(mBuf);
113 pst->event = (Event) EVTPRGUESCELLCFGREQ;
114 RETVALUE(SPstTsk(pst,mBuf));
118 * @brief Ue SCell Cfg Req from PMac to SMac.
119 * @details This primitive is used for light-weight loose coupling.
123 * Function : cmUnpkPrgPMacSMacUeSCellCfgReq
125 * @param[in] Pst* pst
126 * @param[in] RgPrgUeSCellCfgInfo *ueSCellCfgInfo
131 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellCfgReq
133 RgPrgUeSCellCfgReq func,
138 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellCfgReq(func, pst, mBuf)
139 RgPrgUeSCellCfgReq func;
144 RgPrgUeSCellCfgInfo ueSCellCfgInfo;
146 TRC2(cmUnpkPrgPMacSMacUeSCellCfgReq)
148 if(SRemPreMsgMult((Data *)&ueSCellCfgInfo, sizeof(RgPrgUeSCellCfgInfo), mBuf) != ROK)
150 RGPRG_FREE_MSG(mBuf);
154 RGPRG_FREE_MSG(mBuf);
155 RETVALUE((*func)(pst, &ueSCellCfgInfo));
159 * @brief Config confirm for Ue SCell config Req.
160 * @details This primitive is used for light-weight loose coupling.
164 * Function : cmPkPrgSMacPMacCfgCfm
166 * @param[in] Pst *pst
167 * @param[in] RgPrgCfgCfmInfo *cfgCfm
172 PUBLIC S16 cmPkPrgSMacPMacCfgCfm
175 RgPrgCfgCfmInfo *cfgCfm
178 PUBLIC S16 cmPkPrgSMacPMacCfgCfm(pst, cfgCfm)
180 RgPrgCfgCfmInfo *cfgCfm;
183 Buffer *mBuf = NULLP;
185 TRC2(cmPkPrgSMacPMacCfgCfm)
187 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
192 if(SAddPstMsgMult((Data *)cfgCfm, sizeof(RgPrgCfgCfmInfo), mBuf) != ROK)
194 RGPRG_FREE_MSG(mBuf);
197 switch(cfgCfm->event)
199 case EVTPRGUESCELLLCHMODCFM : /*cfm for Lch recfg */
201 pst->event = (Event) EVTPRGUESCELLLCHMODCFM;
204 case EVTPRGUESCELLCFGCFM : /*cfm for Adding Scell */
206 pst->event = (Event) EVTPRGUESCELLCFGCFM;
209 case EVTPRGUESCELLLCHDELCFM : /* cfm for deleting Lch */
211 pst->event = (Event) EVTPRGUESCELLLCHDELCFM;
214 case EVTPRGUESCELLLCHADDCFM: /* cfm for adding of LCh */
216 pst->event = (Event) EVTPRGUESCELLLCHADDCFM;
220 RETVALUE(SPstTsk(pst,mBuf));
224 * @brief Config confirm for SCell addd Req.
225 * @details This primitive is used for light-weight loose coupling.
229 * Function : cmUnpkPrgSMacPMacCfgCfm
231 * @param[in] CfgCfm fun
232 * @param[in] Pst* pst
233 * @param[in] RgPrgCfgCfmInfo *cfgCfm
238 PUBLIC S16 cmUnpkPrgSMacPMacCfgCfm
240 RgSMacPMacCfgCfm func,
245 PUBLIC S16 cmUnpkPrgSMacPMacCfgCfm(func, pst, mBuf)
246 RgSMacPMacCfgCfm func;
251 RgPrgCfgCfmInfo cfgCfm;
253 TRC2(cmUnpkPrgSMacPMacCfgCfm)
255 if(SRemPreMsgMult((Data *)&cfgCfm, sizeof(RgPrgCfgCfmInfo), mBuf) != ROK)
257 RGPRG_FREE_MSG(mBuf);
261 RGPRG_FREE_MSG(mBuf);
262 RETVALUE((*func)(pst, &cfgCfm));
266 * @brief SCell Ue Delete Req/UeId change req from PMac to SMac.
267 * @details This primitive is used for light-weight loose coupling.
271 * Function : cmPkPrgPMacSMacUeSCellDelReq
273 * @param[in] Pst *pst
274 * @param[in] RgPrgUeSCellDelInfo *ueSCellDelInfo
279 PUBLIC S16 cmPkPrgPMacSMacUeSCellDelReq
282 RgPrgUeSCellDelInfo *ueSCellDelInfo
285 PUBLIC S16 cmPkPrgPMacSMacUeSCellDelReq(pst, ueSCellDelInfo)
287 RgPrgUeSCellDelInfo *ueSCellDelInfo;
290 Buffer *mBuf = NULLP;
292 TRC2(cmPkPrgPMacSMacUeSCellDelReq)
294 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
299 if(SAddPstMsgMult((Data *)ueSCellDelInfo, sizeof(RgPrgUeSCellDelInfo), mBuf)\
302 RGPRG_FREE_MSG(mBuf);
306 pst->event = (Event) EVTPRGUESCELLDELREQ;
307 RETVALUE(SPstTsk(pst,mBuf));
311 * @brief Unpacking for SCell UE delete/Ue Id Change Req to SMAC.
312 * @details This primitive is used for light-weight loose coupling.
316 * Function : cmUnpkPrgPMacSMacUeSCellDelReq
318 * @param[in] CfgCfm fun
319 * @param[in] Pst* pst
320 * @param[in] Buffer *mBuf
325 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellDelReq
327 RgUeSCellDelReq func,
332 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellDelReq(func, pst, mBuf)
333 RgUeSCellDelReq func;
338 RgPrgUeSCellDelInfo ueSCellDelInfo;
340 TRC2(cmUnpkPrgPMacSMacUeSCellDelReq)
342 if(SRemPreMsgMult((Data *)&ueSCellDelInfo, sizeof(RgPrgUeSCellDelInfo),\
345 RGPRG_FREE_MSG(mBuf);
349 RGPRG_FREE_MSG(mBuf);
350 RETVALUE((*func)(pst, &ueSCellDelInfo));
354 * @brief Ue Lch Addition Req from PMac to SMac.
355 * @details This primitive is used for light-weight loose coupling.
359 * Function : cmPkPrgPMacSMacUeSCellLchAddReq
361 * @param[in] Pst* pst
362 * @param[in] RgPrgUeSCellLchAddInfo *lchCfgInfo
367 PUBLIC S16 cmPkPrgPMacSMacUeSCellLchAddReq
370 RgPrgUeSCellLchAddInfo *lchCfgInfo,
373 PUBLIC S16 cmPkPrgPMacSMacUeSCellLchAddReq(pst, lchCfgInfo)
375 RgPrgUeSCellLchAddInfo *lchCfgInfo;
378 Buffer *mBuf = NULLP;
380 TRC2(cmPkPrgPMacSMacUeSCellLchAddReq)
382 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
387 if(SAddPstMsgMult((Data *)lchCfgInfo, sizeof(RgPrgUeSCellLchAddInfo),\
390 RGPRG_FREE_MSG(mBuf);
394 pst->event = (Event) EVTPRGUESCELLLCHADDREQ;
395 RETVALUE(SPstTsk(pst,mBuf));
399 * @brief LCH Addition Req from PMac to SMac.
400 * @details This primitive is used for light-weight loose coupling.
404 * Function : cmUnpkPrgPMacSMacUeSCellLchAddReq
406 * @param[in] Pst* pst
407 * @param[in] RgPrgUeSCellLchAddInfo *lchCfgInfo
408 * @param[in]Buffer *mBuf
413 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellLchAddReq
415 RgPrgUeSCellLchAddInfo func,
420 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellLchAddReq(func, pst, mBuf)
421 RgPrgUeSCellLchAddInfo func;
426 RgPrgLchRecfgInfo lchCfgInfo;
428 TRC2(cmUnpkPrgPMacSMacUeSCellLchAddReq)
430 if(SRemPreMsgMult((Data *)&lchCfgInfo, sizeof(RgPrgUeSCellLchAddInfo), mBuf) != ROK)
432 RGPRG_FREE_MSG(mBuf);
436 RGPRG_FREE_MSG(mBuf);
437 RETVALUE((*func)(pst, &lchCfgInfo));
441 * @brief Ue SCell Delete Req from PMac to SMac.
442 * @details This primitive is used for light-weight loose coupling.
446 * Function : cmPkPrgPMacSMacUeSCellLchDelReq
448 * @param[in] Pst *pst
449 * @param[in] RgPrgUeSCellLchDelInfo *delLcCb
454 PUBLIC S16 cmPkPrgPMacSMacUeSCellLchDelReq
457 RgPrgUeSCellLchDelInfo *delLcCb
460 PUBLIC S16 cmPkPrgPMacSMacUeSCellLchDelReq(pst, delLcCb)
462 RgPrgUeSCellLchDelInfo *delLcCb;
465 Buffer *mBuf = NULLP;
467 TRC2(cmPkPrgPMacSMacUeSCellLchDelReq)
469 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
474 if(SAddPstMsgMult((Data *)delLcCb, sizeof(RgPrgUeSCellLchDelInfo),\
477 RGPRG_FREE_MSG(mBuf);
481 pst->event = (Event) EVTPRGUESCELLLCHDELREQ;
482 RETVALUE(SPstTsk(pst,mBuf));
487 * @brief Ue Lch reCfg Req from PMac to SMac.
488 * @details This primitive is used for light-weight loose coupling.
492 * Function : cmPkPrgPMacSMacUeSCellLchModReq
494 * @param[in] Pst *pst
495 * @param[in] RgPrgUeSCellLchModInfo *lchCfgInfo
500 PUBLIC S16 cmPkPrgPMacSMacUeSCellLchModReq
503 RgPrgUeSCellLchModInfo *lchCfgInfo
506 PUBLIC S16 cmPkPrgPMacSMacUeSCellLchModReq(pst, lchCfgInfo)
508 RgPrgUeSCellLchModInfo *lchCfgInfo;
511 Buffer *mBuf = NULLP;
513 TRC2(cmPkPrgPMacSMacUeSCellLchModReq)
515 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
520 if(SAddPstMsgMult((Data *)lchCfgInfo, sizeof(RgPrgUeSCellLchModInfo),\
523 RGPRG_FREE_MSG(mBuf);
527 pst->event = (Event) EVTPRGUESCELLLCHMODREQ;
528 RETVALUE(SPstTsk(pst,mBuf));
533 * @brief LCH Cfg Req from PMac to SMac.
534 * @details This primitive is used for light-weight loose coupling.
538 * Function : cmUnpkPrgPMacSMacUeSCellLchModReq
540 * @param[in] Pst* pst
541 * @param[in] RgPrgLchRecfgInfo *lchCfgInfo
542 * @param[in] Buffer *mBuf
547 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellLchModReq
549 RgPrgUeScellModLchReq func,
554 PUBLIC S16 cmUnpkPrgPMacSMacAddLchCfgReq(func, pst, mBuf)
555 RgPrgUeScellModLchReq func;
560 RgPrgUeSCellLchModInfo lchCfgInfo;
562 TRC2(cmUnpkPrgPMacSMacAddLchCfgReq)
564 if(SRemPreMsgMult((Data *)&lchCfgInfo, sizeof(RgPrgUeSCellLchModInfo), mBuf) != ROK)
566 RGPRG_FREE_MSG(mBuf);
570 RGPRG_FREE_MSG(mBuf);
571 RETVALUE((*func)(pst, &lchCfgInfo));
576 * @brief LCH Del Req from PMac to SMac.
577 * @details This primitive is used for light-weight loose coupling.
581 * Function : cmUnpkPrgPMacSMacUeSCellLchDelReq
583 * @param[in] Pst* pst
584 * @param[in] RgPrgUeScellDelLchReq func;
585 * @param[in] Buffer *mBuf;
590 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellLchDelReq
592 RgPrgUeScellDelLchReq func,
597 PUBLIC S16 cmUnpkPrgPMacSMacUeSCellLchDelReq(func, pst, mBuf)
598 RgPrgUeScellDelLchReq func;
603 RgPrgUeSCellLchDelInfo lchCfgInfo;
605 TRC2(cmUnpkPrgPMacSMacUeSCellLchDelReq)
607 if(SRemPreMsgMult((Data *)&lchCfgInfo, sizeof(RgPrgUeSCellLchDelInfo), mBuf) != ROK)
609 RGPRG_FREE_MSG(mBuf);
613 RGPRG_FREE_MSG(mBuf);
614 RETVALUE((*func)(pst, &lchCfgInfo));
620 /**********************************************************************
623 **********************************************************************/