[Epic-ID: ODUHIGH-464][Task-ID: ODUHIGH-483] Memeory related fix in FDD and TDD mode
[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 S16 RgLiTfuDelDatReq
208 (
209 Pst * pst,
210 SpId spId,
211 TfuDelDatReqInfo * delDatReq
212 )
213 {
214
215    return ((*RgLiTfuDelDatReqMt[pst->selector])(pst, spId, delDatReq));
216
217 }
218 #endif /* L2_OPTMZ*/
219
220 #endif /*--ifdef RG--*/
221
222 #ifdef PTRGLITFU
223
224
225 \f
226 /***********************************************************
227 *
228 *     Func : PtLiTfuBndReq
229 *
230 *
231 *     Desc : This API is used to send a Bind Request from MAC to PHY.
232  * @param pst Pointer to the post structure.
233  * @param suId SAP ID of the service user.
234  * @param spId SAP ID of the service provider.
235  * @return ROK/RFAILED
236 *
237 *
238 *     Ret  : S16
239 *
240 *     Notes:
241 *
242 *     File  : 
243 *
244 **********************************************************/
245 S16 PtLiTfuBndReq
246 (
247 Pst * pst,
248 SuId suId,
249 SpId spId
250 )
251 {
252
253    UNUSED(pst);
254    UNUSED(suId);
255    UNUSED(spId);
256
257    return ROK;
258
259 }
260
261
262 \f
263 /***********************************************************
264 *
265 *     Func : PtLiTfuSchBndReq
266 *
267 *
268 *     Desc : This API is used to send a Bind Request from Scheduler to PHY.
269  * @param pst Pointer to the post structure.
270  * @param suId SAP ID of the service user.
271  * @param spId SAP ID of the service provider.
272  * @return ROK/RFAILED
273 *
274 *
275 *     Ret  : S16
276 *
277 *     Notes:
278 *
279 *     File  : 
280 *
281 **********************************************************/
282 S16 PtLiTfuSchBndReq
283 (
284 Pst * pst,
285 SuId suId,
286 SpId spId
287 )
288 {
289
290    UNUSED(pst);
291    UNUSED(suId);
292    UNUSED(spId);
293
294    return ROK;
295
296 }
297
298
299 \f
300 /***********************************************************
301 *
302 *     Func : PtLiTfuUbndReq
303 *
304 *
305 *     Desc : This API is used to send an Unbind Request from MAC to PHY.
306  * @param pst Pointer to the post structure.
307  * @param suId SAP ID of the service provider.
308  * @param reason Reason for Unbind request.
309  * @return ROK/RFAILED
310 *
311 *
312 *     Ret  : S16
313 *
314 *     Notes:
315 *
316 *     File  : 
317 *
318 **********************************************************/
319 S16 PtLiTfuUbndReq
320 (
321 Pst * pst,
322 SpId spId,
323 Reason reason
324 )
325 {
326
327    UNUSED(pst);
328    UNUSED(spId);
329    UNUSED(reason);
330
331    return ROK;
332
333 }
334
335
336 \f
337 /***********************************************************
338 *
339 *     Func : PtLiTfuSchUbndReq
340 *
341 *
342 *     Desc : This API is used to send an Unbind Request from Scheduler to PHY.
343  * @param pst Pointer to the post structure.
344  * @param suId SAP ID of the service provider.
345  * @param reason Reason for Unbind request.
346  * @return ROK/RFAILED
347 *
348 *
349 *     Ret  : S16
350 *
351 *     Notes:
352 *
353 *     File  : 
354 *
355 **********************************************************/
356 S16 PtLiTfuSchUbndReq
357 (
358 Pst * pst,
359 SpId spId,
360 Reason reason
361 )
362 {
363
364    UNUSED(pst);
365    UNUSED(spId);
366    UNUSED(reason);
367
368    return ROK;
369
370 }
371
372
373 \f
374 /***********************************************************
375 *
376 *     Func : PtLiTfuRecpReq
377 *
378 *
379 *     Desc : This primitive is sent from Scheduler to PHY.
380  * @details This primitive provides PHY with all the information required by 
381  * PHY to decode transmissions from the UE on either PUCCH or PUSCH.
382  * -# On PUCCH UE can transmit the following
383  *    -# SR
384  *    -# HARQ feedback
385  *    -# CQI report
386  *    -# HARQ + CQI
387  *    -# HARQ + SR
388  * -# On PUSCH UE can transmit the following
389  *    -# Data
390  *    -# Data + CQI
391  *    -# Data + HARQ Feedback
392  * This primitive carries all the information for the expected subframe for all
393  * the UEs that have been scheduled to transmit.
394  * @param pst Pointer to the post structure.
395  * @param spId SAP ID of the service provider.
396  * @param recpReq Pointer to the TfuRecpReqInfo structure.
397  * @return ROK/RFAILED
398 *
399 *
400 *     Ret  : S16
401 *
402 *     Notes:
403 *
404 *     File  : 
405 *
406 **********************************************************/
407 S16 PtLiTfuRecpReq
408 (
409 Pst * pst,
410 SpId spId,
411 TfuRecpReqInfo * recpReq
412 )
413 {
414
415    UNUSED(pst);
416    UNUSED(spId);
417    UNUSED(recpReq);
418
419    return ROK;
420
421 }
422
423
424 \f
425 /***********************************************************
426 *
427 *     Func : PtLiTfuCntrlReq
428 *
429 *
430 *     Desc : This Primitive is sent from Scheduler to PHY. It provides PHY with
431   * all the control information
432   * @details This primitive carries the information sent on the following
433   * channels - 
434   * -# PDCCH
435   * -# PHICH
436   * -# PCFICH
437   * 
438   * @param pst
439   * @param spId
440   * @param cntrlReq pointer to TfuCntrlReqInfo
441   * @return ROK/RFAILED
442 *
443 *
444 *     Ret  : S16
445 *
446 *     Notes:
447 *
448 *     File  : 
449 *
450 **********************************************************/
451 S16 PtLiTfuCntrlReq
452 (
453 Pst * pst,
454 SpId spId,
455 TfuCntrlReqInfo * cntrlReq
456 )
457 {
458
459    UNUSED(pst);
460    UNUSED(spId);
461    UNUSED(cntrlReq);
462
463    return ROK;
464
465 }
466
467
468 \f
469 /***********************************************************
470 *
471 *     Func : PtLiTfuDatReq
472 *
473 *
474 *     Desc : This Primitive carries the Data PDUs from MAC to PHY for
475   * transmission. 
476   * @details The data being sent in this primitive is meant to be transmitted on
477   * the downlink channel PDSCH and PBCH (if present). To facilitate physical
478   * layer processing, requisite control information is also sent along with the
479   * data. 
480   * @sa TfUiTfuCntrlReq
481   * @param pst 
482   * @param spId
483   * @param tfuDatReq pointer to TfuDatReqInfo
484   * @return
485 *
486 *
487 *     Ret  : S16
488 *
489 *     Notes:
490 *
491 *     File  : 
492 *
493 **********************************************************/
494 S16 PtLiTfuDatReq
495 (
496 Pst * pst,
497 SpId spId,
498 TfuDatReqInfo * datReq
499 )
500 {
501
502    UNUSED(pst);
503    UNUSED(spId);
504    UNUSED(datReq);
505
506    return ROK;
507
508 }
509
510 \f
511 #ifdef L2_OPTMZ
512 /***********************************************************
513 *
514 *     Func : PtLiTfuDelDatReq
515 *
516 *
517 *   @brief This Primitive carries cellId and UeId for which datReq need to be deleted.
518   * @details This primitive is used to send delDatReq to CL to delete the PDUs of
519     * UE which has been deleted in MAC due to ueId change or anyother scenario
520     
521   * @details The data being sent in this primitive is meant to be transmitted on
522   * @sa TfUiTfuDelDatReq
523   * @param pst 
524   * @param spId
525   * @param tfuDelDatReq pointer to TfuDelDatReqInfo
526   * @return
527 *
528 *
529 *     Ret  : S16
530 *
531 *     Notes:
532 *
533 *     File  : 
534 *
535 **********************************************************/
536 S16 PtLiTfuDelDatReq
537 (
538 Pst * pst,
539 SpId spId,
540 TfuDelDatReqInfo * delDatReq
541 )
542 {
543
544    UNUSED(pst);
545    UNUSED(spId);
546    UNUSED(delDatReq);
547
548    return ROK;
549
550 }
551 #endif /*L2_OPTMZ*/
552
553 #endif /*--ifdef PTRGLITFU--*/
554
555 #ifdef __cplusplus
556 }
557 #endif /* __cplusplus */
558 \f
559 /**********************************************************************
560  
561          End of file
562 **********************************************************************/