RLC-MAC Interface APIs and Memory configuration Changes
[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 
419  * dedicated channel for transmission
420 *
421 * @details
422 *
423 *     Function : packSendDlData
424 *
425 *  @param[in]   Pst*  pst
426 *  @param[in]   SpId  spId
427 *  @param[in]   RguDDatReqInfo  *  datReq
428 *  @return   S16
429 *      -# ROK
430 **/
431 #ifdef ANSI
432 PUBLIC S16 packSendDlData
433 (
434 Pst* pst,
435 SpId spId,
436 RlcMacData  *dlData
437 )
438 #else
439 PUBLIC S16 packSendDlData(pst, spId, dlData)
440 Pst* pst;
441 SpId spId;
442 RlcMacData  dlData;
443 #endif
444 {
445    Buffer *mBuf = NULLP;
446    TRC3(packSendDlData)
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)ERGU022, (ErrVal)0, "Packing failed");
453 #endif      
454       SPutSBuf(pst->region, pst->pool, (Data *)dlData, sizeof(RlcMacData));
455       RETVALUE(RFAILED);
456    }
457
458    if (pst->selector == RGU_SEL_LWLC)
459    {
460       CMCHKPK(cmPkPtr,(PTR) dlData, mBuf);
461    }
462    else
463    {
464       /*rgu_c_001.main_5 - ADD - L2M Support */
465 #ifdef LTE_L2_MEAS
466       if (packRlcMacDataInfo(pst, dlData, mBuf) != ROK)
467 #else
468       if (packRlcMacDataInfo(dlData, mBuf) != ROK) 
469 #endif
470       {
471 #if (ERRCLASS & ERRCLS_ADD_RES)      
472          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
473           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
474           (ErrVal)ERGU023, (ErrVal)0, "Packing failed");
475 #endif      
476          SPutSBuf(pst->region, pst->pool, (Data *)dlData,
477                                        sizeof(RlcMacData));
478          SPutMsg(mBuf);
479          RETVALUE(RFAILED);
480       }
481
482       if (SPutSBuf(pst->region, pst->pool, 
483                    (Data *)dlData, sizeof(RlcMacData)) != ROK) {
484 #if (ERRCLASS & ERRCLS_ADD_RES)      
485          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
486               __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
487              (ErrVal)ERGU025, (ErrVal)0, "Packing failed");
488 #endif      
489          SPutMsg(mBuf);
490          RETVALUE(RFAILED);
491       }
492       dlData = NULLP;
493    }
494    if (SPkS16(spId, mBuf) != ROK) {
495 #if (ERRCLASS & ERRCLS_ADD_RES)      
496       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
497           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
498           (ErrVal)ERGU024, (ErrVal)0, "Packing failed");
499 #endif      
500       if (dlData != NULLP);
501       {
502          SPutSBuf(pst->region, pst->pool, 
503                   (Data *)dlData, sizeof(RlcMacData));
504       }
505       SPutMsg(mBuf);
506       RETVALUE(RFAILED);
507    }
508    pst->event = (Event) EVTRLCDLDAT;
509    RETVALUE(SPstTsk(pst,mBuf));
510 }
511
512 \f
513 /**
514 * @brief Request from RLC to MAC for forwarding SDUs on 
515  * dedicated channel for transmission
516 *
517 * @details
518 *
519 *     Function : unpackSendDlData
520 *
521 *  @param[in]   Pst*  pst
522 *  @param[in]   SpId  spId
523 *  @param[in]   RguDDatReqInfo  *  datReq
524 *  @return   S16
525 *      -# ROK
526 **/
527 #ifdef ANSI
528 PUBLIC S16 unpackSendDlData
529 (
530 RguDDatReq func,
531 Pst *pst,
532 Buffer *mBuf
533 )
534 #else
535 PUBLIC S16 unpackSendDlData(func, pst, mBuf)
536 RguDDatReq func;
537 Pst *pst;
538 Buffer *mBuf;
539 #endif
540 {
541    SpId spId;
542 //   RguDDatReqInfo *datReq;
543    RlcMacData *dlData;
544    
545    TRC3(unpackSendDlData)
546
547    if (SUnpkS16(&spId, mBuf) != ROK) {
548       SPutMsg(mBuf);
549       RETVALUE(RFAILED);
550    }
551
552    if (pst->selector == RGU_SEL_LWLC)
553    {
554       CMCHKUNPK(cmUnpkPtr,(PTR *) &dlData, mBuf);
555    }
556    else 
557    {
558       if ((SGetSBuf(pst->region, pst->pool, 
559                      (Data **)&dlData, sizeof(RlcMacData))) != ROK) {
560 #if (ERRCLASS & ERRCLS_ADD_RES)      
561          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
562              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
563              (ErrVal)ERGU026, (ErrVal)0, "UnPacking failed");
564 #endif      
565          SPutMsg(mBuf);
566          RETVALUE(RFAILED);
567       }
568       cmMemset((U8*)dlData, (U8)0, sizeof(RlcMacData));
569   /*rgu_c_001.main_5 - ADD - L2M Support */
570 #ifdef LTE_L2_MEAS
571       if (unpackRlcMacDataInfo(pst,dlData, mBuf) != ROK)
572 #else
573       if (unpackRlcMacDataInfo(dlData, mBuf) != ROK) 
574 #endif
575       {
576 #if (ERRCLASS & ERRCLS_ADD_RES)      
577          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
578              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
579              (ErrVal)ERGU027, (ErrVal)0, "UnPacking failed");
580 #endif      
581          SPutMsg(mBuf);
582          SPutSBuf(pst->region, pst->pool, (Data *)dlData,
583                                      sizeof(RlcMacData));
584          RETVALUE(RFAILED);
585       }
586    }
587    SPutMsg(mBuf);
588
589    /* TODO : change function call to send RlcMacData as below: */
590    RETVALUE((*func)(pst, spId, dlData));
591    
592    //RETVALUE((*func)(pst, spId, datReq));
593 }
594
595 \f
596 /**
597 * @brief Data Indication from MAC to RLC to 
598  * forward the data received for dedicated channels
599 *
600 * @details
601 *
602 *     Function : packRcvdUlData
603 *
604 *  @param[in]   Pst*  pst
605 *  @param[in]   SuId  suId
606 *  @param[in]   RlcMacData *ulData
607 *  @return   S16
608 *      -# ROK
609 **/
610 #ifdef ANSI
611 PUBLIC S16 packRcvdUlData
612 (
613 Pst* pst,
614 SuId suId,
615 RlcMacData  *ulData
616 )
617 #else
618 PUBLIC S16 packRcvdUlData(pst, suId, ulData)
619 Pst* pst;
620 SuId suId;
621 RlcMacData  *ulData;
622 #endif
623 {
624    Buffer *mBuf = NULLP;
625    TRC3(packRcvdUlData)
626
627    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
628 #if (ERRCLASS & ERRCLS_ADD_RES)      
629       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
630           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
631           (ErrVal)ERGU035, (ErrVal)0, "Packing failed");
632 #endif      
633       SPutStaticBuffer(pst->region, pst->pool, (Data *)ulData, sizeof(RlcMacData),0);
634       RETVALUE(RFAILED);
635    }
636
637    if (pst->selector == RGU_SEL_LWLC)
638    {
639       CMCHKPK(cmPkPtr,(PTR)ulData, mBuf);
640    }
641    else
642    {
643       if (packRlcMacDataInfo(ulData, mBuf) != ROK) {
644 #if (ERRCLASS & ERRCLS_ADD_RES)      
645             SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
646                 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
647                 (ErrVal)ERGU036, (ErrVal)0, "Packing failed");
648 #endif            
649          SPutStaticBuffer(pst->region, pst->pool, (Data *)ulData, sizeof(RlcMacData),0);
650          SPutMsg(mBuf);
651          RETVALUE(RFAILED);
652       }
653
654       if (SPutStaticBuffer(pst->region, pst->pool, 
655                       (Data *)ulData, sizeof(RlcMacData),0) != ROK) {
656 #if (ERRCLASS & ERRCLS_ADD_RES)      
657          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
658              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
659              (ErrVal)ERGU038, (ErrVal)0, "Packing failed");
660 #endif      
661          SPutMsg(mBuf);
662          RETVALUE(RFAILED);
663       }
664       ulData = NULLP;
665    }
666    if (SPkS16(suId, mBuf) != ROK) {
667 #if (ERRCLASS & ERRCLS_ADD_RES)      
668       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
669           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
670           (ErrVal)ERGU037, (ErrVal)0, "Packing failed");
671 #endif      
672       SPutStaticBuffer(pst->region, pst->pool, (Data *)ulData, sizeof(RlcMacData),0);
673       SPutMsg(mBuf);
674       RETVALUE(RFAILED);
675    }
676
677    pst->event = (Event) EVTRLCULDAT;
678    RETVALUE(SPstTsk(pst,mBuf));
679 }
680
681 \f
682 /**
683 * @brief Data Indication from MAC to RLC to 
684  * forward the data received for dedicated channels
685 *
686 * @details
687 *
688 *     Function : unpackRcvdUlData
689 *
690 *  @param[in]   Pst*  pst
691 *  @param[in]   SuId  suId
692 *  @param[in]   RlcMacData  *ulData
693 *  @return   S16
694 *      -# ROK
695 **/
696 #ifdef ANSI
697 PUBLIC S16 unpackRcvdUlData
698 (
699 RguDDatInd func,
700 Pst *pst,
701 Buffer *mBuf
702 )
703 #else
704 PUBLIC S16 unpackRcvdUlData(func, pst, mBuf)
705 RguDDatInd func;
706 Pst *pst;
707 Buffer *mBuf;
708 #endif
709 {
710    SuId suId;
711    RlcMacData *ulData;
712    
713    TRC3(unpackRcvdUlData)
714
715    if (SUnpkS16(&suId, mBuf) != ROK) {
716 #if (ERRCLASS & ERRCLS_ADD_RES)      
717       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
718           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
719           (ErrVal)ERGU039, (ErrVal)0, "UnPacking failed");
720 #endif      
721       SPutMsg(mBuf);
722       RETVALUE(RFAILED);
723    }
724
725    if (pst->selector == RGU_SEL_LWLC)
726    {
727       CMCHKUNPK(cmUnpkPtr,(PTR *) &ulData, mBuf);
728    }
729    else 
730    {
731        if ((SGetStaticBuffer(pst->region, pst->pool, 
732                     (Data **)&ulData, sizeof(RlcMacData),0)) != ROK) {
733 #if (ERRCLASS & ERRCLS_ADD_RES)      
734          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
735              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
736              (ErrVal)ERGU040, (ErrVal)0, "UnPacking failed");
737 #endif      
738          SPutMsg(mBuf);
739          RETVALUE(RFAILED);
740       }
741       if (unpackRlcMacDataInfo(ulData, mBuf) != ROK) {
742 #if (ERRCLASS & ERRCLS_ADD_RES)      
743          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
744              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
745              (ErrVal)ERGU041, (ErrVal)0, "UnPacking failed");
746 #endif      
747          SPutMsg(mBuf);
748          SPutStaticBuffer(pst->region, pst->pool, 
749                     (Data *)ulData, sizeof(RlcMacData),0);
750          RETVALUE(RFAILED);
751       }
752    }
753    SPutMsg(mBuf);
754    RETVALUE((*func)(pst, suId, ulData));
755 }
756
757
758 /*rgu_c_001.main_5 - ADD - L2M & R9 Support */
759 #ifdef LTE_L2_MEAS
760
761 /***********************************************************
762 *
763 *     Func :cmPkRguL2MUlThrpMeasReqInfo 
764 *
765 *
766 * Status Response from RLC to MAC on UL dedicated logical channel for Uplink
767 * Scheduled throughput measurement
768 *
769 *
770 *     Ret  : S16
771 *
772 *     Notes:
773 *
774 *     File  : 
775 *
776 **********************************************************/
777 #ifdef ANSI
778 PUBLIC S16 cmPkRguL2MUlThrpMeasReqInfo 
779 (
780 RguL2MUlThrpMeasReqInfo* param,
781 Buffer *mBuf
782 )
783 #else
784 PUBLIC S16 cmPkRguL2MUlThrpMeasReqInfo(param, mBuf)
785 RguL2MUlThrpMeasReqInfo* param;
786 Buffer *mBuf;
787 #endif
788 {
789    S32 loop;
790    TRC3(cmPkRguL2MUlThrpMeasReqInfo);
791
792    CMCHKPK(SPkU8, param->enbMeas, mBuf);
793    for (loop=param->numLcId-1; loop >= 0; loop--)
794    {
795       CMCHKPK(SPkU8, param->lcId[loop], mBuf);
796    }
797    CMCHKPK(cmPkLteLcId, param->numLcId, mBuf);
798    CMCHKPK(cmPkLteRnti, param->rnti, mBuf);
799    CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
800    RETVALUE(ROK);
801 }
802
803
804 \f
805 /***********************************************************
806 *
807 *     Func :cmUnpkRguL2MUlThrpMeasReqInfo 
808 *
809 *
810 * Status Response from RLC to MAC on UL dedicated logical channel for Uplink
811 * Scheduled throughput measurement
812 *
813 *
814 *     Ret  : S16
815 *
816 *     Notes:
817 *
818 *     File  : 
819 *
820 **********************************************************/
821 #ifdef ANSI
822 PUBLIC S16 cmUnpkRguL2MUlThrpMeasReqInfo 
823 (
824 RguL2MUlThrpMeasReqInfo *param,
825 Buffer *mBuf
826 )
827 #else
828 PUBLIC S16 cmUnpkRguL2MUlThrpMeasReqInfo(param, mBuf)
829 RguL2MUlThrpMeasReqInfo *param;
830 Buffer *mBuf;
831 #endif
832 {
833    U8 loop;
834    TRC3(cmUnpkRguL2MUlThrpMeasReqInfo);
835
836    CMCHKUNPK(cmUnpkLteCellId, &param->cellId, mBuf);
837    CMCHKUNPK(cmUnpkLteRnti, &param->rnti, mBuf);
838    CMCHKUNPK(cmUnpkLteLcId, &param->numLcId, mBuf);
839    for (loop=0; loop<param->numLcId; loop++)
840    {
841       CMCHKUNPK(SUnpkU8, &param->lcId[loop], mBuf);
842    }
843    CMCHKUNPK(SUnpkU8, &param->enbMeas, mBuf);
844    RETVALUE(ROK);
845 }
846
847 /**
848 * @brief Primitive invoked from RLC to MAC to 
849 * inform the On/Off status for Scheduled UL throughput 
850 * measurment for dedicated channels
851 *
852 * @details
853 *
854 *     Function :cmPkRguL2MUlThrpMeasReq 
855 *
856 *  @param[in]   Pst*  pst
857 *  @param[in]   SpId  spId
858 *  @param[in]   RguL2MUlThrpMeasReqInfo*  measReq
859 *  @return   S16
860 *      -# ROK
861 **/
862 #ifdef ANSI
863 PUBLIC S16 cmPkRguL2MUlThrpMeasReq 
864 (
865 Pst* pst,
866 SpId spId,
867 RguL2MUlThrpMeasReqInfo* measReq
868 )
869 #else
870 PUBLIC S16 cmPkRguL2MUlThrpMeasReq(pst, spId, measReq)
871 Pst* pst;
872 SpId spId;
873 RguL2MUlThrpMeasReqInfo* measReq;
874 #endif
875 {
876    Buffer *mBuf = NULLP;
877    TRC3(cmPkRguL2MUlThrpMeasReq)
878
879    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
880 #if (ERRCLASS & ERRCLS_ADD_RES)      
881       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
882           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
883           (ErrVal)ERGU049, (ErrVal)0, "Packing failed");
884 #endif      
885       SPutSBuf(pst->region, pst->pool, (Data *)measReq, sizeof(RguL2MUlThrpMeasReqInfo));
886       RETVALUE(RFAILED);
887    }
888    if (pst->selector == RGU_SEL_LWLC)
889    {
890       CMCHKPK(cmPkPtr,(PTR) measReq, mBuf);
891    }
892    else
893    {
894       if (cmPkRguL2MUlThrpMeasReqInfo(measReq, mBuf) != ROK) {
895 #if (ERRCLASS & ERRCLS_ADD_RES)      
896          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
897              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
898              (ErrVal)ERGU050, (ErrVal)0, "Packing failed");
899 #endif      
900          SPutSBuf(pst->region, pst->pool, (Data *)measReq, 
901                                     sizeof(RguL2MUlThrpMeasReqInfo));
902          SPutMsg(mBuf);
903          RETVALUE(RFAILED);
904       }
905       if (SPutSBuf(pst->region, pst->pool, (Data *)measReq, 
906                            sizeof(RguL2MUlThrpMeasReqInfo)) != ROK) {
907 #if (ERRCLASS & ERRCLS_ADD_RES)      
908          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
909             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
910              (ErrVal)ERGU052, (ErrVal)0, "Packing failed");
911 #endif      
912          SPutMsg(mBuf);
913          RETVALUE(RFAILED);
914       }
915       measReq = NULLP;
916    }
917
918    if (SPkS16(spId, mBuf) != ROK) {
919 #if (ERRCLASS & ERRCLS_ADD_RES)      
920       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
921           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
922           (ErrVal)ERGU051, (ErrVal)0, "Packing failed");
923 #endif      
924       if (measReq != NULLP)
925       {
926          SPutSBuf(pst->region, pst->pool, (Data *)measReq,
927                              sizeof(RguL2MUlThrpMeasReqInfo));
928       }
929       SPutMsg(mBuf);
930       RETVALUE(RFAILED);
931    }
932
933    pst->event = (Event) EVTRGUL2MULTHRPMEASREQ;
934    RETVALUE(SPstTsk(pst,mBuf));
935 }
936
937 \f
938 /**
939 * @brief Primitive invoked from RLC to MAC to 
940 * inform the On/Off status for Scheduled UL throughput 
941 * measurment for dedicated channels
942 *
943 * @details
944 *
945 *     Function :cmUnpkRguL2MUlThrpMeasReq 
946 *
947 *  @param[in]   Pst*  pst
948 *  @param[in]   SpId  spId
949 *  @param[in]   RguL2MUlThrpMeasReqInfo  * measReq 
950 *  @return   S16
951 *      -# ROK
952 **/
953 #ifdef ANSI
954 PUBLIC S16 cmUnpkRguL2MUlThrpMeasReq 
955 (
956 RguL2MUlThrpMeasReq func,
957 Pst *pst,
958 Buffer *mBuf
959 )
960 #else
961 PUBLIC S16 cmUnpkRguL2MUlThrpMeasReq(func, pst, mBuf)
962 RguL2MUlThrpMeasReq func;
963 Pst *pst;
964 Buffer *mBuf;
965 #endif
966 {
967    SpId spId;
968    RguL2MUlThrpMeasReqInfo* measReq;
969    
970    TRC3(cmUnpkRguL2MUlThrpMeasReq)
971
972    if (SUnpkS16(&spId, mBuf) != ROK) {
973 #if (ERRCLASS & ERRCLS_ADD_RES)      
974       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
975           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
976           (ErrVal)ERGU053, (ErrVal)0, "UnPacking failed");
977 #endif      
978       SPutMsg(mBuf);
979       RETVALUE(RFAILED);
980    }
981    if (pst->selector == RGU_SEL_LWLC)
982    {
983       CMCHKUNPK(cmUnpkPtr,(PTR *) &measReq, mBuf);
984    }
985    else 
986    {
987       if ((SGetSBuf(pst->region, pst->pool, (Data **)&measReq,
988                               sizeof(RguL2MUlThrpMeasReqInfo))) != ROK) {
989 #if (ERRCLASS & ERRCLS_ADD_RES)      
990          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
991              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
992              (ErrVal)ERGU054, (ErrVal)0, "UnPacking failed");
993 #endif      
994          SPutMsg(mBuf);
995          RETVALUE(RFAILED);
996       }
997       if (cmUnpkRguL2MUlThrpMeasReqInfo(measReq, mBuf) != ROK) {
998 #if (ERRCLASS & ERRCLS_ADD_RES)      
999          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1000              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1001              (ErrVal)ERGU055, (ErrVal)0, "UnPacking failed");
1002 #endif      
1003          SPutMsg(mBuf);
1004          SPutSBuf(pst->region, pst->pool, (Data *)measReq, 
1005                                 sizeof(RguL2MUlThrpMeasReqInfo));
1006          RETVALUE(RFAILED);
1007       }
1008    }
1009    SPutMsg(mBuf);
1010    RETVALUE((*func)(pst, spId, measReq));
1011 }
1012
1013 #endif
1014
1015
1016
1017 \f
1018 /**
1019 * @brief Primitive invoked from RLC to MAC to 
1020  * inform the BO report for dedicated channels
1021 *
1022 * @details
1023 *
1024 *     Function : packSendBOStatus,
1025 *
1026 *  @param[in]   Pst*  pst
1027 *  @param[in]   SpId  spId
1028 *  @param[in]   RlcMacBOStatus  *  staRsp
1029 *  @return   S16
1030 *      -# ROK
1031 **/
1032 #ifdef ANSI
1033 PUBLIC S16 packSendBOStatus
1034 (
1035 Pst* pst,
1036 SpId spId,
1037 RlcMacBOStatus  *boStatus
1038 )
1039 #else
1040 PUBLIC S16 packSendBOStatus(pst, spId, staRsp)
1041 Pst* pst;
1042 SpId spId;
1043 RlcMacBOStatus  *boStatus;
1044 #endif
1045 {
1046    RlcMacBOStatus  *boStaInfo = NULL;
1047    Buffer *mBuf = NULLP;
1048
1049    if(SGetSBuf(pst->region, pst->pool, (Data **)&boStaInfo, sizeof(RlcMacBOStatus)) != ROK)
1050    {
1051 #if (ERRCLASS & ERRCLS_ADD_RES)      
1052       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1053             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1054             (ErrVal)ERGU056, (ErrVal)0, "Packing failed");
1055 #endif      
1056       RETVALUE(RFAILED);
1057    }
1058 #ifdef ERRCLS_KW
1059    /* boStaInfo cant be NULL here */
1060    if (boStaInfo == NULLP)
1061    {
1062       RETVALUE(RFAILED);
1063    }
1064 #endif
1065    cmMemcpy((U8 *)boStaInfo, (U8 *)boStatus, sizeof(RlcMacBOStatus)); 
1066    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
1067 #if (ERRCLASS & ERRCLS_ADD_RES)      
1068       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1069           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1070           (ErrVal)ERGU056, (ErrVal)0, "Packing failed");
1071 #endif      
1072          SPutSBuf(pst->region, pst->pool, (Data *)boStaInfo, sizeof(RlcMacBOStatus));
1073
1074       RETVALUE(RFAILED);
1075    }
1076    if (pst->selector == RGU_SEL_LWLC)
1077    {
1078       CMCHKPK(cmPkPtr,(PTR) boStaInfo, mBuf);
1079    }
1080    else
1081    {
1082       if (packBOStatusInfo(boStatus, mBuf) != ROK) {
1083 #if (ERRCLASS & ERRCLS_ADD_RES)      
1084         SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1085             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1086             (ErrVal)ERGU057, (ErrVal)0, "Packing failed");
1087 #endif      
1088         SPutMsg(mBuf);
1089         RETVALUE(RFAILED);
1090      }
1091    }
1092    if (SPkS16(spId, mBuf) != ROK) {
1093 #if (ERRCLASS & ERRCLS_ADD_RES)      
1094       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1095           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1096           (ErrVal)ERGU058, (ErrVal)0, "Packing failed");
1097 #endif      
1098       if (boStaInfo != NULLP)
1099       {
1100          SPutSBuf(pst->region, pst->pool, (Data *)boStaInfo, sizeof(RlcMacBOStatus));
1101       }
1102       SPutMsg(mBuf);
1103       RETVALUE(RFAILED);
1104    }
1105
1106    pst->event = (Event)EVTRLCBOSTA;
1107    RETVALUE(SPstTsk(pst,mBuf));
1108    SPutMsg(mBuf);
1109 }
1110
1111 \f
1112 /**
1113 * @brief Primitive invoked from RLC to MAC to 
1114 * inform the BO report for dedicated channels
1115 *
1116 * @details
1117 *
1118 *     Function : unpackSendBOStatus
1119 *
1120 *  @param[in]   Pst*  pst
1121 *  @param[in]   SpId  spId
1122 *  @param[in]   RlcMacBOStatus *  staRsp
1123 *  @return   S16
1124 *      -# ROK
1125 **/
1126 #ifdef ANSI
1127 PUBLIC S16 unpackSendBOStatus
1128 (
1129 RguDStaRsp func,
1130 Pst *pst,
1131 Buffer *mBuf
1132 )
1133 #else
1134 PUBLIC S16 unpackSendBOStatus(func, pst, mBuf)
1135 RguDStaRsp func;
1136 Pst *pst;
1137 Buffer *mBuf;
1138 #endif
1139 {
1140    SpId spId;
1141    RlcMacBOStatus *boSta;
1142
1143    TRC3(unpackSendBOStatus)
1144
1145    if (SUnpkS16(&spId, mBuf) != ROK) {
1146 #if (ERRCLASS & ERRCLS_ADD_RES)      
1147       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1148           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1149           (ErrVal)ERGU060, (ErrVal)0, "UnPacking failed");
1150 #endif      
1151       SPutMsg(mBuf);
1152       RETVALUE(RFAILED);
1153    }
1154
1155    if (pst->selector == RGU_SEL_LWLC)
1156    {
1157       CMCHKUNPK(cmUnpkPtr,(PTR *) &boSta, mBuf);
1158    }
1159    else
1160    {
1161       if ((SGetSBuf(pst->region, pst->pool, (Data **)&boSta, 
1162                                  sizeof(RlcMacBOStatus))) != ROK) {
1163 #if (ERRCLASS & ERRCLS_ADD_RES)      
1164          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1165              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1166              (ErrVal)ERGU061, (ErrVal)0, "UnPacking failed");
1167 #endif      
1168          SPutMsg(mBuf);
1169          RETVALUE(RFAILED);
1170       }
1171       if (unpackBOStatusInfo(boSta, mBuf) != ROK) {
1172 #if (ERRCLASS & ERRCLS_ADD_RES)      
1173          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1174              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1175              (ErrVal)ERGU062, (ErrVal)0, "UnPacking failed");
1176 #endif      
1177          SPutMsg(mBuf);
1178          SPutSBuf(pst->region, pst->pool, (Data *)boSta, sizeof(RlcMacBOStatus));
1179          RETVALUE(RFAILED);
1180       }
1181    }
1182    SPutMsg(mBuf);
1183   // (*func)(pst, spId, boSta);
1184    SPutSBuf(pst->region, pst->pool, (Data *)boSta, sizeof(RlcMacBOStatus));
1185    RETVALUE(ROK);
1186 }
1187
1188
1189    /*rgu_c_001.main_5 - ADD - L2M Support */
1190 #ifdef LTE_L2_MEAS
1191 \f
1192 /**
1193 * @brief Harq Status Indication from MAC to RLC  
1194 *
1195 * @details
1196 *
1197 *     Function : cmPkRguHqStaInd
1198 *
1199 *  @param[in]   Pst*  pst
1200 *  @param[in]   SuId  suId
1201 *  @param[in]   RguHarqStatusInd  *harqStatusInd
1202 *  @return   S16
1203 *      -# ROK
1204 **/
1205 #ifdef ANSI
1206 PUBLIC S16 cmPkRguHqStaInd
1207 (
1208 Pst* pst,
1209 SuId suId,
1210 RguHarqStatusInd  *harqStatusInd
1211 )
1212 #else
1213 PUBLIC S16 cmPkRguHqStaInd(pst, suId, harqStatusInd)
1214 Pst* pst;
1215 SuId suId;
1216 RguHarqStatusInd  *harqStatusInd;
1217 #endif
1218 {
1219
1220    Buffer   *mBuf;
1221    U8       idx;
1222    RguHarqStatusInd *harqStaInd = NULL;
1223
1224    TRC3(cmPkRguHqStaInd)
1225 #ifdef XEON_SPECIFIC_CHANGES
1226    if (SGetSBuf(pst->region, pst->pool, (Data **)&harqStaInd, sizeof(RguHarqStatusInd)) != ROK)
1227 #else      
1228    if ((SGetStaticBuffer(pst->region, pst->pool, 
1229                (Data **)&harqStaInd, sizeof(RguHarqStatusInd),0)) != ROK)
1230 #endif      
1231    {
1232 #if (ERRCLASS & ERRCLS_ADD_RES)      
1233       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1234             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1235             (ErrVal)ERGU070, (ErrVal)0, "Packing failed");
1236 #endif      
1237       RETVALUE(RFAILED);
1238    }
1239
1240    cmMemcpy((U8 *)harqStaInd, (U8 *)harqStatusInd, sizeof(RguHarqStatusInd));
1241
1242    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
1243 #if (ERRCLASS & ERRCLS_ADD_RES)      
1244       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1245             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1246             (ErrVal)ERGU070, (ErrVal)0, "Packing failed");
1247 #endif
1248 #ifdef XEON_SPECIFIC_CHANGES
1249       SPutSBuf(pst->region, pst->pool, (Data *)harqStaInd, sizeof(RguHarqStatusInd));
1250 #else      
1251       SPutStaticBuffer(pst->region, pst->pool, (Data *)harqStaInd, sizeof(RguHarqStatusInd), 0);
1252 #endif      
1253       RETVALUE(RFAILED);
1254    }
1255
1256    if (pst->selector == RGU_SEL_LWLC)
1257    {
1258       CMCHKPK(cmPkPtr,(PTR) harqStaInd, mBuf); 
1259    }
1260    else
1261    {
1262       for(idx = 0; idx < harqStaInd->numTbs; idx++)
1263       {
1264          CMCHKPK(SPkU16, harqStaInd->status[idx], mBuf);
1265       }
1266       for(idx = 0; idx < harqStaInd->numTbs; idx++)
1267       {
1268          CMCHKPK(SPkU32, harqStaInd->tbId[idx], mBuf);
1269       }
1270       CMCHKPK(SPkU8, harqStaInd->numTbs, mBuf);
1271       CMCHKPK(cmPkLteRnti, harqStaInd->ueId, mBuf);
1272       CMCHKPK(cmPkLteCellId, harqStaInd->cellId, mBuf);
1273    }
1274    if (SPkS16(suId, mBuf) != ROK) {
1275 #if (ERRCLASS & ERRCLS_ADD_RES)      
1276       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1277           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1278           (ErrVal)ERGU071, (ErrVal)0, "Packing failed");
1279 #endif
1280 #ifdef XEON_SPECIFIC_CHANGES
1281       SPutSBuf(pst->region, pst->pool, (Data *)harqStaInd,
1282               sizeof(RguHarqStatusInd));
1283 #else      
1284       SPutStaticBuffer(pst->region, pst->pool, (Data *)harqStaInd, sizeof(RguHarqStatusInd), 0);
1285 #endif      
1286       SPutMsg(mBuf);
1287       RETVALUE(RFAILED);
1288    }
1289 #ifdef XEON_SPECIFIC_CHANGES
1290    if (SPutSBuf(pst->region, pst->pool, (Data *)harqStaInd,
1291             sizeof(RguHarqStatusInd)) != ROK) {
1292 #else   
1293    if (pst->selector != RGU_SEL_LWLC)
1294    {
1295       if(SPutStaticBuffer(pst->region, pst->pool, (Data *)harqStaInd, 
1296                sizeof(RguHarqStatusInd), 0) != ROK)
1297       {
1298 #endif         
1299 #if (ERRCLASS & ERRCLS_ADD_RES)      
1300          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1301                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1302                (ErrVal)ERGU072, (ErrVal)0, "Packing failed");
1303 #endif      
1304          SPutMsg(mBuf);
1305          RETVALUE(RFAILED);
1306       }
1307 #ifndef XEON_SPECIFIC_CHANGES      
1308    }
1309 #endif   
1310
1311    pst->event = (Event) EVTRGUHQSTAIND;
1312    RETVALUE(SPstTsk(pst,mBuf));
1313 }
1314 \f
1315
1316 /**
1317 * @brief Harq Status Indication from MAC to RLC  
1318 *
1319 * @details
1320 *
1321 *     Function : cmUnpkRguHqStaInd
1322 *
1323 *  @param[in]  RguHqStaInd   func
1324 *  @param[in]  Pst           *pst
1325 *  @param[in]  Buffer        *mBuf
1326 *  @return   S16
1327 *      -# ROK
1328 **/
1329 #ifdef ANSI
1330 PUBLIC S16 cmUnpkRguHqStaInd
1331 (
1332 RguHqStaInd  func,
1333 Pst *pst,
1334 Buffer *mBuf
1335 )
1336 #else
1337 PUBLIC S16 cmUnpkRguHqStaInd(func, pst, mBuf)
1338 RguHqStaInd   func;
1339 Pst *pst;
1340 Buffer *mBuf;
1341 #endif
1342 {
1343    RguHarqStatusInd    *hqStaInd;  
1344    SuId                suId;
1345    U8                  idx;
1346
1347    TRC3(cmUnpkRguHqStaInd)
1348
1349    if (SUnpkS16(&suId, mBuf) != ROK) {
1350 #if (ERRCLASS & ERRCLS_ADD_RES)      
1351       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1352           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1353           (ErrVal)ERGU073, (ErrVal)0, "UnPacking failed");
1354 #endif      
1355       SPutMsg(mBuf);
1356       RETVALUE(RFAILED);
1357    }
1358 #ifdef XEON_SPECIFIC_CHANGES
1359    if ((SGetSBuf(pst->region, pst->pool, (Data **)&hqStaInd, 
1360         sizeof(RguHarqStatusInd))) != ROK) {
1361 #else   
1362    if (pst->selector == RGU_SEL_LWLC)
1363    {
1364       CMCHKUNPK(cmUnpkPtr,(PTR *) &hqStaInd, mBuf);
1365    }  
1366    else
1367    {   
1368       if ((SGetStaticBuffer(pst->region, pst->pool, 
1369                   (Data **)&hqStaInd, sizeof(RguHarqStatusInd),0)) != ROK)
1370       {
1371 #endif         
1372 #if (ERRCLASS & ERRCLS_ADD_RES)      
1373          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1374                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1375                (ErrVal)ERGU074, (ErrVal)0, "UnPacking failed");
1376 #endif      
1377          SPutMsg(mBuf);
1378          RETVALUE(RFAILED);
1379       }
1380       CMCHKUNPK(cmUnpkLteCellId, &hqStaInd->cellId, mBuf);
1381       CMCHKUNPK(cmUnpkLteRnti, &hqStaInd->ueId, mBuf);
1382       CMCHKUNPK(SUnpkU8, &hqStaInd->numTbs, mBuf);
1383       for(idx = hqStaInd->numTbs; idx > 0; idx--)
1384       {
1385          CMCHKUNPK(SUnpkU32, &hqStaInd->tbId[idx - 1], mBuf);
1386       }
1387       for(idx = hqStaInd->numTbs; idx > 0; idx--)
1388       {
1389          CMCHKUNPK(SUnpkU16, &hqStaInd->status[idx - 1], mBuf);
1390       }
1391 #ifndef XEON_SPECIFIC_CHANGES      
1392    }
1393 #endif   
1394    SPutMsg(mBuf);
1395    (*func)(pst, suId, hqStaInd);
1396 #ifdef XEON_SPECIFIC_CHANGES
1397    SPutSBuf(pst->region, pst->pool, (Data *)hqStaInd, sizeof(RguHarqStatusInd));
1398 #else   
1399    SPutStaticBuffer(pst->region, pst->pool, (Data *)hqStaInd, sizeof(RguHarqStatusInd), 0);
1400 #endif   
1401    RETVALUE(ROK);
1402 }
1403 #endif /* LTE_L2_MEAS */
1404
1405 \f
1406 /**
1407 * @brief Status Indication from MAC to RLC  
1408  * as a response to the staRsp primitive from RLC.
1409  * Informs RLC of the totalBufferSize and Timing Info 
1410  * for the transmission on dedicated channels.
1411 *
1412 * @details
1413 *
1414 *     Function : packSchedRep
1415 *
1416 *  @param[in]   Pst*  pst
1417 *  @param[in]   SuId  suId
1418 *  @param[in]   RlcMacSchedRep*  schRep
1419 *  @return   S16
1420 *      -# ROK
1421 **/
1422 #ifdef ANSI
1423 PUBLIC S16 packSchedRep
1424 (
1425 Pst* pst,
1426 SuId suId,
1427 RlcMacSchedRep  * schRep
1428 )
1429 #else
1430 PUBLIC S16 packSchedRep(pst, suId, staInd)
1431 Pst* pst;
1432 SuId suId;
1433 RlcMacSchedRep  * schRep;
1434 #endif
1435 {
1436    Buffer *mBuf = NULLP;
1437    TRC3(packSchedRep)
1438
1439    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
1440 #if (ERRCLASS & ERRCLS_ADD_RES)      
1441       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1442           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1443           (ErrVal)ERGU076, (ErrVal)0, "Packing failed");
1444 #endif      
1445       SPutSBuf(pst->region, pst->pool, (Data *)schRep, sizeof(RlcMacSchedRep));
1446       RETVALUE(RFAILED);
1447    }
1448    if (pst->selector == RGU_SEL_LWLC)
1449    {
1450       CMCHKPK(cmPkPtr,(PTR) schRep, mBuf);
1451    }
1452    else
1453    {
1454       if (packSchedRepInfo(schRep, mBuf) != ROK) {
1455 #if (ERRCLASS & ERRCLS_ADD_RES)      
1456            SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1457                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1458                (ErrVal)ERGU077, (ErrVal)0, "Packing failed");
1459 #endif      
1460         SPutSBuf(pst->region, pst->pool, (Data *)schRep, 
1461                                          sizeof(RlcMacSchedRep));
1462          SPutMsg(mBuf);
1463          RETVALUE(RFAILED);
1464       } 
1465       if (SPutSBuf(pst->region, pst->pool, (Data *)schRep,
1466                                   sizeof(RlcMacSchedRep)) != ROK) {
1467 #if (ERRCLASS & ERRCLS_ADD_RES)      
1468          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1469              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1470              (ErrVal)ERGU079, (ErrVal)0, "Packing failed");
1471 #endif      
1472          SPutMsg(mBuf);
1473          RETVALUE(RFAILED);
1474       }
1475       schRep= NULLP;
1476    }
1477    if (SPkS16(suId, mBuf) != ROK) {
1478 #if (ERRCLASS & ERRCLS_ADD_RES)      
1479       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1480           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1481           (ErrVal)ERGU078, (ErrVal)0, "Packing failed");
1482 #endif      
1483       if (schRep != NULLP)
1484       {
1485          SPutSBuf(pst->region, pst->pool, (Data *)schRep, sizeof(RlcMacSchedRep));
1486       }
1487       SPutMsg(mBuf);
1488       RETVALUE(RFAILED);
1489    }
1490
1491    pst->event = (Event) EVTSCHREP;
1492    RETVALUE(SPstTsk(pst,mBuf));
1493 }
1494
1495 \f
1496 /**
1497 * @brief Status Indication from MAC to RLC  
1498  * as a response to the staRsp primitive from RLC.
1499  * Informs RLC of the totalBufferSize and Timing Info 
1500  * for the transmission on dedicated channels.
1501 *
1502 * @details
1503 *
1504 *     Function : unpackSchedRep
1505 *
1506 *  @param[in]   Pst*  pst
1507 *  @param[in]   SuId  suId
1508 *  @param[in]   RguDStaIndInfo  *  staInd
1509 *  @return   S16
1510 *      -# ROK
1511 **/
1512 #ifdef ANSI
1513 PUBLIC S16 unpackSchedRep
1514 (
1515 RguDStaInd func,
1516 Pst *pst,
1517 Buffer *mBuf
1518 )
1519 #else
1520 PUBLIC S16 unpackSchedRep(func, pst, mBuf)
1521 RguDStaInd func;
1522 Pst *pst;
1523 Buffer *mBuf;
1524 #endif
1525 {
1526    SuId suId;
1527 //   RguDStaIndInfo *staInd;
1528    RlcMacSchedRep *schRep;
1529    
1530    TRC3(unpackSchedRep)
1531
1532    if (SUnpkS16(&suId, mBuf) != ROK) {
1533 #if (ERRCLASS & ERRCLS_ADD_RES)      
1534       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1535           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1536           (ErrVal)ERGU080, (ErrVal)0, "UnPacking failed");
1537 #endif      
1538       SPutMsg(mBuf);
1539       RETVALUE(RFAILED);
1540    }
1541    if (pst->selector == RGU_SEL_LWLC)
1542    {
1543       CMCHKUNPK(cmUnpkPtr,(PTR *) &schRep, mBuf);
1544    }
1545    else 
1546    {
1547       if ((SGetSBuf(pst->region, pst->pool, (Data **)&schRep, sizeof(RlcMacSchedRep))) != ROK) {
1548 #if (ERRCLASS & ERRCLS_ADD_RES)      
1549          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1550          __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1551          (ErrVal)ERGU081, (ErrVal)0, "UnPacking failed");
1552 #endif      
1553          SPutMsg(mBuf);
1554          RETVALUE(RFAILED);
1555       }
1556       if (unpackSchedRepInfo(schRep, mBuf) != ROK) {
1557 #if (ERRCLASS & ERRCLS_ADD_RES)      
1558          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1559              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1560              (ErrVal)ERGU082, (ErrVal)0, "UnPacking failed");
1561 #endif      
1562          SPutMsg(mBuf);
1563          SPutSBuf(pst->region, pst->pool, (Data *)schRep, sizeof(RlcMacSchedRep));
1564          RETVALUE(RFAILED);
1565       }
1566    }
1567    SPutMsg(mBuf);
1568    RETVALUE((*func)(pst, suId, schRep));
1569 }
1570
1571 #ifdef ANSI
1572 PUBLIC S16 cmPkRguLcFlowCntrlInfo
1573 (
1574 RguLcFlowCntrlInfo *param,
1575 Buffer             *mBuf
1576 )
1577 #else
1578 PUBLIC S16 cmPkRguLcFlowCntrlInfo (param,mBuf)
1579 RguLcFlowCntrlInfo *param;
1580 Buffer             *mBuf;
1581 #endif
1582 {
1583   TRC3(cmPkRguLcFlowCntrlInfo);
1584   CMCHKPK(SPkU32, param->maxBo4FlowCtrl, mBuf);
1585   CMCHKPK(SPkU32, param->pktAdmitCnt, mBuf);
1586   CMCHKPK(cmPkLteLcId, param->lcId, mBuf);
1587
1588   RETVALUE(ROK);
1589 }
1590
1591 #ifdef ANSI
1592 PUBLIC S16 cmPkRguUeFlowCntrlInfo
1593 (
1594 RguUeFlowCntrlInfo *param,
1595 Buffer             *mBuf
1596 )
1597 #else
1598 PUBLIC S16 cmPkRguUeFlowCntrlInfo (param,mBuf)
1599 RguUeFlowCntrlInfo *param;
1600 Buffer             *mBuf;
1601 #endif
1602 {
1603   U32 idx;
1604
1605   TRC3(cmPkRguUeFlowCntrlInfo);
1606
1607   for(idx=(param->numLcs - 1); idx >= 0; idx--)
1608   {
1609     cmPkRguLcFlowCntrlInfo(&param->lcInfo[idx],mBuf);
1610   }
1611   CMCHKPK(SPkU32, param->numLcs, mBuf);
1612   CMCHKPK(cmPkLteRnti, param->ueId, mBuf);
1613   RETVALUE(ROK);
1614 }
1615
1616 #ifdef ANSI
1617 PUBLIC S16 cmPkRguFlowCntrlInfo
1618 (
1619 RguFlowCntrlInd *param, 
1620 Buffer          *mBuf
1621 )
1622 #else
1623 PUBLIC S16 cmPkRguFlowCntrlInfo(flowCntrlInd, mBuf)
1624 RguFlowCntrlInd *param;
1625 Buffer          *mBuf;
1626 #endif
1627 {
1628   U32 idx;
1629
1630   TRC3(cmPkRguFlowCntrlInfo);
1631
1632   for (idx=(param->numUes - 1); idx >= 0; idx--)
1633   {
1634     cmPkRguUeFlowCntrlInfo(&param->ueFlowCntrlInfo[idx],mBuf);
1635   }
1636   CMCHKPK(SPkU32, param->numUes, mBuf);
1637   CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
1638   RETVALUE(ROK);
1639 }
1640 \f
1641 /**
1642 * @brief Flow Cntrl Indication from MAC to RLC  
1643  * Informs RLC of the LCs on which flow control
1644  * to be performed.
1645 *
1646 * @details
1647 *
1648 *     Function : cmPkRguFlowCntrlInd
1649 *
1650 *  @param[in]   Pst*  pst
1651 *  @param[in]   SuId  suId
1652 *  @param[in]   RguFlowCntrlInd *staInd
1653 *  @return   S16
1654 *      -# ROK
1655 **/
1656 #ifdef ANSI
1657 PUBLIC S16 cmPkRguFlowCntrlInd
1658 (
1659 Pst* pst,
1660 SuId suId,
1661 RguFlowCntrlInd  *flowCntrlInd
1662 )
1663 #else
1664 PUBLIC S16 cmPkRguFlowCntrlInd(pst, suId, flowCntrlInd)
1665 Pst* pst;
1666 SuId suId;
1667 RguFlowCntrlInd   *flowCntrlInd;
1668 #endif
1669 {
1670    Buffer *mBuf = NULLP;
1671
1672    TRC3(cmPkRguFlowCntrlInd);
1673    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
1674 #if (ERRCLASS & ERRCLS_ADD_RES)      
1675       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1676           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1677           (ErrVal)ERGU076, (ErrVal)0, "Packing failed");
1678 #endif      
1679       RETVALUE(RFAILED);
1680    }
1681    if (pst->selector == RGU_SEL_LWLC)
1682    {
1683       CMCHKPK(cmPkPtr,(PTR) flowCntrlInd, mBuf);
1684    }
1685    else
1686    {
1687       if (cmPkRguFlowCntrlInfo(flowCntrlInd, mBuf) != ROK) {
1688 #if (ERRCLASS & ERRCLS_ADD_RES)      
1689            SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1690                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1691                (ErrVal)ERGU077, (ErrVal)0, "Packing failed");
1692 #endif      
1693          SPutMsg(mBuf);
1694          RETVALUE(RFAILED);
1695       } 
1696    }
1697    if (SPkS16(suId, mBuf) != ROK) {
1698 #if (ERRCLASS & ERRCLS_ADD_RES)      
1699       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1700           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1701           (ErrVal)ERGU078, (ErrVal)0, "Packing failed");
1702 #endif      
1703       SPutMsg(mBuf);
1704       RETVALUE(RFAILED);
1705    }
1706    
1707    pst->event = (Event) EVTRGUFLOWCNTRLIND;
1708    RETVALUE(SPstTsk(pst,mBuf));
1709 }
1710
1711 #ifdef ANSI
1712 PUBLIC S16 cmUnpkRguLcFlowCntrlInfo
1713 (
1714 RguLcFlowCntrlInfo *param,
1715 Buffer           *mBuf
1716 )
1717 #else
1718 PUBLIC S16 cmUnpkRguLcFlowCntrlInfo (param,mBuf)
1719 RguLcFlowCntrlInfo *param;
1720 Buffer           *mBuf;
1721 #endif
1722 {
1723   TRC3(cmUnpkRguLcFlowCntrlInfo);
1724
1725   CMCHKUNPK(cmUnpkLteLcId, &param->lcId, mBuf);
1726   CMCHKUNPK(SUnpkU32, &param->pktAdmitCnt, mBuf);
1727   CMCHKUNPK(SUnpkU32, &param->maxBo4FlowCtrl, mBuf);
1728   
1729   RETVALUE(ROK);
1730 }
1731 #ifdef ANSI
1732 PUBLIC S16 cmUnpkRguUeFlowCntrlInfo
1733 (
1734 RguUeFlowCntrlInfo *param,
1735 Buffer           *mBuf
1736 )
1737 #else
1738 PUBLIC S16 cmUnpkRguUeFlowCntrlInfo (param,mBuf)
1739 RguUeFlowCntrlInfo *param;
1740 Buffer           *mBuf;
1741 #endif
1742 {
1743   U32 idx;
1744   TRC3(cmUnpkRguUeFlowCntrlInfo);
1745   CMCHKUNPK(cmUnpkLteRnti, &param->ueId, mBuf);
1746   CMCHKUNPK(SUnpkU32, &param->numLcs, mBuf);
1747   for(idx=0; idx < param->numLcs; idx++)
1748   {
1749     cmUnpkRguLcFlowCntrlInfo(&param->lcInfo[idx],mBuf);
1750   }
1751   RETVALUE(ROK);
1752 }
1753
1754 #ifdef ANSI
1755 PUBLIC S16 cmUnpkRguFlowCntrlInfo
1756 (
1757 RguFlowCntrlInd *param, 
1758 Buffer           *mBuf
1759 )
1760 #else
1761 PUBLIC S16 cmUnpkRguFlowCntrlInfo(flowCntrlInfo, mBuf)
1762 RguFlowCntrlInd *param;
1763 Buffer           *mBuf;
1764 #endif
1765 {
1766   U32 idx; 
1767   
1768   TRC3(cmUnpkRguFlowCntrlInfo);
1769
1770   CMCHKUNPK(cmUnpkLteCellId, &param->cellId, mBuf);
1771   CMCHKUNPK(SUnpkU32, &param->numUes, mBuf);
1772   for (idx=0; idx < param->numUes; idx++)
1773   {
1774     cmUnpkRguUeFlowCntrlInfo(&param->ueFlowCntrlInfo[idx],mBuf);
1775   }
1776   RETVALUE(ROK);
1777 }
1778
1779 /**
1780 * @brief Flow control indication from MAC to RLC  
1781 * Informs RLC of the LCs on which flow control to  
1782 * be started
1783 *
1784 * @details
1785 *
1786 *     Function : cmUnpkRguFlowCntrlInd
1787 *
1788 *  @param[in]   RguFlowCntrlInd func
1789 *  @param[in]   Pst    *pst
1790 *  @param[in]   Buffer *mBuf
1791 *  @return   S16
1792 *      -# ROK
1793 **/
1794 #ifdef ANSI
1795 PUBLIC S16 cmUnpkRguFlowCntrlInd
1796 (
1797 RguFlowCntrlIndInfo func,
1798 Pst *pst,
1799 Buffer *mBuf
1800 )
1801 #else
1802 PUBLIC S16 cmUnpkRguFlowCntrlInd(func, pst, mBuf)
1803 RguFlowCntrlIndInfo func;
1804 Pst *pst;
1805 Buffer *mBuf;
1806 #endif
1807 {
1808    SuId suId;
1809    RguFlowCntrlInd *flowCntrlInd;
1810    
1811    TRC3(cmUnpkRguFlowCntrlInd)
1812
1813    if (SUnpkS16(&suId, mBuf) != ROK) {
1814 #if (ERRCLASS & ERRCLS_ADD_RES)      
1815       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1816           __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1817           (ErrVal)ERGU080, (ErrVal)0, "UnPacking failed");
1818 #endif      
1819       SPutMsg(mBuf);
1820       RETVALUE(RFAILED);
1821    }
1822    if (pst->selector == RGU_SEL_LWLC)
1823    {
1824       CMCHKUNPK(cmUnpkPtr,(PTR *) &flowCntrlInd, mBuf);
1825    }
1826    else 
1827    {
1828       if ((SGetSBuf(pst->region, pst->pool, (Data **)&flowCntrlInd, sizeof(RguFlowCntrlInd))) != ROK) {
1829 #if (ERRCLASS & ERRCLS_ADD_RES)      
1830          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1831          __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1832          (ErrVal)ERGU081, (ErrVal)0, "UnPacking failed");
1833 #endif      
1834          SPutMsg(mBuf);
1835          RETVALUE(RFAILED);
1836       }
1837       if (cmUnpkRguFlowCntrlInfo(flowCntrlInd, mBuf) != ROK) {
1838 #if (ERRCLASS & ERRCLS_ADD_RES)      
1839          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1840              __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1841              (ErrVal)ERGU082, (ErrVal)0, "UnPacking failed");
1842 #endif      
1843          SPutMsg(mBuf);
1844          SPutSBuf(pst->region, pst->pool, (Data *)flowCntrlInd, sizeof(RguFlowCntrlInd));
1845          RETVALUE(RFAILED);
1846       }
1847    }
1848    SPutMsg(mBuf);
1849    RETVALUE((*func)(pst, suId, flowCntrlInd));
1850 }
1851
1852 /***********************************************************
1853 *
1854 *     Func : cmPkRguPduInfo
1855 *
1856 *
1857 *     Desc : RguPduInfo
1858  * PDU information given on a logical channel
1859 *
1860 *
1861 *     Ret  : S16
1862 *
1863 *     Notes:
1864 *
1865 *     File  : 
1866 *
1867 **********************************************************/
1868 #ifdef ANSI
1869 PUBLIC S16 cmPkRguPduInfo
1870 (
1871 RguPduInfo *param,
1872 Buffer *mBuf
1873 )
1874 #else
1875 PUBLIC S16 cmPkRguPduInfo(param, mBuf)
1876 RguPduInfo *param;
1877 Buffer *mBuf;
1878 #endif
1879 {
1880    S32 i;
1881
1882    TRC3(cmPkRguPduInfo);
1883
1884    for (i=param->numPdu-1; i >= 0; i--) {
1885      /* rgu_c_001.main_3: ccpu00111328: S16 is renamed as MsgLen */
1886       MsgLen msgLen = 0;
1887       if (SFndLenMsg(param->mBuf[i], &msgLen) != ROK)
1888          RETVALUE(RFAILED);
1889       if (SCatMsg(mBuf, param->mBuf[i], M1M2) != ROK)
1890          RETVALUE(RFAILED);
1891       SPutMsg(param->mBuf[i]);
1892       CMCHKPK(cmPkMsgLen, msgLen, mBuf);
1893    }
1894    CMCHKPK(SPkU8, param->numPdu, mBuf);
1895    RETVALUE(ROK);
1896 }
1897
1898
1899 \f
1900 /***********************************************************
1901 *
1902 *     Func : cmUnpkRguPduInfo
1903 *
1904 *
1905 *     Desc : RguPduInfo
1906  * PDU information given on a logical channel
1907 *
1908 *
1909 *     Ret  : S16
1910 *
1911 *     Notes:
1912 *
1913 *     File  : 
1914 *
1915 **********************************************************/
1916 #ifdef ANSI
1917 PUBLIC S16 cmUnpkRguPduInfo
1918 (
1919 RguPduInfo *param,
1920 Buffer *mBuf
1921 )
1922 #else
1923 PUBLIC S16 cmUnpkRguPduInfo(param, mBuf)
1924 RguPduInfo *param;
1925 Buffer *mBuf;
1926 #endif
1927 {
1928    S32 i;
1929
1930    TRC3(cmUnpkRguPduInfo);
1931
1932    CMCHKUNPK(SUnpkU8, &param->numPdu, mBuf);
1933    for (i=0; i<param->numPdu; i++) {
1934       MsgLen msgLen, totalMsgLen;
1935       CMCHKUNPK(cmUnpkMsgLen, &msgLen, mBuf);
1936       if (SFndLenMsg(mBuf, &totalMsgLen) != ROK)
1937          RETVALUE(RFAILED);
1938       if (SSegMsg(mBuf, totalMsgLen-msgLen, &param->mBuf[i]) != ROK)
1939          RETVALUE(RFAILED);
1940    }
1941    RETVALUE(ROK);
1942 }
1943
1944
1945 \f
1946 /***********************************************************
1947 *
1948 *     Func : cmPkRguDBoReport
1949 *
1950 *
1951 *     Desc : RguDBoReport
1952  * Buffer Occupancy Report for dedicated logical channel
1953 *
1954 *
1955 *     Ret  : S16
1956 *
1957 *     Notes:
1958 *
1959 *     File  : 
1960 *
1961 **********************************************************/
1962 #ifdef ANSI
1963 PUBLIC S16 cmPkRguDBoReport
1964 (
1965 RguDBoReport *param,
1966 Buffer *mBuf
1967 )
1968 #else
1969 PUBLIC S16 cmPkRguDBoReport(param, mBuf)
1970 RguDBoReport *param;
1971 Buffer *mBuf;
1972 #endif
1973 {
1974
1975    TRC3(cmPkRguDBoReport);
1976
1977    CMCHKPK(SPkU32, param->oldestSduArrTime, mBuf);
1978    CMCHKPK(SPkU32, param->staPduBo, mBuf);
1979 #ifdef CCPU_OPT
1980    CMCHKPK(SPkU8, param->staPduPrsnt, mBuf);
1981    CMCHKPK(SPkU16, param->estRlcHdrSz, mBuf);
1982 #endif
1983    CMCHKPK(SPkS32, param->bo, mBuf);
1984    RETVALUE(ROK);
1985 }
1986
1987
1988 \f
1989 /***********************************************************
1990 *
1991 *     Func : cmUnpkRguDBoReport
1992 *
1993 *
1994 *     Desc : RguDBoReport
1995  * Buffer Occupancy Report for dedicated logical channel
1996 *
1997 *
1998 *     Ret  : S16
1999 *
2000 *     Notes:
2001 *
2002 *     File  : 
2003 *
2004 **********************************************************/
2005 #ifdef ANSI
2006 PUBLIC S16 cmUnpkRguDBoReport
2007 (
2008 RguDBoReport *param,
2009 Buffer *mBuf
2010 )
2011 #else
2012 PUBLIC S16 cmUnpkRguDBoReport(param, mBuf)
2013 RguDBoReport *param;
2014 Buffer *mBuf;
2015 #endif
2016 {
2017
2018    TRC3(cmUnpkRguDBoReport);
2019
2020    CMCHKUNPK(SUnpkS32, &param->bo, mBuf);
2021 #ifdef CCPU_OPT
2022    CMCHKUNPK(SUnpkU16, &param->estRlcHdrSz, mBuf);
2023    CMCHKUNPK(SUnpkU8, &param->staPduPrsnt, mBuf);
2024 #endif
2025    
2026    CMCHKUNPK(SUnpkU32, &param->staPduBo, mBuf);
2027    CMCHKUNPK(SUnpkU32, &param->oldestSduArrTime, mBuf);
2028    RETVALUE(ROK);
2029 }
2030
2031 \f
2032 /***********************************************************
2033 *
2034 *     Func : cmPkRguCDatReqInfo
2035 *
2036 *
2037 *     Desc : RguCDatReqInfo
2038  * DatReq from RLC to MAC for Common Channels(BCCH, PCCH and CCCH)
2039 *
2040 *
2041 *     Ret  : S16
2042 *
2043 *     Notes:
2044 *
2045 *     File  : 
2046 *
2047 **********************************************************/
2048 #ifdef ANSI
2049 PUBLIC S16 cmPkRguCDatReqInfo
2050 (
2051 RguCDatReqInfo *param,
2052 Buffer *mBuf
2053 )
2054 #else
2055 PUBLIC S16 cmPkRguCDatReqInfo(param, mBuf)
2056 RguCDatReqInfo *param;
2057 Buffer *mBuf;
2058 #endif
2059 {
2060    MsgLen msgLen;
2061
2062    TRC3(cmPkRguCDatReqInfo);
2063
2064    if (param->pdu != NULLP)
2065    {
2066       if (SFndLenMsg(param->pdu, &msgLen) != ROK)
2067          RETVALUE(RFAILED);
2068       if (SCatMsg(mBuf, param->pdu, M1M2) != ROK)
2069          RETVALUE(RFAILED);
2070       SPutMsg(param->pdu);
2071       CMCHKPK(cmPkMsgLen, msgLen, mBuf);
2072    }
2073    switch(param->lcType) {
2074       case CM_LTE_LCH_CCCH:
2075          CMCHKPK(cmPkLteRnti, param->u.rnti, mBuf);
2076          break;
2077       case CM_LTE_LCH_BCCH:
2078       case CM_LTE_LCH_PCCH:
2079          CMCHKPK(cmPkLteTimingInfo, &param->u.timeToTx, mBuf);
2080 #ifdef EMTC_ENABLE
2081         CMCHKPK(SPkU8,param->pnb,mBuf);
2082 #endif
2083          break;
2084       default :
2085          RETVALUE(RFAILED);
2086    }
2087    CMCHKPK(SPkU32, param->transId, mBuf);
2088    CMCHKPK(cmPkLteLcType, param->lcType, mBuf);
2089    CMCHKPK(cmPkLteLcId, param->lcId, mBuf);
2090    CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
2091    RETVALUE(ROK);
2092 }
2093
2094
2095 \f
2096 /***********************************************************
2097 *
2098 *     Func : cmUnpkRguCDatReqInfo
2099 *
2100 *
2101 *     Desc : RguCDatReqInfo
2102  * DatReq from RLC to MAC for Common Channels(BCCH, PCCH and CCCH)
2103 *
2104 *
2105 *     Ret  : S16
2106 *
2107 *     Notes:
2108 *
2109 *     File  : 
2110 *
2111 **********************************************************/
2112 #ifdef ANSI
2113 PUBLIC S16 cmUnpkRguCDatReqInfo
2114 (
2115 RguCDatReqInfo *param,
2116 Buffer *mBuf
2117 )
2118 #else
2119 PUBLIC S16 cmUnpkRguCDatReqInfo(param, mBuf)
2120 RguCDatReqInfo *param;
2121 Buffer *mBuf;
2122 #endif
2123 {
2124    MsgLen msgLen, totalMsgLen;
2125
2126    TRC3(cmUnpkRguCDatReqInfo);
2127
2128    CMCHKUNPK(cmUnpkLteCellId, &param->cellId, mBuf);
2129    CMCHKUNPK(cmUnpkLteLcId, &param->lcId, mBuf);
2130    CMCHKUNPK(cmUnpkLteLcType, &param->lcType, mBuf);
2131    CMCHKUNPK(SUnpkU32, &param->transId, mBuf);
2132    switch(param->lcType) {
2133       case CM_LTE_LCH_BCCH:
2134       case CM_LTE_LCH_PCCH:
2135 #ifdef EMTC_ENABLE
2136          CMCHKUNPK(SUnpkU8,&param->pnb, mBuf);
2137 #endif
2138          CMCHKUNPK(cmUnpkLteTimingInfo, &param->u.timeToTx, mBuf);
2139          break;
2140       case CM_LTE_LCH_CCCH:
2141          CMCHKUNPK(cmUnpkLteRnti, &param->u.rnti, mBuf);
2142          break;
2143       default :
2144          RETVALUE(RFAILED);
2145    }
2146    SFndLenMsg(mBuf, &msgLen);
2147    if (msgLen > 0)
2148    {
2149       CMCHKUNPK(cmUnpkMsgLen, &msgLen, mBuf);
2150       if (SFndLenMsg(mBuf, &totalMsgLen) != ROK)
2151          RETVALUE(RFAILED);
2152       if (SSegMsg(mBuf, totalMsgLen-msgLen, &param->pdu) != ROK)
2153          RETVALUE(RFAILED);
2154    }
2155    RETVALUE(ROK);
2156 }
2157
2158
2159 \f
2160 /***********************************************************
2161 *
2162 *     Func : cmPkRguLchDatReq
2163 *
2164 *
2165 *     Desc : RguLchDatReq
2166  * DatReq Information of a logical channel
2167 *
2168 *
2169 *     Ret  : S16
2170 *
2171 *     Notes:
2172 *
2173 *     File  : 
2174 *
2175 **********************************************************/
2176 #ifdef ANSI
2177 PUBLIC S16 cmPkRguLchDatReq
2178 (
2179 RguLchDatReq *param,
2180 Buffer *mBuf
2181 )
2182 #else
2183 PUBLIC S16 cmPkRguLchDatReq(param, mBuf)
2184 RguLchDatReq *param;
2185 Buffer *mBuf;
2186 #endif
2187 {
2188
2189    TRC3(cmPkRguLchDatReq);
2190
2191 #ifdef L2_OPTMZ
2192    CMCHKPK(SPkU8, param->freeBuff, mBuf);
2193 #endif
2194    CMCHKPK(SPkU8, param->setMaxUlPrio, mBuf);
2195    CMCHKPK(cmPkRguPduInfo, &param->pdu, mBuf);
2196    CMCHKPK(cmPkRguDBoReport, &param->boReport, mBuf);
2197    CMCHKPK(cmPkLteLcId, param->lcId, mBuf);
2198    RETVALUE(ROK);
2199 }
2200
2201
2202 \f
2203 /***********************************************************
2204 *
2205 *     Func : cmUnpkRguLchDatReq
2206 *
2207 *
2208 *     Desc : RguLchDatReq
2209  * DatReq Information of a logical channel
2210 *
2211 *
2212 *     Ret  : S16
2213 *
2214 *     Notes:
2215 *
2216 *     File  : 
2217 *
2218 **********************************************************/
2219 #ifdef ANSI
2220 PUBLIC S16 cmUnpkRguLchDatReq
2221 (
2222 RguLchDatReq *param,
2223 Buffer *mBuf
2224 )
2225 #else
2226 PUBLIC S16 cmUnpkRguLchDatReq(param, mBuf)
2227 RguLchDatReq *param;
2228 Buffer *mBuf;
2229 #endif
2230 {
2231
2232    TRC3(cmUnpkRguLchDatReq);
2233
2234    CMCHKUNPK(cmUnpkLteLcId, &param->lcId, mBuf);
2235    CMCHKUNPK(cmUnpkRguDBoReport, &param->boReport, mBuf);
2236    CMCHKUNPK(cmUnpkRguPduInfo, &param->pdu, mBuf);
2237    CMCHKUNPK(SUnpkU8, &param->setMaxUlPrio, mBuf);
2238 #ifdef L2_OPTMZ
2239    CMCHKUNPK(SUnpkU8, &param->freeBuff, mBuf);
2240 #endif
2241    RETVALUE(ROK);
2242 }
2243
2244 \f
2245 /***********************************************************
2246 *
2247 *     Func : cmPkRguDatReqTb
2248 *
2249 *
2250 *     Desc : RguDatReqTb
2251 * DatReq from RLC to MAC for dedicated channels of a UE
2252 *
2253 *
2254 *     Ret  : S16
2255 *
2256 *     Notes:
2257 *
2258 *     File  : 
2259 *
2260 **********************************************************/
2261 #ifdef ANSI
2262 PUBLIC S16 cmPkRguDatReqTb
2263 (
2264 RguDatReqTb *param,
2265 Buffer *mBuf
2266 )
2267 #else
2268 PUBLIC S16 cmPkRguDatReqTb(param, mBuf)
2269 RguDatReqTb *param;
2270 Buffer *mBuf;
2271 #endif
2272 {
2273    S32 i;
2274
2275    TRC3(cmPkRguDatReqTb);
2276    /*rgu_c_001.main_5 - ADD - L2M Support */
2277 #ifdef LTE_L2_MEAS
2278    CMCHKPK(SPkU32, param->tbId, mBuf);
2279 #endif
2280    for (i=param->nmbLch-1; i >= 0; i--) {
2281       CMCHKPK(cmPkRguLchDatReq, &param->lchData[i], mBuf);
2282    }
2283    CMCHKPK(SPkU8, param->nmbLch, mBuf);
2284    RETVALUE(ROK);
2285 }
2286
2287
2288 \f
2289 /***********************************************************
2290 *
2291 *     Func : cmUnpkRguDatReqTb
2292 *
2293 *
2294 *     Desc : RguDatReqTb
2295  * DatReq from RLC to MAC for dedicated channels of a UE
2296 *
2297 *
2298 *     Ret  : S16
2299 *
2300 *     Notes:
2301 *
2302 *     File  : 
2303 *
2304 **********************************************************/
2305 #ifdef LTE_L2_MEAS
2306 #ifdef ANSI
2307 PUBLIC S16 cmUnpkRguDatReqTb
2308 (
2309 Pst         *pst, 
2310 RguDatReqTb *param,
2311 Buffer *mBuf
2312 )
2313 #else
2314 PUBLIC S16 cmUnpkRguDatReqTb(pst, param, mBuf)
2315 Pst         *pst;   
2316 RguDatReqTb *param;
2317 Buffer *mBuf;
2318 #endif
2319 #else
2320 #ifdef ANSI
2321 PUBLIC S16 cmUnpkRguDatReqTb
2322 (
2323 RguDatReqTb *param,
2324 Buffer *mBuf
2325 )
2326 #else
2327 PUBLIC S16 cmUnpkRguDatReqTb(param, mBuf)
2328 RguDatReqTb *param;
2329 Buffer *mBuf;
2330 #endif
2331 #endif
2332 {
2333    S32 i;
2334
2335    TRC3(cmUnpkRguDatReqTb);
2336
2337    CMCHKUNPK(SUnpkU8, &param->nmbLch, mBuf);
2338    for (i=0; i<param->nmbLch; i++) {
2339       CMCHKUNPK(cmUnpkRguLchDatReq, &param->lchData[i], mBuf);
2340    }
2341    /*rgu_c_001.main_5 - ADD - L2M Support */
2342 #ifdef LTE_L2_MEAS
2343    CMCHKUNPK(SUnpkU32, &param->tbId, mBuf);
2344 #endif
2345    RETVALUE(ROK);
2346 }
2347
2348 \f
2349 /***********************************************************
2350 *
2351 *     Func : cmPkRguDDatReqInfo
2352 *
2353 *
2354 *     Desc : RguDDatReqInfo
2355  * DatReq from RLC to MAC for dedicated channels of a UE
2356 *
2357 *
2358 *     Ret  : S16
2359 *
2360 *     Notes:
2361 *
2362 *     File  : 
2363 *
2364 **********************************************************/
2365    /*rgu_c_001.main_5 - ADD - L2M Support */
2366 #ifdef LTE_L2_MEAS
2367 #ifdef ANSI
2368 PUBLIC S16 cmPkRguDDatReqInfo
2369 (
2370 Pst            *pst,
2371 RguDDatReqInfo *param,
2372 Buffer *mBuf
2373 )
2374 #else
2375 PUBLIC S16 cmPkRguDDatReqInfo(pst, param, mBuf)
2376 Pst            *pst;
2377 RguDDatReqInfo *param;
2378 Buffer *mBuf;
2379 #endif
2380 #else
2381 #ifdef ANSI
2382 PUBLIC S16 cmPkRguDDatReqInfo
2383 (
2384 RguDDatReqInfo *param,
2385 Buffer *mBuf
2386 )
2387 #else
2388 PUBLIC S16 cmPkRguDDatReqInfo(param, mBuf)
2389 RguDDatReqInfo *param;
2390 Buffer *mBuf;
2391 #endif
2392 #endif
2393 {
2394    S32 i;
2395    S32 idx;
2396
2397    TRC3(cmPkRguDDatReqInfo);
2398
2399    for(idx = (param->nmbOfUeGrantPerTti-1); idx >= 0; idx--)
2400    {
2401       RguDDatReqPerUe *datReq = &param->datReq[idx];
2402       for (i=RGU_MAX_TB-1; i >= 0; i--) 
2403       {
2404          CMCHKPK(cmPkRguDatReqTb, &datReq->datReqTb[i], mBuf);
2405       }
2406       CMCHKPK(SPkU8, datReq->nmbOfTbs, mBuf);
2407       CMCHKPK(SPkU32, datReq->transId, mBuf);
2408       CMCHKPK(cmPkLteRnti, datReq->rnti, mBuf);
2409    }
2410    CMCHKPK(SPkU8, param->nmbOfUeGrantPerTti, mBuf);
2411    CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
2412    RETVALUE(ROK);
2413 }
2414
2415
2416 \f
2417 /***********************************************************
2418 *
2419 *     Func : cmUnpkRguDDatReqInfo
2420 *
2421 *
2422 *     Desc : RguDDatReqInfo
2423  * DatReq from RLC to MAC for dedicated channels of a UE
2424 *
2425 *
2426 *     Ret  : S16
2427 *
2428 *     Notes:
2429 *
2430 *     File  : 
2431 *
2432 **********************************************************/
2433 #ifdef LTE_L2_MEAS
2434 #ifdef ANSI
2435 PUBLIC S16 cmUnpkRguDDatReqInfo
2436 (
2437 Pst            *pst, 
2438 RguDDatReqInfo *param,
2439 Buffer *mBuf
2440 )
2441 #else
2442 PUBLIC S16 cmUnpkRguDDatReqInfo(pst, param, mBuf)
2443 Pst            *pst;
2444 RguDDatReqInfo *param;
2445 Buffer *mBuf;
2446 #endif
2447 #else
2448 #ifdef ANSI
2449 PUBLIC S16 cmUnpkRguDDatReqInfo
2450 (
2451 RguDDatReqInfo *param,
2452 Buffer *mBuf
2453 )
2454 #else
2455 PUBLIC S16 cmUnpkRguDDatReqInfo(param, mBuf)
2456 RguDDatReqInfo *param;
2457 Buffer *mBuf;
2458 #endif
2459 #endif
2460 {
2461    S32 i;
2462   /* After Merging from 2.1 to 2.2 */
2463    /*rgu_c_001.main_5 - ADD - L2M Support */
2464 #ifdef LTE_L2_MEAS
2465    S16 retVal;
2466 #endif
2467    S32 idx;
2468
2469    TRC3(cmUnpkRguDDatReqInfo);
2470
2471   /* After Merging from 2.1 to 2.2 */
2472    /*rgu_c_001.main_5 - ADD - L2M Support */
2473 #ifdef LTE_L2_MEAS
2474    retVal = ROK;
2475 #endif
2476    CMCHKUNPK(cmUnpkLteCellId, &param->cellId, mBuf);
2477    CMCHKUNPK(SUnpkU8, &param->nmbOfUeGrantPerTti, mBuf);
2478    for(idx = 0; idx < param->nmbOfUeGrantPerTti; idx++)
2479    { 
2480       RguDDatReqPerUe *datReq = &param->datReq[idx];
2481       CMCHKUNPK(cmUnpkLteRnti, &datReq->rnti, mBuf);
2482       CMCHKUNPK(SUnpkU32, &datReq->transId, mBuf);
2483       CMCHKUNPK(SUnpkU8, &datReq->nmbOfTbs, mBuf);
2484       /* rgu_c_001.main_4 - Changes for MIMO feature addition */
2485       for (i=0; i<RGU_MAX_TB; i++) 
2486       {
2487          /*rgu_c_001.main_5 - ADD - L2M Support */
2488 #ifdef LTE_L2_MEAS
2489          /* After Merging from 2.1 to 2.2 */
2490          retVal = cmUnpkRguDatReqTb(pst, &datReq->datReqTb[i], mBuf);
2491          if(retVal != ROK)
2492          {
2493             RETVALUE(RFAILED);
2494          }
2495 #else
2496          CMCHKUNPK(cmUnpkRguDatReqTb, &datReq->datReqTb[i], mBuf);
2497 #endif
2498       }
2499    }
2500    RETVALUE(ROK);
2501 }
2502
2503
2504 \f
2505 /***********************************************************
2506 *
2507 *     Func : cmPkRguCDatIndInfo
2508 *
2509 *
2510 *     Desc : RguCDatIndInfo
2511  * DatInd from MAC to RLC on CCCH
2512 *
2513 *
2514 *     Ret  : S16
2515 *
2516 *     Notes:
2517 *
2518 *     File  : 
2519 *
2520 **********************************************************/
2521 #ifdef ANSI
2522 PUBLIC S16 cmPkRguCDatIndInfo
2523 (
2524 RguCDatIndInfo *param,
2525 Buffer *mBuf
2526 )
2527 #else
2528 PUBLIC S16 cmPkRguCDatIndInfo(param, mBuf)
2529 RguCDatIndInfo *param;
2530 Buffer *mBuf;
2531 #endif
2532 {
2533    MsgLen msgLen;
2534
2535    TRC3(cmPkRguCDatIndInfo);
2536
2537    if (SFndLenMsg(param->pdu, &msgLen) != ROK)
2538       RETVALUE(RFAILED);
2539    if (SCatMsg(mBuf, param->pdu, M1M2) != ROK)
2540       RETVALUE(RFAILED);
2541    SPutMsg(param->pdu);
2542    CMCHKPK(cmPkMsgLen, msgLen, mBuf);
2543    CMCHKPK(cmPkLteLcId, param->lcId, mBuf);
2544    CMCHKPK(cmPkLteRnti, param->rnti, mBuf);
2545    CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
2546    RETVALUE(ROK);
2547 }
2548
2549
2550 \f
2551 /***********************************************************
2552 *
2553 *     Func : cmUnpkRguCDatIndInfo
2554 *
2555 *
2556 *     Desc : RguCDatIndInfo
2557  * DatInd from MAC to RLC on CCCH
2558 *
2559 *
2560 *     Ret  : S16
2561 *
2562 *     Notes:
2563 *
2564 *     File  : 
2565 *
2566 **********************************************************/
2567 #ifdef ANSI
2568 PUBLIC S16 cmUnpkRguCDatIndInfo
2569 (
2570 RguCDatIndInfo *param,
2571 Buffer *mBuf
2572 )
2573 #else
2574 PUBLIC S16 cmUnpkRguCDatIndInfo(param, mBuf)
2575 RguCDatIndInfo *param;
2576 Buffer *mBuf;
2577 #endif
2578 {
2579    MsgLen msgLen, totalMsgLen;
2580
2581    TRC3(cmUnpkRguCDatIndInfo);
2582
2583    CMCHKUNPK(cmUnpkLteCellId, &param->cellId, mBuf);
2584    CMCHKUNPK(cmUnpkLteRnti, &param->rnti, mBuf);
2585    CMCHKUNPK(cmUnpkLteLcId, &param->lcId, mBuf);
2586    CMCHKUNPK(cmUnpkMsgLen, &msgLen, mBuf);
2587    if (SFndLenMsg(mBuf, &totalMsgLen) != ROK)
2588       RETVALUE(RFAILED);
2589    if (SSegMsg(mBuf, totalMsgLen-msgLen, &param->pdu) != ROK)
2590       RETVALUE(RFAILED);
2591    RETVALUE(ROK);
2592 }
2593
2594
2595 \f
2596 /***********************************************************
2597 *
2598 *     Func : cmPkRguLchDatInd
2599 *
2600 *
2601 *     Desc : RguLchDatInd
2602  * DatInd Information for a logical channel
2603 *
2604 *
2605 *     Ret  : S16
2606 *
2607 *     Notes:
2608 *
2609 *     File  : 
2610 *
2611 **********************************************************/
2612 #ifdef ANSI
2613 PUBLIC S16 cmPkRguLchDatInd
2614 (
2615 RguLchDatInd *param,
2616 Buffer *mBuf
2617 )
2618 #else
2619 PUBLIC S16 cmPkRguLchDatInd(param, mBuf)
2620 RguLchDatInd *param;
2621 Buffer *mBuf;
2622 #endif
2623 {
2624    TRC3(cmPkRguLchDatInd);
2625
2626       CMCHKPK(cmPkRguPduInfo, &param->pdu, mBuf);
2627    CMCHKPK(cmPkLteLcId, param->lcId, mBuf);
2628    RETVALUE(ROK);
2629 }
2630
2631
2632 \f
2633 /***********************************************************
2634 *
2635 *     Func : cmUnpkRguLchDatInd
2636 *
2637 *
2638 *     Desc : RguLchDatInd
2639  * DatInd Information for a logical channel
2640 *
2641 *
2642 *     Ret  : S16
2643 *
2644 *     Notes:
2645 *
2646 *     File  : 
2647 *
2648 **********************************************************/
2649 #ifdef ANSI
2650 PUBLIC S16 cmUnpkRguLchDatInd
2651 (
2652 RguLchDatInd *param,
2653 Buffer *mBuf
2654 )
2655 #else
2656 PUBLIC S16 cmUnpkRguLchDatInd(param, mBuf)
2657 RguLchDatInd *param;
2658 Buffer *mBuf;
2659 #endif
2660 {
2661    TRC3(cmUnpkRguLchDatInd);
2662
2663    CMCHKUNPK(cmUnpkLteLcId, &param->lcId, mBuf);
2664    CMCHKUNPK(cmUnpkRguPduInfo, &param->pdu, mBuf);
2665    RETVALUE(ROK);
2666 }
2667
2668
2669 \f
2670 /***********************************************************
2671 *
2672 *     Func : packRlcMacDataInfo
2673 *
2674 *
2675 *     Desc : RlcMacData
2676  * Data Indication from MAC to RLC for dedicated channels of a UE
2677 *
2678 *
2679 *     Ret  : S16
2680 *
2681 *     Notes:
2682 *
2683 *     File  : 
2684 *
2685 **********************************************************/
2686 #ifdef ANSI
2687 PUBLIC S16 packRlcMacDataInfo
2688 (
2689 RlcMacData *param,
2690 Buffer *mBuf
2691 )
2692 #else
2693 PUBLIC S16 packRlcMacDataInfo(param, mBuf)
2694 RlcMacData *param;
2695 Buffer *mBuf;
2696 #endif
2697 {
2698    S32 i;
2699    MsgLen msgLen;
2700
2701    TRC3(packRlcMacDataInfo);
2702
2703    for (i=param->nmbPdu-1; i >= 0; i--)
2704    {
2705       MsgLen msgLen = 0;
2706       if (SFndLenMsg(param->pduInfo[i].pduBuf, &msgLen) != ROK)
2707          RETVALUE(RFAILED);
2708       if (SCatMsg(mBuf, param->pduInfo[i].pduBuf, M1M2) != ROK)
2709           RETVALUE(RFAILED);      
2710       CMCHKPK(cmPkMsgLen, msgLen, mBuf);
2711       CMCHKPK(cmPkLteLcId, param->pduInfo[i].lcId, mBuf);
2712       CMCHKPK(cmPkBool, param->pduInfo[i].commCh, mBuf);
2713    }
2714    CMCHKPK(SPkU8, param->nmbPdu, mBuf);
2715    CMCHKPK(cmPkLteRnti, param->rnti, mBuf);
2716    CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
2717    CMCHKPK(cmPkLteTimingInfo, &param->timeToTx, mBuf);
2718    RETVALUE(ROK);
2719 }
2720
2721
2722 \f
2723 /***********************************************************
2724 *
2725 *     Func : unpackRlcMacDataInfo
2726 *
2727 *
2728 *     Desc : RlcMacData
2729  * Data Indication from MAC to RLC for dedicated channels of a UE
2730 *
2731 *
2732 *     Ret  : S16
2733 *
2734 *     Notes:
2735 *
2736 *     File  : 
2737 *
2738 **********************************************************/
2739 #ifdef ANSI
2740 PUBLIC S16 unpackRlcMacDataInfo
2741 (
2742 RlcMacData *param,
2743 Buffer *mBuf
2744 )
2745 #else
2746 PUBLIC S16 unpackRlcMacDataInfo(param, mBuf)
2747 RlcMacData *param;
2748 Buffer *mBuf;
2749 #endif
2750 {
2751    S32 i;
2752
2753    TRC3(unpackRlcMacDataInfo);
2754    
2755    CMCHKUNPK(cmUnpkLteTimingInfo, &param->timeToTx, mBuf);
2756    CMCHKUNPK(cmUnpkLteCellId, &param->cellId, mBuf);
2757    CMCHKUNPK(cmUnpkLteRnti, &param->rnti, mBuf);
2758    CMCHKUNPK(SUnpkU8, &param->nmbPdu, mBuf);
2759    for (i=0; i<param->nmbPdu; i++) 
2760    {
2761       MsgLen totalMsgLen;
2762
2763       CMCHKUNPK(cmUnpkBool, &param->pduInfo[i].commCh, mBuf);
2764       CMCHKUNPK(cmUnpkLteLcId, &param->pduInfo[i].lcId, mBuf);
2765       CMCHKUNPK(cmPkMsgLen, &param->pduInfo[i].pduLen, mBuf);
2766       if (SFndLenMsg(mBuf, &totalMsgLen) != ROK)
2767          RETVALUE(RFAILED);
2768       if (SSegMsg(mBuf, totalMsgLen-param->pduInfo[i].pduLen, &param->pduInfo[i].pduBuf) != ROK)
2769          RETVALUE(RFAILED);
2770    }
2771    RETVALUE(ROK);
2772 }
2773
2774 \f
2775 /***********************************************************
2776 *
2777 *     Func : cmPkRguCStaRspInfo
2778 *
2779 *
2780 *     Desc : RguCStaRspInfo
2781  * Status Response from RLC to MAC  for common logical channel
2782 *
2783 *
2784 *     Ret  : S16
2785 *
2786 *     Notes:
2787 *
2788 *     File  : 
2789 *
2790 **********************************************************/
2791 #ifdef ANSI
2792 PUBLIC S16 cmPkRguCStaRspInfo
2793 (
2794 RguCStaRspInfo *param,
2795 Buffer *mBuf
2796 )
2797 #else
2798 PUBLIC S16 cmPkRguCStaRspInfo(param, mBuf)
2799 RguCStaRspInfo *param;
2800 Buffer *mBuf;
2801 #endif
2802 {
2803
2804    TRC3(cmPkRguCStaRspInfo);
2805
2806    switch(param->lcType) {
2807       case CM_LTE_LCH_CCCH:
2808          CMCHKPK(cmPkLteRnti, param->u.rnti, mBuf);
2809          break;
2810       case CM_LTE_LCH_BCCH:
2811       case CM_LTE_LCH_PCCH:
2812          CMCHKPK(cmPkLteTimingInfo, &param->u.timeToTx, mBuf);
2813 #ifdef EMTC_ENABLE
2814          CMCHKPK(SPkU8,param->pnb,mBuf);
2815          CMCHKPK(SPkU8,param->emtcDiReason,mBuf);
2816 #endif
2817          break;
2818       default :
2819          RETVALUE(RFAILED);
2820    }
2821    CMCHKPK(SPkS32, param->bo, mBuf);
2822    CMCHKPK(cmPkLteLcType, param->lcType, mBuf);
2823    CMCHKPK(cmPkLteLcId, param->lcId, mBuf);
2824    CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
2825    RETVALUE(ROK);
2826 }
2827
2828
2829 \f
2830 /***********************************************************
2831 *
2832 *     Func : cmUnpkRguCStaRspInfo
2833 *
2834 *
2835 *     Desc : RguCStaRspInfo
2836  * Status Response from RLC to MAC  for common logical channel
2837 *
2838 *
2839 *     Ret  : S16
2840 *
2841 *     Notes:
2842 *
2843 *     File  : 
2844 *
2845 **********************************************************/
2846 #ifdef ANSI
2847 PUBLIC S16 cmUnpkRguCStaRspInfo
2848 (
2849 RguCStaRspInfo *param,
2850 Buffer *mBuf
2851 )
2852 #else
2853 PUBLIC S16 cmUnpkRguCStaRspInfo(param, mBuf)
2854 RguCStaRspInfo *param;
2855 Buffer *mBuf;
2856 #endif
2857 {
2858
2859    TRC3(cmUnpkRguCStaRspInfo);
2860
2861    CMCHKUNPK(cmUnpkLteCellId, &param->cellId, mBuf);
2862    CMCHKUNPK(cmUnpkLteLcId, &param->lcId, mBuf);
2863    CMCHKUNPK(cmUnpkLteLcType, &param->lcType, mBuf);
2864    CMCHKUNPK(SUnpkS32, &param->bo, mBuf);
2865    switch(param->lcType) {
2866       case CM_LTE_LCH_BCCH:
2867       case CM_LTE_LCH_PCCH:
2868 #ifdef EMTC_ENABLE
2869          CMCHKUNPK(SUnpkU8,&param->emtcDiReason , mBuf);
2870          CMCHKUNPK(SUnpkU8,&param->pnb , mBuf);
2871 #endif
2872          CMCHKUNPK(cmUnpkLteTimingInfo, &param->u.timeToTx, mBuf);
2873          break;
2874       case CM_LTE_LCH_CCCH:
2875          CMCHKUNPK(cmUnpkLteRnti, &param->u.rnti, mBuf);
2876          break;
2877       default :
2878          RETVALUE(RFAILED);
2879    }
2880    RETVALUE(ROK);
2881 }
2882
2883
2884 \f
2885 /***********************************************************
2886 *
2887 *     Func : packBOStatusInfo
2888 *
2889 *
2890 *     Desc : RlcMacBOStatus
2891  * Status Response from RLC to MAC  for dedicated logical channel
2892 *
2893 *
2894 *     Ret  : S16
2895 *
2896 *     Notes:
2897 *
2898 *     File  : 
2899 *
2900 **********************************************************/
2901 #ifdef ANSI
2902 PUBLIC S16 packBOStatusInfo
2903 (
2904 RlcMacBOStatus *param,
2905 Buffer *mBuf
2906 )
2907 #else
2908 PUBLIC S16 packBOStatusInfo(param, mBuf)
2909 RlcMacBOStatus *param;
2910 Buffer *mBuf;
2911 #endif
2912 {
2913
2914    TRC3(packBOStatusInfo);
2915
2916    CMCHKPK(SPkS32, param->bo, mBuf);
2917    CMCHKPK(cmPkLteLcId, param->lcId, mBuf);
2918    CMCHKPK(cmPkBool, param->commCh, mBuf);
2919    CMCHKPK(cmPkLteRnti, param->rnti, mBuf);
2920    CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
2921    RETVALUE(ROK);
2922 } /* End of packBOStatusInfo */
2923
2924
2925 \f
2926 /***********************************************************
2927 *
2928 *     Func : unpackBOStatusInfo
2929 *
2930 *
2931 *     Desc : RlcMacBOStatus
2932  * Status Response from RLC to MAC  for dedicated logical channel
2933 *
2934 *
2935 *     Ret  : S16
2936 *
2937 *     Notes:
2938 *
2939 *     File  : 
2940 *
2941 **********************************************************/
2942 #ifdef ANSI
2943 PUBLIC S16 unpackBOStatusInfo
2944 (
2945 RlcMacBOStatus *param,
2946 Buffer *mBuf
2947 )
2948 #else
2949 PUBLIC S16 unpackBOStatusInfo(param, mBuf)
2950 RlcMacBOStatus *param;
2951 Buffer *mBuf;
2952 #endif
2953 {
2954
2955    TRC3(unpackBOStatusInfo);
2956
2957    CMCHKUNPK(cmUnpkLteCellId, &param->cellId, mBuf);
2958    CMCHKUNPK(cmUnpkLteRnti, &param->rnti, mBuf);
2959    CMCHKUNPK(cmUnpkBool, &param->commCh, mBuf);
2960    CMCHKUNPK(cmUnpkLteLcId, &param->lcId, mBuf);
2961    CMCHKUNPK(SUnpkS32, &param->bo, mBuf);
2962    RETVALUE(ROK);
2963 } /* End of unpackBOStatusInfo */
2964
2965 \f
2966 /***********************************************************
2967 *
2968 *     Func : cmPkRguLchStaInd
2969 *
2970 *
2971 *     Desc : RguLchStaInd
2972  * StaInd info for each logical channel of a UE
2973 *
2974 *
2975 *     Ret  : S16
2976 *
2977 *     Notes:
2978 *
2979 *     File  : 
2980 *
2981 **********************************************************/
2982 #ifdef ANSI
2983 PUBLIC S16 cmPkRguLchStaInd
2984 (
2985 RguLchStaInd *param,
2986 Buffer *mBuf
2987 )
2988 #else
2989 PUBLIC S16 cmPkRguLchStaInd(param, mBuf)
2990 RguLchStaInd *param;
2991 Buffer *mBuf;
2992 #endif
2993 {
2994
2995    TRC3(cmPkRguLchStaInd);
2996
2997    CMCHKPK(SPkS16, param->totBufSize, mBuf);
2998    CMCHKPK(cmPkLteLcId, param->lcId, mBuf);
2999    RETVALUE(ROK);
3000 }
3001
3002
3003 \f
3004 /***********************************************************
3005 *
3006 *     Func : cmUnpkRguLchStaInd
3007 *
3008 *
3009 *     Desc : RguLchStaInd
3010  * StaInd info for each logical channel of a UE
3011 *
3012 *
3013 *     Ret  : S16
3014 *
3015 *     Notes:
3016 *
3017 *     File  : 
3018 *
3019 **********************************************************/
3020 #ifdef ANSI
3021 PUBLIC S16 cmUnpkRguLchStaInd
3022 (
3023 RguLchStaInd *param,
3024 Buffer *mBuf
3025 )
3026 #else
3027 PUBLIC S16 cmUnpkRguLchStaInd(param, mBuf)
3028 RguLchStaInd *param;
3029 Buffer *mBuf;
3030 #endif
3031 {
3032
3033    TRC3(cmUnpkRguLchStaInd);
3034
3035    CMCHKUNPK(cmUnpkLteLcId, &param->lcId, mBuf);
3036    CMCHKUNPK(SUnpkS16, &param->totBufSize, mBuf);
3037    RETVALUE(ROK);
3038 }
3039
3040 \f
3041 /***********************************************************
3042 *
3043 *     Func : cmPkRguStaIndTb
3044 *
3045 *
3046 *     Desc : RguStaIndTb
3047 * StaInd from RLC to MAC for dedicated channels of a UE
3048 *
3049 *
3050 *     Ret  : S16
3051 *
3052 *     Notes:
3053 *
3054 *     File  : 
3055 *
3056 **********************************************************/
3057 #ifdef ANSI
3058 PUBLIC S16 cmPkRguStaIndTb
3059 (
3060 RguStaIndTb *param,
3061 Buffer *mBuf
3062 )
3063 #else
3064 PUBLIC S16 cmPkRguStaIndTb(param, mBuf)
3065 RguStaIndTb *param;
3066 Buffer *mBuf;
3067 #endif
3068 {
3069    S32 i;
3070
3071    TRC3(cmPkRguStaIndTb);
3072
3073 #ifdef LTE_L2_MEAS
3074    CMCHKPK(SPkU16, param->status, mBuf);
3075    CMCHKPK(SPkU32, param->tbId, mBuf);
3076 #endif   
3077    for (i=param->nmbLch-1; i >= 0; i--) {
3078       CMCHKPK(cmPkRguLchStaInd, &param->lchStaInd[i], mBuf);
3079    }
3080    CMCHKPK(SPkU8, param->nmbLch, mBuf);
3081    RETVALUE(ROK);
3082 }
3083
3084
3085 \f
3086 /***********************************************************
3087 *
3088 *     Func : cmUnpkRguStaIndTb
3089 *
3090 *
3091 *     Desc : RguStaIndTb
3092 * StaInd from RLC to MAC for dedicated channels of a UE
3093 *
3094 *
3095 *     Ret  : S16
3096 *
3097 *     Notes:
3098 *
3099 *     File  : 
3100 *
3101 **********************************************************/
3102 #ifdef ANSI
3103 PUBLIC S16 cmUnpkRguStaIndTb
3104 (
3105 RguStaIndTb *param,
3106 Buffer *mBuf
3107 )
3108 #else
3109 PUBLIC S16 cmUnpkRguStaIndTb(param, mBuf)
3110 RguStaIndTb *param;
3111 Buffer *mBuf;
3112 #endif
3113 {
3114    S32 i;
3115
3116    TRC3(cmUnpkRguStaIndTb);
3117
3118    CMCHKUNPK(SUnpkU8, &param->nmbLch, mBuf);
3119    for (i=0; i<param->nmbLch; i++) {
3120       CMCHKUNPK(cmUnpkRguLchStaInd, &param->lchStaInd[i], mBuf);
3121    }
3122 #ifdef LTE_L2_MEAS
3123    CMCHKUNPK(SUnpkU32, &param->tbId, mBuf);
3124    CMCHKUNPK(SUnpkU16, &param->status, mBuf);
3125 #endif   
3126    RETVALUE(ROK);
3127 }
3128
3129 \f
3130 /***********************************************************
3131 *
3132 *     Func : packSchedRepInfo
3133 *
3134 *
3135 *     Desc : RlcMacSchedRep
3136  * StaInd from MAC to RLC for dedicated logical channels of a UE
3137 *
3138 *
3139 *     Ret  : S16
3140 *
3141 *     Notes:
3142 *
3143 *     File  : 
3144 *
3145 **********************************************************/
3146 #ifdef ANSI
3147 PUBLIC S16 packSchedRepInfo
3148 (
3149 RlcMacSchedRep *param,
3150 Buffer *mBuf
3151 )
3152 #else
3153 PUBLIC S16 packSchedRepInfo(param, mBuf)
3154 RlcMacSchedRep *param;
3155 Buffer *mBuf;
3156 #endif
3157 {
3158    S32 i;
3159    S32 idx;
3160
3161    TRC3(packSchedRepInfo);
3162
3163    for(idx = (param->nmbLch-1); idx >= 0; idx--)
3164    {
3165       CMCHKPK(cmPkRguLchStaInd, &param->lchSta[idx].lchStaInd, mBuf);
3166       CMCHKPK(cmPkBool, param->lchSta[idx].commCh, mBuf);
3167    }
3168    CMCHKPK(SPkU8, param->nmbLch, mBuf);
3169    CMCHKPK(cmPkLteRnti, param->rnti, mBuf);
3170    CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
3171    CMCHKPK(cmPkLteTimingInfo, &param->timeToTx, mBuf);
3172
3173    RETVALUE(ROK);
3174 } /* End of packSchedRepInfo */
3175
3176
3177 \f
3178 /***********************************************************
3179 *
3180 *     Func : unpackSchedRepInfo
3181 *
3182 *
3183 *     Desc : RlcMacSchedRep
3184  * StaInd from MAC to RLC for dedicated logical channels of a UE
3185 *
3186 *
3187 *     Ret  : S16
3188 *
3189 *     Notes:
3190 *
3191 *     File  : 
3192 *
3193 **********************************************************/
3194 #ifdef ANSI
3195 PUBLIC S16 unpackSchedRepInfo
3196 (
3197 RlcMacSchedRep *param,
3198 Buffer *mBuf
3199 )
3200 #else
3201 PUBLIC S16 unpackSchedRepInfo(param, mBuf)
3202 RlcMacSchedRep *param;
3203 Buffer *mBuf;
3204 #endif
3205 {
3206    S32 i;
3207    S32 idx;
3208
3209    TRC3(unpackSchedRepInfo);
3210
3211    CMCHKUNPK(cmUnpkLteTimingInfo, &param->timeToTx, mBuf);
3212    CMCHKUNPK(cmUnpkLteCellId, &param->cellId, mBuf);
3213    CMCHKUNPK(cmUnpkLteRnti, &param->rnti, mBuf);
3214    CMCHKUNPK(SUnpkU8, &param->nmbLch, mBuf);
3215    for(idx = 0; idx < param->nmbLch; idx++)
3216    {
3217       CMCHKUNPK(cmUnpkBool, &param->lchSta[idx].commCh, mBuf);
3218       CMCHKUNPK(cmUnpkRguLchStaInd, &param->lchSta[idx].lchStaInd, mBuf);
3219    }
3220
3221    RETVALUE(ROK);
3222 } /* End of unpackSchedRepInfo */
3223
3224 #endif
3225
3226 /**********************************************************************
3227          End of file
3228 **********************************************************************/