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