- RETVALUE(RgMiLrgStaInd(&rgCb[inst].rgInit.lmPst, &usta));
-}
-
-\f
-/**
- * @brief Layer Manager Trace Indication generation.
- *
- * @details
- *
- * Function : rgLMMTrcInd
- *
- * This API is used by the other modules of MAC to send a
- * Trace indication to the Layer Manager.
- *
- * @param[in] Inst inst
- * @param[in] Buffer *srcMbuf, the Message Buffer .
- * @param[in] U8 event, the trace event.
- * @return Void
- **/
-#ifdef ANSI
-PUBLIC Void rgLMMTrcInd
-(
-Inst inst,
-Buffer *srcMbuf, /* Message Buffer */
-U8 event /* event */
-)
-#else
-PUBLIC Void rgLMMTrcInd(inst,srcMbuf,event)
-Inst inst;
-Buffer *srcMbuf; /* Message Buffer */
-U8 event; /* event */
-#endif
-{
- Buffer *dstMbuf = NULLP;
- MsgLen bufLen = 0;
- Data *tempBuf;
- MsgLen tempCnt;
- RgMngmt trc;
- Pst pst;
-
- TRC2(rgLMMTrcInd)
-
-
- if ((rgCb[inst].trcLen == LRG_NO_TRACE) || (srcMbuf == NULLP))
- {
- RLOG0(L_ERROR, "Trace Disabled.");
- RETVOID;
- }
-
- cmMemset((U8 *)&trc, 0, sizeof(RgMngmt));
-
- pst = rgCb[inst].rgInit.lmPst;
- pst.selector = rgCb[inst].genCfg.trcResp.response.selector;
- pst.prior = rgCb[inst].genCfg.trcResp.response.prior;
- pst.route = rgCb[inst].genCfg.trcResp.response.route;
- pst.region = rgCb[inst].genCfg.trcResp.response.mem.region;
- pst.pool = rgCb[inst].genCfg.trcResp.response.mem.pool;
-
- trc.hdr.transId = rgCb[inst].genCfg.trcResp.transId;
-
- SGetDateTime(&trc.t.trc.dt);
-
- /* Check if the whole buffer is to be sent in Trace indication */
- if(rgCb[inst].trcLen == LRG_FULL_TRACE)
- {
- if (SCpyMsgMsg(srcMbuf, pst.region, pst.pool, &dstMbuf)
- != ROK)
- {
- RLOG0(L_ERROR, "SCpyMsgMsg Failed.");
- RETVOID;
- }
- trc.cfm.status = LCM_PRIM_OK;
- trc.cfm.reason = LCM_REASON_NOT_APPL;
- trc.t.trc.evnt = event;
-
- /* Send Trace Indication to Layer manager */
- RgMiLrgTrcInd(&pst, &trc, dstMbuf);
- }
- /* check if only a specified number of bytes are to be sent */
- else if(rgCb[inst].trcLen > 0)
- {
- /* Get the length of the recvd message buffer */
- if (SFndLenMsg(srcMbuf, &bufLen) != ROK)
- {
- RLOG0(L_ERROR, "SFndLenMsg Failed.");
- RETVOID;
- }
- /* Check if the recvd buffer size is less than request trace len */
- if(bufLen < rgCb[inst].trcLen)
- {
- /* Copy the whole of the recvd buffer in trace indication */
-
- if (SCpyMsgMsg(srcMbuf, pst.region, pst.pool, &dstMbuf)
- != ROK)
- {
- RLOG0(L_ERROR, "SCpyMsgMsg Failed.");
- RETVOID;
- }
-
- trc.cfm.status = LCM_PRIM_OK;
- trc.cfm.reason = LCM_REASON_NOT_APPL;
- trc.t.trc.evnt = event;
-
- /* Send Trace Indication to Layer manager */
- RgMiLrgTrcInd(&pst, &trc, dstMbuf);
- }
- /* if the recvd buffer size is greater than request trace len */
- if(bufLen >= rgCb[inst].trcLen)
- {
- /* Get a temporary buffer to store the msg */
- if (rgAllocSBuf(inst,&tempBuf, rgCb[inst].trcLen) != ROK)
- {
- RLOG0(L_ERROR, "rgAllocSBuf Failed.");
- RETVOID;
- }
-
- /* Copy trcLen nos of bytes from the recvd message */
- if (SCpyMsgFix(srcMbuf,0,rgCb[inst].trcLen,tempBuf,&tempCnt) != ROK)
- {
- RLOG0(L_ERROR, "SCpyMsgFix Failed.");
- RETVOID;
- }
-
- if (SGetMsg(pst.region, pst.pool, &dstMbuf) != ROK)
- {
- RLOG0(L_ERROR, "dstMbuf Allocation Failed");
- RETVOID;
- }
- /* Copy the tempBuf data to dst mBuf */
- if (SCpyFixMsg(tempBuf,dstMbuf,0,rgCb[inst].trcLen,&tempCnt) != ROK)
- {
- RLOG0(L_ERROR, "SCpyFixMsg Failed.");
- RETVOID;
- }
-
- /*ccpu00117052 - MOD - Passing double pointer for proper NULLP
- assignment */
- /* Free the memory allocated for tempBuf */
- rgFreeSBuf(inst,&tempBuf, rgCb[inst].trcLen);
-
- trc.cfm.status = LCM_PRIM_OK;
- trc.cfm.reason = LCM_REASON_NOT_APPL;
- trc.t.trc.evnt = event;
-
- /* Send Trace Indication to Layer manager */
- RgMiLrgTrcInd(&pst, &trc, dstMbuf);
- }
- }
- RETVOID;
-}
-
-\f
-/**
- * @brief Layer Manager Control Confirm generation handler
- * for Bind Confirm reception at TFU interface.
- * RgLiTfuBndCfm() forwards the confirmation to this
- * function. All SAP state related handling is restricted
- * to LMM modules, hence the cfm forwarding.
- *
- * @details
- *
- * Function : rgLMMBndCfm
- *
- * This API is used by the LIM module of MAC to forward
- * the Bind Confirm it receives over the TFU interface.
- *
- * @param[in] Pst *pst, Post Structure
- * @param[in] SuId suId, Service user ID
- * @param[in] U8 status, Status
- * @return S16
- * -# ROK
- **/
-#ifdef ANSI
-PUBLIC S16 rgLMMBndCfm
-(
-Pst *pst, /* Post Structure */
-SuId suId, /* Service user ID */
-U8 status /* Status */
-)
-#else
-PUBLIC S16 rgLMMBndCfm(pst,suId,status)
-Pst *pst; /* Post Structure */
-SuId suId; /* Service user ID */
-U8 status; /* Status */
-#endif
-{
- Inst inst = pst->dstInst - RG_INST_START;
- S16 ret = ROK;
- RgMngmt cntrlCfm;
- Pst cfmPst;
-
- TRC3(rgLMMBndCfm)
-
- UNUSED(pst);
-
- /* Check if the suId is valid */
- if(rgCb[inst].tfuSap.sapCfg.suId != suId)
- {
- RLOG0(L_ERROR, "Invalid SuId");
- RETVALUE(RFAILED);
- }
-
- /* check the Sap State */
- switch(rgCb[inst].tfuSap.sapSta.sapState)
- {
- case LRG_WAIT_BNDCFM:
- break;
- case LRG_BND:
- /* SAP is already bound */
- RETVALUE(ROK);
- default:
- RETVALUE(RFAILED);
- }
-
- cfmPst = rgCb[inst].rgInit.lmPst;
- cfmPst.selector = rgCb[inst].genCfg.bndCfmResp.response.selector;
- cfmPst.prior = rgCb[inst].genCfg.bndCfmResp.response.prior;
- cfmPst.route = rgCb[inst].genCfg.bndCfmResp.response.route;
- cfmPst.region = rgCb[inst].genCfg.bndCfmResp.response.mem.region;
- cfmPst.pool = rgCb[inst].genCfg.bndCfmResp.response.mem.pool;
-
- cmMemset((U8 *)&cntrlCfm, 0, sizeof(RgMngmt));
-
- switch(status)
- {
- case CM_BND_OK: /* status is OK */
- /* Change SAP state to Bound */
- rgCb[inst].tfuSap.sapSta.sapState = LRG_BND;
- if (rgCb[inst].tfuSap.sapCfg.bndTmr.enb == TRUE)
- {
- ret = rgLMMStopTmr(inst,RG_BNDREQ_TMR, (PTR)&rgCb[inst].tfuSap);
- }
- /* Send Control Confirm with status as OK to Layer Manager */
- cntrlCfm.cfm.status = LCM_PRIM_OK;
- cntrlCfm.cfm.reason = LCM_REASON_NOT_APPL;
- break;
-
- default:
- /* Change SAP state to UnBound */
- rgCb[inst].tfuSap.sapSta.sapState = LRG_UNBND;
- if (rgCb[inst].tfuSap.sapCfg.bndTmr.enb == TRUE)
- {
- ret = rgLMMStopTmr(inst,RG_BNDREQ_TMR, (PTR)&rgCb[inst].tfuSap);
- }
- /* Send Control Confirm with status as NOK to Layer Manager */
- cntrlCfm.cfm.status = LCM_PRIM_NOK;
- cntrlCfm.cfm.reason = LCM_REASON_NEG_CFM;
- break;
- }
- rgCb[inst].tfuSap.numBndRetries = 0;
- cntrlCfm.hdr.elmId.elmnt = STTFUSAP;
- cntrlCfm.hdr.transId = rgCb[inst].genCfg.bndCfmResp.transId;
-
- ret = RgMiLrgCntrlCfm(&cfmPst, &cntrlCfm);
-
- RETVALUE(ret);
-}
-
-\f
-/**
- * @brief LTE MAC timer call back function registered with SSI.
- *
- * @details
- *
- * Function : rgActvTmr
- *
- * This function is invoked by SSI for every timer activation
- * period expiry.
- *
- * @return S16
- * -# ROK
- **/
-#ifdef ANSI
-PUBLIC S16 rgActvTmr
-(
- Ent ent,
- Inst inst
-)
-#else
-PUBLIC S16 rgActvTmr(ent, inst)
-Ent ent;
-Inst inst;
-#endif
-{
- Inst macInst = (inst - RG_INST_START);
- TRC3(rgActvTmr)
-
- /* Check if any MAC timer has expired */
- cmPrcTmr(&rgCb[macInst].tmrTqCp, rgCb[macInst].tmrTq, (PFV) rgLMMTmrExpiry);
-
- RETVALUE(ROK);
-
-} /* end of rgActvTmr */
-
-/**
- * @brief Layer Manager Configuration request handler for Scheduler
- *
- * @details
- *
- * Function : MacSchGenCfgReq
- *
- * This function receives general configurations for Scheduler
- * from DU APP and forwards to Scheduler.
- *
- * @param[in] Pst *pst, the post structure
- * @param[in] RgMngmt *cfg, the configuration parameter's structure
- * @return S16
- * -# ROK
- **/
-#ifdef ANSI
-PUBLIC S16 MacSchGenCfgReq
-(
-Pst *pst, /* post structure */
-RgMngmt *cfg /* config structure */
-)
-#else
-PUBLIC S16 MacSchGenCfgReq(pst, cfg)
-Pst *pst; /* post structure */
-RgMngmt *cfg; /* config structure */
-#endif
-{
- printf("\nReceived Scheduler gen config at MAC");
- pst->dstInst = DEFAULT_CELLS + 1;
- HandleSchGenCfgReq(pst, cfg);
-
- return ROK;
-}
-
-/**
- * @brief Layer Manager Configuration response from Scheduler
- *
- * @details
- *
- * Function : SchSendCfgCfm
- *
- * This function sends general configurations response from
- * Scheduler to DU APP.
- *
- * @param[in] Pst *pst, the post structure
- * @param[in] RgMngmt *cfm, the configuration confirm structure
- * @return S16
- * -# ROK
- **/
-#ifdef ANSI
-PUBLIC S16 SchSendCfgCfm
-(
-Pst *pst, /* post structure */
-RgMngmt *cfm /* config confirm structure */
-)
-#else
-PUBLIC S16 SchSendCfgCfm(pst, cfm)
-Pst *pst; /* post structure */
-RgMngmt *cfm; /* config confirm structure */
-#endif
-{
- printf("\nSending Scheduler config confirm to DU APP");
- pst->dstEnt = ENTDUAPP;
- pst->dstInst = 0;
- pst->srcInst = 0;
- pst->selector = MAC_SCH_LC_SELECTOR;
- RgMiLrgSchCfgCfm(pst, cfm);
-
- RETVALUE(ROK);