Merge "Removed ANSI from multiple folder Part - 1 [JIRA ID - ODUHIGH-249]"
[o-du/l2.git] / src / 5gnrsch / rg_sch_lmm.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 Layer Manager Interface Module 
26   
27      File:     rg_sch_lmm.c 
28   
29 **********************************************************************/
30
31 /** @file rg_sch_lmm.c
32 @brief This file contains the Layer Management interface module implementation for scheduler.
33        The functions for the configuration, control, status and statistics 
34        request primitives are defined here.
35 */
36
37 static const char* RLOG_MODULE_NAME="MAC";
38 static int RLOG_MODULE_ID=4096;
39 static int RLOG_FILE_ID=167;
40
41 /* header include files (.h) */
42 #include "common_def.h"
43 #include "rg_env.h"        /* MAC Environment Defines */
44 #include "rgr.h"           /* RGR Interface defines */
45 #include "tfu.h"           /* RGU Interface defines */
46 #include "lrg.h"           /* LRG Interface defines */
47 #include "rgm.h"           /* RGM Interface defines */
48 #include "rg_sch.h"        /* Scheduler defines */
49 #include "rg_sch_inf.h"        /* Scheduler defines */
50 #include "rg_sch_err.h"        /* MAC error defines */
51 #ifdef LTE_L2_MEAS
52 #include "rg_sch_cmn.h"    /* typedefs for Scheduler */
53 #endif
54 #include "rl_interface.h"
55 #include "rl_common.h"
56
57 /* header/extern include files (.x) */
58 #include "rgr.x"           /* RGR Interface includes */
59 #include "rgm.x"           /* RGM Interface includes */
60 #include "tfu.x"           /* RGU Interface includes */
61 #include "lrg.x"           /* LRG Interface includes */
62 #include "rg_sch_inf.x"    /* Scheduler defines */
63 #include "rg_sch.x"        /* Scheduler includes */
64 #ifdef LTE_L2_MEAS
65 #include "rg_sch_cmn.x"    /* typedefs for Scheduler */
66 #endif 
67 #ifndef LTE_L2_MEAS
68 Void rgSCHCmnInit ARGS((Void));
69 #endif 
70 /* forward references */
71 extern int schActvInit(Ent entity, Inst instId, Region region, Reason reason);
72 #ifdef UNUSE_FUN
73 static uint16_t rgSCHLmmSapCfg ARGS((
74    Inst           inst,
75    RgCfg          *cfg,
76    uint8_t             sapIdx,
77    Elmnt          sapType
78 ));
79 #endif
80 static Void rgSCHLmmShutdown ARGS((
81    Inst inst
82 ));
83
84
85 void printSchCellInfo(void)
86 {
87    uint8_t idx=0;
88    uint8_t inst=0;
89    for (idx = 0; idx < rgSchCb[inst].numSaps; idx++)
90    {
91       /* Unbind all the TFU SAP */
92       /* Free the memory held by the cell associated
93        * with this SAP */
94       if (rgSchCb[inst].tfuSap[idx].cell != NULLP)
95       {
96          RLOG1(L_INFO,"CELL %d\n", idx);
97          RLOG1(L_INFO,"NUM UEs :%d\n",rgSchCb[inst].tfuSap[idx].cell->ueLst.nmbEnt);
98       }
99    }
100 }
101
102 /**
103  * @brief SAP Configuration Handler. 
104  *
105  * @details
106  *
107  *     Function : rgSCHLmmSapCfg
108  *     
109  *     This function in called by SchProcGenCfgReq(). It handles the
110  *     interface SAP configuration of the scheduler instance. It 
111  *     initializes the sapState to LRG_UNBND. Returns
112  *     reason for success/failure of this function.
113  *     
114  *  @param[in]  RgCfg *cfg, the Configuaration information 
115  *  @return  uint16_t
116  *      -# LCM_REASON_GENCFG_NOT_DONE
117  *      -# LCM_REASON_INVALID_SAP
118  *      -# LCM_REASON_NOT_APPL
119  **/
120 #ifdef UNUSE_FUN
121 static uint16_t rgSCHLmmSapCfg
122 (
123 Inst  dInst,
124 RgCfg *cfg,            /* Configuaration information */
125 uint8_t sapIdx,          /* SAP index */
126 Elmnt sapType             /* SAP Type */
127 )
128 {
129    uint16_t                  ret = LCM_REASON_NOT_APPL;
130    RgSchLowSapCfgInfo   *lowSapCfg = NULLP;
131    RgSchUpSapCfgInfo    *upSapCfg = NULLP;
132    Inst  inst = (dInst - SCH_INST_START);
133
134    /* Check if Gen Config has been done */
135
136    switch(sapType)
137    {   
138       case STRGRSAP:
139 #ifndef CL_MAC_LWLC
140          if ((cfg->s.schInstCfg.rgrSap[sapIdx].selector != ODU_SELECTOR_TC) &&
141              (cfg->s.schInstCfg.rgrSap[sapIdx].selector != ODU_SELECTOR_LC))
142          {
143             ret = LCM_REASON_INVALID_PAR_VAL;
144             RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCfg(): unsupported"
145                " Selector value for RGR.");
146             break;
147          }
148 #endif
149          if(rgSchCb[inst].rgrSap[sapIdx].sapSta.sapState == LRG_NOT_CFG)
150          { 
151             rgSchCb[inst].rgrSap[sapIdx].sapSta.sapState = LRG_UNBND;
152          }
153          upSapCfg = &rgSchCb[inst].rgrSap[sapIdx].sapCfg;
154
155          upSapCfg->sapPst.dstEnt = cfg->s.schInstCfg.rgrSap[sapIdx].ent;
156          upSapCfg->sapPst.dstInst = cfg->s.schInstCfg.rgrSap[sapIdx].inst;
157          upSapCfg->sapPst.dstProcId = cfg->s.schInstCfg.rgrSap[sapIdx].procId;
158          upSapCfg->sapPst.srcEnt = rgSchCb[inst].rgSchInit.ent;
159          upSapCfg->sapPst.srcInst = rgSchCb[inst].rgSchInit.inst +
160          SCH_INST_START;
161          upSapCfg->sapPst.srcProcId = rgSchCb[inst].rgSchInit.procId;
162          upSapCfg->sapPst.region = cfg->s.schInstCfg.rgrSap[sapIdx].mem.region;
163          upSapCfg->sapPst.pool = cfg->s.schInstCfg.rgrSap[sapIdx].mem.pool;
164          upSapCfg->sapPst.selector = cfg->s.schInstCfg.rgrSap[sapIdx].selector;
165          upSapCfg->sapPst.route = cfg->s.schInstCfg.rgrSap[sapIdx].route;
166          upSapCfg->sapPst.intfVer = 0; 
167          upSapCfg->sapPst.event = 0; 
168          upSapCfg->sapPst.prior = cfg->s.schInstCfg.rgrSap[sapIdx].prior;
169          upSapCfg->suId = cfg->s.schInstCfg.rgrSap[sapIdx].suId;
170          upSapCfg->spId = cfg->s.schInstCfg.rgrSap[sapIdx].spId;
171          break;
172       case STTFUSAP:
173 #ifndef CL_MAC_LWLC
174          if ((cfg->s.schInstCfg.tfuSap[sapIdx].selector != ODU_SELECTOR_TC) &&
175              (cfg->s.schInstCfg.tfuSap[sapIdx].selector != ODU_SELECTOR_LC))
176          {
177             ret = LCM_REASON_INVALID_PAR_VAL;
178             RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCfg(): unsupported"
179                      " Selector value for TFU.");
180             break;
181          }
182 #endif
183          if (rgSchCb[inst].tfuSap[sapIdx].sapSta.sapState == LRG_NOT_CFG) 
184          { 
185             rgSchCb[inst].tfuSap[sapIdx].sapSta.sapState = LRG_UNBND;
186          }
187          /* Initialize the  sap timer */
188          cmInitTimers(&(rgSchCb[inst].tfuSap[sapIdx].tmrBlk), 1);
189          lowSapCfg = &rgSchCb[inst].tfuSap[sapIdx].sapCfg;
190
191          lowSapCfg->sapPst.dstEnt = cfg->s.schInstCfg.tfuSap[sapIdx].ent;
192          lowSapCfg->sapPst.dstInst = cfg->s.schInstCfg.tfuSap[sapIdx].inst;
193          lowSapCfg->sapPst.dstProcId = cfg->s.schInstCfg.tfuSap[sapIdx].procId;
194          lowSapCfg->sapPst.srcEnt = rgSchCb[inst].rgSchInit.ent;
195          lowSapCfg->sapPst.srcInst = rgSchCb[inst].rgSchInit.inst +
196          SCH_INST_START;
197          lowSapCfg->sapPst.srcProcId = rgSchCb[inst].rgSchInit.procId;
198          lowSapCfg->sapPst.region = cfg->s.schInstCfg.tfuSap[sapIdx].mem.region;
199          lowSapCfg->sapPst.pool = cfg->s.schInstCfg.tfuSap[sapIdx].mem.pool;
200          lowSapCfg->sapPst.selector = cfg->s.schInstCfg.tfuSap[sapIdx].selector;
201          lowSapCfg->sapPst.route = cfg->s.schInstCfg.tfuSap[sapIdx].route;
202          lowSapCfg->sapPst.intfVer = 0; 
203           lowSapCfg->sapPst.event = 0; 
204          lowSapCfg->sapPst.prior = cfg->s.schInstCfg.tfuSap[sapIdx].prior;
205          lowSapCfg->suId = cfg->s.schInstCfg.tfuSap[sapIdx].suId;
206          lowSapCfg->spId = cfg->s.schInstCfg.tfuSap[sapIdx].spId;
207          memcpy(&lowSapCfg->bndTmr, 
208                   &cfg->s.schInstCfg.tfuSap[sapIdx].bndTmr,
209                   sizeof(TmrCfg));
210          break;
211       case STRGMSAP:
212 #ifndef RGM_LWLC
213          if ((cfg->s.schInstCfg.rgmSap[sapIdx].selector != RGM_SEL_LWLC) &&
214              (cfg->s.schInstCfg.rgmSap[sapIdx].selector != RGM_SEL_LC) &&
215              (cfg->s.schInstCfg.rgmSap[sapIdx].selector != RGM_SEL_TC))
216          {
217             ret = LCM_REASON_INVALID_PAR_VAL;
218             RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCfg(): unsupported"
219                      " Selector value for RGM.");
220             break;
221          }
222 #endif
223          if (rgSchCb[inst].rgmSap[sapIdx].sapSta.sapState == LRG_NOT_CFG) 
224          { 
225             rgSchCb[inst].rgmSap[sapIdx].sapSta.sapState = LRG_UNBND;
226          }
227          upSapCfg = &rgSchCb[inst].rgmSap[sapIdx].sapCfg;
228          upSapCfg->sapPst.dstEnt = cfg->s.schInstCfg.rgmSap[sapIdx].ent;
229          upSapCfg->sapPst.dstInst = cfg->s.schInstCfg.rgmSap[sapIdx].inst;
230          upSapCfg->sapPst.dstProcId = cfg->s.schInstCfg.rgmSap[sapIdx].procId;
231          upSapCfg->sapPst.srcEnt = rgSchCb[inst].rgSchInit.ent;
232          upSapCfg->sapPst.srcInst = rgSchCb[inst].rgSchInit.inst +
233          SCH_INST_START;
234          upSapCfg->sapPst.srcProcId = rgSchCb[inst].rgSchInit.procId;
235          upSapCfg->sapPst.region = cfg->s.schInstCfg.rgmSap[sapIdx].mem.region;
236          upSapCfg->sapPst.pool = cfg->s.schInstCfg.rgmSap[sapIdx].mem.pool;
237          upSapCfg->sapPst.selector = cfg->s.schInstCfg.rgmSap[sapIdx].selector;
238          upSapCfg->sapPst.route = cfg->s.schInstCfg.rgmSap[sapIdx].route;
239          upSapCfg->sapPst.intfVer = 0; 
240          upSapCfg->sapPst.event = 0; 
241          upSapCfg->sapPst.prior = cfg->s.schInstCfg.rgmSap[sapIdx].prior;
242          upSapCfg->suId = cfg->s.schInstCfg.rgmSap[sapIdx].suId;
243          upSapCfg->spId = cfg->s.schInstCfg.rgmSap[sapIdx].spId;
244
245          break;
246       default:
247          /* would never reach here */
248          break;
249    }
250    return (ret);
251 }
252 #endif
253 \f
254 /***********************************************************
255  *
256  *     Func : rgSCHLmmShutdown
257  *        
258  *
259  *     Desc : Handles the scheduler instance shutdown request. Calls 
260  *     rgSCHCfgFreeCellCb(RgSchCellCb*) to handle each cellCb deallocation.
261  *            
262  *
263  *     Ret  : Void
264  *
265  *     Notes: 
266  *
267  *     File : rg_sch_lmm.c 
268  *
269  **********************************************************/
270 static Void rgSCHLmmShutdown(Inst inst)
271 {
272    Inst          dInst = inst + SCH_INST_START;
273    uint8_t       idx;
274 #ifdef LTE_L2_MEAS
275    CmLList       *lnk = NULLP;
276    RgSchCb       *instCb =  &rgSchCb[inst];
277    RgSchCellCb   *cell = NULLP;
278    RgSchL2MeasCb *measCb;
279    uint8_t       ulAllocIdx;
280    RgSchCmnUlCell *cellUl;
281    RgSchClcBoRpt  *bo = NULL;
282 #endif
283
284 #ifdef LTE_L2_MEAS
285    for (idx = 0; idx < instCb->numSaps; idx++)
286    {
287      /* got the cell break the loop */
288      cell = instCb->rgrSap[idx].cell;
289      if(cell != NULLP)
290      {
291         /* Free the memory held up by  ulAllocInfo */
292         cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
293 #ifdef LTE_TDD
294         for(ulAllocIdx = 0; ulAllocIdx < RGSCH_SF_ALLOC_SIZE; ulAllocIdx++)
295 #else
296         for(ulAllocIdx = 0; ulAllocIdx < RGSCH_NUM_SUB_FRAMES; ulAllocIdx++)
297 #endif
298         {
299            if(cell->sfAllocArr[ulAllocIdx].ulUeInfo.ulAllocInfo != NULLP)
300            {
301              /* ccpu00117052 - MOD - Passing double pointer
302              for proper NULLP assignment*/
303              rgSCHUtlFreeSBuf(cell->instIdx, 
304                     (Data **)(&(cell->sfAllocArr[ulAllocIdx].ulUeInfo.\
305                                 ulAllocInfo)),
306                     cellUl->maxAllocPerUlSf * sizeof(RgInfUeUlAlloc));
307            }
308         }
309         /* Free the memory allocated to measCb */
310         lnk = cell->l2mList.first;
311         while(lnk != NULLP)
312         {
313            measCb = (RgSchL2MeasCb *)lnk->node;
314            cmLListDelFrm(&cell->l2mList, lnk);
315            lnk = lnk->next;
316              /* ccpu00117052 - MOD - Passing double pointer
317              for proper NULLP assignment*/
318            rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb,\
319                           sizeof(RgSchL2MeasCb));
320         }
321
322         /* Free mem if any present for boLst for common channels */
323         for(idx = 0; idx < RGSCH_MAX_CMN_LC_CB; idx++)
324         {
325            lnk = (CmLList *)cell->cmnLcCb[idx].boLst.first;
326            while (lnk)
327            {
328               bo = (RgSchClcBoRpt *)(lnk->node);
329               lnk = lnk->next;
330               cmLListDelFrm(&cell->cmnLcCb[idx].boLst, &bo->boLstEnt);
331               rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&bo, sizeof(RgSchClcBoRpt));
332            }
333         }
334      }
335    }
336 #endif
337
338 #ifdef LTE_ADV
339    rgSCHLaaDeInitEnbCb(&rgSchCb[inst]);
340 #endif
341    for (idx = 0; idx < rgSchCb[inst].numSaps; idx++)
342    {
343       /* Unbind all the TFU SAP */
344       if(rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_WAIT_BNDCFM)
345       {
346          //rgSCHUtlTfuUBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg, LRG_UNBND);
347          if (rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.enb == TRUE)
348          {
349             rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR, (PTR)&rgSchCb[inst].tfuSap[idx]); 
350          }
351          rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_UNBND;
352       }
353       if(rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_BND)
354       {
355          //rgSCHUtlTfuUBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg, LRG_UNBND);
356          rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_UNBND;
357       }
358       /* Free the memory held by the cell associated with this SAP */
359       if (rgSchCb[inst].tfuSap[idx].cell != NULLP)
360          rgSCHCfgFreeCellCb(rgSchCb[inst].tfuSap[idx].cell);
361       rgSchCb[inst].tfuSap[idx].cell = NULLP;
362    }
363    /* Free the memory held by the scheduler instance */
364    /* Deallocate RGR saps */
365    SPutSBuf(rgSchCb[inst].rgSchInit.region,
366                 rgSchCb[inst].rgSchInit.pool,
367                 (Data *)rgSchCb[inst].rgrSap,
368                 (sizeof(RgSchUpSapCb) * rgSchCb[inst].numSaps));
369    rgSchCb[inst].rgrSap = NULLP;
370    /* Deallocate RGM saps */
371    SPutSBuf(rgSchCb[inst].rgSchInit.region,
372                 rgSchCb[inst].rgSchInit.pool,
373                 (Data *)rgSchCb[inst].rgmSap,
374                 (sizeof(RgSchUpSapCb) * rgSchCb[inst].numSaps));
375    rgSchCb[inst].rgmSap = NULLP;
376
377    /* Deallocate TFU saps */
378    SPutSBuf(rgSchCb[inst].rgSchInit.region,
379                 rgSchCb[inst].rgSchInit.pool,
380                 (Data *)rgSchCb[inst].tfuSap,
381                 (sizeof(RgSchLowSapCb) * rgSchCb[inst].numSaps));
382    rgSchCb[inst].tfuSap = NULLP;
383
384    /* Deallocate bndCfmResponses */
385    SPutSBuf(rgSchCb[inst].rgSchInit.region,
386                 rgSchCb[inst].rgSchInit.pool,
387                 (Data *)rgSchCb[inst].genCfg.bndCfmResp,
388                 (sizeof(RgSchLmResponse) * rgSchCb[inst].numSaps));
389    rgSchCb[inst].genCfg.bndCfmResp = NULLP;
390    /* De-register the Timer Service */
391    (Void) SDeregTmrMt(rgSchCb[inst].rgSchInit.ent, dInst,
392                      (S16)rgSchCb[inst].genCfg.tmrRes, schActvTmr); 
393
394    /* call back the task initialization function to intialize
395     * the global rgSchCb[inst] Struct */
396    schActvInit(rgSchCb[inst].rgSchInit.ent, dInst, rgSchCb[inst].rgSchInit.region, 
397               rgSchCb[inst].rgSchInit.reason);
398    
399    /* Set Config done in TskInit */
400    rgSchCb[inst].rgSchInit.cfgDone = FALSE;
401
402    return;
403 }
404
405 \f
406 /***********************************************************
407  *
408  *     Func : rgSCHLmmGenCntrl 
409  *        
410  *
411  *     Desc : Processes the LM control request for STGEN elmnt.
412  *            
413  *
414  *     Ret  : Void
415  *
416  *     Notes: 
417  *
418  *     File : rg_sch_lmm.c 
419  *
420  **********************************************************/
421 Void rgSCHLmmGenCntrl(RgMngmt *cntrl,RgMngmt *cfm,Pst  *cfmPst)
422 {
423    Inst      inst = (cfmPst->srcInst - SCH_INST_START); /* Scheduler instance ID */
424
425    cfm->cfm.status = LCM_PRIM_OK;
426    cfm->cfm.reason = LCM_REASON_NOT_APPL;
427    
428
429    switch(cntrl->t.cntrl.action)
430    {
431       case AENA:
432          /* Action is Enable */
433          switch(cntrl->t.cntrl.subAction)
434          {
435             case SAUSTA:   
436             /* Enable Unsolicited Status (alarms) */
437                rgSchCb[inst].rgSchInit.usta = TRUE;
438                /*Store the response and TransId for sending the Alarms */
439                memcpy(&rgSchCb[inst].genCfg.ustaResp.response, 
440                &cntrl->hdr.response, sizeof(Resp));
441                rgSchCb[inst].genCfg.ustaResp.transId = cntrl->hdr.transId;
442                break;
443             case SADBG:
444             /* Enable Debug Printing */
445 #ifdef DEBUGP
446                rgSchCb[inst].rgSchInit.dbgMask |= cntrl->t.cntrl.s.rgDbgCntrl.dbgMask;
447 #endif
448                break;
449 #ifdef PHY_ERROR_LOGING
450             case SAELMNT:
451                {
452                   rgSchUlAllocCntr.mcs = cntrl->t.cntrl.s.rgSchUlAllocCntrl.mcs;
453                   rgSchUlAllocCntr.numOfRb = cntrl->t.cntrl.s.rgSchUlAllocCntrl.numOfRb;
454                   rgSchUlAllocCntr.rbStart = cntrl->t.cntrl.s.rgSchUlAllocCntrl.rbStart;
455                   rgSchUlAllocCntr.testStart = cntrl->t.cntrl.s.rgSchUlAllocCntrl.testStart;
456                   rgSchUlAllocCntr.enaLog = cntrl->t.cntrl.s.rgSchUlAllocCntrl.enaLog;
457                   rgSchUlAllocCntr.logTime = cntrl->t.cntrl.s.rgSchUlAllocCntrl.logTime;
458                   rgSchUlAllocCntr.crcOk = 0;
459                   rgSchUlAllocCntr.crcErr = 0;
460                   rgSchUlAllocCntr.numUlPackets = 0;
461                   rgSchUlAllocCntr.numPrach = 0;
462                   rgSchUlAllocCntr.taZero = 0;
463 #ifdef MAC_SCH_STATS
464                   /* Reset
465                    * L2
466                    * statistics
467                    * */
468                   memset(&hqRetxStats, 0, sizeof(RgSchHqRetxStats));
469                   memset(&hqFailStats, 0, sizeof(RgSchNackAckStats));
470 #endif
471                   break;
472                }
473 #endif
474             default:
475                cfm->cfm.status = LCM_PRIM_NOK;
476                cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
477                RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmGenCntrl(): "
478                   "invalid subaction=%d", cntrl->t.cntrl.subAction);
479                break;
480          }
481          break;
482       case ADISIMM:
483          /* Action is Diable immidiately */
484          switch(cntrl->t.cntrl.subAction)
485          {
486             case SAUSTA:
487             /* Disable Unsolicited Status (alarms) */
488                rgSchCb[inst].rgSchInit.usta = FALSE;
489                break;
490             case SADBG:
491             /* Disable Debug Printing */
492 #ifdef DEBUGP
493                rgSchCb[inst].rgSchInit.dbgMask &=\
494                           ~cntrl->t.cntrl.s.rgDbgCntrl.dbgMask;
495 #endif
496                break;
497
498             default:
499                cfm->cfm.status = LCM_PRIM_NOK;
500                cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
501                RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmGenCntrl():"
502                  " invalid subaction=%d", cntrl->t.cntrl.subAction);
503                break;
504          }
505          break;
506       case ASHUTDOWN:
507          /* Free all the memory dynamically allocated by MAC */
508          rgSCHLmmShutdown(inst);
509          break;
510       default:
511          cfm->cfm.status = LCM_PRIM_NOK;
512          cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
513          RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmGenCntrl(): invalid"
514           " action=%d", cntrl->t.cntrl.action);
515          break;
516    }
517    RgMiLrgSchCntrlCfm(cfmPst, cfm);
518    return;
519 }
520
521 \f
522 /***********************************************************
523  *
524  *     Func : rgSCHLmmSapCntrl 
525  *        
526  *
527  *     Desc : Processes the LM control request for STxxxSAP elmnt.
528  *            
529  *
530  *     Ret  : Void
531  *
532  *     Notes: 
533  *
534  *     File : rg_sch_lmm.c 
535  *
536  **********************************************************/
537 Void rgSCHLmmSapCntrl 
538 (
539 RgMngmt       *cntrl,
540 RgMngmt       *cfm,
541 Pst           *cfmPst
542 )
543 {
544    uint8_t       idx;
545
546    /* TODO Pass InstId instead of using InstId from cfmPst */
547    Inst      inst = (cfmPst->srcInst - SCH_INST_START); /* Scheduler instance Id */
548
549    /* Only TFU SAP can be controlled by LM */
550    switch(cntrl->hdr.elmId.elmnt)
551    {
552       case STTFUSAP:
553          idx = (uint8_t)cntrl->t.cntrl.s.rgSapCntrl.suId;
554          if (idx > LRG_MAX_SAPS_PER_INST)
555          {
556             cfm->cfm.status = LCM_PRIM_NOK;
557             cfm->cfm.reason = LCM_REASON_INVALID_SAP;
558          }
559          switch(cntrl->t.cntrl.action)
560          {
561             case ABND:
562                /* Bind Enable Request */
563                if ((rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_NOT_CFG) ||
564                    (rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_BND))
565                {
566                   cfm->cfm.status = LCM_PRIM_NOK;
567                   cfm->cfm.reason = LCM_REASON_INVALID_SAP;
568                }
569                else
570                {
571                   if (rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.enb == TRUE)
572                   {
573                      rgSCHLmmStartTmr(inst, RGSCH_BNDREQ_TMR,
574                                   rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.val, 
575                                   (PTR)&rgSchCb[inst].tfuSap[idx]);
576                   }
577                   /* Change SAP state */
578                   rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_WAIT_BNDCFM;
579                   rgSchCb[inst].tfuSap[idx].numBndRetries++;
580                   /* Store the response and TransId for sending 
581                    * the Control confirm */
582                   memcpy(&rgSchCb[inst].genCfg.bndCfmResp[idx].response,
583                            &cntrl->hdr.response, sizeof(Resp));
584                   rgSchCb[inst].genCfg.bndCfmResp[idx].transId = 
585                                                 cntrl->hdr.transId;
586                   
587                   cfm->cfm.status = LCM_PRIM_OK_NDONE;
588                   cfm->cfm.reason = LCM_REASON_NOT_APPL;
589
590                   /* Sending Control Confirm before sending Bind
591                    * Request to TFU  */
592                   RgMiLrgSchCntrlCfm(cfmPst, cfm);
593                   
594                   //rgSCHUtlTfuBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg.suId, 
595                     //             rgSchCb[inst].tfuSap[idx].sapCfg.spId);
596                  return; 
597                }
598                break;
599             case AUBND:
600             /* Unbind request */
601
602                /* Check if the SAP is configured */
603                if( (rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_NOT_CFG) ||
604                      (rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_UNBND))
605                {
606                   cfm->cfm.status = LCM_PRIM_NOK;
607                   cfm->cfm.reason = LCM_REASON_INVALID_MSGTYPE;
608                }
609                else
610                {
611                   //rgSCHUtlTfuUBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg,
612                     //              TFU_UBNDREQ_MNGMT);
613                   if (rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.enb == TRUE)
614                   {
615                      rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR, 
616                                        (PTR)&rgSchCb[inst].tfuSap[idx]);
617                   }
618                   /* Change SAP state */
619                   rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_UNBND;
620                   cfm->cfm.status = LCM_PRIM_OK;
621                   cfm->cfm.reason = LCM_REASON_NOT_APPL;
622                }
623                break;
624             case ADEL:
625                /* Delete SAP, does initialization of SAP */
626                if ((rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_WAIT_BNDCFM) ||
627                    (rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_BND))
628                {
629                   //rgSCHUtlTfuUBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg,
630                     //              TFU_UBNDREQ_MNGMT);
631                   if (rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.enb == TRUE)
632                   {
633                      rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR,
634                                      (PTR)&rgSchCb[inst].tfuSap[idx]);
635                   }
636                }
637                memset(&rgSchCb[inst].tfuSap[idx], 0, sizeof(RgSchLowSapCb));
638                rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_NOT_CFG;
639                cfm->cfm.status = LCM_PRIM_OK;
640                cfm->cfm.reason = LCM_REASON_NOT_APPL;
641                break;
642             default:
643                cfm->cfm.status = LCM_PRIM_NOK;
644                cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
645                RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCntrl(): "
646                   "invalid action=%d", cntrl->t.cntrl.action);
647                break;
648          }
649          break;
650       case STRGRSAP:
651          idx = (uint8_t)cntrl->t.cntrl.s.rgSapCntrl.spId;
652          if (idx > LRG_MAX_SAPS_PER_INST)
653          {
654             cfm->cfm.status = LCM_PRIM_NOK;
655             cfm->cfm.reason = LCM_REASON_INVALID_SAP;
656          }
657          switch(cntrl->t.cntrl.action)
658          {
659             case ADEL:
660                memset(&rgSchCb[inst].rgrSap[idx], 0, sizeof(RgSchUpSapCb));
661                rgSchCb[inst].rgrSap[idx].sapSta.sapState = LRG_NOT_CFG;
662                cfm->cfm.status = LCM_PRIM_OK;
663                cfm->cfm.reason = LCM_REASON_NOT_APPL;
664                break;
665             default:
666                cfm->cfm.status = LCM_PRIM_NOK;
667                cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
668                RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCntrl(): "
669                      "invalid action=%d", cntrl->t.cntrl.action);
670                break;
671          }
672          break;
673       case STRGMSAP:
674          idx = (uint8_t)cntrl->t.cntrl.s.rgSapCntrl.spId;
675          if (idx > LRG_MAX_SAPS_PER_INST)
676          {
677             cfm->cfm.status = LCM_PRIM_NOK;
678             cfm->cfm.reason = LCM_REASON_INVALID_SAP;
679          }
680          switch(cntrl->t.cntrl.action)
681          {
682             case ADEL:
683                memset(&rgSchCb[inst].rgmSap[idx], 0, sizeof(RgSchUpSapCb));
684                rgSchCb[inst].rgmSap[idx].sapSta.sapState = LRG_NOT_CFG;
685                cfm->cfm.status = LCM_PRIM_OK;
686                cfm->cfm.reason = LCM_REASON_NOT_APPL;
687                break;
688             default:
689                cfm->cfm.status = LCM_PRIM_NOK;
690                cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
691                RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCntrl(): "
692                      "invalid action=%d", cntrl->t.cntrl.action);
693                break;
694          }
695          break;
696
697        default:
698          /* Would never come here. */
699          return;
700    }
701    RgMiLrgSchCntrlCfm(cfmPst, cfm);
702    return;
703 }
704
705 \f
706 /***********************************************************
707  *
708  *     Func : SchFillCfmPst 
709  *        
710  *
711  *     Desc : Fills the Confirmation Post Structure cfmPst using the reqPst 
712  *            and the cfm->hdr.response.
713  *            
714  *
715  *     Ret  : Void
716  *
717  *     Notes: 
718  *
719  *     File : rg_sch_lmm.c 
720  *
721  **********************************************************/
722 Void SchFillCfmPst
723 (
724 Pst           *reqPst,
725 Pst           *cfmPst,
726 RgMngmt       *cfm
727 )
728 {
729    Inst inst;
730
731    inst = (reqPst->dstInst - SCH_INST_START);
732
733    cfmPst->srcEnt    = ENTMAC;
734    cfmPst->srcInst   = (Inst) 1;
735    cfmPst->srcProcId = rgSchCb[inst].rgSchInit.procId;
736    cfmPst->dstEnt    = ENTMAC;
737    cfmPst->dstInst   = (Inst) 0;
738    cfmPst->dstProcId = reqPst->srcProcId;
739
740    cfmPst->selector  = cfm->hdr.response.selector;
741    cfmPst->region    = cfm->hdr.response.mem.region;
742    cfmPst->pool      = cfm->hdr.response.mem.pool;
743
744    return;
745 }
746
747 \f
748 /**
749  * @brief Timer start handler. 
750  *
751  * @details
752  *
753  *     Function : rgSCHLmmStartTmr
754  *     
755  *     This function based on the input parameters starts the timer for 
756  *     "tmrVal" duration. As of now scheduler instance uses the timer 
757  *     functionality for BndReq only. Hence there is no conditional
758  *     code based on "tmrEvnt".
759  *     
760  *  @param[in]  S16   tmrEvnt, the Timer Event    
761  *  @param[in]  uint32_t   tmrVal,  the Wait Time
762  *  @param[in]  PTR   cb,  Entry for which Timer expired
763  *  @return  S16
764  *      -# ROK
765  **/
766 S16 rgSCHLmmStartTmr
767 (
768 Inst       inst,
769 S16        tmrEvnt,            /* Timer Event */
770 uint32_t   tmrVal,             /* Wait Time */
771 PTR        cb                  /* Entry for which Timer Expired */
772 )
773 {
774    CmTmrArg    arg;
775 /*   Inst        dInst = inst + SCH_INST_START; */
776
777    UNUSED(tmrEvnt);
778
779    /* Initialize the arg structure */
780    memset(&arg, 0, sizeof(CmTmrArg));
781
782    arg.tqCp = &rgSchCb[inst].tmrTqCp;
783    arg.tq = rgSchCb[inst].tmrTq;
784    arg.timers = &((RgSchLowSapCb *)cb)->tmrBlk;
785    arg.cb = cb;
786    arg.tNum = 0;
787    arg.max = RGSCH_MAX_TIMER;
788    arg.evnt = RGSCH_BNDREQ_TMR;
789    arg.wait = tmrVal;      
790    cmPlcCbTq(&arg);
791
792    return ROK;
793 }
794
795 \f
796 /**
797  * @brief Timer stop handler. 
798  *
799  * @details
800  *
801  *     Function : rgSCHLmmStopTmr
802  *     
803  *     This function based on the input parameters stops the timer for 
804  *     "tmrEvnt". As of now Scheduler instance uses the timer functionality for
805  *     BndReq only. Hence there is no conditional code based on "tmrEvnt".
806  *     Once the bind happens and this timer is stopped, the timer functionality
807  *     is deregistered with SSI. As there is no further use of timer processing.
808  *     
809  *  @param[in]  S16   tmrEvnt, the Timer Event    
810  *  @param[in]  PTR   cb,  Entry for which Timer expired
811  *  @return  S16
812  *      -# ROK
813  *      -# RFAILED
814  **/
815 S16 rgSCHLmmStopTmr
816 (
817 Inst inst,             /* Scheduler instance */
818 S16  tmrEvnt,            /* Timer Event */
819 PTR  cb                  /* Entry for which Timer Expired */
820 )
821 {
822    CmTmrArg   arg;
823    uint8_t    i;
824    S16        ret; 
825
826    ret = RFAILED;
827
828    for(i=0;i<RGSCH_MAX_TIMER;i++)
829    {
830       /* Search for the Timer Blocks */
831       if(((RgSchLowSapCb *)cb)->tmrBlk.tmrEvnt == tmrEvnt)
832       {
833          /* Initialize the arg structure */
834          memset(&arg, 0, sizeof(CmTmrArg));
835
836          arg.tqCp = &rgSchCb[inst].tmrTqCp;
837          arg.tq = rgSchCb[inst].tmrTq;
838          arg.timers = &(((RgSchLowSapCb *)cb)->tmrBlk);
839          arg.cb = cb;
840          arg.max = RGSCH_MAX_TIMER;
841          arg.evnt = tmrEvnt;
842
843          arg.tNum = i;   
844          cmRmvCbTq(&arg);
845          ret = ROK;
846          break;
847       }
848
849    }
850
851
852    return (ret);
853 }
854
855 \f
856 /**
857  * @brief Timer Expiry handler. 
858  *
859  * @details
860  *
861  *     Function : rgSCHLmmTmrExpiry
862  *     
863  *     This is a callback function used as an input parameter to cmPrcTmr()
864  *     to check expiry of any timer. In this function, we are only concerned
865  *     about tmrEvnt=Bind timer.
866  *     
867  *  @param[in]  PTR   cb,  Entry for which Timer expired
868  *  @param[in]  S16   tmrEvnt, the Timer Event    
869  *  @return  S16
870  *      -# ROK
871  **/
872 S16 rgSCHLmmTmrExpiry
873 (
874 PTR cb,               /* Pointer to timer control block */
875 S16 tmrEvnt           /* Timer Event */
876 )
877 {
878    S16           ret = ROK;
879    RgSchLowSapCb *tfuSap = (RgSchLowSapCb *)cb;
880 #ifdef DEBUGP
881    Inst          inst = tfuSap->cell->instIdx;
882 #endif
883
884    
885    switch(tmrEvnt)
886    {
887       case RGSCH_BNDREQ_TMR:
888          tfuSap->numBndRetries++;
889          if(tfuSap->numBndRetries > RGSCH_MAX_BNDRETRY)
890          {
891             rgSCHLmmStaInd((uint8_t)(tfuSap->sapCfg.sapPst.srcInst - SCH_INST_START),
892                            (uint16_t)LCM_CATEGORY_INTERFACE, (uint16_t)LCM_EVENT_BND_FAIL,
893                            (uint16_t)LCM_CAUSE_TMR_EXPIRED, (RgUstaDgn *)NULLP);
894          }
895          else
896          {
897             /* Restart the bind timer */
898             if (tfuSap->sapCfg.bndTmr.enb == TRUE)
899             {
900                ret = rgSCHLmmStartTmr((uint8_t)(tfuSap->sapCfg.sapPst.srcInst - SCH_INST_START),
901                                   RGSCH_BNDREQ_TMR, 
902                                  (uint32_t)tfuSap->sapCfg.bndTmr.val, cb);
903             }
904
905             /* Send bind request */
906             //rgSCHUtlTfuBndReq((uint8_t)(tfuSap->sapCfg.sapPst.srcInst - SCH_INST_START), 
907             //tfuSap->sapCfg.suId, tfuSap->sapCfg.spId);
908          }
909          break;
910       default:
911          RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmTmrExpiry(): Invalid"
912                  " tmrEvnt=%d", tmrEvnt);
913          ret = RFAILED;
914          break;
915    }
916    return (ret);
917 }
918
919 \f
920 /**
921  * @brief Layer Manager Control Confirm generation handler
922  *        for Bind Confirm reception at TFU interface.
923  *        RgLiTfuBndCfm() forwards the confirmation to this 
924  *        function. All SAP state related handling is restricted
925  *        to LMM modules, hence the cfm forwarding.
926  *
927  * @details
928  *
929  *     Function : rgSCHLmmBndCfm 
930  *     
931  *     This API is used by the LIM module of MAC to forward
932  *     the Bind Confirm it receives over the TFU interface.
933  *     
934  *  @param[in]   Pst *pst, Post Structure
935  *  @param[in]   SuId suId, Service user ID
936  *  @param[in]   uint8_t status, Status
937  *  @return  S16
938  *      -# ROK
939  **/
940 S16 rgSCHLmmBndCfm
941 (
942 Pst *pst,               /* Post Structure */
943 SuId suId,              /* Service user ID */
944 uint8_t status               /* Status */
945 )
946 {
947    S16       ret = ROK;
948    RgMngmt   cntrlCfm;
949    Pst       cfmPst;
950    Inst      inst = (pst->dstInst - SCH_INST_START); /* scheduler instance */
951
952
953    /* check the SAP State */
954    switch(rgSchCb[inst].tfuSap[suId].sapSta.sapState)
955    {
956       case LRG_WAIT_BNDCFM:
957          break;
958       case LRG_BND:
959          /* SAP is already bound */
960          return ROK;
961       default:
962          return RFAILED;
963    }
964
965    cfmPst = rgSchCb[inst].rgSchInit.lmPst;
966    cfmPst.selector = rgSchCb[inst].genCfg.bndCfmResp[suId].response.selector;
967    cfmPst.prior = rgSchCb[inst].genCfg.bndCfmResp[suId].response.prior;
968    cfmPst.route = rgSchCb[inst].genCfg.bndCfmResp[suId].response.route;
969    cfmPst.region = rgSchCb[inst].genCfg.bndCfmResp[suId].response.mem.region;
970    cfmPst.pool = rgSchCb[inst].genCfg.bndCfmResp[suId].response.mem.pool;
971    
972    memset(&cntrlCfm, 0, sizeof(RgMngmt));
973
974    switch(status)
975    {
976       case CM_BND_OK: /* status is OK */
977          /* Change SAP state to Bound */
978          rgSchCb[inst].tfuSap[suId].sapSta.sapState = LRG_BND;
979          if (rgSchCb[inst].tfuSap[suId].sapCfg.bndTmr.enb == TRUE)
980          {
981             ret = rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR, (PTR)&rgSchCb[inst].tfuSap[suId]);
982          }
983          /* Send Control Confirm with status as OK to Layer Manager */
984          cntrlCfm.cfm.status = LCM_PRIM_OK;
985          cntrlCfm.cfm.reason = LCM_REASON_NOT_APPL;
986         /* Sending Status Indication to Layer Manager */
987          rgSCHLmmStaInd((uint8_t)(rgSchCb[inst].tfuSap->sapCfg.sapPst.srcInst - SCH_INST_START),
988                LCM_CATEGORY_INTERFACE, LCM_EVENT_BND_OK,
989                LCM_CAUSE_LYR_SPECIFIC, (RgUstaDgn *)NULLP);
990          break;
991
992       default:
993          /* Change SAP state to UnBound */
994          rgSchCb[inst].tfuSap[suId].sapSta.sapState = LRG_UNBND;
995          if (rgSchCb[inst].tfuSap[suId].sapCfg.bndTmr.enb == TRUE)
996          {
997             ret = rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR, (PTR)&rgSchCb[inst].tfuSap[suId]);
998          }
999          /* Send Control Confirm with status as NOK to Layer Manager */
1000          cntrlCfm.cfm.status = LCM_PRIM_NOK;
1001          cntrlCfm.cfm.reason = LCM_REASON_NEG_CFM;
1002          break;
1003    }
1004    rgSchCb[inst].tfuSap[suId].numBndRetries = 0;
1005    cntrlCfm.hdr.elmId.elmnt = STTFUSAP;
1006    cntrlCfm.hdr.transId = rgSchCb[inst].genCfg.bndCfmResp[suId].transId;
1007
1008    ret = RgMiLrgSchCntrlCfm(&cfmPst, &cntrlCfm);
1009
1010    return (ret);
1011 }
1012
1013 /**
1014  * @brief Layer Manager Unsolicited Status Indication generation. 
1015  *
1016  * @details
1017  *
1018  *     Function : rgSCHLmmStaInd 
1019  *     
1020  *     This API is used by the other modules of MAC to send a unsolicited
1021  *     status indication to the Layer Manager.
1022  *     
1023  *  @param[in]  uint16_t category, the Alarm category
1024  *  @param[in]  uint16_t event, the Alarm event
1025  *  @param[in]  uint16_t cause, the cause of the Alarm
1026  *  @param[in]  RgUstaDgn *dgn, Alarm Diagonostics
1027  *  @return  S16
1028  *      -# ROK
1029  **/
1030 S16 rgSCHLmmStaInd
1031 (
1032 Inst inst,
1033 uint16_t  category,
1034 uint16_t  event,
1035 uint16_t  cause,
1036 RgUstaDgn *dgn
1037 )
1038 {
1039    RgMngmt    usta;
1040
1041    if(rgSchCb[inst].rgSchInit.usta == FALSE)
1042    {
1043       return ROK;
1044    }
1045    memset(&usta, 0, sizeof(RgMngmt));
1046
1047    SGetDateTime(&usta.t.usta.cmAlarm.dt);
1048    usta.t.usta.cmAlarm.category = category;
1049    usta.t.usta.cmAlarm.event = event;
1050    usta.t.usta.cmAlarm.cause = cause;
1051    if (dgn != NULLP)
1052    {
1053       memcpy(&usta.t.usta.dgn, dgn, sizeof(RgUstaDgn));
1054    }
1055
1056    rgSchCb[inst].rgSchInit.lmPst.selector = 
1057                        rgSchCb[inst].genCfg.ustaResp.response.selector;
1058    rgSchCb[inst].rgSchInit.lmPst.prior = 
1059                        rgSchCb[inst].genCfg.ustaResp.response.prior;
1060    rgSchCb[inst].rgSchInit.lmPst.route = 
1061                        rgSchCb[inst].genCfg.ustaResp.response.route;
1062    rgSchCb[inst].rgSchInit.lmPst.region = 
1063                        rgSchCb[inst].genCfg.ustaResp.response.mem.region;
1064    rgSchCb[inst].rgSchInit.lmPst.pool = 
1065                        rgSchCb[inst].genCfg.ustaResp.response.mem.pool;
1066    usta.hdr.transId = rgSchCb[inst].genCfg.ustaResp.transId;
1067
1068    return (RgMiLrgSchStaInd(&rgSchCb[inst].rgSchInit.lmPst, &usta));
1069 }
1070
1071 \f
1072 /**
1073  * @brief Scheduler instance timer call back function registered with SSI. 
1074  *
1075  * @details
1076  *
1077  *     Function :  schActvTmr
1078  *     
1079  *     This function is invoked by SSI for every timer activation
1080  *     period expiry. Note that SS_MT_TMR flag needs to be enabled for this
1081  *     as isntId is needed.As part of SRegTmr call for scheduler instance 
1082  *     SS_MT_TMR flag needs to be enabled and schActvTmr needs to be given as 
1083  *     callback function
1084  *     
1085  *  @return  S16
1086  *      -# ROK
1087  **/
1088 S16 schActvTmr(Ent ent,Inst inst)
1089 {
1090    Inst schInst = (inst  - SCH_INST_START);
1091
1092    /* Check if any timer in the scheduler instance has expired */ 
1093    cmPrcTmr(&rgSchCb[schInst].tmrTqCp,
1094             rgSchCb[schInst].tmrTq, (PFV) rgSCHLmmTmrExpiry);
1095  
1096    return ROK;
1097  
1098 } /* end of schActvTmr */
1099
1100 \f
1101 /**********************************************************************
1102  
1103          End of file
1104 **********************************************************************/