967ae3f985be7c0415a88e8ef7431d79ef924fc9
[o-du/l2.git] / src / 5gnrsch / rg_sch_pt.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 INF Interface Module 
26   
27      File:     rg_sch_pt.c 
28   
29 **********************************************************************/
30
31 /** @file rg_sch_pt.c
32 @brief This file contains the definitions for Upper Interface(RGR/CRG/RGU) 
33        primitives that are invoked from MAC to its service users.
34        Portable functions corresponding to these primitives are also defined.
35 */
36 /* header include files (.h) */
37 #include "common_def.h"
38 #include "rg_env.h"        /* MAC Environment Defines */
39 #include "crg.h"           /* CRG Interface defines */
40 #include "rgr.h"           /* RGR Interface defines */
41 #include "rgu.h"           /* RGU Interface defines */
42 #include "cm_mblk.h"       /* memory management */
43 #include "cm_lte.h"        /* Common LTE Defines */
44 #include "tfu.h"           /* RGU Interface defines */
45 #ifdef LTE_L2_MEAS
46 #include "lrg.h"
47 #endif
48 #include "rg_sch_inf.h"           /* RGU Interface defines */
49
50 /* header/extern include files (.x) */
51 #include "crg.x"           /* CRG Interface includes */
52 #include "rgr.x"           /* RGR Interface includes */
53 #include "rgu.x"           /* RGU Interface includes */
54 #include "cm_mblk.x"       /* memory management */
55 #include "cm_lte.x"        /* Common LTE Defines */
56 #include "tfu.x"           /* RGU Interface includes */
57 #ifdef LTE_L2_MEAS
58 #include "lrg.x"
59 #endif
60 #include "rg_sch_inf.x"           /* RGU Interface includes */
61
62 #define RG_MAX_SCH 1
63
64 static const CellRegReq RgSchMacCellRegReqMt[RG_MAX_SCH] =
65 {
66 #ifdef LCSCH
67    cmPkSchMacCellRegReq,
68 #else
69    RgSchMacCellRegReq
70 #endif
71 };
72
73 static const DedBoUpdtReq RgMacSchDedBoUpdtReqMt[RG_MAX_SCH] =
74 {
75 #ifdef LCSCH
76    cmPkMacSchDedBoUpdtReq,
77 #else
78    RgMacSchDedBoUpdtReq
79 #endif
80 };
81
82 static const CmnBoUpdtReq RgMacSchCmnBoUpdtReqMt[RG_MAX_SCH] =
83 {
84 #ifdef LCSCH
85    cmPkMacSchCmnBoUpdtReq,
86 #else
87    RgMacSchCmnBoUpdtReq
88 #endif
89 };
90
91 static const SfRecpInd RgMacSchSfRecpIndMt[RG_MAX_SCH] =
92 {
93 #ifdef LCSCH
94    cmPkMacSchSfRecpInd
95 #else
96    RgMacSchSfRecpInd,
97 #endif
98 };
99 /*Fix: start: Inform UE delete to scheduler*/
100 static const UeDelInd RgMacSchUeDelIndMt[RG_MAX_SCH] =
101 {
102 #ifdef LCSCH
103    cmPkMacSchUeDelInd
104 #else
105    RgMacSchUeDelInd,
106 #endif
107 };
108 /*Fix: end: Inform UE delete to scheduler*/
109 static const SfAllocReq RgSchMacSfAllocReqMt[RG_MAX_SCH] =
110 {
111 #ifdef LCSCH
112    cmPkSchMacSfAllocReq,
113 #else
114    RgSchMacSfAllocReq
115 #endif
116 };
117
118 static const RstHqEntReq RgSchMacRstHqEntReqMt[RG_MAX_SCH] =
119 {
120 #ifdef LCSCH
121    cmPkSchMacRstHqEntReq,
122 #else
123    RgSchMacRstHqEntReq
124 #endif
125 };
126 static const RlsHqReq RgSchMacRlsHqReqMt[RG_MAX_SCH] =
127 {
128 #ifdef LCSCH
129    cmPkSchMacRlsHqReq,
130 #else
131    RgSchMacRlsHqReq
132 #endif
133 };
134
135 static const RlsRntiReq RgSchMacRlsRntiReqMt[RG_MAX_SCH] =
136 {
137 #ifdef LCSCH
138    cmPkSchMacRlsRntiReq,
139 #else
140    RgSchMacRlsRntiReq
141 #endif
142 };
143
144 static const LcgReg RgSchMacLcgRegReqMt[RG_MAX_SCH] =
145 {
146 #ifdef LCSCH
147    cmPkSchMacLcgRegReq,
148 #else
149    RgSchMacLcgRegReq
150 #endif
151 };
152
153 #ifdef LTEMAC_SPS
154 static const SpsLcReg RgSchMacSpsLcRegReqMt[RG_MAX_SCH] =
155 {
156 #ifdef LCSCH
157    cmPkSchMacSpsLcRegReq,
158 #else
159    RgSchMacSpsLcRegReq
160 #endif
161 };
162
163 static const UlSpsReset RgSchMacUlSpsResetMt[RG_MAX_SCH] =
164 {
165 #ifdef LCSCH
166    cmPkSchMacUlSpsReset,
167 #else
168    RgSchMacUlSpsResetReq
169 #endif
170 };
171
172
173
174 static const SpsLcDereg RgSchMacSpsLcDeregReqMt[RG_MAX_SCH] =
175 {
176 #ifdef LCSCH
177    cmPkSchMacSpsLcDeregReq,
178 #else
179    RgSchMacSpsLcDeregReq
180 #endif
181 };
182
183 static const SpsRelInd RgMacSchSpsRelIndMt[RG_MAX_SCH] =
184 {
185 #ifdef LCSCH
186    cmPkMacSchSpsRelInd,
187 #else
188    RgMacSchSpsRelInd
189 #endif
190 };
191
192 #endif /* LTEMAC_SPS */
193
194 #ifdef LTE_L2_MEAS
195 static const L2MeasReq RgSchMacL2MeasReqMt[RG_MAX_SCH] =
196 {
197 #ifdef LCSCH
198    cmPkSchMacL2MeasReq
199 #else
200    RgSchMacL2MeasReq
201 #endif
202 };
203 /*Added for Rsys oam*/
204 static const L2MeasStopReq RgSchMacL2MeasStopReqMt[RG_MAX_SCH] =
205 {
206 #ifdef LCSCH
207    cmPkSchMacL2MeasStopReq
208 #else
209    RgSchMacL2MeasStopReq
210 #endif
211 };
212
213 static const L2MeasSendReq RgSchMacL2MeasSendReqMt[RG_MAX_SCH] =
214 {
215 #ifdef LCSCH
216    cmPkSchMacL2MeasSendReq
217 #else
218    RgSchMacL2MeasSendReq
219 #endif
220 };
221
222 static const L2MeasCfm RgMacSchL2MeasCfmMt[RG_MAX_SCH] =
223 {
224 #ifdef LCSCH
225    cmPkMacSchL2MeasCfm
226 #else
227    RgMacSchL2MeasCfm
228 #endif
229 };
230 static const L2MeasStopCfm RgMacSchL2MeasStopCfmMt[RG_MAX_SCH] =
231 {
232 #ifdef LCSCH
233    cmPkMacSchL2MeasStopCfm
234 #else
235    RgMacSchL2MeasStopCfm
236 #endif
237 };
238 #endif/*LTE_L2_MEAS*/
239 /**
240 * @brief Data Indication from MAC to RLC to 
241  * forward the data received for dedicated channels
242 *
243 * @details
244 *
245 *     Function : RgSchMacCellReg
246 *
247 *  @param[in]   Pst*  pst
248 *  @param[in]   SuId  suId
249 *  @param[in]   RguDDatIndInfo  *  datInd
250 *  @return   S16
251 *      -# ROK
252 **/
253 S16 RgSchMacCellReg(Pst* pst,RgInfCellReg* regReq)
254 {
255
256    return ((*RgSchMacCellRegReqMt[0])(pst, regReq));
257 }
258
259 /**
260 * @brief Data Indication from MAC to RLC to 
261  * forward the data received for dedicated channels
262 *
263 * @details
264 *
265 *     Function : RgMacSchDedBoUpdt
266 *
267 *  @param[in]   Pst*  pst
268 *  @param[in]   SuId  suId
269 *  @param[in]   RguDDatIndInfo  *  datInd
270 *  @return   S16
271 *      -# ROK
272 **/
273 S16 RgMacSchDedBoUpdt(Pst* pst,RgInfDedBoRpt*  boRpt)
274 {
275
276    return ((*RgMacSchDedBoUpdtReqMt[0])(pst, boRpt));
277 }
278
279 /**
280 * @brief Data Indication from MAC to RLC to 
281  * forward the data received for dedicated channels
282 *
283 * @details
284 *
285 *     Function : RgMacSchCmnBoUpdt
286 *
287 *  @param[in]   Pst*  pst
288 *  @param[in]   SuId  suId
289 *  @param[in]   RguDDatIndInfo  *  datInd
290 *  @return   S16
291 *      -# ROK
292 **/
293 S16 RgMacSchCmnBoUpdt(Pst* pst ,RgInfCmnBoRpt*  boRpt)
294 {
295
296    return ((*RgMacSchCmnBoUpdtReqMt[0])(pst, boRpt));
297 }
298
299 /*Fix: start: Inform UE delete to scheduler*/
300 /**
301 * @brief This primitive is used to indicate deletion of UE
302 *        at MAC to scheduler. 
303 *
304 * @details
305 *
306 *     Function : RgMacSchUeDel
307 *
308 *  @param[in]   Pst*  pst
309 *  @param[in]   RgInfSfDatInd*  ueDelInd 
310 *  @return   S16
311 *      -# ROK
312 **/
313 S16 RgMacSchUeDel(Pst* pst,RgInfUeDelInd*  ueDelInd)
314 {
315
316    return ((*RgMacSchUeDelIndMt[0])(pst, ueDelInd));
317 }
318 /*Fix: end: Inform UE delete to scheduler*/
319 /**
320 * @brief Data Indication from MAC to RLC to 
321  * forward the data received for dedicated channels
322 *
323 * @details
324 *
325 *     Function : RgMacSchSfRecp
326 *
327 *  @param[in]   Pst*  pst
328 *  @param[in]   SuId  suId
329 *  @param[in]   RguDDatIndInfo  *  datInd
330 *  @return   S16
331 *      -# ROK
332 **/
333 S16 RgMacSchSfRecp(Pst* pst,RgInfSfDatInd*  datInd)
334 {
335
336    return ((*RgMacSchSfRecpIndMt[0])(pst, datInd));
337 }
338
339 /**
340 * @brief Data Indication from MAC to RLC to 
341  * forward the data received for dedicated channels
342 *
343 * @details
344 *
345 *     Function : RgSchMacSfAlloc
346 *
347 *  @param[in]   Pst*  pst
348 *  @param[in]   SuId  suId
349 *  @param[in]   RguDDatIndInfo  *  datInd
350 *  @return   S16
351 *      -# ROK
352 **/
353 S16 RgSchMacSfAlloc(Pst* pst,RgInfSfAlloc* resAllocReq)
354 {
355
356    return ((*RgSchMacSfAllocReqMt[0])(pst, resAllocReq));
357 }
358
359 /**
360 * @brief Trigger for resetting Harq Entity at MAC
361 *
362 * @details
363 *
364 *     Function : RgSchMacRstHqEnt
365 *
366 *  @param[in]   Pst*  pst
367 *  @param[in]   RgInfResetHqEnt *hqEntRstReq
368 *  @return   S16
369 *      -# ROK
370 **/
371 S16 RgSchMacRstHqEnt(Pst* pst,RgInfResetHqEnt*  hqEntInfo)
372 {
373
374    return ((*RgSchMacRstHqEntReqMt[0])(pst, hqEntInfo));
375 }
376
377 /**
378 * @brief Data Indication from MAC to RLC to 
379  * forward the data received for dedicated channels
380 *
381 * @details
382 *
383 *     Function : RgSchMacRlsHq
384 *
385 *  @param[in]   Pst*  pst
386 *  @param[in]   SuId  suId
387 *  @param[in]   RguDDatIndInfo  *  datInd
388 *  @return   S16
389 *      -# ROK
390 **/
391 S16 RgSchMacRlsHq(Pst* pst,RgInfRlsHqInfo* sfHqInfo)
392 {
393
394    return ((*RgSchMacRlsHqReqMt[0])(pst, sfHqInfo));
395 }
396
397 /**
398 * @brief Data Indication from MAC to RLC to 
399  * forward the data received for dedicated channels
400 *
401 * @details
402 *
403 *     Function : RgSchMacRlsRnti
404 *
405 *  @param[in]   Pst*  pst
406 *  @param[in]   SuId  suId
407 *  @param[in]   RguDDatIndInfo  *  datInd
408 *  @return   S16
409 *      -# ROK
410 **/
411 S16 RgSchMacRlsRnti(Pst* pst,RgInfRlsRnti*   rlsRnti)
412 {
413
414    return ((*RgSchMacRlsRntiReqMt[0])(pst, rlsRnti));
415 }
416
417 /**
418 * @brief Request from SCH to MAC to register the GBR LCG of a UE
419 *
420 * @details
421 *
422 *     Function : RgSchMacLcgReg
423 *
424 *  @param[in]   Pst*           pst
425 *  @param[in]   RgInfLcgRegReq *lcgRegReq
426 *  @return   S16
427 *      -# ROK
428 **/
429 S16 RgSchMacLcgReg(Pst*  pst,RgInfLcgRegReq *lcgRegReq)
430 {
431
432    return ((*RgSchMacLcgRegReqMt[0])(pst, lcgRegReq));
433 } /* end of RgSchMacLcgReg */
434
435 #ifdef LTEMAC_SPS
436 /**
437 * @brief Data Indication from MAC to SCH to 
438  * indicate the arrival of the data on SPS logical channels
439 *
440 * @details
441 *
442 *     Function : RgMacSchSpsRel
443 *
444 *  @param[in]   Pst*  pst
445 *  @param[in]   RgInfSpsRelInfo* relInfo
446 *  @return   S16
447 *      -# ROK
448 **/
449 S16 RgMacSchSpsRel(Pst* pst,RgInfSpsRelInfo* relInfo)
450 {
451
452    return ((*RgMacSchSpsRelIndMt[0])(pst, relInfo));
453 } /* end of RgMacSchSpsRel */
454
455 /**
456 * @brief Request from SCH to MAC to register the SPS logical channels of a UE
457 *
458 * @details
459 *
460 *     Function : RgSchMacSpsLcReg
461 *
462 *  @param[in]   Pst*           pst
463 *  @param[in]   RgInfSpsLcInfo *lcInfo
464 *  @return   S16
465 *      -# ROK
466 **/
467 S16 RgSchMacSpsLcReg(Pst* pst,RgInfSpsLcInfo *lcInfo)
468 {
469
470    return ((*RgSchMacSpsLcRegReqMt[0])(pst, lcInfo));
471 } /* end of RgSchMacSpsLcReg */
472
473
474
475 /**
476 * @brief Request from SCH to MAC to reset UL SPS params
477 *
478 * @details
479 *
480 *     Function : RgSchMacUlSpsReset
481 *
482 *  @param[in]   Pst*           pst
483 *  @param[in]   RgInfUlSpsReset *lcInfo
484 *  @return   S16
485 *      -# ROK
486 **/
487 S16 RgSchMacUlSpsReset(Pst*  pst,RgInfUlSpsReset *ulSpsResetInfo)
488 {
489
490    return ((*RgSchMacUlSpsResetMt[0])(pst, ulSpsResetInfo));
491 } /* end of RgSchMacUlSpsReset */
492
493
494
495 /**
496 * @brief Request from SCH to MAC to deregister the SPS logical channels of a UE
497 *
498 * @details
499 *
500 *     Function : RgSchMacSpsLcDereg
501 *
502 *  @param[in]   Pst*           pst
503 *  @param[in]   RgInfSpsLcInfo *lcInfo
504 *  @return   S16
505 *      -# ROK
506 **/
507 S16 RgSchMacSpsLcDereg(Pst* pst,CmLteCellId  cellId,CmLteRnti crnti)
508 {
509
510    return ((*RgSchMacSpsLcDeregReqMt[0])(pst, cellId, crnti));
511 } /* end of RgSchMacSpsLcDereg */
512
513 #endif /* LTEMAC_SPS */
514 #ifdef LTE_L2_MEAS
515 /**
516 * @brief Request from SCH to MAC for L2 Measurement
517 *
518 * @details
519 *
520 *     Function : RgSchMacL2Meas
521 *
522 *  @param[in]   Pst*           pst
523 *  @param[in]   RgInfL2MeasReq *measInfo
524 *  @return   S16
525 *      -# ROK
526 **/
527 S16 RgSchMacL2Meas(Pst* pst,RgInfL2MeasReq  *measInfo)
528 {
529
530    return ((*RgSchMacL2MeasReqMt[0])(pst, measInfo));
531 } /* end of RgSchMacL2Meas */
532
533 /**
534 * @brief Request from SCH to MAC for Stopping L2 Measurement
535 *
536 * @details
537 *
538 *     Function : RgSchMacL2MeasStop
539 *     
540 *  @param[in]   Pst*           pst
541 *  @param[in]   RgInfL2MeasReq *measInfo
542 *  @return   S16
543 *      -# ROK
544 **/   
545 S16 RgSchMacL2MeasStop(Pst* pst,RgInfL2MeasStopReq *measInfo)     
546 {  
547      
548    return ((*RgSchMacL2MeasStopReqMt[0])(pst, measInfo));
549 } /* end of RgSchMacL2Meas */
550
551 /**
552 * @brief Request from SCH to MAC for Sending L2 Measurement
553 *
554 * @details
555 *
556 *     Function : RgSchMacL2MeasSend
557 *     
558 *  @param[in]   Pst*           pst
559 *  @param[in]   RgInfL2MeasReq *measInfo
560 *  @return   S16
561 *      -# ROK
562 **/
563 S16 RgSchMacL2MeasSend(Pst* pst,RgInfL2MeasSndReq *measInfo)
564 {
565
566    return ((*RgSchMacL2MeasSendReqMt[0])(pst, measInfo));
567 } /* end of RgSchMacL2MeasSend */
568
569 /**
570 * @brief Request from MAC to SCH for L2 Measurement
571 *
572 * @details
573 *
574 *     Function : RgMacSchL2Meas
575 *
576 *  @param[in]   Pst*           pst
577 *  @param[in]   RgInfL2MeasCfm *measInfo
578 *  @return   S16
579 *      -# ROK
580 **/
581 S16 RgMacSchL2Meas(Pst*  pst,RgInfL2MeasCfm *measInfo)
582 {
583
584    return ((*RgMacSchL2MeasCfmMt[0])(pst, measInfo));
585 } /* end of RgSchMacL2Meas */
586 /**
587 * @brief Request from MAC to SCH for L2 Measurement
588 *  
589 * @details
590 *
591 *     Function : RgMacSchL2MeasStop
592 *
593 *  @param[in]   Pst*           pst
594 *  @param[in]   RgInfL2MeasCfm *measInfo
595 *  @return   S16
596 *      -# ROK
597 **/
598 S16 RgMacSchL2MeasStop(Pst*  pst,RgInfL2MeasCfm  *measInfo)
599 {
600     
601    return ((*RgMacSchL2MeasStopCfmMt[0])(pst, measInfo));
602 } /* end of RgSchMacL2MeasStop*/
603 #endif/*LTE_L2_MEAS*/
604 /**********************************************************************
605  
606          End of file
607 **********************************************************************/