Merge "SIB1 optional parameters, Cell start request, stop request and slot indication"
[o-du/l2.git] / src / 5gnrmac / rg_lim.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_lim.c 
28   
29 **********************************************************************/
30
31 /** @file rg_lim.c.
32 @brief It has APIs exposed by Lower Interface Modulue of MAC. It acts as an 
33 Interface handler for lower interface APIs.
34 */
35 static const char* RLOG_MODULE_NAME="MAC";
36 static int RLOG_FILE_ID=182;
37 static int RLOG_MODULE_ID=4096;
38 /* header include files -- defines (.h) */
39 #include "envopt.h"        /* environment options */
40 #include "envdep.h"        /* environment dependent */
41 #include "envind.h"        /* environment independent */
42 #include "gen.h"           /* general layer */
43 #include "ssi.h"           /* system services */
44 #include "cm5.h"           /* common timers defines */
45 #include "cm_hash.h"       /* common hash list defines */
46 #include "cm_llist.h"      /* common linked list defines */
47 #include "cm_mblk.h"       /* memory management */
48 #include "cm_tkns.h"       /* common tokens */
49 #include "cm_lte.h"       /* common tokens */
50 #include "rgu.h"           /* RGU defines */
51 #include "tfu.h"           /* RGU defines */
52 #include "lrg.h"           /* layer management defines for LTE-MAC */
53 #include "crg.h"           /* layer management defines for LTE-MAC */
54 #include "rg_sch_inf.h"           /* layer management defines for LTE-MAC */
55 #include "rg_env.h"        /* customisable defines and macros for MAC */
56 #include "rg.h"            /* defines and macros for MAC */
57 #include "du_log.h"
58
59 /* header/extern include files (.x) */
60 #include "gen.x"           /* general layer typedefs */
61 #include "ssi.x"           /* system services typedefs */
62 #include "cm5.x"           /* common timers */
63 #include "cm_hash.x"       /* common hash list */
64 #include "cm_lib.x"        /* common library */
65 #include "cm_llist.x"      /* common linked list */
66 #include "cm_mblk.x"       /* memory management */
67 #include "cm_tkns.x"       /* common tokens */
68 #include "cm_lte.x"       /* common tokens */
69 #include "rgu.x"           /* RGU types */
70 #include "tfu.x"           /* RGU types */
71 #include "lrg.x"           /* layer management typedefs for MAC */
72 #include "crg.x"           /* layer management typedefs for MAC */
73 #include "rg_sch_inf.x"    /* SCH interface typedefs */
74 #include "rg_prg.x"    /* PRG interface typedefs */
75 #include "du_app_mac_inf.h"
76 #include "rg.x"            /* typedefs for MAC */
77
78 #include "mac_sch_interface.h"
79 #include "mac_upr_inf_api.h"
80
81 /* local externs */
82 #ifdef UNUSED_FUNC
83 PRIVATE S16  rgLIMValidateSap ARGS((Inst inst,SuId suId));
84 #endif
85 PRIVATE Void rgLIMUtlFreeDatIndEvnt ARGS((TfuDatIndInfo *datInd,
86                                           Bool error));
87
88 /* function pointers for packing slot ind from mac to sch */
89 //S16 packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd);
90
91 MacSchSlotIndFunc macSchSlotIndOpts[] =
92 {
93    packMacSchSlotInd,  
94    macSchSlotInd,                                             
95    packMacSchSlotInd
96 }; 
97
98 #ifdef RG_UNUSED
99 PRIVATE Void rgLIMUtlFreeDatReqEvnt ARGS((TfuDatReqInfo *datReq,
100                                           Bool error));
101 #endif
102 /* forward references */
103
104 /**
105  * @brief This API is invoked to send TFU SAP bind request to PHY.
106  *
107  * @details
108  *
109  *     Function : rgLIMTfuBndReq
110  *      
111  *      This API is invoked to send TFU SAP bind request to PHY. It fills in 
112  *      the Pst structure, spId and suId values and invokes bind request
113  *      primitive at TFU.
114  *           
115  *  @param[in]  Inst        inst
116  *  @param[in]  SuId            suId 
117  *  @param[in]  SpId            spId
118  *  @return  S16
119  *      -# ROK 
120  *      -# RFAILED 
121  **/
122 #ifdef ANSI
123 PUBLIC S16 rgLIMTfuBndReq
124 (
125 Inst    inst,
126 SuId    suId, 
127 SpId    spId
128 )
129 #else
130 PUBLIC S16 rgLIMTfuBndReq(inst,suId, spId)
131 Inst    inst;
132 SuId    suId; 
133 SpId    spId;
134 #endif
135 {
136    S16         ret;
137    RgLowSapCb  *tfuSap;
138    Pst         pst;
139
140    TRC2(rgLIMTfuBndReq);
141
142    /* Get the lower SAP control block from the layer control block. */
143    tfuSap = &(rgCb[inst].tfuSap);
144    (Void)cmMemcpy ((U8*)&pst, (U8*)&(tfuSap->sapCfg.sapPst), sizeof(Pst));
145    if((ret = RgLiTfuBndReq (&pst, suId, spId)) != ROK)
146    {
147       RLOG0(L_ERROR,"Call to RgLiTfuBndReq() failed");
148    }
149    RETVALUE(ret);
150 }  /* rgLIMTfuBndReq */
151
152
153 /**
154  * @brief This API is invoked to send TFU SAP unbind request to PHY.
155  *
156  * @details
157  *
158  *     Function : rgLIMTfuBndReq
159  *      
160  *      This API is invoked to send TFU SAP unbind request to PHY. It fills in 
161  *      the Pst structure and spId value and invokes unbind request
162  *      primitive at TFU.
163  *           
164  *  @param[in]  Inst        inst
165  *  @param[in]  SpId            spId
166  *  @param[in]  Reason          reason 
167  *  @return  S16
168  *      -# ROK 
169  *      -# RFAILED 
170  **/
171 #ifdef ANSI
172 PUBLIC S16 rgLIMTfuUbndReq
173 (
174 Inst    inst,
175 SpId    spId, 
176 Reason  reason
177 )
178 #else
179 PUBLIC S16 rgLIMTfuUbndReq(inst,spId, reason)
180 Inst    inst;
181 SpId    spId; 
182 Reason  reason;
183 #endif
184 {
185    S16         ret;
186    RgLowSapCb  *tfuSap;
187    Pst         pst;
188
189    TRC2(rgLIMTfuUbndReq);
190
191    /* Get the lower SAP control block from the layer control block. */
192    tfuSap = &(rgCb[inst].tfuSap);
193    cmMemcpy ((U8*)&pst, (U8*)&(tfuSap->sapCfg.sapPst), sizeof(Pst));
194    if((ret = RgLiTfuUbndReq (&pst, tfuSap->sapCfg.spId, reason)) != ROK)
195    {
196       RLOG0(L_ERROR,"Call to RgLiTfuUbndReq() failed");
197    }
198    RETVALUE(ret);
199
200 }  /* rgLIMTfuUbndReq */
201
202
203 /**
204  * @brief Bind confirm API for TFU SAP 
205  *
206  * @details
207  *
208  *     Function : RgLiTfuBndCfm
209  *      
210  *      This API is invoked by PHY to confirm TFU SAP bind. 
211  *     
212  *           
213  *  @param[in]  Pst   *pst 
214  *  @param[in]  SuId  suId 
215  *  @param[in]  U8    status
216  *  @return  S16
217  *      -# ROK 
218  *      -# RFAILED 
219  **/
220 #ifdef ANSI
221 PUBLIC S16 RgLiTfuBndCfm 
222 (
223 Pst     *pst,
224 SuId    suId, 
225 U8      status
226 )
227 #else
228 PUBLIC S16 RgLiTfuBndCfm(pst, suId, status)
229 Pst     *pst; 
230 SuId    suId; 
231 U8      status;
232 #endif
233 {
234    Inst inst;
235    S16 ret;
236    RgLowSapCb  *tfuSap;
237
238    TRC3(RgLiTfuBndCfm);
239
240
241    RG_IS_INST_VALID(pst->dstInst);
242    inst = pst->dstInst - RG_INST_START;
243    /* Lets validate suId first */
244    /* CA_Change */
245    tfuSap = &(rgCb[inst].tfuSap);
246
247    if (suId != tfuSap->sapCfg.suId)
248    {
249       RLOG2(L_ERROR,"Incorrect SuId. Configured (%d) Recieved (%d)",
250             tfuSap->sapCfg.suId, suId);
251       RETVALUE(RFAILED);
252    }
253    ret = rgLMMBndCfm (pst, suId, status);
254    RETVALUE(ret);
255 }  /* RgLiTfuBndCfm */
256
257  /** @brief This function Validates the SAP information received along with the
258   * primitive from the lower layer. 
259   * Function:
260   *   Validates SAP information.
261  *  @param[in]  Inst        inst
262   * @param  suId The SAP Id
263   * @return 
264   *   -# ROK
265   *   -# RFAILED
266   */
267 #ifdef UNUSED_FUNC
268 #ifdef ANSI
269 PRIVATE S16 rgLIMValidateSap
270 (
271  Inst    inst,
272  SuId    suId
273 )
274 #else
275 PRIVATE S16 rgLIMValidateSap(inst,suId)
276  Inst    inst;
277  SuId    suId;
278 #endif
279 {
280    RgLowSapCb  *tfuSap;
281
282    TRC2(rgLIMValidateSap)
283
284    tfuSap = &(rgCb[inst].tfuSap);
285
286    /* First lets check the suId */
287    if( suId != tfuSap->sapCfg.suId)
288    {
289       RLOG2(L_ERROR,"Incorrect SuId. Configured (%d) Recieved (%d)",
290             tfuSap->sapCfg.suId, suId);
291       RETVALUE(RFAILED);
292    }
293    if (tfuSap->sapSta.sapState != LRG_BND)
294    {
295       RLOG1(L_ERROR,"Lower SAP not enabled SuId (%d)",
296             tfuSap->sapCfg.suId);
297       RETVALUE(RFAILED);
298    }
299    RETVALUE(ROK);
300 } /* end of rgLIMValidateSap */
301 #endif
302 /** @brief This function frees up the TfuDatIndInfo structure
303  *
304  * @details
305  *
306  *     Function: rgLIMUtlFreeDatIndEvnt 
307  *       - Function frees up the TfuDatIndInfo structure, in case of error it shall
308  *       free up the buffer's present in the datIndLst.
309  *
310  *         Processing steps:
311  * @param  [in] TfuDatIndInfo *datInd
312  * @param  [in] Bool          *error
313  * @return 
314  */
315 #ifdef ANSI
316 PRIVATE Void rgLIMUtlFreeDatIndEvnt 
317 (
318  TfuDatIndInfo *datInd,
319  Bool          error
320  )
321 #else
322 PRIVATE Void rgLIMUtlFreeDatIndEvnt(datInd, error)
323  TfuDatIndInfo *datInd;
324  Bool          error;
325 #endif
326 {
327
328    TfuDatInfo     *datInfo;
329    CmLList        *node;
330
331    TRC2(rgLIMUtlFreeDatIndEvnt);
332    /* Steps of freeing up the TfuDatInd.
333     * 1. loop through the datIndLst and free up all the buffers.
334     * 2. free up the whole event
335     */
336    if ((error == TRUE) && (datInd->datIndLst.count > 0))
337    {
338       node =  datInd->datIndLst.first;
339       while (node)
340       {
341          datInfo = (TfuDatInfo*)node->node;
342          RG_FREE_MSG(datInfo->mBuf);
343          node = node->next;
344       }
345    }
346    RG_FREE_MEM(datInd);
347    RETVOID;
348 } /* end of rgLIMUtlFreeDatIndEvnt*/
349
350 /**
351  * @brief Downlink data indication from PHY.
352  *
353  * @details
354  *
355  *     Function : RgLiTfuDatInd
356  *      
357  *      This API is invoked by PHY to send data indication to MAC on 
358  *      recieving data from UEs.
359  *           
360  *  @param[in]  Pst              *pst
361  *  @param[in]  SuId             suId 
362  *  @param[in]  TfuDatIndInfo    *datInd
363  *  @return  S16
364  *      -# ROK 
365  *      -# RFAILED 
366  **/
367 #ifdef ANSI
368 PUBLIC S16 RgLiTfuDatInd
369 (
370 Pst                *pst, 
371 SuId               suId, 
372 TfuDatIndInfo    *datInd
373 )
374 #else
375 PUBLIC S16 RgLiTfuDatInd(pst, suId, datInd)
376 Pst                *pst; 
377 SuId               suId; 
378 TfuDatIndInfo    *datInd;
379 #endif
380 {
381    Inst             inst;
382    S16              ret;
383    VOLATILE U32     startTime=0;
384
385    TRC3(RgLiTfuDatInd);
386
387   // printf("5GTF:: DatindRcvd\n");
388
389    RG_IS_INST_VALID(pst->dstInst);
390    inst = pst->dstInst - RG_INST_START;
391    /*starting Task*/
392    SStartTask(&startTime, PID_MAC_TFU_DATIND);
393
394 #ifndef NO_ERRCLS 
395    if ((ret = rgLIMValidateSap (inst,suId)) != ROK)
396    {
397       RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"SAP Validation failed");
398       rgLIMUtlFreeDatIndEvnt(datInd, TRUE);
399       RETVALUE(ret);
400    }
401 #endif
402    /* Now call the TOM (Tfu ownership module) primitive to process further */
403    rgCb[inst].tfuSap.sapSts.numPduRcvd += 
404                     datInd->datIndLst.count;
405    ret = rgTOMDatInd(inst,datInd);
406    /* Fix: sriky memory corruption precautions */
407    /* Free up the memory for the request structure */
408    if (ret == ROK)
409    {
410       rgLIMUtlFreeDatIndEvnt(datInd, FALSE);
411    }
412    else
413    {
414       rgLIMUtlFreeDatIndEvnt(datInd, TRUE);
415    }
416
417    /*stoping Task*/
418    SStopTask(startTime, PID_MAC_TFU_DATIND);
419
420    RETVALUE(ret);
421 }  /* RgLiTfuDatInd*/
422
423 #ifdef RG_UNUSED
424 /** @brief This function frees up the TfuDatReqInfo structure.
425  *
426  * @details
427  *
428  *     Function: rgLIMUtlFreeDatReqEvnt
429  *       - Function frees up the TfuDatReqInfo structure, in case of error it shall
430  *       free up the buffer's present in the PDUs list.
431  *
432  *         Processing steps:
433  * @param  [in] TfuDatReqInfo *datReq
434  * @param  [in] Bool          *error
435  * @return 
436  */
437 #ifdef ANSI
438 PRIVATE Void rgLIMUtlFreeDatReqEvnt
439 (
440  TfuDatReqInfo *datReq,
441  Bool          error
442  )
443 #else
444 PRIVATE Void rgLIMUtlFreeDatReqEvnt(datReq, error)
445  TfuDatReqInfo *datReq;
446  Bool          error;
447 #endif
448 {
449
450    TfuDatReqPduInfo *datInfo;
451    CmLList          *node;
452    U8               i;
453
454    TRC2(rgLIMUtlFreeDatReqEvnt);
455    /* Steps of freeing up the TfuDatReq.
456     * 1. Free the bch buffer.
457     * 2. loop through the pdus list and free up all the buffers.
458     * 3. free up the whole event
459     */
460    if (error)
461    {
462       if (datReq->bchDat.pres == PRSNT_NODEF)
463       {
464          RG_FREE_MSG(datReq->bchDat.val);
465       }
466       if (datReq->pdus.count > 0)
467       {
468          node =  datReq->pdus.first;
469          while (node)
470          {
471             datInfo = (TfuDatReqPduInfo*)node->node;
472             for (i=0; i<datInfo->nmbOfTBs; i++)
473             {
474                if (datInfo->mBuf[i] != NULLP)
475                {
476                   RG_FREE_MSG(datInfo->mBuf[i]);
477                }
478             }
479             node = node->next;
480          }
481       }
482    }
483    RG_FREE_MEM(datReq);
484    RETVOID;
485 } /* end of rgLIMUtlFreeDatReqEvnt*/
486 #endif
487 /**
488  * @brief This API is invoked to send Data to PHY.
489  *
490  * @details
491  *
492  *     Function : rgLIMTfuDatReq
493  *      
494  *      This API is invoked to send Data to PHY. It 
495  *      fills in the Pst structure, spId value and invokes Data
496  *      request primitive at TFU.
497  *           
498  *  @param[in]  Inst        inst
499  *  @param[in]  TfuDatReqInfo *datReq
500  *  @return  S16
501  *      -# ROK 
502  *      -# RFAILED 
503  **/
504 #ifdef ANSI
505 PUBLIC S16 rgLIMTfuDatReq 
506 (
507 Inst          inst,
508 TfuDatReqInfo *datReq
509 )
510 #else
511 PUBLIC S16 rgLIMTfuDatReq(inst,datReq)
512 Inst          inst;
513 TfuDatReqInfo *datReq;
514 #endif
515 {
516    S16         ret;
517    RgLowSapCb  *tfuSap;
518
519    TRC2(rgLIMTfuDatReq)
520
521    /* Get the lower SAP control block from the layer control block. */
522    tfuSap = &(rgCb[inst].tfuSap);
523
524 #ifndef NO_ERRCLS
525    if (tfuSap->sapSta.sapState != LRG_BND)
526    {
527       RLOG_ARG1(L_ERROR,DBG_CELLID,datReq->cellId,"Lower SAP not bound (%d)",
528             tfuSap->sapSta.sapState);
529 #ifdef RG_UNUSED
530       /* This case will never be hit if sap is not bound then we dont get TTI */
531       rgLIMUtlFreeDatReqEvnt(datReq, TRUE);
532 #endif
533       RETVALUE(RFAILED);
534    }
535 #endif
536
537    tfuSap->sapSts.numPduTxmit += datReq->pdus.count; 
538
539    /* Using existing pst - for optimization */
540    if((ret = RgLiTfuDatReq (&tfuSap->sapCfg.sapPst, tfuSap->sapCfg.spId, 
541                             datReq)) != ROK)
542    {
543       RLOG_ARG0(L_ERROR,DBG_CELLID,datReq->cellId,"Call to RgLiTfuDatReq() failed");
544    }
545    RETVALUE(ret);
546 }  /* rgLIMTfuDatReq*/
547
548 #ifdef L2_OPTMZ
549 /**
550  * @brief This API is invoked to send Data to PHY.
551  *
552  * @details
553  *
554  *     Function : rgLIMTfuDelDatReq
555  *      
556  *      This API is invoked to send Data to PHY. It 
557  *      fills in the Pst structure, spId value and invokes Data
558  *      request primitive at TFU.
559  *           
560  *  @param[in]  Inst        inst
561  *  @param[in]  TfuDelDatReqInfo *datReq
562  *  @return  S16
563  *      -# ROK 
564  *      -# RFAILED 
565  **/
566 #ifdef ANSI
567 PUBLIC S16 rgLIMTfuDelDatReq 
568 (
569 Inst          inst,
570 TfuDelDatReqInfo *delDatReq
571 )
572 #else
573 PUBLIC S16 rgLIMTfuDatReq(inst,delDatReq)
574 Inst          inst;
575 TfuDelDatReqInfo *delDatReq;
576 #endif
577 {
578    S16         ret;
579    RgLowSapCb  *tfuSap;
580
581    TRC2(rgLIMTfuDelDatReq)
582
583    /* Get the lower SAP control block from the layer control block. */
584    tfuSap = &(rgCb[inst].tfuSap);
585
586 #ifndef NO_ERRCLS
587    if (tfuSap->sapSta.sapState != LRG_BND)
588    {
589       RLOG_ARG1(L_ERROR,DBG_CELLID,delDatReq->cellId,"Lower SAP not bound (%d)",
590             tfuSap->sapSta.sapState);
591       RETVALUE(RFAILED);
592    }
593 #endif
594
595    if((ret = RgLiTfuDelDatReq (&tfuSap->sapCfg.sapPst, tfuSap->sapCfg.spId, 
596                             delDatReq)) != ROK)
597    {
598       RLOG_ARG0(L_ERROR,DBG_CELLID,delDatReq->cellId,"Call to RgLiTfuDelDatReq() failed");
599    }
600    RETVALUE(ret);
601 }  /* rgLIMTfuDatReq*/
602 #endif /*L2_OPTMZ */
603
604 /**
605  * @brief Transmission time interval indication from PHY.
606  *
607  * @details
608  *
609  *     Function : sendSlotIndMacToSch
610  * 
611  *      This API is invoked by MAC to send slot ind to scheduler.
612  *           
613  *  @param[in]  SlotIndInfo    *slotInd
614  *  @return  S16
615  *      -# ROK 
616  *      -# RFAILED 
617  **/
618 int sendSlotIndMacToSch(SlotIndInfo *slotInd)
619 {
620    int ret = ROK;
621    /* fill Pst structure to send to lwr_mac to MAC */
622    Pst pst;
623    pst.srcProcId = 0;
624    pst.dstProcId = 0;
625    pst.srcEnt = ENTRG;
626    pst.dstEnt = ENTRG;
627    pst.srcInst = 0;
628    pst.dstInst = 1;
629    pst.event = EVENT_SLOT_IND_TO_SCH;
630    pst.region = 0;
631    pst.pool =  0;
632    pst.selector = MAC_SELECTOR_TC;
633
634    return(*macSchSlotIndOpts[pst.selector])(&pst,slotInd);
635 }
636
637
638 /*******************************************************************
639  *
640  * @brief Send slot indication to DU APP
641  *
642  * @details
643  *
644  *    Function : sendSlotIndMacToDuApp
645  *
646  *    Functionality:
647  *       Send slot indication to DU APP
648  *
649  * @params[in] Slot indication info 
650  * @return ROK     - success
651  *         RFAILED - failure
652  *
653  * ****************************************************************/
654 int sendSlotIndMacToDuApp(SlotIndInfo *slotInd)
655 {
656    Pst pst;
657    SlotInfo  *slotInfo;
658   
659    /* Send Slot Indication to DU APP */
660    MAC_ALLOC(slotInfo, sizeof(SlotInfo));
661    if(!slotInfo)
662    {
663       DU_LOG("\nMAC : Slot Indication memory allocation failed");
664       return RFAILED;
665    }
666
667    /* Fill Pst */
668    pst.selector  = DU_MAC_LWLC;
669    pst.srcEnt    = ENTRG;
670    pst.dstEnt    = ENTDUAPP;
671    pst.dstInst   = 0;
672    pst.srcInst   = 0;
673    pst.dstProcId = rgCb[pst.srcInst].rgInit.procId;
674    pst.srcProcId = rgCb[pst.srcInst].rgInit.procId;
675    pst.region = MAC_MEM_REGION;
676    pst.pool = MAC_POOL;
677    pst.event = EVENT_MAC_SLOT_IND;
678    pst.route = 0;
679    pst.prior = 0;
680    pst.intfVer = 0;
681  
682    return MacDuAppSlotInd(&pst, slotInfo);
683   
684 }
685
686 /**
687  * @brief Transmission time interval indication from PHY.
688  *
689  * @details
690  *
691  *     Function : fapiMacSlotInd 
692  *      
693  *      This API is invoked by PHY to indicate TTI indication to MAC for a cell.
694  *           
695  *  @param[in]  Pst            *pst
696  *  @param[in]  SuId           suId 
697  *  @param[in]  SlotIndInfo    *slotInd
698  *  @return  S16
699  *      -# ROK 
700  *      -# RFAILED 
701  **/
702 PUBLIC S16 fapiMacSlotInd 
703 (
704 Pst                 *pst, 
705 SlotIndInfo         *slotInd
706 )
707 {
708    S16              ret;
709    VOLATILE U32     startTime=0;
710    Inst             inst;
711
712    DU_LOG("\nMAC : Slot Indication received");
713    
714    RG_IS_INST_VALID(pst->dstInst);
715    inst = pst->dstInst - RG_INST_START;
716    /*starting Task*/
717    SStartTask(&startTime, PID_MAC_TTI_IND);
718
719    /* send slot indication to scheduler */
720    ret = sendSlotIndMacToSch(slotInd);
721    if(ret != ROK)
722    {
723       DU_LOG("\nMAC : Sending of slot ind msg from MAC to SCH failed");
724       RETVALUE(ret);
725    }
726
727    /* Now call the TOM (Tfu ownership module) primitive to process further */
728    ret = macProcessSlotInd(inst,*slotInd);
729    if(ret != ROK)
730    {
731       DU_LOG("\nMAC : macProcessSlotInd failed");
732       RETVALUE(ret);
733    }
734
735    /* send slot indication to du app */
736    ret = sendSlotIndMacToDuApp(slotInd);
737    if(ret != ROK)
738    {
739       DU_LOG("\nMAC :Sending of slot ind msg from MAC to DU APP failed");
740       RETVALUE(ret);
741    }
742
743    /*stoping Task*/
744    SStopTask(startTime, PID_MAC_TTI_IND);
745
746    RETVALUE(ret);
747 }  /* fapiMacSlotInd */
748
749 #if defined(TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD)
750  /**
751  * @brief Transmission of non-rt indication from CL.
752  *
753  * @details
754  *
755  *     Function : RgLiTfuNonRtInd 
756  *      
757  *      This API is invoked by CL to indicate non-rt processing indication to MAC for a cell.
758  *           
759  *  @param[in]  Pst            *pst
760  *  @param[in]  SuId           suId 
761  *  @return  S16
762  *      -# ROK 
763  *      -# RFAILED 
764  **/
765 #ifdef ANSI
766 PUBLIC S16 RgLiTfuNonRtInd
767 (
768 Pst                 *pst,
769 SuId                suId
770 )
771 #else
772 PUBLIC S16 RgLiTfuNonRtInd(pst, suId)
773 Pst                 *pst;
774 SuId                suId;
775 #endif
776 {
777    TRC3(RgLiTfuNonRtInd);
778
779 #ifdef NO_ERRCLS
780    if (rgLIMValidateSap (pst->dstInst - RG_INST_START, suId) != ROK)
781    {
782       RGDBGERRNEW(pst->dstInst - RG_INST_START, (rgPBuf(pst->dstInst - RG_INST_START),"RgLiTfuNonRtInd() SAP Validation failed.\n"));
783       RETVALUE(RFAILED);
784    }
785 #endif
786    rgDHMFreeTbBufs(pst->dstInst - RG_INST_START);
787    RETVALUE(ROK);
788 }  /* RgLiTfuNonRtInd */
789
790 #endif
791 /**********************************************************************
792  
793          End of file
794 **********************************************************************/