-/***********************************************************
- *
- * Func : rgLMMShutdown
- *
- *
- * Desc : Handles the MAC layer shutdown request. Calls
- * rgCFGFreeCellCb(RgCellCb*) to handle each cellCb deallocation.
- *
- *
- * Ret : Void
- *
- * Notes:
- *
- * File : rg_lmm.c
- *
- **********************************************************/
-#ifdef ANSI
-PRIVATE Void rgLMMShutdown
-(
-Inst inst
-)
-#else
-PRIVATE Void rgLMMShutdown(inst)
-Inst inst;
-#endif
-{
- RgCellCb *cell = rgCb[inst].cell;
- U8 idx;
-
- TRC2(rgLMMShutdown)
-
- /* Unbind the TFU Sap */
- if(rgCb[inst].tfuSap.sapSta.sapState == LRG_WAIT_BNDCFM)
- {
- rgLIMTfuUbndReq(inst,rgCb[inst].tfuSap.sapCfg.spId, LRG_UNBND);
- if (rgCb[inst].tfuSap.sapCfg.bndTmr.enb == TRUE)
- {
- rgLMMStopTmr(inst,RG_BNDREQ_TMR, (PTR)&rgCb[inst].tfuSap);
- }
- rgCb[inst].tfuSap.sapSta.sapState = LRG_UNBND;
- }
- if(rgCb[inst].tfuSap.sapSta.sapState == LRG_BND)
- {
- rgLIMTfuUbndReq(inst,rgCb[inst].tfuSap.sapCfg.spId, LRG_UNBND);
- rgCb[inst].tfuSap.sapSta.sapState = LRG_UNBND;
- }
-
-
- if(cell != NULLP)
- {
- for(idx=0;idx < RG_NUM_SUB_FRAMES; idx++)
- {
- rgTOMRlsSf(inst,&cell->subFrms[idx]);
- }
-
- rgCFGFreeCellCb(cell);
- }
-
- /* Deleting the RGU SAPs */
- SPutSBuf(rgCb[inst].rgInit.region,
- rgCb[inst].rgInit.pool,
- (Data *)rgCb[inst].rguSap,
- (sizeof(RgUpSapCb) * rgCb[inst].numRguSaps));
- rgCb[inst].rguSap = NULLP;
-
- rgCb[inst].inactiveCell = NULLP;
- rgCb[inst].cell = NULLP;
-
- /* De-register the Timer Service */
- (Void) SDeregTmrMt(rgCb[inst].rgInit.ent, rgCb[inst].rgInit.inst,
- (S16)rgCb[inst].genCfg.tmrRes, rgActvTmr);
-
- /* call back the task initialization function to intialize
- * the global RgCb Struct */
- rgActvInit(rgCb[inst].rgInit.ent, rgCb[inst].rgInit.inst, rgCb[inst].rgInit.region,
- rgCb[inst].rgInit.reason);
-
- RETVOID;
-}
-
-\f
-/***********************************************************
- *
- * Func : rgLMMGenCntrl
- *
- *
- * Desc : Processes the LM control request for STGEN elmnt.
- *
- *
- * Ret : Void
- *
- * Notes:
- *
- * File : rg_lmm.c
- *
- **********************************************************/
-#ifdef ANSI
-PRIVATE Void rgLMMGenCntrl
-(
-RgMngmt *cntrl,
-RgMngmt *cfm,
-Pst *cfmPst
-)
-#else
-PRIVATE Void rgLMMGenCntrl(cntrl, cfm, cfmPst)
-RgMngmt *cntrl;
-RgMngmt *cfm;
-Pst *cfmPst;
-#endif
-{
- Inst inst = (cfmPst->srcInst - RG_INST_START);
- TRC2(rgLMMGenCntrl)
-
- cfm->cfm.status = LCM_PRIM_OK;
- cfm->cfm.reason = LCM_REASON_NOT_APPL;
-
-
- switch(cntrl->t.cntrl.action)
- {
- case AENA:
- /* Action is Enable */
- switch(cntrl->t.cntrl.subAction)
- {
- case SATRC:
- /* Enable Traces */
- rgCb[inst].rgInit.trc = TRUE;
- rgCb[inst].trcLen = cntrl->t.cntrl.s.trcLen;
- /*Store the response and TransId for sending the Traces */
- cmMemcpy((U8 *)&rgCb[inst].genCfg.trcResp.response,
- (U8 *)&cntrl->hdr.response, sizeof(Resp));
- rgCb[inst].genCfg.trcResp.transId = cntrl->hdr.transId;
-
- break;
- case SAUSTA:
- /* Enable Unsolicited Status (alarms) */
- rgCb[inst].rgInit.usta = TRUE;
- /*Store the response and TransId for sending the Alarms */
- cmMemcpy((U8 *)&rgCb[inst].genCfg.ustaResp.response,
- (U8 *)&cntrl->hdr.response, sizeof(Resp));
- rgCb[inst].genCfg.ustaResp.transId = cntrl->hdr.transId;
- break;
- case SADBG:
- /* Enable Debug Printing */
-#ifdef DEBUGP
- rgCb[inst].rgInit.dbgMask |= cntrl->t.cntrl.s.rgDbgCntrl.dbgMask;
-#endif
- break;
-#ifdef SS_DIAG
- case SALOG:
- rgCb[inst].rgInit.logMask = cntrl->t.cntrl.s.logMask;
- break;
-#endif
-
- default:
- cfm->cfm.status = LCM_PRIM_NOK;
- cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
- RLOG1(L_ERROR, "invalid subaction=%d",cntrl->t.cntrl.subAction);
- break;
- }
- break;
- case ADISIMM:
- /* Action is Diable immidiately */
- switch(cntrl->t.cntrl.subAction)
- {
- case SATRC:
- /* Disable Traces */
- rgCb[inst].rgInit.trc = FALSE;
- break;
- case SAUSTA:
- /* Disable Unsolicited Status (alarms) */
- rgCb[inst].rgInit.usta = FALSE;
- break;
- case SADBG:
- /* Disable Debug Printing */
-#ifdef DEBUGP
- rgCb[inst].rgInit.dbgMask &=~cntrl->t.cntrl.s.rgDbgCntrl.dbgMask;
-#endif
- break;
-#ifdef SS_DIAG
- case SALOG:
- rgCb[inst].rgInit.logMask = cntrl->t.cntrl.s.logMask;
- break;
-#endif
-
- default:
- cfm->cfm.status = LCM_PRIM_NOK;
- cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
- RLOG1(L_ERROR, "invalid subaction=%d",cntrl->t.cntrl.subAction);
- break;
- }
- break;
- case ASHUTDOWN:
- /* Free all the memory dynamically allocated by MAC */
- rgLMMShutdown(inst);
- break;
- default:
- cfm->cfm.status = LCM_PRIM_NOK;
- cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
- RLOG1(L_ERROR, "invalid action=%d",cntrl->t.cntrl.action);
- break;
- }
- RgMiLrgCntrlCfm(cfmPst, cfm);
- RETVOID;
-}
-
-\f
-/***********************************************************
- *
- * Func : rgLMMSapCntrl
- *
- *
- * Desc : Processes the LM control request for STxxxSAP elmnt.
- *
- *
- * Ret : Void
- *
- * Notes:
- *
- * File : rg_lmm.c
- *
- **********************************************************/
-#ifdef ANSI
-PRIVATE Void rgLMMSapCntrl
-(
-RgMngmt *cntrl,
-RgMngmt *cfm,
-Pst *cfmPst
-)
-#else
-PRIVATE Void rgLMMSapCntrl(cntrl, cfm, cfmPst)
-RgMngmt *cntrl;
-RgMngmt *cfm;
-Pst *cfmPst;
-#endif
-{
- Inst inst = cfmPst->srcInst - RG_INST_START;
- TRC2(rgLMMSapCntrl)
-
- /* Only TFU Sap can be controlled by LM */
- switch(cntrl->hdr.elmId.elmnt)
- {
- case STTFUSAP:
- switch(cntrl->t.cntrl.action)
- {
- case ABND:
- /* Bind Enable Request */
- if ((rgCb[inst].tfuSap.sapSta.sapState == LRG_NOT_CFG) ||
- (rgCb[inst].tfuSap.sapSta.sapState == LRG_BND))
- {
- cfm->cfm.status = LCM_PRIM_NOK;
- cfm->cfm.reason = LCM_REASON_INVALID_SAP;
- }
- else
- {
- if (rgCb[inst].tfuSap.sapCfg.bndTmr.enb == TRUE)
- {
- rgLMMStartTmr(inst,RG_BNDREQ_TMR, rgCb[inst].tfuSap.sapCfg.bndTmr.val,
- (PTR)&rgCb[inst].tfuSap);
- }
- /* Change SAP state */
- rgCb[inst].tfuSap.sapSta.sapState = LRG_WAIT_BNDCFM;
- rgCb[inst].tfuSap.numBndRetries++;
- /* Store the response and TransId for sending
- * the Control confirm */
- cmMemcpy((U8 *)&rgCb[inst].genCfg.bndCfmResp.response,
- (U8 *)&cntrl->hdr.response, sizeof(Resp));
- rgCb[inst].genCfg.bndCfmResp.transId = cntrl->hdr.transId;
-
- /* Sending Status Indication to Layer Manager */
- cfm->cfm.status = LCM_PRIM_OK_NDONE;
- cfm->cfm.reason = LCM_REASON_NOT_APPL;
- RgMiLrgCntrlCfm(cfmPst, cfm);
-
- rgLIMTfuBndReq(inst,rgCb[inst].tfuSap.sapCfg.suId,
- rgCb[inst].tfuSap.sapCfg.spId);
- RETVOID;
- }
- break;
- case AUBND:
- /* Unbind request */
-
- /* Check if the SAP is configured */
- if( (rgCb[inst].tfuSap.sapSta.sapState == LRG_NOT_CFG) ||
- (rgCb[inst].tfuSap.sapSta.sapState == LRG_UNBND))
- {
- cfm->cfm.status = LCM_PRIM_NOK;
- cfm->cfm.reason = LCM_REASON_INVALID_MSGTYPE;
- }
- else
- {
- rgLIMTfuUbndReq(inst,rgCb[inst].tfuSap.sapCfg.spId, TFU_UBNDREQ_MNGMT);
- if (rgCb[inst].tfuSap.sapCfg.bndTmr.enb == TRUE)
- {
- rgLMMStopTmr(inst,RG_BNDREQ_TMR, (PTR)&rgCb[inst].tfuSap);
- }
- /* Change SAP state */
- rgCb[inst].tfuSap.sapSta.sapState = LRG_UNBND;
- cfm->cfm.status = LCM_PRIM_OK;
- cfm->cfm.reason = LCM_REASON_NOT_APPL;
- }
- break;
- case ADEL:
- /* Delete SAP, does initialization of SAP */
- if ((rgCb[inst].tfuSap.sapSta.sapState == LRG_WAIT_BNDCFM) ||
- (rgCb[inst].tfuSap.sapSta.sapState == LRG_BND))
- {
- rgLIMTfuUbndReq(inst,rgCb[inst].tfuSap.sapCfg.spId, TFU_UBNDREQ_MNGMT);
- if (rgCb[inst].tfuSap.sapCfg.bndTmr.enb == TRUE)
- {
- rgLMMStopTmr(inst,RG_BNDREQ_TMR, (PTR)&rgCb[inst].tfuSap);
- }
- }
- cmMemset((U8 *)&rgCb[inst].tfuSap, 0, sizeof(RgLowSapCb));
- rgCb[inst].tfuSap.sapSta.sapState = LRG_NOT_CFG;
- cfm->cfm.status = LCM_PRIM_OK;
- cfm->cfm.reason = LCM_REASON_NOT_APPL;
- break;
- default:
- cfm->cfm.status = LCM_PRIM_NOK;
- cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
- RGDBGERRNEW(inst,(rgPBuf(inst), "\nrgLMMSapCntrl(): invalid action=%d",
- cntrl->t.cntrl.action));
- break;
- }
- break;
- case STRGUSAP:
- switch(cntrl->t.cntrl.action)
- {
- case ADEL:
- cmMemset((U8 *)&rgCb[inst].rguSap[cntrl->t.cntrl.instId], 0, sizeof(RgUpSapCb));
- rgCb[inst].rguSap[cntrl->t.cntrl.instId].sapSta.sapState = LRG_NOT_CFG;
- cfm->cfm.status = LCM_PRIM_OK;
- cfm->cfm.reason = LCM_REASON_NOT_APPL;
- break;
- default:
- cfm->cfm.status = LCM_PRIM_NOK;
- cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
- RGDBGERRNEW(inst,(rgPBuf(inst), "\nrgLMMSapCntrl(): invalid action=%d",
- cntrl->t.cntrl.action));
- break;
- }
- break;
- case STCRGSAP:
- switch(cntrl->t.cntrl.action)
- {
- case ADEL:
- cmMemset((U8 *)&rgCb[inst].crgSap, 0, sizeof(RgUpSapCb));
- rgCb[inst].crgSap.sapSta.sapState = LRG_NOT_CFG;
- cfm->cfm.status = LCM_PRIM_OK;
- cfm->cfm.reason = LCM_REASON_NOT_APPL;
- break;
- default:
- cfm->cfm.status = LCM_PRIM_NOK;
- cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
- RLOG1(L_ERROR, "invalid action=%d",cntrl->t.cntrl.action);
-
- break;
- }
- break;
- default:
- /* Would never here. */
- RETVOID;
- }
- RgMiLrgCntrlCfm(cfmPst, cfm);
- RETVOID;
-}
-
-\f