-\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");
- RgMiLrgSchCfgCfm(pst, cfm);
-
- RETVALUE(ROK);
-}
-
-/**
- * @brief Layer Manager Configuration request handler.
- *
- * @details
- *
- * Function : MacSchCfgReq
- *
- * This function handles the gNB and cell configuration
- * request received from DU APP.
- * This API unapcks and forwards the config towards SCH
- *
- * @param[in] Pst *pst
- * @param[in] RgrCfgTransId transId
- * @param[in] RgrCfgReqInfo *cfgReqInfo
- * @return S16
- * -# ROK
- **/
-#ifdef ANSI
-PUBLIC S16 MacSchCfgReq
-(
- Pst *pst,
- RgrCfgTransId transId,
- RgrCfgReqInfo *cfgReqInfo
-)
-#else
-PUBLIC S16 MacSchCfgReq(pst, transId, cfgReqInfo)
- Pst *pst;
- RgrCfgTransId transId;
- RgrCfgReqInfo *cfgReqInfo;
-#endif
-{
- printf("\nReceived Scheduler config at MAC");
- pst->dstInst = DEFAULT_CELLS + 1;
- HandleSchCfgReq(pst, transId, cfgReqInfo);
-
- RETVALUE(ROK);
-
-} /* end of MacSchCfgReq*/
-
-\f
-/***********************************************************
- *
- * Func : macCellCfgFillCfmPst
- *
- *
- * Desc : Fills the Confirmation Post Structure cfmPst
- *
- * Ret : Void
- *
- * Notes:
- *
- * File : rg_lmm.c
- *
- **********************************************************/
-Void macCellCfgFillCfmPst
-(
-Pst *reqPst,
-Pst *cfmPst
-)
-{
- Inst inst;
- inst = reqPst->dstInst;
-
- cfmPst->srcEnt = rgCb[inst].rgInit.ent;
- cfmPst->srcInst = rgCb[inst].rgInit.inst;
- cfmPst->srcProcId = rgCb[inst].rgInit.procId;
-
- cfmPst->srcEnt = reqPst->dstEnt;
- cfmPst->dstEnt = reqPst->srcEnt;
- cfmPst->srcInst = reqPst->dstInst;
- cfmPst->dstInst = reqPst->srcInst;
- cfmPst->srcProcId = reqPst->dstProcId;
- cfmPst->dstProcId = reqPst->srcProcId;
-
- cfmPst->selector = LRG_SEL_LC;
- cfmPst->prior = reqPst->prior;
- cfmPst->route = reqPst->route;
- cfmPst->region = reqPst->region;
- cfmPst->pool = reqPst->pool;
- cfmPst->event = EVENT_MAC_CELL_CONFIG_CFM;
-
- RETVOID;
-}
-
-/**
- * @brief Layer Manager Configuration request handler.
- *
- * @details
- *
- * Function : MacHdlCellCfgReq
- *
- * This function handles the gNB and cell configuration
- * request received from DU APP.
- * This API unapcks and forwards the config towards SCH
- *
- * @param[in] Pst *pst
- * @param[in] MacCellCfg *macCellCfg
- * @return S16
- * -# ROK
- **/
-S16 MacHdlCellCfgReq
-(
- Pst *pst,
- MacCellCfg *macCellCfg
-)
-{
- U16 ret = ROK;
- MacCellCfgCfm macCellCfgCfm;
- RgCellCb *cellCb;
- Pst cnfPst;
- Inst inst = pst->dstInst;
-
- cellCb = rgCb[inst].cell;
- memcpy(&cellCb->macCellCfg,macCellCfg,sizeof(MacCellCfg));
-
- macCellCfgFillCfmPst(pst,&cnfPst);
-
- macCellCfgCfm.transId = macCellCfg->transId;
-
- ret = (*packMacCellCfmOpts[cnfPst.selector])(&cnfPst,&macCellCfgCfm);
- return ret;
-} /* end of MacHdlCellCfgReq */
-
-\f