RLC BO, BO response and DL Data handling. [Issue-ID: ODUHIGH-181]
[o-du/l2.git] / src / 5gnrrlc / kw_ptmi.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**
20
21         Name:     RLC Layer Management interface
22
23         Type:     C source file
24
25         Desc:     This file contains source code for RLC layer management
26                   interface primitives. It includes the definition of the
27                   following functions and their portable function
28                   definitions.
29                      -- PjMiLpjCfgCfm
30                      -- PjMiLpjCntrlCfm
31                      -- PjMiLpjStaInd
32
33
34         File:     kw_ptmi.c
35
36 *********************************************************************21*/
37
38 \f
39 /* header (.h) include files */
40 #include "common_def.h"
41 #include "lkw.h"           /* LKW defines */
42 #include "ckw.h"           /* CKW defines */
43 #include "kwu.h"           /* KWU defines */
44 #include "rgu.h"           /* RGU defines */
45
46 #include "kw_env.h"        /* RLC environment options */
47 #include "kw.h"            /* RLC defines */
48
49 /* extern (.x) include files */
50 #include "lkw.x"           /* LKW */
51 #include "ckw.x"           /* CKW */
52 #include "kwu.x"           /* KWU */
53 #include "rgu.x"           /* RGU */
54
55 #include "kw.x"
56
57 /* local defines */
58 #define MAXKWMI 2               /* max. layer management interfaces */
59
60 \f
61 /*********************************************************************
62  *             Primitives for LKW interface 
63  ********************************************************************/
64 /* Configuration confirmation primitive */
65
66 PRIVATE RlcConfigCfm rlcMiRlcConfigCfmMt[MAXKWMI] =
67 {
68 #ifdef LCKWMILKW
69    packRlcConfigCfm,            /* 0 - loosely coupled - fc */
70 #endif /* LCRLMILKW */
71 #ifdef SM
72    SmMiRlcConfigCfm,            /* 1 - tightly coupled layer management*/
73 #endif /* SM */
74 };
75
76 /* control confirmation primitives */
77
78 PRIVATE LkwCntrlCfm kwMiLkwCntrlCfmMt[MAXKWMI] =
79 {
80 #ifdef LCKWMILKW 
81    cmPkLkwCntrlCfm,          /* 0 - loosely coupled - fc */
82 #endif /* LCRLMILKW */
83 #ifdef SM
84    SmMiLkwCntrlCfm,          /* 1 - tightly coupled layer management*/
85 #endif /* SM */
86 };
87
88 /* Status Indication primitive */
89
90 PRIVATE LkwStaInd kwMiLkwStaIndMt[MAXKWMI] =
91 {
92 #ifdef LCKWMILKW 
93    cmPkLkwStaInd,            /* 0 - loosely coupled  */
94 #endif /* LCKWMILKW */
95 #ifdef SM
96    SmMiLkwStaInd,            /* 1 - tightly coupled, layer management */
97 #endif /* SM */
98 };
99
100 /* Status confirm primitive */
101
102 PRIVATE LkwStaCfm kwMiLkwStaCfmMt[MAXKWMI] =
103 {
104 #ifdef LCKWMILKW 
105    cmPkLkwStaCfm,            /* 0 - loosely coupled  */
106 #endif /* LCKWMILKW */
107 #ifdef SM
108    SmMiLkwStaCfm,            /* 1 - tightly coupled, layer management */
109 #endif /* SM */
110 };
111
112 /* Statistics confirm primitive */
113
114 PRIVATE LkwStsCfm kwMiLkwStsCfmMt[MAXKWMI] =
115 {
116 #ifdef LCKWMILKW
117    cmPkLkwStsCfm,            /* 0 - loosely coupled  */
118 #endif /* LCRLMILKW */
119 #ifdef SM
120    SmMiLkwStsCfm,            /* 1 - tightly coupled, layer management */
121 #endif /* SM */
122 };
123
124 /* Trace indication primitive */
125
126 PRIVATE LkwTrcInd kwMiLkwTrcIndMt[MAXKWMI] =
127 {
128 #ifdef LCKWMILKW
129    cmPkLkwTrcInd,            /* 0 - loosely coupled  */
130 #endif /* LCKWMILKW */
131 #ifdef SM
132    SmMiLkwTrcInd,            /* 1 - tightly coupled, layer management */
133 #endif /* SM */
134 };
135
136 /* kw005.201 added support for L2 Measurement */
137 #ifdef LTE_L2_MEAS
138 PRIVATE CONSTANT LkwL2MeasCfm rlcMiLkwL2MeasCfmMt[] =
139 {
140 #ifdef LCKWMILKW
141    cmPkLkwL2MeasCfm,
142 #endif
143 #ifdef SM
144    SmMiLkwL2MeasCfm,
145 #endif
146 };
147 PRIVATE CONSTANT LkwL2MeasStopCfm RlcMiLkwL2MeasStopCfmMt[] =
148 {
149 #ifdef LCKWMILKW
150    cmPkLkwL2MeasStopCfm,
151 #endif
152 #ifdef SM
153    SmMiLkwL2MeasStopCfm,
154 #endif
155 };
156 #endif /*  LTE_L2_MEAS */
157 \f  
158 /****************************************************************************
159  *                         LKW Interface Mt functions
160  ***************************************************************************/
161 /**
162    @brief
163    This function is called by the RlcMiRlcConfigReq function for responding
164    to configuration requests.The cfm field in the RlcMngmt  structure contains
165  the response value.
166
167    - This function calls the mapping matrix for sending the configuration
168      confirmation.
169    - The actual function called depends on the coupling at the LKW interface.
170    - For a loosely coupled interface, a common packing function is called.
171    - The packing function packs the parameter in a message buffer and posts
172      the message to the target task.
173    - For a tightly coupled interface, the actual function called depends on
174      the layer manager API provided.
175
176 */
177 #ifdef ANSI
178 S16 RlcMiRlcConfigCfm
179 (
180 Pst        *pst,                /* post structure */
181 RlcMngmt    *cfm                 /* Layer Management structure */
182 )
183 #else
184 S16 RlcMiRlcConfigCfm(pst, cfm)
185 Pst        *pst;                /* post structure */
186 RlcMngmt    *cfm;                /* Layer Management structure */
187 #endif
188 {
189    TRC3(RlcMiRlcConfigCfm);
190
191    /* jump to specific primitive depending on configured selector */
192    (*rlcMiRlcConfigCfmMt[pst->selector])(pst, cfm);
193    
194    return ROK;
195 }
196
197
198 /**
199    @brief
200    This function is called by the RlcMiLkwCntrlReq function to send a control confirm to the layer management module.
201
202    - This function calls the mapping matrix for sending the control confirmation.
203    - Actual function called depends on the coupling of the LKW interface.
204    - For a loosely coupled interface, a common packing function is called.
205    - The packing function packs the parameter in a message buffer and posts the
206      message to the target task.
207    - For a tightly coupled interface, the actual function called depends on the
208      layer manager API provided.
209
210 */
211 #ifdef ANSI
212 S16 RlcMiLkwCntrlCfm
213 (
214 Pst *pst,                    /* post structure */
215 RlcMngmt *cfm                 /* configure */
216 )
217 #else
218 S16 RlcMiLkwCntrlCfm(pst, cfm)
219 Pst *pst;                    /* post structure */
220 RlcMngmt *cfm;                /* confirm */
221 #endif
222 {
223    TRC3(RlcMiLkwCntrlCfm)
224
225    /* jump to specific primitive depending on configured selector */
226    (*kwMiLkwCntrlCfmMt[pst->selector])(pst, cfm);
227
228    return ROK;
229
230 } /* end of RlcMiLkwCntrlCfm */
231
232 /**
233    @brief
234    Description:
235    - This function can be used by RLC to send unsolicited status information
236      to the layer manager, when the unsolicited status flag is enabled by the
237      layer manager through a previous control request.
238
239    - This function calls the mapping matrix for sending the unsolicited status
240      indication.The actual function called depends on the coupling of the
241      LKW interface.
242
243    - For a loosely coupled interface, a common packing function is called. The
244      packing function packs the parameter in a message buffer and posts the
245      message to the target task.
246
247    - For a tightly coupled interface, the actual function called depends on
248      the layer manager API provided.
249 */
250 #ifdef ANSI
251 S16 RlcMiLkwStaInd
252 (
253 Pst     *pst,                /* post structure */
254 RlcMngmt *usta                /* unsolicited status */
255 )
256 #else
257 S16 RlcMiLkwStaInd(pst, usta)
258 Pst     *pst;                /* post structure */
259 RlcMngmt *usta;               /* unsolicited status */
260 #endif
261 {
262    TRC3(RlcMiLkwStaInd);
263
264    /* jump to specific primitive depending on configured selector */
265    (*kwMiLkwStaIndMt[pst->selector])(pst, usta);
266
267    return (ROK);
268 } /* end of RlcMiLkwStaInd */
269
270
271 /**
272    @brief
273    - This function is called by the RlcMiLkwStaReq function to send
274       the requested status information to the layer manager.
275
276    - This function calls the mapping matrix for sending the status
277       confirmation. The actual function called depends on the coupling
278       of the LKW interface.
279
280    - For a loosely coupled interface, a common packing function is called.
281       The packing function packs the parameter in a message buffer and
282       posts the message to the target task.
283
284    - For a tightly coupled interface, the actual function called depends
285       on the layer manager API provided.
286
287 */
288 #ifdef ANSI
289 S16 RlcMiLkwStaCfm
290 (
291 Pst *pst,                    /* post structure */
292 RlcMngmt *cfm                 /* solicited status confirmation */
293 )
294 #else
295 S16 RlcMiLkwStaCfm(pst, cfm)
296 Pst *pst;                    /* post structure */
297 RlcMngmt *cfm;                /* solicited status confirmation */
298 #endif
299 {
300    TRC3(RlcMiLkwStaCfm);
301
302    /* jump to specific primitive depending on configured selector */
303    (*kwMiLkwStaCfmMt[pst->selector])(pst, cfm);
304
305    return ROK;
306
307 } /* end of RlcMiLkwStaCfm */
308
309
310 /**
311    @brief
312    - This function is called by the RlcMiLkwStsReq function for responding
313       to statistics requests.
314
315    - This function calls the mapping matrix for sending the statistics
316       confirmation. The actual function called depends on the coupling
317       of the LKW interface.
318
319    - For a loosely coupled interface, a common packing function is called.
320       The packing function packs the parameter in a message buffer and
321       posts the message to the target task.
322
323    - For a tightly coupled interface, the actual function called depends
324       on the layer manager API provided.
325
326 */
327 #ifdef ANSI
328 S16 RlcMiLkwStsCfm
329 (
330 Pst *pst,                    /* post structure */
331 Action action,               /* action */
332 RlcMngmt *cfm                 /* statistics confirmation */
333 )
334 #else
335 S16 RlcMiLkwStsCfm(pst, action, cfm)
336 Pst *pst;                    /* post structure */
337 Action action;               /* action */
338 RlcMngmt *cfm;                /* statistics confirmation */
339 #endif
340 {
341    TRC3(RlcMiLkwStsCfm);
342
343    /* jump to specific primitive depending on configured selector */
344    (*kwMiLkwStsCfmMt[pst->selector])(pst, action, cfm);
345
346    return ROK;
347
348 } /* end of RlcMiLkwStsCfm */
349
350 /**
351    @brief
352    - This function can be used by RLC module to send unsolicited trace
353       indications to the layer manager, when tracing is enabled by the
354       layer manager through a previous control request.
355
356    - This function calls the mapping matrix for sending the trace indication.
357       The actual function called depends on the coupling of the LKW interface.
358
359    - For a loosely coupled interface, a common packing function is called.
360       The packing function packs the parameter in a message buffer and posts
361       the message to the target task.
362
363    - For a tightly coupled interface, the actual function called depends on
364       the layer manager API provided.
365
366 */
367 #ifdef ANSI
368 S16 RlcMiLkwTrcInd
369 (
370 Pst *pst,                    /* post structure */
371 RlcMngmt *trc,                /* trace indication */
372 Buffer *mBuf                 /* message buffer */
373 )
374 #else
375 S16 RlcMiLkwTrcInd(pst, trc, mBuf)
376 Pst *pst;                    /* post structure */
377 RlcMngmt *trc;                /* trace indication */
378 Buffer *mBuf;                /* message buffer */
379 #endif
380 {
381    TRC3(RlcMiLkwTrcInd);
382
383    /* jump to specific primitive depending on configured selector */
384    (*kwMiLkwTrcIndMt[pst->selector])(pst, trc, mBuf);
385
386    return ROK;
387
388 } /* end of RlcMiLkwTrcInd */
389
390
391 /* kw005.201 added support for L2 Measurement */
392 #ifdef LTE_L2_MEAS
393 #ifdef ANSI
394 S16 RlcMiLkwL2MeasCfm
395 (
396 Pst * pst,
397 RlcL2MeasCfmEvt *measEvt
398 )
399 #else
400 S16 RlcMiLkwL2MeasCfm(pst, measEvt)
401 Pst * pst;
402 RlcL2MeasCfmEvt *measEvt;
403 #endif
404 {
405
406    TRC3(RlcMiLkwL2MeasCfm)
407
408    (*rlcMiLkwL2MeasCfmMt[pst->selector])(pst, measEvt);
409
410    return ROK;
411
412 }
413 #ifdef ANSI
414 S16 RlcMiLkwL2MeasStopCfm
415 (  
416 Pst *pst,
417 U8  measType,
418 U8  status
419 )
420 #else
421 S16 RlcMiLkwL2MeasStopCfm(pst, measType,status)
422 Pst *pst;
423 U8  measType;
424 U8  status;
425 #endif
426 {
427
428    TRC3(RlcMiLkwL2MeasStopCfm)
429
430    (*RlcMiLkwL2MeasStopCfmMt[pst->selector])(pst, measType,status);
431
432    return ROK;
433
434 }
435 #endif /*  LTE_L2_MEAS */
436
437 /********************************************************************30**
438
439          End of file
440 **********************************************************************/