1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
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 #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
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 *******************************************************************************/
19 /************************************************************************
25 Desc: C source code for Layer Manager Interface Module
29 **********************************************************************/
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.
37 static const char* RLOG_MODULE_NAME="MAC";
38 static int RLOG_MODULE_ID=4096;
39 static int RLOG_FILE_ID=167;
41 /* header include files (.h) */
42 #include "envopt.h" /* environment options */
43 #include "envdep.h" /* environment dependent */
44 #include "envind.h" /* environment independent */
45 #include "gen.h" /* general */
46 #include "ssi.h" /* system services */
47 #include "cm_tkns.h" /* Common Token Defines */
48 #include "cm_llist.h" /* Common Link List Defines */
49 #include "cm_hash.h" /* Common Hash List Defines */
50 #include "cm_mblk.h" /* common memory link list library */
51 #include "cm_lte.h" /* Common LTE Defines */
52 #include "rg_env.h" /* MAC Environment Defines */
53 #include "rgr.h" /* RGR Interface defines */
54 #include "tfu.h" /* RGU Interface defines */
55 #include "lrg.h" /* LRG Interface defines */
56 #include "rgm.h" /* RGM Interface defines */
57 #include "rg_sch.h" /* Scheduler defines */
58 #include "rg_sch_inf.h" /* Scheduler defines */
59 #include "rg_sch_err.h" /* MAC error defines */
61 #include "rg_sch_cmn.h" /* typedefs for Scheduler */
63 #include "rl_interface.h"
64 #include "rl_common.h"
66 /* header/extern include files (.x) */
67 #include "gen.x" /* general */
68 #include "ssi.x" /* system services */
69 #include "cm5.x" /* system services */
70 #include "cm_tkns.x" /* Common Token Definitions */
71 #include "cm_llist.x" /* Common Link List Definitions */
72 #include "cm_lib.x" /* Common Library Definitions */
73 #include "cm_hash.x" /* Common Hash List Definitions */
74 #include "cm_mblk.x" /* common memory link list library */
75 #include "cm_lte.x" /* Common LTE Defines */
76 #include "rgr.x" /* RGR Interface includes */
77 #include "rgm.x" /* RGM Interface includes */
78 #include "tfu.x" /* RGU Interface includes */
79 #include "lrg.x" /* LRG Interface includes */
80 #include "rg_sch_inf.x" /* Scheduler defines */
81 #include "rg_sch.x" /* Scheduler includes */
83 #include "rg_sch_cmn.x" /* typedefs for Scheduler */
86 PUBLIC Void rgSCHCmnInit ARGS((Void));
88 /* forward references */
91 PRIVATE U16 rgSCHLmmSapCfg ARGS((
98 PRIVATE Void rgSCHLmmShutdown ARGS((
103 PUBLIC void printSchCellInfo(void)
107 for (idx = 0; idx < rgSchCb[inst].numSaps; idx++)
109 /* Unbind all the TFU SAP */
110 /* Free the memory held by the cell associated
112 if (rgSchCb[inst].tfuSap[idx].cell != NULLP)
114 RLOG1(L_INFO,"CELL %d\n", idx);
115 RLOG1(L_INFO,"NUM UEs :%d\n",rgSchCb[inst].tfuSap[idx].cell->ueLst.nmbEnt);
122 * @brief Task Initiation callback function.
126 * Function : schActvInit
128 * This function is supplied as one of parameters during MAC's
129 * task registration. SSI will invoke this function once, after
130 * it creates and attaches this TAPA Task to a system task.
132 * @param[in] Ent Entity, the entity ID of this task.
133 * @param[in] Inst Inst, the instance ID of this task.
134 * @param[in] Region Region, the region ID registered for memory
135 * usage of this task.
136 * @param[in] Reason Reason.
141 PUBLIC S16 schActvInit
143 Ent entity, /* entity */
144 Inst instId, /* instance */
145 Region region, /* region */
146 Reason reason /* reason */
149 PUBLIC S16 schActvInit(entity, instId, region, reason)
150 Ent entity; /* entity */
151 Inst instId; /* instance */
152 Region region; /* region */
153 Reason reason; /* reason */
156 Inst inst = (instId - RGSCH_INST_START);
160 /* Initialize the MAC TskInit structure to zero */
161 cmMemset ((U8 *)&rgSchCb[inst], 0, sizeof(RgSchCb));
163 /* Initialize the MAC TskInit with received values */
164 rgSchCb[inst].rgSchInit.ent = entity;
165 rgSchCb[inst].rgSchInit.inst = inst;
166 rgSchCb[inst].rgSchInit.region = region;
167 rgSchCb[inst].rgSchInit.pool = 0;
168 rgSchCb[inst].rgSchInit.reason = reason;
169 rgSchCb[inst].rgSchInit.cfgDone = FALSE;
170 rgSchCb[inst].rgSchInit.acnt = FALSE;
171 rgSchCb[inst].rgSchInit.usta = FALSE;
172 rgSchCb[inst].rgSchInit.trc = FALSE;
175 /* disabling debugs by default */
176 /* rgSchCb[inst].rgSchInit.dbgMask = 0xffffffff; */
179 rgSchCb[inst].rgSchInit.procId = SFndProcId();
181 rgSchCb[inst].rgrSap = NULLP;
182 rgSchCb[inst].tfuSap = NULLP;
183 rgSchCb[inst].rgmSap = NULLP;
191 * @brief SAP Configuration Handler.
195 * Function : rgSCHLmmSapCfg
197 * This function in called by RgMiLrgSchCfgReq(). It handles the
198 * interface SAP configuration of the scheduler instance. It
199 * initializes the sapState to LRG_UNBND. Returns
200 * reason for success/failure of this function.
202 * @param[in] RgCfg *cfg, the Configuaration information
204 * -# LCM_REASON_GENCFG_NOT_DONE
205 * -# LCM_REASON_INVALID_SAP
206 * -# LCM_REASON_NOT_APPL
209 PRIVATE U16 rgSCHLmmSapCfg
212 RgCfg *cfg, /* Configuaration information */
213 U8 sapIdx, /* SAP index */
214 Elmnt sapType /* SAP Type */
217 PRIVATE U16 rgSCHLmmSapCfg(dInst, cfg, sapIdx, sapType)
219 RgCfg *cfg; /* Configuaration information */
220 U8 sapIdx; /* SAP index */
221 Elmnt sapType; /* SAP Type */
224 U16 ret = LCM_REASON_NOT_APPL;
225 RgSchLowSapCfgInfo *lowSapCfg = NULLP;
226 RgSchUpSapCfgInfo *upSapCfg = NULLP;
227 Inst inst = (dInst - RGSCH_INST_START);
231 /* Check if Gen Config has been done */
237 if ((cfg->s.schInstCfg.rgrSap[sapIdx].selector != RGR_SEL_TC) &&
238 (cfg->s.schInstCfg.rgrSap[sapIdx].selector != RGR_SEL_LC))
240 ret = LCM_REASON_INVALID_PAR_VAL;
241 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCfg(): unsupported"
242 " Selector value for RGR.");
246 if(rgSchCb[inst].rgrSap[sapIdx].sapSta.sapState == LRG_NOT_CFG)
248 rgSchCb[inst].rgrSap[sapIdx].sapSta.sapState = LRG_UNBND;
250 upSapCfg = &rgSchCb[inst].rgrSap[sapIdx].sapCfg;
252 upSapCfg->sapPst.dstEnt = cfg->s.schInstCfg.rgrSap[sapIdx].ent;
253 upSapCfg->sapPst.dstInst = cfg->s.schInstCfg.rgrSap[sapIdx].inst;
254 upSapCfg->sapPst.dstProcId = cfg->s.schInstCfg.rgrSap[sapIdx].procId;
255 upSapCfg->sapPst.srcEnt = rgSchCb[inst].rgSchInit.ent;
256 upSapCfg->sapPst.srcInst = rgSchCb[inst].rgSchInit.inst +
258 upSapCfg->sapPst.srcProcId = rgSchCb[inst].rgSchInit.procId;
259 upSapCfg->sapPst.region = cfg->s.schInstCfg.rgrSap[sapIdx].mem.region;
260 upSapCfg->sapPst.pool = cfg->s.schInstCfg.rgrSap[sapIdx].mem.pool;
261 upSapCfg->sapPst.selector = cfg->s.schInstCfg.rgrSap[sapIdx].selector;
262 upSapCfg->sapPst.route = cfg->s.schInstCfg.rgrSap[sapIdx].route;
263 upSapCfg->sapPst.intfVer = 0;
264 upSapCfg->sapPst.event = 0;
265 upSapCfg->sapPst.prior = cfg->s.schInstCfg.rgrSap[sapIdx].prior;
266 upSapCfg->suId = cfg->s.schInstCfg.rgrSap[sapIdx].suId;
267 upSapCfg->spId = cfg->s.schInstCfg.rgrSap[sapIdx].spId;
271 if ((cfg->s.schInstCfg.tfuSap[sapIdx].selector != TFU_SEL_TC) &&
272 (cfg->s.schInstCfg.tfuSap[sapIdx].selector != TFU_SEL_LC))
274 ret = LCM_REASON_INVALID_PAR_VAL;
275 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCfg(): unsupported"
276 " Selector value for TFU.");
280 if (rgSchCb[inst].tfuSap[sapIdx].sapSta.sapState == LRG_NOT_CFG)
282 rgSchCb[inst].tfuSap[sapIdx].sapSta.sapState = LRG_UNBND;
284 /* Initialize the sap timer */
285 cmInitTimers(&(rgSchCb[inst].tfuSap[sapIdx].tmrBlk), 1);
286 lowSapCfg = &rgSchCb[inst].tfuSap[sapIdx].sapCfg;
288 lowSapCfg->sapPst.dstEnt = cfg->s.schInstCfg.tfuSap[sapIdx].ent;
289 lowSapCfg->sapPst.dstInst = cfg->s.schInstCfg.tfuSap[sapIdx].inst;
290 lowSapCfg->sapPst.dstProcId = cfg->s.schInstCfg.tfuSap[sapIdx].procId;
291 lowSapCfg->sapPst.srcEnt = rgSchCb[inst].rgSchInit.ent;
292 lowSapCfg->sapPst.srcInst = rgSchCb[inst].rgSchInit.inst +
294 lowSapCfg->sapPst.srcProcId = rgSchCb[inst].rgSchInit.procId;
295 lowSapCfg->sapPst.region = cfg->s.schInstCfg.tfuSap[sapIdx].mem.region;
296 lowSapCfg->sapPst.pool = cfg->s.schInstCfg.tfuSap[sapIdx].mem.pool;
297 lowSapCfg->sapPst.selector = cfg->s.schInstCfg.tfuSap[sapIdx].selector;
298 lowSapCfg->sapPst.route = cfg->s.schInstCfg.tfuSap[sapIdx].route;
299 lowSapCfg->sapPst.intfVer = 0;
300 lowSapCfg->sapPst.event = 0;
301 lowSapCfg->sapPst.prior = cfg->s.schInstCfg.tfuSap[sapIdx].prior;
302 lowSapCfg->suId = cfg->s.schInstCfg.tfuSap[sapIdx].suId;
303 lowSapCfg->spId = cfg->s.schInstCfg.tfuSap[sapIdx].spId;
304 cmMemcpy((U8 *)&lowSapCfg->bndTmr,
305 (U8 *)&cfg->s.schInstCfg.tfuSap[sapIdx].bndTmr,
310 if ((cfg->s.schInstCfg.rgmSap[sapIdx].selector != RGM_SEL_LWLC) &&
311 (cfg->s.schInstCfg.rgmSap[sapIdx].selector != RGM_SEL_LC) &&
312 (cfg->s.schInstCfg.rgmSap[sapIdx].selector != RGM_SEL_TC))
314 ret = LCM_REASON_INVALID_PAR_VAL;
315 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCfg(): unsupported"
316 " Selector value for RGM.");
320 if (rgSchCb[inst].rgmSap[sapIdx].sapSta.sapState == LRG_NOT_CFG)
322 rgSchCb[inst].rgmSap[sapIdx].sapSta.sapState = LRG_UNBND;
324 upSapCfg = &rgSchCb[inst].rgmSap[sapIdx].sapCfg;
325 upSapCfg->sapPst.dstEnt = cfg->s.schInstCfg.rgmSap[sapIdx].ent;
326 upSapCfg->sapPst.dstInst = cfg->s.schInstCfg.rgmSap[sapIdx].inst;
327 upSapCfg->sapPst.dstProcId = cfg->s.schInstCfg.rgmSap[sapIdx].procId;
328 upSapCfg->sapPst.srcEnt = rgSchCb[inst].rgSchInit.ent;
329 upSapCfg->sapPst.srcInst = rgSchCb[inst].rgSchInit.inst +
331 upSapCfg->sapPst.srcProcId = rgSchCb[inst].rgSchInit.procId;
332 upSapCfg->sapPst.region = cfg->s.schInstCfg.rgmSap[sapIdx].mem.region;
333 upSapCfg->sapPst.pool = cfg->s.schInstCfg.rgmSap[sapIdx].mem.pool;
334 upSapCfg->sapPst.selector = cfg->s.schInstCfg.rgmSap[sapIdx].selector;
335 upSapCfg->sapPst.route = cfg->s.schInstCfg.rgmSap[sapIdx].route;
336 upSapCfg->sapPst.intfVer = 0;
337 upSapCfg->sapPst.event = 0;
338 upSapCfg->sapPst.prior = cfg->s.schInstCfg.rgmSap[sapIdx].prior;
339 upSapCfg->suId = cfg->s.schInstCfg.rgmSap[sapIdx].suId;
340 upSapCfg->spId = cfg->s.schInstCfg.rgmSap[sapIdx].spId;
344 /* would never reach here */
352 * @brief Scheduler instance Configuration Handler.
356 * Function : rgSCHLmmInstCfg
358 * This function in called by RgMiLrgSchCfgReq(). It handles the
359 * general and SAP configurations of the scheduler instance. It initializes
360 * the hash lists of rgSchCb. Returns
361 * reason for success/failure of this function.
363 * @param[in] RgCfg *cfg, the Configuaration information
365 * -# LCM_REASON_NOT_APPL
366 * -# LCM_REASON_INVALID_MSGTYPE
367 * -# LCM_REASON_MEM_NOAVAIL
370 PUBLIC U16 rgSCHLmmInstCfg
372 RgCfg *cfg, /* Configuaration information */
376 PUBLIC U16 rgSCHLmmInstCfg(cfg,dInst)
377 RgCfg *cfg; /* Configuaration information */
381 U16 ret = LCM_REASON_NOT_APPL;
382 Inst inst = (dInst - RGSCH_INST_START);
385 TRC2(rgSCHLmmInstCfg)
387 /* Check if Instance Configuration is done already */
388 if (rgSchCb[inst].rgSchInit.cfgDone == TRUE)
390 RETVALUE(LCM_REASON_INVALID_MSGTYPE);
392 if ((cfg->s.schInstCfg.genCfg.lmPst.selector != LRG_SEL_TC) &&
393 (cfg->s.schInstCfg.genCfg.lmPst.selector != LRG_SEL_LC))
395 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHLmmInstCfg(): unsupported "
396 "Selector value for lmPst.");
397 RETVALUE(LCM_REASON_INVALID_PAR_VAL);
399 /* Update the Pst structure for LM interface */
400 cmMemcpy((U8 *)&rgSchCb[inst].rgSchInit.lmPst,
401 (U8 *)&cfg->s.schInstCfg.genCfg.lmPst,
404 rgSchCb[inst].rgSchInit.inst = inst;
405 rgSchCb[inst].rgSchInit.lmPst.srcProcId = rgSchCb[inst].rgSchInit.procId;
406 rgSchCb[inst].rgSchInit.lmPst.srcEnt = rgSchCb[inst].rgSchInit.ent;
407 rgSchCb[inst].rgSchInit.lmPst.srcInst = rgSchCb[inst].rgSchInit.inst +
409 rgSchCb[inst].rgSchInit.lmPst.event = EVTNONE;
411 rgSchCb[inst].rgSchInit.region = cfg->s.schInstCfg.genCfg.mem.region;
412 rgSchCb[inst].rgSchInit.pool = cfg->s.schInstCfg.genCfg.mem.pool;
413 rgSchCb[inst].genCfg.tmrRes = cfg->s.schInstCfg.genCfg.tmrRes;
415 rgSchCb[inst].genCfg.forceCntrlSrbBoOnPCel = cfg->s.schInstCfg.genCfg.forceCntrlSrbBoOnPCel;
416 rgSchCb[inst].genCfg.isSCellActDeactAlgoEnable = cfg->s.schInstCfg.genCfg.isSCellActDeactAlgoEnable;
418 rgSchCb[inst].genCfg.startCellId = cfg->s.schInstCfg.genCfg.startCellId;
420 /* allocate RGR saps */
421 if (SGetSBuf(rgSchCb[inst].rgSchInit.region,
422 rgSchCb[inst].rgSchInit.pool,
423 (Data **)&rgSchCb[inst].rgrSap,
424 (sizeof(RgSchUpSapCb) * cfg->s.schInstCfg.numSaps)) != ROK)
426 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHLmmInstCfg: SGetSBuf for "
430 /* allocate RGM saps */
431 if (SGetSBuf(rgSchCb[inst].rgSchInit.region,
432 rgSchCb[inst].rgSchInit.pool,
433 (Data **)&rgSchCb[inst].rgmSap,
434 (sizeof(RgSchUpSapCb) * cfg->s.schInstCfg.numSaps)) != ROK)
436 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHLmmInstCfg: SGetSBuf for "
442 /* allocate TFU saps */
443 if (SGetSBuf(rgSchCb[inst].rgSchInit.region,
444 rgSchCb[inst].rgSchInit.pool,
445 (Data **)&rgSchCb[inst].tfuSap,
446 (sizeof(RgSchLowSapCb) * cfg->s.schInstCfg.numSaps)) != ROK)
448 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHLmmInstCfg: SGetSBuf for TFU "
453 /* allocate for bndCfmResponses */
454 if (SGetSBuf(rgSchCb[inst].rgSchInit.region,
455 rgSchCb[inst].rgSchInit.pool,
456 (Data **)&rgSchCb[inst].genCfg.bndCfmResp,
457 (sizeof(RgSchLmResponse) * cfg->s.schInstCfg.numSaps)) != ROK)
459 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHLmmInstCfg: SGetSBuf for bind"
460 " confirm responses failed");
465 rgSCHLaaInitEnbCb(&rgSchCb[inst]);
468 rgSchCb[inst].numSaps = cfg->s.schInstCfg.numSaps;
469 for (idx = 0; idx < cfg->s.schInstCfg.numSaps; idx++)
471 /* Initialize SAP State and configure SAP */
472 rgSchCb[inst].rgrSap[idx].sapSta.sapState = LRG_NOT_CFG;
473 rgSchCb[inst].rgrSap[idx].cell = NULLP;
474 rgSCHLmmSapCfg(dInst, cfg, idx, STRGRSAP);
476 rgSchCb[inst].rgmSap[idx].sapSta.sapState = LRG_NOT_CFG;
477 rgSchCb[inst].rgmSap[idx].cell = NULLP;
478 rgSCHLmmSapCfg(dInst, cfg, idx, STRGMSAP);
480 rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_NOT_CFG;
481 rgSchCb[inst].tfuSap[idx].cell = NULLP;
482 rgSCHLmmSapCfg(dInst, cfg, idx, STTFUSAP);
483 rgSchCb[inst].tfuSap[idx].numBndRetries = 0;
485 /* Initialzie the timer queue */
486 cmMemset((U8 *)&rgSchCb[inst].tmrTq, 0, sizeof(CmTqType)*RGSCH_TQ_SIZE);
487 /* Initialize the timer control point */
488 cmMemset((U8 *)&rgSchCb[inst].tmrTqCp, 0, sizeof(CmTqCp));
489 rgSchCb[inst].tmrTqCp.tmrLen = RGSCH_TQ_SIZE;
491 /* SS_MT_TMR needs to be enabled as schActvTmr needs instance information */
492 /* Timer Registration request to SSI */
493 if (SRegTmrMt(rgSchCb[inst].rgSchInit.ent, dInst,
494 (S16)rgSchCb[inst].genCfg.tmrRes, schActvTmr) != ROK)
496 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "rgSCHLmmInstCfg(): Failed to "
498 RETVALUE(LCM_REASON_MEM_NOAVAIL);
501 /* Set Config done in TskInit */
502 rgSchCb[inst].rgSchInit.cfgDone = TRUE;
508 /***********************************************************
510 * Func : rgSCHLmmShutdown
513 * Desc : Handles the scheduler instance shutdown request. Calls
514 * rgSCHCfgFreeCellCb(RgSchCellCb*) to handle each cellCb deallocation.
521 * File : rg_sch_lmm.c
523 **********************************************************/
525 PRIVATE Void rgSCHLmmShutdown
530 PRIVATE Void rgSCHLmmShutdown(inst)
534 Inst dInst = inst + RGSCH_INST_START;
537 CmLList *lnk = NULLP;
538 RgSchCb *instCb = &rgSchCb[inst];
539 RgSchCellCb *cell = NULLP;
540 RgSchL2MeasCb *measCb;
542 RgSchCmnUlCell *cellUl;
543 RgSchClcBoRpt *bo = NULL;
546 TRC2(rgSCHLmmShutdown)
549 for (idx = 0; idx < instCb->numSaps; idx++)
551 /* got the cell break the loop */
552 cell = instCb->rgrSap[idx].cell;
555 /* Free the memory held up by ulAllocInfo */
556 cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
558 for(ulAllocIdx = 0; ulAllocIdx < RGSCH_SF_ALLOC_SIZE; ulAllocIdx++)
560 for(ulAllocIdx = 0; ulAllocIdx < RGSCH_NUM_SUB_FRAMES; ulAllocIdx++)
563 if(cell->sfAllocArr[ulAllocIdx].ulUeInfo.ulAllocInfo != NULLP)
565 /* ccpu00117052 - MOD - Passing double pointer
566 for proper NULLP assignment*/
567 rgSCHUtlFreeSBuf(cell->instIdx,
568 (Data **)(&(cell->sfAllocArr[ulAllocIdx].ulUeInfo.\
570 cellUl->maxAllocPerUlSf * sizeof(RgInfUeUlAlloc));
573 /* Free the memory allocated to measCb */
574 lnk = cell->l2mList.first;
577 measCb = (RgSchL2MeasCb *)lnk->node;
578 cmLListDelFrm(&cell->l2mList, lnk);
580 /* ccpu00117052 - MOD - Passing double pointer
581 for proper NULLP assignment*/
582 rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb,\
583 sizeof(RgSchL2MeasCb));
586 /* Free mem if any present for boLst for common channels */
587 for(idx = 0; idx < RGSCH_MAX_CMN_LC_CB; idx++)
589 lnk = (CmLList *)cell->cmnLcCb[idx].boLst.first;
592 bo = (RgSchClcBoRpt *)(lnk->node);
594 cmLListDelFrm(&cell->cmnLcCb[idx].boLst, &bo->boLstEnt);
595 rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&bo, sizeof(RgSchClcBoRpt));
603 rgSCHLaaDeInitEnbCb(&rgSchCb[inst]);
605 for (idx = 0; idx < rgSchCb[inst].numSaps; idx++)
607 /* Unbind all the TFU SAP */
608 if(rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_WAIT_BNDCFM)
610 rgSCHUtlTfuUBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg, LRG_UNBND);
611 if (rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.enb == TRUE)
613 rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR, (PTR)&rgSchCb[inst].tfuSap[idx]);
615 rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_UNBND;
617 if(rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_BND)
619 rgSCHUtlTfuUBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg, LRG_UNBND);
620 rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_UNBND;
622 /* Free the memory held by the cell associated with this SAP */
623 if (rgSchCb[inst].tfuSap[idx].cell != NULLP)
624 rgSCHCfgFreeCellCb(rgSchCb[inst].tfuSap[idx].cell);
625 rgSchCb[inst].tfuSap[idx].cell = NULLP;
627 /* Free the memory held by the scheduler instance */
628 /* Deallocate RGR saps */
629 SPutSBuf(rgSchCb[inst].rgSchInit.region,
630 rgSchCb[inst].rgSchInit.pool,
631 (Data *)rgSchCb[inst].rgrSap,
632 (sizeof(RgSchUpSapCb) * rgSchCb[inst].numSaps));
633 rgSchCb[inst].rgrSap = NULLP;
634 /* Deallocate RGM saps */
635 SPutSBuf(rgSchCb[inst].rgSchInit.region,
636 rgSchCb[inst].rgSchInit.pool,
637 (Data *)rgSchCb[inst].rgmSap,
638 (sizeof(RgSchUpSapCb) * rgSchCb[inst].numSaps));
639 rgSchCb[inst].rgmSap = NULLP;
641 /* Deallocate TFU saps */
642 SPutSBuf(rgSchCb[inst].rgSchInit.region,
643 rgSchCb[inst].rgSchInit.pool,
644 (Data *)rgSchCb[inst].tfuSap,
645 (sizeof(RgSchLowSapCb) * rgSchCb[inst].numSaps));
646 rgSchCb[inst].tfuSap = NULLP;
648 /* Deallocate bndCfmResponses */
649 SPutSBuf(rgSchCb[inst].rgSchInit.region,
650 rgSchCb[inst].rgSchInit.pool,
651 (Data *)rgSchCb[inst].genCfg.bndCfmResp,
652 (sizeof(RgSchLmResponse) * rgSchCb[inst].numSaps));
653 rgSchCb[inst].genCfg.bndCfmResp = NULLP;
654 /* De-register the Timer Service */
655 (Void) SDeregTmrMt(rgSchCb[inst].rgSchInit.ent, dInst,
656 (S16)rgSchCb[inst].genCfg.tmrRes, schActvTmr);
658 /* call back the task initialization function to intialize
659 * the global rgSchCb[inst] Struct */
660 schActvInit(rgSchCb[inst].rgSchInit.ent, dInst, rgSchCb[inst].rgSchInit.region,
661 rgSchCb[inst].rgSchInit.reason);
663 /* Set Config done in TskInit */
664 rgSchCb[inst].rgSchInit.cfgDone = FALSE;
670 /***********************************************************
672 * Func : rgSCHLmmGenCntrl
675 * Desc : Processes the LM control request for STGEN elmnt.
682 * File : rg_sch_lmm.c
684 **********************************************************/
686 PUBLIC Void rgSCHLmmGenCntrl
693 PUBLIC Void rgSCHLmmGenCntrl(cntrl, cfm, cfmPst)
699 Inst inst = (cfmPst->srcInst - RGSCH_INST_START); /* Scheduler instance ID */
700 TRC2(rgSCHLmmGenCntrl)
702 cfm->cfm.status = LCM_PRIM_OK;
703 cfm->cfm.reason = LCM_REASON_NOT_APPL;
706 switch(cntrl->t.cntrl.action)
709 /* Action is Enable */
710 switch(cntrl->t.cntrl.subAction)
713 /* Enable Unsolicited Status (alarms) */
714 rgSchCb[inst].rgSchInit.usta = TRUE;
715 /*Store the response and TransId for sending the Alarms */
716 cmMemcpy((U8 *)&rgSchCb[inst].genCfg.ustaResp.response,
717 (U8 *)&cntrl->hdr.response, sizeof(Resp));
718 rgSchCb[inst].genCfg.ustaResp.transId = cntrl->hdr.transId;
721 /* Enable Debug Printing */
723 rgSchCb[inst].rgSchInit.dbgMask |= cntrl->t.cntrl.s.rgDbgCntrl.dbgMask;
726 #ifdef PHY_ERROR_LOGING
729 rgSchUlAllocCntr.mcs = cntrl->t.cntrl.s.rgSchUlAllocCntrl.mcs;
730 rgSchUlAllocCntr.numOfRb = cntrl->t.cntrl.s.rgSchUlAllocCntrl.numOfRb;
731 rgSchUlAllocCntr.rbStart = cntrl->t.cntrl.s.rgSchUlAllocCntrl.rbStart;
732 rgSchUlAllocCntr.testStart = cntrl->t.cntrl.s.rgSchUlAllocCntrl.testStart;
733 rgSchUlAllocCntr.enaLog = cntrl->t.cntrl.s.rgSchUlAllocCntrl.enaLog;
734 rgSchUlAllocCntr.logTime = cntrl->t.cntrl.s.rgSchUlAllocCntrl.logTime;
735 rgSchUlAllocCntr.crcOk = 0;
736 rgSchUlAllocCntr.crcErr = 0;
737 rgSchUlAllocCntr.numUlPackets = 0;
738 rgSchUlAllocCntr.numPrach = 0;
739 rgSchUlAllocCntr.taZero = 0;
745 cmMemset((U8 *)&hqRetxStats, 0, sizeof(RgSchHqRetxStats));
746 cmMemset((U8 *)&hqFailStats, 0, sizeof(RgSchNackAckStats));
752 cfm->cfm.status = LCM_PRIM_NOK;
753 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
754 RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmGenCntrl(): "
755 "invalid subaction=%d", cntrl->t.cntrl.subAction);
760 /* Action is Diable immidiately */
761 switch(cntrl->t.cntrl.subAction)
764 /* Disable Unsolicited Status (alarms) */
765 rgSchCb[inst].rgSchInit.usta = FALSE;
768 /* Disable Debug Printing */
770 rgSchCb[inst].rgSchInit.dbgMask &=\
771 ~cntrl->t.cntrl.s.rgDbgCntrl.dbgMask;
776 cfm->cfm.status = LCM_PRIM_NOK;
777 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
778 RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmGenCntrl():"
779 " invalid subaction=%d", cntrl->t.cntrl.subAction);
784 /* Free all the memory dynamically allocated by MAC */
785 rgSCHLmmShutdown(inst);
788 cfm->cfm.status = LCM_PRIM_NOK;
789 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
790 RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmGenCntrl(): invalid"
791 " action=%d", cntrl->t.cntrl.action);
794 RgMiLrgSchCntrlCfm(cfmPst, cfm);
799 /***********************************************************
801 * Func : rgSCHLmmSapCntrl
804 * Desc : Processes the LM control request for STxxxSAP elmnt.
811 * File : rg_sch_lmm.c
813 **********************************************************/
815 PUBLIC Void rgSCHLmmSapCntrl
822 PUBLIC Void rgSCHLmmSapCntrl(cntrl, cfm, cfmPst)
830 /* TODO Pass InstId instead of using InstId from cfmPst */
831 Inst inst = (cfmPst->srcInst - RGSCH_INST_START); /* Scheduler instance Id */
832 TRC2(rgSCHLmmSapCntrl)
834 /* Only TFU SAP can be controlled by LM */
835 switch(cntrl->hdr.elmId.elmnt)
838 idx = (U8)cntrl->t.cntrl.s.rgSapCntrl.suId;
839 if (idx > LRG_MAX_SAPS_PER_INST)
841 cfm->cfm.status = LCM_PRIM_NOK;
842 cfm->cfm.reason = LCM_REASON_INVALID_SAP;
844 switch(cntrl->t.cntrl.action)
847 /* Bind Enable Request */
848 if ((rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_NOT_CFG) ||
849 (rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_BND))
851 cfm->cfm.status = LCM_PRIM_NOK;
852 cfm->cfm.reason = LCM_REASON_INVALID_SAP;
856 if (rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.enb == TRUE)
858 rgSCHLmmStartTmr(inst, RGSCH_BNDREQ_TMR,
859 rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.val,
860 (PTR)&rgSchCb[inst].tfuSap[idx]);
862 /* Change SAP state */
863 rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_WAIT_BNDCFM;
864 rgSchCb[inst].tfuSap[idx].numBndRetries++;
865 /* Store the response and TransId for sending
866 * the Control confirm */
867 cmMemcpy((U8 *)&rgSchCb[inst].genCfg.bndCfmResp[idx].response,
868 (U8 *)&cntrl->hdr.response, sizeof(Resp));
869 rgSchCb[inst].genCfg.bndCfmResp[idx].transId =
872 cfm->cfm.status = LCM_PRIM_OK_NDONE;
873 cfm->cfm.reason = LCM_REASON_NOT_APPL;
875 /* Sending Control Confirm before sending Bind
877 RgMiLrgSchCntrlCfm(cfmPst, cfm);
879 rgSCHUtlTfuBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg.suId,
880 rgSchCb[inst].tfuSap[idx].sapCfg.spId);
887 /* Check if the SAP is configured */
888 if( (rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_NOT_CFG) ||
889 (rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_UNBND))
891 cfm->cfm.status = LCM_PRIM_NOK;
892 cfm->cfm.reason = LCM_REASON_INVALID_MSGTYPE;
896 rgSCHUtlTfuUBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg,
898 if (rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.enb == TRUE)
900 rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR,
901 (PTR)&rgSchCb[inst].tfuSap[idx]);
903 /* Change SAP state */
904 rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_UNBND;
905 cfm->cfm.status = LCM_PRIM_OK;
906 cfm->cfm.reason = LCM_REASON_NOT_APPL;
910 /* Delete SAP, does initialization of SAP */
911 if ((rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_WAIT_BNDCFM) ||
912 (rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_BND))
914 rgSCHUtlTfuUBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg,
916 if (rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.enb == TRUE)
918 rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR,
919 (PTR)&rgSchCb[inst].tfuSap[idx]);
922 cmMemset((U8 *)&rgSchCb[inst].tfuSap[idx], 0, sizeof(RgSchLowSapCb));
923 rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_NOT_CFG;
924 cfm->cfm.status = LCM_PRIM_OK;
925 cfm->cfm.reason = LCM_REASON_NOT_APPL;
928 cfm->cfm.status = LCM_PRIM_NOK;
929 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
930 RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCntrl(): "
931 "invalid action=%d", cntrl->t.cntrl.action);
936 idx = (U8)cntrl->t.cntrl.s.rgSapCntrl.spId;
937 if (idx > LRG_MAX_SAPS_PER_INST)
939 cfm->cfm.status = LCM_PRIM_NOK;
940 cfm->cfm.reason = LCM_REASON_INVALID_SAP;
942 switch(cntrl->t.cntrl.action)
945 cmMemset((U8 *)&rgSchCb[inst].rgrSap[idx], 0, sizeof(RgSchUpSapCb));
946 rgSchCb[inst].rgrSap[idx].sapSta.sapState = LRG_NOT_CFG;
947 cfm->cfm.status = LCM_PRIM_OK;
948 cfm->cfm.reason = LCM_REASON_NOT_APPL;
951 cfm->cfm.status = LCM_PRIM_NOK;
952 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
953 RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCntrl(): "
954 "invalid action=%d", cntrl->t.cntrl.action);
959 idx = (U8)cntrl->t.cntrl.s.rgSapCntrl.spId;
960 if (idx > LRG_MAX_SAPS_PER_INST)
962 cfm->cfm.status = LCM_PRIM_NOK;
963 cfm->cfm.reason = LCM_REASON_INVALID_SAP;
965 switch(cntrl->t.cntrl.action)
968 cmMemset((U8 *)&rgSchCb[inst].rgmSap[idx], 0, sizeof(RgSchUpSapCb));
969 rgSchCb[inst].rgmSap[idx].sapSta.sapState = LRG_NOT_CFG;
970 cfm->cfm.status = LCM_PRIM_OK;
971 cfm->cfm.reason = LCM_REASON_NOT_APPL;
974 cfm->cfm.status = LCM_PRIM_NOK;
975 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
976 RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCntrl(): "
977 "invalid action=%d", cntrl->t.cntrl.action);
983 /* Would never come here. */
986 RgMiLrgSchCntrlCfm(cfmPst, cfm);
991 /***********************************************************
993 * Func : rgSCHLmmFillCfmPst
996 * Desc : Fills the Confirmation Post Structure cfmPst using the reqPst
997 * and the cfm->hdr.response.
1004 * File : rg_sch_lmm.c
1006 **********************************************************/
1008 PUBLIC Void rgSCHLmmFillCfmPst
1015 PUBLIC Void rgSCHLmmFillCfmPst(reqPst, cfmPst, cfm)
1023 TRC2(rgSCHLmmFillCfmPst)
1025 inst = (reqPst->dstInst - RGSCH_INST_START);
1027 cfmPst->srcEnt = rgSchCb[inst].rgSchInit.ent;
1028 cfmPst->srcInst = rgSchCb[inst].rgSchInit.inst + RGSCH_INST_START;
1029 cfmPst->srcProcId = rgSchCb[inst].rgSchInit.procId;
1030 cfmPst->dstEnt = reqPst->srcEnt;
1031 cfmPst->dstInst = reqPst->srcInst;
1032 cfmPst->dstProcId = reqPst->srcProcId;
1034 cfmPst->selector = cfm->hdr.response.selector;
1035 cfmPst->prior = cfm->hdr.response.prior;
1036 cfmPst->route = cfm->hdr.response.route;
1037 cfmPst->region = cfm->hdr.response.mem.region;
1038 cfmPst->pool = cfm->hdr.response.mem.pool;
1045 * @brief Timer start handler.
1049 * Function : rgSCHLmmStartTmr
1051 * This function based on the input parameters starts the timer for
1052 * "tmrVal" duration. As of now scheduler instance uses the timer
1053 * functionality for BndReq only. Hence there is no conditional
1054 * code based on "tmrEvnt".
1056 * @param[in] S16 tmrEvnt, the Timer Event
1057 * @param[in] U32 tmrVal, the Wait Time
1058 * @param[in] PTR cb, Entry for which Timer expired
1063 PUBLIC S16 rgSCHLmmStartTmr
1066 S16 tmrEvnt, /* Timer Event */
1067 U32 tmrVal, /* Wait Time */
1068 PTR cb /* Entry for which Timer Expired */
1071 PUBLIC S16 rgSCHLmmStartTmr(inst, tmrEvnt, tmrVal, cb)
1072 Inst inst; /* scheduler instance ID */
1073 S16 tmrEvnt; /* Timer Event */
1074 U32 tmrVal; /* Wait Time */
1075 PTR cb; /* Entry for which Timer Expired */
1079 /* Inst dInst = inst + RGSCH_INST_START; */
1081 TRC2(rgSCHLmmStartTmr)
1085 /* Initialize the arg structure */
1086 cmMemset((U8 *)&arg, 0, sizeof(CmTmrArg));
1088 arg.tqCp = &rgSchCb[inst].tmrTqCp;
1089 arg.tq = rgSchCb[inst].tmrTq;
1090 arg.timers = &((RgSchLowSapCb *)cb)->tmrBlk;
1093 arg.max = RGSCH_MAX_TIMER;
1094 arg.evnt = RGSCH_BNDREQ_TMR;
1103 * @brief Timer stop handler.
1107 * Function : rgSCHLmmStopTmr
1109 * This function based on the input parameters stops the timer for
1110 * "tmrEvnt". As of now Scheduler instance uses the timer functionality for
1111 * BndReq only. Hence there is no conditional code based on "tmrEvnt".
1112 * Once the bind happens and this timer is stopped, the timer functionality
1113 * is deregistered with SSI. As there is no further use of timer processing.
1115 * @param[in] S16 tmrEvnt, the Timer Event
1116 * @param[in] PTR cb, Entry for which Timer expired
1122 PUBLIC S16 rgSCHLmmStopTmr
1124 Inst inst, /* Scheduler instance */
1125 S16 tmrEvnt, /* Timer Event */
1126 PTR cb /* Entry for which Timer Expired */
1129 PUBLIC S16 rgSCHLmmStopTmr(inst, tmrEvnt, cb)
1130 Inst inst; /* Scheduler instance */
1131 S16 tmrEvnt; /* Timer Event */
1132 PTR cb; /* Entry for which Timer Expired */
1139 TRC2(rgSCHLmmStopTmr)
1143 for(i=0;i<RGSCH_MAX_TIMER;i++)
1145 /* Search for the Timer Blocks */
1146 if(((RgSchLowSapCb *)cb)->tmrBlk.tmrEvnt == tmrEvnt)
1148 /* Initialize the arg structure */
1149 cmMemset((U8 *)&arg, 0, sizeof(CmTmrArg));
1151 arg.tqCp = &rgSchCb[inst].tmrTqCp;
1152 arg.tq = rgSchCb[inst].tmrTq;
1153 arg.timers = &(((RgSchLowSapCb *)cb)->tmrBlk);
1155 arg.max = RGSCH_MAX_TIMER;
1172 * @brief Timer Expiry handler.
1176 * Function : rgSCHLmmTmrExpiry
1178 * This is a callback function used as an input parameter to cmPrcTmr()
1179 * to check expiry of any timer. In this function, we are only concerned
1180 * about tmrEvnt=Bind timer.
1182 * @param[in] PTR cb, Entry for which Timer expired
1183 * @param[in] S16 tmrEvnt, the Timer Event
1188 PUBLIC S16 rgSCHLmmTmrExpiry
1190 PTR cb, /* Pointer to timer control block */
1191 S16 tmrEvnt /* Timer Event */
1194 PUBLIC S16 rgSCHLmmTmrExpiry(cb,tmrEvnt)
1195 PTR cb; /* Pointer to timer control block */
1196 S16 tmrEvnt; /* Timer Event */
1200 RgSchLowSapCb *tfuSap = (RgSchLowSapCb *)cb;
1202 Inst inst = tfuSap->cell->instIdx;
1204 TRC2(rgSCHLmmTmrExpiry)
1209 case RGSCH_BNDREQ_TMR:
1210 tfuSap->numBndRetries++;
1211 if(tfuSap->numBndRetries > RGSCH_MAX_BNDRETRY)
1213 rgSCHLmmStaInd((U8)(tfuSap->sapCfg.sapPst.srcInst - RGSCH_INST_START),
1214 (U16)LCM_CATEGORY_INTERFACE, (U16)LCM_EVENT_BND_FAIL,
1215 (U16)LCM_CAUSE_TMR_EXPIRED, (RgUstaDgn *)NULLP);
1219 /* Restart the bind timer */
1220 if (tfuSap->sapCfg.bndTmr.enb == TRUE)
1222 ret = rgSCHLmmStartTmr((U8)(tfuSap->sapCfg.sapPst.srcInst - RGSCH_INST_START),
1224 (U32)tfuSap->sapCfg.bndTmr.val, cb);
1227 /* Send bind request */
1228 rgSCHUtlTfuBndReq((U8)(tfuSap->sapCfg.sapPst.srcInst - RGSCH_INST_START),
1229 tfuSap->sapCfg.suId, tfuSap->sapCfg.spId);
1233 RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmTmrExpiry(): Invalid"
1234 " tmrEvnt=%d", tmrEvnt);
1243 * @brief Layer Manager Control Confirm generation handler
1244 * for Bind Confirm reception at TFU interface.
1245 * RgLiTfuBndCfm() forwards the confirmation to this
1246 * function. All SAP state related handling is restricted
1247 * to LMM modules, hence the cfm forwarding.
1251 * Function : rgSCHLmmBndCfm
1253 * This API is used by the LIM module of MAC to forward
1254 * the Bind Confirm it receives over the TFU interface.
1256 * @param[in] Pst *pst, Post Structure
1257 * @param[in] SuId suId, Service user ID
1258 * @param[in] U8 status, Status
1263 PUBLIC S16 rgSCHLmmBndCfm
1265 Pst *pst, /* Post Structure */
1266 SuId suId, /* Service user ID */
1267 U8 status /* Status */
1270 PUBLIC S16 rgSCHLmmBndCfm(pst,suId,status)
1271 Pst *pst; /* Post Structure */
1272 SuId suId; /* Service user Id */
1273 U8 status; /* Status */
1279 Inst inst = (pst->dstInst - RGSCH_INST_START); /* scheduler instance */
1281 TRC2(rgSCHLmmBndCfm)
1284 /* check the SAP State */
1285 switch(rgSchCb[inst].tfuSap[suId].sapSta.sapState)
1287 case LRG_WAIT_BNDCFM:
1290 /* SAP is already bound */
1296 cfmPst = rgSchCb[inst].rgSchInit.lmPst;
1297 cfmPst.selector = rgSchCb[inst].genCfg.bndCfmResp[suId].response.selector;
1298 cfmPst.prior = rgSchCb[inst].genCfg.bndCfmResp[suId].response.prior;
1299 cfmPst.route = rgSchCb[inst].genCfg.bndCfmResp[suId].response.route;
1300 cfmPst.region = rgSchCb[inst].genCfg.bndCfmResp[suId].response.mem.region;
1301 cfmPst.pool = rgSchCb[inst].genCfg.bndCfmResp[suId].response.mem.pool;
1303 cmMemset((U8 *)&cntrlCfm, 0, sizeof(RgMngmt));
1307 case CM_BND_OK: /* status is OK */
1308 /* Change SAP state to Bound */
1309 rgSchCb[inst].tfuSap[suId].sapSta.sapState = LRG_BND;
1310 if (rgSchCb[inst].tfuSap[suId].sapCfg.bndTmr.enb == TRUE)
1312 ret = rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR, (PTR)&rgSchCb[inst].tfuSap[suId]);
1314 /* Send Control Confirm with status as OK to Layer Manager */
1315 cntrlCfm.cfm.status = LCM_PRIM_OK;
1316 cntrlCfm.cfm.reason = LCM_REASON_NOT_APPL;
1317 /* Sending Status Indication to Layer Manager */
1318 rgSCHLmmStaInd((U8)(rgSchCb[inst].tfuSap->sapCfg.sapPst.srcInst - RGSCH_INST_START),
1319 LCM_CATEGORY_INTERFACE, LCM_EVENT_BND_OK,
1320 LCM_CAUSE_LYR_SPECIFIC, (RgUstaDgn *)NULLP);
1324 /* Change SAP state to UnBound */
1325 rgSchCb[inst].tfuSap[suId].sapSta.sapState = LRG_UNBND;
1326 if (rgSchCb[inst].tfuSap[suId].sapCfg.bndTmr.enb == TRUE)
1328 ret = rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR, (PTR)&rgSchCb[inst].tfuSap[suId]);
1330 /* Send Control Confirm with status as NOK to Layer Manager */
1331 cntrlCfm.cfm.status = LCM_PRIM_NOK;
1332 cntrlCfm.cfm.reason = LCM_REASON_NEG_CFM;
1335 rgSchCb[inst].tfuSap[suId].numBndRetries = 0;
1336 cntrlCfm.hdr.elmId.elmnt = STTFUSAP;
1337 cntrlCfm.hdr.transId = rgSchCb[inst].genCfg.bndCfmResp[suId].transId;
1339 ret = RgMiLrgSchCntrlCfm(&cfmPst, &cntrlCfm);
1345 * @brief Layer Manager Unsolicited Status Indication generation.
1349 * Function : rgSCHLmmStaInd
1351 * This API is used by the other modules of MAC to send a unsolicited
1352 * status indication to the Layer Manager.
1354 * @param[in] U16 category, the Alarm category
1355 * @param[in] U16 event, the Alarm event
1356 * @param[in] U16 cause, the cause of the Alarm
1357 * @param[in] RgUstaDgn *dgn, Alarm Diagonostics
1362 PUBLIC S16 rgSCHLmmStaInd
1371 PUBLIC S16 rgSCHLmmStaInd(inst, category, event, cause, dgn)
1381 TRC2(rgSCHLmmStaInd)
1383 if(rgSchCb[inst].rgSchInit.usta == FALSE)
1388 cmMemset((U8 *)&usta, 0, sizeof(RgMngmt));
1390 SGetDateTime(&usta.t.usta.cmAlarm.dt);
1391 usta.t.usta.cmAlarm.category = category;
1392 usta.t.usta.cmAlarm.event = event;
1393 usta.t.usta.cmAlarm.cause = cause;
1396 cmMemcpy((U8 *)&usta.t.usta.dgn, (U8 *)dgn, sizeof(RgUstaDgn));
1399 rgSchCb[inst].rgSchInit.lmPst.selector =
1400 rgSchCb[inst].genCfg.ustaResp.response.selector;
1401 rgSchCb[inst].rgSchInit.lmPst.prior =
1402 rgSchCb[inst].genCfg.ustaResp.response.prior;
1403 rgSchCb[inst].rgSchInit.lmPst.route =
1404 rgSchCb[inst].genCfg.ustaResp.response.route;
1405 rgSchCb[inst].rgSchInit.lmPst.region =
1406 rgSchCb[inst].genCfg.ustaResp.response.mem.region;
1407 rgSchCb[inst].rgSchInit.lmPst.pool =
1408 rgSchCb[inst].genCfg.ustaResp.response.mem.pool;
1409 usta.hdr.transId = rgSchCb[inst].genCfg.ustaResp.transId;
1411 RETVALUE(RgMiLrgSchStaInd(&rgSchCb[inst].rgSchInit.lmPst, &usta));
1416 * @brief Scheduler instance timer call back function registered with SSI.
1420 * Function : schActvTmr
1422 * This function is invoked by SSI for every timer activation
1423 * period expiry. Note that SS_MT_TMR flag needs to be enabled for this
1424 * as isntId is needed.As part of SRegTmr call for scheduler instance
1425 * SS_MT_TMR flag needs to be enabled and schActvTmr needs to be given as
1432 PUBLIC S16 schActvTmr
1438 PUBLIC S16 schActvTmr(ent, inst)
1443 Inst schInst = (inst - RGSCH_INST_START);
1446 /* Check if any timer in the scheduler instance has expired */
1447 cmPrcTmr(&rgSchCb[schInst].tmrTqCp,
1448 rgSchCb[schInst].tmrTq, (PFV) rgSCHLmmTmrExpiry);
1452 } /* end of schActvTmr */
1455 /**********************************************************************
1458 **********************************************************************/