Added code for MAC-PHY interface, DU_APP, F1AP, SCTP and CU stub
[o-du/l2.git] / src / cm / rgu.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 RGU interface
26                primitives.
27   
28      File:     rgu.c 
29   
30 **********************************************************************/
31
32 /** @file rgu.c
33 @brief This file contains the packing/unpacking code for the RGU interface 
34        primitives.
35 */
36
37 /* header include files (.h) */
38 #include "envopt.h"        /* environment options */
39 #include "envdep.h"        /* environment dependent */
40 #include "envind.h"        /* environment independent */
41 #include "gen.h"           /* general */
42 #include "ssi.h"           /* system services */
43 #include "cm_tkns.h"       /* Common Token Defines */
44 #include "cm_llist.h"      /* Common Link List Defines */
45 #include "cm_hash.h"       /* Common Hash List Defines */
46 #include "cm_lte.h"        /* Common LTE Defines */
47 #include "rgu.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_lte.x"        /* Common LTE Defines */
57 #include "rgu.x"           /* RGU Interface includes */
58
59 #ifdef SS_RBUF
60 #include "ss_rbuf.h"
61 #include "ss_rbuf.x"
62 #endif
63
64 #ifdef LCRGU
65
66 \f
67 /**
68 * @brief Request from RLC to MAC to bind the interface saps
69 *
70 * @details
71 *
72 *     Function : cmPkRguBndReq
73 *
74 *  @param[in]   Pst*  pst
75 *  @param[in]   SuId  suId
76 *  @param[in]   SpId  spId
77 *  @return   S16
78 *      -# ROK
79 **/
80 #ifdef ANSI
81 PUBLIC S16 cmPkRguBndReq
82 (
83 Pst* pst,
84 SuId suId,
85 SpId spId
86 )
87 #else
88 PUBLIC S16 cmPkRguBndReq(pst, suId, spId)
89 Pst* pst;
90 SuId suId;
91 SpId spId;
92 #endif
93 {
94    Buffer *mBuf = NULLP;
95    TRC3(cmPkRguBndReq)
96
97    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
98 #if (ERRCLASS & ERRCLS_ADD_RES)      
99       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
100           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
101           (ErrVal)ERGU001, (ErrVal)0, "Packing failed");
102 #endif      
103       RETVALUE(RFAILED);
104    }
105    if (SPkS16(spId, mBuf) != ROK) {
106 #if (ERRCLASS & ERRCLS_ADD_RES)      
107       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
108           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
109           (ErrVal)ERGU002, (ErrVal)0, "Packing failed");
110 #endif      
111       SPutMsg(mBuf);
112       RETVALUE(RFAILED);
113    }
114    if (SPkS16(suId, mBuf) != ROK) {
115 #if (ERRCLASS & ERRCLS_ADD_RES)      
116       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
117           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
118           (ErrVal)ERGU003, (ErrVal)0, "Packing failed");
119 #endif      
120       SPutMsg(mBuf);
121       RETVALUE(RFAILED);
122    }
123    pst->event = (Event) EVTRGUBNDREQ;
124    RETVALUE(SPstTsk(pst,mBuf));
125 }
126
127 \f
128 /**
129 * @brief Request from RLC to MAC to bind the interface saps
130 *
131 * @details
132 *
133 *     Function : cmUnpkRguBndReq
134 *
135 *  @param[in]   Pst*  pst
136 *  @param[in]   SuId  suId
137 *  @param[in]   SpId  spId
138 *  @return   S16
139 *      -# ROK
140 **/
141 #ifdef ANSI
142 PUBLIC S16 cmUnpkRguBndReq
143 (
144 RguBndReq func,
145 Pst *pst,
146 Buffer *mBuf
147 )
148 #else
149 PUBLIC S16 cmUnpkRguBndReq(func, pst, mBuf)
150 RguBndReq func;
151 Pst *pst;
152 Buffer *mBuf;
153 #endif
154 {
155    SuId suId;
156    SpId spId;
157    
158    TRC3(cmUnpkRguBndReq)
159
160    if (SUnpkS16(&suId, mBuf) != ROK) {
161 #if (ERRCLASS & ERRCLS_ADD_RES)      
162       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
163           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
164           (ErrVal)ERGU004, (ErrVal)0, "UnPacking failed");
165 #endif      
166       SPutMsg(mBuf);
167       RETVALUE(RFAILED);
168    }
169    if (SUnpkS16(&spId, mBuf) != ROK) {
170 #if (ERRCLASS & ERRCLS_ADD_RES)      
171       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
172           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
173           (ErrVal)ERGU005, (ErrVal)0, "UnPacking failed");
174 #endif      
175       SPutMsg(mBuf);
176       RETVALUE(RFAILED);
177    }
178    SPutMsg(mBuf);
179    RETVALUE((*func)(pst, suId, spId));
180 }
181
182 \f
183 /**
184 * @brief Request from RLC to MAC to Unbind the interface saps
185 *
186 * @details
187 *
188 *     Function : cmPkRguUbndReq
189 *
190 *  @param[in]   Pst*  pst
191 *  @param[in]   SpId  spId
192 *  @param[in]   Reason  reason
193 *  @return   S16
194 *      -# ROK
195 **/
196 #ifdef ANSI
197 PUBLIC S16 cmPkRguUbndReq
198 (
199 Pst* pst,
200 SpId spId,
201 Reason reason
202 )
203 #else
204 PUBLIC S16 cmPkRguUbndReq(pst, spId, reason)
205 Pst* pst;
206 SpId spId;
207 Reason reason;
208 #endif
209 {
210    Buffer *mBuf = NULLP;
211    TRC3(cmPkRguUbndReq)
212
213    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
214 #if (ERRCLASS & ERRCLS_ADD_RES)      
215       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
216           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
217           (ErrVal)ERGU006, (ErrVal)0, "Packing failed");
218 #endif      
219       RETVALUE(RFAILED);
220    }
221    if (SPkS16(reason, mBuf) != ROK) {
222 #if (ERRCLASS & ERRCLS_ADD_RES)      
223       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
224           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
225           (ErrVal)ERGU007, (ErrVal)0, "Packing failed");
226 #endif      
227       SPutMsg(mBuf);
228       RETVALUE(RFAILED);
229    }
230    if (SPkS16(spId, mBuf) != ROK) {
231 #if (ERRCLASS & ERRCLS_ADD_RES)      
232       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
233           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
234           (ErrVal)ERGU008, (ErrVal)0, "Packing failed");
235 #endif      
236       SPutMsg(mBuf);
237       RETVALUE(RFAILED);
238    }
239    pst->event = (Event) EVTRGUUBNDREQ;
240    RETVALUE(SPstTsk(pst,mBuf));
241 }
242
243 \f
244 /**
245 * @brief Request from RLC to MAC to Unbind the interface saps
246 *
247 * @details
248 *
249 *     Function : cmUnpkRguUbndReq
250 *
251 *  @param[in]   Pst*  pst
252 *  @param[in]   SpId  spId
253 *  @param[in]   Reason  reason
254 *  @return   S16
255 *      -# ROK
256 **/
257 #ifdef ANSI
258 PUBLIC S16 cmUnpkRguUbndReq
259 (
260 RguUbndReq func,
261 Pst *pst,
262 Buffer *mBuf
263 )
264 #else
265 PUBLIC S16 cmUnpkRguUbndReq(func, pst, mBuf)
266 RguUbndReq func;
267 Pst *pst;
268 Buffer *mBuf;
269 #endif
270 {
271    SpId spId;
272    Reason reason;
273    
274    TRC3(cmUnpkRguUbndReq)
275
276    if (SUnpkS16(&spId, mBuf) != ROK) {
277 #if (ERRCLASS & ERRCLS_ADD_RES)      
278       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
279           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
280           (ErrVal)ERGU009, (ErrVal)0, "UnPacking failed");
281 #endif      
282       SPutMsg(mBuf);
283       RETVALUE(RFAILED);
284    }
285    if (SUnpkS16(&reason, mBuf) != ROK) {
286 #if (ERRCLASS & ERRCLS_ADD_RES)      
287       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
288           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
289           (ErrVal)ERGU010, (ErrVal)0, "UnPacking failed");
290 #endif      
291       SPutMsg(mBuf);
292       RETVALUE(RFAILED);
293    }
294    SPutMsg(mBuf);
295    RETVALUE((*func)(pst, spId, reason));
296 }
297
298 \f
299 /**
300 * @brief Confirmation from MAC to RLC for the bind/Unbind 
301  * request for the interface saps
302 *
303 * @details
304 *
305 *     Function : cmPkRguBndCfm
306 *
307 *  @param[in]   Pst*  pst
308 *  @param[in]   SuId  suId
309 *  @param[in]   U8  status
310 *  @return   S16
311 *      -# ROK
312 **/
313 #ifdef ANSI
314 PUBLIC S16 cmPkRguBndCfm
315 (
316 Pst* pst,
317 SuId suId,
318 U8 status
319 )
320 #else
321 PUBLIC S16 cmPkRguBndCfm(pst, suId, status)
322 Pst* pst;
323 SuId suId;
324 U8 status;
325 #endif
326 {
327    Buffer *mBuf = NULLP;
328    TRC3(cmPkRguBndCfm)
329
330    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
331 #if (ERRCLASS & ERRCLS_ADD_RES)      
332       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
333           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
334           (ErrVal)ERGU011, (ErrVal)0, "Packing failed");
335 #endif      
336       RETVALUE(RFAILED);
337    }
338    if (SPkU8(status, mBuf) != ROK) {
339 #if (ERRCLASS & ERRCLS_ADD_RES)      
340       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
341           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
342           (ErrVal)ERGU012, (ErrVal)0, "Packing failed");
343 #endif      
344       SPutMsg(mBuf);
345       RETVALUE(RFAILED);
346    }
347    if (SPkS16(suId, mBuf) != ROK) {
348 #if (ERRCLASS & ERRCLS_ADD_RES)      
349       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
350           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
351           (ErrVal)ERGU013, (ErrVal)0, "Packing failed");
352 #endif      
353       SPutMsg(mBuf);
354       RETVALUE(RFAILED);
355    }
356    pst->event = (Event) EVTRGUBNDCFM;
357    RETVALUE(SPstTsk(pst,mBuf));
358 }
359
360 \f
361 /**
362 * @brief Confirmation from MAC to RLC for the bind/Unbind 
363  * request for the interface saps
364 *
365 * @details
366 *
367 *     Function : cmUnpkRguBndCfm
368 *
369 *  @param[in]   Pst*  pst
370 *  @param[in]   SuId  suId
371 *  @param[in]   U8  status
372 *  @return   S16
373 *      -# ROK
374 **/
375 #ifdef ANSI
376 PUBLIC S16 cmUnpkRguBndCfm
377 (
378 RguBndCfm func,
379 Pst *pst,
380 Buffer *mBuf
381 )
382 #else
383 PUBLIC S16 cmUnpkRguBndCfm(func, pst, mBuf)
384 RguBndCfm func;
385 Pst *pst;
386 Buffer *mBuf;
387 #endif
388 {
389    SuId suId;
390    U8 status;
391    
392    TRC3(cmUnpkRguBndCfm)
393
394    if (SUnpkS16(&suId, mBuf) != ROK) {
395 #if (ERRCLASS & ERRCLS_ADD_RES)      
396       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
397           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
398           (ErrVal)ERGU014, (ErrVal)0, "UnPacking failed");
399 #endif      
400       SPutMsg(mBuf);
401       RETVALUE(RFAILED);
402    }
403    if (SUnpkU8(&status, mBuf) != ROK) {
404 #if (ERRCLASS & ERRCLS_ADD_RES)      
405       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
406           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
407           (ErrVal)ERGU015, (ErrVal)0, "UnPacking failed");
408 #endif      
409       SPutMsg(mBuf);
410       RETVALUE(RFAILED);
411    }
412    SPutMsg(mBuf);
413    RETVALUE((*func)(pst, suId, status));
414 }
415
416 \f
417 /**
418 * @brief Request from RLC to MAC for forwarding SDUs on common
419  * channel for transmission
420 *
421 * @details
422 *
423 *     Function : cmPkRguCDatReq
424 *
425 *  @param[in]   Pst*  pst
426 *  @param[in]   SpId  spId
427 *  @param[in]   RguCDatReqInfo  *  datReq
428 *  @return   S16
429 *      -# ROK
430 **/
431 #ifdef ANSI
432 PUBLIC S16 cmPkRguCDatReq
433 (
434 Pst* pst,
435 SpId spId,
436 RguCDatReqInfo  * datReq
437 )
438 #else
439 PUBLIC S16 cmPkRguCDatReq(pst, spId, datReq)
440 Pst* pst;
441 SpId spId;
442 RguCDatReqInfo  * datReq;
443 #endif
444 {
445    Buffer *mBuf = NULLP;
446    TRC3(cmPkRguCDatReq)
447
448    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
449 #if (ERRCLASS & ERRCLS_ADD_RES)      
450       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
451           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
452           (ErrVal)ERGU016, (ErrVal)0, "Packing failed");
453 #endif      
454       SPutSBuf(pst->region, pst->pool, (Data *)datReq, sizeof(RguCDatReqInfo));
455       RETVALUE(RFAILED);
456    }
457    if (pst->selector == RGU_SEL_LWLC)
458    {
459       CMCHKPK(cmPkPtr,(PTR) datReq, mBuf);
460    }
461    else
462    {
463       if (cmPkRguCDatReqInfo(datReq, mBuf) != ROK) {
464 #if (ERRCLASS & ERRCLS_ADD_RES)      
465          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
466           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
467           (ErrVal)ERGU017, (ErrVal)0, "Packing failed");
468 #endif      
469          SPutSBuf(pst->region, pst->pool, 
470                   (Data *)datReq, sizeof(RguCDatReqInfo));
471          SPutMsg(mBuf);
472          RETVALUE(RFAILED);
473       }
474       if (SPutSBuf(pst->region, pst->pool, 
475                    (Data *)datReq, sizeof(RguCDatReqInfo)) != ROK) {
476 #if (ERRCLASS & ERRCLS_ADD_RES)      
477          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
478              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
479              (ErrVal)ERGU019, (ErrVal)0, "Packing failed");
480 #endif      
481          SPutMsg(mBuf);
482          RETVALUE(RFAILED);
483       }
484       datReq = NULLP;
485    }
486
487    if (SPkS16(spId, mBuf) != ROK) {
488 #if (ERRCLASS & ERRCLS_ADD_RES)      
489       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
490           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
491           (ErrVal)ERGU018, (ErrVal)0, "Packing failed");
492 #endif      
493
494       if (datReq != NULLP)
495       {
496          SPutSBuf(pst->region, pst->pool, 
497                    (Data *)datReq, sizeof(RguCDatReqInfo));
498       }
499
500       SPutMsg(mBuf);
501       RETVALUE(RFAILED);
502    }
503
504    pst->event = (Event) EVTRGUCDATREQ;
505    RETVALUE(SPstTsk(pst,mBuf));
506 }
507
508 \f
509 /**
510 * @brief Request from RLC to MAC for forwarding SDUs on common
511  * channel for transmission
512 *
513 * @details
514 *
515 *     Function : cmUnpkRguCDatReq
516 *
517 *  @param[in]   Pst*  pst
518 *  @param[in]   SpId  spId
519 *  @param[in]   RguCDatReqInfo  *  datReq
520 *  @return   S16
521 *      -# ROK
522 **/
523 #ifdef ANSI
524 PUBLIC S16 cmUnpkRguCDatReq
525 (
526 RguCDatReq func,
527 Pst *pst,
528 Buffer *mBuf
529 )
530 #else
531 PUBLIC S16 cmUnpkRguCDatReq(func, pst, mBuf)
532 RguCDatReq func;
533 Pst *pst;
534 Buffer *mBuf;
535 #endif
536 {
537    SpId spId;
538    RguCDatReqInfo *datReq;
539    
540    TRC3(cmUnpkRguCDatReq)
541
542    if (SUnpkS16(&spId, mBuf) != ROK) {
543       SPutMsg(mBuf);
544       RETVALUE(RFAILED);
545    }
546    if (pst->selector == RGU_SEL_LWLC)
547    {
548       CMCHKUNPK(cmUnpkPtr,(PTR *) &datReq, mBuf);
549    }
550    else 
551    {
552       if ((SGetSBuf(pst->region, pst->pool, 
553                    (Data **)&datReq, sizeof(RguCDatReqInfo))) != ROK) {
554 #if (ERRCLASS & ERRCLS_ADD_RES)      
555          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
556              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
557              (ErrVal)ERGU020, (ErrVal)0, "UnPacking failed");
558 #endif      
559          SPutMsg(mBuf);
560          RETVALUE(RFAILED);
561      }
562      cmMemset((U8*)datReq, (U8)0, sizeof(RguCDatReqInfo));
563      if (cmUnpkRguCDatReqInfo(datReq, mBuf) != ROK) {
564 #if (ERRCLASS & ERRCLS_ADD_RES)      
565          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
566              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
567              (ErrVal)ERGU021, (ErrVal)0, "UnPacking failed");
568 #endif      
569          SPutMsg(mBuf);
570          SPutSBuf(pst->region, pst->pool, 
571                   (Data *)datReq, sizeof(RguCDatReqInfo));
572          RETVALUE(RFAILED);
573       }
574    }
575    SPutMsg(mBuf);
576    RETVALUE((*func)(pst, spId, datReq));
577 }
578
579 \f
580 /**
581 * @brief Request from RLC to MAC for forwarding SDUs on 
582  * dedicated channel for transmission
583 *
584 * @details
585 *
586 *     Function : cmPkRguDDatReq
587 *
588 *  @param[in]   Pst*  pst
589 *  @param[in]   SpId  spId
590 *  @param[in]   RguDDatReqInfo  *  datReq
591 *  @return   S16
592 *      -# ROK
593 **/
594 #ifdef ANSI
595 PUBLIC S16 cmPkRguDDatReq
596 (
597 Pst* pst,
598 SpId spId,
599 RguDDatReqInfo  * datReq
600 )
601 #else
602 PUBLIC S16 cmPkRguDDatReq(pst, spId, datReq)
603 Pst* pst;
604 SpId spId;
605 RguDDatReqInfo  * datReq;
606 #endif
607 {
608    Buffer *mBuf = NULLP;
609    TRC3(cmPkRguDDatReq)
610
611    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
612 #if (ERRCLASS & ERRCLS_ADD_RES)      
613       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
614           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
615           (ErrVal)ERGU022, (ErrVal)0, "Packing failed");
616 #endif      
617       SPutSBuf(pst->region, pst->pool, (Data *)datReq, sizeof(RguDDatReqInfo));
618       RETVALUE(RFAILED);
619    }
620
621    if (pst->selector == RGU_SEL_LWLC)
622    {
623       CMCHKPK(cmPkPtr,(PTR) datReq, mBuf);
624    }
625    else
626    {
627       /*rgu_c_001.main_5 - ADD - L2M Support */
628 #ifdef LTE_L2_MEAS
629       if (cmPkRguDDatReqInfo(pst, datReq, mBuf) != ROK)
630 #else
631       if (cmPkRguDDatReqInfo(datReq, mBuf) != ROK) 
632 #endif
633       {
634 #if (ERRCLASS & ERRCLS_ADD_RES)      
635          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
636           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
637           (ErrVal)ERGU023, (ErrVal)0, "Packing failed");
638 #endif      
639          SPutSBuf(pst->region, pst->pool, (Data *)datReq,
640                                        sizeof(RguDDatReqInfo));
641          SPutMsg(mBuf);
642          RETVALUE(RFAILED);
643       }
644
645       if (SPutSBuf(pst->region, pst->pool, 
646                    (Data *)datReq, sizeof(RguDDatReqInfo)) != ROK) {
647 #if (ERRCLASS & ERRCLS_ADD_RES)      
648          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
649               __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
650              (ErrVal)ERGU025, (ErrVal)0, "Packing failed");
651 #endif      
652          SPutMsg(mBuf);
653          RETVALUE(RFAILED);
654       }
655       datReq = NULLP;
656    }
657    if (SPkS16(spId, mBuf) != ROK) {
658 #if (ERRCLASS & ERRCLS_ADD_RES)      
659       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
660           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
661           (ErrVal)ERGU024, (ErrVal)0, "Packing failed");
662 #endif      
663       if (datReq != NULLP);
664       {
665          SPutSBuf(pst->region, pst->pool, 
666                   (Data *)datReq, sizeof(RguDDatReqInfo));
667       }
668       SPutMsg(mBuf);
669       RETVALUE(RFAILED);
670    }
671    pst->event = (Event) EVTRGUDDATREQ;
672    RETVALUE(SPstTsk(pst,mBuf));
673 }
674
675 \f
676 /**
677 * @brief Request from RLC to MAC for forwarding SDUs on 
678  * dedicated channel for transmission
679 *
680 * @details
681 *
682 *     Function : cmUnpkRguDDatReq
683 *
684 *  @param[in]   Pst*  pst
685 *  @param[in]   SpId  spId
686 *  @param[in]   RguDDatReqInfo  *  datReq
687 *  @return   S16
688 *      -# ROK
689 **/
690 #ifdef ANSI
691 PUBLIC S16 cmUnpkRguDDatReq
692 (
693 RguDDatReq func,
694 Pst *pst,
695 Buffer *mBuf
696 )
697 #else
698 PUBLIC S16 cmUnpkRguDDatReq(func, pst, mBuf)
699 RguDDatReq func;
700 Pst *pst;
701 Buffer *mBuf;
702 #endif
703 {
704    SpId spId;
705    RguDDatReqInfo *datReq;
706    
707    TRC3(cmUnpkRguDDatReq)
708
709    if (SUnpkS16(&spId, mBuf) != ROK) {
710       SPutMsg(mBuf);
711       RETVALUE(RFAILED);
712    }
713
714    if (pst->selector == RGU_SEL_LWLC)
715    {
716       CMCHKUNPK(cmUnpkPtr,(PTR *) &datReq, mBuf);
717    }
718    else 
719    {
720       if ((SGetSBuf(pst->region, pst->pool, 
721                      (Data **)&datReq, sizeof(RguDDatReqInfo))) != ROK) {
722 #if (ERRCLASS & ERRCLS_ADD_RES)      
723          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
724              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
725              (ErrVal)ERGU026, (ErrVal)0, "UnPacking failed");
726 #endif      
727          SPutMsg(mBuf);
728          RETVALUE(RFAILED);
729       }
730       cmMemset((U8*)datReq, (U8)0, sizeof(RguDDatReqInfo));
731   /*rgu_c_001.main_5 - ADD - L2M Support */
732 #ifdef LTE_L2_MEAS
733       if (cmUnpkRguDDatReqInfo(pst,datReq, mBuf) != ROK)
734 #else
735       if (cmUnpkRguDDatReqInfo(datReq, mBuf) != ROK) 
736 #endif
737       {
738 #if (ERRCLASS & ERRCLS_ADD_RES)      
739          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
740              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
741              (ErrVal)ERGU027, (ErrVal)0, "UnPacking failed");
742 #endif      
743          SPutMsg(mBuf);
744          SPutSBuf(pst->region, pst->pool, (Data *)datReq,
745                                      sizeof(RguDDatReqInfo));
746          RETVALUE(RFAILED);
747       }
748    }
749    SPutMsg(mBuf);
750    RETVALUE((*func)(pst, spId, datReq));
751 }
752
753 \f
754 /**
755 * @brief Data Indication from MAC to RLC to 
756  * forward the data received for common channels
757 *
758 * @details
759 *
760 *     Function : cmPkRguCDatInd
761 *
762 *  @param[in]   Pst*  pst
763 *  @param[in]   SuId  suId
764 *  @param[in]   RguCDatIndInfo  *  datInd
765 *  @return   S16
766 *      -# ROK
767 **/
768 #ifdef ANSI
769 PUBLIC S16 cmPkRguCDatInd
770 (
771 Pst* pst,
772 SuId suId,
773 RguCDatIndInfo  * datInd
774 )
775 #else
776 PUBLIC S16 cmPkRguCDatInd(pst, suId, datInd)
777 Pst* pst;
778 SuId suId;
779 RguCDatIndInfo  * datInd;
780 #endif
781 {
782    Buffer *mBuf = NULLP;
783    TRC3(cmPkRguCDatInd)
784
785    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
786 #if (ERRCLASS & ERRCLS_ADD_RES)      
787       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
788           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
789           (ErrVal)ERGU028, (ErrVal)0, "Packing failed");
790 #endif      
791       SPutStaticBuffer(pst->region, pst->pool, (Data *)datInd, sizeof(RguCDatIndInfo),0);
792       RETVALUE(RFAILED);
793    }
794    if (pst->selector == RGU_SEL_LWLC)
795    {
796       CMCHKPK(cmPkPtr,(PTR) datInd, mBuf);
797    }
798    else
799    {
800       if (cmPkRguCDatIndInfo(datInd, mBuf) != ROK) {
801 #if (ERRCLASS & ERRCLS_ADD_RES)      
802         SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
803             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
804             (ErrVal)ERGU029, (ErrVal)0, "Packing failed");
805 #endif      
806         SPutStaticBuffer(pst->region, pst->pool, (Data *)datInd,
807                                     sizeof(RguCDatIndInfo),0);
808         SPutMsg(mBuf);
809         RETVALUE(RFAILED);
810      }
811      if (SPutStaticBuffer(pst->region, pst->pool, (Data *)datInd, 
812                                sizeof(RguCDatIndInfo),0) != ROK) {
813 #if (ERRCLASS & ERRCLS_ADD_RES)      
814         SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
815             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
816             (ErrVal)ERGU031, (ErrVal)0, "Packing failed");
817 #endif      
818         SPutMsg(mBuf);
819         RETVALUE(RFAILED);
820      }
821      datInd = NULLP;
822   }
823    if (SPkS16(suId, mBuf) != ROK) {
824 #if (ERRCLASS & ERRCLS_ADD_RES)      
825       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
826           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
827           (ErrVal)ERGU030, (ErrVal)0, "Packing failed");
828 #endif      
829       SPutStaticBuffer(pst->region, pst->pool, (Data *)datInd, sizeof(RguCDatIndInfo),0);
830       SPutMsg(mBuf);
831       RETVALUE(RFAILED);
832    }
833
834    pst->event = (Event) EVTRGUCDATIND;
835    RETVALUE(SPstTsk(pst,mBuf));
836 }
837
838 \f
839 /**
840 * @brief Data Indication from MAC to RLC to 
841  * forward the data received for common channels
842 *
843 * @details
844 *
845 *     Function : cmUnpkRguCDatInd
846 *
847 *  @param[in]   Pst*  pst
848 *  @param[in]   SuId  suId
849 *  @param[in]   RguCDatIndInfo  *  datInd
850 *  @return   S16
851 *      -# ROK
852 **/
853 #ifdef ANSI
854 PUBLIC S16 cmUnpkRguCDatInd
855 (
856 RguCDatInd func,
857 Pst *pst,
858 Buffer *mBuf
859 )
860 #else
861 PUBLIC S16 cmUnpkRguCDatInd(func, pst, mBuf)
862 RguCDatInd func;
863 Pst *pst;
864 Buffer *mBuf;
865 #endif
866 {
867    SuId suId;
868    RguCDatIndInfo *datInd;
869    
870    TRC3(cmUnpkRguCDatInd)
871
872    if (SUnpkS16(&suId, mBuf) != ROK) {
873 #if (ERRCLASS & ERRCLS_ADD_RES)      
874       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
875           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
876           (ErrVal)ERGU032, (ErrVal)0, "UnPacking failed");
877 #endif      
878       SPutMsg(mBuf);
879       RETVALUE(RFAILED);
880    }
881
882    if (pst->selector == RGU_SEL_LWLC)
883    {
884       CMCHKUNPK(cmUnpkPtr,(PTR *) &datInd, mBuf);
885    }
886    else 
887    {
888       if ((SGetStaticBuffer(pst->region, pst->pool, 
889                     (Data **)&datInd, sizeof(RguCDatIndInfo),0)) != ROK) {
890 #if (ERRCLASS & ERRCLS_ADD_RES)      
891          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
892              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
893              (ErrVal)ERGU033, (ErrVal)0, "UnPacking failed");
894 #endif      
895          SPutMsg(mBuf);
896          RETVALUE(RFAILED);
897       }
898       if (cmUnpkRguCDatIndInfo(datInd, mBuf) != ROK) {
899 #if (ERRCLASS & ERRCLS_ADD_RES)      
900          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
901              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
902              (ErrVal)ERGU034, (ErrVal)0, "UnPacking failed");
903 #endif      
904          SPutMsg(mBuf);
905          SPutStaticBuffer(pst->region, pst->pool, (Data *)datInd, 
906                                        sizeof(RguCDatIndInfo),0);
907          RETVALUE(RFAILED);
908       }
909    }
910    SPutMsg(mBuf);
911    RETVALUE((*func)(pst, suId, datInd));
912 }
913
914 \f
915 /**
916 * @brief Data Indication from MAC to RLC to 
917  * forward the data received for dedicated channels
918 *
919 * @details
920 *
921 *     Function : cmPkRguDDatInd
922 *
923 *  @param[in]   Pst*  pst
924 *  @param[in]   SuId  suId
925 *  @param[in]   RguDDatIndInfo  *  datInd
926 *  @return   S16
927 *      -# ROK
928 **/
929 #ifdef ANSI
930 PUBLIC S16 cmPkRguDDatInd
931 (
932 Pst* pst,
933 SuId suId,
934 RguDDatIndInfo  * datInd
935 )
936 #else
937 PUBLIC S16 cmPkRguDDatInd(pst, suId, datInd)
938 Pst* pst;
939 SuId suId;
940 RguDDatIndInfo  * datInd;
941 #endif
942 {
943    Buffer *mBuf = NULLP;
944    TRC3(cmPkRguDDatInd)
945
946    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
947 #if (ERRCLASS & ERRCLS_ADD_RES)      
948       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
949           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
950           (ErrVal)ERGU035, (ErrVal)0, "Packing failed");
951 #endif      
952       SPutStaticBuffer(pst->region, pst->pool, (Data *)datInd, sizeof(RguDDatIndInfo),0);
953       RETVALUE(RFAILED);
954    }
955
956    if (pst->selector == RGU_SEL_LWLC)
957    {
958       CMCHKPK(cmPkPtr,(PTR) datInd, mBuf);
959    }
960    else
961    {
962       if (cmPkRguDDatIndInfo(datInd, mBuf) != ROK) {
963 #if (ERRCLASS & ERRCLS_ADD_RES)      
964             SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
965                 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
966                 (ErrVal)ERGU036, (ErrVal)0, "Packing failed");
967 #endif            
968          SPutStaticBuffer(pst->region, pst->pool, (Data *)datInd, sizeof(RguDDatIndInfo),0);
969          SPutMsg(mBuf);
970          RETVALUE(RFAILED);
971       }
972
973       if (SPutStaticBuffer(pst->region, pst->pool, 
974                       (Data *)datInd, sizeof(RguDDatIndInfo),0) != ROK) {
975 #if (ERRCLASS & ERRCLS_ADD_RES)      
976          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
977              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
978              (ErrVal)ERGU038, (ErrVal)0, "Packing failed");
979 #endif      
980          SPutMsg(mBuf);
981          RETVALUE(RFAILED);
982       }
983       datInd = NULLP;
984    }
985    if (SPkS16(suId, mBuf) != ROK) {
986 #if (ERRCLASS & ERRCLS_ADD_RES)      
987       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
988           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
989           (ErrVal)ERGU037, (ErrVal)0, "Packing failed");
990 #endif      
991       SPutStaticBuffer(pst->region, pst->pool, (Data *)datInd, sizeof(RguDDatIndInfo),0);
992       SPutMsg(mBuf);
993       RETVALUE(RFAILED);
994    }
995
996    pst->event = (Event) EVTRGUDDATIND;
997    RETVALUE(SPstTsk(pst,mBuf));
998 }
999
1000 \f
1001 /**
1002 * @brief Data Indication from MAC to RLC to 
1003  * forward the data received for dedicated channels
1004 *
1005 * @details
1006 *
1007 *     Function : cmUnpkRguDDatInd
1008 *
1009 *  @param[in]   Pst*  pst
1010 *  @param[in]   SuId  suId
1011 *  @param[in]   RguDDatIndInfo  *  datInd
1012 *  @return   S16
1013 *      -# ROK
1014 **/
1015 #ifdef ANSI
1016 PUBLIC S16 cmUnpkRguDDatInd
1017 (
1018 RguDDatInd func,
1019 Pst *pst,
1020 Buffer *mBuf
1021 )
1022 #else
1023 PUBLIC S16 cmUnpkRguDDatInd(func, pst, mBuf)
1024 RguDDatInd func;
1025 Pst *pst;
1026 Buffer *mBuf;
1027 #endif
1028 {
1029    SuId suId;
1030    RguDDatIndInfo *datInd;
1031    
1032    TRC3(cmUnpkRguDDatInd)
1033
1034    if (SUnpkS16(&suId, mBuf) != ROK) {
1035 #if (ERRCLASS & ERRCLS_ADD_RES)      
1036       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1037           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1038           (ErrVal)ERGU039, (ErrVal)0, "UnPacking failed");
1039 #endif      
1040       SPutMsg(mBuf);
1041       RETVALUE(RFAILED);
1042    }
1043
1044    if (pst->selector == RGU_SEL_LWLC)
1045    {
1046       CMCHKUNPK(cmUnpkPtr,(PTR *) &datInd, mBuf);
1047    }
1048    else 
1049    {
1050        if ((SGetStaticBuffer(pst->region, pst->pool, 
1051                     (Data **)&datInd, sizeof(RguDDatIndInfo),0)) != ROK) {
1052 #if (ERRCLASS & ERRCLS_ADD_RES)      
1053          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1054              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1055              (ErrVal)ERGU040, (ErrVal)0, "UnPacking failed");
1056 #endif      
1057          SPutMsg(mBuf);
1058          RETVALUE(RFAILED);
1059       }
1060       if (cmUnpkRguDDatIndInfo(datInd, mBuf) != ROK) {
1061 #if (ERRCLASS & ERRCLS_ADD_RES)      
1062          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1063              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1064              (ErrVal)ERGU041, (ErrVal)0, "UnPacking failed");
1065 #endif      
1066          SPutMsg(mBuf);
1067          SPutStaticBuffer(pst->region, pst->pool, 
1068                     (Data *)datInd, sizeof(RguDDatIndInfo),0);
1069          RETVALUE(RFAILED);
1070       }
1071    }
1072    SPutMsg(mBuf);
1073    RETVALUE((*func)(pst, suId, datInd));
1074 }
1075
1076 \f
1077 /**
1078 * @brief Primitive invoked from RLC to MAC to 
1079  * inform the BO report for common channels
1080 *
1081 * @details
1082 *
1083 *     Function : cmPkRguCStaRsp
1084 *
1085 *  @param[in]   Pst*  pst
1086 *  @param[in]   SpId  spId
1087 *  @param[in]   RguCStaRspInfo  *  staRsp
1088 *  @return   S16
1089 *      -# ROK
1090 **/
1091 #ifdef ANSI
1092 PUBLIC S16 cmPkRguCStaRsp
1093 (
1094 Pst* pst,
1095 SpId spId,
1096 RguCStaRspInfo  * staRsp
1097 )
1098 #else
1099 PUBLIC S16 cmPkRguCStaRsp(pst, spId, staRsp)
1100 Pst* pst;
1101 SpId spId;
1102 RguCStaRspInfo  * staRsp;
1103 #endif
1104 {
1105    Buffer *mBuf = NULLP;
1106    TRC3(cmPkRguCStaRsp)
1107
1108    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
1109 #if (ERRCLASS & ERRCLS_ADD_RES)      
1110       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1111           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1112           (ErrVal)ERGU042, (ErrVal)0, "Packing failed");
1113 #endif      
1114       SPutSBuf(pst->region, pst->pool, (Data *)staRsp, sizeof(RguCStaRspInfo));
1115       RETVALUE(RFAILED);
1116    }
1117    if (pst->selector == RGU_SEL_LWLC)
1118    {
1119       CMCHKPK(cmPkPtr,(PTR) staRsp, mBuf);
1120    }
1121    else
1122    {
1123       if (cmPkRguCStaRspInfo(staRsp, mBuf) != ROK) {
1124 #if (ERRCLASS & ERRCLS_ADD_RES)      
1125          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1126              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1127              (ErrVal)ERGU043, (ErrVal)0, "Packing failed");
1128 #endif      
1129          SPutSBuf(pst->region, pst->pool, (Data *)staRsp, 
1130                                      sizeof(RguCStaRspInfo));
1131          SPutMsg(mBuf);
1132          RETVALUE(RFAILED);
1133       }
1134
1135       if (SPutSBuf(pst->region, pst->pool, (Data *)staRsp, 
1136                                      sizeof(RguCStaRspInfo)) != ROK) {
1137 #if (ERRCLASS & ERRCLS_ADD_RES)      
1138       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1139           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1140           (ErrVal)ERGU045, (ErrVal)0, "Packing failed");
1141 #endif      
1142          SPutMsg(mBuf);
1143          RETVALUE(RFAILED);
1144       }
1145       staRsp = NULLP;
1146    }
1147    if (SPkS16(spId, mBuf) != ROK) {
1148 #if (ERRCLASS & ERRCLS_ADD_RES)      
1149       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1150           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1151           (ErrVal)ERGU044, (ErrVal)0, "Packing failed");
1152 #endif      
1153       if (staRsp != NULLP)
1154       {
1155          SPutSBuf(pst->region, pst->pool, 
1156                        (Data *)staRsp, sizeof(RguCStaRspInfo));
1157       }
1158       SPutMsg(mBuf);
1159       RETVALUE(RFAILED);
1160    }
1161
1162    pst->event = (Event) EVTRGUCSTARSP;
1163    RETVALUE(SPstTsk(pst,mBuf));
1164 }
1165
1166 \f
1167 /**
1168 * @brief Primitive invoked from RLC to MAC to 
1169  * inform the BO report for common channels
1170 *
1171 * @details
1172 *
1173 *     Function : cmUnpkRguCStaRsp
1174 *
1175 *  @param[in]   Pst*  pst
1176 *  @param[in]   SpId  spId
1177 *  @param[in]   RguCStaRspInfo  *  staRsp
1178 *  @return   S16
1179 *      -# ROK
1180 **/
1181 #ifdef ANSI
1182 PUBLIC S16 cmUnpkRguCStaRsp
1183 (
1184 RguCStaRsp func,
1185 Pst *pst,
1186 Buffer *mBuf
1187 )
1188 #else
1189 PUBLIC S16 cmUnpkRguCStaRsp(func, pst, mBuf)
1190 RguCStaRsp func;
1191 Pst *pst;
1192 Buffer *mBuf;
1193 #endif
1194 {
1195    SpId spId;
1196    RguCStaRspInfo *staRsp;
1197    
1198    TRC3(cmUnpkRguCStaRsp)
1199
1200    if (SUnpkS16(&spId, mBuf) != ROK) {
1201 #if (ERRCLASS & ERRCLS_ADD_RES)      
1202       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1203           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1204           (ErrVal)ERGU046, (ErrVal)0, "UnPacking failed");
1205 #endif      
1206       SPutMsg(mBuf);
1207       RETVALUE(RFAILED);
1208    }
1209    if (pst->selector == RGU_SEL_LWLC)
1210    {
1211       CMCHKUNPK(cmUnpkPtr,(PTR *) &staRsp, mBuf);
1212    }
1213    else 
1214    {
1215       if ((SGetSBuf(pst->region, pst->pool, (Data **)&staRsp, 
1216                                     sizeof(RguCStaRspInfo))) != ROK) {
1217 #if (ERRCLASS & ERRCLS_ADD_RES)      
1218          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1219              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1220              (ErrVal)ERGU047, (ErrVal)0, "UnPacking failed");
1221 #endif      
1222          SPutMsg(mBuf);
1223          RETVALUE(RFAILED);
1224       }
1225       if (cmUnpkRguCStaRspInfo(staRsp, mBuf) != ROK) {
1226 #if (ERRCLASS & ERRCLS_ADD_RES)      
1227          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1228              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1229              (ErrVal)ERGU048, (ErrVal)0, "UnPacking failed");
1230 #endif      
1231          SPutMsg(mBuf);
1232          SPutSBuf(pst->region, pst->pool, (Data *)staRsp, 
1233                                           sizeof(RguCStaRspInfo));
1234          RETVALUE(RFAILED);
1235       }
1236    }
1237    SPutMsg(mBuf);
1238    RETVALUE((*func)(pst, spId, staRsp));
1239 }
1240
1241 /*rgu_c_001.main_5 - ADD - L2M & R9 Support */
1242 #ifdef LTE_L2_MEAS
1243
1244 /***********************************************************
1245 *
1246 *     Func :cmPkRguL2MUlThrpMeasReqInfo 
1247 *
1248 *
1249 * Status Response from RLC to MAC on UL dedicated logical channel for Uplink
1250 * Scheduled throughput measurement
1251 *
1252 *
1253 *     Ret  : S16
1254 *
1255 *     Notes:
1256 *
1257 *     File  : 
1258 *
1259 **********************************************************/
1260 #ifdef ANSI
1261 PUBLIC S16 cmPkRguL2MUlThrpMeasReqInfo 
1262 (
1263 RguL2MUlThrpMeasReqInfo* param,
1264 Buffer *mBuf
1265 )
1266 #else
1267 PUBLIC S16 cmPkRguL2MUlThrpMeasReqInfo(param, mBuf)
1268 RguL2MUlThrpMeasReqInfo* param;
1269 Buffer *mBuf;
1270 #endif
1271 {
1272    S32 loop;
1273    TRC3(cmPkRguL2MUlThrpMeasReqInfo);
1274
1275    CMCHKPK(SPkU8, param->enbMeas, mBuf);
1276    for (loop=param->numLcId-1; loop >= 0; loop--)
1277    {
1278       CMCHKPK(SPkU8, param->lcId[loop], mBuf);
1279    }
1280    CMCHKPK(cmPkLteLcId, param->numLcId, mBuf);
1281    CMCHKPK(cmPkLteRnti, param->rnti, mBuf);
1282    CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
1283    RETVALUE(ROK);
1284 }
1285
1286
1287 \f
1288 /***********************************************************
1289 *
1290 *     Func :cmUnpkRguL2MUlThrpMeasReqInfo 
1291 *
1292 *
1293 * Status Response from RLC to MAC on UL dedicated logical channel for Uplink
1294 * Scheduled throughput measurement
1295 *
1296 *
1297 *     Ret  : S16
1298 *
1299 *     Notes:
1300 *
1301 *     File  : 
1302 *
1303 **********************************************************/
1304 #ifdef ANSI
1305 PUBLIC S16 cmUnpkRguL2MUlThrpMeasReqInfo 
1306 (
1307 RguL2MUlThrpMeasReqInfo *param,
1308 Buffer *mBuf
1309 )
1310 #else
1311 PUBLIC S16 cmUnpkRguL2MUlThrpMeasReqInfo(param, mBuf)
1312 RguL2MUlThrpMeasReqInfo *param;
1313 Buffer *mBuf;
1314 #endif
1315 {
1316    U8 loop;
1317    TRC3(cmUnpkRguL2MUlThrpMeasReqInfo);
1318
1319    CMCHKUNPK(cmUnpkLteCellId, &param->cellId, mBuf);
1320    CMCHKUNPK(cmUnpkLteRnti, &param->rnti, mBuf);
1321    CMCHKUNPK(cmUnpkLteLcId, &param->numLcId, mBuf);
1322    for (loop=0; loop<param->numLcId; loop++)
1323    {
1324       CMCHKUNPK(SUnpkU8, &param->lcId[loop], mBuf);
1325    }
1326    CMCHKUNPK(SUnpkU8, &param->enbMeas, mBuf);
1327    RETVALUE(ROK);
1328 }
1329
1330 /**
1331 * @brief Primitive invoked from RLC to MAC to 
1332 * inform the On/Off status for Scheduled UL throughput 
1333 * measurment for dedicated channels
1334 *
1335 * @details
1336 *
1337 *     Function :cmPkRguL2MUlThrpMeasReq 
1338 *
1339 *  @param[in]   Pst*  pst
1340 *  @param[in]   SpId  spId
1341 *  @param[in]   RguL2MUlThrpMeasReqInfo*  measReq
1342 *  @return   S16
1343 *      -# ROK
1344 **/
1345 #ifdef ANSI
1346 PUBLIC S16 cmPkRguL2MUlThrpMeasReq 
1347 (
1348 Pst* pst,
1349 SpId spId,
1350 RguL2MUlThrpMeasReqInfo* measReq
1351 )
1352 #else
1353 PUBLIC S16 cmPkRguL2MUlThrpMeasReq(pst, spId, measReq)
1354 Pst* pst;
1355 SpId spId;
1356 RguL2MUlThrpMeasReqInfo* measReq;
1357 #endif
1358 {
1359    Buffer *mBuf = NULLP;
1360    TRC3(cmPkRguL2MUlThrpMeasReq)
1361
1362    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
1363 #if (ERRCLASS & ERRCLS_ADD_RES)      
1364       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1365           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1366           (ErrVal)ERGU049, (ErrVal)0, "Packing failed");
1367 #endif      
1368       SPutSBuf(pst->region, pst->pool, (Data *)measReq, sizeof(RguL2MUlThrpMeasReqInfo));
1369       RETVALUE(RFAILED);
1370    }
1371    if (pst->selector == RGU_SEL_LWLC)
1372    {
1373       CMCHKPK(cmPkPtr,(PTR) measReq, mBuf);
1374    }
1375    else
1376    {
1377       if (cmPkRguL2MUlThrpMeasReqInfo(measReq, mBuf) != ROK) {
1378 #if (ERRCLASS & ERRCLS_ADD_RES)      
1379          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1380              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1381              (ErrVal)ERGU050, (ErrVal)0, "Packing failed");
1382 #endif      
1383          SPutSBuf(pst->region, pst->pool, (Data *)measReq, 
1384                                     sizeof(RguL2MUlThrpMeasReqInfo));
1385          SPutMsg(mBuf);
1386          RETVALUE(RFAILED);
1387       }
1388       if (SPutSBuf(pst->region, pst->pool, (Data *)measReq, 
1389                            sizeof(RguL2MUlThrpMeasReqInfo)) != ROK) {
1390 #if (ERRCLASS & ERRCLS_ADD_RES)      
1391          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1392             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1393              (ErrVal)ERGU052, (ErrVal)0, "Packing failed");
1394 #endif      
1395          SPutMsg(mBuf);
1396          RETVALUE(RFAILED);
1397       }
1398       measReq = NULLP;
1399    }
1400
1401    if (SPkS16(spId, mBuf) != ROK) {
1402 #if (ERRCLASS & ERRCLS_ADD_RES)      
1403       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1404           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1405           (ErrVal)ERGU051, (ErrVal)0, "Packing failed");
1406 #endif      
1407       if (measReq != NULLP)
1408       {
1409          SPutSBuf(pst->region, pst->pool, (Data *)measReq,
1410                              sizeof(RguL2MUlThrpMeasReqInfo));
1411       }
1412       SPutMsg(mBuf);
1413       RETVALUE(RFAILED);
1414    }
1415
1416    pst->event = (Event) EVTRGUL2MULTHRPMEASREQ;
1417    RETVALUE(SPstTsk(pst,mBuf));
1418 }
1419
1420 \f
1421 /**
1422 * @brief Primitive invoked from RLC to MAC to 
1423 * inform the On/Off status for Scheduled UL throughput 
1424 * measurment for dedicated channels
1425 *
1426 * @details
1427 *
1428 *     Function :cmUnpkRguL2MUlThrpMeasReq 
1429 *
1430 *  @param[in]   Pst*  pst
1431 *  @param[in]   SpId  spId
1432 *  @param[in]   RguL2MUlThrpMeasReqInfo  * measReq 
1433 *  @return   S16
1434 *      -# ROK
1435 **/
1436 #ifdef ANSI
1437 PUBLIC S16 cmUnpkRguL2MUlThrpMeasReq 
1438 (
1439 RguL2MUlThrpMeasReq func,
1440 Pst *pst,
1441 Buffer *mBuf
1442 )
1443 #else
1444 PUBLIC S16 cmUnpkRguL2MUlThrpMeasReq(func, pst, mBuf)
1445 RguL2MUlThrpMeasReq func;
1446 Pst *pst;
1447 Buffer *mBuf;
1448 #endif
1449 {
1450    SpId spId;
1451    RguL2MUlThrpMeasReqInfo* measReq;
1452    
1453    TRC3(cmUnpkRguL2MUlThrpMeasReq)
1454
1455    if (SUnpkS16(&spId, mBuf) != ROK) {
1456 #if (ERRCLASS & ERRCLS_ADD_RES)      
1457       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1458           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1459           (ErrVal)ERGU053, (ErrVal)0, "UnPacking failed");
1460 #endif      
1461       SPutMsg(mBuf);
1462       RETVALUE(RFAILED);
1463    }
1464    if (pst->selector == RGU_SEL_LWLC)
1465    {
1466       CMCHKUNPK(cmUnpkPtr,(PTR *) &measReq, mBuf);
1467    }
1468    else 
1469    {
1470       if ((SGetSBuf(pst->region, pst->pool, (Data **)&measReq,
1471                               sizeof(RguL2MUlThrpMeasReqInfo))) != ROK) {
1472 #if (ERRCLASS & ERRCLS_ADD_RES)      
1473          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1474              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1475              (ErrVal)ERGU054, (ErrVal)0, "UnPacking failed");
1476 #endif      
1477          SPutMsg(mBuf);
1478          RETVALUE(RFAILED);
1479       }
1480       if (cmUnpkRguL2MUlThrpMeasReqInfo(measReq, mBuf) != ROK) {
1481 #if (ERRCLASS & ERRCLS_ADD_RES)      
1482          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1483              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1484              (ErrVal)ERGU055, (ErrVal)0, "UnPacking failed");
1485 #endif      
1486          SPutMsg(mBuf);
1487          SPutSBuf(pst->region, pst->pool, (Data *)measReq, 
1488                                 sizeof(RguL2MUlThrpMeasReqInfo));
1489          RETVALUE(RFAILED);
1490       }
1491    }
1492    SPutMsg(mBuf);
1493    RETVALUE((*func)(pst, spId, measReq));
1494 }
1495
1496 #endif
1497
1498
1499
1500 \f
1501 /**
1502 * @brief Primitive invoked from RLC to MAC to 
1503  * inform the BO report for dedicated channels
1504 *
1505 * @details
1506 *
1507 *     Function : cmPkRguDStaRsp
1508 *
1509 *  @param[in]   Pst*  pst
1510 *  @param[in]   SpId  spId
1511 *  @param[in]   RguDStaRspInfo  *  staRsp
1512 *  @return   S16
1513 *      -# ROK
1514 **/
1515 #ifdef ANSI
1516 PUBLIC S16 cmPkRguDStaRsp
1517 (
1518 Pst* pst,
1519 SpId spId,
1520 RguDStaRspInfo  *staRsp
1521 )
1522 #else
1523 PUBLIC S16 cmPkRguDStaRsp(pst, spId, staRsp)
1524 Pst* pst;
1525 SpId spId;
1526 RguDStaRspInfo  *staRsp;
1527 #endif
1528 {
1529
1530    RguDStaRspInfo  *staRspInfo = NULL;
1531    Buffer *mBuf = NULLP;
1532
1533    if(SGetSBuf(pst->region, pst->pool, (Data **)&staRspInfo, sizeof(RguDStaRspInfo)) != ROK)
1534    {
1535 #if (ERRCLASS & ERRCLS_ADD_RES)      
1536       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1537             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1538             (ErrVal)ERGU056, (ErrVal)0, "Packing failed");
1539 #endif      
1540       RETVALUE(RFAILED);
1541    }
1542 #ifdef ERRCLS_KW
1543    /* staRspInfo cant be NULL here */
1544    if (staRspInfo == NULLP)
1545    {
1546       RETVALUE(RFAILED);
1547    }
1548 #endif
1549    cmMemcpy((U8 *)staRspInfo, (U8 *)staRsp, sizeof(RguDStaRspInfo)); 
1550    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
1551 #if (ERRCLASS & ERRCLS_ADD_RES)      
1552       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1553           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1554           (ErrVal)ERGU056, (ErrVal)0, "Packing failed");
1555 #endif      
1556          SPutSBuf(pst->region, pst->pool, (Data *)staRspInfo, sizeof(RguDStaRspInfo));
1557
1558       RETVALUE(RFAILED);
1559    }
1560    if (pst->selector == RGU_SEL_LWLC)
1561    {
1562       CMCHKPK(cmPkPtr,(PTR) staRspInfo, mBuf);
1563    }
1564    else
1565    {
1566       if (cmPkRguDStaRspInfo(staRsp, mBuf) != ROK) {
1567 #if (ERRCLASS & ERRCLS_ADD_RES)      
1568         SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1569             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1570             (ErrVal)ERGU057, (ErrVal)0, "Packing failed");
1571 #endif      
1572         SPutMsg(mBuf);
1573         RETVALUE(RFAILED);
1574      }
1575    }
1576    if (SPkS16(spId, mBuf) != ROK) {
1577 #if (ERRCLASS & ERRCLS_ADD_RES)      
1578       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1579           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1580           (ErrVal)ERGU058, (ErrVal)0, "Packing failed");
1581 #endif      
1582       if (staRspInfo != NULLP)
1583       {
1584          SPutSBuf(pst->region, pst->pool, (Data *)staRspInfo, sizeof(RguDStaRspInfo));
1585       }
1586       SPutMsg(mBuf);
1587       RETVALUE(RFAILED);
1588    }
1589
1590    pst->event = (Event) EVTRGUDSTARSP;
1591    RETVALUE(SPstTsk(pst,mBuf));
1592    SPutMsg(mBuf);
1593 }
1594
1595 \f
1596 /**
1597 * @brief Primitive invoked from RLC to MAC to 
1598  * inform the BO report for dedicated channels
1599 *
1600 * @details
1601 *
1602 *     Function : cmUnpkRguDStaRsp
1603 *
1604 *  @param[in]   Pst*  pst
1605 *  @param[in]   SpId  spId
1606 *  @param[in]   RguDStaRspInfo  *  staRsp
1607 *  @return   S16
1608 *      -# ROK
1609 **/
1610 #ifdef ANSI
1611 PUBLIC S16 cmUnpkRguDStaRsp
1612 (
1613 RguDStaRsp func,
1614 Pst *pst,
1615 Buffer *mBuf
1616 )
1617 #else
1618 PUBLIC S16 cmUnpkRguDStaRsp(func, pst, mBuf)
1619 RguDStaRsp func;
1620 Pst *pst;
1621 Buffer *mBuf;
1622 #endif
1623 {
1624    SpId spId;
1625    RguDStaRspInfo *staRsp;
1626    
1627    TRC3(cmUnpkRguDStaRsp)
1628
1629    if (SUnpkS16(&spId, mBuf) != ROK) {
1630 #if (ERRCLASS & ERRCLS_ADD_RES)      
1631       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1632           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1633           (ErrVal)ERGU060, (ErrVal)0, "UnPacking failed");
1634 #endif      
1635       SPutMsg(mBuf);
1636       RETVALUE(RFAILED);
1637    }
1638
1639    if (pst->selector == RGU_SEL_LWLC)
1640    {
1641       CMCHKUNPK(cmUnpkPtr,(PTR *) &staRsp, mBuf);
1642    }
1643    else
1644    {
1645       if ((SGetSBuf(pst->region, pst->pool, (Data **)&staRsp, 
1646                                  sizeof(RguDStaRspInfo))) != ROK) {
1647 #if (ERRCLASS & ERRCLS_ADD_RES)      
1648          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1649              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1650              (ErrVal)ERGU061, (ErrVal)0, "UnPacking failed");
1651 #endif      
1652          SPutMsg(mBuf);
1653          RETVALUE(RFAILED);
1654       }
1655       if (cmUnpkRguDStaRspInfo(staRsp, mBuf) != ROK) {
1656 #if (ERRCLASS & ERRCLS_ADD_RES)      
1657          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1658              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1659              (ErrVal)ERGU062, (ErrVal)0, "UnPacking failed");
1660 #endif      
1661          SPutMsg(mBuf);
1662          SPutSBuf(pst->region, pst->pool, (Data *)staRsp, sizeof(RguDStaRspInfo));
1663          RETVALUE(RFAILED);
1664       }
1665    }
1666    SPutMsg(mBuf);
1667    (*func)(pst, spId, staRsp);
1668    SPutSBuf(pst->region, pst->pool, (Data *)staRsp, sizeof(RguDStaRspInfo));
1669    RETVALUE(ROK);
1670 }
1671
1672 \f
1673 /**
1674 * @brief Status Indication from MAC to RLC  
1675  * as a response to the staRsp primitive from RLC.
1676  * Informs RLC of the totalBufferSize and Timing Info 
1677  * for the transmission on common channels.
1678 *
1679 * @details
1680 *
1681 *     Function : cmPkRguCStaInd
1682 *
1683 *  @param[in]   Pst*  pst
1684 *  @param[in]   SuId  suId
1685 *  @param[in]   RguCStaIndInfo  *  staInd
1686 *  @return   S16
1687 *      -# ROK
1688 **/
1689 #ifdef ANSI
1690 PUBLIC S16 cmPkRguCStaInd
1691 (
1692 Pst* pst,
1693 SuId suId,
1694 RguCStaIndInfo  * staInd
1695 )
1696 #else
1697 PUBLIC S16 cmPkRguCStaInd(pst, suId, staInd)
1698 Pst* pst;
1699 SuId suId;
1700 RguCStaIndInfo  * staInd;
1701 #endif
1702 {
1703    Buffer *mBuf = NULLP;
1704    TRC3(cmPkRguCStaInd)
1705
1706    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
1707 #if (ERRCLASS & ERRCLS_ADD_RES)      
1708       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1709           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1710           (ErrVal)ERGU063, (ErrVal)0, "Packing failed");
1711 #endif      
1712       SPutSBuf(pst->region, pst->pool, (Data *)staInd, sizeof(RguCStaIndInfo));
1713       RETVALUE(RFAILED);
1714    }
1715       if (pst->selector == RGU_SEL_LWLC)
1716    {
1717       CMCHKPK(cmPkPtr,(PTR) staInd, mBuf);
1718    }
1719    else
1720    {
1721       if (cmPkRguCStaIndInfo(staInd, mBuf) != ROK) {
1722 #if (ERRCLASS & ERRCLS_ADD_RES)      
1723             SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1724                 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1725                 (ErrVal)ERGU064, (ErrVal)0, "Packing failed");
1726 #endif      
1727          SPutSBuf(pst->region, pst->pool, (Data *)staInd, sizeof(RguCStaIndInfo));
1728          SPutMsg(mBuf);
1729          RETVALUE(RFAILED);
1730       }
1731       if (SPutSBuf(pst->region, pst->pool, 
1732                     (Data *)staInd, sizeof(RguCStaIndInfo)) != ROK) {
1733 #if (ERRCLASS & ERRCLS_ADD_RES)      
1734          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1735              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1736              (ErrVal)ERGU066, (ErrVal)0, "Packing failed");
1737 #endif      
1738          SPutMsg(mBuf);
1739          RETVALUE(RFAILED);
1740       }
1741       staInd = NULLP;
1742   }
1743   if (SPkS16(suId,mBuf) != ROK) {
1744 #if (ERRCLASS & ERRCLS_ADD_RES)      
1745       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1746           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1747           (ErrVal)ERGU065, (ErrVal)0, "Packing failed");
1748 #endif      
1749       if (staInd != NULLP)
1750       {
1751          SPutSBuf(pst->region, pst->pool, (Data *)staInd,
1752                                      sizeof(RguCStaIndInfo));
1753       }
1754       SPutMsg(mBuf);
1755       RETVALUE(RFAILED);
1756    }
1757    pst->event = (Event) EVTRGUCSTAIND;
1758    RETVALUE(SPstTsk(pst,mBuf));
1759 }
1760
1761 \f
1762 /**
1763 * @brief Status Indication from MAC to RLC  
1764  * as a response to the staRsp primitive from RLC.
1765  * Informs RLC of the totalBufferSize and Timing Info 
1766  * for the transmission on common channels.
1767 *
1768 * @details
1769 *
1770 *     Function : cmUnpkRguCStaInd
1771 *
1772 *  @param[in]   Pst*  pst
1773 *  @param[in]   SuId  suId
1774 *  @param[in]   RguCStaIndInfo  *  staInd
1775 *  @return   S16
1776 *      -# ROK
1777 **/
1778 #ifdef ANSI
1779 PUBLIC S16 cmUnpkRguCStaInd
1780 (
1781 RguCStaInd func,
1782 Pst *pst,
1783 Buffer *mBuf
1784 )
1785 #else
1786 PUBLIC S16 cmUnpkRguCStaInd(func, pst, mBuf)
1787 RguCStaInd func;
1788 Pst *pst;
1789 Buffer *mBuf;
1790 #endif
1791 {
1792    SuId suId;
1793    RguCStaIndInfo *staInd;
1794    
1795    TRC3(cmUnpkRguCStaInd)
1796
1797    if (SUnpkS16(&suId, mBuf) != ROK) {
1798 #if (ERRCLASS & ERRCLS_ADD_RES)      
1799       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1800           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1801           (ErrVal)ERGU067, (ErrVal)0, "UnPacking failed");
1802 #endif      
1803       SPutMsg(mBuf);
1804       RETVALUE(RFAILED);
1805    }
1806
1807    if (pst->selector == RGU_SEL_LWLC)
1808    {
1809       CMCHKUNPK(cmUnpkPtr,(PTR *) &staInd, mBuf);
1810    }
1811    else
1812    {
1813       if ((SGetSBuf(pst->region, pst->pool, (Data **)&staInd, sizeof(RguCStaIndInfo))) != ROK) {
1814 #if (ERRCLASS & ERRCLS_ADD_RES)      
1815            SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1816                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1817                (ErrVal)ERGU068, (ErrVal)0, "UnPacking failed");
1818 #endif      
1819          SPutMsg(mBuf);
1820          RETVALUE(RFAILED);
1821       }
1822       if (cmUnpkRguCStaIndInfo(staInd, mBuf) != ROK) {
1823 #if (ERRCLASS & ERRCLS_ADD_RES)      
1824          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1825              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1826              (ErrVal)ERGU069, (ErrVal)0, "UnPacking failed");
1827 #endif      
1828          SPutMsg(mBuf);
1829          SPutSBuf(pst->region, pst->pool, (Data *)staInd, sizeof(RguCStaIndInfo));
1830          RETVALUE(RFAILED);
1831       }
1832    }
1833    SPutMsg(mBuf);
1834    RETVALUE((*func)(pst, suId, staInd));
1835 }
1836
1837    /*rgu_c_001.main_5 - ADD - L2M Support */
1838 #ifdef LTE_L2_MEAS
1839 #if 0
1840 \f
1841 /**
1842 * @brief Packing function for RguLchMapInfo
1843 *
1844 * @details
1845 *
1846 *     Function : cmPkRguLchMapInfo
1847 *  @param[in]   RguLchMapInfo  *param
1848 *  @param[out]  Buffer         *mBuf 
1849 *  @return  Void 
1850 **/
1851 #ifdef ANSI
1852 PRIVATE S16 cmPkRguLchMapInfo
1853 (
1854 RguLchMapInfo   *param,
1855 Buffer          *mBuf
1856 )
1857 #else
1858 PRIVATE S16 cmPkRguLchMapInfo(param, mBuf)
1859 RguLchMapInfo   *param;
1860 Buffer          *mBuf;
1861 #endif
1862 {
1863    U8    idx;
1864
1865    TRC3(cmPkRguLchMapInfo);
1866
1867    for(idx = 0; idx < RGU_MAX_LC; idx++)
1868    {
1869       CMCHKPK(SPkU16, param->snList[idx], mBuf);
1870    }
1871    CMCHKPK(cmPkLteLcId, param->lChId, mBuf);
1872
1873    RETVALUE(ROK);
1874 }
1875
1876 /**
1877 * @brief Unpacking function for RguLchMapInfo
1878 *
1879 * @details
1880 *
1881 *     Function : cmUnpkRguLchMapInfo
1882 *
1883 *  @param[out] RguLchMapInfo  *param
1884 *  @param[in]  Buffer        *mBuf
1885 *  @return   Void
1886 **/
1887 #ifdef ANSI
1888 PRIVATE S16 cmUnpkRguLchMapInfo
1889 (
1890 RguLchMapInfo *param, 
1891 Buffer       *mBuf
1892 )
1893 #else
1894 PRIVATE S16 cmUnpkRguLchMapInfo(param, mBuf)
1895 RguLchMapInfo *param;   
1896 Buffer       *mBuf;
1897 #endif
1898 {
1899    U8    idx;
1900
1901    TRC3(cmUnpkRguLchMapInfo)
1902
1903    CMCHKUNPK(cmUnpkLteLcId, &param->lChId, mBuf);
1904    for(idx = RGU_MAX_LC; idx > 0; idx--)
1905    {
1906       CMCHKUNPK(SUnpkU16, &param->snList[idx - 1], mBuf);
1907    }
1908
1909    RETVALUE(ROK);
1910 }
1911 #endif
1912 \f
1913 /**
1914 * @brief Harq Status Indication from MAC to RLC  
1915 *
1916 * @details
1917 *
1918 *     Function : cmPkRguHqStaInd
1919 *
1920 *  @param[in]   Pst*  pst
1921 *  @param[in]   SuId  suId
1922 *  @param[in]   RguHarqStatusInd  *harqStatusInd
1923 *  @return   S16
1924 *      -# ROK
1925 **/
1926 #ifdef ANSI
1927 PUBLIC S16 cmPkRguHqStaInd
1928 (
1929 Pst* pst,
1930 SuId suId,
1931 RguHarqStatusInd  *harqStatusInd
1932 )
1933 #else
1934 PUBLIC S16 cmPkRguHqStaInd(pst, suId, harqStatusInd)
1935 Pst* pst;
1936 SuId suId;
1937 RguHarqStatusInd  *harqStatusInd;
1938 #endif
1939 {
1940
1941    Buffer   *mBuf;
1942    U8       idx;
1943    RguHarqStatusInd *harqStaInd = NULL;
1944
1945    TRC3(cmPkRguHqStaInd)
1946 #ifdef XEON_SPECIFIC_CHANGES
1947    if (SGetSBuf(pst->region, pst->pool, (Data **)&harqStaInd, sizeof(RguHarqStatusInd)) != ROK)
1948 #else      
1949    if ((SGetStaticBuffer(pst->region, pst->pool, 
1950                (Data **)&harqStaInd, sizeof(RguHarqStatusInd),0)) != ROK)
1951 #endif      
1952    {
1953 #if (ERRCLASS & ERRCLS_ADD_RES)      
1954       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1955             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1956             (ErrVal)ERGU070, (ErrVal)0, "Packing failed");
1957 #endif      
1958       RETVALUE(RFAILED);
1959    }
1960
1961    cmMemcpy((U8 *)harqStaInd, (U8 *)harqStatusInd, sizeof(RguHarqStatusInd));
1962
1963    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
1964 #if (ERRCLASS & ERRCLS_ADD_RES)      
1965       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1966             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1967             (ErrVal)ERGU070, (ErrVal)0, "Packing failed");
1968 #endif
1969 #ifdef XEON_SPECIFIC_CHANGES
1970       SPutSBuf(pst->region, pst->pool, (Data *)harqStaInd, sizeof(RguHarqStatusInd));
1971 #else      
1972       SPutStaticBuffer(pst->region, pst->pool, (Data *)harqStaInd, sizeof(RguHarqStatusInd), 0);
1973 #endif      
1974       RETVALUE(RFAILED);
1975    }
1976
1977    if (pst->selector == RGU_SEL_LWLC)
1978    {
1979       CMCHKPK(cmPkPtr,(PTR) harqStaInd, mBuf); 
1980    }
1981    else
1982    {
1983       for(idx = 0; idx < harqStaInd->numTbs; idx++)
1984       {
1985          CMCHKPK(SPkU16, harqStaInd->status[idx], mBuf);
1986       }
1987       for(idx = 0; idx < harqStaInd->numTbs; idx++)
1988       {
1989          CMCHKPK(SPkU32, harqStaInd->tbId[idx], mBuf);
1990       }
1991       CMCHKPK(SPkU8, harqStaInd->numTbs, mBuf);
1992       CMCHKPK(cmPkLteRnti, harqStaInd->ueId, mBuf);
1993       CMCHKPK(cmPkLteCellId, harqStaInd->cellId, mBuf);
1994    }
1995    if (SPkS16(suId, mBuf) != ROK) {
1996 #if (ERRCLASS & ERRCLS_ADD_RES)      
1997       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1998           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1999           (ErrVal)ERGU071, (ErrVal)0, "Packing failed");
2000 #endif
2001 #ifdef XEON_SPECIFIC_CHANGES
2002       SPutSBuf(pst->region, pst->pool, (Data *)harqStaInd,
2003               sizeof(RguHarqStatusInd));
2004 #else      
2005       SPutStaticBuffer(pst->region, pst->pool, (Data *)harqStaInd, sizeof(RguHarqStatusInd), 0);
2006 #endif      
2007       SPutMsg(mBuf);
2008       RETVALUE(RFAILED);
2009    }
2010 #ifdef XEON_SPECIFIC_CHANGES
2011    if (SPutSBuf(pst->region, pst->pool, (Data *)harqStaInd,
2012             sizeof(RguHarqStatusInd)) != ROK) {
2013 #else   
2014    if (pst->selector != RGU_SEL_LWLC)
2015    {
2016       if(SPutStaticBuffer(pst->region, pst->pool, (Data *)harqStaInd, 
2017                sizeof(RguHarqStatusInd), 0) != ROK)
2018       {
2019 #endif         
2020 #if (ERRCLASS & ERRCLS_ADD_RES)      
2021          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2022                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2023                (ErrVal)ERGU072, (ErrVal)0, "Packing failed");
2024 #endif      
2025          SPutMsg(mBuf);
2026          RETVALUE(RFAILED);
2027       }
2028 #ifndef XEON_SPECIFIC_CHANGES      
2029    }
2030 #endif   
2031
2032    pst->event = (Event) EVTRGUHQSTAIND;
2033    RETVALUE(SPstTsk(pst,mBuf));
2034 }
2035 \f
2036
2037 #if 0
2038 /**
2039 * @brief Unpacking function for RguSnMapInfo
2040 *
2041 * @details
2042 *
2043 *     Function : cmUnpkRguSnMapInfo
2044 *
2045 *  @param[out] RguSnMapInfo  *param
2046 *  @param[in]  Buffer        *mBuf
2047 *  @return  Void
2048 **/
2049 #ifdef ANSI
2050 PRIVATE S16 cmUnpkRguSnMapInfo
2051 (
2052 RguSnMapInfo *param, 
2053 Buffer       *mBuf
2054 )
2055 #else
2056 PRIVATE S16 cmUnpkRguSnMapInfo(param, mBuf)
2057 RguSnMapInfo *param;   
2058 Buffer       *mBuf;
2059 #endif
2060 {
2061    U8    idx;
2062    
2063    TRC3(cmUnpkRguSnMapInfo)
2064    
2065    CMCHKUNPK(SUnpkU32, &param->tbId, mBuf);   
2066    CMCHKUNPK(SUnpkU8, &param->numLch, mBuf);   
2067    for(idx = param->numLch; idx > 0; idx--)
2068    {
2069       CMCHKUNPK(cmUnpkRguLchMapInfo, &param->lchMap[idx - 1], mBuf);
2070    }
2071    RETVALUE(ROK);
2072 }
2073 #endif
2074 \f
2075 /**
2076 * @brief Harq Status Indication from MAC to RLC  
2077 *
2078 * @details
2079 *
2080 *     Function : cmUnpkRguHqStaInd
2081 *
2082 *  @param[in]  RguHqStaInd   func
2083 *  @param[in]  Pst           *pst
2084 *  @param[in]  Buffer        *mBuf
2085 *  @return   S16
2086 *      -# ROK
2087 **/
2088 #ifdef ANSI
2089 PUBLIC S16 cmUnpkRguHqStaInd
2090 (
2091 RguHqStaInd  func,
2092 Pst *pst,
2093 Buffer *mBuf
2094 )
2095 #else
2096 PUBLIC S16 cmUnpkRguHqStaInd(func, pst, mBuf)
2097 RguHqStaInd   func;
2098 Pst *pst;
2099 Buffer *mBuf;
2100 #endif
2101 {
2102    RguHarqStatusInd    *hqStaInd;  
2103    SuId                suId;
2104    U8                  idx;
2105
2106    TRC3(cmUnpkRguHqStaInd)
2107
2108    if (SUnpkS16(&suId, mBuf) != ROK) {
2109 #if (ERRCLASS & ERRCLS_ADD_RES)      
2110       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2111           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2112           (ErrVal)ERGU073, (ErrVal)0, "UnPacking failed");
2113 #endif      
2114       SPutMsg(mBuf);
2115       RETVALUE(RFAILED);
2116    }
2117 #ifdef XEON_SPECIFIC_CHANGES
2118    if ((SGetSBuf(pst->region, pst->pool, (Data **)&hqStaInd, 
2119         sizeof(RguHarqStatusInd))) != ROK) {
2120 #else   
2121    if (pst->selector == RGU_SEL_LWLC)
2122    {
2123       CMCHKUNPK(cmUnpkPtr,(PTR *) &hqStaInd, mBuf);
2124    }  
2125    else
2126    {   
2127       if ((SGetStaticBuffer(pst->region, pst->pool, 
2128                   (Data **)&hqStaInd, sizeof(RguHarqStatusInd),0)) != ROK)
2129       {
2130 #endif         
2131 #if (ERRCLASS & ERRCLS_ADD_RES)      
2132          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2133                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2134                (ErrVal)ERGU074, (ErrVal)0, "UnPacking failed");
2135 #endif      
2136          SPutMsg(mBuf);
2137          RETVALUE(RFAILED);
2138       }
2139       CMCHKUNPK(cmUnpkLteCellId, &hqStaInd->cellId, mBuf);
2140       CMCHKUNPK(cmUnpkLteRnti, &hqStaInd->ueId, mBuf);
2141       CMCHKUNPK(SUnpkU8, &hqStaInd->numTbs, mBuf);
2142       for(idx = hqStaInd->numTbs; idx > 0; idx--)
2143       {
2144          CMCHKUNPK(SUnpkU32, &hqStaInd->tbId[idx - 1], mBuf);
2145       }
2146       for(idx = hqStaInd->numTbs; idx > 0; idx--)
2147       {
2148          CMCHKUNPK(SUnpkU16, &hqStaInd->status[idx - 1], mBuf);
2149       }
2150 #ifndef XEON_SPECIFIC_CHANGES      
2151    }
2152 #endif   
2153    SPutMsg(mBuf);
2154    (*func)(pst, suId, hqStaInd);
2155 #ifdef XEON_SPECIFIC_CHANGES
2156    SPutSBuf(pst->region, pst->pool, (Data *)hqStaInd, sizeof(RguHarqStatusInd));
2157 #else   
2158    SPutStaticBuffer(pst->region, pst->pool, (Data *)hqStaInd, sizeof(RguHarqStatusInd), 0);
2159 #endif   
2160    RETVALUE(ROK);
2161 }
2162 #endif /* LTE_L2_MEAS */
2163
2164 \f
2165 /**
2166 * @brief Status Indication from MAC to RLC  
2167  * as a response to the staRsp primitive from RLC.
2168  * Informs RLC of the totalBufferSize and Timing Info 
2169  * for the transmission on dedicated channels.
2170 *
2171 * @details
2172 *
2173 *     Function : cmPkRguDStaInd
2174 *
2175 *  @param[in]   Pst*  pst
2176 *  @param[in]   SuId  suId
2177 *  @param[in]   RguDStaIndInfo  *  staInd
2178 *  @return   S16
2179 *      -# ROK
2180 **/
2181 #ifdef ANSI
2182 PUBLIC S16 cmPkRguDStaInd
2183 (
2184 Pst* pst,
2185 SuId suId,
2186 RguDStaIndInfo  * staInd
2187 )
2188 #else
2189 PUBLIC S16 cmPkRguDStaInd(pst, suId, staInd)
2190 Pst* pst;
2191 SuId suId;
2192 RguDStaIndInfo  * staInd;
2193 #endif
2194 {
2195    Buffer *mBuf = NULLP;
2196    TRC3(cmPkRguDStaInd)
2197
2198    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
2199 #if (ERRCLASS & ERRCLS_ADD_RES)      
2200       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2201           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2202           (ErrVal)ERGU076, (ErrVal)0, "Packing failed");
2203 #endif      
2204       SPutSBuf(pst->region, pst->pool, (Data *)staInd, sizeof(RguDStaIndInfo));
2205       RETVALUE(RFAILED);
2206    }
2207    if (pst->selector == RGU_SEL_LWLC)
2208    {
2209       CMCHKPK(cmPkPtr,(PTR) staInd, mBuf);
2210    }
2211    else
2212    {
2213       if (cmPkRguDStaIndInfo(staInd, mBuf) != ROK) {
2214 #if (ERRCLASS & ERRCLS_ADD_RES)      
2215            SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2216                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2217                (ErrVal)ERGU077, (ErrVal)0, "Packing failed");
2218 #endif      
2219         SPutSBuf(pst->region, pst->pool, (Data *)staInd, 
2220                                          sizeof(RguDStaIndInfo));
2221          SPutMsg(mBuf);
2222          RETVALUE(RFAILED);
2223       } 
2224       if (SPutSBuf(pst->region, pst->pool, (Data *)staInd,
2225                                   sizeof(RguDStaIndInfo)) != ROK) {
2226 #if (ERRCLASS & ERRCLS_ADD_RES)      
2227          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2228              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2229              (ErrVal)ERGU079, (ErrVal)0, "Packing failed");
2230 #endif      
2231          SPutMsg(mBuf);
2232          RETVALUE(RFAILED);
2233       }
2234       staInd = NULLP;
2235    }
2236    if (SPkS16(suId, mBuf) != ROK) {
2237 #if (ERRCLASS & ERRCLS_ADD_RES)      
2238       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2239           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2240           (ErrVal)ERGU078, (ErrVal)0, "Packing failed");
2241 #endif      
2242       if (staInd != NULLP)
2243       {
2244          SPutSBuf(pst->region, pst->pool, (Data *)staInd, sizeof(RguDStaIndInfo));
2245       }
2246       SPutMsg(mBuf);
2247       RETVALUE(RFAILED);
2248    }
2249
2250    pst->event = (Event) EVTRGUDSTAIND;
2251    RETVALUE(SPstTsk(pst,mBuf));
2252 }
2253
2254 \f
2255 /**
2256 * @brief Status Indication from MAC to RLC  
2257  * as a response to the staRsp primitive from RLC.
2258  * Informs RLC of the totalBufferSize and Timing Info 
2259  * for the transmission on dedicated channels.
2260 *
2261 * @details
2262 *
2263 *     Function : cmUnpkRguDStaInd
2264 *
2265 *  @param[in]   Pst*  pst
2266 *  @param[in]   SuId  suId
2267 *  @param[in]   RguDStaIndInfo  *  staInd
2268 *  @return   S16
2269 *      -# ROK
2270 **/
2271 #ifdef ANSI
2272 PUBLIC S16 cmUnpkRguDStaInd
2273 (
2274 RguDStaInd func,
2275 Pst *pst,
2276 Buffer *mBuf
2277 )
2278 #else
2279 PUBLIC S16 cmUnpkRguDStaInd(func, pst, mBuf)
2280 RguDStaInd func;
2281 Pst *pst;
2282 Buffer *mBuf;
2283 #endif
2284 {
2285    SuId suId;
2286    RguDStaIndInfo *staInd;
2287    
2288    TRC3(cmUnpkRguDStaInd)
2289
2290    if (SUnpkS16(&suId, mBuf) != ROK) {
2291 #if (ERRCLASS & ERRCLS_ADD_RES)      
2292       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2293           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2294           (ErrVal)ERGU080, (ErrVal)0, "UnPacking failed");
2295 #endif      
2296       SPutMsg(mBuf);
2297       RETVALUE(RFAILED);
2298    }
2299    if (pst->selector == RGU_SEL_LWLC)
2300    {
2301       CMCHKUNPK(cmUnpkPtr,(PTR *) &staInd, mBuf);
2302    }
2303    else 
2304    {
2305       if ((SGetSBuf(pst->region, pst->pool, (Data **)&staInd, sizeof(RguDStaIndInfo))) != ROK) {
2306 #if (ERRCLASS & ERRCLS_ADD_RES)      
2307          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2308          __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2309          (ErrVal)ERGU081, (ErrVal)0, "UnPacking failed");
2310 #endif      
2311          SPutMsg(mBuf);
2312          RETVALUE(RFAILED);
2313       }
2314       if (cmUnpkRguDStaIndInfo(staInd, mBuf) != ROK) {
2315 #if (ERRCLASS & ERRCLS_ADD_RES)      
2316          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2317              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2318              (ErrVal)ERGU082, (ErrVal)0, "UnPacking failed");
2319 #endif      
2320          SPutMsg(mBuf);
2321          SPutSBuf(pst->region, pst->pool, (Data *)staInd, sizeof(RguDStaIndInfo));
2322          RETVALUE(RFAILED);
2323       }
2324    }
2325    SPutMsg(mBuf);
2326    RETVALUE((*func)(pst, suId, staInd));
2327 }
2328
2329 #ifdef ANSI
2330 PUBLIC S16 cmPkRguLcFlowCntrlInfo
2331 (
2332 RguLcFlowCntrlInfo *param,
2333 Buffer             *mBuf
2334 )
2335 #else
2336 PUBLIC S16 cmPkRguLcFlowCntrlInfo (param,mBuf)
2337 RguLcFlowCntrlInfo *param;
2338 Buffer             *mBuf;
2339 #endif
2340 {
2341   TRC3(cmPkRguLcFlowCntrlInfo);
2342   CMCHKPK(SPkU32, param->maxBo4FlowCtrl, mBuf);
2343   CMCHKPK(SPkU32, param->pktAdmitCnt, mBuf);
2344   CMCHKPK(cmPkLteLcId, param->lcId, mBuf);
2345
2346   RETVALUE(ROK);
2347 }
2348
2349 #ifdef ANSI
2350 PUBLIC S16 cmPkRguUeFlowCntrlInfo
2351 (
2352 RguUeFlowCntrlInfo *param,
2353 Buffer             *mBuf
2354 )
2355 #else
2356 PUBLIC S16 cmPkRguUeFlowCntrlInfo (param,mBuf)
2357 RguUeFlowCntrlInfo *param;
2358 Buffer             *mBuf;
2359 #endif
2360 {
2361   U32 idx;
2362
2363   TRC3(cmPkRguUeFlowCntrlInfo);
2364
2365   for(idx=(param->numLcs - 1); idx >= 0; idx--)
2366   {
2367     cmPkRguLcFlowCntrlInfo(&param->lcInfo[idx],mBuf);
2368   }
2369   CMCHKPK(SPkU32, param->numLcs, mBuf);
2370   CMCHKPK(cmPkLteRnti, param->ueId, mBuf);
2371   RETVALUE(ROK);
2372 }
2373
2374 #ifdef ANSI
2375 PUBLIC S16 cmPkRguFlowCntrlInfo
2376 (
2377 RguFlowCntrlInd *param, 
2378 Buffer          *mBuf
2379 )
2380 #else
2381 PUBLIC S16 cmPkRguFlowCntrlInfo(flowCntrlInd, mBuf)
2382 RguFlowCntrlInd *param;
2383 Buffer          *mBuf;
2384 #endif
2385 {
2386   U32 idx;
2387
2388   TRC3(cmPkRguFlowCntrlInfo);
2389
2390   for (idx=(param->numUes - 1); idx >= 0; idx--)
2391   {
2392     cmPkRguUeFlowCntrlInfo(&param->ueFlowCntrlInfo[idx],mBuf);
2393   }
2394   CMCHKPK(SPkU32, param->numUes, mBuf);
2395   CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
2396   RETVALUE(ROK);
2397 }
2398 \f
2399 /**
2400 * @brief Flow Cntrl Indication from MAC to RLC  
2401  * Informs RLC of the LCs on which flow control
2402  * to be performed.
2403 *
2404 * @details
2405 *
2406 *     Function : cmPkRguFlowCntrlInd
2407 *
2408 *  @param[in]   Pst*  pst
2409 *  @param[in]   SuId  suId
2410 *  @param[in]   RguFlowCntrlInd *staInd
2411 *  @return   S16
2412 *      -# ROK
2413 **/
2414 #ifdef ANSI
2415 PUBLIC S16 cmPkRguFlowCntrlInd
2416 (
2417 Pst* pst,
2418 SuId suId,
2419 RguFlowCntrlInd  *flowCntrlInd
2420 )
2421 #else
2422 PUBLIC S16 cmPkRguFlowCntrlInd(pst, suId, flowCntrlInd)
2423 Pst* pst;
2424 SuId suId;
2425 RguFlowCntrlInd   *flowCntrlInd;
2426 #endif
2427 {
2428    Buffer *mBuf = NULLP;
2429
2430    TRC3(cmPkRguFlowCntrlInd);
2431    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
2432 #if (ERRCLASS & ERRCLS_ADD_RES)      
2433       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2434           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2435           (ErrVal)ERGU076, (ErrVal)0, "Packing failed");
2436 #endif      
2437       RETVALUE(RFAILED);
2438    }
2439    if (pst->selector == RGU_SEL_LWLC)
2440    {
2441       CMCHKPK(cmPkPtr,(PTR) flowCntrlInd, mBuf);
2442    }
2443    else
2444    {
2445       if (cmPkRguFlowCntrlInfo(flowCntrlInd, mBuf) != ROK) {
2446 #if (ERRCLASS & ERRCLS_ADD_RES)      
2447            SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2448                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2449                (ErrVal)ERGU077, (ErrVal)0, "Packing failed");
2450 #endif      
2451          SPutMsg(mBuf);
2452          RETVALUE(RFAILED);
2453       } 
2454    }
2455    if (SPkS16(suId, mBuf) != ROK) {
2456 #if (ERRCLASS & ERRCLS_ADD_RES)      
2457       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2458           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2459           (ErrVal)ERGU078, (ErrVal)0, "Packing failed");
2460 #endif      
2461       SPutMsg(mBuf);
2462       RETVALUE(RFAILED);
2463    }
2464    
2465    pst->event = (Event) EVTRGUFLOWCNTRLIND;
2466    RETVALUE(SPstTsk(pst,mBuf));
2467 }
2468
2469 #ifdef ANSI
2470 PUBLIC S16 cmUnpkRguLcFlowCntrlInfo
2471 (
2472 RguLcFlowCntrlInfo *param,
2473 Buffer           *mBuf
2474 )
2475 #else
2476 PUBLIC S16 cmUnpkRguLcFlowCntrlInfo (param,mBuf)
2477 RguLcFlowCntrlInfo *param;
2478 Buffer           *mBuf;
2479 #endif
2480 {
2481   TRC3(cmUnpkRguLcFlowCntrlInfo);
2482
2483   CMCHKUNPK(cmUnpkLteLcId, &param->lcId, mBuf);
2484   CMCHKUNPK(SUnpkU32, &param->pktAdmitCnt, mBuf);
2485   CMCHKUNPK(SUnpkU32, &param->maxBo4FlowCtrl, mBuf);
2486   
2487   RETVALUE(ROK);
2488 }
2489 #ifdef ANSI
2490 PUBLIC S16 cmUnpkRguUeFlowCntrlInfo
2491 (
2492 RguUeFlowCntrlInfo *param,
2493 Buffer           *mBuf
2494 )
2495 #else
2496 PUBLIC S16 cmUnpkRguUeFlowCntrlInfo (param,mBuf)
2497 RguUeFlowCntrlInfo *param;
2498 Buffer           *mBuf;
2499 #endif
2500 {
2501   U32 idx;
2502   TRC3(cmUnpkRguUeFlowCntrlInfo);
2503   CMCHKUNPK(cmUnpkLteRnti, &param->ueId, mBuf);
2504   CMCHKUNPK(SUnpkU32, &param->numLcs, mBuf);
2505   for(idx=0; idx < param->numLcs; idx++)
2506   {
2507     cmUnpkRguLcFlowCntrlInfo(&param->lcInfo[idx],mBuf);
2508   }
2509   RETVALUE(ROK);
2510 }
2511
2512 #ifdef ANSI
2513 PUBLIC S16 cmUnpkRguFlowCntrlInfo
2514 (
2515 RguFlowCntrlInd *param, 
2516 Buffer           *mBuf
2517 )
2518 #else
2519 PUBLIC S16 cmUnpkRguFlowCntrlInfo(flowCntrlInfo, mBuf)
2520 RguFlowCntrlInd *param;
2521 Buffer           *mBuf;
2522 #endif
2523 {
2524   U32 idx; 
2525   
2526   TRC3(cmUnpkRguFlowCntrlInfo);
2527
2528   CMCHKUNPK(cmUnpkLteCellId, &param->cellId, mBuf);
2529   CMCHKUNPK(SUnpkU32, &param->numUes, mBuf);
2530   for (idx=0; idx < param->numUes; idx++)
2531   {
2532     cmUnpkRguUeFlowCntrlInfo(&param->ueFlowCntrlInfo[idx],mBuf);
2533   }
2534   RETVALUE(ROK);
2535 }
2536
2537 /**
2538 * @brief Flow control indication from MAC to RLC  
2539 * Informs RLC of the LCs on which flow control to  
2540 * be started
2541 *
2542 * @details
2543 *
2544 *     Function : cmUnpkRguFlowCntrlInd
2545 *
2546 *  @param[in]   RguFlowCntrlInd func
2547 *  @param[in]   Pst    *pst
2548 *  @param[in]   Buffer *mBuf
2549 *  @return   S16
2550 *      -# ROK
2551 **/
2552 #ifdef ANSI
2553 PUBLIC S16 cmUnpkRguFlowCntrlInd
2554 (
2555 RguFlowCntrlIndInfo func,
2556 Pst *pst,
2557 Buffer *mBuf
2558 )
2559 #else
2560 PUBLIC S16 cmUnpkRguFlowCntrlInd(func, pst, mBuf)
2561 RguFlowCntrlIndInfo func;
2562 Pst *pst;
2563 Buffer *mBuf;
2564 #endif
2565 {
2566    SuId suId;
2567    RguFlowCntrlInd *flowCntrlInd;
2568    
2569    TRC3(cmUnpkRguFlowCntrlInd)
2570
2571    if (SUnpkS16(&suId, mBuf) != ROK) {
2572 #if (ERRCLASS & ERRCLS_ADD_RES)      
2573       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2574           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2575           (ErrVal)ERGU080, (ErrVal)0, "UnPacking failed");
2576 #endif      
2577       SPutMsg(mBuf);
2578       RETVALUE(RFAILED);
2579    }
2580    if (pst->selector == RGU_SEL_LWLC)
2581    {
2582       CMCHKUNPK(cmUnpkPtr,(PTR *) &flowCntrlInd, mBuf);
2583    }
2584    else 
2585    {
2586       if ((SGetSBuf(pst->region, pst->pool, (Data **)&flowCntrlInd, sizeof(RguFlowCntrlInd))) != ROK) {
2587 #if (ERRCLASS & ERRCLS_ADD_RES)      
2588          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2589          __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2590          (ErrVal)ERGU081, (ErrVal)0, "UnPacking failed");
2591 #endif      
2592          SPutMsg(mBuf);
2593          RETVALUE(RFAILED);
2594       }
2595       if (cmUnpkRguFlowCntrlInfo(flowCntrlInd, mBuf) != ROK) {
2596 #if (ERRCLASS & ERRCLS_ADD_RES)      
2597          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2598              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2599              (ErrVal)ERGU082, (ErrVal)0, "UnPacking failed");
2600 #endif      
2601          SPutMsg(mBuf);
2602          SPutSBuf(pst->region, pst->pool, (Data *)flowCntrlInd, sizeof(RguFlowCntrlInd));
2603          RETVALUE(RFAILED);
2604       }
2605    }
2606    SPutMsg(mBuf);
2607    RETVALUE((*func)(pst, suId, flowCntrlInd));
2608 }
2609
2610 /***********************************************************
2611 *
2612 *     Func : cmPkRguPduInfo
2613 *
2614 *
2615 *     Desc : RguPduInfo
2616  * PDU information given on a logical channel
2617 *
2618 *
2619 *     Ret  : S16
2620 *
2621 *     Notes:
2622 *
2623 *     File  : 
2624 *
2625 **********************************************************/
2626 #ifdef ANSI
2627 PUBLIC S16 cmPkRguPduInfo
2628 (
2629 RguPduInfo *param,
2630 Buffer *mBuf
2631 )
2632 #else
2633 PUBLIC S16 cmPkRguPduInfo(param, mBuf)
2634 RguPduInfo *param;
2635 Buffer *mBuf;
2636 #endif
2637 {
2638    S32 i;
2639
2640    TRC3(cmPkRguPduInfo);
2641
2642    for (i=param->numPdu-1; i >= 0; i--) {
2643      /* rgu_c_001.main_3: ccpu00111328: S16 is renamed as MsgLen */
2644       MsgLen msgLen = 0;
2645       if (SFndLenMsg(param->mBuf[i], &msgLen) != ROK)
2646          RETVALUE(RFAILED);
2647       if (SCatMsg(mBuf, param->mBuf[i], M1M2) != ROK)
2648          RETVALUE(RFAILED);
2649       SPutMsg(param->mBuf[i]);
2650       CMCHKPK(cmPkMsgLen, msgLen, mBuf);
2651    }
2652    CMCHKPK(SPkU8, param->numPdu, mBuf);
2653    RETVALUE(ROK);
2654 }
2655
2656
2657 \f
2658 /***********************************************************
2659 *
2660 *     Func : cmUnpkRguPduInfo
2661 *
2662 *
2663 *     Desc : RguPduInfo
2664  * PDU information given on a logical channel
2665 *
2666 *
2667 *     Ret  : S16
2668 *
2669 *     Notes:
2670 *
2671 *     File  : 
2672 *
2673 **********************************************************/
2674 #ifdef ANSI
2675 PUBLIC S16 cmUnpkRguPduInfo
2676 (
2677 RguPduInfo *param,
2678 Buffer *mBuf
2679 )
2680 #else
2681 PUBLIC S16 cmUnpkRguPduInfo(param, mBuf)
2682 RguPduInfo *param;
2683 Buffer *mBuf;
2684 #endif
2685 {
2686    S32 i;
2687
2688    TRC3(cmUnpkRguPduInfo);
2689
2690    CMCHKUNPK(SUnpkU8, &param->numPdu, mBuf);
2691    for (i=0; i<param->numPdu; i++) {
2692       MsgLen msgLen, totalMsgLen;
2693       CMCHKUNPK(cmUnpkMsgLen, &msgLen, mBuf);
2694       if (SFndLenMsg(mBuf, &totalMsgLen) != ROK)
2695          RETVALUE(RFAILED);
2696       if (SSegMsg(mBuf, totalMsgLen-msgLen, &param->mBuf[i]) != ROK)
2697          RETVALUE(RFAILED);
2698    }
2699    RETVALUE(ROK);
2700 }
2701
2702
2703 \f
2704 /***********************************************************
2705 *
2706 *     Func : cmPkRguDBoReport
2707 *
2708 *
2709 *     Desc : RguDBoReport
2710  * Buffer Occupancy Report for dedicated logical channel
2711 *
2712 *
2713 *     Ret  : S16
2714 *
2715 *     Notes:
2716 *
2717 *     File  : 
2718 *
2719 **********************************************************/
2720 #ifdef ANSI
2721 PUBLIC S16 cmPkRguDBoReport
2722 (
2723 RguDBoReport *param,
2724 Buffer *mBuf
2725 )
2726 #else
2727 PUBLIC S16 cmPkRguDBoReport(param, mBuf)
2728 RguDBoReport *param;
2729 Buffer *mBuf;
2730 #endif
2731 {
2732
2733    TRC3(cmPkRguDBoReport);
2734
2735    CMCHKPK(SPkU32, param->oldestSduArrTime, mBuf);
2736    CMCHKPK(SPkU32, param->staPduBo, mBuf);
2737 #ifdef CCPU_OPT
2738    CMCHKPK(SPkU8, param->staPduPrsnt, mBuf);
2739    CMCHKPK(SPkU16, param->estRlcHdrSz, mBuf);
2740 #endif
2741    CMCHKPK(SPkS32, param->bo, mBuf);
2742    RETVALUE(ROK);
2743 }
2744
2745
2746 \f
2747 /***********************************************************
2748 *
2749 *     Func : cmUnpkRguDBoReport
2750 *
2751 *
2752 *     Desc : RguDBoReport
2753  * Buffer Occupancy Report for dedicated logical channel
2754 *
2755 *
2756 *     Ret  : S16
2757 *
2758 *     Notes:
2759 *
2760 *     File  : 
2761 *
2762 **********************************************************/
2763 #ifdef ANSI
2764 PUBLIC S16 cmUnpkRguDBoReport
2765 (
2766 RguDBoReport *param,
2767 Buffer *mBuf
2768 )
2769 #else
2770 PUBLIC S16 cmUnpkRguDBoReport(param, mBuf)
2771 RguDBoReport *param;
2772 Buffer *mBuf;
2773 #endif
2774 {
2775
2776    TRC3(cmUnpkRguDBoReport);
2777
2778    CMCHKUNPK(SUnpkS32, &param->bo, mBuf);
2779 #ifdef CCPU_OPT
2780    CMCHKUNPK(SUnpkU16, &param->estRlcHdrSz, mBuf);
2781    CMCHKUNPK(SUnpkU8, &param->staPduPrsnt, mBuf);
2782 #endif
2783    
2784    CMCHKUNPK(SUnpkU32, &param->staPduBo, mBuf);
2785    CMCHKUNPK(SUnpkU32, &param->oldestSduArrTime, mBuf);
2786    RETVALUE(ROK);
2787 }
2788
2789 \f
2790 /***********************************************************
2791 *
2792 *     Func : cmPkRguCDatReqInfo
2793 *
2794 *
2795 *     Desc : RguCDatReqInfo
2796  * DatReq from RLC to MAC for Common Channels(BCCH, PCCH and CCCH)
2797 *
2798 *
2799 *     Ret  : S16
2800 *
2801 *     Notes:
2802 *
2803 *     File  : 
2804 *
2805 **********************************************************/
2806 #ifdef ANSI
2807 PUBLIC S16 cmPkRguCDatReqInfo
2808 (
2809 RguCDatReqInfo *param,
2810 Buffer *mBuf
2811 )
2812 #else
2813 PUBLIC S16 cmPkRguCDatReqInfo(param, mBuf)
2814 RguCDatReqInfo *param;
2815 Buffer *mBuf;
2816 #endif
2817 {
2818    MsgLen msgLen;
2819
2820    TRC3(cmPkRguCDatReqInfo);
2821
2822    if (param->pdu != NULLP)
2823    {
2824       if (SFndLenMsg(param->pdu, &msgLen) != ROK)
2825          RETVALUE(RFAILED);
2826       if (SCatMsg(mBuf, param->pdu, M1M2) != ROK)
2827          RETVALUE(RFAILED);
2828       SPutMsg(param->pdu);
2829       CMCHKPK(cmPkMsgLen, msgLen, mBuf);
2830    }
2831    switch(param->lcType) {
2832       case CM_LTE_LCH_CCCH:
2833          CMCHKPK(cmPkLteRnti, param->u.rnti, mBuf);
2834          break;
2835       case CM_LTE_LCH_BCCH:
2836       case CM_LTE_LCH_PCCH:
2837          CMCHKPK(cmPkLteTimingInfo, &param->u.timeToTx, mBuf);
2838 #ifdef EMTC_ENABLE
2839         CMCHKPK(SPkU8,param->pnb,mBuf);
2840 #endif
2841          break;
2842       default :
2843          RETVALUE(RFAILED);
2844    }
2845    CMCHKPK(SPkU32, param->transId, mBuf);
2846    CMCHKPK(cmPkLteLcType, param->lcType, mBuf);
2847    CMCHKPK(cmPkLteLcId, param->lcId, mBuf);
2848    CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
2849    RETVALUE(ROK);
2850 }
2851
2852
2853 \f
2854 /***********************************************************
2855 *
2856 *     Func : cmUnpkRguCDatReqInfo
2857 *
2858 *
2859 *     Desc : RguCDatReqInfo
2860  * DatReq from RLC to MAC for Common Channels(BCCH, PCCH and CCCH)
2861 *
2862 *
2863 *     Ret  : S16
2864 *
2865 *     Notes:
2866 *
2867 *     File  : 
2868 *
2869 **********************************************************/
2870 #ifdef ANSI
2871 PUBLIC S16 cmUnpkRguCDatReqInfo
2872 (
2873 RguCDatReqInfo *param,
2874 Buffer *mBuf
2875 )
2876 #else
2877 PUBLIC S16 cmUnpkRguCDatReqInfo(param, mBuf)
2878 RguCDatReqInfo *param;
2879 Buffer *mBuf;
2880 #endif
2881 {
2882    MsgLen msgLen, totalMsgLen;
2883
2884    TRC3(cmUnpkRguCDatReqInfo);
2885
2886    CMCHKUNPK(cmUnpkLteCellId, &param->cellId, mBuf);
2887    CMCHKUNPK(cmUnpkLteLcId, &param->lcId, mBuf);
2888    CMCHKUNPK(cmUnpkLteLcType, &param->lcType, mBuf);
2889    CMCHKUNPK(SUnpkU32, &param->transId, mBuf);
2890    switch(param->lcType) {
2891       case CM_LTE_LCH_BCCH:
2892       case CM_LTE_LCH_PCCH:
2893 #ifdef EMTC_ENABLE
2894          CMCHKUNPK(SUnpkU8,&param->pnb, mBuf);
2895 #endif
2896          CMCHKUNPK(cmUnpkLteTimingInfo, &param->u.timeToTx, mBuf);
2897          break;
2898       case CM_LTE_LCH_CCCH:
2899          CMCHKUNPK(cmUnpkLteRnti, &param->u.rnti, mBuf);
2900          break;
2901       default :
2902          RETVALUE(RFAILED);
2903    }
2904    SFndLenMsg(mBuf, &msgLen);
2905    if (msgLen > 0)
2906    {
2907       CMCHKUNPK(cmUnpkMsgLen, &msgLen, mBuf);
2908       if (SFndLenMsg(mBuf, &totalMsgLen) != ROK)
2909          RETVALUE(RFAILED);
2910       if (SSegMsg(mBuf, totalMsgLen-msgLen, &param->pdu) != ROK)
2911          RETVALUE(RFAILED);
2912    }
2913    RETVALUE(ROK);
2914 }
2915
2916
2917 \f
2918 /***********************************************************
2919 *
2920 *     Func : cmPkRguLchDatReq
2921 *
2922 *
2923 *     Desc : RguLchDatReq
2924  * DatReq Information of a logical channel
2925 *
2926 *
2927 *     Ret  : S16
2928 *
2929 *     Notes:
2930 *
2931 *     File  : 
2932 *
2933 **********************************************************/
2934 #ifdef ANSI
2935 PUBLIC S16 cmPkRguLchDatReq
2936 (
2937 RguLchDatReq *param,
2938 Buffer *mBuf
2939 )
2940 #else
2941 PUBLIC S16 cmPkRguLchDatReq(param, mBuf)
2942 RguLchDatReq *param;
2943 Buffer *mBuf;
2944 #endif
2945 {
2946
2947    TRC3(cmPkRguLchDatReq);
2948
2949 #ifdef L2_OPTMZ
2950    CMCHKPK(SPkU8, param->freeBuff, mBuf);
2951 #endif
2952    CMCHKPK(SPkU8, param->setMaxUlPrio, mBuf);
2953    CMCHKPK(cmPkRguPduInfo, &param->pdu, mBuf);
2954    CMCHKPK(cmPkRguDBoReport, &param->boReport, mBuf);
2955    CMCHKPK(cmPkLteLcId, param->lcId, mBuf);
2956    RETVALUE(ROK);
2957 }
2958
2959
2960 \f
2961 /***********************************************************
2962 *
2963 *     Func : cmUnpkRguLchDatReq
2964 *
2965 *
2966 *     Desc : RguLchDatReq
2967  * DatReq Information of a logical channel
2968 *
2969 *
2970 *     Ret  : S16
2971 *
2972 *     Notes:
2973 *
2974 *     File  : 
2975 *
2976 **********************************************************/
2977 #ifdef ANSI
2978 PUBLIC S16 cmUnpkRguLchDatReq
2979 (
2980 RguLchDatReq *param,
2981 Buffer *mBuf
2982 )
2983 #else
2984 PUBLIC S16 cmUnpkRguLchDatReq(param, mBuf)
2985 RguLchDatReq *param;
2986 Buffer *mBuf;
2987 #endif
2988 {
2989
2990    TRC3(cmUnpkRguLchDatReq);
2991
2992    CMCHKUNPK(cmUnpkLteLcId, &param->lcId, mBuf);
2993    CMCHKUNPK(cmUnpkRguDBoReport, &param->boReport, mBuf);
2994    CMCHKUNPK(cmUnpkRguPduInfo, &param->pdu, mBuf);
2995    CMCHKUNPK(SUnpkU8, &param->setMaxUlPrio, mBuf);
2996 #ifdef L2_OPTMZ
2997    CMCHKUNPK(SUnpkU8, &param->freeBuff, mBuf);
2998 #endif
2999    RETVALUE(ROK);
3000 }
3001
3002 \f
3003 /***********************************************************
3004 *
3005 *     Func : cmPkRguDatReqTb
3006 *
3007 *
3008 *     Desc : RguDatReqTb
3009 * DatReq from RLC to MAC for dedicated channels of a UE
3010 *
3011 *
3012 *     Ret  : S16
3013 *
3014 *     Notes:
3015 *
3016 *     File  : 
3017 *
3018 **********************************************************/
3019 #ifdef ANSI
3020 PUBLIC S16 cmPkRguDatReqTb
3021 (
3022 RguDatReqTb *param,
3023 Buffer *mBuf
3024 )
3025 #else
3026 PUBLIC S16 cmPkRguDatReqTb(param, mBuf)
3027 RguDatReqTb *param;
3028 Buffer *mBuf;
3029 #endif
3030 {
3031    S32 i;
3032
3033    TRC3(cmPkRguDatReqTb);
3034    /*rgu_c_001.main_5 - ADD - L2M Support */
3035 #ifdef LTE_L2_MEAS
3036    CMCHKPK(SPkU32, param->tbId, mBuf);
3037 #endif
3038    for (i=param->nmbLch-1; i >= 0; i--) {
3039       CMCHKPK(cmPkRguLchDatReq, &param->lchData[i], mBuf);
3040    }
3041    CMCHKPK(SPkU8, param->nmbLch, mBuf);
3042    RETVALUE(ROK);
3043 }
3044
3045
3046 \f
3047 /***********************************************************
3048 *
3049 *     Func : cmUnpkRguDatReqTb
3050 *
3051 *
3052 *     Desc : RguDatReqTb
3053  * DatReq from RLC to MAC for dedicated channels of a UE
3054 *
3055 *
3056 *     Ret  : S16
3057 *
3058 *     Notes:
3059 *
3060 *     File  : 
3061 *
3062 **********************************************************/
3063 #ifdef LTE_L2_MEAS
3064 #ifdef ANSI
3065 PUBLIC S16 cmUnpkRguDatReqTb
3066 (
3067 Pst         *pst, 
3068 RguDatReqTb *param,
3069 Buffer *mBuf
3070 )
3071 #else
3072 PUBLIC S16 cmUnpkRguDatReqTb(pst, param, mBuf)
3073 Pst         *pst;   
3074 RguDatReqTb *param;
3075 Buffer *mBuf;
3076 #endif
3077 #else
3078 #ifdef ANSI
3079 PUBLIC S16 cmUnpkRguDatReqTb
3080 (
3081 RguDatReqTb *param,
3082 Buffer *mBuf
3083 )
3084 #else
3085 PUBLIC S16 cmUnpkRguDatReqTb(param, mBuf)
3086 RguDatReqTb *param;
3087 Buffer *mBuf;
3088 #endif
3089 #endif
3090 {
3091    S32 i;
3092
3093    TRC3(cmUnpkRguDatReqTb);
3094
3095    CMCHKUNPK(SUnpkU8, &param->nmbLch, mBuf);
3096    for (i=0; i<param->nmbLch; i++) {
3097       CMCHKUNPK(cmUnpkRguLchDatReq, &param->lchData[i], mBuf);
3098    }
3099    /*rgu_c_001.main_5 - ADD - L2M Support */
3100 #ifdef LTE_L2_MEAS
3101    CMCHKUNPK(SUnpkU32, &param->tbId, mBuf);
3102 #endif
3103    RETVALUE(ROK);
3104 }
3105
3106 \f
3107 /***********************************************************
3108 *
3109 *     Func : cmPkRguDDatReqInfo
3110 *
3111 *
3112 *     Desc : RguDDatReqInfo
3113  * DatReq from RLC to MAC for dedicated channels of a UE
3114 *
3115 *
3116 *     Ret  : S16
3117 *
3118 *     Notes:
3119 *
3120 *     File  : 
3121 *
3122 **********************************************************/
3123    /*rgu_c_001.main_5 - ADD - L2M Support */
3124 #ifdef LTE_L2_MEAS
3125 #ifdef ANSI
3126 PUBLIC S16 cmPkRguDDatReqInfo
3127 (
3128 Pst            *pst,
3129 RguDDatReqInfo *param,
3130 Buffer *mBuf
3131 )
3132 #else
3133 PUBLIC S16 cmPkRguDDatReqInfo(pst, param, mBuf)
3134 Pst            *pst;
3135 RguDDatReqInfo *param;
3136 Buffer *mBuf;
3137 #endif
3138 #else
3139 #ifdef ANSI
3140 PUBLIC S16 cmPkRguDDatReqInfo
3141 (
3142 RguDDatReqInfo *param,
3143 Buffer *mBuf
3144 )
3145 #else
3146 PUBLIC S16 cmPkRguDDatReqInfo(param, mBuf)
3147 RguDDatReqInfo *param;
3148 Buffer *mBuf;
3149 #endif
3150 #endif
3151 {
3152    S32 i;
3153    S32 idx;
3154
3155    TRC3(cmPkRguDDatReqInfo);
3156
3157    for(idx = (param->nmbOfUeGrantPerTti-1); idx >= 0; idx--)
3158    {
3159       RguDDatReqPerUe *datReq = &param->datReq[idx];
3160       for (i=RGU_MAX_TB-1; i >= 0; i--) 
3161       {
3162          CMCHKPK(cmPkRguDatReqTb, &datReq->datReqTb[i], mBuf);
3163       }
3164       CMCHKPK(SPkU8, datReq->nmbOfTbs, mBuf);
3165       CMCHKPK(SPkU32, datReq->transId, mBuf);
3166       CMCHKPK(cmPkLteRnti, datReq->rnti, mBuf);
3167    }
3168    CMCHKPK(SPkU8, param->nmbOfUeGrantPerTti, mBuf);
3169    CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
3170    RETVALUE(ROK);
3171 }
3172
3173
3174 \f
3175 /***********************************************************
3176 *
3177 *     Func : cmUnpkRguDDatReqInfo
3178 *
3179 *
3180 *     Desc : RguDDatReqInfo
3181  * DatReq from RLC to MAC for dedicated channels of a UE
3182 *
3183 *
3184 *     Ret  : S16
3185 *
3186 *     Notes:
3187 *
3188 *     File  : 
3189 *
3190 **********************************************************/
3191 #ifdef LTE_L2_MEAS
3192 #ifdef ANSI
3193 PUBLIC S16 cmUnpkRguDDatReqInfo
3194 (
3195 Pst            *pst, 
3196 RguDDatReqInfo *param,
3197 Buffer *mBuf
3198 )
3199 #else
3200 PUBLIC S16 cmUnpkRguDDatReqInfo(pst, param, mBuf)
3201 Pst            *pst;
3202 RguDDatReqInfo *param;
3203 Buffer *mBuf;
3204 #endif
3205 #else
3206 #ifdef ANSI
3207 PUBLIC S16 cmUnpkRguDDatReqInfo
3208 (
3209 RguDDatReqInfo *param,
3210 Buffer *mBuf
3211 )
3212 #else
3213 PUBLIC S16 cmUnpkRguDDatReqInfo(param, mBuf)
3214 RguDDatReqInfo *param;
3215 Buffer *mBuf;
3216 #endif
3217 #endif
3218 {
3219    S32 i;
3220   /* After Merging from 2.1 to 2.2 */
3221    /*rgu_c_001.main_5 - ADD - L2M Support */
3222 #ifdef LTE_L2_MEAS
3223    S16 retVal;
3224 #endif
3225    S32 idx;
3226
3227    TRC3(cmUnpkRguDDatReqInfo);
3228
3229   /* After Merging from 2.1 to 2.2 */
3230    /*rgu_c_001.main_5 - ADD - L2M Support */
3231 #ifdef LTE_L2_MEAS
3232    retVal = ROK;
3233 #endif
3234    CMCHKUNPK(cmUnpkLteCellId, &param->cellId, mBuf);
3235    CMCHKUNPK(SUnpkU8, &param->nmbOfUeGrantPerTti, mBuf);
3236    for(idx = 0; idx < param->nmbOfUeGrantPerTti; idx++)
3237    { 
3238       RguDDatReqPerUe *datReq = &param->datReq[idx];
3239       CMCHKUNPK(cmUnpkLteRnti, &datReq->rnti, mBuf);
3240       CMCHKUNPK(SUnpkU32, &datReq->transId, mBuf);
3241       CMCHKUNPK(SUnpkU8, &datReq->nmbOfTbs, mBuf);
3242       /* rgu_c_001.main_4 - Changes for MIMO feature addition */
3243       for (i=0; i<RGU_MAX_TB; i++) 
3244       {
3245          /*rgu_c_001.main_5 - ADD - L2M Support */
3246 #ifdef LTE_L2_MEAS
3247          /* After Merging from 2.1 to 2.2 */
3248          retVal = cmUnpkRguDatReqTb(pst, &datReq->datReqTb[i], mBuf);
3249          if(retVal != ROK)
3250          {
3251             RETVALUE(RFAILED);
3252          }
3253 #else
3254          CMCHKUNPK(cmUnpkRguDatReqTb, &datReq->datReqTb[i], mBuf);
3255 #endif
3256       }
3257    }
3258    RETVALUE(ROK);
3259 }
3260
3261
3262 \f
3263 /***********************************************************
3264 *
3265 *     Func : cmPkRguCDatIndInfo
3266 *
3267 *
3268 *     Desc : RguCDatIndInfo
3269  * DatInd from MAC to RLC on CCCH
3270 *
3271 *
3272 *     Ret  : S16
3273 *
3274 *     Notes:
3275 *
3276 *     File  : 
3277 *
3278 **********************************************************/
3279 #ifdef ANSI
3280 PUBLIC S16 cmPkRguCDatIndInfo
3281 (
3282 RguCDatIndInfo *param,
3283 Buffer *mBuf
3284 )
3285 #else
3286 PUBLIC S16 cmPkRguCDatIndInfo(param, mBuf)
3287 RguCDatIndInfo *param;
3288 Buffer *mBuf;
3289 #endif
3290 {
3291    MsgLen msgLen;
3292
3293    TRC3(cmPkRguCDatIndInfo);
3294
3295    if (SFndLenMsg(param->pdu, &msgLen) != ROK)
3296       RETVALUE(RFAILED);
3297    if (SCatMsg(mBuf, param->pdu, M1M2) != ROK)
3298       RETVALUE(RFAILED);
3299    SPutMsg(param->pdu);
3300    CMCHKPK(cmPkMsgLen, msgLen, mBuf);
3301    CMCHKPK(cmPkLteLcId, param->lcId, mBuf);
3302    CMCHKPK(cmPkLteRnti, param->rnti, mBuf);
3303    CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
3304    RETVALUE(ROK);
3305 }
3306
3307
3308 \f
3309 /***********************************************************
3310 *
3311 *     Func : cmUnpkRguCDatIndInfo
3312 *
3313 *
3314 *     Desc : RguCDatIndInfo
3315  * DatInd from MAC to RLC on CCCH
3316 *
3317 *
3318 *     Ret  : S16
3319 *
3320 *     Notes:
3321 *
3322 *     File  : 
3323 *
3324 **********************************************************/
3325 #ifdef ANSI
3326 PUBLIC S16 cmUnpkRguCDatIndInfo
3327 (
3328 RguCDatIndInfo *param,
3329 Buffer *mBuf
3330 )
3331 #else
3332 PUBLIC S16 cmUnpkRguCDatIndInfo(param, mBuf)
3333 RguCDatIndInfo *param;
3334 Buffer *mBuf;
3335 #endif
3336 {
3337    MsgLen msgLen, totalMsgLen;
3338
3339    TRC3(cmUnpkRguCDatIndInfo);
3340
3341    CMCHKUNPK(cmUnpkLteCellId, &param->cellId, mBuf);
3342    CMCHKUNPK(cmUnpkLteRnti, &param->rnti, mBuf);
3343    CMCHKUNPK(cmUnpkLteLcId, &param->lcId, mBuf);
3344    CMCHKUNPK(cmUnpkMsgLen, &msgLen, mBuf);
3345    if (SFndLenMsg(mBuf, &totalMsgLen) != ROK)
3346       RETVALUE(RFAILED);
3347    if (SSegMsg(mBuf, totalMsgLen-msgLen, &param->pdu) != ROK)
3348       RETVALUE(RFAILED);
3349    RETVALUE(ROK);
3350 }
3351
3352
3353 \f
3354 /***********************************************************
3355 *
3356 *     Func : cmPkRguLchDatInd
3357 *
3358 *
3359 *     Desc : RguLchDatInd
3360  * DatInd Information for a logical channel
3361 *
3362 *
3363 *     Ret  : S16
3364 *
3365 *     Notes:
3366 *
3367 *     File  : 
3368 *
3369 **********************************************************/
3370 #ifdef ANSI
3371 PUBLIC S16 cmPkRguLchDatInd
3372 (
3373 RguLchDatInd *param,
3374 Buffer *mBuf
3375 )
3376 #else
3377 PUBLIC S16 cmPkRguLchDatInd(param, mBuf)
3378 RguLchDatInd *param;
3379 Buffer *mBuf;
3380 #endif
3381 {
3382    TRC3(cmPkRguLchDatInd);
3383
3384       CMCHKPK(cmPkRguPduInfo, &param->pdu, mBuf);
3385    CMCHKPK(cmPkLteLcId, param->lcId, mBuf);
3386    RETVALUE(ROK);
3387 }
3388
3389
3390 \f
3391 /***********************************************************
3392 *
3393 *     Func : cmUnpkRguLchDatInd
3394 *
3395 *
3396 *     Desc : RguLchDatInd
3397  * DatInd Information for a logical channel
3398 *
3399 *
3400 *     Ret  : S16
3401 *
3402 *     Notes:
3403 *
3404 *     File  : 
3405 *
3406 **********************************************************/
3407 #ifdef ANSI
3408 PUBLIC S16 cmUnpkRguLchDatInd
3409 (
3410 RguLchDatInd *param,
3411 Buffer *mBuf
3412 )
3413 #else
3414 PUBLIC S16 cmUnpkRguLchDatInd(param, mBuf)
3415 RguLchDatInd *param;
3416 Buffer *mBuf;
3417 #endif
3418 {
3419    TRC3(cmUnpkRguLchDatInd);
3420
3421    CMCHKUNPK(cmUnpkLteLcId, &param->lcId, mBuf);
3422    CMCHKUNPK(cmUnpkRguPduInfo, &param->pdu, mBuf);
3423    RETVALUE(ROK);
3424 }
3425
3426
3427 \f
3428 /***********************************************************
3429 *
3430 *     Func : cmPkRguDDatIndInfo
3431 *
3432 *
3433 *     Desc : RguDDatIndInfo
3434  * Data Indication from MAC to RLC for dedicated channels of a UE
3435 *
3436 *
3437 *     Ret  : S16
3438 *
3439 *     Notes:
3440 *
3441 *     File  : 
3442 *
3443 **********************************************************/
3444 #ifdef ANSI
3445 PUBLIC S16 cmPkRguDDatIndInfo
3446 (
3447 RguDDatIndInfo *param,
3448 Buffer *mBuf
3449 )
3450 #else
3451 PUBLIC S16 cmPkRguDDatIndInfo(param, mBuf)
3452 RguDDatIndInfo *param;
3453 Buffer *mBuf;
3454 #endif
3455 {
3456    S32 i;
3457
3458    TRC3(cmPkRguDDatIndInfo);
3459
3460 #ifdef LTE_L2_MEAS
3461    CMCHKPK(SPkU8, param->burstInd, mBuf);
3462    CMCHKPK(SPkU32, param->ttiCnt, mBuf);
3463 #endif
3464    for (i=param->numLch-1; i >= 0; i--) {
3465       CMCHKPK(cmPkRguLchDatInd, &param->lchData[i], mBuf);
3466    }
3467    CMCHKPK(SPkU8, param->numLch, mBuf);
3468    CMCHKPK(cmPkLteRnti, param->rnti, mBuf);
3469    CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
3470    RETVALUE(ROK);
3471 }
3472
3473
3474 \f
3475 /***********************************************************
3476 *
3477 *     Func : cmUnpkRguDDatIndInfo
3478 *
3479 *
3480 *     Desc : RguDDatIndInfo
3481  * Data Indication from MAC to RLC for dedicated channels of a UE
3482 *
3483 *
3484 *     Ret  : S16
3485 *
3486 *     Notes:
3487 *
3488 *     File  : 
3489 *
3490 **********************************************************/
3491 #ifdef ANSI
3492 PUBLIC S16 cmUnpkRguDDatIndInfo
3493 (
3494 RguDDatIndInfo *param,
3495 Buffer *mBuf
3496 )
3497 #else
3498 PUBLIC S16 cmUnpkRguDDatIndInfo(param, mBuf)
3499 RguDDatIndInfo *param;
3500 Buffer *mBuf;
3501 #endif
3502 {
3503    S32 i;
3504
3505    TRC3(cmUnpkRguDDatIndInfo);
3506
3507    CMCHKUNPK(cmUnpkLteCellId, &param->cellId, mBuf);
3508    CMCHKUNPK(cmUnpkLteRnti, &param->rnti, mBuf);
3509    CMCHKUNPK(SUnpkU8, &param->numLch, mBuf);
3510    for (i=0; i<param->numLch; i++) {
3511       CMCHKUNPK(cmUnpkRguLchDatInd, &param->lchData[i], mBuf);
3512    }
3513 #ifdef LTE_L2_MEAS
3514    CMCHKUNPK(SUnpkU32, &param->ttiCnt, mBuf);
3515    CMCHKUNPK(SUnpkU8, &param->burstInd, mBuf);
3516 #endif
3517    RETVALUE(ROK);
3518 }
3519
3520 \f
3521 /***********************************************************
3522 *
3523 *     Func : cmPkRguCStaRspInfo
3524 *
3525 *
3526 *     Desc : RguCStaRspInfo
3527  * Status Response from RLC to MAC  for common logical channel
3528 *
3529 *
3530 *     Ret  : S16
3531 *
3532 *     Notes:
3533 *
3534 *     File  : 
3535 *
3536 **********************************************************/
3537 #ifdef ANSI
3538 PUBLIC S16 cmPkRguCStaRspInfo
3539 (
3540 RguCStaRspInfo *param,
3541 Buffer *mBuf
3542 )
3543 #else
3544 PUBLIC S16 cmPkRguCStaRspInfo(param, mBuf)
3545 RguCStaRspInfo *param;
3546 Buffer *mBuf;
3547 #endif
3548 {
3549
3550    TRC3(cmPkRguCStaRspInfo);
3551
3552    switch(param->lcType) {
3553       case CM_LTE_LCH_CCCH:
3554          CMCHKPK(cmPkLteRnti, param->u.rnti, mBuf);
3555          break;
3556       case CM_LTE_LCH_BCCH:
3557       case CM_LTE_LCH_PCCH:
3558          CMCHKPK(cmPkLteTimingInfo, &param->u.timeToTx, mBuf);
3559 #ifdef EMTC_ENABLE
3560          CMCHKPK(SPkU8,param->pnb,mBuf);
3561          CMCHKPK(SPkU8,param->emtcDiReason,mBuf);
3562 #endif
3563          break;
3564       default :
3565          RETVALUE(RFAILED);
3566    }
3567    CMCHKPK(SPkS32, param->bo, mBuf);
3568    CMCHKPK(cmPkLteLcType, param->lcType, mBuf);
3569    CMCHKPK(cmPkLteLcId, param->lcId, mBuf);
3570    CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
3571    RETVALUE(ROK);
3572 }
3573
3574
3575 \f
3576 /***********************************************************
3577 *
3578 *     Func : cmUnpkRguCStaRspInfo
3579 *
3580 *
3581 *     Desc : RguCStaRspInfo
3582  * Status Response from RLC to MAC  for common logical channel
3583 *
3584 *
3585 *     Ret  : S16
3586 *
3587 *     Notes:
3588 *
3589 *     File  : 
3590 *
3591 **********************************************************/
3592 #ifdef ANSI
3593 PUBLIC S16 cmUnpkRguCStaRspInfo
3594 (
3595 RguCStaRspInfo *param,
3596 Buffer *mBuf
3597 )
3598 #else
3599 PUBLIC S16 cmUnpkRguCStaRspInfo(param, mBuf)
3600 RguCStaRspInfo *param;
3601 Buffer *mBuf;
3602 #endif
3603 {
3604
3605    TRC3(cmUnpkRguCStaRspInfo);
3606
3607    CMCHKUNPK(cmUnpkLteCellId, &param->cellId, mBuf);
3608    CMCHKUNPK(cmUnpkLteLcId, &param->lcId, mBuf);
3609    CMCHKUNPK(cmUnpkLteLcType, &param->lcType, mBuf);
3610    CMCHKUNPK(SUnpkS32, &param->bo, mBuf);
3611    switch(param->lcType) {
3612       case CM_LTE_LCH_BCCH:
3613       case CM_LTE_LCH_PCCH:
3614 #ifdef EMTC_ENABLE
3615          CMCHKUNPK(SUnpkU8,&param->emtcDiReason , mBuf);
3616          CMCHKUNPK(SUnpkU8,&param->pnb , mBuf);
3617 #endif
3618          CMCHKUNPK(cmUnpkLteTimingInfo, &param->u.timeToTx, mBuf);
3619          break;
3620       case CM_LTE_LCH_CCCH:
3621          CMCHKUNPK(cmUnpkLteRnti, &param->u.rnti, mBuf);
3622          break;
3623       default :
3624          RETVALUE(RFAILED);
3625    }
3626    RETVALUE(ROK);
3627 }
3628
3629
3630 \f
3631 /***********************************************************
3632 *
3633 *     Func : cmPkRguDStaRspInfo
3634 *
3635 *
3636 *     Desc : RguDStaRspInfo
3637  * Status Response from RLC to MAC  for dedicated logical channel
3638 *
3639 *
3640 *     Ret  : S16
3641 *
3642 *     Notes:
3643 *
3644 *     File  : 
3645 *
3646 **********************************************************/
3647 #ifdef ANSI
3648 PUBLIC S16 cmPkRguDStaRspInfo
3649 (
3650 RguDStaRspInfo *param,
3651 Buffer *mBuf
3652 )
3653 #else
3654 PUBLIC S16 cmPkRguDStaRspInfo(param, mBuf)
3655 RguDStaRspInfo *param;
3656 Buffer *mBuf;
3657 #endif
3658 {
3659
3660    TRC3(cmPkRguDStaRspInfo);
3661
3662    CMCHKPK(cmPkRguDBoReport, &param->boReport, mBuf);
3663    CMCHKPK(cmPkLteLcId, param->lcId, mBuf);
3664    CMCHKPK(cmPkLteRnti, param->rnti, mBuf);
3665    CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
3666    RETVALUE(ROK);
3667 }
3668
3669
3670 \f
3671 /***********************************************************
3672 *
3673 *     Func : cmUnpkRguDStaRspInfo
3674 *
3675 *
3676 *     Desc : RguDStaRspInfo
3677  * Status Response from RLC to MAC  for dedicated logical channel
3678 *
3679 *
3680 *     Ret  : S16
3681 *
3682 *     Notes:
3683 *
3684 *     File  : 
3685 *
3686 **********************************************************/
3687 #ifdef ANSI
3688 PUBLIC S16 cmUnpkRguDStaRspInfo
3689 (
3690 RguDStaRspInfo *param,
3691 Buffer *mBuf
3692 )
3693 #else
3694 PUBLIC S16 cmUnpkRguDStaRspInfo(param, mBuf)
3695 RguDStaRspInfo *param;
3696 Buffer *mBuf;
3697 #endif
3698 {
3699
3700    TRC3(cmUnpkRguDStaRspInfo);
3701
3702    CMCHKUNPK(cmUnpkLteCellId, &param->cellId, mBuf);
3703    CMCHKUNPK(cmUnpkLteRnti, &param->rnti, mBuf);
3704    CMCHKUNPK(cmUnpkLteLcId, &param->lcId, mBuf);
3705    CMCHKUNPK(cmUnpkRguDBoReport, &param->boReport, mBuf);
3706    RETVALUE(ROK);
3707 }
3708
3709
3710 \f
3711 /***********************************************************
3712 *
3713 *     Func : cmPkRguCStaIndInfo
3714 *
3715 *
3716 *     Desc : RguCStaIndInfo
3717  * Status Indication from MAC to RLC for common logical channel
3718 *
3719 *
3720 *     Ret  : S16
3721 *
3722 *     Notes:
3723 *
3724 *     File  : 
3725 *
3726 **********************************************************/
3727 #ifdef ANSI
3728 PUBLIC S16 cmPkRguCStaIndInfo
3729 (
3730 RguCStaIndInfo *param,
3731 Buffer *mBuf
3732 )
3733 #else
3734 PUBLIC S16 cmPkRguCStaIndInfo(param, mBuf)
3735 RguCStaIndInfo *param;
3736 Buffer *mBuf;
3737 #endif
3738 {
3739
3740    TRC3(cmPkRguCStaIndInfo);
3741 #ifdef EMTC_ENBALE
3742    CMCHKPK(cmPkLteTimingInfo, &param->pagingTimingInfo, mBuf);
3743    CMCHKPK(SPkU8, param->isEmtcPaging, mBuf);
3744 #endif
3745    CMCHKPK(cmPkLteRnti, param->rnti, mBuf);
3746    CMCHKPK(SPkU32, param->transId, mBuf);
3747    CMCHKPK(cmPkLteLcId, param->lcId, mBuf);
3748    CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
3749    RETVALUE(ROK);
3750 }
3751
3752
3753 \f
3754 /***********************************************************
3755 *
3756 *     Func : cmUnpkRguCStaIndInfo
3757 *
3758 *
3759 *     Desc : RguCStaIndInfo
3760  * Status Indication from MAC to RLC for common logical channel
3761 *
3762 *
3763 *     Ret  : S16
3764 *
3765 *     Notes:
3766 *
3767 *     File  : 
3768 *
3769 **********************************************************/
3770 #ifdef ANSI
3771 PUBLIC S16 cmUnpkRguCStaIndInfo
3772 (
3773 RguCStaIndInfo *param,
3774 Buffer *mBuf
3775 )
3776 #else
3777 PUBLIC S16 cmUnpkRguCStaIndInfo(param, mBuf)
3778 RguCStaIndInfo *param;
3779 Buffer *mBuf;
3780 #endif
3781 {
3782
3783    TRC3(cmUnpkRguCStaIndInfo);
3784
3785    CMCHKUNPK(cmUnpkLteCellId, &param->cellId, mBuf);
3786    CMCHKUNPK(cmUnpkLteLcId, &param->lcId, mBuf);
3787    CMCHKUNPK(SUnpkU32, &param->transId, mBuf);
3788    /*TODO:Mukesh: Need to check why rnti unpacking is missing*/
3789 #ifdef EMTC_ENBALE
3790    CMCHKUNPK(SUnpkU8, &param->isEmtcPaging, mBuf);
3791    CMCHKUNPK(cmUnpkLteTimingInfo, &param->pagingTimingInfo, mBuf);
3792 #endif
3793    RETVALUE(ROK);
3794 }
3795
3796
3797 \f
3798 /***********************************************************
3799 *
3800 *     Func : cmPkRguLchStaInd
3801 *
3802 *
3803 *     Desc : RguLchStaInd
3804  * StaInd info for each logical channel of a UE
3805 *
3806 *
3807 *     Ret  : S16
3808 *
3809 *     Notes:
3810 *
3811 *     File  : 
3812 *
3813 **********************************************************/
3814 #ifdef ANSI
3815 PUBLIC S16 cmPkRguLchStaInd
3816 (
3817 RguLchStaInd *param,
3818 Buffer *mBuf
3819 )
3820 #else
3821 PUBLIC S16 cmPkRguLchStaInd(param, mBuf)
3822 RguLchStaInd *param;
3823 Buffer *mBuf;
3824 #endif
3825 {
3826
3827    TRC3(cmPkRguLchStaInd);
3828
3829    CMCHKPK(SPkS16, param->totBufSize, mBuf);
3830    CMCHKPK(cmPkLteLcId, param->lcId, mBuf);
3831    RETVALUE(ROK);
3832 }
3833
3834
3835 \f
3836 /***********************************************************
3837 *
3838 *     Func : cmUnpkRguLchStaInd
3839 *
3840 *
3841 *     Desc : RguLchStaInd
3842  * StaInd info for each logical channel of a UE
3843 *
3844 *
3845 *     Ret  : S16
3846 *
3847 *     Notes:
3848 *
3849 *     File  : 
3850 *
3851 **********************************************************/
3852 #ifdef ANSI
3853 PUBLIC S16 cmUnpkRguLchStaInd
3854 (
3855 RguLchStaInd *param,
3856 Buffer *mBuf
3857 )
3858 #else
3859 PUBLIC S16 cmUnpkRguLchStaInd(param, mBuf)
3860 RguLchStaInd *param;
3861 Buffer *mBuf;
3862 #endif
3863 {
3864
3865    TRC3(cmUnpkRguLchStaInd);
3866
3867    CMCHKUNPK(cmUnpkLteLcId, &param->lcId, mBuf);
3868    CMCHKUNPK(SUnpkS16, &param->totBufSize, mBuf);
3869    RETVALUE(ROK);
3870 }
3871
3872 \f
3873 /***********************************************************
3874 *
3875 *     Func : cmPkRguStaIndTb
3876 *
3877 *
3878 *     Desc : RguStaIndTb
3879 * StaInd from RLC to MAC for dedicated channels of a UE
3880 *
3881 *
3882 *     Ret  : S16
3883 *
3884 *     Notes:
3885 *
3886 *     File  : 
3887 *
3888 **********************************************************/
3889 #ifdef ANSI
3890 PUBLIC S16 cmPkRguStaIndTb
3891 (
3892 RguStaIndTb *param,
3893 Buffer *mBuf
3894 )
3895 #else
3896 PUBLIC S16 cmPkRguStaIndTb(param, mBuf)
3897 RguStaIndTb *param;
3898 Buffer *mBuf;
3899 #endif
3900 {
3901    S32 i;
3902
3903    TRC3(cmPkRguStaIndTb);
3904
3905 #ifdef LTE_L2_MEAS
3906    CMCHKPK(SPkU16, param->status, mBuf);
3907    CMCHKPK(SPkU32, param->tbId, mBuf);
3908 #endif   
3909    for (i=param->nmbLch-1; i >= 0; i--) {
3910       CMCHKPK(cmPkRguLchStaInd, &param->lchStaInd[i], mBuf);
3911    }
3912    CMCHKPK(SPkU8, param->nmbLch, mBuf);
3913    RETVALUE(ROK);
3914 }
3915
3916
3917 \f
3918 /***********************************************************
3919 *
3920 *     Func : cmUnpkRguStaIndTb
3921 *
3922 *
3923 *     Desc : RguStaIndTb
3924 * StaInd from RLC to MAC for dedicated channels of a UE
3925 *
3926 *
3927 *     Ret  : S16
3928 *
3929 *     Notes:
3930 *
3931 *     File  : 
3932 *
3933 **********************************************************/
3934 #ifdef ANSI
3935 PUBLIC S16 cmUnpkRguStaIndTb
3936 (
3937 RguStaIndTb *param,
3938 Buffer *mBuf
3939 )
3940 #else
3941 PUBLIC S16 cmUnpkRguStaIndTb(param, mBuf)
3942 RguStaIndTb *param;
3943 Buffer *mBuf;
3944 #endif
3945 {
3946    S32 i;
3947
3948    TRC3(cmUnpkRguStaIndTb);
3949
3950    CMCHKUNPK(SUnpkU8, &param->nmbLch, mBuf);
3951    for (i=0; i<param->nmbLch; i++) {
3952       CMCHKUNPK(cmUnpkRguLchStaInd, &param->lchStaInd[i], mBuf);
3953    }
3954 #ifdef LTE_L2_MEAS
3955    CMCHKUNPK(SUnpkU32, &param->tbId, mBuf);
3956    CMCHKUNPK(SUnpkU16, &param->status, mBuf);
3957 #endif   
3958    RETVALUE(ROK);
3959 }
3960
3961 \f
3962 /***********************************************************
3963 *
3964 *     Func : cmPkRguDStaIndInfo
3965 *
3966 *
3967 *     Desc : RguDStaIndInfo
3968  * StaInd from MAC to RLC for dedicated logical channels of a UE
3969 *
3970 *
3971 *     Ret  : S16
3972 *
3973 *     Notes:
3974 *
3975 *     File  : 
3976 *
3977 **********************************************************/
3978 #ifdef ANSI
3979 PUBLIC S16 cmPkRguDStaIndInfo
3980 (
3981 RguDStaIndInfo *param,
3982 Buffer *mBuf
3983 )
3984 #else
3985 PUBLIC S16 cmPkRguDStaIndInfo(param, mBuf)
3986 RguDStaIndInfo *param;
3987 Buffer *mBuf;
3988 #endif
3989 {
3990    S32 i;
3991    S32 idx;
3992
3993    TRC3(cmPkRguDStaIndInfo);
3994
3995    for(idx = (param->nmbOfUeGrantPerTti - 1); idx >= 0 ; idx--)
3996    {
3997       RguDStaIndPerUe *staInd = &param->staInd[idx];
3998       CMCHKPK(SPkU8, staInd->fillCtrlPdu, mBuf);
3999       for (i=staInd->nmbOfTbs-1; i >= 0; i--) {
4000          CMCHKPK(cmPkRguStaIndTb, &staInd->staIndTb[i], mBuf);
4001       }
4002       CMCHKPK(SPkU8, staInd->nmbOfTbs, mBuf);
4003       CMCHKPK(SPkU32,staInd->transId, mBuf);
4004       CMCHKPK(cmPkLteRnti, staInd->rnti, mBuf);
4005    }
4006    CMCHKPK(SPkU8, param->nmbOfUeGrantPerTti, mBuf);
4007    CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
4008    RETVALUE(ROK);
4009 }
4010
4011
4012 \f
4013 /***********************************************************
4014 *
4015 *     Func : cmUnpkRguDStaIndInfo
4016 *
4017 *
4018 *     Desc : RguDStaIndInfo
4019  * StaInd from MAC to RLC for dedicated logical channels of a UE
4020 *
4021 *
4022 *     Ret  : S16
4023 *
4024 *     Notes:
4025 *
4026 *     File  : 
4027 *
4028 **********************************************************/
4029 #ifdef ANSI
4030 PUBLIC S16 cmUnpkRguDStaIndInfo
4031 (
4032 RguDStaIndInfo *param,
4033 Buffer *mBuf
4034 )
4035 #else
4036 PUBLIC S16 cmUnpkRguDStaIndInfo(param, mBuf)
4037 RguDStaIndInfo *param;
4038 Buffer *mBuf;
4039 #endif
4040 {
4041    S32 i;
4042    S32 idx;
4043
4044    TRC3(cmUnpkRguDStaIndInfo);
4045
4046    CMCHKUNPK(cmUnpkLteCellId, &param->cellId, mBuf);
4047    CMCHKUNPK(SUnpkU8, &param->nmbOfUeGrantPerTti, mBuf);
4048    for(idx = 0; idx < param->nmbOfUeGrantPerTti; idx++)
4049    {
4050       RguDStaIndPerUe *staInd = &param->staInd[idx];
4051       CMCHKUNPK(cmUnpkLteRnti, &staInd->rnti, mBuf);
4052       CMCHKUNPK(SUnpkU32, &staInd->transId, mBuf);
4053       CMCHKUNPK(SUnpkU8, &staInd->nmbOfTbs, mBuf);
4054       for (i=0; i<staInd->nmbOfTbs; i++) 
4055       {
4056          CMCHKUNPK(cmUnpkRguStaIndTb, &staInd->staIndTb[i], mBuf);
4057       }
4058       CMCHKUNPK(SUnpkU8, &staInd->fillCtrlPdu, mBuf);
4059    }
4060    RETVALUE(ROK);
4061 }
4062
4063 #endif
4064
4065 /**********************************************************************
4066          End of file
4067 **********************************************************************/