Initial commit for Bronze release
[o-du/l2.git] / src / cm / rgm.c
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
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                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
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 *******************************************************************************/
18 \f
19
20 /************************************************************************
21  
22      Name:     LTE-MAC layer
23   
24      Type:     C source file
25   
26      Desc:     C source code for packing/unpacking of RGM interface
27                primitives.
28   
29      File:     rgm.c 
30   
31 **********************************************************************/
32
33 /** @file rgm.c
34 @brief This file contains the packing/unpacking code for the RGM interface 
35        primitives.
36 */
37
38 /* header include files (.h) */
39 #include "envopt.h"        /* environment options */
40 #include "envdep.h"        /* environment dependent */
41 #include "envind.h"        /* environment independent */
42 #include "gen.h"           /* general */
43 #include "ssi.h"           /* system services */
44 #include "cm_tkns.h"       /* Common Token Defines */
45 #include "cm_llist.h"      /* Common Link List Defines */
46 #include "cm_hash.h"       /* Common Hash List Defines */
47 #include "cm_lte.h"        /* Common LTE Defines */
48 #include "rgm.h"           /* RGM Interface defines */
49
50 /* header/extern include files (.x) */
51 #include "gen.x"           /* general */
52 #include "ssi.x"           /* system services */
53 #include "cm_tkns.x"       /* Common Token Definitions */
54 #include "cm_llist.x"      /* Common Link List Definitions */
55 #include "cm_lib.x"        /* Common Library Definitions */
56 #include "cm_hash.x"       /* Common Hash List Definitions */
57 #include "cm_lte.x"        /* Common LTE Defines */
58 #include "rgm.x"           /* RGM Interface includes */
59
60 #ifdef RGM_LWLC
61
62 \f
63 /**
64 * @brief Request from RRM to MAC to bind the interface saps
65 *
66 * @details
67 *
68 *     Function : cmPkLwLcRgmBndReq
69 *
70 *  @param[in]   Pst*  pst
71 *  @param[in]   SuId  suId
72 *  @param[in]   SpId  spId
73 *  @return   S16
74 *      -# ROK
75 **/
76 #ifdef ANSI
77 PUBLIC S16 cmPkLwLcRgmBndReq
78 (
79 Pst* pst,
80 SuId suId,
81 SpId spId
82 )
83 #else
84 PUBLIC S16 cmPkLwLcRgmBndReq(pst, suId, spId)
85 Pst* pst;
86 SuId suId;
87 SpId spId;
88 #endif
89 {
90    Buffer *mBuf = NULLP;
91    TRC3(cmPkLwLcRgmBndReq)
92
93    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) 
94    {
95       RETVALUE(RFAILED);
96    }
97
98    if (SPkS16(spId, mBuf) != ROK) 
99    {
100       SPutMsg(mBuf);
101       RETVALUE(RFAILED);
102    }
103
104    if (SPkS16(suId, mBuf) != ROK) 
105    {
106       SPutMsg(mBuf);
107       RETVALUE(RFAILED);
108    }
109
110    pst->event = (Event) EVTRGMBNDREQ;
111    RETVALUE(SPstTsk(pst,mBuf));
112 }
113
114 \f
115 /**
116 * @brief Request from RRM to MAC to bind the interface saps
117 *
118 * @details
119 *
120 *     Function : cmUnpkLwLcRgmBndReq
121 *
122 *  @param[in]   Pst*  pst
123 *  @param[in]   SuId  suId
124 *  @param[in]   SpId  spId
125 *  @return   S16
126 *      -# ROK
127 **/
128 #ifdef ANSI
129 PUBLIC S16 cmUnpkLwLcRgmBndReq
130 (
131 RgmBndReq func,
132 Pst *pst,
133 Buffer *mBuf
134 )
135 #else
136 PUBLIC S16 cmUnpkLwLcRgmBndReq(func, pst, mBuf)
137 RgmBndReq func;
138 Pst *pst;
139 Buffer *mBuf;
140 #endif
141 {
142    SuId suId;
143    SpId spId;
144    S16  ret;
145    
146    TRC3(cmUnpkLwLcRgmBndReq)
147
148    if (SUnpkS16(&suId, mBuf) != ROK) 
149    {
150       SPutMsg(mBuf);
151       RETVALUE(RFAILED);
152    }
153
154    if (SUnpkS16(&spId, mBuf) != ROK) 
155    {
156       SPutMsg(mBuf);
157       RETVALUE(RFAILED);
158    }
159
160    ret = ((*func)(pst, suId, spId));
161
162    SPutMsg(mBuf);
163
164    RETVALUE(ret);
165 }
166
167 /**
168 * @brief Request from RRM to MAC to Unbind the interface saps
169 *
170 * @details
171 *
172 *     Function : cmPkLwLcRgmUbndReq
173 *
174 *  @param[in]   Pst*  pst
175 *  @param[in]   SpId  spId
176 *  @param[in]   Reason  reason
177 *  @return   S16
178 *      -# ROK
179 **/
180 #ifdef ANSI
181 PUBLIC S16 cmPkLwLcRgmUbndReq
182 (
183 Pst* pst,
184 SpId spId,
185 Reason reason
186 )
187 #else
188 PUBLIC S16 cmPkLwLcRgmUbndReq(pst, spId, reason)
189 Pst* pst;
190 SpId spId;
191 Reason reason;
192 #endif
193 {
194    Buffer *mBuf = NULLP;
195    TRC3(cmPkLwLcRgmUbndReq)
196
197    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) 
198    {
199       RETVALUE(RFAILED);
200    }
201    if (SPkS16(reason, mBuf) != ROK) 
202    {
203       SPutMsg(mBuf);
204       RETVALUE(RFAILED);
205    }
206    if (SPkS16(spId, mBuf) != ROK) 
207    {
208       SPutMsg(mBuf);
209       RETVALUE(RFAILED);
210    }
211
212    pst->event = (Event) EVTRGMUBNDREQ;
213    RETVALUE(SPstTsk(pst,mBuf));
214 }
215
216 /**
217 * @brief Confirmation from MAC to RRM for the bind/Unbind 
218  * request for the interface saps
219 *
220 * @details
221 *
222 *     Function : cmPkLwLcRgmBndCfm
223 *
224 *  @param[in]   Pst*  pst
225 *  @param[in]   SuId  suId
226 *  @param[in]   U8  status
227 *  @return   S16
228 *      -# ROK
229 **/
230 #ifdef ANSI
231 PUBLIC S16 cmPkLwLcRgmBndCfm
232 (
233 Pst* pst,
234 SuId suId,
235 U8 status
236 )
237 #else
238 PUBLIC S16 cmPkLwLcRgmBndCfm(pst, suId, status)
239 Pst* pst;
240 SuId suId;
241 U8 status;
242 #endif
243 {
244    Buffer *mBuf = NULLP;
245    TRC3(cmPkLwLcRgmBndCfm)
246
247    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) 
248    {
249       RETVALUE(RFAILED);
250    }
251
252    if (SPkS16(suId, mBuf) != ROK) 
253    {
254       SPutMsg(mBuf);
255       RETVALUE(RFAILED);
256    }
257
258    if (SPkU8(status, mBuf) != ROK) 
259    {
260       SPutMsg(mBuf);
261       RETVALUE(RFAILED);
262    }
263
264   pst->event = (Event) EVTRGMBNDCFM;
265    RETVALUE(SPstTsk(pst,mBuf));
266 }
267
268 \f
269 /**
270 * @brief Confirmation from MAC to RRM for the bind/Unbind 
271  * request for the interface saps
272 *
273 * @details
274 *
275 *     Function : cmUnpkLwLcRgmBndCfm
276 *
277 *  @param[in]   Pst*  pst
278 *  @param[in]   SuId  suId
279 *  @param[in]   U8  status
280 *  @return   S16
281 *      -# ROK
282 **/
283 #ifdef ANSI
284 PUBLIC S16 cmUnpkLwLcRgmBndCfm
285 (
286 RgmBndCfm func,
287 Pst *pst,
288 Buffer *mBuf
289 )
290 #else
291 PUBLIC S16 cmUnpkLwLcRgmBndCfm(func, pst, mBuf)
292 RgmBndCfm func;
293 Pst *pst;
294 Buffer *mBuf;
295 #endif
296 {
297    SuId suId;
298    U8 status;
299    
300    TRC3(cmUnpkLwLcRgmBndCfm)
301
302    if (SUnpkU8(&status, mBuf) != ROK) 
303    {
304       SPutMsg(mBuf);
305       RETVALUE(RFAILED);
306    }
307
308    if (SUnpkS16(&suId, mBuf) != ROK) 
309    {
310       SPutMsg(mBuf);
311       RETVALUE(RFAILED);
312    }
313    SPutMsg(mBuf);
314    RETVALUE((*func)(pst, suId, status));
315 }
316
317 \f
318 /**
319 * @brief Configure the PRB Report Preparation Start/Stop from RRM to MAC 
320 *
321 * @details
322 *
323 *     Function : cmPkLwLcRgmCfgPrbRprt
324 *
325 *  @param[in]   Pst*  pst
326 *  @param[in]   SpId  spId
327 *  @param[in]   RgmPrbRprtCfg  *  prbRprtCfg
328 *  @return   S16
329 *      -# ROK
330 **/
331 #ifdef ANSI
332 PUBLIC S16 cmPkLwLcRgmCfgPrbRprt
333 (
334 Pst* pst,
335 SpId spId,
336 RgmPrbRprtCfg  * prbRprtCfg
337 )
338 #else
339 PUBLIC S16 cmPkLwLcRgmCfgPrbRprt(pst, spId, prbRprtCfg)
340 Pst* pst;
341 SpId spId;
342 RgmPrbRprtCfg  * prbRprtCfg;
343 #endif
344 {
345    Buffer *mBuf = NULLP;
346    U32 len = sizeof(RgmPrbRprtCfg);
347    TRC3(cmPkLwLcRgmCfgPrbRprt)
348
349    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) 
350    {
351       SPutSBuf(pst->region, pst->pool, (Data *)prbRprtCfg, sizeof(RgmPrbRprtCfg));
352       RETVALUE(RFAILED);
353    }
354
355     if(cmPkPtr((PTR)prbRprtCfg, mBuf) != ROK)
356     {
357        SPutMsg(mBuf); 
358        SPutSBuf(pst->region, pst->pool, (Data*)prbRprtCfg, len);
359        RETVALUE(RFAILED);
360     }
361
362    if (SPkS16(spId, mBuf) != ROK) 
363    {
364       SPutSBuf(pst->region, pst->pool, (Data *)prbRprtCfg, sizeof(RgmPrbRprtCfg));
365       SPutMsg(mBuf);
366       RETVALUE(RFAILED);
367    }
368
369    pst->event = (Event) EVTRGMCFGPRBRPRT;
370    RETVALUE(SPstTsk(pst,mBuf));
371 }
372
373 \f
374 /**
375 * @brief Configure the PRB Report Preparation Start/Stop from RRM to MAC 
376 *
377 * @details
378 *
379 *     Function : cmUnpkLwLcRgmCfgPrbRprt
380 *
381 *  @param[in]   Pst*  pst
382 *  @param[in]   SpId  spId
383 *  @param[in]   RgmPrbRprtCfg  *  prbRprtCfg
384 *  @return   S16
385 *      -# ROK
386 **/
387 #ifdef ANSI
388 PUBLIC S16 cmUnpkLwLcRgmCfgPrbRprt
389 (
390 RgmCfgPrbRprtFptr func,
391 Pst *pst,
392 Buffer *mBuf
393 )
394 #else
395 PUBLIC S16 cmUnpkLwLcRgmCfgPrbRprt(func, pst, mBuf)
396 RgmCfgPrbRprtFptr func;
397 Pst *pst;
398 Buffer *mBuf;
399 #endif
400 {
401    S16 ret;
402    SpId spId;
403    RgmPrbRprtCfg *prbRprtCfg;
404    
405    TRC3(cmUnpkLwLcRgmCfgPrbRprt)
406
407    if (SUnpkS16(&spId, mBuf) != ROK) 
408    {
409       SPutMsg(mBuf);
410       RETVALUE(RFAILED);
411    }
412
413    if (cmUnpkPtr((PTR *)&prbRprtCfg, mBuf) != ROK)
414    {
415       SPutMsg(mBuf);
416       SPutSBuf(pst->region, pst->pool, (Data *)prbRprtCfg, sizeof(RgmPrbRprtCfg));
417       RETVALUE(RFAILED);
418    }
419
420    ret =  ((*func)(pst, spId, prbRprtCfg));
421
422    SPutMsg(mBuf);
423    RETVALUE(ret);
424 }
425
426
427 /**
428 * @brief PRB Usage Report Indication  from MAC to RRM 
429 *
430 * @details
431 *
432 *     Function : cmPkLwLcRgmPrbRprtInd
433 *
434 *  @param[in]   Pst*  pst
435 *  @param[in]   SuId  suId
436 *  @param[in]   RgmPrbRprtInd  *  prbRprtInd
437 *  @return   S16
438 *      -# ROK
439 **/
440 #ifdef ANSI
441 PUBLIC S16 cmPkLwLcRgmPrbRprtInd
442 (
443 Pst* pst,
444 SuId suId,
445 RgmPrbRprtInd  * prbRprtInd
446 )
447 #else
448 PUBLIC S16 cmPkLwLcRgmPrbRprtInd(pst, suId, prbRprtInd)
449 Pst* pst;
450 SuId suId;
451 RgmPrbRprtInd  * prbRprtInd;
452 #endif
453 {
454    Buffer *mBuf = NULLP;
455
456    TRC3(cmPkLwLcRgmPrbRprtInd)
457
458    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
459       SPutSBuf(pst->region, pst->pool, (Data *)prbRprtInd, sizeof(RgmPrbRprtInd));
460       RETVALUE(RFAILED);
461    }
462
463    if(cmPkPtr((PTR)prbRprtInd, mBuf) != ROK)
464    {
465       SPutSBuf(pst->region, pst->pool, (Data *)prbRprtInd, sizeof(RgmPrbRprtInd));
466       SPutMsg(mBuf);
467       RETVALUE(RFAILED);
468    }
469
470    if (SPkS16(suId, mBuf) != ROK) 
471    {
472       SPutSBuf(pst->region, pst->pool, (Data *)prbRprtInd, sizeof(RgmPrbRprtInd));
473       SPutMsg(mBuf);
474       RETVALUE(RFAILED);
475    }
476
477    pst->event = (Event) EVTRGMCFGPRBRPRT;
478    RETVALUE(SPstTsk(pst,mBuf));
479 }
480
481
482 /**
483 * @brief PRB Usage Report Indication from MAC to RRM 
484 *
485 * @details
486 *
487 *     Function : cmUnpkLwLcRgmPrbRprtInd
488 *
489 *  @param[in]   Pst*  pst
490 *  @param[in]   SuId  suId
491 *  @param[in]   RgmPrbRprtInd  *  prbRprtInd
492 *  @return   S16
493 *      -# ROK
494 **/
495 #ifdef ANSI
496 PUBLIC S16 cmUnpkLwLcRgmPrbRprtInd
497 (
498 RgmPrbRprtIndFptr func,
499 Pst *pst,
500 Buffer *mBuf
501 )
502 #else
503 PUBLIC S16 cmUnpkLwLcRgmPrbRprtInd(func, pst, mBuf)
504 RgmPrbRprtIndFptr func;
505 Pst *pst;
506 Buffer *mBuf;
507 #endif
508 {
509    SuId suId;
510    RgmPrbRprtInd *prbRprtInd;
511    S16 ret;
512    
513    TRC3(cmUnpkLwLcRgmPrbRprtInd)
514
515    if (SUnpkS16(&suId, mBuf) != ROK) 
516    {
517       SPutMsg(mBuf);
518       RETVALUE(RFAILED);
519    }
520
521    if (cmUnpkPtr((PTR *)&prbRprtInd, mBuf) != ROK) 
522    {
523       SPutMsg(mBuf);
524       SPutSBuf(pst->region, pst->pool, (Data *)prbRprtInd, sizeof(RgmPrbRprtInd));
525       RETVALUE(RFAILED);
526    }
527
528
529    ret = ((*func)(pst, suId, prbRprtInd));
530
531    SPutMsg(mBuf);
532
533    RETVALUE(ret);
534 }
535 #endif
536
537
538 /**
539 * @brief Request from RRM to MAC to bind the interface saps
540 *
541 * @details
542 *
543 *     Function : cmPkRgmBndReq
544 *
545 *  @param[in]   Pst*  pst
546 *  @param[in]   SuId  suId
547 *  @param[in]   SpId  spId
548 *  @return   S16
549 *      -# ROK
550 **/
551 #ifdef ANSI
552 PUBLIC S16 cmPkRgmBndReq
553 (
554 Pst* pst,
555 SuId suId,
556 SpId spId
557 )
558 #else
559 PUBLIC S16 cmPkRgmBndReq(pst, suId, spId)
560 Pst* pst;
561 SuId suId;
562 SpId spId;
563 #endif
564 {
565    Buffer *mBuf = NULLP;
566    TRC3(cmPkRgmBndReq)
567
568    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) 
569    {
570       RETVALUE(RFAILED);
571    }
572
573    if (SPkS16(spId, mBuf) != ROK) 
574    {
575       SPutMsg(mBuf);
576       RETVALUE(RFAILED);
577    }
578
579    if (SPkS16(suId, mBuf) != ROK) 
580    {
581       SPutMsg(mBuf);
582       RETVALUE(RFAILED);
583    }
584
585    pst->event = (Event) EVTRGMBNDREQ;
586    RETVALUE(SPstTsk(pst,mBuf));
587 }
588
589 \f
590 /**
591 * @brief Request from RRM to MAC to bind the interface saps
592 *
593 * @details
594 *
595 *     Function : cmUnpkRgmBndReq
596 *
597 *  @param[in]   Pst*  pst
598 *  @param[in]   SuId  suId
599 *  @param[in]   SpId  spId
600 *  @return   S16
601 *      -# ROK
602 **/
603 #ifdef ANSI
604 PUBLIC S16 cmUnpkRgmBndReq
605 (
606 RgmBndReq func,
607 Pst *pst,
608 Buffer *mBuf
609 )
610 #else
611 PUBLIC S16 cmUnpkRgmBndReq(func, pst, mBuf)
612 RgmBndReq func;
613 Pst *pst;
614 Buffer *mBuf;
615 #endif
616 {
617    SuId suId;
618    SpId spId;
619    S16  ret;
620    
621    TRC3(cmUnpkRgmBndReq)
622
623    if (SUnpkS16(&suId, mBuf) != ROK) 
624    {
625       SPutMsg(mBuf);
626       RETVALUE(RFAILED);
627    }
628
629    if (SUnpkS16(&spId, mBuf) != ROK) 
630    {
631       SPutMsg(mBuf);
632       RETVALUE(RFAILED);
633    }
634
635    ret = ((*func)(pst, suId, spId));
636
637    SPutMsg(mBuf);
638
639    RETVALUE(ret);
640 }
641
642 /**
643 * @brief Request from RRM to MAC to Unbind the interface saps
644 *
645 * @details
646 *
647 *     Function : cmPkRgmUbndReq
648 *
649 *  @param[in]   Pst*  pst
650 *  @param[in]   SpId  spId
651 *  @param[in]   Reason  reason
652 *  @return   S16
653 *      -# ROK
654 **/
655 #ifdef ANSI
656 PUBLIC S16 cmPkRgmUbndReq
657 (
658 Pst* pst,
659 SpId spId,
660 Reason reason
661 )
662 #else
663 PUBLIC S16 cmPkRgmUbndReq(pst, spId, reason)
664 Pst* pst;
665 SpId spId;
666 Reason reason;
667 #endif
668 {
669    Buffer *mBuf = NULLP;
670    TRC3(cmPkRgmUbndReq)
671
672    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) 
673    {
674       RETVALUE(RFAILED);
675    }
676    if (SPkS16(reason, mBuf) != ROK) 
677    {
678       SPutMsg(mBuf);
679       RETVALUE(RFAILED);
680    }
681    if (SPkS16(spId, mBuf) != ROK) 
682    {
683       SPutMsg(mBuf);
684       RETVALUE(RFAILED);
685    }
686
687    pst->event = (Event) EVTRGMUBNDREQ;
688    RETVALUE(SPstTsk(pst,mBuf));
689 }
690
691 #if 1 
692 \f
693 /**
694 * @brief Request from RRM to MAC to Unbind the interface saps
695 *
696 * @details
697 *
698 *     Function : cmUnpkRgmUbndReq
699 *
700 *  @param[in]   Pst*  pst
701 *  @param[in]   SpId  spId
702 *  @param[in]   Reason  reason
703 *  @return   S16
704 *      -# ROK
705 **/
706 #ifdef ANSI
707 PUBLIC S16 cmUnpkRgmUbndReq
708 (
709 RgmUbndReq func,
710 Pst *pst,
711 Buffer *mBuf
712 )
713 #else
714 PUBLIC S16 cmUnpkRgmUbndReq(func, pst, mBuf)
715 RgmUbndReq func;
716 Pst *pst;
717 Buffer *mBuf;
718 #endif
719 {
720    SpId spId;
721    Reason reason;
722    
723    TRC3(cmUnpkRgmUbndReq)
724
725    if (SUnpkS16(&spId, mBuf) != ROK) 
726    {
727       SPutMsg(mBuf);
728       RETVALUE(RFAILED);
729    }
730    if (SUnpkS16(&reason, mBuf) != ROK)
731    {
732       SPutMsg(mBuf);
733       RETVALUE(RFAILED);
734    }
735    SPutMsg(mBuf);
736    RETVALUE((*func)(pst, spId, reason));
737 }
738 #endif
739
740 /**
741 * @brief Confirmation from MAC to RRM for the bind/Unbind 
742  * request for the interface saps
743 *
744 * @details
745 *
746 *     Function : cmPkRgmBndCfm
747 *
748 *  @param[in]   Pst*  pst
749 *  @param[in]   SuId  suId
750 *  @param[in]   U8  status
751 *  @return   S16
752 *      -# ROK
753 **/
754 #ifdef ANSI
755 PUBLIC S16 cmPkRgmBndCfm
756 (
757 Pst* pst,
758 SuId suId,
759 U8 status
760 )
761 #else
762 PUBLIC S16 cmPkRgmBndCfm(pst, suId, status)
763 Pst* pst;
764 SuId suId;
765 U8 status;
766 #endif
767 {
768    Buffer *mBuf = NULLP;
769    TRC3(cmPkRgmBndCfm)
770
771    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) 
772    {
773       RETVALUE(RFAILED);
774    }
775
776    if (SPkS16(suId, mBuf) != ROK) 
777    {
778       SPutMsg(mBuf);
779       RETVALUE(RFAILED);
780    }
781
782    if (SPkU8(status, mBuf) != ROK) 
783    {
784       SPutMsg(mBuf);
785       RETVALUE(RFAILED);
786    }
787
788   pst->event = (Event) EVTRGMBNDCFM;
789    RETVALUE(SPstTsk(pst,mBuf));
790 }
791
792 \f
793 /**
794 * @brief Confirmation from MAC to RRM for the bind/Unbind 
795  * request for the interface saps
796 *
797 * @details
798 *
799 *     Function : cmUnpkRgmBndCfm
800 *
801 *  @param[in]   Pst*  pst
802 *  @param[in]   SuId  suId
803 *  @param[in]   U8  status
804 *  @return   S16
805 *      -# ROK
806 **/
807 #ifdef ANSI
808 PUBLIC S16 cmUnpkRgmBndCfm
809 (
810 RgmBndCfm func,
811 Pst *pst,
812 Buffer *mBuf
813 )
814 #else
815 PUBLIC S16 cmUnpkRgmBndCfm(func, pst, mBuf)
816 RgmBndCfm func;
817 Pst *pst;
818 Buffer *mBuf;
819 #endif
820 {
821    SuId suId;
822    U8 status;
823    
824    TRC3(cmUnpkRgmBndCfm)
825
826    if (SUnpkU8(&status, mBuf) != ROK) 
827    {
828       SPutMsg(mBuf);
829       RETVALUE(RFAILED);
830    }
831
832    if (SUnpkS16(&suId, mBuf) != ROK) 
833    {
834       SPutMsg(mBuf);
835       RETVALUE(RFAILED);
836    }
837    SPutMsg(mBuf);
838    RETVALUE((*func)(pst, suId, status));
839 }
840
841 \f
842
843
844 /**
845 * @brief Configure the PRB Report Preparation Start/Stop from RRM to MAC 
846 *
847 * @details
848 *
849 *     Function : cmPkCfgPrbRprt
850 *
851 *  @param[in]   RgmPrbRprtCfg  *prbRprtCfg
852 *  @param[in]   Buffer *mBuf 
853 *  @return   S16
854 *      -# ROK
855 **/
856 #ifdef ANSI
857 PUBLIC S16 cmPkCfgPrbRprt
858 (
859 RgmPrbRprtCfg  * prbRprtCfg,
860 Buffer *mBuf
861 )
862 #else
863 PUBLIC S16 cmPkCfgPrbRprt(prbRprtCfg, mBuf)
864 RgmPrbRprtCfg  * prbRprtCfg;
865 Buffer *mBuf;
866 #endif
867 {
868    TRC3(cmPkCfgPrbRprt);
869    CMCHKPK(SPkU16, prbRprtCfg->usPrbAvgPeriodicty, mBuf);
870    CMCHKPK(SPkU8, prbRprtCfg->bConfigType, mBuf);
871    CMCHKPK(SPkU8, prbRprtCfg->bCellId, mBuf);
872    RETVALUE(ROK);
873 }
874 /**
875 * @brief Configure the PRB Report Preparation Start/Stop from RRM to MAC 
876 *
877 * @details
878 *
879 *     Function : cmUnPkCfgPrbRprt
880 *
881 *  @param[in]   RgmPrbRprtCfg  *prbRprtCfg
882 *  @param[in]   Buffer *mBuf 
883 *  @return   S16
884 *      -# ROK
885 **/
886 #ifdef ANSI
887 PUBLIC S16 cmUnPkCfgPrbRprt
888 (
889 RgmPrbRprtCfg  * prbRprtCfg,
890 Buffer *mBuf
891 )
892 #else
893 PUBLIC S16 cmUnPkCfgPrbRprt(prbRprtCfg, mBuf)
894 RgmPrbRprtCfg  * prbRprtCfg;
895 Buffer *mBuf;
896 #endif
897 {
898    TRC3(cmUnPkCfgPrbRprt);
899    CMCHKUNPK(SUnpkU8, &prbRprtCfg->bCellId, mBuf);
900    CMCHKUNPK(SUnpkU8, &prbRprtCfg->bConfigType, mBuf);
901    CMCHKUNPK(SUnpkU16, &prbRprtCfg->usPrbAvgPeriodicty, mBuf);
902    RETVALUE(ROK);
903 }
904
905
906
907 \f
908 /**
909 * @brief Configure the PRB Report Preparation Start/Stop from RRM to MAC 
910 *
911 * @details
912 *
913 *     Function : cmPkRgmCfgPrbRprt
914 *
915 *  @param[in]   Pst*  pst
916 *  @param[in]   SpId  spId
917 *  @param[in]   RgmPrbRprtCfg  *prbRprtCfg
918 *  @return   S16
919 *      -# ROK
920 **/
921 #ifdef ANSI
922 PUBLIC S16 cmPkRgmCfgPrbRprt
923 (
924 Pst* pst,
925 SpId spId,
926 RgmPrbRprtCfg  * prbRprtCfg
927 )
928 #else
929 PUBLIC S16 cmPkRgmCfgPrbRprt(pst, spId, prbRprtCfg)
930 Pst* pst;
931 SpId spId;
932 RgmPrbRprtCfg  * prbRprtCfg;
933 #endif
934 {
935    Buffer *mBuf = NULLP;
936    U32 len = sizeof(RgmPrbRprtCfg);
937    TRC3(cmPkRgmCfgPrbRprt)
938
939    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) 
940    {
941       SPutSBuf(pst->region, pst->pool, (Data *)prbRprtCfg, sizeof(RgmPrbRprtCfg));
942       RETVALUE(RFAILED);
943    }
944
945     if(cmPkCfgPrbRprt(prbRprtCfg, mBuf) != ROK)
946     {
947        SPutMsg(mBuf); 
948        SPutSBuf(pst->region, pst->pool, (Data*)prbRprtCfg, len);
949        RETVALUE(RFAILED);
950     }
951
952    if (SPkS16(spId, mBuf) != ROK) 
953    {
954       SPutSBuf(pst->region, pst->pool, (Data *)prbRprtCfg, sizeof(RgmPrbRprtCfg));
955       SPutMsg(mBuf);
956       RETVALUE(RFAILED);
957    }
958
959    SPutSBuf(pst->region, pst->pool, (Data *)prbRprtCfg, sizeof(RgmPrbRprtCfg));
960
961    pst->event = (Event) EVTRGMCFGPRBRPRT;
962    RETVALUE(SPstTsk(pst,mBuf));
963 }
964
965
966
967 /**
968 * @brief Configure the PRB Report Preparation Start/Stop from RRM to MAC 
969 *
970 * @details
971 *
972 *     Function : cmUnpkRgmCfgPrbRprt
973 *
974 *  @param[in]   Pst*  pst
975 *  @param[in]   SpId  spId
976 *  @param[in]   RgmPrbRprtCfg  *  prbRprtCfg
977 *  @return   S16
978 *      -# ROK
979 **/
980 #ifdef ANSI
981 PUBLIC S16 cmUnpkRgmCfgPrbRprt
982 (
983 RgmCfgPrbRprtFptr func,
984 Pst *pst,
985 Buffer *mBuf
986 )
987 #else
988 PUBLIC S16 cmUnpkRgmCfgPrbRprt(func, pst, mBuf)
989 RgmCfgPrbRprtFptr func;
990 Pst *pst;
991 Buffer *mBuf;
992 #endif
993 {
994    SpId spId;
995    RgmPrbRprtCfg *prbRprtCfg;
996
997    TRC3(cmUnpkRgmCfgPrbRprt)
998    if ((SGetSBuf(pst->region, pst->pool, (Data **)&prbRprtCfg, sizeof(RgmPrbRprtCfg))) != ROK)
999       {
1000          SPutMsg(mBuf);
1001          RETVALUE(RFAILED);
1002       }
1003
1004    if (SUnpkS16(&spId, mBuf) != ROK) 
1005    {
1006       SPutMsg(mBuf);
1007       RETVALUE(RFAILED);
1008    }
1009
1010    if (cmUnPkCfgPrbRprt(prbRprtCfg, mBuf) != ROK)
1011    {
1012       SPutMsg(mBuf);
1013       RETVALUE(RFAILED);
1014    }
1015
1016    SPutMsg(mBuf);
1017    RETVALUE((*func)(pst, spId, prbRprtCfg));
1018 }
1019
1020 /* RRM_SP1_START */
1021 /**
1022 * @brief Packing of PRB Usage Report for qci for sending 
1023 *        to RRM from MAC 
1024 *
1025 * @details
1026 *
1027 *     Function : cmPkRgmPrbQciRpt 
1028 *
1029 *  @param[in]   RgmPrbRptPerQci * qciPrbRprt 
1030 *  @param[out]   Buffer *mBuf 
1031 *  @return   S16
1032 *      -# ROK
1033 **/
1034 #ifdef ANSI
1035 PUBLIC S16 cmPkRgmPrbQciRpt 
1036 (
1037  RgmPrbRptPerQci *qciPrbRprt,
1038  Buffer *mBuf
1039  )
1040 #else
1041 PUBLIC S16 cmPkRgmPrbQciRpt(qciPrbRprt, mBuf)
1042 RgmPrbRptPerQci *qciPrbRprt;
1043 Buffer *mBuf = NULLP;
1044 #endif
1045 {
1046    CMCHKPK(SPkU8, qciPrbRprt->bQci, mBuf);
1047    CMCHKPK(SPkU8, qciPrbRprt->bAvgPrbUlUsage, mBuf);
1048    CMCHKPK(SPkU8, qciPrbRprt->bAvgPrbDlUsage, mBuf);
1049
1050    RETVALUE(ROK);
1051 }
1052
1053 /**
1054 * @brief Unpacking of PRB Usage Report for qci received from MAC 
1055 *
1056 * @details
1057 *
1058 *     Function : cmUnpkRgmPrbQciRpt 
1059 *
1060 *  @param[out]   RgmPrbRptPerQci * qciPrbRprt 
1061 *  @param[in]   Buffer *mBuf 
1062 *  @return   S16
1063 *      -# ROK
1064 **/
1065 #ifdef ANSI
1066 PUBLIC S16 cmUnpkRgmPrbQciRpt 
1067 (
1068  RgmPrbRptPerQci *qciPrbRprt,
1069  Buffer *mBuf
1070  )
1071 #else
1072 PUBLIC S16 cmUnpkRgmPrbQciRpt(qciPrbRprt, mBuf)
1073 RgmPrbRptPerQci *qciPrbRprt;
1074 Buffer *mBuf = NULLP;
1075 #endif
1076 {
1077    CMCHKUNPK(SUnpkU8, &qciPrbRprt->bAvgPrbDlUsage, mBuf);
1078    CMCHKUNPK(SUnpkU8, &qciPrbRprt->bAvgPrbUlUsage, mBuf);
1079    CMCHKUNPK(SUnpkU8, &qciPrbRprt->bQci, mBuf);
1080
1081    RETVALUE(ROK);
1082 }
1083 /* RRM_SP1_END */
1084
1085 /**
1086 * @brief PRB Usage Report Indication  from MAC to RRM 
1087 *
1088 * @details
1089 *
1090 *     Function : cmPkPrbRprtInd
1091 *
1092 *  @param[in]   RgmPrbRprtInd  *  prbRprtInd
1093 *  @param[in]   Buffer *mBuf 
1094 *  @return   S16
1095 *      -# ROK
1096 **/
1097 #ifdef ANSI
1098 PUBLIC S16 cmPkPrbRprtInd
1099 (
1100  RgmPrbRprtInd  * prbRprtInd,
1101  Buffer *mBuf
1102  )
1103 #else
1104 PUBLIC S16 cmPkPrbRprtInd(prbRprtInd, mBuf)
1105    RgmPrbRprtInd  * prbRprtInd;
1106    Buffer *mBuf = NULLP;
1107 #endif
1108 {
1109    S32 idx = 0;
1110
1111    TRC3(cmPkPrbRprtInd); 
1112    
1113    /* RRM_SP1_START */
1114    for(idx = RGM_MAX_QCI_REPORTS-1; idx >= 0; idx--)
1115    {
1116       CMCHKPK(cmPkRgmPrbQciRpt, &prbRprtInd->stQciPrbRpts[idx], mBuf);
1117    }
1118    CMCHKPK(SPkU8, prbRprtInd->bPrbUsageMask, mBuf);
1119    CMCHKPK(SPkU8, prbRprtInd->bCellId, mBuf);
1120    /* RRM_SP1_END */
1121    RETVALUE(ROK);
1122 }
1123
1124 /**
1125 * @brief PRB Usage Report Indication  from MAC to RRM 
1126 *
1127 * @details
1128 *
1129 *     Function : cmUnpkPrbRprtInd
1130 *
1131 *  @param[in]   RgmPrbRprtInd  *  prbRprtInd
1132 *  @param[in]   Buffer *mBuf 
1133 *  @return   S16
1134 *      -# ROK
1135 **/
1136 #ifdef ANSI
1137 PUBLIC S16 cmUnpkPrbRprtInd
1138 (
1139  RgmPrbRprtInd  * prbRprtInd,
1140  Buffer *mBuf
1141  )
1142 #else
1143 PUBLIC S16 cmUnpkPrbRprtInd(prbRprtInd, mBuf)
1144    RgmPrbRprtInd  * prbRprtInd;
1145    Buffer *mBuf;
1146 #endif
1147 {
1148    U32 idx = 0;
1149
1150    TRC3(cmUnpkPrbRprtInd);
1151
1152    /* RRM_SP1_START */
1153    CMCHKUNPK(SUnpkU8, &prbRprtInd->bCellId, mBuf);
1154    CMCHKUNPK(SUnpkU8, &prbRprtInd->bPrbUsageMask, mBuf);
1155    for(idx = 0; idx < RGM_MAX_QCI_REPORTS; idx++)
1156    {
1157       CMCHKUNPK(cmUnpkRgmPrbQciRpt, &prbRprtInd->stQciPrbRpts[idx], mBuf);
1158    }
1159
1160    /* RRM_SP1_END */
1161    RETVALUE(ROK);
1162 }
1163
1164
1165
1166 /**
1167 * @brief PRB Usage Report Indication  from MAC to RRM 
1168 *
1169 * @details
1170 *
1171 *     Function : cmPkRgmPrbRprtInd
1172 *
1173 *  @param[in]   Pst*  pst
1174 *  @param[in]   SuId  suId
1175 *  @param[in]   RgmPrbRprtInd  *  prbRprtInd
1176 *  @return   S16
1177 *      -# ROK
1178 **/
1179 #ifdef ANSI
1180 PUBLIC S16 cmPkRgmPrbRprtInd
1181 (
1182 Pst* pst,
1183 SuId suId,
1184 RgmPrbRprtInd  * prbRprtInd
1185 )
1186 #else
1187 PUBLIC S16 cmPkRgmPrbRprtInd(pst, suId, prbRprtInd)
1188 Pst* pst;
1189 SuId suId;
1190 RgmPrbRprtInd  * prbRprtInd;
1191 #endif
1192 {
1193    Buffer *mBuf = NULLP;
1194
1195    TRC3(cmPkRgmPrbRprtInd)
1196
1197    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
1198       SPutSBuf(pst->region, pst->pool, (Data *)prbRprtInd, sizeof(RgmPrbRprtInd));
1199       RETVALUE(RFAILED);
1200    }
1201
1202    if(cmPkPrbRprtInd(prbRprtInd, mBuf) != ROK)
1203    {
1204       SPutSBuf(pst->region, pst->pool, (Data *)prbRprtInd, sizeof(RgmPrbRprtInd));
1205       SPutMsg(mBuf);
1206       RETVALUE(RFAILED);
1207    }
1208
1209    if (SPkS16(suId, mBuf) != ROK) 
1210    {
1211       SPutSBuf(pst->region, pst->pool, (Data *)prbRprtInd, sizeof(RgmPrbRprtInd));
1212       SPutMsg(mBuf);
1213       RETVALUE(RFAILED);
1214    }
1215
1216    SPutSBuf(pst->region, pst->pool, (Data *)prbRprtInd, sizeof(RgmPrbRprtInd));
1217
1218    pst->event = (Event) EVTRGMPRBRPRTIND;
1219    RETVALUE(SPstTsk(pst,mBuf));
1220 }
1221 /**
1222 * @brief PRB Usage Report Indication from MAC to RRM 
1223 *
1224 * @details
1225 *
1226 *     Function : cmUnpkRgmPrbRprtInd
1227 *
1228 *  @param[in]   Pst*  pst
1229 *  @param[in]   SuId  suId
1230 *  @param[in]   RgmPrbRprtInd  *  prbRprtInd
1231 *  @return   S16
1232 *      -# ROK
1233 **/
1234 #ifdef ANSI
1235 PUBLIC S16 cmUnpkRgmPrbRprtInd
1236 (
1237 RgmPrbRprtIndFptr func,
1238 Pst *pst,
1239 Buffer *mBuf
1240 )
1241 #else
1242 PUBLIC S16 cmUnpkRgmPrbRprtInd(func, pst, mBuf)
1243 RgmPrbRprtIndFptr func;
1244 Pst *pst;
1245 Buffer *mBuf;
1246 #endif
1247 {
1248    SuId suId;
1249    RgmPrbRprtInd prbRprtInd;
1250    
1251    TRC3(cmUnpkRgmPrbRprtInd)
1252
1253    if (SUnpkS16(&suId, mBuf) != ROK) 
1254    {
1255       SPutMsg(mBuf);
1256       RETVALUE(RFAILED);
1257    }
1258
1259    if (cmUnpkPrbRprtInd(&prbRprtInd, mBuf) != ROK) 
1260    {
1261       SPutMsg(mBuf);
1262       RETVALUE(RFAILED);
1263    }
1264
1265    SPutMsg(mBuf);
1266    RETVALUE((*func)(pst, suId, &prbRprtInd));
1267 }
1268
1269 /**
1270 * @brief Transmission Mode Change Indication  from MAC to RRM 
1271 *
1272 * @details
1273 *
1274 *     Function : cmPkTransModeInd
1275 *
1276 *  @param[in]   RgmTransModeInd *transModeInd
1277 *  @param[in]   Buffer *mBuf 
1278 *  @return   S16
1279 *      -# ROK
1280 **/
1281 #ifdef ANSI
1282 PUBLIC S16 cmPkTransModeInd
1283 (
1284  RgmTransModeInd *transModeInd,
1285  Buffer *mBuf
1286  )
1287 #else
1288 PUBLIC S16 cmPkTransModeInd(transModeInd, mBuf)
1289    RgmTransModeInd *transModeInd;
1290    Buffer *mBuf;
1291 #endif
1292 {
1293    TRC3(cmPkTransModeInd); 
1294    CMCHKPK(SPkU32, transModeInd->eMode, mBuf);
1295    CMCHKPK(SPkU16, transModeInd->usCrnti, mBuf);
1296    CMCHKPK(SPkU8, transModeInd->bCellId, mBuf);
1297    RETVALUE(ROK);
1298 }
1299
1300 /**
1301 * @brief  Transmission Mode Change Indication from MAC to RRM 
1302 *
1303 * @details
1304 *
1305 *     Function : cmUnpkTransModeInd
1306 *
1307 *  @param[in]   RgmTransModeInd *transModeInd 
1308 *  @param[in]   Buffer *mBuf 
1309 *  @return   S16
1310 *      -# ROK
1311 **/
1312 #ifdef ANSI
1313 PUBLIC S16 cmUnpkTransModeInd
1314 (
1315  RgmTransModeInd *transModeInd,
1316  Buffer *mBuf
1317  )
1318 #else
1319 PUBLIC S16 cmUnpkTransModeInd(transModeInd, mBuf)
1320    RgmTransModeInd *transModeInd;
1321    Buffer *mBuf;
1322 #endif
1323 {
1324    U32 tmpModeEnum;
1325    TRC3(cmUnpkTransModeInd);
1326    CMCHKUNPK(SUnpkU8, &transModeInd->bCellId, mBuf);
1327    CMCHKUNPK(SUnpkU16, &transModeInd->usCrnti, mBuf);
1328    CMCHKUNPK(SUnpkU32, (U32 *)&tmpModeEnum, mBuf);
1329    transModeInd->eMode = (RgmTxnMode)tmpModeEnum;
1330    RETVALUE(ROK);
1331 }
1332 /**
1333 * @brief Transmission Mode Change Indication  from MAC to RRM 
1334 *
1335 * @details
1336 *
1337 *     Function : cmPkRgmTransModeInd
1338 *
1339 *  @param[in]   Pst*  pst
1340 *  @param[in]   SuId  suId
1341 *  @param[in]   RgmTransModeInd *transModeInd 
1342 *  @return   S16
1343 *      -# ROK
1344 **/
1345 #ifdef ANSI
1346 PUBLIC S16 cmPkRgmTransModeInd 
1347 (
1348 Pst* pst,
1349 SuId suId,
1350 RgmTransModeInd *transModeInd
1351 )
1352 #else
1353 PUBLIC S16 cmPkRgmTransModeInd(pst, suId, transModeInd)
1354 Pst* pst;
1355 SuId suId;
1356 RgmTransModeInd *transModeInd;
1357 #endif
1358 {
1359    Buffer *mBuf = NULLP;
1360
1361    TRC3(cmPkRgmTransModeInd)
1362
1363    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
1364       SPutSBuf(pst->region, pst->pool, (Data *)transModeInd, sizeof(RgmTransModeInd));
1365       RETVALUE(RFAILED);
1366    }
1367
1368    if(cmPkTransModeInd(transModeInd, mBuf) != ROK)
1369    {
1370       SPutSBuf(pst->region, pst->pool, (Data *)transModeInd, sizeof(RgmTransModeInd));
1371       SPutMsg(mBuf);
1372       RETVALUE(RFAILED);
1373    }
1374
1375    if (SPkS16(suId, mBuf) != ROK) 
1376    {
1377       SPutSBuf(pst->region, pst->pool, (Data *)transModeInd, sizeof(RgmTransModeInd));
1378       SPutMsg(mBuf);
1379       RETVALUE(RFAILED);
1380    }
1381
1382    SPutSBuf(pst->region, pst->pool, (Data *)transModeInd, sizeof(RgmTransModeInd));
1383
1384    pst->event = (Event) EVTRGMTRANSMODEIND;
1385    RETVALUE(SPstTsk(pst,mBuf));
1386 }
1387 /**
1388 * @brief Transmission Mode Change Indication  from MAC to RRM 
1389 *
1390 * @details
1391 *
1392 *     Function : cmUnpkRgmTransModeInd
1393 *
1394 *  @param[in]   Pst*  pst
1395 *  @param[in]   SuId  suId
1396 *  @param[in]   RgmTransModeInd *transModeInd 
1397 *  @return   S16
1398 *      -# ROK
1399 **/
1400 #ifdef ANSI
1401 PUBLIC S16 cmUnpkRgmTransModeInd
1402 (
1403 RgmTransModeIndFptr func,
1404 Pst *pst,
1405 Buffer *mBuf
1406 )
1407 #else
1408 PUBLIC S16 cmUnpkRgmTransModeInd(func, pst, mBuf)
1409 RgmTransModeIndFptr func;
1410 Pst *pst;
1411 Buffer *mBuf;
1412 #endif
1413 {
1414    SuId suId;
1415    RgmTransModeInd transModeInd;
1416    
1417    TRC3(cmUnpkRgmTransModeInd)
1418
1419    if (SUnpkS16(&suId, mBuf) != ROK) 
1420    {
1421       SPutMsg(mBuf);
1422       RETVALUE(RFAILED);
1423    }
1424
1425    if (cmUnpkTransModeInd(&transModeInd, mBuf) != ROK) 
1426    {
1427       SPutMsg(mBuf);
1428       RETVALUE(RFAILED);
1429    }
1430
1431    SPutMsg(mBuf);
1432    RETVALUE((*func)(pst, suId, &transModeInd));
1433 }
1434 /**********************************************************************
1435  
1436          End of file
1437  
1438 **********************************************************************/