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