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