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