Merge "Added a new Flag ODU_LWR_MAC_DEBUG in the code"
[o-du/l2.git] / src / 5gnrsch / rg_sch_inf.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
19 /************************************************************************
20  
21      Name:     LTE-MAC layer
22   
23      Type:     C source file
24   
25      Desc:     C source code for packing/unpacking of INF interface
26                primitives.
27   
28      File:     rg_sch_inf.c 
29   
30 **********************************************************************/
31
32 /* header include files (.h) */
33 #include "common_def.h"
34 #include "tfu.h"           /* RGU defines */
35 #ifdef LTE_L2_MEAS
36 #include "lrg.h"
37 #endif
38 #include "rg_sch_inf.h"    /* RGU Interface defines */
39
40 /* header/extern include files (.x) */
41 #include "tfu.x"           /* RGU defines */
42 #ifdef LTE_L2_MEAS
43 #include "lrg.x"
44 #endif
45 #include "rg_sch_inf.x"    /* RGU Interface includes */
46
47 #ifdef LCSCH
48 /*Fix: start: Inform UE delete to scheduler*/
49 /**
50 * @brief This primitive is used to indicate to scheduler
51 *        that UE has been deleted at MAC.
52 *
53 * @details
54 *
55 *     Function : cmPkMacSchUeDelInd
56 *
57 *  @param[in]   Pst*  pst
58 *  @param[in]   RgInfUeDelInd*  ueDelInd
59 *  @return   S16
60 *      -# ROK
61 **/
62 #ifdef ANSI
63 S16 cmPkMacSchUeDelInd
64 (
65 Pst* pst,
66 RgInfUeDelInd*  ueDelInd
67 )
68 #else
69 S16 cmPkMacSchUeDelInd(pst, ueDelInd)
70 Pst* pst;
71 RgInfUeDelInd*  ueDelInd;
72 #endif
73 {
74    Buffer *mBuf = NULLP;
75    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) 
76    {
77       return RFAILED;
78    }
79    
80 #ifdef MS_MBUF_CORRUPTION 
81    MS_BUF_ADD_ALLOC_CALLER();
82 #endif 
83    if(SAddPstMsgMult((Data *)ueDelInd, sizeof(RgInfUeDelInd), mBuf) != ROK)
84    {
85       RGSCHINF_FREE_MSG(mBuf);
86       return RFAILED;
87    }
88
89    pst->event = (Event) EVTINFUEDELIND;
90    return (SPstTsk(pst,mBuf));
91 }
92
93 /**
94 * @brief This primitive is used to indicate to scheduler
95 *        that UE has been deleted at MAC.
96 *
97 *
98 * @details
99 *
100 *     Function : cmUnpkMacSchUeDelInd
101 *
102 *  @param[in]   Pst*  pst
103 *  @param[in]   SpId  spId
104 *  @param[in]   RguDDatReqInfo  *  datReq
105 *  @return   S16
106 *      -# ROK
107 **/
108 #ifdef ANSI
109 S16 cmUnpkMacSchUeDelInd
110 (
111 UeDelInd func,
112 Pst *pst,
113 Buffer *mBuf
114 )
115 #else
116 S16 cmUnpkMacSchUeDelInd(func, pst, mBuf)
117 UeDelInd func;
118 Pst *pst;
119 Buffer *mBuf;
120 #endif
121 {
122    RgInfUeDelInd ueDelInd;
123    
124    if(SRemPreMsgMult((Data *)&ueDelInd, sizeof(RgInfUeDelInd), mBuf) != ROK)
125    {
126       RGSCHINF_FREE_MSG(mBuf);
127       return RFAILED;
128    }
129
130    RGSCHINF_FREE_MSG(mBuf);
131
132    return ((*func)(pst, &ueDelInd));
133 }
134 /*Fix: end: Inform UE delete to scheduler*/
135
136 /**
137 * @brief Request from RLC to MAC for forwarding SDUs on 
138  * dedicated channel for transmission.
139 *
140 * @details
141 *
142 *     Function : cmPkMacSchDedBoUpdtReq
143 *
144 *  @param[in]   Pst*  pst
145 *  @param[in]   SpId  spId
146 *  @param[in]   RguDDatReqInfo  *  datReq
147 *  @return   S16
148 *      -# ROK
149 **/
150 #ifdef ANSI
151 S16 cmPkMacSchDedBoUpdtReq
152 (
153 Pst* pst,
154 RgInfDedBoRpt* boRpt
155 )
156 #else
157 S16 cmPkMacSchDedBoUpdtReq(pst, boRpt)
158 Pst* pst;
159 RgInfDedBoRpt* boRpt;
160 #endif
161 {
162    Buffer *mBuf = NULLP;
163
164    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
165       return RFAILED;
166    }
167
168 #ifdef MS_MBUF_CORRUPTION 
169    MS_BUF_ADD_ALLOC_CALLER();
170 #endif 
171    if(SAddPstMsgMult((Data *)boRpt, sizeof(RgInfDedBoRpt), mBuf) != ROK)
172    {
173       RGSCHINF_FREE_MSG(mBuf);
174       return RFAILED;
175    }
176
177    pst->event = (Event) EVTINFDEDBOUPDTREQ;
178    return (SPstTsk(pst,mBuf));
179 }
180
181
182 /**
183 * @brief Request from RLC to MAC for forwarding SDUs on 
184  * dedicated channel for transmission.
185 *
186 * @details
187 *
188 *     Function : cmUnpkMacSchDedBoUpdtReq
189 *
190 *  @param[in]   Pst*  pst
191 *  @param[in]   SpId  spId
192 *  @param[in]   RguDDatReqInfo  *  datReq
193 *  @return   S16
194 *      -# ROK
195 **/
196 #ifdef ANSI
197 S16 cmUnpkMacSchDedBoUpdtReq
198 (
199 DedBoUpdtReq func,
200 Pst *pst,
201 Buffer *mBuf
202 )
203 #else
204 S16 cmUnpkMacSchDedBoUpdtReq(func, pst, mBuf)
205 DedBoUpdtReq func;
206 Pst *pst;
207 Buffer *mBuf;
208 #endif
209 {
210    RgInfDedBoRpt boRpt;
211    
212    if(SRemPreMsgMult((Data *)&boRpt, sizeof(RgInfDedBoRpt), mBuf) != ROK)
213    {
214       RGSCHINF_FREE_MSG(mBuf);
215       return RFAILED;
216    }
217
218    RGSCHINF_FREE_MSG(mBuf);
219    return ((*func)(pst, &boRpt));
220 }
221 /**
222 * @brief Request from RLC to MAC for forwarding SDUs on 
223  * dedicated channel for transmission.
224 *
225 * @details
226 *
227 *     Function : cmPkMacSchCmnBoUpdtReq
228 *
229 *  @param[in]   Pst*  pst
230 *  @param[in]   SpId  spId
231 *  @param[in]   RguDDatReqInfo  *  datReq
232 *  @return   S16
233 *      -# ROK
234 **/
235 #ifdef ANSI
236 S16 cmPkMacSchCmnBoUpdtReq
237 (
238 Pst* pst,
239 RgInfCmnBoRpt* boRpt
240 )
241 #else
242 S16 cmPkMacSchCmnBoUpdtReq(pst, boRpt)
243 Pst* pst;
244 RgInfCmnBoRpt* boRpt;
245 #endif
246 {
247    Buffer *mBuf = NULLP;
248
249    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
250       return RFAILED;
251    }
252
253 #ifdef MS_MBUF_CORRUPTION 
254    MS_BUF_ADD_ALLOC_CALLER();
255 #endif 
256    if(SAddPstMsgMult((Data *)boRpt, sizeof(RgInfCmnBoRpt), mBuf) != ROK)
257    {
258       RGSCHINF_FREE_MSG(mBuf);
259       return RFAILED;
260    }
261
262    pst->event = (Event) EVTINFCMNBOUPDTREQ;
263    return (SPstTsk(pst,mBuf));
264 }
265
266
267 /**
268 * @brief Request from RLC to MAC for forwarding SDUs on 
269  * dedicated channel for transmission.
270 *
271 * @details
272 *
273 *     Function : cmUnpkMacSchCmnBoUpdtReq
274 *
275 *  @param[in]   Pst*  pst
276 *  @param[in]   SpId  spId
277 *  @param[in]   RguDDatReqInfo  *  datReq
278 *  @return   S16
279 *      -# ROK
280 **/
281 #ifdef ANSI
282 S16 cmUnpkMacSchCmnBoUpdtReq
283 (
284 CmnBoUpdtReq func,
285 Pst *pst,
286 Buffer *mBuf
287 )
288 #else
289 S16 cmUnpkMacSchCmnBoUpdtReq(func, pst, mBuf)
290 CmnBoUpdtReq func;
291 Pst *pst;
292 Buffer *mBuf;
293 #endif
294 {
295    RgInfCmnBoRpt boRpt;
296    
297    if(SRemPreMsgMult((Data *)&boRpt, sizeof(RgInfCmnBoRpt), mBuf) != ROK)
298    {
299       RGSCHINF_FREE_MSG(mBuf);
300       return RFAILED;
301    }
302
303    RGSCHINF_FREE_MSG(mBuf);
304    return ((*func)(pst, &boRpt));
305 }
306 /**
307 * @brief Request from RLC to MAC for forwarding SDUs on 
308  * dedicated channel for transmission.
309 *
310 * @details
311 *
312 *     Function : cmPkMacSchSfRecpInd
313 *
314 *  @param[in]   Pst*  pst
315 *  @param[in]   SpId  spId
316 *  @param[in]   RguDDatReqInfo  *  datReq
317 *  @return   S16
318 *      -# ROK
319 **/
320 #ifdef ANSI
321 S16 cmPkMacSchSfRecpInd
322 (
323 Pst* pst,
324 RgInfSfDatInd*  datInd
325 )
326 #else
327 S16 cmPkMacSchSfRecpInd(pst, datInd)
328 Pst* pst;
329 RgInfSfDatInd*  datInd;
330 #endif
331 {
332    Buffer *mBuf = NULLP;
333
334    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
335       return RFAILED;
336    }
337
338    if(oduPackPointer((PTR)datInd, mBuf) != ROK)
339    {
340       RGSCHINF_FREE_MSG(mBuf);
341       return RFAILED;
342    }
343
344    pst->event = (Event) EVTINFSFRECPIND;
345    return (SPstTsk(pst,mBuf));
346 }
347
348
349 /**
350 * @brief Request from RLC to MAC for forwarding SDUs on 
351  * dedicated channel for transmission.
352 *
353 * @details
354 *
355 *     Function : cmUnpkMacSchSfRecpInd
356 *
357 *  @param[in]   Pst*  pst
358 *  @param[in]   SpId  spId
359 *  @param[in]   RguDDatReqInfo  *  datReq
360 *  @return   S16
361 *      -# ROK
362 **/
363 #ifdef ANSI
364 S16 cmUnpkMacSchSfRecpInd
365 (
366 SfRecpInd func,
367 Pst *pst,
368 Buffer *mBuf
369 )
370 #else
371 S16 cmUnpkMacSchSfRecpInd(func, pst, mBuf)
372 SfRecpInd func;
373 Pst *pst;
374 Buffer *mBuf;
375 #endif
376 {
377    RgInfSfDatInd* datInd;
378    
379    if(oduUnpackPointer((PTR *)&datInd, mBuf) != ROK)
380    {
381       RGSCHINF_FREE_MSG(mBuf);
382       return RFAILED;
383    }
384
385    RGSCHINF_FREE_MSG(mBuf);
386    /* Call cmFreeMem(datInd) in scheduler */
387    return ((*func)(pst, datInd));
388 }
389
390 #ifdef LTEMAC_SPS
391 /**
392 * @brief Primitive from MAC to SCH to indicate release of UL SPS for a UE
393 *
394 * @details
395 *
396 *     Function : cmPkMacSchSpsRelInd
397 *
398 *  @param[in]   Pst*                 pst
399 *  @param[in]   RgInfSpsRelInfo*     relInfo
400 *  @return   S16
401 *      -# ROK
402 **/
403 #ifdef ANSI
404 S16 cmPkMacSchSpsRelInd
405 (
406 Pst*                 pst,
407 RgInfSpsRelInfo*     relInfo
408 )
409 #else
410 S16 cmPkMacSchSpsRelInd(pst, relInfo)
411 Pst*                 pst;
412 RgInfSpsRelInfo*     relInfo;
413 #endif
414 {
415    Buffer *mBuf = NULLP;
416
417    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
418       return RFAILED;
419    }
420
421    if(oduPackPointer((PTR)relInfo, mBuf) != ROK)
422    {
423       RGSCHINF_FREE_MSG(mBuf);
424       return RFAILED;
425    }
426
427    pst->event = (Event) EVTINFSPSRELIND;
428    return (SPstTsk(pst,mBuf));
429 } /* end of cmPkMacSchSpsRelInd */
430
431 /**
432 * @brief Primitive from MAC to SCH to indicate release of UL SPS for a UE
433 *
434 * @details
435 *
436 *     Function : cmUnpkMacSchSpsRelInd
437 *
438 *  @param[in]    SpsRelInd            func
439 *  @param[in]    Pst*                 pst
440 *  @param[in]    Buffer               *mBuf
441 *  @return   S16
442 *      -# ROK
443 **/
444 #ifdef ANSI
445 S16 cmUnpkMacSchSpsRelInd
446 (
447 SpsRelInd      func,
448 Pst            *pst,
449 Buffer         *mBuf
450 )
451 #else
452 S16 cmUnpkMacSchSpsRelInd(func, pst, mBuf)
453 SpsRelInd      func;
454 Pst            *pst;
455 Buffer         *mBuf;
456 #endif
457 {
458    RgInfSpsRelInfo *relInfo;
459    
460    if(oduUnpackPointer((PTR *)&relInfo, mBuf) != ROK)
461    {
462       RGSCHINF_FREE_MSG(mBuf);
463       return RFAILED;
464    }
465
466    RGSCHINF_FREE_MSG(mBuf);
467    return ((*func)(pst, relInfo));
468 } /* end of cmUnpkMacSchSpsRelInd */
469 #endif /* LTEMAC_SPS */
470
471 #endif
472 #ifdef LCRG
473 /**
474 * @brief Request from RLC to MAC for forwarding SDUs on 
475  * dedicated channel for transmission.
476 *
477 * @details
478 *
479 *     Function : cmPkSchMacSfAllocReq
480 *
481 *  @param[in]   Pst*  pst
482 *  @param[in]   SpId  spId
483 *  @param[in]   RguDDatReqInfo  *  datReq
484 *  @return   S16
485 *      -# ROK
486 **/
487 #ifdef ANSI
488 S16 cmPkSchMacSfAllocReq
489 (
490 Pst* pst,
491 RgInfSfAlloc*   resAllocReq
492 )
493 #else
494 S16 cmPkSchMacSfAllocReq(pst, resAllocReq)
495 Pst* pst;
496 RgInfSfAlloc*   resAllocReq;
497 #endif
498 {
499    Buffer *mBuf = NULLP;
500
501    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
502       return RFAILED;
503    }
504
505    if(oduPackPointer((PTR)resAllocReq, mBuf) != ROK)
506    {
507       RGSCHINF_FREE_MSG(mBuf);
508       return RFAILED;
509    }
510
511    pst->event = (Event) EVTINFSFALLOCREQ;
512    return (SPstTsk(pst,mBuf));
513 }
514
515
516 /**
517 * @brief Request from RLC to MAC for forwarding SDUs on 
518  * dedicated channel for transmission.
519 *
520 * @details
521 *
522 *     Function : cmUnpkSchMacSfAllocReq
523 *
524 *  @param[in]   Pst*  pst
525 *  @param[in]   SpId  spId
526 *  @param[in]   RguDDatReqInfo  *  datReq
527 *  @return   S16
528 *      -# ROK
529 **/
530 #ifdef ANSI
531 S16 cmUnpkSchMacSfAllocReq
532 (
533 SfAllocReq func,
534 Pst *pst,
535 Buffer *mBuf
536 )
537 #else
538 S16 cmUnpkSchMacSfAllocReq(func, pst, mBuf)
539 SfAllocReq func;
540 Pst *pst;
541 Buffer *mBuf;
542 #endif
543 {
544    RgInfSfAlloc* resAllocReq;
545    
546    if(oduUnpackPointer((PTR *)&resAllocReq, mBuf) != ROK)
547    {
548       RGSCHINF_FREE_MSG(mBuf);
549       return RFAILED;
550    }
551
552    RGSCHINF_FREE_MSG(mBuf);
553    return ((*func)(pst, resAllocReq));
554 }
555 /**
556 * @brief Request from  SCH To MAC for harq entity reset
557 *
558 * @details
559 *
560 *     Function : cmPkSchMacRstHqEntReq
561 *
562 *  @param[in]   Pst*  pst
563 *  @param[in]   RgInfResetHqEnt *hqEntInfo
564 *  @return   S16
565 *      -# ROK
566 **/
567 #ifdef ANSI
568 S16 cmPkSchMacRstHqEntReq
569 (
570 Pst*                 pst,
571 RgInfResetHqEnt*     hqEntInfo
572 )
573 #else
574 S16 cmPkSchMacRstHqEntReq(pst, sfHqInfo)
575 Pst*                 pst,    
576 RgInfResetHqEnt*     hqEntInfo
577 #endif
578 {
579    Buffer *mBuf = NULLP;
580
581    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
582       return RFAILED;
583    }
584
585    if(oduPackPointer((PTR)hqEntInfo, mBuf) != ROK)
586    {
587       RGSCHINF_FREE_MSG(mBuf);
588       return RFAILED;
589    }
590
591    pst->event = (Event) EVTINFHQENTRESET;
592    return (SPstTsk(pst,mBuf));
593 }
594
595 /**
596 * @brief Request from SCH to MAC for resetting the harqentity
597 *
598 * @details
599 *
600 *     Function : cmUnpkSchMacRstHqEntReq
601 *
602 *  @param[in]   Pst*  pst
603 *  @param[in]   RgInfResetHqEnt *hqEntInfo
604 *  @return   S16
605 *      -# ROK
606 **/
607 #ifdef ANSI
608 S16 cmUnpkSchMacRstHqEntReq
609 (
610 RstHqEntReq func,
611 Pst *pst,
612 Buffer *mBuf
613 )
614 #else
615 S16 cmUnpkSchMacRstHqEntReq(func, pst, mBuf)
616 RstHqEntReq func,
617 Pst *pst,
618 Buffer *mBuf
619 #endif
620 {
621    RgInfResetHqEnt* hqEntRstInfo;
622    
623    if(oduUnpackPointer((PTR *)&hqEntRstInfo, mBuf) != ROK)
624    {
625       RGSCHINF_FREE_MSG(mBuf);
626       return RFAILED;
627    }
628
629    RGSCHINF_FREE_MSG(mBuf);
630    return ((*func)(pst, hqEntRstInfo));
631 }
632
633 /**
634 * @brief Request from RLC to MAC for forwarding SDUs on 
635  * dedicated channel for transmission.
636 *
637 * @details
638 *
639 *     Function : cmPkSchMacRlsHqReq
640 *
641 *  @param[in]   Pst*  pst
642 *  @param[in]   SpId  spId
643 *  @param[in]   RguDDatReqInfo  *  datReq
644 *  @return   S16
645 *      -# ROK
646 **/
647 #ifdef ANSI
648 S16 cmPkSchMacRlsHqReq
649 (
650 Pst* pst,
651 RgInfRlsHqInfo* sfHqInfo
652 )
653 #else
654 S16 cmPkSchMacRlsHqReq(pst, sfHqInfo)
655 Pst* pst;
656 RgInfRlsHqInfo* sfHqInfo;
657 #endif
658 {
659    Buffer *mBuf = NULLP;
660
661    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
662       return RFAILED;
663    }
664
665    if(oduPackPointer((PTR)sfHqInfo, mBuf) != ROK)
666    {
667       RGSCHINF_FREE_MSG(mBuf);
668       return RFAILED;
669    }
670
671    pst->event = (Event) EVTINFRLSHQREQ;
672    return (SPstTsk(pst,mBuf));
673 }
674
675 /**
676 * @brief Request from RLC to MAC for forwarding SDUs on 
677  * dedicated channel for transmission.
678 *
679 * @details
680 *
681 *     Function : cmUnpkSchMacRlsHqReq
682 *
683 *  @param[in]   Pst*  pst
684 *  @param[in]   SpId  spId
685 *  @param[in]   RguDDatReqInfo  *  datReq
686 *  @return   S16
687 *      -# ROK
688 **/
689 #ifdef ANSI
690 S16 cmUnpkSchMacRlsHqReq
691 (
692 RlsHqReq func,
693 Pst *pst,
694 Buffer *mBuf
695 )
696 #else
697 S16 cmUnpkSchMacRlsHqReq(func, pst, mBuf)
698 RlsHqReq func;
699 Pst *pst;
700 Buffer *mBuf;
701 #endif
702 {
703    RgInfRlsHqInfo* sfHqInfo;
704    
705    if(oduUnpackPointer((PTR *)&sfHqInfo, mBuf) != ROK)
706    {
707       RGSCHINF_FREE_MSG(mBuf);
708       return RFAILED;
709    }
710
711    RGSCHINF_FREE_MSG(mBuf);
712    return ((*func)(pst, sfHqInfo));
713 }
714 /**
715 * @brief Request from RLC to MAC for forwarding SDUs on 
716  * dedicated channel for transmission.
717 *
718 * @details
719 *
720 *     Function : cmPkSchMacRlsRntiReq
721 *
722 *  @param[in]   Pst*  pst
723 *  @param[in]   SpId  spId
724 *  @param[in]   RguDDatReqInfo  *  datReq
725 *  @return   S16
726 *      -# ROK
727 **/
728 #ifdef ANSI
729 S16 cmPkSchMacRlsRntiReq
730 (
731 Pst* pst,
732 RgInfRlsRnti* rlsRnti
733 )
734 #else
735 S16 cmPkSchMacRlsRntiReq(pst, rlsRnti)
736 Pst* pst;
737 RgInfRlsRnti* rlsRnti;
738 #endif
739 {
740    Buffer *mBuf = NULLP;
741
742    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
743       return RFAILED;
744    }
745
746 #ifdef MS_MBUF_CORRUPTION 
747    MS_BUF_ADD_ALLOC_CALLER();
748 #endif 
749    if(SAddPstMsgMult((Data *)rlsRnti, sizeof(RgInfRlsRnti), mBuf) != ROK)
750    {
751       RGSCHINF_FREE_MSG(mBuf);
752       return RFAILED;
753    }
754
755    pst->event = (Event) EVTINFRLSRNTIREQ;
756    return (SPstTsk(pst,mBuf));
757 }
758
759 /**
760 * @brief Request from RLC to MAC for forwarding SDUs on 
761  * dedicated channel for transmission.
762 *
763 * @details
764 *
765 *     Function : cmUnpkSchMacRlsRntiReq
766 *
767 *  @param[in]   Pst*  pst
768 *  @param[in]   SpId  spId
769 *  @param[in]   RguDDatReqInfo  *  datReq
770 *  @return   S16
771 *      -# ROK
772 **/
773 #ifdef ANSI
774 S16 cmUnpkSchMacRlsRntiReq
775 (
776 RlsRntiReq func,
777 Pst *pst,
778 Buffer *mBuf
779 )
780 #else
781 S16 cmUnpkSchMacRlsRntiReq(func, pst, mBuf)
782 RlsRntiReq func;
783 Pst *pst;
784 Buffer *mBuf;
785 #endif
786 {
787    RgInfRlsRnti rlsRnti;
788    
789    if(SRemPreMsgMult((Data *)&rlsRnti, sizeof(RgInfRlsRnti), mBuf) != ROK)
790    {
791       RGSCHINF_FREE_MSG(mBuf);
792       return RFAILED;
793    }
794
795    RGSCHINF_FREE_MSG(mBuf);
796    return ((*func)(pst, &rlsRnti));
797 }
798
799 /**
800 * @brief Request from RLC to MAC for forwarding SDUs on 
801  * dedicated channel for transmission.
802 *
803 * @details
804 *
805 *     Function : cmPkSchMacCellRegReq
806 *
807 *  @param[in]   Pst*  pst
808 *  @param[in]   SpId  spId
809 *  @param[in]   RguDDatReqInfo  *  datReq
810 *  @return   S16
811 *      -# ROK
812 **/
813 #ifdef ANSI
814 S16 cmPkSchMacCellRegReq
815 (
816 Pst* pst,
817 RgInfCellReg* regReq
818 )
819 #else
820 S16 cmPkSchMacCellRegReq(pst, regReq)
821 Pst* pst;
822 RgInfCellReg* regReq;
823 #endif
824 {
825    Buffer *mBuf = NULLP;
826
827    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
828       return RFAILED;
829    }
830
831 #ifdef MS_MBUF_CORRUPTION 
832    MS_BUF_ADD_ALLOC_CALLER();
833 #endif 
834    if(SAddPstMsgMult((Data *)regReq, sizeof(RgInfCellReg), mBuf) != ROK)
835    {
836       RGSCHINF_FREE_MSG(mBuf);
837       return RFAILED;
838    }
839
840    pst->event = (Event) EVTINFCELLREGREQ;
841    return (SPstTsk(pst,mBuf));
842 }
843
844 /**
845 * @brief Request from RLC to MAC for forwarding SDUs on 
846  * dedicated channel for transmission.
847 *
848 * @details
849 *
850 *     Function : cmUnpkSchMacCellRegReq
851 *
852 *  @param[in]   Pst*  pst
853 *  @param[in]   SpId  spId
854 *  @param[in]   RguDDatReqInfo  *  datReq
855 *  @return   S16
856 *      -# ROK
857 **/
858 #ifdef ANSI
859 S16 cmUnpkSchMacCellRegReq
860 (
861 CellRegReq func,
862 Pst *pst,
863 Buffer *mBuf
864 )
865 #else
866 S16 cmUnpkSchMacCellRegReq(func, pst, mBuf)
867 CellRegReq func;
868 Pst *pst;
869 Buffer *mBuf;
870 #endif
871 {
872    RgInfCellReg regReq;
873    
874    if(SRemPreMsgMult((Data *)&regReq, sizeof(RgInfCellReg), mBuf) != ROK)
875    {
876       RGSCHINF_FREE_MSG(mBuf);
877       return RFAILED;
878    }
879
880    RGSCHINF_FREE_MSG(mBuf);
881    return ((*func)(pst, &regReq));
882 }
883
884 /**
885 * @brief Primitive from SCH to MAC to register GBR LCG per UE
886 *
887 * @details
888 *
889 *     Function : cmPkSchMacLcgRegReq
890 *
891 *  @param[in]   Pst*                 pst
892 *  @param[in]   RgInfLcgRegReq       *lcgRegReq
893 *  @return   S16
894 *      -# ROK
895 **/
896 #ifdef ANSI
897 S16 cmPkSchMacLcgRegReq
898 (
899 Pst*                 pst,
900 RgInfLcgRegReq       *lcgRegReq
901 )
902 #else
903 S16 cmPkSchMacLcgRegReq(pst, lcgRegReq)
904 Pst*                 pst;
905 RgInfLcgRegReq       *lcgRegReq;
906 #endif
907 {
908    Buffer *mBuf = NULLP;
909
910    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
911       return RFAILED;
912    }
913
914    if(SAddPstMsgMult((Data *)lcgRegReq, sizeof(RgInfLcgRegReq), mBuf) != ROK)
915    {
916       RGSCHINF_FREE_MSG(mBuf);
917       return RFAILED;
918    }
919
920    pst->event = (Event) EVTINFLCGREG;
921    return (SPstTsk(pst,mBuf));
922 } /* end of cmPkSchMacLcgRegReq */
923
924 /**
925 * @brief Primitive from SCH to MAC to register GBR LCG
926 *
927 * @details
928 *
929 *     Function : cmUnpkSchMacLcgRegReq
930 *
931 *  @param[in]    LcgReg               func
932 *  @param[in]    Pst*                 pst
933 *  @param[in]    Buffer               *mBuf
934 *  @return   S16
935 *      -# ROK
936 **/
937 #ifdef ANSI
938 S16 cmUnpkSchMacLcgRegReq
939 (
940 LcgReg         func,
941 Pst            *pst,
942 Buffer         *mBuf
943 )
944 #else
945 S16 cmUnpkSchMacLcgRegReq(func, pst, mBuf)
946 LcgReg         func;
947 Pst            *pst;
948 Buffer         *mBuf;
949 #endif
950 {
951    RgInfLcgRegReq       *lcgRegReq;
952    
953    if(oduUnpackPointer((PTR *)&lcgRegReq, mBuf) != ROK)
954    {
955       RGSCHINF_FREE_MSG(mBuf);
956       return RFAILED;
957    }
958
959    RGSCHINF_FREE_MSG(mBuf);
960    return ((*func)(pst, lcgRegReq));
961 } /* end of cmUnpkSchMacLcgRegReq */
962
963 #ifdef LTEMAC_SPS
964
965 /**
966 * @brief Primitive from SCH to MAC to register the set of SPS LCs per UE
967 *
968 * @details
969 *
970 *     Function : cmPkSchMacSpsLcRegReq
971 *
972 *  @param[in]   Pst*                 pst
973 *  @param[in]   RgInfSpsLcInfo       *lcInfo
974 *  @return   S16
975 *      -# ROK
976 **/
977 #ifdef ANSI
978 S16 cmPkSchMacSpsLcRegReq
979 (
980 Pst*                 pst,
981 RgInfSpsLcInfo       *lcInfo
982 )
983 #else
984 S16 cmPkSchMacSpsLcRegReq(pst, lcInfo)
985 Pst*                 pst;
986 RgInfSpsLcInfo       *lcInfo;
987 #endif
988 {
989    Buffer *mBuf = NULLP;
990
991    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
992       return RFAILED;
993    }
994
995    if(oduPackPointer((PTR)lcInfo, mBuf) != ROK)
996    {
997       RGSCHINF_FREE_MSG(mBuf);
998       return RFAILED;
999    }
1000
1001    pst->event = (Event) EVTINFSPSLCREG;
1002    return (SPstTsk(pst,mBuf));
1003 } /* end of cmPkSchMacSpsLcRegReq */
1004
1005 /**
1006 * @brief Primitive from SCH to MAC to reset SPS Params for the UE
1007 *
1008 * @details
1009 *
1010 *     Function : cmPkSchMacUlSpsResetReq
1011 *
1012 *  @param[in]   Pst*                 pst
1013 *  @param[in]   RgInfUlSpsReset       *ulSpsResetInfo
1014 *  @return   S16
1015 *      -# ROK
1016 **/
1017 #ifdef ANSI
1018 S16 cmPkSchMacUlSpsResetReq
1019 (
1020 Pst*                 pst,
1021 RgInfUlSpsReset      *ulSpsResetInfo
1022 )
1023 #else
1024 S16 cmPkSchMacUlSpsResetReq(pst, ulSpsResetInfo)
1025 Pst*                 pst;
1026 RgInfUlSpsReset       *ulSpsResetInfo;
1027 #endif
1028 {
1029    Buffer *mBuf = NULLP;
1030
1031    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
1032       return RFAILED;
1033    }
1034
1035    if(oduPackPointer((PTR)ulSpsResetInfo, mBuf) != ROK)
1036    {
1037       RGSCHINF_FREE_MSG(mBuf);
1038       return RFAILED;
1039    }
1040
1041    pst->event = (Event) EVTINFSPSRESET;
1042    return (SPstTsk(pst,mBuf));
1043 } /* end of cmPkSchMacUlSpsResetReq */
1044
1045 /**
1046 * @brief Primitive from SCH to MAC to register the set of SPS LCs per UE
1047 *
1048 * @details
1049 *
1050 *     Function : cmUnpkSchMacSpsLcRegReq
1051 *
1052 *  @param[in]    SpsLcReg             func
1053 *  @param[in]    Pst*                 pst
1054 *  @param[in]    Buffer               *mBuf
1055 *  @return   S16
1056 *      -# ROK
1057 **/
1058 #ifdef ANSI
1059 S16 cmUnpkSchMacSpsLcRegReq
1060 (
1061 SpsLcReg       func,
1062 Pst            *pst,
1063 Buffer         *mBuf
1064 )
1065 #else
1066 S16 cmUnpkSchMacSpsLcRegReq(func, pst, mBuf)
1067 SpsLcReg       func;
1068 Pst            *pst;
1069 Buffer         *mBuf;
1070 #endif
1071 {
1072    RgInfSpsLcInfo       *lcInfo;
1073    
1074    if(oduUnpackPointer((PTR *)&lcInfo, mBuf) != ROK)
1075    {
1076       RGSCHINF_FREE_MSG(mBuf);
1077       return RFAILED;
1078    }
1079
1080    RGSCHINF_FREE_MSG(mBuf);
1081    return ((*func)(pst, lcInfo));
1082 } /* end of cmUnpkSchMacSpsLcRegReq */
1083
1084
1085
1086 /**
1087 * @brief Primitive from SCH to MAC to reset UL SPS params
1088 *
1089 * @details
1090 *
1091 *     Function : cmUnpkSchMacUlSpsResetReq
1092 *
1093 *  @param[in]    UlSpsReset             func
1094 *  @param[in]    Pst*                 pst
1095 *  @param[in]    Buffer               *mBuf
1096 *  @return   S16
1097 *      -# ROK
1098 **/
1099 #ifdef ANSI
1100 S16 cmUnpkSchMacUlSpsResetReq
1101 (
1102 UlSpsReset       func,
1103 Pst            *pst,
1104 Buffer         *mBuf
1105 )
1106 #else
1107 S16 cmUnpkSchMacUlSpsResetReq(func, pst, mBuf)
1108 UlSpsReset       func;
1109 Pst            *pst;
1110 Buffer         *mBuf;
1111 #endif
1112 {
1113    RgInfUlSpsReset       *ulSpsResetInfo;
1114    
1115    if(oduUnpackPointer((PTR *)&ulSpsResetInfo, mBuf) != ROK)
1116    {
1117       RGSCHINF_FREE_MSG(mBuf);
1118       return RFAILED;
1119    }
1120
1121    RGSCHINF_FREE_MSG(mBuf);
1122    return ((*func)(pst, ulSpsResetInfo));
1123 } /* end of cmUnpkSchMacUlSpsResetReq */
1124
1125
1126
1127 /**
1128 * @brief Primitive from SCH to MAC to deregister the set of SPS LCs per UE
1129 *
1130 * @details
1131 *
1132 *     Function : cmPkSchMacSpsLcDeregReq
1133 *
1134 *  @param[in]   Pst*                 pst
1135 *  @param[in]   CmLteCellId          cellId,
1136 *  @param[in]   CmLteRnti            crnti
1137 *  @return   S16
1138 *      -# ROK
1139 **/
1140 #ifdef ANSI
1141 S16 cmPkSchMacSpsLcDeregReq
1142 (
1143 Pst*                 pst,
1144 CmLteCellId          cellId,
1145 CmLteRnti            crnti
1146 )
1147 #else
1148 S16 cmPkSchMacSpsLcDeregReq(pst, cellId, crnti)
1149 Pst*                 pst;
1150 CmLteCellId          cellId;
1151 CmLteRnti            crnti;
1152 #endif
1153 {
1154    Buffer *mBuf = NULLP;
1155
1156    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
1157       return RFAILED;
1158    }
1159
1160    CMCHKPK(cmPkLteCellId, cellId, mBuf);
1161    CMCHKPK(cmPkLteRnti, crnti, mBuf);
1162
1163    pst->event = (Event) EVTINFSPSLCDEREG;
1164    return (SPstTsk(pst,mBuf));
1165 } /* end of cmPkSchMacSpsLcDeregReq */
1166
1167 /**
1168 * @brief Primitive from SCH to MAC to deregister the set of SPS LCs per UE
1169 *
1170 * @details
1171 *
1172 *     Function : cmUnpkSchMacSpsLcDeregReq
1173 *
1174 *  @param[in]    SpsLcDereg           func
1175 *  @param[in]    Pst*                 pst
1176 *  @param[in]    Buffer               *mBuf
1177 *  @return   S16
1178 *      -# ROK
1179 **/
1180 #ifdef ANSI
1181 S16 cmUnpkSchMacSpsLcDeregReq
1182 (
1183 SpsLcDereg     func,
1184 Pst            *pst,
1185 Buffer         *mBuf
1186 )
1187 #else
1188 S16 cmUnpkSchMacSpsLcDeregReq(func, pst, mBuf)
1189 SpsLcDereg     func;
1190 Pst            *pst;
1191 Buffer         *mBuf;
1192 #endif
1193 {
1194    CmLteCellId  cellId;
1195    CmLteRnti    crnti;
1196    
1197    CMCHKUNPK(cmUnpkLteRnti, &crnti, mBuf);
1198    CMCHKUNPK(cmUnpkLteCellId, &cellId, mBuf);
1199
1200    RGSCHINF_FREE_MSG(mBuf);
1201    return ((*func)(pst, cellId, crnti));
1202 } /* end of cmUnpkSchMacSpsLcDeregReq */
1203
1204 #endif /* LTEMAC_SPS */
1205 #ifdef LTE_L2_MEAS
1206
1207 /**
1208 * @brief Primitive from SCH to MAC for L2 Measurement
1209 *
1210 * @details
1211 *
1212 *     Function : cmPkSchMacL2MeasReq
1213 *
1214 *  @param[in]   Pst*                 pst
1215 *  @param[in]   RgInfSpsLcInfo       *lcInfo
1216 *  @return   S16
1217 *      -# ROK
1218 **/
1219 #ifdef ANSI
1220 S16 cmPkSchMacL2MeasReq
1221 (
1222 Pst*                 pst,
1223 RgInfL2MeasReq      *measInfo
1224 )
1225 #else
1226 S16 cmPkSchMacL2MeasReq(pst, measInfo)
1227 Pst*                 pst;
1228 RgInfL2MeasReq      *measInfo;
1229 #endif
1230 {
1231    Buffer *mBuf = NULLP;
1232
1233    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
1234       return RFAILED;
1235    }
1236    if(SAddPstMsgMult((Data *)measInfo, sizeof(RgInfL2MeasReq), mBuf) != ROK)
1237    {
1238       RGSCHINF_FREE_MSG(mBuf);
1239       return RFAILED;
1240    }
1241
1242    pst->event = (Event) EVTINFL2MEASREQ;
1243    return (SPstTsk(pst,mBuf));
1244 } /* end of cmPkSchMacL2MeasReq */
1245
1246 /**
1247 * @brief Primitive from SCH to MAC for L2 Stop Measurement
1248 *
1249 * @details
1250 *
1251 *     Function : cmPkSchMacL2MeasStopReq
1252 *
1253 *  @param[in]   Pst*                 pst
1254 *  @param[in]   RgInfSpsLcInfo       *lcInfo
1255 *  @return   S16
1256 *      -# ROK
1257 **/
1258 #ifdef ANSI
1259 S16 cmPkSchMacL2MeasStopReq
1260 (
1261 Pst*                 pst,
1262 RgInfL2MeasStopReq *measInfo
1263 )
1264 #else
1265 S16 cmPkSchMacL2MeasStopReq(pst, measInfo)
1266 Pst*                 pst;
1267 RgInfL2MeasStopReq *measInfo;
1268 #endif
1269 {
1270    Buffer *mBuf = NULLP;
1271
1272    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
1273        return RFAILED;
1274   }
1275    if(SAddPstMsgMult((Data *)measInfo, sizeof(RgInfL2MeasStopReq), mBuf) != ROK)
1276    {
1277       SPutMsg(mBuf);
1278       return RFAILED;
1279    }
1280
1281    pst->event = (Event) EVTINFL2MEASSTOPREQ;
1282    return (SPstTsk(pst,mBuf));
1283 } /* end of cmPkSchMacL2MeasStopReq */
1284 /**
1285 * @brief Primitive from SCH to MAC for L2 Measurement
1286 *         Send Request
1287 * @details
1288 *
1289 *     Function : cmPkSchMacL2MeasSendReq
1290 *
1291 *  @param[in]   Pst*                 pst
1292 *  @param[in]   RgInfSpsLcInfo       *lcInfo
1293 *  @return   S16
1294 *      -# ROK
1295 **/
1296 #ifdef ANSI
1297 S16 cmPkSchMacL2MeasSendReq
1298 (
1299 Pst*                 pst,
1300 RgInfL2MeasSndReq *measInfo
1301 )
1302 #else
1303 S16 cmPkSchMacL2MeasSendReq(pst, measInfo)
1304 Pst*                 pst;
1305 RgInfL2MeasSndReq *measInfo;
1306 #endif
1307 {
1308    Buffer *mBuf = NULLP;
1309
1310    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
1311        return RFAILED;
1312   }
1313
1314    if(SAddPstMsgMult((Data *)measInfo, sizeof(RgInfL2MeasSndReq), mBuf) != ROK)
1315    {
1316       SPutMsg(mBuf);
1317       return RFAILED;
1318    }
1319
1320    pst->event = (Event) EVTINFL2MEASSENDREQ;
1321    return (SPstTsk(pst,mBuf));
1322 } /* end of cmPkSchMacL2MeasSendReq */
1323
1324 /**
1325 * @brief Primitive from SCH to MAC for L2 Measurement request
1326 *
1327 * @details
1328 *
1329 *     Function : cmUnpkSchMacL2MeasReq
1330 *
1331 *  @param[in]    L2MeasReg            func
1332 *  @param[in]    Pst*                 pst
1333 *  @param[in]    Buffer               *mBuf
1334 *  @return   S16
1335 *      -# ROK
1336 **/
1337 #ifdef ANSI
1338 S16 cmUnpkSchMacL2MeasReq
1339 (
1340 L2MeasReq      func,
1341 Pst            *pst,
1342 Buffer         *mBuf
1343 )
1344 #else
1345 S16 cmUnpkSchMacL2MeasReq(func, pst, mBuf)
1346 L2MeasReq      func;
1347 Pst            *pst;
1348 Buffer         *mBuf;
1349 #endif
1350 {
1351    RgInfL2MeasReq      measInfo;
1352    
1353    if(SRemPreMsgMult((Data *)&measInfo, sizeof(RgInfL2MeasReq), mBuf) != ROK)
1354    {
1355       RGSCHINF_FREE_MSG(mBuf);
1356       return RFAILED;
1357    }
1358
1359    RGSCHINF_FREE_MSG(mBuf);
1360    return ((*func)(pst, &measInfo));
1361 } /* end of cmUnpkSchMacL2MeasReq */
1362
1363 /**
1364 * @brief Primitive from SCH to MAC for L2 Measurement Stop request
1365 *
1366 * @details
1367 *
1368 *     Function : cmUnpkSchMacL2MeasStopReq
1369 *
1370 *  @param[in]    L2MeasReg            func
1371 *  @param[in]    Pst*                 pst
1372 *  @param[in]    Buffer               *mBuf
1373 *  @return   S16
1374 *      -# ROK
1375 **/
1376 #ifdef ANSI
1377 S16 cmUnpkSchMacL2MeasStopReq
1378 (
1379 L2MeasStopReq func,
1380 Pst            *pst,
1381 Buffer         *mBuf
1382 )
1383 #else
1384 S16 cmUnpkSchMacL2MeasStopReq(func, pst, mBuf)
1385 L2MeasStopReq      func;
1386 Pst            *pst;
1387 Buffer         *mBuf;
1388 #endif
1389 {
1390    RgInfL2MeasStopReq measInfo;
1391
1392    if(SRemPreMsgMult((Data *)&measInfo, sizeof(RgInfL2MeasStopReq), mBuf) != ROK)
1393    {
1394       SPutMsg(mBuf);
1395       return RFAILED;
1396    }
1397
1398    SPutMsg(mBuf);
1399    return ((*func)(pst, &measInfo));
1400 } /* end of cmUnpkSchMacL2MeasReq */
1401 /**
1402 * @brief Primitive from SCH to MAC for L2 Measurement request
1403 *
1404 * @details
1405 *
1406 *     Function : cmUnpkSchMacL2MeasReq
1407 *
1408 *  @param[in]    L2MeasReg            func
1409 *  @param[in]    Pst*                 pst
1410 *  @param[in]    Buffer               *mBuf
1411 *  @return   S16
1412 *      -# ROK
1413 **/
1414 #ifdef ANSI
1415 S16 cmUnpkSchMacL2MeasSendReq
1416 (
1417 L2MeasSendReq      func,
1418 Pst            *pst,
1419 Buffer         *mBuf
1420 )
1421 #else
1422 S16 cmUnpkSchMacL2MeasSendReq(func, pst, mBuf)
1423 L2MeasSendReq func;
1424 Pst            *pst;
1425 Buffer         *mBuf;
1426 #endif
1427 {
1428    RgInfL2MeasSndReq measInfo;
1429
1430  if(SRemPreMsgMult((Data *)&measInfo, sizeof(RgInfL2MeasSndReq), mBuf) != ROK)  
1431    {
1432       SPutMsg(mBuf);
1433       return RFAILED;
1434    }
1435
1436    SPutMsg(mBuf);
1437    return ((*func)(pst, &measInfo));
1438 } /* end of cmUnpkSchMacL2MeasSendReq*/
1439
1440 /**
1441 * @brief Primitive from MAC to SCH for L2 Measurement
1442 *
1443 * @details
1444 *
1445 *     Function : cmPkMacSchL2MeasCfm
1446 *
1447 *  @param[in]   Pst*                 pst
1448 *  @param[in]   RgInfL2MeasCfm       *measInfo
1449 *  @return   S16
1450 *      -# ROK
1451 **/
1452 #ifdef ANSI
1453 S16 cmPkMacSchL2MeasCfm
1454 (
1455 Pst*                 pst,
1456 RgInfL2MeasCfm       *measCfm
1457 )
1458 #else
1459 S16 cmPkMacSchL2MeasCfm(pst, measCfm)
1460 Pst*                 pst;
1461 RgInfL2MeasCfm       *measCfm;
1462 #endif
1463 {
1464    Buffer *mBuf = NULLP;
1465
1466    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
1467       return RFAILED;
1468    }
1469
1470    if(SAddPstMsgMult((Data *)measCfm, sizeof(RgInfL2MeasCfm), mBuf) != ROK)
1471    {
1472       RGSCHINF_FREE_MSG(mBuf);
1473       return RFAILED;
1474    }
1475
1476    pst->event = (Event) EVTINFL2MEASCFM;
1477    return (SPstTsk(pst,mBuf));
1478 } /* end of cmPkMacSchL2MeasCfm */
1479
1480
1481 /**
1482 * @brief Primitive from MAC to SCH for L2 Measurement
1483 *        stop cfm
1484 * @details
1485 *
1486 *     Function : cmPkMacSchL2MeasStopCfm
1487 *
1488 *  @param[in]   Pst*                 pst
1489 *  @param[in]   RgInfL2MeasCfm       *measInfo
1490 *  @return   S16
1491 *      -# ROK
1492 **/
1493 #ifdef ANSI
1494 S16 cmPkMacSchL2MeasStopCfm
1495 (
1496 Pst*                 pst,
1497 RgInfL2MeasCfm       *measCfm
1498 )
1499 #else
1500 S16 cmPkMacSchL2MeasStopCfm(pst, measCfm)
1501 Pst*                 pst;
1502 RgInfL2MeasCfm       *measCfm;
1503 #endif
1504 {
1505    Buffer *mBuf = NULLP;
1506
1507  if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
1508       return RFAILED;
1509    }
1510
1511    if(SAddPstMsgMult((Data *)measCfm, sizeof(RgInfL2MeasCfm), mBuf) != ROK)
1512    {
1513       SPutMsg(mBuf);
1514       return RFAILED;
1515    }
1516
1517    pst->event = (Event) EVTINFL2MEASSTOPCFM;
1518    return (SPstTsk(pst,mBuf));
1519 }/*cmPkMacSchL2MeasStopCfm*/
1520 /**
1521 * @brief Primitive from MAC to SCH for L2 Measurement Cfm
1522 *
1523 * @details
1524 *
1525 *     Function : cmUnpkSchMacL2MeasReq
1526 *
1527 *  @param[in]    L2MeasCfm            func
1528 *  @param[in]    Pst*                 pst
1529 *  @param[in]    Buffer               *mBuf
1530 *  @return   S16
1531 *      -# ROK
1532 **/
1533 #ifdef ANSI
1534 S16 cmUnpkMacSchL2MeasCfm
1535 (
1536 L2MeasCfm      func,
1537 Pst            *pst,
1538 Buffer         *mBuf
1539 )
1540 #else
1541 S16 cmUnpkMacSchL2MeasCfm(func, pst, mBuf)
1542 L2MeasCfm      func;
1543 Pst            *pst;
1544 Buffer         *mBuf;
1545 #endif
1546 {
1547    RgInfL2MeasCfm      measCfm;
1548    
1549    if(SRemPreMsgMult((Data *)&measCfm, sizeof(RgInfL2MeasCfm), mBuf) != ROK)
1550    {
1551       RGSCHINF_FREE_MSG(mBuf);
1552       return RFAILED;
1553    }
1554
1555    RGSCHINF_FREE_MSG(mBuf);
1556    return ((*func)(pst, &measCfm));
1557 } /* end of cmUnpkMacSchL2MeasCfm */
1558
1559 /**
1560 * @brief Primitive from MAC to SCH for L2 Measurement Stop  Cfm
1561 *
1562 * @details
1563 *
1564 *     Function : cmUnpkMacSchL2MeasStopCfm
1565 *
1566 *  @param[in]    L2MeasCfm            func
1567 *  @param[in]    Pst*                 pst
1568 *  @param[in]    Buffer               *mBuf
1569 *  @return   S16
1570 *      -# ROK
1571 **/
1572 #ifdef ANSI
1573 S16 cmUnpkMacSchL2MeasStopCfm
1574 (
1575 L2MeasCfm      func,
1576 Pst            *pst,
1577 Buffer         *mBuf
1578 )
1579 #else
1580 S16 cmUnpkMacSchL2MeasStopCfm(func, pst, mBuf)
1581 L2MeasCfm      func;
1582 Pst            *pst;
1583 Buffer         *mBuf;
1584 #endif
1585 {
1586 RgInfL2MeasCfm      measCfm;
1587
1588    if(SRemPreMsgMult((Data *)&measCfm, sizeof(RgInfL2MeasCfm), mBuf) != ROK)
1589    {
1590       SPutMsg(mBuf);
1591       return RFAILED;
1592    }
1593
1594    SPutMsg(mBuf);
1595    return ((*func)(pst, &measCfm));
1596 } /* end of cmUnpkMacSchL2MeasStopCfm */
1597
1598 #endif/* LTE_L2_MEAS */
1599
1600 #endif
1601
1602
1603 /**********************************************************************
1604  
1605          End of file
1606 **********************************************************************/