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