Merge "O-DU High Architecture updated"
[o-du/l2.git] / src / 5gnrmac / rg_ptli.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 Entry point fucntions
26   
27      File:     rg_ptli.c
28   
29 **********************************************************************/
30
31 /** @file rg_dhm.c
32 @brief APIs related to Downlink HARQ.
33 */
34
35 /* header include files (.h) */
36 #include "common_def.h"
37 #include "tfu.h"           /* RGU Interface defines */
38
39 /* header/extern include files (.x) */
40 #include "tfu.x"           /* RGU Interface includes */
41
42
43 #ifdef __cplusplus
44 extern "C" {
45 #endif /* __cplusplus */
46
47 #if !(defined(LCRGLITFU)  && defined(TF) && defined(LWLCRGLITFU))
48 #define PTRGLITFU
49 #endif
50
51
52 /* MAX Number of Service Providers of RG */
53 #define RG_MAX_TFU_PROV   3
54
55 #ifdef PTRGLITFU
56 /** @brief This API is used to send a Bind Request from MAC to PHY.
57  * @param pst Pointer to the post structure.
58  * @param suId SAP ID of the service user.
59  * @param spId SAP ID of the service provider.
60  * @return ROK/RFAILED
61  */
62 S16 PtLiTfuBndReq ARGS((Pst * pst, SuId suId, SpId spId));
63 /** @brief This API is used to send a Bind Request from Scheduler to PHY.
64  * @param pst Pointer to the post structure.
65  * @param suId SAP ID of the service user.
66  * @param spId SAP ID of the service provider.
67  * @return ROK/RFAILED
68  */
69 S16 PtLiTfuSchBndReq ARGS((Pst * pst, SuId suId, SpId spId));
70 /** @brief This API is used to send an Unbind Request from MAC to PHY.
71  * @param pst Pointer to the post structure.
72  * @param suId SAP ID of the service provider.
73  * @param reason Reason for Unbind request.
74  * @return ROK/RFAILED
75  */
76 S16 PtLiTfuUbndReq ARGS((Pst * pst, SpId spId, Reason reason));
77 /** @brief This API is used to send an Unbind Request from Scheduler to PHY.
78  * @param pst Pointer to the post structure.
79  * @param suId SAP ID of the service provider.
80  * @param reason Reason for Unbind request.
81  * @return ROK/RFAILED
82  */
83 S16 PtLiTfuSchUbndReq ARGS((Pst * pst, SpId spId, Reason reason));
84 /** @brief This primitive is sent from Scheduler to PHY.
85  * @details This primitive provides PHY with all the information required by 
86  * PHY to decode transmissions from the UE on either PUCCH or PUSCH.
87  * -# On PUCCH UE can transmit the following
88  *    -# SR
89  *    -# HARQ feedback
90  *    -# CQI report
91  *    -# HARQ + CQI
92  *    -# HARQ + SR
93  * -# On PUSCH UE can transmit the following
94  *    -# Data
95  *    -# Data + CQI
96  *    -# Data + HARQ Feedback
97  * This primitive carries all the information for the expected subframe for all
98  * the UEs that have been scheduled to transmit.
99  * @param pst Pointer to the post structure.
100  * @param spId SAP ID of the service provider.
101  * @param recpReq Pointer to the TfuRecpReqInfo structure.
102  * @return ROK/RFAILED
103  */
104 S16 PtLiTfuRecpReq ARGS((Pst * pst, SpId spId, TfuRecpReqInfo * recpReq));
105 /** @brief This Primitive is sent from Scheduler to PHY. It provides PHY with
106   * all the control information
107   * @details This primitive carries the information sent on the following
108   * channels - 
109   * -# PDCCH
110   * -# PHICH
111   * -# PCFICH
112   * 
113   * @param pst
114   * @param spId
115   * @param cntrlReq pointer to TfuCntrlReqInfo
116   * @return ROK/RFAILED
117   */
118 S16 PtLiTfuCntrlReq ARGS((Pst * pst, SpId spId, TfuCntrlReqInfo * cntrlReq));
119 /** @brief This Primitive carries the Data PDUs from MAC to PHY for
120   * transmission. 
121   * @details The data being sent in this primitive is meant to be transmitted on
122   * the downlink channel PDSCH and PBCH (if present). To facilitate physical
123   * layer processing, requisite control information is also sent along with the
124   * data. 
125   * @sa TfUiTfuCntrlReq
126   * @param pst 
127   * @param spId
128   * @param tfuDatReq pointer to TfuDatReqInfo
129   * @return 
130   */
131 S16 PtLiTfuDatReq ARGS((Pst * pst, SpId spId, TfuDatReqInfo * datReq));
132 #ifdef L2_OPTMZ
133 /** @brief This Primitive carries cellId and UeId for which datReq need to be deleted.
134   * @details This primitive is used to send delDatReq to CL to delete the PDUs of
135   * UE which has been deleted in MAC due to ueId change or anyother scenario
136   * @details The data being sent in this primitive is meant to be transmitted on
137   * @sa TfUiTfuDelDatReq
138   * @param pst
139   * @param spId
140   * @param tfuDelDatReq pointer to TfuDelDatReqInfo
141   * @return
142  */
143 S16 PtLiTfuDelDatReq ARGS((Pst * pst, SpId spId, TfuDelDatReqInfo * datReq));
144 #endif /*L2_OPTMZ*/
145 #endif /*--#ifdef PTRGLITFU--*/
146
147 #ifdef L2_OPTMZ
148 /** @brief This Primitive carries cellId and UeId for which datReq need to be deleted. 
149   * @details This primitive is used to send delDatReq to CL to delete the PDUs of 
150   * UE which has been deleted in MAC due to ueId change or anyother scenario
151   * NOTE:: This API is only supported for TC because race condition issue
152   *        happens only in case of TC
153   * @sa TfUiTfuDelDatReq
154   * @param pst 
155   * @param spId
156   * @param tfuDelDatReq pointer to TfuDelDatReqInfo
157   * @return 
158   */
159 static const TfuDelDatReq RgLiTfuDelDatReqMt[RG_MAX_TFU_PROV] =
160 {
161 #ifdef LCRGLITFU
162    PtLiTfuDelDatReq, /*calling dummy api as LC not required for this privitive*/
163 #else
164    PtLiTfuDelDatReq,
165 #endif
166 #ifdef TF
167    TfUiTfuDelDatReq,
168 #else
169    PtLiTfuDelDatReq,
170 #endif
171 #ifdef LWLCRGLITFU
172    PtLiTfuDelDatReq, /*calling dummy api as LWLC not required for this privitive*/
173 #else
174    PtLiTfuDelDatReq
175 #endif
176 };
177 #endif /* L2_OPTMZ*/
178
179 #ifdef RG
180
181
182 #ifdef L2_OPTMZ
183 \f
184 /***********************************************************
185 *
186 *     Func : RgLiTfuDelDatReq
187 *
188 *
189 *     Desc : This Primitive is used to delete datReq in CL when there is ueId change. 
190   * @details: This primitive is required when L2_OPMZ flag is elabed. this is required
191   *           To delete datRq PDUs from CL for the Ue for which Ue Id got changed or
192   *           anyother similar scenario
193   * @sa TfUiTfuDelDatReq
194   * @param pst 
195   * @param spId
196   * @param tfuDelDatReq pointer to TfuDelDatReqInfo
197   * @return
198 *
199 *
200 *     Ret  : S16
201 *
202 *     Notes:
203 *
204 *     File  : 
205 *
206 **********************************************************/
207 #ifdef ANSI
208 S16 RgLiTfuDelDatReq
209 (
210 Pst * pst,
211 SpId spId,
212 TfuDelDatReqInfo * delDatReq
213 )
214 #else
215 S16 RgLiTfuDelDatReq(pst, spId, delDatReq)
216 Pst * pst;
217 SpId spId;
218 TfuDelDatReqInfo * delDatReq;
219 #endif
220 {
221
222    return ((*RgLiTfuDelDatReqMt[pst->selector])(pst, spId, delDatReq));
223
224 }
225 #endif /* L2_OPTMZ*/
226
227 #endif /*--ifdef RG--*/
228
229 #ifdef PTRGLITFU
230
231
232 \f
233 /***********************************************************
234 *
235 *     Func : PtLiTfuBndReq
236 *
237 *
238 *     Desc : This API is used to send a Bind Request from MAC to PHY.
239  * @param pst Pointer to the post structure.
240  * @param suId SAP ID of the service user.
241  * @param spId SAP ID of the service provider.
242  * @return ROK/RFAILED
243 *
244 *
245 *     Ret  : S16
246 *
247 *     Notes:
248 *
249 *     File  : 
250 *
251 **********************************************************/
252 #ifdef ANSI
253 S16 PtLiTfuBndReq
254 (
255 Pst * pst,
256 SuId suId,
257 SpId spId
258 )
259 #else
260 S16 PtLiTfuBndReq(pst, suId, spId)
261 Pst * pst;
262 SuId suId;
263 SpId spId;
264 #endif
265 {
266
267
268    UNUSED(pst);
269    UNUSED(suId);
270    UNUSED(spId);
271
272    return ROK;
273
274 }
275
276
277 \f
278 /***********************************************************
279 *
280 *     Func : PtLiTfuSchBndReq
281 *
282 *
283 *     Desc : This API is used to send a Bind Request from Scheduler to PHY.
284  * @param pst Pointer to the post structure.
285  * @param suId SAP ID of the service user.
286  * @param spId SAP ID of the service provider.
287  * @return ROK/RFAILED
288 *
289 *
290 *     Ret  : S16
291 *
292 *     Notes:
293 *
294 *     File  : 
295 *
296 **********************************************************/
297 #ifdef ANSI
298 S16 PtLiTfuSchBndReq
299 (
300 Pst * pst,
301 SuId suId,
302 SpId spId
303 )
304 #else
305 S16 PtLiTfuSchBndReq(pst, suId, spId)
306 Pst * pst;
307 SuId suId;
308 SpId spId;
309 #endif
310 {
311
312    UNUSED(pst);
313    UNUSED(suId);
314    UNUSED(spId);
315
316    return ROK;
317
318 }
319
320
321 \f
322 /***********************************************************
323 *
324 *     Func : PtLiTfuUbndReq
325 *
326 *
327 *     Desc : This API is used to send an Unbind Request from MAC to PHY.
328  * @param pst Pointer to the post structure.
329  * @param suId SAP ID of the service provider.
330  * @param reason Reason for Unbind request.
331  * @return ROK/RFAILED
332 *
333 *
334 *     Ret  : S16
335 *
336 *     Notes:
337 *
338 *     File  : 
339 *
340 **********************************************************/
341 #ifdef ANSI
342 S16 PtLiTfuUbndReq
343 (
344 Pst * pst,
345 SpId spId,
346 Reason reason
347 )
348 #else
349 S16 PtLiTfuUbndReq(pst, spId, reason)
350 Pst * pst;
351 SpId spId;
352 Reason reason;
353 #endif
354 {
355
356    UNUSED(pst);
357    UNUSED(spId);
358    UNUSED(reason);
359
360    return ROK;
361
362 }
363
364
365 \f
366 /***********************************************************
367 *
368 *     Func : PtLiTfuSchUbndReq
369 *
370 *
371 *     Desc : This API is used to send an Unbind Request from Scheduler to PHY.
372  * @param pst Pointer to the post structure.
373  * @param suId SAP ID of the service provider.
374  * @param reason Reason for Unbind request.
375  * @return ROK/RFAILED
376 *
377 *
378 *     Ret  : S16
379 *
380 *     Notes:
381 *
382 *     File  : 
383 *
384 **********************************************************/
385 #ifdef ANSI
386 S16 PtLiTfuSchUbndReq
387 (
388 Pst * pst,
389 SpId spId,
390 Reason reason
391 )
392 #else
393 S16 PtLiTfuSchUbndReq(pst, spId, reason)
394 Pst * pst;
395 SpId spId;
396 Reason reason;
397 #endif
398 {
399
400    UNUSED(pst);
401    UNUSED(spId);
402    UNUSED(reason);
403
404    return ROK;
405
406 }
407
408
409 \f
410 /***********************************************************
411 *
412 *     Func : PtLiTfuRecpReq
413 *
414 *
415 *     Desc : This primitive is sent from Scheduler to PHY.
416  * @details This primitive provides PHY with all the information required by 
417  * PHY to decode transmissions from the UE on either PUCCH or PUSCH.
418  * -# On PUCCH UE can transmit the following
419  *    -# SR
420  *    -# HARQ feedback
421  *    -# CQI report
422  *    -# HARQ + CQI
423  *    -# HARQ + SR
424  * -# On PUSCH UE can transmit the following
425  *    -# Data
426  *    -# Data + CQI
427  *    -# Data + HARQ Feedback
428  * This primitive carries all the information for the expected subframe for all
429  * the UEs that have been scheduled to transmit.
430  * @param pst Pointer to the post structure.
431  * @param spId SAP ID of the service provider.
432  * @param recpReq Pointer to the TfuRecpReqInfo structure.
433  * @return ROK/RFAILED
434 *
435 *
436 *     Ret  : S16
437 *
438 *     Notes:
439 *
440 *     File  : 
441 *
442 **********************************************************/
443 #ifdef ANSI
444 S16 PtLiTfuRecpReq
445 (
446 Pst * pst,
447 SpId spId,
448 TfuRecpReqInfo * recpReq
449 )
450 #else
451 S16 PtLiTfuRecpReq(pst, spId, recpReq)
452 Pst * pst;
453 SpId spId;
454 TfuRecpReqInfo * recpReq;
455 #endif
456 {
457
458    UNUSED(pst);
459    UNUSED(spId);
460    UNUSED(recpReq);
461
462    return ROK;
463
464 }
465
466
467 \f
468 /***********************************************************
469 *
470 *     Func : PtLiTfuCntrlReq
471 *
472 *
473 *     Desc : This Primitive is sent from Scheduler to PHY. It provides PHY with
474   * all the control information
475   * @details This primitive carries the information sent on the following
476   * channels - 
477   * -# PDCCH
478   * -# PHICH
479   * -# PCFICH
480   * 
481   * @param pst
482   * @param spId
483   * @param cntrlReq pointer to TfuCntrlReqInfo
484   * @return ROK/RFAILED
485 *
486 *
487 *     Ret  : S16
488 *
489 *     Notes:
490 *
491 *     File  : 
492 *
493 **********************************************************/
494 #ifdef ANSI
495 S16 PtLiTfuCntrlReq
496 (
497 Pst * pst,
498 SpId spId,
499 TfuCntrlReqInfo * cntrlReq
500 )
501 #else
502 S16 PtLiTfuCntrlReq(pst, spId, cntrlReq)
503 Pst * pst;
504 SpId spId;
505 TfuCntrlReqInfo * cntrlReq;
506 #endif
507 {
508
509    UNUSED(pst);
510    UNUSED(spId);
511    UNUSED(cntrlReq);
512
513    return ROK;
514
515 }
516
517
518 \f
519 /***********************************************************
520 *
521 *     Func : PtLiTfuDatReq
522 *
523 *
524 *     Desc : This Primitive carries the Data PDUs from MAC to PHY for
525   * transmission. 
526   * @details The data being sent in this primitive is meant to be transmitted on
527   * the downlink channel PDSCH and PBCH (if present). To facilitate physical
528   * layer processing, requisite control information is also sent along with the
529   * data. 
530   * @sa TfUiTfuCntrlReq
531   * @param pst 
532   * @param spId
533   * @param tfuDatReq pointer to TfuDatReqInfo
534   * @return
535 *
536 *
537 *     Ret  : S16
538 *
539 *     Notes:
540 *
541 *     File  : 
542 *
543 **********************************************************/
544 #ifdef ANSI
545 S16 PtLiTfuDatReq
546 (
547 Pst * pst,
548 SpId spId,
549 TfuDatReqInfo * datReq
550 )
551 #else
552 S16 PtLiTfuDatReq(pst, spId, datReq)
553 Pst * pst;
554 SpId spId;
555 TfuDatReqInfo * datReq;
556 #endif
557 {
558
559    UNUSED(pst);
560    UNUSED(spId);
561    UNUSED(datReq);
562
563    return ROK;
564
565 }
566
567 \f
568 #ifdef L2_OPTMZ
569 /***********************************************************
570 *
571 *     Func : PtLiTfuDelDatReq
572 *
573 *
574 *   @brief This Primitive carries cellId and UeId for which datReq need to be deleted.
575   * @details This primitive is used to send delDatReq to CL to delete the PDUs of
576     * UE which has been deleted in MAC due to ueId change or anyother scenario
577     
578   * @details The data being sent in this primitive is meant to be transmitted on
579   * @sa TfUiTfuDelDatReq
580   * @param pst 
581   * @param spId
582   * @param tfuDelDatReq pointer to TfuDelDatReqInfo
583   * @return
584 *
585 *
586 *     Ret  : S16
587 *
588 *     Notes:
589 *
590 *     File  : 
591 *
592 **********************************************************/
593 #ifdef ANSI
594 S16 PtLiTfuDelDatReq
595 (
596 Pst * pst,
597 SpId spId,
598 TfuDelDatReqInfo * delDatReq
599 )
600 #else
601 S16 PtLiTfuDelDatReq(pst, spId, delDatReq)
602 Pst * pst;
603 SpId spId;
604 TfuDelDatReqInfo * DelDatReq;
605 #endif
606 {
607
608    UNUSED(pst);
609    UNUSED(spId);
610    UNUSED(delDatReq);
611
612    return ROK;
613
614 }
615 #endif /*L2_OPTMZ*/
616
617 #endif /*--ifdef PTRGLITFU--*/
618
619 #ifdef __cplusplus
620 }
621 #endif /* __cplusplus */
622 \f
623 /**********************************************************************
624  
625          End of file
626 **********************************************************************/