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