[Epic-ID: ODUHIGH-461][Task-ID: ODUHIGH-468]Unused files and functions removed/disabled
[o-du/l2.git] / src / cm / rgm.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 \f
19
20 /************************************************************************
21  
22      Name:     LTE-MAC layer
23   
24      Type:     C source file
25   
26      Desc:     C source code for packing/unpacking of RGM interface
27                primitives.
28   
29      File:     rgm.c 
30   
31 **********************************************************************/
32
33 /** @file rgm.c
34 @brief This file contains the packing/unpacking code for the RGM interface 
35        primitives.
36 */
37
38 /* header include files (.h) */
39 #include "common_def.h"
40 #include "rgm.h"           /* RGM Interface defines */
41 /* header/extern include files (.x) */
42 #include "rgm.x"           /* RGM Interface includes */
43
44 /* RRM_SP1_START */
45 /**
46 * @brief Packing of PRB Usage Report for qci for sending 
47 *        to RRM from MAC 
48 *
49 * @details
50 *
51 *     Function : cmPkRgmPrbQciRpt 
52 *
53 *  @param[in]   RgmPrbRptPerQci * qciPrbRprt 
54 *  @param[out]   Buffer *mBuf 
55 *  @return   S16
56 *      -# ROK
57 **/
58 S16 cmPkRgmPrbQciRpt 
59 (
60 RgmPrbRptPerQci *qciPrbRprt,
61 Buffer *mBuf
62 )
63 {
64    CMCHKPK(oduUnpackUInt8, qciPrbRprt->bQci, mBuf);
65    CMCHKPK(oduUnpackUInt8, qciPrbRprt->bAvgPrbUlUsage, mBuf);
66    CMCHKPK(oduUnpackUInt8, qciPrbRprt->bAvgPrbDlUsage, mBuf);
67
68    return ROK;
69 }
70
71 /**
72 * @brief Unpacking of PRB Usage Report for qci received from MAC 
73 *
74 * @details
75 *
76 *     Function : cmUnpkRgmPrbQciRpt 
77 *
78 *  @param[out]   RgmPrbRptPerQci * qciPrbRprt 
79 *  @param[in]   Buffer *mBuf 
80 *  @return   S16
81 *      -# ROK
82 **/
83 S16 cmUnpkRgmPrbQciRpt 
84 (
85 RgmPrbRptPerQci *qciPrbRprt,
86 Buffer *mBuf
87 )
88 {
89    CMCHKUNPK(oduPackUInt8, &qciPrbRprt->bAvgPrbDlUsage, mBuf);
90    CMCHKUNPK(oduPackUInt8, &qciPrbRprt->bAvgPrbUlUsage, mBuf);
91    CMCHKUNPK(oduPackUInt8, &qciPrbRprt->bQci, mBuf);
92
93    return ROK;
94 }
95 /* RRM_SP1_END */
96
97 /**
98 * @brief PRB Usage Report Indication  from MAC to RRM 
99 *
100 * @details
101 *
102 *     Function : cmPkPrbRprtInd
103 *
104 *  @param[in]   RgmPrbRprtInd  *  prbRprtInd
105 *  @param[in]   Buffer *mBuf 
106 *  @return   S16
107 *      -# ROK
108 **/
109 S16 cmPkPrbRprtInd
110 (
111 RgmPrbRprtInd  * prbRprtInd,
112 Buffer *mBuf
113 )
114 {
115    S32 idx = 0;
116
117    
118    /* RRM_SP1_START */
119    for(idx = RGM_MAX_QCI_REPORTS-1; idx >= 0; idx--)
120    {
121       CMCHKPK(cmPkRgmPrbQciRpt, &prbRprtInd->stQciPrbRpts[idx], mBuf);
122    }
123    CMCHKPK(oduUnpackUInt8, prbRprtInd->bPrbUsageMask, mBuf);
124    CMCHKPK(oduUnpackUInt8, prbRprtInd->bCellId, mBuf);
125    /* RRM_SP1_END */
126    return ROK;
127 }
128
129 /**
130 * @brief PRB Usage Report Indication  from MAC to RRM 
131 *
132 * @details
133 *
134 *     Function : cmUnpkPrbRprtInd
135 *
136 *  @param[in]   RgmPrbRprtInd  *  prbRprtInd
137 *  @param[in]   Buffer *mBuf 
138 *  @return   S16
139 *      -# ROK
140 **/
141 S16 cmUnpkPrbRprtInd
142 (
143 RgmPrbRprtInd  * prbRprtInd,
144 Buffer *mBuf
145 )
146 {
147    uint32_t idx = 0;
148
149
150    /* RRM_SP1_START */
151    CMCHKUNPK(oduPackUInt8, &prbRprtInd->bCellId, mBuf);
152    CMCHKUNPK(oduPackUInt8, &prbRprtInd->bPrbUsageMask, mBuf);
153    for(idx = 0; idx < RGM_MAX_QCI_REPORTS; idx++)
154    {
155       CMCHKUNPK(cmUnpkRgmPrbQciRpt, &prbRprtInd->stQciPrbRpts[idx], mBuf);
156    }
157
158    /* RRM_SP1_END */
159    return ROK;
160 }
161
162
163
164 /**
165 * @brief PRB Usage Report Indication  from MAC to RRM 
166 *
167 * @details
168 *
169 *     Function : cmPkRgmPrbRprtInd
170 *
171 *  @param[in]   Pst*  pst
172 *  @param[in]   SuId  suId
173 *  @param[in]   RgmPrbRprtInd  *  prbRprtInd
174 *  @return   S16
175 *      -# ROK
176 **/
177 S16 cmPkRgmPrbRprtInd
178 (
179 Pst* pst,
180 SuId suId,
181 RgmPrbRprtInd  * prbRprtInd
182 )
183 {
184    Buffer *mBuf = NULLP;
185
186
187    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
188       SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)prbRprtInd, sizeof(RgmPrbRprtInd));
189       return RFAILED;
190    }
191
192    if(cmPkPrbRprtInd(prbRprtInd, mBuf) != ROK)
193    {
194       SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)prbRprtInd, sizeof(RgmPrbRprtInd));
195       SPutMsg(mBuf);
196       return RFAILED;
197    }
198
199    if (SPkS16(suId, mBuf) != ROK) 
200    {
201       SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)prbRprtInd, sizeof(RgmPrbRprtInd));
202       SPutMsg(mBuf);
203       return RFAILED;
204    }
205
206    SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)prbRprtInd, sizeof(RgmPrbRprtInd));
207
208    pst->event = (Event) EVTRGMPRBRPRTIND;
209    return (SPstTsk(pst,mBuf));
210 }
211 /**
212 * @brief PRB Usage Report Indication from MAC to RRM 
213 *
214 * @details
215 *
216 *     Function : cmUnpkRgmPrbRprtInd
217 *
218 *  @param[in]   Pst*  pst
219 *  @param[in]   SuId  suId
220 *  @param[in]   RgmPrbRprtInd  *  prbRprtInd
221 *  @return   S16
222 *      -# ROK
223 **/
224 S16 cmUnpkRgmPrbRprtInd
225 (
226 RgmPrbRprtIndFptr func,
227 Pst *pst,
228 Buffer *mBuf
229 )
230 {
231    SuId suId;
232    RgmPrbRprtInd prbRprtInd;
233    
234
235    if (SUnpkS16(&suId, mBuf) != ROK) 
236    {
237       SPutMsg(mBuf);
238       return RFAILED;
239    }
240
241    if (cmUnpkPrbRprtInd(&prbRprtInd, mBuf) != ROK) 
242    {
243       SPutMsg(mBuf);
244       return RFAILED;
245    }
246
247    SPutMsg(mBuf);
248    return ((*func)(pst, suId, &prbRprtInd));
249 }
250
251 /**
252 * @brief Transmission Mode Change Indication  from MAC to RRM 
253 *
254 * @details
255 *
256 *     Function : cmPkTransModeInd
257 *
258 *  @param[in]   RgmTransModeInd *transModeInd
259 *  @param[in]   Buffer *mBuf 
260 *  @return   S16
261 *      -# ROK
262 **/
263 S16 cmPkTransModeInd
264 (
265 RgmTransModeInd *transModeInd,
266 Buffer *mBuf
267 )
268 {
269    CMCHKPK(oduUnpackUInt32, transModeInd->eMode, mBuf);
270    CMCHKPK(oduUnpackUInt16, transModeInd->usCrnti, mBuf);
271    CMCHKPK(oduUnpackUInt8, transModeInd->bCellId, mBuf);
272    return ROK;
273 }
274
275 /**
276 * @brief  Transmission Mode Change Indication from MAC to RRM 
277 *
278 * @details
279 *
280 *     Function : cmUnpkTransModeInd
281 *
282 *  @param[in]   RgmTransModeInd *transModeInd 
283 *  @param[in]   Buffer *mBuf 
284 *  @return   S16
285 *      -# ROK
286 **/
287 S16 cmUnpkTransModeInd
288 (
289 RgmTransModeInd *transModeInd,
290 Buffer *mBuf
291 )
292 {
293    uint32_t tmpModeEnum;
294    CMCHKUNPK(oduPackUInt8, &transModeInd->bCellId, mBuf);
295    CMCHKUNPK(oduPackUInt16, &transModeInd->usCrnti, mBuf);
296    CMCHKUNPK(oduPackUInt32, (uint32_t *)&tmpModeEnum, mBuf);
297    transModeInd->eMode = (RgmTxnMode)tmpModeEnum;
298    return ROK;
299 }
300 /**
301 * @brief Transmission Mode Change Indication  from MAC to RRM 
302 *
303 * @details
304 *
305 *     Function : cmPkRgmTransModeInd
306 *
307 *  @param[in]   Pst*  pst
308 *  @param[in]   SuId  suId
309 *  @param[in]   RgmTransModeInd *transModeInd 
310 *  @return   S16
311 *      -# ROK
312 **/
313
314 S16 cmPkRgmTransModeInd 
315 (
316 Pst* pst,
317 SuId suId,
318 RgmTransModeInd *transModeInd
319 )
320 {
321    Buffer *mBuf = NULLP;
322
323
324    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
325       SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)transModeInd, sizeof(RgmTransModeInd));
326       return RFAILED;
327    }
328
329    if(cmPkTransModeInd(transModeInd, mBuf) != ROK)
330    {
331       SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)transModeInd, sizeof(RgmTransModeInd));
332       SPutMsg(mBuf);
333       return RFAILED;
334    }
335
336    if (SPkS16(suId, mBuf) != ROK) 
337    {
338       SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)transModeInd, sizeof(RgmTransModeInd));
339       SPutMsg(mBuf);
340       return RFAILED;
341    }
342
343    SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)transModeInd, sizeof(RgmTransModeInd));
344
345    pst->event = (Event) EVTRGMTRANSMODEIND;
346    return (SPstTsk(pst,mBuf));
347 }
348 /**
349 * @brief Transmission Mode Change Indication  from MAC to RRM 
350 *
351 * @details
352 *
353 *     Function : cmUnpkRgmTransModeInd
354 *
355 *  @param[in]   Pst*  pst
356 *  @param[in]   SuId  suId
357 *  @param[in]   RgmTransModeInd *transModeInd 
358 *  @return   S16
359 *      -# ROK
360 **/
361 S16 cmUnpkRgmTransModeInd
362 (
363 RgmTransModeIndFptr func,
364 Pst *pst,
365 Buffer *mBuf
366 )
367 {
368    SuId suId;
369    RgmTransModeInd transModeInd;
370    
371
372    if (SUnpkS16(&suId, mBuf) != ROK) 
373    {
374       SPutMsg(mBuf);
375       return RFAILED;
376    }
377
378    if (cmUnpkTransModeInd(&transModeInd, mBuf) != ROK) 
379    {
380       SPutMsg(mBuf);
381       return RFAILED;
382    }
383
384    SPutMsg(mBuf);
385    return ((*func)(pst, suId, &transModeInd));
386 }
387 /**********************************************************************
388  
389          End of file
390  
391 **********************************************************************/