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