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 - SCH_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 HandleSchGenCfgReq(). 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 - SCH_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 : SchInstCfg
358 * This function in called by HandleSchGenCfgReq(). 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 SchInstCfg
372 RgCfg *cfg, /* Configuaration information */
376 PUBLIC U16 SchInstCfg(cfg,dInst)
377 RgCfg *cfg; /* Configuaration information */
381 U16 ret = LCM_REASON_NOT_APPL;
382 Inst inst = (dInst - SCH_INST_START);
386 printf("\nEntered SchInstCfg()");
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, "SchInstCfg(): 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 /* Not adding any SAPs towards SCH now */
422 /* allocate RGR saps */
423 if (SGetSBuf(rgSchCb[inst].rgSchInit.region,
424 rgSchCb[inst].rgSchInit.pool,
425 (Data **)&rgSchCb[inst].rgrSap,
426 (sizeof(RgSchUpSapCb) * cfg->s.schInstCfg.numSaps)) != ROK)
428 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "SchInstCfg: SGetSBuf for "
432 /* allocate RGM saps */
433 if (SGetSBuf(rgSchCb[inst].rgSchInit.region,
434 rgSchCb[inst].rgSchInit.pool,
435 (Data **)&rgSchCb[inst].rgmSap,
436 (sizeof(RgSchUpSapCb) * cfg->s.schInstCfg.numSaps)) != ROK)
438 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "SchInstCfg: SGetSBuf for "
444 /* allocate TFU saps */
445 if (SGetSBuf(rgSchCb[inst].rgSchInit.region,
446 rgSchCb[inst].rgSchInit.pool,
447 (Data **)&rgSchCb[inst].tfuSap,
448 (sizeof(RgSchLowSapCb) * cfg->s.schInstCfg.numSaps)) != ROK)
450 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "SchInstCfg: SGetSBuf for TFU "
455 /* allocate for bndCfmResponses */
456 if (SGetSBuf(rgSchCb[inst].rgSchInit.region,
457 rgSchCb[inst].rgSchInit.pool,
458 (Data **)&rgSchCb[inst].genCfg.bndCfmResp,
459 (sizeof(RgSchLmResponse) * cfg->s.schInstCfg.numSaps)) != ROK)
461 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "SchInstCfg: SGetSBuf for bind"
462 " confirm responses failed");
466 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;
486 /* Initialzie the timer queue */
487 cmMemset((U8 *)&rgSchCb[inst].tmrTq, 0, sizeof(CmTqType)*RGSCH_TQ_SIZE);
488 /* Initialize the timer control point */
489 cmMemset((U8 *)&rgSchCb[inst].tmrTqCp, 0, sizeof(CmTqCp));
490 rgSchCb[inst].tmrTqCp.tmrLen = RGSCH_TQ_SIZE;
492 /* SS_MT_TMR needs to be enabled as schActvTmr needs instance information */
493 /* Timer Registration request to SSI */
494 if (SRegTmrMt(rgSchCb[inst].rgSchInit.ent, dInst,
495 (S16)rgSchCb[inst].genCfg.tmrRes, schActvTmr) != ROK)
497 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "SchInstCfg(): Failed to "
499 RETVALUE(LCM_REASON_MEM_NOAVAIL);
502 /* Set Config done in TskInit */
503 rgSchCb[inst].rgSchInit.cfgDone = TRUE;
504 printf("\nScheduler gen config done");
510 /***********************************************************
512 * Func : rgSCHLmmShutdown
515 * Desc : Handles the scheduler instance shutdown request. Calls
516 * rgSCHCfgFreeCellCb(RgSchCellCb*) to handle each cellCb deallocation.
523 * File : rg_sch_lmm.c
525 **********************************************************/
527 PRIVATE Void rgSCHLmmShutdown
532 PRIVATE Void rgSCHLmmShutdown(inst)
536 Inst dInst = inst + SCH_INST_START;
539 CmLList *lnk = NULLP;
540 RgSchCb *instCb = &rgSchCb[inst];
541 RgSchCellCb *cell = NULLP;
542 RgSchL2MeasCb *measCb;
544 RgSchCmnUlCell *cellUl;
545 RgSchClcBoRpt *bo = NULL;
548 TRC2(rgSCHLmmShutdown)
551 for (idx = 0; idx < instCb->numSaps; idx++)
553 /* got the cell break the loop */
554 cell = instCb->rgrSap[idx].cell;
557 /* Free the memory held up by ulAllocInfo */
558 cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
560 for(ulAllocIdx = 0; ulAllocIdx < RGSCH_SF_ALLOC_SIZE; ulAllocIdx++)
562 for(ulAllocIdx = 0; ulAllocIdx < RGSCH_NUM_SUB_FRAMES; ulAllocIdx++)
565 if(cell->sfAllocArr[ulAllocIdx].ulUeInfo.ulAllocInfo != NULLP)
567 /* ccpu00117052 - MOD - Passing double pointer
568 for proper NULLP assignment*/
569 rgSCHUtlFreeSBuf(cell->instIdx,
570 (Data **)(&(cell->sfAllocArr[ulAllocIdx].ulUeInfo.\
572 cellUl->maxAllocPerUlSf * sizeof(RgInfUeUlAlloc));
575 /* Free the memory allocated to measCb */
576 lnk = cell->l2mList.first;
579 measCb = (RgSchL2MeasCb *)lnk->node;
580 cmLListDelFrm(&cell->l2mList, lnk);
582 /* ccpu00117052 - MOD - Passing double pointer
583 for proper NULLP assignment*/
584 rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb,\
585 sizeof(RgSchL2MeasCb));
588 /* Free mem if any present for boLst for common channels */
589 for(idx = 0; idx < RGSCH_MAX_CMN_LC_CB; idx++)
591 lnk = (CmLList *)cell->cmnLcCb[idx].boLst.first;
594 bo = (RgSchClcBoRpt *)(lnk->node);
596 cmLListDelFrm(&cell->cmnLcCb[idx].boLst, &bo->boLstEnt);
597 rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&bo, sizeof(RgSchClcBoRpt));
605 rgSCHLaaDeInitEnbCb(&rgSchCb[inst]);
607 for (idx = 0; idx < rgSchCb[inst].numSaps; idx++)
609 /* Unbind all the TFU SAP */
610 if(rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_WAIT_BNDCFM)
612 rgSCHUtlTfuUBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg, LRG_UNBND);
613 if (rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.enb == TRUE)
615 rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR, (PTR)&rgSchCb[inst].tfuSap[idx]);
617 rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_UNBND;
619 if(rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_BND)
621 rgSCHUtlTfuUBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg, LRG_UNBND);
622 rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_UNBND;
624 /* Free the memory held by the cell associated with this SAP */
625 if (rgSchCb[inst].tfuSap[idx].cell != NULLP)
626 rgSCHCfgFreeCellCb(rgSchCb[inst].tfuSap[idx].cell);
627 rgSchCb[inst].tfuSap[idx].cell = NULLP;
629 /* Free the memory held by the scheduler instance */
630 /* Deallocate RGR saps */
631 SPutSBuf(rgSchCb[inst].rgSchInit.region,
632 rgSchCb[inst].rgSchInit.pool,
633 (Data *)rgSchCb[inst].rgrSap,
634 (sizeof(RgSchUpSapCb) * rgSchCb[inst].numSaps));
635 rgSchCb[inst].rgrSap = NULLP;
636 /* Deallocate RGM saps */
637 SPutSBuf(rgSchCb[inst].rgSchInit.region,
638 rgSchCb[inst].rgSchInit.pool,
639 (Data *)rgSchCb[inst].rgmSap,
640 (sizeof(RgSchUpSapCb) * rgSchCb[inst].numSaps));
641 rgSchCb[inst].rgmSap = NULLP;
643 /* Deallocate TFU saps */
644 SPutSBuf(rgSchCb[inst].rgSchInit.region,
645 rgSchCb[inst].rgSchInit.pool,
646 (Data *)rgSchCb[inst].tfuSap,
647 (sizeof(RgSchLowSapCb) * rgSchCb[inst].numSaps));
648 rgSchCb[inst].tfuSap = NULLP;
650 /* Deallocate bndCfmResponses */
651 SPutSBuf(rgSchCb[inst].rgSchInit.region,
652 rgSchCb[inst].rgSchInit.pool,
653 (Data *)rgSchCb[inst].genCfg.bndCfmResp,
654 (sizeof(RgSchLmResponse) * rgSchCb[inst].numSaps));
655 rgSchCb[inst].genCfg.bndCfmResp = NULLP;
656 /* De-register the Timer Service */
657 (Void) SDeregTmrMt(rgSchCb[inst].rgSchInit.ent, dInst,
658 (S16)rgSchCb[inst].genCfg.tmrRes, schActvTmr);
660 /* call back the task initialization function to intialize
661 * the global rgSchCb[inst] Struct */
662 schActvInit(rgSchCb[inst].rgSchInit.ent, dInst, rgSchCb[inst].rgSchInit.region,
663 rgSchCb[inst].rgSchInit.reason);
665 /* Set Config done in TskInit */
666 rgSchCb[inst].rgSchInit.cfgDone = FALSE;
672 /***********************************************************
674 * Func : rgSCHLmmGenCntrl
677 * Desc : Processes the LM control request for STGEN elmnt.
684 * File : rg_sch_lmm.c
686 **********************************************************/
688 PUBLIC Void rgSCHLmmGenCntrl
695 PUBLIC Void rgSCHLmmGenCntrl(cntrl, cfm, cfmPst)
701 Inst inst = (cfmPst->srcInst - SCH_INST_START); /* Scheduler instance ID */
702 TRC2(rgSCHLmmGenCntrl)
704 cfm->cfm.status = LCM_PRIM_OK;
705 cfm->cfm.reason = LCM_REASON_NOT_APPL;
708 switch(cntrl->t.cntrl.action)
711 /* Action is Enable */
712 switch(cntrl->t.cntrl.subAction)
715 /* Enable Unsolicited Status (alarms) */
716 rgSchCb[inst].rgSchInit.usta = TRUE;
717 /*Store the response and TransId for sending the Alarms */
718 cmMemcpy((U8 *)&rgSchCb[inst].genCfg.ustaResp.response,
719 (U8 *)&cntrl->hdr.response, sizeof(Resp));
720 rgSchCb[inst].genCfg.ustaResp.transId = cntrl->hdr.transId;
723 /* Enable Debug Printing */
725 rgSchCb[inst].rgSchInit.dbgMask |= cntrl->t.cntrl.s.rgDbgCntrl.dbgMask;
728 #ifdef PHY_ERROR_LOGING
731 rgSchUlAllocCntr.mcs = cntrl->t.cntrl.s.rgSchUlAllocCntrl.mcs;
732 rgSchUlAllocCntr.numOfRb = cntrl->t.cntrl.s.rgSchUlAllocCntrl.numOfRb;
733 rgSchUlAllocCntr.rbStart = cntrl->t.cntrl.s.rgSchUlAllocCntrl.rbStart;
734 rgSchUlAllocCntr.testStart = cntrl->t.cntrl.s.rgSchUlAllocCntrl.testStart;
735 rgSchUlAllocCntr.enaLog = cntrl->t.cntrl.s.rgSchUlAllocCntrl.enaLog;
736 rgSchUlAllocCntr.logTime = cntrl->t.cntrl.s.rgSchUlAllocCntrl.logTime;
737 rgSchUlAllocCntr.crcOk = 0;
738 rgSchUlAllocCntr.crcErr = 0;
739 rgSchUlAllocCntr.numUlPackets = 0;
740 rgSchUlAllocCntr.numPrach = 0;
741 rgSchUlAllocCntr.taZero = 0;
747 cmMemset((U8 *)&hqRetxStats, 0, sizeof(RgSchHqRetxStats));
748 cmMemset((U8 *)&hqFailStats, 0, sizeof(RgSchNackAckStats));
754 cfm->cfm.status = LCM_PRIM_NOK;
755 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
756 RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmGenCntrl(): "
757 "invalid subaction=%d", cntrl->t.cntrl.subAction);
762 /* Action is Diable immidiately */
763 switch(cntrl->t.cntrl.subAction)
766 /* Disable Unsolicited Status (alarms) */
767 rgSchCb[inst].rgSchInit.usta = FALSE;
770 /* Disable Debug Printing */
772 rgSchCb[inst].rgSchInit.dbgMask &=\
773 ~cntrl->t.cntrl.s.rgDbgCntrl.dbgMask;
778 cfm->cfm.status = LCM_PRIM_NOK;
779 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
780 RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmGenCntrl():"
781 " invalid subaction=%d", cntrl->t.cntrl.subAction);
786 /* Free all the memory dynamically allocated by MAC */
787 rgSCHLmmShutdown(inst);
790 cfm->cfm.status = LCM_PRIM_NOK;
791 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
792 RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmGenCntrl(): invalid"
793 " action=%d", cntrl->t.cntrl.action);
796 RgMiLrgSchCntrlCfm(cfmPst, cfm);
801 /***********************************************************
803 * Func : rgSCHLmmSapCntrl
806 * Desc : Processes the LM control request for STxxxSAP elmnt.
813 * File : rg_sch_lmm.c
815 **********************************************************/
817 PUBLIC Void rgSCHLmmSapCntrl
824 PUBLIC Void rgSCHLmmSapCntrl(cntrl, cfm, cfmPst)
832 /* TODO Pass InstId instead of using InstId from cfmPst */
833 Inst inst = (cfmPst->srcInst - SCH_INST_START); /* Scheduler instance Id */
834 TRC2(rgSCHLmmSapCntrl)
836 /* Only TFU SAP can be controlled by LM */
837 switch(cntrl->hdr.elmId.elmnt)
840 idx = (U8)cntrl->t.cntrl.s.rgSapCntrl.suId;
841 if (idx > LRG_MAX_SAPS_PER_INST)
843 cfm->cfm.status = LCM_PRIM_NOK;
844 cfm->cfm.reason = LCM_REASON_INVALID_SAP;
846 switch(cntrl->t.cntrl.action)
849 /* Bind Enable Request */
850 if ((rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_NOT_CFG) ||
851 (rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_BND))
853 cfm->cfm.status = LCM_PRIM_NOK;
854 cfm->cfm.reason = LCM_REASON_INVALID_SAP;
858 if (rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.enb == TRUE)
860 rgSCHLmmStartTmr(inst, RGSCH_BNDREQ_TMR,
861 rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.val,
862 (PTR)&rgSchCb[inst].tfuSap[idx]);
864 /* Change SAP state */
865 rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_WAIT_BNDCFM;
866 rgSchCb[inst].tfuSap[idx].numBndRetries++;
867 /* Store the response and TransId for sending
868 * the Control confirm */
869 cmMemcpy((U8 *)&rgSchCb[inst].genCfg.bndCfmResp[idx].response,
870 (U8 *)&cntrl->hdr.response, sizeof(Resp));
871 rgSchCb[inst].genCfg.bndCfmResp[idx].transId =
874 cfm->cfm.status = LCM_PRIM_OK_NDONE;
875 cfm->cfm.reason = LCM_REASON_NOT_APPL;
877 /* Sending Control Confirm before sending Bind
879 RgMiLrgSchCntrlCfm(cfmPst, cfm);
881 rgSCHUtlTfuBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg.suId,
882 rgSchCb[inst].tfuSap[idx].sapCfg.spId);
889 /* Check if the SAP is configured */
890 if( (rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_NOT_CFG) ||
891 (rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_UNBND))
893 cfm->cfm.status = LCM_PRIM_NOK;
894 cfm->cfm.reason = LCM_REASON_INVALID_MSGTYPE;
898 rgSCHUtlTfuUBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg,
900 if (rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.enb == TRUE)
902 rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR,
903 (PTR)&rgSchCb[inst].tfuSap[idx]);
905 /* Change SAP state */
906 rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_UNBND;
907 cfm->cfm.status = LCM_PRIM_OK;
908 cfm->cfm.reason = LCM_REASON_NOT_APPL;
912 /* Delete SAP, does initialization of SAP */
913 if ((rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_WAIT_BNDCFM) ||
914 (rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_BND))
916 rgSCHUtlTfuUBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg,
918 if (rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.enb == TRUE)
920 rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR,
921 (PTR)&rgSchCb[inst].tfuSap[idx]);
924 cmMemset((U8 *)&rgSchCb[inst].tfuSap[idx], 0, sizeof(RgSchLowSapCb));
925 rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_NOT_CFG;
926 cfm->cfm.status = LCM_PRIM_OK;
927 cfm->cfm.reason = LCM_REASON_NOT_APPL;
930 cfm->cfm.status = LCM_PRIM_NOK;
931 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
932 RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCntrl(): "
933 "invalid action=%d", cntrl->t.cntrl.action);
938 idx = (U8)cntrl->t.cntrl.s.rgSapCntrl.spId;
939 if (idx > LRG_MAX_SAPS_PER_INST)
941 cfm->cfm.status = LCM_PRIM_NOK;
942 cfm->cfm.reason = LCM_REASON_INVALID_SAP;
944 switch(cntrl->t.cntrl.action)
947 cmMemset((U8 *)&rgSchCb[inst].rgrSap[idx], 0, sizeof(RgSchUpSapCb));
948 rgSchCb[inst].rgrSap[idx].sapSta.sapState = LRG_NOT_CFG;
949 cfm->cfm.status = LCM_PRIM_OK;
950 cfm->cfm.reason = LCM_REASON_NOT_APPL;
953 cfm->cfm.status = LCM_PRIM_NOK;
954 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
955 RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCntrl(): "
956 "invalid action=%d", cntrl->t.cntrl.action);
961 idx = (U8)cntrl->t.cntrl.s.rgSapCntrl.spId;
962 if (idx > LRG_MAX_SAPS_PER_INST)
964 cfm->cfm.status = LCM_PRIM_NOK;
965 cfm->cfm.reason = LCM_REASON_INVALID_SAP;
967 switch(cntrl->t.cntrl.action)
970 cmMemset((U8 *)&rgSchCb[inst].rgmSap[idx], 0, sizeof(RgSchUpSapCb));
971 rgSchCb[inst].rgmSap[idx].sapSta.sapState = LRG_NOT_CFG;
972 cfm->cfm.status = LCM_PRIM_OK;
973 cfm->cfm.reason = LCM_REASON_NOT_APPL;
976 cfm->cfm.status = LCM_PRIM_NOK;
977 cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
978 RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmSapCntrl(): "
979 "invalid action=%d", cntrl->t.cntrl.action);
985 /* Would never come here. */
988 RgMiLrgSchCntrlCfm(cfmPst, cfm);
993 /***********************************************************
995 * Func : SchFillCfmPst
998 * Desc : Fills the Confirmation Post Structure cfmPst using the reqPst
999 * and the cfm->hdr.response.
1006 * File : rg_sch_lmm.c
1008 **********************************************************/
1010 PUBLIC Void SchFillCfmPst
1017 PUBLIC Void SchFillCfmPst(reqPst, cfmPst, cfm)
1027 inst = (reqPst->dstInst - SCH_INST_START);
1029 cfmPst->srcEnt = rgSchCb[inst].rgSchInit.ent;
1030 cfmPst->srcInst = (Inst) 0;
1031 cfmPst->srcProcId = rgSchCb[inst].rgSchInit.procId;
1032 cfmPst->dstEnt = reqPst->srcEnt;
1033 cfmPst->dstInst = (Inst) 0;
1034 cfmPst->dstProcId = reqPst->srcProcId;
1036 cfmPst->selector = cfm->hdr.response.selector;
1037 cfmPst->prior = cfm->hdr.response.prior;
1038 cfmPst->route = cfm->hdr.response.route;
1039 cfmPst->region = cfm->hdr.response.mem.region;
1040 cfmPst->pool = cfm->hdr.response.mem.pool;
1047 * @brief Timer start handler.
1051 * Function : rgSCHLmmStartTmr
1053 * This function based on the input parameters starts the timer for
1054 * "tmrVal" duration. As of now scheduler instance uses the timer
1055 * functionality for BndReq only. Hence there is no conditional
1056 * code based on "tmrEvnt".
1058 * @param[in] S16 tmrEvnt, the Timer Event
1059 * @param[in] U32 tmrVal, the Wait Time
1060 * @param[in] PTR cb, Entry for which Timer expired
1065 PUBLIC S16 rgSCHLmmStartTmr
1068 S16 tmrEvnt, /* Timer Event */
1069 U32 tmrVal, /* Wait Time */
1070 PTR cb /* Entry for which Timer Expired */
1073 PUBLIC S16 rgSCHLmmStartTmr(inst, tmrEvnt, tmrVal, cb)
1074 Inst inst; /* scheduler instance ID */
1075 S16 tmrEvnt; /* Timer Event */
1076 U32 tmrVal; /* Wait Time */
1077 PTR cb; /* Entry for which Timer Expired */
1081 /* Inst dInst = inst + SCH_INST_START; */
1083 TRC2(rgSCHLmmStartTmr)
1087 /* Initialize the arg structure */
1088 cmMemset((U8 *)&arg, 0, sizeof(CmTmrArg));
1090 arg.tqCp = &rgSchCb[inst].tmrTqCp;
1091 arg.tq = rgSchCb[inst].tmrTq;
1092 arg.timers = &((RgSchLowSapCb *)cb)->tmrBlk;
1095 arg.max = RGSCH_MAX_TIMER;
1096 arg.evnt = RGSCH_BNDREQ_TMR;
1105 * @brief Timer stop handler.
1109 * Function : rgSCHLmmStopTmr
1111 * This function based on the input parameters stops the timer for
1112 * "tmrEvnt". As of now Scheduler instance uses the timer functionality for
1113 * BndReq only. Hence there is no conditional code based on "tmrEvnt".
1114 * Once the bind happens and this timer is stopped, the timer functionality
1115 * is deregistered with SSI. As there is no further use of timer processing.
1117 * @param[in] S16 tmrEvnt, the Timer Event
1118 * @param[in] PTR cb, Entry for which Timer expired
1124 PUBLIC S16 rgSCHLmmStopTmr
1126 Inst inst, /* Scheduler instance */
1127 S16 tmrEvnt, /* Timer Event */
1128 PTR cb /* Entry for which Timer Expired */
1131 PUBLIC S16 rgSCHLmmStopTmr(inst, tmrEvnt, cb)
1132 Inst inst; /* Scheduler instance */
1133 S16 tmrEvnt; /* Timer Event */
1134 PTR cb; /* Entry for which Timer Expired */
1141 TRC2(rgSCHLmmStopTmr)
1145 for(i=0;i<RGSCH_MAX_TIMER;i++)
1147 /* Search for the Timer Blocks */
1148 if(((RgSchLowSapCb *)cb)->tmrBlk.tmrEvnt == tmrEvnt)
1150 /* Initialize the arg structure */
1151 cmMemset((U8 *)&arg, 0, sizeof(CmTmrArg));
1153 arg.tqCp = &rgSchCb[inst].tmrTqCp;
1154 arg.tq = rgSchCb[inst].tmrTq;
1155 arg.timers = &(((RgSchLowSapCb *)cb)->tmrBlk);
1157 arg.max = RGSCH_MAX_TIMER;
1174 * @brief Timer Expiry handler.
1178 * Function : rgSCHLmmTmrExpiry
1180 * This is a callback function used as an input parameter to cmPrcTmr()
1181 * to check expiry of any timer. In this function, we are only concerned
1182 * about tmrEvnt=Bind timer.
1184 * @param[in] PTR cb, Entry for which Timer expired
1185 * @param[in] S16 tmrEvnt, the Timer Event
1190 PUBLIC S16 rgSCHLmmTmrExpiry
1192 PTR cb, /* Pointer to timer control block */
1193 S16 tmrEvnt /* Timer Event */
1196 PUBLIC S16 rgSCHLmmTmrExpiry(cb,tmrEvnt)
1197 PTR cb; /* Pointer to timer control block */
1198 S16 tmrEvnt; /* Timer Event */
1202 RgSchLowSapCb *tfuSap = (RgSchLowSapCb *)cb;
1204 Inst inst = tfuSap->cell->instIdx;
1206 TRC2(rgSCHLmmTmrExpiry)
1211 case RGSCH_BNDREQ_TMR:
1212 tfuSap->numBndRetries++;
1213 if(tfuSap->numBndRetries > RGSCH_MAX_BNDRETRY)
1215 rgSCHLmmStaInd((U8)(tfuSap->sapCfg.sapPst.srcInst - SCH_INST_START),
1216 (U16)LCM_CATEGORY_INTERFACE, (U16)LCM_EVENT_BND_FAIL,
1217 (U16)LCM_CAUSE_TMR_EXPIRED, (RgUstaDgn *)NULLP);
1221 /* Restart the bind timer */
1222 if (tfuSap->sapCfg.bndTmr.enb == TRUE)
1224 ret = rgSCHLmmStartTmr((U8)(tfuSap->sapCfg.sapPst.srcInst - SCH_INST_START),
1226 (U32)tfuSap->sapCfg.bndTmr.val, cb);
1229 /* Send bind request */
1230 rgSCHUtlTfuBndReq((U8)(tfuSap->sapCfg.sapPst.srcInst - SCH_INST_START),
1231 tfuSap->sapCfg.suId, tfuSap->sapCfg.spId);
1235 RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "rgSCHLmmTmrExpiry(): Invalid"
1236 " tmrEvnt=%d", tmrEvnt);
1245 * @brief Layer Manager Control Confirm generation handler
1246 * for Bind Confirm reception at TFU interface.
1247 * RgLiTfuBndCfm() forwards the confirmation to this
1248 * function. All SAP state related handling is restricted
1249 * to LMM modules, hence the cfm forwarding.
1253 * Function : rgSCHLmmBndCfm
1255 * This API is used by the LIM module of MAC to forward
1256 * the Bind Confirm it receives over the TFU interface.
1258 * @param[in] Pst *pst, Post Structure
1259 * @param[in] SuId suId, Service user ID
1260 * @param[in] U8 status, Status
1265 PUBLIC S16 rgSCHLmmBndCfm
1267 Pst *pst, /* Post Structure */
1268 SuId suId, /* Service user ID */
1269 U8 status /* Status */
1272 PUBLIC S16 rgSCHLmmBndCfm(pst,suId,status)
1273 Pst *pst; /* Post Structure */
1274 SuId suId; /* Service user Id */
1275 U8 status; /* Status */
1281 Inst inst = (pst->dstInst - SCH_INST_START); /* scheduler instance */
1283 TRC2(rgSCHLmmBndCfm)
1286 /* check the SAP State */
1287 switch(rgSchCb[inst].tfuSap[suId].sapSta.sapState)
1289 case LRG_WAIT_BNDCFM:
1292 /* SAP is already bound */
1298 cfmPst = rgSchCb[inst].rgSchInit.lmPst;
1299 cfmPst.selector = rgSchCb[inst].genCfg.bndCfmResp[suId].response.selector;
1300 cfmPst.prior = rgSchCb[inst].genCfg.bndCfmResp[suId].response.prior;
1301 cfmPst.route = rgSchCb[inst].genCfg.bndCfmResp[suId].response.route;
1302 cfmPst.region = rgSchCb[inst].genCfg.bndCfmResp[suId].response.mem.region;
1303 cfmPst.pool = rgSchCb[inst].genCfg.bndCfmResp[suId].response.mem.pool;
1305 cmMemset((U8 *)&cntrlCfm, 0, sizeof(RgMngmt));
1309 case CM_BND_OK: /* status is OK */
1310 /* Change SAP state to Bound */
1311 rgSchCb[inst].tfuSap[suId].sapSta.sapState = LRG_BND;
1312 if (rgSchCb[inst].tfuSap[suId].sapCfg.bndTmr.enb == TRUE)
1314 ret = rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR, (PTR)&rgSchCb[inst].tfuSap[suId]);
1316 /* Send Control Confirm with status as OK to Layer Manager */
1317 cntrlCfm.cfm.status = LCM_PRIM_OK;
1318 cntrlCfm.cfm.reason = LCM_REASON_NOT_APPL;
1319 /* Sending Status Indication to Layer Manager */
1320 rgSCHLmmStaInd((U8)(rgSchCb[inst].tfuSap->sapCfg.sapPst.srcInst - SCH_INST_START),
1321 LCM_CATEGORY_INTERFACE, LCM_EVENT_BND_OK,
1322 LCM_CAUSE_LYR_SPECIFIC, (RgUstaDgn *)NULLP);
1326 /* Change SAP state to UnBound */
1327 rgSchCb[inst].tfuSap[suId].sapSta.sapState = LRG_UNBND;
1328 if (rgSchCb[inst].tfuSap[suId].sapCfg.bndTmr.enb == TRUE)
1330 ret = rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR, (PTR)&rgSchCb[inst].tfuSap[suId]);
1332 /* Send Control Confirm with status as NOK to Layer Manager */
1333 cntrlCfm.cfm.status = LCM_PRIM_NOK;
1334 cntrlCfm.cfm.reason = LCM_REASON_NEG_CFM;
1337 rgSchCb[inst].tfuSap[suId].numBndRetries = 0;
1338 cntrlCfm.hdr.elmId.elmnt = STTFUSAP;
1339 cntrlCfm.hdr.transId = rgSchCb[inst].genCfg.bndCfmResp[suId].transId;
1341 ret = RgMiLrgSchCntrlCfm(&cfmPst, &cntrlCfm);
1347 * @brief Layer Manager Unsolicited Status Indication generation.
1351 * Function : rgSCHLmmStaInd
1353 * This API is used by the other modules of MAC to send a unsolicited
1354 * status indication to the Layer Manager.
1356 * @param[in] U16 category, the Alarm category
1357 * @param[in] U16 event, the Alarm event
1358 * @param[in] U16 cause, the cause of the Alarm
1359 * @param[in] RgUstaDgn *dgn, Alarm Diagonostics
1364 PUBLIC S16 rgSCHLmmStaInd
1373 PUBLIC S16 rgSCHLmmStaInd(inst, category, event, cause, dgn)
1383 TRC2(rgSCHLmmStaInd)
1385 if(rgSchCb[inst].rgSchInit.usta == FALSE)
1390 cmMemset((U8 *)&usta, 0, sizeof(RgMngmt));
1392 SGetDateTime(&usta.t.usta.cmAlarm.dt);
1393 usta.t.usta.cmAlarm.category = category;
1394 usta.t.usta.cmAlarm.event = event;
1395 usta.t.usta.cmAlarm.cause = cause;
1398 cmMemcpy((U8 *)&usta.t.usta.dgn, (U8 *)dgn, sizeof(RgUstaDgn));
1401 rgSchCb[inst].rgSchInit.lmPst.selector =
1402 rgSchCb[inst].genCfg.ustaResp.response.selector;
1403 rgSchCb[inst].rgSchInit.lmPst.prior =
1404 rgSchCb[inst].genCfg.ustaResp.response.prior;
1405 rgSchCb[inst].rgSchInit.lmPst.route =
1406 rgSchCb[inst].genCfg.ustaResp.response.route;
1407 rgSchCb[inst].rgSchInit.lmPst.region =
1408 rgSchCb[inst].genCfg.ustaResp.response.mem.region;
1409 rgSchCb[inst].rgSchInit.lmPst.pool =
1410 rgSchCb[inst].genCfg.ustaResp.response.mem.pool;
1411 usta.hdr.transId = rgSchCb[inst].genCfg.ustaResp.transId;
1413 RETVALUE(RgMiLrgSchStaInd(&rgSchCb[inst].rgSchInit.lmPst, &usta));
1418 * @brief Scheduler instance timer call back function registered with SSI.
1422 * Function : schActvTmr
1424 * This function is invoked by SSI for every timer activation
1425 * period expiry. Note that SS_MT_TMR flag needs to be enabled for this
1426 * as isntId is needed.As part of SRegTmr call for scheduler instance
1427 * SS_MT_TMR flag needs to be enabled and schActvTmr needs to be given as
1434 PUBLIC S16 schActvTmr
1440 PUBLIC S16 schActvTmr(ent, inst)
1445 Inst schInst = (inst - SCH_INST_START);
1448 /* Check if any timer in the scheduler instance has expired */
1449 cmPrcTmr(&rgSchCb[schInst].tmrTqCp,
1450 rgSchCb[schInst].tmrTq, (PFV) rgSCHLmmTmrExpiry);
1454 } /* end of schActvTmr */
1457 /**********************************************************************
1460 **********************************************************************/