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