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