return ROK;\r
}\r
\r
+#ifdef CALL_FLOW_DEBUG_LOG\r
/**************************************************************************\r
* @brief function prints src, dest, msg info about all the msgs received \r
*\r
}\r
DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);\r
}\r
+#endif\r
+\r
/**************************************************************************\r
* @brief Task Activation callback function. \r
*\r
}
#endif /* FAPI */
+#ifdef CALL_FLOW_DEBUG_LOG
/*******************************************************************
* @brief Function prints src, dest, msg infor about all the msgs that
received.
}
DU_LOG("\nCall Flow: PHY -> ENTLWRMAC : %s\n",message);
}
+#endif
/*******************************************************************
*
/* Process a config. request */
cmUnpkLrgSchCfgReq(MacSchGenCfgReq, pst, mBuf);
break;
- case EVTLRGCNTRLREQ:
- /* Process a control request */
- cmUnpkLrgCntrlReq(RgMiLrgCntrlReq, pst, mBuf);
- break;
- case EVTLRGSSTAREQ:
- /* Process a status request */
- cmUnpkLrgStaReq(RgMiLrgStaReq, pst, mBuf);
- break;
case EVTLRGSTSREQ:
/* Process a statistics request */
cmUnpkLrgStsReq(RgMiLrgStsReq, pst, mBuf);
case EVTCRGUBNDREQ:
cmUnpkCrgUbndReq(RgUiCrgUbndReq, pst, mBuf);
break;
- case EVTCRGCFGREQ:
- cmUnpkCrgCfgReq(RgUiCrgCfgReq, pst, mBuf);
- break;
#endif
default:
RG_FREE_MSG(mBuf);
case EVTINFRLSRNTIREQ:
cmUnpkSchMacRlsRntiReq(RgSchMacRlsRntiReq, pst, mBuf);
break;
-#ifdef LTEMAC_SPS
- case EVTINFSPSLCREG:
- cmUnpkSchMacSpsLcRegReq(RgSchMacSpsLcRegReq, pst, mBuf);
- break;
- case EVTINFSPSLCDEREG:
- cmUnpkSchMacSpsLcDeregReq(RgSchMacSpsLcDeregReq, pst, mBuf);
- break;
- case EVTINFSPSRESET:
- cmUnpkSchMacUlSpsResetReq(RgSchMacUlSpsResetReq, pst, mBuf);
- break;
-#endif /* LTEMAC_SPS */
#ifdef LTE_L2_MEAS
case EVTINFL2MEASREQ:
cmUnpkSchMacL2MeasReq(RgSchMacL2MeasReq, pst, mBuf);
cmUnpkSchMacL2MeasStopReq(RgSchMacL2MeasStopReq, pst , mBuf);
break;
#endif/* LTE_L2_MEAS */
- case EVTINFLCGREG:
- cmUnpkSchMacLcgRegReq(RgSchMacLcgRegReq, pst, mBuf);
- break;
-#endif
+#endif /* LCRG */
#if defined(LTE_ADV) && defined(LCPRG)
case EVTPRGUESCELLCFGREQ:
{
}
}
+#ifdef CALL_FLOW_DEBUG_LOG
/**
* @brief Function prints src, dest, msg infor about all the msgs that received.
*
case EVTMACSCHGENCFGREQ:
strcpy(message,"EVTMACSCHGENCFGREQ");
break;
- case EVTLRGCNTRLREQ:
- strcpy(message,"EVTLRGCNTRLREQ");
- break;
- case EVTLRGSSTAREQ:
- strcpy(message,"EVTLRGSSTAREQ");
- break;
- case EVTLRGSTSREQ:
- strcpy(message,"EVTLRGSTSREQ");
- break;
#endif /* LCRGMILRG */
case EVENT_MAC_CELL_CONFIG_REQ:
strcpy(message,"EVENT_MAC_CELL_CONFIG_REQ");
case EVTINFRLSRNTIREQ:
strcpy(message,"EVTINFRLSRNTIREQ");
break;
-#ifdef LTEMAC_SPS
- case EVTINFSPSLCREG:
- strcpy(message,"EVTINFSPSLCREG");
- break;
- case EVTINFSPSLCDEREG:
- strcpy(message,"EVTINFSPSLCDEREG");
- break;
- case EVTINFSPSRESET:
- strcpy(message,"EVTINFSPSRESET");
- break;
-#endif /* LTEMAC_SPS */
- case EVTINFLCGREG:
- strcpy(message,"EVTINFLCGREG");
- break;
#endif
#if defined(LTE_ADV) && defined(LCPRG)
case EVTPRGUESCELLCFGREQ:
}
DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);
}
+#endif
\f
-/**********************************************************************
-\f
/**
* @brief Task Activation callback function.
*
/* Value used to set nDmrs in uplink grant if nDmrs is not applicable */
#define RG_INVALID_NDMRS 10
-#define RG_SEND_TRC_IND(_inst,_mBuf, _event) rgLMMTrcInd(_inst,_mBuf, _event)
-
/* Note: Any changes to these enums should reflect to */
/** @details Enums for special argument
*
S16 rgLMMTmrExpiry ARGS((PTR cb, S16 tmrEvnt));
/* To send a Unsolicited Status Indication to Layer Manager */
S16 rgLMMStaInd ARGS((Inst inst,uint16_t category, uint16_t event, uint16_t cause, RgUstaDgn *dgn));
-/* To send a Trace Indication to Layer Manager.
- * srcMbuf is not freed. caller has to take care. */
-Void rgLMMTrcInd ARGS((Inst inst,Buffer *srcMbuf, uint8_t event));
/* LIM uses this to forward the BndCfm to LMM. This function invokes a
* Control Confirmation to the LM. */
-S16 rgLMMBndCfm ARGS((Pst *pst, SuId suId, uint8_t status));
S16 rgActvTmr ARGS((Ent ent, Inst inst ));
S16 rgActvInit ARGS((Ent entity, Inst inst, Region
region, Reason reason));
S16 rgActvTsk ARGS((Pst *pst, Buffer *mBuf));
-/*
- * APIs exposed by CFG module
- */
-S16 rgCFGVldtCrgCellCfg ARGS((Inst inst,CrgCellCfg *cellCfg, RgErrInfo *errInfo));
-S16 rgCFGVldtCrgUeCfg ARGS((Inst inst,CrgUeCfg *ueCfg, RgCellCb **cell, RgErrInfo
- *errInfo));
-S16 rgCFGVldtCrgLcCfg ARGS((Inst inst,CrgLchCfg *lcCfg, RgCellCb **cell, RgUeCb
- **ue, RgErrInfo *errInfo));
-S16 rgCFGVldtCrgCellRecfg ARGS((Inst inst,CrgCellRecfg *cellRecfg, RgCellCb **cell,
- RgErrInfo *errInfo));
-S16 rgCFGVldtCrgUeRecfg ARGS((Inst inst,CrgUeRecfg *ueRecfg, RgCellCb **cell,
- RgUeCb **ue, RgErrInfo *errInfo));
-S16 rgCFGVldtCrgLcRecfg ARGS((Inst inst,CrgLchRecfg *lcRecfg, RgCellCb **cell,
- RgUeCb **ue, RgUlLcCb **ulLc, RgErrInfo *errInfo));
-S16 rgCFGVldtCrgUeReset ARGS ((Inst inst,CrgRst *reset,RgCellCb **cell,RgUeCb **ue,
- RgErrInfo *errInfo));
-
-S16 rgCFGCrgCellCfg ARGS((Inst inst,CrgCellCfg *cellCfg, RgErrInfo *errInfo));
-S16 rgCFGCrgUeCfg ARGS((Inst inst,RgCellCb *cell, CrgUeCfg *ueCfg, RgErrInfo
- *errInfo));
-
-#ifdef LTE_ADV
-S16 rgFillAndAddSCellCfg ARGS((Inst inst, RgCellCb *cell,
- CrgUeRecfg *ueRecfg, CrgCfgTransId transId, Bool *isCfmRqrd));
-S16 rgDelUeFrmAllSCell ARGS(( RgCellCb *cell, RgUeCb *ue));
-S16 rgUtlVltdAddSCellCfg ARGS ((RgPrgUeSCellCfgInfo *ueSCellCb,
- RgCellCb *cell,
- Inst inst
- ));
-S16 rgCfgAddUeSCellCfg ARGS ((Inst dstMacInst,
- RgPrgUeSCellCfgInfo *ueSCellCb,
- RgCellCb *cell
- ));
-#endif /* LTE_ADV */
-
-S16 rgCFGCrgLcCfg ARGS((Inst inst,RgCellCb *cell, RgUeCb *ue, CrgLchCfg
- *lcCfg, RgErrInfo *errInfo,Bool *isCfmRqrd,CrgCfgTransId transId));
-S16 rgCFGCrgCellRecfg ARGS((Inst inst,RgCellCb *cell, CrgCellRecfg *cellRecfg,
- RgErrInfo *errInfo));
-S16 rgCFGCrgUeRecfg ARGS((Inst inst,RgCellCb *cell, RgUeCb *ue, CrgUeRecfg
- *ueRecfg, RgErrInfo *errInfo));
-S16 rgCFGCrgLcRecfg ARGS((Inst inst,RgCellCb *cell, RgUeCb *ue, RgUlLcCb
- *ulLc, CrgLchRecfg *lcRecfg, RgErrInfo *errInfo, Bool *isCfmRqrd));
-S16 rgCFGCrgCellDel ARGS((Inst inst,CrgDel *cellDelInfo, RgErrInfo *errInfo));
-S16 rgCFGCrgUeDel ARGS((Inst inst,CrgDel *ueDelInfo, RgErrInfo *errInfo));
-S16 rgCFGCrgLcDel ARGS((Inst inst,CrgDel *lcDelInfo, RgErrInfo
- *errInfo,Bool *isCfmRqrd,CrgCfgTransId transId));
-Void rgCFGFreeCellCb ARGS((RgCellCb *cell));
-Void rgCFGFreeInactvCellCb ARGS((RgCellCb *cell));
-S16 rgSchMacCellRegReq ARGS((Pst* pst,RgInfCellReg* regReq));
-S16 rgCFGCrgUeReset ARGS((RgCellCb *cell,RgUeCb *ue,CrgRst *reset,
- RgErrInfo *errInfo));
-
-/*
- * APIs exposed by COM module
- */
-S16 rgCOMCfgReq ARGS((Inst inst,CrgCfgTransId transId, CrgCfgReqInfo
- *cfgReqInfo));
-
/* APIs Exposed by UIM */
S16 rgUIMRguBndCfm ARGS ((Inst inst,SuId suId, uint8_t status));
S16 rgUIMSndDedStaInd ARGS ((Inst inst,RgUpSapCb *rguDlSap,RgRguDedStaInd *staInd));
/*
* APIs exposed by ROM module
*/
-S16 rgROMDedDatReq ARGS((Inst inst,RgRguDedDatReq *datReq));
-S16 rgROMCmnDatReq ARGS((Inst inst,RgRguCmnDatReq *datReq));
-S16 rgROMDedStaRsp ARGS((Inst inst,RgRguDedStaRsp *staRsp));
-S16 rgROMCmnStaRsp ARGS((Inst inst,RgRguCmnStaRsp *staRsp));
#ifdef LTE_L2_MEAS
S16 rgROML2MUlThrpMeasReq ARGS((Inst inst,RgRguL2MUlThrpMeasReq *measReq));
/*
* APIs exposed by MUX module
*/
-#ifndef L2_OPTMZ
-S16 rgMUXBldPdu ARGS((Inst inst, RgBldPduInfo *bldPdu, Buffer **txPdu,
- RgErrInfo *err));
-#else
-S16 rgMUXBldPdu ARGS((Inst inst, RgBldPduInfo *bldPdu, RgTfuDatReqTbInfo *tb,
- RgErrInfo *err));
+#ifdef L2_OPTMZ
Bool RgUtlIsTbMuxed ARGS((TfuDatReqTbInfo *tb));
#endif
S16 rgMUXBldRarPdu ARGS((RgCellCb *cell, RgInfRaRntiInfo *alloc,
* Utility APIs
*/
S16 rgAllocSBuf ARGS((Inst inst,Data **pData, Size size));
-S16 rgGetMsg ARGS((Inst inst,Buffer **mBuf));
/*ccpu00117052 - MOD Passing double pointer for proper NULLP
assignment */
Void rgFreeSBuf ARGS((Inst inst,Data **data, Size size));
Void rgFillDgnParams ARGS((Inst inst,RgUstaDgn *dgn,uint8_t dgnType));
-Void rgUpdtRguDedSts ARGS((Inst inst,RgUpSapCb *rguSap,uint8_t stsType, RgRguDedDatReq *datReq));
-Void rgUpdtRguCmnSts ARGS((Inst inst,RgUpSapCb *rguSap,uint8_t stsType));
-Void rgUpdtCellCnt ARGS((Inst inst,uint8_t updtType));
-Void rgUpdtUeCnt ARGS((Inst inst,uint8_t updtType));
-Void rgGetPstToInst ARGS((Pst *pst,Inst srcInst, Inst dstInst));
-S16 rgAllocEventMem ARGS((Inst inst,Ptr *memPtr,Size memSize));
-S16 rgGetEventMem ARGS((Inst inst,Ptr *ptr,Size len,Ptr memCp));
-S16 rgAllocShrablSBuf ARGS((Inst inst,Data **pData, Size size));
Void rgPrintfSubFrameInfo ARGS((RgDlSf *dlSf));
Void printMacCellInfo ARGS((Void));
Void rgFreeSharableSBuf ARGS((Inst inst,Data **data, Size size));
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Entry point fucntions
-
- File: rg_cfg.c
-
-**********************************************************************/
-
-/** @file rg_cfg.c
-@brief This module handles the configuration of MAC by RRC and RRM.
-*/
-
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "lrg.h" /* Layer manager interface includes*/
-#include "crg.h" /* CRG interface includes*/
-#include "rgu.h" /* RGU interface includes*/
-#include "tfu.h" /* TFU interface includes */
-#include "rg_sch_inf.h" /* SCH interface includes */
-#include "rg_prg.h" /* PRG (MAC-MAC) interface includes*/
-#include "rg_env.h" /* MAC environmental includes*/
-#include "rg.h" /* MAC includes*/
-#include "rg_err.h" /* MAC error includes*/
-#include "mac_utils.h"
-/* header/extern include files (.x) */
-#include "rgu.x" /* RGU types */
-#include "tfu.x" /* RGU types */
-#include "lrg.x" /* layer management typedefs for MAC */
-#include "crg.x" /* CRG interface includes */
-#include "rg_sch_inf.x" /* SCH interface typedefs */
-#include "rg_prg.x" /* PRG (MAC-MAC) Interface typedefs */
-#include "du_app_mac_inf.h"
-#include "rg.x" /* typedefs for MAC */
-#ifdef LTE_ADV
-#include "rg_pom_scell.x"
-#endif
-/* LTE-MAC Control Block Structure */
-RgCb rgCb[RG_MAX_INST];
-
-/* local defines */
-static S16 rgCFGVldtCrgDedLcCfg ARGS((Inst inst,CrgLchCfg *lcCfg, RgCellCb **cell,
- RgUeCb **ue, RgErrInfo *errInfo));
-static S16 rgCFGVldtCrgCmnLcCfg ARGS((Inst inst,CrgLchCfg *lcCfg, RgCellCb **cell,
- RgErrInfo *errInfo));
-static S16 rgCFGCrgDedLcCfg ARGS((RgCellCb *cell, RgUeCb *ue,
- CrgLchCfg *lcCfg, RgErrInfo *errInfo));
-static S16 rgCFGCrgCmnLcCfg ARGS((Inst inst,RgCellCb *cell, CrgLchCfg *lcCfg,
- RgErrInfo *errInfo));
-
-static Void rgCFGFreeCmnLcLst ARGS((RgCellCb *cell));
-static Void rgCFGFreeUeLst ARGS((RgCellCb *cell));
-/* Added support for SPS*/
-#ifdef LTEMAC_SPS
-static Void rgCFGFreeSpsUeLst ARGS((RgCellCb *cell));
-#endif /* LTEMAC_SPS */
-
-
-/* local typedefs */
-
-/* local externs */
-
-/* forward references */
-
-
-
-
-/**
- * @brief Validates the cell configuration request from RRC to MAC.
- *
- * @details
- *
- * Function : rgCFGVldtCrgCellCfg
- *
- * Processing Steps:
- * - Validate the cell configuration request from RRC to MAC at CFG:
- * validate the value range for the configured values.
- * - If validated successfully,
- * - Return ROK.
- * - Else
- * - Return RFAILED.
- *
- * @param[in] Inst inst
- * @param[in] CrgCellCfg *cellCfg
- * @param[out] RgErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgCFGVldtCrgCellCfg
-(
-Inst inst,
-CrgCellCfg *cellCfg,
-RgErrInfo *errInfo
-)
-{
- errInfo->errCause = RGERR_CFG_INVALID_CRG_CELL_CFG;
- if ((rgCb[inst].cell != NULLP)
- || rgCb[inst].inactiveCell != NULLP)
- {
- DU_LOG("\nERROR --> MAC : Cell already exists");
- return RFAILED;
- }
- if ((cellCfg->bwCfg.dlTotalBw < RG_MIN_DL_BW
- || cellCfg->bwCfg.dlTotalBw > RG_MAX_DL_BW)
- || (cellCfg->bwCfg.ulTotalBw < RG_MIN_UL_BW
- || cellCfg->bwCfg.ulTotalBw > RG_MAX_UL_BW))
- {
- DU_LOG("\nERROR --> MAC : Invalid Bandwidth configuration: ul %d dl %d",
- cellCfg->bwCfg.ulTotalBw, cellCfg->bwCfg.dlTotalBw);
- return RFAILED;
- }
- if (cellCfg->rachCfg.maxMsg3Tx < RG_MIN_HQ_TX)
- {
- DU_LOG("\nERROR --> MAC : Invalid RACH configuration: maxMsg3Tx %d",cellCfg->rachCfg.maxMsg3Tx);
- return RFAILED;
- }
-#ifdef TENB_MULT_CELL_SUPPRT
- if((cellCfg->rguDlSapId > rgCb[inst].numRguSaps) ||
- (cellCfg->rguUlSapId > rgCb[inst].numRguSaps))
- {
- DU_LOG("\nERROR --> MAC : Invald Sap Id: DL %d UL %d for CellId %d failed\n",
- cellCfg->rguDlSapId,
- cellCfg->rguUlSapId,
- cellCfg->cellId);
- return RFAILED;
- }
-#endif
- errInfo->errCause = RGERR_NONE;
- return ROK;
-} /* rgCFGVldtCrgCellCfg */
-
-
-/**
- * @brief Validates the UE configuration request from RRC to MAC.
- *
- * @details
- *
- * Function : rgCFGVldtCrgUeCfg
- *
- * Processing Steps:
- * - Validate the UE configuration request from RRC to MAC at CFG:
- * validate the value range for the configured values.
- * - If validated successfully,
- * - Return ROK and pointer to the cell of UE.
- * - Else
- * - Return RFAILED.
- *
- * @param[in] Inst inst
- * @param[in] CrgUeCfg *ueCfg
- * @param[out] RgCellCb **cell
- * @param[out] RgErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgCFGVldtCrgUeCfg
-(
-Inst inst,
-CrgUeCfg *ueCfg,
-RgCellCb **cell,
-RgErrInfo *errInfo
-)
-{
- errInfo->errCause = RGERR_CFG_INVALID_CRG_UE_CFG;
- if ((ueCfg->txMode.pres == PRSNT_NODEF) &&
- (ueCfg->txMode.tm == CRG_UE_TM_5))
- {
- DU_LOG("\nERROR --> MAC : Transmission Mode=%d not supported",
- ueCfg->txMode.tm);
- return RFAILED;
- }
-
- /* Fetch the Active cell */
- if(((*cell = rgCb[inst].cell) == NULLP) ||
- ((*cell)->cellId != ueCfg->cellId))
- {
- DU_LOG("\nERROR --> MAC : Active Cell does not exist for cellId%d",
- ueCfg->cellId);
- return RFAILED;
- }
- /* Check if UE already configured */
- if (rgDBMGetUeCb(*cell, ueCfg->crnti) != NULLP)
- {
- DU_LOG("\nERROR --> MAC : UE already exists");
- return RFAILED;
- }
-
- if (ueCfg->ueUlHqCfg.maxUlHqTx < RG_MIN_HQ_TX)
- {
- DU_LOG("\nERROR --> MAC : Invalid Uplink HARQ config %d ",
- ueCfg->ueUlHqCfg.maxUlHqTx);
- return RFAILED;
- }
-#ifdef TENB_MULT_CELL_SUPPRT
- if((ueCfg->rguDlSapId > rgCb[inst].numRguSaps) ||
- (ueCfg->rguUlSapId > rgCb[inst].numRguSaps))
- {
- DU_LOG("\nERROR --> MAC : Invald Sap Id: DL %d UL %d for ueId %d failed\n",
- ueCfg->rguDlSapId,
- ueCfg->rguUlSapId,
- ueCfg->crnti);
- return RFAILED;
- }
-#endif
-
- errInfo->errCause = RGERR_NONE;
- return ROK;
-} /* rgCFGVldtCrgUeCfg */
-
-
-/**
- * @brief Validates the logical channel configuration request from RRC to MAC.
- *
- * @details
- *
- * Function : rgCFGVldtCrgLcCfg
- *
- * Processing Steps:
- * - Validate the logical channel configuration request from RRC to
- * MAC at CFG: validate if configured values are within the range.
- * - If validated successfully,
- * - Return ROK and pointer to the cell for common channels. Return
- * pointer to cell and UE for dedicated logical channels.
- * - Else
- * - Return RFAILED.
- *
- * @param[in] CrgLchCfg *lcCfg
- * @param[in] Inst inst
- * @param[out] RgCellCb **cell
- * @param[out] RgUeCb **ue
- * @param[out] RgErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgCFGVldtCrgLcCfg
-(
-Inst inst,
-CrgLchCfg *lcCfg,
-RgCellCb **cell,
-RgUeCb **ue,
-RgErrInfo *errInfo
-)
-{
-
- if (lcCfg->lcType == CM_LTE_LCH_DTCH || lcCfg->lcType == CM_LTE_LCH_DCCH)
- {
- /* Dedicated logical channels */
- if ((rgCFGVldtCrgDedLcCfg(inst,lcCfg, cell, ue, errInfo)) != ROK)
- {
- DU_LOG("\nERROR --> MAC : Validation for dedicated LC failed");
- return RFAILED;
- }
- }
- else if (lcCfg->lcType == CM_LTE_LCH_BCCH
- || lcCfg->lcType == CM_LTE_LCH_PCCH
- || lcCfg->lcType == CM_LTE_LCH_CCCH)
- {
- if ((rgCFGVldtCrgCmnLcCfg(inst,lcCfg, cell, errInfo)) != ROK)
- {
- DU_LOG("\nERROR --> MAC : Validation for common logical channels failed");
- return RFAILED;
- }
- }
- else
- {
- DU_LOG("\nERROR --> MAC : Invalid logical channel type %d",
- lcCfg->lcType);
- return RFAILED;
- }
-#ifdef LTE_L2_MEAS
- if ( lcCfg->qci < RG_QCI_MIN ||
- lcCfg->qci > RG_QCI_MAX
- )
- {
- DU_LOG("\nERROR --> MAC : Invalid qci %x",lcCfg->qci);
- return RFAILED;
- }
- /*validate qci */
-#endif /*LTE_L2_MEAS */
-
- errInfo->errCause = RGERR_NONE;
- return ROK;
-} /* rgCFGVldtCrgLcCfg */
-
-
-/**
- * @brief Validates the cell re-configuration request from RRC to MAC.
- *
- * @details
- *
- * Function : rgCFGVldtCrgCellRecfg
- *
- * Processing Steps:
- * - Retrieve the cell control block.
- * - If successful,
- * - Validate the range of re-configured values recieved in
- * re-configuration request.
- * - If validated successfully,
- * - Return ROK and pointer to the cell.
- * - Else
- * - Return RFAILED.
- * - Else return RFAILED.
- *
- * @param[in] Inst inst
- * @param[in] CrgCellRecfg *cellRecfg
- * @param[out] RgCellCb **cell
- * @param[out] RgErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgCFGVldtCrgCellRecfg
-(
-Inst inst,
-CrgCellRecfg *cellRecfg,
-RgCellCb **cell,
-RgErrInfo *errInfo
-)
-{
- errInfo->errCause = RGERR_CFG_INVALID_CRG_CELL_RECFG;
-
- if (((*cell = rgCb[inst].cell) == NULLP)
- && ((*cell = rgCb[inst].inactiveCell) == NULLP))
- {
- DU_LOG("\nERROR --> MAC : Cell does not exist");
- return RFAILED;
- }
-
- if((*cell)->cellId != cellRecfg->cellId)
- {
- DU_LOG("\nERROR --> MAC : Cell does not exist %d\n",cellRecfg->cellId);
- return RFAILED;
- }
- if (cellRecfg->rachRecfg.maxMsg3Tx < RG_MIN_HQ_TX)
- {
- DU_LOG("\nERROR --> MAC : Invalid RACH configuration: maxMsg3Tx %d",cellRecfg->rachRecfg.maxMsg3Tx);
- return RFAILED;
- }
- errInfo->errCause = RGERR_NONE;
- return ROK;
-} /* rgCFGVldtCrgCellRecfg */
-
-
-/**
- * @brief Validates the UE re-configuration request from RRC to MAC.
- *
- * @details
- *
- * Function : rgCFGVldtCrgUeRecfg
- *
- * Processing Steps:
- * - Retrieve the UE control block.
- * - If successful,
- * - Validate the range of re-configured values recieved in
- * re-configuration request.
- * - If validated successfully,
- * - Return ROK and pointer to the cell and ue.
- * - Else
- * - Return RFAILED.
- * - Else return RFAILED.
- *
- * @param[in] Inst inst
- * @param[in] CrgUeRecfg *ueRecfg
- * @param[out] RgCellCb **cell
- * @param[out] RgUeCb **ue
- * @param[out] RgErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgCFGVldtCrgUeRecfg
-(
-Inst inst,
-CrgUeRecfg *ueRecfg,
-RgCellCb **cell,
-RgUeCb **ue,
-RgErrInfo *errInfo
-)
-{
- errInfo->errCause = RGERR_CFG_INVALID_CRG_UE_RECFG;
-
- if ((ueRecfg->txMode.pres == PRSNT_NODEF) &&
- (ueRecfg->txMode.tm == CRG_UE_TM_5))
- {
- DU_LOG("\nERROR --> MAC : Transmission Mode=%d not supported",
- ueRecfg->txMode.tm);
- return RFAILED;
- }
-
- /* Fetch the Active cell */
- if (((*cell = rgCb[inst].cell) == NULLP)
- || ((*cell)->cellId != ueRecfg->cellId))
- {
- DU_LOG("\nERROR --> MAC : Active Cell does not exist\n");
- return RFAILED;
- }
-
- /* Fix : syed UE ID change at MAC will now be controlled
- * by SCH. */
- if ((*ue = rgDBMGetUeCb(*cell, ueRecfg->oldCrnti)) == NULLP)
- {
- DU_LOG("\nERROR --> MAC : [%d]Old UE does not exist", ueRecfg->oldCrnti);
- return RFAILED;
- }
- if (ueRecfg->ueUlHqRecfg.maxUlHqTx < RG_MIN_HQ_TX)
- {
- DU_LOG("\nERROR --> MAC : Invalid Uplink HARQ config for UE %d",
- ueRecfg->ueUlHqRecfg.maxUlHqTx);
- return RFAILED;
- }
- errInfo->errCause = RGERR_NONE;
- return ROK;
-} /* rgCFGVldtCrgUeRecfg */
-
-
-/**
- * @brief Validates the logical channel re-configuration request from
- * RRC to MAC.
- *
- * @details
- *
- * Function : rgCFGVldtCrgLcRecfg
- *
- * Processing Steps:
- * - Retrieve the uplink and downlink logical channel control block.
- * - If successful,
- * - Validate the range of re-configured values recieved in
- * re-configuration request.
- * - If validated successfully,
- * - Return ROK and pointer to the cell, UE and logical channel.
- * - Else
- * - Return RFAILED.
- * - Else return RFAILED.
- *
- * @param[in] Inst inst
- * @param[in] CrgLchRecfg *lcRecfg
- * @param[out] RgCellCb **cell
- * @param[out] RgUeCb **ue
- * @param[out] RgUlLcCb **ulLc
- * @param[out] RgDlLcCb **dlLc
- * @param[out] RgErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgCFGVldtCrgLcRecfg
-(
-Inst inst,
-CrgLchRecfg *lcRecfg,
-RgCellCb **cell,
-RgUeCb **ue,
-RgUlLcCb **ulLc,
-RgErrInfo *errInfo
-)
-{
- errInfo->errCause = RGERR_CFG_INVALID_CRG_LC_RECFG;
-
- /* Fetch the cell */
- if ((((*cell = rgCb[inst].cell)) == NULLP)
- || ((*cell)->cellId != lcRecfg->cellId))
- {
- DU_LOG("\nERROR --> MAC : Active Cell %u does not exist for UE %u", lcRecfg->cellId, lcRecfg->crnti);
- return RFAILED;
- }
- /* Fetch the Ue for dedicated channels */
- if ((*ue = rgDBMGetUeCb(*cell, lcRecfg->crnti)) == NULLP)
- {
- DU_LOG("\nERROR --> MAC : UE does not exist for dedicated logical channel");
- return RFAILED;
- }
-
- if ((*ulLc = rgDBMGetUlDedLcCb((*ue), lcRecfg->lcId)) == NULLP)
- {
- DU_LOG("\nERROR --> MAC : Dedicated UL LC does not exist %d",lcRecfg->lcId);
- return RFAILED;
- }
-
- if (lcRecfg->ulRecfg.lcgId > (RG_MAX_LCG_PER_UE - 1))
- {
- DU_LOG("\nERROR --> MAC : Invalid lcgId for uplink logical channel lcg %d lc %d",
- lcRecfg->ulRecfg.lcgId, lcRecfg->lcId);
- return RFAILED;
- }
-
- errInfo->errCause = RGERR_NONE;
- return ROK;
-} /* rgCFGVldtCrgLcRecfg */
-
-/* Start: LTEMAC_2.1_DEV_CFG */
-/**
- * @brief Validates the UE Reset request from RRC to MAC.
- *
- * @details
- *
- * Function : rgCFGVldtCrgUeReset
- *
- * Processing Steps:
- * - Retrieve the CELL control block.
- * - If Failue,
- * - Return RFAILED.
- * - Retrieve the UE control block.
- * - If Failue,
- * - Return RFAILED.
- *
- * @param[in] Inst inst
- * @param[in] CrgRst *reset,
- * @param[out] RgCellCb **cell
- * @param[out] RgUeCb **ue
- * @param[out] RgErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgCFGVldtCrgUeReset
-(
-Inst inst,
-CrgRst *reset,
-RgCellCb **cell,
-RgUeCb **ue,
-RgErrInfo *errInfo
-)
-{
- errInfo->errCause = RGERR_CFG_INVALID_CRG_UE_RESET;
-
- /* Fetch the Active cell */
- if (((*cell = rgCb[inst].cell) == NULLP)
- || ((*cell)->cellId != reset->cellId))
- {
- DU_LOG("\nERROR --> MAC : Active Cell does not exist %d",reset->cellId);
- return RFAILED;
- }
-
- /* Fetch the Ue */
- if ((*ue = rgDBMGetUeCb(*cell, reset->crnti)) == NULLP)
- {
- DU_LOG("\nERROR --> MAC : UE does not exist");
- return RFAILED;
- }
-
- errInfo->errCause = RGERR_NONE;
- return ROK;
-} /* rgCFGVldtCrgUeReset*/
-/* End: LTEMAC_2.1_DEV_CFG */
-
-
-
-/**
- * @brief Handler for the cell configuration request from RRC to MAC.
- *
- * @details
- *
- * Function : rgCFGCrgCellCfg
- *
- * Processing Steps:
- * - Allocate and create cell control block.
- * - Update cell control block with the values recieved in the
- * configuration.
- * - Add the control block to hash list of cells.
- * - Update the statistics.
- * - If successful, return ROK else return RFAILED.
- *
- * @param[in] Inst inst
- * @param[in] CrgCellCfg *cellCfg
- * @param[out] RgErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgCFGCrgCellCfg
-(
-Inst inst,
-CrgCellCfg *cellCfg,
-RgErrInfo *errInfo
-)
-{
- S16 ret;
- RgCellCb *cell = NULLP;
- uint8_t idx;
- SuId rguUlSapId = 0;
- SuId rguDlSapId = 0;
- /* RLC SAP to allocate flowCntrlInd buffer*/
- /* Commented below to resolve compilation warning */
- //Pst *pst ;
-
- errInfo->errCause = RGERR_CFG_CRG_CELL_CFG;
-
- /* Allocate the cell control block */
- if((ret = rgAllocSBuf(inst,(Data**)&cell, sizeof(RgCellCb))) != ROK)
- {
- DU_LOG("\nERROR --> MAC : Memory allocation FAILED for cell");
- return RFAILED;
- }
- if (cell == NULLP)
- {
- DU_LOG("\nERROR --> MAC : Memory allocation FAILED for cell");
- return RFAILED;
- }
-
- /* Initialize the cell */
- cell->cellId = cellCfg->cellId;
- cell->rachCfg = cellCfg->rachCfg;
- cell->bwCfg = cellCfg->bwCfg;
-#ifdef EMTC_ENABLE
- if(cellCfg->emtcEnable)
- {
- cell->emtcEnable = cellCfg->emtcEnable;
- }
-#endif
- /* Initialize UL and DL CCCH logical channels */
- cell->ulCcchId = RG_INVALID_LC_ID;
- cell->dlCcchId = RG_INVALID_LC_ID;
-
-
- /* Initialize the lists of the cell */
- ret = rgDBMInitCell(cell);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> MAC : DBM initialization for cell failed");
- rgCFGFreeInactvCellCb(cell);
- return RFAILED;
- }
-
-#ifdef LTE_ADV
- if (RFAILED == RgLaaCellCbInit(cell))
- {
- rgCFGFreeInactvCellCb(cell);
- return RFAILED;
- }
-#endif
-
- for(idx=0;idx < RG_NUM_SUB_FRAMES; idx++)
- {
- cell->subFrms[idx].txDone = TRUE;
- }
-
- cell->macInst = inst + RG_INST_START;
- /* Insert cell in the incative cell list */
- rgCb[inst].inactiveCell = cell;
- rgCb[inst].cell = NULLP;
-#ifdef TENB_MULT_CELL_SUPPRT
- rguDlSapId = cellCfg->rguDlSapId;
- rguUlSapId = cellCfg->rguUlSapId;
-#else
- if(rgCb[inst].numRguSaps > 1)
- {
- rguDlSapId = 1;
- }
-#endif
- cell->rguDlSap = &(rgCb[inst].rguSap[rguDlSapId]);
- cell->rguUlSap = &(rgCb[inst].rguSap[rguUlSapId]);
-
-
-#ifdef LTE_L2_MEAS
- cmLListInit(&cell->l2mList);
- for(idx = 0; idx < RG_NUM_UL_SUB_FRAMES; idx++)
- {
- memset(&cell->ulSf[idx], 0, sizeof(RgUlSf));
- }
-
- cell->ttiCycle = (uint32_t)RG_TTI_CYCLE_INVLD;
-#endif
- /* Update Statistics */
- rgUpdtCellCnt(inst,RG_CFG_ADD);
- errInfo->errCause = RGERR_NONE;
-
- /* Commented below to resolve compilation warning */
- //pst = &rgCb[inst].rguSap[rguDlSapId].sapCfg.sapPst;
- /* Allocate a buffer for flowCntrlInd.*/
- MAC_ALLOC(cell->flowCntrlInd, sizeof(RguFlowCntrlInd));
- if(cell->flowCntrlInd == NULLP)
- {
- DU_LOG("ERROR --> MAC : rgCFGCrgCellCfg(): Memory allocation failed");
- return RFAILED;
- }
- return ROK;
-} /* rgCFGCrgCellCfg */
-
-#ifdef LTE_ADV
-/**
- * @brief Add SCell Cfg recvd from primary MAC instance.
- *
- * @details
- *
- * Function : rgCfgAddUeSCellCfg
- *
- * Processing Steps:
- * - Allocate and create UE control block.
- * - Update UE control block with the values recieved in the
- * configuration.
- * - If successful, add the control block to hash list of UEs for the cell
- * else Rollback and FAIL.
- *
- * @param[in] Inst dstMacInst
- * @param[in] RgPrgUeSCellCfgInfo *ueSCellCb
- * @param[in] RgCellCb cell
-
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgCfgAddUeSCellCfg
-(
-Inst dstMacInst,
-RgPrgUeSCellCfgInfo *ueSCellCb,
-RgCellCb *cell
-)
-{
- RgUeCb *ueCb = NULLP;
- SuId rguUlSapId = 0;
- SuId rguDlSapId = 0;
- uint8_t idx;
- RgErrInfo errInfo;
-
-#ifdef LTE_ADV
- rguDlSapId = ueSCellCb->rguDlSapId;
- rguUlSapId = ueSCellCb->rguUlSapId;
-#endif
-#ifndef TENB_MULT_CELL_SUPPRT
- if(rgCb[dstMacInst].numRguSaps > 1)
- {
- rguDlSapId = 1;
- }
-#endif
-
- if ((ueCb = rgDBMGetUeCb(cell, ueSCellCb->ueId)) != NULLP)
- {
- DU_LOG("\nERROR --> MAC : [%d]UE already exist in scell %d during scell addition\n",
- ueSCellCb->ueId,
- cell->cellId);
- return RFAILED;
- }
-
- /* Create UeCb */
- if((ueCb = rgRAMCreateUeCb(cell, ueSCellCb->ueId,
- FALSE, &errInfo)) == NULLP)
- {
- DU_LOG("\nERROR --> MAC : [%d]UeCb creation failed\n", ueSCellCb->ueId);
- return RFAILED;
- }
-
- if(rgDHMHqEntInit(dstMacInst, &ueCb->dl.hqEnt,
- (rgCb[dstMacInst].cell)->maxDlHqProcPerUe) != ROK)
- {
- DU_LOG("\nERROR --> MAC : [%d]UeCb Harq Entity Initialization failed\n", ueSCellCb->ueId);
- return RFAILED;
- }
- rgDBMInsUeCb(cell, ueCb);
-
-
- ueCb->rguDlSap = &(rgCb[dstMacInst].rguSap[rguDlSapId]);
- ueCb->rguUlSap = &(rgCb[dstMacInst].rguSap[rguUlSapId]);
-
- /* Update satistics */
- rgUpdtUeCnt(dstMacInst, RG_CFG_ADD);
- /*Commit Added SCell info to UeCb */
- /*
- ueCb->sCelAddInfo[idx].isSCellAdded = TRUE;
- ueCb->sCelAddInfo[idx].macInst = dstMacInst;
- ueCb->sCelAddInfo[idx].sCellId = ueSCellCb->cellId;
- */
-
- ueCb->txMode = ueSCellCb->txMode;
- ueCb->ul.hqEnt.maxHqRetx = ueSCellCb->maxUlHqRetx;
-
- for (idx =0; idx <RG_MAX_LC_PER_UE; idx++)
- {
- ueCb->ul.lcCb[idx] = ueSCellCb->ulLcInfo[idx];
- ueCb->dl.lcCb[idx] = ueSCellCb->dlLcInfo[idx];
- }
-
- for (idx =0; idx < RG_MAX_LCG_PER_UE; idx++)
- {
- ueCb->ul.lcgArr[idx].lcgId = ueSCellCb->lcgInfo[idx].lcgId;
- ueCb->ul.lcgArr[idx].lcCount = ueSCellCb->lcgInfo[idx].lcCount;
- ueCb->ul.lcgArr[idx].isGbr = ueSCellCb->lcgInfo[idx].isGbr;
- }
- return ROK;
-}/* rgCfgAddUeSCellCfg */
-
-/**
- * @brief SCell Config Filling for added cell from RRC to MAC.
- *
- * @details
- *
- * Function : rgFillAndAddSCellCfg
- *
- * Processing Steps:
- * - Update UE control block with the values recieved in the
- * configuration.
- * - Update UE control block with the values present in the
- * CellCb
- * - If successful, add the control block to hash list of UEs for the cell
- * else Rollback and FAIL.
- *
- * @param[in] Inst inst
- * @param[in] RgCellCb *cell
- * @param[in] CrgUeCfg *ueCfg
- * @param[in] CrgCfgTransId transId
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgFillAndAddSCellCfg
-(
-Inst inst,
-RgCellCb *cell,
-CrgUeRecfg *ueRecfg,
-CrgCfgTransId transId,
-Bool *isCfmRqrd
-)
-{
- RgUeCb *ue = NULLP;
- uint8_t idx = 0;
- Inst dstMacInst;
- RgPrgUeSCellCfgInfo ueSCellCb;
- Pst dstInstPst;
-
- /* Fetch the Active cell */
- if(((cell = rgCb[inst].cell) == NULLP) ||
- (cell->cellId != ueRecfg->cellId))
- {
- DU_LOG("\nERROR --> MAC : [%d]Active Cell does not exist %d\n",
- ueRecfg->oldCrnti, ueRecfg->cellId);
- return RFAILED;
- }
-
- DU_LOG("\nINFO --> MAC : Filling SCell Config : cellId %d ueId %d\n",
- cell->cellId, cell->ueId);
-
- if ((ue = rgDBMGetUeCb(cell, ueRecfg->oldCrnti)) == NULLP)
- {
- DU_LOG("\nERROR --> MAC : [%d]UE does not exist\n", ueRecfg->oldCrnti);
- return RFAILED;
- }
-
- /* Initialize cfgCfmInfo in the ueCb. This is used while processing SCellAdd
- *confirmation*/
- ue->cfgCfmInfo.numSCells = ueRecfg->crgSCellCfg.numSCells;
- ue->cfgCfmInfo.cfgCfgCount = 0;
- ue->cfgCfmInfo.mask = 0x0;
-
- memcpy(&(ue->cfgCfmInfo.transId), &transId,
- sizeof(CrgCfgTransId));
- ueSCellCb.ueId = ueRecfg->oldCrnti;
- ueSCellCb.txMode = ue->txMode;
- ueSCellCb.maxUlHqRetx = ue->ul.hqEnt.maxHqRetx;
- memcpy(ueSCellCb.ulLcInfo, ue->ul.lcCb, sizeof(ue->ul.lcCb));
- memcpy(ueSCellCb.dlLcInfo, ue->dl.lcCb, sizeof(ue->dl.lcCb));
- for (idx =0; idx < RG_MAX_LCG_PER_UE; idx++)
- {
- ueSCellCb.lcgInfo[idx].lcgId = ue->ul.lcgArr[idx].lcgId;
- ueSCellCb.lcgInfo[idx].lcCount = ue->ul.lcgArr[idx].lcCount;
- ueSCellCb.lcgInfo[idx].isGbr = ue->ul.lcgArr[idx].isGbr;
- }
-
- for(idx = 0;
- idx < ueRecfg->crgSCellCfg.numSCells; idx++)
- {
- dstMacInst = ueRecfg->crgSCellCfg.ueSCellCfg[idx].macInst - RG_INST_START;
- ueSCellCb.cellId = ueRecfg->crgSCellCfg.ueSCellCfg[idx].sCellId;
- ueSCellCb.rguDlSapId = ueRecfg->crgSCellCfg.ueSCellCfg[idx].rguDlSapId;
- ueSCellCb.rguUlSapId = ueRecfg->crgSCellCfg.ueSCellCfg[idx].rguUlSapId;
-
- /* Get post structure of the cell to whom ueSCellCb needs to be sent
- * And then send the sCell Add based on Mac instances */
- rgGetPstToInst(&dstInstPst, inst, dstMacInst);
- RgPrgPMacSMacUeSCellCfg(&dstInstPst, &ueSCellCb);
-
- /*Commit Added SCell info to UeCb is moved to config confirm*/
- } /*end of for loop */
- *isCfmRqrd = FALSE;
-
- return ROK;
-} /* rgFillAndAddSCellCfg */
-#endif /* LTE_ADV */
-
-/**
- * @brief Handler for the UE configuration request from RRC to MAC.
- *
- * @details
- *
- * Function : rgCFGCrgUeCfg
- *
- * Processing Steps:
- * - Allocate and create UE control block.
- * - Update UE control block with the values recieved in the
- * configuration.
- * - Invoke RAM, SCH, UHM and DHM with created UE control block, to
- * update random access, scheduler, uplink harq and downlink harq
- * specific information respectively.
- * - If successful, add the control block to hash list of UEs for the cell
- * else Rollback and FAIL.
- *
- * @param[in] Inst inst
- * @param[in] RgCellCb *cell
- * @param[in] CrgUeCfg *ueCfg
- * @param[out] RgErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgCFGCrgUeCfg
-(
-Inst inst,
-RgCellCb *cell,
-CrgUeCfg *ueCfg,
-RgErrInfo *errInfo
-)
-{
- RgUeCb *ue = NULLP;
- Bool handover = FALSE;
- SuId rguUlSapId = 0;
- SuId rguDlSapId = 0;
-
- errInfo->errCause = RGERR_CFG_CRG_UE_CFG;
-
-/* Start: LTEMAC_2.1_DEV_CFG */
- if ((ue = rgDBMGetUeCbFromRachLst(cell, ueCfg->crnti)) == NULLP)
- {
- /* Create UeCb and Insert in Rach List */
- if((ue=rgRAMCreateUeCb(cell, ueCfg->crnti, FALSE, errInfo)) == NULLP)
- {
- DU_LOG("\nERROR --> MAC : UeCb creation failed");
- return RFAILED;
- }
- if(rgDHMHqEntInit(inst,&ue->dl.hqEnt, cell->maxDlHqProcPerUe) != ROK)
- {
- DU_LOG("\nERROR --> MAC : UeCb Harq Entity Initialization failed");
- return RFAILED;
- }
- handover = TRUE;
- }
-/* End: LTEMAC_2.1_DEV_CFG */
-
- if(handover == FALSE)
- {
- /* Remove from the rachLst */
- rgDBMDelUeCbFromRachLst(cell, ue);
- }
-
-
- /* Initialize uplink HARQ related information for UE */
- rgUHMCrgUeCfg(cell, ue, ueCfg);
-
- rgDBMInsUeCb(cell, ue);
-
-#ifdef TENB_MULT_CELL_SUPPRT
- rguDlSapId = ueCfg->rguDlSapId;
- rguUlSapId = ueCfg->rguUlSapId;
-#else
- if(rgCb[inst].numRguSaps > 1)
- {
- rguDlSapId = 1;
- }
-#endif
-
- ue->rguDlSap = &(rgCb[inst].rguSap[rguDlSapId]);
- ue->rguUlSap = &(rgCb[inst].rguSap[rguUlSapId]);
-
-
- /* Update satistics */
- rgUpdtUeCnt(inst,RG_CFG_ADD);
- errInfo->errCause = RGERR_NONE;
- return ROK;
-} /* rgCFGCrgUeCfg */
-
-
-/**
- * @brief Handler for the logical channel configuration request from
- * RRC to MAC.
- *
- * @details
- *
- * Function : rgCFGCrgLcCfg
- *
- * Processing Steps:
- * - Check if the configuration is for dedicated or common logical channel.
- * - For Dedicated logical channels:
- * - Update the dedicated logical channel Cb with the configured values.
- * - Invoke SCH will cell, UE and logical channel Cb to update scheduler
- * specific information.
- * - For Common logical channels:
- * - Update the common logical channel Cb with the configured values.
- * - Move cell to active list of cells if cell becomes ACTIVE.
- * - If successful, return ROK else RFAILED.
- *
- * @param[in] Inst inst
- * @param[in] RgCellCb *cell
- * @param[in] RgUeCb *ue
- * @param[in] CrgLchCfg *lcCfg
- * @param[out] RgErrInfo *errInfo
- * @param[in] Bool *isCfmRqrd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgCFGCrgLcCfg
-(
-Inst inst,
-RgCellCb *cell,
-RgUeCb *ue,
-CrgLchCfg *lcCfg,
-RgErrInfo *errInfo,
-Bool *isCfmRqrd,
-CrgCfgTransId transId
-)
-{
-
- /* Handle Config for dedicated/common logical channels */
- if (lcCfg->lcType == CM_LTE_LCH_DTCH || lcCfg->lcType == CM_LTE_LCH_DCCH)
- {
-
- if ((rgCFGCrgDedLcCfg(cell, ue, lcCfg, errInfo)) != ROK)
- {
- DU_LOG("\nERROR --> MAC : Dedicated logical channel configuration failed %d",lcCfg->lcId);
- return RFAILED;
- }
-#ifdef LTE_ADV
- /*ERAB Multl Cell fix*/
- memcpy(&(ue->cfgCfmInfo.transId), &transId,
- sizeof(CrgCfgTransId));
- rgPomSndUeSCellLchAddToSmac(inst, cell, ue, lcCfg,isCfmRqrd);
-#endif
- }
- else
- {
- if ((rgCFGCrgCmnLcCfg(inst,cell, lcCfg, errInfo)) != ROK)
- {
- DU_LOG("\nERROR --> MAC : Common logical channel configuration"
- "failed %d\n", lcCfg->lcId);
- return RFAILED;
- }
- }
-
- errInfo->errCause = RGERR_NONE;
- DU_LOG("\nINFO --> MAC : CRG LC config done for UE lcId %d\n", lcCfg->lcId);
- return ROK;
-} /* rgCFGCrgLcCfg */
-
-
-/**
- * @brief Handler for the cell re-configuration request from RRC to MAC.
- *
- * @details
- *
- * Function : rgCFGCrgCellRecfg
- *
- * Processing Steps:
- * - Invoke SCH with updated Cell Cb to update scheduler specific
- * parameters.
- * - Update the cell Cb with the reconfigured values.
- * - If successful, return ROK else RFAILED.
- *
- * @param[in] Inst inst
- * @param[in] RgCellCb *cell
- * @param[in] CrgCellRecfg *cellRecfg
- * @param[out] RgErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgCFGCrgCellRecfg
-(
-Inst inst,
-RgCellCb *cell,
-CrgCellRecfg *cellRecfg,
-RgErrInfo *errInfo
-)
-{
- /* Store the given rachCfg */
- cell->rachCfg = cellRecfg->rachRecfg;
-
- errInfo->errCause = RGERR_NONE;
- return ROK;
-} /* rgCFGCrgCellRecfg */
-
-
-/**
- * @brief Handler for the UE re-configuration request from RRC to MAC.
- *
- * @details
- *
- * Function : rgCFGCrgUeRecfg
- *
- * Processing Steps:
- * - If rnti changes,
- * - Invoke RAM for UE reconfiguration.
- * - Delete old UE from the list.
- * - Update the new rnti and re-insert the UE in the list.
- * - Update the UE control block with the reconfigured values.
- * - Invoke SCH, UHM and DHM with updated UE control block to
- * update scheduler, uplink HARQ and downlink HARQ specific
- * parameters.
- * - If successful, return ROK else RFAILED.
- *
- * @param[in] Inst inst
- * @param[in] RgCellCb *cell
- * @param[in] RgUeCb *ue
- * @param[in] CrgUeRecfg *ueRecfg
- * @param[out] RgErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgCFGCrgUeRecfg
-(
-Inst inst,
-RgCellCb *cell,
-RgUeCb *ue,
-CrgUeRecfg *ueRecfg,
-RgErrInfo *errInfo
-)
-{
- errInfo->errCause = RGERR_CFG_CRG_UE_RECFG;
-
- /* Fix : syed UE ID change at MAC will now be controlled
- * by SCH. */
-
- /* Update uplink HARQ related information for UE */
- rgUHMCrgUeRecfg(cell, ue, ueRecfg);
-
- errInfo->errCause = RGERR_NONE;
- return ROK;
-} /* rgCFGCrgUeRecfg */
-
-
-/**
- * @brief Handler for the logical channel re-configuration request from
- * RRC to MAC.
- *
- * @details
- *
- * Function : rgCFGCrgLcRecfg
- *
- * Processing Steps:
- * - Invoke scheduler to update scheduler specific information.
- * - Update the dedicated logical channel Cb with the re-configured
- * values.
- * - If successful, return ROK else RFAILED.
- *
- * @param[in] Inst inst
- * @param[in] RgUlCellCb *cell
- * @param[in] RgUlUeCb *ue
- * @param[in] RgUlLcCb *ulLc
- * @param[in] RgDlLcCb *dlLc
- * @param[in] CrgLchRecfg *lcRecfg
- * @param[out] RgErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgCFGCrgLcRecfg
-(
-Inst inst,
-RgCellCb *cell,
-RgUeCb *ue,
-RgUlLcCb *ulLc,
-CrgLchRecfg *lcRecfg,
-RgErrInfo *errInfo,
-Bool *isCfmRqrd
-)
-{
-
- if (ulLc->lcgId != lcRecfg->ulRecfg.lcgId)
- {
- rgDBMUpdUlDedLcCb(ue, ulLc, lcRecfg->ulRecfg.lcgId);
-#ifdef LTE_ADV
- rgPomSndUeSCellLchModToSmac(inst, cell, ue, lcRecfg,isCfmRqrd);
-#endif
- }
-
- errInfo->errCause = RGERR_NONE;
- return ROK;
-} /* rgCFGCrgLcRecfg */
-
-/* Start: LTEMAC_2.1_DEV_CFG */
-/**
- * @brief Handler for the logical channel re-configuration request from
- * RRC to MAC.
- *
- * @details
- *
- * Function : rgCFGCrgUeReset
- *
- * Processing Steps:
- *
- * @param[in] RgUlCellCb *cell
- * @param[in] RgUlUeCb *ue
- * @param[in] CrgRst *reset
- * @param[out] RgErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgCFGCrgUeReset
-(
-RgCellCb *cell,
-RgUeCb *ue,
-CrgRst *reset,
-RgErrInfo *errInfo
-)
-{
-
- DU_LOG("\nDEBUG --> MAC : UE of cell %d Reset\n", cell->cellId);
- rgDHMUeReset(cell, &ue->dl.hqEnt);
-
- errInfo->errCause = RGERR_NONE;
-
- return ROK;
-} /* rgCFGCrgUeReset */
-/* End: LTEMAC_2.1_DEV_CFG */
-
-/**
- * @brief Handler for the cell delete request from RRC to MAC.
- *
- * @details
- *
- * Function : rgCFGCrgCellDel
- *
- * Processing Steps:
- * - Fetch the cell control block.
- * - Remove the cell control block from the hash list of cells.
- * - Free the cell control block.
- * - If successful, return ROK else return RFAILED.
- *
- * @param[in] Inst inst
- * @param[in] CrgDel *cellDelInfo
- * @param[out] RgErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgCFGCrgCellDel
-(
-Inst inst,
-CrgDel *cellDelInfo,
-RgErrInfo *errInfo
-)
-{
- RgCellCb *cell;
- uint8_t idx;
-
-
- errInfo->errCause = RGERR_CFG_CRG_CELL_DEL;
- if (((cell = rgCb[inst].cell) == NULLP)
- ||(cell->cellId != cellDelInfo->u.cellDel.cellId))
- {
- if(((cell = rgCb[inst].inactiveCell) == NULLP)
- ||(cell->cellId != cellDelInfo->u.cellDel.cellId))
- {
-
-
- DU_LOG("\nERROR --> MAC : Cell does not exist");
- return RFAILED;
- }
-
- /* Delete cell from inactive list */
- rgCb[inst].inactiveCell = NULLP ;
-
- /* Free the inactive cell */
- rgCFGFreeInactvCellCb(cell);
-
- errInfo->errCause = RGERR_NONE;
- return ROK;
- }
-
- /* Delete from the cell list */
- //rgDBMDelCellCb(cell);
- for(idx=0;idx < RG_NUM_SUB_FRAMES; idx++)
- {
- rgTOMRlsSf(inst,&cell->subFrms[idx]);
- }
-
- /* Free the active cell */
- rgCFGFreeCellCb(cell);
-
- rgCb[inst].cell = NULLP;
-
- errInfo->errCause = RGERR_NONE;
- DU_LOG("\nINFO --> MAC : Cell %d deleted\n", cellDelInfo->u.cellDel.cellId);
- return ROK;
-} /* rgCFGCrgCellDel */
-
-
-/**
- * @brief Handler for the UE delete request from RRC to MAC.
- *
- * @details
- *
- * Function : rgCFGCrgUeDel
- *
- * Processing Steps:
- * - Fetch the UE control block.
- * - Remove the UE control block from the hash list of UEs for the cell.
- * - Free the UE control block.
- * - If successful, return ROK else return RFAILED.
- *
- * @param[in] Inst inst
- * @param[in] CrgDel *ueDelInfo
- * @param[out] RgErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgCFGCrgUeDel
-(
-Inst inst,
-CrgDel *ueDelInfo,
-RgErrInfo *errInfo
-)
-{
-
- errInfo->errCause = RGERR_CFG_CRG_UE_DEL;
-
- DU_LOG("\nDEBUG --> MAC : UE %d Deletion Req at MAC\n", \
- ueDelInfo->u.ueDel.crnti);
- if ((rgCb[inst].cell == NULLP)
- || (rgCb[inst].cell->cellId != ueDelInfo->u.ueDel.cellId))
- {
- DU_LOG("\nERROR --> MAC : Cell does not exist %d",
- ueDelInfo->u.ueDel.cellId);
- return RFAILED;
- }
-
- errInfo->errCause = RGERR_NONE;
- /* Fix: syed Context Deletion is relied upon SCH indication */
- return ROK;
-} /* rgCFGCrgUeDel */
-
-
-/**
- * @brief Handler for the logical channel delete request from
- * RRC to MAC.
- *
- * @details
- *
- * Function : rgCFGCrgLcDel
- *
- * Processing Steps:
- * - Fetch the logical channel control block.
- * - Free the logical channel control block.
- * - If successful, return ROK else return RFAILED.
- *
- * @param[in] Inst inst
- * @param[in] CrgDel *lcDelInfo
- * @param[out] RgErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgCFGCrgLcDel
-(
-Inst inst,
-CrgDel *lcDelInfo,
-RgErrInfo *errInfo,
-Bool *isCfmRqrd,
-CrgCfgTransId transId
-)
-{
- Bool dirVld = FALSE;
- RgCellCb *cell;
- RgUeCb *ue;
- RgUlLcCb *ulLc;
- RgDlLcCb *dlLc;
-
- errInfo->errCause = RGERR_CFG_CRG_LC_DEL;
-
- /* Fetch the Active cell */
- if (((cell = rgCb[inst].cell) == NULLP) ||
- (rgCb[inst].cell->cellId != lcDelInfo->u.lchDel.cellId))
- {
- DU_LOG("\nERROR --> MAC : Cell does not exist %d",
- lcDelInfo->u.lchDel.cellId);
- return RFAILED;
- }
-
- /* Fetch the Ue */
- if ((ue = rgDBMGetUeCb(cell, lcDelInfo->u.lchDel.crnti)) == NULLP)
- {
- DU_LOG("\nERROR --> MAC : UE does not exist for dedicated logical channel");
- return RFAILED;
- }
-
- /* Validate downlink info */
- if (lcDelInfo->u.lchDel.dir & CRG_DIR_TX)
- {
- if ((dlLc = rgDBMGetDlDedLcCb(ue, lcDelInfo->u.lchDel.lcId))
- == NULLP)
- {
- DU_LOG("\nERROR --> MAC : DL LC %d does not exist",
- lcDelInfo->u.lchDel.lcId);
- return RFAILED;
- }
- rgDBMDelDlDedLcCb(ue, dlLc);
- dirVld = TRUE;
- }
-
- /* Validate uplink info */
- if (lcDelInfo->u.lchDel.dir & CRG_DIR_RX)
- {
- if ((ulLc = rgDBMGetUlDedLcCb(ue, lcDelInfo->u.lchDel.lcId))
- == NULLP)
- {
- DU_LOG("\nERROR --> MAC : UL LC %d does not exist",
- lcDelInfo->u.lchDel.lcId);
- return RFAILED;
- }
- rgDBMDelUlDedLcCb(ue, ulLc);
- dirVld = TRUE;
- }
-
- if (!dirVld)
- {
- DU_LOG("\nERROR --> MAC : Invalid direction %d for LC Delete",
- lcDelInfo->u.lchDel.dir);
- return RFAILED;
- }
-#ifdef LTE_ADV
- /*ERAB - multicell fix*/
- memcpy( &(ue->cfgCfmInfo.transId), &transId,
- sizeof(CrgCfgTransId));
- rgPomSndUeSCellLchDelToSmac(inst, lcDelInfo, isCfmRqrd);
-#endif
- errInfo->errCause = RGERR_NONE;
- return ROK;
-} /* rgCFGCrgLcDel */
-
-/***********************************************************
- *
- * Func : rgCFGVldtCrgDedLcCfg
- *
- *
- * Desc : Validates dedicated logical channel configuration recieved from RRC.
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgCFGVldtCrgDedLcCfg
-(
-Inst inst,
-CrgLchCfg *lcCfg,
-RgCellCb **cell,
-RgUeCb **ue,
-RgErrInfo *errInfo
-)
-{
- uint8_t dirVld = FALSE;
-
- errInfo->errCause = RGERR_CFG_INVALID_CRG_DED_LC_CFG;
-
- /* Fetch the Active cell */
- if (((*cell = rgCb[inst].cell) == NULLP)
- || ((*cell)->cellId != lcCfg->cellId))
- {
- DU_LOG("\nERROR --> MAC : Active Cell does not exist: Cell %d",
- lcCfg->cellId);
- return RFAILED;
- }
-
- /* Fetch the Ue */
- if ((*ue = rgDBMGetUeCb(*cell, lcCfg->crnti)) == NULLP)
- {
- DU_LOG("\nERROR --> MAC : UE does not exist for dedicated logical channel %d",
- lcCfg->lcId);
- return RFAILED;
- }
-
- /* Validate logical channel Id */
- if ((lcCfg->lcId < RG_DEDLC_MIN_LCID)
- ||(lcCfg->lcId > RG_DEDLC_MAX_LCID))
- {
- DU_LOG("\nERROR --> MAC : Invalid logical channel Id %d",
- lcCfg->lcId);
- return RFAILED;
- }
-
- /* Validate downlink info */
- if (lcCfg->dir & CRG_DIR_TX)
- {
- if (rgDBMGetDlDedLcCb((*ue), lcCfg->lcId) != NULLP)
- {
- DU_LOG("\nERROR --> MAC : UE Dedicated DL LC %d already configured",
- lcCfg->lcId);
- return RFAILED;
- }
- dirVld = TRUE;
- }
-
- /* Validate uplink info */
- if (lcCfg->dir & CRG_DIR_RX)
- {
- if (lcCfg->ulInfo.lcgId > (RG_MAX_LCG_PER_UE - 1))
- {
- DU_LOG("\nERROR --> MAC : UE Invalid lcgId for uplink logical channel %d",
- lcCfg->ulInfo.lcgId);
- return RFAILED;
- }
- if (rgDBMGetUlDedLcCb((*ue), lcCfg->lcId) != NULLP)
- {
- DU_LOG("\nERROR --> MAC : UE Dedicated UL LC %d already configured",
- lcCfg->lcId);
- return RFAILED;
- }
- dirVld = TRUE;
- }
-
- if (!dirVld)
- {
- DU_LOG("\nERROR --> MAC : Invalid Direction %d",
- lcCfg->dir);
- return RFAILED;
- }
-
- return ROK;
-} /* rgCFGVldtCrgDedLcCfg */
-
-
-/***********************************************************
- *
- * Func : rgCFGVldtCrgCmnLcCfg
- *
- *
- * Desc : Validates common logical channel configuration recieved from RRC.
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgCFGVldtCrgCmnLcCfg
-(
-Inst inst,
-CrgLchCfg *lcCfg,
-RgCellCb **cell,
-RgErrInfo *errInfo
-)
-{
- uint8_t dirVld = FALSE;
-
- errInfo->errCause = RGERR_CFG_INVALID_CRG_CMN_LC_CFG;
-
- /* Ensure cell is not in the active list */
- if (((*cell = rgCb[inst].cell) != NULLP)
- && ((*cell)->cellId != lcCfg->cellId))
- {
- DU_LOG("\nERROR --> MAC : Active Cell exists for common channels");
- return RFAILED;
- }
-
- /* Fetch the inactive cell for common logical channels */
- if (((*cell = rgCb[inst].inactiveCell) == NULLP)
- || ((*cell)->cellId != lcCfg->cellId))
- {
-
- DU_LOG("\nERROR --> MAC : Inactive Cell does not exist for common channels");
- return RFAILED;
- }
- /* Validate downlink info */
- if (lcCfg->dir & CRG_DIR_TX)
- {
- if (lcCfg->lcType == CM_LTE_LCH_BCCH)
- {
- if (lcCfg->dlInfo.dlTrchType == CM_LTE_TRCH_DL_SCH)
- {
- if (rgDBMGetBcchOnDlsch(*cell,lcCfg->lcId) != NULLP)
- {
- DU_LOG("\nERROR --> MAC : BCCH on DLSCH already configured for cell");
- return RFAILED;
- }
- }
- else if (lcCfg->dlInfo.dlTrchType == CM_LTE_TRCH_BCH)
- {
- if (rgDBMGetBcchOnBch(*cell) != NULLP)
- {
- DU_LOG("\nERROR --> MAC : BCCH on BCH already configured for cell ");
- return RFAILED;
- }
- }
- else
- {
- DU_LOG("\nERROR --> MAC : Invalid transport channel %d for cell",
- lcCfg->dlInfo.dlTrchType);
- return RFAILED;
- }
- }
- else if (lcCfg->lcType == CM_LTE_LCH_PCCH)
- {
- if (rgDBMGetPcch(*cell) != NULLP)
- {
- DU_LOG("\nERROR --> MAC : PCCH already configured for cell");
- return RFAILED;
- }
- }
- else if (RG_DLCCCH_ISCFGD(*cell))
- {
- DU_LOG("\nERROR --> MAC : DL CCCH already configured for cell ");
- return RFAILED;
- }
- dirVld = TRUE;
- }
-
- /* Validate uplink info */
- if (lcCfg->dir & CRG_DIR_RX)
- {
- /* Uplink CCCH */
- if (lcCfg->lcType != CM_LTE_LCH_CCCH)
- {
- DU_LOG("\nERROR --> MAC : Invalid UL common lcType %d for cell ",
- lcCfg->lcType);
- return RFAILED;
- }
- if (RG_ULCCCH_ISCFGD(*cell))
- {
- DU_LOG("\nERROR --> MAC : UL CCCH already configured for cell ");
- return RFAILED;
- }
- dirVld = TRUE;
- }
-
- /* Invalid direction */
- if (!dirVld)
- {
- DU_LOG("\nERROR --> MAC : Invalid Direction %d", lcCfg->dir);
- return RFAILED;
- }
-
- return ROK;
-} /* rgCFGVldtCrgCmnLcCfg */
-
-/***********************************************************
- *
- * Func : rgCFGCrgDedLcCfg
- *
- *
- * Desc : Handles dedicated logical channel configuration
- * recieved from RRC.
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgCFGCrgDedLcCfg
-(
-RgCellCb *cell,
-RgUeCb *ue,
-CrgLchCfg *lcCfg,
-RgErrInfo *errInfo
-)
-{
- //Inst inst = cell->macInst - RG_INST_START;
- errInfo->errCause = RGERR_CFG_CRG_DED_LC_CFG;
-
- /* Uplink/Bi-directional logical channel */
- if (lcCfg->dir & CRG_DIR_RX)
- {
-#ifdef LTE_L2_MEAS
- rgDBMInsUlDedLcCb(ue, lcCfg->lcId, lcCfg->ulInfo.lcgId, lcCfg->qci);
- cell->qciArray[lcCfg->qci].qci = lcCfg->qci;
- if(lcCfg->lcType == CM_LTE_LCH_DTCH)
- {
- rgAddToL2MeasPerQci(cell,lcCfg->qci);/*LTE_L2_MEAS_PHASE2*/
- }
-#else
- rgDBMInsUlDedLcCb(ue, lcCfg->lcId, lcCfg->ulInfo.lcgId);
-#endif
- }
-
- /* Downlink/Bi-directional logical channel */
- if (lcCfg->dir & CRG_DIR_TX)
- {
- rgDBMInsDlDedLcCb(ue, lcCfg->lcId);
- }
- return ROK;
-} /* rgCFGCrgDedLcCfg */
-
-
-/***********************************************************
- *
- * Func : rgCFGCrgCmnLcCfg
- *
- *
- * Desc : Handles dedicated logical channel configuration
- * recieved from RRC.
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgCFGCrgCmnLcCfg
-(
-Inst inst,
-RgCellCb *cell,
-CrgLchCfg *lcCfg,
-RgErrInfo *errInfo
-)
-{
- errInfo->errCause = RGERR_CFG_CRG_CMN_LC_CFG;
-
- /* Handle configuration for CCCH/BCCH/PCCH */
- if (lcCfg->lcType == CM_LTE_LCH_CCCH)
- {
- /* UL and DL CCCH configuration */
- if (lcCfg->dir & CRG_DIR_TX)
- {
- cell->dlCcchId = lcCfg->lcId;
- cell->cellActvState |= RG_DL_CCCH_CFG_DONE;
- }
-
- if (lcCfg->dir & CRG_DIR_RX)
- {
- cell->ulCcchId = lcCfg->lcId;
- cell->cellActvState |= RG_UL_CCCH_CFG_DONE;
- }
- }
- else
- {
- if (lcCfg->lcType == CM_LTE_LCH_BCCH)
- {
- /* BCCH on BCH and DLSCH configuration */
- if (lcCfg->dlInfo.dlTrchType == CM_LTE_TRCH_DL_SCH)
- {
- rgDBMInsBcchOnDlsch(cell, lcCfg->lcId);
-
- if(cell->cellActvState & RG_BCCH_DLSCH_CFG1_DONE)
- {
- cell->cellActvState |= RG_BCCH_DLSCH_CFG2_DONE;
- }
- else
- {
- cell->cellActvState |= RG_BCCH_DLSCH_CFG1_DONE;
- }
- }
- else
- {
- rgDBMInsBcchOnBch(cell, lcCfg->lcId);
- cell->cellActvState |= RG_BCCH_BCH_CFG_DONE;
- }
- }
- else /* PCCH configuration */
- {
- rgDBMInsPcch(cell, lcCfg->lcId);
- cell->cellActvState |= RG_PCCH_CFG_DONE;
- }
- }
-
- /* Add to active cell list if cell is active */
- if (cell->cellActvState == RG_CELL_ACTIVE)
- {
- rgCb[inst].cell = cell;
- rgCb[inst].inactiveCell = NULLP;
- DU_LOG("\nDEBUG --> MAC : Cell added to active list after common LC %d\
- config\n", lcCfg->lcId);
- }
-
- return ROK;
-} /* rgCFGCrgCmnLcCfg */
-#ifdef LTE_L2_MEAS
-/***********************************************************
- *
- * Func : rgCFGFreeUeUlAlloc
- *
- *
- * Desc :
- * - Processing Steps:
- * - Frees cell control block.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgCFGFreeUeUlAlloc(RgCellCb *cell)
-{
- uint8_t sfIdx;
- Inst inst = cell->macInst - RG_INST_START;
-
- for(sfIdx = 0; sfIdx < RG_NUM_UL_SUB_FRAMES; sfIdx++)
- {
- if(cell->ulSf[sfIdx].ueUlAllocInfo != NULLP)
- {
- /*ccpu00117052 - MOD- Passing double pointer for proper
- * NULLP assignment */
- rgFreeSBuf(inst,(Data **)&(cell->ulSf[sfIdx].ueUlAllocInfo),
- (cell->ulSf[sfIdx].numUe * sizeof(RgUeUlAlloc)));
- }
- }
-}/* rgCFGFreeUeUlAlloc */
-#endif
-/***********************************************************
- *
- * Func : rgCFGFreeCellCb
- *
- *
- * Desc :
- * - Processing Steps:
- * - Frees cell control block.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgCFGFreeCellCb(RgCellCb *cell)
-{
- Inst inst = cell->macInst - RG_INST_START;
-
-#ifdef LTE_ADV
- RgLaaCellCbDeInit(cell);
-#endif
- /* Free lists of the cell */
-#ifdef LTEMAC_SPS
- rgCFGFreeSpsUeLst(cell);
-#endif /* LTEMAC_SPS */
- rgCFGFreeUeLst(cell);
- rgRAMFreeCell(cell);
- rgCFGFreeCmnLcLst(cell);
-#ifdef LTE_L2_MEAS
- rgCFGFreeUeUlAlloc(cell);
-#endif
- /* ccpu00117052 - MOD - Passing double pointer for proper NULLP
- assignment */
- /* Update satistics */
- rgUpdtCellCnt(inst,RG_CFG_DEL);
- rgDHMFreeAllTbBufs(inst);
-
- rgFreeSBuf(inst,(Data **)&cell->flowCntrlInd, sizeof(RguFlowCntrlInd));
-
- /* De-allocate the Cell */
- rgFreeSBuf(inst,(Data **)&cell, sizeof(*cell));
-
-
- DU_LOG("\nINFO --> MAC : Cell freed\n");
-
- /* Stack Crash Problem for TRACE5 Changes. Added return below */
- return;
-} /* rgCFGFreeCellCb */
-
-
-/***********************************************************
- *
- * Func : rgCFGFreeInactvCellCb
- *
- *
- * Desc :
- * - Processing Steps:
- * - Frees inactive cell control block.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgCFGFreeInactvCellCb(RgCellCb *cell)
-{
- Inst inst = cell->macInst - RG_INST_START;
- /* De-initialize the Ue list */
- rgDBMDeInitUeCbLst(cell);
-#ifdef LTEMAC_SPS
- rgDBMDeInitSpsUeCbLst(cell);
-#endif
-
- rgCFGFreeCmnLcLst(cell);
-
- rgFreeSBuf(inst, (Data **)&cell->flowCntrlInd, sizeof(RguFlowCntrlInd));
- /*ccpu00117052 - MOD- Passing double pointer for proper
- NULLP assignment */
- /* De-allocate the Cell */
- rgFreeSBuf(inst,(Data **)&cell, sizeof(*cell));
-
- /* Update satistics */
- rgUpdtCellCnt(inst,RG_CFG_DEL);
-
-
- /* Stack Crash Problem for TRACE5 Changes. Added return below */
- return;
-} /* rgCFGFreeInactvCellCb */
-
-
-/***********************************************************
- *
- * Func : rgCFGFreeUeCb
- *
- *
- * Desc :
- * - Processing Steps:
- * - Frees UE control block.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgCFGFreeUeCb(RgCellCb *cell,RgUeCb *ue)
-{
- Inst inst = cell->macInst - RG_INST_START;
-
- rgDHMFreeUe(inst,&ue->dl.hqEnt);
-
- /* ccpu00117052 - MOD - Passing double pointer for proper NULLP
- assignment */
- /* De-allocate the Ue */
- rgFreeSBuf(inst,(Data **)&ue, sizeof(*ue));
-
- /* Update Statistics */
- rgUpdtUeCnt(inst,RG_CFG_DEL);
-
-
- /* Stack Crash Problem for TRACE5 Changes. Added return below */
- return;
-} /* rgCFGFreeUeCb */
-
-/***********************************************************
- *
- * Func : rgCFGFreeCmnLcLst
- *
- *
- * Desc :
- * - Processing Steps:
- * - Frees common logical channels in cell control block.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgCFGFreeCmnLcLst(RgCellCb *cell)
-{
- rgDBMFreeCmnLcLst(cell);
-
-
- /* Stack Crash Problem for TRACE5 Changes. Added return below */
- return;
-} /* rgCFGFreeCmnLcLst */
-
-
-/***********************************************************
- *
- * Func : rgCFGFreeUeLst
- *
- *
- * Desc :
- * - Processing Steps:
- * - Frees UE list in cell control block.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgCFGFreeUeLst(RgCellCb *cell)
-{
- RgUeCb *ue;
-
- /* Free Ues in the list */
- while ((ue = rgDBMGetNextUeCb(cell, NULLP)) != NULLP)
- {
-#ifdef LTE_ADV
- rgDelUeFrmAllSCell(cell,ue);
-#endif
- rgDBMDelUeCb(cell, ue);
- rgCFGFreeUeCb(cell, ue);
- }
-
- /* De-initialize the Ue list */
- rgDBMDeInitUeCbLst(cell);
-
-
- /* Stack Crash Problem for TRACE5 Changes. Added return below */
- return;
-} /* rgCFGFreeUeLst */
-
-#ifdef LTEMAC_SPS
-/***********************************************************
- *
- * Func : rgCFGFreeSpsUeLst
- *
- *
- * Desc :
- * - Processing Steps:
- * - Frees Sps UE list in cell control block.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgCFGFreeSpsUeLst(RgCellCb *cell)
-{
- RgUeCb *ue;
-
- /* Free Ues in the list */
- while ((ue = rgDBMGetNextSpsUeCb(cell, NULLP)))
- {
- rgDBMDelSpsUeCb(cell, ue);
- }
-
- /* De-initialize the Ue list */
- rgDBMDeInitSpsUeCbLst(cell);
-
-} /* rgCFGFreeSpsUeLst */
-
-#endif /* LTEMAC_SPS */
-
-/**
- * @brief Function for registering cell- scheduler instance mapping
- *
- * @details
- *
- * Function : RgSchMacCellRegReq
- *
- * This function shall be invoked whenever scheduler is done with the
- * cell configuration successfully.
- * This shall create a mapping of the cell, scheduler instance that
- * is serving the cell and the unique identifier of the cell on the
- * scheduler at MAC. This mapping shall be used for further
- * communication to the scheduler instance for this cell.
- *
- *
- * @param[in] Pst* pst,
- * @param[in] CmLteCellId cellId,
- * @param[in] RaRespReqInfo raRespReq
- * @return S16
- * -# ROK
- **/
-S16 RgSchMacCellRegReq(Pst* pst,RgInfCellReg* regReq)
-{
- Inst inst;
- RgCellCb *cell = NULLP;
-
- RG_IS_INST_VALID(pst->dstInst);
- inst = pst->dstInst - RG_INST_START;
- cell = rgCb[inst].cell;
-
- if(NULLP == regReq)
- {
- return RFAILED;
- }
-
- if((cell == NULLP) || (cell->cellId != regReq->cellId))
- {
- return RFAILED;
- }
- if(regReq->maxDlHqProcPerUe > RG_MAX_DL_HARQ_NUM)
- {
- return RFAILED;
- }
- /* Initialize */
- cell->schInstMap.cellSapId = regReq->cellSapId;
- cell->schInstMap.schInst = pst->srcInst;
- cell->maxDlHqProcPerUe = regReq->maxDlHqProcPerUe;
-
- return ROK;
-
-} /* end of RgSchMacCellRegReq */
-
-/*Added Ue for Onging L2 Meas*/
-#ifdef LTE_L2_MEAS
-/*LTE_L2_MEAS_PHASE2*/
-S16 rgAddToL2MeasPerQci(RgCellCb *cell,uint8_t qci)
-{
- S16 ret = ROK;
- CmLList *lnk;
- RgL2MeasCb *measCb;
- uint16_t idx;
-
- lnk = cell->l2mList.first;
- while(lnk != NULLP )
- {
- measCb = (RgL2MeasCb *)lnk->node;
- if(measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL)
- {
- for(idx = 0;idx< measCb->measReq.t.prbReq.numQci;idx++)
- {
- if(measCb->measReq.t.prbReq.qci[idx] == qci)
- {
- break; /*exit from for loop*/
- }
- }
- if(idx == measCb->measReq.t.prbReq.numQci)
- {
- cell->qciArray[qci].mask = TRUE;
- measCb->measReq.t.prbReq.qci[measCb->measReq.t.prbReq.numQci++] = qci;
- }
- }
- lnk = lnk->next;
- } /* End of While*/
-
-
-
- return (ret);
-}
-
-
-#endif
-
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Entry point functions
-
- File: rg_com.c
-
-**********************************************************************/
-
-/** @file rg_com.c
-@brief This module does processing related to handling of upper interface APIs
-invoked by RRC towards MAC.
-*/
-
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "tfu.h"
-#include "du_app_mac_inf.h"
-#include "lrg.h"
-#include "crg.h"
-#include "rgu.h"
-#include "rg_sch_inf.h"
-#include "rg_env.h"
-#include "rg.h"
-#include "rg_err.h"
-
-/* header/extern include files (.x) */
-#include "tfu.x"
-#include "lrg.x"
-#include "crg.x"
-#include "rgu.x"
-#include "rg_sch_inf.x"
-#include "rg_prg.x" /* PRG interface typedefs*/
-#include "rg.x"
-#ifdef LTE_ADV
-#include "rg_pom_scell.x"
-#endif
-/* local defines */
-static S16 rgCOMHndlCfgReq ARGS((Inst inst,CrgCfg *cfg, RgErrInfo *errInfo,Bool *isCfmRqrd,CrgCfgTransId transId));
-static S16 rgCOMHndlRecfgReq ARGS((Inst inst,CrgRecfg *recfg, RgErrInfo *errInfo, \
- CrgCfgTransId transId,Bool *isCfmRqrd));
-static S16 rgCOMHndlDelReq ARGS((Inst inst,CrgDel *del, RgErrInfo *errInfo, Bool *isCfmRqrd, CrgCfgTransId transId));
-static S16 rgCOMHndlResetReq ARGS((Inst inst,CrgRst *reset,RgErrInfo *errInfo));
-/* local typedefs */
-
-/* local externs */
-
-/* forward references */
-
-/**
- * @brief Handler to handle config request from RRC to MAC.
- *
- * @details
- *
- * Function: rgCOMCfgReq
- *
- * This API handles processing for config request from RRC to MAC.
- *
- * Processing Steps:
- * - If configuration, process configuration request. Call rgCOMHndlCfgReq.
- * - else If re-configuration, process re-configuration request.
- * Call rgCOMHndlRecfgReq.
- * - else If reset, process reset request. Call rgCOMHndlResetReq.
- * - else If delete, process delete request. Call rgCOMHndlDelReq.
- * - If successful, send confirmation to RRC. Call rgUIMCrgCfgCfm.
- * - If failed, FAIL.
- *
- * @param[in] Inst inst
- * @param[in] CrgCfgTransId transId
- * @param[in] CrgCfgReqInfo *crgCfgReq
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgCOMCfgReq
-(
-Inst inst,
-CrgCfgTransId transId,
-CrgCfgReqInfo *crgCfgReq
-)
-{
- S16 ret;
- uint8_t cfmStatus = CRG_CFG_CFM_OK;
- RgErrInfo errInfo;
- Bool isCfmRqrd = TRUE;
-
- /* Process Config/Reconfig/Delete request from RRC */
- switch (crgCfgReq->action)
- {
- case CRG_CONFIG:
- {
- ret = rgCOMHndlCfgReq(inst,&crgCfgReq->u.cfgInfo, &errInfo,&isCfmRqrd, transId);
- break;
- }
- case CRG_RECONFIG:
- {
- ret = rgCOMHndlRecfgReq(inst,&crgCfgReq->u.recfgInfo, &errInfo, transId, &isCfmRqrd);
- break;
- }
- /* Start: LTEMAC_2.1_DEV_CFG */
- case CRG_RESET:
- {
- ret = rgCOMHndlResetReq(inst,&crgCfgReq->u.rstInfo, &errInfo);
- break;
- }
- /* End: LTEMAC_2.1_DEV_CFG */
- case CRG_DELETE:
- {
- ret = rgCOMHndlDelReq(inst,&crgCfgReq->u.delInfo, &errInfo, &isCfmRqrd, transId);
- break;
- }
- default:
- {
- DU_LOG("\nERROR --> MAC : Invalid configuration action %d",
- crgCfgReq->action);
-
- ret = RFAILED;
- }
- }
-
- if (ret != ROK)
- {
- cfmStatus = CRG_CFG_CFM_NOK;
- }
-
- /* When UeSCellCfg is present then confirmation will be sent later once
- confirm from all SMAC are recved at PMAC. PMAC will send a consolidated
- confirm to RRC.Handling the failure of PMAC for Ue Scell add*/
-#ifdef LTE_ADV
-if(TRUE == isCfmRqrd)
- {
-#endif
- /* Send back confirmation status to RRC */
- rgUIMCrgCfgCfm(inst,transId, cfmStatus);
-#ifdef LTE_ADV
- }
-#endif
- DU_LOG("\nINFO --> MAC : CRG Configuration request processed\n");
- return (ret);
-} /* rgCOMCfgReq */
-/**
- * @brief Handler for processing Cell/Ue/Logical channel configuration request
- * recieved from RRC.
- *
- * @details
- *
- * Function: rgCOMHndlCfgReq
- *
- * This API handles processing of configuration request from RRC to MAC.
- *
- * Processing Steps:
- * - Validate configuration request parameters at CFG module.
- * Call rgCFGVldtCrgCellCfg, rgCFGVldtCrgUeCfg, rgCFGVldtCrgLcCfg
- * for Cell, UE and Logical channel configuration respectively.
- * - If validated successfully, Call rgCFGCrgCellCfg, rgCFGCrgUeCfg,
- * rgCFGCrgLcCfg for Cell, UE and Logical channel configuration
- * respectively, else FAIL.
- *
- * @param[in] Inst inst
- * @param[in] CrgCfg *cfg
- * @param[out] RgErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgCOMHndlCfgReq
-(
-Inst inst,
-CrgCfg *cfg,
-RgErrInfo *errInfo,
-Bool *isCfmRqrd,
-CrgCfgTransId transId
-)
-{
- S16 ret;
- RgCellCb *cell = NULLP;
- RgUeCb *ue = NULLP;
-
- errInfo->errType = RGERR_COM_CFG_REQ;
-
- /* Validate and process the configuration request */
- switch (cfg->cfgType)
- {
- case CRG_CELL_CFG:
- {
- ret = rgCFGVldtCrgCellCfg(inst,&cfg->u.cellCfg,errInfo);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> MAC : Cell configuration validation FAILED\n");
- return RFAILED;
- }
- ret = rgCFGCrgCellCfg(inst,&cfg->u.cellCfg, errInfo);
- break;
- }
- case CRG_UE_CFG:
- {
- {
- ret = rgCFGVldtCrgUeCfg(inst,&cfg->u.ueCfg, &cell, errInfo);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> MAC : UE configuration validation FAILED\n");
- return RFAILED;
- }
- ret = rgCFGCrgUeCfg(inst,cell, &cfg->u.ueCfg, errInfo);
- }
- break;
- }
- case CRG_LCH_CFG:
- {
-
- ret = rgCFGVldtCrgLcCfg(inst,&cfg->u.lchCfg, &cell, &ue,errInfo);
- if (ret != ROK)
- {
-
- DU_LOG("\nERROR --> MAC : LC configuration validation FAILED: LC %d\n", cfg->u.lchCfg.lcId);
- return RFAILED;
- }
- ret = rgCFGCrgLcCfg(inst,cell, ue, &cfg->u.lchCfg, errInfo,isCfmRqrd,transId);
- break;
- }
- default:
- {
- DU_LOG("\nERROR --> MAC : Should never come here: cfgType %d",cfg->cfgType);
- return RFAILED;
- }
- }
-
- return (ret);
-} /* rgCOMHndlCfgReq */
-
-
-/**
- * @brief Handler for processing Cell/Ue/Logical channel re-configuration request
- * recieved from RRC.
- *
- * @details
- *
- * Function: rgCOMHndlRecfgReq
- *
- * This API handles processing of reconfiguration request from RRC to MAC.
- *
- * Processing Steps:
- * - Validate reconfiguration request parameters at CFG module. Call
- * rgCFGVldtCrgCellRecfg, rgCFGVldtCrgUeRecfg, rgCFGVldtCrgLchRecfg for
- * Cell, UE and logical channel reconfiguration respectively.
- * - If validated, Call rgCFGCrgCellRecfg, rgCFGCrgUeRecfg,
- * rgCFGCrgLchRecfg for Cell, UE and Logical channel re-configuration
- * respectively else FAIL.
- *
- * @param[in] Inst inst
- * @param[in] CrgRecfg *recfg
- * @param[out] RgErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgCOMHndlRecfgReq
-(
-Inst inst,
-CrgRecfg *recfg,
-RgErrInfo *errInfo,
-CrgCfgTransId transId,
-Bool *isCfmRqrd
-)
-{
- S16 ret;
- RgCellCb *cell = rgCb[inst].cell;
- RgUeCb *ue = NULLP;
- RgUlLcCb *ulLc = NULLP;
-
- errInfo->errType = RGERR_COM_RECFG_REQ;
-
- /* Validate and process the re-configuration request */
- switch (recfg->recfgType)
- {
- case CRG_CELL_CFG:
- {
- ret = rgCFGVldtCrgCellRecfg(inst,&recfg->u.cellRecfg, &cell, errInfo);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> MAC : Cell Recfg Validation FAILED");
- return RFAILED;
- }
- ret = rgCFGCrgCellRecfg(inst,cell, &recfg->u.cellRecfg, errInfo);
- break;
- }
- case CRG_UE_CFG:
- {
- /*ccpu00126865 - Added as a part of RRC Reestablishment issue with MAC
- * having a possibility of sending NOK */
- if (recfg->u.ueRecfg.oldCrnti != recfg->u.ueRecfg.newCrnti)
- {
- errInfo->errCause = RGERR_CFG_INVALID_CRG_UE_RECFG;
- ret = ROK;
- }
- else
- {
-#ifdef LTE_ADV
- /* Check for isSCellCfgPres */
- if(TRUE == recfg->u.ueRecfg.crgSCellCfg.isSCellCfgPres)
- {
- ret = rgFillAndAddSCellCfg(inst, cell, &recfg->u.ueRecfg, transId, isCfmRqrd);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> MAC : [%d]UE SCell configuration FAILED for inst [%d]\n",
- recfg->u.ueRecfg.oldCrnti, inst);
- return RFAILED;
- }
-
- }
- else
- {
-#endif /* LTE_ADV */
- ret = rgCFGVldtCrgUeRecfg(inst,&recfg->u.ueRecfg, &cell, &ue, errInfo);
- if ( ret != ROK)
- {
- DU_LOG("\nERROR --> MAC : UE Re-configuration validation FAILED OLD CRNTI:%d",
- recfg->u.ueRecfg.oldCrnti);
- return RFAILED;
- }
- ret = rgCFGCrgUeRecfg(inst,cell, ue, &recfg->u.ueRecfg, errInfo);
- }
-#ifdef LTE_ADV
- }
-#endif
- break;
- }
- case CRG_LCH_CFG:
- {
- ret = rgCFGVldtCrgLcRecfg(inst,&recfg->u.lchRecfg, &cell, &ue,
- &ulLc, errInfo);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> MAC : LC Re-configuration validation FAILED LCID:%d CRNTI:%d",
- recfg->u.lchRecfg.lcId,recfg->u.lchRecfg.crnti);
- return RFAILED;
- }
-
-#ifdef LTE_ADV
- /*ERAB- multicell fix*/
- memcpy( &(ue->cfgCfmInfo.transId), &transId,
- sizeof(CrgCfgTransId));
-#endif
- ret = rgCFGCrgLcRecfg(inst,cell, ue, ulLc,
- &recfg->u.lchRecfg, errInfo,isCfmRqrd);
-
- break;
- }
- default:
- {
- DU_LOG("\nERROR --> MAC : Should never come here: recfgType %d",
- recfg->recfgType);
- return RFAILED;
- }
- }
-
- return (ret);
-} /* rgCOMHndlRecfgReq */
-
-/*Start: LTEMAC_2.1_DEV_CFG */
-/**
- * @brief Handler for processing UE Reset request recieved from RRC.
- *
- * @details
- *
- * Function: rgCOMHndlResetReq
- *
- * This API handles processing of Reset request from RRC to MAC.
- *
- * Processing Steps:
- * - Validate reset request parameters at CFG module. Call
- * rgCFGVldtCrgUeReset for UE reset.
- * - If validated, Call rgCFGCrgUeReset for UE reset, else FAIL.
- *
- * @param[in] Inst inst
- * @param[in] CrgRst *reset
- * @param[out] RgErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgCOMHndlResetReq
-(
-Inst inst,
-CrgRst *reset,
-RgErrInfo *errInfo
-)
-{
- /* Fix : ccpu00126865: ignore CRG reset. Let SCH trigger it. */
-
- errInfo->errCause = RGERR_NONE;
- DU_LOG("\nINFO --> MAC : CRG UE Reset processed \n");
- return ROK;
-} /* rgCOMHndlResetReq */
-/*End: LTEMAC_2.1_DEV_CFG */
-
-/**
- * @brief Handler for processing Cell/UE/Logical channel delete request
- * recieved from RRC.
- *
- * @details
- *
- * Function: rgCOMHndlDelReq
- *
- * This API handles processing of delete request from RRC to MAC.
- *
- * Processing Steps:
- * - Fetch corresponding control block and pass it to CFG module.
- * - If control block does not exist, FAIL.
- *
- * @param[in] Inst inst
- * @param[in] CrgDel *del
- * @param[out] RgErrInfo *errInfo
- @param[out] Bool *isCfmRqrd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgCOMHndlDelReq
-(
-Inst inst,
-CrgDel *del,
-RgErrInfo *errInfo,
-Bool *isCfmRqrd,
-CrgCfgTransId transId
-)
-{
-
- S16 ret;
- volatile uint32_t startTime=0;
-
- errInfo->errType = RGERR_COM_DEL_REQ;
-
- /* Process the delete request */
- switch (del->delType)
- {
- case CRG_CELL_CFG:
- {
- ret = rgCFGCrgCellDel(inst,del, errInfo);
- break;
- }
- case CRG_UE_CFG:
- {
- /*starting Task*/
- SStartTask(&startTime,PID_MAC_UE_DEL);
-
- ret = rgCFGCrgUeDel(inst,del, errInfo);
- DU_LOG("\nINFO --> MAC : [%d] Delete UE Done \n", del->u.ueDel.crnti);
-
- /*stoping Task*/
- SStopTask(startTime,PID_MAC_UE_DEL);
-
- break;
- }
- case CRG_LCH_CFG:
- {
- ret = rgCFGCrgLcDel(inst,del, errInfo,isCfmRqrd, transId);
- break;
- }
- default:
- {
- DU_LOG("\nERROR --> MAC : Should never come here: delType %d",
- del->delType);
- return RFAILED;
- }
- }
-
- return (ret);
-} /* rgCOMHndlDelReq */
-
-#ifdef LTE_ADV
-/**
- * @brief Handler for the SCell configuration request from RRC to MAC.
- *
- * @details
- *
- * Function : RgPrgPMacSMacUeSCellCfgReq
- *
- * Processing Steps:
- * - Allocate and create UE control block.
- * - Update UE control block with the values recieved in the
- * configuration.
- * - If successful, add the control block to hash list of UEs for the cell
- * else Rollback and FAIL.
- *
- * @param[in] Pst *pst
- * @param[in] RgPrgUeSCellCfgInfo *ueSCellCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgPrgPMacSMacUeSCellCfgReq
-(
-Pst *pst,
-RgPrgUeSCellCfgInfo *ueSCellCb
-)
-{
- RgPrgCfgCfmInfo cfgCfm;
- Inst inst = pst->dstInst;
- RgCellCb *cell = rgCb[inst].cell;
- S16 ret;
- Pst cfmPst;
-
-
- DU_LOG("\nDEBUG --> MAC : APPLYING CRG UE SCELL CONFIG: cellId %d ueId %d\n",
- ueSCellCb->cellId, ueSCellCb->ueId);
-
- cfgCfm.ueId = ueSCellCb->ueId;
- cfgCfm.sCellId = ueSCellCb->cellId;
- cfgCfm.status = PRG_CFG_CFM_OK;
- cfgCfm.event = EVTPRGUESCELLCFGCFM;
- rgGetPstToInst(&cfmPst, inst, pst->srcInst);
-
- ret = rgUtlVltdAddSCellCfg(ueSCellCb, cell, inst);
- if(ret != ROK)
- {
- DU_LOG("\nERROR --> MAC : [%d]Crg UE SCell failed:\
- cellId %d\n", ueSCellCb->ueId, ueSCellCb->cellId);
- /* Set status as Not OK*/
- cfgCfm.status = PRG_CFG_CFM_NOK;
- }
- else
- {
- ret = rgCfgAddUeSCellCfg(inst, ueSCellCb, cell);
- if(ret != ROK)
- {
- DU_LOG("\nERROR --> MAC : [%d]Crg UE SCell failed:\
- cellId %d\n", ueSCellCb->ueId, ueSCellCb->cellId);
- /* Set status as Not OK*/
- cfgCfm.status = PRG_CFG_CFM_NOK;
- }
- }
-
- DU_LOG("\nINFO --> MAC : [%d]Crg UE SCell Config done:\
- cellId %d\n", ueSCellCb->ueId, ueSCellCb->cellId);
-
- /* Send positive confirmation to primary cell*/
- RgPrgSMacPMacCfg(&cfmPst, &cfgCfm);
- return ROK;
-} /* RgPrgPMacSMacUeSCellCfgReq */
-
-/**
- * @brief Hander for config confim from sec MAC to Pri mac for Add Scell Cfg.
- *
- * @details
- *
- * Function : RgPrgSMacPMacCfgCfm
- *
- * Processing Steps:
- * - Allocate and create UE control block.
- * - If cfm event is lch recfg then send the confirmation to RRC for
- * that event.
- * - If cfm event is Scell addition then send the confirmation to RRC for
- * the same.
- * - Update UE control block with the values received in the
- * configuration.
- * - If successful, add the control block to hash list of UEs for the cell
- * else Rollback and FAIL.
- *
- * @param[in] Inst dstMacInst
- * @param[in] RgUrSCellCb *ueSCellCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgPrgSMacPMacCfgCfm
-(
-Pst *pst,
-RgPrgCfgCfmInfo *cfgCfm
-)
-{
- Inst inst = pst->dstInst;
- RgCellCb *cell;
- RgUeCb *ue;
-
- RG_IS_INST_VALID(inst);
-
- DU_LOG("\nINFO --> MAC : Config Confirm Rcvd from Inst %d ueId %d cellId %d\n",
- pst->srcInst, cfgCfm->ueId, cfgCfm->cellId);
-
- cell = rgCb[inst].cell;
-
- if ((ue = rgDBMGetUeCb(cell, cfgCfm->ueId)) == NULLP)
- {
- DU_LOG("\nERROR --> MAC : [%d]UE does not exist\n", cfgCfm->ueId);
- return RFAILED;
- }
- switch(cfgCfm->event)
- {
- /* cfgCount increment for all cases */
- case EVTPRGUESCELLLCHMODCFM:
- case EVTPRGUESCELLLCHDELCFM:
- case EVTPRGUESCELLLCHADDCFM:
- {
- ue->cfgCfmInfo.cfgCfgCount++;
- ue->cfgCfmInfo.mask |= cfgCfm->status;
- if(ue->cfgCfmInfo.numSCells == ue->cfgCfmInfo.cfgCfgCount)
- {
- ue->cfgCfmInfo.cfgCfgCount = 0;
- /* Send back confirmation status to RRC */
- rgUIMCrgCfgCfm(inst, ue->cfgCfmInfo.transId, ue->cfgCfmInfo.mask);
- ue->cfgCfmInfo.mask = 0;
- DU_LOG("\nINFO --> MAC : CRG Configuration request processed\n");
- }
- }
- break;
- case EVTPRGUESCELLCFGCFM:
- {
- /*Commit Added SCell info to UeCb as we confirmation received */
- if(PRG_CFG_CFM_OK == cfgCfm->status)
- {
- ue->sCelInfo[pst->srcInst].isSCellAdded = TRUE;
- ue->sCelInfo[pst->srcInst].macInst = pst->srcInst;
- ue->sCelInfo[pst->srcInst].sCellId = cfgCfm->sCellId;
- }
-
- ue->cfgCfmInfo.cfgCfgCount++;
- ue->cfgCfmInfo.mask |= cfgCfm->status;
- if(ue->cfgCfmInfo.numSCells == ue->cfgCfmInfo.cfgCfgCount)
- {
- ue->cfgCfmInfo.cfgCfgCount = 0;
- /* Send back confirmation status to RRC */
- rgUIMCrgCfgCfm(inst, ue->cfgCfmInfo.transId, ue->cfgCfmInfo.mask);
- ue->cfgCfmInfo.mask = 0;
- DU_LOG("\nINFO --> MAC : CRG Configuration request processed\n");
- }
- }
- break;
- default:
- {
- DU_LOG("\nERROR --> MAC : Invalid configuration confirm event %d\n",
- cfgCfm->event);
-
- return RFAILED;
- }
-
- }
- return ROK;
-} /* RgPrgSMacPMacCfgCfm */
-
-/**
- * @brief Function for handling UE release for SCELL
- * triggered from Primary Cell
- *
- * @details
- *
- * Function : RgPrgPMacSMacUeSCellDelReq
- *
- * - This Function should be invoked by PCell of UE
- * - Remove the UE context from SCELL corresponding to rnti.
- *
- * @param[in] Pst *pst
- * @param[in] RgPrgUeSCellDelInfo *ueSCellDelInfo
- * @return ROK is SUCCESS
- **/
-S16 RgPrgPMacSMacUeSCellDelReq
-(
-Pst *pst,
-RgPrgUeSCellDelInfo *ueSCellDelInfo
-)
-{
- Inst inst = pst->dstInst - RG_INST_START;
- RgCellCb *sCell = rgCb[inst].cell;
- RgUeCb *sCellUe = NULLP;
-
- /* Checking for cell Cb because in case of shutdownReq it is possible that
- * cell is already deleted for this cell*/
- if(sCell == NULLP)
- {
- return ROK;
- }
- /* Retrive the UeCb from sec cell*/
- if ((sCellUe = rgDBMGetUeCb(sCell, ueSCellDelInfo->ueId)) == NULLP)
- {
- DU_LOG("\nERROR --> MAC : [%d]UE:does not exist in sCell(%d)\n",
- ueSCellDelInfo->ueId, sCell->cellId);
- return RFAILED;
- }
-
- /*PMAC_Reest: ueId and newRnti is different that means its a UeId change
- *request from PMAC to SMAC during PCell reestablishment
- */
- if(ueSCellDelInfo->ueId != ueSCellDelInfo->newRnti)
- {
- /* Retrive the UeCb from sec cell*/
- if ((rgDBMGetUeCb(sCell, ueSCellDelInfo->newRnti)) != NULLP)
- {
- DU_LOG("\nERROR --> MAC : [%d]UE:UE context already exist in\
- sCell(%d)",ueSCellDelInfo->newRnti, sCell->cellId);
- return RFAILED;
- }
-
- rgDBMDelUeCb(sCell, sCellUe);
-
- sCellUe->ueId = ueSCellDelInfo->newRnti;
-
- /* Reset harq procs*/
- rgDHMUeReset(sCell, &sCellUe->dl.hqEnt);
-
- rgDBMInsUeCb(sCell, sCellUe);
- }
- else
- {
- rgDBMDelUeCb(sCell, sCellUe);
- rgCFGFreeUeCb(sCell, sCellUe);
- }
-
- return ROK;
-} /* RgPrgPMacSMacUeSCellDelReq */
-#endif /*LTE_ADV */
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Entry point fucntions
-
- File: rg_dbm.c
-
-**********************************************************************/
-
-/** @file rg_dbm.c
-@brief This file contains the APIs exposed for the insertion/fetching/deletion of cellCb/ueCb and traversal of LcCbLst.
-*/
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "tfu.h"
-#include "du_app_mac_inf.h"
-#include "lrg.h"
-#include "crg.h"
-#include "rgu.h"
-#include "rg_sch_inf.h"
-#include "rg_env.h"
-#include "rg.h"
-
-/* header/extern include files (.x) */
-#include "tfu.x"
-#include "lrg.x"
-#include "crg.x"
-#include "rgu.x"
-#include "rg_sch_inf.x"
-#include "rg_prg.x" /* PRG interface typedefs*/
-#include "rg.x"
-
-/* local defines */
-static S16 rgDBMInitUeCbLst ARGS(( RgCellCb *cellCb, uint16_t numBins));
-static Void rgDBMInitDedLcLst ARGS((RgUeCb *ueCb));
-static Void rgDBMInitCmnLcLst ARGS((RgCellCb *cellCb));
-static Void rgDBMInitRachLst ARGS((RgCellCb *cellCb));
-#ifdef LTEMAC_SPS
-static S16 rgDBMInitSpsUeCbLst ARGS((
-RgCellCb *cellCb,
-uint16_t numBins
-));
-#endif
-
-/* local typedefs */
-
-/* local externs */
-
-/* forward references */
-
-/**
- * @brief Handler for Initializing the cell.
- *
- * @details
- *
- * Function : rgDBMInitCell
- *
- * Initializes the lists belonging to the cell.
- *
- *
- * @param[in] RgCellCb *cellCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgDBMInitCell
-(
-RgCellCb *cellCb
-)
-{
- S16 ret;
-
- /* Initialize ue list */
- if ((ret = rgDBMInitUeCbLst(cellCb, RG_MAX_UE_BIN_PER_CELL)) != ROK)
- return (ret);
-
-#ifdef LTEMAC_SPS
- /* Initialize SPS Ue list */
- if ((ret = rgDBMInitSpsUeCbLst(cellCb, RG_MAX_UE_BIN_PER_CELL)) != ROK)
- return (ret);
-#endif /* LTEMAC_SPS */
-
- /* Initialize BCCH/PCCH logical channels */
- rgDBMInitCmnLcLst(cellCb);
-
-
- /* Initialize rach ue list */
- rgDBMInitRachLst(cellCb);
-
- return (ret);
-
-} /* rgDBMInitCell */
-
-/**
- * @brief Handler for initializing the ueCbLst under the cellCb.
- *
- * @details
- *
- * Function : rgDBMInitUeCbLst
- *
- *
- * @param[in] *cellCb
- * @param[in] numBins
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgDBMInitUeCbLst
-(
-RgCellCb *cellCb,
-uint16_t numBins
-)
-{
- Inst inst = cellCb->macInst - RG_INST_START;
- RgUeCb ue;
-
- return (cmHashListInit(&cellCb->ueLst, numBins, (uint16_t)((PTR)&(ue.ueLstEnt) - (PTR)&ue), FALSE,
- CM_HASH_KEYTYPE_CONID, rgCb[inst].rgInit.region, rgCb[inst].rgInit.pool));
-
-} /* rgDBMInitUeCbLst */
-
-/**
- * @brief Handler for de-initializing the ueCbLst under the cellCb.
- *
- * @details
- *
- * Function : rgDBMDeInitUeCbLst
- *
- *
- * @param[in] *cellCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgDBMDeInitUeCbLst(RgCellCb *cellCb)
-{
-
- return (cmHashListDeinit(&cellCb->ueLst));
-
-} /* rgDBMDeInitUeCbLst */
-
-#ifdef LTEMAC_SPS
-/**
- * @brief Handler for initializing the spsUeCbLst under the cellCb.
- *
- * @details
- *
- * Function : rgDBMInitSpsUeCbLst
- *
- *
- * @param[in] *cellCb
- * @param[in] numBins
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgDBMInitSpsUeCbLst(RgCellCb *cellCb,uint16_t numBins)
-{
- Inst inst = cellCb->macInst - RG_INST_START;
- RgUeCb ue;
-
- return (cmHashListInit(&cellCb->spsUeLst, numBins, (uint16_t) ((PTR) &(ue.spsUeLstEnt) - (PTR) &ue), FALSE,
- CM_HASH_KEYTYPE_CONID, rgCb[inst].rgInit.region, rgCb[inst].rgInit.pool));
-
-} /* rgDBMInitSpsUeCbLst */
-
-/**
- * @brief Handler for de-initializing the spsUeCbLst under the cellCb.
- *
- * @details
- *
- * Function : rgDBMDeInitSpsUeCbLst
- *
- *
- * @param[in] *cellCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgDBMDeInitSpsUeCbLst(RgCellCb *cellCb)
-{
-
- return (cmHashListDeinit(&cellCb->spsUeLst));
-
-} /* rgDBMDeInitSpsUeCbLst */
-
-#endif /* LTEMAC_SPS */
-
-/**
- * @brief Handler for inserting the ueCb in to the ueCbLst under the cellCb.
- *
- * @details
- *
- * Function : rgDBMInsUeCb
- *
- *
- * @param[in] *cellCb
- * @param[in] *ueCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgDBMInsUeCb(RgCellCb *cellCb,RgUeCb *ueCb)
-{
- return (cmHashListInsert(&cellCb->ueLst, (PTR)ueCb,
- (uint8_t *)&ueCb->ueId, (uint16_t)sizeof(ueCb->ueId)));
-
-} /* rgDBMInsUeCb */
-
-#ifdef LTEMAC_SPS
-/**
- * @brief Handler for inserting the ueCb in to the spsUeCbLst under the cellCb.
- *
- * @details
- *
- * Function : rgDBMInsSpsUeCb
- *
- *
- * @param[in] *cellCb
- * @param[in] *ueCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgDBMInsSpsUeCb(RgCellCb *cellCb,RgUeCb *ueCb)
-{
-
- return (cmHashListInsert(&cellCb->spsUeLst, (PTR)ueCb,
- (uint8_t *)&ueCb->spsRnti, (uint16_t)sizeof(ueCb->spsRnti)));
-
-} /* end of rgDBMInsSpsUeCb */
-
-#endif /* LTEMAC_SPS */
-
-/**
- * @brief Handler for accessing the existing ueCb identified by the key ueId
- * in the ueCbLst under the cellCb.
- *
- * @details
- *
- * Function : rgDBMGetUeCb
- *
- *
- * @param[in] *cellCb
- * @param[in] ueId
- * @return RgUeCb*
- **/
-RgUeCb* rgDBMGetUeCb(RgCellCb *cellCb, CmLteRnti ueId)
-{
- RgUeCb *ueCb = NULLP;
-
- cmHashListFind(&cellCb->ueLst, (uint8_t *)&ueId,
- sizeof(ueId), 0, (PTR *)&ueCb);
- return (ueCb);
-} /* rgDBMGetUeCb */
-
-#ifdef LTEMAC_SPS
-/**
- * @brief Handler for accessing the ueCb identified by the key sps-rnti
- * in the spsUeLst under the cellCb.
- *
- * @details
- *
- * Function : rgDBMGetSpsUeCb
- *
- *
- * @param[in] *cellCb
- * @param[in] ueId
- * @return RgUeCb*
- **/
-RgUeCb* rgDBMGetSpsUeCb(RgCellCb *cellCb, CmLteRnti spsRnti)
-{
- RgUeCb *ueCb = NULLP;
-
- cmHashListFind(&cellCb->spsUeLst, (uint8_t *)&spsRnti,
- sizeof(spsRnti), 0, (PTR *)&ueCb);
- return (ueCb);
-} /* rgDBMGetSpsUeCb */
-
-#endif /* LTEMAC_SPS */
-
-/**
- * @brief Handler for accessing the existing next ueCb in the ueCbLst under the
- * cellCb.
- *
- * @details
- *
- * Function : rgDBMGetNextUeCb
- *
- *
- * @param[in] *cellCb
- * @param[in] *ueCb
- * @return RgUeCb*
- **/
-RgUeCb* rgDBMGetNextUeCb(RgCellCb *cellCb, RgUeCb *ueCb)
-{
- RgUeCb *nextUeCb = NULLP;
-
- cmHashListGetNext(&cellCb->ueLst, (PTR) ueCb, (PTR *)&nextUeCb);
- return (nextUeCb);
-} /* rgDBMGetNextUeCb */
-
-#ifdef LTEMAC_SPS
-/**
- * @brief Handler for accessing the existing next ueCb stored in the spsUeCbLst
- * using SPS-Rnti under the cellCb.
- *
- * @details
- *
- * Function : rgDBMGetNextSpsUeCb
- *
- *
- * @param[in] *cellCb
- * @param[in] *ueCb
- * @return RgUeCb*
- **/
-RgUeCb* rgDBMGetNextSpsUeCb(RgCellCb *cellCb, RgUeCb *ueCb)
-{
- RgUeCb *nextUeCb = NULLP;
-
- cmHashListGetNext(&cellCb->spsUeLst, (PTR) ueCb, (PTR *)&nextUeCb);
- return (nextUeCb);
-} /* end of rgDBMGetNextSpsUeCb */
-
-#endif /* LTEMAC_SPS */
-
-
-/**
- * @brief Handler for deleting the existing ueCb from the ueCbLst under the
- * cellCb.
- *
- * @details
- *
- * Function : rgDBMDelUeCb
- *
- *
- * @param[in] *cellCb
- * @param[in] *ueCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgDBMDelUeCb(RgCellCb *cellCb, RgUeCb *ueCb)
-{
- return (cmHashListDelete(&cellCb->ueLst, (PTR)ueCb));
-} /* rgDBMDelUeCb */
-
-#ifdef LTEMAC_SPS
-/**
- * @brief Handler for deleting the existing ueCb from the spsUeCbLst under the
- * cellCb.
- *
- * @details
- *
- * Function : rgDBMDelSpsUeCb
- *
- *
- * @param[in] *cellCb
- * @param[in] *ueCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgDBMDelSpsUeCb(RgCellCb *cellCb, RgUeCb *ueCb)
-{
-
- return (cmHashListDelete(&cellCb->spsUeLst, (PTR)ueCb));
-} /* end of rgDBMDelSpsUeCb */
-
-#endif /* LTEMAC_SPS */
-
-/**
- * @brief Handler for Initializing the UE.
- *
- * @details
- *
- * Function : rgDBMInitUe
- *
- * Initializes the lists belonging to the UE.
- *
- *
- * @param[in] RgUeCb *ueCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-Void rgDBMInitUe(RgUeCb *ueCb)
-{
-#ifdef LTEMAC_SPS
- uint8_t idx;
-#endif
-
- /* Initialize Dedicated logical channels */
- rgDBMInitDedLcLst(ueCb);
-
-#ifdef LTEMAC_SPS
- /* Initialize the SPS LC Ids */
- for (idx=0; idx < RG_MAX_LC_PER_UE; idx++)
- {
- ueCb->ul.spsLcId[idx] = FALSE;
- }
-#endif
-
-
- return;
-} /* rgDBMInitUe */
-
-/**
- * @brief Handler for Initializing the dedicated logical channels.
- *
- * @details
- *
- * Function : rgDBMInitDedLcLst
- *
- * Initializes dedicated logical channels.
- *
- * @param[in] RgUeCb *ueCb
- * @return Void
- **/
-static Void rgDBMInitDedLcLst(RgUeCb *ueCb)
-{
- uint8_t idx;
-
- for (idx = 0; idx < RG_MAX_LC_PER_UE; ++idx)
- {
- /* Set Dedicated LCs as not configured */
- ueCb->ul.lcCb[idx].lcId = RG_INVALID_LC_ID;
- ueCb->ul.lcCb[idx].lcgId = RG_INVALID_LCG_ID;
- ueCb->dl.lcCb[idx].lcId = RG_INVALID_LC_ID;
- }
-
- for (idx = 0; idx < RG_MAX_LCG_PER_UE; ++idx)
- {
- /* Set LCGs as not configured */
- ueCb->ul.lcgArr[idx].lcgId = RG_INVALID_LCG_ID;
- ueCb->ul.lcgArr[idx].lcCount = 0;
- }
-
- /* Stack Crash problem for TRACE5 Changes. Added the return below */
- return;
-} /* rgDBMInitDedLcLst */
-
-/**
- * @brief Handler for Initializing the common logical channel list of the cell.
- *
- * @details
- *
- * Function : rgDBMInitCmnLcLst
- *
- * Initializes following common logical channels belonging to the cell.
- * - BCCH on BCH
- * - BCCH on DLSCH
- * - PCCH
- *
- * @param[in] RgCellCb *cellCb
- * @return Void
- **/
-static Void rgDBMInitCmnLcLst(RgCellCb *cellCb)
-{
- uint8_t idx;
-
- cellCb->bcchBchInfo.lcId = RG_INVALID_LC_ID;
- cellCb->pcchInfo.lcId = RG_INVALID_LC_ID;
-
- cellCb->numBcchDlschInfo = 0;
- for (idx = 0; idx < RG_MAX_BCCH_DLSCH; idx++)
- {
- cellCb->bcchDlschInfo[idx].lcId = RG_INVALID_LC_ID;
- cellCb->bcchDlschInfo[idx].tb = NULLP;
- }
-
- /* Stack Crash problem for TRACE5 Changes. Added the return below */
- return;
-} /* rgDBMInitCmnLcLst */
-
-/**
- * @brief Handler for Initializing the common logical channel list of the cell.
- *
- * @details
- *
- * Function : rgDBMFreeCmnLcLst
- *
- * Initializes following common logical channels belonging to the cell.
- * - BCCH on BCH
- * - BCCH on DLSCH
- * - PCCH
- *
- * @param[in] RgCellCb *cellCb
- * @return Void
- **/
-Void rgDBMFreeCmnLcLst(RgCellCb *cellCb)
-{
- uint8_t idx;
-
- cellCb->bcchBchInfo.lcId = RG_INVALID_LC_ID;
- cellCb->pcchInfo.lcId = RG_INVALID_LC_ID;
-
- for (idx = 0; idx < cellCb->numBcchDlschInfo; idx++)
- {
- cellCb->bcchDlschInfo[idx].lcId = RG_INVALID_LC_ID;
- RG_FREE_MSG(cellCb->bcchDlschInfo[idx].tb);
- }
- cellCb->numBcchDlschInfo = 0;
-
- /* Stack Crash problem for TRACE5 Changes. Added the return below */
- return;
-} /* rgDBMFreeCmnLcLst */
-
-/**
- * @brief Handler for inserting dedicated DL logical channel.
- *
- * @details
- *
- * Function : rgDBMInsDlDedLcCb
- *
- * @param[in] RgUeCb *ueCb
- * @param[in] RgDlLcCb* dlLcCb
- * @return Void
- **/
-Void rgDBMInsDlDedLcCb(RgUeCb *ueCb, CmLteLcId idx)
-{
- if( idx >= RG_DEDLC_MIN_LCID )
- {
- ueCb->dl.lcCb[idx-1].lcId = idx;
- }
- /* Stack Crash problem for TRACE5 Changes. Added the return below */
- return;
-} /* rgDBMInsDlDedLcCb */
-
-/**
- * @brief Handler for deleting dedicated DL logical channel.
- *
- * @details
- *
- * Function : rgDBMDelDlDedLcCb
- *
- * @param[in] RgUeCb *ueCb
- * @param[in] RgDlLcCb* dlLcCb
- * @return Void
- **/
-Void rgDBMDelDlDedLcCb(RgUeCb *ueCb, RgDlLcCb *dlLcCb)
-{
- ueCb->dl.lcCb[dlLcCb->lcId - 1].lcId = RG_INVALID_LC_ID;
-
- /* Stack Crash problem for TRACE5 Changes. Added the return below */
- return;
-
-} /* rgDBMDelDlDedLcCb */
-
-/**
- * @brief Handler for accessing the existing DL dedicated lcCb at idx in the
- * lcCbLst of the ueCb.
- *
- * @details
- *
- * Function : rgDBMGetDlDedLcCb
- *
- * @param[in] *ueCb
- * @param[in] idx
- * @return RgDlLcCb*
- **/
-RgDlLcCb* rgDBMGetDlDedLcCb(RgUeCb *ueCb, CmLteLcId idx)
-{
- if (idx > RG_DEDLC_MAX_LCID || idx <= 0)
- {
- return (NULLP);
- }
- if(ueCb->dl.lcCb[idx-1].lcId == RG_INVALID_LC_ID)
- {
- return (NULLP);
- }
-
- return (&ueCb->dl.lcCb[idx-1]);
-
-} /* rgDBMGetDlDedLcCb */
-
-/**
- * @brief Handler for inserting dedicated UL logical channel.
- *
- * @details
- *
- * Function : rgDBMInsUlDedLcCb
- *
- *
- * @param[in] RgUeCb *ueCb
- * @param[in] CmLteLcId idx
- * @param[in] LteLcgId gId
- * @return Void
- **/
-#ifdef LTE_L2_MEAS
-Void rgDBMInsUlDedLcCb
-(
-RgUeCb *ueCb,
-CmLteLcId idx,
-LteLcgId gId,
-uint8_t qci
-)
-#else
-Void rgDBMInsUlDedLcCb
-(
-RgUeCb *ueCb,
-CmLteLcId idx,
-LteLcgId gId
-)
-#endif
-{
- if ( idx >= RG_DEDLC_MIN_LCID)
- {
- ueCb->ul.lcCb[idx - 1].lcId = idx;
- ueCb->ul.lcCb[idx - 1].lcgId = gId;
-#ifdef LTE_L2_MEAS
- ueCb->ul.lcCb[idx - 1].qci = qci;
-#endif
- }
- if(ueCb->ul.lcgArr[gId].lcgId == RG_INVALID_LCG_ID)
- {
- ueCb->ul.lcgArr[gId].lcgId = gId;
- }
- ueCb->ul.lcgArr[gId].lcCount = ueCb->ul.lcgArr[gId].lcCount + 1;
-
-
- /* Stack Crash problem for TRACE5 Changes. Added the return below */
- return;
-
-} /* rgDBMInsUlDedLcCb */
-
-/**
- * @brief Handler for deleting the dedicated UL logical channel.
- *
- * @details
- *
- * Function : rgDBMUpdUlDedLcCb
- *
- *
- * @param[in] RgUeCb *ueCb
- * @param[in] RgUlLcCb* ulLcCb
- * @param[in] LteLcgId gId
- * @return Void
- **/
-Void rgDBMUpdUlDedLcCb
-(
-RgUeCb *ueCb,
-RgUlLcCb *ulLcCb,
-LteLcgId gId
-)
-{
- ueCb->ul.lcgArr[ulLcCb->lcgId].lcCount =
- ueCb->ul.lcgArr[ulLcCb->lcgId].lcCount - 1;
- if(ueCb->ul.lcgArr[ulLcCb->lcgId].lcCount == 0)
- {
- ueCb->ul.lcgArr[ulLcCb->lcgId].lcgId = RG_INVALID_LCG_ID;
- }
- ueCb->ul.lcCb[ulLcCb->lcId - 1].lcgId = gId;
-
- if(ueCb->ul.lcgArr[gId].lcgId == RG_INVALID_LCG_ID)
- {
- ueCb->ul.lcgArr[gId].lcgId = gId;
- }
- ueCb->ul.lcgArr[gId].lcCount = ueCb->ul.lcgArr[gId].lcCount + 1;
-
- /* Stack Crash problem for TRACE5 Changes. Added the return below */
- return;
-} /* rgDBMUpdUlDedLcCb */
-
-/**
- * @brief Handler for updating the dedicated UL logical channel.
- *
- * @details
- *
- * Function : rgDBMDelUlDedLcCb
- *
- *
- * @param[in] RgUeCb *ueCb
- * @param[in] RgUlLcCb* ulLcCb
- * @return Void
- **/
-Void rgDBMDelUlDedLcCb(RgUeCb *ueCb, RgUlLcCb *ulLcCb)
-{
-
- ueCb->ul.lcgArr[ulLcCb->lcgId].lcCount =
- ueCb->ul.lcgArr[ulLcCb->lcgId].lcCount - 1;
- if(ueCb->ul.lcgArr[ulLcCb->lcgId].lcCount == 0)
- {
- ueCb->ul.lcgArr[ulLcCb->lcgId].lcgId = RG_INVALID_LCG_ID;
- }
- ueCb->ul.lcCb[ulLcCb->lcId - 1].lcgId = RG_INVALID_LCG_ID;
- ueCb->ul.lcCb[ulLcCb->lcId - 1].lcId = RG_INVALID_LC_ID;
-
- /* Stack Crash problem for TRACE5 Changes. Added the return below */
- return;
-} /* rgDBMDelUlDedLcCb */
-
-/**
- * @brief Handler for accessing the existing UL dedicated lcCb at idx in the
- * lcCbLst of the ueCb.
- *
- * @details
- *
- * Function : rgDBMGetUlDedLcCb
- *
- *
- * @param[in] *ueCb
- * @param[in] idx
- * @return RgUlLcCb*
- **/
-RgUlLcCb* rgDBMGetUlDedLcCb(RgUeCb *ueCb, CmLteLcId idx)
-{
-
- if (idx > RG_DEDLC_MAX_LCID || idx < RG_DEDLC_MIN_LCID)
- {
- return (NULLP);
- }
- if(ueCb->ul.lcCb[idx-1].lcId == RG_INVALID_LC_ID)
- {
- return (NULLP);
- }
-
- return (&ueCb->ul.lcCb[idx-1]);
-} /* rgDBMGetDlDedLcCb */
-
-/**
- * @brief Handler for accessing the existing DL common lcCb identified by the key lcId
- * in the lcCbLst of the ueCb.
- *
- * @details
- *
- * Function : rgDBMChkCmnLcCb
- *
- *
- * @param[in] *cellCb
- * @param[in] lcId
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgDBMChkCmnLcCb(RgCellCb *cellCb, CmLteLcId lcId)
-{
- uint8_t idx;
-
- if(cellCb->bcchBchInfo.lcId == lcId)
- {
- return ROK;
- }
- if(cellCb->pcchInfo.lcId == lcId)
- {
- return ROK;
- }
-
- for (idx = 0; idx < cellCb->numBcchDlschInfo; idx++)
- {
- if(cellCb->bcchDlschInfo[idx].lcId == lcId)
- {
- return ROK;
- }
- }
- return RFAILED;
-} /* rgDBMChkCmnLcCb */
-
-/**
- * @brief Handler for accessing the existing BCCH mapped on to BCH in the
- * lcCbLst of the ueCb.
- *
- * @details
- *
- * Function : rgDBMGetBcchOnBch
- *
- *
- * @param[in] *cellCb
- * @return RgBcchBchLcCb*
- **/
-RgBcchBchLcCb* rgDBMGetBcchOnBch(RgCellCb *cellCb)
-{
-
- if(cellCb->bcchBchInfo.lcId != RG_INVALID_LC_ID)
- {
- return (&(cellCb->bcchBchInfo));
- }
- return (NULLP);
-} /* rgDBMGetBcchOnBch */
-
-/**
- * @brief Handler for accessing the existing BCCH mapped on to DLSCH in the
- * lcCbLst of the ueCb.
- *
- * @details
- *
- * Function : rgDBMGetBcchOnDlsch
- *
- *
- * @param[in] *cellCb
- * @param[in] lcId
- * @return RgBcchDlschLcCb*
- **/
-RgBcchDlschLcCb* rgDBMGetBcchOnDlsch(RgCellCb *cellCb,CmLteLcId lcId)
-{
- uint8_t idx;
-
- for (idx = 0; idx < RG_MAX_BCCH_DLSCH; idx++)
- {
- if(cellCb->bcchDlschInfo[idx].lcId == lcId)
- {
- return (&(cellCb->bcchDlschInfo[idx]));
- }
- }
- return (NULLP);
-} /* rgDBMGetBcchOnDlsch */
-
-/**
- * @brief Handler for accessing the existing PCCH in the lcCbLst of the ueCb.
- *
- * @details
- *
- * Function : rgDBMGetPcch
- *
- *
- * @param[in] *cellCb
- * @return RgPcchLcCb*
- **/
-RgPcchLcCb* rgDBMGetPcch(RgCellCb *cellCb)
-{
-
- if(cellCb->pcchInfo.lcId != RG_INVALID_LC_ID)
- {
- return (&(cellCb->pcchInfo));
- }
- return (NULLP);
-} /* rgDBMGetPcch */
-
-/**
- * @brief Handler for inserting the BCCH mapped on to BCH in the
- * lcCbLst of the ueCb.
- *
- * @details
- *
- * Function : rgDBMInsBcchOnBch
- *
- *
- * @param[in] *cellCb
- * @return Void
- **/
-Void rgDBMInsBcchOnBch(RgCellCb *cellCb, CmLteLcId idx)
-{
-
- cellCb->bcchBchInfo.lcId = idx;
-
- /* Stack Crash problem for TRACE5 Changes. Added the return below */
- return;
-} /* rgDBMInsBcchOnBch */
-
-/**
- * @brief Handler for inserting the BCCH mapped on to DLSCH in the
- * lcCbLst of the ueCb.
- *
- * @details
- *
- * Function : rgDBMInsBcchOnDlsch
- *
- *
- * @param[in] *cellCb
- * @return Void
- **/
-Void rgDBMInsBcchOnDlsch(RgCellCb *cellCb, CmLteLcId idx)
-{
-
- cellCb->bcchDlschInfo[cellCb->numBcchDlschInfo].lcId = idx;
- cellCb->numBcchDlschInfo++;
-
- /* Stack Crash problem for TRACE5 Changes. Added the return below */
- return;
-} /* rgDBMInsBcchOnDlsch */
-
-
-/**
- * @brief Handler for inserting the PCCH in the lcCbLst of the ueCb.
- *
- * @details
- *
- * Function : rgDBMInsPcch
- *
- *
- * @param[in] *cellCb
- * @return Void
- **/
-Void rgDBMInsPcch(RgCellCb *cellCb, CmLteLcId idx)
-{
-
- cellCb->pcchInfo.lcId = idx;
-
- /* Stack Crash problem for TRACE5 Changes. Added the return below */
- return;
-} /* rgDBMInsPcch */
-
-/**
- * @brief Handler for initializing the rachLst
- *
- * @details
- *
- * Function : rgDBMInitRachLst
- *
- *
- * @param[in] *cellCb
- * @return Void
- **/
-static Void rgDBMInitRachLst(RgCellCb *cellCb)
-{
-
- cmLListInit(&cellCb->raInfo.ueRachLst);
- return;
-} /* rgDBMInitRachLst */
-
-/**
- * @brief Handler for inserting the ueCb in the rachLst.
- *
- * @details
- *
- * Function : rgDBMInsUeCbInRachLst
- *
- *
- * @param[in] *cellCb
- * @param[in] *ueCb
- * @return Void
- **/
-Void rgDBMInsUeCbInRachLst(RgCellCb *cellCb, RgUeCb *ueCb)
-{
-
- cmLListAdd2Tail(&cellCb->raInfo.ueRachLst,&ueCb->rachLstEnt);
-
- return;
-} /* rgDBMInsUeCbInRachLst */
-
-/**
- * @brief Handler for accessing the existing raCb in the rachLst.
- *
- * @details
- *
- * Function : rgDBMGetUeCbFromRachLst
- *
- *
- * @param[in] *cellCb
- * @param[in] key
- * @return RgUeCb*
- **/
-RgUeCb* rgDBMGetUeCbFromRachLst(RgCellCb *cellCb, CmLteRnti key)
-{
- CmLList *tmpNode;
-
- CM_LLIST_FIRST_NODE(&cellCb->raInfo.ueRachLst,tmpNode);
- while(tmpNode)
- {
- if(((RgUeCb *)tmpNode->node)->ueId == key)
- {
- return ((RgUeCb *)(tmpNode->node));
- }
- CM_LLIST_NEXT_NODE(&cellCb->raInfo.ueRachLst,tmpNode);
- }
- return (NULLP);
-} /* rgDBMGetUeCbFromRachLst */
-
-/**
- * @brief Handler for accessing the existing ueCb from rachLst.
- *
- * @details
- *
- * Function : rgDBMGetNextUeCbFromRachLst
- *
- *
- * @param[in] *cellCb
- * @param[in] *ueCb
- * @return RgUeCb*
- **/
-RgUeCb* rgDBMGetNextUeCbFromRachLst(RgCellCb *cellCb,RgUeCb *ueCb)
-{
-
- if(!ueCb)
- {
- return ( cellCb->raInfo.ueRachLst.first ?
- (RgUeCb *)(cellCb->raInfo.ueRachLst.first->node) : NULLP );
- }
- return ( ueCb->rachLstEnt.next ?
- (RgUeCb *)(ueCb->rachLstEnt.next->node) : NULLP );
-} /* rgDBMGetNextUeCbFromRachLst */
-
-/**
- * @brief Handler for deleting the existing ueCb in the rachLst.
- *
- * @details
- *
- * Function : rgDBMDelUeCbFromRachLst
- *
- *
- * @param[in] *cellCb
- * @param[in] key
- * @return RgUeCb*
- **/
-Void rgDBMDelUeCbFromRachLst(RgCellCb *cellCb, RgUeCb *ueCb)
-{
-
- cmLListDelFrm(&cellCb->raInfo.ueRachLst, &ueCb->rachLstEnt);
- return;
-} /* rgDBMDelUeCbFromRachLst */
-
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Entry point fucntions
-
- File: rg_dhm.c
-
-**********************************************************************/
-
-/** @file rg_dhm.c
-@brief APIs related to Downlink HARQ.
-*/
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#ifdef L2_OPTMZ
-#include "ss_strm.h"
-#endif
-#include "lrg.h"
-#include "crg.h"
-#include "tfu.h"
-#include "rgu.h"
-#include "rg_sch_inf.h"
-#include "rg_env.h"
-#include "rg_err.h"
-#include "rg.h"
-#include "du_app_mac_inf.h"
-
-/* header/extern include files (.x) */
-#ifdef L2_OPTMZ
-#include "ss_strm.x"
-#endif
-#include "lrg.x"
-#include "crg.x"
-#include "tfu.x"
-#include "rgu.x"
-#include "rg_sch_inf.x"
-#include "rg_prg.x" /* PRG interface typedefs */
-#include "rg.x"
-
-#ifdef L2_OPTMZ
-#include "ss_queue.h"
-#include "ss_queue.x"
-#include "ss_task.x"
-#include "ss_msg.x" /* MAC includes */
-/* local defines */
-// S16 ssGetDBufOfSize(Region region,Size size,Buffer **dBuf);
-//void prc_trace_format_string(UINT32 group_mask, UINT16 level, const char *format, ...);
-#endif
-
-/* local typedefs */
-
-/* local externs */
-S16 SIncMsgRef(Buffer *srcBuf,Region dstRegion, Pool dstPool,Buffer **dstBuf);
-
-static Void rgDHMBldTfuDatReq ARGS((RgCellCb *cellCb, RgDlSf *dlSf, RgDlHqProcCb *hqP,
- RgTfuDatReqPduInfo *datReq));
-
-#ifdef L2_OPTMZ
-S16 rgDHMFreeHqProcTB
-(
-RgDlHqProcCb *hqP,
-uint8_t tbIndex
-);
-
-#endif
-
-/* forward references */
-
-/**
- * @brief This function initializes the DL HARQ Entity of UE
- *
- * @details
- *
- * Function: rgDHMHqEntInit
- * Purpose: This function initializes the DL HARQ entity of
- * UE control block. This is performed at the time
- * of creating UE control block.
- *
- * Invoked by: configuration module
- *
- * @param[in] Inst inst
- * @param[in] RgCellCb* cell
- * @param[in] RgUeCb* ue
- * @return S16
- * -# ROK
- * -# RFAILED
- *
- **/
-S16 rgDHMHqEntInit(Inst inst, RgDlHqEnt *hqE, uint8_t maxHqProcs)
-{
- uint8_t idx1,idx2;
-#ifdef L2_OPTMZ
- Buffer *hdrDBuf = NULLP;
- Buffer *ceDBuf = NULLP;
-#endif
-
- hqE->numHqProcs = maxHqProcs;
- /* for each harq process */
- for (idx1 = 0; idx1 < hqE->numHqProcs; idx1++)
- {
- if (rgAllocSBuf(inst,(Data **)&(hqE->procs[idx1]),sizeof(RgDlHqProcCb)) != ROK)
- {
- while(idx1--)
- {
- rgFreeSBuf(inst,(Data **)&(hqE->procs[idx1]), sizeof(RgDlHqProcCb));
- }
- DU_LOG("\nERROR --> MAC : Memory Alloc Failure for RgDlHqProcCb");
- return RFAILED;
- }
-
- hqE->procs[idx1]->procId = idx1;
- for(idx2 = 0; idx2 < RG_MAX_TB_PER_UE; idx2++)
- {
-#ifndef L2_OPTMZ
- hqE->procs[idx1]->tbInfo[idx2].tb = NULLP;
-#else
- Buffer *tmpMBuf;
- /* L2 optimization for mUe/Tti: Allocating buffers for macHdr, macCes
- * and macPadding. These buffers shall not be released by MAC/CL.
- * However, Only rPtr and wPtr will be reset while release of hq proc
- */
- tmpMBuf = hqE->procs[idx1]->tbInfo[idx2].tb.macHdr;
- rgGetMsg(inst, &tmpMBuf);
- RG_ADD_DBuf(hdrDBuf, RG_MAC_HDR_SIZE, tmpMBuf);
- hqE->procs[idx1]->tbInfo[idx2].tb.macHdr = tmpMBuf;
- macHeader[idx2] = MacPtrAddress;
-
- tmpMBuf = hqE->procs[idx1]->tbInfo[idx2].tb.macCes;
- rgGetMsg(inst, &tmpMBuf);
- RG_ADD_DBuf(ceDBuf, RG_MAC_CE_SIZE, tmpMBuf);
- hqE->procs[idx1]->tbInfo[idx2].tb.macCes = tmpMBuf;
-
- hqE->procs[idx1]->tbInfo[idx2].tb.padSize = 0;
-#endif
-#ifdef LTE_L2_MEAS
- hqE->procs[idx1]->tbId[idx2] = RGU_INVALID_TBID;
-#endif
- }
-
- cmLListInit(&hqE->savedProcLst[idx1]);
- }
-
-
- return ROK;
-} /* rgDHMHqEntInit */
-
-/**
- * @brief This function releases a HARQ process
- *
- * @details
- *
- * Function: rgDHMUeReset
- * Purpose: This function resets TB in each HarqProc.
- *
- * Invoked by: CFG UE Reset
- *
- * @param[in] RgDlHqProc *hqP
- * @return Void
- *
- **/
-Void rgDHMUeReset(RgCellCb *cell, RgDlHqEnt *hqE)
-{
- uint8_t i = 0;
-
- if(hqE->procs[0])
- {
- /* Free all the TB memory associated with HARQ */
- for (i=0; i < hqE->numHqProcs; i++)
- {
- rgDHMRlsHqProcTB(cell, hqE->procs[i], 1);
- rgDHMRlsHqProcTB(cell, hqE->procs[i], 2);
-
-#ifdef LTE_ADV
- rgDHMFreeSavedHqP((cell->macInst - RG_INST_START), hqE, i);
-#endif
- }
- }
- return;
-} /* rgDHMUeReset*/
-
-/**
- * @brief This function defers shared memory buffer
- * freeing out of the critical RT path.
- *
- * @details
- *
- * Function: rgDHMHdlBufFree
- * Purpose: To defer shared memory freeing post
- * critical path. Defer as many if defer queue
- * is full then release instantly.
- *
- * Invoked by: HARQ TB Release.
- *
- * @return Void
- *
- **/
-Void rgDHMHdlBufFree(Inst inst, Buffer **mBuf)
-{
- RgCb *rgCbP = &rgCb[inst];
-
- if (rgCbP->bufCnt < RG_MAX_DFRD_FREE_BUFS)
- {
- if (*mBuf)
- {
- rgCbP->bufToFree[rgCbP->bufCnt] = *mBuf;
- rgCbP->bufCnt++;
- *mBuf = NULLP;
- }
- }
- else
- {
- RG_FREE_MSG(*mBuf);
- }
- return;
-}
-/**
- * @brief This function is called to release the
- * shared memory of the HARQ TBs outside
- * the critical RT path.
- *
- * @details
- *
- * Function: rgDHMFreeTbBufs
- * Purpose: This function is called to release the
- * shared memory of the HARQ TBs outside
- * the critical RT path.
- *
- * 1. Job of releasing TBs is shared across TTIs
- * Invoked by: MAC every TTI
- *
- * @return Void
- *
- **/
-Void rgDHMFreeTbBufs(Inst inst)
-{
- RgCb *rgCbP = &rgCb[inst];
- uint8_t start = rgCbP->bufCnt;
- uint8_t end = 0;
-
- if (rgCbP->bufCnt < RG_MAX_FREE_BUFS_PERTTI)
- {
- end = 0;
- }
- else
- {
- end = rgCbP->bufCnt - RG_MAX_FREE_BUFS_PERTTI;
- }
- while (start != end)
- {
- start--;
- ODU_PUT_MSG_BUF(rgCbP->bufToFree[start]);
- }
- rgCbP->bufCnt = end;
- return;
-} /* rgDHMFreeTbBufs */
-
-Void rgDHMFreeAllTbBufs(Inst inst)
-{
- RgCb *rgCbP = &rgCb[inst];
- uint8_t start = rgCbP->bufCnt;
- uint8_t end = 0;
-
- while (start != end)
- {
- start--;
- ODU_PUT_MSG_BUF(rgCbP->bufToFree[start]);
- }
- rgCbP->bufCnt = end;
- return;
-} /* rgDHMFreeTbBufs */
-
-
-/**
- * @brief This function releases a HARQ process
- *
- * @details
- *
- * Function: rgDHMRlsHqProcTB
- * Purpose: This function returns a HARQ process to HARQ Entity
- * in the DL direction.
- *
- * 1. Add the HARQ process to the free queue.
- * Invoked by: scheduler and HARQ processing
- *
- * @param[in] RgDlHqProc *hqP
- * @return Void
- *
- **/
-S16 rgDHMRlsHqProcTB(RgCellCb *cell, RgDlHqProcCb *hqP, uint8_t tbIndex)
-{
- uint8_t idx;
-#ifdef L2_OPTMZ
- RgTfuDatReqTbInfo *tb; /* TB to be sent to CL/PHY*/
- // uint32_t lchIdx, pduIdx;
-#endif
-
- if((tbIndex > RG_MAX_TB_PER_UE) ||
- (tbIndex == 0))
- {
- return RFAILED;
- }
-
- hqP->tbInfo[tbIndex-1].numSchLch = 0;
-#ifndef L2_OPTMZ
- if (hqP->tbInfo[tbIndex-1].tb)
- {
- rgDHMHdlBufFree(cell->macInst - RG_INST_START, &hqP->tbInfo[tbIndex-1].tb);
- }
-#else
- /* L2 Optimization for mUe/Tti: macHdr, macCes and macPad mBuf pointers
- * shall not be released. However, Inorder to release harq info/TB info,
- * just Resetting rPtr and wPtr of these mbufs to db_base
- */
- tb = &(hqP->tbInfo[tbIndex-1].tb);
- if (tb->tbPres == TRUE)
- {
- RG_FREE_TB(tb);
- }
-#endif
- hqP->tbInfo[tbIndex-1].schdTa.pres = FALSE;
-#ifdef LTE_ADV
- hqP->tbInfo[tbIndex -1].sCellActCe.pres = FALSE;
-#endif
-
- /* Decrementing might lead to roundoff error in case of say UE reset
- * where all the HqProcs irrespective whether in use are called for rls.
- * Hence to avoid the same shift operator is being used. */
- hqP->numOfTBs = hqP->numOfTBs >> 1;
- for(idx = 0; idx < 2; idx++)
- {
- if (hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sfLnk.node != NULLP)
- {
- cmLListDelFrm(&hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sf->tbs,
- &(hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sfLnk));
- hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sfLnk.node = (PTR)NULLP;
- DU_LOG("\nINFO --> MAC : rgDHMRlsHqProcTB:: hqP %p \n", (Void *)hqP);
- }
- hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sf = NULLP;
- }
- /* Fix : syed It is better to reset these feilds
- * corruption avoidance */
- hqP->tbInfo[tbIndex-1].tbSz = 0;
- hqP->tbInfo[tbIndex-1].contResCe = NOTPRSNT;
- hqP->tbInfo[tbIndex-1].contResId = NULLP;
-
- return ROK;
-} /* rgDHMRlsHqProc */
-
-/**
- * @brief This function gets HARQ process with the given Id
- *
- * @details
- *
- * Function: rgDHMGetHqProcFrmId
- * Purpose: This function returns the HARQ process with the given ID.
- * Invoked by: ROM
- *
- * @param[in] RgUeCb *ue
- * @param[in] uint8_t idx
- * @param[in] RgDlHqProc **hqP
- * @return S16
- * -# ROK if successful
- * -# RFAILED otherwise
- *
- **/
-S16 rgDHMGetHqProcFrmId(RgUeCb *ue, uint8_t idx, RgDlHqProcCb **hqP)
-{
- /* Pick the proc based on the index provided */
- *hqP = (ue->dl.hqEnt.procs[idx]);
-
- return ROK;
-} /* rgDHMGetHqProcFrmId */
-
-/*static uint32_t dataAvl; */
-/**
- * @brief Handler for sending data to PHY
- *
- * @details
- *
- * Function : rgDHMSndDatReq
- *
- * This function shall send the MAC PDU built for the UE to TOM
- * when invoked as part of TTI processing and keep track of the number of
- * transmissions for this TB.
- *
- *
- * @param[in] RgCellCb *cell
- * @param[in] RgDlHqProcCb *hqE
- * @param[out] RgErrInfo *err
- * @return S16
- * -#ROK
- * -#RFAILED
- **/
- S16 rgDHMSndDatReq
-(
- RgCellCb *cellCb,
- RgDlSf *dlSf,
- RgTfuDatReqInfo *datInfo,
- RgDlHqProcCb *hqP,
- RgErrInfo *err
- )
-{
- uint8_t i;
- Inst inst = cellCb->macInst - RG_INST_START;
- RgTfuDatReqPduInfo *datReq;
- RgBldPduInfo bldPdu;
- /*Added this variable to figure out that whether this UE data
- has to be inclueded in the TFU Data request.*/
- Bool dataAvlblUe;
-
- dataAvlblUe = TRUE;
- for(i=0;i< RG_MAX_TB_PER_UE;i++)
- {
- /* DU_LOG("\nDHMSndDatReq1: Rnti %d dlSfSchdTime(sfn sf) : (%d %d)\n"
- "macCell(sfn sf): (%d %d) tbTimingInfo(sfn sf): (%d %d)\n"
- "dlSf %p dlSf->tbs.count %d hqp %p tb %p\n",
- hqP->tbInfo[i].pdcch.rnti,
- dlSf->schdTime.sfn, dlSf->schdTime.slot,
- cellCb->crntTime.sfn, cellCb->crntTime.slot,
- hqP->tbInfo[i].timingInfo.sfn,
- hqP->tbInfo[i].timingInfo.slot,
- (Void *)dlSf, dlSf->tbs.count,
- (Void *)hqP,
- (Void *)hqP->tbInfo[i].tb);*/
- /* Mukesh :: in case of rpepetiton this is not rerd*/
- if (hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf == dlSf)
- {
- /* Check if data from RLC had been received and got muxed. */
-#ifndef L2_OPTMZ
- if (hqP->tbInfo[i].tb == NULLP)
-#else
- if (!(hqP->tbInfo[i].tb.tbPres))
-#endif
- {
-#ifndef LTE_ADV
- if (hqP->tbInfo[i].schdTa.pres == TRUE ||
- hqP->tbInfo[i].contResCe == PRSNT_NODEF)
-#else
- if ((hqP->tbInfo[i].schdTa.pres == TRUE) ||
- (hqP->tbInfo[i].contResCe == PRSNT_NODEF) ||
- (hqP->tbInfo[i].sCellActCe.pres == TRUE))
-#endif
- {
- /* Data not received but ta needs to be sent. */
- /* MUX TA and send it */
- bldPdu.datReq = NULLP;
- //bldPdu.reqType = EVENT_SLOT_IND_TO_MAC;
- bldPdu.schdTbSz = hqP->tbInfo[i].tbSz;
- bldPdu.ta = hqP->tbInfo[i].schdTa;
-#ifdef LTE_ADV
- bldPdu.sCellActCe= hqP->tbInfo[i].sCellActCe;
-#endif
- /* changes for CR timer implementation*/
- bldPdu.contResId = hqP->tbInfo[i].contResId;
- if (ROK != rgMUXBldPdu(inst,&bldPdu, &(hqP->tbInfo[i].tb), err))
- {
- DU_LOG("\nERROR --> MAC : MUXing failed for: MacInst %d", inst);
- DU_LOG("\nERROR --> MAC : MUXing failed for: time: %d/%d\
- procId %d ueId %d", hqP->tbInfo[i].timingInfo.sfn,
- hqP->tbInfo[i].timingInfo.slot, hqP->procId,
- hqP->tbInfo[i].pdcch.rnti);
-
- return RFAILED;
- }
- }
- else
- {
-#ifdef LTEMAC_RGU_PAD
- /* Data not received from RLC. Padding at MAC */
- bldPdu.datReq = NULLP;
- //bldPdu.reqType = EVENT_SLOT_IND_TO_MAC;
- bldPdu.schdTbSz = hqP->tbInfo[i].tbSz;
- bldPdu.ta = hqP->tbInfo[i].schdTa;
-#ifdef LTE_ADV
- bldPdu.sCellActCe= hqP->tbInfo[i].sCellActCe;
-#endif
- bldPdu.ta.val = 0;
- bldPdu.contResId = NULLP;
-
- if (ROK != rgMUXBldPdu(inst,&bldPdu, &(hqP->tbInfo[i].tb), err))
- {
- DU_LOG("\nERROR --> MAC : MUXing failed for: MacInst %d", inst);
- DU_LOG("\nERROR --> MAC : MUXing failed for: time: %d/%d\
- procId %d ueId %d", hqP->tbInfo[i].timingInfo.sfn,
- hqP->tbInfo[i].timingInfo.slot, hqP->procId,
- hqP->tbInfo[i].pdcch.rnti);
-
- return RFAILED;
- }
-#else
- /*Padding is not done so data for this UE will not be
- included.*/
- dataAvlblUe = FALSE;
-#endif
- }
- }
- else
- {
- }
- }
- //else
- {
- }
- }
-
- /*If Data/Padding is not available for UE, then we can not include
- any Data for this UE in TFU Data Request.*/
- if(!dataAvlblUe)
- {
- /*Free up the HARQ process for this allocation.*/
- /* Release First TB, as this would be anyway there*/
- rgDHMRlsHqProcTB(cellCb, hqP, 1);
- if(2 == hqP->numOfTBs)
- {
- rgDHMRlsHqProcTB(cellCb, hqP, 2);
- }
-
- return ROK;
- }
-
- if (rgGetEventMem(inst,(Ptr *)&datReq, sizeof(TfuDatReqPduInfo),
- &(datInfo->memCp)) != ROK)
- {
- return RFAILED;
- }
- /* Fill the TFU Dat Req with information from Harq Proc */
-
- rgDHMBldTfuDatReq(cellCb, dlSf, hqP, datReq);
-
- /* MS_WORKAROUND for ccpu00122894 */
- for(i=0;i< RG_MAX_TB_PER_UE;i++)
- {
- if (hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf == dlSf)
- {
- cmLListDelFrm(&dlSf->tbs, &(hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk));
- hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk.node = NULLP;
-
-
- hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf = NULLP;
- }
- }
- cmLListAdd2Tail(&datInfo->pdus, &(datReq->lnk));
- datReq->lnk.node = (PTR)datReq;
-
- return ROK;
-} /* rgDHMSndDatReq */
-
-/**
- * @brief Function to handle RGU datReq received from ROM
- *
- * @details
- *
- * Function : rgDHMHndlDedDatReq
- *
- * This function shall act on the datReq received on RGU. It shall
- * store the data IDs for all the logical channels and get the MAC
- * PDU built.
- *
- *
- * @param[in] Inst inst
- * @param[in] RgDlHqProcCb *hqProc
- * @param[in] RgRguDedDatReq *datReq
- * @param[out] RgErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
- S16 rgDHMHndlDedDatReq
-(
- Inst inst,
- RgDlHqProcCb *hqProc,
- RgRguDDatReqPerUe *datReq,
- RgDlSf *dlSf,
- RgErrInfo *err
- )
-{
- // uint32_t len;
- uint8_t i;
- uint8_t j;
- RgBldPduInfo bldPdu;
- uint8_t tbIndex;
-#ifdef L2_OPTMZ
- RgTfuDatReqTbInfo *tb;
-#endif
-
-
- tbIndex = (uint8_t)(datReq->transId & 0x03);
- /* Accept all the data requests even if delayed in case nothing
- * has been sent earlier on the harq proc.
- */
- if((datReq->nmbOfTbs > RG_MAX_TB_PER_UE) ||
- (tbIndex == 0))
- {
- /* release corresponding TBs from SF tbs List */
- for(j=0;j<datReq->nmbOfTbs;j++)
- {
- if (!(tbIndex & (j+1)))
- {
- j++;
- }
- rgDHMRlsHqProcTB(rgCb[inst].cell, hqProc, (uint8_t)(j+1));
- }
- return RFAILED;
- }
-
- for(i=0;i<datReq->nmbOfTbs;i++)
- {
- /* tbIndex 01 corresponds to presence of 1st TB
- * 10 corresponds 2nd TB
- * 11 corresponds two TBs of UE */
- if (!(tbIndex & (i+1)))
- {
- continue;
- }
- if (hqProc->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk.node == NULLP)
- {
- /* release corresponding TBs from SF tbs List */
- for(j=0;j<datReq->nmbOfTbs;j++)
- {
- if (!(tbIndex & (j+1)))
- {
- j++;
- }
- rgDHMRlsHqProcTB(rgCb[inst].cell, hqProc, (uint8_t)(j+1));
- DU_LOG("\nINFO --> MAC : rgDHMHndlDedDatReq:: hqP %p \n", (Void *)hqProc);
- }
- return RFAILED;
-
- }
-#ifndef L2_OPTMZ
- RG_FREE_MSG(hqProc->tbInfo[i].tb);
- /* L2 optimization for mUe/Tti: Pre-allocated mBuf pointers(macHdr,
- * macCes and MacPad) of harq TB need to be reset to db_base
- */
-#else
- tb = &hqProc->tbInfo[i].tb;
- if (tb->tbPres == TRUE)
- {
- RG_FREE_TB(tb);
- }
-#endif
- bldPdu.datReq = datReq;
- bldPdu.reqType = EVTRGUDDATREQ;
- bldPdu.schdTbSz = hqProc->tbInfo[i].tbSz;
- bldPdu.tbIndex = i+1;
- bldPdu.ta = hqProc->tbInfo[i].schdTa;
-#ifdef LTE_ADV
- bldPdu.sCellActCe= hqProc->tbInfo[i].sCellActCe;
-#endif
- bldPdu.contResId = NULLP;
-#ifdef LTE_L2_MEAS
- /* Store tbId from RLC in DDatRequest */
- hqProc->tbId[i] = datReq->datReqTb[i].tbId;
-
-
- hqProc->status[i] = FALSE;
-#endif
- if(rgMUXBldPdu(inst,&bldPdu, &(hqProc->tbInfo[i].tb), err) != ROK)
- {
- DU_LOG("\nERROR --> MAC : MUXing failed for: MacInst %d", inst);
- DU_LOG("\nERROR --> MAC : MUXing failed for: time: %d/%d\
- procId %d ueId %d", hqProc->tbInfo[i].timingInfo.sfn,
- hqProc->tbInfo[i].timingInfo.slot, hqProc->procId,
- hqProc->tbInfo[i].pdcch.rnti);
-
- /* release corresponding TBs from SF tbs List */
- for(j=0;j<datReq->nmbOfTbs;j++)
- {
- if (!(tbIndex & (j+1)))
- {
- j++;
- }
- rgDHMRlsHqProcTB(rgCb[inst].cell, hqProc, (uint8_t)(j+1));
- }
- return RFAILED;
- }
- /*
- SFndLenMsg(hqProc->tbInfo[i].tb, &len);
- */
- }
- return ROK;
-} /* rgDHMHndlDedDatReq */
-
-/**
- * @brief Function to handle RGU datReq received from ROM
- *
- * @details
- *
- * Function : rgDHMHndlCmnDatReq
- *
- * This function shall act on the datReq received on RGU. It shall
- * store the data IDs for all the logical channels and get the MAC
- * PDU built.
- *
- *
- * @param[in] Inst inst
- * @param[in] RgDlHqProcCb *hqProc
- * @param[in] RgRguCmnDatReq *datReq
- * @param[out] RgErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
- S16 rgDHMHndlCmnDatReq
-(
- Inst inst,
- RgDlHqProcCb *hqProc,
- RgRguCmnDatReq *datReq,
- RgErrInfo *err
- )
-{
- RgUstaDgn dgn;
- RgBldPduInfo bldPdu;
-
-#ifndef L2_OPTMZ
- if (hqProc->tbInfo[0].tb != NULLP)
-#else
- /* If numLch is non zero means HQ Proc is busy*/
- if (hqProc->tbInfo[0].tb.tbPres)
-#endif
- {
- /* datReq discarded. Generate an alarm */
- rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_HARQ);
- rgLMMStaInd(inst,LCM_CATEGORY_PROTOCOL, LCM_EVENT_UI_INV_EVT,
- LRG_CAUSE_HQ_PROC_BUSY, &dgn);
- return RFAILED;
- }
-
- bldPdu.datReq = datReq;
- bldPdu.reqType = EVTRGUCDATREQ;
- bldPdu.schdTbSz = hqProc->tbInfo[0].tbSz;
- bldPdu.ta = hqProc->tbInfo[0].schdTa;
-#ifdef LTE_ADV
- bldPdu.sCellActCe= hqProc->tbInfo[0].sCellActCe;
-#endif
-
- bldPdu.contResId = hqProc->tbInfo[0].contResId;
-
- if(rgMUXBldPdu(inst,&bldPdu, &(hqProc->tbInfo[0].tb), err) != ROK)
- {
- DU_LOG("\nERROR --> MAC : MUXing failed for: MacInst %d", inst);
- DU_LOG("\nERROR --> MAC : MUXing failed for: time: %d/%d\
- procId %d ueId %d", hqProc->tbInfo[0].timingInfo.sfn,
- hqProc->tbInfo[0].timingInfo.slot, hqProc->procId,
- hqProc->tbInfo[0].pdcch.rnti);
-
- RG_FREE_MSG(datReq->pdu);
- return RFAILED;
- }
-
- return ROK;
-} /* rgDHMHndlCmnDatReq */
-
-/**
- * @brief Function to get consolidate grants and send consolidated grant to RLC
- *
- * @details
- *
- * Function : rgDHMSndConsolidatedStaInd
- *
- * This function shall be invoked by Scheduler to trigger DHM to send a
- * consolidated status indication of all UE scheduled in a TTI as well as
- * send consolidated CStaInd for MSG4 and for all common channels(PCCH,
- * if RGR_SI_SCH is not defined then it includes BCH and BCCH also)
- *
- *
- * @param[in] RgCellCb *cell
- * @param[in] RgInfUeInfo *ueInfo,
- * @param[in] CmLteTimingInfo timingInfo,
- * @param[out] RgErrInfo err
- * @param[in] RguCStaIndInfo *cStaInd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-RgUeCb *gUe =NULLP;
- S16 rgDHMSndConsolidatedStaInd
-(
- RgCellCb *cell,
- RgInfUeInfo *ueInfo,
- CmLteTimingInfo timingInfo,
- RgErrInfo *err
- )
-{
- SuId rguDlSpId;/*need to use spID instead of suID*/
- uint8_t idx;
- uint8_t ueIdx;
- uint8_t lcIdx;
- uint8_t tbIndex=0,idx1;
- RgDlSf *dlSf = &cell->subFrms[(timingInfo.slot % RG_NUM_SUB_FRAMES)];
- Inst inst = cell->macInst - RG_INST_START;
- // Bool isDStaReqrd = FALSE;
- RgRguDedStaInd *dStaInd[rgCb[inst].numRguSaps] ;
- RgUpSapCb *rguDlSap[rgCb[inst].numRguSaps];
-
- int lchBufSize =0;
- RgUeCb *ue;
- RgDlHqProcCb *hqP;
- RgInfUeAlloc *allocInfo;
- uint8_t activeSapCnt = 0;
- uint8_t staIndCnt = 0;
-#ifdef LTE_ADV
- Bool hqPAdded = FALSE;
-#endif
-#ifdef L2_OPTMZ
- RgTfuDatReqTbInfo *tb; /* TB to be sent to CL/PHY*/
-#endif
-
- memset (dStaInd, 0, (sizeof(RgRguDedStaInd *) * rgCb[inst].numRguSaps));
- memset (rguDlSap, 0, (sizeof(RgUpSapCb *) * rgCb[inst].numRguSaps));
-
- /* Send StaInd for the scheduled UEs */
- for(ueIdx = 0; ueIdx < ueInfo->numUes; ueIdx++)
- {
-#ifdef LTE_ADV
- hqPAdded = FALSE;
-#endif
- if((ue=rgDBMGetUeCb (cell, ueInfo->allocInfo[ueIdx].rnti)) == NULLP)
- {
- /* Check in RachLst */
- if((ue=rgDBMGetUeCbFromRachLst (cell,
- ueInfo->allocInfo[ueIdx].rnti)) == NULLP)
- {
- DU_LOG("\nERROR --> MAC : CRNTI:%d No ueCb found",
- ueInfo->allocInfo[ueIdx].rnti);
- /*Fix: If one UE is not present dont return, look for the next.*/
- continue;
- }
- }
-
-
- rgDHMGetHqProcFrmId(ue,ueInfo->allocInfo[ueIdx].hqProcId,&hqP);
- allocInfo = &ueInfo->allocInfo[ueIdx];
- gUe = ue;
-
- /* Fix : syed Avoid sending data for a RETX
- * if initial TX data processing was unsuccessful */
- if((allocInfo->tbInfo[0].isReTx == TRUE) &&
- (hqP->tbInfo[0].tbSz == 0))
- {
- DU_LOG("\nERROR --> MAC : CRNTI:%d RETX hqP(%d) tb(0) for a failed New Tx",
- allocInfo->rnti, hqP->procId);
- continue;
- }
- if((allocInfo->tbInfo[1].isReTx == TRUE) &&
- (hqP->tbInfo[1].tbSz == 0))
- {
- DU_LOG("\nERROR --> MAC : CRNTI:%d RETX hqP(%d) tb(1) for a failed New Tx",
- allocInfo->rnti, hqP->procId);
- continue;
- }
-
- if(ue->rguDlSap != NULLP)
- {
- rguDlSpId = ue->rguDlSap->sapCfg.spId;
- }else
- {/* UeCb is from rachList */
- rguDlSpId = cell->rguDlSap->sapCfg.spId;
- }
-
-
- for(idx=allocInfo->tbStrtIdx;((idx-allocInfo->tbStrtIdx) <\
- allocInfo->nmbOfTBs); idx++)
- {
- RguCStaIndInfo *cStaInd;
-#ifdef TFU_UPGRADE
- /* LTE_ADV_FLAG_REMOVED_START */
- hqP->tbInfo[idx].isEnbSFR = allocInfo->isEnbSFR;
- /* update pA value */
- hqP->tbInfo[idx].pa = allocInfo->pa;
- /* LTE_ADV_FLAG_REMOVED_END */
-#endif
-
- hqP->numOfTBs = allocInfo->nmbOfTBs;
- hqP->tbInfo[idx].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk.node = (PTR)hqP;
- hqP->tbInfo[idx].sfLnkInfo[dlSf->schdTime.slot % 2].sf = dlSf;
- cmLListAdd2Tail(&dlSf->tbs,&(hqP->tbInfo[idx].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk));
- /* Changes as part of performance testing*/
- /* hqP->numOfTBs++;*/
- hqP->tbInfo[idx].doa = allocInfo->doa;
- hqP->tbInfo[idx].txMode = allocInfo->txMode;
- hqP->tbInfo[idx].puschRptUsd = allocInfo->puschRptUsd;
- hqP->tbInfo[idx].puschPmiInfo = allocInfo->puschPmiInfo;
-#ifdef LTEMAC_SPS
- hqP->tbInfo[idx].pdcch.rnti = allocInfo->pdcchRnti;
-#else
- hqP->tbInfo[idx].pdcch.rnti = allocInfo->rnti;
-#endif
- if(allocInfo->tbInfo[idx].isReTx == TRUE)
- {
- hqP->tbInfo[idx].pdcch.dci = allocInfo->dciInfo;
- continue;
- }
-
- hqP->tbInfo[idx].timingInfo = timingInfo;
- hqP->tbInfo[idx].pdcch.dci = allocInfo->dciInfo;
-#ifndef L2_OPTMZ
- RG_FREE_MSG(hqP->tbInfo[idx].tb);
-#else
- /* L2 optimization for mUe/Tti: Pre-allocated mBuf pointers(macHdr,
- * macCes and MacPad) of harq TB need to be reset to db_base
- */
- tb = &(hqP->tbInfo[idx].tb);
- if (tb->tbPres == TRUE)
- {
- RG_FREE_TB(tb);
- }
-#endif
- hqP->tbInfo[idx].tbSz = allocInfo->tbInfo[idx].schdTbSz;
-
- hqP->tbInfo[idx].schdTa.pres = allocInfo->tbInfo[idx].ta.pres;
- hqP->tbInfo[idx].schdTa.val = allocInfo->tbInfo[idx].ta.val;
-
-#ifdef LTE_ADV
- hqP->tbInfo[idx].sCellActCe.pres = allocInfo->tbInfo[idx].sCellActCe.pres;
- hqP->tbInfo[idx].sCellActCe.val = allocInfo->tbInfo[idx].sCellActCe.val;
-#endif
-
-#ifdef LTE_ADV
- if(( hqPAdded == TRUE) || (ROK == rgLaaPushHqPToScellLst(allocInfo,cell,timingInfo)))
- {
- hqPAdded = TRUE;
- continue;
- }
-#endif
- if (allocInfo->tbInfo[idx].schdDat[0].lcId == RG_CCCH_LCID)
- {
-#ifndef L2_OPTMZ
- RG_FREE_MSG(hqP->tbInfo[idx].tb);
-#else
- /* L2 optimization for mUe/Tti: Pre-allocated mBuf pointers(macHdr,
- * macCes and MacPad) of harq TB need to be reset to db_base
- */
- tb = &(hqP->tbInfo[idx].tb);
-
- if (tb->tbPres == TRUE)
- {
- RG_FREE_TB(tb);
- }
-#endif
- hqP->tbInfo[0].contResCe = allocInfo->tbInfo[0].contResCe;
- if(allocInfo->tbInfo[0].contResCe)
- {
- hqP->tbInfo[0].contResId = &ue->contResId;
- }
-
-
- if(allocInfo->tbInfo[idx].numSchLch == 0)
- {
- DU_LOG("\nDEBUG --> MAC : UEID:%d MSG4 with only contResId hqP(%d)",
- allocInfo->rnti,
- hqP->procId);
- hqP->tbInfo[idx].numSchLch = 0;
- continue;
- }
-
- /* Increamenting the tbIndex instead of
- assigning it to constant */
- tbIndex++;
-
-
- hqP->tbInfo[idx].numSchLch = 1;
- hqP->tbInfo[idx].schdData[0].lcId =
- allocInfo->tbInfo[idx].schdDat[0].lcId;
- hqP->tbInfo[idx].schdData[0].schdSz =
- allocInfo->tbInfo[idx].schdDat[0].numBytes;
-
- // if(cStaInd == NULLP)
- {
- if ((rgAllocShrablSBuf(inst,(Data**)&cStaInd, sizeof(RguCStaIndInfo))) != ROK)
- {
- err->errType = RGERR_DHM_SND_STA_IND;
- err->errCause = RG_DHM_MEM_ALLOC_FAIL;
- return RFAILED;
- }
- }
-
- idx1 = (hqP->procId << 2) | tbIndex;
-
- cStaInd->cellId = cell->cellId;
- cStaInd->rnti = allocInfo->rnti;
- cStaInd->lcId = cell->dlCcchId;
- cStaInd->transId = (timingInfo.sfn << 16) |
- (timingInfo.slot << 8) | idx1;
- /* ADD Changes for Downlink UE Timing Optimization */
-#ifdef LTEMAC_DLUE_TMGOPTMZ
- dlSf->remDatReqCnt++;
-#endif
- DU_LOG("\nDEUBG --> MAC : RNTI:%d UE:MSG4 grant for CCCH hqP(%d) LCID:%d",
- allocInfo->rnti,
- hqP->procId,
- cStaInd->lcId);
- /* Fix : syed Avoid return param for interface prim and
- * proceed for other UEs. For the failed UE, MAC shall
- * do padding. */
- rgUIMSndCmnStaInd(cell->macInst,cell->rguDlSap,cStaInd);
- break;
- }
- else
- {
- tbIndex+=idx+1;
-#ifndef L2_OPTMZ
- RG_FREE_MSG(hqP->tbInfo[idx].tb);
-#else
- /* L2 optimization for mUe/Tti: Pre-allocated mBuf pointers(macHdr,
- * macCes and MacPad) of harq TB need to be reset to db_base
- */
- tb = &(hqP->tbInfo[idx].tb);
- if (tb->tbPres == TRUE)
- {
- RG_FREE_TB(tb);
- }
-#endif
-
- if((NULLP == dStaInd[rguDlSpId]) && (allocInfo->tbInfo[idx].numSchLch))
- {
- if ((rgAllocShrablSBuf (inst,(Data**)&dStaInd[rguDlSpId], sizeof(RguDStaIndInfo))) != ROK)
- {
- err->errType = RGERR_DHM_SND_STA_IND;
- err->errCause = RG_DHM_MEM_ALLOC_FAIL;
- /* Need to return as memory allocation will fail for other UEs also*/
- return RFAILED;
- }
- dStaInd[rguDlSpId]->nmbOfUeGrantPerTti = 0;
- rguDlSap[rguDlSpId] = ue->rguDlSap;
- activeSapCnt++;
- }
-
- for (lcIdx = 0;
- lcIdx < allocInfo->tbInfo[idx].numSchLch; lcIdx++)
- {
- hqP->tbInfo[idx].schdData[lcIdx].lcId =
- allocInfo->tbInfo[idx].schdDat[lcIdx].lcId;
- if (hqP->tbInfo[idx].schdData[lcIdx].lcId == 0)
- {
- DU_LOG("\nERROR --> MAC : CCCH grant in DStaInd for LCID:%d CRNTI:%d",
- hqP->tbInfo[idx].schdData[lcIdx].lcId,allocInfo->rnti);
- }
- hqP->tbInfo[idx].schdData[lcIdx].schdSz =
- allocInfo->tbInfo[idx].schdDat[lcIdx].numBytes;
- if(dStaInd[rguDlSpId])
- {
- dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].staIndTb[idx].\
- lchStaInd[lcIdx].lcId = allocInfo->tbInfo[idx].\
- schdDat[lcIdx].lcId;
- dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].staIndTb[idx].\
- lchStaInd[lcIdx].totBufSize = allocInfo->tbInfo[idx].\
- schdDat[lcIdx].numBytes;
- }
-
- lchBufSize+=allocInfo->tbInfo[idx].schdDat[lcIdx].numBytes;
- }
- hqP->tbInfo[idx].numSchLch =
- allocInfo->tbInfo[idx].numSchLch;
- if(dStaInd[rguDlSpId])
- {
- dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].staIndTb[idx].nmbLch =
- allocInfo->tbInfo[idx].numSchLch;
-#ifdef LTE_L2_MEAS
- dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].staIndTb[idx].tbId =
- hqP->tbId[idx];
-#endif
- }
- lchBufSize=0;
- }
- }
- //if((dStaInd) && (tbIndex) && (isDStaReqrd == TRUE))
- if((dStaInd[rguDlSpId]) && (tbIndex))
- {
- idx1 = (hqP->procId << 2) | tbIndex;
- /* Create RguDStaInd struct and send to UIM */
- dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].rnti = allocInfo->rnti;
- /*
- dStaInd->transId = (hqP->timingInfo.sfn << 16) |
- (hqP->timingInfo.slot << 8) | hqP->procId;
- */
- dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].transId = (timingInfo.sfn << 16) |
- (timingInfo.slot << 8) | idx1;
- dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].nmbOfTbs = hqP->numOfTBs;
-#ifdef LTE_ADV
- dStaInd[rguDlSpId]->staInd[dStaInd[rguDlSpId]->nmbOfUeGrantPerTti].fillCtrlPdu = allocInfo->fillCtrlPdu;
-#endif
- /*increment num of UE as staInd is prepared for it */
- dStaInd[rguDlSpId]->nmbOfUeGrantPerTti++;
- /* ADD Changes for Downlink UE Timing Optimization */
-#ifdef LTEMAC_DLUE_TMGOPTMZ
- dlSf->remDatReqCnt++;
-#endif
- }
- //isDStaReqrd = FALSE;
- tbIndex = 0;
- }
-
- for(idx = 0; idx < rgCb[inst].numRguSaps ; idx++)
- {
- if(dStaInd[idx] != NULLP)
- {
- dStaInd[idx]->cellId = cell->cellId;
- /* Fix : syed Avoid return param for interface prim and
- * proceed for other UEs. For the failed UE, MAC shall
- * do padding. */
- rgUIMSndDedStaInd(inst,rguDlSap[idx],dStaInd[idx]);
-
- staIndCnt++;
- if(staIndCnt == activeSapCnt)
- break;/* all valid staind are considered */
- }
-
- }
- return ROK;
-} /* rgDHMSndConsolidatedStaInd */
-
-
-/**
- * @brief Function to handle building the TFU Data Request
- *
- * @details
- *
- * Function : rgDHMBldTfuDatReq
- *
- * This function builds the TFU Data Request with the details
- * present in HARQ Process.
- *
- * @param[in] RgDlHqProcCb *hqP
- * @param[out] TfuDatReqPduInfo *datReq
- * @return Void
- * None
- **/
-//uint8_t crashFlag = 0;
- static Void rgDHMBldTfuDatReq
-(
- RgCellCb *cellCb,
- RgDlSf *dlSf,
- RgDlHqProcCb *hqP,
- RgTfuDatReqPduInfo *datReq
- )
-{
-
-#ifndef L2_OPTMZ
-#if !(!(defined TENB_ACC) && !(defined LTE_PAL_ENB))
- Inst inst;
-#elif defined(TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD)
- Inst inst;
-#endif
-#endif
-
- uint8_t i;
-
-#ifdef L2_OPTMZ
- uint32_t lchIdx, pduIdx;
-#endif
-
- datReq->nmbOfTBs = 0;
-#ifndef L2_OPTMZ
-#if !(!(defined TENB_ACC) && !(defined LTE_PAL_ENB))
- inst = cellCb->macInst - RG_INST_START;
-#elif defined(TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD)
- inst = cellCb->macInst - RG_INST_START;
-#endif
-#endif
- /*MS_WORKAROUND for ccpu00123904*/
- datReq->isTApres = FALSE;
-#ifdef TFU_ALLOC_EVENT_NO_INIT
-#ifndef L2_OPTMZ
- datReq->mBuf[0] = 0;
- datReq->mBuf[1] = 0;
-#endif
-#endif
-
- for(i=0;i<RG_MAX_TB_PER_UE;i++)
- {
-#ifndef L2_OPTMZ
- if ((hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf == dlSf) &&
- (hqP->tbInfo[i].tb != NULLP))
-#else
- if ((hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf == dlSf) &&
- RgUtlIsTbMuxed(&(hqP->tbInfo[i].tb)))
-#endif
- {
-
- datReq->rnti = hqP->tbInfo[i].pdcch.rnti;
- datReq->dciInfo = hqP->tbInfo[i].pdcch.dci;
- datReq->doa = hqP->tbInfo[i].doa;
- datReq->transMode = hqP->tbInfo[i].txMode;
- datReq->puschRptUsd = hqP->tbInfo[i].puschRptUsd;
- datReq->puschPmiInfo = hqP->tbInfo[i].puschPmiInfo;
- /*MS_WORKAROUND for ccpu00123904*/
- if (hqP->tbInfo[i].schdTa.pres)
- {
- datReq->isTApres = TRUE;
- }
-#ifdef TFU_UPGRADE
- /* update pA value */
- datReq->pa = hqP->tbInfo[i].pa;
-#endif
- /* LTE_ADV_FLAG_REMOVED_START */
- datReq->isEnbSFR = hqP->tbInfo[i].isEnbSFR;
- /* LTE_ADV_FLAG_REMOVED_END */
-#ifndef L2_OPTMZ
-#if (!(defined TENB_ACC) && !(defined LTE_PAL_ENB)) /* ABHI */ /* This is only temp fix. It needs to be removed
- after rebasing to MAC CCB */
-#ifdef BRDCM
- datReq->mBuf[i] = hqP->tbInfo[i].tb;
-#else
- /* Intel Tdd- Commenting out the Optimization for direct Access of
- * mBuf Index */
- /*Proper clean-up needed as this needs long stability tests
- * in all SoCs*/
-#if defined(TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD)
- SIncMsgRef(hqP->tbInfo[i].tb, RG_GET_MEM_REGION(rgCb[inst]),
- RG_GET_MEM_POOL(rgCb[inst]), &datReq->mBuf[i]);
-#else
- datReq->mBuf[i] = hqP->tbInfo[i].tb;
-#endif
-#endif/*BRDCM*/
-#else
- SIncMsgRef(hqP->tbInfo[i].tb, RG_GET_MEM_REGION(rgCb[inst]),
- RG_GET_MEM_POOL(rgCb[inst]), &datReq->mBuf[i]);
-#endif
- {
- MsgLen dbgBufLen;
- if(SFndLenMsg(datReq->mBuf[i], &dbgBufLen))
- {
- if(dbgBufLen == 0)
- {
- DU_LOG("\nERROR --> MAC : RNTI:%d SFN:%d slot:%d tbIdx:%d Sdu Length 0 ",
- datReq->rnti,
- hqP->tbInfo[i].timingInfo.sfn,
- hqP->tbInfo[i].timingInfo.slot,i);
- DU_LOG("\nERROR --> MAC : taPres [%d] numOfTbs [%d] format[%d]",
- datReq->isTApres,
- hqP->numOfTBs,
- datReq->dciInfo.format);
- }
- }
- }
-#else
- /* L2 optimization for mUe/Tti: Removing SIncMsgRef to avoid additional
- * mBuf allocation. MAC header, MAC Ces, MAC PDU per LCH per TB Per UE
- * and MAC padding Mbufs are being sent to CL. Populating these Ptrs
- * From TB Info to TfuDatReq
- */
- datReq->tbInfo[i].tbPres = TRUE;
- datReq->tbInfo[i].tbSize = hqP->tbInfo[i].tbSz;
- datReq->tbInfo[i].macHdr = hqP->tbInfo[i].tb.macHdr;
- datReq->tbInfo[i].macCes = hqP->tbInfo[i].tb.macCes;
- datReq->tbInfo[i].numLch = hqP->tbInfo[i].tb.numLch;
- for(lchIdx = 0; lchIdx < hqP->tbInfo[i].tb.numLch; lchIdx++)
- {
- datReq->tbInfo[i].lchInfo[lchIdx].numPdu = hqP->tbInfo[i].tb.\
- lchInfo[lchIdx].numPdu;
- for(pduIdx = 0; pduIdx < hqP->tbInfo[i].tb.lchInfo[lchIdx].numPdu;\
- pduIdx++)
- {
- datReq->tbInfo[i].lchInfo[lchIdx].mBuf[pduIdx] =
- hqP->tbInfo[i].tb.lchInfo[lchIdx].mBuf[pduIdx];
- }
- }
- // datReq->tbInfo[i].macPad = hqP->tbInfo[i].tb.macPad;
- datReq->tbInfo[i].padSize = hqP->tbInfo[i].tb.padSize;
- // prc_trace_format_string(0x40,3,"TfuDatReq:RNTI=%d TbIdx=%d TbSize=%d PdSz=(%d) macHdraddr: (%p) macCEAddr: (%p) noLch=(%d)",datReq->rnti, i,
- // hqP->tbInfo[i].tbSz, datReq->tbInfo[i].padSize, datReq->tbInfo[i].macHdr, datReq->tbInfo[i].macCes, datReq->tbInfo[i].numLch);
-
-#endif
- datReq->nmbOfTBs++;
- }
- }
- return;
-} /* rgDHMBldTfuDatReq */
-
-
-#ifdef L2_OPTMZ
-/**
- * @brief This function releases a HARQ process
- *
- * @details
- *
- * Function: rgDHMFreeHqProcTB
- * Purpose: This function returns a HARQ process to HARQ Entity
- * in the DL direction.
- *
- * 1. Add the HARQ process to the free queue.
- * Invoked by: scheduler and HARQ processing
- *
- * @param[in] RgDlHqProc *hqP
- * @return Void
- *
- **/
-S16 rgDHMFreeHqProcTB(RgDlHqProcCb *hqP, uint8_t tbIndex)
-{
- RgTfuDatReqTbInfo *tb; /* TB to be sent to CL/PHY*/
- uint8_t idx;
-
- if((tbIndex > RG_MAX_TB_PER_UE) ||
- (tbIndex == 0))
- {
- return RFAILED;
- }
-
- tb = &(hqP->tbInfo[tbIndex-1].tb);
- RG_FREE_MSG(tb->macHdr);
- RG_FREE_MSG(tb->macCes);
-
- for(idx = 0; idx < 2; idx++)
- {
- if (hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sfLnk.node != NULLP)
- {
- cmLListDelFrm(&hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sf->tbs,
- &(hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sfLnk));
- hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sfLnk.node = (PTR)NULLP;
- DU_LOG("\nINFO --> MAC : rgDHMFreeHqProcTB:: hqP %p \n", (Void *)hqP);
- }
- hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sf = NULLP;
- }
- return ROK;
-}
-#endif
-
-
-
-/**
- * @brief Handler for freeing up the harq related information from ueCb
- *
- * @details
- *
- * Function : rgDHMFreeUe
- *
- * This function shall free up the HARQ specific information from ueCb.
- *
- * @param[in] Inst inst
- * @param[in] RgDlHqEnt *hqE
- *
- * @return None.
- *
- **/
-Void rgDHMFreeUe(Inst inst, RgDlHqEnt *hqE)
-{
- uint8_t i;
-
- if(hqE->procs)
- {
- /* Free all the memory associated with HARQ */
- for (i=0; i < hqE->numHqProcs; i++)
- {
-#ifndef L2_OPTMZ
- rgDHMRlsHqProcTB(rgCb[inst].cell, hqE->procs[i], 1);
- rgDHMRlsHqProcTB(rgCb[inst].cell, hqE->procs[i], 2);
-#else
- rgDHMFreeHqProcTB(hqE->procs[i], 1);
- rgDHMFreeHqProcTB(hqE->procs[i], 2);
-#endif
-
- rgFreeSBuf(inst,(Data **)&(hqE->procs[i]), sizeof(RgDlHqProcCb));
-#ifdef LTE_ADV
- rgDHMFreeSavedHqP(inst,hqE,i);
-#endif
- }
-
- /*ccpu00117052 - MOD - Passing double pointer for proper NULLP
- assignment */
- }
-
- return;
-
-} /* rgDHMFreeUe */
-/**
- * @brief Function for handling RaResp request received from scheduler to MAC
- *
- * @details
- *
- * Function : RgSchMacRstHqEntReq
- *
- * This function shall be invoked whenever a sec cell of an ue
- * is deactivated. MAC needs to reset the harqentity associated
- * with the deactivated scell of the ue
- *
- *
- * @param[in] Pst *pst
- * @param[in] RgInfResetHqEnt *hqEntInfo
- * @return S16
- * -# ROK
- **/
-S16 RgSchMacRstHqEntReq(Pst* pst, RgInfResetHqEnt* hqEntInfo)
-{
- Inst inst;
- RgCellCb *cell;
- RgUeCb *ue;
-
- inst = pst->dstInst - RG_INST_START;
-
- if (((cell = rgCb[inst].cell) == NULLP) ||
- (rgCb[inst].cell->cellId != hqEntInfo->cellId))
- {
- DU_LOG("\nERROR --> MAC : For user [%d]Cell does not exist %d\n",
- hqEntInfo->crnti,hqEntInfo->cellId);
- return RFAILED;
- }
-
- if ((ue = rgDBMGetUeCb(cell, hqEntInfo->crnti)) == NULLP)
- {
- DU_LOG("\nERROR --> MAC : [%d]UE does not exist for this hqEntInfo\n",
- hqEntInfo->crnti);
- return RFAILED;
- }
-
- rgDHMUeReset(cell, &ue->dl.hqEnt);
-
- return ROK;
-}
-uint32_t gSaveVal;
-\f
-/**
- * @brief Function for handling RaResp request received from scheduler to MAC
- *
- * @details
- *
- * Function : RgSchMacRlsHqReq
- *
- * This function shall be invoked whenever scheduler is done with the
- * allocations of random access responses for a slot.
- * This shall invoke RAM to create ueCbs for all the rapIds allocated and
- * shall invoke MUX to create RAR PDUs for raRntis allocated.
- *
- *
- * @param[in] CmLteCellId cellId,
- * @param[in] CmLteTimingInfo timingInfo,
- * @param[in] RaRespInfo *rarInfo
- * @return S16
- * -# ROK
- **/
-S16 RgSchMacRlsHqReq(Pst *pst, RgInfRlsHqInfo *rlshqUeInfo)
-{
- Inst inst;
- RgCellCb *cell = NULLP;
- RgUeCb *ue;
- RgDlHqProcCb *hqP;
- uint8_t idx1,idx2;
-#ifdef LTE_L2_MEAS
- uint8_t tbId;
- RguHarqStatusInd hqStaInd;
- Bool isValidTbId = FALSE;
-#endif
- uint32_t startTime=0;
-
- RG_IS_INST_VALID(pst->dstInst);
- inst = pst->dstInst - RG_INST_START;
- cell = rgCb[inst].cell;
- /*starting Task*/
- SStartTask(&startTime, PID_MAC_AM_HARQ_RLS);
-
- if(NULLP == rlshqUeInfo)
- {
- return RFAILED;
- }
-
- if((cell == NULLP)
- ||( cell->cellId != rlshqUeInfo->cellId))
- {
-
- DU_LOG("\nERROR --> MAC : No cellCb found with cellId");
- return RFAILED;
- }
-
- if(NULLP == rlshqUeInfo->ueHqInfo)
- {
- return RFAILED;
- }
-
- for(idx1 = 0; idx1 < rlshqUeInfo->numUes; idx1++)
- {
- if((ue=rgDBMGetUeCb (cell, rlshqUeInfo->ueHqInfo[idx1].rnti)) == NULLP)
- {
- /* Check in RachLst */
- if((ue=rgDBMGetUeCbFromRachLst (cell,
- rlshqUeInfo->ueHqInfo[idx1].rnti)) == NULLP)
- {
- DU_LOG("\nERROR --> MAC : CRNTI:%d No ueCb found",
- rlshqUeInfo->ueHqInfo[idx1].rnti);
- continue;
- }
- }
-#ifdef LTE_ADV
-#ifdef LAA_DBG
- if ((rlshqUeInfo->ueHqInfo[idx1].rlsOperationType && !gSaveVal) || (rlshqUeInfo->ueHqInfo[idx1].hqProcId > 8))
- {
- int *p = NULL;
- DU_LOG("\nINFO --> MAC : SPURIOUS CALLL !!!! procId %d \n", rlshqUeInfo->ueHqInfo[idx1].hqProcId);
-
-
- DU_LOG("\nINFO --> MAC : RgSchMacRlsHqReq cell %d : numUes %d idx %d rnti %d hqProc %d numTbsi\
- %d tbid[0] %d tbid[1] %d rlsopr %d \n",
- cell->cellId,
- rlshqUeInfo->numUes,
- idx1,
- rlshqUeInfo->ueHqInfo[idx1].rnti,
- rlshqUeInfo->ueHqInfo[idx1].hqProcId,
- rlshqUeInfo->ueHqInfo[idx1].numOfTBs,
- rlshqUeInfo->ueHqInfo[idx1].tbId[0],
- rlshqUeInfo->ueHqInfo[idx1].tbId[1],
- rlshqUeInfo->ueHqInfo[idx1].rlsOperationType);
-
- *p = 10;
- }
-#endif
- gSaveVal = 0;
-
-
- RgSchMacHndlRelReq(cell, ue, &rlshqUeInfo->ueHqInfo[idx1]);
-
- if (RGINF_RLS_HQ_DEL_TB == rlshqUeInfo->ueHqInfo[idx1].rlsOperationType)
- {
- /* If REQ is to DEL the saved TBs no need to free the HqP as it's already
- freed up earlier */
- continue;
- }
-#endif /* LTE_ADV */
- rgDHMGetHqProcFrmId(ue,rlshqUeInfo->ueHqInfo[idx1].hqProcId,&hqP);
- if(rlshqUeInfo->ueHqInfo[idx1].status[0] != TRUE)
- {
- rgCb[inst].genSts.numHarqFail++;
- }
-
-#ifdef LTE_L2_MEAS
- hqStaInd.cellId = cell->cellId;
- hqStaInd.ueId = rlshqUeInfo->ueHqInfo[idx1].rnti;
- hqStaInd.numTbs = rlshqUeInfo->ueHqInfo[idx1].numOfTBs;
-#endif
-
- for(idx2=0; idx2 < rlshqUeInfo->ueHqInfo[idx1].numOfTBs; idx2++)
- {
-#ifdef LTE_L2_MEAS
- /* Fill the hq sta Ind stucture. Need to send the Status Ind for only
- those TBID's reported by Scheduler*/
- tbId = rlshqUeInfo->ueHqInfo[idx1].tbId[idx2];
- if (hqP->tbId[tbId-1] != RGU_INVALID_TBID)
- {
- /* Fill the correct Sn Map corresponding to the TBID */
- hqStaInd.tbId[idx2] = hqP->tbId[tbId-1];
- hqStaInd.status[idx2] = rlshqUeInfo->ueHqInfo[idx1].status[idx2];
- isValidTbId = TRUE;
- }
-#endif
- if(rgDHMRlsHqProcTB(cell, hqP,
- rlshqUeInfo->ueHqInfo[idx1].tbId[idx2]) != ROK)
- {
- DU_LOG("\nERROR --> MAC : CRNTI:%d Failure in releasing hq TB",
- rlshqUeInfo->ueHqInfo[idx1].rnti);
- continue;
- }
- }
-
-#ifdef LTE_L2_MEAS
-
- if (isValidTbId)
- {
- if(ue->rguDlSap)
- {
- RgUiRguHqStaInd(&(ue->rguDlSap->sapCfg.sapPst),
- ue->rguDlSap->sapCfg.suId,
- &hqStaInd);
- }
- else
- {/* Ue is from rach list*/
- RgUiRguHqStaInd(&(cell->rguDlSap->sapCfg.sapPst),
- cell->rguDlSap->sapCfg.suId,
- &hqStaInd);
- }
- }
-#endif
- } /* end of ues loop */
-
- /*starting Task*/
- SStopTask(startTime,PID_MAC_AM_HARQ_RLS);
-
- return ROK;
-} /* end of RgSchMacRlsHqReq */
-
-
-/**********************************************************************
-
- End of file
- **********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Entry point fucntions
-
- File: rg_dux.c
-
-**********************************************************************/
-
-/** @file rg_dux.c
-@brief This module handles de-multiplexing of the data recieved at MAC.
-*/
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-
-#include "rg_env.h" /* MAC Environment Defines */
-#include "tfu.h" /* CRG Interface defines */
-#include "crg.h" /* CRG Interface defines */
-#include "rg_sch_inf.h" /* RGR Interface defines */
-#include "rgu.h" /* RGU Interface defines */
-#include "lrg.h" /* LRG Interface defines */
-
-#include "rg.h" /* MAC defines */
-#include "rg_err.h" /* MAC error defines */
-
-/* header/extern include files (.x) */
-
-#include "rgu.x" /* RGU types */
-#include "tfu.x" /* CRG Interface includes */
-#include "crg.x" /* CRG Interface includes */
-#include "rg_sch_inf.x" /* SCH Interface includes */
-#include "rg_prg.x" /* PRG interface includes */
-#include "rgu.x" /* RGU Interface includes */
-#include "lrg.x" /* LRG Interface includes */
-
-#include "du_app_mac_inf.h"
-#include "rg.x" /* MAC includes */
-
-/* local defines */
-
-/* local typedefs */
-
-/* local externs */
-
-/* forward references */
-
-#define RG_DUX_ALLOC(_pdu, _size, _dataPtr, _ret) {\
- _ret = cmGetMem((Ptr)&_pdu->memCp, _size, (Ptr *)&_dataPtr); \
-}
-
-#define RG_INIT_SDU(_sdu, _lcId, _len) {\
- (_sdu)->lcId = (_lcId); \
- (_sdu)->len = (_len); \
- (_sdu)->mBuf = NULLP; \
- (_sdu)->sduLstEnt.next = NULLP; \
- (_sdu)->sduLstEnt.prev = NULLP; \
- (_sdu)->sduLstEnt.node = (PTR)(_sdu); \
-}
-
-#define RG_EXT_BS(_bsr, _bs1, _bs2, _bs3, _bs4) {\
- _bs1 = _bsr[0] >> 2; \
- _bs2 = (((_bsr[0] & 0x3) << 4) | (_bsr[1] >> 4)); \
- _bs3 = (((_bsr[1] & 0x0F) << 2) | (_bsr[2] >> 6)); \
- _bs4 = _bsr[2] & 0x3F; \
-}
-
-#define RG_UNPACK_LONG_BSR(_bsr, _mBuf, _ret) {\
- _ret = SRemPreMsgMult((_bsr), 3, (_mBuf)); \
-}
-
-#define RG_UNPACK_SHORT_BSR(_bsr, _mBuf, _ret) {\
- _ret = oduPackUInt8((_bsr), (_mBuf)); \
-}
-
-#define RG_UNPACK_TRUNC_BSR(_bsr, _mBuf, _ret) {\
- _ret = oduPackUInt8((_bsr), (_mBuf)); \
-}
-
-#define RG_UNPACK_PHR(_phr, _mBuf, _ret) {\
- _ret = oduPackUInt8((_phr), (_mBuf)); \
-}
-
-#define RG_UNPACK_CRNTI(_rnti, _mBuf, _ret) {\
- Data _unpkArray[2];\
- *_rnti = 0;\
- _ret = SRemPreMsgMult(_unpkArray, (MsgLen) 2, _mBuf);\
- if (_ret == ROK)\
- {\
- *_rnti = (uint16_t) PutHiByte(*_rnti, (uint8_t) _unpkArray[0]);\
- *_rnti = (uint16_t) PutLoByte(*_rnti, (uint8_t) _unpkArray[1]);\
- }\
-}
-
-/* For EXT PHR DEMUX */
-#define RG_UNPACK_EXT_PHR_CI(_ci, _mBuf, _ret) {\
- _ret = oduPackUInt8((_ci), (_mBuf)); \
-}
-
-#define RG_UNPACK_EXT_PHR(_extPhr, _mBuf, _ret) {\
- _ret = oduPackUInt8((_extPhr), (_mBuf)); \
-}
-
-
-
-/**
- * @brief Handles the insertion of SDU in to PDU.
- *
- * @details
- *
- * Function: rgDUXInsSdu
- *
- * This API handles the insertion of SDU in to PDU.
- *
- * Processing Steps:
- * - Append the sdu to the sduLst of pdu.
- *
- * @param[in] Inst inst
- * @param[out] *pdu
- * @param[in] lcId
- * @param[in] sduLen
- * @param[out] *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgDUXInsSdu(Inst inst, RgMacPdu *pdu, RgMacSdu **sdu, uint8_t lcId, uint16_t sduLen, RgErrInfo *err)
-{
- S16 ret;
- RgMacSdu *sduAloc = NULLP;
-
-
- RG_DUX_ALLOC(pdu, sizeof(RgMacSdu), sduAloc, ret);
- if(ret != ROK)
- {
- DU_LOG("\nERROR --> MAC : Allocation of RgSubHdr failed for LCID:%d",lcId);
- err->errCause = RGERR_DUX_MEM_EXHAUST;
- return RFAILED;
- }
- *sdu = sduAloc;
- RG_INIT_SDU(sduAloc, lcId, sduLen);
- cmLListAdd2Tail(&pdu->sduLst, &sduAloc->sduLstEnt);
- return ROK;
-}
-
-/**
- * @brief Handles extracting the CE sub headers from the MAC PDU.
- *
- * @details
- *
- * Function: rgDUXExtSubHdr
- *
- * This API handles extracting the sub headers from the MAC PDU.
- *
- * Processing Steps:
- * - Extract the each sub header.
- *
- * @param[in] Inst inst
- * @param[out] *pdu
- * @param[in] *mBuf
- * @param[out] *lcId
- * @param[out] *len
- * @param[out] *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgDUXExtSubHdr(Inst inst, RgMacPdu *pdu, Buffer *mBuf, uint8_t *lcId, uint16_t *len, RgErrInfo *err)
-{
- uint8_t byte;
- uint8_t fmt=0;
-
-
- *len = 0;
- if(oduPackUInt8(&byte,mBuf) != ROK)
- {
- DU_LOG("\nERROR --> MAC : oduPackUInt8 failed");
- err->errCause = RGERR_DUX_UNPACK_FAILURE;
- return RFAILED;
- }
- /* Extract the lcid */
- RG_EXT_LCID(*lcId, byte);
-
- /*note: RG_EXT_PHR_LCID currently not considered */
- if(*lcId <= RG_DEDLC_MAX_LCID)
- { /* variable size MAC Sub PDU */
- RG_EXT_FORMT_BIT(fmt,byte);
- if(oduPackUInt8(&byte, mBuf) != ROK)
- {
- DU_LOG("\nERROR --> MAC : oduPackUInt8 failed");
- err->errCause = RGERR_DUX_UNPACK_FAILURE;
- return RFAILED;
- }
- *len = byte;
- if(fmt)
- {
- if(oduPackUInt8(&byte,mBuf) != ROK)
- {
- DU_LOG("\nERROR --> MAC : oduPackUInt8 failed");
- err->errCause = RGERR_DUX_UNPACK_FAILURE;
- return RFAILED;
- }
- *len = (*len << 8) | byte;
- }
- }
- return ROK;
-} /* rgDUXExtSubHdr */
-
-/**
- * @brief Handles extracting the CEs from the MAC PDU.
- *
- * @details
- *
- * Function: rgDUXExtCe
- *
- * This API handles extracting the CEs from the MAC PDU.
- *
- * Processing Steps:
- * - Based on the ce sub header extract the ce.
- *
- * @param[in] Inst inst
- * @param[in,out] *pdu
- * @param[out] *ceInfo
- * @param[in] *mBuf
- * @param[in] lcId
- * @param[in] subPduLen
- * @param[out] *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgDUXExtCe(Inst inst, RgMacPdu *pdu, RgInfCeInfo *ceInfo, Buffer *mBuf, uint8_t lcId, uint16_t subPduLen,\
-RgErrInfo *err)
-{
- S16 ret;
-
-
- switch(lcId)
- {
- case RG_EXT_PHR_LCID:
- {
- uint8_t Ci;
- uint8_t sCellIdx;
- uint8_t extPhrOctet;
- uint8_t extPhrPCmax;
- RgInfExtPhrCEInfo *extPhr;
-
- RG_UNPACK_EXT_PHR_CI(&Ci,mBuf,ret);
- if(ret != ROK)
- {
- DU_LOG("\nERROR --> MAC : Unpacking of EXT PHR failed LCID:%d",lcId);
- err->errCause = RGERR_DUX_UNPACK_FAILURE;
- return RFAILED;
- }
-
- /* Not handling Type 2 PHR report as simultaneous PUSCH/PUCCH
- is not supported as of now */
- extPhr = &ceInfo->ces.extPhr;
- extPhr->numServCells = 0;
-
- /* Setting first BIT as PCELL field even though reserved is always
- reported by UE */
- Ci |= 0x1;
- for (sCellIdx = 0; (Ci && sCellIdx < CM_LTE_MAX_CELLS); sCellIdx++)
- {
- if (Ci & 0x1)
- {
- extPhr->servCellPhr[extPhr->numServCells].sCellIdx = sCellIdx;
- RG_UNPACK_EXT_PHR(&extPhrOctet,mBuf,ret);
- if(ret != ROK)
- {
- DU_LOG("\nERROR --> MAC : Unpacking of EXT PHR failed LCID:%d",lcId);
- err->errCause = RGERR_DUX_UNPACK_FAILURE;
- return RFAILED;
- }
-
- /* extPhrOctet: Bits : 7 6 5 4 3 2 1 0
- * P V x x x x x x
- * <6x Bit phr>
- */
- /* P : P Back off applied or not */
- extPhr->servCellPhr[extPhr->numServCells].phr = (extPhrOctet & 0x3F);
- extPhr->servCellPhr[extPhr->numServCells].pBackOff =
- ((extPhrOctet >> 7) & 0x01);
-
- /* V: Virtual PCMAX or Real Tx PCMAX */
- if (extPhrOctet & 0x40)
- {
- extPhr->servCellPhr[extPhr->numServCells].pCmax = RG_REF_PCMAX;
- }
- else
- {
- RG_UNPACK_EXT_PHR(&extPhrPCmax,mBuf,ret);
- if(ret != ROK)
- {
- DU_LOG("\nERROR --> MAC : Unpacking of EXT PHR failed LCID:%d",lcId);
- err->errCause = RGERR_DUX_UNPACK_FAILURE;
- return RFAILED;
- }
- extPhr->servCellPhr[extPhr->numServCells].pCmax = (extPhrPCmax & 0x3F);
- }
- extPhr->numServCells++;
- }
- Ci >>= 1;
- }
-
- ceInfo->bitMask |= RG_EXT_PHR_CE_PRSNT;
- }
- break;
-
- case RG_PHR_LCID:
- {
- RG_UNPACK_PHR(&ceInfo->ces.phr,mBuf,ret);
- if(ret != ROK)
- {
- DU_LOG("\nERROR --> MAC : Unpacking of PHR failed LCID:%d",lcId);
- err->errCause = RGERR_DUX_UNPACK_FAILURE;
- return RFAILED;
- }
- ceInfo->bitMask |= RG_PHR_CE_PRSNT;
- }
- break;
- case RG_TRUNC_BSR_LCID:
- {
- RG_UNPACK_TRUNC_BSR(&ceInfo->ces.bsr.truncBsr,mBuf,ret);
- if(ret != ROK)
- {
- DU_LOG("\nERROR --> MAC : Unpacking of Trunc BSR failed LCID:%d",lcId);
- err->errCause = RGERR_DUX_UNPACK_FAILURE;
- return RFAILED;
- }
- ceInfo->bitMask |= RG_TRUNC_BSR_CE_PRSNT;
- }
- break;
- case RG_SHORT_BSR_LCID:
- {
- RG_UNPACK_SHORT_BSR(&ceInfo->ces.bsr.shortBsr,mBuf,ret);
- if(ret != ROK)
- {
- DU_LOG("\nERROR --> MAC : Unpacking of Short BSR failed LCID:%d",lcId);
- err->errCause = RGERR_DUX_UNPACK_FAILURE;
- return RFAILED;
- }
- ceInfo->bitMask |= RG_SHORT_BSR_CE_PRSNT;
- }
- break;
- case RG_LONG_BSR_LCID:
- {
- uint8_t longBsr[3] = {0}; /* KW_FIXX */
- RG_UNPACK_LONG_BSR(longBsr,mBuf,ret);
- if(ret != ROK)
- {
- DU_LOG("\nERROR --> MAC : Unpacking of Long BSR failed LCID:%d",lcId);
- err->errCause = RGERR_DUX_UNPACK_FAILURE;
- return RFAILED;
- }
- RG_EXT_BS(longBsr,
- ceInfo->ces.bsr.longBsr.bs1,
- ceInfo->ces.bsr.longBsr.bs2,
- ceInfo->ces.bsr.longBsr.bs3,
- ceInfo->ces.bsr.longBsr.bs4);
- ceInfo->bitMask |= RG_LONG_BSR_CE_PRSNT;
- }
- break;
- case RG_CRNTI_LCID:
- {
- RG_UNPACK_CRNTI(&ceInfo->ces.cRnti,mBuf,ret);
- if(ret != ROK)
- {
- DU_LOG("\nERROR --> MAC : Unpacking of C-RNTI failed LCID:%d",lcId);
- err->errCause = RGERR_DUX_UNPACK_FAILURE;
- return RFAILED;
- }
- ceInfo->bitMask |= RG_CRNTI_CE_PRSNT;
- }
- break;
- default:
- DU_LOG("\nERROR --> MAC : Invalid LCID:%u received",lcId);
- err->errCause = RGERR_DUX_INV_LCID_RX;
- return RFAILED;
- }
- return ROK;
-} /* rgDUXExtCe */
-
-
-/**
- * @brief Handles extracting the SDU from the MAC PDU.
- *
- * @details
- *
- * Function: rgDUXExtSdu
- *
- * This API handles extracting the SDU corresponding to a logical channel.
- *
- * Processing Steps:
- * - Based on the length stored in the sub header extract the SDU.
- *
- * @param[in] Inst inst
- * @param[in,out] *pdu
- * @param[out] *ceInfo
- * @param[in] *mBuf
- * @param[in] lcId
- * @param[in] subPduLen
- * @param[out] *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgDUXExtSdu(Inst inst, RgMacPdu *pdu, RgInfCeInfo *ceInfo, Buffer **mBuf, uint8_t lcId, uint16_t subPduLen,\
-RgErrInfo *err)
-{
- S16 ret;
- Buffer *tmpBuf1;
- Buffer *tmpBuf2 = NULLP;
- RgMacSdu *sdu;
-
-
- if(lcId == RG_CCCH_LCID)
- {
- ceInfo->bitMask |= RG_CCCH_SDU_PRSNT;
- }
-
- if(rgDUXInsSdu(inst,pdu, &sdu,lcId, subPduLen, err) != ROK)
- {
- RG_FREE_MSG(*mBuf);
- return RFAILED;
- }
-
- tmpBuf1 = *mBuf;
- {
- ret = SSegMsg(tmpBuf1,subPduLen,&tmpBuf2);
- if((ret != ROK) && (!((ret == ROKDNA) )))
- {
- RG_FREE_MSG(tmpBuf1);
- DU_LOG("\nERROR --> MAC : SSegMsg failed");
- err->errCause = RGERR_DUX_RLC_PDU_CREAT_FAIL;
- return RFAILED;
- }
- sdu->mBuf = tmpBuf1;
- *mBuf = tmpBuf2;
- }
- return ROK;
-} /* rgDUXExtSdu */
-
-/**
- * @brief Handles de-multiplexing of the data recieved at MAC.
- *
- * @details
- *
- * Function: rgDUXDemuxData
- *
- * This API handles de-multiplexing of the data recieved at MAC.
- *
- * Invoked by: rgTOMTfuDatInd of TOM
- *
- * Processing Steps:
- * - De-multiplex the mBuf
- *
- * @param[in] Inst inst
- * @param[in] *pdu
- * @param[in] *mBuf
- * @param[out] *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgDUXDemuxData(Inst inst, RgMacPdu *pdu, RgInfCeInfo *ceInfo, Buffer **mBuf, RgErrInfo *err)
-{
- uint8_t lcId;
- uint16_t subPduLen;
- MsgLen len;
-
- ceInfo->bitMask = 0x0000;
-
- /* Initialize the sdu list */
- cmLListInit(&pdu->sduLst);
-
- if(*mBuf == NULLP)
- {
- DU_LOG("\nERROR --> MAC : Null Buffer Recevived");
- return RFAILED;
- }
- do
- {
- /* UL Message format order :
- PduSubHdr+SubPDU,PduSubHdr+SubPDU,...CeSubHdr+Ce,CeSubPdu+Ce,...,PADSubHdr+PAD */
- /* Extract the Sub headers */
- if(rgDUXExtSubHdr(inst,pdu, *mBuf, &lcId,
- &subPduLen, err) != ROK)
- {
- RG_FREE_MSG(*mBuf);
- DU_LOG("\nERROR --> MAC : Failed to extract pad sub headers");
- return RFAILED;
- }
- if(lcId == RG_PAD_LCID)
- { /*at end of MAC PDU, Padding started */
- RG_FREE_MSG(*mBuf);
- return ROK;
- }
- if(lcId <= RG_DEDLC_MAX_LCID)
- {
- /* Extract the sdus */
- if(rgDUXExtSdu(inst,pdu,ceInfo, mBuf,lcId,subPduLen, err) != ROK)
- {
- /* Fix : syed rgDUXExtSdu would have segmented mBuf and hence
- * will be responsible for freeing mBuf */
- *mBuf = NULLP;
- DU_LOG("\nERROR --> MAC : failed to Extract the sdus");
- return RFAILED;
- }
- if(*mBuf == NULLP) /* if message read completes then return */
- {
- return ROK;
- }
- }
- else
- {
- /* Extract the ces */
- if(rgDUXExtCe(inst,pdu,ceInfo,*mBuf, lcId,subPduLen, err) != ROK)
- {
- RG_FREE_MSG(*mBuf);
- DU_LOG("\nERROR --> MAC : failed to Extract the ces");
- return RFAILED;
- }
- }
- if(SFndLenMsg(*mBuf,&len) != ROK)
- {
- RG_FREE_MSG(*mBuf);
- DU_LOG("\nERROR --> MAC : mBuf length check failed");
- err->errCause = RGERR_DUX_UNPACK_FAILURE;
- return RFAILED;
- }
- }while(len);
-
- RG_FREE_MSG(*mBuf);
- return ROK;
-} /* rgDUXDemuxData */
-
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for L2 Measurements in MAC
-
- File: rg_l2m.c
-
-**********************************************************************/
-
-/** @file rg_l2m.c
-@brief This file implements the schedulers main access to MAC layer code.
-*/
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "lrg.h"
-#include "crg.h"
-#include "rgr.h"
-#include "rgu.h"
-#include "tfu.h"
-#include "rg_env.h"
-#include "rg_err.h"
-#include "rg_sch_inf.h"
-#include "rg.h"
-
-/* header/extern include files (.x) */
-#include "rgu.x" /* RGU types */
-#include "tfu.x" /* TFU types */
-#include "lrg.x" /* layer management typedefs for MAC */
-#include "rgr.x" /* layer management typedefs for MAC */
-#include "crg.x" /* layer management typedefs for MAC */
-#include "rg_sch_inf.x" /* typedefs for Scheduler */
-#include "rg_prg.x" /* typedefs for PRG interface */
-#include "du_app_mac_inf.h"
-#include "rg.x" /* MAC types */
-
-
-/* local defines */
-#ifdef LTE_L2_MEAS
-static S16 rgL2mInsertMeasCb ARGS((
- RgCellCb *cell,
- RgL2MeasCb *measCb,
- RgInfL2MeasReq *measInfo ));
-
-static RgL2MeasCb * rgL2mAllocMeasCb ARGS((
- RgCellCb *cell,
- RgInfL2MeasReq *measInfo,
- RgErrInfo *err));
-
-/* Function definitions */
-
-/** @brief This function creates the measCb
- *
- * @details
- *
- * Function: rgL2mCreateMeasCb
- * Processing steps:
- * - Check the measType
- * - Create measCb for every qci
- *
- * @param [in] RgCellCb *cell
- * @param [in] RgInfL2MeasReq *measInfo
- * @param [in] uint8_t measType
- * @param [out] RgErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- *
- */
-S16 rgL2mCreateMeasCb
-(
-RgCellCb *cell,
-RgInfL2MeasReq *measInfo,
-uint8_t measType,
-RgErrInfo *err
-)
-{
- // Inst inst = cell->macInst - RG_INST_START;
- uint32_t idx;
- RgL2MeasCb *measCb = NULLP;
- uint8_t qciVal = 0;
-
- UNUSED(measType);
- UNUSED(err);
-
- if ((measCb = rgL2mAllocMeasCb(cell, measInfo, err)) == NULLP)
- {
- DU_LOG("\nERROR --> MAC : Allocation of RgL2MeasCb failed");
- return RFAILED;
- }
- //Memcpy is already done in rgL2mAllocMeasCb
- /*memcpy(&measCb->measReq, (const uint8_t *)measInfo,\
- sizeof(RgInfL2MeasReq));*/
- rgL2mInsertMeasCb(cell, measCb, measInfo);
- measCb->measReq.timePrd = measInfo->timePrd;
-
- if(measInfo->timePrd == 0)
- {
- cell->sndL2Meas = FALSE;
- }
-
- for(idx = 0; idx < measInfo->t.prbReq.numQci; idx++)
- {
- if(measInfo->timePrd == 0)
- {
- qciVal = measInfo->t.prbReq.qci[idx];
- cell->qciArray[qciVal].qci = qciVal;
- }
- cell->qciArray[measInfo->t.prbReq.qci[idx]].mask = TRUE;
- }
- return ROK;
-} /* rgL2mCreateMeasCb */
-
-
-/**
- * @brief Layer Manager Measurement request handler.
- *
- * @details
- *
- * Function : rgL2mMeasReq
- *
- * This function handles measurement request received at MAC
- * from the Scheduler.
- * -# Measurement request will be stored in the list in descending order of
- * there time period.
- *
- * @param[in] Pst *pst, the post structure
- * @param[in] RgInfL2MeasReq *measInfo, the measurement request structure
- * @param[out] RgErrInfo *err, error information
- * @return S16
- * -# ROK
- **/
-S16 rgL2mMeasReq
-(
-RgCellCb *cell,
-RgInfL2MeasReq *measInfo,
-RgErrInfo *err
-)
-{
- S16 ret=RFAILED;
-
- /* Creaet MeasCb Insert in cell->l2mList and return*/
- if ( (ret = rgL2mCreateMeasCb(cell, measInfo,
- LRG_L2MEAS_AVG_PRB_PER_QCI_UL, err)) != ROK)
- {
- /* Clear Downlink MeasCb created Above If exists*/
- return (ret);
- }
- return ROK;
-} /* rgL2mMeasReq */
-/** @brief This function sends the measurement confirm
- * from mac to scheduler
- *
- * @details
- *
- * Function: rgSndL2MeasCfm
- *
- * @param [in] RgCellCb *cell
- * @param [in] RgInfL2MeasCfm *measCfm
- */
-static Void rgSndL2MeasCfm(RgCellCb *cell, RgInfL2MeasCfm *measCfm)
-{
- Pst pst;
- Inst macInst = cell->macInst - RG_INST_START;
-
- memset(&pst, 0, sizeof(Pst));
- rgGetPstToInst(&pst,macInst, cell->schInstMap.schInst);
- RgMacSchL2Meas(&pst, measCfm);
-
- return;
-}/* rgSndL2MeasCfm */
-
-/** @brief This function sends the measurement stop confirm
- * from mac to scheduler
- *
- * @details
- *
- * Function: rgSndL2MeasStopCfm
- *
- * @param [in] RgCellCb *cell
- * @param [in] RgInfL2MeasCfm *measCfm
- */
-static Void rgSndL2MeasStopCfm(RgCellCb *cell,RgInfL2MeasCfm *measCfm)
-{
- Pst pst;
- Inst macInst = cell->macInst - RG_INST_START;
-
- memset(&pst, 0, sizeof(Pst));
- rgGetPstToInst(&pst,macInst, cell->schInstMap.schInst);
- RgMacSchL2MeasStop(&pst, measCfm);
-
- return;
-}/* rgSndL2MeasStopCfm */
-
-/**
- * @brief L2 Measurement request handler.This function shall be called by
- * scheduler to calculate average PRB usage Per Qci in Uplink
- *
- * @details
- *
- * Function : RgSchMacL2MeasReq
- *
- * @param[in] Pst *pst, the post structure
- * @param[in] RgInfL2MeasReq *measInfo, L2 Measurement req structure
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgSchMacL2MeasReq
-(
-Pst *pst, /* post structure */
-RgInfL2MeasReq *measInfo /* Meas Req Info */
-)
-{
- Inst inst;
- RgCellCb *cellCb = NULLP;
- RgErrInfo err;
- S16 ret = ROK;
- RgInfL2MeasCfm measCfm;
-
- RG_IS_INST_VALID(pst->dstInst);
- inst = pst->dstInst - RG_INST_START;
- cellCb = rgCb[inst].cell;
- /* Get the cell using cellId */
- if ((cellCb == NULLP) ||
- (cellCb->cellId != measInfo->cellId))
- {
- DU_LOG("\nERROR --> MAC : unable to get the cellCb");
- return RFAILED;
- }
- /* Call L2M Function to store Meas req */
- ret = rgL2mMeasReq(cellCb, measInfo, &err);
- if (ret != ROK)
- {
- memset(&measCfm, 0, sizeof(RgInfL2MeasCfm));
- measCfm.transId = measInfo->transId;
- measCfm.cellId = measInfo->cellId;
- measCfm.measType = measInfo->measType;
- measCfm.cfm.reason = LCM_REASON_INVALID_PAR_VAL;
- measCfm.cfm.status = LCM_PRIM_NOK;
- rgSndL2MeasCfm(cellCb, &measCfm);
- DU_LOG("\nERROR --> MAC : Meas req Failed errType(%d) errCause(%d)",
- err.errType, err.errCause);
- return RFAILED;
- }
- return (ret);
-} /* -- RgSchMacL2MeasReq-- */
-
-/**
- * @brief L2 Measurement request handler.This function shall be called by
- * sch to to stop l2 measurement in MAC,
- *
- * @details
- *
- * Function : RgSchMacL2MeasStopReq
- *
- * @param[in] Pst *pst, the post structure
- * @param[in] RgInfL2MeasReq *measInfo, L2 Measurement req structure
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgSchMacL2MeasStopReq
-(
-Pst *pst, /* post structure */
-RgInfL2MeasStopReq *measInfo /* Meas Req Info */
-)
-{
- S16 ret = ROK;
- CmLList *node = NULLP;
- RgL2MeasCb *measCb = NULLP;
- uint8_t idx;
- uint8_t qciVal;
- Inst inst;
- RgCellCb *cellCb = NULLP;
- RgInfL2MeasCfm measCfm;
-
- RG_IS_INST_VALID(pst->dstInst);
- inst = pst->dstInst - RG_INST_START;
- cellCb = rgCb[inst].cell;
- /* Get the cell using cellId */
- if ((cellCb == NULLP) ||
- (cellCb->cellId != measInfo->cellId))
- {
-
- DU_LOG("\nERROR --> MAC : Unable to get the cellCb");
- return RFAILED;
- }
- node = cellCb->l2mList.first;
- while(node != NULLP)
- {
- measCb = (RgL2MeasCb *)(node)->node;
- node = (node)->next;
- /*L2 Meas off for qci in cell */
- for(idx = 0; idx < measCb->measReq.t.prbReq.numQci; idx++)
- {
- qciVal = measCb->measReq.t.prbReq.qci[idx];
- cellCb->qciArray[qciVal].mask = FALSE;
- }
- cmLListDelFrm(&cellCb->l2mList, &measCb->measLnk);
- rgFreeSBuf(inst,(Data**)&measCb, sizeof(RgL2MeasCb));
- }
- memset(&measCfm, 0, sizeof(RgInfL2MeasCfm));
- measCfm.transId = measInfo->transId;
- measCfm.cellId = measInfo->cellId;
- measCfm.measType = measInfo->measType;
- measCfm.cfm.status = LCM_PRIM_OK;
- rgSndL2MeasStopCfm(cellCb, &measCfm);
- return (ret);
-} /* -- RgSchMacL2MeasStopReq-- */
-
-/**
- * @brief L2 Measurement request handler.This function shall be called by
- * scheduler for sending L2 meas
- *
- * @details
- *
- * Function : RgSchMacL2MeasSendReq
- *
- * @param[in] Pst *pst, the post structure
- * @param[in] RgInfL2MeasReq *measInfo, L2 Measurement req structure
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgSchMacL2MeasSendReq
-(
-Pst *pst, /* post structure */
-RgInfL2MeasSndReq *measInfo /* Meas Req Info */
-)
-{
- Inst inst;
- RgCellCb *cellCb = NULLP;
- S16 ret = ROK;
-
- RG_IS_INST_VALID(pst->dstInst);
- inst = pst->dstInst - RG_INST_START;
- cellCb = rgCb[inst].cell;
- /* Get the cell using cellId */
- if ((cellCb == NULLP) ||
- (cellCb->cellId != measInfo->cellId))
- {
-
- DU_LOG("\nERROR --> MAC : Unable to get the cellCb");
- return RFAILED;
- }
- /*set sndL2Meas as applicatoin sent l2 meas info request*/
- cellCb->sndL2Meas = TRUE;
-
- return (ret);
-}/*RgSchMacL2MeasSendReq*/
-
-/** @brief This function inserts the MeasCb in to data base
- *
- * @details
- *
- * Function: rgL2mInsertMeasCb
- *
- * @param [in] RgCellCb *cell
- * @param [in] RgL2MeasCb *measCb
- * @param [in] RgInfMeasReq *measInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-static S16 rgL2mInsertMeasCb
-(
-RgCellCb *cell,
-RgL2MeasCb *measCb,
-RgInfL2MeasReq *measInfo
-)
-{
- CmLList *lnk, *node;
- RgL2MeasCb *oldMeasCb;
- uint16_t diffTime;
-
- /*
- * 1. Check if l2mList has any entries.
- * 2. If yes
- * 1. Take the first entrie's time period and find the diff with
- * cell->crntTime.
- * 2. If the diff is > measInfo->timePeriod then insert before this
- * entry.
- * 3. Else take the next entry in list
- * 4. If reached without adding to list . Append at the end of list.
- * 3. If no entries in l2mList add at the first.
- */
- lnk = cell->l2mList.first;
-
- node = &measCb->measLnk;
- node->node = (PTR)measCb;
- while(lnk != NULLP )
- {
- oldMeasCb = (RgL2MeasCb *)lnk->node;
- diffTime = (oldMeasCb->measReq.timePrd -
- (RG_CALC_SF_DIFF(cell->crntTime, oldMeasCb->startTime)));
- if (diffTime > measInfo->timePrd)
- {
- cell->l2mList.crnt = lnk;
- cmLListInsCrnt(&(cell->l2mList), node);
- return ROK;
- }
- else
- {
- lnk = lnk->next;
- }
- } /* End of While */
-
- cmLListAdd2Tail(&(cell->l2mList), node);
- return ROK;
-} /* rgL2mInsertMeasCb */
-
-/** @brief This function allocates memory from the heap
- *
- * @details
- *
- * Function: rgL2mAllocMeasCb
- *
- * @param [in] RgCellCb *cell
- * @param [in] RgInfL2MeasReq *measInfo
- * @param [out] RgErrInfo *err
- * @return RgSchL2MeasCb *
- */
-static RgL2MeasCb * rgL2mAllocMeasCb
-(
-RgCellCb *cell,
-RgInfL2MeasReq *measInfo,
-RgErrInfo *err
-)
-{
- RgL2MeasCb *measCb = NULLP;
- Inst inst = cell->macInst - RG_INST_START;
-
-
- if((rgAllocSBuf(inst,(Data **)&(measCb),
- sizeof(RgL2MeasCb))) == RFAILED)
- {
- DU_LOG("\nERROR --> MAC : Allocation of RgL2MeasCb failed");
- err->errType = RGERR_L2M_MEASREQ;
- err->errCause = RGERR_RAM_MEM_EXHAUST;
- return (NULLP);
- }
- memcpy(&measCb->measReq, measInfo, sizeof(RgInfL2MeasReq));
- RGCPYTIMEINFO(cell->crntTime, measCb->startTime);
-
- return (measCb);
-} /* rgL2mAllocMeasCb */
-
-
-/**
- * @brief This function calculates the measurement for measType
- * LRG_L2MEAS_AVG_PRB_PER_QCI_UL and send the end result to the
- * MAC Scheduler.
- *
- * @details
- *
- * Function : rgL2Meas
- *
- * @param[in] RgCellCb *cell
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgL2Meas(RgCellCb *cell)
-{
- CmLList *node = NULLP;
- RgL2MeasCb *measCb = NULLP;
- RgInfL2MeasCfm measCfm;
- uint8_t idx = 0;
- uint8_t qciVal = 0;
- uint32_t measPrd; /*LTE_L2_MEAS_PHASE2*/
- CmLteTimingInfo crntTime;
- Inst inst = cell->macInst - RG_INST_START;
-
- node = cell->l2mList.first;
-
- while(node != NULLP)
- {
- measCb = (RgL2MeasCb *)node->node;
- node = node->next;
- crntTime = cell->crntTime;
-
- if(cell->crntTime.sfn == 0 && (cell->crntTime.slot % RG_NUM_SUB_FRAMES) == 0)
- {
- measCb->sfnCycle++;
- }
-
- measPrd = RG_CALC_SFN_SF_DIFF(cell->crntTime,
- measCb->sfnCycle, measCb->startTime);
-
- /*LTE_L2_MEAS_PHASE2*/
- if (cell->sndL2Meas || measPrd == measCb->measReq.timePrd)
- {
- memset(&measCfm, 0, sizeof(RgInfL2MeasCfm));
- for(idx = 0; idx < measCb->measReq.t.prbReq.numQci; idx++)
- {
- qciVal = measCb->measReq.t.prbReq.qci[idx];
- measCfm.u.prbCfm.prbUsage[idx].qciValue = qciVal;
-
- measCfm.transId = measCb->measReq.transId;
- measCfm.measType = measCb->measReq.measType;
- measCfm.cellId = measCb->measReq.cellId;
-
- measCfm.u.prbCfm.prbUsage[idx].prbUsage =
- cell->qciArray[qciVal].prbCount;
-
- cell->qciArray[qciVal].prbCount = 0;
- measCfm.u.prbCfm.numQci++;
- if(measCb->measReq.timePrd > 0)
- {
- cell->qciArray[qciVal].mask = FALSE;
- }
- }
- rgSndL2MeasCfm(cell, &measCfm);
-
- if(measCb->measReq.timePrd > 0)
- {
- cmLListDelFrm(&cell->l2mList, &measCb->measLnk);
- rgFreeSBuf(inst,(Data**)&measCb, sizeof(RgL2MeasCb));
- }
- else /*if meas period is 0 then do not delette meascb , just reset l2 cntrs value to 0*/
- {
- measCb->startTime = crntTime;
- measCb->measReq.timePrd = 0;
- cell->sndL2Meas = FALSE;
- }
- continue;
- }
- }
- return ROK;
-} /* rgL2MEas */
-
-#endif /* LTE_L2_MEAS */
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Entry point fucntions
-
- File: rg_lim.c
-
-**********************************************************************/
-
-/** @file rg_lim.c.
-@brief It has APIs exposed by Lower Interface Modulue of MAC. It acts as an
-Interface handler for lower interface APIs.
-*/
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "rgu.h" /* RGU defines */
-#include "tfu.h" /* RGU defines */
-#include "lrg.h" /* layer management defines for LTE-MAC */
-#include "crg.h" /* layer management defines for LTE-MAC */
-#include "rg_sch_inf.h" /* layer management defines for LTE-MAC */
-#include "rg_env.h" /* customisable defines and macros for MAC */
-#include "rg.h" /* defines and macros for MAC */
-
-/* header/extern include files (.x) */
-#include "rgu.x" /* RGU types */
-#include "tfu.x" /* RGU types */
-#include "lrg.x" /* layer management typedefs for MAC */
-#include "crg.x" /* layer management typedefs for MAC */
-#include "rg_sch_inf.x" /* SCH interface typedefs */
-#include "rg_prg.x" /* PRG interface typedefs */
-#include "rg.x" /* typedefs for MAC */
-
-/* local externs */
-#ifdef UNUSED_FUNC
-static S16 rgLIMValidateSap ARGS((Inst inst,SuId suId));
-#endif
-static Void rgLIMUtlFreeDatIndEvnt ARGS((TfuDatIndInfo *datInd,
- Bool error));
-#ifdef RG_UNUSED
-static Void rgLIMUtlFreeDatReqEvnt ARGS((TfuDatReqInfo *datReq,
- Bool error));
-#endif
-/* forward references */
-
-/**
- * @brief Bind confirm API for TFU SAP
- *
- * @details
- *
- * Function : RgLiTfuBndCfm
- *
- * This API is invoked by PHY to confirm TFU SAP bind.
- *
- *
- * @param[in] Pst *pst
- * @param[in] SuId suId
- * @param[in] uint8_t status
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgLiTfuBndCfm
-(
-Pst *pst,
-SuId suId,
-uint8_t status
-)
-{
- Inst inst;
- S16 ret;
- RgLowSapCb *tfuSap;
-
-
-
- RG_IS_INST_VALID(pst->dstInst);
- inst = pst->dstInst - RG_INST_START;
- /* Lets validate suId first */
- /* CA_Change */
- tfuSap = &(rgCb[inst].tfuSap);
-
- if (suId != tfuSap->sapCfg.suId)
- {
- DU_LOG("\nERROR --> MAC : Incorrect SuId. Configured (%d) Recieved (%d)",
- tfuSap->sapCfg.suId, suId);
- return RFAILED;
- }
- ret = rgLMMBndCfm (pst, suId, status);
- return (ret);
-} /* RgLiTfuBndCfm */
-
- /** @brief This function Validates the SAP information received along with the
- * primitive from the lower layer.
- * Function:
- * Validates SAP information.
- * @param[in] Inst inst
- * @param suId The SAP Id
- * @return
- * -# ROK
- * -# RFAILED
- */
-#ifdef UNUSED_FUNC
-static S16 rgLIMValidateSap(Inst inst,SuId suId)
-{
- RgLowSapCb *tfuSap;
-
-
- tfuSap = &(rgCb[inst].tfuSap);
-
- /* First lets check the suId */
- if( suId != tfuSap->sapCfg.suId)
- {
- DU_LOG("\nERROR --> MAC : Incorrect SuId. Configured (%d) Recieved (%d)",
- tfuSap->sapCfg.suId, suId);
- return RFAILED;
- }
- if (tfuSap->sapSta.sapState != LRG_BND)
- {
- DU_LOG("\nERROR --> MAC : Lower SAP not enabled SuId (%d)",
- tfuSap->sapCfg.suId);
- return RFAILED;
- }
- return ROK;
-} /* end of rgLIMValidateSap */
-#endif
-/** @brief This function frees up the TfuDatIndInfo structure
- *
- * @details
- *
- * Function: rgLIMUtlFreeDatIndEvnt
- * - Function frees up the TfuDatIndInfo structure, in case of error it shall
- * free up the buffer's present in the datIndLst.
- *
- * Processing steps:
- * @param [in] TfuDatIndInfo *datInd
- * @param [in] Bool *error
- * @return
- */
-static Void rgLIMUtlFreeDatIndEvnt(TfuDatIndInfo *datInd,Bool error)
-{
-
- TfuDatInfo *datInfo;
- CmLList *node;
-
- /* Steps of freeing up the TfuDatInd.
- * 1. loop through the datIndLst and free up all the buffers.
- * 2. free up the whole event
- */
- if ((error == TRUE) && (datInd->datIndLst.count > 0))
- {
- node = datInd->datIndLst.first;
- while (node)
- {
- datInfo = (TfuDatInfo*)node->node;
- RG_FREE_MSG(datInfo->mBuf);
- node = node->next;
- }
- }
- RG_FREE_MEM(datInd);
- return;
-} /* end of rgLIMUtlFreeDatIndEvnt*/
-
-/**
- * @brief Downlink data indication from PHY.
- *
- * @details
- *
- * Function : RgLiTfuDatInd
- *
- * This API is invoked by PHY to send data indication to MAC on
- * recieving data from UEs.
- *
- * @param[in] Pst *pst
- * @param[in] SuId suId
- * @param[in] TfuDatIndInfo *datInd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgLiTfuDatInd
-(
-Pst *pst,
-SuId suId,
-TfuDatIndInfo *datInd
-)
-{
- Inst inst;
- S16 ret;
- volatile uint32_t startTime=0;
-
-
- // DU_LOG("5GTF:: DatindRcvd\n");
-
- RG_IS_INST_VALID(pst->dstInst);
- inst = pst->dstInst - RG_INST_START;
- /*starting Task*/
- SStartTask(&startTime, PID_MAC_TFU_DATIND);
-
-#ifndef NO_ERRCLS
- if ((ret = rgLIMValidateSap (inst,suId)) != ROK)
- {
- DU_LOG("\nERROR --> MAC : SAP Validation failed");
- rgLIMUtlFreeDatIndEvnt(datInd, TRUE);
- return (ret);
- }
-#endif
- /* Now call the TOM (Tfu ownership module) primitive to process further */
- rgCb[inst].tfuSap.sapSts.numPduRcvd +=
- datInd->datIndLst.count;
- ret = rgTOMDatInd(inst,datInd);
- /* Fix: sriky memory corruption precautions */
- /* Free up the memory for the request structure */
- if (ret == ROK)
- {
- rgLIMUtlFreeDatIndEvnt(datInd, FALSE);
- }
- else
- {
- rgLIMUtlFreeDatIndEvnt(datInd, TRUE);
- }
-
- /*stoping Task*/
- SStopTask(startTime, PID_MAC_TFU_DATIND);
-
- return (ret);
-} /* RgLiTfuDatInd*/
-
-#ifdef RG_UNUSED
-/** @brief This function frees up the TfuDatReqInfo structure.
- *
- * @details
- *
- * Function: rgLIMUtlFreeDatReqEvnt
- * - Function frees up the TfuDatReqInfo structure, in case of error it shall
- * free up the buffer's present in the PDUs list.
- *
- * Processing steps:
- * @param [in] TfuDatReqInfo *datReq
- * @param [in] Bool *error
- * @return
- */
-static Void rgLIMUtlFreeDatReqEvnt(TfuDatReqInfo *datReq,Bool error)
-{
-
- TfuDatReqPduInfo *datInfo;
- CmLList *node;
- uint8_t i;
-
- /* Steps of freeing up the TfuDatReq.
- * 1. Free the bch buffer.
- * 2. loop through the pdus list and free up all the buffers.
- * 3. free up the whole event
- */
- if (error)
- {
- if (datReq->bchDat.pres == PRSNT_NODEF)
- {
- RG_FREE_MSG(datReq->bchDat.val);
- }
- if (datReq->pdus.count > 0)
- {
- node = datReq->pdus.first;
- while (node)
- {
- datInfo = (TfuDatReqPduInfo*)node->node;
- for (i=0; i<datInfo->nmbOfTBs; i++)
- {
- if (datInfo->mBuf[i] != NULLP)
- {
- RG_FREE_MSG(datInfo->mBuf[i]);
- }
- }
- node = node->next;
- }
- }
- }
- RG_FREE_MEM(datReq);
- return;
-} /* end of rgLIMUtlFreeDatReqEvnt*/
-#endif
-
-#ifdef L2_OPTMZ
-/**
- * @brief This API is invoked to send Data to PHY.
- *
- * @details
- *
- * Function : rgLIMTfuDelDatReq
- *
- * This API is invoked to send Data to PHY. It
- * fills in the Pst structure, spId value and invokes Data
- * request primitive at TFU.
- *
- * @param[in] Inst inst
- * @param[in] TfuDelDatReqInfo *datReq
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgLIMTfuDelDatReq(Inst inst,TfuDelDatReqInfo *delDatReq)
-{
- S16 ret;
- RgLowSapCb *tfuSap;
-
-
- /* Get the lower SAP control block from the layer control block. */
- tfuSap = &(rgCb[inst].tfuSap);
-
-#ifndef NO_ERRCLS
- if (tfuSap->sapSta.sapState != LRG_BND)
- {
- DU_LOG("\nERROR --> MAC : Lower SAP not bound (%d)",
- tfuSap->sapSta.sapState);
- return RFAILED;
- }
-#endif
-
- if((ret = RgLiTfuDelDatReq (&tfuSap->sapCfg.sapPst, tfuSap->sapCfg.spId,
- delDatReq)) != ROK)
- {
- DU_LOG("\nERROR --> MAC : Call to RgLiTfuDelDatReq() failed");
- }
- return (ret);
-} /* rgLIMTfuDatReq*/
-#endif /*L2_OPTMZ */
-
-#if defined(TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD)
- /**
- * @brief Transmission of non-rt indication from CL.
- *
- * @details
- *
- * Function : RgLiTfuNonRtInd
- *
- * This API is invoked by CL to indicate non-rt processing indication to MAC for a cell.
- *
- * @param[in] Pst *pst
- * @param[in] SuId suId
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgLiTfuNonRtInd(Pst *pst,SuId suId)
-{
-
-#ifdef NO_ERRCLS
- if (rgLIMValidateSap (pst->dstInst - RG_INST_START, suId) != ROK)
- {
- DU_LOG("\nERROR --> MAC : RgLiTfuNonRtInd() SAP Validation failed.\n");
- return RFAILED;
- }
-#endif
- rgDHMFreeTbBufs(pst->dstInst - RG_INST_START);
- return ROK;
-} /* RgLiTfuNonRtInd */
-
-#endif
-/**********************************************************************
-
- End of file
-**********************************************************************/
Elmnt sapType
));
-static Void rgLMMShutdown ARGS((
- Inst inst
-));
-
static Void rgLMMFillCfmPst ARGS((
Pst *reqPst,
Pst *cfmPst,
RgMngmt *cfm
));
-static Void rgLMMGenCntrl ARGS((
-RgMngmt *cntrl,
-RgMngmt *cfm,
-Pst *cfmPst
-));
-
-static Void rgLMMSapCntrl ARGS((
-RgMngmt *cntrl,
-RgMngmt *cfm,
-Pst *cfmPst
-));
-
\f
/**
* @brief Task Initiation callback function.
}/*-- RgMiLrgStsReq --*/
\f
-/**
- * @brief Layer Manager Status request handler.
- *
- * @details
- *
- * Function : RgMiLrgStaReq
- *
- * This function handles the solicited status
- * request received from the Layer Manager.
- * -# Based on sta->hdr.elmId.elmnt, it retrieves the status of a
- * particular SAP from the rgCb global control block.
- * -# Invokes the RgMiLrgStaCfm to send back the confirmation to LM.
- *
- * @param[in] Pst *pst, the post structure
- * @param[in] RgMngmt *sta, the status parameter's structure
- * @return S16
- * -# ROK
- **/
-S16 RgMiLrgStaReq
-(
-Pst *pst, /* post structure */
-RgMngmt *sta /* status structure */
-)
-{
- Pst cfmPst;
- RgMngmt cfm;
- Inst inst ;
-
-
- RG_IS_INST_VALID(pst->dstInst);
- inst = pst->dstInst - RG_INST_START;
-
-
- /* Fill the post structure for sending the confirmation */
- rgLMMFillCfmPst(pst, &cfmPst, sta);
-
- if (sta->t.ssta.s.sysId.ptNmb != NULLP)
- {
- MAC_FREE(sta->t.ssta.s.sysId.ptNmb, LRG_MAX_PT_NUM_SIZE);
- }
-
- memset(&cfm, 0, sizeof(RgMngmt));
- cfm.hdr.elmId.elmnt = sta->hdr.elmId.elmnt;
-
-#ifdef LMINT3
- cfm.hdr.transId = sta->hdr.transId;
-#endif
- /* Check if General Config Done */
- if(rgCb[inst].rgInit.cfgDone != TRUE)
- {
- SGetDateTime(&cfm.t.ssta.dt);
- MAC_ALLOC(cfm.t.ssta.s.sysId.ptNmb, LRG_MAX_PT_NUM_SIZE);
- if(cfm.t.ssta.s.sysId.ptNmb == NULLP)
- {
- DU_LOG("\nERROR --> MAC : Memory Unavailable for Confirmation");
- return ROK;
- }
- memset((cfm.t.ssta.s.sysId.ptNmb), 0, LRG_MAX_PT_NUM_SIZE);
- rgGetSId(&cfm.t.ssta.s.sysId);
- cfm.cfm.status = LCM_PRIM_NOK;
- cfm.cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
- cfm.hdr.elmId.elmnt = sta->hdr.elmId.elmnt;
- RgMiLrgStaCfm(&cfmPst, &cfm);
- DU_LOG("\nERROR --> MAC : Gen Cfg not done");
- return ROK;
- }
-
- switch(sta->hdr.elmId.elmnt)
- {
- case STGEN:
- SGetDateTime(&cfm.t.ssta.dt);
- MAC_ALLOC(cfm.t.ssta.s.sysId.ptNmb, LRG_MAX_PT_NUM_SIZE);
- if(cfm.t.ssta.s.sysId.ptNmb == NULLP)
- {
- DU_LOG("\nERROR --> MAC : Memory Unavailable for Confirmation");
- return ROK;
- }
- memset((cfm.t.ssta.s.sysId.ptNmb), 0, LRG_MAX_PT_NUM_SIZE);
- rgGetSId(&cfm.t.ssta.s.sysId);
- cfm.cfm.status = LCM_PRIM_OK;
- cfm.cfm.reason = LCM_REASON_NOT_APPL;
- RgMiLrgStaCfm(&cfmPst, &cfm);
- break;
- case STRGUSAP:
- cfm.cfm.status = LCM_PRIM_OK;
- cfm.cfm.reason = LCM_REASON_NOT_APPL;
- SGetDateTime(&cfm.t.ssta.dt);
- memcpy(&(cfm.t.ssta.s.rguSapSta),
- &rgCb[inst].rguSap[sta->t.ssta.sapInst].sapSta,
- sizeof(RgSapSta));
- RgMiLrgStaCfm(&cfmPst, &cfm);
- break;
- case STCRGSAP:
- cfm.cfm.status = LCM_PRIM_OK;
- cfm.cfm.reason = LCM_REASON_NOT_APPL;
- SGetDateTime(&cfm.t.ssta.dt);
- memcpy(&(cfm.t.ssta.s.crgSapSta), &rgCb[inst].crgSap.sapSta,
- sizeof(RgSapSta));
- RgMiLrgStaCfm(&cfmPst, &cfm);
- break;
- case STTFUSAP:
- cfm.cfm.status = LCM_PRIM_OK;
- cfm.cfm.reason = LCM_REASON_NOT_APPL;
- SGetDateTime(&cfm.t.ssta.dt);
- memcpy(&(cfm.t.ssta.s.tfuSapSta), &rgCb[inst].tfuSap.sapSta,
- sizeof(RgSapSta));
- RgMiLrgStaCfm(&cfmPst, &cfm);
- break;
- default:
- cfm.cfm.status = LCM_PRIM_NOK;
- cfm.cfm.reason = LCM_REASON_INVALID_ELMNT;
- RgMiLrgStaCfm(&cfmPst, &cfm);
- DU_LOG("\nERROR --> MAC : Invalid elmnt=%d",sta->hdr.elmId.elmnt);
- break;
- }
- return ROK;
-}/*-- RgMiLrgStaReq --*/
-
-\f
-/**
- * @brief Layer Manager Control request handler.
- *
- * @details
- *
- * Function : RgMiLrgCntrlReq
- *
- * This function handles the control
- * request received from the Layer Manager.
- * -# Based on cntrl->hdr.elmId.elmnt, cntrl->t.cntrl.action
- * and cntrl->t.cntrl.subAction, it performs the appropriate control action
- * of SAP (enable/disable), Debug (enable/disable), Trace (enable/disable)
- * and layer shutdown.
- * -# Invokes the RgMiLrgCntrlCfm to send back the confirmation to LM.
- *
- * @param[in] Pst *pst, the post structure
- * @param[in] RgMngmt *cntrl, the control parameter's structure
- * @return S16
- * -# ROK
- **/
-S16 RgMiLrgCntrlReq
-(
-Pst *pst, /* post structure */
-RgMngmt *cntrl /* control structure */
-)
-{
- S16 ret = ROK; /* return value */
- Pst cfmPst;
- RgMngmt cfm;
- Inst inst;
- /* Fill the post structure for sending the confirmation */
-
- RG_IS_INST_VALID(pst->dstInst);
- inst = pst->dstInst - RG_INST_START;
-
- rgLMMFillCfmPst(pst, &cfmPst, cntrl);
-
- memset(&cfm, 0, sizeof(RgMngmt));
-#ifdef LMINT3
- cfm.hdr.transId = cntrl->hdr.transId;
-#endif
- cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt;
- cfm.t.cntrl.action = cntrl->t.cntrl.action;
- cfm.t.cntrl.subAction = cntrl->t.cntrl.subAction;
-
- /* Check if General Config Done*/
- if(rgCb[inst].rgInit.cfgDone != TRUE)
- {
- cfm.cfm.status = LCM_PRIM_NOK;
- cfm.cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
- cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt;
- RgMiLrgCntrlCfm(&cfmPst, &cfm);
- DU_LOG("\nERROR --> MAC : Gen Cfg not done");
- return ROK;
- }
-
- /* General Config done, process the Control request */
- switch(cntrl->hdr.elmId.elmnt)
- {
- case STGEN:
- rgLMMGenCntrl(cntrl, &cfm, &cfmPst);
- break;
- case STTFUSAP:
- case STRGUSAP:
- case STCRGSAP:
- rgLMMSapCntrl(cntrl, &cfm, &cfmPst);
- break;
- default:
- cfm.cfm.status = LCM_PRIM_NOK;
- cfm.cfm.reason = LCM_REASON_INVALID_PAR_VAL;
- RgMiLrgCntrlCfm(&cfmPst, &cfm);
- DU_LOG("\nERROR --> MAC : invalid elmnt=%d",cntrl->hdr.elmId.elmnt);
- break;
- }
- return (ret);
-}/*-- RgMiLrgCntrlReq --*/
-
-\f
/**
* @brief SAP Configuration Handler.
*
}
\f
-/***********************************************************
- *
- * Func : rgLMMShutdown
- *
- *
- * Desc : Handles the MAC layer shutdown request. Calls
- * rgCFGFreeCellCb(RgCellCb*) to handle each cellCb deallocation.
- *
- *
- * Ret : Void
- *
- * Notes:
- *
- * File : rg_lmm.c
- *
- **********************************************************/
-static Void rgLMMShutdown(Inst inst)
-{
- RgCellCb *cell = rgCb[inst].cell;
- uint8_t idx;
-
-
- /* 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 */
- MAC_FREE(rgCb[inst].rguSap,
- (sizeof(RgUpSapCb) * rgCb[inst].numRguSaps));
-
- 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, macActvTmr);
-
- /* 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);
-
- return;
-}
-
-\f
-/***********************************************************
- *
- * Func : rgLMMGenCntrl
- *
- *
- * Desc : Processes the LM control request for STGEN elmnt.
- *
- *
- * Ret : Void
- *
- * Notes:
- *
- * File : rg_lmm.c
- *
- **********************************************************/
-static Void rgLMMGenCntrl
-(
-RgMngmt *cntrl,
-RgMngmt *cfm,
-Pst *cfmPst
-)
-{
- Inst inst = (cfmPst->srcInst - RG_INST_START);
-
- 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 */
- memcpy(&rgCb[inst].genCfg.trcResp.response,
- &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 */
- memcpy(&rgCb[inst].genCfg.ustaResp.response,
- &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;
- DU_LOG("\nERROR --> MAC : 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;
- DU_LOG("\nERROR --> MAC : 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;
- DU_LOG("\nERROR --> MAC : invalid action=%d",cntrl->t.cntrl.action);
- break;
- }
- RgMiLrgCntrlCfm(cfmPst, cfm);
- return;
-}
-
-\f
-/***********************************************************
- *
- * Func : rgLMMSapCntrl
- *
- *
- * Desc : Processes the LM control request for STxxxSAP elmnt.
- *
- *
- * Ret : Void
- *
- * Notes:
- *
- * File : rg_lmm.c
- *
- **********************************************************/
-static Void rgLMMSapCntrl
-(
-RgMngmt *cntrl,
-RgMngmt *cfm,
-Pst *cfmPst
-)
-{
- Inst inst = cfmPst->srcInst - RG_INST_START;
-
- /* 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 */
- memcpy(&rgCb[inst].genCfg.bndCfmResp.response,
- &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);
- }
- }
- memset(&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;
- DU_LOG("\nERROR --> MAC : rgLMMSapCntrl(): invalid action=%d",
- cntrl->t.cntrl.action);
- break;
- }
- break;
- case STRGUSAP:
- switch(cntrl->t.cntrl.action)
- {
- case ADEL:
- memset(&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;
- DU_LOG("\nERROR --> MAC : rgLMMSapCntrl(): invalid action=%d",
- cntrl->t.cntrl.action);
- break;
- }
- break;
- case STCRGSAP:
- switch(cntrl->t.cntrl.action)
- {
- case ADEL:
- memset(&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;
- DU_LOG("\nERROR --> MAC : invalid action=%d",cntrl->t.cntrl.action);
-
- break;
- }
- break;
- default:
- /* Would never here. */
- RETVOID;
- }
- RgMiLrgCntrlCfm(cfmPst, cfm);
- return;
-}
-
-\f
/***********************************************************
*
* Func : rgLMMFillCfmPst
return (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] uint8_t event, the trace event.
- * @return Void
- **/
-Void rgLMMTrcInd
-(
-Inst inst,
-Buffer *srcMbuf, /* Message Buffer */
-uint8_t event /* event */
-)
-{
- Buffer *dstMbuf = NULLP;
- MsgLen bufLen = 0;
- Data *tempBuf;
- MsgLen tempCnt;
- RgMngmt trc;
- Pst pst;
-
-
-
- if ((rgCb[inst].trcLen == LRG_NO_TRACE) || (srcMbuf == NULLP))
- {
- DU_LOG("\nERROR --> MAC : Trace Disabled.");
- return;
- }
-
- memset(&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)
- {
- DU_LOG("\nERROR --> MAC : SCpyMsgMsg Failed.");
- return;
- }
- 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)
- {
- DU_LOG("\nERROR --> MAC : SFndLenMsg Failed.");
- return;
- }
- /* 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)
- {
- DU_LOG("\nERROR --> MAC : SCpyMsgMsg Failed.");
- return;
- }
-
- 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)
- {
- DU_LOG("\nERROR --> MAC : rgAllocSBuf Failed.");
- return;
- }
-
- /* Copy trcLen nos of bytes from the recvd message */
- if (SCpyMsgFix(srcMbuf,0,rgCb[inst].trcLen,tempBuf,&tempCnt) != ROK)
- {
- DU_LOG("\nERROR --> MAC : SCpyMsgFix Failed.");
- return;
- }
-
- if (ODU_GET_MSG_BUF(pst.region, pst.pool, &dstMbuf) != ROK)
- {
- DU_LOG("\nERROR --> MAC : dstMbuf Allocation Failed");
- return;
- }
- /* Copy the tempBuf data to dst mBuf */
- if (SCpyFixMsg(tempBuf,dstMbuf,0,rgCb[inst].trcLen,&tempCnt) != ROK)
- {
- DU_LOG("\nERROR --> MAC : SCpyFixMsg Failed.");
- return;
- }
-
- /*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);
- }
- }
- return;
-}
-
-\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] uint8_t status, Status
- * @return S16
- * -# ROK
- **/
-S16 rgLMMBndCfm
-(
-Pst *pst, /* Post Structure */
-SuId suId, /* Service user ID */
-uint8_t status /* Status */
-)
-{
- Inst inst = pst->dstInst - RG_INST_START;
- S16 ret = ROK;
- RgMngmt cntrlCfm;
- Pst cfmPst;
-
-
- UNUSED(pst);
-
- /* Check if the suId is valid */
- if(rgCb[inst].tfuSap.sapCfg.suId != suId)
- {
- DU_LOG("\nERROR --> MAC : Invalid SuId");
- return RFAILED;
- }
-
- /* check the Sap State */
- switch(rgCb[inst].tfuSap.sapSta.sapState)
- {
- case LRG_WAIT_BNDCFM:
- break;
- case LRG_BND:
- /* SAP is already bound */
- return ROK;
- default:
- return 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;
-
- memset(&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);
-
- return (ret);
-}
-
/**********************************************************************
End of file
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Entry point fucntions
-
- File: rg_mux.c
-
-**********************************************************************/
-
-/** @file rg_mux.c
-@brief MAC Multiplexing API.
-*/
-
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "rg_env.h" /* MAC Environment Defines */
-#include "tfu.h" /* TFU Interface defines */
-#include "crg.h" /* CRG Interface defines */
-#include "rg_sch_inf.h" /* RGR Interface defines */
-#include "rgu.h" /* RGU Interface defines */
-#include "lrg.h" /* LRG Interface defines */
-
-#include "rg_err.h" /* MAC error defines */
-#include "rg.h" /* MAC defines */
-
-/* header/extern include files (.x) */
-
-#include "rgu.x" /* RGU Interface includes */
-#include "tfu.x" /* CRG Interface includes */
-#include "crg.x" /* CRG Interface includes */
-#include "rg_sch_inf.x" /* SCH Interface includes */
-#include "rg_prg.x" /* PRG Interface includes */
-#include "rgu.x" /* RGU Interface includes */
-#include "lrg.x" /* LRG Interface includes */
-
-#include "du_app_mac_inf.h"
-#include "rg.x" /* MAC includes */
-#include "ss_queue.h"
-#include "ss_queue.x"
-#include "ss_task.x"
-#include "ss_msg.x" /* MAC includes */
-/* local defines */
-#ifndef T2K_MEM_LEAK_DBG
- S16 ssGetDBufOfSize(Region region,Size size,Buffer **dBuf);
-#else
-char* file = __FILE__;
-uint32_t line = __LINE__;
-#endif
-
-/* local typedefs */
-
-/* global variables */
-uint32_t rgDlrate_rgu;
-
-/* local externs */
-
-static Void rgMUXGet20bitRarGrnt ARGS((uint8_t ulBw,
- RgInfRarUlGrnt *msg3Grnt,
- uint8_t *grnt));
-uint16_t rgMUXCalcRiv ARGS((uint8_t bw,
- uint8_t rbStart,
- uint8_t numRb));
-
-#ifndef MS_MBUF_CORRUPTION
-#define MS_BUF_ADD_ALLOC_CALLER()
-#endif
-/* forward references */
-
-#define RG_PACK_SHDR_FIXD_SZ(_subHdr, _lcId, _mBuf, _ret) {\
- _subHdr.shLen = RG_FIXDSZ_CE_SHDR_LEN;\
- _subHdr.shData[0] = (0x3F & _lcId);\
- MS_BUF_ADD_ALLOC_CALLER(); \
- _ret = SAddPstMsgMult(&_subHdr.shData[0], _subHdr.shLen, _mBuf);\
-}
-
-#define RG_PACK_CE(_ce, _len, _ceBuf, _ret) {\
- MS_BUF_ADD_ALLOC_CALLER(); \
- _ret = SAddPstMsgMult((uint8_t *)(&(_ce)), _len, _ceBuf);\
-}
-
-#define RG_MUX_CALC_LEN(_len,_lenBytes,_elmTotLen) {\
- uint8_t _hdrLen;\
- _lenBytes = (_len <= 255) ? 1 : 2;\
- _hdrLen = _lenBytes + RG_SDU_SHDR_LEN;\
- _elmTotLen = _hdrLen + _len;\
-}
-
-#define RG_PACK_VAR_SZ_CE_SDU_SHDR(_subHdr, _lcId, _len,_mBuf, _ret) {\
- _ret = ROK;\
- if(_len <= 255)\
- {\
- _subHdr.shData[0] = (0x3F & _lcId);\
- _subHdr.shLen = 2;\
- _subHdr.shData[1] = (0xFF & _len);\
- _subHdr.shData[2] = 0;\
- }\
- else\
- {\
- _subHdr.shData[0] = (0x7F & ((0x40) | _lcId));\
- _subHdr.shLen = 3;\
- _subHdr.shData[1] = (0xFF & (_len >> 8));\
- _subHdr.shData[2] = (0xFF & _len);\
- }\
- MS_BUF_ADD_ALLOC_CALLER(); \
- _ret = SAddPstMsgMult(&_subHdr.shData[0], _subHdr.shLen, _mBuf);\
-}
-
-#define RG_PACK_PAD_SHDR(_mBuf, _ret) {\
- _ret = SAddPreMsg(0x3F, _mBuf);\
-}
-
-#define RG_PACK_RAR_SHDR(_byte, _mBuf, _ret) {\
- _ret = SAddPstMsg(_byte, _mBuf);\
-}
-
-
-/**
- * @brief Function to add ces along with subhdrs.
- * This function packs first CE sub-hdr and then CE in ceBuf pointer
- *
- * @details
- *
- * Function : rgMUXAddCes
- *
- * @param[in] Inst inst
- * @param[in] RgBldPduInfo *pdu
- * @param[in] Buffer *ceBuf
- * @param[in] RgErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgMUXAddCes
-(
-Inst inst,
-RgBldPduInfo *pdu,
-Buffer *ceBuf,
-RgErrInfo *err
-)
-{
- S16 ret;
- RgMUXSubHdr subHdr;
-
- if (NULLP != pdu->contResId)
- {
- if(pdu->schdTbSz >= RG_CRES_ELM_LEN)
- {
- RG_PACK_SHDR_FIXD_SZ(subHdr, RG_CRES_LCID_IDX, ceBuf, ret);
-
- if(ret != ROK)
- {
- err->errCause = RGERR_MUX_BLD_CEHDR_FAIL;
- DU_LOG("\nERROR --> MAC : Muxing of Contention Resolution CE sub-header is failed");
- return RFAILED;
- }
-
- RG_PACK_CE(pdu->contResId->resId[0], RG_CRES_LEN, ceBuf, ret);
-
- if(ret != ROK)
- {
- err->errCause = RGERR_MUX_BLD_CE_FAIL;
- DU_LOG("\nERROR --> MAC : Muxing of Contention Resolution CE is failed");
- return RFAILED;
- }
- pdu->schdTbSz -= RG_CRES_ELM_LEN;
- }
- }
- if (TRUE == pdu->ta.pres)
- {
- if(pdu->schdTbSz >= RG_TA_ELM_LEN)
- {
- uint8_t taVal; /* Moving from outer scope to available scope */
- RG_PACK_SHDR_FIXD_SZ(subHdr, RG_TA_LCID_IDX, ceBuf, ret);
-
- if(ret != ROK)
- {
- err->errCause = RGERR_MUX_BLD_CEHDR_FAIL;
- DU_LOG("\nERROR --> MAC : Muxing of TA CE sub-hdr is failed");
- return RFAILED;
- }
-
- taVal = pdu->ta.val;
- RG_PACK_CE(taVal, RG_TA_LEN, ceBuf, ret);
-
- if(ret != ROK)
- {
- err->errCause = RGERR_MUX_BLD_CE_FAIL;
- DU_LOG("\nERROR --> MAC : Muxing of TA CE is failed");
- return RFAILED;
- }
- pdu->schdTbSz -= RG_TA_ELM_LEN;
- DU_LOG("\nDEBUG --> MAC : TA muxed by MAC: %u", pdu->ta.val);
- }
- }
-#ifdef LTE_ADV
- if(TRUE == pdu->sCellActCe.pres)
- {
- if(pdu->schdTbSz >= RG_SCELL_CE_ELM_LEN)
- {
- /* Adding the subheader for ACT CE */
- RG_PACK_SHDR_FIXD_SZ(subHdr, RG_SCELL_LCID_IDX, ceBuf, ret);
-
- if(ret != ROK)
- {
- err->errCause = RGERR_MUX_BLD_CEHDR_FAIL;
- DU_LOG("\nERROR --> MAC : Muxing of SCELL Activation CE sub-hdr is failed")
- return RFAILED;
- }
-
- /* Adding the ACT CE */
- RG_PACK_CE(pdu->sCellActCe.val, RG_SCELL_ACT_CE_LEN, ceBuf, ret);
-
- if(ret != ROK)
- {
- err->errCause = RGERR_MUX_BLD_CE_FAIL;
- DU_LOG("\nERROR --> MAC : Muxing of SCELL Activation CE is failed")
- return RFAILED;
- }
- pdu->schdTbSz -= RG_SCELL_CE_ELM_LEN;
-
- }
- }
-#endif
-
- /*LcId is not yet decided in 5G-NR spec for MAC CEs Hence, not writing code
- * new MAC CEs. */
-
- return ROK;
-} /* rgMUXAddCes */
-
-/**
- * @brief Function to insert SDU along with sub headers.
- *
- * @details
- *
- * Function : rgMUXInsSdu
- *
- * @param[in] Inst inst
- * @param[in] MsgLen *schdTbSz
- * @param[in] uint8_t lcId
- * @param[in] Buffer *sdu
- * @param[out] Buffer *sduBuf
- * @param[out] RgErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgMUXInsSdu
-(
-Inst inst,
-MsgLen *schdTbSz,
-uint8_t lcId,
-Buffer *sdu,
-Buffer *sduBuf,
-RgErrInfo *err
-)
-{
- S16 ret;
- MsgLen msgLen = 0;
- uint8_t lenBytes;
- MsgLen elmTotLen;
-
- SFndLenMsg(sdu, &msgLen);
-
- RG_MUX_CALC_LEN(msgLen,lenBytes,elmTotLen);
-
- if (lcId == 3)
- {
- rgDlrate_rgu += msgLen;
- }
- if (*schdTbSz >= elmTotLen)
- {
- RgMUXSubHdr subHdr;
- RG_PACK_VAR_SZ_CE_SDU_SHDR(subHdr, lcId, msgLen,sduBuf, ret);
- if(ret != ROK)
- {
- err->errCause = RGERR_MUX_BLD_SDUHDR_FAIL;
- DU_LOG("\nERROR --> MAC : RGERR_MUX_BLD_SDUHDR_FAIL for LCID:%d",lcId);
- return RFAILED;
- }
-
-#ifndef L2_OPTMZ /* no need to pack as passing not muxing all LCs PDUs to 1*/
- RG_PACK_SDU(sduBuf, sdu, ret);
-#else
- //UDAY
- ret = ROK;
- UNUSED(sduBuf);
-#endif
-
- if(ret != ROK)
- {
- err->errCause = RGERR_MUX_BLD_SDU_FAIL;
- DU_LOG("\nERROR --> MAC : RGERR_MUX_BLD_SDU_FAIL for LCID:%d",lcId);
- return RFAILED;
- }
-
- *schdTbSz -= elmTotLen;
- }
- else
- {
- /* This Sub-PDU can not be accodmodated at all */
- DU_LOG("\nERROR --> MAC : Failed lcId %u, elmTotLen %d lenBytes %d LCID:%d",
- lcId, ((S16)elmTotLen), lenBytes,lcId);
- DU_LOG("\nERROR --> MAC : msglen %d schdTbSz %d LCID:%d",
- ((S16)msgLen), ((S16)*schdTbSz),lcId);
- return RFAILED;
- }
- return ROK;
-}
-
-/**
- * @brief Function to insert SDU along with sub headers.
- *
- * @details
- *
- * Function : rgMUXAddPadd
- *
- * @param[in] Inst inst
- * @param[in] RgBldPduInfo *pdu
- * @param[out] Buffer *mBuf
- * @param[out] Buffer *sduBuf
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-#ifdef L2_OPTMZ
-uint32_t padSize = 0;
-#endif
-S16 rgMUXAddPadd
-(
-Inst inst,
-MsgLen *schdTbSz,
-Buffer *sduBuf,
-Bool isRar,
-RgErrInfo *err
-)
-{
- S16 ret = ROK;
- Buffer *padBuf = NULLP;
- RgMUXSubHdr subHdr;
-
-#ifdef L2_OPTMZ
- padSize = 0;
-#endif
- if(*schdTbSz)
- {
-#ifndef L2_OPTMZ
- if(FALSE == isRar)
-#else
- if((FALSE == isRar) && (NULL != sHdrBuf))
-#endif
-
- {
- RG_PACK_SHDR_FIXD_SZ(subHdr, RG_PAD_LCID_IDX, sduBuf, ret);
-
- if(ret != ROK)
- {
- err->errCause = RGERR_MUX_BLD_PADHDR_FAIL;
- DU_LOG("\nERROR --> MAC : RGERR_MUX_BLD_PADHDR_FAIL");
- return RFAILED;
- }
-
- *schdTbSz -= 1;
- }
-
- if (*schdTbSz)
- {
- if (*schdTbSz <= RG_MAX_PAD_ARR_SZ)
- {
-#ifndef L2_OPTMZ
- RG_PACK_PAD(padBuf,*schdTbSz,sduBuf);
-#else
- if(sduBuf)
- {
- RG_PACK_PAD(padBuf,*schdTbSz,sduBuf);
- }
- else
- padSize += *schdTbSz;
-#endif
- if(ret != ROK)
- {
- err->errCause = RGERR_MUX_BLD_PAD_FAIL;
- DU_LOG("\nERROR --> MAC : RGERR_MUX_BLD_PAD_FAIL");
- return RFAILED;
- }
- *schdTbSz = 0;
- }
- else
- {
- while (*schdTbSz)
- {
- if (*schdTbSz > RG_MAX_PAD_ARR_SZ)
- {
-#ifndef L2_OPTMZ
- RG_PACK_PAD(padBuf,RG_MAX_PAD_ARR_SZ,sduBuf);
-#else
- if(sduBuf)
- {
- RG_PACK_PAD(padBuf,RG_MAX_PAD_ARR_SZ,sduBuf);
- }
- else
- padSize += RG_MAX_PAD_ARR_SZ;
-#endif
-
- if(ret != ROK)
- {
- err->errCause = RGERR_MUX_BLD_PAD_FAIL;
- DU_LOG("\nERROR --> MAC : RGERR_MUX_BLD_PAD_FAIL");
- return RFAILED;
- }
-
- *schdTbSz -= RG_MAX_PAD_ARR_SZ;
- }
- else
- {
-#ifndef L2_OPTMZ
- RG_PACK_PAD(padBuf,*schdTbSz,sduBuf);
-#else
- if(sduBuf)
- {
- RG_PACK_PAD(padBuf,*schdTbSz,sduBuf);
- }
- else
- padSize += *schdTbSz;
-#endif
-
- if(ret != ROK)
- {
- err->errCause = RGERR_MUX_BLD_PAD_FAIL;
- DU_LOG("\nERROR --> MAC : RGERR_MUX_BLD_PAD_FAIL");
- return RFAILED;
-
- }
- *schdTbSz = 0;
- }
- }
- }
- }
- }
-
- return ROK;
-} /* rgMUXAddPadd */
-
-#ifndef L2_OPTMZ
-/**
- * @brief Function to add SDU along with sub headers.
- *
- * @details
- *
- * Function : rgMUXAddSdus
- *
- * @param[in] Inst inst
- * @param[in] RgBldPduInfo *pdu
- * @param[out] Buffer *mBuf
- * @param[out] Buffer *sduBuf
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgMUXAddSdus
-(
-Inst inst,
-RgBldPduInfo *pdu,
-Buffer *sduBuf,
-RgErrInfo *err
-)
-{
- RgRguDDatReqPerUe *dDatReq;
- RgRguCmnDatReq *cDatReq;
-
- switch(pdu->reqType)
- {
- case EVTRGUCDATREQ:
- cDatReq = (RgRguCmnDatReq *)(pdu->datReq);
- /* Add sdu(s) to the Message Buffer */
- if (NULLP != cDatReq)
- {
- if(rgMUXInsSdu(inst,&pdu->schdTbSz,
- RG_CCCH_LCID, cDatReq->pdu, sduBuf, err) != ROK)
- {
- return RFAILED;
- }
- RG_FREE_MSG(cDatReq->pdu);
- }
- break;
-
- case EVTRGUDDATREQ:
- dDatReq = (RgRguDDatReqPerUe *)(pdu->datReq);
- /* Add sdu(s) to the Message Buffer */
- if (NULLP != dDatReq)
- {
- if(pdu->tbIndex == 1)
- {
- uint16_t idx1, idx2;
- /* Adding this temporary variable for optimization */
- RguDatReqTb *datReqTb = &dDatReq->datReqTb[0];
-
- for (idx1=0; (idx1 < datReqTb->nmbLch); idx1++)
- {
- for(idx2=0;
- (idx2 < datReqTb->lchData[idx1].pdu.numPdu);
- idx2++)
- {
- if(pdu->schdTbSz)
- {
- if(rgMUXInsSdu(inst,&pdu->schdTbSz,
- datReqTb->lchData[idx1].lcId,
- datReqTb->lchData[idx1].pdu.mBuf[idx2],
- sduBuf, err) != ROK)
- {
- DU_LOG("\nERROR --> MAC : FAILED for LCID:%d",datReqTb->lchData[idx1].lcId);
- return RFAILED;
- }
- }
- RG_FREE_MSG(datReqTb->lchData[idx1].pdu.mBuf[idx2]);
- }
- }
- }
- else if(pdu->tbIndex == 2)
- {
- uint16_t idx1, idx2;
- RguDatReqTb *datReqTb = &dDatReq->datReqTb[1];
- for (idx1=0; (idx1 < datReqTb->nmbLch); idx1++)
- {
- for(idx2=0;
- (idx2 < datReqTb->lchData[idx1].pdu.numPdu);
- idx2++)
- {
- if(pdu->schdTbSz)
- {
- if(rgMUXInsSdu(inst,&pdu->schdTbSz,
- datReqTb->lchData[idx1].lcId,
- datReqTb->lchData[idx1].pdu.mBuf[idx2],
- sduBuf, err) != ROK)
- {
- DU_LOG("\nERROR --> MAC : FAILED TB Size %d LCID:%d",
- ((S16)pdu->schdTbSz),datReqTb->lchData[idx1].lcId);
- return RFAILED;
- }
- }
- RG_FREE_MSG(datReqTb->lchData[idx1].pdu.mBuf[idx2]);
- }
- }
- }
- }
- break;
-
- default:
- break;
- } /* End of switch(reqType) */
- if(rgMUXAddPadd(inst,&pdu->schdTbSz, sduBuf, FALSE, err) != ROK)
- {
- DU_LOG("\nERROR --> MAC : FAILED for TB Size:%d",(S16)pdu->schdTbSz);
- return RFAILED;
- }
- return ROK;
-}
-
-/**
- * @brief Function to create MAC PDU from RLC SDUs and control elements, if any.
- *
- * @details
- *
- * Function : rgMUXBldPdu
- *
- * -# This function shall be invoked by Downlink Harq Module as soon as a
- * Data request is received from RLC for a UE along with its stored
- * control elements to create a MAC PDU.
- * -# It shall create subheaders for the control elements (timing advance
- * and contention resolution ID) and pack sub-header before each CE,
- * if given, and then shall run through all the logical channels and
- * create subheader for each of the SDUs given on that logical channel
- * and pack corresponding sub-header before the each SDU
- * -# It shall invoke rgMUXPadPdu if the total length of the created
- * buffer is less than the scheduled TB size.
- *
- *
- * @param[in] Inst *inst
- * @param[in] RgBldPduInfo *bldPdu
- * @param[in] Buffer **txPdu
- * @param[out] RgErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgMUXBldPdu
-(
-Inst inst,
-RgBldPduInfo *pdu,
-Buffer **txPdu,
-RgErrInfo *err
-)
-{
- Buffer *mBuf = NULLP;
-
- if (rgGetMsg(inst, &mBuf) != ROK)
- {
- /* Buffer couldnt get allocated. Return a failure */
- err->errCause = RGERR_MUX_MEM_ALLOC_FAIL;
- err->errType = RGERR_MUX_BLD_PDU;
- DU_LOG("\nERROR --> MAC : Memory allocation failed during MUXing of MAC TB: MacInst %d", inst);
- return RFAILED;
- }
-
- if(rgMUXAddCes(inst, pdu, mBuf, err) != ROK)
- {
- RG_FREE_MSG(mBuf);
- err->errType = RGERR_MUX_BLD_PDU;
- DU_LOG("\nERROR --> MAC : Failed to Multiplex MAC CEs: MacInst %d", inst);
- return RFAILED;
- }
-
- if(rgMUXAddSdus(inst, pdu, mBuf, err) != ROK)
- {
- RG_FREE_MSG(mBuf);
- err->errType = RGERR_MUX_BLD_PDU;
- DU_LOG("\nERROR --> MAC : FAILED to Multiplex MAC SDU: MacInst %d", inst);
- return RFAILED;
- }
-
- *txPdu = mBuf;
-
- return ROK;
-
-} /* rgMUXBldPdu */
-
-#else /* else of ifndef L2_OPTMZ */
-
-/**
- * @brief Function to add SDU along with sub headers.
- *
- * @details
- *
- * Function : rgMUXAddSdus
- *
- * @param[in] RgBldPduInfo *pdu
- * @param[out] Buffer *mBuf
- * @param[out] Buffer *sduBuf
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgMUXAddSdus
-(
-Inst inst,
-RgBldPduInfo *pdu,
-Buffer *sHdrBuf,
-RgTfuDatReqTbInfo *tb,
-RgErrInfo *err
-)
-{
- RgRguDDatReqPerUe *dDatReq;
- RgRguCmnDatReq *cDatReq;
- uint32_t lchIdx, pduIdx;
-
- switch(pdu->reqType)
- {
- case EVTRGUCDATREQ:
- cDatReq = (RgRguCmnDatReq *)(pdu->datReq);
- /* Add sdu(s) to the Message Buffer */
- if (NULLP != cDatReq)
- {
- if(rgMUXInsSdu(inst, &pdu->schdTbSz,
- RG_CCCH_LCID, cDatReq->pdu,
- sHdrBuf, NULLP, err) != ROK)
- {
- return RFAILED;
- }
- /* L2 Optimization for mUe/Tti: RLC pdu mbuf pointer will be passed
- * to CL it is stored in DlHqProc->TbInfo and it will be used in
- * case of harq retransmission. Store CCCH data at 0th index of
- * lch array*/
- tb->lchInfo[tb->numLch].mBuf[(tb->lchInfo[tb->numLch].numPdu)]\
- = cDatReq->pdu;
- tb->lchInfo[tb->numLch].numPdu++;
- tb->numLch++;
- DU_LOG("\nINFO --> MAC : MSG4 is muxed numLch=%ld numPdu=%ld tbaddr =%p",\
- tb->numLch,tb->lchInfo[tb->numLch-1].numPdu, (uint32_t)tb);
- }
- break;
-
- case EVTRGUDDATREQ:
- dDatReq = (RgRguDDatReqPerUe *)(pdu->datReq);
- /* Add sdu(s) to the Message Buffer */
- if (NULLP != dDatReq)
- {
- if(pdu->tbIndex == 1)
- {
- uint16_t idx1, idx2;
- /* Adding this temporary variable for optimization */
- RguDatReqTb *datReqTb = &dDatReq->datReqTb[0];
-
- tb->numLch = lchIdx = 0;
-
- for (idx1=0; (idx1 < datReqTb->nmbLch); idx1++)
- {
- tb->lchInfo[lchIdx].numPdu = pduIdx = 0;
-
- for(idx2=0;
- (idx2 < datReqTb->lchData[idx1].pdu.numPdu);
- idx2++)
- {
- if(pdu->schdTbSz)
- {
- if(rgMUXInsSdu(inst, &pdu->schdTbSz,
- datReqTb->lchData[idx1].lcId,
- datReqTb->lchData[idx1].pdu.mBuf[idx2],
- sHdrBuf, NULLP, err) != ROK)
- {
- DU_LOG("\nERROR --> MAC : Failed to insert SDU in rgMUXAddSdus\n");
- return RFAILED;
- }
-
- /* L2 Optimization for mUe/Tti:Increment numPdu by 1
- * Store pdu buffer in tb to send it to CL/PHY. Increment
- * numPdu by 1*/
- tb->lchInfo[lchIdx].mBuf[pduIdx] = datReqTb->lchData[idx1].pdu.mBuf[idx2];
-
-#ifdef L2_OPTMZ
- if(datReqTb->lchData[idx1].freeBuff == FALSE)
- {/* Not incrementing refCnt for UM Mode. */
- tb->lchInfo[lchIdx].mBuf[pduIdx]->refCnt++;
- }
-#endif
-//UDAY
- if(NULL != datReqTb->lchData[idx1].pdu.mBuf[idx2]->b_cont)
- {
- Buffer *tmp;
- tmp = datReqTb->lchData[idx1].pdu.mBuf[idx2]->b_cont;
- if(NULL == tmp->b_rptr)
- {
- DU_LOG("\nERROR --> MAC : rgMUXAddSdus failed in EVTRGUDDATREQ");
- }
- }
- else
- {
- DU_LOG("\nERROR --> MAC : rgMUXAddSdus failed in EVTRGUDDATREQ");
- }
- pduIdx++;
- //tb->lchInfo[tb->numLch].numPdu++;
- //tb->numLch++;
-
- }
- }
-
- if(pduIdx)
- {
- tb->lchInfo[lchIdx].numPdu = pduIdx;
- /* If Bearer is UM then MBUF to be free by MAC layer */
- tb->lchInfo[lchIdx].freeBuff = datReqTb->lchData[idx1].freeBuff;
- lchIdx++;
- }
- }
- tb->numLch = lchIdx;
- }
- else if(pdu->tbIndex == 2)
- {
- uint16_t idx1, idx2;
- RguDatReqTb *datReqTb = &dDatReq->datReqTb[1];
- tb->numLch = lchIdx = 0;
- // prc_trace_format_string(0x40,3,": AddSdus: numOfLch=%d numOfPdu=%d, schdSz=%d", datReqTb->nmbLch, datReqTb->lchData[0].pdu.numPdu, pdu->schdTbSz);
- for (idx1=0; (idx1 < datReqTb->nmbLch); idx1++)
- {
- tb->lchInfo[lchIdx].numPdu = pduIdx = 0;
- for(idx2=0;
- (idx2 < datReqTb->lchData[idx1].pdu.numPdu);
- idx2++)
- {
- if(pdu->schdTbSz)
- {
- if(rgMUXInsSdu(inst, &pdu->schdTbSz,
- datReqTb->lchData[idx1].lcId,
- datReqTb->lchData[idx1].pdu.mBuf[idx2],
- sHdrBuf, NULLP, err) != ROK)
- {
- DU_LOG("\nERROR --> MAC : FAILED TB Size %d\n",
- ((S16)pdu->schdTbSz));
- return RFAILED;
- }
- /* L2 Optimization for mUe/Tti:Increment numPdu by 1
- * Store pdu buffer in tb to send it to CL/PHY. Increment
- * numPdu by 1*/
- tb->lchInfo[lchIdx].mBuf[pduIdx] = datReqTb->lchData[idx1].pdu.mBuf[idx2];
-#ifdef L2_OPTMZ
- if(datReqTb->lchData[idx1].freeBuff == FALSE)
- {/* Not incrementing refCnt for UM Mode. */
- tb->lchInfo[lchIdx].mBuf[pduIdx]->refCnt++;
- }
-#endif
- if(NULL != datReqTb->lchData[idx1].pdu.mBuf[idx2]->b_cont)
- {
- Buffer *tmp;
- tmp = datReqTb->lchData[idx1].pdu.mBuf[idx2]->b_cont;
- if(NULL == tmp->b_rptr)
- {
- DU_LOG("\nERROR --> MAC : rgMUXAddSdus failed in EVTRGUDDATREQ");
- }
- }
- else
- {
- DU_LOG("\nERROR --> MAC : rgMUXAddSdus failed in EVTRGUDDATREQ");
- }
- pduIdx++;
- // tb->lchInfo[tb->numLch].numPdu++;
- // tb->numLch++;
-
- }
- }
-
- if(pduIdx)
- {
- tb->lchInfo[lchIdx].numPdu = pduIdx;
- /* If Bearer is UM then MBUF to be free by MAC layer */
- tb->lchInfo[lchIdx].freeBuff = datReqTb->lchData[idx1].freeBuff;
- lchIdx++;
- }
- }
-
- tb->numLch = lchIdx;
- }
- }
- break;
-
- case EVENT_SLOT_IND_TO_MAC:
- break;
- default:
- break;
- } /* End of switch(reqType) */
-
-
- if(rgMUXAddPadd(inst, &pdu->schdTbSz, sduBuf, NULLP, FALSE, err) != ROK)
- {
- //RGDBGERRNEW((rgPBuf, "FAILED"));
- return RFAILED;
- }
- tb->padSize = padSize;
-
- return ROK;
-}
-
-/**
- * @brief Function to create MAC PDU from RLC SDUs and control elements, if any.
- *
- * @details
- *
- * Function : rgMUXBldPdu
- * -# This function shall be invoked by Downlink Harq Module as soon as a
- * Data request is received from RLC for a UE along with its stored
- * control elements to create a MAC PDU.
- * -# It shall create subheaders for the control elements (timing advance
- * and contention resolution ID), if given, and then shall run through
- * all the logical channels and create subheader for each of the SDUs
- * given on that logical channel.
- * -# L2 Optimization for mUe/Tti: Avoiding muxing to reduce overhead of
- * additional Mbuf allocation memory related operation.
- -# MAC header, MAC CEs, MAC PDUs and MAC padding are stored in pre-
- allocated mBufs. These pointers will not be freed by CL
- * -# It shall invoke rgMUXPadPdu if the total length of the created
- * buffer is less than the scheduled TB size.
- * -# At successfull operation of this function tb->macHdr, will have
- * complete MAC Header. tb->macCes will have MAC CEs if any. tb->
- * lchInfo[idx].mBuf[idx] will have MAC SDU per LCH per TB per UE
- *
- *
- * @param[in] RgBldPduInfo *bldPdu
- * @param[out] RgTbInfo *tb
- * @param[out] RgErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgMUXBldPdu
-(
-Inst inst,
-RgBldPduInfo *pdu,
-RgTfuDatReqTbInfo *tb,
-RgErrInfo *err
-)
-{
- Buffer *mBuf1; /* MAC hearder */
- Buffer *mBuf2; /* MAC CEs */
- //uint32_t lchIdx, pduIdx;
-
- /* Reseting macHdr and macCes pointers */
- if(tb->macHdr)
- SResetMBuf(tb->macHdr);
- if(tb->macCes)
- SResetMBuf(tb->macCes);
-
- mBuf1 = tb->macHdr; /* MAC hearder */
- mBuf2 = tb->macCes; /* MAC CEs */
- tb->tbSize = pdu->schdTbSz;
-
- if(rgMUXAddCes(inst, pdu, mBuf1, mBuf2, err) != ROK)
- {
- /* Reset rPtr and wPtr to the base of data buffer(db_base)*/
- DU_LOG("\nERROR --> MAC : rgMUXBldPdu: rgMUXAddCes is Failed \n");
- RG_FREE_TB(tb);
- err->errType = RGERR_MUX_BLD_PDU;
- //RGDBGERRNEW((rgPBuf, "FAILED"));
- return RFAILED;
- }
- if(rgMUXAddSdus(inst, pdu, mBuf1, tb, err) != ROK)
- {
- /*TODO:MP Reset rPtr and wPtr to the base of data buffer(db_base)
- * Reset numLch and numPdu to zero and set MAC SDU buf to NULLP */
- DU_LOG("\nERROR --> MAC : rgMUXBldPdu: rgMUXAddSdus is Failed \n");
- RG_FREE_TB(tb);
-
- err->errType = RGERR_MUX_BLD_PDU;
- //RGDBGERRNEW((rgPBuf, "FAILED"));
- return RFAILED;
- }
-// UDAY
-// SPrntMsg(tb->macHdr, 0, 0);
-// prc_trace_format_string(0x40,3,": padSize=%ld", tb->padSize);
-
- tb->tbPres = TRUE;
- return ROK;
-
-} /* rgMUXBldPdu */
-
-#endif /* end of L2_OPTMZ */
-
-/**
- * @brief Function to create RAR PDU.
- *
- * @details
- *
- * Function : rgMUXBldRarPdu
- * This function is used to build RAR PDUs and is being
- * invoked by the scheduler.
- *
- * @param[out]RgCellCb *cellCb
- * @param[in] RgRaRspAlloc *bldPdu
- * @param[in] Buffer **txPdu
- * @param[out] RgErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgMUXBldRarPdu
-(
-RgCellCb *cell,
-RgInfRaRntiInfo *alloc,
-Buffer **txPdu,
-RgErrInfo *err
-)
-{
- Buffer *datBuf = NULLP;
- S16 ret;
- uint8_t data[RG_RAR_ELEM_LEN];
- uint8_t hdrByte;
- MsgLen schdTbSz;
- uint8_t idx;
- Inst inst = cell->macInst - RG_INST_START;
-
- schdTbSz = alloc->schdTbSz;
- /* RAR PDU Requirements */
- /*
- 1. SubHeader - R/T/RAPID. //5GNR, changed E to R
- 2. TA ( if applicable)
- 3. Ul Grant:
- a. Hopping Flag - 1 Bit.
- b. Fixed Size RB Assignment. - 10 Bits.
- c. Truncated Modulation and coding scheme - 4 Bits.
- d. TPC command for scheduled PUSCH. - 3 Bits.
- e. UL Delay - 1 Bit.
- f. CQI Request - 1 Bit.
- 4. Temporary Crnti.
- */
-
- /* Initialize the error type */
- err->errType = RGERR_MUX_BLD_RAR_PDU;
-
- if ((ret = rgGetMsg(inst,&datBuf)) != ROK)
- {
- /* Buffer couldnt get allocated. Return a failure */
- err->errCause = RGERR_MUX_MEM_ALLOC_FAIL;
- DU_LOG("\nERROR --> MAC : FAILED to getMsg");
- return RFAILED;
- }
-
- if (TRUE == alloc->backOffInd.pres)
- {
- /*Set T Bit , NO E bit Required */
- hdrByte = 0x00;
- /* Add the bi */
- hdrByte |= (0x0F & (alloc->backOffInd.val));
-
- /* Add the header */
- RG_PACK_RAR_SHDR(hdrByte, datBuf, ret);
- if(ret != ROK)
- {
- err->errCause = RGERR_MUX_BLD_BI_FAIL;
- DU_LOG("\nERROR --> MAC : RGERR_MUX_BLD_BI_FAIL");
- RG_FREE_MSG(datBuf);
- return RFAILED;
- }
- schdTbSz--;
- }
-
- for (idx=0; idx < (alloc->numCrnti) &&
- (schdTbSz >= RG_RAR_ELEM_LEN+RG_RAR_SHDR_LEN); idx++)
- {
- /* Add the tBit */
- hdrByte = 0x40;
- /* Add the rapId */
- hdrByte |= (0x3F & (alloc->crntiInfo[idx].rapId));
-
- /* Add the header */
- RG_PACK_RAR_SHDR(hdrByte, datBuf, ret);
- if(ret != ROK)
- {
- err->errCause = RGERR_MUX_BLD_RAPIDHDR_FAIL;
- DU_LOG("\nERROR --> MAC : RGERR_MUX_BLD_RAPIDHDR_FAIL");
- RG_FREE_MSG(datBuf);
- return RFAILED;
- }
-
- /* Prepare the data */
- data[0] = 0x7F & ((alloc->crntiInfo[idx].ta.val) >> 4);
- data[1] = 0;
- data[2] = 0;
- data[3] = 0;
- {
- rgMUXGet20bitRarGrnt(cell->bwCfg.ulTotalBw, &(alloc->crntiInfo[idx].grnt), &data[1]);
- }
- data[1] |= ((uint8_t)((alloc->crntiInfo[idx].ta.val) << 4));
- data[4] = (alloc->crntiInfo[idx].tmpCrnti) >> 8;
- data[5] = (uint8_t) (alloc->crntiInfo[idx].tmpCrnti);
-
- DU_LOG("\nDEBUG --> MAC : Rar,Rapid=%d, Temp CRNTI:%d",
- alloc->crntiInfo[idx].rapId,
- alloc->crntiInfo[idx].tmpCrnti);
- MS_BUF_ADD_ALLOC_CALLER();
- if(SAddPstMsgMult(&data[0], RG_RAR_ELEM_LEN, datBuf) != ROK)
- {
- err->errCause = RGERR_MUX_BLD_RAPID_FAIL;
- DU_LOG("\nERROR --> MAC : RGERR_MUX_BLD_RAPID_FAIL");
- RG_FREE_MSG(datBuf);
- return RFAILED;
- }
- schdTbSz -= RG_RAR_ELEM_LEN+RG_RAR_SHDR_LEN;
- }
-
- if(rgMUXAddPadd(inst,&schdTbSz, datBuf, TRUE, err) != ROK)
- {
- RG_FREE_MSG(datBuf);
- DU_LOG("\nERROR --> MAC : FAILED to mux add padding");
- return RFAILED;
- }
-
- *txPdu = datBuf;
-
- return ROK;
-} /* rgMUXBldRarPdu */
-
-/***********************************************************
- *
- * Func : rgMUXGet20bitRarGrnt
- *
- * Desc : This function fills up the 20-bit grant
- * for RA response.
- *
- * Ret : None.
- *
- * Notes: None.
- *
- * File : rg_mux.c
- *
- **********************************************************/
-static Void rgMUXGet20bitRarGrnt
-(
-uint8_t ulBw,
-RgInfRarUlGrnt *msg3Grnt,
-uint8_t *grnt
-)
-{
- uint16_t riv = rgMUXCalcRiv(ulBw, msg3Grnt->rbStart, msg3Grnt->numRb);
-
- grnt[2] = msg3Grnt->cqiBit; /* cqi bit is 0, output from sched */
- grnt[2] |= (msg3Grnt->delayBit << 1);
- grnt[2] |= (msg3Grnt->tpc << 2);
- grnt[2] |= (msg3Grnt->iMcsCrnt << 5);
-
- grnt[1] = (msg3Grnt->iMcsCrnt >> 3);
- /* Forcing right shift to insert 0 as the LSB:
- * since this is assumed in the computation */
- grnt[1] |= (uint8_t)((riv << 1) & 0xFE);
-
- grnt[0] = (uint8_t)((riv >> 7) & 0x07);
- grnt[0] |= ((msg3Grnt->hop & 0x01) << 3);
-
- return;
-} /* rgMUXGet20bitRarGrnt */
-
-/***********************************************************
- *
- * Func : rgMUXCalcRiv
- *
- * Desc : This function calculates RIV.
- *
- * Ret : None.
- *
- * Notes: None.
- *
- * File : rg_mux.c
- *
- **********************************************************/
-uint16_t rgMUXCalcRiv
-(
-uint8_t bw,
-uint8_t rbStart,
-uint8_t numRb
-)
-{
- uint8_t numRbMinus1 = numRb - 1;
- uint16_t riv;
-
- if (numRbMinus1 <= bw/2)
- {
- riv = bw * numRbMinus1 + rbStart;
- }
- else
- {
- riv = bw * (bw - numRbMinus1) + (bw - rbStart - 1);
- }
- return (riv);
-} /* rgMUXCalcRiv */
-
-
-
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Entry point functions
-
- File: rg_pom_scell.c
-
-**********************************************************************/
-
-/** @file rg_pom_scell.c
-@brief This module does processing related to handling of SCell related function.
-*/
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "lrg.h"
-#include "crg.h"
-#include "rgu.h"
-#include "tfu.h"
-#include "rg_sch_inf.h"
-#include "rg_prg.h" /* PRG interface includes*/
-#include "rg_env.h"
-#include "rg.h"
-#include "rg_err.h"
-
-/* header/extern include files (.x) */
-#include "lrg.x"
-#include "crg.x"
-#include "rgu.x"
-#include "tfu.x"
-#include "rg_sch_inf.x"
-#include "rg_prg.x" /* PRG interface typedefs*/
-#include "du_app_mac_inf.h"
-#include "rg.x"
-#ifdef LTE_ADV
-#include "rg_pom_scell.x"
-static S16 rgPomVldtSCellDedLchCfg ARGS((
- Inst inst,
- RgPrgUeSCellLchAddInfo *lcCfg,
- RgCellCb **cell,
- RgUeCb **ue
- ));
-static S16 rgPomUeSCellDedLcCfg ARGS((RgCellCb *cell,
- RgUeCb *ue,
- RgPrgUeSCellLchAddInfo *lcCfg
- ));
-/**
- * @brief Handler for the Lch reconfiguration request from PMAC to SMAC.
- *
- * @details
- *
- * Function : RgPrgPMacSMacUeSCellLchModReq
- *
- * Processing Steps:
- * - calls the function for validating cell, uecb and lch sent by PMAC
- * - Updates the lch recfg into ueCb.
- * - If successful, add the control block to hash list of UEs for the cell
- * else Rollback and FAIL.
- *
- * @param[in] Pst *pst
- * @param[in] RgPrgUeSCellLchModInfo *lchCfgCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgPrgPMacSMacUeSCellLchModReq
-(
-Pst *pst,
-RgPrgUeSCellLchModInfo *lchCfgCb
-)
-{
- RgPrgCfgCfmInfo cfgCfm;
- Inst inst = pst->dstInst;
- RgCellCb *cell;
- S16 ret;
- Pst cfmPst;
- RgUeCb *ue;
- RgUlLcCb *ulLc;
-
- RGDBGPRM(inst,(rgPBuf(inst),
- "APPLYING CRG UE SCELL CONFIG: cellId %d ueId %d lcId %d lcgId %d\n",
- lchCfgCb->cellId, lchCfgCb->crnti,lchCfgCb->lcId,lchCfgCb->ulLchRecfg.lcgId));
-
- cfgCfm.ueId = lchCfgCb->crnti;
- cfgCfm.sCellId = lchCfgCb->cellId;
- cfgCfm.status = PRG_CFG_CFM_OK;
- cfgCfm.event = EVTPRGUESCELLLCHMODCFM;
- rgGetPstToInst(&cfmPst, inst, pst->srcInst);
-
- ret = rgPomVltdModLch(inst,lchCfgCb, &cell, &ue,&ulLc);
- if(ret != ROK)
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d] SMAC SCell Lc Cfg failed:\
- cellId %d\n", lchCfgCb->crnti, lchCfgCb->cellId));
- /* Set status as Not OK*/
- cfgCfm.status = PRG_CFG_CFM_NOK;
- }
- else
- {
- ret = rgPomUeSCellLcMod(inst, ue, ulLc, lchCfgCb);
- if(ret != ROK)
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d] SMac SCell lc cfg failed:\
- cellId %d\n", lchCfgCb->crnti, lchCfgCb->cellId));
- /* Set status as Not OK*/
- cfgCfm.status = PRG_CFG_CFM_NOK;
- }
- }
-
- RGDBGINFONEW(inst,(rgPBuf(inst), "[%d] Scell Lch Config done:\
- cellId %d\n", lchCfgCb->crnti, lchCfgCb->cellId));
-
- /* Send positive confirmation to primary cell*/
- RgPrgSMacPMacCfg(&cfmPst, &cfgCfm);
- return ROK;
-} /* RgPrgPMacSMacUeSCellLchModReq */
-
-
-/**
- * @brief A wrapper class to send the LCH Del req from PMAC to SMAC
- *
- * @details
- *
- * Function : rgPomSndUeSCellLchDelToSmac
- *
- * Processing Steps:
- * - Retrieve the cell control block.
- * - If successful,
- * - Validate the range of values received in
- * delete request.
- * - Checks if the Ue has any scell added.
- * - If validated successfully,
- * - if SCells have been added ,then
- * send the lchDel structure to update the same values to SMAC.
- * - Return ROK.
- * - Else return RFAILED.
- *
- * @param[in] Inst inst
- * @param[in] CrgDel *lcDel
- * @param[in] Bool *isCfmRqrd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgPomSndUeSCellLchDelToSmac
-(
-Inst inst,
-CrgDel *lcDel,
-Bool *isCfmRqrd
-)
-{
- uint8_t idx = 0;
- Inst dstMacInst;
- Pst dstInstPst;
- RgPrgUeSCellLchDelInfo delLcCb;
- RgCellCb *cell;
- RgUeCb *ue;
-
- /* Fetch the Active cell */
- if(((cell = rgCb[inst].cell) == NULLP) ||
- (cell->cellId != lcDel->u.lchDel.cellId))
- {
- RGDBGERRNEW(inst,(rgPBuf(inst),
- "[%d]Active Cell does not exist %d\n",
- lcDel->u.lchDel.crnti, lcDel->u.lchDel.cellId));
- return RFAILED;
- }
-
- RGDBGPRM(inst,(rgPBuf(inst),
- "Filling SCell LCh Config : cellId %d ueId %d\n",
- cell->cellId, cell->ueId));
-
- if ((ue = rgDBMGetUeCb(cell, lcDel->u.lchDel.crnti)) == NULLP)
- {
- RGDBGERRNEW(inst,(rgPBuf(inst),
- "[%d]Ue does not exist\n", lcDel->u.lchDel.crnti));
- return RFAILED;
- }
- for(idx = 0; idx < RG_MAX_SCELL_PER_UE ; idx++)
- {
- if(TRUE == ue->sCelInfo[idx].isSCellAdded)
- {
- dstMacInst = ue->sCelInfo[idx].macInst - RG_INST_START;
- delLcCb.cellId = ue->sCelInfo[idx].sCellId;
- delLcCb.crnti = lcDel->u.lchDel.crnti;
- delLcCb.lcId = lcDel->u.lchDel.lcId;
- delLcCb.dir = lcDel->u.lchDel.dir;
-
- /* Get post structure of the cell to whom delLcCb needs to be sent
- * And then send the lch recfg based on Mac instances */
- rgGetPstToInst(&dstInstPst, inst, dstMacInst);
- RgPrgPMacSMacUeScellLchDel(&dstInstPst, &delLcCb);
- *isCfmRqrd = FALSE;
- }
- }
- return ROK;
-}
-
-
-/**
- * @brief A wrapper class to send the LCH reconfig req from PMAC to SMAC
- *
- * @details
- *
- * Function : rgPomSndUeSCellLchModToSmac
- *
- * Processing Steps:
- * - Retrieve the cell control block.
- * - If successful,
- * - Validate the range of re-configured values recieved in
- * re-configuration request.
- * - Checks if the Ue has any scell added.
- * - If validated successfully,
- * - if SCells have been added ,then
- * send the lchRecfg structure to update the same values to SMAC.
- * - Return ROK.
- * - Else return RFAILED.
- *
- * @param[in] Inst inst
- * @param[in] RgCellCb *cell
- @param[in] RgUeCb *ue,
- @param[in] CrgLchRecfg *lchRecfg,
- @param[in] Bool *isCfmRqrd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgPomSndUeSCellLchModToSmac
-(
-Inst inst,
-RgCellCb *cell,
-RgUeCb *ue,
-CrgLchRecfg *lchRecfg,
-Bool *isCfmRqrd
-)
-{
- uint8_t idx = 0;
- Inst dstMacInst;
- RgPrgUeSCellLchModInfo lchCfgCb;
- Pst dstInstPst;
-
- for(idx = 0; idx < RG_MAX_SCELL_PER_UE ; idx++)
- {
- if(TRUE == ue->sCelInfo[idx].isSCellAdded)
- {
- dstMacInst = ue->sCelInfo[idx].macInst - RG_INST_START;
- lchCfgCb.cellId = ue->sCelInfo[idx].sCellId;
- lchCfgCb.crnti = lchRecfg->crnti;
- lchCfgCb.lcId = lchRecfg->lcId;
- lchCfgCb.ulLchRecfg.lcgId = lchRecfg->ulRecfg.lcgId;
-
- /* Get post structure of the cell to whom lchCfgCb needs to be sent
- * And then send the lch recfg based on Mac instances */
- rgGetPstToInst(&dstInstPst, inst, dstMacInst);
- RgPrgPMacSMacUeScellLchMod(&dstInstPst, &lchCfgCb);
- *isCfmRqrd = FALSE;
- }
- }
- return ROK;
-}
-
-/**
- * @brief A wrapper class to send the LCH config req from PMAC to SMAC
- *
- * @details
- *
- * Function : rgPomSndUeSCellLchAddToSmac
- *
- * Processing Steps:
- * - Checks if the Ue has any scell added.
- * - if SCells have been added ,then
- * send the lchCfgCb structure to update the same values to SMAC.
- * - Return ROK.
- * - Else return RFAILED.
- *
- * @param[in] Inst insg
- *
- * @param[in] RgCellCb *cell
- * @paran[in] RgUeCb *ue
- * @paran[in] CrgLchCfg *lchCfg
- * @paran[in] Bool *isCfmRqrd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgPomSndUeSCellLchAddToSmac
-(
-Inst inst,
-RgCellCb *cell,
-RgUeCb *ue,
-CrgLchCfg *lchCfg,
-Bool *isCfmRqrd
-)
-{
- uint8_t idx = 0;
- Inst dstMacInst;
- RgPrgUeSCellLchAddInfo lchCfgCb;
- Pst dstInstPst;
-
- for(idx = 0; idx < RG_MAX_SCELL_PER_UE ; idx++)
- {
- if(TRUE == ue->sCelInfo[idx].isSCellAdded)
- {
- dstMacInst = ue->sCelInfo[idx].macInst - RG_INST_START;
- lchCfgCb.cellId = ue->sCelInfo[idx].sCellId;
- lchCfgCb.crnti = lchCfg->crnti;
- lchCfgCb.lcId = lchCfg->lcId;
- lchCfgCb.lcType = lchCfg->lcType;
- lchCfgCb.dir = lchCfg->dir;
- lchCfgCb.dlInfo.dlTrchType = lchCfg->dlInfo.dlTrchType;
- lchCfgCb.ulInfo.ulTrchType = lchCfg->ulInfo.ulTrchType;
- lchCfgCb.ulInfo.lcgId = lchCfg->ulInfo.lcgId;
-#ifdef LTE_L2_MEAS
- lchCfgCb.qci = lchCfg->qci;
-#endif /* LTE_L2_MEAS */
-
- /* Get post structure of the cell to whom lchCfgCb needs to be sent
- * And then send the lch recfg based on Mac instances */
- rgGetPstToInst(&dstInstPst, inst, dstMacInst);
- RgPrgPMacSMacUeScellLchAdd(&dstInstPst, &lchCfgCb);
- *isCfmRqrd = FALSE;
- }
- }
- return ROK;
-} /* rgPomSndUeSCellLchAddToSmac */
-
-/**
- * @brief Handler for the Lch delete request from PMAC to SMAC.
- *
- * @details
- *
- * Function : RgPrgPMacSMacUeSCellLchDelReq
- *
- * Processing Steps:
- * - calls the function for validating cell, uecb and Lch sent by PMAC
- * - If successful, delete the logical channel
- * else Rollback and FAIL.
- *
- * @param[in] Pst *pst
- * @param[in] RgPrgUeSCellLchDelInfo *lchCfgCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgPrgPMacSMacUeSCellLchDelReq
-(
-Pst *pst,
-RgPrgUeSCellLchDelInfo *delLcCb
-)
-{
- RgPrgCfgCfmInfo cfgCfm;
- Inst inst = pst->dstInst;
- RgCellCb *cell;
- S16 ret;
- Pst cfmPst;
- RgUeCb *ue;
- RgUlLcCb *ulLc;
- RgDlLcCb *dlLc;
-
- RGDBGPRM(inst,(rgPBuf(inst),
- "APPLYING CRG UE SCELL CONFIG: cellId %d ueId %d\n",
- lchCfgCb->cellId, lchCfgCb->crnti));
-
- cfgCfm.ueId = delLcCb->crnti;
- cfgCfm.sCellId = delLcCb->cellId;
- cfgCfm.status = PRG_CFG_CFM_OK;
- cfgCfm.event = EVTPRGUESCELLLCHDELCFM;
- rgGetPstToInst(&cfmPst, inst, pst->srcInst);
-
- ret = rgPomVltdDelLch(inst,delLcCb, &cell, &ue,&ulLc,&dlLc);
- if(ret != ROK)
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d] SMAC SCell Lc Cfg failed:\
- cellId %d\n", delLcCb->crnti, delLcCb->cellId));
- /* Set status as Not OK*/
- cfgCfm.status = PRG_CFG_CFM_NOK;
- }
- else
- {
- ret = rgPomUeSCellLcDel(inst, delLcCb, ue, ulLc,dlLc);
- if(ret != ROK)
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d] SMac SCell lc cfg failed:\
- cellId %d\n", delLcCb->crnti, delLcCb->cellId));
- /* Set status as Not OK*/
- cfgCfm.status = PRG_CFG_CFM_NOK;
- }
- }
-
- RGDBGINFONEW(inst,(rgPBuf(inst), "[%d] Scell Lch Config done:\
- cellId %d\n", delLcCb->crnti, delLcCb->cellId));
-
- /* Send positive confirmation to primary cell*/
- RgPrgSMacPMacCfg(&cfmPst, &cfgCfm);
- return ROK;
-} /* RgPrgPMacSMacUeSCellLchDelReq */
-
-
-/**
- * @brief Handler for the Lch configuration request from PMAC to SMAC.
- *
- * @details
- *
- * Function : RgPrgPMacSMacUeSCellLchAddReq
- *
- * Processing Steps:
- * - calls the function for validating cell, uecb and Lch sent by PMAC
- * - Updates the lch recfg into ueCb.
- * - If successful, add the control block to hash list of UEs for the cell
- * else Rollback and FAIL.
- *
- * @param[in] Pst *pst
- * @param[in] RgPrgLchRecfgInfo *lchCfgCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgPrgPMacSMacUeSCellLchAddReq
-(
-Pst *pst,
-RgPrgUeSCellLchAddInfo *lchCfgCb
-)
-{
- RgPrgCfgCfmInfo cfgCfm;
- Inst inst = pst->dstInst;
- RgCellCb *cell;
- S16 ret;
- Pst cfmPst;
- RgUeCb *ue;
-
- RGDBGPRM(inst,(rgPBuf(inst),
- "APPLYING UE SCELL CONFIG AT SMAC : cellId %d ueId %d\n",
- lchCfgCb->cellId, lchCfgCb->crnti));
-
- cfgCfm.ueId = lchCfgCb->crnti;
- cfgCfm.sCellId = lchCfgCb->cellId;
- cfgCfm.status = PRG_CFG_CFM_OK;
- cfgCfm.event = EVTPRGUESCELLLCHADDCFM;
- rgGetPstToInst(&cfmPst, inst, pst->srcInst);
-
- ret = rgPomVldtAddLch(inst,lchCfgCb, &cell, &ue);
- if(ret != ROK)
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d] SMAC SCell Lc Cfg failed:\
- cellId %d\n", lchCfgCb->crnti, lchCfgCb->cellId));
- /* Set status as Not OK*/
- cfgCfm.status = PRG_CFG_CFM_NOK;
- }
- else
- {
- ret = rgPomUeSCellLcAdd(inst, cell, ue, lchCfgCb);
- if(ret != ROK)
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d] SMac SCell lc cfg failed:\
- cellId %d\n", lchCfgCb->crnti, lchCfgCb->cellId));
- /* Set status as Not OK*/
- cfgCfm.status = PRG_CFG_CFM_NOK;
- }
- }
-
- RGDBGINFONEW(inst,(rgPBuf(inst), "[%d] Scell Lch Config done:\
- cellId %d\n", lchCfgCb->crnti, lchCfgCb->cellId));
-
- /* Send positive confirmation to primary cell*/
- RgPrgSMacPMacCfg(&cfmPst, &cfgCfm);
- return ROK;
-} /* RgPrgPMacSMacUeSCellLchAddReq */
-/**
- * @brief Validates the logical channel configuration request from PMAC to SMAC.
- *
- * @details
- *
- * Function : rPommVldtAddLch
- *
- * Processing Steps:
- * - Validate the logical channel configuration request from PMAC to
- * SMAC : validate if configured values are within the range.
- * - If validated successfully,
- * - Return ROK and pointer to cell and UE for dedicated logical channels.
- * - Else
- * - Return RFAILED.
- *
- * @param[in] Inst inst
- * @param[in] RgPrgUeSCellLchAddInfo *lcCfg
- * @param[out] RgCellCb **cell
- * @param[out] RgUeCb **ue
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgPomVldtAddLch
-(
-Inst inst,
-RgPrgUeSCellLchAddInfo *lcCfg,
-RgCellCb **cell,
-RgUeCb **ue
-)
-{
-
- RGDBGPRM(inst,(rgPBuf(inst), "VALIDATE SMAC LC CONFIG: cellId %d ueId %d lcId %d\
- cell %p ue %p\n", lcCfg->cellId, lcCfg->crnti, lcCfg->lcId,
- (void*)*cell, (void*)*ue));
-
- if (lcCfg->lcType == CM_LTE_LCH_DTCH || lcCfg->lcType == CM_LTE_LCH_DCCH)
- {
- /* Dedicated logical channels */
- if ((rgPomVldtSCellDedLchCfg(inst,lcCfg, cell, ue)) != ROK)
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]UEID Validation for dedicated LC failed\n",
- lcCfg->crnti));
- return RFAILED;
- }
- }
- else
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]UEID Invalid logical channel type %d\n",\
- lcCfg->crnti, lcCfg->lcType));
- return RFAILED;
- }
-#ifdef LTE_L2_MEAS
- if ( lcCfg->qci < RG_QCI_MIN ||
- lcCfg->qci > RG_QCI_MAX
- )
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]UEID Invalid qci %x\n",
- lcCfg->crnti, lcCfg->qci));
- return RFAILED;
- }
- /*validate qci */
-#endif /*LTE_L2_MEAS */
-
- RGDBGINFONEW(inst,(rgPBuf(inst),"[%d]UEID CRG LCconfig validation done:cellId:%d lcId:%d\n",
- lcCfg->crnti, lcCfg->cellId, lcCfg->lcId));
- return ROK;
-}
-/**
- * @brief Handler for the logical channel configuration request from
- * PMAC to SMAC.
- *
- * @details
- *
- * Function : rgPomUeSCellLcAdd
- *
- * Processing Steps:
- * - Update the dedicated logical channel Cb with the configured values.
- * - If successful, return ROK else RFAILED.
- *
- * @param[in] Inst inst
- * @param[in] RgCellCb *cell
- * @param[in] RgUeCb *ue
- * @param[in] CrgLchCfg *lcCfg
- * @param[out] RgErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgPomUeSCellLcAdd
-(
-Inst inst,
-RgCellCb *cell,
-RgUeCb *ue,
-RgPrgUeSCellLchAddInfo *lcCfg
-)
-{
-
- RGDBGPRM(inst,(rgPBuf(inst), "APPLYING CRG LC CONFIG: cellId %d ueId %d\
- lcId %d dir %d cell %p ue %p\n", lcCfg->cellId, lcCfg->crnti,
- lcCfg->lcId, lcCfg->dir, (void*)cell, (void*)ue));
-
- if ((rgPomUeSCellDedLcCfg(cell, ue, lcCfg)) != ROK)
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]Dedicated logical channel configuration"
- "failed in SCell%d\n", lcCfg->crnti, lcCfg->lcId));
- return RFAILED;
- }
-
- RGDBGINFONEW(inst,(rgPBuf(inst), "[%d]SCell LC config done: cellId %d lcId %d\n",
- lcCfg->crnti, lcCfg->cellId, lcCfg->lcId));
- return ROK;
-} /* rgPomUeSCellLcAdd */
-
-/***********************************************************
- *
- * Func : rgPomVldtSCellDedLchCfg
- *
- *
- * Desc : Validates dedicated logical channel configuration received from PMAC.
- *
- * @param[in] Inst inst
- * @param[in] RgPrgUeScellLchAddInfo *lcCfg
- * @param[in] RgCellCb **cell
- * @param[in] RgUeCb **ue
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgPomVldtSCellDedLchCfg
-(
-Inst inst,
-RgPrgUeSCellLchAddInfo *lcCfg,
-RgCellCb **cell,
-RgUeCb **ue
-)
-{
- RGDBGPRM(inst,(rgPBuf(inst), "VALIDATING CRG DEDICATED LC CONFIG \n"));
-
-
- /* Fetch the Active cell */
- if (((*cell = rgCb[inst].cell) == NULLP)
- || ((*cell)->cellId != lcCfg->cellId))
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]Active Cell does not exist: Cell %d\n",
- lcCfg->crnti, lcCfg->cellId));
- return RFAILED;
- }
-
- /* Fetch the Ue */
- if ((*ue = rgDBMGetUeCb(*cell, lcCfg->crnti)) == NULLP)
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]UE does not exist for dedicated logical"
- "channel %d\n", lcCfg->crnti, lcCfg->lcId));
- return RFAILED;
- }
-
- /* Validate logical channel Id */
- /*if ((lcCfg->lcId < RG_DEDLC_MIN_LCID)
- ||(lcCfg->lcId > RG_DEDLC_MAX_LCID))
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]Invalid logical channel Id %d\n",
- lcCfg->crnti, lcCfg->lcId));
- return RFAILED;
- }*/
- /* Validate downlink info */
- if (lcCfg->dir & PRG_DIR_TX)
- {
- if (rgDBMGetDlDedLcCb((*ue), lcCfg->lcId) != NULLP)
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]UE: Dedicated DL LC %d already configured\n",
- lcCfg->crnti, lcCfg->lcId));
- return RFAILED;
- }
-/* dirVld = TRUE;*/
- }
-
- /* Validate uplink info */
- if (lcCfg->dir & PRG_DIR_RX)
- {
- if (lcCfg->ulInfo.lcgId > (RG_MAX_LCG_PER_UE - 1))
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]UE: Invalid lcgId for uplink logical"
- "channel %d\n", lcCfg->crnti, lcCfg->ulInfo.lcgId));
- return RFAILED;
- }
- if (rgDBMGetUlDedLcCb((*ue), lcCfg->lcId) != NULLP)
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]UE: Dedicated UL LC %d already configured\n",
- lcCfg->crnti, lcCfg->lcId));
- return RFAILED;
- }
-/* dirVld = TRUE;*/
- }
-/*
- if (!dirVld)
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]Invalid Direction %d \n",
- lcCfg->crnti, lcCfg->dir));
- return RFAILED;
- }
-*/
- RGDBGINFONEW(inst,(rgPBuf(inst), "[%d]Dedicated logical channel %d validated"
- "for cell %d\n", lcCfg->crnti, lcCfg->lcId, lcCfg->cellId));
- return ROK;
-} /* rgPomVldtSCellDedLchCfg */
-/***********************************************************
- *
- * Func : rgPomUeSCellDedLcCfg
- *
- *
- * Desc : Validates dedicated logical channel configuration received from PMAC.
- *
- * @param[in] RgCellCb *cell
- * @param[in] RgUeCb *ue
- * @param[in] RgPrgUeSCellLchAddInfo *lcCfg
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgPomUeSCellDedLcCfg
-(
-RgCellCb *cell,
-RgUeCb *ue,
-RgPrgUeSCellLchAddInfo *lcCfg
-)
-{
- //Inst inst = cell->macInst - RG_INST_START;
- //RGDBGPRM(inst,(rgPBuf(inst), "APPLYING DEDICATED LC CONFIG\n"));
-
- /* Uplink/Bi-directional logical channel */
- if (lcCfg->dir & PRG_DIR_RX)
- {
-#ifdef LTE_L2_MEAS
- rgDBMInsUlDedLcCb(ue, lcCfg->lcId, lcCfg->ulInfo.lcgId, lcCfg->qci);
- cell->qciArray[lcCfg->qci].qci = lcCfg->qci;
- if(lcCfg->lcType == CM_LTE_LCH_DTCH)
- {
- rgAddToL2MeasPerQci(cell,lcCfg->qci);/*LTE_L2_MEAS_PHASE2*/
- }
-#else
- rgDBMInsUlDedLcCb(ue, lcCfg->lcId, lcCfg->ulInfo.lcgId);
-#endif
- }
-
- /* Downlink/Bi-directional logical channel */
- if (lcCfg->dir & PRG_DIR_TX)
- {
- rgDBMInsDlDedLcCb(ue, lcCfg->lcId);
- }
- RGDBGINFO(inst,(rgPBuf(inst), "Dedicated LC config done\n"));
- return ROK;
-
- } /* rgPomUeSCellDedLcCfg */
-/**
- * @brief Function to validate SCellLchReCfg.
- *
- * @details
- *
- * Function : rgPomVltdModLch
- *
- *
- * @param[in] inst instance number to fetch rgCb instance
- * @param[in] lchCfg Cb lchCfg CB for validation
- * @param[out] cell cell control block
- * @param[out] RgCellCb **cell
- * @param[out] RgUeCb **ue
- * @param[out] RgUlLcCb **ulLc
- * @return S16
- * -# ROK
- **/
-S16 rgPomVltdModLch
-(
-Inst inst,
-RgPrgUeSCellLchModInfo *lchCfgCb,
-RgCellCb **cell,
-RgUeCb **ue,
-RgUlLcCb **ulLc
-)
-{
- RGDBGPRM(inst,(rgPBuf(inst), "VALIDATE SMAC LC RECONFIG: cellId %d ueId %d \
- lcId %d cell %p ue %p ulLc %p\n",lchCfgCb->cellId,
- lchCfgCb->crnti,lchCfgCb->lcId, (void*)*cell, (void*)*ue,
- (void*)*ulLc));
- /* Fetch the cell */
- if ((((*cell = rgCb[inst].cell)) == NULLP)
- || ((*cell)->cellId != lchCfgCb->cellId))
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]Active Cell does not exist %d\n",lchCfgCb->crnti, lchCfgCb->cellId));
- return RFAILED;
- }
- /* Fetch the Ue for dedicated channels */
- if ((*ue = rgDBMGetUeCb(*cell, lchCfgCb->crnti)) == NULLP)
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]Ue does not exist for dedicated logical channel\n",
- lchCfgCb->crnti));
- return RFAILED;
- }
- if ((*ulLc = rgDBMGetUlDedLcCb((*ue), lchCfgCb->lcId)) == NULLP)
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]Dedicated UL LC does not exist %d\n",
- lchCfgCb->crnti, lchCfgCb->lcId));
- return RFAILED;
- }
- /* if (lchCfgCb->ulLchRecfg.lcgId > (RG_MAX_LCG_PER_UE - 1))
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]Invalid lcgId for uplink logical channel: lcg %d"
- "lc %d\n",lchCfgCb->crnti, lchCfgCb->ulLchRecfg.lcgId, lchCfgCb->lcId));
- return RFAILED;
- }*/
- return ROK;
-} /*rgPomVltdModLch*/
-/**
- * @brief Handler for the logical channel re-configuration request from
- * PMAC to SMAC.
- *
- * @details
- *
- * Function : rgPomUeSCellLcMod
- *
- * Processing Steps:
- * - Update the dedicated logical channel Cb with the re-configured
- * values.
- * - If successful, return ROK else RFAILED.
- *
- * @param[in] Inst inst
- * @param[in] RgUlUeCb *ue
- * @param[in] RgUlLcCb *ulLc
- * @param[in] RgPrgLchRecfgInfo *lchCfgCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgPomUeSCellLcMod
-(
-Inst inst,
-RgUeCb *ue,
-RgUlLcCb *ulLc,
-RgPrgUeSCellLchModInfo *lchCfgCb
-)
-{
- RGDBGPRM(inst,(rgPBuf(inst), "APPLYING SMAC LC RECONFIG: cellId %d ueId %d\
- lcId %d \n",
- lchCfgCb->cellId, lchCfgCb->crnti, lchCfgCb->lcId));
-
- if (ulLc->lcgId != lchCfgCb->ulLchRecfg.lcgId)
- {
- rgDBMUpdUlDedLcCb(ue, ulLc, lchCfgCb->ulLchRecfg.lcgId);
- }
-
- RGDBGINFO(inst,(rgPBuf(inst), "LC %d of Ue %d of cell %d Reconfigured\n",
- lchCfgCb->lcId, ue->ueId, cell->cellId));
- return ROK;
-} /* rgPomUeSCellLcMod */
-/**
- * @brief Function to validate SCellLchDel.
- *
- * @details
- *
- * Function : rgPomVltdDelLch
- *
- *
- * @param[in] inst instance number to fetch rgCb instance
- * @param[in] lchCfg Cb lchCfg CB for validation
- * @param[out] cell cell control block
- * @param[out] RgCellCb **cell
- * @param[out] RgUeCb **ue
- * @param[out] RgUlLcCb **ulLc
- * @return S16
- * -# ROK
- **/
-S16 rgPomVltdDelLch
-(
-Inst inst,
-RgPrgUeSCellLchDelInfo *delLcCb,
-RgCellCb **cell,
-RgUeCb **ue,
-RgUlLcCb **ulLc,
-RgDlLcCb **dlLc
-)
-{
- RGDBGPRM(inst,(rgPBuf(inst), "VALIDATE SMAC LC RECONFIG: cellId %d ueId %d \
- lcId %d cell %p ue %p ulLc %p\n",delLcCb->cellId,
- delLcCb->crnti,delLcCb->lcId, (void*)*cell, (void*)*ue,
- (void*)*ulLc));
- /* Fetch the cell */
- if ((((*cell = rgCb[inst].cell)) == NULLP)
- || ((*cell)->cellId != delLcCb->cellId))
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]Active Cell does not exist %d\n",delLcCb->crnti, delLcCb->cellId));
- return RFAILED;
- }
- /* Fetch the Ue for dedicated channels */
- if ((*ue = rgDBMGetUeCb(*cell, delLcCb->crnti)) == NULLP)
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]Ue does not exist for dedicated logical channel\n",
- delLcCb->crnti));
- return RFAILED;
- }
- if ((*ulLc = rgDBMGetUlDedLcCb((*ue), delLcCb->lcId)) == NULLP)
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]Dedicated UL LC does not exist %d\n",
- delLcCb->crnti, delLcCb->lcId));
- return RFAILED;
- }
- if ((*dlLc = rgDBMGetDlDedLcCb((*ue), delLcCb->lcId)) == NULLP)
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]DL LC %d does not exist\n",
- delLcCb->crnti, delLcCb->lcId));
- return RFAILED;
- }
- return ROK;
-} /*rgPomVltdDelLch*/
-/**
- * @brief Handler for the logical channel delete request from
- * PMAC to SMAC.
- *
- * @details
- *
- * Function : rgPomUeSCellLcDel
- *
- * Processing Steps:
- * - Fetch the logical channel control block.
- * - Free the logical channel control block.
- * - If successful, return ROK else return RFAILED.
- *
- * @param[in] Inst inst
- * @param[in] RgPrgUeSCellLchDelInfo *delLcCb
- * @param[in] RgUeCb *ue
- * @param[in] RgUlLcCb *ulLc
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgPomUeSCellLcDel
-(
-Inst inst,
-RgPrgUeSCellLchDelInfo *delLcCb,
-RgUeCb *ue,
-RgUlLcCb *ulLc,
-RgDlLcCb *dlLc
-)
-{
-
- RGDBGPRM(inst,(rgPBuf(inst), "APPLYING CRG LC DELETE: cellId %d ueId %d\
- lcId %d dir %d\n", delLcCb->cellId,
- delLcCb->crnti, delLcCb->lcId,
- delLcCb->dir));
-
-
- /* Validate downlink info */
- if (delLcCb->dir & PRG_DIR_TX)
- {
- rgDBMDelDlDedLcCb(ue, dlLc);
-/* dirVld = TRUE;*/
- }
-
- /* Validate uplink info */
- if (delLcCb->dir & PRG_DIR_RX)
- {
- rgDBMDelUlDedLcCb(ue, ulLc);
-/* dirVld = TRUE;*/
- }
-
- /*if (!dirVld)
- {
- RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]Invalid direction %d for LC Delete\n",
- delLcCb->crnti, delLcCb->dir));
- return RFAILED;
- }*/
- RGDBGINFONEW(inst,(rgPBuf(inst), "[%d]UE's Logical channel %d deleted from cell %d\n",
- delLcCb->crnti, delLcCb->lcId,
- delLcCb->cellId));
- return ROK;
-} /* rgPomUeSCellLcDel */
-#endif /*LTE_ADV */
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/* *****************************************************************************
- Name: LTE-MAC layer
-
- Type: C Include File
-
- Desc: Structures, variables, and typedefs required by Secondary cell
- received through PRG interface.
-
- File: rg_pom_scell.x
-
-**********************************************************************/
-/**
- @file rg_pom_scell.x
- @brief Structure declarations and definitions for Secondary cell received from (PRG) interface.
- */
-
-#ifndef __RGPOMSCELL_X__
-#define __RGPOMSCELL_X__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef LTE_ADV
-S16 RgPrgPMacSMacUeSCellLchModReq ARGS
-((
- Pst *pst,
- RgPrgUeSCellLchModInfo *lchCfgCb
-));
-S16 RgPrgPMacSMacUeSCellLchAddReq ARGS
-((
- Pst *pst,
- RgPrgUeSCellLchAddInfo *lchCfgCb
-));
-S16 RgPrgPMacSMacUeSCellLchDelReq ARGS
-((
- Pst *pst,
- RgPrgUeSCellLchDelInfo *delLcCb
-));
-S16 rgPomSndUeSCellLchDelToSmac ARGS((Inst inst,CrgDel *lcDel,
- Bool *isCfmRqrd));
-S16 rgPomSndUeSCellLchAddToSmac ARGS((Inst inst,RgCellCb *cell,
- RgUeCb *ue,CrgLchCfg *lchCfg,
- Bool *isCfmRqrd));
-S16 rgPomSndUeSCellLchModToSmac ARGS((Inst inst,RgCellCb *cell,
- RgUeCb *ue,CrgLchRecfg *lchRecfg,
- Bool *isCfmRqrd));
-S16 rgPomVldtAddLch ARGS((Inst inst,
- RgPrgUeSCellLchAddInfo *lcCfg,
- RgCellCb **cell,
- RgUeCb **ue
- ));
-S16 rgPomUeSCellLcAdd ARGS((Inst inst,
- RgCellCb *cell,
- RgUeCb *ue,
- RgPrgUeSCellLchAddInfo *lcCfg
- ));
-S16 rgPomVltdModLch ARGS ((Inst inst,
- RgPrgUeSCellLchModInfo *lchCfgCb,
- RgCellCb **cell,
- RgUeCb **ue,
- RgUlLcCb **ulLc
- ));
-S16 rgPomUeSCellLcMod ARGS((Inst inst,
- RgUeCb *ue,
- RgUlLcCb *ulLc,
- RgPrgUeSCellLchModInfo *lchCfgCb
- ));
-S16 rgPomUeSCellLcDel ARGS((Inst inst,
- RgPrgUeSCellLchDelInfo *delLcCb,
- RgUeCb *ue,
- RgUlLcCb *ulLc,
- RgDlLcCb *dlLc
- ));
-S16 rgPomVltdDelLch ARGS ((Inst inst,
- RgPrgUeSCellLchDelInfo *delLcCb,
- RgCellCb **cell,
- RgUeCb **ue,
- RgUlLcCb **ulLc,
- RgDlLcCb **dlLc
- ));
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __RGPRG_X__*/
-
-/**********************************************************************
-
- End of file: rg_pom_scell.x
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for packing/unpacking of MAC to MAC interface
- primitives.
-
- File: rg_prg.c
-
-**********************************************************************/
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "lrg.h"
-#include "crg.h"
-#include "rgu.h"
-#include "tfu.h"
-#include "rg_sch_inf.h"
-#include "rg_prg.h"
-#include "rg_env.h"
-#include "rg.h"
-#include "rg_err.h"
-
-/* header/extern include files (.x) */
-#include "rgu.x" /* RGU types */
-#include "tfu.x" /* RGU types */
-#include "lrg.x" /* layer management typedefs for MAC */
-#include "crg.x" /* layer management typedefs for MAC */
-#include "rg_sch_inf.x" /* layer management typedefs for MAC */
-#include "rg_prg.x" /* Prg(MAC-MAC)interface includes */
-#include "du_app_mac_inf.h"
-#include "rg.x" /* typedefs for MAC */
-
-#ifdef LTE_ADV
-#ifdef LCPRG
-/**
- * @brief Ue SCell Cfg Req from PMac to SMac.
- * @details This primitive is used for light-weight loose coupling.
- *
- * @details
- *
- * Function : cmPkPrgPMacSMacUeSCellCfgReq
- *
- * @param[in] Pst* pst
- * @param[in] RgPrgUeSCellCfgInfo *ueSCellCfgInfo
- * @return S16
- * -# ROK
- **/
-S16 cmPkPrgPMacSMacUeSCellCfgReq(Pst *pst,RgPrgUeSCellCfgInfo *ueSCellCfgInfo)
-{
- Buffer *mBuf = NULLP;
-
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
- {
- return RFAILED;
- }
-
- if(SAddPstMsgMult((Data *)ueSCellCfgInfo, sizeof(RgPrgUeSCellCfgInfo),\
- mBuf) != ROK)
- {
- RGPRG_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTPRGUESCELLCFGREQ;
- return (SPstTsk(pst,mBuf));
-}
-
-/**
- * @brief Ue SCell Cfg Req from PMac to SMac.
- * @details This primitive is used for light-weight loose coupling.
- *
- * @details
- *
- * Function : cmUnpkPrgPMacSMacUeSCellCfgReq
- *
- * @param[in] Pst* pst
- * @param[in] RgPrgUeSCellCfgInfo *ueSCellCfgInfo
- * @return S16
- * -# ROK
- **/
-S16 cmUnpkPrgPMacSMacUeSCellCfgReq(RgPrgUeSCellCfgReq func,Pst *pst,Buffer *mBuf)
-{
- RgPrgUeSCellCfgInfo ueSCellCfgInfo;
-
- if(SRemPreMsgMult((Data *)&ueSCellCfgInfo, sizeof(RgPrgUeSCellCfgInfo), mBuf) != ROK)
- {
- RGPRG_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- RGPRG_FREE_MSG(mBuf);
- return ((*func)(pst, &ueSCellCfgInfo));
-}
-
-/**
- * @brief Config confirm for Ue SCell config Req.
- * @details This primitive is used for light-weight loose coupling.
- *
- * @details
- *
- * Function : cmPkPrgSMacPMacCfgCfm
- *
- * @param[in] Pst *pst
- * @param[in] RgPrgCfgCfmInfo *cfgCfm
- * @return S16
- * -# ROK
- **/
-S16 cmPkPrgSMacPMacCfgCfm(Pst *pst,RgPrgCfgCfmInfo *cfgCfm)
-{
- Buffer *mBuf = NULLP;
-
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
- {
- return RFAILED;
- }
-
- if(SAddPstMsgMult((Data *)cfgCfm, sizeof(RgPrgCfgCfmInfo), mBuf) != ROK)
- {
- RGPRG_FREE_MSG(mBuf);
- return RFAILED;
- }
- switch(cfgCfm->event)
- {
- case EVTPRGUESCELLLCHMODCFM : /*cfm for Lch recfg */
- {
- pst->event = (Event) EVTPRGUESCELLLCHMODCFM;
- }
- break;
- case EVTPRGUESCELLCFGCFM : /*cfm for Adding Scell */
- {
- pst->event = (Event) EVTPRGUESCELLCFGCFM;
- }
- break;
- case EVTPRGUESCELLLCHDELCFM : /* cfm for deleting Lch */
- {
- pst->event = (Event) EVTPRGUESCELLLCHDELCFM;
- }
- break;
- case EVTPRGUESCELLLCHADDCFM: /* cfm for adding of LCh */
- {
- pst->event = (Event) EVTPRGUESCELLLCHADDCFM;
- }
- break;
- }
- return (SPstTsk(pst,mBuf));
-}
-
-/**
- * @brief Config confirm for SCell addd Req.
- * @details This primitive is used for light-weight loose coupling.
- *
- * @details
- *
- * Function : cmUnpkPrgSMacPMacCfgCfm
- *
- * @param[in] CfgCfm fun
- * @param[in] Pst* pst
- * @param[in] RgPrgCfgCfmInfo *cfgCfm
- * @return S16
- * -# ROK
- **/
-S16 cmUnpkPrgSMacPMacCfgCfm
-(
-RgSMacPMacCfgCfm func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- RgPrgCfgCfmInfo cfgCfm;
-
- if(SRemPreMsgMult((Data *)&cfgCfm, sizeof(RgPrgCfgCfmInfo), mBuf) != ROK)
- {
- RGPRG_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- RGPRG_FREE_MSG(mBuf);
- return ((*func)(pst, &cfgCfm));
-}
-
-/**
- * @brief SCell Ue Delete Req/UeId change req from PMac to SMac.
- * @details This primitive is used for light-weight loose coupling.
- *
- * @details
- *
- * Function : cmPkPrgPMacSMacUeSCellDelReq
- *
- * @param[in] Pst *pst
- * @param[in] RgPrgUeSCellDelInfo *ueSCellDelInfo
- * @return S16
- * -# ROK
- **/
-S16 cmPkPrgPMacSMacUeSCellDelReq(Pst *pst,RgPrgUeSCellDelInfo *ueSCellDelInfo)
-{
- Buffer *mBuf = NULLP;
-
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
- {
- return RFAILED;
- }
-
- if(SAddPstMsgMult((Data *)ueSCellDelInfo, sizeof(RgPrgUeSCellDelInfo), mBuf)\
- != ROK)
- {
- RGPRG_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTPRGUESCELLDELREQ;
- return (SPstTsk(pst,mBuf));
-}
-
-/**
- * @brief Unpacking for SCell UE delete/Ue Id Change Req to SMAC.
- * @details This primitive is used for light-weight loose coupling.
- *
- * @details
- *
- * Function : cmUnpkPrgPMacSMacUeSCellDelReq
- *
- * @param[in] CfgCfm fun
- * @param[in] Pst* pst
- * @param[in] Buffer *mBuf
- * @return S16
- * -# ROK
- **/
-S16 cmUnpkPrgPMacSMacUeSCellDelReq
-(
-RgUeSCellDelReq func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- RgPrgUeSCellDelInfo ueSCellDelInfo;
-
- if(SRemPreMsgMult((Data *)&ueSCellDelInfo, sizeof(RgPrgUeSCellDelInfo),\
- mBuf) != ROK)
- {
- RGPRG_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- RGPRG_FREE_MSG(mBuf);
- return ((*func)(pst, &ueSCellDelInfo));
-}
-
-/**
- * @brief Ue Lch Addition Req from PMac to SMac.
- * @details This primitive is used for light-weight loose coupling.
- *
- * @details
- *
- * Function : cmPkPrgPMacSMacUeSCellLchAddReq
- *
- * @param[in] Pst* pst
- * @param[in] RgPrgUeSCellLchAddInfo *lchCfgInfo
- * @return S16
- * -# ROK
- **/
-S16 cmPkPrgPMacSMacUeSCellLchAddReq(Pst *pst,RgPrgUeSCellLchAddInfo *lchCfgInfo)
-{
- Buffer *mBuf = NULLP;
-
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
- {
- return RFAILED;
- }
-
- if(SAddPstMsgMult((Data *)lchCfgInfo, sizeof(RgPrgUeSCellLchAddInfo),\
- mBuf) != ROK)
- {
- RGPRG_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTPRGUESCELLLCHADDREQ;
- return (SPstTsk(pst,mBuf));
-}
-
-/**
- * @brief LCH Addition Req from PMac to SMac.
- * @details This primitive is used for light-weight loose coupling.
- *
- * @details
- *
- * Function : cmUnpkPrgPMacSMacUeSCellLchAddReq
- *
- * @param[in] Pst* pst
- * @param[in] RgPrgUeSCellLchAddInfo *lchCfgInfo
- * @param[in]Buffer *mBuf
- * @return S16
- * -# ROK
- **/
-S16 cmUnpkPrgPMacSMacUeSCellLchAddReq
-(
-RgPrgUeSCellLchAddInfo func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- RgPrgLchRecfgInfo lchCfgInfo;
-
- if(SRemPreMsgMult((Data *)&lchCfgInfo, sizeof(RgPrgUeSCellLchAddInfo), mBuf) != ROK)
- {
- RGPRG_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- RGPRG_FREE_MSG(mBuf);
- return ((*func)(pst, &lchCfgInfo));
-}
-
-/**
- * @brief Ue SCell Delete Req from PMac to SMac.
- * @details This primitive is used for light-weight loose coupling.
- *
- * @details
- *
- * Function : cmPkPrgPMacSMacUeSCellLchDelReq
- *
- * @param[in] Pst *pst
- * @param[in] RgPrgUeSCellLchDelInfo *delLcCb
- * @return S16
- * -# ROK
- **/
-S16 cmPkPrgPMacSMacUeSCellLchDelReq(Pst *pst,RgPrgUeSCellLchDelInfo *delLcCb)
-{
- Buffer *mBuf = NULLP;
-
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
- {
- return RFAILED;
- }
-
- if(SAddPstMsgMult((Data *)delLcCb, sizeof(RgPrgUeSCellLchDelInfo),\
- mBuf) != ROK)
- {
- RGPRG_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTPRGUESCELLLCHDELREQ;
- return (SPstTsk(pst,mBuf));
-}
-
-
-/**
- * @brief Ue Lch reCfg Req from PMac to SMac.
- * @details This primitive is used for light-weight loose coupling.
- *
- * @details
- *
- * Function : cmPkPrgPMacSMacUeSCellLchModReq
- *
- * @param[in] Pst *pst
- * @param[in] RgPrgUeSCellLchModInfo *lchCfgInfo
- * @return S16
- * -# ROK
- **/
-S16 cmPkPrgPMacSMacUeSCellLchModReq(Pst *pst,RgPrgUeSCellLchModInfo *lchCfgInfo)
-{
- Buffer *mBuf = NULLP;
-
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
- {
- return RFAILED;
- }
-
- if(SAddPstMsgMult((Data *)lchCfgInfo, sizeof(RgPrgUeSCellLchModInfo),\
- mBuf) != ROK)
- {
- RGPRG_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTPRGUESCELLLCHMODREQ;
- return (SPstTsk(pst,mBuf));
-}
-
-
-/**
- * @brief LCH Cfg Req from PMac to SMac.
- * @details This primitive is used for light-weight loose coupling.
- *
- * @details
- *
- * Function : cmUnpkPrgPMacSMacUeSCellLchModReq
- *
- * @param[in] Pst* pst
- * @param[in] RgPrgLchRecfgInfo *lchCfgInfo
- * @param[in] Buffer *mBuf
- * @return S16
- * -# ROK
- **/
-S16 cmUnpkPrgPMacSMacUeSCellLchModReq
-(
-RgPrgUeScellModLchReq func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- RgPrgUeSCellLchModInfo lchCfgInfo;
-
- if(SRemPreMsgMult((Data *)&lchCfgInfo, sizeof(RgPrgUeSCellLchModInfo), mBuf) != ROK)
- {
- RGPRG_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- RGPRG_FREE_MSG(mBuf);
- return ((*func)(pst, &lchCfgInfo));
-}
-
-
-/**
- * @brief LCH Del Req from PMac to SMac.
- * @details This primitive is used for light-weight loose coupling.
- *
- * @details
- *
- * Function : cmUnpkPrgPMacSMacUeSCellLchDelReq
- *
- * @param[in] Pst* pst
- * @param[in] RgPrgUeScellDelLchReq func;
- * @param[in] Buffer *mBuf;
- * @return S16
- * -# ROK
- **/
-S16 cmUnpkPrgPMacSMacUeSCellLchDelReq
-(
-RgPrgUeScellDelLchReq func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- RgPrgUeSCellLchDelInfo lchCfgInfo;
-
- if(SRemPreMsgMult((Data *)&lchCfgInfo, sizeof(RgPrgUeSCellLchDelInfo), mBuf) != ROK)
- {
- RGPRG_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- RGPRG_FREE_MSG(mBuf);
- return ((*func)(pst, &lchCfgInfo));
-}
-
-#endif /*LCPRG*/
-#endif /*LTE_ADV*/
-
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for MAC to MAC (PRG) interface
-
- File: rg_prg_pt.c
-
-**********************************************************************/
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "lrg.h" /* layer manager for MAC */
-#include "crg.h" /* CRG interface includes*/
-#include "rgu.h" /* RGU interface includes*/
-#include "tfu.h" /* TFU interface includes*/
-#include "rg_sch_inf.h" /* SCH interface includes*/
-#include "rg_prg.h" /* PRG interface includes*/
-#include "rg_env.h" /* MAC Enviroments includes */
-#include "rg.h" /* MAC includes*/
-#include "rg_err.h" /* MAC error includes*/
-
-/* header/extern include files (.x) */
-#include "rgu.x" /* RGU types */
-#include "tfu.x" /* RGU types */
-#include "lrg.x" /* layer management typedefs for MAC */
-#include "crg.x" /* layer management typedefs for MAC */
-#include "rg_sch_inf.x" /* layer management typedefs for MAC */
-#include "rg_prg.x" /* PRG interface typedefs*/
-#include "du_app_mac_inf.h"
-#include "rg.x" /* typedefs for MAC */
-
-#ifdef LTE_ADV
-#include "rg_pom_scell.x"
-
-/* Matrix for Ue SCell Config Req*/
-static const RgPrgUeSCellCfgReq RgPrgPMacSMacUeSCellCfgReqMt[RG_PRG_MAX] =
-{
-#ifdef LCPRG
- cmPkPrgPMacSMacUeSCellCfgReq,
-#else
- RgPrgPMacSMacUeSCellCfgReq
-#endif
-};
-
-/**
-* @brief Ue SCell config Req from PMac to SMac
-*
-* @details
-*
-* Function : RgPrgPMacSMacUeSCellCfg
-*
-* @param[in] Pst *pst
-* @param[in] RgPrgUeSCellCfgInfo *ueSCellCfgInfo;
-* @return S16
-* -# ROK
-**/
-S16 RgPrgPMacSMacUeSCellCfg(Pst *pst, RgPrgUeSCellCfgInfo *ueSCellCfgInfo)
-{
-
- return ((*RgPrgPMacSMacUeSCellCfgReqMt[0])(pst, ueSCellCfgInfo));
-}
-
-/* Matrix for config confirm from SMac to Pmac*/
-static const RgSMacPMacCfgCfm RgPrgSMacPMacCfgCfmMt[RG_PRG_MAX] =
-{
-#ifdef LCPRG
- cmPkPrgSMacPMacCfgCfm,
-#else
- RgPrgSMacPMacCfgCfm
-#endif
-};
-
-/**
-* @brief Config confirm from SMac to PMac for Ue Cell Config Req
-*
-* @details
-*
-* Function :RgPrgSMacPMacCfg
-*
-* @param[in] Pst *pst
-* @param[in] RgPrgCfgCfmInfo *cfmCfm
-* @return S16
-* -# ROK
-**/
-S16 RgPrgSMacPMacCfg(Pst *pst,RgPrgCfgCfmInfo *cfgCfm)
-{
-
- return ((*RgPrgSMacPMacCfgCfmMt[0])(pst, cfgCfm));
-}
-
-/* Matrix for Ue SCell delete req/Ue Id change req from PMac to SMac */
-static const RgUeSCellDelReq RgPrgPMacSMacUeSCellDelReqMt[RG_PRG_MAX] =
-{
-#ifdef LCPRG
- cmPkPrgPMacSMacUeSCellDelReq,
-#else
- RgPrgPMacSMacUeSCellDelReq
-#endif
-};
-
-/**
-* @brief Ue SCell delete Req/Ue Id change Req from PMac to SMac
-*
-* @details
-*
-* Function : RgPrgPMacSMacUeSCellDel
-*
-* @param[in] Pst *pst
-* @param[in] RgPrgUeSCellDelInfo *ueSCellDelInfo;
-* @return S16
-* -# ROK
-**/
-S16 RgPrgPMacSMacUeSCellDel(Pst *pst,RgPrgUeSCellDelInfo *ueSCellDelInfo)
-{
-
- return ((*RgPrgPMacSMacUeSCellDelReqMt[0])(pst, ueSCellDelInfo));
-}
-
-
-
-/* Matrix for Lch ReConfig Req*/
-static const RgPrgUeScellModLchReq RgPrgPMacSMacUeScellModLchReqMt[RG_PRG_MAX] =
-{
-#ifdef LCPRG
- cmPkPrgPMacSMacUeSCellLchModReq,
-#else
- RgPrgPMacSMacUeSCellLchModReq
-#endif
-};
-
-
-/**
-* @brief Ue Lch Reconfig Req from PMac to SMac
-*
-* @details
-*
-* Function : RgPrgPMacSMacUeScellLchMod
-*
-* @param[in] Pst *pst
-* @param[in] RgPrgUeSCellLchModInfo *lchCfgInfo
-* @return S16
-* -# ROK
-**/
-S16 RgPrgPMacSMacUeScellLchMod(Pst *pst,RgPrgUeSCellLchModInfo *lchCfgInfo)
-{
-
- return ((*RgPrgPMacSMacUeScellModLchReqMt[0])(pst, lchCfgInfo));
-}
-
-
-/* Matrix for delete Lch Req*/
-static const RgPrgUeScellDelLchReq RgPrgPMacSMacUeScellDelLchReqMt[RG_PRG_MAX] =
-{
-#ifdef LCPRG
- cmPkPrgPMacSMacUeSCellLchDelReq,
-#else
- RgPrgPMacSMacUeSCellLchDelReq
-#endif
-};
-
-
-/**
-* @brief Delete Lch Req from PMac to SMac
-*
-* @details
-*
-* Function : RgPrgPMacSMacUeScellLchDel
-*
-* @param[in] Pst *pst
-* @param[in] RgPrgUeSCellLchDelInfo *delLcCb
-* @return S16
-* -# ROK
-**/
-S16 RgPrgPMacSMacUeScellLchDel(Pst *pst,RgPrgUeSCellLchDelInfo *delLcCb)
-{
-
- return ((*RgPrgPMacSMacUeScellDelLchReqMt[0])(pst, delLcCb));
-}
-
-
-/* Matrix for Lch Config Req*/
-static const RgPrgUeScellAddLchReq RgPrgPMacSMacUeScellAddLchReqMt[RG_PRG_MAX] =
-{
-#ifdef LCPRG
- cmPkPrgPMacSMacUeSCellLchAddReq,
-#else
- RgPrgPMacSMacUeSCellLchAddReq
-#endif
-};
-
-
-/**
-* @brief Ue Lch config Req from PMac to SMac
-*
-* @details
-*
-* Function : RgPrgPMacSMacUeScellLchAdd
-*
-* @param[in] Pst *pst
-* @param[in] RgPrgUeSCellLchAddInfo *lchCfgInfo
-* @return S16
-* -# ROK
-**/
-S16 RgPrgPMacSMacUeScellLchAdd(Pst *pst,RgPrgUeSCellLchAddInfo *lchCfgInfo)
-{
-
- return ((*RgPrgPMacSMacUeScellAddLchReqMt[0])(pst, lchCfgInfo));
-}
-
-#endif /* LTE_ADV */
-
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Entry point fucntions
-
- File: rg_ptli.c
-
-**********************************************************************/
-
-/** @file rg_dhm.c
-@brief APIs related to Downlink HARQ.
-*/
-
-/* header include files (.h) */
-#include "common_def.h"
-#include "tfu.h" /* RGU Interface defines */
-
-/* header/extern include files (.x) */
-#include "tfu.x" /* RGU Interface includes */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#if !(defined(LCRGLITFU) && defined(TF) && defined(LWLCRGLITFU))
-#define PTRGLITFU
-#endif
-
-
-/* MAX Number of Service Providers of RG */
-#define RG_MAX_TFU_PROV 3
-
-#ifdef PTRGLITFU
-/** @brief This API is used to send a Bind Request from MAC to PHY.
- * @param pst Pointer to the post structure.
- * @param suId SAP ID of the service user.
- * @param spId SAP ID of the service provider.
- * @return ROK/RFAILED
- */
-S16 PtLiTfuBndReq ARGS((Pst * pst, SuId suId, SpId spId));
-/** @brief This API is used to send a Bind Request from Scheduler to PHY.
- * @param pst Pointer to the post structure.
- * @param suId SAP ID of the service user.
- * @param spId SAP ID of the service provider.
- * @return ROK/RFAILED
- */
-S16 PtLiTfuSchBndReq ARGS((Pst * pst, SuId suId, SpId spId));
-/** @brief This API is used to send an Unbind Request from MAC to PHY.
- * @param pst Pointer to the post structure.
- * @param suId SAP ID of the service provider.
- * @param reason Reason for Unbind request.
- * @return ROK/RFAILED
- */
-S16 PtLiTfuUbndReq ARGS((Pst * pst, SpId spId, Reason reason));
-/** @brief This API is used to send an Unbind Request from Scheduler to PHY.
- * @param pst Pointer to the post structure.
- * @param suId SAP ID of the service provider.
- * @param reason Reason for Unbind request.
- * @return ROK/RFAILED
- */
-S16 PtLiTfuSchUbndReq ARGS((Pst * pst, SpId spId, Reason reason));
-/** @brief This primitive is sent from Scheduler to PHY.
- * @details This primitive provides PHY with all the information required by
- * PHY to decode transmissions from the UE on either PUCCH or PUSCH.
- * -# On PUCCH UE can transmit the following
- * -# SR
- * -# HARQ feedback
- * -# CQI report
- * -# HARQ + CQI
- * -# HARQ + SR
- * -# On PUSCH UE can transmit the following
- * -# Data
- * -# Data + CQI
- * -# Data + HARQ Feedback
- * This primitive carries all the information for the expected subframe for all
- * the UEs that have been scheduled to transmit.
- * @param pst Pointer to the post structure.
- * @param spId SAP ID of the service provider.
- * @param recpReq Pointer to the TfuRecpReqInfo structure.
- * @return ROK/RFAILED
- */
-S16 PtLiTfuRecpReq ARGS((Pst * pst, SpId spId, TfuRecpReqInfo * recpReq));
-/** @brief This Primitive is sent from Scheduler to PHY. It provides PHY with
- * all the control information
- * @details This primitive carries the information sent on the following
- * channels -
- * -# PDCCH
- * -# PHICH
- * -# PCFICH
- *
- * @param pst
- * @param spId
- * @param cntrlReq pointer to TfuCntrlReqInfo
- * @return ROK/RFAILED
- */
-S16 PtLiTfuCntrlReq ARGS((Pst * pst, SpId spId, TfuCntrlReqInfo * cntrlReq));
-/** @brief This Primitive carries the Data PDUs from MAC to PHY for
- * transmission.
- * @details The data being sent in this primitive is meant to be transmitted on
- * the downlink channel PDSCH and PBCH (if present). To facilitate physical
- * layer processing, requisite control information is also sent along with the
- * data.
- * @sa TfUiTfuCntrlReq
- * @param pst
- * @param spId
- * @param tfuDatReq pointer to TfuDatReqInfo
- * @return
- */
-S16 PtLiTfuDatReq ARGS((Pst * pst, SpId spId, TfuDatReqInfo * datReq));
-#ifdef L2_OPTMZ
-/** @brief This Primitive carries cellId and UeId for which datReq need to be deleted.
- * @details This primitive is used to send delDatReq to CL to delete the PDUs of
- * UE which has been deleted in MAC due to ueId change or anyother scenario
- * @details The data being sent in this primitive is meant to be transmitted on
- * @sa TfUiTfuDelDatReq
- * @param pst
- * @param spId
- * @param tfuDelDatReq pointer to TfuDelDatReqInfo
- * @return
- */
-S16 PtLiTfuDelDatReq ARGS((Pst * pst, SpId spId, TfuDelDatReqInfo * datReq));
-#endif /*L2_OPTMZ*/
-#endif /*--#ifdef PTRGLITFU--*/
-
-#ifdef L2_OPTMZ
-/** @brief This Primitive carries cellId and UeId for which datReq need to be deleted.
- * @details This primitive is used to send delDatReq to CL to delete the PDUs of
- * UE which has been deleted in MAC due to ueId change or anyother scenario
- * NOTE:: This API is only supported for TC because race condition issue
- * happens only in case of TC
- * @sa TfUiTfuDelDatReq
- * @param pst
- * @param spId
- * @param tfuDelDatReq pointer to TfuDelDatReqInfo
- * @return
- */
-static const TfuDelDatReq RgLiTfuDelDatReqMt[RG_MAX_TFU_PROV] =
-{
-#ifdef LCRGLITFU
- PtLiTfuDelDatReq, /*calling dummy api as LC not required for this privitive*/
-#else
- PtLiTfuDelDatReq,
-#endif
-#ifdef TF
- TfUiTfuDelDatReq,
-#else
- PtLiTfuDelDatReq,
-#endif
-#ifdef LWLCRGLITFU
- PtLiTfuDelDatReq, /*calling dummy api as LWLC not required for this privitive*/
-#else
- PtLiTfuDelDatReq
-#endif
-};
-#endif /* L2_OPTMZ*/
-
-#ifdef RG
-
-
-#ifdef L2_OPTMZ
-\f
-/***********************************************************
-*
-* Func : RgLiTfuDelDatReq
-*
-*
-* Desc : This Primitive is used to delete datReq in CL when there is ueId change.
- * @details: This primitive is required when L2_OPMZ flag is elabed. this is required
- * To delete datRq PDUs from CL for the Ue for which Ue Id got changed or
- * anyother similar scenario
- * @sa TfUiTfuDelDatReq
- * @param pst
- * @param spId
- * @param tfuDelDatReq pointer to TfuDelDatReqInfo
- * @return
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 RgLiTfuDelDatReq
-(
-Pst * pst,
-SpId spId,
-TfuDelDatReqInfo * delDatReq
-)
-{
-
- return ((*RgLiTfuDelDatReqMt[pst->selector])(pst, spId, delDatReq));
-
-}
-#endif /* L2_OPTMZ*/
-
-#endif /*--ifdef RG--*/
-
-#ifdef PTRGLITFU
-
-
-\f
-/***********************************************************
-*
-* Func : PtLiTfuBndReq
-*
-*
-* Desc : This API is used to send a Bind Request from MAC to PHY.
- * @param pst Pointer to the post structure.
- * @param suId SAP ID of the service user.
- * @param spId SAP ID of the service provider.
- * @return ROK/RFAILED
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 PtLiTfuBndReq
-(
-Pst * pst,
-SuId suId,
-SpId spId
-)
-{
-
- UNUSED(pst);
- UNUSED(suId);
- UNUSED(spId);
-
- return ROK;
-
-}
-
-
-\f
-/***********************************************************
-*
-* Func : PtLiTfuSchBndReq
-*
-*
-* Desc : This API is used to send a Bind Request from Scheduler to PHY.
- * @param pst Pointer to the post structure.
- * @param suId SAP ID of the service user.
- * @param spId SAP ID of the service provider.
- * @return ROK/RFAILED
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 PtLiTfuSchBndReq
-(
-Pst * pst,
-SuId suId,
-SpId spId
-)
-{
-
- UNUSED(pst);
- UNUSED(suId);
- UNUSED(spId);
-
- return ROK;
-
-}
-
-
-\f
-/***********************************************************
-*
-* Func : PtLiTfuUbndReq
-*
-*
-* Desc : This API is used to send an Unbind Request from MAC to PHY.
- * @param pst Pointer to the post structure.
- * @param suId SAP ID of the service provider.
- * @param reason Reason for Unbind request.
- * @return ROK/RFAILED
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 PtLiTfuUbndReq
-(
-Pst * pst,
-SpId spId,
-Reason reason
-)
-{
-
- UNUSED(pst);
- UNUSED(spId);
- UNUSED(reason);
-
- return ROK;
-
-}
-
-
-\f
-/***********************************************************
-*
-* Func : PtLiTfuSchUbndReq
-*
-*
-* Desc : This API is used to send an Unbind Request from Scheduler to PHY.
- * @param pst Pointer to the post structure.
- * @param suId SAP ID of the service provider.
- * @param reason Reason for Unbind request.
- * @return ROK/RFAILED
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 PtLiTfuSchUbndReq
-(
-Pst * pst,
-SpId spId,
-Reason reason
-)
-{
-
- UNUSED(pst);
- UNUSED(spId);
- UNUSED(reason);
-
- return ROK;
-
-}
-
-
-\f
-/***********************************************************
-*
-* Func : PtLiTfuRecpReq
-*
-*
-* Desc : This primitive is sent from Scheduler to PHY.
- * @details This primitive provides PHY with all the information required by
- * PHY to decode transmissions from the UE on either PUCCH or PUSCH.
- * -# On PUCCH UE can transmit the following
- * -# SR
- * -# HARQ feedback
- * -# CQI report
- * -# HARQ + CQI
- * -# HARQ + SR
- * -# On PUSCH UE can transmit the following
- * -# Data
- * -# Data + CQI
- * -# Data + HARQ Feedback
- * This primitive carries all the information for the expected subframe for all
- * the UEs that have been scheduled to transmit.
- * @param pst Pointer to the post structure.
- * @param spId SAP ID of the service provider.
- * @param recpReq Pointer to the TfuRecpReqInfo structure.
- * @return ROK/RFAILED
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 PtLiTfuRecpReq
-(
-Pst * pst,
-SpId spId,
-TfuRecpReqInfo * recpReq
-)
-{
-
- UNUSED(pst);
- UNUSED(spId);
- UNUSED(recpReq);
-
- return ROK;
-
-}
-
-
-\f
-/***********************************************************
-*
-* Func : PtLiTfuCntrlReq
-*
-*
-* Desc : This Primitive is sent from Scheduler to PHY. It provides PHY with
- * all the control information
- * @details This primitive carries the information sent on the following
- * channels -
- * -# PDCCH
- * -# PHICH
- * -# PCFICH
- *
- * @param pst
- * @param spId
- * @param cntrlReq pointer to TfuCntrlReqInfo
- * @return ROK/RFAILED
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 PtLiTfuCntrlReq
-(
-Pst * pst,
-SpId spId,
-TfuCntrlReqInfo * cntrlReq
-)
-{
-
- UNUSED(pst);
- UNUSED(spId);
- UNUSED(cntrlReq);
-
- return ROK;
-
-}
-
-
-\f
-/***********************************************************
-*
-* Func : PtLiTfuDatReq
-*
-*
-* Desc : This Primitive carries the Data PDUs from MAC to PHY for
- * transmission.
- * @details The data being sent in this primitive is meant to be transmitted on
- * the downlink channel PDSCH and PBCH (if present). To facilitate physical
- * layer processing, requisite control information is also sent along with the
- * data.
- * @sa TfUiTfuCntrlReq
- * @param pst
- * @param spId
- * @param tfuDatReq pointer to TfuDatReqInfo
- * @return
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 PtLiTfuDatReq
-(
-Pst * pst,
-SpId spId,
-TfuDatReqInfo * datReq
-)
-{
-
- UNUSED(pst);
- UNUSED(spId);
- UNUSED(datReq);
-
- return ROK;
-
-}
-
-\f
-#ifdef L2_OPTMZ
-/***********************************************************
-*
-* Func : PtLiTfuDelDatReq
-*
-*
-* @brief This Primitive carries cellId and UeId for which datReq need to be deleted.
- * @details This primitive is used to send delDatReq to CL to delete the PDUs of
- * UE which has been deleted in MAC due to ueId change or anyother scenario
-
- * @details The data being sent in this primitive is meant to be transmitted on
- * @sa TfUiTfuDelDatReq
- * @param pst
- * @param spId
- * @param tfuDelDatReq pointer to TfuDelDatReqInfo
- * @return
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 PtLiTfuDelDatReq
-(
-Pst * pst,
-SpId spId,
-TfuDelDatReqInfo * delDatReq
-)
-{
-
- UNUSED(pst);
- UNUSED(spId);
- UNUSED(delDatReq);
-
- return ROK;
-
-}
-#endif /*L2_OPTMZ*/
-
-#endif /*--ifdef PTRGLITFU--*/
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-\f
-/**********************************************************************
-
- End of file
-**********************************************************************/
S16 PtMiLrgCfgCfm ARGS((Pst *pst, RgMngmt *cfm));
S16 PtMiLrgSchCfgCfm ARGS((Pst *pst, RgMngmt *cfm));
S16 PtMiLrgStsCfm ARGS((Pst *pst, RgMngmt *cfm));
-S16 PtMiLrgStaCfm ARGS((Pst *pst, RgMngmt *cfm));
S16 PtMiLrgStaInd ARGS((Pst *pst, RgMngmt *usta));
S16 PtMiLrgSchStaInd ARGS((Pst *pst, RgMngmt *usta));
S16 PtMiLrgCntrlCfm ARGS((Pst *pst, RgMngmt *cfm));
-S16 PtMiLrgSchCntrlCfm ARGS((Pst *pst, RgMngmt *cfm));
S16 PtMiLrgTrcInd ARGS((Pst *pst, RgMngmt *trc,Buffer *mBuf));
#ifdef LTE_L2_MEAS
S16 PtMiLrgSchL2MeasCfm ARGS((Pst *pst, LrgSchMeasCfmInfo *cfm));
#endif
};
-/** @brief Status Confirm primitive Matrix */
-static const LrgStaCfm RgMiLrgStaCfmMt[RG_MAX_LRG_USR] =
-{
-#ifdef LCRGMILRG
- cmPkLrgStaCfm, /* 0 - loosely coupled */
-#else
- PtMiLrgStaCfm, /* 0 - loosely coupled */
-#endif
-#ifdef SM
- SmMiLrgStaCfm, /* 1 - Tightly coupled SM */
-#else
- PtMiLrgStaCfm, /* 1 - Tightly coupled SM */
-#endif
-};
-
-
/** @brief Status Indication primitive Matrix */
static const LrgStaInd RgMiLrgStaIndMt[RG_MAX_LRG_USR] =
{
#endif
};
-
-/** @brief Control Confirm primitive Matrix */
-static const LrgCntrlCfm RgMiLrgCntrlCfmMt[RG_MAX_LRG_USR] =
-{
-#ifdef LCRGMILRG
- cmPkLrgCntrlCfm, /* 0 - loosely coupled */
-#else
- PtMiLrgCntrlCfm, /* 0 - loosely coupled */
-#endif
-#ifdef SM
- SmMiLrgCntrlCfm, /* 1 - Tightly coupled SM */
-#else
- PtMiLrgCntrlCfm, /* 1 - Tightly coupled SM */
-#endif
-};
-
-/** @brief Scheduler Control Confirm primitive Matrix */
-static const LrgSchCntrlCfm RgMiLrgSchCntrlCfmMt[RG_MAX_LRG_USR] =
-{
-#ifdef LCRGMILRG
- cmPkLrgSchCntrlCfm, /* 0 - loosely coupled */
-#else
- PtMiLrgSchCntrlCfm, /* 0 - loosely coupled */
-#endif
-#ifdef SM
- SmMiLrgSchCntrlCfm, /* 1 - Tightly coupled SM */
-#else
- PtMiLrgSchCntrlCfm, /* 1 - Tightly coupled SM */
-#endif
-};
-
-/** @brief Trace Indication primitive Matrix */
-static const LrgTrcInd RgMiLrgTrcIndMt[RG_MAX_LRG_USR] =
-{
-#ifdef LCRGMILRG
- cmPkLrgTrcInd, /* 0 - loosely coupled */
-#else
- PtMiLrgTrcInd, /* 0 - loosely coupled */
-#endif
-#ifdef SM
- SmMiLrgTrcInd, /* 1 - Tightly coupled SM */
-#else
- PtMiLrgTrcInd, /* 1 - Tightly coupled SM */
-#endif
-};
#ifdef LTE_L2_MEAS
/** @brief L2 Meas Cfm primitive Matrix */
static const LrgSchL2MeasCfm RgMiLrgSchL2mMeasCfmMt[RG_MAX_LRG_USR] =
}/*-- RgMiLrgStsCfm --*/
\f
-/**
- * @brief Layer Manager Status confirm handler.
- *
- * @details
- *
- * Function : RgMiLrgStaCfm
- *
- * This function handles the status
- * confirm invoked by MAC to Layer Manager.
- * -# Based on the pst->selector value it invokes one of the
- * functions cmPkLrgStaCfm() or SmMiLrgStaCfm().
- *
- * @param[in] Pst *pst, the post structure
- * @param[in] RgMngmt *cfm, the status confirm structure
- * @return S16
- * -# ROK
- **/
-S16 RgMiLrgStaCfm
-(
-Pst *pst, /* post structure */
-RgMngmt *cfm /* status confirm structure */
-)
-{
-
- (*RgMiLrgStaCfmMt[pst->selector])(pst,cfm);
-
- return ROK;
-
-}/*-- RgMiLrgStaCfm --*/
-
-\f
-/**
- * @brief Layer Manager Control confirm handler.
- *
- * @details
- *
- * Function : RgMiLrgCntrlCfm
- *
- * This function handles the control
- * confirm invoked by MAC to Layer Manager.
- * -# Based on the pst->selector value it invokes one of the
- * functions cmPkLrgCntrlCfm() or SmMiLrgCntrlCfm().
- *
- * @param[in] Pst *pst, the post structure
- * @param[in] RgMngmt *cfm, the control confirm structure
- * @return S16
- * -# ROK
- **/
-S16 RgMiLrgCntrlCfm
-(
-Pst *pst, /* post structure */
-RgMngmt *cfm /* control confirm structure */
-)
-{
-
- (*RgMiLrgCntrlCfmMt[pst->selector])(pst,cfm);
-
- return ROK;
-
-}/*-- RgMiLrgCntrlCfm --*/
-
-/**
- * @brief Layer Manager scheduler Control confirm handler.
- *
- * @details
- *
- * Function : RgMiLrgSchCntrlCfm
- *
- * This function handles the control
- * confirm invoked by scheduler to Layer Manager.
- * -# Based on the pst->selector value it invokes one of the
- * functions cmPkLrgSchCntrlCfm() or SmMiLrgSchCntrlCfm().
- *
- * @param[in] Pst *pst, the post structure
- * @param[in] RgMngmt *cfm, the control confirm structure
- * @return S16
- * -# ROK
- **/
-S16 RgMiLrgSchCntrlCfm
-(
-Pst *pst, /* post structure */
-RgMngmt *cfm /* control confirm structure */
-)
-{
-
- (*RgMiLrgSchCntrlCfmMt[pst->selector])(pst,cfm);
-
- return ROK;
-
-}/*-- RgMiLrgSchCntrlCfm --*/
-
-\f
/**
* @brief Layer Manager Unsolicited Status Indication handler.
*
}/*-- RgMiLrgSchStaInd --*/
-\f
-/**
- * @brief Layer Manager Trace Indication handler.
- *
- * @details
- *
- * Function : RgMiLrgTrcInd
- *
- * This function handles the trace
- * Indication invoked by MAC to Layer Manager.
- * -# Based on the pst->selector value it invokes one of the
- * functions cmPkLrgTrcInd() or SmMiLrgTrcInd().
- *
- * @param[in] Pst *pst, the post structure
- * @param[in] RgMngmt *trc, the trace event
- * @param[in] Buffer *mBuf, the trace message
- * @return S16
- * -# ROK
- **/
-S16 RgMiLrgTrcInd
-(
-Pst *pst, /* post structure */
-RgMngmt *trc, /* Trace event */
-Buffer *mBuf /* Trace message */
-)
-{
-
- (*RgMiLrgTrcIndMt[pst->selector])(pst,trc,mBuf);
-
- return ROK;
-
-}/*-- RgMiLrgTrcInd --*/
-
#ifdef LTE_L2_MEAS
/* TODO: Function header */
\f
-/**
- * @brief Portable Function definition for Layer Manager Status
- * confirm handler.
- *
- * @details
- *
- * Function : PtMiLrgStaCfm
- *
- * This function handles the status
- * confirm invoked by MAC to Layer Manager.
- * Users of MAC who intend to provide a glue logic
- * for portability of status Confirm are expected
- * to fill in the code in this function definition.
- *
- * @param[in] Pst *pst, the post structure
- * @param[in] RgMngmt *cfm, the status confirm structure
- * @return S16
- * -# ROK
- **/
-S16 PtMiLrgStaCfm
-(
-Pst *pst, /* post structure */
-RgMngmt *cfm /* Status Confirm */
-)
-{
- return ROK;
-}/* end of PtMiLrgStaCfm */
-
-
-\f
/**
* @brief Portable Function definition for Layer Manager Status
* Indication handler.
return ROK;
}/* end of PtMiLrgCntrlCfm */
-/**
- * @brief Portable Function definition for Layer Manager Control
- * confirm handler.
- *
- * @details
- *
- * Function : PtMiLrgSchCntrlCfm
- *
- * This function handles the control
- * confirm invoked by scheduler to Layer Manager.
- * Users of MAC who intend to provide a glue logic
- * for portability of control Confirm are expected
- * to fill in the code in this function definition.
- *
- * @param[in] Pst *pst, the post structure
- * @param[in] RgMngmt *cfm, the control confirm structure
- * @return S16
- * -# ROK
- **/
-S16 PtMiLrgSchCntrlCfm
-(
-Pst *pst, /* post structure */
-RgMngmt *cfm /* Control Confirm */
-)
-{
- return ROK;
-}/* end of PtMiLrgSchCntrlCfm */
-
-\f
-/**
- * @brief Portable Function definition for Layer Manager Trace
- * Indication handler.
- *
- * @details
- *
- * Function : PtMiLrgTrcInd
- *
- * This function handles the trace
- * indication invoked by MAC to Layer Manager.
- * Users of MAC who intend to provide a glue logic
- * for portability of trace indication are expected
- * to fill in the code in this function definition.
- *
- * @param[in] Pst *pst, the post structure
- * @param[in] RgMngmt *cfm, the trace indication structure
- * @return S16
- * -# ROK
- **/
-S16 PtMiLrgTrcInd
-(
-Pst *pst, /* post structure */
-RgMngmt *trc, /* Trace Event */
-Buffer *mBuf /* Trace message */
-)
-{
- return ROK;
-}/* end of PtMiLrgTrcInd */
#ifdef LTE_L2_MEAS
/**
* @brief Portable Function definition for L2 Measurement Configuration
S16 PtUiRgrCfgCfm ARGS((Pst* pst, SuId suId, RgrCfgTransId transId, uint8_t status));
S16 PtUiRgrTtiInd ARGS((Pst* pst, SuId suId, RgrTtiIndInfo *ttiInd));
/* Added for SI Enhancement*/
-#ifdef RGR_SI_SCH
-S16 PtUiRgrSiCfgCfm ARGS((Pst* pst, SuId suId, RgrCfgTransId transId, uint8_t status));
-S16 PtUiRgrWarningSiCfgCfm ARGS((Pst* pst, SuId suId,
- RgrCfgTransId transId, uint8_t siId, uint8_t status));
-#endif/*RGR_SI_SCH*/
#endif /*--#ifdef PTRGUIRGR--*/
#ifdef PTRGUIRGM
S16 PtUiRgmPrbRprtInd ARGS((Pst* pst, SuId suId, RgmPrbRprtInd *prbRprtInd));
-S16 PtUiRgmBndCfm ARGS((Pst* pst, SuId suId, uint8_t status));
S16 PtUiRgmTransModeInd ARGS((Pst* pst, SuId suId, RgmTransModeInd *transModeInd));
#endif
S16 RgUiRgmSendPrbRprtInd ARGS((Pst* pst, SuId suId, RgmPrbRprtInd *prbRprtInd));
#endif
};
-
-/** @brief Confirmation from MAC to RRM for the bind/Unbind
- * request for the interface saps */
-static const RgrBndCfm RgUiRgrBndCfmMt[RG_MAX_RGR_USR] =
-{
-#ifdef LCRGUIRGR
- cmPkRgrBndCfm,
-#else
- PtUiRgrBndCfm,
-#endif
-#ifdef NX
- NxLiRgrBndCfm,
-#else
- PtUiRgrBndCfm,
-#endif
-};
-
-/** @brief Confirmation from MAC to RRM for the bind/Unbind
- * request for the interface saps via RGM interface*/
-static const RgmBndCfm RgUiRgmBndCfmMt[RG_MAX_RGM_USR] =
-{
-#ifdef RGM_LC
- cmPkRgmBndCfm,
-#else
- PtUiRgmBndCfm,
-#endif
-#ifdef RM
- RmLiRgmBndCfm, /*To be added by RRM*/
-#else
- PtUiRgmBndCfm,
-#endif
-};
-
-
/** @brief Configuration Confirm from MAC to RRM */
static const RgrCfgCfm RgUiRgrCfgCfmMt[RG_MAX_RGR_USR] =
{
};
/* Added for SI Enhancement*/
-#ifdef RGR_SI_SCH
-/** @brief SI Configuration Confirm from MAC to RRM */
-static const RgrSiCfgCfm RgUiRgrSiCfgCfmMt[RG_MAX_RGR_USR] =
-{
-#ifdef LCRGUIRGR
- cmPkRgrSiCfgCfm,
-#else
- PtUiRgrSiCfgCfm,
-#endif
-#ifdef NX
- NxLiRgrSiCfgCfm,
-#else
- PtUiRgrSiCfgCfm,
-#endif
-};
-
-
-/** @brief Warning SI Configuration Confirm from MAC to RRM */
-static const RgrWarningSiCfgCfm RgUiRgrWarningSiCfgCfmMt[RG_MAX_RGR_USR] =
-{
-#ifdef LCRGUIRGR
- cmPkRgrWarningSiCfgCfm,
-#else
- PtUiRgrWarningSiCfgCfm,
-#endif
-#ifdef NX
- NxLiRgrWarningSiCfgCfm,
-#else
- PtUiRgrWarningSiCfgCfm,
-#endif
-};
-
-#endif/*RGR_SI_SCH */
/** @brief Confirmation from MAC to RRC for the bind/Unbind
* request for the interface saps */
static const CrgBndCfm RgUiCrgBndCfmMt[RG_MAX_CRG_USR] =
#endif /* __cplusplus */
#ifdef RG
-\f
-/**
-* @brief Confirmation from MAC to RRM for the bind/Unbind
- * request for the interface saps
-*
-* @details
-*
-* Function : RgUiRgrBndCfm
-*
-* @param[in] Pst* pst
-* @param[in] SuId suId
-* @param[in] uint8_t status
-* @return S16
-* -# ROK
-**/
-S16 RgUiRgrBndCfm(Pst* pst,SuId suId,uint8_t status)
-{
-
- return ((*RgUiRgrBndCfmMt[pst->selector])(pst, suId, status));
-
-}
-/**
-* @brief Confirmation from MAC to RRM for the bind/Unbind
- * request for the interface saps via RGM interface
-*
-* @details
-*
-* Function : RgUiRgmBndCfm
-*
-* @param[in] Pst* pst
-* @param[in] SuId suId
-* @param[in] uint8_t status
-* @return S16
-* -# ROK
-**/
-S16 RgUiRgmBndCfm(Pst* pst,SuId suId,uint8_t status)
-{
-
- return ((*RgUiRgmBndCfmMt[pst->selector])(pst, suId, status));
-
-}
-
-
/* Added for sending TTI tick to RRM */
\f
return ((*RgUiRguFlowCntrlIndMt[pst->selector])(pst, suId, flowCntrlInd));
}
/* Added for SI Enhancement*/
-#ifdef RGR_SI_SCH
-/**
-* @brief SI Configuration Confirm from MAC to RRM
-*
-* @details
-*
-* Function : RgUiRgrSiCfgCfm
-*
-* @param[in] Pst* pst
-* @param[in] SuId suId
-* @param[in] RgrCfgTransId transId
-* @param[in] uint8_t status
-* @return S16
-* -# ROK
-**/
-S16 RgUiRgrSiCfgCfm(Pst* pst,SuId suId,RgrCfgTransId transId,uint8_t status)
-{
-
- return ((*RgUiRgrSiCfgCfmMt[pst->selector])(pst, suId, transId, status));
-
-}
-
-/**
-* @brief Warning SI Configuration Confirm from MAC to RRM
-*
-* @details
-*
-* Function : RgUiRgrWarningSiCfgCfm
-*
-* @param[in] Pst* pst
-* @param[in] SuId suId
-* @param[in] RgrCfgTransId transId
-* @param[in] uint8_t siId
-* @param[in] uint8_t status
-* @return S16
-* -# ROK
-**/
-S16 RgUiRgrWarningSiCfgCfm(Pst* pst,SuId suId,RgrCfgTransId transId,uint8_t siId,uint8_t status)
-{
- return ((*RgUiRgrWarningSiCfgCfmMt[pst->selector])
- (pst, suId, transId, siId, status));
-}
-
-#endif/*RGR_SI_SCH*/
\f
/* ccpu00117452 - MOD - Changed macro name from
}
/* Added for SI Enhancement*/
-#ifdef RGR_SI_SCH
-/**
-* @brief SI Configuration Confirm from MAC to RRM
-*
-* @details
-*
-* Function : PtUiRgrSiCfgCfm
-*
-* @param[in] Pst* pst
-* @param[in] SuId suId
-* @param[in] RgrCfgTransId transId
-* @param[in] uint8_t status
-* @return S16
-* -# ROK
-**/
-S16 PtUiRgrSiCfgCfm(Pst* pst,SuId suId,RgrCfgTransId transId,uint8_t status)
-{
-
- UNUSED(pst);
- UNUSED(suId);
- UNUSED(transId);
- UNUSED(status);
-
- return ROK;
-
-}
-
-/**
-* @brief Warning SI Configuration Confirm from MAC to RRM
-*
-* @details
-*
-* Function : PtUiRgrWarningSiCfgCfm
-*
-* @param[in] Pst* pst
-* @param[in] SuId suId
-* @param[in] RgrCfgTransId transId
-* @param[in] uint8_t siId
-* @param[in] uint8_t status
-* @return S16
-* -# ROK
-**/
-S16 PtUiRgrWarningSiCfgCfm(Pst* pst,SuId suId,RgrCfgTransId transId,uint8_t siId,uint8_t status)
-{
- UNUSED(pst);
- UNUSED(suId);
- UNUSED(transId);
- UNUSED(siId);
- UNUSED(status);
-
- return ROK;
-}
-#endif/* RGR_SI_SCH */
-
\f
/* ccpu00117452 - MOD - Changed macro name from
RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
#ifdef PTRGUIRGM
-/**
-* @brief Confirmation from MAC to RRM for the bind/Unbind
- * request for the interface saps via RGM interface
-*
-* @details
-*
-* Function : PtUiRgmBndCfm
-*
-* @param[in] Pst* pst
-* @param[in] SuId suId
-* @param[in] uint8_t status
-* @return S16
-* -# ROK
-**/
-S16 PtUiRgmBndCfm(Pst* pst,SuId suId,uint8_t status)
-{
-
- UNUSED(pst);
- UNUSED(suId);
- UNUSED(status);
-
- return ROK;
-
-}
/**
* @brief Average PRB indication from MAC to RRM
return (ret);
}
#endif
-#ifdef RLC_MAC_DAT_REQ_RBUF
-S16 rgDlDatReqBatchProc
-(
-Void
-)
-{
-/* Read from Ring Buffer and process PDCP packets */
-
- uint8_t rngBufDeqIndx = 0;
- static Pst rgDDatRbfuPst ={1,1,ENTMAC,0,ENTRLC,1,PRIOR0,RTESPEC,EVTRGUDDATREQ,0,0,2,0};
- static Pst rgCDatRbfuPst ={1,1,ENTMAC,0,ENTRLC,1,PRIOR0,RTESPEC,EVTRGUCDATREQ,0,0,2,0};
- Void *elmIndx = NULLP;
- RguInfoRingElem *datReqRing=NULLP;
- elmIndx = SRngGetRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ);
- while(NULLP != elmIndx)
- {
- datReqRing= (RguInfoRingElem *)elmIndx;
- SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ].nPktProc++;//Number of pkt processed in tti
- if(datReqRing->msg)
- {
- if(datReqRing->event == EVTRGUDDATREQ)
- {
- RgUiRguDDatReq(&rgDDatRbfuPst, datReqRing->spId, (RguDDatReqInfo *) datReqRing->msg);
- }
- else
- {
- // printf("CSHP:*** Received CDatReq in MAC Ring \n");
- RgUiRguCDatReq(&rgCDatRbfuPst, datReqRing->spId, (RguCDatReqInfo *) datReqRing->msg);
- }
- }
- else
- {
- printf(" Buf Pinter is NULL RBUF Read(%ld) write (%ld) \n",SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ].r_addr->read,
- SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ].r_addr->write);
- /* Due to the cache issue we are verifying the mbuf pointer again and sending it to rlc if avilable*/
- if(datReqRing->msg)
- {
- if(datReqRing->event == EVTRGUDDATREQ)
- RgUiRguDDatReq(&rgDDatRbfuPst, datReqRing->spId, (RguDDatReqInfo *) datReqRing->msg);
- else
- RgUiRguCDatReq(&rgCDatRbfuPst, datReqRing->spId, (RguCDatReqInfo *) datReqRing->msg);
- }else
- {
- printf(" still Buf Pinter is NULL RBUF Read(%ld) write (%ld) \n",SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ].r_addr->read,
- SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ].r_addr->write);
- }
- }
- datReqRing->msg=NULLP;
- SRngIncrRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ);
- datReqRing->event=0;
- elmIndx = NULLP;
- datReqRing= NULLP;
- rngBufDeqIndx++;
-
- if(rngBufDeqIndx >= SS_RNG_MAX_DLRLC_TO_DLMAC_DAT_REQ_DQ_CNT)
- break;
-
- if((elmIndx = SRngGetRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ)) == NULLP)
- break;
- }
-
- return ROK;
-}
-#endif
-
-#ifdef RLC_MAC_STA_RSP_RBUF
-S16 rgDlStaRspBatchProc(Void)
-{
-/* Read from Ring Buffer and process PDCP packets */
-
- uint8_t rngBufDeqIndx = 0;
- static Pst rgDStaRbfuPst ={1,1,ENTMAC,0,ENTRLC,1,PRIOR0,RTESPEC,EVTRGUDSTARSP,0,0,2,0};
- static Pst rgCStaRbfuPst ={1,1,ENTMAC,0,ENTRLC,1,PRIOR0,RTESPEC,EVTRGUCSTARSP,0,0,2,0};
- Void *elmIndx = NULLP;
- RguInfoRingElem *staRspRing=NULLP;
-
- elmIndx = SRngGetRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
- while(NULLP != elmIndx)
- {
- staRspRing= (RguInfoRingElem *)elmIndx;
- SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC].nPktProc++;//Number of pkt processed in tti
-
- if(staRspRing->msg!= NULLP)
- {
- if( staRspRing->event == EVTRGUDSTARSP)
- {
- RgUiRguDStaRsp(&rgDStaRbfuPst, staRspRing->spId, (RguDStaRspInfo *) staRspRing->msg);
- }
- else
- {
- RgUiRguCStaRsp(&rgCStaRbfuPst, staRspRing->spId, (RguCStaRspInfo *) staRspRing->msg);
- }
- }
- else
- {
- printf(" Buf Pinter is NULL RBUF Read(%ld) write (%ld) \n",SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC].r_addr->read,
- SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC].r_addr->write);
- /* Due to the cache issue we are verifying the mbuf pointer again and sending it to rlc if avilable*/
- if(staRspRing->msg!= NULLP)
- {
- if( staRspRing->event == EVTRGUDSTARSP)
- RgUiRguDStaRsp(&rgDStaRbfuPst, staRspRing->spId, (RguDStaRspInfo *) staRspRing->msg);
- else
- RgUiRguCStaRsp(&rgCStaRbfuPst, staRspRing->spId, (RguCStaRspInfo *) staRspRing->msg);
- }else
- {
- printf(" still Buf Pinter is NULL RBUF Read(%ld) write (%ld) \n",SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC].r_addr->read,
- SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC].r_addr->write);
- }
- }
- staRspRing->msg=NULLP;
- SRngIncrRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
- staRspRing->event =0;
- elmIndx = NULLP;
- staRspRing= NULLP;
-
- rngBufDeqIndx++;
- if(rngBufDeqIndx >= SS_RNG_MAX_DLRLC_TO_DLMAC_STA_RSP_DQ_CNT)
- break;
-
- if((elmIndx = SRngGetRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC)) == NULLP)
- break;
- }
-
- return ROK;
-}
-#endif
#ifdef LTE_L2_MEAS
#ifdef MAC_RLC_HARQ_STA_RBUF
S16 RgUiRguHqStaIndRbuf (Pst* pst,SuId suId,RguHarqStatusInd *harqStatusInd)
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Entry point fucntions
-
- File: rg_ram.c
-
-**********************************************************************/
-
-/** @file rg_ram.c
-@brief This file has APIs to handle the random access procedure functionality.
-*/
-
-/* header include files (.h) */
-#include "common_def.h"
-#include "rg_env.h" /* MAC Environment Defines */
-#include "crg.h" /* CRG Interface defines */
-#include "rgu.h" /* RGU Interface defines */
-#include "tfu.h" /* TFU Interface defines */
-#include "rg_sch_inf.h" /* RGR Interface defines */
-#include "lrg.h" /* LRG Interface defines */
-
-#include "rg.h" /* MAC defines */
-#include "rg_err.h" /* MAC error defines */
-
-/* header/extern include files (.x) */
-
-#include "crg.x" /* CRG Interface includes */
-#include "rgu.x" /* RGU Interface includes */
-#include "tfu.x" /* TFU Interface includes */
-#include "rg_sch_inf.x" /* SCH Interface includes */
-#include "rg_prg.x" /* PRG Interface includes */
-#include "lrg.x" /* LRG Interface includes */
-
-#include "du_app_mac_inf.h"
-#include "rg.x" /* MAC includes */
-
-/* local defines */
-
-/* local typedefs */
-
-/* forward references */
-
-/***********************************************************
- *
- * Func : rgRAMFreeUeCb
- *
- *
- * Desc :
- * - Processing Steps:
- * - Frees UE control block.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgRAMFreeUeCb(Inst inst,RgUeCb *ue)
-{
- rgDHMFreeUe(inst,&ue->dl.hqEnt);
-
- /*ccpu00117052 - MOD - Passing double pointer for proper NULLP
- assignment */
- /* De-allocate the Ue */
- rgFreeSBuf(inst,(Data **)&ue, sizeof(*ue));
-
- /* Stack Crash problem for TRACE5 changes. Added the return below */
- return;
-
-} /* rgRAMFreeUeCb */
-
-/**
- * @brief Handler for Random Access control block creation.
- *
- * @details
- *
- * Function : rgRAMCreateUeCb
- * Creates a raCb and gives the same to scheduler for its updation.
- *
- *
- * @param[in] RgCellCb *cell
- * @param[in] CmLteRnti tmpCrnti
- * @param[out] RgErrInfo *err
- * @return RgUeCb*
- **/
-RgUeCb* rgRAMCreateUeCb(RgCellCb *cell,CmLteRnti tmpCrnti,Bool insert,RgErrInfo *err)
-{
- Inst inst = cell->macInst - RG_INST_START;
- RgUeCb *ueCb = NULLP;
-
- DU_LOG("\nINFO --> MAC : CREATE UECB FOR CRNTI:%d",
- tmpCrnti);
- /* Allocate the Ue control block */
- if (rgAllocSBuf(inst,(Data **)&ueCb, sizeof(*ueCb)) != ROK)
- {
- DU_LOG("\nERROR --> MAC : Memory allocation FAILED for CRNTI:%d",tmpCrnti);
- err->errCause = RGERR_RAM_MEM_EXHAUST;
- return (NULLP);
- }
-
- /* Inititialize Ue control block */
- ueCb->ueId = tmpCrnti;
-
- /* Initialize the lists of the UE */
- rgDBMInitUe(ueCb);
-
- if(insert == TRUE)
- {
- /* MS_FIX : Remove stale UEs if present */
- RgUeCb *staleUe = NULLP;
- /* Insert the created raCb into raCb list of cell */
- ueCb->rachLstEnt.next = NULLP;
- ueCb->rachLstEnt.prev = NULLP;
- ueCb->rachLstEnt.node = (PTR)(ueCb);
- /* MS_FIX : Remove stale UEs if present */
- staleUe = rgDBMGetUeCbFromRachLst (cell, tmpCrnti);
- if (staleUe)
- {
- rgDBMDelUeCbFromRachLst(cell, staleUe);
- rgRAMFreeUeCb(inst,staleUe);
- }
- rgDBMInsUeCbInRachLst(cell, ueCb);
- }
-
- return (ueCb);
-} /* rgRAMCreateUeCb */
-
-/**
- * @brief Function for handling cell delete.
- *
- * @details
- *
- * Function : rgRAMFreeCell
- *
- * This function shall be invoked whenever a cell needs to be deleted.
- * This shall remove raCbs and raReqs stored in cell.
- *
- *
- * @param[in,out] RgCellCb *cell
- * @return S16
- * -# ROK
- **/
-S16 rgRAMFreeCell(RgCellCb *cell)
-{
- Inst inst = cell->macInst - RG_INST_START;
- RgUeCb *ueCb;
-
- /* Free CURRENT CRG cfg list */
- while ((ueCb = rgDBMGetNextUeCbFromRachLst(cell, NULLP)) != NULLP)
- {
- rgDBMDelUeCbFromRachLst(cell, ueCb);
- rgRAMFreeUeCb(inst,ueCb);
- }
-
- return ROK;
-} /* rgRAMFreeCell */
-/**
- * @brief Function for handling RA response scheduled for a subframe.
- *
- * @details
- *
- * Function : rgHndlRaResp
- *
- * This function shall be invoked whenever scheduler is done with the
- * allocations of random access responses for a subframe RgSchMacSfAllocReq.
- *
- * Processing steps :
- *
- * This shall invoke RAM to create ueCbs for all the rapIds allocated and
- * shall invoke MUX to create RAR PDUs for raRntis allocated.
- *
- *
- * @param[in] RgCellCb *cell,
- * @param[in] CmLteTimingInfo timingInfo,
- * @param[in] RgInfRarInfo *rarInfo
- * @param[in/out] RgErrInfo *err
- * @return S16
- * -# ROK
- **/
-S16 rgHndlRaResp(RgCellCb *cell,CmLteTimingInfo timingInfo,RgInfRarInfo *rarInfo,RgErrInfo *err)
-{
- uint8_t idx1,idx2;
- Buffer *rarPdu;
- RgDlSf *dlSf;
- uint8_t idx;
-
- if(NULLP == rarInfo->raRntiInfo)
- {
- return RFAILED;
- }
-
- idx = (timingInfo.slot % RG_NUM_SUB_FRAMES);
- dlSf = &cell->subFrms[idx];
-
- /* Create RAR PDUs for all the allocated RA-RNTIs */
- for(idx1 = 0; idx1 < rarInfo->numRaRntis; idx1++)
- {
- if(ROK == (rgMUXBldRarPdu(cell,
- &rarInfo->raRntiInfo[idx1], &rarPdu, err)))
- {
- /* Create RaCbs for all the rapIds allocated */
- for(idx2 = 0; idx2 < rarInfo->raRntiInfo[idx1].numCrnti; idx2++)
- {
- if(FALSE == rarInfo->raRntiInfo[idx1].crntiInfo[idx2].isContFree)
- {
- if(rgRAMCreateUeCb(cell,
- rarInfo->raRntiInfo[idx1].crntiInfo[idx2].tmpCrnti,
- TRUE, err) == NULLP)
- {
- return RFAILED;
- }
- }
- }
- /* Store the created RAR PDU */
- dlSf->raRsp[dlSf->numRaRsp].pdcch.rnti =
- rarInfo->raRntiInfo[idx1].raRnti;
-
- dlSf->raRsp[dlSf->numRaRsp].pdcch.dci =
- rarInfo->raRntiInfo[idx1].dciInfo;
-
- dlSf->raRsp[dlSf->numRaRsp].rar = rarPdu;
- /* ccpu00132314-ADD-Adding txPower offset for the PDSCH transmission */
- dlSf->raRsp[dlSf->numRaRsp].txPwrOffset =
- rarInfo->txPwrOffset;
-
- dlSf->numRaRsp++;
- }
- else
- {
- DU_LOG("\nERROR --> MAC : RARNTI:%d Creation of RAR"
- "PDU for failed", rarInfo->raRntiInfo[idx1].raRnti);
- continue;
- }
- } /* end of raRntis loop */
- return ROK;
-} /* end of rgHndlRaResp */
-
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Entry point fucntions.
-
- File: rg_rom.c
-
-**********************************************************************/
-
-/** @file rg_rom.c
-@brief APIs to handle all the primitives invoked on RGU interface.
-*/
-
-
-/* header include files (.h) */
-#include "common_def.h"
-#include "rg_env.h" /* MAC Environment Defines */
-#include "crg.h" /* CRG Interface defines */
-#include "rgu.h" /* RGU Interface defines */
-#include "tfu.h" /* TFU Interface defines */
-#include "rg_sch_inf.h" /* RGR Interface defines */
-#include "lrg.h" /* LRG Interface defines */
-
-#include "rg.h" /* MAC defines */
-#include "rg_err.h" /* MAC error defines */
-
-/* header/extern include files (.x) */
-
-#include "crg.x" /* CRG Interface includes */
-#include "rgu.x" /* RGU Interface includes */
-#include "tfu.x" /* TFU Interface includes */
-#include "rg_sch_inf.x" /* SCH Interface includes */
-#include "rg_prg.x" /* PRG Interface includes */
-#include "lrg.x" /* LRG Interface includes */
-
-#include "du_app_mac_inf.h"
-#include "rg.x" /* MAC includes */
-
-/* local defines */
-#define RG_NON_MIMO_IDX 0
-
-/* local typedefs */
-
-S16 RgMacSchBrdcmDedBoUpdtReq ARGS((Inst inst, CmLteCellId cellId, CmLteRnti rnti, CmLteLcId lcId, S32 bo ));
-static S16 rgROMHndlCcchDatReq ARGS((RgCellCb *cell,
- RgRguCmnDatReq *datReq, RgErrInfo *err));
-static S16 rgROMHndlBcchPcchDatReq ARGS((RgCellCb *cell,
- RgRguCmnDatReq *datReq, RgErrInfo *err));
-static S16 rgROMHndlCcchStaRsp ARGS((RgCellCb *cell,
- RgRguCmnStaRsp *staRsp, RgErrInfo *err));
-static S16 rgROMHndlBcchPcchStaRsp ARGS((RgCellCb *cell,
- RgRguCmnStaRsp *staRsp, RgErrInfo *err));
-
-/* ADD Changes for Downlink UE Timing Optimization */
-#ifdef LTEMAC_DLUE_TMGOPTMZ
-static S16 rgROMUpdDlSfRemDataCnt ARGS((RgCellCb *cellCb,
- RgDlSf *dlSf));
-S16 rgTOMUtlProcDlSf ARGS(( RgDlSf *dlSf,
- RgCellCb *cellCb,
- RgErrInfo *err));
-#endif
-
-/* forward references */
-
-/**
- * @brief Handler for dedicated DatReq received on RGU for an UE.
- *
- * @details
- *
- * Function : rgROMDedDatReq
- *
- * This function shall
- * -# store the BO reported for the given logical channels.
- * -# invoke DL HARQ for further processing.
- *
- *
- * @param[in] Inst inst
- * @param[in] RgRguDedDatReq *datReq
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgROMDedDatReq(Inst inst,RgRguDedDatReq *datReq)
-{
-#if 0
- RgCellCb *cell;
- RgUeCb *ue;
- uint8_t idx1,idx2;
- RgDlHqProcCb *hqProc;
- uint8_t hqPId;
- RgErrInfo err;
- Pst schPst;
- RgInfDedBoRpt boRpt;
- CmLteTimingInfo timingInfo;
- RgDlSf *sf;
-#if (ERRCLASS & ERRCLS_DEBUG)
- RgUstaDgn dgn; /* Alarm diagnostics structure */
-#endif
-/* ADD Changes for Downlink UE Timing Optimization */
-#ifdef LTEMAC_DLUE_TMGOPTMZ
- S16 ret;
-#endif
- uint32_t idx;
- //uint8_t datReqFailCnt = 0;
-
-
- if (((cell = rgCb[inst].cell) == NULLP)
- || (cell->cellId != datReq->cellId))
- {
-#if (ERRCLASS & ERRCLS_INT_PAR)
- /* Handle Cell fetch failure */
- DU_LOG("\nERROR --> MAC : rgROMDedDatReq(): Invalid cell Id");
-#endif
- err.errType = RGERR_ROM_DEDDATREQ;
- err.errCause = RGERR_ROM_INV_CELL_ID;
- if(cell != NULLP)
- {
- /* Update stats */
- rgUpdtRguDedSts(inst,cell->rguDlSap,RG_RGU_SDU_DROP, datReq);
- }
- return RFAILED;
- }
-
-/* Add loop here to scan for all UEs in the consolidated DDatReq*/
- for(idx = 0; idx < datReq->nmbOfUeGrantPerTti; idx++)
- {
-
- timingInfo.slot = (uint8_t)((datReq->datReq[idx].transId >> 8) & 0XFF);
- timingInfo.sfn = (uint16_t)((datReq->datReq[idx].transId >> 16) & 0xFFFF);
- sf = &cell->subFrms[(timingInfo.slot % RG_NUM_SUB_FRAMES)];
-
- if( (sf->txDone == TRUE) ||
- (!RG_TIMEINFO_SAME(sf->schdTime,timingInfo)))
- {
-#if (ERRCLASS & ERRCLS_DEBUG)
- /* Transmission is already done for this slot. This is a delayed
- * datReq. So discard */
- rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
- rgLMMStaInd(inst,LCM_CATEGORY_PROTOCOL, LCM_EVENT_UI_INV_EVT,
- LRG_CAUSE_DELAYED_DATREQ, &dgn);
-#endif
- err.errType = RGERR_ROM_DEDDATREQ;
- err.errCause = RGERR_ROM_DELAYED_DATREQ;
- /* Update stats */
- rgUpdtRguDedSts(inst,cell->rguDlSap,RG_RGU_SDU_DROP, datReq);
-#ifdef CA_DBG
- {
- uint32_t dbgDelayedDatReqInMac;
- dbgDelayedDatReqInMac++;
- }
-#endif /* CA_DBG */
-#ifndef L2_OPTMZ
- RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[idx]);
-#endif
- continue;
- // return RFAILED;
- }
-
- if ((ue = rgDBMGetUeCb(cell, datReq->datReq[idx].rnti)) == NULLP)
- {
-#if (ERRCLASS & ERRCLS_INT_PAR)
- /* Handle Ue fetch failure */
- DU_LOG("\nERROR --> MAC : rgROMDedDatReq(): Invalid ue Id");
-#endif
- err.errType = RGERR_ROM_DEDDATREQ;
- err.errCause = RGERR_ROM_INV_UE_ID;
- /* Update stats */
- rgUpdtRguDedSts(inst,cell->rguDlSap,RG_RGU_SDU_DROP, datReq);
- /* ADD Changes for Downlink UE Timing Optimization */
-#ifdef LTEMAC_DLUE_TMGOPTMZ
- /* Trying to send the prev successful PDU's
- * if present */
- ret = rgROMUpdDlSfRemDataCnt(cell, sf);
- if(ret == RFAILED)
- {
- DU_LOG("\nERROR --> MAC : Dropping due to no ue \n");
-#ifndef L2_OPTMZ
- RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[idx]);
-#endif
- /* Return from here as above functions found more datReq than expected*/
- /* return (ret); */
- }
-#endif
- /* Conitnue for next UE */
- continue;
- }
-
- hqPId = (uint8_t)(datReq->datReq[idx].transId);
- hqPId = hqPId >> 2;
- /* get harq process and invoke DHM */
- rgDHMGetHqProcFrmId(ue, hqPId, &hqProc);
-
- if (rgDHMHndlDedDatReq(inst,hqProc, &datReq->datReq[idx], sf, &err) == RFAILED)
- {
- DU_LOG("\nERROR --> MAC : Handling of Data request in DHM failedi RNTI:%d",
- datReq->datReq[idx].rnti);
- err.errType = RGERR_ROM_DEDDATREQ;
- /* errcause shall be filled in appropriately by DHM */
- /* Update stats */
- rgUpdtRguDedSts(inst,ue->rguDlSap,RG_RGU_SDU_DROP, datReq);
- /* ADD Changes for Downlink UE Timing Optimization */
-#ifdef LTEMAC_DLUE_TMGOPTMZ
- /* Trying to send the prev successful PDU's
- * if present */
- ret = rgROMUpdDlSfRemDataCnt(cell, sf);
- if(ret == RFAILED)
- {
- DU_LOG("\nERROR --> MAC : Dropping due to no failure of remCnt update");
-#ifndef L2_OPTMZ
- RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[idx]);
-#endif
- /* Return from here as above functions found more datReq than expected*/
- //return (ret);
- }
-#endif
- continue;
- }
-
- /* Merging the updation of statistics of SDUs with for loop below */
-
- rgGetPstToInst(&schPst,inst, cell->schInstMap.schInst);
- schPst.event = 0;
- boRpt.cellSapId = cell->schInstMap.cellSapId;
- boRpt.cellId = datReq->cellId;
-
- boRpt.rnti = datReq->datReq[idx].rnti;
-
-
- /* Fill the DStaRsp struct and send it to scheduler */
- for (idx1 = 0; idx1 < datReq->datReq[idx].nmbOfTbs; idx1++)
- {
- for(idx2 = 0; idx2 < datReq->datReq[idx].datReqTb[idx1].nmbLch; idx2++)
- {
- /* Updating dedicated SDUs received statistics without
- additional function above for optimization */
- ue->rguDlSap->sapSts.numPduRcvd +=
- datReq->datReq[idx].datReqTb[idx1].lchData[idx2].pdu.numPdu;
-
- boRpt.lcId = datReq->datReq[idx].datReqTb[idx1].lchData[idx2].lcId;
- boRpt.bo = datReq->datReq[idx].datReqTb[idx1].lchData[idx2].boReport.bo;
- boRpt.oldestSduArrTime
- = datReq->datReq[idx].datReqTb[idx1].lchData[idx2].boReport.oldestSduArrTime;
- boRpt.staPduBo = datReq->datReq[idx].datReqTb[idx1].lchData[idx2].boReport.staPduBo;
-
- boRpt.setMaxUlPrio= datReq->datReq[idx].datReqTb[idx1].lchData[idx2].setMaxUlPrio;
-#ifdef CCPU_OPT
- boRpt.setMaxDlPrio= datReq->datReq[idx].datReqTb[idx1].lchData[idx2].boReport.staPduPrsnt;
-#endif
- RgMacSchDedBoUpdt(&schPst, &boRpt);
- }
- }
-
- /* ADD Changes for Downlink UE Timing Optimization */
-#ifdef LTEMAC_DLUE_TMGOPTMZ
-// sf->remDatReqCnt -= datReqFailCnt;
- /*Presently this function is not returning RFAILED, thus not checking
- for failure condition.*/
- ret = rgROMUpdDlSfRemDataCnt(cell, sf);
- if(ret == RFAILED)
- {
- DU_LOG("\nERROR --> MAC : Dropping due to no failure of remCnt update(1) \n");
-#ifndef L2_OPTMZ
- RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[idx]);
-#endif
- /* Return from here as above functions found more datReq than expected*/
- // return (ret);
- }
-#endif
- } /* for loop for num of Ue per TTI*/
-
-#endif
- /* Data send successfully to PHY. lets retuns ROK*/
- return ROK;
-} /* rgROMDedDatReq */
-
-
-/**
- * @brief Handler for DatReq received on RGU for a common logical channel.
- *
- * @details
- *
- * Function : rgROMCmnDatReq
- *
- * This function shall invoke rgROMHndlCcchDatReq() if datReq is on CCCH
- * If not, it shall invoke rgROMHndlBcchPcchDatReq().
- *
- *
- * @param[in] Inst inst
- * @param[in] RgRguCmnDatReq *datReq
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgROMCmnDatReq(Inst inst, RgRguCmnDatReq *datReq)
-{
- RgCellCb *cell;
- RgErrInfo err;
- S16 ret;
-/* ADD Changes for Downlink UE Timing Optimization */
-#ifdef LTEMAC_DLUE_TMGOPTMZ
- CmLteTimingInfo timingInfo;
- RgDlSf *sf;
-#endif
-
- ret = ROK;
- err.errType = RGERR_ROM_CMNDATREQ;
- if(((cell = rgCb[inst].cell) == NULLP)
- ||(cell->cellId != datReq->cellId))
- {
-#if (ERRCLASS & ERRCLS_INT_PAR)
- /* Handle Cell fetch failure */
- DU_LOG("\nERROR --> MAC : rgROMCmnDatReq(): Invalid cell Id");
-#endif
- err.errCause = RGERR_ROM_INV_CELL_ID;
- /* Update stats */
- if(cell != NULLP)
- {
- rgUpdtRguCmnSts(inst,cell->rguDlSap,RG_RGU_SDU_DROP);
- }
- return RFAILED;
- }
-
- if (datReq->lcId == cell->dlCcchId)
- {
- ret = rgROMHndlCcchDatReq(cell, datReq, &err);
-
- /*Get the timing Info*/
- /* ADD Changes for Downlink UE Timing Optimization */
-#ifdef LTEMAC_DLUE_TMGOPTMZ
- timingInfo.slot = (uint8_t)((datReq->transId >> 8) & 0XFF);
- timingInfo.sfn = (uint16_t)((datReq->transId >> 16) & 0xFFFF);
-#endif
- }
- else
- {
- ret = rgROMHndlBcchPcchDatReq(cell, datReq, &err);
-
- /*Get the timing Info*/
- /* ADD Changes for Downlink UE Timing Optimization */
-#ifdef LTEMAC_DLUE_TMGOPTMZ
- timingInfo.slot = (uint8_t)(datReq->transId & 0XFF);
- timingInfo.sfn = (uint16_t)((datReq->transId >> 8) & 0xFFFF);
-#endif
- }
-
- /* Update stats */
- if (ret == RFAILED)
- {
- rgUpdtRguCmnSts(inst,cell->rguDlSap,RG_RGU_SDU_DROP);
- }
- else
- {
- /* Update stats with number of SDUs received */
- rgUpdtRguCmnSts(inst,cell->rguDlSap,RG_RGU_SDU_RCVD);
- }
-
- /* ADD Changes for Downlink UE Timing Optimization */
-#ifdef LTEMAC_DLUE_TMGOPTMZ
- RG_ARRAY_BOUND_CHECK(0, cell->subFrms, (timingInfo.slot % RG_NUM_SUB_FRAMES));
- sf = &cell->subFrms[(timingInfo.slot % RG_NUM_SUB_FRAMES)];
-
- ret = rgROMUpdDlSfRemDataCnt(cell, sf);
- /*Added check for RFAILED as above function can return RFAILED*/
-#endif
-
- return (ret);
-} /* rgROMCmnDatReq */
-
-/**
- * @brief Handler for DatReq received on RGU for CCCH.
- *
- * @details
- *
- * Function : rgROMHndlCcchDatReq
- *
- * This function shall fetch the raCb with the given rnti and indicate msg4
- * arrival to RAM.
- *
- *
- * @param[in] RgCellCb *cell
- * @param[in] RgRguCmnDatReq *datReq
- * @param[out] RgErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgROMHndlCcchDatReq(RgCellCb *cell, RgRguCmnDatReq *datReq, RgErrInfo *err)
-{
- Inst inst = cell->macInst - RG_INST_START;
- RgUeCb *ue;
- uint8_t hqPId;
- RgDlHqProcCb *hqProc;
- CmLteTimingInfo timingInfo;
- RgDlSf *sf;
-#if (ERRCLASS & ERRCLS_DEBUG)
- RgUstaDgn dgn; /* Alarm diagnostics structure */
-#endif
-
- err->errType = RGERR_ROM_CMNDATREQ;
-
- if ((ue = rgDBMGetUeCb(cell, datReq->u.rnti)) == NULLP)
- {
- if ((ue = rgDBMGetUeCbFromRachLst(cell, datReq->u.rnti)) == NULLP)
- {
- #if (ERRCLASS & ERRCLS_INT_PAR)
- /* Handle Ue fetch failure */
- DU_LOG("\nERROR --> MAC : rgROMHndlCcchDatReq(): Invalid ue Id");
- #endif
- err->errCause = RGERR_ROM_INV_UE_ID;
- return RFAILED;
- }
- }
-
- timingInfo.slot = (uint8_t)((datReq->transId >> 8) & 0XFF);
- timingInfo.sfn = (uint16_t)((datReq->transId >> 16) & 0xFFFF);
- sf = &cell->subFrms[(timingInfo.slot % RG_NUM_SUB_FRAMES)];
-
- if( (sf->txDone == TRUE) ||
- (!RG_TIMEINFO_SAME(sf->schdTime,timingInfo)))
- {
-#if (ERRCLASS & ERRCLS_DEBUG)
- /* Transmission is already done for this slot. This is a delayed
- * datReq. So discard */
- rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
- rgLMMStaInd(inst,LCM_CATEGORY_PROTOCOL, LCM_EVENT_UI_INV_EVT,
- LRG_CAUSE_DELAYED_DATREQ, &dgn);
-#endif
- err->errCause = RGERR_ROM_DELAYED_DATREQ;
- return RFAILED;
- }
-
- hqPId = (uint8_t)(datReq->transId);
- hqPId = hqPId >> 2;
-
- /* get harq process and invoke DHM */
- rgDHMGetHqProcFrmId(ue, hqPId, &hqProc);
-
- /* Changed for CR timer implementation*/
- /* invoke DHM to process CCCH data */
- if (rgDHMHndlCmnDatReq(inst,hqProc, datReq, err) == RFAILED)
- {
- DU_LOG("\nERROR --> MAC : Handling of Data request in DHM failed RNTI:%d LCID:%d",
- datReq->u.rnti,datReq->lcId);
- /* Release First TB */
- rgDHMRlsHqProcTB(cell, hqProc, 1);
- /* err shall be filled in appropriately by DHM */
- return RFAILED;
- }
-
- return ROK;
-} /* rgROMHndlCcchDatReq */
-
-
-/**
- * @brief Handler for DatReq received on RGU for BCCH or PCCH.
- *
- * @details
- *
- * Function : rgROMHndlBcchPcchDatReq
- *
- * This function shall store the buffer and time to transmit in lcCb.
- *
- *
- * @param[in] RgCellCb *cell
- * @param[in] RgRguCmnDatReq *datReq
- * @param[out] RgErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgROMHndlBcchPcchDatReq(RgCellCb *cell, RgRguCmnDatReq *datReq, RgErrInfo *err)
-{
- Inst inst = cell->macInst - RG_INST_START;
- RgPcchLcCb *pcch;
- /* Modified for SI Enhancement*/
-#ifndef RGR_SI_SCH
- RgBcchBchLcCb *bch;
- RgBcchDlschLcCb *bcch;
-#endif/*RGR_SI_SCH*/
- RgDlSf *sf;
- CmLteTimingInfo timingInfo;
-#if (ERRCLASS & ERRCLS_DEBUG)
- RgUstaDgn dgn; /* Alarm diagnostics structure */
-#endif
-
-
- timingInfo.slot = (uint8_t)(datReq->transId & 0XFF);
- timingInfo.sfn = (uint16_t)((datReq->transId >> 8) & 0xFFFF);
- sf = &cell->subFrms[(timingInfo.slot % RG_NUM_SUB_FRAMES)];
-
- if( (sf->txDone == TRUE) ||
- (!RG_TIMEINFO_SAME(sf->schdTime,timingInfo)))
- {
-#if (ERRCLASS & ERRCLS_DEBUG)
- /* Transmission is already done for this slot. This is a delayed
- * datReq. So discard */
- rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
- rgLMMStaInd(inst,LCM_CATEGORY_PROTOCOL, LCM_EVENT_UI_INV_EVT,
- LRG_CAUSE_DELAYED_DATREQ, &dgn);
-#endif
- err->errCause = RGERR_ROM_DELAYED_DATREQ;
- return RFAILED;
- }
-
-#ifndef RGR_SI_SCH
- bcch = rgDBMGetBcchOnDlsch(cell,datReq->lcId);
- if (bcch )
- {
- /* Store BCCH-DLSCH data received in Scheduled slot */
- sf->bcch.tb = datReq->pdu;
-
- SCpyMsgMsg(datReq->pdu, RG_GET_MEM_REGION(rgCb[inst]),
- RG_GET_MEM_POOL(rgCb[inst]), &bcch->tb);
-
- return ROK;
- }
-
- bch = rgDBMGetBcchOnBch(cell);
- if ((bch) && (bch->lcId == datReq->lcId))
- {
- /* Store BCH data received in Scheduled slot */
- sf->bch.tb = datReq->pdu;
- return ROK;
- }
-#endif/*RGR_SI_SCH*/
- UNUSED(inst);
- pcch = rgDBMGetPcch(cell);
- if ((pcch) && (pcch->lcId == datReq->lcId))
- {
- /* Store PCCH-DLSCH data received in Scheduled slot */
- sf->pcch.tb = datReq->pdu;
- return ROK;
- }
-
- /* Handle lcCb fetch failure */
- DU_LOG("\nERROR --> MAC : rgROMHndlBcchPcchDatReq(): Invalid Lc Id");
- err->errCause = RGERR_ROM_INV_LC_ID;
-
- return RFAILED;
-} /* rgROMHndlBcchPcchDatReq */
-
-/**
- * @brief Handler for StaRsp received on RGU for a dedicated logical channel.
- *
- * @details
- *
- * Function : rgROMDedStaRsp
- *
- * This fucntion shall store the BO reported for the given logical
- * channel.
- *
- *
- * @param[in] Inst inst
- * @param[in] RgRguDedStaRsp *staRsp
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgROMDedStaRsp(Inst inst, RgRguDedStaRsp *staRsp)
-{
- RgCellCb *cell;
-
- /* Moving the error variables and assignments to available scope */
-
- /* Avoiding memset, as the variables of this are getting
- initialized */
-
-
- if(((cell = rgCb[inst].cell) != NULLP)
- && (cell->cellId == staRsp->cellId))
- {
- Pst schPst;
-#ifdef UNUSED_VAR
- RgInfDedBoRpt boRpt
- boRpt.cellSapId = cell->schInstMap.cellSapId;
- boRpt.cellId = staRsp->cellId;
- boRpt.rnti = staRsp->rnti;
- boRpt.lcId = staRsp->lcId;
- boRpt.bo = staRsp->boReport.bo;
- boRpt.oldestSduArrTime = staRsp->boReport.oldestSduArrTime;
- boRpt.staPduBo = staRsp->boReport.staPduBo;
- boRpt.oldestSduArrTime = staRsp->boReport.oldestSduArrTime;
-#endif
- rgGetPstToInst(&schPst,inst, cell->schInstMap.schInst);
- schPst.event = 0;
- //TODO: commented for compilation without SCH RgMacSchDedBoUpdt(&schPst, &boRpt);
- return ROK;
- }
- DU_LOG("\nERROR --> MAC : Invalid cell for CRNTI:%d LCID:%d ",
- staRsp->rnti,staRsp->lcId);
-
- return RFAILED;
-} /* rgROMDedStaRsp */
-
-S16 RgMacSchBrdcmDedBoUpdtReq(
-Inst inst,
-CmLteCellId cellId,
-CmLteRnti rnti,
-CmLteLcId lcId,
-S32 bo
-)
-{
-
- RgCellCb *cell;
- //if ((cell = rgDBMGetCellCb(cellId)) != NULLP)
- if (((cell = rgCb[inst].cell) != NULLP) &&
- (cell->cellId == cellId))
- {
- Pst schPst;
-#ifdef UNUSED_VAR
- RgInfDedBoRpt boRpt;
- boRpt.cellSapId = cell->schInstMap.cellSapId;
- boRpt.cellId = cellId;
- boRpt.rnti = rnti;
- boRpt.lcId = lcId;
- boRpt.bo = bo;
-#endif
- rgGetPstToInst(&schPst,inst, cell->schInstMap.schInst);
- schPst.event = 0;
- //TODO: commented for compilation without SCH RgMacSchDedBoUpdtReq (&schPst,&boRpt);
- }
- return ROK;
-}
-/**
- * @brief Handler for StaRsp received on RGU for a common logical channel.
- *
- * @details
- *
- * Function : rgROMCmnStaRsp
- *
- * This fucntion shall invoke rgROMHndlCcchStaRsp() for status response on
- * CCCH and shall invoke rgROMHndlBcchPcchStaRsp() for status response on
- * BCCH or PCCH.
- *
- *
- * @param[in] Inst inst
- * @param[in] RgRguCmnStaRsp *staRsp
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgROMCmnStaRsp(Inst inst, RgRguCmnStaRsp *staRsp)
-{
- RgCellCb *cell;
- RgErrInfo err;
-
- if(((cell = rgCb[inst].cell) == NULLP)
- || (cell->cellId != staRsp->cellId))
- {
- /* Handle Cell fetch failure */
- DU_LOG("\nERROR --> MAC : Invalid cell for CRNTI:%d LCID:%d",staRsp->u.rnti,staRsp->lcId);
- err.errType = RGERR_ROM_CMNSTARSP;
- err.errCause = RGERR_ROM_INV_CELL_ID;
- return RFAILED;
- }
-
- /* handle status response on CCCH */
- if(staRsp->lcId == cell->dlCcchId)
- {
- rgROMHndlCcchStaRsp(cell, staRsp, &err);
- }
- else
- {
- rgROMHndlBcchPcchStaRsp(cell, staRsp, &err);
- }
-
- return ROK;
-} /* rgROMCmnStaRsp */
-
-#ifdef LTE_L2_MEAS
-
-/**
- * @brief Handler for Request received on RGU for a UL Throughput measurement
- * enabled logical channel.
- *
- * @details
- *
- * Function :rgROML2MUlThrpMeasReq
- *
- * This function shall store the L2M UL Throughput Measurement status information
- * for the given logical channel.
- *
- *
- * @param[in] Inst inst
- * @param[in] RgRguL2MUlThrpMeasReq *measReq
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgROML2MUlThrpMeasReq(Inst inst, RgRguL2MUlThrpMeasReq *measReq)
-{
- RgCellCb *cell;
- RgUeCb *ue;
- uint8_t lcgId;
- uint8_t loop;
-
- if(((cell = rgCb[inst].cell) != NULLP)
- &&(cell->cellId == measReq->cellId))
- {
- if ((ue = rgDBMGetUeCb(cell, measReq->rnti)) != NULLP)
- {
- for(loop=0; loop<measReq->numLcId;loop++)
- {
- if ((rgDBMGetUlDedLcCb(ue, measReq->lcId[loop])) != NULLP)
- {
- ue->ul.lcCb[measReq->lcId[loop]].measOn = measReq->enbMeas;
- if(ue->ul.lcCb[measReq->lcId[loop]].measOn == FALSE)
- {
- lcgId=ue->ul.lcCb[measReq->lcId[loop]].lcgId;
- ue->ul.lcgArr[lcgId].lcgBsInfo.outStndngBs = 0;
- ue->ul.lcgArr[lcgId].lcgBsInfo.firstDatSegRcvd = FALSE;
- }
- }
- }
- return ROK;
- }
- }
- DU_LOG("\nERROR --> MAC : Invalid cell CRNTI:%d",
- measReq->rnti);
- return RFAILED;
-} /* rgROML2MUlThrpMeasReq */
-
-#endif
-
-/**
- * @brief Handler for StaRsp received on RGU for CCCH.
- *
- * @details
- *
- * Function : rgROMHndlCcchStaRsp
- *
- * This function shall fetch the raCb with the given RNTI and ask RAM to
- * update BO.
- *
- *
- * @param[in] RgCellCb *cell
- * @param[in] RgRguCmnStaRsp *staRsp
- * @param[out] RgErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgROMHndlCcchStaRsp(RgCellCb *cell,RgRguCmnStaRsp *staRsp, RgErrInfo *err)
-{
- Pst schPst;
- Inst macInst = cell->macInst - RG_INST_START;
- //RgInfCmnBoRpt boRpt;
-
-#ifdef UNUSED_VAR
- RgInfCmnBoRpt boRpt;
- boRpt.cellSapId = cell->schInstMap.cellSapId;
- boRpt.cellId = staRsp->cellId;
- boRpt.u.rnti = staRsp->u.rnti;
- boRpt.lcId = staRsp->lcId;
- boRpt.lcType = staRsp->lcType;
- boRpt.bo = staRsp->bo;
-#endif
- rgGetPstToInst(&schPst,macInst, cell->schInstMap.schInst);
- //TODO: commented for compilation without SCH RgMacSchCmnBoUpdt(&schPst, &boRpt);
-
- return ROK;
-} /* rgROMHndlCcchStaRsp */
-
-
-/**
- * @brief Handler for StaRsp received on RGU for BCCH or PCCH.
- *
- * @details
- *
- * Function : rgROMHndlBcchPcchStaRsp
- *
- * This function shall store the buffer and time to transmit in lcCb.
- *
- *
- * @param[in] RgCellCb *cell
- * @param[in] RgRguCmnStaRsp *staRsp
- * @param[out] RgErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgROMHndlBcchPcchStaRsp(RgCellCb *cell,RgRguCmnStaRsp *staRsp,RgErrInfo *err)
-{
- Pst schPst;
- //RgInfCmnBoRpt boRpt;
- Inst macInst = cell->macInst - RG_INST_START;
-
- memset(&schPst, 0, sizeof(Pst));
-
- if (rgDBMChkCmnLcCb(cell, staRsp->lcId) != ROK)
- {
- /* Handle lcCb fetch failure */
- DU_LOG("\nERROR --> MAC : Invalid LCID:%d",staRsp->lcId);
- err->errCause = RGERR_ROM_INV_LC_ID;
- return RFAILED;
- }
- /* MS_WORKAROUND : This is to ensure that the queue for BCH is not filled with old BO requests :
- This assumes that BO is not received more than 4 frames in advance from the enodeb application */
- if (cell->bcchBchInfo.lcId == staRsp->lcId)
- {
- uint16_t nextBchSfn;
-
- nextBchSfn = (cell->crntTime.sfn + 4 - (cell->crntTime.sfn%4)) % RG_MAX_SFN;
- if ((staRsp->u.timeToTx.sfn != nextBchSfn) ||
- ((staRsp->u.timeToTx.sfn == cell->crntTime.sfn) && (cell->crntTime.slot >= 7)))
- {
- return ROK;
- }
- }
-/*
- boRpt.cellSapId = cell->schInstMap.cellSapId;
- boRpt.cellId = staRsp->cellId;
- boRpt.u.timeToTx = staRsp->u.timeToTx;
- boRpt.lcId = staRsp->lcId;
- boRpt.lcType = staRsp->lcType;
- boRpt.bo = staRsp->bo;*/
-#ifdef EMTC_ENABLE
- if(cell->emtcEnable)
- {
- if(boRpt.lcType == CM_LTE_LCH_PCCH)
- {
- boRpt.emtcDIReason = staRsp->emtcDiReason;
- boRpt.pnb = staRsp->pnb;
- }
- }
-#endif
- rgGetPstToInst(&schPst,macInst, cell->schInstMap.schInst);
- //TODO: commented for compilation without SCH RgMacSchCmnBoUpdt(&schPst, &boRpt);
-
- return ROK;
-} /* rgROMHndlBcchPcchStaRsp */
-
-/* ADD Changes for Downlink UE Timing Optimization */
-#ifdef LTEMAC_DLUE_TMGOPTMZ
-/**
- * @brief Handler for updating DL SF information on receiving
- * DL dedicated data, CCCH, BCCH/PCCH data request.
- *
- * @details
- *
- * Function : rgROMUpdDLSfRemDataCnt
- *
- *
- * @param[in] RgCellCb *cell
- * @param[in] RgDlSf *dlSf;
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgROMUpdDlSfRemDataCnt(RgCellCb *cellCb, RgDlSf *dlSf)
-{
- RgErrInfo err;
- //Inst inst = cellCb->macInst - RG_INST_START;
-
- if(!dlSf->remDatReqCnt)
- {
- /*This is an error scenario of RLC generating more data
- * request than the allocation. Do nothing for this. */
- DU_LOG("\nERROR --> MAC : RX new data while remDatReqCnt is 0 for cell");
- return RFAILED;
- }
-
- /*Decrement the remaining data request to be received countter
- for this SF.
- Check if this was the last pending data request for this DL SF.*/
- /* Fix[ccpu00126310]: Tracks Data Requests from RLC for both loosely and tight coupled
- RLC-MAC */
- if((0 == --dlSf->remDatReqCnt) && !(dlSf->txDone) &&
- (RG_TIMEINFO_SAME(cellCb->crntTime, dlSf->schdTime)) && (dlSf->statIndDone))
- {
- /*Check if we have already received a TTI for this Data,
- if that is the case then we need to send TFU Data request
- to PHY */
-
- if (ROK != rgTOMUtlProcDlSf (dlSf, cellCb, &err))
- {
- DU_LOG("\nERROR --> MAC : Unable to process downlink slot for cell");
- err.errType = RGERR_ROM_DEDDATREQ;
- }
-
- /* Mark this frame as sent */
- dlSf->txDone = TRUE;
- }
-
- return ROK;
-} /* rgROMUpdDlSfRemDataCnt*/
-#endif
-
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Entry point fucntions
-
- File: rg_tom.c
-
-**********************************************************************/
-
-/** @file rg_tom.c
-@brief This module does processing related to handling of lower interface APIs
-invoked by PHY towards MAC
-*/
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "rgu.h" /* RGU defines */
-#include "tfu.h" /* RGU defines */
-#include "lrg.h" /* layer management defines for LTE-MAC */
-#include "crg.h" /* layer management defines for LTE-MAC */
-#include "rg_sch_inf.h" /* layer management defines for LTE-MAC */
-#include "rg.h" /* defines and macros for MAC */
-#include "rg_env.h" /* defines and macros for MAC */
-#include "rg_err.h" /* defines and macros for MAC */
-#include "rgm.h" /* layer management typedefs for MAC */
-
-/* header/extern include files (.x) */
-#include "crg.x" /* CRG interface typedefs */
-#include "rgu.x" /* RGU types */
-#include "tfu.x" /* RGU types */
-#include "lrg.x" /* layer management typedefs for MAC */
-#include "rg_sch_inf.x" /* SCH interface typedefs */
-#include "rg_prg.x" /* PRG interface typedefs */
-#include "rgm.x" /* layer management typedefs for MAC */
-#include "rg.x" /* typedefs for MAC */
-#ifdef MAC_RLC_UL_RBUF
-#include "ss_rbuf.h"
-#include "ss_rbuf.x"
-#endif
-
-/* ADD Changes for Downlink UE Timing Optimization */
-#ifndef LTEMAC_DLUE_TMGOPTMZ
-static S16 rgTOMUtlProcDlSf ARGS(( RgDlSf *dlSf, RgCellCb *cellCb,
- RgErrInfo *err));
-#else
-S16 rgTOMUtlProcDlSf ARGS((RgDlSf *dlSf, RgCellCb *cellCb,
- RgErrInfo *err));
-#endif
-static S16 rgTOMProcCrntiCEInDatInd ARGS((
-RgMacPdu *pdu,
-RgUeCb *prevUeCb,
-RgCellCb *cellCb,
-TfuDatInfo *datInfo,
-RgInfCeInfo *ceInfo,
-uint16_t slot
-));
-
-static S16 rgTOMProcCCCHSduInDatInd ARGS((
-RgMacPdu *pdu,
-RgUeCb *prevUeCb,
-RgCellCb *cellCb,
-TfuDatInfo *datInfo,
-RgInfCeInfo *ceInfo,
-uint16_t slot
-));
-
-S16 rgHndlFlowCntrl
-(
-RgCellCb *cell,
-RgInfSfAlloc *sfInfo
-);
-
-S16 RgUiRguFlowCntrlInd(Pst* pst, SuId suId, RguFlowCntrlInd *flowCntrlInd);
-#ifdef EMTC_ENABLE
-S16 rgEmtcHndl(RgCellCb *cell,RgInfSfAlloc *sfInfo);
-S16 rgTOMEmtcUtlFillDatReqPdus(TfuDatReqInfo *datInfo, RgDlSf *dlSf, RgCellCb *cell, RgErrInfo *err);
-Void rgTOMEmtcRlsSf(RgDlSf *dlSf);
-#endif
-#ifdef LTE_L2_MEAS
-static Void rgTOML2MCompileActiveLCs ARGS
-((
- RgCellCb *cellCb,
- RgUeCb *ueCb,
- RgMacPdu *pdu,
- RgInfCeInfo *ceInfo
- ));
-static S16 rgTOMUtlL2MStoreBufSz ARGS
-((
- RgUeCb *ueCb,
- RgInfCeInfo *ceInfo
- ));
-
-static S16 rgTomUtlPrepareL2MUlThrpInfo ARGS
-((
- RgCellCb *cellCb,
- RgUeCb *ueCb,
- RgRguDedDatInd *dDatInd
-));
-
-
-/* The below table takes lower values of BSR Range for a BSR value
- This is to ensure that outstanding can be decrease to zero upon reception of
- TB, which is not guaranteed if higher Range values are used */
- /* Note: taking value 10 for BSR index 1 */
-#ifndef MAC_5GTF_UPDATE
-static uint32_t rgLwrBsrTbl[64] = {
- 0, 10, 10, 12, 14, 17, 19, 22, 26,
- 31, 36, 42, 49, 57, 67, 78, 91,
- 107, 125, 146, 171, 200, 234, 274, 321,
- 376, 440, 515, 603, 706, 826, 967, 1132,
- 1326, 1552, 1817, 2127, 2490, 2915, 3413, 3995,
- 4677, 5476, 6411, 7505, 8787, 10287, 12043, 14099,
- 16507, 19325, 22624, 26487, 31009, 36304, 42502, 49759,
- 58255, 68201, 79846, 93479, 109439, 128125, 150000
-};
-#else
-
-static uint32_t rgLwrBsrTbl[64] = {
-0,10,13,16,19,23,29,35,43,53,65,80,98,120,147,181,223,274,337,414,
-509,625,769,945,1162,1429,1757,2161,2657,3267,4017,4940,6074,7469,
-9185,11294,13888,17077,20999,25822,31752,39045,48012,59039,72598,
-89272,109774,134986,165989,204111,250990,308634,379519,466683,
-573866,705666,867737,1067031,1312097,1613447,1984009,2439678,
-3000000};
-
-#endif
-
-#endif
-
-/* local defines */
-#define RG_TOM_INF_ALLOC(_pdu, _size, _dataPtr, _ret) {\
- _ret = cmGetMem((Ptr)&_pdu->memCp, _size, (Ptr *)&_dataPtr); \
-}
-
-/* global variables */
-uint32_t rgUlrate_tfu;
-#ifdef EMTC_ENABLE
-uint32_t grgUlrate_tfu;
-#endif
-
-/** @brief This function fills the PDSCH data of a downlink subframe
- *
- * @details
- *
- * Function: rgTOMUtlFillDatReqPdus
- *
- * Processing steps:
- * - Fill BCCH on DLSCH data using datInfo
- * - Fill PCCH on DLSCH data using datInfo
- * - Fill Dedicated data on DLSCH data using datInfo
- * - Fill RA RSP data using datInfo
- *
- * @param [out] TfuDatReqInfo *datInfo
- * @param [in] RgDlSf *dlSf
- * @param [in] RgCellCb *cellCb
- * @param [out] RgErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-static S16 rgTOMUtlFillDatReqPdus (TfuDatReqInfo *datInfo,RgDlSf *dlSf,RgCellCb *cellCb, RgErrInfo *err)
-{
- S16 ret;
- TfuDatReqPduInfo *datReq=NULLP;
- /* Moving node declaration to limited scope for optimization */
- RgDlHqProcCb *hqCb;
- uint8_t idx;
- Inst inst = cellCb->macInst - RG_INST_START;
-
-
- /* first lets send the BCCH data down to PHY */
- if (dlSf->bcch.tb != NULLP)
- {
- if ((ret = rgGetEventMem(inst,(Ptr *)&datReq, sizeof(TfuDatReqPduInfo),
- &(datInfo->memCp))) != ROK)
- {
- err->errCause = RGERR_TOM_MEM_EXHAUST;
- DU_LOG("\nERROR --> MAC : Memory Exhaustion ");
- return (ret);
- }
-#ifdef TFU_ALLOC_EVENT_NO_INIT
-#ifndef L2_OPTMZ
- datReq->mBuf[1] = 0;
-#else
- datReq->tbInfo[0].lchInfo[0].mBuf[0]=NULLP;
-#endif
-#endif
- datReq->rnti = RG_SI_RNTI;
- datReq->dciInfo = dlSf->bcch.pdcch.dci;
- /* Note: SCpyMsgMsg is not done since free of unsent buffer
- * has been taken care through cell delete by invoking rgTomRlsSf
- * during shutdown */
- datReq->nmbOfTBs = 1;
-#ifndef L2_OPTMZ
- datReq->mBuf[0] = dlSf->bcch.tb;
-#else
- SFndLenMsg((Buffer *)dlSf->bcch.tb, &(datReq->tbInfo[0].tbSize));
- datReq->tbInfo[0].tbPres = TRUE;
- datReq->tbInfo[0].lchInfo[0].mBuf[0] = dlSf->bcch.tb;
- datReq->tbInfo[0].numLch = 1;
- datReq->tbInfo[0].lchInfo[0].numPdu = 1;
-
-#ifdef TFU_ALLOC_EVENT_NO_INIT
- datReq->tbInfo[1].tbPres = FALSE;
- datReq->tbInfo[1].lchInfo[0].mBuf[0] = NULLP;
-#endif
-#endif
- cmLListAdd2Tail(&datInfo->pdus, &(datReq->lnk));
- datReq->lnk.node = (PTR)datReq;
-#ifdef TFU_UPGRADE
- /* ccpu00132314-ADD- Adding txPower offset for the PDSCH transmission */
- datReq->txPwrOffset = dlSf->bcch.txPwrOffset;
-#endif
- /* Setting the pointer to NULL post transmission */
- dlSf->bcch.tb = NULLP;
- }
- /* Fill PCCH data */
- if (dlSf->pcch.tb != NULLP)
- {
- if ((ret = rgGetEventMem(inst,(Ptr *)&datReq, sizeof(TfuDatReqPduInfo),
- &(datInfo->memCp))) != ROK)
- {
- err->errCause = RGERR_TOM_MEM_EXHAUST;
- DU_LOG("\nERROR --> MAC : Memory Exhaustion CRNTI:%d",datReq->rnti);
- return (ret);
- }
-#ifdef TFU_ALLOC_EVENT_NO_INIT
-#ifndef L2_OPTMZ
- datReq->mBuf[1] = 0;
-#endif
-#endif
- datReq->rnti = RG_P_RNTI;
- datReq->dciInfo = dlSf->pcch.pdcch.dci;
- datReq->nmbOfTBs = 1;
-#ifndef L2_OPTMZ
- datReq->mBuf[0] = dlSf->pcch.tb;
-#else
- SFndLenMsg((Buffer *)dlSf->pcch.tb, &datReq->tbInfo[0].tbSize);
- datReq->tbInfo[0].tbPres = TRUE;
- datReq->tbInfo[0].lchInfo[0].mBuf[0] = dlSf->pcch.tb;
-#ifdef TFU_ALLOC_EVENT_NO_INIT
- datReq->tbInfo[1].tbPres = FALSE;
- datReq->tbInfo[1].lchInfo[0].mBuf[0] = NULLP;
-#endif
- datReq->tbInfo[0].numLch = 1;
- datReq->tbInfo[0].lchInfo[0].numPdu = 1;
-#endif
- cmLListAdd2Tail(&datInfo->pdus, &(datReq->lnk));
- datReq->lnk.node = (PTR)datReq;
-#ifdef TFU_UPGRADE
- /* ccpu00132314-ADD- Adding txPower offset for the PDSCH transmission */
- datReq->txPwrOffset = dlSf->pcch.txPwrOffset;
-#endif
- dlSf->pcch.tb = NULLP;
- }
-
- for(idx=0; idx < dlSf->numRaRsp; idx++)
- {
- if ((ret = rgGetEventMem(inst,(Ptr *)&datReq, sizeof(TfuDatReqPduInfo),
- &(datInfo->memCp))) != ROK)
- {
- err->errCause = RGERR_TOM_MEM_EXHAUST;
- DU_LOG("\nERROR --> MAC : Memory Exhaustion CRNTI:%d",
- datReq->rnti);
- return (ret);
- }
-#ifdef TFU_ALLOC_EVENT_NO_INIT
-#ifndef L2_OPTMZ
- datReq->mBuf[1] = 0;
-#endif
-#endif
- datReq->rnti = dlSf->raRsp[idx].pdcch.rnti;
- datReq->dciInfo = dlSf->raRsp[idx].pdcch.dci;
- datReq->nmbOfTBs = 1;
-#ifndef L2_OPTMZ
- datReq->mBuf[0] = dlSf->raRsp[idx].rar;
-#else
- SFndLenMsg((Buffer *)dlSf->raRsp[idx].rar, &datReq->tbInfo[0].tbSize);
- datReq->tbInfo[0].tbPres = TRUE;
- datReq->tbInfo[0].lchInfo[0].mBuf[0] = dlSf->raRsp[idx].rar;
-#ifdef TFU_ALLOC_EVENT_NO_INIT
- datReq->tbInfo[1].lchInfo[0].mBuf[0] = NULLP;
- datReq->tbInfo[1].tbPres = FALSE;
-#endif
- datReq->tbInfo[0].numLch = 1;
- datReq->tbInfo[0].lchInfo[0].numPdu = 1;
- // prc_trace_format_string(0x40,3,"UE Id=(%d) tbSz=(%d)",datReq->rnti, datReq->tbInfo[0].tbSize);
-#endif
- cmLListAdd2Tail(&datInfo->pdus, &(datReq->lnk));
- datReq->lnk.node = (PTR)datReq;
-#ifdef TFU_UPGRADE
- /* ccpu00132314-ADD- Adding txPower offset for the PDSCH transmission */
- datReq->txPwrOffset = dlSf->raRsp[idx].txPwrOffset;
-#endif
- dlSf->raRsp[idx].rar = NULLP;
- }
-
- /* Fill Dedicated UE data */
- if (dlSf->tbs.count != 0)
- {
- CmLList *node;
- while (dlSf->tbs.first)
- {
- node = dlSf->tbs.first;
- hqCb = (RgDlHqProcCb*)node->node;
- if ((ret = rgDHMSndDatReq (cellCb, dlSf, datInfo, hqCb, err)) != ROK)
- {
- DU_LOG("\nERROR --> MAC : DHM unable to fill DATA request");
- err->errType = RGERR_TOM_TTIIND;
- continue;
- }
- } /* end of while */
- }
-
- return ROK;
-} /* end of rgTOMUtlFillDatReqPdus*/
-
-/** @brief This function does all the processing related to a single downlink
- * subframe.
- *
- * @details
- *
- * Function: rgTOMUtlProcDlSf
- *
- * Processing steps:
- * - collate control data for all UEs and send to PHY
- * - collate data buffers for all UEs and send to PHY
- *
- * @param [in] RgDlSf *dlSf
- * @param [in] RgCellCb *cellCb
- * @param [out] RgErrInfo *err
- * @return S16
- */
-/* ADD Changes for Downlink UE Timing Optimization */
-#ifndef LTEMAC_DLUE_TMGOPTMZ
-static S16 rgTOMUtlProcDlSf(RgDlSf *dlSf,RgCellCb *cellCb,RgErrInfo *err)
-#else
-S16 rgTOMUtlProcDlSf(RgDlSf *dlSf,RgCellCb *cellCb,RgErrInfo *err)
-#endif
-{
- S16 ret;
- TfuDatReqInfo *datInfo;
- Inst inst = cellCb->macInst - RG_INST_START;
-
-
- /* Fill Data Request Info from scheduler to PHY */
- if ((ret = rgAllocEventMem(inst,(Ptr *)&datInfo,
- sizeof(TfuDatReqInfo))) != ROK)
- {
- DU_LOG("\nERROR --> MAC : Unable to Allocate TfuDatReqInfo");
- return (ret);
- }
- else
- {
- cmLListInit(&datInfo->pdus);
-#ifdef LTE_TDD
- RGADDTOCRNTTIME(dlSf->schdTime, datInfo->timingInfo, TFU_DELTA);
-#else
- RGADDTOCRNTTIME(dlSf->schdTime, datInfo->timingInfo, TFU_DLDATA_DLDELTA);
-#endif
- datInfo->cellId = cellCb->cellId;
- if((0 == (datInfo->timingInfo.sfn % 30)) && (0 == datInfo->timingInfo.slot))
- {
- //DU_LOG("5GTF_CHECK rgTOMUtlProcDlSf dat (%d : %d)\n", datInfo->timingInfo.sfn, datInfo->timingInfo.slot);
- }
-#ifdef TFU_ALLOC_EVENT_NO_INIT
- datInfo->bchDat.pres = 0;
-#endif
-
- /* Fill BCH data */
- if (dlSf->bch.tb != NULLP)
- {
- datInfo->bchDat.pres = PRSNT_NODEF;
- datInfo->bchDat.val = dlSf->bch.tb;
- dlSf->bch.tb = NULLP;
- }
-#ifdef EMTC_ENABLE
- /* Fill the DLSCH PDUs of BCCH, PCCH and Dedicated Channels */
- if ((ret = rgTOMEmtcUtlFillDatReqPdus(datInfo, dlSf, cellCb, err)) != ROK)
- {
- RG_FREE_MEM(datInfo);
- return (ret);
- }
-#endif
- /* Fill the DLSCH PDUs of BCCH, PCCH and Dedicated Channels */
- if ((ret = rgTOMUtlFillDatReqPdus(datInfo, dlSf, cellCb, err)) != ROK)
- {
- DU_LOG("\nERROR --> MAC : Unable to send data for cell");
- RG_FREE_MEM(datInfo);
- return (ret);
- }
- if((datInfo->pdus.count) || (datInfo->bchDat.pres == TRUE))
- {
- /* sending the data to Phy */
- //if (rgLIMTfuDatReq(inst,datInfo) != ROK)
- {
- DU_LOG("\nERROR --> MAC : Unable to send data info for cell");
- }
- }
- else
- {
- /* Nothing to send: free the allocated datInfo */
- RG_FREE_MEM(datInfo);
- }
- }
- return ROK;
-} /* end of */
-
-uint32_t rgMacGT;
-
-/** @brief This function allocates the RgMacPdu that will be populated by DEMUX
- * with the SubHeaders list and the values of the Control elements.
- *
- * @details
- *
- * Function: rgTOMUtlAllocPduEvnt
- *
- * Processing steps:
- * @param[in] Inst inst
- * @param [out] RgMacPdu **pdu
- *
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-static S16 rgTOMUtlAllocPduEvnt (Inst inst,RgMacPdu **pdu)
-{
-
- Mem evntMem;
- RgUstaDgn dgn; /* Alarm diagnostics structure */
- volatile uint32_t startTime=0;
-
-
- evntMem.region = rgCb[inst].rgInit.region;
- evntMem.pool = rgCb[inst].rgInit.pool;
-
- /*starting Task*/
- SStartTask(&startTime, PID_TOMUTL_CMALLCEVT);
-
-#ifdef MS_MBUF_CORRUPTION /* Should be enabled when debugging mbuf corruption */
- MS_BUF_ADD_ALLOC_CALLER();
-#endif /* */
-
- if (cmAllocEvnt (sizeof (RgMacPdu), RG_BLKSZ, &evntMem, (Ptr*)pdu) != ROK)
- {
- rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
- rgLMMStaInd(inst,LCM_CATEGORY_RESOURCE, LCM_EVENT_DMEM_ALLOC_FAIL,
- LCM_CAUSE_MEM_ALLOC_FAIL, &dgn);
- DU_LOG("\nERROR --> MAC : Allocation of DUX event failed");
- return RFAILED;
- }
-
- /*stoping Task*/
- SStopTask(startTime, PID_TOMUTL_CMALLCEVT);
-
- return ROK;
-} /* end of */
-
-/** @brief This function frees up the RgMacPdu structure that has been
- * populated by demux.
- *
- * @details
- *
- * Function: rgTOMUtlFreePduEvnt
- * - Function frees up the RgMacPdu structure, in case of error it shall
- * free up the buffer's present in the different sdu.
- *
- * Processing steps:
- * @param [in] Inst inst
- * @param [in] RgMacPdu *pdu
- * @param [in] Bool *error
- * @return
- */
-static Void rgTOMUtlFreePduEvnt( RgMacPdu *pdu,Bool error)
-{
-
- RgMacSdu *sdu;
- CmLList *node;
-
- /* Steps of freeing up the PDU.
- * 1. loop through the subHdrLst and free up all the buffers.
- * 2. free up the whole event
- */
- if ((error == TRUE) && (pdu->sduLst.count > 0))
- {
- node = pdu->sduLst.first;
- while (node)
- {
- sdu = (RgMacSdu*)node->node;
- RG_FREE_MSG(sdu->mBuf);
- node = node->next;
- }
- }
- RG_FREE_MEM(pdu);
- return;
-} /* end of rgTOMUtlFreePduEvnt */
-
-/** @brief This function allocates the RgMacPdu that will be populated by DEMUX
- * with the SubHeaders list and the values of the Control elements.
- *
- * @details
- *
- * Function: rgTOMInfAllocPduEvnt
- *
- * Processing steps:
- * @param [in] Inst inst
- * @param [out] RgMacPdu **pdu
- *
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-static S16 rgTOMInfAllocPduEvnt (Inst inst,RgInfSfDatInd **sfInfo)
-{
-
- Mem evntMem;
- RgUstaDgn dgn; /* Alarm diagnostics structure */
- volatile uint32_t startTime=0;
-
-
- evntMem.region = rgCb[inst].rgInit.region;
- evntMem.pool = rgCb[inst].rgInit.pool;
-
- /*starting Task*/
- SStartTask(&startTime, PID_TOMINF_CMALLCEVT);
-
-#ifdef MS_MBUF_CORRUPTION /* Should be enabled when debugging mbuf corruption */
- MS_BUF_ADD_ALLOC_CALLER();
-#endif /* */
- if (cmAllocEvnt (sizeof (RgInfSfDatInd), RG_BLKSZ, &evntMem, (Ptr*)sfInfo) != ROK)
- {
- rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
- rgLMMStaInd(inst,LCM_CATEGORY_RESOURCE, LCM_EVENT_DMEM_ALLOC_FAIL,
- LCM_CAUSE_MEM_ALLOC_FAIL, &dgn);
- DU_LOG("\nERROR --> MAC : Allocation failed");
- return RFAILED;
- }
-
- /*stoping Task*/
- SStopTask(startTime, PID_TOMINF_CMALLCEVT);
-
- return ROK;
-} /* end of */
-
-/** @brief This function frees up the RgMacPdu structure that has been
- * populated by demux.
- *
- * @details
- *
- * Function: rgTOMInfFreePduEvnt
- * - Function frees up the RgMacPdu structure, in case of error it shall
- * free up the buffer's present in the different sdu.
- *
- * Processing steps:
- * @param [in] RgMacPdu *pdu
- * @param [in] Bool *error
- * @return
- */
-static Void rgTOMInfFreePduEvnt(RgInfSfDatInd *sfInfo)
-{
-
- RG_FREE_MEM(sfInfo);
- return;
-} /* end of rgTOMUtlFreePduEvnt */
-
-#ifdef LTE_L2_MEAS
-
-/** @brief This function performs the preparation of information needed to set
- * L2M Scheduled UL Throughput Information for a particular UE.
- *
- * @details
- *
- * Function: rgTomUtlPrepareL2MUlThrpInfo
- * This function performs the preparation of information needed to set
- * L2M Scheduled UL Throughput Information for a particular UE.
- *
- *
- * Processing steps:
- * @param [in] RgCellCb *cellCb
- * @param [in] RgUeCb *ueCb
- * @param [out] RgRguDedDatInd *dDatInd
- * @return
- */
-static S16 rgTomUtlPrepareL2MUlThrpInfo(RgCellCb *cellCb,RgUeCb *ueCb,RgRguDedDatInd *dDatInd)
-{
- uint8_t lcId;
- uint8_t lcgId;
- uint8_t loop;
-
- dDatInd->burstInd = RGU_L2M_UL_BURST_END;
- for(loop=0;loop<dDatInd->numLch;loop++)
- {
- lcId=dDatInd->lchData[loop].lcId;
- if (lcId)
- {
- lcgId = ueCb->ul.lcCb[lcId - 1].lcgId;
- if(ueCb->ul.lcgArr[lcgId].lcgBsInfo.outStndngBs > 0)
- {
- dDatInd->burstInd = RGU_L2M_UL_BURST_START;
- break;
- }
- }
- }
-
- return ROK;
-}
-
-#endif
-
-/** @brief This function is called by rgTOMDatInd. This function invokes the
- * scheduler with the information of the received Data and any Control Elements
- * if present. Also it generates Data indications towards the higher layers.
- *
- * @details
- *
- * Function:
- *
- * Processing steps:
- * - Retrieves the RaCb with the rnti provided, if it doesnt exist
- * return failure.
- * - If UE exists then update the Schduler with any MAC CEs if present.
- * - Invoke RAM module to do Msg3 related processing rgRAMProcMsg3
- * - Loop through the SDU subheaders and invoke either a common data
- * indication (rgUIMSndCmnDatInd) or dedicated data indication
- * (rgUIMSndDedDatInd) towards the higher layers.
- *
- * @param [in] RgCellCb *cellCb
- * @param [in] RgUeCb *ueCb
- * @param [in] CmLteRnti rnti
- * @param [in] RgMacPdu *pdu
- * @param [out] uint32_t *lcgBytes
- *
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-RgUeCb *glblueCb4;
-RgUeCb *glblueCb5;
-
-#ifdef LTEMAC_SPS
- static S16 rgTOMUtlProcMsg
-(
- RgCellCb *cellCb,
- RgUeCb *ueCb,
- RgMacPdu *pdu,
- Bool isSpsRnti,
- Bool *spsToBeActvtd,
- uint16_t *sduSize,
- uint16_t slot,
- uint32_t *lcgBytes
- )
-#else /* LTEMAC_SPS */
- static S16 rgTOMUtlProcMsg
-(
- RgCellCb *cellCb,
- RgUeCb *ueCb,
- RgMacPdu *pdu,
- uint16_t slot,
- uint32_t *lcgBytes
- )
-#endif
-{
- Inst inst = cellCb->macInst - RG_INST_START;
- S16 ret;
- RgRguCmnDatInd *cDatInd;
- RgRguDedDatInd *dDatInd;
- CmLList *node;
- RgMacSdu *sdu;
- MsgLen ccchSz;
- MsgLen cpySz;
-#ifdef LTEMAC_SPS
- Pst schPst1;
- // RgInfSpsRelInfo relInfo;
-#endif
-
-#ifdef LTE_L2_MEAS
- uint8_t idx1;
- uint8_t idx2;
- RgUlSf *ulSf;
- uint16_t totalBytesRcvd = 0;
- uint16_t sduLen[RGU_MAX_LC] = {0};
- uint8_t qciVal[RGU_MAX_LC] = {0};
- uint8_t numPrb = 0;
-
-#endif
- uint8_t lcgId;
- MsgLen bufSz;
-
- /* Moved outside of LTE_L2_MEAS
- * scope as this pointer will now be used to
- * check for valid Logical Channel ID
- */
- RgUlLcCb *ulLcCb;
-
- cDatInd = NULLP;
- dDatInd = NULLP;
-#ifdef LTE_L2_MEAS
- ulSf = NULLP;
- idx1 = 0;
- idx2 = 0;
-#endif
-#ifdef SS_RBUF
- Void *elem = NULLP;
-#endif
-
- ulLcCb = NULLP;
-
-
-#ifndef LTE_L2_MEAS
- UNUSED(slot);
-#endif
-
- if(pdu->sduLst.first)
- {
- sdu = (RgMacSdu*)(pdu->sduLst.first->node);
- glblueCb4 = ueCb;
- if ((sdu->lcId == RG_CCCH_LCID))
- {
- /* code for common channel dat indications */
- if ((ret = rgAllocShrablSBuf (inst,(Data**)&cDatInd, sizeof(RgRguCmnDatInd))) != ROK)
- {
- return RFAILED;
- }
- cDatInd->cellId = cellCb->cellId;
- cDatInd->rnti = ueCb->ueId;
- /* rg001.101: Corrected lcId value for common data indication */
- cDatInd->lcId = cellCb->ulCcchId;
- cDatInd->pdu = sdu->mBuf;
- SFndLenMsg (sdu->mBuf, &ccchSz);
- /* Fix : syed Contention resolution ID copy should consider only
- * 6 bytes of information from sdu->mBuf. Incase of CCCH sdu for reest
- * message/psuedo reest message, ccchSz can go beyond 6 and can corrupt
- * other fields of ueCb. */
- if (ccchSz >= RG_CRES_LEN)
- {
- SCpyMsgFix (sdu->mBuf, (MsgLen)0, RG_CRES_LEN, ueCb->contResId.resId,
- &cpySz);
- }
-#ifdef XEON_SPECIFIC_CHANGES
- CM_LOG_DEBUG(CM_LOG_ID_MAC, "CCCH SDU of size(%d) received for UE(%d) CRES[0x%x 0x%x 0x%x 0x%x 0x%x 0x%x] Time[%d %d]\n", ((S16)ccchSz), ueCb->ueId,ueCb->contResId.resId[0], ueCb->contResId.resId[1], ueCb->contResId.resId[2], ueCb->contResId.resId[3], ueCb->contResId.resId[4], ueCb->contResId.resId[5], cellCb->crntTime.sfn, cellCb->crntTime.slot);
-#endif
- sdu->mBuf = NULLP;
- rgUIMSndCmnDatInd(inst,cellCb->rguUlSap,cDatInd);
- return ROK;
- } /* end of common channel processing */
-#ifndef SS_RBUF
- if ((ret = rgAllocShrablSBuf (inst,(Data**)&dDatInd, sizeof(RgRguDedDatInd))) != ROK)
- {
- return RFAILED;
- }
-#else
- glblueCb5 = ueCb;
- elem = SRngGetWIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
- if (NULLP == elem)
- {
- return RFAILED;
- }
- dDatInd = (RgRguDedDatInd *)elem;
- memset(dDatInd, 0x00, sizeof(RgRguDedDatInd));
-#endif
- dDatInd->cellId = cellCb->cellId;
- dDatInd->rnti = ueCb->ueId;
- dDatInd->numLch = 0;
- }
-#ifdef LTE_L2_MEAS
- ulSf = &cellCb->ulSf[(slot % RG_NUM_SUB_FRAMES)];
- if(ulSf->ueUlAllocInfo != NULLP)
- {
- for(idx1 = 0; idx1 < ulSf->numUe; idx1++)
- {
- if(ulSf->ueUlAllocInfo[idx1].rnti == ueCb->ueId)
- {
- numPrb = ulSf->ueUlAllocInfo[idx1].numPrb;
- break;
- }
- }
- }
-#endif
- node = pdu->sduLst.first;
- while (node)
- {
- sdu = (RgMacSdu*)node->node;
-
- ulLcCb = rgDBMGetUlDedLcCb (ueCb, sdu->lcId);
-
- if(ulLcCb == NULLP)
- {
- DU_LOG("\nERROR --> MAC : Unconfigured LCID:%d CRNTI:%d"
- ,sdu->lcId,ueCb->ueId);
- /* ccpu00128443: Fix for memory leak */
- /* Fix : syed Neccessary to set sdu->mBuf = NULLP */
- RG_FREE_MSG(sdu->mBuf);
- node = node->next;
- continue;
- }
-#ifdef RLC_STA_PROC_IN_MAC/* RLC Status PDU Processing */
- {
- S16 rlcProcDlStatusPdu(Pst *udxPst,SuId suId,
- CmLteCellId cellId,CmLteRnti rnti,CmLteLcId lcId,Buffer *rlcSdu);
-
- if(ROK == rlcProcDlStatusPdu(&(cellCb->rguDlSap->sapCfg.sapPst),
- cellCb->rguDlSap->sapCfg.suId,
- cellCb->cellId,ueCb->ueId,sdu->lcId,sdu->mBuf))
- {
- RG_FREE_MSG(sdu->mBuf);
- node = node->next;
- continue;
- }
- }
-#endif
-
- /* ccpu00116477- Fixed the rgUIMSndDedDatInd condition when we receive 11 sdus in the
- * list we are losing 11th sdu and sending the first 10 sdus again which
- * is causing the duplicate packets and eNB crashing due to access
- * of the freed memory */
- if (dDatInd->numLch >= RGU_MAX_LC)
- {
- if ((ret = rgUIMSndDedDatInd(inst,ueCb->rguUlSap,dDatInd)) != ROK)
- {
- DU_LOG("\nERROR --> MAC : Failed to send datIndication to RGU CRNTI:%d",ueCb->ueId);
- return (ret);
- }
-#ifndef SS_RBUF
- if ((ret = rgAllocShrablSBuf (inst,(Data**)&dDatInd, sizeof(RgRguDedDatInd))) != ROK)
- {
- return RFAILED;
- }
-#else
- elem = SRngGetWIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
- if (NULLP == elem)
- {
- return RFAILED;
- }
- dDatInd = (RgRguDedDatInd *)elem;
- memset(dDatInd, 0x00, sizeof(RgRguDedDatInd));
-#endif
- dDatInd->cellId = cellCb->cellId;
- dDatInd->rnti = ueCb->ueId;
- dDatInd->numLch = 0;
- }
- dDatInd->lchData[dDatInd->numLch].lcId = sdu->lcId;
- dDatInd->lchData[dDatInd->numLch].pdu.mBuf[dDatInd->lchData[dDatInd->numLch].pdu.numPdu] = sdu->mBuf;
- dDatInd->lchData[dDatInd->numLch].pdu.numPdu++;
- lcgId = ulLcCb->lcgId;
- SFndLenMsg(sdu->mBuf, &bufSz);
-#ifdef LTE_L2_MEAS
- if(ulLcCb->measOn)
- {
- ueCb->ul.lcgArr[lcgId].lcgBsInfo.outStndngBs -= bufSz;
- }
-#endif
- //if ((lcgBytes != NULLP) && (ueCb->ul.lcgArr[lcgId].isGbr == TRUE))
- if (lcgBytes != NULLP)
- {
- lcgBytes[lcgId] += bufSz;
- }
- sdu->mBuf = NULLP;
- dDatInd->numLch++;
-#ifdef LTEMAC_SPS
- /* Check if data has come on SPS LC */
- /* KWORK_FIX: Modified the index from lcId to lcId-1 for handling lcId 10 properly */
- if (ueCb->ul.spsLcId[sdu->lcId-1] == TRUE)
- {
- ueCb->ul.spsDatRcvd++;
- }
-
- if(isSpsRnti)
- {
- /* Data rcvd on CRNTI*/
- /* Retrieve the LCG ID of the LCID*/
- /* SPS LCG has data whose size > SID Size */
- /* Activate SPS if data recvd on SPS LCID and size > SID Packet Size */
- if((ueCb->ul.spsLcId[sdu->lcId-1] == TRUE) &&
- (sdu->len > RG_SPS_SID_PACKET_SIZE))
- {
- *spsToBeActvtd = TRUE;
- *sduSize = sdu->len;
- }
- }
-
-#endif
-
-#ifdef LTE_L2_MEAS
- if(cellCb->qciArray[ulLcCb->qci].mask == TRUE)
- {
- sduLen[ulLcCb->qci] = sdu->len;
- totalBytesRcvd += sdu->len;
- qciVal[ulLcCb->qci] = ulLcCb->qci;
- }
-#endif
- node = node->next;
- } /* end of while for SubHeaders */
-#ifdef LTE_L2_MEAS
- for(idx2 = 0; idx2 < RGU_MAX_LC; idx2++)
- {
- if((cellCb->qciArray[qciVal[idx2]].mask == TRUE) &&
- totalBytesRcvd > 0)
- {
- cellCb->qciArray[qciVal[idx2]].prbCount +=
- ((numPrb * sduLen[idx2]) / totalBytesRcvd);
- }
-
- /* RRM_RBC_X */
- if(totalBytesRcvd > 0 && qciVal[idx2] > 0)
- {
- RG_UPD_GBR_PRB(cellCb, qciVal[idx2], ((numPrb * sduLen[idx2])/totalBytesRcvd));
- }
- /* RRM_RBC_Y */
- }
-#endif
- /*Added for explicit release - start*/
-#ifdef LTEMAC_SPS
-
- if(isSpsRnti && dDatInd && dDatInd->numLch)
- {
- if(ueCb->ul.spsDatRcvd != 0)
- {
- ueCb->ul.explRelCntr = 0;
- ueCb->ul.spsDatRcvd = 0;
- }
- else
- {
- ueCb->ul.explRelCntr++;
- if (ueCb->ul.explRelCntr == ueCb->ul.explRelCnt)
- {
- ueCb->ul.explRelCntr = 0;
- /* Indicate scheduler for explicit release */
- memset(&schPst1, 0, sizeof(Pst));
- rgGetPstToInst(&schPst1,inst, cellCb->schInstMap.schInst);
- //TODO: commented for compilation without SCH
-#if 0
- relInfo.cellSapId = cellCb->schInstMap.cellSapId;
- relInfo.cRnti = ueCb->ueId;
- relInfo.isExplRel = TRUE;
- /* Release indicator is called now through the matrix in the function below */
- //TODO: commented for compilation without SCH RgMacSchSpsRel( &schPst1, &relInfo );
-#endif
- ueCb->ul.implRelCntr = 0;
- }
- }
- }
- else
- {
- /* SPS_FIX */
- if(ueCb->ul.spsDatRcvd != 0)
- {
- //ueCb->ul.implRelCntr = 0;
- ueCb->ul.explRelCntr = 0;
- ueCb->ul.spsDatRcvd = 0;
- }
- }
-#endif
- /*Added for explicit release - end */
-
- if((dDatInd) && (dDatInd->numLch))
- {
-#ifdef LTE_L2_MEAS
- rgTomUtlPrepareL2MUlThrpInfo(cellCb, ueCb,dDatInd);
-
- RG_CALC_TTI_CNT(cellCb, dDatInd->ttiCnt);
-#endif
- if ((ret = rgUIMSndDedDatInd(inst,ueCb->rguUlSap,dDatInd)) != ROK)
- {
- DU_LOG("\nERROR --> MAC : Failed to send datIndication to RGU CRNTI:%d",ueCb->ueId);
- return (ret);
- }
- }
-#ifndef SS_RBUF
- else if((dDatInd) && (0 == dDatInd->numLch))
- {
- /* Free the memory allocated for dDatInd if we
- * have no valid LCH PDU to send to RLC.*/
- rgFreeSharableSBuf(inst,(Data **)&dDatInd,sizeof(RgRguDedDatInd));
- }
-#endif
- return ROK;
-} /* end of */
-
-/** @brief This function frees up the RgMacPdu structure that has been
- * populated by demux.
- *
- * @details
- *
- * Function: rgTOMUtlInsSchInfo
- * - Function frees up the RgMacPdu structure, in case of error it shall
- * free up the buffer's present in the different sdu.
- *
- * Processing steps:
- * @param [in] RgMacPdu *pdu
- * @param [in] Bool *error
- * @return
- */
-#ifdef LTEMAC_SPS
- static S16 rgTOMUtlInsSchInfo
-(
- RgMacPdu *pdu,
- RgInfSfDatInd *sfInfo,
- RgInfCeInfo *ceInfo,
- CmLteRnti rnti,
- Bool spsToBeActvtd,
- uint16_t sduSize,
- uint32_t *lcgBytes
- )
-#else
- static S16 rgTOMUtlInsSchInfo
-(
- RgMacPdu *pdu,
- RgInfSfDatInd *sfInfo,
- RgInfCeInfo *ceInfo,
- CmLteRnti rnti,
- uint32_t *lcgBytes
- )
-#endif
-{
- S16 ret;
- RgInfUeDatInd *ueInfo;
- uint32_t lcgId = 0;
- uint32_t idx = 0;
-
-
- RG_TOM_INF_ALLOC(sfInfo, sizeof(RgInfUeDatInd), ueInfo, ret);
-
- if(ROK != ret)
- {
- return RFAILED;
- }
-
- ueInfo->rnti = rnti;
-
- ueInfo->ceInfo = *ceInfo;
- ueInfo->ueLstEnt.node = (PTR)ueInfo;
- for (lcgId = 1, idx = 0; lcgId < RGINF_MAX_LCG_PER_UE; lcgId++)
- {
- if (lcgBytes[lcgId] != 0)
- {
- /* Only GBR bytes */
- ueInfo->lcgInfo[idx].lcgId = lcgId;
- ueInfo->lcgInfo[idx++].bytesRcvd = lcgBytes[lcgId];
- lcgBytes[lcgId] = 0;
- }
- }
- cmLListAdd2Tail(&sfInfo->ueLst, &ueInfo->ueLstEnt);
- return ROK;
-} /* end of rgTOMUtlInsSchInfo */
-
-#include <stdlib.h>
-/**
- * @brief Handler for processing data indication recieved from PHY for UEs.
- *
- * @details
- *
- * Function: rgTOMDatInd
- *
- * Handler for processing data indication recieved from PHY for UEs.
- *
- * Invoked by: RgLiTfuDatInd of LIM
- *
- * Processing Steps:
- * For each DataInfo recieved
- * - Validate the information received and retrieve cellCb
- * Validate cellId, rnti
- * - Call De-Mux module to decode the data rgDUXDemuxData
- * - If received a CRNTI control element
- * - Check if a CCCH SDU is present, if it is return failure
- * - Check for the existence of UE, if its isnt present return failure.
- * - Delegate the remaining processing to rgTOMUtlProcMsg3 which
- * primarily informs the scheduler about the data received and
- * generates Data indications towards the higher layer.
- * - If only CCCH SDU is present
- * - Invoke rgTOMUtlProcMsg3 for further processing.
- * - If its a non-Msg3 PDU i.e. received outside of a RA procedure
- * - Retrieve the UeCB
- * - Validate that the received PDU contains only configured Logical
- * Channels.
- * - Invoke rgTOMUtlProcDatPdu for further processing. It informs the
- * scheduler with the information of the received Data and generates
- * DatIndications towards the higher layers.
- *
- * @param [in] Inst inst
- * @param[in] TfuDatIndInfo *datInd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgTOMDatInd(Inst inst, TfuDatIndInfo *datInd)
-{
- S16 ret = ROK;
- RgErrInfo err;
- RgUeCb *ueCb;
- RgUeCb *prevUeCb = NULLP;
- RgCellCb *cellCb;
- RgMacPdu *pdu;
- RgInfSfDatInd *sfInfo;
- RgInfCeInfo ceInfo;
- Pst schPst;
- CmLList *node;
- TfuDatInfo *datInfo;
- RgLowSapCb *tfuSap;
- uint16_t slot;
-#ifdef LTEMAC_SPS
- Bool isSpsRnti=FALSE;
- Pst schPst1;
- // RgInfSpsRelInfo relInfo;
- Bool spsToBeActvtd = FALSE;
- uint16_t sduSize = 0;
-#endif
- uint32_t lcgBytes[RGINF_MAX_LCG_PER_UE];
-
-
-#ifdef STUB_TTI_HANDLING_5GTF
- node = datInd->datIndLst.first;
- for (;node; node=node->next)
- {
- datInfo = (TfuDatInfo*)node->node;
- {
- MsgLen len;
- SFndLenMsg(datInfo->mBuf, &len);
- rgUlrate_tfu += len;
- if (rgUlrate_tfu > 100000)
- {
- DU_LOG("\nINFO --> MAC : rgTOMDatInd datInfo->mBuf len =%d rgUlrate_tfu=%d",len,rgUlrate_tfu);
- rgUlrate_tfu = 0;
- }
- }
- }
- return(RFAILED);
-#endif
-
- memset(&lcgBytes, 0, sizeof(lcgBytes));
-
- tfuSap = &(rgCb[inst].tfuSap);
- ueCb = NULLP;
- cellCb = rgCb[inst].cell;
- if((cellCb == NULLP) ||
- (cellCb->cellId != datInd->cellId))
- {
-
- DU_LOG("\nERROR --> MAC : Unable to get the cellCb for cell");
- return RFAILED;
- }
- /* Avoiding memset as all the fields are getting initialized further */
-
- if (rgTOMInfAllocPduEvnt (inst,&sfInfo) != ROK)
- {
- err.errType = RGERR_TOM_DATIND;
- DU_LOG("\nERROR --> MAC : Unable to Allocate PDU for DUX cell");
- node = datInd->datIndLst.first;
- return RFAILED;
- }
- cmLListInit(&sfInfo->ueLst);
- sfInfo->cellId = datInd->cellId;
- sfInfo->timingInfo = datInd->timingInfo;
- slot = datInd->timingInfo.slot;
-
- node = datInd->datIndLst.first;
- for (;node; node=node->next)
- {
- datInfo = (TfuDatInfo*)node->node;
- {
- //uint32_t ulrate_tfu;
- MsgLen len;
- SFndLenMsg(datInfo->mBuf, &len);
-#ifdef STUB_TTI_HANDLING_5GTF
- // DU_LOG(":rgTOMDatInd datInfo->mBuf len =%d",len);
-#endif
- rgUlrate_tfu += len;
-#ifdef EMTC_ENABLE
- grgUlrate_tfu += len;
-#endif
- }
-#ifdef STUB_TTI_HANDLING_5GTF
- rgLIMUtlFreeDatIndEvnt(datInd,TRUE);
-#endif
- /* We shall call De-Mux to process the received buffer. We shall try and find
- * out the RaCb based on the following -
- * 1. If the incoming PDU contained a CCCH SDU i.e. this is message 3.
- * 2. If the incoming PDU contained a CRNTI control element, i.e. we should
- * have a ueCb also for this
- */
- /* Lets allocate the event that needs to be passed to DUX */
- if (rgTOMUtlAllocPduEvnt (inst,&pdu) != ROK)
- {
- err.errType = RGERR_TOM_DATIND;
- DU_LOG("\nERROR --> MAC : Unable to Allocate PDU for DUX cell");
- rgTOMInfFreePduEvnt (sfInfo);
- return RFAILED;
- }
-
- if ((ret = rgDUXDemuxData (inst,pdu, &ceInfo,
- &datInfo->mBuf, &err)) != ROK)
- {
- //exit(1);
- /* Fix: sriky memory corruption precautions */
- rgTOMUtlFreePduEvnt (pdu, TRUE);
- err.errType = RGERR_TOM_DATIND;
- DU_LOG("\nERROR --> MAC : DUX processing failed");
- tfuSap->sapSts.numPduDrop++;
- continue;
- }
- /* It could be that a non-msg3 pdu contains a CRNTI Control element. We
- * should check for CRNTI CE and if it exists the UECb must exist, also an
- * if the CRNTI in the CE and the one with which the message came in are
- * different we shall look for an raCb as well.
- */
-
- if (ceInfo.bitMask & RG_CCCH_SDU_PRSNT)
- {
- ret = rgTOMProcCCCHSduInDatInd(pdu, prevUeCb, \
- cellCb, datInfo, &ceInfo, slot);
- if (ret == RFAILED)
- {
- rgTOMUtlFreePduEvnt (pdu, TRUE);
- err.errType = RGERR_TOM_DATIND;
- tfuSap->sapSts.numPduDrop++;
- continue;
- }
- } /* end of Msg3 processing */
-
- else if (ceInfo.bitMask & RG_CRNTI_CE_PRSNT)
- {
- ret = rgTOMProcCrntiCEInDatInd(pdu, prevUeCb, \
- cellCb, datInfo, &ceInfo, slot);
- if (ret == RFAILED)
- {
- rgTOMUtlFreePduEvnt (pdu, TRUE);
- err.errType = RGERR_TOM_DATIND;
- tfuSap->sapSts.numPduDrop++;
- continue;
- }
-
- } /* end of CRNTI based message */
- else
- {
- ueCb = rgDBMGetUeCb (cellCb, datInfo->rnti);
- if (ueCb == NULLP)
- {
-#ifdef LTEMAC_SPS
- /* Try getting the UE using SPS-RNTI. */
- ueCb = rgDBMGetSpsUeCb (cellCb, datInfo->rnti);
- if (ueCb != NULLP)
- {
- isSpsRnti = TRUE;
- /* Increment implrelCntr for an empty transmission */
- if (pdu->sduLst.count == 0)
- {
- ueCb->ul.implRelCntr++;
- if (ueCb->ul.implRelCntr == ueCb->ul.implRelCnt)
- {
- /* Indicate scheduler for implicit release */
- memset(&schPst1, 0, sizeof(Pst));
- rgGetPstToInst(&schPst1,inst, cellCb->schInstMap.schInst);
-
- ueCb->ul.implRelCntr = 0;
- ueCb->ul.explRelCntr = 0;
-#if 0
- relInfo.cellSapId = cellCb->schInstMap.cellSapId;
- relInfo.cRnti = ueCb->ueId;
- relInfo.isExplRel= FALSE;
- //TODO: commented for compilation without SCH RgMacSchSpsRel(&schPst1, &relInfo);
-#endif
- }
- }
- else
- {
- /* Reset the implrelCntr */
- ueCb->ul.implRelCntr = 0;
- }
- }
- else
-#endif
- {
- /* Perform failure if ueCb is still NULLP */
- rgTOMUtlFreePduEvnt (pdu, TRUE);
- err.errType = RGERR_TOM_DATIND;
- DU_LOG("\nERROR --> MAC : RNTI:%d Unable to get the UE CB",
- datInfo->rnti);
- tfuSap->sapSts.numPduDrop++;
- continue;
- }
- }
-#ifdef LTE_L2_MEAS
- rgTOMUtlL2MStoreBufSz(ueCb, &ceInfo);
- rgTOML2MCompileActiveLCs (cellCb, ueCb, pdu, &ceInfo);
-#endif
-#ifdef LTEMAC_SPS
- if ((ret = rgTOMUtlProcMsg(cellCb, ueCb, pdu, isSpsRnti,&spsToBeActvtd,&sduSize, slot, (uint32_t *)&lcgBytes)) != ROK)
-#else
- if ((ret = rgTOMUtlProcMsg (cellCb, ueCb, pdu, slot, (uint32_t *)&lcgBytes)) != ROK)
-#endif /* LTEMAC_SPS */
- {
- rgTOMUtlFreePduEvnt (pdu, TRUE);
- err.errType = RGERR_TOM_DATIND;
- DU_LOG("\nERROR --> MAC : Unable to handle Data Indication CRNTI:%d",ueCb->ueId);
- tfuSap->sapSts.numPduDrop++;
- continue;
- }
- }
-
-
-#ifdef LTEMAC_SPS
- if(rgTOMUtlInsSchInfo(pdu, sfInfo, &ceInfo, datInfo->rnti,spsToBeActvtd,sduSize, (uint32_t *)&lcgBytes) != ROK)
-#else
- if(rgTOMUtlInsSchInfo(pdu, sfInfo, &ceInfo, datInfo->rnti, (uint32_t *)&lcgBytes) != ROK)
-#endif
-
- {
- rgTOMInfFreePduEvnt (sfInfo);
- rgTOMUtlFreePduEvnt (pdu, FALSE);
- return RFAILED;
- }
- /* free up the PDU memory */
- rgTOMUtlFreePduEvnt (pdu, FALSE);
- }
- /* Free the allocated memory for ueUlAllocInfo here */
-#ifdef LTE_L2_MEAS
- if(cellCb->ulSf[(slot % RG_NUM_SUB_FRAMES)].ueUlAllocInfo != NULLP)
- {
- /*ccpu00117052 - MOD - Passing double for proper NULLP
- assignment */
- rgFreeSBuf(inst,(Data **)&(cellCb->ulSf[(slot % RG_NUM_SUB_FRAMES)].ueUlAllocInfo),
- ((cellCb->ulSf[(slot % RG_NUM_SUB_FRAMES)].numUe) * sizeof(RgUeUlAlloc)));
- }
-#endif
- /* RRM_RBC_X */
- /* Update PRB used for all GBR QCIs to scheduler */
- memcpy( &sfInfo->qcisUlPrbCnt[0],
- &cellCb->qcisUlPrbCnt[0],
- (RGM_MAX_QCI_REPORTS * sizeof(uint32_t)));
- /* clear the cellCb ul prb value */
- memset(&cellCb->qcisUlPrbCnt[0], 0,
- (RGM_MAX_QCI_REPORTS * sizeof(uint32_t)));
-
- /* RRM_RBC_Y */
-
- rgGetPstToInst(&schPst, inst,cellCb->schInstMap.schInst);
- sfInfo->cellSapId = cellCb->schInstMap.cellSapId;
- //TODO: commented for compilation without SCH RgMacSchSfRecp(&schPst, sfInfo);
- return ROK;
-} /* rgTOMDatInd */
-
-/**
- * @brief Function handles allocation for common channels i.e. BCCH-BCH,
- * BCCH-DLSCH, PCCH-DLSCH.
- *
- * @details
- *
- * Function : rgHndlCmnChnl
- *
- * This function is invoked from RgSchMacSfAllocReq. This function handles
- * allocations made for common channels like BCCH and PCCH.
- *
- * Processing steps:
- * 1. If BCCH on BCH has been scheduled, send StatusIndication on RGU.
- * 2. If PCCH is scheduled, send StatusIndication on RGU.
- * 3. If BCCH on DLSCH has been scheduled and sndStatInd is TRUE, send
- * StatusIndication on RGU, else copy the bcch buffer onto the downlink
- * subframe.
- *
- *
- * @param[in] RgCellCb *cell,
- * @param[in] CmLteTimingInfo timingInfo,
- * @param[in] RgInfCmnLcInfo *cmnLcInfo,
- * @param[in/out] RgErrInfo *err,
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
- static S16 rgHndlCmnChnl
-(
- RgCellCb *cell,
- CmLteTimingInfo timingInfo,
- RgInfCmnLcInfo *cmnLcInfo,
- RgErrInfo *err
- )
-{
-#if (ERRCLASS & ERRCLS_DEBUG)
- RgPcchLcCb *pcch;
-#endif
-#ifndef RGR_SI_SCH
- RgBcchDlschLcCb *bcch;
-#if (ERRCLASS & ERRCLS_DEBUG)
- RgBcchBchLcCb *bch;
-#endif
-#endif/*RGR_SI_SCH*/
- RguCStaIndInfo *staInd;
- RgDlSf *dlSf;
- Inst inst = cell->macInst - RG_INST_START;
-
-
- dlSf = &cell->subFrms[(timingInfo.slot % RG_NUM_SUB_FRAMES)];
-
- if(cmnLcInfo->bitMask & RGINF_BCH_INFO)
- {
-#ifndef RGR_SI_SCH
-#if (ERRCLASS & ERRCLS_DEBUG)
- if(NULLP == (bch = rgDBMGetBcchOnBch(cell)))
- {
- return RFAILED;
- }
- if(cmnLcInfo->bchInfo.lcId != bch->lcId)
- {
- return RFAILED;
- }
-#endif
-
- if (rgAllocShrablSBuf (inst,(Data**)&staInd, sizeof(RguCStaIndInfo)) != ROK)
- {
- err->errCause = RGERR_TOM_MEM_EXHAUST;
- return RFAILED;
- }
- staInd->cellId = cell->cellId;
- staInd->rnti = RG_INVALID_RNTI;
- staInd->lcId = cmnLcInfo->bchInfo.lcId;
- staInd->transId = (timingInfo.sfn << 8) | (timingInfo.slot);
- /* ADD Changes for Downlink UE Timing Optimization */
-#ifdef LTEMAC_DLUE_TMGOPTMZ
- dlSf->remDatReqCnt++;
-#endif
- if (rgUIMSndCmnStaInd (inst,cell->rguDlSap,staInd) != ROK)
- {
- return RFAILED;
- }
-#else
- /*Store the received BCH Data in the scheduled subframe*/
- dlSf->bch.tb = cmnLcInfo->bchInfo.pdu;
-#endif/*RGR_SI_SCH*/
- }
-
- if(cmnLcInfo->bitMask & RGINF_PCCH_INFO)
- {
-#if (ERRCLASS & ERRCLS_DEBUG)
- if(NULLP == (pcch = rgDBMGetPcch(cell)))
- {
- return RFAILED;
- }
- if(cmnLcInfo->pcchInfo.lcId != pcch->lcId)
- {
- return RFAILED;
- }
-#endif
-
- dlSf->pcch.pdcch.rnti =
- cmnLcInfo->pcchInfo.rnti;
- dlSf->pcch.pdcch.dci =
- cmnLcInfo->pcchInfo.dciInfo;
-#ifdef TFU_UPGRADE
- /* ccpu00132314-ADD-Fill the tx Pwr offset from scheduler */
- dlSf->pcch.txPwrOffset = cmnLcInfo->pcchInfo.txPwrOffset;
-#endif
- if (rgAllocShrablSBuf (inst,(Data**)&staInd, sizeof(RguCStaIndInfo)) != ROK)
- {
- err->errCause = RGERR_TOM_MEM_EXHAUST;
- return RFAILED;
- }
- staInd->cellId = cell->cellId;
- staInd->rnti = RG_INVALID_RNTI;
- staInd->lcId = cmnLcInfo->pcchInfo.lcId;
- staInd->transId = (timingInfo.sfn << 8) | (timingInfo.slot);
- /* ADD Changes for Downlink UE Timing Optimization */
-#ifdef LTEMAC_DLUE_TMGOPTMZ
- dlSf->remDatReqCnt++;
-#endif
- /* for consolidated CmnStaInd calling below function from function
- * rgHndlSchedUe once CmnStaInd prepared for all UEs
- */
- if (rgUIMSndCmnStaInd (inst,cell->rguDlSap,staInd) != ROK)
- {
- return RFAILED;
- }
- }
-
- if(cmnLcInfo->bitMask & RGINF_BCCH_INFO)
- {
- dlSf->bcch.pdcch.rnti =
- cmnLcInfo->bcchInfo.rnti;
- dlSf->bcch.pdcch.dci =
- cmnLcInfo->bcchInfo.dciInfo;
-#ifdef TFU_UPGRADE
- /* ccpu00132314-ADD-Fill the tx Pwr offset from scheduler */
- dlSf->bcch.txPwrOffset = cmnLcInfo->bcchInfo.txPwrOffset;
-#endif
-#ifndef RGR_SI_SCH
- if(NULLP ==
- (bcch=rgDBMGetBcchOnDlsch(cell,cmnLcInfo->bcchInfo.lcId)))
- {
- return RFAILED;
- }
- if(TRUE == cmnLcInfo->bcchInfo.sndStatInd)
- {
- RG_FREE_MSG(bcch->tb);
- if (rgAllocShrablSBuf (inst,(Data**)&staInd,
- sizeof(RguCStaIndInfo)) != ROK)
- {
- err->errCause = RGERR_TOM_MEM_EXHAUST;
- return RFAILED;
- }
- staInd->cellId = cell->cellId;
- staInd->rnti = RG_INVALID_RNTI;
- staInd->lcId = cmnLcInfo->bcchInfo.lcId;
- staInd->transId = (timingInfo.sfn << 8) | (timingInfo.slot);
- /* ADD Changes for Downlink UE Timing Optimization */
-#ifdef LTEMAC_DLUE_TMGOPTMZ
- dlSf->remDatReqCnt++;
-#endif
- if (rgUIMSndCmnStaInd (inst,cell->rguDlSap,staInd) != ROK)
- {
- return RFAILED;
- }
- }
- else
- {
- SCpyMsgMsg(bcch->tb, RG_GET_MEM_REGION(rgCb[inst]),
- RG_GET_MEM_POOL(rgCb[inst]), &dlSf->bcch.tb);
- }
-#else
- /*Store the received BCCH Data in the scheduled subframe*/
- dlSf->bcch.tb = cmnLcInfo->bcchInfo.pdu;
-#endif/*RGR_SI_SCH*/
- }
-
- return ROK;
-} /* end of rgHndlCmnChnl */
-
-/**
- * @brief Function for handling allocations for dedicated channels for a
- * subframe.
- *
- * @details
- *
- * Function : rgHndlSchdUe
- *
- * This function shall be invoked whenever scheduler is done with the
- * allocations of dedicated channels for a subframe. Invoked by the function
- * RgSchMacSfAllocReq.
- *
- * Processing steps :
- * 1. Loops through the list of UE's scheduled looking for the corresponding
- * ueCb/raCb.
- * 2. Finds the corresponding HARQ process.
- * 3. Invokes the DHM function to issue StatusIndications on RGU.
- *
- *
- * @param[in] RgCellCb *cell,
- * @param[in] CmLteTimingInfo timingInfo,
- * @param[in] RgInfUeInfo *ueInfo
- * @param[in/out] RgErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
- static S16 rgHndlSchdUe
-(
- RgCellCb *cell,
- CmLteTimingInfo timingInfo,
- RgInfUeInfo *ueInfo,
- RgErrInfo *err
- )
-{
-
-
- if(NULLP == ueInfo->allocInfo)
- {
- return RFAILED;
- }
-
- rgDHMSndConsolidatedStaInd(cell, ueInfo, timingInfo, err);
-
- return ROK;
-} /* end of rgHndlSchdUe */
-
-#ifdef LTE_L2_MEAS
-/**
- * @brief Function for handling Uplink allocations for Ue for a
- * subframe.
- *
- * @details
- *
- * Function : rgHndlUlUeInfo
- *
- * @param[in] RgCellCb *cell,
- * @param[in] CmLteTimingInfo timingInfo,
- * @param[in] RgInfUlUeInfo *ueInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
- static S16 rgHndlUlUeInfo
-(
- RgCellCb *cell,
- CmLteTimingInfo timingInfo,
- RgInfUlUeInfo *ueInfo
- )
-{
- Inst inst = cell->macInst - RG_INST_START;
- uint8_t idx;
- RgUlSf *ulSf;
- S16 ret;
-
-
- ulSf = &cell->ulSf[(timingInfo.slot % RGSCH_NUM_SUB_FRAMES)];
-
- /* rg003.301-MOD- Corrected the purifier memory leak */
- if (ulSf->numUe != ueInfo->numUes)
- {
- if (ulSf->ueUlAllocInfo)
- {
- rgFreeSBuf(inst,(Data **)&(ulSf->ueUlAllocInfo),
- ulSf->numUe * sizeof(RgUeUlAlloc));
- }
- }
-#ifdef XEON_SPECIFIC_CHANGES
- CM_MEAS_TIME((cell->crntTime.slot % RGSCH_NUM_SUB_FRAMES), CM_DBG_MAC_TTI_IND, CM_DBG_MEAS_FREE);
- CM_ADD_INFO((cell->crntTime.slot % RGSCH_NUM_SUB_FRAMES), CM_DBG_MEAS_FREE, ulSf->numUe);
-#endif
- ulSf->numUe = ueInfo->numUes;
- if((ulSf->ueUlAllocInfo == NULLP) && (ueInfo->numUes > 0))
- {
- /* Allocate memory for ulAllocInfo */
- if((ret = rgAllocSBuf(inst,(Data**)&(cell->ulSf[(timingInfo.slot % RGSCH_NUM_SUB_FRAMES)].
- ueUlAllocInfo), ueInfo->numUes * sizeof(RgUeUlAlloc))) != ROK)
- {
- return (ret);
- }
- }
-#ifdef XEON_SPECIFIC_CHANGES
- CM_MEAS_TIME((cell->crntTime.slot % RGSCH_NUM_SUB_FRAMES), CM_DBG_MAC_TTI_IND, CM_DBG_MEAS_ALLOC);
- CM_ADD_INFO((cell->crntTime.slot % RGSCH_NUM_SUB_FRAMES), CM_DBG_MEAS_ALLOC, ueInfo->numUes);
-#endif
- if (ulSf->ueUlAllocInfo != NULLP)
- {
- for(idx = 0; idx < ueInfo->numUes; idx++)
- {
- ulSf->ueUlAllocInfo[idx].rnti = ueInfo->ulAllocInfo[idx].rnti;
- ulSf->ueUlAllocInfo[idx].numPrb = ueInfo->ulAllocInfo[idx].numPrb;
- }
- }
- RGCPYTIMEINFO(timingInfo, ulSf->schdTime);
- return ROK;
-} /* end of rgHndlUlUeInfo */
-#endif
-/**
- * @brief Function for handling RaResp request received from scheduler to MAC
- *
- * @details
- *
- * Function : rgTOMRlsSf
- *
- * This function shall be invoked whenever scheduler is done with the
- * allocations of random access responses for a subframe.
- * This shall invoke RAM to create ueCbs for all the rapIds allocated and
- * shall invoke MUX to create RAR PDUs for raRntis allocated.
- *
- *
- * @param[in] Inst inst
- * @param[in] CmLteCellId cellId,
- * @param[in] CmLteTimingInfo timingInfo,
- * @param[in] RaRespInfo *rarInfo
- * @return S16
- * -# ROK
- **/
-Void rgTOMRlsSf(Inst inst,RgDlSf *dlSf)
-{
- uint8_t idx;
-
-
- if(dlSf->txDone == FALSE)
- {
- DU_LOG("\nERROR --> MAC : SUBFRAME Not pushed to the PHY");
-
- if (dlSf->bch.tb != NULLP)
- {
- RG_FREE_MSG(dlSf->bch.tb);
- }
- if (dlSf->bcch.tb != NULLP)
- {
- RG_FREE_MSG(dlSf->bcch.tb);
- }
- if (dlSf->pcch.tb != NULLP)
- {
- RG_FREE_MSG(dlSf->pcch.tb);
- }
-#ifdef EMTC_ENABLE
- rgTOMEmtcRlsSf(dlSf);
-#endif
- for(idx=0; idx < dlSf->numRaRsp; idx++)
- {
- RG_FREE_MSG(dlSf->raRsp[idx].rar);
- }
- }
- /* ADD Changes for Downlink UE Timing Optimization */
-#ifdef LTEMAC_DLUE_TMGOPTMZ
- dlSf->remDatReqCnt = 0;
- /* Fix[ccpu00126310]: Tracks Data Requests from RLC for both loosely and tight coupled
- RLC-MAC */
- dlSf->statIndDone = FALSE;
-#endif
- if (dlSf->tbs.count)
- {
- uint8_t i;
- CmLList *node;
- RgDlHqProcCb *hqP;
- DU_LOG("\nERROR --> MAC : Error Stale TBs in Subframes TBS list\n");
- node = dlSf->tbs.first;
- while(node)
- {
- hqP = (RgDlHqProcCb*)node->node;
- node = node->next;
- if (hqP)
- {
- for(i=0;i< RG_MAX_TB_PER_UE;i++)
- {
- if (hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf == dlSf)
- {
- cmLListDelFrm(&dlSf->tbs, &(hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk));
- hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sfLnk.node = NULLP;
- DU_LOG("\nERROR --> MAC : rgTOMRlsSf:: hqP %p \n", (Void *)hqP);
- }
- hqP->tbInfo[i].sfLnkInfo[dlSf->schdTime.slot % 2].sf = NULLP;
- }
- }
- }
- }
- /*arjun: check if dlSf laaTb list has to be freed???*/
- cmLListInit(&dlSf->tbs);
- dlSf->txDone = FALSE;
- dlSf->numRaRsp = 0;
- return;
-}
-
-/**
- * @brief Function is called by the scheduler once it has completed the
- * allocation for the subframe.
- *
- * @details
- *
- * Function : rgHndlFlowCntrl
- * This function should fill and send Flow control
- * indication to RLC
- *
- *
- * @param[in] Pst *cell
- * @param[in] RgInfSfAlloc *sfInfo Carries all the allocation
- * information.
- * @return S16
- * -# ROK
- **/
-S16 rgHndlFlowCntrl(RgCellCb *cell,RgInfSfAlloc *sfInfo)
-{
- RguFlowCntrlInd *flowCntrlInd;
- Pst *pst;
- uint32_t ueIdx;
- uint32_t lcIdx;
-
- pst = &cell->rguDlSap->sapCfg.sapPst;
- /* flowCntrlInd is alloced in cell init time and will be re-used throughout */
- flowCntrlInd = cell->flowCntrlInd;
- flowCntrlInd->cellId = sfInfo->cellId;
- flowCntrlInd->numUes = sfInfo->flowCntrlInfo.numUes;
-
- for (ueIdx = 0; ueIdx < sfInfo->flowCntrlInfo.numUes; ueIdx++)
- {
- flowCntrlInd->ueFlowCntrlInfo[ueIdx].ueId = sfInfo->flowCntrlInfo.ueFlowCntrlInfo[ueIdx].ueId;
- flowCntrlInd->ueFlowCntrlInfo[ueIdx].numLcs = sfInfo->flowCntrlInfo.ueFlowCntrlInfo[ueIdx].numLcs;
-
- for (lcIdx = 0; lcIdx < RGINF_MAX_NUM_DED_LC; lcIdx++)
- {
- flowCntrlInd->ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].lcId =
- sfInfo->flowCntrlInfo.ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].lcId;
- flowCntrlInd->ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].pktAdmitCnt =
- sfInfo->flowCntrlInfo.ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].pktAdmitCnt;
-
- flowCntrlInd->ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].maxBo4FlowCtrl =
- sfInfo->flowCntrlInfo.ueFlowCntrlInfo[ueIdx].lcInfo[lcIdx].maxBo4FlowCtrl;
- }
- }
- RgUiRguFlowCntrlInd(pst, cell->rguDlSap->sapCfg.spId,flowCntrlInd); /* TODO: Rishi confirm if the suId and pst pointer is correct */
- return ROK;
-}
-/**
- * @brief Function is called by the scheduler once it has completed the
- * allocation for the subframe.
- *
- * @details
- *
- * Function : RgSchMacSfAllocReq
- *
- * This function shall be invoked whenever scheduler is done with the
- * allocations of for a subframe. The sfInfo carries all the allocation
- * details for the common channels, RA responses and dedicated channel
- * allocations.
- *
- * Processing steps :
- * 1. Reset the information present in the downlink subframe that is
- * scheduled.
- * 2. Handle common channel allocations
- * 3. Handle RA Response allocations
- * 4. Handle dedicated channel allocations.
- *
- * @param[in] Pst *pst
- * @param[in] RgInfSfAlloc *sfInfo Carries all the allocation
- * information.
- * @return S16
- * -# ROK
- **/
-S16 RgSchMacSfAllocReq(Pst *pst,RgInfSfAlloc *sfInfo)
-{
- RgCellCb *cell;
- RgDlSf *dlSf;
- RgErrInfo err;
- volatile uint32_t startTime=0;
- Inst inst;
-
-
- RG_IS_INST_VALID(pst->dstInst);
- inst = pst->dstInst - RG_INST_START;
- /*starting Task*/
- SStartTask(&startTime, PID_MAC_SF_ALLOC_REQ);
-
- if(NULLP == sfInfo)
- {
- return RFAILED;
- }
-
- if((cell = rgCb[inst].cell) == NULLP)
- {
- DU_LOG("\nERROR --> MAC : No cellCb found with cell");
- return RFAILED;
- }
-
- dlSf = &cell->subFrms[(sfInfo->timingInfo.slot % RG_NUM_SUB_FRAMES)];
-
- rgTOMRlsSf(inst,dlSf);
- dlSf->schdTime = sfInfo->timingInfo;
-
-#ifdef LTE_ADV
- rgLaaInitTbInfoLst(cell);
-#endif
-
- /* Fix : syed Ignore Failure Returns and continue processing.
- * Incomplete processing results in state sync loss between MAC-SCH. */
-#ifdef EMTC_ENABLE
- if(TRUE == cell->emtcEnable)
- {
- rgEmtcHndl(cell, sfInfo);
- }
-#endif
- rgHndlCmnChnl(cell, sfInfo->timingInfo, &sfInfo->cmnLcInfo, &err);
-
- rgHndlRaResp(cell, sfInfo->timingInfo, &sfInfo->rarInfo, &err);
-
-#ifdef LTE_ADV
-#ifdef XEON_SPECIFIC_CHANGES
- CM_MEAS_TIME((cell->crntTime.slot % RG_NUM_SUB_FRAMES), CM_DBG_MAC_TTI_IND, CM_DBG_MAC_B4_UE_SCHD);
-#endif
- rgHndlSchdUe(cell, sfInfo->timingInfo, &sfInfo->ueInfo, &err);
-#ifdef XEON_SPECIFIC_CHANGES
- CM_MEAS_TIME((cell->crntTime.slot % RG_NUM_SUB_FRAMES), CM_DBG_MAC_TTI_IND, CM_DBG_MAC_UE_SCHD);
-#endif
- rgLaaChkAndReqTbs(dlSf,cell, inst);
-
-#else
- rgHndlSchdUe(cell, sfInfo->timingInfo, &sfInfo->ueInfo, &err);
-#endif
-
-#ifdef LTE_L2_MEAS
- if(rgHndlUlUeInfo(cell, sfInfo->ulUeInfo.timingInfo,
- &sfInfo->ulUeInfo) != ROK)
- {
- return RFAILED;
- }
-#endif
-#ifdef XEON_SPECIFIC_CHANGES
- CM_MEAS_TIME((cell->crntTime.slot % RG_NUM_SUB_FRAMES), CM_DBG_MAC_TTI_IND, CM_DBG_MAC_MEAS);
-#endif
- /* Fix[ccpu00126310]: Tracks Data Requests from RLC for both loosely and tight coupled
- RLC-MAC */
-
-
- /* Added the handling for pushing down
- * TFU Data request in the retransmission only scenario.*/
-#ifdef LTEMAC_DLUE_TMGOPTMZ
- dlSf->statIndDone = TRUE;
- /* Fix [ccpu00126310]: Tracks Data Requests from RLC for both loosely and tight coupled
- RLC-MAC */
- if(!(dlSf->txDone) &&
-#ifdef LTE_ADV
- (TRUE == rgLaaChkAllRxTbs(dlSf)) &&
-#endif
- (0 == dlSf->remDatReqCnt) && (dlSf->statIndDone) &&
- (RG_TIMEINFO_SAME(cell->crntTime, dlSf->schdTime)))
- {
- /*This is the case of rettransmission, so no need
- * to wait for TTI Ind to push TFU Data Request. Send
- * it right away.*/
- if (ROK != rgTOMUtlProcDlSf (dlSf, cell, &err))
- {
- DU_LOG("\nERROR --> MAC : Unable to process downlink subframe for cell");
- err.errType = RGERR_ROM_DEDDATREQ;
- }
- /* Mark this frame as sent */
- dlSf->txDone = TRUE;
- }
-#endif
- if (sfInfo->flowCntrlInfo.numUes > 0)
- {
- rgHndlFlowCntrl(cell,sfInfo);
- }
- /*stoping Task*/
- SStopTask(startTime, PID_MAC_SF_ALLOC_REQ);
- return ROK;
-} /* end of RgSchMacSfAllocReq */
-/**
- * @brief Handler for processing data indication recieved from PHY for UEs.
- *
- * @details
- *
- * Function: rgTOMProcCrntiCEInDatInd
- *
- * Handler for processing data indication recieved from PHY for UEs.
- *
- * Invoked by: RgLiTfuDatInd of LIM
- *
- * Processing Steps:
- * For each DataInfo recieved
- * - If received a CRNTI control element
- * - Check if a CCCH SDU is present, if it is return failure
- * - Check for the existence of UE, if its isnt present return failure.
- * - Delegate the remaining processing to rgTOMUtlProcMsg3 which
- * primarily informs the scheduler about the data received and
- * generates Data indications towards the higher layer.
- *
- * @param RgMacPdu *pdu,
- * @param RgUeCb *prevUeCb,
- * @param RgCellCb *cellCb,
- * @param TfuDatInfo *datInfo,
- * @param RgInfCeInfo *ceInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
- static S16 rgTOMProcCrntiCEInDatInd
-(
- RgMacPdu *pdu,
- RgUeCb *prevUeCb,
- RgCellCb *cellCb,
- TfuDatInfo *datInfo,
- RgInfCeInfo *ceInfo,
- uint16_t slot
- )
-{
- RgUeCb *ueCb = NULLP;
- Inst inst = cellCb->macInst - RG_INST_START;
-
-
-#ifdef LTEMAC_SPS
- Bool spsToBeActvtd;
- uint16_t sduSize;
-#endif
-
-
-#ifndef LTE_L2_MEAS
- UNUSED(slot);
-#endif
-
- ueCb = rgDBMGetUeCbFromRachLst (cellCb, datInfo->rnti);
-
- if (ueCb == NULLP)
- {
- DU_LOG("\nERROR --> MAC : RNTI:%d Received MSG3 with CRNTI,unable to find ueCb", ceInfo->ces.cRnti);
- return RFAILED;
- }
-
- prevUeCb = rgDBMGetUeCb (cellCb, ceInfo->ces.cRnti);
- if (prevUeCb == NULLP)
- {
- DU_LOG("\nERROR --> MAC : RNTI:%d Received MSG3 with CRNTI,unable to find ueCb", ceInfo->ces.cRnti);
- return RFAILED;
- }
- DU_LOG("\nERROR --> MAC : CRNTI CE(%d) received through tmpCrnti(%d)",
- ceInfo->ces.cRnti, datInfo->rnti);
- rgDBMDelUeCbFromRachLst(cellCb, ueCb);
- rgRAMFreeUeCb(inst,ueCb);
- ueCb = prevUeCb;
-#ifdef LTEMAC_SPS
- if ((rgTOMUtlProcMsg(cellCb, ueCb, pdu, FALSE,&spsToBeActvtd,&sduSize, slot, NULLP)) != ROK)
-#else
- if ((rgTOMUtlProcMsg (cellCb, ueCb, pdu, slot, NULLP)) != ROK)
-#endif /* LTEMAC_SPS */
- {
- DU_LOG("\nERROR --> MAC : RNTI:%d Processing for MSG3 failed",datInfo->rnti);
- return RFAILED;
- }
- return ROK;
-}
-/**
- * @brief Handler for processing data indication recieved from PHY for UEs.
- *
- * @details
- *
- * Function: rgTOMProcCCCHSduInDatInd
- *
- * Handler for processing data indication recieved from PHY for UEs.
- *
- * Invoked by: RgLiTfuDatInd of LIM
- *
- * Processing Steps:
- * For each DataInfo recieved
- * - If only CCCH SDU is present
- * - Invoke rgTOMUtlProcMsg3 for further processing.
- * - If its a non-Msg3 PDU i.e. received outside of a RA procedure
- * - Retrieve the UeCB
- * - Validate that the received PDU contains only configured Logical
- * Channels.
- * - Invoke rgTOMUtlProcDatPdu for further processing. It informs the
- * scheduler with the information of the received Data and generates
- * DatIndications towards the higher layers.
- *
- * @param TfuDatIndInfo *datInd
- * @param RgMacPdu *pdu,
- * @param RgUeCb *prevUeCb,
- * @param RgCellCb *cellCb,
- * @param TfuDatInfo *datInfo,
- * @param RgInfCeInfo *ceInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
- static S16 rgTOMProcCCCHSduInDatInd
-(
- RgMacPdu *pdu,
- RgUeCb *prevUeCb,
- RgCellCb *cellCb,
- TfuDatInfo *datInfo,
- RgInfCeInfo *ceInfo,
- uint16_t slot
- )
-{
- RgUeCb *ueCb = NULLP;
- Inst inst = cellCb->macInst - RG_INST_START;
-
-#ifdef LTEMAC_SPS
- Bool spsToBeActvtd;
- uint16_t sduSize;
-#endif
-
-
-
-#ifndef LTE_L2_MEAS
- UNUSED(slot);
-#endif
-
- if (ceInfo->bitMask & RG_CRNTI_CE_PRSNT)
- {
- DU_LOG("\nERROR --> MAC : CRNTI:%d Received MSG3 with CCCH",ceInfo->ces.cRnti);
- return RFAILED;
- }
-
- ueCb = rgDBMGetUeCbFromRachLst (cellCb, datInfo->rnti);
-
- if (ueCb == NULLP)
- {
- DU_LOG("\nERROR --> MAC : RNTI:%d Processing for MSG3 failed", datInfo->rnti);
- return RFAILED;
- }
- /* Fix: syed Drop any duplicate Msg3(CCCH Sdu) */
- if (ueCb->dl.hqEnt.numHqProcs)
- {
- /* HqE is already initialized by a previuos Msg3 */
- DU_LOG("\nERROR --> MAC : RNTI:%d Processing for MSG3 failed. Duplicate "
- "MSG3 received. Dropping", datInfo->rnti);
- return RFAILED;
- }
-
- if(rgDHMHqEntInit(inst,&ueCb->dl.hqEnt,
- cellCb->maxDlHqProcPerUe) != ROK)
- {
- DU_LOG("\nERROR --> MAC : RNTI:%d Harq Initialization failed ",
- datInfo->rnti);
- return RFAILED;
- }
- DU_LOG("\nDEBUG --> MAC : CCCH SDU received through tmpCrnti(%d)",datInfo->rnti);
-#ifdef LTEMAC_SPS
- if ((rgTOMUtlProcMsg(cellCb, ueCb, pdu, FALSE,&spsToBeActvtd,&sduSize, slot, NULLP)) != ROK)
-#else
- if ((rgTOMUtlProcMsg (cellCb, ueCb, pdu, slot, NULLP)) != ROK)
-#endif /* LTEMAC_SPS */
- {
- DU_LOG("\nERROR --> MAC : RNTI:%d Processing for MSG3 failed",
- datInfo->rnti);
- return RFAILED;
- }
- return ROK;
-}
-
-#ifdef LTE_L2_MEAS
-
-/** @brief This function captures the BSR value from Control Element
- * Info structure and updates the effective Buffer size into the
- * corresponding LCG ID.
- *
- * @details
- *
- * Function: rgTOMUtlL2MStoreBufSz
- *
- * Processing steps:
- * - update/append the Data structure based on BSR type
- *
- * @param [in] RgUeCb *ueCb
- * @param [in] RgInfCeInfo *ceInfo
- * @return S16
- */
-
-static S16 rgTOMUtlL2MStoreBufSz( RgUeCb *ueCb, RgInfCeInfo *ceInfo )
-{
- uint8_t lcgId;
- uint8_t bsr;
-
- if(ceInfo->bitMask & RG_TRUNC_BSR_CE_PRSNT)
- {
- lcgId = ((ceInfo->ces.bsr.truncBsr >> 6) & 0x03);
- bsr = ceInfo->ces.bsr.truncBsr & 0x3F;
- ueCb->ul.lcgArr[lcgId].lcgBsInfo.outStndngBs = rgLwrBsrTbl[bsr];
- }
- else if(ceInfo->bitMask & RG_SHORT_BSR_CE_PRSNT)
- {
- lcgId = ((ceInfo->ces.bsr.shortBsr >> 6) & 0x03);
- bsr = ceInfo->ces.bsr.shortBsr & 0x3F;
- ueCb->ul.lcgArr[lcgId].lcgBsInfo.outStndngBs = rgLwrBsrTbl[bsr];
-
- }
- else if(ceInfo->bitMask & RG_LONG_BSR_CE_PRSNT)
- {
- ueCb->ul.lcgArr[0].lcgBsInfo.outStndngBs = rgLwrBsrTbl[ceInfo->ces.bsr.longBsr.bs1];
- ueCb->ul.lcgArr[1].lcgBsInfo.outStndngBs = rgLwrBsrTbl[ceInfo->ces.bsr.longBsr.bs2];
- ueCb->ul.lcgArr[2].lcgBsInfo.outStndngBs = rgLwrBsrTbl[ceInfo->ces.bsr.longBsr.bs3];
- ueCb->ul.lcgArr[3].lcgBsInfo.outStndngBs = rgLwrBsrTbl[ceInfo->ces.bsr.longBsr.bs4];
- }
- return ROK;
-} /* end of rgTOMUtlL2MStoreBufSz*/
-
-/** @brief : Compiles list of LCs received in UL data for DTCH RBs
- *
- * @details
- *
- * @param [in] RgCellCb *cellCb
- * @param [in] RgUeCb *ueCb
- * @param [in] CmLteRnti rnti
- * @param [in] RgMacPdu *pdu
- * @param
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-static Void rgTOML2MCompileActiveLCs(RgCellCb *cellCb,RgUeCb *ueCb,RgMacPdu *pdu,RgInfCeInfo *ceInfo)
-{
- CmLList *node;
- RgMacSdu *sdu;
- RgUlLcCb *ulLcCb;
-
-
- node = pdu->sduLst.first;
- while (node)
- {
- sdu = (RgMacSdu*)node->node;
-
- if ((ulLcCb = rgDBMGetUlDedLcCb(ueCb, sdu->lcId)), ulLcCb != NULLP)
- {
- if (ulLcCb->lcgId != 0)
- {
- ceInfo->bitMask |= RG_ACTIVE_LC_PRSNT;
- ceInfo->ulActLCs[ulLcCb->lcId - 1] = TRUE;
- }
- }
- node = node->next;
- }
-
-} /* end of */
-
-
-
-#endif
-/**********************************************************************
-
- End of file
- **********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Entry point fucntions
-
- File: rg_uhm.c
-
-**********************************************************************/
-
-/** @file rg_uhm.c
-@brief This module handles uplink harq related functionality in MAC.
-*/
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "rg_env.h" /* MAC Environment Defines */
-#include "tfu.h" /* TFU Interface defines */
-#include "crg.h" /* CRG Interface defines */
-#include "rgu.h" /* RGU Interface defines */
-#include "rg_sch_inf.h" /* TFU Interface defines */
-#include "lrg.h" /* LRG Interface defines */
-
-#include "rg.h" /* MAC defines */
-#include "rg_err.h" /* MAC error defines */
-
-/* header/extern include files (.x) */
-
-#include "tfu.x" /* TFU Interface defines */
-#include "crg.x" /* CRG Interface includes */
-#include "rgu.x" /* RGU Interface includes */
-#include "rg_sch_inf.x" /* SCH Interface defines */
-#include "rg_prg.x" /* PRG Interface defines */
-#include "lrg.x" /* LRG Interface includes */
-
-#include "du_app_mac_inf.h"
-#include "rg.x" /* MAC includes */
-
-/* local defines */
-
-/* local typedefs */
-
-/* local externs */
-
-/* forward references */
-
-/**
- * @brief Handler for initializing the HARQ entity.
- *
- * @details
- *
- * Function: rgUHMCrgUeCfg
- *
- * Invoked by: CRG
- *
- * Processing Steps:
- * - Initialize maxHqRetx
- *
- * @param[in] *cellCb
- * @param[in,out] *ueCb
- * @param[in] *ueCfg
- * @param[out] *err
- * @return Void
- **/
-Void rgUHMCrgUeCfg
-(
-RgCellCb *cellCb,
-RgUeCb *ueCb,
-CrgUeCfg *ueCfg
-)
-{
- ueCb->ul.hqEnt.maxHqRetx = (ueCfg->ueUlHqCfg.maxUlHqTx - 1);
- return;
-} /* rgUHMCrgUeCfg */
-
-/**
- * @brief Handler for re-initializing the HARQ entity.
- *
- * @details
- *
- * Function: rgUHMCrgUeRecfg
- *
- * Invoked by: CRG
- *
- * Processing Steps:
- * - Re-initialize maxHqRetx
- *
- * @param[in] *cellCb
- * @param[in,out] *ueCb
- * @param[in] *ueCfg
- * @param[out] *err
- * @return Void
- **/
-Void rgUHMCrgUeRecfg
-(
-RgCellCb *cellCb,
-RgUeCb *ueCb,
-CrgUeRecfg *ueRecfg
-)
-{
-
- ueCb->ul.hqEnt.maxHqRetx = (ueRecfg->ueUlHqRecfg.maxUlHqTx - 1);
- return;
-} /* rgUHMCrgUeCfg */
-
-/**********************************************************************
-
- End of file
-**********************************************************************/
/* forward references */
-#if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_STA_RSP_RBUF)
-S16 rgBatchProc(Void);
-#endif
uint8_t rgRguDlSap;
uint8_t rgRguUlSap;
/**
return (ret);
} /* rgUIMRguBndCfm*/
-
-/**
- * @brief Handler for dedicated DatReq from RGU
- *
- * @details
- *
- * Function : RgUiRguDDatReq
- *
- * This function validates SAP and invokes ROM for further processing
- *
- * @param[in] Pst *pst
- * @param[in] SpId spId
- * @param[in] RguDDatReqInfo *datReq
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgUiRguDDatReq(Pst *pst,SpId spId,RguDDatReqInfo *datReq)
-{
- S16 ret = ROK;
- Inst inst;
-#ifndef NO_ERRCLS
- uint32_t id;
- uint32_t id1;
- uint32_t id2;
- uint32_t id3;
-#endif
-
- RG_IS_INST_VALID(pst->dstInst);
- inst = pst->dstInst - RG_INST_START;
-#ifndef NO_ERRCLS
- if (datReq == NULLP)
- {
- DU_LOG("\nERROR --> MAC : Input Message Buffer is NULL");
- return RFAILED;
- }
-
- if(rgCb[inst].rguSap[spId].sapCfg.spId == spId)
- {
- switch (rgCb[inst].rguSap[spId].sapSta.sapState)
- {
- case LRG_BND: /* SAP is bound */
- DU_LOG("\nDEBUG --> MAC : SAP is already bound");
- break;
- default: /* Should never reach here */
-#if (ERRCLASS & ERRCLS_ADD_RES)
- DU_LOG("\nERROR --> MAC : Invalid SAP State:%d RgUiRguDDatReq failed",
- rgCb[inst].rguSap[spId].sapSta.sapState);
-#endif
-#ifndef L2_OPTMZ
- for(id3 = 0; id3 < datReq->nmbOfUeGrantPerTti; id3++)
- {
- RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[id3]);
- }
-#endif
- return RFAILED;
- }
- }
- else
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- DU_LOG("\nERROR --> MAC : Invalid SAP Id:RgUiRguDDatReq failed\n");
-#endif
-#ifndef L2_OPTMZ
- for(id3 = 0; id3 < datReq->nmbOfUeGrantPerTti; id3++)
- {
- RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[id3]);
- }
-#endif
- return RFAILED;
- }
-
- /* Update RGU SAP statistics for received sdu count */
- /*ccpu00118201 - ADD - Send trace only when its enabled*/
- if(rgCb[inst].rgInit.trc)
- {
- for(id3 = 0; id3 < datReq->nmbOfUeGrantPerTti; id3++)
- {
- RguDDatReqPerUe *datReqPerUe = &datReq->datReq[id3];
- for (id = 0; id < datReqPerUe->nmbOfTbs; id++)
- {
- for (id1 = 0; id1 < datReqPerUe->datReqTb[id].nmbLch; id1++)
- {
- /* rgCb.rguSap.sapSts.numPduRcvd is updated by
- * rgROMDedDatReq -> rgUpdtRguDedSts function
- * So numPduRcvd updation is commented here */
- /* rgCb.rguSap.sapSts.numPduRcvd +=
- datReq->datReqTb[id].lchData[id1].pdu.numPdu; */
- for (id2 = 0; id2 < datReqPerUe->datReqTb[id].lchData[id1].pdu.numPdu; id2++)
- {
- RG_SEND_TRC_IND(inst,datReqPerUe->datReqTb[id].
- lchData[id1].pdu.mBuf[id2], EVTRGUDDATREQ);
- }
- }
- }
- }
- }
-#endif
-
- /* Call Ownership module for further processing */
- ret = rgROMDedDatReq(inst,datReq);
- MAC_FREE_SHRABL_BUF(pst->region, pst->pool, datReq,sizeof(RguDDatReqInfo));
- return (ret);
-} /* RgUiRguDDatReq */
-
-
-/**
- * @brief Handler for common DatReq from RGU
- *
- * @details
- *
- * Function : RgUiRguCDatReq
- *
- * This function validates SAP invokes ROM for further processing
- *
- * @param[in] Pst *pst
- * @param[in] SpId spId
- * @param[in] RguCDatReqInfo *datReq
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgUiRguCDatReq
-(
-Pst *pst,
-SpId spId,
-RguCDatReqInfo *datReq
-)
-{
- Inst inst;
- S16 ret = ROK;
-
- RG_IS_INST_VALID(pst->dstInst);
- inst = pst->dstInst - RG_INST_START;
-#ifndef NO_ERRCLS
- if (datReq == NULLP)
- {
- DU_LOG("\nERROR --> MAC : Input Message Buffer is NULL");
- return RFAILED;
- }
-
- if(rgCb[inst].rguSap[spId].sapCfg.spId == spId)
- {
- switch (rgCb[inst].rguSap[spId].sapSta.sapState)
- {
- case LRG_BND: /* SAP is bound */
- DU_LOG("\nERROR --> MAC : SAP is already bound");
- break;
- default: /* Should never reach here */
-#if (ERRCLASS & ERRCLS_ADD_RES)
- DU_LOG("\nERROR --> MAC : Invalid SAP State:%d RgUiRguCDatReq failed",
- rgCb[inst].rguSap[spId].sapSta.sapState);
-#endif
- return RFAILED;
- }
- }
- else
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- DU_LOG("\nERROR --> MAC : Invalid SAP Id:%d RgUiRguCDatReq failed ",spId);
-#endif
- return RFAILED;
- }
-#endif
-
- /* Update RGU SAP statistics for received sdu count */
- /* rgCb.rguSap.sapSts.numPduRcvd is updated by
- * rgROMCmnDatReq ->rgUpdtRguCmnSts function
- * So numPduRcvd updation is commented here */
- /* rgCb.rguSap.sapSts.numPduRcvd++; */
-
- ret = rgROMCmnDatReq(inst,datReq);
- /*ccpu00118201 - ADD - Send trace only when its enabled*/
- if(rgCb[inst].rgInit.trc)
- {
- RG_SEND_TRC_IND(inst,datReq->pdu, EVTRGUCDATREQ);
- }
- if (ret == RFAILED)
- {
- RG_DROP_RGUCDATREQ_MBUF(datReq);
- }
- MAC_FREE_SHRABL_BUF(pst->region, pst->pool,datReq,sizeof(RguCDatReqInfo));
- return (ret);
-} /* RgUiRguCDatReq */
-
-
-/**
- * @brief Handler for dedicated StaRsp from RGU
- *
- * @details
- *
- * Function : RgUiRguDStaRsp
- *
- * This function validates SAP and invokes ROM for further processing
- *
- * @param[in] Pst *pst
- * @param[in] SpId spId
- * @param[in] RguDStaRspInfo *staRsp
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgUiRguDStaRsp
-(
-Pst *pst,
-SpId spId,
-RguDStaRspInfo *staRsp
-)
-{
- Inst inst;
- S16 ret = ROK;
- volatile uint32_t startTime = 0;
-
-
- RG_IS_INST_VALID(pst->dstInst);
- inst = pst->dstInst - RG_INST_START;
- /*starting Task*/
- SStartTask(&startTime, PID_MAC_STA_RSP);
-
- ret = rgROMDedStaRsp(inst,staRsp);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> MAC : Processing Of Status Response Failed");
- }
-
-
- /*stoping Task*/
- SStopTask(startTime, PID_MAC_STA_RSP);
- return (ret);
-} /* RgUiRguDStaRsp */
-
-
-/**
- * @brief Handler for common StaRsp from RGU
- *
- * @details
- *
- * Function : RgUiRguCStaRsp
- *
- * This function validates SAP and invokes ROM
- * for further processing
- *
- *
- * @param[in] Pst *pst
- * @param[in] SpId spId
- * @param[in] RguCStaRspInfo *staRsp
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgUiRguCStaRsp
-(
-Pst *pst,
-SpId spId,
-RguCStaRspInfo *staRsp
-)
-{
- Inst inst;
- S16 ret = ROK;
-
- RG_IS_INST_VALID(pst->dstInst);
- inst = pst->dstInst - RG_INST_START;
-#ifndef NO_ERRCLS
- if (staRsp == NULLP)
- {
- DU_LOG("\nERROR --> MAC : Input Response Buffer is NULL");
- return RFAILED;
- }
-
- if (spId == rgCb[inst].rguSap[spId].sapCfg.spId)
- {
- switch (rgCb[inst].rguSap[spId].sapSta.sapState)
- {
- case LRG_BND: /* SAP is bound */
- DU_LOG("\nDEBUG --> MAC : SAP is already bound");
- break;
- default: /* Should never reach here */
-#if (ERRCLASS & ERRCLS_ADD_RES)
- DU_LOG("\nERROR --> MAC : Invalid SAP State:%d RgUiRguCStaRsp failed",
- rgCb[inst].rguSap[spId].sapSta.sapState);
-#endif
- return RFAILED;
- }
- }
- else
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- DU_LOG("\nERROR --> MAC : Invalid SAP Id:%d RgUiRguCStaRsp failed",spId);
-#endif
- return RFAILED;
- }
-#endif
-
- ret = rgROMCmnStaRsp(inst,staRsp);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> MAC : Processing Of Status Response Failed");
- return (ret);
- }
-
- MAC_FREE_SHRABL_BUF(pst->region, pst->pool, staRsp,sizeof(RguCStaRspInfo));
- return (ret);
-} /* RgUiRguCStaRsp */
-
#ifdef LTE_L2_MEAS
/**
return ROK;
} /* rgUIMCrgBndCfm*/
-/**
- * @brief API for configuration request from RRC towards MAC.
- *
- * @details
- *
- * Function: RgUiCrgCfgReq
- *
- * This API is invoked by RRC towards MAC to configure MAC.
- * These API validates the Pst, spId, suId and transfers the config request
- * specific information to corresponding ownership module (COM) API.
- *
- *
- * @param[in] Pst *pst
- * @param[in] SpId spId
- * @param[in] CrgCfgTransId transId
- * @param[in] CrgCfgReqInfo *cfgReqInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgUiCrgCfgReq
-(
-Pst *pst,
-SpId spId,
-CrgCfgTransId transId,
-CrgCfgReqInfo *cfgReqInfo
-)
-{
- Inst inst;
- S16 ret = ROK;
- uint8_t cfmStatus = 0x00ff;
- uint8_t prntTrans[CRG_CFG_TRANSID_SIZE+1];
-
- RG_IS_INST_VALID(pst->dstInst);
- inst = pst->dstInst - RG_INST_START;
- /* Ensuring transId is always Null terminated. */
- memcpy(prntTrans, transId.trans, CRG_CFG_TRANSID_SIZE);
- prntTrans[CRG_CFG_TRANSID_SIZE] = '\0';
-
-
- /* CrgCfgReqInfo Validation for NULLP */
- if (cfgReqInfo == NULLP)
- {
- DU_LOG("\nERROR --> MAC : Input Param crgReqInfo is NULL ");
- rgUIMCrgCfgCfm(inst,transId, cfmStatus);
- return RFAILED;
- }
-
- /* Upper SAP Id and State validation */
- if (spId == rgCb[inst].crgSap.sapCfg.spId)
- {
- switch(rgCb[inst].crgSap.sapSta.sapState)
- {
- case LRG_BND: /* SAP is already bound */
- DU_LOG("\nDEBUG --> MAC : SAP is already bound");
- break;
- default: /* Should never reach here */
-#if (ERRCLASS & ERRCLS_ADD_RES)
- DU_LOG("\nERROR --> MAC : Invalid SAP State:%d RgUiCrgCfgReq failed",
- rgCb[inst].crgSap.sapSta.sapState);
-#endif
- MAC_FREE(cfgReqInfo, sizeof(CrgCfgReqInfo));
-
- rgUIMCrgCfgCfm(inst,transId, cfmStatus);
- return RFAILED;
- }
- }
- else
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- DU_LOG("\nERROR --> MAC : Invalid SAP Id:%d RgUiCrgCfgReq failed",
- rgCb[inst].crgSap.sapCfg.spId);
-#endif
- MAC_FREE(cfgReqInfo, sizeof(CrgCfgReqInfo));
- rgUIMCrgCfgCfm(inst,transId, cfmStatus);
- return RFAILED;
- }
- ret = rgCOMCfgReq(inst,transId, cfgReqInfo);
- MAC_FREE(cfgReqInfo, sizeof(CrgCfgReqInfo));
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> MAC : Configuration Request Handling Failed ");
- return RFAILED;
- }
-
- return ROK;
-} /* RgUiCrgCfgReq */
-
/**
* @brief API for sending configuration confirm from MAC to RRC
*
return (ret);
} /* rgUIMCrgCfgCfm */
-#if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_STA_RSP_RBUF)
-
-S16 rgBatchProc(Void)
-{
-/* Read from Ring Buffer and process RLC BO Update */
- Pst pst = {0};
- SpId spId = 0;
- RguDStaRspInfo *staRsp;
- uint32_t elmIndx = 0;
-#ifndef LTE_ADV
-/* Fill pst */
- pst.srcProcId = 1;
- pst.dstProcId = 1;
- pst.dstEnt = ENTMAC;
- pst.dstInst = 0;
- pst.srcEnt = ENTRLC;
- pst.srcInst = 1;
- pst.prior = PRIOR0;
- pst.route = RTESPEC;
- pst.event = EVTRGUDSTARSP;
- pst.region = 0;
- pst.pool = 0;
- pst.selector = 2; /*SM_SELECTOR_LC */
-#else
-#endif
-
- elmIndx = (uint32_t)SRngGetRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
- while(NULLP != elmIndx)
- {
- staRsp = (RguDStaRspInfo *)elmIndx;
-#ifdef LTE_ADV
- pst = staRsp->post;
-#endif
- RgUiRguDStaRsp(&pst, spId, staRsp);
-
- elmIndx = NULLP;
- staRsp = NULLP;
- SRngIncrRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
-
- if((elmIndx = (uint32_t)SRngGetRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC)) == NULLP)
- break;
- }
- return ROK;
-}
-#endif
/**********************************************************************
/* local defines */
#define RG_NON_MIMO_IDX 0
-/* local typedefs */
-
-/* local externs */
-
-/* forward references */
-static S16 rgUtlHndlCrntiChng ARGS((
- Inst inst,
- RgCellCb *cell,
- CmLteRnti rnti,
- CmLteRnti newRnti
- ));
-static Void rgUtlHndlCrntiRls ARGS((
- RgCellCb *cell,
- RgInfRlsRnti *rlsRnti
- ));
-
-S16 rgDelUeFrmAllSCell ARGS((
- RgCellCb *cell,
- RgUeCb *ue
- ));
-
-#ifdef LTE_ADV
-static S16 rgUtlSndCrntiChngReq2AllSMacs ARGS((
- RgCellCb *cell,
- CmLteRnti rnti,
- CmLteRnti newRnti
- ));
-#endif
-/***********************************************************
- *
- * Func : rgAllocShrablSBuf
- *
- * Desc : Utility Function to Allocate static buffer which is
- * sharable among different layers if YYYY flag is enabled.
- * else it allocates from normal static region
- * Memory allocated is assumed contiguous.
- *
- *
- * Ret : ROK
- * RFAILED
- *
- * Notes: Caller doesnt need to raise the alarm in case of memory
- * allocation gets failed.
- *
- * File : rg_utl.c
- *
- **********************************************************/
-S16 rgAllocShrablSBuf
-(
-Inst inst,
-Data **pData, /* Pointer of the data to be returned */
-Size size /* size */
-)
-{
- RgUstaDgn dgn; /* Alarm diagnostics structure */
-
- /* Initialize the param to NULLP */
- *pData = NULLP;
-
- if (size == 0)
- {
- return RFAILED;
- }
-
- /* allocate buffer */
- MAC_ALLOC_SHRABL_BUF(pData, size);
- if(pData == NULLP)
- {
- dgn.type = LRG_USTA_DGNVAL_MEM;
- dgn.u.mem.region = rgCb[inst].rgInit.region;
- dgn.u.mem.pool = rgCb[inst].rgInit.pool;
- /* Send an alarm to Layer Manager */
- rgLMMStaInd(inst,LCM_CATEGORY_RESOURCE, LCM_EVENT_SMEM_ALLOC_FAIL,
- LCM_CAUSE_MEM_ALLOC_FAIL, &dgn);
- DU_LOG("\nERROR --> MAC : Unable to Allocate Buffer");
- return RFAILED;
- }
-
-#ifndef ALIGN_64BIT
- DU_LOG("\nDEBUG --> MAC : MAC_ALLOC(Region (%d), Pool (%d), Size (%ld)), Data (0x%p))\n",
- rgCb[inst].rgInit.region, rgCb[inst].rgInit.pool, size, *pData);
-#else
- DU_LOG("\nDEBUG --> MAC : MAC_ALLOC(Region (%d), Pool (%d), Size (%d)), Data (0x%p))\n",
- rgCb[inst].rgInit.region, rgCb[inst].rgInit.pool, size, *pData);
-#endif
-
- /* zero out the allocated memory */
- memset(*pData, 0x00, size);
-
- return ROK;
-
-} /* end of rgAllocSBuf */
-
-
/***********************************************************
*
* Func : rgAllocSBuf
} /* end of rgFreeSBuf */
-/***********************************************************
- *
- * Func : rgGetMsg
- *
- * Desc : Utility Function to Allocate message buffer.
- *
- *
- * Ret : ROK
- * RFAILED
- *
- * Notes: Caller doesnt need to raise the alarm in case of memory
- * allocation gets failed.
- *
- * File : rg_utl.c
- *
- **********************************************************/
-S16 rgGetMsg
-(
-Inst inst,
-Buffer **mBuf /* Message Buffer pointer be returned */
-)
-{
- S16 ret;
-
-#ifdef MS_MBUF_CORRUPTION /* Should be enabled when debugging mbuf corruption */
- MS_BUF_ADD_ALLOC_CALLER();
-#endif /* */
- ret = ODU_GET_MSG_BUF(RG_GET_MEM_REGION(rgCb[inst]), RG_GET_MEM_POOL(rgCb[inst]), mBuf);
-
- if (ROK != ret)
- {
- /* Moving diagnostics structure to limited scope for optimization */
- RgUstaDgn dgn; /* Alarm diagnostics structure */
-
- rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
-
- /* Send an alarm to Layer Manager */
- rgLMMStaInd(inst,LCM_CATEGORY_RESOURCE, LCM_EVENT_DMEM_ALLOC_FAIL,
- LCM_CAUSE_MEM_ALLOC_FAIL, &dgn);
- DU_LOG("\nERROR --> MAC : Unable to Allocate Buffer");
- return RFAILED;
- }
-
- return ROK;
-
-} /* end of rgGetMsg */
-
-
/***********************************************************
*
* Func : rgFillDgnParams
} /* end of rgFillDgnParams */
-/***********************************************************
- *
- * Func : rgUpdtRguDedSts
- *
- * Desc : Utility Function to update rgu sap statistics for dedicated
- * DatReqs.
- *
- *
- * Ret : ROK
- * RFAILED
- *
- * Notes:
- *
- * File : rg_utl.c
- *
- **********************************************************/
-Void rgUpdtRguDedSts
-(
-Inst inst,
-RgUpSapCb *rguDlSap,
-uint8_t stsType, /* Statistics type to update */
-RgRguDedDatReq *datReq /* DatReq pointer */
-)
-{
- uint8_t idx1,idx2;
- uint32_t idx;
-
- switch(stsType)
- {
- case RG_RGU_SDU_RCVD:
- for(idx = 0; idx < datReq->nmbOfUeGrantPerTti; idx++)
- {
- RguDDatReqPerUe *datReqPerUe = &datReq->datReq[idx];
- for (idx1 = 0; idx1 < datReqPerUe->nmbOfTbs; idx1++)
- {
- for(idx2 = 0; idx2 < datReqPerUe->datReqTb[idx1].nmbLch; idx2++)
- {
- rguDlSap->sapSts.numPduRcvd +=
- datReqPerUe->datReqTb[idx1].lchData[idx2].pdu.numPdu;
- }
- }
- }
-
- break;
- case RG_RGU_SDU_DROP:
- for(idx = 0; idx < datReq->nmbOfUeGrantPerTti; idx++)
- {
- RguDDatReqPerUe *datReqPerUe = &datReq->datReq[idx];
- for (idx1 = 0; idx1 < datReqPerUe->nmbOfTbs; idx1++)
- {
- for(idx2 = 0; idx2 < datReqPerUe->datReqTb[idx1].nmbLch; idx2++)
- {
- rguDlSap->sapSts.numPduRcvd +=
- datReqPerUe->datReqTb[idx1].lchData[idx2].pdu.numPdu;
- rguDlSap->sapSts.numPduDrop +=
- datReqPerUe->datReqTb[idx1].lchData[idx2].pdu.numPdu;
- }
- }
- }
-
- break;
- }
-
- return;
-} /* rgUpdtRguDedSts */
-
-
-/***********************************************************
- *
- * Func : rgUpdtRguCmnSts
- *
- * Desc : Utility Function to update rgu sap statistics for common
- * DatReqs.
- *
- *
- * Ret : ROK
- * RFAILED
- *
- * Notes:
- *
- * File : rg_utl.c
- *
- **********************************************************/
-Void rgUpdtRguCmnSts
-(
-Inst inst,
-RgUpSapCb *rguDlSap,
-uint8_t stsType /* Statistics type to update */
-)
-{
-
- switch(stsType)
- {
- case RG_RGU_SDU_RCVD:
- rguDlSap->sapSts.numPduRcvd ++;
- break;
- case RG_RGU_SDU_DROP:
- rguDlSap->sapSts.numPduRcvd ++;
- rguDlSap->sapSts.numPduDrop ++;
- break;
- }
-
- return;
-} /* rgUpdtRguCmnSts */
-
-
-/***********************************************************
- *
- * Func : rgUpdtCellCnt
- *
- * Desc : Utility Function to update cell count. It gives number of active
- * cells
- *
- *
- * Ret : ROK
- * RFAILED
- *
- * Notes: This function should be called only after cell is added/deleted
- * from the globlal hashlist
- *
- * File : rg_utl.c
- *
- **********************************************************/
-Void rgUpdtCellCnt(Inst inst,uint8_t updtType)
-{
-
- switch (updtType)
- {
- case RG_CFG_ADD:
- rgCb[inst].genSts.numCellCfg++;
- break;
- case RG_CFG_DEL:
- rgCb[inst].genSts.numCellCfg--;
- break;
- default:
- break;
- }
-
- return;
-} /* rgUpdtCellCnt */
-
-
-/***********************************************************
- *
- * Func : rgUpdtUeCnt
- *
- * Desc : Utility Function to update ue count. It gives number of active
- * Ues.
- *
- *
- * Ret : ROK
- * RFAILED
- *
- * Notes: This function should be called only after ue is added/deleted
- * from the globlal hashlist
- *
- * File : rg_utl.c
- *
- **********************************************************/
-Void rgUpdtUeCnt(Inst inst,uint8_t updtType)
-{
- switch (updtType)
- {
- case RG_CFG_ADD:
- rgCb[inst].genSts.numUeCfg++;
- break;
- case RG_CFG_DEL:
- rgCb[inst].genSts.numUeCfg--;
- break;
- default:
- break;
- }
- return;
-} /* rgUpdtUeCnt */
-
-/*
-*
-* Fun: rgAllocEventMem
-*
-* Desc: This function allocates event memory
-*
-* Ret: ROK - on success
-* RFAILED - on failure
-*
-* Notes: None
-*
-* File: rg_utl.c
-*
-*/
-S16 rgAllocEventMem
-(
-Inst inst,
-Ptr *memPtr,
-Size memSize
-)
-{
- Mem sMem;
- volatile uint32_t startTime=0;
-
-
- sMem.region = rgCb[inst].rgInit.region;
- sMem.pool = rgCb[inst].rgInit.pool;
-
-#if (ERRCLASS & ERRCLS_DEBUG)
- if (memSize<= 0)
- {
- DU_LOG("\nERROR --> MAC : rgAllocEventMem(): memSize invalid\n");
- return (RFAILED);
- }
-#endif /* ERRCLASS & ERRCLS_DEBUG */
-
-
- /*starting Task*/
- SStartTask(&startTime, PID_MACUTL_CMALLCEVT);
-
-#ifdef MS_MBUF_CORRUPTION /* Should be enabled when debugging mbuf corruption */
- MS_BUF_ADD_ALLOC_CALLER();
-#endif /* */
-#ifdef TFU_ALLOC_EVENT_NO_INIT
- if(ROK != cmAllocEvntNoInit(memSize, TFU_MAX_MEMBLK_SIZE, &sMem, memPtr))
-#else
- if(ROK != cmAllocEvnt(memSize, TFU_MAX_MEMBLK_SIZE, &sMem, memPtr))
-#endif /* */
- {
- DU_LOG("\nERROR --> MAC : cmAllocEvnt Failed");
- return RFAILED;
- }
-
- /*stoping Task*/
- SStopTask(startTime, PID_MACUTL_CMALLCEVT);
-
- return ROK;
-} /* end of rgAllocEventMem*/
-
-/*
-*
-* Fun: rgGetEventMem
-*
-* Desc: This function allocates event memory
-*
-* Ret: ROK - on success
-* RFAILED - on failure
-*
-* Notes: None
-*
-* File: rg_utl.c
-*
-*/
-S16 rgGetEventMem
-(
-Inst inst,
-Ptr *ptr,
-Size len,
-Ptr memCp
-)
-{
- S16 ret;
-
-#ifdef TFU_ALLOC_EVENT_NO_INIT
- ret = cmGetMemNoInit(memCp, len, (Ptr *)ptr);
-#else
- ret = cmGetMem(memCp, len, (Ptr *)ptr);
-#endif /* */
- return (ret);
-} /* end of rgGetEventMem*/
-
-/***********************************************************
- *
- * Func : rgGetPstToInst
- *
- * Desc : Utility Function to get the pst structure to post a message to
- * scheduler instance
- *
- *
- * Ret : ROK
- * RFAILED
- *
- * Notes: This function should be called while sending a msg from
- * MAC to a scheduler instance
- *
- * File : rg_utl.c
- *
- **********************************************************/
-Void rgGetPstToInst
-(
-Pst *pst,
-Inst srcInst,
-Inst dstInst
-)
-{
-
- pst->srcEnt = rgCb[srcInst].rgInit.ent;
- pst->srcInst = rgCb[srcInst].rgInit.inst;
- pst->srcProcId = rgCb[srcInst].rgInit.procId;
- pst->region = rgCb[srcInst].rgInit.region;
- pst->pool = rgCb[srcInst].rgInit.pool;
-
- pst->dstProcId = rgCb[dstInst].rgInit.procId;
- pst->dstEnt = rgCb[dstInst].rgInit.ent;
- pst->dstInst = dstInst;
- pst->selector = 0;
- pst->prior = PRIOR0;
- pst->intfVer = 0;
- pst->route = RTESPEC;
-
- return;
-} /* end of rgGetPstToInst */
-
-/***********************************************************
- *
- * Func : RgSchMacLcgRegReq
- *
- * Desc : Utility Function to register the set of GBR LCG.
- * Invoked at the time of LCG configuration/Reconfiguration at Schedular.
- *
- * Processing Steps:
- * - Fetch the ueCb using the crnti given in lcInfo
- * - Store the if LCG is GBR or not.
- *
- * Ret : ROK
- * RFAILED
- *
- * Notes: This function should be called at the time of LCG
- * configuration/Reconfiguration at Schedular.
- *
- *
- * File : rg_utl.c
- *
- **********************************************************/
-S16 RgSchMacLcgRegReq(Pst *pst,RgInfLcgRegReq *lcgRegReq)
-{
- Inst inst;
- RgCellCb *cell = NULLP;
- RgUeCb *ue;
-
- RG_IS_INST_VALID(pst->dstInst);
- inst = pst->dstInst - RG_INST_START;
- cell = rgCb[inst].cell;
- /* Fetch the cell and then the UE */
- if((cell == NULLP) ||
- (cell->cellId != lcgRegReq->cellId))
- {
-
- DU_LOG("\nERROR --> MAC : Cell does not exist ");
- return RFAILED;
- }
-
- if ((ue = rgDBMGetUeCb(cell, lcgRegReq->crnti)) == NULLP)
- {
- DU_LOG("\nERROR --> MAC : CRNTI:%d does not exist",
- lcgRegReq->crnti);
- return RFAILED;
- }
- ue->ul.lcgArr[lcgRegReq->lcgId].isGbr = lcgRegReq->isGbr;
-
- return ROK;
-} /* end of RgSchMacLcgRegReq */
-
-#ifdef LTEMAC_SPS
-
-/***********************************************************
- *
- * Func : RgSchMacUlSpsResetReq
- *
- * Desc : Utility Function to reset SPS params for a UE
- *
- * Processing Steps:
- * - Fetch the ueCb using the crnti
- * - reset implRelCnt and explRelCnt
- *
- * Ret : ROK
- * RFAILED
- *
- * File : rg_utl.c
- *
- **********************************************************/
-S16 RgSchMacUlSpsResetReq(Pst *pst,RgInfUlSpsReset *ulSpsResetInfo)
-{
- Inst inst;
- RgCellCb *cell = NULLP;
- RgUeCb *ue;
-
- RG_IS_INST_VALID(pst->dstInst);
- inst = pst->dstInst - RG_INST_START;
- cell = rgCb[inst].cell;
- /* Fetch the cell and then the UE */
- if((cell == NULLP)||
- (cell->cellId != ulSpsResetInfo->cellId))
- {
-
- DU_LOG("\nERROR --> MAC : Cell does not exist ");
- return RFAILED;
- }
-
- if ((ue = rgDBMGetUeCb(cell, ulSpsResetInfo->crnti)) == NULLP)
- {
- DU_LOG("\nERROR --> MAC : CRNTI:%d does not exist",
- ulSpsResetInfo->crnti);
- return RFAILED;
- }
-
- ue->ul.implRelCntr = 0;
- ue->ul.explRelCntr = 0;
-
- return ROK;
-} /* end of RgSchMacUlSpsResetReq */
-
-
-
-
-/***********************************************************
- *
- * Func : RgSchMacSpsLcRegReq
- *
- * Desc : Utility Function to register the set of uplink SPS logical
- * channels for a SPS UE.
- * Invoked at the time of activation of a UE for UL-SPS.
- * Whenever there is data on these LCs MAC shall inform scheduler
- *
- * Processing Steps:
- * - Fetch the ueCb using the crnti given in lcInfo
- * - Store the sps-rnti and set the bits corresponding to the
- * logical channel ids in ueUlCb->spsLcMask.
- *
- * Ret : ROK
- * RFAILED
- *
- * Notes: This function should be called at the time UL SPS is activated
- * for a UE at scheduler
- *
- *
- * File : rg_utl.c
- *
- **********************************************************/
-S16 RgSchMacSpsLcRegReq(Pst *pst,RgInfSpsLcInfo *lcInfo)
-{
- Inst inst;
- RgCellCb *cell= NULLP;
- RgUeCb *ue;
- uint8_t idx;
-
- RG_IS_INST_VALID(pst->dstInst);
- inst = pst->dstInst - RG_INST_START;
- cell = rgCb[inst].cell;
- /* Fetch the cell and then the UE */
- if((cell == NULLP) ||
- (cell->cellId != lcInfo->cellId))
- {
-
- DU_LOG("\nERROR --> MAC : Cell does not exist ");
- return RFAILED;
- }
-
- if ((ue = rgDBMGetUeCb(cell, lcInfo->crnti)) == NULLP)
- {
- DU_LOG("\nERROR --> MAC : CRNTI:%d does not exist",
- lcInfo->crnti);
- return RFAILED;
- }
-
- /* Store the sps-rnti and SPS LC information in the UE */
- ue->spsRnti = lcInfo->spsRnti;
- for (idx=0; idx < lcInfo->spsLcCnt; idx++)
- {
- /* KWORK_FIX: Modified the index from lcId to lcId-1 for handling lcId 10 properly */
- ue->ul.spsLcId[(lcInfo->spsLcId[idx])-1] = TRUE;
- }
- ue->ul.implRelCnt = lcInfo->implRelCnt;
- ue->ul.explRelCnt = ue->ul.implRelCnt + 1; /*(lcInfo->implRelCnt * lcInfo->spsPrd);*/
-
- /* Insert the UE into SPS UE List */
- if (rgDBMInsSpsUeCb(cell, ue) == RFAILED)
- {
- DU_LOG("\nERROR --> MAC : Ue insertion into SPS list failed SPS CRNTI:%d", ue->spsRnti);
- return RFAILED;
- }
-
- return ROK;
-} /* end of RgSchMacSpsLcRegReq */
-
-
-/***********************************************************
- *
- * Func : RgSchMacSpsLcDeregReq
- *
- * Desc : Utility Function to deregister the set of uplink SPS
- * logical channels for a UE.
- * Invoked at the time of release of UL-SPS for an activated UE.
- *
- * Processing Steps:
- * - Fetch the ueCb using the crnti given
- * - Reset the bits corresponding to the logical channel ids in
- * ueUlCb->spsLcMask.
- *
- * Ret : ROK
- * RFAILED
- *
- * Notes: This function should be called at the time UL SPS is released
- * for a UE at scheduler
- *
- *
- * File : rg_utl.c
- *
- **********************************************************/
-S16 RgSchMacSpsLcDeregReq(Pst *pst,CmLteCellId cellId,CmLteRnti crnti)
-{
- Inst inst;
- RgCellCb *cell = NULLP;
- RgUeCb *ue;
-
- RG_IS_INST_VALID(pst->dstInst);
- inst = pst->dstInst - RG_INST_START;
- cell = rgCb[inst].cell;
- /* Fetch the cell and then the UE */
- if((cell == NULLP) ||
- (cell->cellId != cellId))
- {
-
- DU_LOG("\nERROR --> MAC : Cell does not exist ");
- return RFAILED;
- }
-
- if ((ue = rgDBMGetUeCb(cell, crnti)) == NULLP)
- {
- DU_LOG("\nERROR --> MAC : CRNTI:%d Ue does not exist", crnti);
- return RFAILED;
- }
-
- /* No need to reset the SPS LC Ids as they will not be looked at*/
-
- /* Delete UE from the SPS UE List */
- rgDBMDelSpsUeCb(cell, ue);
-
- return ROK;
-} /* end of RgSchMacSpsLcDeregReq */
-
-#endif /* LTEMAC_SPS */
-
-/**
- * @brief Function for handling CRNTI change request
- * received from scheduler to MAC.
- *
- * @details
- *
- * Function : rgUtlHndlCrntiChng
- *
- * - Delete old UE from the list.
- * - Update the new rnti and re-insert the UE in the list.
- *
- *
- * @param[in] Inst inst
- * @param[in] RgCellCb *cell,
- * @param[in] CmLteRnti rnti,
- * @param[in] CmLteRnti newRnti
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgUtlHndlCrntiChng
-(
-Inst inst,
-RgCellCb *cell,
-CmLteRnti rnti,
-CmLteRnti newRnti
-)
-{
- RgUeCb *ue = NULLP;
- RgUeCb *newUe = NULLP;
-
- ue = rgDBMGetUeCb(cell, rnti);
- newUe = rgDBMGetUeCbFromRachLst(cell, newRnti);
- if ((ue == NULLP) || (newUe == NULLP))
- {
- DU_LOG("\nERROR --> MAC : RNTI:%d Failed to get UECB[%lu:%lu] or NEW RNTI:%d",
- rnti, ((PTR)ue), ((PTR)newUe), newRnti);
- return RFAILED;
- }
-#ifdef XEON_SPECIFIC_CHANGES
- DU_LOG("\nDEBUG --> MAC : MAC:UE[%d] id changed to %d\n", rnti, newRnti);
-#endif
- rgDBMDelUeCb(cell, ue);
-
- ue->ueId = newRnti;
-
- memcpy(&(ue->contResId), &(newUe->contResId),
- sizeof(newUe->contResId));
- /* Fix : syed MSG4 might be RETXing need to store the
- * HARQ context. */
- rgDHMFreeUe(inst,&ue->dl.hqEnt);
- ue->dl.hqEnt = newUe->dl.hqEnt;
-
- rgDBMInsUeCb(cell, ue);
-
- rgDBMDelUeCbFromRachLst(cell, newUe);
- rgFreeSBuf(inst,(Data **)&newUe, sizeof(*newUe));
-
- return ROK;
-} /* end of rgUtlHndlCrntiChng */
-
-#ifdef LTE_ADV
-/**
- * @brief Function for handling UE release for SCELL
- * triggered from SCH to MAC.
- *
- * @details
- *
- * Function : rgDelUeFrmAllSCell
- *
- * - This Function should be invoked by PCell of UE
- * - Remove the UE context from SCELL corresponding to rnti.
- *
- * @param[in] Inst *macInst,
- * @param[in] RgUeCb *ue
- * @return ROK is SUCCESS
- **/
-S16 rgDelUeFrmAllSCell(RgCellCb *cell,RgUeCb *ue)
-{
- Inst inst = cell->macInst - RG_INST_START;
- uint8_t idx = 0;
- Inst sCellInstIdx;
- Pst dstInstPst;
- RgPrgUeSCellDelInfo ueSCellDelInfo;
-
- /* To Delete the SCells if exisits for that UE */
- for(idx = 0; idx < RG_MAX_SCELL_PER_UE ; idx++)
- {
- if(TRUE == ue->sCelInfo[idx].isSCellAdded)
- {
- sCellInstIdx = ue->sCelInfo[idx].macInst - RG_INST_START;
-
- rgGetPstToInst(&dstInstPst, inst, sCellInstIdx);
- ueSCellDelInfo.ueId = ue->ueId;
- ueSCellDelInfo.sCellId = ue->sCelInfo[idx].sCellId;
-
- /* Filling same ueId in newRnti so that SMAC will check if newRnti
- *and old UeId is same that means its a UeSCell delete request*/
- ueSCellDelInfo.newRnti = ue->ueId;
-
- RgPrgPMacSMacUeSCellDel(&dstInstPst, &ueSCellDelInfo);
- ue->sCelInfo[idx].isSCellAdded = FALSE;
- } /* loop of if */
- } /* loop of for */
-
- return ROK;
-} /* rgDelUeFrmAllSCell */
-
-/**
- * @brief Function to validate AddSCellCfg.
- *
- * @details
- *
- * Function : rgUtlVltdAddSCellCfg
- *
- *
- * @param[in] ueSCellCb secondary cell CB for validation
- * @param[in] cell cell control block
- * @param[in] inst instance number to fetch rgCb instance
- * @return S16
- * -# ROK
- **/
-S16 rgUtlVltdAddSCellCfg(RgPrgUeSCellCfgInfo *ueSCellCb,RgCellCb *cell,Inst inst)
-{
- S16 ret = ROK;
-
- /* To Validate the CellID presence */
- if((cell == NULLP) ||
- (cell->cellId != ueSCellCb->cellId))
- {
- DU_LOG("\nERROR --> MAC : [%d]Sec Cell does not exit %d\n",
- ueSCellCb->ueId, ueSCellCb->cellId);
- ret = RFAILED;
- }
-#ifdef TENB_MULT_CELL_SUPPRT
- if((ueSCellCb->rguDlSapId > rgCb[inst].numRguSaps) ||
- (ueSCellCb->rguUlSapId > rgCb[inst].numRguSaps))
- {
- DU_LOG("\nERROR --> MAC : Invald Sap Id: DL %d UL %d for ueId %d failed\n",
- ueSCellCb->rguDlSapId,
- ueSCellCb->rguUlSapId,
- ueSCellCb->cellId);
- ret = RFAILED;
- }
-#endif
- return (ret);
-} /* rgUtlVltdAddSCellCfg */
-
-/**
- * @brief Function to build CrntiChangeReq and send to all SMACs.
- *
- * @details
- *
- * Function : rgUtlSndCrntiChngReq2AllSMacs
- *
- * - This Function should be invoked by PCell of UE
- * - It sends RgPrgPMacSMacUeSCellDelReq to all SMACs with newRnti sent
- * by SCH. SMAC will check if newRnti is not equal to old UeId then it
- * do only UeId change else it will delete the UeScell context
- *
- * @param[in] cell Cell CB to get Ue control block
- * @param[in] rnti Ue Identifier used to fill in UeId Change req
- * @param[in] newRnti UE new identifier, to be used in UeId Change req
- * @return S16
- * -# ROK
- **/
-static S16 rgUtlSndCrntiChngReq2AllSMacs
-(
-RgCellCb *cell,
-CmLteRnti rnti,
-CmLteRnti newRnti
-)
-{
- Inst inst = cell->macInst - RG_INST_START;
- Inst sCellInstIdx;
- Pst dstInstPst;
- RgPrgUeSCellDelInfo ueIdChngReq;
- RgUeCb *ue;
- uint8_t idx;
-#ifdef L2_OPTMZ
-TfuDelDatReqInfo delDatReq;
-#endif
-
- /* use newRnti to get UeCb in PMac because rnti is already changed in PMac*/
- ue = rgDBMGetUeCb(cell, newRnti);
- if (ue == NULLP)
- {
- DU_LOG("\nERROR --> MAC : [%d]RNTI:Failed to get ueCb \
- newRnti=%d\n", rnti, newRnti);
- return RFAILED;
- }
- /* For all added SCells, prepare and send ueIdChngReq */
- for(idx = 0; idx < RG_MAX_SCELL_PER_UE ; idx++)
- {
- if(TRUE == ue->sCelInfo[idx].isSCellAdded)
- {
- sCellInstIdx = ue->sCelInfo[idx].macInst - RG_INST_START;
-
- rgGetPstToInst(&dstInstPst, inst, sCellInstIdx);
- /* fill old rnti*/
- ueIdChngReq.ueId = rnti;
- ueIdChngReq.sCellId = ue->sCelInfo[idx].sCellId;
-
- /* Filling newRnti so that SMAC can check if old ueId and new UeId
- *(newRnti) is different then its a UeId change request from PMAC.
- * RgPrgPMacSMacUeSCellDelReq is being reused for UeId change req
- * from PMAC to SMAC*/
- ueIdChngReq.newRnti = newRnti;
-
- /* Re-using UeSCellDelReq API for UeId change*/
- RgPrgPMacSMacUeSCellDel(&dstInstPst, &ueIdChngReq);
-#ifdef L2_OPTMZ
- /* Sending delDatReq to CL to clear the Pdus for old UeId present in CL*/
- delDatReq.cellId = ueIdChngReq.sCellId;
- delDatReq.ueId = ueIdChngReq.ueId;
- rgLIMTfuDelDatReq(sCellInstIdx, &delDatReq);
-#endif
-
- } /* loop of if */
- } /* loop of for */
-
- return ROK;
-} /* rgUtlSndCrntiChngReq2AllSMacs */
-
-#endif /* LTE_ADV */
-
-/**
- * @brief Function for handling CRNTI Context release
- * triggered from SCH to MAC.
- *
- * @details
- *
- * Function : rgUtlHndlCrntiRls
- *
- * - Remove the UE context from MAC corresponding to rnti.
- *
- *
- * @param[in] RgCellCb *cell,
- * @param[in] CmLteRnti rnti
- * @return Void
- **/
-static Void rgUtlHndlCrntiRls(RgCellCb *cell,RgInfRlsRnti *rlsRnti)
-{
- Inst inst = cell->macInst - RG_INST_START;
- RgUeCb *ue = NULLP;
-#ifdef LTEMAC_SPS
- RgUeCb *spsUeCb = NULLP;
-#endif
-
- if ((ue = rgDBMGetUeCb(cell, rlsRnti->rnti)) == NULLP)
- {
- /* Check in RachLst */
- if((ue=rgDBMGetUeCbFromRachLst (cell, rlsRnti->rnti)) != NULLP)
- {
- /* Delete Ue from the UE list */
- rgDBMDelUeCbFromRachLst(cell, ue);
-
- /* Free Ue */
- rgRAMFreeUeCb(inst,ue);
- }
- else
- {
- DU_LOG("\nERROR --> MAC : RNTI:%d No ueCb found in RachLst",rlsRnti->rnti);
- }
- }
- else
- {
-#ifdef LTE_ADV
- if(FALSE == rlsRnti->isUeSCellDel)
- {
- rgDelUeFrmAllSCell(cell, ue);
- }
-#endif /* LTE_ADV */
-
- /* Delete Ue from the UE list */
- rgDBMDelUeCb(cell, ue);
-#ifdef LTEMAC_SPS
- spsUeCb = rgDBMGetSpsUeCb (cell, ue->spsRnti);
- if (spsUeCb)
- {
- rgDBMDelSpsUeCb(cell, spsUeCb);
- }
-#endif
-
- /* Free Ue */
- rgCFGFreeUeCb(cell, ue);
- /* MS_REMOVE : syed Check in RachLst */
- {
- if((ue=rgDBMGetUeCbFromRachLst (cell, rlsRnti->rnti)) != NULLP)
- {
- DU_LOG("\nERROR --> MAC : RNTI:%d STALE UE is still present", rlsRnti->rnti);
- }
- }
- }
-
- return;
-} /* end of rgUtlHndlCrntiRls */
-
-/**
- * @brief Function for handling RaResp request received from scheduler to MAC.
- *
- * @details
- *
- * Function : RgSchMacRlsRntiReq
- *
- * This function shall be invoked whenever scheduler is done with the
- * allocations of random access responses for a subframe.
- * This shall invoke RAM to create ueCbs for all the rapIds allocated and
- * shall invoke MUX to create RAR PDUs for raRntis allocated.
- *
- *
- * @param[in] CmLteCellId cellId,
- * @param[in] CmLteTimingInfo timingInfo,
- * @param[in] RaRespInfo *rarInfo
- * @return S16
- * -# ROK
- **/
-S16 RgSchMacRlsRntiReq(Pst *pst,RgInfRlsRnti *rlsRnti)
-{
-// Pst schPst;
-// RgInfUeDelInd ueDelInd;
- Inst macInst;
- RgCellCb *cell;
-#ifdef L2_OPTMZ
-TfuDelDatReqInfo delDatReq;
-#endif
-
- RG_IS_INST_VALID(pst->dstInst);
- macInst = pst->dstInst - RG_INST_START;
- cell = rgCb[macInst].cell;
-
- if(NULLP == rlsRnti)
- {
- return RFAILED;
- }
-
- if((cell == NULLP) ||
- (cell->cellId != rlsRnti->cellId))
- {
-
- DU_LOG("\nERROR --> MAC : No cellCb found with cellId for RNTI:%d",
- rlsRnti->rnti);
- return RFAILED;
- }
- /* Fix : syed Clearing UE context when SCH indicates to do so
- * UE DEL from CRG interface is now dummy. */
- if (rlsRnti->ueIdChng)
- {
- /* Fix : syed ueId change as part of reestablishment.
- * Now SCH to trigger this. CRG ueRecfg for ueId change
- * is dummy */
- if (rgUtlHndlCrntiChng(macInst,cell, rlsRnti->rnti, rlsRnti->newRnti) != ROK)
- {
- DU_LOG("\nERROR --> MAC : CRNTI change failed for RNTI:%d new RNTI:%d",
- rlsRnti->rnti,rlsRnti->newRnti);
- return RFAILED;
- }
-
-#ifdef LTE_ADV
- /*PMAC_Reest: Prepare CrntiChngReq and then send to all SMACs to change
- *rnti in all Scells
- */
- if(rgUtlSndCrntiChngReq2AllSMacs(cell, rlsRnti->rnti, rlsRnti->newRnti) != ROK)
- {
- /* TODO: do we need to send DelInd to SCH in failure case*/
- return RFAILED;
- }
-#endif
-#ifdef L2_OPTMZ
- /* Sending delDatReq to CL to clear the Pdus for old UeId present in CL*/
- delDatReq.cellId = cell->cellId;
- delDatReq.ueId = rlsRnti->rnti;
- rgLIMTfuDelDatReq(macInst, &delDatReq);
-#endif
- }
- else
- {
- rgUtlHndlCrntiRls(cell, rlsRnti);
- }
- /* Fix : syed Send delete confirmation to SCH */
- /* Send RgMacSchUeDelInd to SCH only if it is Rnti release to PMAC.
- * Basically dont send DelInd to SCH incase of Ue SCell Del*/
-#ifdef LTE_ADV
- if(FALSE == rlsRnti->isUeSCellDel)
-#endif
- {
- //TODO: commented for compilation without SCH
-#if 0
- ueDelInd.cellSapId = cell->schInstMap.cellSapId;
- ueDelInd.cellId = rlsRnti->cellId;
- ueDelInd.rnti = rlsRnti->rnti;
- rgGetPstToInst(&schPst,macInst, cell->schInstMap.schInst);
- RgMacSchUeDel(&schPst, &ueDelInd);
-#endif
- }
-
- return ROK;
-} /* end of RgSchMacRlsRntiReq */
-
-#ifdef L2_OPTMZ
-Bool RgUtlIsTbMuxed(TfuDatReqTbInfo *tb)
-{
- MsgLen len = 0;
- SFndLenMsg(tb->macHdr, &len);
- return (len?TRUE : FALSE);
-}
-#endif
-
/**********************************************************************
End of file
return ROK;
} /* kwActvInit */
+#ifdef CALL_FLOW_DEBUG_LOG
/*
*
* @brief
}
DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);
}
+#endif
+
\f
/**
*
return ROK;
} /* rlcUlActvInit */
+#ifdef CALL_FLOW_DEBUG_LOG
/*
* @brief
*
DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);
}
-
+#endif
\f
\f
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Entry point fucntions
-
- File: rg_sch.c
-
-**********************************************************************/
-
-/** @file rg_sch.c
-@brief This file implements the schedulers main access to MAC layer code.
-*/
-
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "lrg.h"
-#include "rgr.h"
-#include "tfu.h"
-#include "rgm.h"
-#include "rg_env.h"
-#include "rg_sch_inf.h"
-#include "rg_sch.h"
-#include "rg_sch_err.h"
-#include "rg_sch_cmn.h"
-#include "sch_utils.h"
-
-/* header/extern include files (.x) */
-#include "tfu.x" /* TFU types */
-#include "lrg.x" /* layer management typedefs for MAC */
-#include "rgr.x" /* layer management typedefs for MAC */
-#include "rgm.x" /* layer management typedefs for MAC */
-#include "rg_sch_inf.x" /* typedefs for Scheduler */
-#include "rg_sch.x" /* typedefs for Scheduler */
-#include "rg_sch_cmn.x"
-#include "mac_sch_interface.h"
-
-#ifdef EMTC_ENABLE
-S16 rgEmtcMacSchUeDelInd ARGS((RgSchCellCb *cell,RgInfUeDelInd *ueDelInd));
-S16 rgSCHGomEmtcHndlSiCfg ARGS((
-Region reg,
-Pool pool,
-RgSchCb *instCb,
-SpId spId,
-RgrCfgTransId transId,
-RgrSiCfgReqInfo *cfgReqInfo
-));
-S16 rgSCHGomEmtcHndlWarningSiCfg ARGS((
-Region reg,
-Pool pool,
-RgSchCb *instCb,
-SpId spId,
-RgrCfgTransId transId,
-RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
-));
-#endif
-/* local defines */
-/************** LRG Interface ****************/
-\f
-/**
- * @brief Layer Manager Control request handler.
- *
- * @details
- *
- * Function : RgMiLrgSchCntrlReq
- *
- * This function handles the control
- * request received from the Layer Manager.
- * -# Based on cntrl->hdr.elmId.elmnt, cntrl->t.cntrl.action
- * and cntrl->t.cntrl.subAction, it performs the appropriate control action
- * of SAP (enable/disable) and layer shutdown.
- * -# Invokes the RgMiLrgSchCntrlCfm to send back the confirmation to LM.
- *
- * @param[in] Pst *pst, the post structure
- * @param[in] RgMngmt *cntrl, the control parameter's structure
- * @return S16
- * -# ROK
- **/
-S16 RgMiLrgSchCntrlReq
-(
-Pst *pst, /* post structure */
-RgMngmt *cntrl /* control structure */
-)
-{
- S16 ret = ROK; /* return value */
- Pst cfmPst;
- RgMngmt cfm;
-
- Inst inst = (pst->dstInst - SCH_INST_START); /* Scheduler instance Id */
-
- /* Fill the post structure for sending the confirmation */
- SchFillCfmPst(pst, &cfmPst, cntrl);
-
- /* Initialize the cfg cfm structure
- SCH_ALLOC(cfm, sizeof(RgMngmt));
- if(cfm == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Memory Unavailable for Confirmation");
- SCH_FREE(pst->region, pst->pool, cntrl, sizeof(RgMngmt));
- return ROK;
- } */
- memset(&cfm, 0, sizeof(RgMngmt));
-
-#ifdef LMINT3
- cfm.hdr.transId =
- cntrl->hdr.transId;
-#endif
-
- cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt;
- cfm.t.cntrl.action = cntrl->t.cntrl.action;
- cfm.t.cntrl.subAction = cntrl->t.cntrl.subAction;
-
- /* Check if General Config Done*/
- if(rgSchCb[inst].rgSchInit.cfgDone != TRUE)
- {
- cfm.cfm.status = LCM_PRIM_NOK;
- cfm.cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
- cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt;
- RgMiLrgSchCntrlCfm(&cfmPst, &cfm);
- DU_LOG("\nERROR --> SCH : Gen Cfg not done.");
- /* SCH_FREE(pst->region, pst->pool, cntrl, sizeof(RgMngmt)); */
- return ROK;
- }
-
- /* General Config done, process the Control request */
- switch(cntrl->hdr.elmId.elmnt)
- {
- case STGEN:
- rgSCHLmmGenCntrl(cntrl, &cfm, &cfmPst);
- break;
- case STTFUSAP:
- case STRGRSAP:
- rgSCHLmmSapCntrl(cntrl, &cfm, &cfmPst);
- break;
- default:
- cfm.cfm.status = LCM_PRIM_NOK;
- cfm.cfm.reason = LCM_REASON_INVALID_PAR_VAL;
- RgMiLrgSchCntrlCfm(&cfmPst, &cfm);
- DU_LOG("\nERROR --> SCH : invalid elmnt=%d",
- cntrl->hdr.elmId.elmnt);
- break;
- }
- /* SCH_FREE(pst->region, pst->pool, cntrl, sizeof(RgMngmt)); */
- return (ret);
-}/*-- RgMiLrgSchCntrlReq --*/
-
-#ifdef LTE_L2_MEAS
-/**
- * @brief Layer Manager L2 Measurement request handler.
- *
- * @details
- *
- * Function : RgMiLrgSchL2MeasReq
- *
- * This function handles the control
- * measurement request received from the Layer Manager.
- *
- * @param[in] Pst *pst, the post structure
- * @param[in] LrgSchMeasReqInfo *measInfo, measurement request info
- * @return S16
- * -# ROK
- **/
-S16 RgMiLrgSchL2MeasReq
-(
-Pst *pst, /* post structure */
-LrgSchMeasReqInfo *measInfo /* Meas Req Info */
-)
-{
- Pst cfmPst;
- RgSchCellCb *cell;
- RgSchErrInfo err;
- S16 ret = ROK;
- RgSchCb *instCb = &rgSchCb[(pst->dstInst - SCH_INST_START)];
-#if (ERRCLASS & ERRCLS_ADD_RES)
- CmLList *lnk;
-#endif
- uint32_t idx;
- RgSchL2MeasCb *measCb = NULLP;
-#ifdef DEBUGP
- Inst inst = (pst->dstInst - SCH_INST_START); /* Scheduler instance Id */
-#endif
-
- err.errType = 0;
- err.errCause = 0;
-
-
- /* Find the cellCb using cellId in measInfo. Iterate through all cells
- * in rgrsapCb in RgschCb */
- cell = NULLP;
- for (idx = 0; idx < instCb->numSaps; idx++)
- {
- if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId)
- {
- /* got the cell break the loop */
- cell = instCb->rgrSap[idx].cell;
- break;
- }
- }
- /* If no cellCb return Err with Invalid Cell Id */
- if (cell == NULLP)
- {
- rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
- RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_INVALID_CELLID);
- rgSchL2mSndCfm(&cfmPst, NULLP, measInfo, TRUE);
- DU_LOG("\nERROR --> SCH : Meas req Failed.Invalid Cell Id errType(%d) errCause(%d)",
- err.errType, err.errCause);
- return RFAILED;
- }
- /* Validate for Meas Types */
- if ( (ret = rgSCHUtlValidateMeasReq(cell, measInfo, &err)) != ROK)
- {
- rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
- RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_INVALID_MEASTYPE);
- rgSchL2mSndCfm(&cfmPst, NULLP, measInfo, TRUE);
- DU_LOG("\nERROR --> SCH : Meas req Failed.Invalid Measurement Type"
- "errCasue(%d) errType(%d)", err.errType, err.errCause);
- return RFAILED;
- }
- /* Iterate through all meas requests in l2mList in cellCb */
-#if (ERRCLASS & ERRCLS_ADD_RES)
- lnk = cell->l2mList.first;
- while(lnk != NULLP)
- {
- /* Get the MeasCb : RgSchL2MeasCb */
- measCb = (RgSchL2MeasCb *)lnk->node;
- lnk = lnk->next;
- if (measCb->measReq.hdr.transId == measInfo->hdr.transId)
- {
- rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
- RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_DUP_TRANSID);
- rgSchL2mSndCfm(&cfmPst, measCb, measInfo, TRUE);
- DU_LOG("\nERROR --> SCH : Meas req Failed Duplicate TransId"
- "errType(%d) errCause(%d)", err.errType, err.errCause);
- return RFAILED;
- }
- }
-#endif
- /* Call L2M Function to store Meas req */
- ret = rgSchL2mMeasReq(cell, measInfo, err);
- if (ret != ROK)
- {
- rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
- RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_L2MEAS_FAILED);
- rgSchL2mSndCfm(&cfmPst, measCb, measInfo, TRUE);
- DU_LOG("\nERROR --> SCH : Meas req Failed.errType(%d) errCause(%d)",
- err.errType, err.errCause);
- return RFAILED;
- }
- return (ret);
-} /* -- RRgMiLrgSchL2MeasReq-- */
-
-/**
- * @brief Layer Manager L2 Measurement Stop request handler.
- *
- * @details
- *
- * Function : RgMiLrgSchL2MeasStopReq
- *
- * This function handles the control
- * measurement stop request received from the Layer Manager.
- *
- * @param[in] Pst *pst, the post structure
- * @param[in] LrgSchMeasReqInfo *measInfo, measurement stop request info
- * @return S16
- * -# ROK
- **/
-S16 RgMiLrgSchL2MeasStopReq
-(
-Pst *pst, /* post structure */
-LrgSchMeasStopReqInfo *measInfo /* Meas Req Info */
-)
-{
- S16 ret = ROK;
- RgSchCellCb *cell = NULLP;
- RgSchCb *instCb = &rgSchCb[(pst->dstInst - SCH_INST_START)];
- CmLList *node = NULLP;
- RgSchL2MeasCb *measCb = NULLP;
- LrgSchMeasCfmInfo measCfm;
- uint8_t idx;
-
- for (idx = 0; idx < instCb->numSaps; idx++)
- {
- if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId)
- {
- /* got the cell break the loop */
- cell = instCb->rgrSap[idx].cell;
- break;
- }
- }
- if (cell == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Stop req Failed.Invalid Cell Id ");
- return RFAILED;
- }
- memset(&measCfm, 0, sizeof(LrgSchMeasCfmInfo));
- node = cell->l2mList.first;
- while(node != NULLP)
- {
- measCb = (RgSchL2MeasCb *)(node)->node;
-
- node = (node)->next;
- cmLListDelFrm(&cell->l2mList, &measCb->measLnk);
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb,
- sizeof(RgSchL2MeasCb));
- }
-
- if(measInfo->measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL)
- {
- RgInfL2MeasStopReq measStopReq;
- Pst pstMac;
- memset(&measStopReq, 0, sizeof(RgInfL2MeasStopReq));
- measStopReq.transId = measInfo->hdr.transId;
- measStopReq.measType = measInfo->measType;
- /* measReq.timePrd = measInfo->timePrd; */
- measStopReq.cellId = measInfo->cellId;
- rgSCHUtlGetPstToLyr(&pstMac, &rgSchCb[cell->instIdx], cell->macInst);
- RgSchMacL2MeasStop(&pstMac,&measStopReq);
- }
- else
- {
- RgMiLrgSchL2MeasStopCfm(&(rgSchCb[cell->instIdx].rgSchInit.lmPst),
- &measCfm);
- }
- return (ret);
-}/*RgMiLrgSchL2MeasStopReq*/
-/**
- * @brief Layer Manager L2 Measurement request handler.
- * for Send l2 measurement req
- * @details
- *
- * Function : RgMiLrgSchL2MeasSendReq
- *
- * This function handles the control
- * measurement send request received from the Layer Manager.
- *
- * @param[in] Pst *pst, the post structure
- * @param[in] LrgSchMeasReqInfo *measInfo, measurement stop request info
- * @return S16
- * -# ROK
- **/
-S16 RgMiLrgSchL2MeasSendReq
-(
-Pst *pst, /* post structure */
-LrgSchMeasSndReqInfo *measInfo /* Meas Req Info */
-)
-{
- S16 ret = ROK;
- RgSchCellCb *cell;
- RgSchCb *instCb = &rgSchCb[(pst->dstInst - SCH_INST_START)];
- uint8_t idx;
-
- cell = NULLP;
- for (idx = 0; idx < instCb->numSaps; idx++)
- {
- if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId)
- {
- /* got the cell break the loop */
- cell = instCb->rgrSap[idx].cell;
- break;
- }
- }
- if (cell == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Send req Failed.Invalid Cell Id");
- return RFAILED;
- }
-
- if(measInfo->measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL)
- {
- RgInfL2MeasSndReq measSndReq;
- Pst pstMac;
- memset(&measSndReq, 0, sizeof(RgInfL2MeasSndReq));
- measSndReq.transId = measInfo->hdr.transId;
- measSndReq.measType = measInfo->measType;
- measSndReq.timePrd = measInfo->timePrd;
- measSndReq.cellId = measInfo->cellId;
- rgSCHUtlGetPstToLyr(&pstMac, &rgSchCb[cell->instIdx], cell->macInst);
- RgSchMacL2MeasSend(&pstMac, &measSndReq);
- }
- else
- {
- cell->sndL2Meas = TRUE;
- }
-
- return (ret);
-}/*RgMiLrgSchL2MeasSendReq*/
-#endif /* LTE_L2_MEAS */
-
-
-
-
-/************* RGR Interface ****************/
-/**
- * @brief API for bind request from RRM towards MAC.
- *
- * @details
- *
- * Function: RgUiRgrBndReq
- *
- * This API is invoked by RRM towards MAC to bind RGR SAP.
- * These API validates the Pst, spId, suId and sends the bind confirm to
- * RRM.
- *
- *
- * @param[in] Pst *pst
- * @param[in] SuId suId
- * @param[in] SpId spId
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgUiRgrBndReq(Pst *pst, SuId suId, SpId spId)
-{
- S16 ret = ROK;
- Pst tmpPst; /* Temporary Post Structure */
- Inst instId = pst->dstInst-SCH_INST_START;
- RgUstaDgn dgn; /* Alarm diagnostics structure */
-
- tmpPst.prior = pst->prior;
- tmpPst.route = pst->route;
- tmpPst.selector = pst->selector;
- tmpPst.region = rgSchCb[instId].rgSchInit.region;
- tmpPst.pool = rgSchCb[instId].rgSchInit.pool;
- tmpPst.srcProcId = rgSchCb[instId].rgSchInit.procId;
- tmpPst.srcEnt = rgSchCb[instId].rgSchInit.ent;
- tmpPst.srcInst = rgSchCb[instId].rgSchInit.inst + SCH_INST_START;
- tmpPst.event = EVTNONE;
- tmpPst.dstProcId = pst->srcProcId;
- tmpPst.dstEnt = pst->srcEnt;
- tmpPst.dstInst = pst->srcInst;
-
- if(spId < rgSchCb[instId].numSaps)
- {
- /* Check the state of the SAP */
- switch (rgSchCb[instId].rgrSap[spId].sapSta.sapState)
- {
- /* This case might not be needed if SAP not configured then it will go
- * to else of above if condition */
- case LRG_UNBND: /* SAP is not bound */
- DU_LOG("\nDEBUG --> SCH : SAP Not yet bound");
- rgSchCb[instId].rgrSap[spId].sapSta.sapState = LRG_BND;
- rgSchCb[instId].rgrSap[spId].sapCfg.suId = suId;
- /* Send Bind Confirm with status as SUCCESS */
- ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_OK);
- /*Indicate to Layer manager */
- rgSCHUtlFillDgnParams(instId, &dgn, LRG_USTA_DGNVAL_MEM);
- ret = rgSCHLmmStaInd(instId, LCM_CATEGORY_INTERFACE,
- LRG_EVENT_RGRSAP_ENB, LCM_CAUSE_UNKNOWN, &dgn);
- break;
- case LRG_BND: /* SAP is already bound*/
- DU_LOG("\nDEBUG --> SCH : SAP is already bound");
- ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_OK);
- break;
- default: /* Should Never Enter here */
-#if (ERRCLASS & ERRCLS_ADD_RES)
- DU_LOG("\nERROR --> SCH : Invalid SAP State:RgUiRrgBndReq failed\n");
-#endif
- ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_NOK);
- break;
- }
- }
- else
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- /* ccpu00117035 - MOD - Changed ErrVal argument from accessing sap state
- to spId to avoid seg fault due to invalid sapID */
- DU_LOG("\nERROR --> SCH : Invalid SAP Id:RgUiRrgBndReq failed\n");
-#endif
- ret = RgUiRgrBndCfm(&tmpPst, suId, CM_BND_NOK);
- }
- return (ret);
-} /* RgUiRgrBndReq */
-
-/**
- * @brief API for unbind request from RRM towards MAC.
- *
- * @details
- *
- * Function: RgUiRgrUbndReq
- *
- * This API is invoked by RRM towards MAC to unbind RGR SAP.
- * These API validates the Pst, spId, suId and transfers the unbind request
- * specific information to corresponding ownership module (GOM) API.
- *
- *
- * @param[in] Pst *pst
- * @param[in] SuId suId
- * @param[in] Reason reason
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgUiRgrUbndReq(Pst *pst,SpId spId,Reason reason)
-{
- Inst instId = pst->dstInst-SCH_INST_START;
-
- /* SAP Id validation */
- if (spId < rgSchCb[instId].numSaps)
- {
- switch(rgSchCb[instId].rgrSap[spId].sapSta.sapState)
- {
- case LRG_BND: /* SAP is already bound*/
- DU_LOG("\nDEBUG --> SCH : SAP is already bound");
- /* setting SAP state to UN BOUND */
- rgSchCb[instId].rgrSap[spId].sapSta.sapState = LRG_UNBND;
- break;
- default:
-#if (ERRCLASS & ERRCLS_ADD_RES)
- DU_LOG("\nERROR --> SCH : Invalid SAP State RgUiRgrUbndReq failed\n");
-#endif
- return RFAILED;
- }
- }
- else
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- DU_LOG("\nERROR --> SCH : Invalid SAP Id RgUiRgrUbndReq failed\n");
-#endif
- return RFAILED;
- }
- return ROK;
-} /* RgUiRgrUbndReq */
-
-#ifdef RGR_SI_SCH
-/**
- * @brief API for SI configuration request from RRM towards MAC.
- *
- * @details
- *
- * Function: RgUiRgrSiCfgReq
- *
- * This API is invoked by RRM towards MAC to configure SI at MAC.
- * These API validates the Pst, spId, suId and transfers the
- * config request specific information to corresponding ownership
- * module (GOM) API.
- *
- *
- * @param[in] Pst *pst
- * @param[in] SpId spId
- * @param[in] RgrCfgTransId transId
- * @param[in] RgrSiCfgReqInfo *cfgReqInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgUiRgrSiCfgReq(Pst *pst, SpId spId,RgrCfgTransId transId,RgrSiCfgReqInfo *cfgReqInfo)
-{
- S16 ret = ROK;
- uint8_t cfmStatus = RGR_CFG_CFM_NOK;
- uint8_t prntTrans[RGR_CFG_TRANSID_SIZE+1];
- Inst instId = pst->dstInst-SCH_INST_START;
-
- memcpy(prntTrans, transId.trans, RGR_CFG_TRANSID_SIZE);
- prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
-
-
- if (cfgReqInfo == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Input Message Buffer is NULL");
- rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus);
- return RFAILED;
- }
-
- if (spId < rgSchCb[instId].numSaps)
- {
- if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- DU_LOG("\nERROR --> SCH : Invalid SAP State: RgUiRgrSiCfgReq failed\n");
-#endif
- SCH_FREE(cfgReqInfo, (Size)sizeof(*cfgReqInfo));
- rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus);
- return RFAILED;
- }
- }
- else
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- DU_LOG("\nERROR --> SCH : Invalid SAP Id:RgUiRgrSiCfgReq failed\n");
-#endif
- SCH_FREE(cfgReqInfo, (Size)sizeof(*cfgReqInfo));
- rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus);
- return RFAILED;
- }
-
- /* Handle configuration */
-#ifdef EMTC_ENABLE
-if(rgSchCb[instId].rgrSap[spId].cell->emtcEnable)
-{
- ret = rgSCHGomEmtcHndlSiCfg(pst->region, pst->pool,
- &rgSchCb[instId], spId, transId,
- cfgReqInfo);
-}
-else
-{
- ret = rgSCHGomHndlSiCfg(pst->region, pst->pool,
- &rgSchCb[instId], spId, transId,
- cfgReqInfo);
-}
- #else
- ret = rgSCHGomHndlSiCfg(pst->region, pst->pool,
- &rgSchCb[instId], spId, transId,
- cfgReqInfo);
- #endif
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : RgUiRgrSiCfgReq:"
- "Configuration Request Handling Failed");
- return RFAILED;
- }
-
- return ROK;
-} /* RgUiRgrSiCfgReq */
-
-\f
-/**
- * @brief API for Warning SI configuration request from RRM towards MAC.
- *
- * @details
- *
- * Function: RgUiRgrWarningSiCfgReq
- *
- * This API is invoked by RRM towards MAC to configure SI at MAC.
- * These API validates the Pst, spId, suId and transfers the
- * config request specific information to corresponding ownership
- * module (GOM) API.
- *
- *
- * @param[in] Pst *pst
- * @param[in] SpId spId
- * @param[in] RgrCfgTransId transId
- * @param[in] RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgUiRgrWarningSiCfgReq(Pst *pst, SpId spId,RgrCfgTransId transId,RgrWarningSiCfgReqInfo *warningSiCfgReqInfo)
-{
- Inst instId = pst->dstInst-SCH_INST_START;
- S16 ret = ROK;
- uint8_t cfmStatus = RGR_CFG_CFM_NOK;
- uint8_t prntTrans[RGR_CFG_TRANSID_SIZE+1];
-
- memcpy(prntTrans, transId.trans, RGR_CFG_TRANSID_SIZE);
- prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
-
- if (warningSiCfgReqInfo == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Input Message Buffer "
- "is NULL");
- rgSCHUtlRgrWarningSiCfgCfm(instId, spId, 0, transId, cfmStatus);
- return RFAILED;
- }
-
- if (spId < rgSchCb[instId].numSaps)
- {
- if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- DU_LOG("\nERROR --> SCH : Invalid SAP State: warningSiCfgReqInfo failed\n");
-#endif
- rgSCHUtlFreeWarningSiSeg(pst->region, pst->pool,
- &warningSiCfgReqInfo->siPduLst);
- SCH_FREE(warningSiCfgReqInfo, sizeof(RgrWarningSiCfgReqInfo));
- rgSCHUtlRgrWarningSiCfgCfm(instId, spId, warningSiCfgReqInfo->siId,
- transId, cfmStatus);
- return RFAILED;
- }
- }
- else
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- DU_LOG("\nERROR --> SCH : Invalid SAP Id:warningSiCfgReqInfo failed\n");
-#endif
- rgSCHUtlFreeWarningSiSeg(pst->region, pst->pool,
- &warningSiCfgReqInfo->siPduLst);
- SCH_FREE(warningSiCfgReqInfo,sizeof(RgrWarningSiCfgReqInfo));
- rgSCHUtlRgrWarningSiCfgCfm(instId, spId, warningSiCfgReqInfo->siId,
- transId, cfmStatus);
- return RFAILED;
- }
-
- /* Handle configuration */
-#ifdef EMTC_ENABLE
-if(rgSchCb[instId].rgrSap[spId].cell->emtcEnable)
-{
- ret = rgSCHGomEmtcHndlWarningSiCfg(pst->region, pst->pool,
- &rgSchCb[instId], spId, transId, warningSiCfgReqInfo);
-}
-else
-{
- ret = rgSCHGomHndlWarningSiCfg(pst->region, pst->pool,
- &rgSchCb[instId], spId, transId, warningSiCfgReqInfo);
-}
-#else
- ret = rgSCHGomHndlWarningSiCfg(pst->region, pst->pool,
- &rgSchCb[instId], spId, transId, warningSiCfgReqInfo);
-#endif
- if(ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Configuration Request Handling Failed");
- return RFAILED;
- }
-
- return ROK;
-}
-
-\f
-/**
- * @brief API for Warning SI Stop request from RRM towards MAC.
- *
- * @details
- *
- * Function: RgUiRgrWarningSiStopReq
- *
- * This API is invoked by RRM towards MAC to Stop warning SI at MAC.
- * These API validates the Pst, spId, suId and transfers the
- * stop request specific information to corresponding ownership
- * module (GOM) API.
- *
- *
- * @param[in] Pst *pst
- * @param[in] SpId spId
- * @param[in] RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgUiRgrWarningSiStopReq(Pst *pst,SpId spId,RgrCfgTransId transId,uint8_t siId)
-{
- Inst instId = pst->dstInst-SCH_INST_START;
-
- if (spId < rgSchCb[instId].numSaps)
- {
- if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- DU_LOG("\nERROR --> SCH : Invalid SAP State: RgUiRgrWarningSiStopReq failed\n");
-#endif
- return RFAILED;
- }
- }
- else
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- DU_LOG("\nERROR --> SCH : Invalid SAP Id:RgUiRgrWarningSiStopReq failed\n");
-#endif
- return RFAILED;
- }
-
- rgSCHGomHndlWarningSiStopReq(pst->region, pst->pool,
- &rgSchCb[instId], siId, transId, spId);
-
- return ROK;
-}
-#endif /*RGR_SI_SCH */
-
-/* LTE_ADV_FLAG_REMOVED_START */
-
-/**
- * @brief API for LOAD INF request from RRM towards MAC.
- *
- * @details
- *
- * Function: RgUiRgrLoadInfReq
- *
- * This API is invoked by RRM towards MAC to configure LOAD INF Parameters at MAC.
- * These API validates the Pst, spId, suId and transfers the
- * LOAD INF request to corresponding ownership
- * module (GOM) API.
- *
- *
- * @param[in] Pst *pst
- * @param[in] SpId spId
- * @param[in] RgrCfgTransId transId
- * @param[in] RgrLoadInfReqInfo *loadInfReq
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgUiRgrLoadInfReq(Pst *pst, SpId spId, RgrCfgTransId transId,RgrLoadInfReqInfo *loadInfReq)
-{
- S16 ret = ROK;
- uint8_t prntTrans[RGR_CFG_TRANSID_SIZE+1];
- Inst instId = pst->dstInst-SCH_INST_START;
-
- memcpy(prntTrans, transId.trans, RGR_CFG_TRANSID_SIZE);
- prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
-
-
- if (loadInfReq == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Input Message Buffer "
- "is NULL");
- return RFAILED;
- }
-
- if (spId < rgSchCb[instId].numSaps)
- {
- if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- DU_LOG("\nERROR --> SCH : Invalid SAP State: RgUiRgrLoadInfReq failed\n");
-#endif
- SCH_FREE(loadInfReq, (Size)sizeof(*loadInfReq));
- return RFAILED;
- }
- }
- else
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- DU_LOG("\nERROR --> SCH : Invalid SAP Id:RgUiRgrLoadInfReq failed\n");
-#endif
- SCH_FREE(loadInfReq, (Size)sizeof(*loadInfReq));
- return RFAILED;
- }
-
- /* Handle configuration */
- ret = rgSCHGomHndlLoadInf(pst->region, pst->pool,
- &rgSchCb[(pst->dstInst - SCH_INST_START)], spId, transId,
- loadInfReq);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Configuration Request Handling Failed");
- return RFAILED;
- }
-
- return ROK;
-} /* RgUiRgrLoadInfReq */
-/* LTE_ADV_FLAG_REMOVED_END */
-
-/************** MAC SCH Interface **************/
-/**
- * @brief Function for updating dedicated channel BO at scheduler from MAC.
- *
- * @details
- *
- * Function : rgMacSchDedBoUpdtReq
- *
- * This function shall be invoked whenever MAC gets staRsp from RLC
- * Scheduler shall update BO in its dedicated logical channel control block.
- *
- * @param[in] Pst* pst
- * @param[in] S16 cellSapId
- * @param[in] RgInfDedBoRpt *boRpt
- * @return S16
- * -# ROK
- **/
-S16 RgMacSchDedBoUpdtReq(Pst* pst,RgInfDedBoRpt *boRpt)
-{
- RgSchCellCb *cell;
- RgSchUeCb *ue;
-#ifdef SCH_STATS
- RgSchCmnDlUe *dlUe;
-#endif
-
- Inst inst = (pst->dstInst - SCH_INST_START);
- S16 cellSapId = boRpt->cellSapId;
-/*
- DU_LOG("\nDEBUG --> SCH : rgMacSchDedBoUpdtReq():"
- " boRpt->rnti = %u boRpt->lcId = %u",boRpt->rnti, boRpt->lcId);
-*/
- /* No need to chk for cell being NULL as MAC wouldn't have found instance if
- * it doesnt exist */
- cell = rgSchCb[inst].rgrSap[cellSapId].cell;
-
-#ifndef NO_ERRCLS
- if (cell->cellId != boRpt->cellId)
- {
- /* Handle Cell fetch failure */
- DU_LOG("\nERROR --> SCH : rgMacSchDedBoUpdtReq(): Invalid cell Id");
- return RFAILED;
- }
-#endif
-
- /* Update Bo in the given logical channel of the UE */
- if ((ue = rgSCHDbmGetUeCb(cell, boRpt->rnti)) != NULLP)
- {
- RgSchDlLcCb *dlLc;
- /* Honor BO Reports only from PCELL */
-#ifdef LTE_ADV
- if (cell != ue->cell)
- {
- return RFAILED;
- }
-#endif
- if ((dlLc = rgSCHDbmGetDlDedLcCb(ue, boRpt->lcId)) != NULLP)
- {
-#ifdef LTE_L2_MEAS
- if(dlLc->lcType == CM_LTE_LCH_DTCH)
- {
- if((dlLc->bo == 0) &&(boRpt->bo != 0))
- {
- /* UE is active */
- if(!(ue->qciActiveLCs[dlLc->qciCb->qci]))
- {
- dlLc->qciCb->dlUeCount++;
- }
- ue->qciActiveLCs[dlLc->qciCb->qci]++;
- }
- else if((dlLc->bo != 0) && (boRpt->bo == 0) && (dlLc->qciCb->dlUeCount))
- {
- /* UE is inactive */
- if (ue->qciActiveLCs[dlLc->qciCb->qci])
- {
- ue->qciActiveLCs[dlLc->qciCb->qci]--;
- if (!(ue->qciActiveLCs[dlLc->qciCb->qci]))
- {
- dlLc->qciCb->dlUeCount--;
- }
- }
- }
- }
-#endif
-#ifdef SCH_STATS
- dlUe = RG_SCH_CMN_GET_DL_UE(ue, cell);
- if (boRpt->bo > dlLc->bo)
- {
- dlUe->boReported += (boRpt->bo - dlLc->bo);
- }
-#endif
-#ifdef TENB_STATS
- if (boRpt->bo > dlLc->bo)
- {
- ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].dlBo += ((boRpt->bo - dlLc->bo)<<3);
- }
-#endif
- /* RLC provides cumulative BO for each LC.
- * Reduce the left out unscheduled bo from total bo and
- * update the new BO to the total bo */
- if(ue->totalBo >= dlLc->bo)
- {
- ue->totalBo -= dlLc->bo;
- }
- else
- {
- ue->totalBo = 0; /* this case should not arise
- * Resetting for safety */
- }
-
- ue->totalBo += boRpt->bo;
- dlLc->bo = boRpt->bo;
- dlLc->oldestSduArrTime = boRpt->oldestSduArrTime;
- dlLc->staPduBo = boRpt->staPduBo;
-
- dlLc->setMaxUlPrio = boRpt->setMaxUlPrio;
- dlLc->setMaxDlPrio = boRpt->setMaxDlPrio;
- /* Update the scheduler */
- rgSCHUtlDlDedBoUpd(cell, ue, dlLc);
- return ROK;
- }
- }
- return RFAILED;
-
-} /* end of rgMacSchDedBoUpdtReq */
-
-
-/**
- * @brief Function for updating common channel BO at scheduler from MAC.
- *
- * @details
- *
- * Function : RgMacSchCmnBoUpdtReq
- *
- * This function shall be invoked whenever MAC gets staRsp from RLC
- * Scheduler shall update BO in its common logical channel control block.
- *
- * @param[in] Pst* pst
- * @param[in] S16 cellSapId
- * @param[in] RgInfCmnBoRpt *boRpt
- * @return S16
- * -# ROK
- **/
-S16 RgMacSchCmnBoUpdtReq(Pst* pst,RgInfCmnBoRpt *boRpt)
-{
- RgSchCellCb *cell;
- Inst inst = (pst->dstInst - SCH_INST_START);
- S16 cellSapId = boRpt->cellSapId;
-
-
- /* No need to chk for cell being NULL as MAC would not have found instance if
- * it doesnt exist */
- cell = rgSchCb[inst].rgrSap[cellSapId].cell;
- if (cell->cellId != boRpt->cellId)
- {
- DU_LOG("\nERROR --> SCH : RgMacSchCmnBoUpdtReq():"
- "Invalid boRpt cell Id:%d",boRpt->cellId);
- return RFAILED;
- }
-
- /* handle status response on CCCH */
- if(boRpt->lcId == cell->dlCcchId)
- {
- DU_LOG("\nDEBUG --> SCH : RgMacSchCmnBoUpdtReq():"
- " BO update for CCCH");
- rgSCHUtlHndlCcchBoUpdt(cell, boRpt);
- }
- else
- {
- rgSCHUtlHndlBcchPcchBoUpdt(cell, boRpt);
- }
-
- return ROK;
-} /* end of RgMacSchCmnBoUpdtReq */
-/*Fix: start: Inform UE delete to scheduler*/
-/**
- * @brief This API is used to send data indication to Scheduler instance from MAC.
- *
- * @details
- *
- * Function : rgMacSchUeDelInd
- *
- * This function shall be invoked whenever MAC gets Ue delete request.
- *
- *
- * @param[in] Pst* pst
- * @param[in] RgInfUeDelInd *ueDelInd
- * @return S16
- * -# ROK
- **/
-S16 RgMacSchUeDelInd(Pst* pst,RgInfUeDelInd *ueDelInd)
-{
- RgSchCellCb *cell;
- Inst inst = (pst->dstInst - SCH_INST_START);
- S16 cellSapId = ueDelInd->cellSapId;
- CmLList *tmp;
- RgSchRntiLnk *rntiLnk=NULL;
-
- if (rgSchCb[inst].rgrSap == NULLP || rgSchCb[inst].rgrSap[cellSapId].cell == NULLP)
- {
- DU_LOG("\nERROR --> SCH : rgrSap or cell is not configured");
- return ROK;
- }
- cell = rgSchCb[inst].rgrSap[cellSapId].cell;
-#ifndef NO_ERRCLS
- if (cell->cellId != ueDelInd->cellId)
- {
- /* Handle Cell fetch failure */
- DU_LOG("\nERROR --> SCH : rgMacSchUeDelInd(): Invalid ueDelInd cell Id:%d",
- ueDelInd->cellId);
- return ROK;
- }
-#endif
-
- CM_LLIST_FIRST_NODE(&cell->rntiDb.rntiGuardPool, tmp);
-
- while(tmp)
- {
- rntiLnk = (RgSchRntiLnk *)(tmp->node);
- if(rntiLnk->rnti == ueDelInd->rnti)
- {
- cmLListDelFrm(&cell->rntiDb.rntiGuardPool, tmp);
- tmp->node = NULLP;
- rgSCHDbmRlsRnti(cell, rntiLnk);
- DU_LOG("\nDEBUG --> SCH : RNTI:%d Released from the Guard pool(%d)",
- ueDelInd->rnti, cell->rntiDb.rntiGuardPool.count);
-
- break;
- }
- CM_LLIST_NEXT_NODE(&cell->rntiDb.rntiGuardPool, tmp);
- }
-
-#ifdef EMTC_ENABLE
- rgEmtcMacSchUeDelInd(cell,ueDelInd);
-#endif
-
- if(tmp == NULLP)
- {
- /* Fix : syed HO UE does not have a valid ue->rntiLnk */
- DU_LOG("\nINFO --> SCH : HO CRNTI:%d not present in the"
- "Guard Pool:%d", ueDelInd->rnti, cell->rntiDb.rntiGuardPool.count);
- }
-
- return ROK;
-} /* rgMacSchUeDelInd */
-/*Fix: end: Inform UE delete to scheduler*/
-/**
- * @brief This API is used to send data indication to Scheduler instance from MAC.
- *
- * @details
- *
- * Function : rgMacSchSfRecpInd
- *
- * This function shall be invoked whenever MAC gets datInd on TFU
- * Scheduler shall act on the CEs and data that are received as part of
- * datInd.
- *
- * @param[in] Pst* pst
- * @param[in] S16 cellSapId
- * @param[in] CmLteRnti rnti
- * @param[in] DatIndInfo *datInd
- * @return S16
- * -# ROK
- **/
-S16 RgMacSchSfRecpInd(Pst* pst,RgInfSfDatInd *subfrmInfo)
-{
- S16 ret = RFAILED;
- RgSchErrInfo err;
- RgSchUeCb *ue;
- RgInfUeDatInd *datInd;
- RgSchCellCb *cell;
- Inst inst = (pst->dstInst - SCH_INST_START);
- CmLteRnti rnti;
- CmLListCp *lnkLst;
- CmLList *tmp;
- S16 cellSapId = subfrmInfo->cellSapId;
- RgrUeStaIndInfo *ueStaInd;
-#ifdef RG_UNUSED
-//#ifdef LTEMAC_SPS
- RgSchCmnUlUeSpsInfo *ulSpsUe ;
-#endif
- /* RRM_RBC_X */
- uint32_t idx;
- /* RRM_RBC_Y */
-
-#ifdef LTE_L2_MEAS
- uint8_t qci;
- uint16_t datIndActQci = 0;
- uint16_t combDatIndActQci = 0; /* Prev and Latest Dat Ind combined */
- uint16_t tempUeActQci = 0; /* UE specific Active QCIs */
- uint16_t diffBits = 0;
- uint8_t lcCount;
-#endif
-
- /* No need to chk for cell being NULL as MAC wouldn't have found instance if
- * it doesnt exist */
- cell = rgSchCb[inst].rgrSap[cellSapId].cell;
-
- /* lnkLst assignment */
- lnkLst = &(subfrmInfo->ueLst);
-
- CM_LLIST_FIRST_NODE(lnkLst, tmp);
-
- while((NULLP != tmp) && ((RgInfUeDatInd *)tmp->node != NULLP))
- {
- ue = NULLP;
-#ifdef LTE_L2_MEAS
- qci = 0;
-#endif
- datInd = (RgInfUeDatInd *)tmp->node;
- rnti = datInd->rnti;
-
- /* We shall try and find
- * out the RaCb based on the following -
- * 1. If the incoming PDU contained a CCCH SDU i.e. this is message 3.
- * 2. If the incoming PDU contained a CRNTI control element, i.e. we should
- * have a ueCb also for this
- */
-
- /* It could be that a non-msg3 pdu contains a CRNTI Control element. We
- * should check for CRNTI CE and if it exists the UECb must exist, also an
- * if the CRNTI in the CE and the one with which the message came in are
- * different we shall look for an raCb as well.
- */
- if (datInd->ceInfo.bitMask & RGSCH_CRNTI_CE_PRSNT)
- {
- /* SR_RACH_STATS : CRNTI CE*/
- rgNumMsg3CrntiCE++;
-
- if (datInd->ceInfo.bitMask & RGSCH_CCCH_SDU_PRSNT)
- {
- RGSCH_FREE_MEM(subfrmInfo);
- err.errType = RGSCHERR_TOM_DATIND;
- DU_LOG("\nDEBUG --> SCH : Received MSG3 with CRNTI:%d and also CCCH ",
- datInd->ceInfo.ces.cRnti);
- return RFAILED;
- }
- ue = rgSCHDbmGetUeCb (cell, datInd->ceInfo.ces.cRnti);
- if (ue == NULLP)
- {
- /* SR_RACH_STATS : CRNTI CE UECB NOT FOUND*/
- rgNumCrntiCeCrntiNotFound++;
- /* ccpu00141318 - Removed condition for SPS rnti checking*/
- RGSCH_FREE_MEM(subfrmInfo);
- err.errType = RGSCHERR_TOM_DATIND;
- DU_LOG("\nERROR --> SCH : Received MSG3 "
- "with CRNTI:%d unable to find ueCb",
- datInd->ceInfo.ces.cRnti);
- return RFAILED;
- }
-
- if ((ret = rgSCHUtlProcMsg3 (subfrmInfo, cell, ue,
- rnti, datInd, &err)) != ROK)
- {
- RGSCH_FREE_MEM(subfrmInfo);
- err.errType = RGSCHERR_TOM_DATIND;
- DU_LOG("\nERROR --> SCH : Processing for MSG3 failed for CRNTI:%d",
- datInd->rnti);
- return RFAILED;
- }
-
-#ifdef LTEMAC_SPS
- rgSCHUtlHdlCrntiCE (cell, ue);
-#endif
- ret = rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&ueStaInd,
- sizeof(RgrUeStaIndInfo));
- if(ret == ROK)
- {
- ueStaInd->status = RGR_UESTA_MAC_CRNTI_CE_RECVD;
-#ifdef RG_UNUSED
-//#ifdef LTEMAC_SPS
- ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue);
- if(ulSpsUe->isUlSpsActv)
- {
- ueStaInd->status = RGR_UESTA_MAC_CRNTI_CE_RECVD_IN_SPS_ACTIVE;
- ue->ul.ulSpsCfg.isLcSRMaskEnab = FALSE;
- }
-#endif
- ret = rgSCHUtlFillSndUeStaInd(cell, ue, ueStaInd);
- if(ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Could not Send Ue Sta Ind UEID:%d",ue->ueId);
- }
- }
- CM_LLIST_NEXT_NODE(lnkLst, tmp);
- continue;
- } /* end of CRNTI based message */
- else if (datInd->ceInfo.bitMask & RGSCH_CCCH_SDU_PRSNT)
- {
- /* SR_RACH_STATS : CCCH SDU */
- rgNumMsg3CCCHSdu++;
- /* SR_RACH_STATS : CCCH SDU RACB NOT FOUND*/
- if (NULLP == rgSCHDbmGetRaCb (cell, rnti))
- {
- rgNumCCCHSduCrntiNotFound++;
- }
-
- if ((ret = rgSCHUtlProcMsg3 (subfrmInfo, cell, ue,
- rnti, datInd, &err)) != ROK)
- {
- RGSCH_FREE_MEM(subfrmInfo);
- err.errType = RGSCHERR_TOM_DATIND;
- DU_LOG("\nERROR --> SCH : Processing for MSG3 failed for CRNTI:%d",
- datInd->rnti);
- return RFAILED;
- }
- /* fix */
- CM_LLIST_NEXT_NODE(lnkLst, tmp);
- continue;
- } /* end of Msg3 processing */
-
- if (ue == NULLP)
- {
- ue = rgSCHDbmGetUeCb (cell, datInd->rnti);
- if (ue == NULLP)
- {
-#ifdef LTEMAC_SPS
- if((ue = rgSCHDbmGetSpsUeCb (cell, datInd->rnti)) == NULLP)
-#endif
- {
- RGSCH_FREE_MEM(subfrmInfo);
- err.errType = RGSCHERR_TOM_DATIND;
- DU_LOG("\nERROR --> SCH : Unable to get the UE CB for CRNTI:%d",
- datInd->rnti);
- return RFAILED;
- }
- }
- }
-/* L2_COUNTERS */
-#ifdef LTE_L2_MEAS
- /* The LCs for which data is received at MAC is provided to SCH.
- This information is used to estimate the Active LCs at UE
- since estimates based on only BSR is not accurate */
- if (datInd->ceInfo.bitMask & RGSCH_ACTIVE_LC_PRSNT)
- {
-
- /* Compose a Bitmask with for the QCI's for which Data
- is received */
- for (lcCount = 0; lcCount < RGINF_MAX_NUM_DED_LC; lcCount++)
- {
- if ((datInd->ceInfo.ulActLCs[lcCount] == TRUE) && (TRUE == ue->ul.lcCb[lcCount].isValid))
- {
- datIndActQci |= (1 << (ue->ul.lcCb[lcCount].qciCb->qci -1));
- }
- }
- if (ue->ulActiveLCs && ue->lastDatIndLCs)
- {
- /* Combine previous Dat Ind and current Dat Ind to
- estimate active LCs at UE */
- combDatIndActQci = ue->lastDatIndLCs | datIndActQci;
- tempUeActQci = ue->ulActiveLCs;
- ue->ulActiveLCs = combDatIndActQci;
- diffBits = combDatIndActQci ^ tempUeActQci;
- while (diffBits)
- {
- qci++;
- if (0x1 & diffBits)
- {
- if (0x1 & tempUeActQci)
- {
- /* An active QCI has become inactive */
- cell->qciArray[qci].ulUeCount--;
- }
- else
- {
- /* An Inactive QCI has become active */
- cell->qciArray[qci].ulUeCount++;
- }
- }
- diffBits >>= 1;
- tempUeActQci >>= 1;
- }
- }
- ue->lastDatIndLCs = datIndActQci;
-
- }
-
-#endif /* LTE_L2_MEAS */
- /* Just copy the timing information from the dat indication into the one
- * stored in the UE CB, will be later utilized to handle Timing advance
- */
-
- if ((ret = rgSCHUtlUpdSch (subfrmInfo, cell, ue, datInd, &err)) != ROK)
- {
- RGSCH_FREE_MEM(subfrmInfo);
- err.errType = RGSCHERR_TOM_DATIND;
- DU_LOG("\nERROR --> SCH : Unable to handle Data"
- " Indication for UEID:%d",ue->ueId);
- return RFAILED;
- }
-
- CM_LLIST_NEXT_NODE(lnkLst, tmp);
- }
- /* RRM_RBC_X */
- /* update the UL PRB usage for all GBR QCIs*/
- for (idx = 0; idx < RGM_MAX_QCI_REPORTS; idx++)
- {
- cell->prbUsage.qciPrbRpts[idx].ulTotPrbUsed += subfrmInfo->qcisUlPrbCnt[idx];
- }
- /* RRM_RBC_Y */
-
- /* chk if Sch needs to dealloc datInd after unpk */
- RGSCH_FREE_MEM(subfrmInfo);
- return (ret);
-} /* rgMacSchSfRecpInd */
-
-#ifdef LTEMAC_SPS
-/**
- * @brief Function to handle relInd from MAC for a UE
- *
- * @details
- *
- * Function: RgMacSchSpsRelInd
- *
- * Handler for processing relInd for UL SPS of a UE
- *
- * Invoked by:
- * MAC
- *
- * Processing Steps:
- *
- * @param[in] Pst *pst
- * @param[in] RgInfSpsRelInfo *relInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgMacSchSpsRelInd(Pst *pst,RgInfSpsRelInfo *relInfo)
-{
- RgSchUeCb *ue;
- RgSchCellCb *cell;
- Inst inst = (pst->dstInst - SCH_INST_START);
-
-
- /* No need to chk for cell being NULL as MAC wouldn't have found instance if
- * it doesnt exist */
- cell = rgSchCb[inst].rgrSap[relInfo->cellSapId].cell;
-
- if ((ue = rgSCHDbmGetUeCb(cell, relInfo->cRnti)) == NULLP)
- {
- DU_LOG("\nERROR --> SCH : No Ue exists with CRNTI:%d",relInfo->cRnti);
- return RFAILED;
- }
-
- if ((rgSCHUtlSpsRelInd(cell, ue, relInfo->isExplRel)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : RelInd processing for CRNTI:%d failed",relInfo->cRnti);
- return RFAILED;
- }
- return ROK;
-} /* end of RgMacSchSpsRelInd */
-#endif /* LTEMAC_SPS */
-
-#ifdef LTE_L2_MEAS
-
-/**
- * @brief Function to handle L2MeasCfm from MAC
- *
- * @details
- *
- * Function: RgMacSchL2MeasCfm
- *
- * Handler for processing L2 measurement confirm
- *
- * Invoked by:
- * MAC
- *
- * Processing Steps:
- *
- * @param[in] Pst *pst
- * @param[in] RgInfL2MeasCfm *measCfm
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgMacSchL2MeasCfm(Pst *pst, RgInfL2MeasCfm *measCfm)
-{
- RgSchCellCb *cell = NULLP;
- Inst inst = (pst->dstInst - SCH_INST_START);
- CmLList *lnk;
- RgSchL2MeasCb *measCb = NULLP;
- RgSchCb *instCb = &rgSchCb[inst];
- uint32_t idx;
- LrgSchMeasCfmInfo schMeasCfm;
- uint8_t qciVal;
- uint8_t idx1; /*LTE_L2_MEAS_PHASE2*/
- uint8_t qciVal1;
-
- /* Find the cellCb using cellId in measInfo. Iterate through all cells
- * in rgrsapCb in RgschCb */
- for (idx = 0; idx < instCb->numSaps; idx++)
- {
- if ( instCb->rgrSap[idx].cell->cellId == measCfm->cellId)
- {
- /* got the cell break the loop */
- cell = instCb->rgrSap[idx].cell;
- break;
- }
- }
- /* If no cellCb return Err with Invalid Cell Id */
- if (cell == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Meas Cfm Failed.Invalid Cell Id");
- return RFAILED;
- }
-
-
- /* Iterate through all meas requests in l2mList in cellCb */
- lnk = cell->l2mList.first;
- while(lnk != NULLP)
- {
- /* Get the MeasCb : RgSchL2MeasCb */
- measCb = (RgSchL2MeasCb *)lnk->node;
- lnk = lnk->next;
- if (measCb->measReq.hdr.transId == measCfm->transId)
- {
- break;
- }
- }
- if ( measCb == NULLP )
- {
- return ( RFAILED );
- }
-
-
- if(measCfm->cfm.status != LCM_PRIM_OK)
- {
- for (idx = 0; idx < measCb->measReq.avgPrbQciUl.numQci; idx++)
- {
- qciVal = measCb->measReq.avgPrbQciUl.qci[idx];
- cell->qciArray[qciVal].qci = 0;
- }
- /* Delete this measCb, send the negative confirmation to
- * stack manager */
- cmLListDelFrm(&cell->l2mList, &measCb->measLnk);
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb, sizeof(RgSchL2MeasCb));
- memset(&schMeasCfm, 0, sizeof(LrgSchMeasCfmInfo));
- schMeasCfm.measType = measCfm->measType;
- schMeasCfm.cfm = measCfm->cfm;
- schMeasCfm.hdr.transId = measCfm->transId;
- schMeasCfm.cellId = measCfm->cellId;
- RgMiLrgSchL2MeasCfm(&(instCb->rgSchInit.lmPst), &schMeasCfm);
- return ROK;
- }
- for(idx = 0; idx < measCfm->u.prbCfm.numQci; idx++)
- {
- measCb->avgPrbQciUl.prbUsage[idx].prbUsage = measCfm->u.prbCfm.prbUsage[idx].prbUsage;
- measCb->avgPrbQciUl.prbUsage[idx].qciValue = measCfm->u.prbCfm.prbUsage[idx].qciValue;
- /*LTE_L2_MEAS_PHASE2*/
- qciVal1 = measCfm->u.prbCfm.prbUsage[idx].qciValue;
- for(idx1=0;idx1<measCb->measReq.avgPrbQciUl.numQci;idx1++)
- {
- if(measCb->measReq.avgPrbQciUl.qci[idx1] == qciVal1)
- {
- break;
- }
- }
- if(idx1 == measCb->measReq.avgPrbQciUl.numQci)
- {
- measCb->measReq.avgPrbQciUl.qci[measCb->measReq.avgPrbQciUl.numQci++] = qciVal1;
- }
- }
- measCb->avgPrbQciUl.numQci = measCfm->u.prbCfm.numQci;
- measCb->cfmRcvd = TRUE;
- cell->sndL2Meas = TRUE;
- return ROK;
-} /* end of RgMacSchL2MeasCfm */
-
-/**
- * @brief Function to handle L2MeasStopCfm from MAC
- *
- * @details
- *
- * Function: RgMacSchL2MeasStopCfm
- *
- * Handler for processing L2 measurement confirm
- *
- * Invoked by:
- * MAC
- *
- * Processing Steps:
- *
- * @param[in] Pst *pst
- * @param[in] RgInfL2MeasCfm *measCfm
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgMacSchL2MeasStopCfm(Pst *pst,RgInfL2MeasCfm *measCfm)
-{
- LrgSchMeasCfmInfo schMeasCfm;
- Inst inst = (pst->dstInst - SCH_INST_START);
- RgSchCb *instCb = &rgSchCb[inst];
-
- memset(&schMeasCfm, 0, sizeof(LrgSchMeasCfmInfo));
- schMeasCfm.measType = measCfm->measType;
- schMeasCfm.cfm = measCfm->cfm;
- schMeasCfm.hdr.transId = measCfm->transId;
- schMeasCfm.cellId = measCfm->cellId;
- RgMiLrgSchL2MeasStopCfm(&(instCb->rgSchInit.lmPst), &schMeasCfm);
- return ROK;
-}
-#endif
-
-/************** TFU Interface *************/
-
-/**
- * @brief Bind confirm API for TFU SAP on scheduler instance.
- *
- * @details
- *
- * Function : RgLiTfuSchBndCfm
- *
- * This API is invoked by PHY to confirm TFU SAP bind.
- *
- *
- * @param[in] Pst *pst
- * @param[in] SuId suId
- * @param[in] uint8_t status
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgLiTfuSchBndCfm (Pst *pst,SuId suId, uint8_t status)
-{
- S16 ret;
- RgSchLowSapCb *tfuSap;
- Inst instId = pst->dstInst - SCH_INST_START;
-
- if(suId >= rgSchCb[instId].numSaps)
- {
- DU_LOG("\nERROR --> SCH : Incorrect SuId");
- return RFAILED;
- }
- /* Lets validate suId first */
- tfuSap = &(rgSchCb[instId].tfuSap[suId]);
-
- if (suId != tfuSap->sapCfg.suId)
- {
- DU_LOG("\nERROR --> SCH : Incorrect SuId. Configured (%d)"
- "Recieved (%d)", tfuSap->sapCfg.suId, suId);
- return RFAILED;
- }
- ret = rgSCHLmmBndCfm (pst, suId, status);
- return (ret);
-} /* RgLiTfuSchBndCfm */
-
-/**
- * @brief Random Access Request indication from PHY.
- *
- * @details
- *
- * Function : RgLiTfuRaReqInd
- *
- * This API is invoked by PHY to send Random Access Request to Scheduler.
- * This API contains information for Random Access Request including
- * raRnti, list of associated RAPIDs and related information.
- *
- * @param[in] Pst *pst
- * @param[in] SuId suId
- * @param[in] TfuRaReqIndInfo *raReqInd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgLiTfuRaReqInd(Pst *pst,SuId suId, TfuRaReqIndInfo *raReqInd)
-{
- S16 ret;
- Inst inst = pst->dstInst-SCH_INST_START;
-
- if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : SAP Validation failed SuId(%d)", suId);
- /* Free up the memory for the request structure */
- RGSCH_FREE_MEM(raReqInd);
- return (ret);
- }
-
- if(raReqInd == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Invalid input pointer for raReqInd Failed");
- return RFAILED;
- }
-
- if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
- {
- DU_LOG("\nERROR --> SCH : No cell exists");
- return RFAILED;
- }
-
- ret = rgSCHTomRaReqInd(rgSchCb[inst].tfuSap[suId].cell, raReqInd);
- /* Free up the memory for the request structure */
- RGSCH_FREE_MEM(raReqInd);
- /*SCH_FREE(pst->region, pst->pool, (Data *)raReqInd,
- sizeof(TfuRaReqIndInfo)); */
- return (ret);
-} /* RgLiTfuRaReqInd */
-
-/**
- * @brief Uplink CQI indication from PHY.
- *
- * @details
- *
- * Function : RgLiTfuUlCqiInd
- *
- * This API is invoked by PHY to send Uplink CQI to Scheduler.
- * This API contains Uplink CQI information reported per UE.
- *
- * @param[in] Pst *pst
- * @param[in] SuId suId
- * @param[in] TfuUlCqiIndInfo *ulCqiInd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgLiTfuUlCqiInd(Pst *pst, SuId suId, TfuUlCqiIndInfo *ulCqiInd)
-{
- S16 ret;
- Inst inst = pst->dstInst-SCH_INST_START;
-
- if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : SAP Validation failed");
- /* Free up the memory for the request structure */
- RGSCH_FREE_MEM(ulCqiInd);
- return (ret);
- }
-
- if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
- {
- DU_LOG("\nERROR --> SCH : No cell exists");
- /* Free up the memory for the request structure */
- RGSCH_FREE_MEM(ulCqiInd);
- return RFAILED;
- }
- ret = rgSCHTomUlCqiInd (rgSchCb[inst].tfuSap[suId].cell, ulCqiInd);
- /* Free up the memory for the request structure */
- RGSCH_FREE_MEM(ulCqiInd);
- return (ret);
-} /* RgLiTfuUlCqiInd */
-
-/**
- * @brief PUCCH power adjustment indication.
- *
- * @details
- *
- * Function : RgLiTfuPucchDeltaPwrInd
- *
- * This API is invoked by PHY to send PUCCH power adjustment
- * indication.
- *
- * @param[in] Pst *pst
- * @param[in] SuId suId
- * @param[in] TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgLiTfuPucchDeltaPwrInd(Pst *pst,SuId suId,TfuPucchDeltaPwrIndInfo *pucchDeltaPwr)
-{
- S16 ret;
- Inst inst = pst->dstInst-SCH_INST_START;
-
- if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : SAP Validation failed");
- /* Free up the memory for the request structure */
- RGSCH_FREE_MEM(pucchDeltaPwr);
- return (ret);
- }
-
- if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
- {
- DU_LOG("\nERROR --> SCH : No cell exists");
- return RFAILED;
- }
- ret = rgSCHTomPucchDeltaPwrInd (rgSchCb[inst].tfuSap[suId].cell, pucchDeltaPwr);
- /* Free up the memory for the request structure */
- RGSCH_FREE_MEM(pucchDeltaPwr);
- return (ret);
-} /* RgLiTfuPucchDeltaPwrInd */
-
-
-/**
- * @brief HARQ ACK indication from PHY for Downlink transmissions.
- *
- * @details
- *
- * Function : RgLiTfuHqInd
- *
- * This API is invoked by PHY to send HARQ ACK information to Scheduler
- * on recieving HARQ ACK/NACK from UEs.
- * This API contains HARQ ACK information recieved by PHY for downlink
- * transmissions.
- *
- * @param[in] Pst *pst
- * @param[in] SuId suId
- * @param[in] TfuHqIndInfo *harqAckInd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgLiTfuHqInd(Pst *pst, SuId suId, TfuHqIndInfo *harqAckInd)
-{
- S16 ret;
- Inst inst = (pst->dstInst - SCH_INST_START);
-
-
-#ifndef NO_ERRCLS
- if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : SAP Validation failed");
- RGSCH_FREE_MEM(harqAckInd);
- return (ret);
- }
-
- if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
- {
- DU_LOG("\nERROR --> SCH : No cell exists");
- return RFAILED;
- }
-#endif
-
- /* Now call the TOM (Tfu ownership module) primitive to process further */
- ret = rgSCHTomHarqAckInd (rgSchCb[inst].tfuSap[suId].cell, harqAckInd);
- /* Free up the memory for the request structure */
- RGSCH_FREE_MEM(harqAckInd);
- return (ret);
-} /* RgLiTfuHqInd */
-
-
-/**
- * @brief Scheduling request(SR) indication from PHY for an UE.
- *
- * @details
- *
- * Function : RgLiTfuSrInd
- *
- * This API is invoked by PHY to send Scheduling request information to
- * Scheduler on recieving SR from a list of UEs.
- * This API contains scheduling request information recieved by PHY for UEs.
- *
- * @param[in] Pst *pst
- * @param[in] SuId suId
- * @param[in] TfuSrIndInfo *srInd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgLiTfuSrInd(Pst *pst, SuId suId, TfuSrIndInfo *srInd)
-{
- S16 ret;
- Inst inst = pst->dstInst-SCH_INST_START;
-
-#ifndef NO_ERRCLS
- if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : SAP Validation failed");
- RGSCH_FREE_MEM(srInd);
- return (ret);
- }
-
- if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
- {
- DU_LOG("\nERROR --> SCH : RgLiTfuSrInd()No cell exists");
- return RFAILED;
- }
-#endif
- /* Now call the TOM (Tfu ownership module) primitive to process further */
- ret = rgSCHTomSrInd (rgSchCb[inst].tfuSap[suId].cell, srInd);
- /* Free up the memory for the request structure */
- RGSCH_FREE_MEM(srInd);
- return (ret);
-} /* RgLiTfuSrInd */
-
-
-/**
- * @brief Downlink CQI indication from PHY for an UE.
- *
- * @details
- *
- * Function : RgLiTfuDlCqiInd
- *
- * This API is invoked by PHY to send Downlink CQI indication to Scheduler
- * on recieving downlink CQI from UE.
- * This API contains downlink CQI information recieved by PHY for an UE.
- *
- * @param[in] Pst *pst
- * @param[in] SuId suId
- * @param[in] TfuDlCqiIndInfo *dlCqiInd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgLiTfuDlCqiInd(Pst *pst, SuId suId, TfuDlCqiIndInfo *dlCqiInd)
-{
- S16 ret;
- Inst inst = pst->dstInst-SCH_INST_START;
-
- if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : SAP Validation failed");
- /* Free up the memory for the request structure */
- RGSCH_FREE_MEM(dlCqiInd);
- return (ret);
- }
-
- if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
- {
- DU_LOG("\nERROR --> SCH : No cell exists");
- return RFAILED;
- }
- ret = rgSCHTomDlCqiInd (rgSchCb[inst].tfuSap[suId].cell, dlCqiInd);
- /* Free up the memory for the request structure */
- RGSCH_FREE_MEM(dlCqiInd);
- return (ret);
-} /* RgLiTfuDlCqiInd */
-#ifdef TFU_UPGRADE
-
-/**
- * @brief Raw CQI indication from PHY for an UE.
- *
- * @details
- *
- * Function : RgLiTfuRawCqiInd
- *
- * This API is invoked by PHY to send Raw CQI indication to Scheduler
- * on receiving Raw CQI from UE.
- * This API contains Raw CQI information recieved by PHY for an UE.
- *
- * @param[in] Pst *pst
- * @param[in] SuId suId
- * @param[in] TfuRawCqiIndInfo *rawCqiInd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgLiTfuRawCqiInd(Pst *pst, SuId suId, TfuRawCqiIndInfo *rawCqiInd)
-{
- S16 ret;
- Inst inst = pst->dstInst-SCH_INST_START;
-
-#ifdef NO_ERRCLS
- if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : SAP Validation failed");
- /* Free up the memory for the request structure */
- RGSCH_FREE_MEM(rawCqiInd);
- return (ret);
- }
-
- if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
- {
- DU_LOG("\nERROR --> SCH : No cell exists");
- return RFAILED;
- }
-#endif
- ret = rgSCHTomRawCqiInd (rgSchCb[inst].tfuSap[suId].cell, rawCqiInd);
- /* Free up the memory for the request structure */
- RGSCH_FREE_MEM(rawCqiInd);
- return (ret);
-} /* RgLiTfuRawCqiInd */
-
-/**
- * @brief SRS indication from PHY for an UE.
- *
- * @details
- *
- * Function : RgLiTfuSrsInd
- *
- * This API is invoked by PHY to send UL SRS indication to Scheduler
- * on receiving a SRS from UE.
- * This API contains SRS information recieved by PHY for an UE.
- *
- * @param[in] Pst *pst
- * @param[in] SuId suId
- * @param[in] TfuSrsIndInfo *srsInd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgLiTfuSrsInd(Pst *pst, SuId suId, TfuSrsIndInfo *srsInd)
-{
- S16 ret;
- Inst inst = pst->dstInst-SCH_INST_START;
-
- if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : SAP Validation failed");
- /* Free up the memory for the request structure */
- RGSCH_FREE_MEM(srsInd);
- return (ret);
- }
-
- if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
- {
- DU_LOG("\nERROR --> SCH : No cell exists");
- return RFAILED;
- }
- ret = rgSCHTomSrsInd (rgSchCb[inst].tfuSap[suId].cell, srsInd);
- /* Free up the memory for the request structure */
- RGSCH_FREE_MEM(srsInd);
- return (ret);
-} /* RgLiTfuSrsInd */
-
-#endif
-
-/**
- * @brief DOA indication from PHY for an UE.
- *
- * @details
- *
- * Function : RgLiTfuDoaInd
- *
- * This API is invoked by PHY to send Direction Of Arrival to Scheduler
- * on calculating DOA at PHYSICAL LAYER for an UE.
- * This API contains DOA information calculated by PHY for an UE.
- *
- * @param[in] Pst *pst
- * @param[in] SuId suId
- * @param[in] TfuDoaIndInfo *doaInd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgLiTfuDoaInd(Pst *pst, SuId suId, TfuDoaIndInfo *doaInd)
-{
- S16 ret;
- Inst inst = pst->dstInst-SCH_INST_START;
-
- if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : SAP Validation failed");
- /* Free up the memory for the request structure */
- RGSCH_FREE_MEM(doaInd);
- return (ret);
- }
-
- if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
- {
- DU_LOG("\nERROR --> SCH : No cell exists");
- return RFAILED;
- }
- ret = rgSCHTomDoaInd (rgSchCb[inst].tfuSap[suId].cell, doaInd);
- /* Free up the memory for the request structure */
- RGSCH_FREE_MEM(doaInd);
- return (ret);
-} /* RgLiTfuDlCqiInd */
-
-/**
- * @brief CRC indication from PHY.
- *
- * @details
- *
- * Function : RgLiTfuCrcInd
- *
- * This API is invoked by PHY to give CRC indication to scheduler.
- *
- * @param[in] Pst *pst
- * @param[in] SuId suId
- * @param[in] TfuCrcIndInfo *crcInd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgLiTfuCrcInd(Pst *pst, SuId suId, TfuCrcIndInfo *crcInd)
-{
- S16 ret;
- Inst inst = pst->dstInst-SCH_INST_START;
-
-#ifdef XEON_SPECIFIC_CHANGES
-struct timeval start6, end6;
-gettimeofday(&start6, NULL);
-#endif
-#ifndef NO_ERRCLS
- if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : SAP Validation failed");
- RGSCH_FREE_MEM(crcInd);
- return (ret);
- }
-
- if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
- {
- DU_LOG("\nERROR --> SCH : No cell exists");
- return RFAILED;
- }
-#endif
-
- /* Now call the TOM (Tfu ownership module) primitive to process further */
- ret = rgSCHTomCrcInd(rgSchCb[inst].tfuSap[suId].cell, crcInd);
- /* Free up the memory for the request structure */
- RGSCH_FREE_MEM(crcInd);
-#ifdef XEON_SPECIFIC_CHANGES
-gettimeofday(&end6, NULL);
-#endif
- return (ret);
-} /* RgLiTfuCrcInd */
-
-/**
- * @brief Timing Advance indication from PHY.
- *
- * @details
- *
- * Function : RgLiTfuTimingAdvInd
- *
- * This API is invoked by PHY to indicate timing advance to Scheduler for
- * an UE.
- *
- * @param[in] Pst *pst
- * @param[in] SuId suId
- * @param[in] TfuTimingAdvIndInfo *timingAdvInd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgLiTfuTimingAdvInd(Pst *pst, SuId suId, TfuTimingAdvIndInfo *timingAdvInd)
-{
- S16 ret;
- Inst inst = pst->dstInst-SCH_INST_START;
-
- if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : SAP Validation failed");
- /* Free up the memory for the request structure */
- RGSCH_FREE_MEM(timingAdvInd);
- return (ret);
- }
-
- if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
- {
- DU_LOG("\nERROR --> SCH : No cell exists");
- return RFAILED;
- }
- /* Now call the TOM (Tfu ownership module) primitive to process further */
- ret = rgSCHTomTimingAdvInd(rgSchCb[inst].tfuSap[suId].cell, timingAdvInd);
- /* Free up the memory for the request structure */
- RGSCH_FREE_MEM(timingAdvInd);
- return (ret);
-} /* RgLiTfuTimingAdvInd */
-
-/************* RGM Interface ****************/
-/**
- * @brief API for bind request from RRM towards MAC.
- *
- * @details
- *
- * Function: RgUiRgmBndReq
- *
- * This API is invoked by RRM towards MAC to bind RGM SAP.
- * These API validates the Pst, spId, suId and sends the bind confirm to
- * RRM.
- *
- *
- * @param[in] Pst *pst
- * @param[in] SuId suId
- * @param[in] SpId spId
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgUiRgmBndReq(Pst *pst,SuId suId,SpId spId)
-{
- S16 ret = ROK;
- Pst tmpPst; /* Temporary Post Structure */
- Inst instId = pst->dstInst-SCH_INST_START;
-
- tmpPst.prior = pst->prior;
- tmpPst.route = pst->route;
- tmpPst.selector = pst->selector;
- tmpPst.region = rgSchCb[instId].rgSchInit.region;
- tmpPst.pool = rgSchCb[instId].rgSchInit.pool;
-
- tmpPst.srcProcId = rgSchCb[instId].rgSchInit.procId;
- tmpPst.srcEnt = rgSchCb[instId].rgSchInit.ent;
- tmpPst.srcInst = rgSchCb[instId].rgSchInit.inst + SCH_INST_START;
-
- tmpPst.event = EVTNONE;
-
- tmpPst.dstProcId = pst->srcProcId;
- tmpPst.dstEnt = pst->srcEnt;
- tmpPst.dstInst = pst->srcInst;
-
- /*TODO remove follo statement*/
- rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_UNBND;
-
- if(spId < rgSchCb[instId].numSaps)
- {
- /* Check the state of the SAP */
- switch (rgSchCb[instId].rgmSap[spId].sapSta.sapState)
- {
- /* This case might not be needed if SAP not configured then it will go
- * to else of above if condition */
- case LRG_UNBND: /* SAP is not bound */
- DU_LOG("\nDEBUG --> SCH : SAP is not yet bound");
- rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_BND;
- rgSchCb[instId].rgmSap[spId].sapCfg.suId = suId;
- /* Send Bind Confirm with status as SUCCESS */
- ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_OK);
- /*Indicate to Layer manager */
- break;
- case LRG_BND: /* SAP is already bound*/
- DU_LOG("\nDEBUG --> SCH : SAP is already bound");
- ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_OK);
- break;
- default: /* Should Never Enter here */
-#if (ERRCLASS & ERRCLS_ADD_RES)
- DU_LOG("\nERROR --> SCH : Invalid SAP State:RgUiRgmBndReq failed\n");
-#endif
- ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_NOK);
- break;
- }
- }
- else
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
-/* ccpu00117035 - MOD - Changed ErrVal argument from accessing sap state
- to spId to avoid seg fault due to invalid sapID */
- DU_LOG("\nERROR --> SCH : Invalid SAP Id:RgUiRrmBndReq failed\n");
-#endif
- ret = RgUiRgmBndCfm(&tmpPst, suId, CM_BND_NOK);
- }
- return (ret);
-} /* RgUiRgmBndReq */
-
-/**
- * @brief API for unbind request from RRM towards MAC.
- *
- * @details
- *
- * Function: RgUiRgmUbndReq
- *
- * This API is invoked by RRM towards MAC to unbind RGM SAP.
- * These API validates the Pst, spId, suId and transfers the unbind request
- * specific information to corresponding ownership module (GOM) API.
- *
- *
- * @param[in] Pst *pst
- * @param[in] SuId suId
- * @param[in] Reason reason
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgUiRgmUbndReq(Pst *pst,SpId spId,Reason reason)
-{
- Inst instId = pst->dstInst-SCH_INST_START;
-
- /* SAP Id validation */
- if (spId < rgSchCb[instId].numSaps)
- {
- switch(rgSchCb[instId].rgmSap[spId].sapSta.sapState)
- {
- case LRG_BND: /* SAP is already bound*/
- /* setting SAP state to UN BOUND */
- DU_LOG("\nDEBUG --> SCH : SAP is already bound");
- rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_UNBND;
- break;
- default:
-#if (ERRCLASS & ERRCLS_ADD_RES)
- DU_LOG("\nERROR --> SCH : Invalid SAP State: RgUiRgmUbndReq failed\n");
-#endif
- return RFAILED;
- }
- }
- else
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- DU_LOG("\nERROR --> SCH : Invalid SAP Id:RgUiRgmUbndReq failed\n");
-#endif
- return RFAILED;
- }
- return ROK;
-} /* RgUiRgmUbndReq */
-
-
-/**
- * @brief API for start or stop PRB reporting from RRM towards MAC.
- *
- * @details
- *
- * Function: RgUiRgmCfgPrbRprt
- *
- * This API is invoked by RRM towards MAC to start or stop calculating
- * Average PRB usage in downlink and uplink. The average PRB usage will
- * be reported to RRM based on confiured periodicity.
- *
- *
- * @param[in] Pst *pst
- * @param[in] SuId suId
- * @param[in] SpId spId
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgUiRgmCfgPrbRprt(Pst *pst, SpId spId,RgmPrbRprtCfg *prbRprtCfg)
-{
-/* Initalize*/
- RgSchCellCb *cell;
- RgSchPrbUsage *prbUsage;
- Inst inst = (pst->dstInst - SCH_INST_START);
-
- cell = rgSchCb[inst].rgmSap[spId].cell;
- prbUsage = &cell->prbUsage;
- prbUsage->prbRprtEnabld = prbRprtCfg->bConfigType;
- prbUsage->rprtPeriod = prbRprtCfg->usPrbAvgPeriodicty;
- RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, prbUsage->startTime, 1);
-
- /* clear the qciPrbRpts for all GBR QCIs */
- memset(&prbUsage->qciPrbRpts[0], 0,
- (RGM_MAX_QCI_REPORTS * sizeof(RgSchQciPrbUsage)));
- DU_LOG("\nDEBUG --> SCH : RgUiRgmCfgPrbRprt config type %d with the report period %d",
- prbUsage->prbRprtEnabld,prbUsage->rprtPeriod);
-
- /* ccpu00134393 : mem leak fix */
- SCH_FREE(prbRprtCfg, sizeof(RgmPrbRprtCfg));
-
- return ROK;
-}
-/**
- * @brief ERROR INDICATION from PHY for the i failed unlicensed Scell transmission.
- *
- * @details
- *
- * Function : RgLiTfuErrInd
- *
- * This API is invoked by PHY to send ERROR INDICATION to scheduler
- * Currently invoked in the cases when the Unlicensed SCell transmission
- * fails.
- * This API contains the Cell and subframe information for which the
- * transmission failed.
- *
- * @param[in] Pst *pst
- * @param[in] SuId suId
- * @param[in] TfuErrIndInfo *errIndInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 RgLiTfuErrInd(Pst *pst, SuId suId, TfuErrIndInfo *errInd)
-{
- S16 ret = ROK;
-#ifdef LTE_ADV
- Inst inst = (pst->dstInst - SCH_INST_START);
-#endif
-
-#ifndef NO_ERRCLS
- if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
- {
-
- DU_LOG("\nERROR --> SCH : SAP Validation failed");
- return (ret);
- }
-
- if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
- {
- DU_LOG("\nERROR --> SCH : No cell exists");
- return RFAILED;
- }
-#endif
-
-#ifdef LTE_ADV
- /* Now call the TOM (Tfu ownership module) primitive to process further */
- ret = rgSCHLaaErrInd(rgSchCb[inst].tfuSap[suId].cell, errInd);
-#endif
- return (ret);
-} /* RgLiTfuErrInd */
-
-
-\f
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/**********************************************************************
-
- Name: LTE MAC layer
-
- Type: C include file
-
- Desc: Defines required by LTE MAC
-
- File: rg_sch.x
-
-**********************************************************************/
-/** @file rg_sch.x
-@brief This file contains basic data structures for the scheuler.
-*/
-
-#ifdef TENB_STATS
-#include "pj_tenb_stats.x"
-#endif
-
-#ifndef __SCH__
-#define __SCH__
-
-#ifdef TENB_STATS
-#include "l2_tenb_stats.x"
-#endif
-
-#ifdef EMTC_ENABLE
-#include "rg_sch_emtc.x"
-#endif
-
-
-typedef struct rgSchHistNode
-{
- uint32_t line;
- S8* file;
- const S8* func;
- Void * dbgVal; /* This is specific to the data struct being debug
- for example if the debugging is done fo list
- then this should contain the node address */
- uint32_t action;
-}RgSchHistNode;
-
-#define MAX_HIST_NODES 50
-
-#define RGSCH_ACTION_ADD 11
-#define RGSCH_ACTION_DEL 12
-
-typedef struct rgSchHistInfo
-{
- uint32_t histCount;
- RgSchHistNode hist[MAX_HIST_NODES];
-}RgSchHistInfo;
-
-#define RG_SCH_RECORD(_histInfo,_action,_dbgVal)\
-{\
- (_histInfo)->hist[(_histInfo)->histCount%MAX_HIST_NODES].file = __FILE__;\
- (_histInfo)->hist[(_histInfo)->histCount%MAX_HIST_NODES].func = __FUNCTION__;\
- (_histInfo)->hist[(_histInfo)->histCount%MAX_HIST_NODES].line = __LINE__;\
- (_histInfo)->hist[(_histInfo)->histCount%MAX_HIST_NODES].action = _action;\
- (_histInfo)->hist[(_histInfo)->histCount%MAX_HIST_NODES].dbgVal = _dbgVal;\
- (_histInfo)->histCount++;\
-}
-
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-typedef TfuDciFormat1aInfo RgDciFmt1AInfo;
-typedef TfuRaReqInfo RgTfuRaReqInfo;
-typedef TfuSubbandCqiInfo RgSchSubbandCqiInfo;
-typedef TfuHqIndInfo RgTfuHqIndInfo;
-typedef TfuHqInfo RgTfuHqInfo;
-typedef TfuCntrlReqInfo RgTfuCntrlReqInfo;
-
-/* Forward declarations for some structures */
-#ifdef LTE_L2_MEAS
-typedef struct rgSchL2MeasCb RgSchL2MeasCb;
-#endif /* LTE_L2_MEAS */
-typedef struct rgSchQciCb RgSchQciCb;
-typedef struct rgSchUeCb RgSchUeCb;
-typedef struct rgSchCellCb RgSchCellCb;
-typedef struct rgSchErrInfo RgSchErrInfo;
-typedef struct rgSchUlAlloc RgSchUlAlloc;
-typedef struct rgSchUlRetxAlloc RgSchUlRetxAlloc;
-typedef struct rgSchUlHqProcCb RgSchUlHqProcCb;
-typedef struct rgSchDlHqProcCb RgSchDlHqProcCb;
-/* Changes for MIMO feature addition */
-/* Removed dependency on MIMO compile-time flag */
-typedef struct rgSchDlHqTbCb RgSchDlHqTbCb;
-typedef struct rgSchLcgCb RgSchLcgCb;
-typedef struct rgSchDlHqEnt RgSchDlHqEnt;
-typedef struct rgSchRaCb RgSchRaCb;
-typedef struct _rgSchCb RgSchCb;
-typedef struct rgSchUlLcCb RgSchUlLcCb;
-typedef struct rgSchDlLcCb RgSchDlLcCb;
-typedef struct _rgSchdApis RgSchdApis;
-#ifdef LTE_TDD
-typedef struct rgSchTddPhichOffInfo RgSchTddPhichOffInfo;
-typedef uint8_t RgSchTddNpValTbl[RGSCH_TDD_MAX_P_PLUS_ONE_VAL];
-#endif
-/* Added support for SPS*/
-#ifdef LTEMAC_SPS
-typedef struct rgSchDlSfAllocInfo RgSchDlSfAllocInfo;
-#endif
-
-typedef struct rgSchUeCellInfo RgSchUeCellInfo;
-/**
- * @brief
- * Scheduler APIs
- */
-struct _rgSchdApis
-{
- S16 (*rgSCHRgrUeCfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgrUeCfg *cfg,
- RgSchErrInfo *err));
- S16 (*rgSCHRgrUeRecfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgrUeRecfg *recfg,
- RgSchErrInfo *err));
- Void (*rgSCHFreeUe) ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
- S16 (*rgSCHRgrCellCfg) ARGS((RgSchCellCb *cell, RgrCellCfg *cfg,
- RgSchErrInfo *err));
- S16 (*rgSCHRgrCellRecfg) ARGS((RgSchCellCb *cell, RgrCellRecfg *recfg,
- RgSchErrInfo *err));
- Void (*rgSCHFreeCell) ARGS((RgSchCellCb *cell));
- S16 (*rgSCHRgrLchCfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgSchDlLcCb *dl, RgrLchCfg *cfg, RgSchErrInfo *errInfo));
- S16 (*rgSCHRgrLcgCfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgSchLcgCb *lcg, RgrLcgCfg *cfg, RgSchErrInfo *errInfo));
- S16 (*rgSCHRgrLchRecfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgSchDlLcCb *dl, RgrLchRecfg *recfg,
- RgSchErrInfo *errInfo));
- S16 (*rgSCHRgrLcgRecfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgSchLcgCb *lcg, RgrLcgRecfg *recfg, RgSchErrInfo *errInfo));
- Void (*rgSCHFreeDlLc) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchDlLcCb *dlLc));
- Void (*rgSCHFreeLcg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchLcgCb *lcg));
- S16 (*rgSCHRgrLchDel) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,CmLteLcId lcId, \
- uint8_t lcgId));
- Void (*rgSCHActvtUlUe) ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
- Void (*rgSCHActvtDlUe) ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
- Void (*rgSCHHdlUlTransInd) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- CmLteTimingInfo timingInfo));
- Void (*rgSCHUeReset) ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
- S16 (*rgSCHUpdBsrShort) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchLcgCb *ulLcg, uint8_t bsr, RgSchErrInfo *err));
- S16 (*rgSCHUpdBsrTrunc) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchLcgCb *ulLcg, uint8_t bsr, RgSchErrInfo *err));
- S16 (*rgSCHUpdBsrLong) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, uint8_t bsArr[], RgSchErrInfo *err));
- S16 (*rgSCHUpdPhr) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, uint8_t phr, RgSchErrInfo *err));
- S16 (*rgSCHUpdExtPhr) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgInfExtPhrCEInfo * extPhr, RgSchErrInfo *err));
-#ifdef RG_UNUSED
- S16 (*rgSCHUpdUlHqProc) ARGS((RgSchCellCb *cell, RgSchUlHqProcCb *curProc,
- RgSchUlHqProcCb *oldProc));
-#endif
- S16 (*rgSCHContResUlGrant) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchErrInfo *err));
- S16 (*rgSCHSrRcvd) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, CmLteTimingInfo, RgSchErrInfo *err));
- S16 (*rgSCHTti) ARGS((RgSchCellCb *cell, RgSchErrInfo *err));
- Void (*rgSCHUlCqiInd) ARGS(( RgSchCellCb *cell, RgSchUeCb *ue, TfuUlCqiRpt *ulCqiInfo));
- Void (*rgSCHPucchDeltaPwrInd) ARGS(( RgSchCellCb *cell,
- RgSchUeCb *ue, S8 delta));
- S16 (*rgSCHlUeReset) ARGS(( RgSchCellCb *cell, RgSchUeCb *ue));
- Void (*rgSCHDlDedBoUpd) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchDlLcCb *svc));
- /* ccpu00105914: PHR handling for MSG3 */
- Void (*rgSCHUlRecMsg3Alloc) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgSchRaCb *raCb));
- Void (*rgSCHUlHqProcForUe) ARGS((RgSchCellCb *cell, CmLteTimingInfo frm,
- RgSchUeCb *ue, RgSchUlHqProcCb **procRef));
- RgSchUlAlloc *(*rgSCHFirstRcptnReq) ARGS((RgSchCellCb *cell));
- RgSchUlAlloc *(*rgSCHNextRcptnReq) ARGS((RgSchCellCb *cell,
- RgSchUlAlloc *alloc));
- RgSchUlAlloc *(*rgSCHFirstHqFdbkAlloc) ARGS((RgSchCellCb *cell, uint8_t idx));
- RgSchUlAlloc *(*rgSCHNextHqFdbkAlloc) ARGS((RgSchCellCb *cell,
- RgSchUlAlloc *alloc,uint8_t idx));
- Void (*rgSCHDlProcAddToRetx) ARGS((RgSchCellCb *cell,RgSchDlHqProcCb *hqP));
- Void (*rgSCHDlCqiInd) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- Bool isPucchInfo, Void *dlCqi, CmLteTimingInfo timingInfo));
-/* Added changes of TFU_UPGRADE */
-#ifdef TFU_UPGRADE
-Void (*rgSCHSrsInd) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- TfuSrsRpt* srsInd, CmLteTimingInfo timingInfo));
-#endif
-
- Void (*rgSCHDlTARpt) ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
- /* Changes for MIMO feature addition */
- /* Removed dependency on MIMO compile-time flag */
- Void (*rgSCHDlRlsSubFrm) ARGS((RgSchCellCb *cell, CmLteTimingInfo subFrm));
- /* Added support for SPS*/
-#ifdef LTEMAC_SPS
- Void (*rgSCHHdlCrntiCE) ARGS((RgSchCellCb *cell, RgSchUeCb * ue));
- Void (*rgSCHDlProcAck) ARGS((RgSchCellCb *cell, RgSchDlHqProcCb *hqP));
- Void (*rgSCHDlProcDtx) ARGS((RgSchCellCb *cell, RgSchDlHqProcCb *hqP));
- Void (*rgSCHDlRelPdcchFbk) ARGS((RgSchCellCb *cell, RgSchUeCb * ue,
- uint8_t isAck));
- Void (*rgSCHUlSpsRelInd) ARGS((RgSchCellCb *cell, RgSchUeCb * ue,
- Bool isExplRel));
-
- Void (*rgSCHUlSpsActInd) ARGS((RgSchCellCb *cell, RgSchUeCb * ue,
- uint16_t sduSuze));
-
- Void (*rgSCHUlCrcFailInd) ARGS((RgSchCellCb *cell, RgSchUeCb * ue,
- CmLteTimingInfo crcTime));
- Void (*rgSCHUlCrcInd) ARGS((RgSchCellCb *cell, RgSchUeCb * ue,
- CmLteTimingInfo crcTime));
-#endif /* LTEMAC_SPS */
- Void (*rgSCHDrxStrtInActvTmrInUl) ARGS((RgSchCellCb *cell));
- Void (*rgSCHUpdUeDataIndLcg) ARGS((RgSchCellCb *cell, RgSchUeCb * ue, RgInfUeDatInd *datInd));
-#ifdef LTE_ADV
- S16 (*rgSCHRgrSCellUeCfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue ,RgrUeSecCellCfg *sCellInfoCfg,
- RgSchErrInfo *err));
- S16 (*rgSCHRgrSCellUeDel) ARGS((RgSchUeCellInfo *sCellInfo, RgSchUeCb *ue));
-#endif
-#ifdef EMTC_ENABLE
- Void (*rgSCHUlProcAddToRetx) ARGS((RgSchCellCb *cell,RgSchUlHqProcCb *hqP));
-#endif
-};
-
-/* Added changes of TFU_UPGRADE */
-#ifdef TFU_UPGRADE
-
-/**
-* @brief Periodic CQI/PMI/RI configuration parameters information
-*/
-typedef RgrUePrdDlCqiCfg RgSchUeDlPCqiCfg;
-
-/**
-* @brief Periodic CQI Setup configuration parameters information
-*/
-/* Reference: 36.313: CQI-ReportPeriodic */
-typedef RgrUeDlPCqiSetup RgSchUeDlPCqiSetup;
-
-/**
-* @brief SRS configuration parameters information
-*/
-/* Reference 36.313 SoundingRS-UL-Config */
-
-typedef RgrUeUlSrsCfg RgSchUeUlSrsCfg;
-
-
-/**
-* @brief SRS configuration setup parameters information
-*/
-/* Reference 36.313 SoundingRS-UL-Config */
-
-typedef RgrUeUlSrsSetupCfg RgSchUeSrsUlSetupCfg;
-
-/**
-* @brief SR configuration parameters information
-*/
-
-typedef RgrUeSrCfg RgSchUeSrCfg;
-
-/**
-* @brief SR Setup configuration parameters information
-*/
-
-typedef RgrUeSrSetupCfg RgSchUeSrSetupCfg;
-
-#define IOT_INVALID_FREQSTART 0xffffffff
-#define IOT_INFINITE_SIZE 0xffffffff
-#define RGSCH_IOT_PDCCH_POOLSZ 100
-#define RGSCH_IOT_PDSCH_POOLSZ 100
-#define RGSCH_IOT_PUSCH_POOLSZ 100
-#define RGSCH_IOT_PUCCH_POOLSZ 100
-#define RGSCH_IOT_SCHED_POOLSZ 100
-/* TODO: Minimum Delta between CRNT Time and TX time */
-#define RGSCH_IOT_PDCCH_DELTA RG_SCH_CMN_DL_DELTA
-#define RGSCH_IOT_PDSCH_DELTA RG_SCH_CMN_DL_DELTA - 1 /* UL_CNTRL_DELTA value is 2*/
-#define RGSCH_IOT_PUCCH_DELTA 6
-#define RGSCH_IOT_PUSCH_DELTA 6
-#define RGSCH_IOT_PDCCH_MAXFREQSZ 24 /* MAX num of eCCEs per SF */
-#define RGSCH_IOT_PDSCH_MAXFREQSZ 100 /* MAX num of PDSCH RB per SF */
-#define RGSCH_IOT_PUCCH_MAXFREQSZ 2048 /* MAx num of PUCCH resource per SF */
-#define RGSCH_IOT_PUSCH_MAXFREQSZ 100 /* MAx num of PUSCh RB per SF */
-#define RGSCH_IOT_SCHED_MAXFREQSZ 1 /*Resource only in Time domain */
-#define RGSCH_IOT_PUCCH_INVALID_FREQ 2049
-/**
- * @brief
- * IoT PDCCH/PDSCH/PUSCH/PUCCH resource definition.
- * For Iot Devices resource can span multiple subframes
- * Hence resource is defined as a set of freq resources
- * over a set of consecutive valid subframes
- */
-typedef struct rgSchIotRes
-{
- uint32_t resType;
- PTR allctdBy;
- CmLteTimingInfo timeStart;
- CmLteTimingInfo timeEnd;
- uint32_t tSize;
- uint8_t freqStart;
- uint8_t freqEnd;
- uint32_t fSize;
- CmLList lnk; /*!< Link to other Fragments or Allocs in resMngmt */
- CmLList cbLnk; /*!< Link to other allocs in a given control block (ueCb) */
- CmLList resLnk;/*!<Link to resList in UE*/
-} RgSchIotRes;
-
-/**
- * @brief
- * IoT PDCCH/PDSCH/PUSCH resource control block.
- * Has pre-initialized pool of resources of #poolSize.
- * allocList will hold the allocations for PDCCH/PUSCH/PDSCH
- * fragList will hold the context of fragments in resource
- */
-typedef struct rgSchIotResCb
-{
- uint32_t poolSz;
- RgSchIotRes *resources;
- CmLListCp resPool;
- uint8_t maxFreqSz; /*!< Max Number of RBs/SCs/CCEs per Subframe */
- uint32_t deltaTime; /*!< PDCCH/PUSCH/PDSCH Delta w.r.t current time */
- RgSchIotRes *contRes; /*!< Represents continuous availability of resource
- in frequency and time domain */
- CmLListCp fragList; /*!< Represents list of fragmented resourcesi b4
- contRes, ordered in time domain */
- CmLListCp allocList; /*!< Represents list of resources allocated which
- are ordered in time domain */
-} RgSchIotResCb;
-
-
-/**
- * @brief
- * IoT Resource Management Control Block
- * for PDCCH, PDSCH and PUSCH resources
- */
-typedef struct rgSchIotResMngmtCb
-{
- RgSchIotResCb pdcchResCb;
- RgSchIotResCb pdschResCb;
- RgSchIotResCb puschResCb;
- RgSchIotResCb pucchHqFdbkCb;
-} RgSchIotResMngmtCb;
-
-S16 rgSCHUtlIotResPrcTti ARGS((
-RgSchCellCb *cell
-));
-
-Void rgSCHUtlIotInsAlloc2Lst ARGS((
-CmLListCp *allocList,
-RgSchIotRes *alloc,
-CmLList *lnk
-));
-
-S16 rgSCHUtlIotResMngmtInit ARGS((
- RgSchCellCb *cell,
- uint32_t pdcchPoolSz,
- uint32_t pdcchDelta,
- uint32_t pdcchMaxFreqSz,
- uint32_t pdschPoolSz,
- uint32_t pdschDelta,
- uint32_t pdschMaxFreqSz,
- uint32_t puschPoolSz,
- uint32_t puschDelta,
- uint32_t puschMaxFreqSz
- ));
-
-Void rgSCHUtlIotResMngmtDeinit ARGS((
- RgSchCellCb *cell
- ));
-
-RgSchIotRes *rgSCHUtlIotAllocRes ARGS((
- RgSchIotResCb *resCb,
- uint32_t fStart,
- uint32_t fSize,
- CmLteTimingInfo tStart,
- uint32_t tSize,
- Bool isForEnable
- ));
-
-RgSchIotRes *rgSCHUtlIotFirstAllocForTx ARGS((
- RgSchIotResCb *resCb,
- CmLteTimingInfo txTime
- ));
-
-RgSchIotRes *rgSCHUtlIotNextAllocForTx ARGS((
- RgSchIotResCb *resCb,
- RgSchIotRes *prevAlloc,
- CmLteTimingInfo txTime
- ));
-
-Void rgSCHUtlIotAllocRls ARGS((
- RgSchIotResCb *resCb,
- RgSchIotRes *alloc
- ));
-
-RgSchIotRes *rgSCHUtlEmtcAllocRes ARGS((
- RgSchIotResCb *resCb,
- uint32_t *fStart,
- uint32_t *fEnd,
- CmLteTimingInfo tStart,
- uint32_t tSize,
- uint32_t numPrb,
- Bool isRetx
- ));
-
-S16 rgSCHUtlEmtcResPrcTti ARGS((
- RgSchCellCb *cell
- ));
-
-S16 rgSCHUtlEmtcResMngmtInit ARGS((
- RgSchCellCb *cell,
- uint32_t pdschPoolSz,
- uint32_t pdschDelta,
- uint32_t pdschMaxFreqSz,
- uint32_t puschPoolSz,
- uint32_t puschDelta,
- uint32_t puschMaxFreqSz,
- uint32_t pucchPoolSz,
- uint32_t pucchDelta,
- uint32_t pucchMaxFreqSz
- ));
-
-Void rgSCHUtlEmtcResMngmtDeinit ARGS((
- RgSchCellCb *cell
- ));
-
-#ifdef RG_5GTF
-RgSchUlHqProcCb* rgSCHUhmGetUlProcByTime ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-CmLteTimingInfo frm
-));
-S16 rgSCHUhmGetAvlHqProc ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchUlHqProcCb **hqP
-));
-#endif
-/**
-* @brief Store Periodic CQI, SRS and SR tranmission instances list
-* */
-
-typedef struct rgSchPerPucchCb
-{
- CmLListCp srLst;
- CmLListCp srsLst;
- CmLListCp cqiLst;
- CmLListCp riLst;
-}RgSchPerPucchCb;
-
-/**
- @brief UE Specific SRS Periodicity and Subframe Offset Configuration FDD */
-
-typedef struct rgSchUePCqiSrsSrCfgIdxTbl
-{
- uint16_t min; /*!< start ISRB Index */
- uint16_t max; /*!< end ISRB Index */
- uint16_t peri; /*!< SRS Periodicity in ms */
- uint16_t offset; /*!< Offset with ISRB value */
-}RgSchUePCqiSrsSrCfgIdxTbl;
-
-/**
- @brief UE Specific SRS Periodicity and Subframe Offset Configuration TDD */
-
-/* Ref: Table 8.2-2: UE Specific SRS Periodicity */
-
-typedef struct rgSchUeSrsCfgIdxTbl
-{
- uint16_t min; /*!< start ISRB Index */
- uint16_t max; /*!< end ISRB Index */
- uint16_t peri; /*!< SRS Periodicity in ms */
- uint16_t offset1; /*!< Offset with ISRB value */
- uint16_t offset2; /*!< Offset with ISRB value */
-
-}RgSchUeSrsCfgIdxTbl;
-
-#ifdef RG_5GTF
-/*
-typedef enum rgSchSfType
-{
- RG_SCH_SF_DLCNTRL_DLDATA = 0,
- RG_SCH_SF_DLCNTRL_DLDATA_ULCNTRL,
- RG_SCH_SF_DLCNTRL_ULDATA,
- RG_SCH_SF_DLCNTRL_ULDATA_ULCNTRL
-}RgSchSfType;
-*/
-/**
-@brief Per UE Group Info
-*/
-typedef struct rgSchUeGrp
-{
- uint8_t beamBitMask; /*!< Beam bit mask */
- //uint8_t numUe; /*!< Ue present in Group */
-}RgSchUeGrp;
-
-/**
-@brief 5gtf Cell Info
-*/
-typedef struct rgSch5gtfCellCb
-{
- RgSchUeGrp ueGrp5gConf[MAX_5GTF_GROUP]; /*!< Contains all the group configured */
- RgSchSfType dynConfig[MAX_5GTF_SUBFRAME_INFO]; /*!< Get config from config file as of now */
- uint8_t numUes;
- uint8_t uePerGrpPerTti; /*!< Num of UEs to be scheduled in a group per TTI */
- uint8_t ueGrpPerTti; /*!< Num of Groups to ne scheduled per Tti */
- uint8_t numCCs;
- uint8_t bwPerCC;
- uint8_t cfi;
- uint8_t totVrbg;
-}RgSch5gtfCellCb;
-
-#endif // 5GTF
-
-/**
- @brief UE Specific SRS Control Block */
-
-typedef struct rgSchUeSrsCb
-{
- RgSchUeUlSrsCfg srsCfg; /*!< SRS Specific configuration */
- uint16_t peri; /*!< Periodicity */
- uint16_t offset; /*!< subframe Offset */
- uint16_t nSrsTrIdx;
- /*!< Next Tranmission instance
- Referenence: 36.213 Section:8.2
- ((10*sfn +sf-sfOffset))/mod(peri)) */
- CmLList srsLstEnt; /*!< SRS List for next tranmission instance subframe */
- uint8_t selectedAnt; /*!< Selected Antenna for SRS Reception*/
- uint16_t srsDist; /*!< crnt Distance to get RI Transmission */
- Bool srsRecpPrcsd; /*!< SRS Recpeption processed as part of PUCCH
- // or PUSCH processing in current TTI or not */
-
-}RgSchUeSrsCb;
-
-/**
-@brief Periodic CQI/PMI Reporting configuration using PUCCH */
-
-
-
-/**
-@brief Subband Size (k) and Bandwidth Parts (J) vs. DL sys BW */
-
-typedef struct rgSchUeBwSubSzBwParts
-{
- uint8_t rbStart; /* RB Start */
- uint8_t rbEnd; /* RB End */
- uint8_t subSize; /* k */
- uint8_t bwParts; /* J */
-
-}RgSchUeBwSubSzBwParts;
-
-#ifdef LTE_ADV
-/**
- * @brief
- * Enum for specifying priority level of various PUCCH report types
- * RG_SCH_CQI_PRIO_LVL_0 :PUCCH Report type 1,1a
- * RG_SCH_CQI_PRIO_LVL_1 :PUCCH Report type 2,2b,2c,4
- * RG_SCH_CQI_PRIO_LVL_2 :PUCCH Report type 2a,3,5,6
- */
-typedef enum
-{
- RG_SCH_CQI_PRIO_LVL_0,
- RG_SCH_CQI_PRIO_LVL_1,
- RG_SCH_CQI_PRIO_LVL_2,
- RG_SCH_CQI_PRIO_LVL_INVALID
-}RgSchCqiPrioLvl;
-#endif
-
-
-/**
-@brief Periodic CQI/PMI/RI Control Block */
-
-typedef struct rgSchUePCqiCb
-{
- RgrUePrdDlCqiCfg cqiCfg; /*!< Cqi Pmi Configuration */
- uint16_t cqiPeri; /*!< Periodicity */
- uint16_t cqiOffset; /*!< CQI offset */
- uint16_t riOffset; /*!< RI Offset */
- uint16_t riPeri; /*!< RI periodicity */
- uint16_t nCqiTrIdx;
- /*!< Next Active Tranmission instace index ,
- precompute CQI/PMI
- Transmission Instance
- Referenence: 36.213 Section:8.2 */
-
- /* 1. where wideband CQI/PMI reporting is configured
- (Mode: 1-0 or 1-1)
- 10*sfn+floor(subframe/2)-Noffsetcqi )Mod(Nperiod)=0
- 2. where both wideband CQI/PMI and subband CQI reporting are configured
- (Mode: 2-0 or 2-1)
- 10*sfn+floor(subframe/2)-Noffsetcqi )Mod(Nperiod)=0
- only the few occasations will be used for WB and
- few will be used for subbands.
- */
-
- uint16_t nRiTrIdx; /*!< Next Active Transmission instance for RI
- Transmission Instance Referenence:
- 36.213 Section:8.2 */
- uint16_t riDist; /*!< crnt Distance to get RI Transmission */
- uint16_t h; /*!< Precompute and store H */
- uint8_t riNumBits; /*Precomputed value as it doesn't change
- on-the-fly */
- /* 1. In the case where wideband RI reporting is configured
- (Mode 1-0 or 1-1)
- (10*sfn+floor(subframe)-Noffsetcqi-NoffsetRI )Mod(NCqiperiod *
- MriPeriod)=0
-
- 2. Where Widesband and Subband RI reporting is configured
- (Mode 2-0 or 2-1 )
- (10*sfn+floor(subframe)-Noffsetcqi-NoffsetRI )
- Mod(H. NCqiperiod *MriPeriod )=0
- where H= J * K +1; J=Number of bandwidth parts(BW/subsize). K is RGR
- interf input */
- Bool isWb; /*! < Is True when a WideBand CQI is to be
- Transmitted in a SubBand CQI Config*/
- uint8_t bpIdx; /*Index of the Bandwidth Part*/
- uint8_t label; /*Label L associated */
- uint8_t J; /*Number of Bandwidth Parts*/
-
- CmLList cqiLstEnt;/*!< List CQI UEs for next transmission
- instance */
- CmLList riLstEnt; /*!< List RI UEs for next transmission
- instance */
- Bool invalidateCqi; /*!< If TRUE, ignore the WB/SB CQI report*/
- uint8_t perRiVal; /*!< Latest Periodic RI value reported */
- Bool riRecpPrcsd; /*!< RI Recpeption processed as part of
- PUCCH or PUSCH processing in current
- TTI or not */
-#ifdef LTE_ADV
- RgSchCqiPrioLvl prioLvl; /* Priority lvl set based on the PUCCH Report
- type */
- Bool isCqiIgnoByCollsn; /*!< Is this CQI type being ignored for
- this reporting instance due to
- collision with higher priority
- CQI type */
- Bool isRiIgnoByCollsn; /*!< Is this CQI type being ignored for
- this reporting instance due to
- collision with higher priority CQI
- type */
-#endif
- RgSchUeCellInfo *servCellInfo; /*!< Access to the serving cell of this
- CQI CB */
- RgSchHistInfo histElem;
-#ifdef EMTC_ENABLE
- uint8_t rgSchPucchRepNumCount; /*!< CQI repetition count for CATM1 */
-#endif
-}RgSchUePCqiCb;
-
-
-
-/**
-@brief SR Configuration Index */
-
-typedef struct rgSchUeSrCfgIdx
-{
- uint16_t sIsr; /*!< Start ISR Index */
- uint16_t eIsr; /*!< End ISR Index */
- uint16_t peri; /*!< SR Periodicity */
- uint16_t offset; /*!< offset */
-}RgSchUeSrCfgIdx;
-#ifdef RG_UNUSED
-/* Reference : 36.213 Table 10.1-5 */
-/* Note: SR is same table for TDD and FDD */
-RgSchUeSrCfgIdx schUeSrCfgIdx[RG_SCH_ISR_INDX_MAX]=
-{
- { 0,4, 5, 0 },
- { 5,14, 10, 5 },
- { 15,34, 20,15 },
- { 35,74, 40,35},
- { 75,154, 80, 75},
- /* RESERVED: Configuration should not allow Res values */
-};
-#endif
-/**
-@brief SR Control block */
-
-typedef struct rgSchUeSrCb
-{
- RgSchUeSrCfg srCfg; /*!< SR configuration */
- uint16_t offset; /*!< SR offset */
- uint16_t peri; /*!< SR periodicity */
-
- uint16_t nSrTrIdx; /*!< Next Active Tranmission Instance Index ,
- Referenence: 36.213 Section:10.1 */
-
- /*
- ((10*sfn+floor(sf)-srOffset)Mod(srPeriodcity))
- */
-
-#ifdef EMTC_ENABLE
- uint8_t rgSchPucchRepNumCount; /*!< SR repetition count for CATM1 */
-#endif
- CmLList srLstEnt; /*!< Next Transmission instance SR UE list */
-
-}RgSchUeSrCb;
-
-/**
- * @enum rgSchCqiReqField
- * Enumeration of CSI Request Field (Table 7.2.1-1A 36.213).
- * "00" No aperiodic CSI report is triggered
- * "01" Aperiodic CSI report is triggered for serving cell c
- * "10" Aperiodic CSI report is triggered for a 1st set of
- * serving cells configured by higher layers
- * "11" Aperiodic CSI report is triggered for a 2nd set of
- * serving cells configured by higher layers
- *
- */
-typedef enum rgSchCqiReqField
-{
- RG_SCH_APCQI_NO = 0,
- RG_SCH_APCQI_SERVING_CC,
- RG_SCH_APCQI_1ST_SERVING_CCS_SET,
- RG_SCH_APCQI_2ND_SERVING_CCS_SET
-}RgSchCqiReqField;
-
-/**
-@brief APeriodic CQI Control Block */
-typedef struct rgSchUeACqiCb
-{
- RgrUeAprdDlCqiCfg aCqiCfg;/*!< Cqi Pmi Configuration */
- uint8_t L; /*Unique Label through which positioning of Subbands
- will be conveyed by the UE */
- uint8_t N; /*Total Bandwidth / Num of Subbands*/
- uint8_t M; /*Number of Selected Subbands*/
- uint8_t riNumBits;
- uint8_t k; /*k - SB size. 36.213 Tables:7.2.1-3, 7.2.1-5*/
- uint8_t cqiPmiSzR1; /*CQIPMI Size for Rank =1*/
- uint8_t cqiPmiSzRn1; /*CQIPMI Size for Rank > 1*/
- uint32_t aCqiTrigWt; /* Metric to track Aperiodic CQI Trigger occassion */
- RgSchCqiReqField cqiReqField; /* Cqi Request field. This Value can be 00 01 10 11, based upon
- the cell present in which trigger list form App */
-}RgSchUeACqiCb;
-
-typedef enum
-{
- RG_SCH_FDD_PCQI_TBL = 0,
- RG_SCH_TDD_PCQI_TBL,
- RG_SCH_RI_TBL,
- RG_SCH_FDD_SRS_TBL,
- RG_SCH_TDD_SRS_TBL,
- RG_SCH_SR_TBL
-} RgSchPerTbl;
-
-/*ccpu00116923 - ADD - SRS present support*/
-#ifdef LTE_TDD
-typedef uint8_t RgSchTddCellSpSrsSubfrmTbl[RGSCH_CELLSP_SRS_SF_CONFIGS][RGSCH_NUM_SUB_FRAMES];
-#else
-typedef uint8_t RgSchFddCellSpSrsSubfrmTbl[RGSCH_CELLSP_SRS_SF_CONFIGS][RGSCH_NUM_SUB_FRAMES];
-#endif
-
-
-#endif
-
-
-
-#ifdef LTE_TDD
-/**
- * @brief
- * Enum to define the type of Downlink subframe.
- */
-typedef enum
-{
- RG_SCH_SPL_SF_NO_DATA = 0,
- RG_SCH_SPL_SF_DATA,
- RG_SCH_DL_SF_0,
- RG_SCH_DL_SF
-}RgSchTddSfType;
-/**
- * @brief
- * TDD UE specific PUCCH recpetion information.
- */
-typedef struct rgSchUePucchRecpInfo
-{
- CmHashListEnt hashLstEnt; /*!< List of PUCCH for receiving
- ACK/NACK feedback information */
- TfuUeRecpReqInfo *pucchRecpInfo; /*!< UE PUCCH Reception information */
-} RgSchUePucchRecpInfo;
-
-/**
- * @brief
- * TDD switch point information.
- */
-typedef struct rgSchTddSubfrmInfo
-{
- uint8_t switchPoints; /*!< Number of DL-UL switch points */
- uint8_t numFrmHf1; /*!< Number of subframes for half frame 1
- Present for both 5ms and 10ms periodicity */
- uint8_t numFrmHf2; /*!< Number of subframes for half frame 2
- Present only for 5ms periodicity */
-} RgSchTddSubfrmInfo;
-
-/**
- * @brief
- * TDD DL Association Set information.
- */
-typedef struct rgSchTddDlAscSetIdxK
-{
- uint8_t numFdbkSubfrms; /*!< Number of Feedbacks for DL Subframes */
- uint8_t subfrmNum[RGSCH_NUM_SUB_FRAMES-1]; /*!< List of Subframe Number */
-} RgSchTddDlAscSetIdxK;
-
-/** @brief PRACH Information for a frequency resource. */
-typedef struct rgrSchTddPrachInfo
-{
- uint8_t freqIdx; /*!< Frequency Index */
- uint8_t sfn; /*!< Even/Odd/All Radio Frames */
- uint8_t halfFrm; /*!< First/Second Half Frame */
- uint8_t ulStartSfIdx; /*!< Uplink Start Subframe Index*/
-} RgSchTddPrachInfo;
-
-/** @brief PRACH resource Information for each of the
- * frequency resources. */
-typedef struct rgrSchTddPrachRscInfo
-{
- uint8_t numRsc; /*!< Number of frequency resources*/
- RgSchTddPrachInfo prachInfo[RGSCH_TDD_MAX_FREQ_RSRC]; /*!< PRACH Information */
-} RgSchTddPrachRscInfo;
-
-/**
- * @brief
- * TDD Special subframe configuration information.
- */
-struct rgSchTddSplSubfrmInfo
-{
- uint8_t norDlDwPts; /*!< DL Normal CP: DwPTS in Ts */
- uint8_t norDlNorUpPts; /*!< DL Normal CP: UL Normal CP:UpPTS in Ts */
- uint8_t norDlExtUpPts; /*!< DL Normal CP: UL Extended CP: UpPTS in Ts */
- uint8_t extDlDwPts; /*!< DL Extended CP: DwPTS in Ts */
- uint8_t extDlNorUpPts; /*!< DL Extended CP: UL Normal CP:UpPTS in Ts */
- uint8_t extDlExtUpPts; /*!< DL Extended CP: UL Extended CP: UpPTS in Ts */
-};
-
-/**
- * @brief
- * RACH response awaiting scheduling from the current time is
- * identified with sfn offset and subframe.
- */
-typedef struct rgSchTddRachRspInfo
-{
- uint8_t sfnOffset; /*!< SFN offset with respect to
- expected RACH available for
- scheduling */
- uint8_t numSubfrms; /* Number of subframes present */
- uint8_t subframe[RGSCH_NUM_SUB_FRAMES]; /*!< List of Subframe numbers */
-} RgSchTddRachRspInfo;
-
-typedef RgSchTddRachRspInfo RgSchTddRachDelInfo;
-
-/**
- * @brief
- * List of awaiting RACH responses for scheduling across radio frames.
- *
- */
-typedef struct rgSchTddRachRspLst
-{
- uint8_t numRadiofrms; /*!< Number of radio frames */
- RgSchTddRachRspInfo rachRsp[2]; /*!< RACH Occasions for which response
- can be sent */
- RgSchTddRachDelInfo delInfo; /*!< Previous RACH responses for
- which the scheduling deadline
- has expired. So those responses
- can be deleted */
-} RgSchTddRachRspLst;
-
-/**
- * @brief
- * Uplink association index information indicates the SFN offset and
- * subframe in which DL HARQ ACK/NACK is expected.
- */
-typedef struct rgSchTddUlAscInfo
-{
- uint8_t subframe; /*!< Subframe number */
- uint8_t sfnOffset; /*!< SFN offset with respect to expected
- UL data reception time */
-} RgSchTddUlAscInfo;
-
-/**
- * @brief
- * PUSCH information indicates the SFN offset and
- * subframe in which UL data is scheduled.
- */
-typedef struct rgSchTddPuschOffInfo
-{
- uint8_t subframe; /*!< Subframe number */
- uint8_t sfnOffset; /*!< SFN offset with respect to expected
- UL data reception time */
-} RgSchTddPuschOffInfo;
-
-/**
- * @brief
- * PHICH information indicates the SFN offset and
- * subframe for which PHICH should be sent.
- */
-struct rgSchTddPhichOffInfo
-{
- uint8_t numSubfrms; /*!< Number of subframes */
-/* ACC-TDD */
- uint8_t subframe; /*!< The Uplink Subframe number corresponding
- to the phich */
- uint8_t sfnOffset; /*!< SFN offset with respect to expected
- UL data reception time */
-};
-
-/**
- * @brief
- * DL feedback reception information indicates the SFN offset
- * and subframe at which feedback is expected.
- */
-typedef struct rgSchTddDlFdbkInfo
-{
- uint8_t subframe; /*!< Subframe number */
- uint8_t sfnOffset; /*!< SFN offset with respect to current
- scheduled time */
- uint8_t m; /*!< m factor used in Downlink Association
- Set Index */
-#ifdef LTE_ADV /*Naw:: This is not correct */
- CmLListCp n1PucchResLst; /*!< List for storing the used N1 resource */
-#endif
-} RgSchTddDlFdbkInfo;
-
-
-/**
- * @brief
- * Special subframe configuration index.
- */
-typedef struct rgSchTddSplSubfrmCfg
-{
- uint16_t dwPts; /*!< DwPTS in OFDM Symbol Duration */
- uint16_t upPts; /*!< UpPTS in OFDM Symbol Duration */
- Bool isDlDataAllowed; /*!< To allow scheduling of DL data on
- special subframe */
-} RgSchTddSplSubfrmCfg;
-
-/**
- * @brief
- * ACK/NACK information to be used for ACK/NACK bundling mode.
- */
-typedef struct rgSchTddANInfo
-{
- uint16_t sfn; /*!< ACK/NACK is sent for PDU in this SFN */
- uint8_t subframe; /*!< ACK/NACK is sent for PDU in this subframe */
- uint8_t dlDai; /*!< Downlink Assignment Index for
- UL-DL Configuration 1-6 */
- uint8_t ulDai; /*!< DAI for uplink */
- uint8_t latestMIdx; /*!< Last transmitted DL subframe 'm' index */
- uint8_t n1ResTpcIdx; /*!< N1 Res idx for scell assigned in TPC command */
- Bool isSpsOccasion; /*!< To indicate the presence of SPS occasion */
-#ifdef LTE_ADV
- uint8_t wUlDai; /*!< Max Ul dai in all the cells */
-#endif
-} RgSchTddANInfo;
-#endif
-
-/**
- * @brief
- * Information about one MCS entry.
- */
-typedef struct rgSchUlIMcsInfo
-{
- uint8_t qm;
- uint8_t iTbs;
-} RgSchUlIMcsTbl[29];
-RgSchUlIMcsTbl rgUlIMcsTbl;
-
-typedef struct rgSchUeCatTbl
-{
- uint32_t maxUlBits;/*Maximum number of
- bits of an UL-SCH
- transport block
- transmitted within a
- TTI*/
- uint32_t maxDlBits[4];/*Maximum number of
- bits of a DLSCH
- transport block
- received within a TTI*/
-/* correcting DL harq softbuffer limitation logic */
- uint32_t maxSftChBits;/*Total number of soft channel bits*/
- Bool ul64qamSup;/*Support for 64QAM in UL*/
-/* Changes for MIMO feature addition */
-/* Removed dependency on MIMO compile-time flag */
- uint32_t maxDlTbBits;/*Maximum number of DL-SCH
- transport block bits
- received within a TTI*/
- uint8_t maxTxLyrs;/*Maximum number of supported
- layers for spatial multiplexing
- in DL*/
-} RgSchUeCatTbl[CM_MAX_UE_CAT_SUPP + 1];
-RgSchUeCatTbl rgUeCatTbl;
-
-/* Changes for MIMO feature addition */
-/* Removed dependency on MIMO compile-time flag */
-typedef uint32_t RgSchTbSzTbl[RGSCH_MAX_NUM_LYR_PERCW][RGSCH_NUM_ITBS][RGSCH_MAX_NUM_RB];
-
-#ifdef LTE_TDD
-typedef uint8_t RgSchRaPrmblToRaFrmTbl[RGSCH_MAX_TDD_RA_PREAMBLE_FMT+1];
-#else
-/* Added matrix 'rgRaPrmblToRaFrmTbl' for computation of RA
- sub-frames from preamble format */
-typedef uint8_t RgSchRaPrmblToRaFrmTbl[RGSCH_MAX_RA_PREAMBLE_FMT+1];
-#endif
-RgSchRaPrmblToRaFrmTbl rgRaPrmblToRaFrmTbl;
-
-uint8_t rgRvTable[4];
-
-typedef struct rgDciFmt
-{
- uint8_t dciType;
- union
- {
- RgDciFmt1AInfo dci1a;
- } dci;
-} RgDciFmt;
-
-typedef enum rgSchPdcchSearchSpace
-{
- RG_SCH_UE_SPECIFIC_SEARCH_SPACE,
- RG_SCH_CMN_SEARCH_SPACE,
-}RgSchPdcchSearchSpace;
-
-/**
- * @brief
- * Information about one PDCCH.
- */
-typedef struct rgSchPdcch {
- uint8_t nCce; /*!< CCE index */
- CmLteAggrLvl aggrLvl; /*!< Aggregation level */
- TfuDciInfo dci; /*!< PDCCH format */
- uint16_t rnti; /*!< RNTI to who the PDCCH is allocated */
-#if (defined (LTE_TDD))
- uint8_t dlDai; /*!< DAI associated with this PDCCH.
- THis is used for F1BCS resource calulcation */
-#endif
- /* Added support for SPS*/
-#ifdef LTEMAC_SPS
- CmLteTimingInfo relFbkTiming; /*!< Feebback timing information for release
- PDCCH */
- Bool isSpsRnti; /*!< TRUE if rnti is SPS RNTI */
- uint16_t crnti; /*!< CRNTI to who the PDCCH is allocated */
-#endif
- CmLList lnk; /*!< To link PDCCHs in a subframe */
-#ifdef EMTC_ENABLE
- Void *emtcPdcch;
-#endif
- RgSchUeCb *ue; /*!< Pointer to the UE Control Block */
- RgSchPdcchSearchSpace pdcchSearchSpace; /*!< Search Space from this PDCCH allocated */
- uint8_t dciNumOfBits; /*!< Size of DCI in bits */
-} RgSchPdcch;
-
-/**
- * @brief
- * PDCCH information for cell.
- */
-typedef struct rgSchPdcchInfo {
- uint8_t *map; /*!< Bit map of PDCCHs */
- uint8_t currCfi; /*!< Number of CCEs */
- uint16_t nCce; /*!< Total CCEs */
- CmLListCp pdcchs; /*!< List of RgSchPdcch */
-} RgSchPdcchInfo;
-
-typedef struct rgSchPhich
-{
- CmLList lnk; /*!< To link PHICHs in a subframe */
- uint8_t hqFeedBack; /*!< Harq Feed Back */
- uint8_t rbStart; /*!< Starting RB */
- uint8_t nDmrs; /*!< 3 bits for DMRS cyclic shift */
- /* changes for passing iphich at TFU;*/
- Bool isForMsg3; /*! < Phich Ack/Nack conveyed for MSG 3 */
-#ifdef LTE_TDD
- uint8_t iPhich; /*!< For determining phich group */
-#endif
-} RgSchPhich;
-
-typedef struct rgSchPhichInfo
-{
- CmLListCp phichs; /*!< List of RgSchPhich */
-} RgSchPhichInfo;
-
-typedef struct rgSchBcchTb
-{
- RgSchPdcch *pdcch;
- Buffer *tb;
- uint16_t tbSize;
-} RgSchBcchTb;
-
-typedef struct rgSchPcchTb
-{
- RgSchPdcch *pdcch;
- Buffer *tb;
- uint16_t tbSize;
-} RgSchPcchTb;
-
-typedef struct rgSchRaRspAlloc
-{
- uint16_t raRnti;
- uint32_t tbSz;
- TknUInt8 backOffInd; /*!< Backoff index value */
- CmLListCp raRspLst; /*!< List of RaCbs */
- CmLListCp contFreeUeLst; /*! List of HandOver or PdcchOrder UEs */
- RgSchPdcch *pdcch; /*!< NULLP if no Rsp allocation done for raRnti*/
-}RgSchRaRspAlloc;
-
-typedef struct rgSchBchTb
-{
- Buffer *tb; /*!< BCH data for this frame */
- uint16_t tbSize; /*!< Non-Zero if bch data is scheduled for this SF */
-}RgSchBchTb;
-
-/* Added support for SPS*/
-#ifdef LTEMAC_SPS
-/**
- * TODO: check compilation
- @brief Downlink Resource allocation type information. */
-struct rgSchDlSfAllocInfo
-{
- uint32_t raType0Mask; /*!< RBG allocation mask for type 0*/
- uint32_t raType1Mask[RG_SCH_NUM_RATYPE1_32BIT_MASK]; /*!< RA Type 1
- allocation mask */
- uint32_t raType1UsedRbs[RG_SCH_NUM_RATYPE1_32BIT_MASK];/*!< RA Type 1 Used RBs
- per subset */
- uint32_t nxtRbgSubset; /*!< Next RBG subset to be used for allocation */
- uint32_t raType2Mask[RG_SCH_NUM_RATYPE2_32BIT_MASK];
- /*!< Mask for resource allocation type 2 */
-};
-#endif /* LTEMAC_SPS */
-
-/* LTE_ADV_FLAG_REMOVED_START */
-/**
- @brief RGR RB range for SFR */
-typedef struct rgrPwrHiCCRange
-{
- uint8_t startRb; /*<! Start RB for power high cell centre user */
- uint8_t endRb; /*<! End RB for power high cell centre user */
-} RgrPwrHiCCRange;
-
-typedef struct rgSchSFRTotalPoolInfo
-{
- CmLListCp ccPool; /*Dynamic Variable, It will change when BW is assigned.
- Initially assigned to 0 */
- Bool ccBwFull; /*If BW is full*/
- CmLListCp cePool; /*Dynamic Variable, It will change when BW is assigned.
- Initially assigned to 0 */
- Bool ceBwFull; /*If BW is full*/
- Bool isUeCellEdge;
- Bool CERetx; /* to check if there is any CE retransmission */
- Bool CCRetx; /* to check if there is any CC retransmission */
- Bool CC1; /* Cell centre pool 1 */
- Bool CC2; /* cell centre pool 2 */
- uint8_t CCPool1BwAvlbl; /* Cell Centre Bw available for Pool1 */
- uint8_t CCPool2BwAvlbl; /* Cell Centre Bw available for Pool2 */
- uint8_t CEPoolBwAvlbl; /* Cell Edge Bw available for CE Pool */
-}RgSchSFRTotalPoolInfo;
-
-typedef struct rgSchSFRPoolInfo
-{
- /*Fixed RB Range of the Pool. Fixed by user configuration*/
- uint16_t poolstartRB;
- uint16_t poolendRB;
- uint16_t bw; /*!< Number of RBs in the pool */
- /*Dynamic Values */
- uint8_t type2Start; /*!< Start RB for the next type 2 allocation */
- uint8_t type2End; /*!< End position of Type2 allocation with in the bit mask */
- uint8_t type0End; /*!< End position of Type0 allocation with in the bit mask */
-
- uint16_t bwAlloced; /*!< Number of RBs already allocated by DLFS */
- Bool CCPool2Exists; /*!< To check if the last pool in the RB allocation is a CC pool */
- struct rgSchSFRPoolInfo * adjCCPool; /*!< The CC pool adjacent to this CE Pool SFR_FIX */
- RgrPwrHiCCRange pwrHiCCRange; /*!< Power High Range which can be used by CC user based on RNTP info */
-}RgSchSFRPoolInfo;
-/* LTE_ADV_FLAG_REMOVED_END */
-
-typedef struct rgSchPuschBwInfo
-{
- uint8_t numSb; /*!< PUSCH BW in subbands */
- uint8_t startRb; /*!< Starting RB for PUSCH BW */
-}RgSchPuschBwInfo;
-
-typedef struct rgSchDynCfiCb
-{
- uint8_t isDynCfiEnb; /*!< Dynamic CFI feature Flag */
- uint8_t maxCfi; /*!< max possible CFI in the cell */
- uint8_t switchOvrWinLen; /*!< Length of Switchover window */
- uint16_t cceFailCnt; /*!< Number of CCE allocation Failures in a
- CCE failure sample period */
- uint16_t *cceFailSamples; /*!< Array holding samples of Avg number
- of CCE allocation failures */
- uint16_t cceFailSum; /*!< Moving sum of the CCE faliures of
- N samples */
- uint16_t cfiStepUpTtiCnt; /*!< No.of TTIs to take decision for CFI
- step Up */
- uint16_t cceUsed; /*!< Total CCEs used in current monitoring
- interval */
- uint16_t lowCceCnt; /*!< Number of TTI in which CCEs used is
- less than available CCEs in
- lower CFI */
- uint16_t cfiStepDownTtiCnt; /*!< No.of TTIs to take decision for CFI
- step Down */
- uint32_t cfiSwitches; /*!< Total number of CFI switches */
- uint32_t cfiIncr; /*!< Total number of CFI increments */
- uint32_t cfiDecr; /*!< Total number of CFI decrements */
- /*!< Total CCE per CFI */
- uint8_t cfi2NCceTbl[RG_SCH_MAX_MPHICH][RG_SCH_CMN_MAX_CFI];
-
- uint8_t numFailSamples; /*!< Number of CCE Allocation Failure
- samples */
- uint16_t failSamplePrd; /*!< Failure Sample Period */
- uint16_t ttiCnt; /*!< TTI count to track monitoring period
- and sample period expiry */
- RgSchPuschBwInfo bwInfo[RG_SCH_CMN_MAX_CFI]; /*!< PUSCH BW info */
- uint8_t pdcchSfIdx; /*!< Subframe Idx for CFI applying */
- uint8_t prevCceFailIdx; /*!< To maintain Previous Index of
- CCE failure array */
- Bool switchOvrInProgress; /*!< Switchover is in progress */
- Bool dynCfiRecfgPend; /*!< Flag for pending dynamic cfi reconfig */
-}RgSchDynCfiCb;
-
-#ifdef RG_5GTF
-
-/**
- * @brief
- * Beam information for a subframe
- */
-typedef struct rgSchSfBeamInfo
-{
- uint16_t totVrbgAvail; /*!< Total VRBG available */
- //uint16_t totRb; /*!< Total RB per Beam */
- uint16_t totVrbgRequired; /*!< total Rbs requested for beam */
- uint16_t totVrbgAllocated; /*!< total Rbs allocated for beam */
- uint16_t vrbgStart; /*!< VRBG start for beam */
-} RgSchSfBeamInfo;
-#endif
-
-typedef struct rgSchDlSf
-{
- uint8_t cceCnt; /*!< Number of CCEs used in the subframe */
- Bool isCceFailure; /*!< TRUE if PDCCH allocation is failed for
- this subframe */
- uint8_t dlUlBothCmplt; /*!< To track that DL and UL both scheduling
- is done */
- uint8_t sfNum; /*!< Number of the subframe */
- uint16_t bw; /*!< Number of RBs in the cell */
- uint16_t bwAlloced; /*!< Number of RBs already allocated by DLFS */
- uint16_t bwAssigned; /*!< Number of RBs already allocated by scheduler */
-/* LTE_ADV_FLAG_REMOVED_START */
- RgSchSFRTotalPoolInfo sfrTotalPoolInfo; /* SFR Pool Info*/
- TknStrOSXL rntpInfo; /* RNTP Info for the complete subframe*/
-/* LTE_ADV_FLAG_REMOVED_END */
-
- uint8_t type2Start; /*!< Start RB for the next type 2 allocation */
- uint8_t type2End; /*!< End position of Type2 allocation with
- in the bit mask */
- uint8_t type0End; /*!< End position of Type0 allocation with
- in the bit mask */
- uint8_t lstRbgDfct; /*!< The last RBG deficit RBs, Ex. if DLBW = 97,
- * RBGsz = 4, lstRbgDfct = 3 */
- Bool txDone; /*!< Flag to indicate if transmission is done*/
- uint32_t numDlActvUes; /* 4UE_TTI_DELTA: num of active Ues */
- RgSchBchTb bch; /*!< BCH data for this frame */
- RgSchBcchTb bcch; /*!< BCCH allocation for this frame */
- RgSchPcchTb pcch; /*!< PCCH allocation for this frame */
- RgSchPdcchInfo pdcchInfo; /*!< PDCCH info */
- RgSchPhichInfo phichInfo; /*!< PHICH info */
- /* CA dev Start */
-
- CmLListCp ueLst; /*!< UE List which are scheduled in Perticular SF */
- Void *laaCb;
- CmLListCp msg4HqPLst; /*!< Msg4 Hq Procs that are scheduled in Perticular SF */
- /* CA dev End */
- uint8_t remUeCnt; /*!< Remaining number of UEs that can be scheduled */
- Bool schdAmbrNxt;/*!< Flag indicates to pick an AMBR LC after GBR LC */
- /*[ccpu00138609]-ADD- Counter to track the number of Msg4/DL CCCH UEs */
- uint8_t schdCcchUe; /*!< Num of Msg4/DL CCCH UEs scheduled in
- the DL Sf */
-#ifdef LTE_TDD
- uint8_t nCce; /*!< Number of CCEs */
- RgSchTddPhichOffInfo phichOffInfo; /*!< PHICH Information */
- RgSchTddDlFdbkInfo dlFdbkInfo; /*!< HARQ Ack/Nack feedback expected time */
- RgSchTddUlAscInfo ulAscInfo; /*!< UL Association set Information */
- RgSchRaRspAlloc raRsp[RGSCH_MAX_TDD_RA_RSP_ALLOC]; /* Array of list
- of Ra Rsp
- Allocations for each rarnti */
- RgSchTddSfType sfType; /*!< Stores the enum value for SF type */
-#else
- RgSchRaRspAlloc raRsp[RGSCH_MAX_RA_RSP_ALLOC]; /* Array of list of Ra Rsp
- Allocations for each rarnti */
-#endif
- Void *dlfsSf; /*!< DLFS specific information per sub-frame */
- CmLListCp ackNakRepQ; /*!< ACK NACK repetition queue */
- /* Added support for SPS*/
-#ifdef LTEMAC_SPS
- Bool isSPSOcc; /*!< TRUE if this SF has SPS Occasion allocation */
- RgSchDlSfAllocInfo dlSfAllocInfo;/*!< Allocation information for DL SF */
- uint32_t spsAllocdBw; /*!< Number of RBs allocated for SPS */
- RgSchPdcch *relPdcch; /*!< Only one release PDCCH scheduled per
- sub-frame */
-#ifdef LTE_TDD
- struct
- {
- CmLteRnti crnti; /*!< UE's C-RNTI (not SPS RNTI) */
- RgrTddAckNackMode ackNackMode; /*!< Ack/nack mode */
- } relPdcchInfo; /*!< Info required for receiving Hq fdbk
- * for release PDCCH (DL) */
-#endif
-#endif
- uint32_t schedLcCount; /*!< Num of LCs scheduled in this TTI */
- uint32_t totalLcCntOfSlctdUes; /*!< total Lc count of all UE's selected in
- * this TTI*/
- uint32_t totPrbReq; /*!< Sum of PRBs required by selected UEs
- in this subframe */
-#ifdef BEST_EFFORT_2_UE_PER_TTI
- uint32_t beTotPrbReq;
-#endif
-
- /* CA dev Start */
- uint8_t dlIdx;
- /* CA dev Start */
-#ifdef LTE_ADV
- CmLListCp n1PucchResLst; /*!< List for storing the used N3 resource */
- CmLListCp n3PucchResLst; /*!< List for storing the used N1 resource */
-#endif
-#ifdef RG_5GTF
- RgSchSfBeamInfo sfBeamInfo[MAX_5GTF_BEAMS]; /*!< Per info Beam per sf*/
- uint8_t numGrpPerTti; /*!< number of Group per TTI*/
- uint8_t numUePerGrp; /*!< number of UE per group in TTI*/
-#endif
-} RgSchDlSf;
-
-/* Data Structures used for DL Allocations by Schedulers */
-/**
- @brief Downlink Resource allocation type 0 information. */
-typedef struct rgSchDlRbAllocRaType0
-{
- uint8_t numDlAlloc; /*!< Number of downlink allocations */
- uint32_t dlAllocBitMask; /*!< Downlink allocations done for the UE */
-} RgSchDlRbAllocRaType0;
-
-/* Added support for SPS*/
-#ifdef LTEMAC_SPS
-/**
- @brief Downlink Resource allocation type 1 information. */
-typedef struct rgSchDlRbAllocRaType1
-{
- uint8_t numDlAlloc; /*!< Number of downlink allocations */
- uint8_t shift; /*!< Indicates if the shift is triggered in the
- allocation */
- uint8_t rbgSubset; /*!< RBG subset number selected for the allocation*/
- uint32_t dlAllocBitMask; /*!< Downlink allocations done for the UE */
-} RgSchDlRbAllocRaType1;
-#endif /* LTEMAC_SPS */
-/**
- @brief Downlink Resource allocation type 2 information. */
-typedef struct rgSchDlRbAllocRaType2
-{
- Bool isLocal; /*!< True if localised VRB */
- uint8_t rbStart; /*!< Starting RB */
- uint8_t numRb; /*!< Number of RBs */
-} RgSchDlRbAllocRaType2;
-
-
-typedef struct rgSchcmnDlGrnt
-{
- uint16_t schdTime; /*!< Time at which Harq proc has been scheduled */
- uint8_t rbStrt; /*!< Starting RB of the allocation */
- uint8_t numRb; /*!< Number of RBs allocated */
- uint8_t iMcs; /*!< Index to the MCS */
- uint8_t rv; /*!< RV for HARQ (re)transmission */
- uint8_t rvIdx; /*!< RVIdx for HARQ(re)transmission */
-#ifdef RG_5GTF /* ToDo:: Anoop need to check for other fields required*/
- uint8_t vrbgStart;
- uint8_t numVrbg;
- uint16_t rbAssign;
- uint8_t xPDSCHRange;
- uint8_t SCID;
- TfuDciFormat dciFormat; /*!< DCI format for the allocation */
- /* ToDo */
-#endif
-} RgSchDlCmnGrnt;
-
-
-/**
- @brief Downlink allocation details per TB. */
-typedef struct rgSchDlTbAllocInfo
-{
- Bool schdlngForTb;/*!< Indicates if this TB has been scheduled */
- /*ccpu00120365:-ADD-is this TB disabled. Refer to 36.213-7.1.7.2 */
- Bool isDisabled; /*!< Indicates if this TB is disabled */
- uint32_t bytesReq; /*!< Number of bytes required to be allocated
- for each TB: filled in by RR/MAX C/I/PFS */
- uint32_t bytesAlloc; /*!< Num of bytes allocated for each TB */
- uint8_t iTbs; /*!< Itbs for allocation for this allocation
- * of TB */
- uint8_t imcs; /*!< Imcs for allocation for this allocation
- * of TB */
- uint8_t noLyr; /*!< No. of SM layers for this TB transmission */
- RgSchDlHqTbCb *tbCb; /*!< address of TB Control Block */
-#ifdef RG_5GTF
- RgSchDlCmnGrnt cmnGrnt; /*! < Alloc info to store 5GTF RAR sched */
-#endif
-}RgSchDlTbAllocInfo;
-
-/**
- @brief Downlink MIMO related allocation details. */
-typedef struct rgSchMimoAllocInfo
-{
- Bool hasNewTxData;/*!< Indicator from Specific Sched to Common.
- * Set, if UE has new data available for clubbing
- * with RETX in case of TM3 and TM4 */
- Bool swpFlg; /*!< Swap Flag to indicate TB to CW association
- * incase of 2 TB transmission */
- uint8_t precIdxInfo; /*!< Precoding index information stored */
- uint8_t numTxLyrs; /*!< Number of SM layers scheduled for Transmission */
-}RgSchMimoAllocInfo;
-
-
-/**
- @brief Downlink RB allocation details. */
-typedef struct rgSchDlRbAlloc
-{
- CmLteRnti rnti; /*!< RNTI for allocation: used only for RARs and
- dedicated transmissions */
- uint8_t rbsReq; /*!< Number of RBs required to be allocated:
- filled in by RR/MAX C/I/PFS */
- RgSchDlSf *dlSf; /*!< DL sub-frame for which allocation is to be
- done: filled in by RR/MAX C/I/PFS */
- TfuDciFormat dciFormat; /*!< DCI format for the allocation */
- uint8_t raType; /*!< Resource allocation Type */
- RgSchPdcch *pdcch; /*!< Pointer to allocated PDCCH */
- union allocInfoU
- {
- RgSchDlRbAllocRaType0 raType0; /*!< Resource allocation type 0 information */
- /* Added support for SPS*/
-#ifdef LTEMAC_SPS
- RgSchDlRbAllocRaType1 raType1; /*!< Resource allocation type 1
- information */
-#endif
- RgSchDlRbAllocRaType2 raType2; /*!< Resource allocation type 2 information */
- } allocInfo; /*!< Resource allocation information */
- uint8_t rbsAlloc; /*!< Number of RBs allocated */
- uint8_t numRapids; /*!< Number of RAPIDs serviced within RAR*/
- /* Nprb indication at PHY for common Ch */
- uint8_t nPrb; /*!< NPRB column num. either 2 or 3 */
- uint32_t raIndex;
- Bool schdFirst;
- /* Add BI sub-header size to the tbSize requirement */
- uint8_t biEstmt;
- RgSchMimoAllocInfo mimoAllocInfo; /*!< Mimo specific allocation params */
- RgSchDlTbAllocInfo tbInfo[2]; /*!< Allocation information for each TB. */
-
- /* Added support for SPS*/
-#ifdef LTEMAC_SPS
- uint8_t cqiForTx; /*!< Assumed value of CQI at which transmission is
- scheduled */
- RgSchDlSfAllocInfo resAllocInfo; /*!< Resource allocation information for
- the current allocation for
- RA type 0, 1 and 2 */
- Bool isSchdBySps; /*!< Indicates if this UE is already scheduled by SPS
- module */
- CmLteTimingInfo spsSchdTime; /*!< Timing info at which UE was scheduled by
- SPS module */
-#endif
- Void * laaCb;
-#ifdef EMTC_ENABLE
- RgSchPdcch *mpdcch; /*!< Pointer to allocated PDCCH */
- RgSchEmtcDlRbAlloc emtcAllocInfo; /*!< EMTC DL RB alloc Info */
-#endif
-#ifdef RG_5GTF
- uint8_t vrbgReq;
-#endif
-} RgSchDlRbAlloc;
-
-/**
- * @brief
- * Uplink Grant Information per UE.
- */
-typedef struct rgSchUlGrnt
-{
- uint8_t iMcs; /*!< Original MCS index */
- uint8_t iMcsCrnt; /*!< Current MCS index of the grant */
- uint8_t hop; /*!< Hopping flag, set to 0 in this version */
- uint8_t rbStart; /*!< Start Resource block of allocation */
- uint8_t numRb; /*!< Number of resource blocks allocated */
- uint8_t tpc; /*!< TPC command for the uplink grant */
- uint8_t nDmrs; /*!< n1DMRS for the uplink grant */
- uint8_t delayBit; /*!< Delay bit, for msg3 grant, set to 1 */
- /* Added for Uplink Adaptive retransmission */
- Bool isRtx; /*!< To indicate if this grant is for a RETX */
- /* To include the length and ModOrder in DataRecp Req. */
- uint16_t datSz; /*!< Length of the Data */
- TfuModScheme modOdr; /*!< Modulation order */
-#ifdef RG_5GTF
- uint8_t vrbgStart;
- uint8_t numVrbg;
- uint16_t rbAssign;
- uint8_t xPUSCHRange;
- uint8_t SCID;
- uint8_t PMI;
- uint8_t uciOnxPUSCH;
- uint8_t hqProcId;
- Bool ndi;
- TfuDciFormat dciFrmt;
- uint8_t numLyr;
-#endif
-} RgSchUlGrnt;
-
-
-/* Added for Uplink Adaptive retransmission */
-/**
- * @brief
- * Uplink retransmission allocation.
- */
-struct rgSchUlRetxAlloc
-{
- CmLteRnti rnti; /*!< RNTI */
- uint8_t numSb; /*!< Number of subbands */
- uint32_t tbSz; /*!< Transmission Block Size */
- uint8_t iMcs; /*!< Original MCS index */
- RgSchUeCb *ue; /*!< UE assocated with allocation */
- Bool forMsg3; /*!< If allocation is for Msg3 */
- /* PHR handling for MSG3 */
- RgSchRaCb *raCb; /*!< Pointer to RaCb, if forMsg3 = TRUE */
-#ifdef EMTC_ENABLE
- RgSchEmtcUlGrnt emtcGrnt;
-#endif
-#ifdef RG_5GTF
- TfuDciFormat dciFrmt;
- uint8_t numLyr;
- uint8_t vrbgStart;
- uint8_t numVrbg;
- TfuModScheme modOdr; /*!< Modulation order */
-#endif
-};
-
-/**
- * @brief
- * Hole information, pertaining to uplink bandwidth
- */
-typedef struct rgSchUlHole
-{
- uint8_t start; /*!< Beginning of hole */
- uint8_t num; /*!< Number of elements making up the hole */
- struct rgSchUlHole *prv; /*!< Previous hole */
- struct rgSchUlHole *nxt; /*!< Next hole */
- struct rgSchUlAlloc *nxtAlloc; /*!< Next allocation */
- struct rgSchUlAlloc *prvAlloc; /*!< Previous allocation */
-} RgSchUlHole;
-
-/**
- * @brief
- * Uplink allocation
- */
-struct rgSchUlAlloc
-{
- RgSchUlHqProcCb *hqProc; /*!< HARQ process */
- CmLteRnti rnti; /*!< RNTI */
- uint8_t sbStart; /*!< Subband start idx */
- uint8_t numSb; /*!< Number of subbands */
- RgSchUlGrnt grnt; /*!< Grant info */
- /* Not keeping grant attributes now */
- RgSchPdcch *pdcch; /*!< Associated PDCCH */
- RgSchUeCb *ue; /*!< UE assocated with allocation */
- Bool forMsg3; /*!< If allocation is for Msg3 */
- Bool isMsg3CCCHSdu; /*!<Msg3 contains CCCH Sdu */
- Bool isMsg3CrntiCe; /*!< Msg3 contains CRNTI CE */
- /* PHR handling for MSG3 */
- RgSchRaCb *raCb; /*!< RaCb, if forMsg3 = TRUE */
- Bool mrgdNewTxAlloc; /*!< Alloc corresponding to newTx
- * that was merged in the process of
- * comdining txSf and reTxSf. */
- RgSchUlAlloc *prv; /*!< Previous alloc */
- RgSchUlAlloc *nxt; /*!< Next alloc */
- RgSchUlHole *prvHole; /*!< Next hole */
- RgSchUlHole *nxtHole; /*!< Prev hole */
- /* UL_ALLOC_CHANGES*/
- void *allocDbRef; /*!< The db from which this allocation was made*/
- void *holeDbRef; /*!< The db from which this allocation was made*/
- Bool isAdaptive;
-#ifdef EMTC_ENABLE
- CmLList allocLink;
- RgSchEmtcUlGrnt emtcGrnt;
- RgSchDlRbAllocRaType0 raType0; /*!< Resource Alloction type zero for eMTC */
-#endif /* EMTC_ENABLE */
-};
-
-/**
- * @brief
- * Allocation free pool for an allocation db
- */
-typedef struct rgSchUlAllocMem
-{
- uint8_t maxAllocs; /*!< Maximum possible allocations per subframe */
- RgSchUlAlloc *firstFree; /*!< First free index */
- RgSchUlAlloc *allocs; /*!< Array of 'maxAllocs' elems */
-} RgSchUlAllocMem;
-
-/**
- * @brief
- * Allocation information for a subframe
- */
-typedef struct rgSchUlAllocDb
-{
- uint8_t count; /*!< Number of allocations */
- RgSchUlAlloc *first; /*!< First allocation */
- RgSchUlAllocMem mem; /*!< Alloc pool management */
-} RgSchUlAllocDb;
-
-/**
- * @brief
- * Hole free pool for a hole db
- */
-typedef struct rgSchUlHoleMem
-{
- uint8_t maxHoles; /*!< Maximum possible holes per subframe */
- RgSchUlHole *firstFree; /*!< First free index */
- RgSchUlHole *holes; /*!< Array of 'maxHoles' elems */
-} RgSchUlHoleMem;
-
-/**
- * @brief
- * Holes information for a subframe
- */
-typedef struct rgSchUlHoleDb
-{
- uint8_t count; /*!< Number of holes */
- RgSchUlHole *first; /*!< First hole */
- RgSchUlHoleMem mem; /*!< Hole pool management */
-} RgSchUlHoleDb;
-
-/**
- * @brief
- * Uplink subframe information.
- */
-typedef struct rgSchUlSf
-{
- uint8_t idx; /*!< Identifier for uplink subframe (range: 0-7)
- - maps to HARQ proc ID */
- CmLListCp reTxLst; /*!< Retransmission List*/
-#ifdef LTE_TDD
- RgSchTddPuschOffInfo puschOffset; /*!< PUSCH offset information */
- uint8_t ulSfIdx; /*!< The Uplink subframe number
- in the TDD frame. Range [2-9]
- Used only in TDD Cfg 0 */
-#endif
- uint32_t totPrb; /*!< Total PRB used in this sub frame */
- /* ccpu00129725 -DEL- removed Platform flag */
- /* Fix:ccpu00120610 add a counter to keep track of remaining allocations */
- uint8_t *allocCountRef; /*!< Allocation count in this
- * subframe, it is a reference to the actual
- * counter held in allocDb (no additional
- * logic needed to maintain this) */
- /* Added for Uplink Adaptive retransmission */
- RgSchUlAllocDb *allocDb; /*!< Allocation info */
- RgSchUlHoleDb *holeDb; /*!< Holes info */
- uint8_t availSubbands; /*!< Number of total available subbands
- * for the current sub-frame */
- uint8_t numACqiCount; /*!< Used to Restrict 2 Aperiodic cqi per TTI*/
-#ifdef RG_5GTF
- RgSchSfBeamInfo sfBeamInfo[MAX_5GTF_BEAMS]; /*!< Per info Beam per sf*/
- uint8_t numGrpPerTti; /*!< number of Group per TTI*/
- uint8_t numUePerGrp; /*!< number of UE per group in TTI*/
-#endif
-} RgSchUlSf;
-
-/* Nprb indication at PHY for common Ch */
-/**
- * @brief
- * Bo report given for common logical channel.
- */
-typedef struct rgSchClcBoRpt
-{
- CmLList boLstEnt; /*!< Linked list entity for BO list */
- uint32_t bo; /*!< Bo in bytes */
- CmLteTimingInfo timeToTx; /*!< Time at which the BO needs to be satisfied
- (data to be sent to PHY) */
-#ifdef EMTC_ENABLE
- uint8_t emtcDIReason; /*!< Reason for DI message to send. */
- uint8_t pnb; /*!< Paging narrowBand on which Ue performs reception of paging*/
-#endif
- CmLteTimingInfo maxTimeToTx;
- uint8_t retxCnt;
- uint16_t i;
- uint8_t nPrb; /*! NPRB column. Allowed values {2,3} */
- /* Corrected allocation for common channels */
- uint8_t mcs;
-} RgSchClcBoRpt;
-
-/**
- * @brief
- * Logical channel control block for BCCH and PCCH channels.
- */
-typedef struct rgSchClcDlLcCb
-{
- uint8_t lcId; /*!< Logical channel ID */
- Bool si;
- CmLListCp boLst; /*!< List of BOs reported (RgSchClcBoRpt) */
-} RgSchClcDlLcCb;
-
-/**
- * @brief
- * Transmission offset configuration for SRS.
- */
-typedef struct rgSchSrsTxOffst
-{
- uint8_t count; /*!< Number of offsets in the array */
- uint8_t offst[RGSCH_MAX_SRS_TX_OFFSET]; /*!< SRS TX offset value */
-} RgSchSrsTxOffst;
-
-/**
- * @brief
- * Cell Control block per cell.
- */
-typedef struct rgSchSrsCfg
-{
- /*ccpu00130768 - ADD - SRS CFG Present flag to enable/disable cell specific SRS*/
- Bool isSrsCfgPres; /*!< cell specific SRS CFG enable/disable flag */
- RgrSrsCfgPrd srsCfgPrdEnum; /*!< SRS configuration period (in subframes) */
- RgrSrsBwCfg srsBwEnum; /*!< SRS Bandwidth configuration per cell.*/
- RgSchSrsTxOffst srsTxOffst; /*!< Transmission offset for SRS */
-/*ccpu00116923 - ADD - SRS present support*/
-#ifdef TFU_UPGRADE
- uint8_t srsSubFrameCfg;/*!< SRS subframe configuration index per cell.
- Range - [0-15] */
-#endif
-} RgSchSrsCfg;
-
-
-/**
- * @brief
- * MAC Configuration element for CRG interface.
- */
-typedef struct rgSchCfgElem
-{
- CmLList cfgReqLstEnt; /*!< Linked list entry for cfgReqLst */
- CmLteTimingInfo actvTime; /*!< Activation time to apply configuration */
- struct rgrCfgS
- {
- Region reg;
- Pool pool;
- RgrCfgReqInfo *rgrCfgReq; /*!< Configuration request information from
- RRM */
- RgrCfgTransId transId; /*!< Transaction ID for the config request */
- } rgrCfg; /*!< RGR configuration information */
-} RgSchCfgElem;
-
-
-/**
- * @brief
- * Configuration Control block per cell.
- */
-typedef struct rgSchCfgCb
-{
- CmLListCp crntRgrCfgLst; /*!< List of config requests recieved in the
- current TTI from RRM */
- CmLListCp pndngRgrCfgLst; /*!< List of pending config requests recieved in the
- previous TTIs from RRM */
-} RgSchCfgCfb;
-
-/**
- * @brief
- * Link of RNTIs managed by MAC.
- */
-typedef struct rgSchRntiLnk
-{
- uint16_t rnti; /*!< RNTI */
- /*Fix: Overcome race condition between MAC and Scheduler delete*/
- CmLList rntiGrdPoolLnk; /*!< Link for RNTI guard pool*/
- struct rgSchRntiLnk *prv; /*!< Link to previous RNTI */
- struct rgSchRntiLnk *nxt; /*!< Link to next RNTI */
-} RgSchRntiLnk;
-
-/**
- * @brief
- * Database of RNTIs managed by MAC.
- */
-typedef struct rgSchRntiDb
-{
- uint16_t rntiStart; /*!< Start RNTI */
- uint16_t maxRntis; /*!< Maximum number of RNTIs managed by MAC */
- uint16_t count;
- RgSchRntiLnk *freeRnti; /*!< first free RNTI in the list */
- RgSchRntiLnk *lastRnti; /*!< last RNTI in the list */
- RgSchRntiLnk *rntiPool; /*!< Linked list of RNTIs */
- /*Fix:Overcome Race condition between MAC and Scheduler delete*/
- CmLListCp rntiGuardPool; /*!< Holds guard pool for RNTIs when deleted in
- Scheduler but not deleted at MAC */
-} RgSchRntiDb;
-
-/**
- * @brief
- * Random access information per cell.
- */
-typedef struct rgSchRaInfoCb
-{
-#ifdef LTE_TDD
- uint8_t maxRaSize; /*!< Number of RA-RNTIs stored
- across radio frames */
- uint8_t lstSize; /*!< list size */
- CmLListCp *raReqLst; /*!< Each array elem is linked
- list of RgRaReqInfo
- (per ra-rnti) */
-#else
- /* ccpu00132523 Doubled the array size from MAX_RARNTI because window expiry
- * is overlapping with newly received TACH reqs in max RAR window*/
- /* Array Size should be more than gap towards window start */
- CmLListCp raReqLst[RGSCH_RAREQ_ARRAY_SIZE]; /*!< Each array elem is linked
- list of RgRaReqInfo
- (per max ra-rnti*2) */
-#endif
- CmLListCp raCbLst; /*!< List of RaCbs */
- CmLListCp toBeSchdLst; /*!< List of RaCbs to be
- scheduled */
-} RgSchRaInfoCb;
-#ifdef EMTC_ENABLE
-/** @brief This structure is part of the uplink HARQ process, this structure
- * encapsulates all the DRX related information.
- */
-typedef struct rgSchDrxUlHqProcCb
-{
- CmLList harqRTTEnt; /*!< Entry into the HARQ RTT timer list */
- CmLList harqRetxEnt; /*!< Entry into the harqRetxQ */
-
- uint16_t rttIndx; /*!< Current Index into HARQ RTT Q */
- uint16_t reTxIndx; /*!< Current Index into Re-Tx Q */
- uint8_t retxTmrReduction; /*!< Due to platform specific timing diff between
- UL HARQ processing and UL Scheduling, the
- drx retx timer may start at a later time, than
- actual. That delay in starting the timer is
- stored in this */
-
-} RgSchDrxUlHqProcCb;
-
-#endif
-
-/**
- * @brief
- * Uplink HARQ process information per UE
- */
-struct rgSchUlHqProcCb
-{
- uint8_t ndi; /*!< NDI */
- uint8_t remTx; /*!< Number of remaining transmissions */
- RgSchUlAlloc *alloc; /*!< Uplink allocation */
- /* Renamed rcvdDatInd to rcvdCrcInd */
- Bool rcvdCrcInd; /*!< Set to true when data rcvd, false when
- decode failure. */
- uint8_t rvIdx; /*!< Redundancy version index */
- TknUInt8 rvIdxPhy; /*!< Whatever is given by PHY. To be inspected in case
- of NACK.Always initialised to 'not present' */
- CmLList reTxLnk; /*!< Retransmission List */
- RgSchUlRetxAlloc reTxAlloc; /*!< Retransmission allocation
- information */
- Bool isRetx; /*!< Awaiting retransmission */
- uint8_t procId; /*!< HARQ Process ID */
- uint8_t ulSfIdx; /*!< UL Subframe Index */
-#ifdef LTE_TDD
- /* Changes for passing iPhich at TFU*/
- uint8_t iPhich; /*!< Needed to Calculate PHICH
- location. For TDD only */
-#endif
-#ifdef LTEMAC_SPS
- Bool isSpsActvnHqP; /*!< Set to true when this HqP is used for
- UL SPS Activation */
- Bool isSpsOccnHqP; /*!< Set to true when this HqP is used for
- UL SPS Occasion TX */
-#endif
- void *hqEnt;
-#ifdef EMTC_ENABLE
- RgSchDrxUlHqProcCb drxCb;
- Bool isDtx;
-#endif
- /* 5gtf: TODO two links are not required */
- CmLList lnk; /*!< To link to inUse/Free Pool */
- CmLteTimingInfo schdTime; /*!< SFN,SF of schd time */
-};
-
-/**
- * @brief
- * Uplink HARQ entity information per UE.
- */
-typedef struct rgSchUlHqCb
-{
- uint8_t maxHqRetx; /*!< Maximum number of harq
- * re-transmissions */
- uint8_t numHqPrcs; /*!< Number of HARQ Processes */
-#ifdef LTE_TDD
- RgSchUlHqProcCb *hqProcCb; /*!< Uplink harq process info */
-#else
- RgSchUlHqProcCb hqProcCb[RGSCH_NUM_UL_HQ_PROC]; /*!< Uplink harq process info */
-#endif
-#ifdef LTE_L2_MEAS
- uint8_t numBusyHqProcs; /*!< Total Num of Hq procs in use */
-#endif
-#ifdef EMTC_ENABLE
- void *sch;
- RgSchUeCb *ue;
-#endif
- CmLListCp free; /*!< List of free HARQ processes */
- CmLListCp inUse; /*!< List of in-use HARQ processes */
-} RgUeUlHqCb;
-
-/**
- * @brief
- * Logical channel group.
- */
-#ifdef LTE_L2_MEAS
-/**
- * @brief
- * Structure to store values for Ra Preambles received values
- * */
-typedef struct rgSchRaPreambles
-{
- uint8_t dedPream; /*!< Dedicated RA Preamble received */
- uint8_t preamGrpA; /*!< Randomly selected preambles in low range */
- uint8_t preamGrpB; /*!< Randomly selected preambles in high range */
-}RgSchRaPreambles;
-
-/**
- * @brief strutcure to store Avergae PRB usage for a given Time period in
- * Downlink.
- * */
-typedef struct rgSchAvgPrbDl
-{
- Bool cntActive; /* Set to TRUE if counting activated */
- CmLteTimingInfo startTime; /*!< Start Time */
- uint8_t timePrd; /*!< Period For which meas to be done */
- uint32_t prbCount; /*!< PRB Count Updated every Per TTI */
-} RgSchAvgPrbDl;
-
-/**
- * @brief strutcure to store Avergae PRB usage for a given Time period in
- * Uplink .
- * */
-typedef struct rgSchAvgPrbUl
-{
- Bool cntActive; /*!< Set to TRUE if counting activated */
- CmLteTimingInfo startTime; /*!< Start Time */
- uint8_t timePrd; /*!< Period For which meas to be done */
- uint32_t prbCount; /*!< PRB Count Updated every Per TTI */
-} RgSchAvgPrbUl;
-
-/** @brief
- * L2 measurement control block.
- * */
-struct rgSchL2MeasCb
-{
- CmLList measLnk; /*!< MeasCb node */
- LrgSchMeasReqInfo measReq; /*!< Request received for measurement */
- CmLteTimingInfo startTime; /*!< Time at which measurement started */
- RgInfPrbCfm avgPrbQciUl; /*!< Used to store result from MAC */
- Bool cfmRcvd; /*!< Used to check if confirm received from MAC */
- /*!< For average PRB usage in UL */
- uint16_t sfnCycle; /*<! Count of Num of SFN wraps */
- uint32_t dlTotalBw; /*!< Total DL Bw between meas Req and Meas Send Req */
- uint32_t ulTotalBw; /*!< Total UL Bw between meas Req and Meas Send Req */
-};
-
-typedef struct rgSchTbCnt
-{
- uint32_t tbTransDlTotalCnt; /*!< Total DL TB count */
- uint32_t tbTransDlFaulty; /*!< Total DL Faulty TB count */
- uint32_t tbTransUlTotalCnt; /*!< Total UL TB count */
- uint32_t tbTransUlFaulty; /*!< Total UL Faulty TB count */
-}RgSchTbCnt;
-#endif /* LTE_L2_MEAS */
-/** @brief
- * Control block to store measurement details per QCI.
- * */
-struct rgSchQciCb
-{
- uint8_t qci; /*!< QCI of the Logical Channel */
- uint32_t dlPrbCount; /*!< Cumulative Prb Count for this QCI */
- uint32_t dlUeCount; /*!< Cumulative number of active UE's */
- uint32_t dlTotal_UeCount; /*!< Cummulative count added for every sampling
- Occasion*/
- uint32_t ulUeCount; /*!< Cumulative number of active UE's */
- uint32_t ulTotal_UeCount; /*!< Cummulative count added for every sampling
- Occasion*/
-};
-struct rgSchLcgCb
-{
- /* Right now not keeping associated logical channels, searching for
- * associated channels needed only during config */
- uint8_t lcgId; /*!< Group ID */
- Void *sch;
-#ifdef LTE_L2_MEAS
- uint8_t numLch; /*!< Number fo LC's for this LCG*/
- RgSchUlLcCb *lcArray[RGSCH_MAX_LC_PER_UE]; /*!< Dedicated Uplink logical
- channel per LCG */
-#endif /* LTE_L2_MEAS */
- /* Added support for SPS*/
-#ifdef LTEMAC_SPS
- uint8_t lcCnt;
- uint8_t lcId[RGR_MAX_SPS_LC];
-#endif
-};
-
-/**
- * @brief
- * Uplink Dedicated Logical channel control block.
- */
-struct rgSchUlLcCb
-{
- Bool isValid; /*!< If this struct holds valid values*/
- uint8_t lcId; /*!< Logical channel ID */
- uint8_t lcgArrIdx; /*!< Index of this LC in the LCG Array*/
- RgSchLcgCb *lcg; /*!< Logical channel group */
- RgrLchQosCfg ulQos; /*!< UL Qos parameters */
- /* After Merging from 2.1 to 2.2 */
- RgSchQciCb *qciCb; /* QCI Details for this LC */
-};
-
-/**
- * @brief
- * Ul Grnt Info for Ho/Po UE in RAR.
- */
-typedef struct rgSchHoPoUeGrnt
-{
- uint8_t rapId; /*!< dedicated rapId */
- uint8_t hop; /*!< Hopping flag, set to 0 in this version */
- uint8_t rbStart; /*!< Start Resource block of allocation */
- uint8_t numRb; /*!< Number of resource blocks allocated */
- uint8_t tpc; /*!< TPC command for the uplink grant */
- uint8_t iMcsCrnt; /*!< Current MCS index of the grant */
- TknUInt16 ta; /*!< Timing Adjustment */
- CmLList raRspLnk; /*!< To link UE to RaRsp cont free list */
- /* Added support for SPS*/
- uint16_t datSz; /*!< Length of the Data */
- Bool cqiReqBit; /*!< Aperiodic CQI is requested or not */
-} RgSchHoPoUeGrnt;
-
-/**
- * @brief
- * Uplink SPS scheduling information per UE
- */
-typedef struct rgSchCmnSpsUlUeSchdInfo
-{
- uint32_t allocBwMask[RGSCH_SPS_ULBW_MASK_LEN]; /*!< Bitmask indicating the allocation info
- for the UE. Bit set at position 'x'
- indicates subband 'x' is allocated */
- uint8_t scaledCqi; /*!< Assumed value of CQI for transmission */
- uint16_t actvSfLstIdx; /*!< Index into cell-wide UL SPS sub-frame
- table during activation */
- CmLteTimingInfo ulSpsActvOcc; /*!< Time at which SPS is activated/reactivated
- for the UE */
- CmLteTimingInfo crntUlSpsOcc;/*!< Key into the list of UL SPS active
- UEs: next UL SPS ocassion */
- RgSchUlAlloc allocInfo; /*!< Allocation information of the UE */
- RgSchUlAlloc *crntAlloc; /*!< Allocation pointer in the subframe */
- RgSchUlSf *crntAllocSf; /*!< sf in which crntAlloc was made */
-} RgSchCmnSpsUlUeSchdInfo;
-
-/**
- * @brief
- * Uplink information for SPS per UE
- */
-typedef struct rgSchCmnUlUeSpsInfo
-{
- CmLList actvUeLstEnt; /*!< Linked List entry for UL SPS
- active UE list*/
- CmLList pndngUeLstEnt;/*!< Linked List entry for UE list with
- pending SPS action:
- activation/reactivation/release */
- Bool isUlSpsActv; /*!< Indicates if UE's UL SPS is
- active currently */
- uint8_t measGapMask[RGSCH_SPS_MG_MASK_LEN]; /*!< Indicates the UL sub-frames with
- ongoing measurement gap. Mask is
- of size (80/8) */
- uint8_t state; /*!< State of the UE: can be one of
- ACTV_REACTV_SENT (pdcch for
- (re)activation sent),REL_SENT,
- ULSPS_ACTV */
- Bool pdcchToRetx; /*!< set to TRUE if DTX occurs at the
- (re)activated SPS occasion */
- RgSchCmnSpsUlUeSchdInfo ulSpsSchdInfo; /*!< Scheduled info for UL SPS
- active UE */
-
- uint8_t spsOccIdx; /*!< N value for nxt sps occasion */
-
- uint32_t packetSize; /*!< Packet size for SPS - SPS allocation*/
- uint32_t spsSduSize; /*!< SDU Size recvd on SPS Occasion*/
- uint32_t spsGrantSize; /*!< Grant size for SPS allocation */
-
- CmLteTimingInfo lastSpsDatRecvdTime; /*!< timing info on which the
- SPS data is recieved*/
- CmLListCp *spsList; /*!< Pointer to the SPS list of which
- UE is a part */
- uint32_t actPdcchCrcFailCount; /*!< Num of consecutive CRC fails for
- SPS Activation PDCCH */
- uint32_t crcFailCntSpsOcc; /*!< Consecutive CRC fail for SPS Occasion
- TX */
- uint32_t relPdcchSntCnt; /*!< Num ber Rel PDCCH sent to UE*/
-#ifdef RGSCH_SPS_STATS
- uint32_t crcFailStats;
- uint32_t crcPassStats;
- uint32_t totalBsr;
- uint32_t numBsrRpt;
-#endif
-} RgSchCmnUlUeSpsInfo;
-
-
-
-/**
- * @brief
- * Uplink control block for UE specific information.
- */
-typedef struct rgSchUeUlCb
-{
- RgSchUlLcCb lcCb[RGSCH_MAX_LC_PER_UE]; /*!< Dedicated Uplink logical channel
- information */
- RgSchLcgCb lcgArr[RGSCH_MAX_LCG_PER_UE]; /*!< Logical channel groups */
- uint8_t ulInactvMask; /*!< Bitmask indicating if UE is inactive for UL scheduling */
- CmLList ulInactvLnk; /*!< Link to the inactive UE List for UL */
- RgSchHoPoUeGrnt rarGrnt; /*!< UE's RAR grant Information */
- RgrUeTxAntSelCfg ulTxAntSel;/*!< UL Transmit antenna selection Cfg Info */
-#ifdef RGR_V1
- /* Added periodic BSR timer */
- RgrUeBsrTmrCfg bsrTmrCfg; /*!< BSR timers configuraiton for the UE */
-#endif
- /* Added support for SPS*/
-#ifdef LTEMAC_SPS
- RgrUeSpsUlCfg ulSpsCfg; /*!< UL SPS configuration information */
- uint8_t explicitRelCnt; /*!< Number of subframes after sending
- release to consider it successful */
- uint16_t spsPrdcty; /*!< Shall store the SPS periodicity of the
- UE. Needed to round-off in case of
- TDD */
- CmLteTimingInfo relPdcchSchdTime; /*!< This field holds the scheduled time
- of SPS rel PDCCH*/
-#endif
-#ifdef LTE_L2_MEAS
- uint32_t nPrb; /*!< Number of resource block allocated */
-#endif
-#ifdef TFU_UPGRADE
- uint8_t betaHqOffst; /*!< Delta HARQ offset used in the case where HARQ
- feedback is multiplexed with PUSCH data. */
- uint8_t betaCqiOffst;/*!< Beta offset for CQI[0-15]. Given by RRC*/
- uint8_t betaRiOffst;/*!Beta offset for RI[0-15]. Given by RRC */
-#endif
- uint32_t cqiRiSz; /*!<Size of Periodic/Aperiodic CQI or RI depending
- on the occassion */
- uint32_t betaOffstVal; /*!< beta offset of CQI or RI depending
- on the occassion*/
- uint32_t maxBytesPerUePerTti; /*!< Maximum bytes that can be allocated
- * in 1 scheduling instance per UE */
- uint32_t minReqBytes; /*!< The buffer amount of lcg0 */
- uint32_t totalBsr; /*!< Total BSR as reported by UE (in bytes) */
- uint32_t nonLcg0Bs; /*!< Total BSR for LCG1/LCG2/LCG3 */
- uint32_t nonGbrLcgBs; /*!< Total BSR as reported by UE (in bytes) for non-GBR LCG's*/
- uint32_t effBsr; /*!< BSR yet to be satisfied in allocations */
-
- uint32_t cfgdAmbr; /*!< Byte rate of UE Ambr per Refresh Cycle */
- uint32_t effAmbr; /*!< Remaining Bytes of Byte rate available in a refresh Cycle */
- CmLteTimingInfo ulTransTime; /*!< Timing info of the latest reception of
- any UL data/signal from UE */
-#ifdef LTEMAC_SPS
- RgSchCmnUlUeSpsInfo ulSpsInfo; /*!< UL SPS information for UE */
-#endif
- Bool isUlCaEnabled; /*!< If TRUE UL CA is enabled for the UE */
- CmLteCellId ctrlOnServCellIdx[RGSCH_ULCTRL_RECP_DIST]; /*!<
- * Serving Cell Idx on which UL CTRL INFO is to
- * be received of all configured
- * serving cell */
-
- Bool useExtBSRSizes; /*!< If TRUE used R10 Extended BSR Size Table*/
-} RgSchUeUlCb;
-
-/**
- * @brief
- * Downlink CCCH Tx/Retx schedule information.
- */
-typedef struct rgSchCcchSchdInfo
-{
- uint32_t totBytes; /*!< Total bytes allocated */
- CmLList retxLnk; /*!< To link hqP to retx Queues */
- uint8_t rvIdx; /*!< Rv Index */
-} RgSchCcchSchdInfo;
-
-/**
- * @brief
- * Downlink Grant Information per UE.
- */
-typedef struct rgSchDlGrnt
-{
- uint16_t schdTime; /*!< Time at which Harq proc has been scheduled */
- uint8_t rbStrt; /*!< Starting RB of the allocation */
- uint8_t numRb; /*!< Number of RBs allocated */
- uint8_t iMcs; /*!< Index to the MCS */
- uint8_t rv; /*!< RV for HARQ (re)transmission */
- uint8_t rvIdx; /*!< RVIdx for HARQ(re)transmission */
-#ifdef RG_5GTF /* ToDo:: Anoop need to check for other fields required*/
- uint8_t vrbgStart;
- uint8_t numVrbg;
- uint16_t rbAssign;
- uint8_t xPDSCHRange;
- uint8_t SCID;
- TfuDciFormat dciFormat; /*!< DCI format for the allocation */
- /* ToDo */
-#endif
-} RgSchDlGrnt;
-
-/**
- * @brief
- * Logical channel data as being scheduled by the scheduler.
- */
-typedef struct rgSchLchAllocInfo
-{
- uint8_t lcId; /*!< Logical channel ID */
- uint32_t schdData; /*!< Scheduled logical channel data */
-} RgSchLchAllocInfo;
-
-/** @brief This structure is part of the downlink HARQ process, this structure
- * encapsulates all the DRX related information.
- */
-typedef struct rgSchDrxDlHqProcCb
-{
- CmLList harqRTTEnt; /*!< Entry into the HARQ RTT timer list */
- CmLList harqRetxEnt; /*!< Entry into the harqRetxQ */
-
- uint16_t rttIndx; /*!< Current Index into HARQ RTT Q */
- uint16_t reTxIndx; /*!< Current Index into Re-Tx Q */
- uint8_t retxTmrReduction; /*!< Due to platform specific timing diff between
- DL HARQ processing and DL Scheduling, the
- drx retx timer may start at a later time, than
- actual. That delay in starting the timer is
- stored in this */
-
-
-} RgSchDrxDlHqProcCb;
-
-/** @enum TfuDciFormat
- * This Enum has values for Harq Proc TB state.
- */
-typedef enum
-{
- HQ_TB_ACKED=0,
- HQ_TB_NACKED,
- HQ_TB_WAITING
-}RgSchHqTbState;
-/**
- * @brief
- * Downlink TB information per DL HqProc.
- */
-struct rgSchDlHqTbCb
-{
- uint8_t tbIdx; /*!< Index of this TB (0/1). Initialized
- at HqEnt allocation */
- uint32_t tbSz; /*!< TB size scheduled for this TB */
- uint8_t txCntr; /*!< Transmission counter */
- uint8_t ndi; /*!< New Data Indicator 0 or 1*/
- TknUInt8 schdTa; /*!< TA scheduled to be sent */
- /* CR timer implementation changes*/
- uint8_t contResCe;
- uint8_t numLch; /*!< No. of DL Logical Channels scheduled
- for this TB */
- CmLteTimingInfo timingInfo; /*!< This field holds the scheduled time */
- RgSchLchAllocInfo lchSchdDataArr[RGSCH_MAX_NUM_DED_LC];
- RgSchLchAllocInfo *lchSchdData;
- RgSchCcchSchdInfo ccchSchdInfo;/*!< CCCH TX/RETX scheduler Info */
- uint8_t fbkRepCntr; /*!< Counter to ANRep Feedback */
- uint8_t fbkRecpRepCntr; /*!< Counter to ANRep Feedback */
- CmLList anRepLnk[6]; /*!< Links for ANRep we need
- these many links to
- simultaneously hold the
- hqProcs in multiple
- subframes. */
- RgSchDlSf *crntSubfrm[6]; /*!< Pointer to subframes */
- uint8_t ackCount; /*!< Counter for ACKs */
- uint8_t isAckNackDtx; /* ACK or NACK or DTX*/
- uint8_t nackCount; /* NACK Counter */
- uint8_t dtxCount; /* DTX Counter */
- RgSchDlGrnt dlGrnt; /*!< Scheduler grant */
- Bool taSnt; /*!< TA sent or not */
-#ifdef LTE_TDD
- CmLteTimingInfo fdbkTime; /*!< Expected feedback time */
- uint8_t m; /*!< Subframe Order Index within the subframe
- downlink association index K */
- RgSchTddSfType sfType; /*!< Identifies the first Tx subframe type */
- uint8_t pucchFdbkIdx;/*!< DL subframe idx for which fdbk is expected */
- uint8_t dai; /*!< DAI associated with this TB.
- THis is used for F1BCS resource calulcation */
-#ifdef XEON_TDD_SPCL
- uint8_t initTxNumRbs;/*!< Number of Rbs Allocated in First TX */
-#endif
-
-#endif
- /* 3.1 MIMO */
- uint8_t numLyrs; /*!< Number of layers using which this TB is
- being transmitted */
- RgSchHqTbState state; /*!< State of this Trasport Block */
- RgSchDlHqProcCb *hqP; /*!< Reference to the TB container */
- /* Freeing up the HARQ proc blocked for
- * indefinite time in case of Retx */
- uint8_t cntrRetxAllocFail; /*!< Number of times allocation failed
- for the retransmission of this TB */
-#ifdef LTE_ADV
- TknUInt8 schdSCellActCe; /* !< SCell Act values and whether
- scheduled or not */
-#endif
- uint32_t firstSchedTime; /*!< First time when the TB was scheduled */
- uint8_t minRlcReordrTmr; /*!< Min RLC reorder timer of all LCs
- scheduled in this hqP*/
-};
-
-
-/**
- * @brief
- * Downlink HARQ process information per UE.
- */
-struct rgSchDlHqProcCb
-{
- CmLList lnk; /*!< To link with other HARQ processes */
- RgSchDlHqEnt *hqE; /*!< HARQ entity */
-#ifdef LTE_TDD
- uint8_t txCntr; /*!< Transmission counter */
-#endif
- uint8_t procId; /*!< Harq process ID */
- Void *sch; /*!< Cmn sched Hq control block */
- /* 3.1 MIMO */
- RgSchDlHqTbCb tbInfo[2]; /*!< TB related information for 1+1(if any) TBs */
- RgSchDrxDlHqProcCb drxCb; /*!< DRX control block */
-#ifdef TFU_UPGRADE
- uint8_t tbCnt; /*!< Count of the number TBs being sent with a
- Reception Requesti */
-#endif
-#ifdef LTEMAC_SPS
- TknUInt16 spsN1PucchRes; /*!< N1Pucch resource for HARQ process at SPS
- ocassions: present only when HqP contains
- Data without PDCCH */
-#endif
- /* Fix: syed having a hqP added to Lists for RB assignment rather than
- * a UE, as adding UE was limiting handling some scenarios */
- CmLList reqLnk; /*!< Link for list of UEs/RACBs to be scheduled */
- CmLList schdLstLnk; /*!< Link for list of scheduled/non-scheduled
- allocations: used by RB allocation module*/
- Bool hasDcch; /*!< Set to TRUE if DCCH channel is present in
- scheduling grant over this hqProc */
- Bool cwSwpEnabled; /*!< Set if CW swap enabled */
-/*f1b_Sprint3*/
- uint8_t tpc; /*!< TPC command to be used for Secondary cell
- N1PUCCH resource Index*/
-/*f1b_Sprint3*/
- /*CA Dev Start*/
- CmLList hqPSfLnk;
- /* Shifted from TbCb to HqCb*/
- RgSchPdcch *pdcch; /*!< Pdcch Allocated for this Hq TB */
- RgSchDlSf *subFrm; /*!< Subfrm for which this TB is assgnd */
-#ifdef EMTC_ENABLE
- Void *emtcHqInfo;/*!< emtc specfic hq info */
-#endif
- uint8_t dlDai; /*!< DL DAI assosciated with this harq proc */
- uint8_t ulDai; /*!< UL DAI assosciated with this harq proc */
-#ifdef BRDCM
- /*CA Dev End*/
- uint32_t isPuschFdbk;
-#endif
- Void * laaCb;
- CmLListCp *hqPLst; /*!< pointer to either inUse of free list of hqE */
- TfuDciFormat prevDciFormat; /*!< Previous alloction DCI format used for ERR Ind prcessing */
-
- /* LAA DBG Only */
- uint32_t tbSizeAtEstimate[2];
- uint32_t tbSizeAtFnlz[2];
- uint32_t tbSizeOfMvdTb[2];
- uint32_t itbsAtEstimate[2];
- uint32_t prbAtEstimate;
-};
-
-/**
- * @brief
- * Downlink HARQ entity information per UE.
- */
-struct rgSchDlHqEnt
-{
- RgSchRaCb *raCb; /*!< Parent RACB when attached to RACB */
- RgSchUeCb *ue; /*!< Parent UE */
- CmLListCp free; /*!< List of free HARQ processes */
- CmLListCp inUse; /*!< List of in-use HARQ processes */
- uint8_t maxHqTx; /*!< Maximum number of harq transmissions */
- RgSchDlHqProcCb *msg4Proc; /*!< Points to MSG4 HARQ process */
-#ifdef RGR_V1
- /* CR timer changes*/
- RgSchDlHqProcCb *ccchSduProc; /*!< Points to CCCH SDU HARQ process
- to identify feedback for CCCH SDU
- transmissions done without cont res CE*/
-#endif
- uint8_t numHqPrcs; /*!< Number of HARQ Processes */
-#ifdef LTE_TDD
- RgSchDlHqProcCb *procs; /*!< Downlink harq processes */
-#else
- RgSchDlHqProcCb procs[RGSCH_NUM_DL_HQ_PROC]; /*!< Downlink harq processes */
-#endif
- Void *sch; /*!< Scheduler specific Info */
- /* CA Dev Start */
- RgSchCellCb *cell; /*Contains the pointer to coresponding CellCb*/
- /* CA Dev End*/
-};
-
-
-/**
- * @enum rgSchTaState
- * Enumeration of time alignment states.
- */
-typedef enum rgSchTaState
-{
- RGSCH_TA_IDLE = 0, /*!< TA is to be scheduled */
- RGSCH_TA_TOBE_SCHEDULED,/*!< TA is to be scheduled */
- RGSCH_TA_SCHEDULED /*!< TA is scheduled */
-} RgSchTaState;
-
-/**
- * @brief
- * Downlink Time alignment information per UE.
- */
-typedef struct rgSchUeDlTaCb
-{
- uint16_t cfgTaTmr; /*!< Configured TA timer value */
- uint8_t ta; /*!< TA value for UE */
- uint8_t numRemSf; /*!< Number of subframes left to apply TA */
- RgSchTaState state; /*!< Indicates HARQ state for TA */
- /*rg003.301[ccpu00121813] ADD added new var*/
- Bool outStndngTa; /*!< if new TA is rcvd before it gets
- applied at UE*/
- uint8_t outStndngTaval; /*!< outstanding TA val */
-} RgSchUeDlTaCb;
-
-/**
- * @brief
- * Downlink Dedicated Logical channel control block.
- */
-struct rgSchDlLcCb
-{
- uint8_t lcId; /*!< Logical channel ID */
- uint32_t bo;
- RgSchUeCb *ue; /* UE to which this LC belongs to */
- /* Not validating DlQos for DCCH */
- CmLteLcType lcType; /* Logical channel Type*/
- RgSchQciCb *qciCb; /*!< Pointer to ACI Control Block */
- /* Added support for SPS*/
-#ifdef LTEMAC_SPS
- RgrLchSpsCfg dlLcSpsCfg; /*!< SPS configuration for DL logical channel */
-#endif
-#ifdef CCPU_OPT
- uint16_t estRlcHdrSz; /*!< Estimated RLC header size */
- Bool staPduPrsnt; /*!< Indicate the status pdu present or not*/
-#endif
- uint32_t staPduBo; /*!< Indicate the Status PDU BO.
- This amount is already included in original BO */
- Void *sch; /*!< Holds Scheduler Info pointer */
- uint32_t prbsReqd; /*!< PRBs reqd in DL for each UE in MUE scenario*/
- CmLList schdLnk; /*!< Link to ueCb inserted in toBeSchdList in DL*/
- uint32_t oldestSduArrTime; /*!< oldest SDU arrival time for this LC */
- CmLList lcFlowCntrlEnt; /*!<link to Lc in flow Cntrl lst */
- CmLList lcPdbFbkLnk; /*!<link to LC in LC flow contrl monitoring lst */
- Bool setMaxUlPrio; /*!<set if Poll bit is sent in the PDU */
- Bool setMaxDlPrio; /*!<set if there is a RLC status PDU in DL */
- Void* laaCb;
-
-};
-/*f1b_Sprint3*/
-
-typedef struct rgSchN1PucchResCb
-{
- uint16_t n1PucchIdx; /* !< N1 resource */
- CmLList n1Lnk; /* !< Link for adding into dlsf N1 used list */
-}RgSchN1PucchResCb;
-typedef struct rgSchN3PucchResCb
-{
- uint16_t n3PucchIdx; /* !< N3 resource */
- CmLList n3Lnk; /* !< Link for adding into dlsf N3 used list */
- uint8_t sCellIdx; /* !< Allocated by which scell */
-}RgSchN3PucchResCb;
-
-typedef struct rgSchSCellN3ResCb
-{
- uint8_t antP0N3ResCount; /* !< Number of N3 res for antenna port 0*/
- uint8_t antP1N3ResCount; /* !< Number of N3 res for antenna port 0*/
- RgSchN3PucchResCb antP0N3Res[RG_SCH_MAX_NUM_N3PUCCH_PER_UE]; /* !< Antenna Port 0 N3 resources*/
- RgSchN3PucchResCb antP1N3Res[RG_SCH_MAX_NUM_N3PUCCH_PER_UE]; /* !< Antenna Port 1 N3 resources*/
-}RgSchSCellN3ResCb;
-
-typedef struct rgSchSCellN1ResCb
-{
- uint8_t cw1N1ResCount; /* !< Number of N1 res for CW 1*/
- uint8_t cw2N1ResCount; /* !< Number of N1 res for CW 2*/
- RgSchN1PucchResCb cw1N1Res[RG_SCH_MAX_NUM_N1PUCCH_PER_UE]; /* !< CW1 N1 resources*/
- RgSchN1PucchResCb cw2N1Res[RG_SCH_MAX_NUM_N1PUCCH_PER_UE]; /* !< CW2 N1 resources*/
-}RgSchSCellN1ResCb;
-/*CA Dev Start*/
-#ifdef LTE_ADV
-typedef struct rgSchN3PucchRes
-{
- uint16_t n3PucchIdx; /* !< N3 resource */
- uint8_t tpcIdx;
-}RgSchN3PucchRes;
-#endif
-typedef struct rgSchDlHqInfo
-{
-/*f1b_Sprint3*/
-#ifdef LTE_TDD
- uint8_t numOfCells; /*!<This will be used to store number of unique cells in
- this subframe*/
- Bool isSCellPdschPres; /*!< Flag to indicate whether any PDSCH transmission
- present in secondary cell. Used for CSI/HARQ collision
- */
-#endif
- Bool isPuschHarqRecpPres;/*!< Flag to indicate pusch recp req is pres or not */
- RgrSchFrmt1b3TypEnum uciFrmtTyp; /*!< Store value of format1b or format3.
- */
- uint8_t totalTbCnt; /*!< This will be used to store total number of TBs
- across all harqProcs.It will be used to identify
- PUCCH format type to be used in this SF*/
- CmLList dlSfUeLnk; /*!< list entry into dlsf->ueLst */
- Void * laaCb;
- CmLListCp hqPLst; /*!< This is a list of hq proc per DL
- SF which are scheduled in that SF.
- The number of harq procs awaiting
- feedback for the same subframe depends on
- mode TDD or FDD and max number of Carriers
- that can be aggregated */
-#ifdef LTE_ADV
- RgSchN3PucchRes n3ScellPucch;
-#endif
-}RgSchDlHqInfo;
-
-/*CA Dev End*/
-/** @brief This structure contains the Measurement gap configuration for an UE.
- */
-typedef struct rgUeMeasGapCfg
-{
- Bool isMesGapEnabled; /*!< Is Measuremnet gap enabled or disabled */
- uint8_t gapPrd; /*!< Gap period 40ms/80ms */
- uint8_t gapOffst; /*!< Gap offset - Vaue is 0 to 1*/
-} RgUeMeasGapCfg;
-
-/**
- @brief Measurement Gap related information per UE. */
-typedef struct rgSchUeMeasGapCb
-{
- Bool isMesGapEnabled;/*!< TRUE if Measurement gap is enabled for this UE */
- uint8_t isMeasuring; /*!< Set to TRUE during measurement gap */
- uint8_t gapPrd; /*!< Measurement gap period configuration for the UE */
- uint8_t gapOffst; /*!< Measurement gap offset for the UE */
- CmLList measQLnk; /*!< To Link to the measurement gap list */
- CmLList ackNakQLnk; /*!< To Link to the ACK NACK Rep list */
- CmTimer measGapTmr; /*!< Timer for Measurement Gap */
- CmTimer measGapUlInactvTmr; /*!< UL Inactive timer for measurement gap */
- CmTimer measGapDlInactvTmr; /*!< DL Inactive timer for measurement gap */
-} RgSchUeMeasGapCb;
-
-/**
- @brief ACK-NACK repetition related information per UE. */
-typedef struct rgSchUeAckNakRepCb
-{
- Bool isAckNackEnabled; /*!< Is ACK/NACK Enabled*/
- uint8_t isAckNakRep; /*!< Set to TRUE during ACK-NACK repetition prd */
- uint8_t cfgRepCnt; /*!< Configured value for the repetition counter */
- uint8_t repCntr; /*!< Actual repetition counter */
- uint16_t pucchRes; /*!< PUCCH resource for repetition */
- CmTimer ackNakRepUlInactvTmr; /*!< UL Inactive timer for ack-nack repetition */
- CmTimer ackNakRepDlInactvTmr; /*!< DL Inactive timer for ack-nack repetition */
- CmTimer ackNakRepTmr; /*!< Timer for ack-nack repetition */
- CmLList ackNakRepLnk; /*!< ACK NACK repetition queue link */
- CmLListCp *prsntQ; /*!< Pointer to the Queue that this UE is current
- present in. */
-} RgSchUeAckNakRepCb;
-
-/**
- * @brief
- * UE's MIMO specific information.
- */
-typedef struct rgSchUeMimoInfo
-{
- RgrTxMode oldTMode; /*!< UE's Previous Transmission Mode */
- RgrTxMode txMode; /*!< UE's Transmission Mode */
- TknUInt32 doa; /*!< DOA indicator for this UE */
- Bool puschFdbkVld; /*!< True if Precoding Info in PDCCH has to be
- in-accordance with the latest PUSCH report */
- TfuDlCqiPuschInfo puschPmiInfo; /*!< PUSCH report details for explicit PMI
- * information to PHY during a PDSCH */
- RgrCodeBookRstCfg cdbkSbstRstrctn; /*!< Codebook subset restriction defined as per
- * 36.331 section 6.3.2. As of now, this info
- * is not processed by MAC. SCH shall use the
- * PMI reported by UE unconditionally.*/
-#ifdef DL_LA
- S32 txModUpChgFactor; /*!< tx mode chnage factor for step up*/
- S32 txModDownChgFactor; /*!< tx mode chnage factor for step
- Down*/
-#endif
-}RgSchUeMimoInfo;
-
-/* Added changes of TFU_UPGRADE */
-#ifdef TFU_UPGRADE
-
-/** @brief This structure that stores the length of Bits that
-* will be received over PUSCH for Aperiodic Mode 3-1.
-*/
-typedef struct rgSchCqiRawPuschMode31
-{
- uint8_t wideBCqiCw0; /*!< Length of Wideband CQI Codeword 0 */
- uint8_t totLenSbDiffCqiCw0; /*!< Length of SubBand Differential CQI Codeword 0 */
- uint8_t r1WideBCqiCw1; /*!< Length of Wideband CQI Codeword 1 for Rank =1*/
- uint8_t r1TotLenSbDiffCqiCw1; /*!< Length of SubBand Differential CQI Codeword 1 for Rank = 1*/
- uint8_t rg1WideBCqiCw1; /*!< Length of Wideband CQI Codeword 1 for Rank > 1*/
- uint8_t rg1TotLenSbDiffCqiCw1; /*!< Length of SubBand Differential CQI Codeword 1 for Rank > 1*/
- uint8_t r1PmiBitLen; /*!< Length of PMI Bits for Rank = 1*/
- uint8_t rg1PmiBitLen; /*!< Length of PMI Bits for Rank > 1*/
-} RgSchCqiRawPuschMode31;
-
-/** @brief This structure that stores the length of Bits that
-* will be received over PUSCH for Aperiodic Mode 3-0.
-*/
-typedef struct rgSchCqiRawPuschMode30
-{
- uint8_t wideBCqiCw; /*!< Length of Wideband CQI */
- uint8_t totLenSbDiffCqi; /*!< Length of SubBand Differential CQI */
-} RgSchCqiRawPuschMode30;
-
-/** @brief This structure that stores the length of Bits that
-* will be received over PUSCH for Aperiodic Mode 2-2.
-*/
-typedef struct rgSchCqiRawPuschMode22
-{
- uint8_t wideBCqiCw0; /*!< Length of Wideband CQI Codeword 0 */
- uint8_t sBDiffCqiCw0; /*!< Length of SubBand Differential CQI Codeword 0 */
- uint8_t r1WideBCqiCw1; /*!< Length of Wideband CQI Codeword 1 for Rank =1 */
- uint8_t r1SbDiffCqiCw1; /*!< Length of SubBand Differential CQI Codeword 1 for Rank =1*/
- uint8_t rg1WideBCqiCw1; /*!< Length of Wideband CQI Codeword 1 for Rank > 1*/
- uint8_t rg1SbDiffCqiCw1; /*!< Length of SubBand Differential CQI Codeword 1 for Rank >1*/
- uint8_t posOfM; /*!< Position of M selected SubBands */
- uint8_t r1PmiBitLen; /*!< Length of PMI Bits for Rank =1*/
- uint8_t rg1PmiBitLen; /*!< Length of PMI Bits for Rank >1*/
-} RgSchCqiRawPuschMode22;
-
-/** @brief This structure that stores the length of Bits that
-* will be received over PUSCH for Aperiodic Mode 2-0.
-*/
-typedef struct rgSchCqiRawPuschMode20
-{
- uint8_t wideBCqiCw; /*!< Length of Wideband CQI */
- uint8_t subBandDiffCqi; /*!< Length of SubBand Differential CQI */
- uint8_t posOfM; /*!< Position of M selected SubBands */
-} RgSchCqiRawPuschMode20;
-
-/** @brief This structure that stores the length of Bits that
-* will be received over PUSCH for Aperiodic Mode 1-2.
-*/
-typedef struct rgSchCqiRawPuschMode12
-{
- uint8_t wideBCqiCw0; /*!< Length of Wideband CQI Codeword 0 */
- uint8_t r1WideBCqiCw1; /*!< Length of Wideband CQI Codeword 1 for Rank =1*/
- uint8_t rg1WideBCqiCw1; /*!< Length of Wideband CQI Codeword for Rank > 1 */
- uint8_t r1TotalPmiBitLen; /*!< Aggregate length of PMI Bits for Rank =1 */
- uint8_t rg1TotalPmiBitLen; /*!< Aggregate length of PMI Bits for Rank > 1 */
-} RgSchCqiRawPuschMode12;
-
-
-/** @brief This structure that stores the length of Bits that
-* will be received over PUSCH.
-*/
-typedef struct rgSchDlCqiRawPusch
-{
- TfuDlCqiPuschMode mode; /*!< PUSCH CQI mode */
- TknUInt8 ri; /*!< Rank Indicator for TM 3,4 */
- union
- {
- RgSchCqiRawPuschMode12 mode12Info; /*!< Mode 1-2 information */
- RgSchCqiRawPuschMode20 mode20Info; /*!< Mode 2-0 information */
- RgSchCqiRawPuschMode22 mode22Info; /*!< Mode 2-2 information */
- RgSchCqiRawPuschMode30 mode30Info; /*!< Mode 3-0 information */
- RgSchCqiRawPuschMode31 mode31Info; /*!< Mode 3-1 information */
- }u;
-} RgSchDlCqiRawPusch;
-
-typedef struct rgSchPuschRawCqiInfoPerCell
-{
- uint8_t sCellIdx; /*!< Serving cell idx of the cell for
- this cqi info*/
- RgSchDlCqiRawPusch puschRawCqiInfo; /*!< Raw CQI Bit Width for PUSCH */
-} RgSchPuschRawCqiInfoPerCell;
-
-typedef struct rgSchPuschRawCqiInfoForSCells
-{
- uint8_t numOfCells; /* Num of cells for which Apcqi is comming*/
- RgSchPuschRawCqiInfoPerCell cqiBitWidth[CM_LTE_MAX_CELLS];
-} RgSchPuschRawCqiInfoForSCells;
-
-typedef struct rgSchPucchRawCqiInfoPerCell
-{
- uint8_t sCellIdx; /*!< Serving cell idx of the cell for
- this cqi info*/
- TfuDlCqiPucch pucchRawCqiInfo; /*!< Raw CQI Bit Width for PUCCH */
-} RgSchPucchRawCqiInfoPerCell;
-
-typedef struct rgSchUeRawCqiBitWidthInfo
-{
- TfuRecpReqType type; /*!< Type indicating PUCCH or PUSCH */
- CmLteTimingInfo recvTime;
- union
- {
- RgSchPucchRawCqiInfoPerCell pucch;
- RgSchPuschRawCqiInfoForSCells pusch;
- }u;
-} RgSchUeRawCqiBitWidthInfo;
-#endif
-
-
-/* CaDev start */
-#ifdef LTE_ADV
-
-/**
- * @brief
- * Enum for storing the different states of a Scell
- * RG_SCH_SCELL_INACTIVE : SCell is added but not activate
- * RG_SCH_SCELL_TOBE_ACTIVATED : SCell Activation trigger condition is met
- Need to be scheduled.
- * RG_SCH_SCELL_ACTVTN_IN_PROG : Waiting for Harq feedback for the scell activation
- * RG_SCH_SCELL_ACTIVE : SCell is activated succesfully
- */
-typedef enum
-{
- RG_SCH_SCELL_INACTIVE = 0, /*!<SCELL Addition/Reset */
- RG_SCH_SCELL_READY, /*!<SCELL Ready is reaceived or SCell is deactivated */
- RG_SCH_SCELL_TOBE_ACTIVATED, /*!<Activation Trigger */
- RG_SCH_SCELL_ACTVTN_IN_PROG, /*<!Activation CE is sent */
- RG_SCH_SCELL_TOBE_DEACTIVATED, /*<!Deactivation Trigger */
- RG_SCH_SCELL_DEACTVTN_IN_PROG, /*<!Deactivation CE is sent */
- RG_SCH_SCELL_ACTIVE /*<!SCell is activated */
-}RgSCellStateEnum;
-
-/**
- * @brief
- * Enum to define the value of A for Format 1B with CS
- * in FDD Case and for M=1 in TDD Case.
- */
-typedef enum
-{
- RG_SCH_A_VAL_2 = 2,
- RG_SCH_A_VAL_3 = 3,
- RG_SCH_A_VAL_4 = 4,
- RG_SCH_A_VAL_INVALID = 5
-}RgSchAValue;
-
-#ifdef LTE_TDD
-/**
- * @brief
- * Enum to define the value of A for Format 1B with CS
- * in FDD Case and for M=1 in TDD Case.
- */
-typedef enum
-{
- RG_SCH_M_VAL_1 = 1,
- RG_SCH_M_VAL_2 = 2,
- RG_SCH_M_VAL_3 = 3,
- RG_SCH_M_VAL_4 = 4,
- RG_SCH_M_VAL_INVALID = 5
-}RgSchMValue;
-#endif/*LTE_TDD*/
-#endif/*LTE_ADV*/
-
-/**
- * @brief
- * Downlink UE specific SCell information.
- */
-struct rgSchUeCellInfo
-{
- CmHashListEnt ueLstEnt; /*!< Hash List entity for UE List */
- RgSchUeCb *ue; /*!< Pointer to UECB */
-#ifdef LTE_ADV
- uint8_t sCellIdx; /*!< Serving Cell Index */
- uint16_t sCellId; /*!< Secondary Cell Id */
- RgSCellStateEnum sCellState; /* !< For holding the current state of the sec cell */
- CmLList sCellLnk; /*!< Node for adding this UE in secondary cell */
-#endif
- RgSchDlHqEnt *hqEnt; /*!< Downlink HARQ information for the UE */
- RgSchDlRbAlloc dlAllocCb; /*!< RB Allocation Info for Ded Trans/Retrans */
- RgSchCellCb *cell; /* !< Reference to sec Cell Cb */
- Void *sch; /*!< UE Specific Scheduler information */
- RgrUeTxModeCfg txMode; /*!< UE transmission mode in Secondary */
-#ifdef LTE_TDD
- RgSchTddANInfo *anInfo; /*!< ACK/NACK related Information */
- uint8_t nextFreeANIdx; /*!< Next Available ANInfo Index */
-
-#endif
- uint8_t reqForCqi; /*!< set to True if Aperiodic CQI from UE is required */
-#ifdef TFU_UPGRADE
- RgSchUeACqiCb acqiCb; /* ! < Aperiodic CQI Report Control Block*/
- RgSchUePCqiCb cqiCb; /*!< Periodic CQI PMI RI Control Block */
- TknUInt8 pA; /* PA value configured by RRM
- ref: RRC 36.331, 6.3.2, PDSCH-Config*/
- /* RgSchUeRawCqiBitWidthInfo rawCqiBitW[MAX_CQI_RI_RPT_BUFF]; */
-#endif
- uint8_t cqiRiWritIdx; /*!< write index to be used whenever CQI/RI reception
- request is being filled*/
- uint8_t cqiRiReadIdx; /*!< Read index to be used whenevr CQI/RI indication
- is recieved from PHY*/
- CmTimer deactTmr; /*!< SCell deactivation timer */
- CmTimer actDelayTmr; /*!< SCell timer */
-
-};
-
-
-
-/* CaDev end */
-
-
-
-/**
- * @brief
- * Downlink control block for UE specific information.
- */
-typedef struct rgSchUeDlCb
-{
- RgSchUeDlTaCb taCb; /*!< Downlink timing adjustment information for the
-UE */
- RgSchDlLcCb *lcCb[RGSCH_MAX_LC_PER_UE];/*!< Dedicated Downlink logical channels in
-UE */
- RgrUeDlCqiCfg ueDlCqiCfg; /*!< UE DL CQI config */
- uint8_t dlInactvMask; /*!< Bitmask indicating if UE is inactive for DL scheduling */
- RgSchCqiReqField reqForCqi; /*!< set to True if Aperiodic CQI from UE is required */
- Bool pCqiPrsnt; /*!< set to True if periodic CQI from UE is expected */
- Bool acqiResGrntd; /*!< Aperiodic CQI resources granted in RB Estimation */
- CmLList dlInactvLnk; /*!< Link to the inactive UE List for DL */
-#ifdef LTE_TDD
- RgrTddAckNackMode ackNackMode; /*!< ACK/NACK Bundling/ ACK/NACK Multiplexing */
-#endif
- /* Added support for SPS*/
-#ifdef LTEMAC_SPS
- RgrUeSpsDlCfg dlSpsCfg; /*!< DL SPS configuration information */
- Bool isSpsHqPInUse; /*!< Indicates if SPS HARQ procs are in use
- or are to be used for SPS
- transmissions */
- RgSchPdcch spsOccPdcch; /*!< PDCCH information for SPS ocassion */
-#endif
- /* CA dev Start */
- uint8_t numHqDlSfInfo;
-#ifdef LTE_TDD
- RgSchDlHqInfo *dlSfHqInfo;
-#else
-#ifdef RG_5GTF
- /* 5GTF TODO : Hard setting number of CCs to 3 */
- RgSchDlHqInfo dlSfHqInfo[MAX_5GTF_CELL][RGSCH_NUM_DL_slotS];
-#else
- RgSchDlHqInfo dlSfHqInfo[RGSCH_NUM_DL_slotS];
-#endif
-#endif
- /* Moved from rgSchCmnDlUe to Here, as this shouldn't be present per cell*/
- uint32_t ambrCfgd; /*!< UE's configured AMBR scaled to Refresh Cycle */
- /* CA dev End */
- /* Added to restrict max TB Bits in case of more than one CCs for a UE */
- uint32_t aggTbBits; /*!< Aggregated Transport Block Bits this UE can receive per TTI*/
- CmLteTimingInfo lstSchTime; /*!< Last Time UE got Scheduled */
-
-} RgSchUeDlCb;
-
-
-
-#ifdef LTEMAC_HDFDD
-
-/******************************************************************************
- * Start of Data declarations *
- ******************************************************************************/
-/**
- @brief Half Duplex subframtion information stored per ue. */
-
-typedef struct rgSchUeHdFddSfInfo
-{
- uint16_t sfn; /*!< Store the sfn for updated state
- Default Value= 0xffff
- */
- uint8_t subFrmDir;
- /*!< 0x00= DFLT
- 0x01= DL DATA +(OPT:CNTRL INFO)
- 0x02= DL CNTRL
- 0x04= UL DATA+(OPT: CTNRL INFO)
- */
-
-}RgSchUeHdFddSfInfo;
-
-/**
- @brief Half Duplex control related information per ue. */
-
-typedef struct rgSchUeHdFddCb
-{
- RgSchUeHdFddSfInfo subfrm[RG_SCH_HDFDD_NUMSFINFO];
-
-}RgSchUeHdFddCb;
-#endif /* LTEMAC_HDFDD */
-
-
-/** @brief This structure is part of rgSchUeCb structure and stored DRX related
- * information for a UE.
- */
-typedef struct rgSchDrxUeCb
-{
-#ifdef LTEMAC_R9
- TknS32 cqiMask; /*!<If pres, only value supported is SETUP i.e 0 */
-#endif
- Bool srRcvd; /*!< TRUE if SR is received from the UE. */
- Bool raRcvd; /*!< TRUE if Random access request is received using a
- dedicated preamble for this UE. */
- uint16_t onDurTmrLen; /*!< Length of onDuration Timer [1 - 200]. */
- uint16_t drxStartOffset; /*!< Value of the DRX Starting Offset [0 - 2559]. */
- S16 onDurExpDistance; /*!< Keeps track of actual distance */
-
- uint16_t drxRetransTmrLen; /*!< Length of DRX Retransmission timer [1 - 33].*/
-
- uint16_t inactvtyTmrLen; /*!< Length of drx-Inactivity Timer [1 - 2560]. */
- S16 drxInactDistance; /*!< Keeps track of actual distance */
-
- Bool isLongCycle;
- uint16_t longDrxCycle; /*!< Value of the DRX long cycle [10 - 2560]. */
-
- Bool isShortCycleCfgd; /*!< TRUE if short cycle is enabled. */
- uint8_t shortCycleTmrLen; /*!< Value of DRX short cycle Timer [1-16]. */
- uint16_t shortDrxCycle; /*!< Value of the DRX short cycle [2 - 640]. */
- S16 drxShortCycleDistance; /*!< Keeps track of actual distance */
-
-
- CmLList onDurationEnt; /*!< Entry into the OnDuration List. */
- CmLList onDurationExpEnt; /*!< Entry into the onDuration Expiry List. */
- CmLList inActvTmrEnt; /*!< Entry into the inactivity Timer list. */
- CmLList shortCycleEnt; /*!< Entry into HARQ Retransmission list. */
-
- S16 distance; /*!< Keeps track of actual distance */
-
-/* The following elements track current indices into the drxQ present at the
- * cell level. These indicies help in fast deletion in case of UE Delete,
- * otherwise it might have required a linear search. */
- uint16_t onDurIndx; /*!< The current index for onDuration Queue. */
- uint16_t onDurExpIndx; /*!< The current index for onDuration Queue. */
- uint16_t drxInactvIndx; /*!< The current index for drx-InactityTmr Queue. */
- uint16_t shortCycleIndx; /*!< The current index for Short Cycle Queue. */
-
- uint8_t shortCycleTmr; /*!< Counter to keep track of Short DRX Cycle. */
- uint32_t drxDlInactvMask; /*!< Downlink Mask to track InActivity */
- uint32_t drxUlInactvMask; /*!< Uplink Mask to track InActivity */
- uint32_t drxDlInactvMaskPerCell[CM_LTE_MAX_CELLS]; /*!< Downlink Mask to track InActivity per cell */
- uint32_t drxUlInactvMaskPerCell[CM_LTE_MAX_CELLS]; /*!< Uplink Mask to track InActivity per cell */
-} RgSchDrxUeCb;
-
-
-
-/* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
-typedef struct RgSchCqiInfo
-{
- uint8_t cqiCount; /* To keep track of CQI reports
- received so far */
- RgrUeCqiRept cqiRept[RGR_CQIRPTS_MAXN]; /* Array to maintain CQI reports */
-}RgSchCqiInfo;
-
-
-#endif
-
-/* LTE_ADV_FLAG_REMOVED_START */
-
-/* @brief Control block for LTE Advance Feature for UE */
-typedef struct rgSchLteAdvUeCb
-{
- RgrLteAdvancedUeConfig rgrLteAdvUeCfg; /*< RGR Configuration of LTE Adv */
- Bool isCCUePHigh; /* CC user gets high power after RNTP info */
-} RgSchLteAdvFeatureUeCb;
-/* LTE_ADV_FLAG_REMOVED_END */
-
-/*<! Sizes of DCI 0/1/1A/2/2A */
-typedef struct rgSchUeDciSize {
-#ifdef EMTC_ENABLE
- uint8_t cmnSize[TFU_DCI_FORMAT_6_2+1]; /*!< DCI 0/1A/6-0A/6-1A final size in common Search Space and scrambled by C-RNTI */
- uint8_t dedSize[TFU_DCI_FORMAT_6_2+1]; /*!< DCI 0/1/1A/2/2A/6-0A/6-1A final size in UE Search Space and scrambled by C-RNTI */
-#else
- uint8_t cmnSize[TFU_DCI_FORMAT_1A+1]; /*!< DCI 0/1A final size in common Search Space and scrambled by C-RNTI */
- uint8_t dedSize[TFU_DCI_FORMAT_2A+1]; /*!< DCI 0/1/1A/2/2A final size in UE Search Space and scrambled by C-RNTI */
-#endif
- uint8_t noUlCcSize[TFU_DCI_FORMAT_2A+1]; /*!< DCI 1/1A final size in UE/Common Search Space when the cell
- is SCell and no corresponding UL CC configured */
-} RgSchUeDciSize;
-
-#ifdef RG_PFS_STATS
-typedef struct rgSchPerRefreshStats {
- uint32_t remGbr;
- uint32_t remDeltaMbr;
- uint32_t totByteSchd;
- uint32_t lcSchdOcc;
-}RgSchPerRefreshStats;
-
-typedef struct rgSchLcStats
-{
- //Bool isLcCntSet;
- //uint32_t schdOccCnt;
- uint32_t ueSchdOcc[CM_LTE_MAX_CELLS];
- uint32_t gbrSatisfiedCnt;
- Bool ignoredFirstRefresh;
- uint32_t gbrRefreshCycleCnt;
- uint32_t totGbrBytesSchd;
- uint32_t totMbrBytesSchd;
- uint32_t achvdFracDataRate;
- Bool isRecvdBo;
-#define RGSCH_NUM_STATS_PER_REFRESH 50
- uint32_t startIdx;
- uint32_t lastIdx;
- uint32_t favCellCnt[CM_LTE_MAX_CELLS];
- RgSchPerRefreshStats perRefresh[RGSCH_NUM_STATS_PER_REFRESH];
-}RgSchLcStats;
-
-typedef struct rgSchCqiStats
-{
- uint32_t totalCqiOcc;
- uint32_t avgCqi;
-}RgSchCqiStats;
-
-typedef struct rgSchPfsStats
-{
- RgSchLcStats lcStats[RGSCH_MAX_LC_PER_UE];
- //uint32_t ueSchdOcc[CM_LTE_MAX_CELLS];
- uint32_t refreshCycleCnt;
- RgSchCqiStats cqiStats[CM_LTE_MAX_CELLS];
- Bool isCaUe;
-}RgSchPfsStats;
-#endif
-
-#ifdef RG_5GTF
-/**
- * @brief
- * UE control block for UE specific information for 5gtf.
- */
-typedef struct rgSch5gtfUeCb
-{
- uint8_t grpId; // Group Id
- uint8_t BeamId; // Beam Id of UE
- uint8_t numCC; // num Carrier configured for UE
- uint8_t mcs; // MCS configured
- uint8_t maxPrb; // Max Prb configured for UE
- CmLteTimingInfo nxtCqiRiOccn; /*!< Next CQI RI Occn */
- uint16_t cqiRiPer; /*!< CQI RI periodicity in SFs */
- uint8_t rank; /*!< Latest Rank Report from UE */
-}RgSch5gtfUeCb;
-#endif
-
-/**
- * @brief
- * UE control block for UE specific information.
- */
-struct rgSchUeCb
-{
- uint32_t totalBo; /*!<Sum of DL BO across all logical channels*/
- uint32_t totalPrbRequired;/*!<Num of PRB reqd to satisfy DL totlBo*/
- /* Added support for SPS*/
-#ifdef LTEMAC_SPS
- CmHashListEnt spsUeLstEnt; /*!< Hash List entity for UE List */
- uint32_t spsOccasionCnt; /*!< Total number of SPS occasion cnt*/
-#endif
-#ifdef CQI_CONFBITMASK_DROP
- uint8_t cqiConfBitMask;
- uint8_t prevCqi;
-#endif
- RgSchRntiLnk *rntiLnk; /*!< Link to RNTI for the UE */
- CmLteRnti ueId; /*!< UE identifier */
- RgSchUeMimoInfo mimoInfo; /*!< MIMO related information for a UE */
- /* Added support for SPS*/
-#ifdef LTEMAC_SPS
- CmLteRnti spsRnti; /*!< Configured value for spsRnti if SPg
- is enabled for the UE */
- /* TODO antz - put all relPdcch related info in a struct */
- CmLteTimingInfo relPdcchTxTime; /*!< Time at which release pdcch is
- transmitted */
-#ifdef LTE_TDD
- uint8_t relPdcchValm; /*!< 'm' for relPdcch */
-#endif
- CmLteTimingInfo relPdcchFbkTiming;/*!< Release PDCCH feedback timing for
- the UE: value used by DHM */
-#endif
- RgSchCellCb *cell; /*!< Cell to which this UE belongs */
-#ifdef XEON_SPECIFIC_CHANGES
- Void *sch; /*!< UE Specific Scheduler information */
-#endif
- RgSchUeUlCb ul; /*!< UE Specific Uplink information */
- RgSchUeDlCb dl; /*!< UE Specific Downlink information */
- CmLteTimingInfo datIndTime;/*!< Timing info of the last received Dat
- indication */
- CmLteTimingInfo macCeRptTime;/*!< Timing info of the last received
- * MAC CE (BSR/PHR) */
- uint32_t y[RGSCH_NUM_SUB_FRAMES]; /*!< 'Y' values calculated
- using C-RNTI and subframe
- no based on formula
- present in sec 9.1.1 of
- 3GPP 36.313*/
-
- CmLList taLnk; /*!< To link to the taUeLst list */
- CmLList dlTaLnk; /*!< To link to the Dl SCHED's taLst */
- CmTimer taTmr; /*!< Timer for Timing Alignment */
- RgSchUeMeasGapCb measGapCb; /*!< Measurement gap control block */
- RgSchUeAckNakRepCb ackNakRepCb; /*!< Ack-Nack Repetition control block */
-#ifdef LTE_ADV
- CmLList sCellActLnk; /*!< To link to the Dl SCHED's
- ScellActivation List */
-#endif
-
-#ifdef RGR_V1
- /* Added periodic BSR timer */
- CmTimer bsrTmr; /*!< BSR timer expiry handling case */
- /* CR timer implementation changes*/
- CmLList ccchSduLnk; /*!< To link raCb to the "to be
- scheduled"
- list
- */
- struct
- {
- uint32_t bo; /*!< Buffer occupancy for
- CCCH */
- } dlCcchInfo; /*!< Params for DL
- CCCH */
-#else
-
- CmTimer bsrTmr; /*!< BSR timer expiry handling case */
-#endif
-/* Added changes of TFU_UPGRADE */
-#ifdef TFU_UPGRADE
- CmLteUeCategory ueCatEnum;
- /* Moved to SCellInfo*/
-// RgSchUeACqiCb acqiCb; /* ! < Aperiodic CQI Report Control Block*/
- /* Periodic CQI/SRS/SR Report Feature */
- RgSchUeSrsCb srsCb; /*!< SRS Control Block*/
- RgSchUeSrCb srCb; /*!< SR Control Block */
-#endif
-
-#ifdef LTEMAC_HDFDD
- /* Half Duplex Feature */
- Bool hdFddEnbld; /*!< Half Duplex FDD is configured TRUE=1/FALSE=0 */
- RgSchUeHdFddCb *hdFddCb; /*!< Half Duplex Control Block */
-#endif /* LTEMAC_HDFDD */
-/* Added changes of TFU_UPGRADE */
- Bool isDrxEnabled; /*!< isDrx Enabled for this UE?*/
- RgSchDrxUeCb *drxCb; /*!< DRX control block. Allocated at time of
- UE configuration. */
- CmLList ulDrxInactvLnk; /*!<List of UE's which become inactive for UL */
- CmLList dlDrxInactvLnk; /*!<List of UE's which become inactive for DL */
-
- CmLList ulDrxInactvTmrLnk; /*!<List of UEs on which inactivity
- tmr has to be started for UL */
- CmLList dlDrxInactvTmrLnk; /*!<List of UEs on which inactivity
- tmr has to be started for DL */
-#ifdef TFU_UPGRADE
-
- uint8_t validTxAnt; /*! < Tx Antenna selected after computing the CQI among two Antennas*/
-
- uint8_t cqiRiWritIdx; /*!< write index to be used whenever CQI/RI reception
- request is being filled*/
- uint8_t cqiRiReadIdx; /*!< Read index to be used whenevr CQI/RI indication
- is recieved from PHY*/
- RgSchUeRawCqiBitWidthInfo rawCqiBitW[MAX_CQI_RI_RPT_BUFF];
- uint8_t initNumRbs; /* No. of RBs allocated for UL Data New Transmission */
-#endif
-
-/* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
- RgrUeCqiReptCfg cqiReptCfgInfo; /* Holds static information such
- as configured values for DL
- Power Control*/
-#endif
-#ifdef TFU_UPGRADE
-#endif
-/* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
- RgSchCqiInfo schCqiInfo; /* This structure is place holder for
- keeping all CQI reporting related information */
-#endif
-/* LTE_ADV_FLAG_REMOVED_START */
- RgSchLteAdvFeatureUeCb lteAdvUeCb; /* LTE-Advanced control block for UE */
-/* LTE_ADV_FLAG_REMOVED_END */
-
-
-#ifdef LTE_L2_MEAS
- uint8_t qciActiveLCs[LRG_MAX_QCI]; /* This structure has number of active LCs per
- Qci for this UE */ /* L2_COUNTERS */
- uint16_t ulActiveLCs; /* This is a bitmask - Each bit representing a QCI
- LSB - QCI 1 ... When bit is set, UE has an active
- LC for that QCI */
- uint16_t lastDatIndLCs; /* This is a bitmask - Each bit representing a QCI
- for which Data for received in UL
- LSB - QCI 1 ... When bit is set, UE has an active
- LC for that QCI */
-#endif
- Bool isMsg4PdcchWithCrnti; /* This is to aid rgNumMsg4PdcchWithCrnti counter which counts
- num of PDCCH scrambled with CRNTI for CRNTI Based contention resolution */
- Bool isSrGrant; /*!< This is to aid Counter to check number of successful SR Grants SR_RACH_STATS*/
- Bool txModeTransCmplt; /*!< Flag to confirm TM Mode
- transition completion*/
- CmTimer txModeTransTmr; /*!< Timer for TxMode transition Completion */
-#ifdef RGSCH_SPS_STATS
- CmLteTimingInfo lastSpsLcBoRptTime;
- CmLteTimingInfo lastSpsLcSchedTime;
- uint64_t absTimeBo;
- uint64_t absTimeSched;
-#endif
- uint8_t refreshOffset; /*!< UE referesh offset */
- uint8_t csgMmbrSta; /*!< CSG Membership status configured */
-#ifdef TENB_STATS
- TSL2UeStatsCb *tenbStats; /*!< UE Stats Holder */
-#endif
- CmLListCp flowCntrlLcLst;/*!< Dedicated Downlink logical channels in UE for Flow Control*/
- CmLList ueFlowCntrlEnt;/*!<UE lnk to the flow control Lst*/
-
- RgSchLcgCb *repLcg;/*!<representative LCG of the UE in UL */
-#ifdef XEON_SPECIFIC_CHANGES
- CmLteTimingInfo riRecpTime; /*! To idnentify Ri wrap arround during PUSCH and
- PUCCH reception filling */
-#endif
-#ifdef LTE_ADV
- TknUInt32 sCellDeactTmrVal; /* !< SCell Deactivation Timer Value */
- uint8_t f1bCsAVal; /* !< A value mentioned in table 10.12.2.1-1 of 36.213. This will tell
- the max number of tbs possible based on TM mode of each configured
- scell. It is used only for F1B with channel selection*/
-#endif
-/*f1b_Sprint3*/
- RgSchSCellN1ResCb n1PucchF1bResCb; /*!< N1 resouurce Cb for F1b Channel selection */
- RgSchSCellN3ResCb n3PucchResCb;
- RgrSchFrmt1b3TypEnum uciFrmtTyp; /*!< Store value of format1bcs or format3.It
- is updated from upper layer*/
-/*f1b_Sprint3*/
- uint8_t numSCells; /* !< number of configured SCells */
- uint8_t cellIdToCellIdxMap[CM_LTE_MAX_CELLS]; /*!< Mapping info of Cell Id to Cell Idx */
-
- RgSchUeCellInfo *cellInfo[CM_LTE_MAX_CELLS]; /*!< DL Sec Cell Information */
-#ifdef TFU_UPGRADE
- RgSchUePCqiCb *nPCqiCb; /*!< Pointer to Periodic Cqi CB for which next CQI is expected*/
- RgSchUePCqiCb *nPRiCb; /*!< Pointer to Periodic Cqi CB for which next RI is expected*/
-#endif
- uint8_t remBoCnt; /*!< count of occurence when BO is not fullfilled
- in a TTI */
- uint8_t *zeroBoCnt; /*!< pointer of count of occurence when BO is
- Zero */
-#ifdef LTE_ADV
- Bool isScellExplicitDeAct; /*!< TRUE when SCELL deactivation timer is Infinity/Not configured */
- Bool allocCmnUlPdcch; /*!< If this flag is TRUE, allocate PDCCH from Common
- search space */
- uint8_t simulAckNackCQIFormat3; /* !< Flag for simultanious A/N and CQI on PUCCH Format 3 */
-#endif
- RgSchUeDciSize dciSize; /*!< DCI Sizes */
- RgrAccessStratumRls accessStratumRls; /*!< UE Release */
-#ifdef RG_PFS_STATS
- RgSchPfsStats pfsStats;
-#endif
-#ifdef EMTC_ENABLE
- Bool isEmtcUe; /*!< flag to check EMTC UE */
- Void *emtcUeInfo; /*!< EMTC UE specific information */
-#endif
-#ifdef RG_5GTF
- RgSch5gtfUeCb ue5gtfCb; /*!< UECb of 5gtf */
-#endif
-};
-
-
-/**
- * @brief
- * Configuration Information for Upper SAPs at RGU, CRG and RGR interfaces.
- */
-typedef struct rgSchUpSapCfgInfo
-{
- Pst sapPst; /*!< Post info associated with SAP */
- SpId spId; /*!< SpId associated with SAP */
- SuId suId; /*!< SuId associated with SAP */
-}RgSchUpSapCfgInfo;
-
-/**
- * @brief
- * Configuration Information for Lower SAP at TFU interface.
- */
-typedef struct rgSchLowSapCfgInfo
-{
- Pst sapPst; /*!< Post info associated with SAP */
- SpId spId; /*!< SpId associated with SAP */
- SuId suId; /*!< SuId associated with SAP */
- TmrCfg bndTmr; /*!< Bind Timer Value */
-}RgSchLowSapCfgInfo;
-
-/**
- * @brief
- * Control Block structure for Upper SAPs at RGU, CRG and RGR interfaces.
- */
-typedef struct rgSchUpSapCb
-{
- RgSchUpSapCfgInfo sapCfg; /*!< Configuration info */
- RgSapSta sapSta; /*!< SAP Status */
- RgSchCellCb *cell; /*!< Cell associated with this sap */
-}RgSchUpSapCb;
-
-/**
- * @brief
- * Control Block structure for Lower SAP at TFU interface.
- */
-typedef struct rgSchLowSapCb
-{
- RgSchLowSapCfgInfo sapCfg; /*!< SAP configuration info */
- RgSapSta sapSta; /*!< SAP Status */
- uint8_t numBndRetries; /*!< Number of Bind Retries */
- RgSchCellCb *cell; /*!< Cell associated with this SAP */
- CmTimer tmrBlk; /*!< Timer Block associated with this SAP */
-}RgSchLowSapCb;
-
-/**
- * @brief
- * structure holding Layer Manager Response information cached from control
- * request.
- */
-typedef struct rgSchLmResponse
-{
- TranId transId; /*!< Transaction ID */
- Resp response; /*!< Response */
-}RgSchLmResponse;
-
-/* XXX: Below structures added for PDCCH Order req for RACH Module */
-typedef enum sfnEnum
-{
- RG_SCH_SFN_ANY,
- RG_SCH_SFN_ODD,
- RG_SCH_SFN_EVEN
-} SfnEnum;
-
-typedef struct rgSchConfigIdx
-{
- uint8_t configurationIndex; /* New RGR Cell cfg */
- SfnEnum sfn;
- uint8_t subframes[10];
-} RgSchConfigIdx;
-
-typedef struct rgSchRapId
-{
- uint8_t rapId;
- CmLteTimingInfo lastAllocPRACHMaskIdx;
-} RgSchRapId;
-
-typedef struct pdcchOrderCfg
-{
- RgSchRapId rapIds[RGSCH_MAX_RAPID];
- RgSchConfigIdx configIdx;
-} PdcchOrderCfg;
-/* XXX: End */
-
-/**
- @brief Measurement Gap related information per cell. */
-typedef struct rgSchMeasGapCb
-{
- CmLListCp gapPrd40Q[RG_SCH_CMN_MEAS_GAPPRD40]; /*!< Measurement Gap queue
- for UEs with 40 ms gap period */
- CmLListCp gapPrd80Q[RG_SCH_CMN_MEAS_GAPPRD80]; /*!< Measurement Gap queue
- for UEs with 80 ms gap period */
-} RgSchMeasGapCb;
-
-/**
- @brief ACK-NACK repetition related information per cell. */
-typedef struct rgSchAckNakRepCb
-{
-#ifdef LTE_TDD
- CmLListCp ackNakRepQ[2*RGSCH_NUM_SUB_FRAMES]; /*!< ACK NACK repetition queue */
-#else
- CmLListCp ackNakRepQ[RGSCH_NUM_SUB_FRAMES]; /*!< ACK NACK repetition queue */
-#endif
-} RgSchAckNakRepCb;
-/**
- * @brief
- * Structure holding RBG information for the BW
- */
-typedef struct rgSchBwRbgInfo
-{
- uint8_t numRbs; /*!< Total number of RBs for which information is
- stored */
- uint8_t numRbgs; /*!< Number of RBGs for the BW (rounded off to the
- closest RBG number */
- uint8_t rbgSize; /*!< RBG size */
- uint8_t lastRbgSize; /*!< Last RBG size : in number of RBs */
- uint8_t rbgSubsetSize[RG_SCH_NUM_RATYPE1_SUBSETS]; /*!< RBG Subset 0,1,2,3
- sizes: number of RBs
- */
-}RgSchBwRbgInfo;
-/** @brief This structure is one element of the DRX Queue mainted per cell.
- * @details It is composed of a list of linked lists, each tracking a specific
- * timer as defined in the DRX functionality.
- */
-typedef struct rgSchDrxQ
-{
- CmLListCp onDurationQ; /*!< Tracks the start of onDuration Timer. */
- CmLListCp onDurationExpQ; /*!< Tracks the Expiry of onDuration Timer. */
- CmLListCp inActvTmrQ; /*!< Tracks the Expiry of drx-InactivityTimer. */
- CmLListCp harqRTTQ; /*!< Tracks the Expiry of HARQ RTT timer. */
- CmLListCp harqRetxQ; /*!< Tracks the Expiry of Re-Transmission timer. */
- CmLListCp shortCycleQ; /*!< Tracks the Expiry of DRX Short Cycle. */
-#ifdef EMTC_ENABLE
- CmLListCp ulHarqRTTQ; /*!< Tracks the Expiry of HARQ RTT timer for Uplink transmission */
- CmLListCp ulHarqRetxQ; /*!< Tracks the Expiry of Re-Transmission timer for UPLINK. */
-#endif
-} RgSchDrxQ;
-
-/** @brief This structure is part of the RgSchCellCb structure and stores the
- * DRX related information for a cell.dfort
- * The cell contains a single Array of queues, wherein UEs shall be enqueued
- * based on configured offset and periodicity and timer values. Please note the
- * same queue is utilized for Long and Short DRX cycle.
- */
-typedef struct rgSchDRXCellCb
-{
- RgSchDrxQ drxQ[RG_SCH_MAX_DRXQ_SIZE ]; /*!< Maintains all
- the timers for DRX. */
- Bool delInUlScan; /*!< Maintains whether elements
- from timer queue should be
- removed while scanning in
- UL or DL.*/
-} RgSchDRXCellCb;
-
-
-/* Added for SI Enhancement*/
-#ifdef RGR_SI_SCH
-
-/* Sib1 info */
-typedef struct sib1Info
-{
- Buffer *sib1;
- uint8_t mcs;
- uint8_t nPrb;
- MsgLen msgLen;
-}RgSchSib1Info;
-
-/* SI info */
-typedef struct siInfo
-{
- Buffer *si;
- uint8_t mcs;
- uint8_t nPrb;
- MsgLen msgLen;
-}RgSchSiInfo;
-
-/**
- @brief SI Configuration information per cell. */
-typedef struct rgSchSiCfgInfo
-{
- Buffer *mib; /*!< MIB PDU */
- RgSchSib1Info sib1Info;
- RgSchSiInfo siInfo[RGR_MAX_NUM_SI];
-}RgSchSiCfgInfo;
-
-/**
- @brief SI Context information per SI. */
-typedef struct rgSchSiCtx
-{
- uint8_t siId; /*!< SI Id */
- CmLteTimingInfo timeToTx; /*!< Time at which the SI for this SI
- context need to be scheduled.*/
- CmLteTimingInfo maxTimeToTx;/*!< Max Time to TX for this SI */
- uint8_t retxCntRem; /*!< SI retransmit count remaining */
- uint16_t i; /*!< Value used to calculate the Riv of SI */
- Bool warningSiFlag; /*!< Flag for Warning SI */
-} RgSchSiCtx;
-
-
-/**
- @brief Contains each PDU of Warning SI */
-typedef struct warningSiPdu
-{
- CmLList lnk;
- Buffer *pdu;
- uint8_t mcs;
- uint8_t nPrb;
- MsgLen msgLen;
-}RgSchWarningSiPdu;
-
-
-/**
- @brief warningSi node having multiple segments */
-typedef struct warningSiSeg
-{
- /* ccpu00136659: CMAS ETWS design changes */
- CmLListCp segLstCp; /*!< LList of Warning SI Segments */
- RgSchWarningSiPdu pduNode[RGR_MAX_WARNING_SI_SEG];
- RgrCfgTransId transId; /*!< Transaction Id */
-}RgSchWarningSiSeg;
-
-/**
- @brief Warning SI structure per Cell. */
-typedef struct warningSi
-{
- /* ccpu00136659: CMAS ETWS design changes */
- RgSchWarningSiSeg warningSiMsg;
- /*!< Each node contains LList of si segments. */
- uint8_t siId; /*!< Warning SI ID */
- uint8_t idx; /*!< Warning SI Idx in RgSchWarningSiInfo */
-}RgSchWarningSiInfo;
-
-/**
- @brief SI Array Structure for each SI */
-typedef struct siArray
-{
- Bool isWarningSi; /*!< Flag for Warning SI */
- void *si; /*!< Pointer for SI */
-}
-RgSchSiArray;
-/**
- @brief SI Control BLock per Cell. */
-typedef struct rgSchSiCb
-{
- Bool siBitMask; /*!< Bitmask to indicate which of the SI
- components have been updated */
- RgSchSiCtx siCtx; /*!< SI Context */
- RgrSiCfg newSiCfg; /*!< New SI Configuration, valid if the
- respective bit is set in bit mask
- siBitMask */
- S8 inWindow; /*!< counter to indicate the start of a new
- si window. Reset to siWinLen at the start
- of window. */
- RgSchSiCfgInfo crntSiInfo;/*!< PDUs for current modification period */
- RgSchSiCfgInfo newSiInfo; /*!< PDUs for next modification period */
- RgSchWarningSiInfo warningSi[RGR_MAX_NUM_WARNING_SI];
- /*!< PDUs for warning SI */
- RgSchSiArray siArray[RGR_MAX_NUM_SI]; /*!< Pointers for SIs */
-} RgSchSiCb;
-#endif /*RGR_SI_SCH */
-/* R8 Upgrade */
-typedef struct rgSchBiInfo
-{
- uint16_t prevBiTime; /*!< Previous BI Value in ms Calculated and
- Sent in Previous Response */
- CmLteTimingInfo biTime; /*!< Time at which previous BI sent */
-} RgSchBiInfo;
-
-/* RRM_SP1_START */
-typedef struct rgSchQciPrbUsage
-{
- uint8_t qci; /*!< QCI of the Logical Channel */
- uint32_t dlTotPrbUsed; /*!< total PRB used for DL within one interval*/
- uint32_t ulTotPrbUsed; /*!< total PRB used for UL within one interval*/
-}RgSchQciPrbUsage;
-
-/* RRM_SP1_END */
-
-typedef struct rgSchPrbUsage
-{
- Bool prbRprtEnabld; /*!< reporting is enabled or not*/
- uint16_t rprtPeriod; /*!< reporting interval to send PRB usage to the
- RRM (in subframes)*/
- CmLteTimingInfo startTime; /*!< timing information when the summation is
- started in terms of sfn and subframe*/
-/* RRM_SP1_START */
- RgSchQciPrbUsage qciPrbRpts[RGINF_MAX_GBR_QCI_REPORTS]; /*!< toal
- PRB usgae for GBR
- QCIs */
-/* RRM_SP1_END */
-}RgSchPrbUsage;
-
-/* LTE_ADV_FLAG_REMOVED_START */
-/* @brief Enum to differntiate the subframe */
-/* Donot change the value of enum member - code dependency */
-typedef enum rgSchAbsSfEnum
-{
- RG_SCH_ABS_ENABLED_NONABS_SF = 0, /* ABS is enabled and ABS SF */
- RG_SCH_ABS_ENABLED_ABS_SF = 1, /* ABS is enabled and non ABS SF */
- RG_SCH_ABS_DISABLED = 2 /* ABS is disabled */
-} RgSchAbsSfEnum;
-
-/* @brief Control block for LTE Advance Feature */
-typedef struct rgSchLteAdvFeatureCb
-{
- RgrSfrConfig sfrCfg; /*!< Configuration of SFR feature */
- RgrDsfrConfig dsfrCfg; /*!< Configuration of DSFR feature */
- RgrAbsConfig absCfg; /*!< Configuration of ABS feature */
- RgSchAbsSfEnum absDlSfInfo; /*< Flag to indicate current scheduling
- DL subframe is ABS subframe or not */
- uint8_t absPatternDlIdx;
- uint32_t absLoadTtiCnt;
- uint32_t absLoadInfo[RGR_ABS_PATTERN_LEN];
-} RgSchLteAdvFeatureCb;
-/* LTE_ADV_FLAG_REMOVED_END */
-
-/*<! baseSize is the fixed sizes of the respective DCIs. If no other size
- * mentioned, baseSize is the final size of the DCI */
-typedef struct rgSchCellDciSize {
-#ifdef EMTC_ENABLE
- uint8_t baseSize[TFU_DCI_FORMAT_6_2+1]; /*!< Fixed Base Size of DCI 0/1/1A/6-0A/6-1A/6-0B/6-1B/6-2 without any adjustment */
- uint8_t size[TFU_DCI_FORMAT_6_2+1]; /*!< DCI 0/1A final size in common Search Space and not scrambled by C-RNTI
- DCi 3/3A final sizes
- DCI 2/2A final sizes
- DCI 6-0A/6-0B final sizes
- DCI 6-1A/6-1B final sizes
- DCI 6-2 final sizes */
-#else
- uint8_t baseSize[TFU_DCI_FORMAT_1A+1]; /*!< Fixed Base Size of DCI 0/1/1A without any adjustment */
- uint8_t size[TFU_DCI_FORMAT_3A+1]; /*!< DCI 0/1A final size in common Search Space and not scrambled by C-RNTI
- DCi 3/3A final sizes
- DCI 2/2A final sizes */
-#endif
- uint8_t dci0HopSize; /*!< DCI 0 Hop Size */
-} RgSchCellDciSize;
-
-/**
- * @brief
- * Cell level measurements
- */
-typedef struct rgSchMeasCb
-{
- uint32_t dlTpt; /*!< DL Bytes served in a fixed time PERIOD */
- uint32_t dlBytesCnt; /*!< DL Bytes served from start of this time period */
- uint32_t ulTpt; /*!< DL Bytes served in a fixed time PERIOD */
- uint32_t ulBytesCnt; /*!< UL Bytes served from start of this time period */
-}RgSchMeasCb;
-
-/**
- * @brief
- * Cell level thresholds
- */
-typedef struct rgSchThrsldsCb
-{
- uint8_t maxDlItbs;
- uint8_t maxUlItbs;
-}RgSchThrsldsCb;
-/**
- * @brief
- * CPU Overload control state info
- */
-typedef struct rgSchCpuOvrLdCntrlCb
-{
- uint8_t cpuOvrLdIns;
- uint32_t tgtDlTpt;
- uint32_t tgtUlTpt;
- uint8_t dlNxtIndxDecNumUeTti; /*!< Total DL num UE per TTI reduction instruction applied */
- uint8_t ulNxtIndxDecNumUeTti; /*!< Total UL num UE per TTI reduction instruction applied */
- uint8_t maxUeNewTxPerTti[10]; /*!< list of subframe where DL num UE per TTI reduction applied */
- uint8_t maxUeNewRxPerTti[10]; /*!< list of subframe where UL num UE per TTI reduction applied */
-}RgSchCpuOvrLdCntrlCb;
-
-/**
- * @brief
- * Cell Control block per cell.
- */
-struct rgSchCellCb
-{
- CmLteCellId cellId; /*!< Cell ID */
- Inst instIdx; /*!< Index of the scheduler instance */
- Inst macInst; /*!< Index of the MAC instance */
- uint8_t schTickDelta; /* 4UE_TTI_DELTA */
- Bool stopSiSch; /*!< If TRUE Bcch,Pcch Scheduling is not done */
- uint8_t stopDlSch; /*!< If TRUE DL scheduling is not done */
- Bool stopUlSch; /*!< If TRUE UL scheduling is not done */
- Bool isDlDataAllwd; /*!< FALSE for Uplink subframes */
- RgrDlHqCfg dlHqCfg; /*!< HARQ related configuration */
- RgSchRntiDb rntiDb; /*!< RNTIs DB: range of rntis to be managed by MAC */
- struct schdInfoS
- {
- Void *sch; /*!< Common Scheduler specific information */
- RgSchdApis *apis; /*!< Common Scheduler APIs */
- } sc;
-
- Bool isCpUlExtend; /*!< Cyclic prefix : TRUE-extended/FALSE-normal */
- Bool isCpDlExtend; /*!< Cyclic prefix : TRUE-extended/FALSE-normal */
- uint8_t numTxAntPorts; /*!< Number of Tx antenna ports */
- RgrBwCfg bwCfg; /*!< Bandwidth Configuration */
- uint8_t pbchRbStart; /*!< Indicates the Start RB of the center 6 RBs of DL BW */
- uint8_t pbchRbEnd; /*!< Indicates the Start RB of the center 6 RBs of DL BW */
- uint8_t numCellRSPerSf; /*!< Indicates the number of cell specific
- Reference symbols in a Subframe */
- RgrPhichCfg phichCfg; /*!< PHICH Config Information */
- RgrPucchCfg pucchCfg; /*!< PUCCH Config Information */
- RgSchSrsCfg srsCfg; /*!< SRS Config Information */
- RgrRachCfg rachCfg; /*!< RACH Configuration */
- /* R8 Upgrade */
- RgSchBiInfo biInfo; /* CELL wide BI Info */
- RgrSiCfg siCfg; /*!< SI Configuration */
- /* Added support for SPS*/
-#ifdef LTEMAC_SPS
- RgrPuschCfg puschCfg; /*!< Cell-specific hopping configuration */
-#endif
- RgrPreambleSetCfg macPreambleSet; /*!< Range of PDCCH Order Preamble Id's
- to be managed by MAC */
- CmLteTimingInfo crntTime; /*!< Current frame and subframe number for
- the cell */
- CmLteTimingInfo hiDci0Time; /*!< Scheduling SFN, SF for HIDCI-0 */
- CmLteTimingInfo hqRlsTime; /*!< SFN, SF for HARQ clean up */
- CmLteTimingInfo dlSfRlsTime; /*!< SFN, SF for Downlink subframe clean up*/
- CmLteTimingInfo dlDciTime; /*!< SFN, SF for DL control Request */
- CmLteTimingInfo rcpReqTime; /*!< SFN, SF for UL reception Request */
- RgSchCfgCfb rgCfgInfo; /*!< Control block for configuration related
- information */
- uint8_t ulCcchId; /*!< LcId for uplink CCCH */
- uint8_t dlCcchId; /*!< LcId for downlink CCCH */
- RgSchClcDlLcCb cmnLcCb[RGSCH_MAX_CMN_LC_CB]; /*!< BCCH/PCCH logical channel control block */
- CmHashListCp ueLst; /*!< Hash list of UE control
- blocks: RgSchUeCb */
- /* Added support for SPS*/
-#ifdef LTEMAC_SPS
- CmHashListCp spsUeLst; /*!< Hash list of UE control blocks
- for spsRnti: RgSchUeCb */
-#endif /* LTEMAC_SPS */
- CmLListCp taUeLst; /*!< List of ueCbs having ta */
-#ifdef RGR_V1
- /* CR timer changes*/
- CmLListCp ccchSduUeLst; /*!< List of ueCbs scheduled for CCCH
- SDU */
- CmLListCp contResGrdTmrLst; /*!< List of raCbs whose Guard timer is
- running */
- CmLListCp contResTmrLst; /*!< List of raCbs whose contention
- resolution timer is running */
-#endif
- RgSchRaInfoCb raInfo; /*!< Random access related information for
- cell */
- CmLListCp pdcchLst; /*!< List of free RgSchPdcch structures */
- CmTqCp tqCp;
- CmTqType tq[RGSCH_UE_TQ_SIZE];
- uint8_t crntSfIdx; /*!< Current index for allocation */
-#ifdef LTE_TDD
- RgInfSfAlloc sfAllocArr[RGSCH_SF_ALLOC_SIZE]; /*!< Subframe Allocation
- info to be sent to MAC */
-#else
- RgInfSfAlloc sfAllocArr[RGSCH_NUM_SUB_FRAMES]; /*!< Subframe Allocation
- info to be sent to MAC */
-#endif
- RgInfRlsHqInfo rlsHqArr[RGSCH_NUM_SUB_FRAMES]; /*!< Harq Release
- info to be sent to MAC */
- uint8_t crntHqIdx; /*!< Current index for Harq release info */
- RgSchLowSapCb *tfuSap;
-/* Added for sending TTI tick to RRM */
-#if (defined(RGR_RRM_TICK) || defined(RGR_CQI_REPT))
- RgSchUpSapCb *rgrSap; /*!< Pointer to the cell's RGR SAP
- Control Block */
-#endif
- RgSchUpSapCb *rgmSap; /*!< Pointer to the cell's RGM SAP
- Control Block */
-#ifdef RGR_RRM_TICK
- uint8_t rrmTtiIndPrd; /*!< Periodicity of TTI indication from
- MAC towards RGR user. Range [1-255]. A
- value of 1 means one tick per System
- Frame and 2 means one tick per 2 System
- Frame, and so on. */
-#endif
- PdcchOrderCfg pdcchOrdCfg;
- RgSchMeasGapCb measGapCb; /*!< Measurement gap control block */
- RgSchAckNakRepCb ackNakRepCb; /*!< Ack-Nack Repetition control block */
-#ifdef LTE_TDD
- RgSchTddRachRspLst *rachRspLst; /*!< List of awaiting RACH responses */
- uint8_t numDlSubfrms; /*!< Number of DL subframes */
- uint8_t ulDlCfgIdx; /*!< UL-DL Configuration Index */
- uint8_t ackNackFdbkArrSize; /*!< Maximum Number of Ack/Nack
- feedback information to be
- stored */
- S8 tddHqSfnCycle; /*!< Counter to keep track of the
- number of sfn,sf wrap arounds.
- This is used for UL harq
- determination. It ranges from
- 0 to num Ul Harq-1 */
- RgSchTddSplSubfrmCfg splSubfrmCfg; /*!< Special subframe configuration */
- Bool isDwPtsCnted; /*!< is DwPts counted as PDCCH sf */
- RgSchTddNpValTbl rgSchTddNpValTbl;/*!< Mapping between 'Np' and 'p' */
- RgSchDlSf **subFrms; /*!< DL subframes list */
- RgSchTddPrachRscInfo prachCfg; /*!< PRACH configuration */
- CmHashListCp ueTfuPendLst; /*!< Used for HARQ Ack/Nack
- Multiplexing */
- /* TODO:: change to array of pointers */
- CmLListCp n1ResUsedLst[RGSCH_NUM_SUB_FRAMES]; /*!< For storing the used
- N1 resources for scell in case of F1B CS */
-#else
- RgSchDlSf *subFrms[RGSCH_NUM_DL_slotS];
- uint16_t nCce;
-#endif
- RgSchDynCfiCb dynCfiCb; /*!< Dynamic CFI control block */
-/* Changes for MIMO feature addition */
- uint8_t noOfRbgs; /*!< Number of RBGs for this bw */
- uint8_t rbgSize; /*!< RBG Size */
- /* Added support for SPS*/
-#ifdef LTEMAC_SPS
- RgSchBwRbgInfo dlBwRbgInfo; /*!< RBG information for the configured
- DL BW */
- RgrSpsCellCfg spsCellCfg; /*!< SPS specific configuration for
- the cell */
- RgSchBwRbgInfo spsBwRbgInfo; /*!< RBG information for configured maximum
- SPS bandwidth */
-#endif
-#ifdef LTE_L2_MEAS
- RgSchRaPreambles raPrmbs; /*!< Different received RA preambles */
- RgSchAvgPrbDl avgPrbDl; /*!< PRB usage in percentage per QCI for DL */
- RgSchAvgPrbUl avgPrbUl; /*!< PRB usage in percentage per QCI for UL */
- CmLListCp l2mList; /*!< List of all L2M requests
- rgSchL2MeasCb */
- RgSchQciCb qciArray[LRG_MAX_QCI]; /*!< Array of all qci's configured
- rgSchQciCb */
- Bool sndL2Meas; /*!< send L2 Meas in case no le mesurement timer is running*/
- RgSchTbCnt dlUlTbCnt; /*!< Count of DL and UL TB transmitteed and Faulty
- TB (for wich NACK is received) */
-#endif /* LTE_L2_MEAS */
- uint8_t ulAvailBw; /*!< Total Uplink band width available
- for this sub frame */
-#ifdef TFU_UPGRADE
- RgSchPerPucchCb pCqiSrsSrLst[RG_SCH_PCQI_SRS_SR_TRINS_SIZE];
- /*!< To store next active Periodic CQI/PMI, RI,
- SRS and SR Transmission instance */
-#endif /* TFU_UPGRADE */
-
-#ifdef LTEMAC_HDFDD
- CmLListCp hdFddLst; /*!< Half Duplex FDD UE list */
-#endif /* LTEMAC_HDFDD */
- RgSchDRXCellCb *drxCb; /*!< Pointer to the DRX control block shall be
- allocated at the time of cell configuration. */
- /* Added for SI Enhancement*/
-#ifdef RGR_SI_SCH
- RgSchSiCb siCb; /*!< SI Control Block */
-#endif /*RGR_SI_SCH */
- RgSchPrbUsage prbUsage; /*!< measures average PRB usage for configured interval*/
- uint16_t t300TmrVal; /*!< t300Timer value configured in Frames */
-/* LTE_ADV_FLAG_REMOVED_START */
- TknStrOSXL rntpAggrInfo; /*!< RNTP Info */
- RgrLoadInfReqInfo loadInfReqInfo; /*!< Consists startRb & endRb
- location for which CC to
- be raised to P-High */
- RgSchLteAdvFeatureCb lteAdvCb; /*!< Control block for LTE Adv
- features */
-/* LTE_ADV_FLAG_REMOVED_END */
- uint32_t dlNumUeSchedPerTti[RG_MAX_NUM_UE_PER_TTI]; /*!<DL mUe/Tti histograms*/
- uint32_t ulNumUeSchedPerTti[RG_MAX_NUM_UE_PER_TTI]; /*!<UL mUe/Tti histograms*/
- Bool overLoadBackOffEnab; /*!< Overload Rach Backoff enable/disable */
- uint8_t overLoadBackOffval; /*!< Overload Rach BackOff value */
- uint8_t refreshUeCnt[RGSCH_MAX_REFRESH_OFFSET]; /*! To maintain number of UE refreshed per subframe */
- uint8_t minDlResNonCsg; /*!< Minimum DL resources reserved for Non CSG UEs */
- uint8_t minUlResNonCsg; /*!< Minimum UL resources reserved for CSG UEs */
- Bool isAutoCfgModeEnb; /*!< Indicates Auto config of TM mode is enabled or
- disabled. True - Enabled, False - Disabled */
- CmLListCp lcMonitorLst; /*LC Lst used for flow cntrl */
- uint32_t prbCnt; /*!<PRB usage in flow control interval*/
- uint32_t maxPrbCnt; /*!<Max PRB cnt after which Flow Cntrl
- can be triggered */
- RgSchCpuOvrLdCntrlCb cpuOvrLdCntrl; /*!< CPU Overload control state info */
- RgSchMeasCb measurements; /*!< Cell level measurements */
- RgSchThrsldsCb thresholds; /*!< Cell level thresholds */
-#ifdef TENB_STATS
- TSL2CellStatsCb *tenbStats; /*!< CELL Stats Holder */
-#endif
- RgSchCellDciSize dciSize;
-#ifdef LTE_ADV
- CmLListCp sCellUeLst; /*!< List of UEs for which this cell is secondary cell*/
- Bool isPucchFormat3Sptd;
-#endif
-#ifdef RG_PFS_STATS
- uint32_t totalPrb;
- uint32_t totalTime;
-#endif
- Void * laaCb;
-#ifdef EMTC_ENABLE
- /* TODO:: Below members need to be moved
- * to emtc specific files and have void *
- * here */
- uint8_t emtcEnable;
- Void *emtcCb;
- RgSchRntiDb emtcRntiDb; /*!< RNTIs DB: range of rntis to be managed by MAC */
-#endif
- RgSchIotResMngmtCb resMngmt;
-#ifdef RG_5GTF
- RgSch5gtfCellCb cell5gtfCb;
-#endif
-};
-
-/**
- * @brief
- * Structure holding LTE MAC's General Configuration information.
- */
-typedef struct rgSchGenCb
-{
- uint8_t tmrRes; /*!< Timer resolution */
- RgSchLmResponse *bndCfmResp; /*!< Respones value for Bind Confirm */
- RgSchLmResponse ustaResp; /*!< Respones value for Alarms */
- uint8_t startCellId; /*!< Starting Cell Id */
-#ifdef LTE_ADV
- Bool forceCntrlSrbBoOnPCel; /*!< value 1 means force scheduling
- of RLC control BO and SRB BO on
- PCell. val 0 means don't force*/
- Bool isSCellActDeactAlgoEnable; /*!< TRUE will enable activation/deactivation algo at Schd */
-#endif
-}RgSchGenCb;
-
-#ifdef RG_5GTF
-/* 5GTF Dynamic TDD Specific defines */
-
-/* Number of subframes information managed */
-#define RG_SCH_DYNTDD_MAX_SFINFO 20
-
-/* Subframe Types */
-#define RG_SCH_DYNTDD_NOTDEF 0
-#define RG_SCH_DYNTDD_DLC_DLD 1
-#define RG_SCH_DYNTDD_DLC_DLD_ULC 2
-#define RG_SCH_DYNTDD_DLC_ULD 3
-#define RG_SCH_DYNTDD_DLC_ULD_ULC 4
-
-/* Mark the subframe */
-#define RG_SCH_DYN_TDD_MARKTYPE(_dynTdd, _sfi, _state)\
-{\
- (_dynTdd)->sfInfo[(_sfi)].sfType = _state;\
-}
-
-/* Mark sfi as UL Subframe */
-#define RG_SCH_DYN_TDD_MARKTYPE_UL(_dynTdd, _sfi)\
-{\
- RG_SCH_DYN_TDD_MARKTYPE(_dynTdd, _sfi, RG_SCH_DYNTDD_DLC_ULD);\
-}
-
-/* Mark sfi as DL Subframe */
-#define RG_SCH_DYN_TDD_MARKTYPE_DL(_dynTdd, _sfi)\
-{\
- RG_SCH_DYN_TDD_MARKTYPE(_dynTdd, _sfi, RG_SCH_DYNTDD_DLC_DLD);\
-}
-
-/* Get SFI and SFN from given time and subframe offset */
-#define RG_SCH_DYN_TDD_GET_SFIDX(_sfi, _crntSfIdx, _offset)\
- (_sfi) = (_crntSfIdx + _offset)% RG_SCH_DYNTDD_MAX_SFINFO
-
-/**
- @brief Dynamic TDD subframe type. */
-
-typedef struct rgSchDynTddSfType
-{
- uint8_t sfType; /*!< 0= NOT Defined
- 1= DL Cntrl + DL Data
- 2= DL Cntrl + DL Data + UL Cntrl
- 3= DL Cntrl + UL Data
- 4= DL Cntrl + UL Data + UL Cntrl
- */
-
-}RgSchDynTddSfType;
-/**
- @brief Dynamic TDD control Block */
-
-typedef struct rgSchDynTddCb
-{
- Bool isDynTddEnbld; /*!< Is dynamic TDD enabled */
- uint8_t crntDTddSfIdx; /*!< Pivot Index corresponding
- cell's current subframe */
- RgSchDynTddSfType sfInfo[RG_SCH_DYNTDD_MAX_SFINFO];
-}RgSchDynTddCb;
-
-#endif
-
-/**
- * @brief
- * Global Control block for LTE-MAC.
- */
-struct _rgSchCb
-{
- TskInit rgSchInit; /*!< Task Init info */
- RgSchGenCb genCfg; /*!< General Config info */
- uint8_t numSaps; /*!< Num RGR Saps = Num TFU Saps */
- RgSchUpSapCb *rgrSap; /*!< RGR SAP Control Block */
- RgSchLowSapCb *tfuSap; /*!< TFU SAP Control Block */
- RgSchUpSapCb *rgmSap; /*!< TFU SAP Control Block */
- CmTqCp tmrTqCp; /*!< Timer Task Queue Cntrl Point */
- CmTqType tmrTq[RGSCH_TQ_SIZE]; /*!< Timer Task Queue */
- uint8_t rgSchDlDelta; /* 4UE_TTI_DELTA */
- uint8_t rgSchCmnDlDelta;
- uint8_t rgSchUlDelta;
- RgSchCellCb *cells[CM_LTE_MAX_CELLS]; /* Array to store cellCb ptr */
- RgrSchedEnbCfg rgrSchedEnbCfg; /*!< eNB level RR/PFS Config */
- Void *rgSchEnbPfsDl; /*!< eNB level PFS DL Block */
-
- Void * laaCb;
-#ifdef RG_5GTF
- RgSchDynTddCb rgSchDynTdd; /*!< Dynamic TDD Control Block */
-#endif
-};
-
-/* Declaration for scheduler control blocks */
-RgSchCb rgSchCb[RGSCH_MAX_INST];
-
-/*
- * Data structures for RAM
- */
-
-/**
- * @brief
- * Random Access Req Info to be stored in cellCb.
- */
-typedef struct rgSchRaReqInfo
-{
- CmLList raReqLstEnt; /*!< Linked list entity for RaReq List */
- CmLteTimingInfo timingInfo; /*!< RACHO: Time of RaReq Reception */
- RgTfuRaReqInfo raReq; /*!< Random Access Request Information */
- RgSchUeCb *ue; /*!< UECB if RAP ID is a dedicated one */
-} RgSchRaReqInfo;
-
-/**
- * @enum rgSchRaState
- * Enumeration of random access states.
- */
-typedef enum rgSchRaState
-{
- RGSCH_RA_MSG3_PENDING, /*!< Msg3 reception pending */
- RGSCH_RA_MSG4_PENDING, /*!< Msg4 transmission pending */
- RGSCH_RA_MSG4_DONE /*!< Msg4 transmission successful */
-} RgSchRaState;
-
-/**
- * @brief
- * Control block for Random Access.
- */
-struct rgSchRaCb
-{
- CmLList raCbLnk; /*!< To link to the raCb list */
- CmLList schdLnk; /*!< To link raCb to the "to be scheduled"
- list */
- CmLteRnti tmpCrnti; /*!< Temporary C-RNTI */
- CmLteTimingInfo timingInfo; /*!< Timing information */
- RgSchRntiLnk *rntiLnk; /*!< Link to RNTI for raCb */
- RgSchRaState raState; /*!< Random access state */
- struct
- {
- uint32_t bo; /*!< Buffer occupancy for CCCH */
- } dlCcchInfo; /*!< Params for DL CCCH */
- uint8_t msg3HqProcId; /*!< Msg3 Harq Process ID */
- /*ccpu00128820 - DEL - msg3HqProcRef is delete for Msg3 alloc double delete issue*/
- RgSchUlHqProcCb msg3HqProc; /*!< msg3HqProcRef points to this initially */
- RgSchUeCb *ue; /*!< NULL initially */
- Bool toDel; /*!< To delete this RaCb after msg4 reject */
- TknUInt8 phr; /*!< To store the PHR, if received along with
- Msg3 */
- CmLList rspLnk; /*!< Used to link RACB to a frame for resp */
- uint8_t rapId; /*!< RAP ID */
- TknUInt16 ta; /*!< Timing Adjustment */
- RgSchUlGrnt msg3Grnt; /*!< Msg3 grant as given by the UL Sched */
- uint32_t y[RGSCH_NUM_SUB_FRAMES]; /*!< y values using tmpCrnti by DLSCHED */
- RgSchDlHqEnt *dlHqE; /*!< DL HARQ module */
- uint8_t ccchCqi; /*!< DL Cqi obtained from RaReq and Used for CCCH */
- RgSchDlRbAlloc rbAllocInfo; /*!< RB Allocation Info for MSG4 Trans/Retrans */
- /* PHR handling for MSG3 */
- CmLteTimingInfo msg3AllocTime; /*!< Allocation time for msg3 grant */
-#ifdef RGR_V1
- /* CR timer changes*/
- CmLList contResTmrLnk; /*!< To link raCb to the
- Guard Timer/Contention Resolution timer list*/
- CmLteTimingInfo expiryTime; /*!< Expiry time for Guard/Contention
- Resolution timers */
-
- uint32_t ccchSduBo; /*!<To store CCCH SDU BO if it arrives while
- ContRes CE is transmitting or retransmitting*/
-#endif
-#ifdef EMTC_ENABLE
- Bool isEmtcRaCb; /*!< 0 - Normal, 1 - EMTC */
- Void *emtcRaInfo;
-#endif
-};
-
-/**
- * @brief
- * Carries the Error information.
- */
-struct rgSchErrInfo
-{
- uint8_t errType; /*!< Error Type */
- uint16_t errCause; /*!< Cause of Error */
-};
-
-/* Global Variables */
-#ifdef LTE_TDD
-
-#ifdef LTEMAC_SPS
-uint8_t rgSchTddSpsDlMaxRetxTbl[RGSCH_MAX_TDD_UL_DL_CFG];
-#endif
-typedef uint8_t RgSchTddUlDlSubfrmTbl[RGSCH_MAX_TDD_UL_DL_CFG][RGSCH_NUM_SUB_FRAMES];
-RgSchTddUlDlSubfrmTbl rgSchTddUlDlSubfrmTbl;
-
-typedef struct rgSchTddSplSubfrmInfo RgSchTddSplSubfrmInfoTbl[RGSCH_MAX_TDD_SPL_SUBFRM_CFG];
-RgSchTddSplSubfrmInfoTbl rgSchTddSplSubfrmInfoTbl;
-
-typedef struct rgSchTddDlAscSetIdxK RgSchTddDlAscSetIdxKTbl[RGSCH_MAX_TDD_UL_DL_CFG][RGSCH_NUM_SUB_FRAMES];
-RgSchTddDlAscSetIdxKTbl rgSchTddDlAscSetIdxKTbl;
-/* ccpu00132282 */
-RgSchTddDlAscSetIdxKTbl rgSchTddDlHqPucchResCalTbl;
-
-typedef uint8_t RgSchTddPhichMValTbl[RGSCH_MAX_TDD_UL_DL_CFG][RGSCH_NUM_SUB_FRAMES];
-RgSchTddPhichMValTbl rgSchTddPhichMValTbl;
-
-typedef uint8_t RgSchTddKPhichTbl[RGSCH_MAX_TDD_UL_DL_CFG][RGSCH_NUM_SUB_FRAMES];
-RgSchTddKPhichTbl rgSchTddKPhichTbl;
-
-typedef RgSchTddPhichOffInfo RgSchTddPhichOffInfoTbl[RGSCH_MAX_TDD_UL_DL_CFG][RGSCH_NUM_SUB_FRAMES];
-
-typedef uint8_t RgSchTddUlAscIdxKDashTbl[RGSCH_MAX_TDD_UL_DL_CFG-1][RGSCH_NUM_SUB_FRAMES];
-RgSchTddUlAscIdxKDashTbl rgSchTddUlAscIdxKDashTbl;
-
-#ifdef LTEMAC_SPS
-typedef uint8_t RgSchTddInvDlAscSetIdxTbl[RGSCH_MAX_TDD_UL_DL_CFG][RGSCH_NUM_SUB_FRAMES];
-RgSchTddInvDlAscSetIdxTbl rgSchTddInvDlAscSetIdxTbl;
-#endif
-
-typedef uint8_t RgSchTddPuschTxKTbl[RGSCH_MAX_TDD_UL_DL_CFG][RGSCH_NUM_SUB_FRAMES];
-RgSchTddPuschTxKTbl rgSchTddPuschTxKTbl;
-
-typedef uint8_t RgSchTddUlNumHarqProcTbl[RGSCH_MAX_TDD_UL_DL_CFG];
-RgSchTddUlNumHarqProcTbl rgSchTddUlNumHarqProcTbl;
-
-typedef uint8_t RgSchTddDlNumHarqProcTbl[RGSCH_MAX_TDD_UL_DL_CFG];
-RgSchTddDlNumHarqProcTbl rgSchTddDlNumHarqProcTbl;
-
-/* Number of ACK/NACK Feedback to be stored based on UL-DL Configuration Index */
-typedef uint8_t RgSchTddANFdbkMapTbl[RGSCH_MAX_TDD_UL_DL_CFG];
-RgSchTddANFdbkMapTbl rgSchTddANFdbkMapTbl;
-
-/* Number of UL subframes */
-typedef RgSchTddSubfrmInfo RgSchTddMaxUlSubfrmTbl[RGSCH_MAX_TDD_UL_DL_CFG];
-RgSchTddMaxUlSubfrmTbl rgSchTddMaxUlSubfrmTbl;
-
-/* Number of UL subframes */
-typedef uint8_t RgSchTddNumUlSubfrmTbl[RGSCH_MAX_TDD_UL_DL_CFG][RGSCH_NUM_SUB_FRAMES];
-RgSchTddNumUlSubfrmTbl rgSchTddNumUlSubfrmTbl;
-
-/* Number of low UL subframes Indices*/
-typedef uint8_t RgSchTddLowUlSubfrmIdxTbl[RGSCH_MAX_TDD_UL_DL_CFG][RGSCH_NUM_SUB_FRAMES];
-RgSchTddLowUlSubfrmIdxTbl rgSchTddLowUlSubfrmIdxTbl;
-
-/* Number of high UL subframes Indices*/
-typedef uint8_t RgSchTddHighUlSubfrmIdxTbl[RGSCH_MAX_TDD_UL_DL_CFG][RGSCH_NUM_SUB_FRAMES];
-RgSchTddHighUlSubfrmIdxTbl rgSchTddHighUlSubfrmIdxTbl;
-
-/* Number of low DL subframes Indices*/
-typedef uint8_t RgSchTddLowDlSubfrmIdxTbl[RGSCH_MAX_TDD_UL_DL_CFG][RGSCH_NUM_SUB_FRAMES];
-RgSchTddLowDlSubfrmIdxTbl rgSchTddLowDlSubfrmIdxTbl;
-
-/* Number of high DL subframes Indices*/
-typedef uint8_t RgSchTddHighDlSubfrmIdxTbl[RGSCH_MAX_TDD_UL_DL_CFG][RGSCH_NUM_SUB_FRAMES];
-RgSchTddHighDlSubfrmIdxTbl rgSchTddHighDlSubfrmIdxTbl;
-
-/* Number of DL subframes and Special subframes with DwPTS */
-typedef uint8_t RgSchTddNumDlSubfrmTbl[RGSCH_MAX_TDD_UL_DL_CFG][RGSCH_NUM_SUB_FRAMES];
-RgSchTddNumDlSubfrmTbl rgSchTddNumDlSubfrmTbl;
-
-/* Number of DL subframes and Special subframes with DwPTS */
-typedef RgSchTddSubfrmInfo RgSchTddMaxDlSubfrmTbl[RGSCH_MAX_TDD_UL_DL_CFG];
-RgSchTddMaxDlSubfrmTbl rgSchTddMaxDlSubfrmTbl;
-
-typedef uint8_t RgSchTddMsg3SubfrmTbl[RGSCH_MAX_TDD_UL_DL_CFG][RGSCH_NUM_SUB_FRAMES];
-RgSchTddMsg3SubfrmTbl rgSchTddMsg3SubfrmTbl;
-#ifdef LTEMAC_SPS
-typedef RgSchTddMsg3SubfrmTbl RgSchTddSpsUlRsrvTbl;
-RgSchTddMsg3SubfrmTbl rgSchTddSpsUlRsrvTbl;
-#endif
-
-typedef uint8_t RgSchTddRlsDlSubfrmTbl[RGSCH_MAX_TDD_UL_DL_CFG][RGSCH_NUM_SUB_FRAMES];
-RgSchTddRlsDlSubfrmTbl rgSchTddRlsDlSubfrmTbl;
-
-
-uint8_t rgSchTddPucchTxTbl[RGSCH_MAX_TDD_UL_DL_CFG][RGSCH_NUM_SUB_FRAMES];
-
-#endif
-#ifdef LTE_ADV
-RgSchCellCb* rgSchUtlGetCellCb ARGS((
-Inst inst,
-uint16_t cellId
-));
-
-Void rgSCHSCellDlUeReset ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-
-Void rgSCHSCellDlLcCfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *svc
-));
-
-Void rgSCHSCellDlLcDel ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *svc
-));
-
-Void rgSCHSCellDlDedBoUpd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *svc
-));
-
-Void rgSCHSCellSchdActDeactCe ARGS((
-RgSchUeCb *ueCb,
-RgSchDlHqTbCb *tbInfo
-));
-
-Void rgSCHSCellAddToActDeactLst ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-
-Void rgSCHSCellRmvFrmActLst ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-S16 rgSCHSCellIsActive ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-
-
-
-Void rgSCHSCellHndlFdbkInd ARGS((
-RgSchDlHqProcCb *hqP,
-uint8_t tbIdx,
-uint8_t fdbk,
-Bool maxHqRetxReached
-));
-
-Void rgSCHSCellDeactTmrExpry ARGS((
-RgSchUeCellInfo *sCell
-));
-
-S16 rgSCHSCellTrigActDeact ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ueCb,
-uint8_t sCellIdx,
-uint8_t action
-));
-
-S16 rgSCHSCellDelUe ARGS((
-RgSchCellCb *cellCb,
-RgSchUeCb *ueCb
-));
-
-Bool rgSCHIsActvReqd ARGS ((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-
-Void rgSCHSCellSelectAndActDeAct ARGS ((
-RgSchCellCb *PCell,
-RgSchUeCb *ueCb,
-uint8_t action
-));
-
-S16 rgSCHSCellPCqiCfg ARGS((
-RgSchCellCb *priCellCb,
-RgSchCellCb *secCellCb,
-RgSchUeCb *ueCb,
-RgrUePrdDlCqiCfg *cqiCfg,
-CmLteUeCategory ueCat,
-uint8_t sCellIdx
-));
-
-Void rgSCHUtlSndUeSCellDel2Mac ARGS ((
-RgSchCellCb *cell,
-CmLteRnti rnti
-));
-
-uint8_t rgSCHUtlGetMaxTbSupp ARGS ((
-RgrTxMode txMode
-));
-#endif/*LTE_ADV*/
-
-/* APIs exposed by TMR module */
-Void rgSCHTmrStartTmr ARGS((
- RgSchCellCb *cellCb,
- Ptr cb,
- S16 tmrEvnt,
- uint32_t tmrVal));
-
-Void rgSCHTmrStopTmr ARGS((
- RgSchCellCb *cellCb,
- S16 tmrEvnt,
- Ptr cb));
-
-Void rgSCHTmrProcTmr ARGS((
- Ptr cb,
- S16 tmrEvnt));
-
-/* APIs exposed by TOM */
-
-S16 rgSCHTomRaReqInd ARGS((
- RgSchCellCb *cell,
- TfuRaReqIndInfo *raReqInd));
-
-S16 rgSCHTomPucchDeltaPwrInd ARGS((
- RgSchCellCb *cell,
- TfuPucchDeltaPwrIndInfo *pucchDeltaPwr));
-
-S16 rgSCHTomUlCqiInd ARGS((
- RgSchCellCb *cell,
- TfuUlCqiIndInfo *ulCqiInd));
-
-S16 rgSCHTomSrInd ARGS((
- RgSchCellCb *cell,
- TfuSrIndInfo *srInd));
-
-S16 rgSCHTomDlCqiInd ARGS((
- RgSchCellCb *cell,
- TfuDlCqiIndInfo *dlCqiInd));
-/* Added changes of TFU_UPGRADE */
-#ifdef TFU_UPGRADE
-S16 rgSCHTomRawCqiInd ARGS
-((
-RgSchCellCb *cell,
-TfuRawCqiIndInfo* rawCqiInd
-));
-
-S16 rgSCHTomSrsInd ARGS
-((
-RgSchCellCb *cell,
-TfuSrsIndInfo* srsInd
-));
-
-#endif
-
-S16 rgSCHTomDoaInd ARGS((
- RgSchCellCb *cell,
- TfuDoaIndInfo *doaInd));
-S16 rgSCHTomCrcInd ARGS((
- RgSchCellCb *cell,
- TfuCrcIndInfo *crcInd));
-
-S16 rgSCHTomHarqAckInd ARGS((
- RgSchCellCb *cell,
- TfuHqIndInfo *harqAckInd));
-
-S16 rgSCHTomTimingAdvInd ARGS((
- RgSchCellCb *cell,
- TfuTimingAdvIndInfo *timingAdvInd));
-
-
-/*
- * APIs exposed by LMM
- */
-S16 rgSCHLmmStartTmr ARGS ((Inst instId, S16 tmrEvnt,
- uint32_t tmrVal, PTR cb));
-S16 rgSCHLmmStopTmr ARGS((Inst instId, S16 tmrEvnt, PTR cb));
-S16 rgSCHLmmTmrExpiry ARGS((PTR cb, S16 tmrEvnt));
-/* This function invokes a Control Confirmation to the LM from scheduler. */
-S16 rgSCHLmmBndCfm ARGS((Pst *pst, SuId suId, uint8_t status));
-S16 schActvTmr ARGS((Ent entity, Inst inst));
-/* To send a Unsolicited Status Indication to Layer Manager */
-S16 rgSCHLmmStaInd ARGS((Inst instId, uint16_t category, uint16_t event,
- uint16_t cause, RgUstaDgn *dgn));
-S16 schActvTsk ARGS((Pst *pst, Buffer *mBuf));
-Void SchFillCfmPst ARGS((Pst *reqPst,Pst *cfmPst,RgMngmt *cfm));
-uint16_t SchInstCfg ARGS((RgCfg *cfg, Inst inst));
-Void printSchCellInfo ARGS((Void));
-Void rgSCHLmmGenCntrl ARGS((RgMngmt *cntrl,RgMngmt *cfm,Pst *cfmPst));
-Void rgSCHLmmSapCntrl ARGS((RgMngmt *cntrl,RgMngmt *cfm,Pst *cfmPst));
-
-#ifdef EMTC_ENABLE
-S16 rgSCHCfgEmtcCellCfg ARGS ((RgSchCellCb *cell,
- RgrEmtcCellCfg *emtcCellCfg));
-S16 rgSCHCfgVldtRgrEmtcCellCfg ARGS ((RgrCellCfg *cellCfg));
-
-Void rgSchTomTtiEmtcSched ARGS((RgSchCellCb *cell));
-S16 rgSCHCfgVldtEmtcUeCfg ARGS((RgSchCellCb *cell, RgrUeEmtcCfg *emtcUeCfg));
-S16 rgSCHUtlUpdUeEmtcInfo ARGS((RgSchCellCb *cell, RgrUeCfg *ueCfg, RgSchUeCb *ueCb));
-S16 rgSCHEmtcCellDel ARGS((RgSchCellCb *cell));
-S16 rgSCHEmtcUeDel ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
-S16 rgSCHEmtcHdFddUeCfg ARGS((RgSchCellCb *cellCb,RgSchUeCb *ueCb,Bool hdFddEnbl));
-
-#endif
-/*
- * APIs exposed by CFG module
- */
-S16 rgSCHCfgVldtRgrCellCfg ARGS((Inst inst, RgrCellCfg *cellCfg,
- RgSchCellCb *cell, RgSchErrInfo *errInfo));
-S16 rgSCHCfgRgrCellCfg ARGS((RgSchCb *instCb, SpId spId,
- RgrCellCfg *cellCfg, RgSchErrInfo *errInfo));
-S16 rgSCHCfgRgrSchedEnbCfg ARGS((Inst inst, SpId spId,
- RgrSchedEnbCfg *schedEnbCfg, RgSchErrInfo *errInfo));
-S16 rgSCHCfgVldtRgrCellRecfg ARGS((Inst inst, RgrCellRecfg *cellRecfg,
- RgSchCellCb **cell, RgSchErrInfo *errInfo));
-S16 rgSCHCfgRgrCellRecfg ARGS((RgSchCellCb *cell, RgrCellRecfg *cellRecfg,
- RgSchErrInfo *errInfo));
-
-S16 rgSCHCfgVldtRgrUeCfg ARGS((Inst inst, RgrUeCfg *ueCfg,
- RgSchCellCb **cell, RgSchErrInfo *errInfo));
-S16 rgSCHCfgRgrUeCfg ARGS((RgSchCellCb *cell, RgrUeCfg *ueCfg,
- RgSchErrInfo *errInfo));
-S16 rgSCHCfgVldtRgrUeRecfg ARGS((Inst inst, RgrUeRecfg *ueRecfg,
- RgSchCellCb **cell, RgSchUeCb **ue, RgSchErrInfo *errInfo));
-S16 rgSCHCfgRgrUeRecfg ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgrUeRecfg
- *ueRecfg, RgSchErrInfo *errInfo));
-
-S16 rgSCHCfgVldtRgrLcCfg ARGS((Inst inst, RgrLchCfg *lcCfg,
- RgSchCellCb **cell, RgSchUeCb **ue, RgSchErrInfo *errInfo));
-S16 rgSCHCfgRgrLchCfg ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgrLchCfg *lcCfg, RgSchErrInfo *errInfo));
-S16 rgSCHCfgVldtRgrLchRecfg ARGS((Inst inst, RgrLchRecfg *lcRecfg,
- RgSchCellCb **cell, RgSchUeCb **ue, RgSchDlLcCb **dlLc,
- RgSchErrInfo *errInfo));
-S16 rgSCHCfgRgrLchRecfg ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgSchDlLcCb *dlLc, RgrLchRecfg *lcRecfg, RgSchErrInfo *errInfo));
-
-S16 rgSCHCfgVldtRgrLcgRecfg ARGS ((Inst inst,RgrLcgRecfg *lcgRecfg,
- RgSchCellCb *cell,RgSchUeCb **ue,RgSchErrInfo *errInfo ));
-S16 rgSCHCfgVldtRgrLcgCfg ARGS ((Inst inst,RgrLcgCfg *lcgCfg,
- RgSchCellCb **cell,RgSchUeCb **ue,RgSchErrInfo *errInfo ));
-S16 rgSCHCfgVldtRgrSchedEnbCfg ARGS ((Inst inst,
- RgrSchedEnbCfg *schedEnbCfg, RgSchErrInfo *errInfo ));
-S16 rgSCHCfgRgrLcgCfg ARGS ((RgSchCellCb *cell,RgSchUeCb *ue,
- RgrLcgCfg *lcgCfg,RgSchErrInfo *errInfo ));
-S16 rgSCHCfgRgrLcgRecfg ARGS ((RgSchCellCb *cell,RgSchUeCb *ue,
- RgrLcgRecfg *lcgRecfg,RgSchErrInfo *errInfo));
-
-S16 rgSCHCfgVldtRgrUeReset ARGS((Inst inst, RgrRst *reset, RgSchCellCb *cell,
- RgSchUeCb **ue,RgSchErrInfo *errInfo));
-S16 rgSCHCfgRgrUeReset ARGS((RgSchCellCb *cell,RgSchUeCb *ue,RgrRst *reset,
- RgSchErrInfo *errInfo));
-
-S16 rgSCHCfgRgrCellDel ARGS((RgSchCellCb *cell, RgrDel *cellDelInfo,
- RgSchErrInfo *errInfo));
-S16 rgSCHCfgRgrUeDel ARGS((RgSchCellCb *cell, RgrDel *ueDelInfo,
- RgSchErrInfo *errInfo));
-S16 rgSCHCfgRgrLcDel ARGS((RgSchCellCb *cell, RgrDel *lcDelInfo,
- RgSchErrInfo *errInfo));
-S16 rgSCHCfgRgrLcgDel ARGS ((RgSchCellCb *cell,RgrDel *lcDelInfo,
- RgSchErrInfo *errInfo));
-Void rgSCHCfgFreeCellCb ARGS((RgSchCellCb *cell));
-/* Added for SI Enhancement*/
-#ifdef RGR_SI_SCH
-S16 rgSCHCfgVldtRgrSiCfg ARGS(( Inst inst, RgrSiCfgReqInfo *siCfg,
- RgSchCellCb *cell, RgSchErrInfo *errInfo));
-S16 rgSCHGomHndlSiCfg ARGS(( Region reg, Pool pool,
- RgSchCb *instCb, SpId spId,
- RgrCfgTransId transId, RgrSiCfgReqInfo *cfgReqInfo));
-S16 rgSCHUtlRgrSiCfgCfm ARGS ((Inst inst, SpId spId,
- RgrCfgTransId transId,uint8_t status));
-
-S16 rgSCHGomHndlWarningSiCfg ARGS(( Region reg, Pool pool,
- RgSchCb *instCb, SpId spId, RgrCfgTransId transId,
- RgrWarningSiCfgReqInfo *warningSiCfgReqInfo));
-
-Void rgSCHGomHndlWarningSiStopReq ARGS(( Region reg, Pool pool,
- RgSchCb *instCb, uint8_t siId,
- RgrCfgTransId transId, SpId spId));
-
-S16 rgSCHUtlRgrWarningSiCfgCfm ARGS ((Inst inst, SpId spId, uint8_t siId,
- RgrCfgTransId transId,uint8_t status));
-#endif /* RGR_SI_SCH */
-/* LTE_ADV_FLAG_REMOVED_START */
-S16 rgSchDSFRRntpInfoInit ARGS ((TknStrOSXL *rntpPtr, RgSchCellCb *cell,
- uint16_t bw));
-S16 rgSchDSFRRntpInfoFree ARGS ((TknStrOSXL *rntpPtr, RgSchCellCb *cell,
- uint16_t bw));
-S16 rgSchUpdtRNTPInfo ARGS ((RgSchCellCb *cell, RgSchDlSf *sf,
- RgrLoadInfReqInfo *loadInfReq));
-S16 rgSCHCfgVldtRgrLoadInf ARGS(( Inst inst, RgrLoadInfReqInfo *loadInfReq,
- RgSchCellCb *cell, RgSchErrInfo *errInfo));
-S16 rgSCHGomHndlLoadInf ARGS(( Region reg, Pool pool,
- RgSchCb *instCb, SpId spId,
- RgrCfgTransId transId, RgrLoadInfReqInfo *cfgReqInfo));
-/* LTE_ADV_FLAG_REMOVED_END */
-
-/*
- * APIs exposed by GOM module
- */
-S16 rgSCHGomHndlCfg ARGS((Pst *pst, RgSchCb *instCb,
- RgrCfgTransId transId, RgrCfgReqInfo *cfgReqInfo));
-S16 rgSCHGomTtiHndlr ARGS((RgSchCellCb *cell, SpId spId));
-
-
-/*
- * APIs exposed by RAM module
- */
-S16 rgSCHRamVldtUeCfg ARGS((
-RgSchCellCb *cell,
-RgrUeCfg *ueCfg
-));
-S16 rgSCHRamProcRaReq ARGS((uint8_t raReqCnt, RgSchCellCb *cell, CmLteRnti raRnti,
- TfuRachInfo *raReqInd,
- CmLteTimingInfo timingInfo,
- RgSchUeCb *ue,
- RgSchErrInfo *err));
-S16 rgSCHRamCreateRaCb ARGS((RgSchCellCb *cell, RgSchRaCb **raCb,
- RgSchErrInfo *err));
-S16 rgSCHRamRgrUeCfg ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgSchRaCb *raCb, RgSchErrInfo *err));
-S16 rgSCHRamProcMsg3 ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgSchRaCb *raCb, RgInfUeDatInd *pdu,
- RgSchErrInfo *err));
-S16 rgSCHRamUpdtBo ARGS((RgSchCellCb *cell, RgSchRaCb *raCb,
- RgInfCmnBoRpt *staRsp));
-S16 rgSCHRamMsg3DatInd ARGS((RgSchRaCb *raCb));
-S16 rgSCHRamMsg3FailureInd ARGS((RgSchRaCb *raCb));
-S16 rgSCHRamMsg4FdbkInd ARGS((RgSchRaCb *raCb));
-S16 rgSCHRamMsg4Done ARGS((RgSchCellCb *cell, RgSchRaCb *raCb));
-S16 rgSCHRamDelRaCb ARGS((RgSchCellCb *cell, RgSchRaCb *raCb,
- Bool rlsRnti));
-S16 rgSCHRamFreeCell ARGS((RgSchCellCb *cell));
-S16 rgSCHRamTtiHndlr ARGS((RgSchCellCb *cell));
-Void rgSCHCmnUlSch ARGS((RgSchCellCb *cell));
-Void rgSCHCmnDlCommonChSch ARGS ((RgSchCellCb *cell));
-#ifdef RGR_V1
-/* Added periodic BSR timer */
-S16 rgSCHCmnBsrTmrExpry ARGS(( RgSchUeCb *ueCb));
-#endif
-#ifdef LTE_TDD
-S16 rgSCHRamDelRaReq ARGS((RgSchCellCb *cell,
- CmLteTimingInfo timingInfo,
- uint8_t raIdx));
-#endif
-S16 rgSCHRamAddToRaInfoSchdLst(RgSchCellCb *cell, RgSchRaCb *raCb);
-
-S16 rgSCHRamRmvFrmRaInfoSchdLst(RgSchCellCb *cell, RgSchRaCb *raCb);
-
-/* APIs exposed by UHM */
-/* Added for Uplink Adaptive retransmission */
-Void rgSCHUhmNonadapRetx ARGS((RgSchUlHqProcCb *hqProc));
-S16 rgSCHUhmHqEntInit ARGS ((RgSchCellCb *cellCb, RgSchUeCb *ueCb));
-#ifndef MAC_SCH_STATS
-Void rgSCHUhmProcDatInd ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- CmLteTimingInfo frm));
-#else /* MAC_SCH_STATS */
-Void rgSCHUhmProcDatInd ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- CmLteTimingInfo frm, uint8_t cqi));
-#endif
-Void rgSCHUhmProcMsg3DatInd ARGS((RgSchUlHqProcCb *hqProc));
-Void rgSCHUhmProcMsg3Failure ARGS((RgSchUlHqProcCb *hqProc));
-#ifndef MAC_SCH_STATS
-Void rgSCHUhmProcHqFailure ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- CmLteTimingInfo frm, TknUInt8 rv));
-#else /* MAC_SCH_STATS */
-Void rgSCHUhmProcHqFailure ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- CmLteTimingInfo frm, TknUInt8 rv, uint8_t cqi));
-#endif
-RgSchUlHqProcCb* rgSCHUhmGetUlHqProc ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- uint8_t idx));
-Void rgSCHUhmNewTx ARGS((RgSchUlHqProcCb *hqProc, uint8_t maxHqRetx,
- RgSchUlAlloc *alloc));
-Void rgSCHUhmFreeProc ARGS((RgSchUlHqProcCb *hqProc,
- RgSchCellCb *cell));
-Void rgSCHUhmRetx ARGS((RgSchUlHqProcCb *hqProc, RgSchUlAlloc *alloc));
-Void rgSCHUhmRgrUeCfg ARGS(( RgSchCellCb *cellCb, RgSchUeCb *ueCb,
- RgrUeCfg *ueCfg));
-Void rgSCHUhmRgrUeRecfg ARGS(( RgSchCellCb *cellCb, RgSchUeCb *ueCb,
- RgrUeRecfg *ueRecfg));
-Void rgSCHUhmFreeUe ARGS(( RgSchCellCb *cellCb, RgUeUlHqCb *hqEnt));
-S16 rgSCHUhmAppendPhich ARGS(( RgSchCellCb *cellCb,
- CmLteTimingInfo frm, uint8_t idx));
-
-/* APIs exposed by DBM */
-S16 rgSCHDbmInitCell ARGS((RgSchCellCb *cellCb));
-S16 rgSCHDbmDeInitUeCbLst ARGS(( RgSchCellCb *cellCb));
-#ifdef LTE_TDD
-S16 rgSCHDbmDeInitUeTfuPendLst ARGS(( RgSchCellCb *cellCb));
-#endif
-S16 rgSCHDbmInsUeCb ARGS(( RgSchCellCb *cellCb, RgSchUeCb *ueCb));
-RgSchUeCb* rgSCHDbmGetUeCb ARGS(( RgSchCellCb *cellCb, CmLteRnti ueId));
-RgSchUeCb* rgSCHDbmGetNextUeCb ( RgSchCellCb *cellCb, RgSchUeCb *ueCb);
-S16 rgSCHDbmDelUeCb ARGS(( RgSchCellCb *cellCb, RgSchUeCb *ueCb));
-#ifdef LTE_L2_MEAS
-S16 rgSCHDbmDelL2MUe ARGS(( RgSchCellCb *cellCb, RgSchUeCb *ueCb));
-#endif
-S16 rgSCHDbmInitUe ARGS((RgSchUeCb *ueCb));
-Void rgSCHDbmInsDlDedLcCb ARGS((RgSchUeCb *ueCb, RgSchDlLcCb *dlLcCb));
-Void rgSCHDbmDelDlDedLcCb ARGS((RgSchUeCb *ueCb, RgSchDlLcCb *dlLcCb));
-RgSchDlLcCb* rgSCHDbmGetDlDedLcCb ARGS(( RgSchUeCb *ueCb, CmLteLcId idx));
-RgSchDlLcCb* rgSCHDbmGetFirstDlDedLcCb ARGS((RgSchUeCb *ueCbb));
-RgSchDlLcCb* rgSCHDbmGetNextDlDedLcCb ARGS((RgSchUeCb *ueCb, RgSchDlLcCb *lcCb));
-RgSchClcDlLcCb* rgSCHDbmGetCmnLcCb ARGS(( RgSchCellCb *cellCb, CmLteLcId lcId));
-RgSchClcDlLcCb* rgSCHDbmGetBcchOnBch ARGS(( RgSchCellCb *cellCb ));
-RgSchClcDlLcCb* rgSCHDbmGetFirstBcchOnDlsch ARGS(( RgSchCellCb *cellCb));
-RgSchClcDlLcCb* rgSCHDbmGetSecondBcchOnDlsch ARGS(( RgSchCellCb *cellCb));
-RgSchClcDlLcCb* rgSCHDbmGetPcch ARGS(( RgSchCellCb *cellCb));
-Void rgSCHDbmInsBcchOnBch ARGS(( RgSchCellCb *cellCb, RgSchClcDlLcCb *cmnDlLcCb));
-Void rgSCHDbmInsBcchOnDlsch ARGS(( RgSchCellCb *cellCb, RgSchClcDlLcCb *cmnDlLcCb));
-Void rgSCHDbmInsPcch ARGS(( RgSchCellCb *cellCb, RgSchClcDlLcCb *cmnDlLcCb));
-
-Void rgSCHDbmInitCmnLcBoLst ARGS(( RgSchClcDlLcCb *cmnDlLcCb));
-Void rgSCHDbmInsCmnLcBoRpt ARGS(( RgSchClcDlLcCb *cmnDlLcCb,
- RgSchClcBoRpt *cmnBoRpt));
-RgSchRaCb* rgSCHDbmGetRaCb ARGS(( RgSchCellCb *cellCb, CmLteRnti key));
-Void rgSCHDbmInsCrntRgrCfgElem ARGS(( RgSchCellCb *cellCb,
- RgSchCfgElem *cfgElem));
-Void rgSCHDbmInsPndngRgrCfgElem ARGS(( RgSchCellCb *cellCb,
- RgSchCfgElem *cfgElem));
-RgSchCfgElem* rgSCHDbmGetNextCrntRgrCfgElem ARGS(( RgSchCellCb *cellCb,
- RgSchCfgElem *cfgElem));
-RgSchCfgElem* rgSCHDbmGetNextPndngRgrCfgElem ARGS(( RgSchCellCb *cellCb,
- RgSchCfgElem *cfgElem));
-RgSchCfgElem* rgSCHDbmGetPndngRgrCfgElemByKey ARGS(( RgSchCellCb *cellCb,
- CmLteTimingInfo key));
-RgSchCfgElem* rgSCHDbmDelCrntRgrCfgElem ARGS(( RgSchCellCb *cellCb,
- RgSchCfgElem *cfgElem));
-RgSchCfgElem* rgSCHDbmDelPndngRgrCfgElem ARGS(( RgSchCellCb *cellCb,
- RgSchCfgElem *cfgElem));
-
-S16 rgSCHDbmRntiDbInit ARGS(( RgSchCellCb *cellCb, uint16_t rntiStart, uint16_t maxRntis));
-Void rgSCHDbmRntiDbDeInit ARGS(( RgSchCellCb *cellCb));
-RgSchRntiLnk* rgSCHDbmGetRnti ARGS(( RgSchCellCb *cellCb));
-Void rgSCHDbmRlsRnti ARGS(( RgSchCellCb *cellCb, RgSchRntiLnk *rntiLnk));
-/* Fix : syed HO UE does not have a valid ue->rntiLnk */
-Void rgSCHUtlIndRntiRls2Mac ARGS(( RgSchCellCb *cell, CmLteRnti rnti,
- Bool ueIdChng, CmLteRnti newRnti));
-
-/*rg008.201 - Added support for SPS*/
-#ifdef LTEMAC_SPS
-S16 rgSCHDbmDeInitSpsUeCbLst ARGS((RgSchCellCb *cellCb));
-S16 rgSCHDbmInsSpsUeCb ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb));
-RgSchUeCb* rgSCHDbmGetSpsUeCb ARGS((RgSchCellCb *cellCb, CmLteRnti ueId));
-RgSchUeCb* rgSCHDbmGetNextSpsUeCb ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb));
-S16 rgSCHDbmDelSpsUeCb ARGS((RgSchCellCb *cellCb,RgSchUeCb *ueCb));
-#endif /* LTEMAC_SPS */
-
-#ifdef LTE_L2_MEAS
-/*
- * L2M APIs
- */
-S16 rgSchL2mMeasReq ARGS ((
- RgSchCellCb *cell,
- LrgSchMeasReqInfo *measInfo,
- RgSchErrInfo err));
-S16 RgSchMacL2MeasSend ARGS
-((
-Pst* pst,
-RgInfL2MeasSndReq *measInfo
-));
-
-S16 RgSchMacL2MeasStop ARGS
-((
-Pst* pst,
-RgInfL2MeasStopReq *measInfo
-));
-#endif /* LTE_L2_MEAS */
-/*
- * DHM APIs
- */
-/* LTE_ADV_FLAG_REMOVED_START */
-S16 rgSchSFRTotalPoolInit ARGS((RgSchCellCb *cell, RgSchDlSf *sf));
-/* LTE_ADV_FLAG_REMOVED_END */
-Void rgSCHDhmHqPAdd2FreeLst ARGS (( RgSchDlHqProcCb *hqP));
-Void rgSCHDhmHqPAdd2InUseLst ARGS (( RgSchDlHqProcCb *hqP));
-Void rgSCHDhmHqPDelFrmFreeLst ARGS (( RgSchDlHqProcCb *hqP));
-Void rgSCHDhmHqPDelFrmInUseLst ARGS (( RgSchDlHqProcCb *hqP));
-
-RgSchDlHqEnt *rgSCHDhmHqEntInit ARGS((RgSchCellCb *cell));
-S16 rgSCHDhmGetAvlHqProc ARGS((RgSchCellCb *cell, RgSchUeCb *ue, CmLteTimingInfo timingInfo,
- RgSchDlHqProcCb **hqP));
-Void rgSCHDhmHqRetx ARGS((RgSchDlHqEnt *hqE, CmLteTimingInfo timeInfo,
- RgSchDlHqProcCb *hqP));
-RgSchDlHqProcCb * rgSCHDhmLastSchedHqProc ARGS((RgSchDlHqEnt *hqE));
-/* CR timer changes*/
-S16 rgSCHDhmGetCcchSduHqProc ARGS((RgSchUeCb *ueCb, CmLteTimingInfo timeInfo,
- RgSchDlHqProcCb **hqP));
-S16 rgSCHDhmGetMsg4HqProc ARGS((RgSchRaCb *raCb, CmLteTimingInfo timeInfo));
-Void rgSCHDhmRlsHqProc ARGS((RgSchDlHqProcCb *hqP));
-/* ccpu00118350 : Correcting NDI manipulation of Harq */
-Void rgSCHDhmRlsHqpTb ARGS((RgSchDlHqProcCb *hqP, uint8_t tbIdx, Bool togNdi));
-Void rgSCHUtlDlHqPTbAddToTx ARGS((RgSchDlSf *subFrm,
-RgSchDlHqProcCb *hqP, uint8_t tbIdx ));
-Void rgSCHDhmHqTbRetx ARGS(( RgSchDlHqEnt *hqE,
-CmLteTimingInfo timingInfo, RgSchDlHqProcCb *hqP, uint8_t tbIdx));
-Void rgSCHUtlDlHqPTbAddToTx ARGS((RgSchDlSf *subFrm,
-RgSchDlHqProcCb *hqP, uint8_t tbIdx ));
-Void rgSCHDhmHqTbRetx ARGS(( RgSchDlHqEnt *hqE,
-CmLteTimingInfo timingInfo, RgSchDlHqProcCb *hqP, uint8_t tbIdx));
-#ifdef RG_UNUSED
-S16 rgSCHDhmGetHqProcFrmId ARGS((RgSchCellCb *cell, RgSchUeCb *ue, uint8_t idx,
- RgSchDlHqProcCb **hqP));
-#endif
-/* Changes for MIMO feature addition */
-Void rgSCHDhmSchdTa ARGS((RgSchUeCb *ueCb, RgSchDlHqTbCb *tbInfo));
-S16 rgSCHDhmHqFdbkInd ARGS((Void *cb, uint8_t cbType, RgSchCellCb *cellCb,
- CmLteTimingInfo timingInfo, RgTfuHqInfo *fdbk, RgInfRlsHqInfo
- *rlsHqBufs,RgSchErrInfo *err));
-#ifdef EMTC_ENABLE
-S16 rgSCHDhmEmtcHqFdbkInd ARGS((Void *cb, uint8_t cbType, RgSchCellCb *cellCb,
- CmLteTimingInfo timingInfo, RgTfuHqInfo *fdbk, RgInfRlsHqInfo
- *rlsHqBufs,RgSchErrInfo *err));
-S16 rgSCHUtlAddToResLst
-(
- CmLListCp *cp,
- RgSchIotRes *iotRes
- );
-#endif
-/*CA Dev Start */
-S16 rgSCHDhmPrcFdbkForTb(RgSchCellCb *cell,RgSchUeCb *ue,
- RgSchDlHqProcCb *hqP,RgSchDlSf *sf,Bool isMsg4,
- uint16_t rnti,uint8_t tbCnt,CmLteTimingInfo timingInfo, uint8_t isAck,
- RgInfRlsHqInfo *rlsHqBufs,RgSchErrInfo *err
- );
-/*CA Dev End */
-Void rgSCHDhmRgrUeCfg ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb,
- RgrUeCfg *ueCfg, RgSchErrInfo *err));
-Void rgSCHDhmRgrUeRecfg ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb,
- RgrUeRecfg *ueCfg, RgSchErrInfo *err));
-Void rgSCHDhmRgrCellCfg ARGS((RgSchCellCb *cellCb, RgrCellCfg *cellCfg,
- RgSchErrInfo *err));
-Void rgSCHDhmRgrCellRecfg ARGS((RgSchCellCb *cellCb, RgrCellRecfg
- *cellRecfg, RgSchErrInfo *err));
-Void rgSCHDhmFreeUe ARGS((RgSchUeCb *ueCb));
-Void rgSCHDhmUpdTa ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb, uint8_t ta));
-Void rgSCHDhmProcTAExp ARGS((RgSchUeCb *ue));
-/* Changes for MIMO feature addition */
-S16 rgSCHDhmAddLcData ARGS((Inst inst, RgSchLchAllocInfo *lchData,
- RgSchDlHqTbCb *tbInfo));
-S16 rgSCHDhmRlsDlsfHqProc ARGS((RgSchCellCb *cellCb, CmLteTimingInfo
-timingInfo));
-
-#ifdef LTE_TDD
-S16 rgSCHDhmTddRlsSubFrm ARGS((RgSchCellCb *cell, CmLteTimingInfo uciTimingInfo));
-S16 rgSCHCfgVldtTddDrxCycCfg ARGS((RgSchCellCb *cell, uint16_t drxCycle,
- uint8_t onDurTmr, uint16_t offSet));
-#endif
-/* Added support for SPS*/
-#ifdef LTEMAC_SPS
-S16 rgSCHDhmGetHqProcFrmId ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint8_t idx,
-RgSchDlHqProcCb **hqP
-));
-#endif /* LTEMAC_SPS */
-/* Freeing up the HARQ proc blocked for
- * indefinite time in case of Retx */
-S16 rgSCHDhmDlRetxAllocFail ARGS((
-RgSchUeCb *ue,
-RgSchDlHqProcCb *proc
-));
-/* MS_WORKAROUND for ccpu00122893 temp fix Incorrect HqProc release was done instead of
- * a Harq Entity reset. Fixing the same */
-Void rgSCHDhmHqEntReset ARGS((
- RgSchDlHqEnt *hqE
-));
-/* Measurement GAP and ACK NACK */
-
-S16 rgSCHMeasGapANRepUeCfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeCfg *ueCfg
-));
-S16 rgSCHMeasGapANRepUeRecfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeRecfg *ueRecfg
-));
-/* ccpu00133470- Added extra argument to identify UE DEL*/
-Void rgSCHMeasGapANRepUeDel ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-Bool isUeDel
-));
-S16 rgSCHMeasGapANRepTtiHndl ARGS((
-RgSchCellCb *cell
-));
-S16 rgSCHMeasGapANRepGetDlInactvUe ARGS((
-RgSchCellCb *cell,
-CmLListCp *dlInactvUeLst
-));
-S16 rgSCHMeasGapANRepGetUlInactvUe ARGS((
-RgSchCellCb *cell,
-CmLListCp *ulInactvUeLst
-));
-Void rgSCHMeasGapANRepDlInactvTmrExpry ARGS((
-RgSchUeCb *ue,
-uint8_t tmrEvnt
-));
-Void rgSCHMeasGapANRepUlInactvTmrExpry ARGS((
-RgSchUeCb *ue,
-uint8_t tmrEvnt
-));
-Void rgSCHMeasGapANRepTmrExpry ARGS((
-RgSchUeCb *ue
-));
-Void rgSCHAckNakRepTmrExpry ARGS((
-RgSchUeCb *ue
-));
-Void rgSCHAckNakRepSndHqFbkRcpReq ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *dlSf,
-CmLteTimingInfo timingInfo));
-
-Void rgSCHAckNakRepAddToQ ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *crntDlSf));
-
-/*
- * SCH Util APIs
- */
-#ifdef LTEMAC_SPS
-Void rgSCHUtlHdlCrcInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-CmLteTimingInfo timingInfo
-));
-#endif
-
-#ifdef LTE_L2_MEAS
- S16 rgSCHUtlValidateMeasReq ARGS ((RgSchCellCb *cellCb,
- LrgSchMeasReqInfo *schL2MeasInfo,
- RgSchErrInfo *err
- ));
-S16 rgSchL2mSndCfm ARGS((Pst *pst,
- RgSchL2MeasCb *measCb,
- LrgSchMeasReqInfo *measInfo,
- Bool isErr
-));
- S16 rgSchFillL2MeasCfm ARGS((
- RgSchCellCb *cell,
- RgSchL2MeasCb *measCb,
- LrgSchMeasCfmInfo *cfm,
- uint32_t measTime
-));
-Void rgSchL2mFillCfmPst ARGS((
- Pst *pst,
- Pst *cfmPst,
- LrgSchMeasReqInfo *measInfo
-));
-S16 rgSCHL2Meas ARGS((
- RgSchCellCb *cell,
- uint8_t isCalrCrcInd
-));
-#endif /* LTE_L2_MEAS */
-/* Added changes of TFU_UPGRADE */
-#ifdef TFU_UPGRADE
-F64 rgSCHUtlPower ARGS
-((
-F64 x,
-F64 n
-));
-
- uint32_t rgSCHUtlParse ARGS
- ((
- uint8_t *buff,
- uint8_t startPos,
- uint8_t endPos,
- uint8_t buffSize
- ));
-
- uint8_t rgSCHUtlFindDist ARGS
-((
-uint16_t crntTime,
-uint16_t tempIdx
-));
-#endif
-Bool rgSCHUtlPdcchAvail ARGS((RgSchCellCb *cell, RgSchPdcchInfo
- *pdcchInfo, CmLteAggrLvl aggrLvl, RgSchPdcch **pdcch));
-Void rgSCHUtlPdcchPut ARGS((RgSchCellCb *cell, RgSchPdcchInfo *pdcchInfo,
- RgSchPdcch *pdcch));
-#ifdef LTE_TDD
-/* Changes for passing iPhich at TFU interface*/
-S16 rgSCHUtlAddPhich ARGS((RgSchCellCb *cellCb, CmLteTimingInfo frm,
- uint8_t hqFeedBack, uint8_t nDmrs, uint8_t rbStart, uint8_t iPhich));
-#else
-S16 rgSCHUtlAddPhich ARGS((RgSchCellCb *cellCb, CmLteTimingInfo frm,
- uint8_t hqFeedBack, uint8_t nDmrs, uint8_t rbStart,Bool isForMsg3));
-#endif
-RgSchDlSf* rgSCHUtlSubFrmGet ARGS((RgSchCellCb *cell,
- CmLteTimingInfo frm));
-Void rgSCHUtlSubFrmPut ARGS((RgSchCellCb *cell, RgSchDlSf *sf));
-uint8_t rgSCHUtlLog32bitNbase2 ARGS((uint32_t n));
-/* Added support for SPS*/
-
-
-#ifdef LTEMAC_SPS
-RgSchDlHqProcCb * rgSCHDhmSpsDlGetHqProc ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
-CmLteTimingInfo timingInfo));
-#endif
-#ifdef LTE_TDD
-uint8_t rgSCHUtlCalcNCce ARGS((uint8_t bw, RgrPhichNg ng, uint8_t cfi, uint8_t mPhich,
- uint8_t numAntna, Bool isEcp));
-#else
-uint8_t rgSCHUtlCalcNCce ARGS((uint8_t bw, RgrPhichNg ng, uint8_t cfi, uint8_t numAntna, Bool
-isEcp));
-#endif
-#ifdef LTE_TDD
-/* Changes for passing iPhich at TFU interface*/
-S16 rgSCHUtlGetPhichInfo ARGS((RgSchUlHqProcCb *hqProc, uint8_t *rbStartRef,
- uint8_t *nDmrsRef, uint8_t *iPhich));
-#else
-S16 rgSCHUtlGetPhichInfo ARGS((RgSchUlHqProcCb *hqProc, uint8_t *rbStartRef,
- uint8_t *nDmrsRef));
-#endif
-/* Added changes of TFU_UPGRADE */
-#ifndef TFU_UPGRADE
-/* To include the length and ModOrder in DataRecp Req. */
-/* Updating NDI and HARQ proc Id */
-S16 rgSCHUtlAllocRcptInfo ARGS((RgSchUlAlloc *alloc, CmLteRnti *rnti,
- uint8_t *iMcsRef, uint8_t *rbStartRef, uint8_t *numRbRef, uint8_t *rvRef, uint16_t *size,
- TfuModScheme *modType,Bool *isRtx,
-uint8_t *nDmrs,
-Bool *ndi,
-uint8_t *hqPId));
-#else
-S16 rgSCHUtlAllocRcptInfo ARGS((
- RgSchCellCb *cell,
- RgSchUlAlloc *alloc,
- CmLteTimingInfo *timeInfo,
- TfuUeUlSchRecpInfo *recpReq
- ));
-#endif /* TFU_UPGRADE */
-
-S16 rgSCHUtlRgrCellCfg ARGS((RgSchCellCb *cell, RgrCellCfg *cellCfg,
- RgSchErrInfo *errInfo));
-S16 rgSCHUtlRgrCellRecfg ARGS((RgSchCellCb *cell, RgrCellRecfg *recfg,
- RgSchErrInfo *errInfo));
-S16 rgSCHUtlFreeCell ARGS((RgSchCellCb *cell));
-S16 rgSCHUtlRgrUeCfg ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgrUeCfg *cfg, RgSchErrInfo *err));
-S16 rgSCHUtlRgrLcCfg ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgSchDlLcCb *dl, RgrLchCfg *cfg,RgSchErrInfo *errInfo));
-S16 rgSCHUtlRgrLcDel ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- CmLteLcId lcId, uint8_t lcgId));
-S16 rgSCHUtlRgrLcRecfg ARGS ((RgSchCellCb *cell,RgSchUeCb *ue,
- RgSchDlLcCb *dlLc,RgrLchRecfg *recfg,RgSchErrInfo *err));
-S16 rgSCHUtlRgrLcgCfg ARGS ((RgSchCellCb *cell,RgSchUeCb *ue,
- RgrLcgCfg *cfg,RgSchErrInfo *errInfo));
-S16 rgSCHUtlRgrLcgRecfg ARGS ((RgSchCellCb *cell,RgSchUeCb *ue,
- RgrLcgRecfg *recfg,RgSchErrInfo *err));
-Void rgSCHUtlRgrLcgDel ARGS ((RgSchCellCb *cell,RgSchUeCb *ue,
- uint8_t lcgId));
-Void rgSCHUtlDlCqiInd ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- TfuDlCqiRpt *dlCqiInd, CmLteTimingInfo timingInfo));
-
-/* Added changes of TFU_UPGRADE */
-#ifdef TFU_UPGRADE
-Void rgSCHUtlRawCqiInd ARGS
-((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-TfuRawCqiRpt* rawCqiRpt,
-CmLteTimingInfo timingInfo
-));
-
-Void rgSCHUtlSrsInd ARGS
-((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-TfuSrsRpt* srsRpt,
-CmLteTimingInfo timingInfo
-));
-S16 rgSCHUtlGetCfgPerOff ARGS
-((
-RgSchPerTbl tbl,
-uint16_t cfgIdx,
-uint16_t *peri,
-uint16_t *offset
-));
-#endif
-
-Void rgSCHUtlDoaInd ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- TfuDoaRpt *doaInd));
-Void rgSCHUtlDlTARpt ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
-/* Changes for MIMO feature addition */
-Void rgSCHUtlDlRlsSubFrm ARGS((RgSchCellCb *cell, CmLteTimingInfo subFrm));
-Void rgSCHUtlDlProcAddToRetx ARGS((RgSchCellCb *cell,
- RgSchDlHqProcCb *hqP));
-S16 rgSCHUtlRegSch ARGS((uint8_t schIdx, RgSchdApis *apis));
-Void rgSCHUtlDlHqProcAddToTx ARGS((RgSchDlSf *subFrm, RgSchDlHqProcCb *hqP));
-/* Changes for MIMO feature addition */
-Void rgSCHUtlDlHqPTbRmvFrmTx ARGS((RgSchDlSf *subFrm,
- RgSchDlHqProcCb *hqP, uint8_t tbIdx, Bool isRepeating));
-S16 rgSCHUtlRgrUeRecfg ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgrUeRecfg *recfg, RgSchErrInfo *err));
-Void rgSCHUtlFreeDlLc ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgSchDlLcCb *dlLc));
-Void rgSCHUtlFreeUlLc ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgSchUlLcCb *ulLc));
-Void rgSCHUtlFreeUe ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
-Void rgSCHUtlDlDedBoUpd ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgSchDlLcCb *svc));
-#ifdef RG_UNUSED
-S16 rgSCHUtlUpdUlHqProc ARGS((RgSchCellCb *cell, RgSchUlHqProcCb *curProc,
- RgSchUlHqProcCb *oldProc));
-#endif
-/* PHR handling for MSG3 */
-Void rgSCHUtlRecMsg3Alloc ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgSchRaCb *raCb));
-S16 rgSCHUtlContResUlGrant ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgSchErrInfo *err));
-S16 rgSCHUtlSrRcvd ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- CmLteTimingInfo, RgSchErrInfo *err));
-Void rgSCHUtlUpdBsrShort ARGS((RgSchCellCb *cell, RgSchUeCb *ue, uint8_t lcgId,
- uint8_t bsr, RgSchErrInfo *err));
-Void rgSCHUtlUpdBsrTrunc ARGS((RgSchCellCb *cell, RgSchUeCb *ue, uint8_t lcgId,
- uint8_t bsr, RgSchErrInfo *err));
-Void rgSCHUtlUpdBsrLong ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- uint8_t bsr1,uint8_t bsr2,uint8_t bsr3,uint8_t bsr4, RgSchErrInfo *err));
-S16 rgSCHUtlUpdPhr ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- uint8_t phr, RgSchErrInfo *err));
-S16 rgSCHUtlUpdExtPhr ARGS(( RgSchCellCb *cell, RgSchUeCb *ue,
-RgInfExtPhrCEInfo * extPhr, RgSchErrInfo *err));
-S16 rgSCHUtlDataRcvd ARGS((RgSchCellCb *cell, RgSchUeCb *ue, uint8_t numLc,
- RgSchUlLcCb *lcArr[], uint16_t bytesArr[], RgSchErrInfo *err));
-Void rgSCHUtlUlCqiInd ARGS(( RgSchCellCb *cell, RgSchUeCb *ue,
- TfuUlCqiRpt *ulCqiInfo));
-Void rgSCHUtlPucchDeltaPwrInd ARGS(( RgSchCellCb *cell, RgSchUeCb *ue,
- S8 delta));
-Void rgSCHUtlUeReset ARGS(( RgSchCellCb *cell, RgSchUeCb *ue));
-Void rgSCHUtlUlHqProcForUe ARGS((RgSchCellCb *cell, CmLteTimingInfo frm,
- RgSchUeCb *ue, RgSchUlHqProcCb **procRef));
-RgSchUlAlloc *rgSCHUtlFirstRcptnReq ARGS((RgSchCellCb *cell));
-RgSchUlAlloc *rgSCHUtlNextRcptnReq ARGS((RgSchCellCb *cell,
- RgSchUlAlloc *alloc));
-RgSchUlAlloc *rgSCHUtlFirstHqFdbkAlloc ARGS((RgSchCellCb *cell, uint8_t idx));
-RgSchUlAlloc *rgSCHUtlNextHqFdbkAlloc ARGS((RgSchCellCb *cell,
- RgSchUlAlloc *alloc, uint8_t idx));
-S16 rgSCHUtlTfuBndReq ARGS((Inst inst, SuId suId, SpId spId));
-S16 rgSCHUtlTfuUBndReq ARGS((Inst inst, RgSchLowSapCfgInfo sapCfg, Reason reason));
-#ifdef EMTC_ENABLE
-S16 rgSCHEmtcUtlResetSfAlloc ARGS((RgInfSfAlloc *sfAlloc,
- Bool resetCmnLcInfo, Bool restAlloc));
-#endif
-S16 rgSCHUtlResetSfAlloc ARGS((RgInfSfAlloc *sfAlloc,
- Bool resetCmnLcInfo, Bool restAlloc));
-S16 rgSCHUtlGetSfAlloc ARGS((RgSchCellCb *cell));
-S16 rgSCHUtlPutSfAlloc ARGS((RgSchCellCb *cell));
-S16 rgSCHUtlAllocSBuf ARGS((Inst inst, Data **pData, Size size));
-/* ccpu00117052 - MOD - Passing double pointer
-for proper NULLP assignment*/
-Void rgSCHUtlFreeSBuf ARGS((Inst inst, Data **data, Size size));
-Void rgSCHUtlFillDgnParams ARGS((Inst inst, RgUstaDgn *dgn,uint8_t dgnType));
-Void rgSCHUtlGetPstToLyr ARGS((Pst *pst,RgSchCb *schCb,Inst macInst));
-S16 rgSCHUtlFillRgInfCmnLcInfo ARGS((RgSchDlSf *sf,RgInfSfAlloc *sfAlloc,
- CmLteLcId lcId, Bool sendInd));
-S16 rgSCHUtlFillRgInfRarInfo ARGS((RgSchDlSf *sf,RgInfSfAlloc *sfAlloc,RgSchCellCb *cell));
-S16 rgSCHUtlFillPdschDciInfo ARGS((TfuPdschDciInfo *pdschDci,TfuDciInfo
- *pdcchDci));
- /* CA dev Start */
-Void rgSCHUtlFillRgInfUeInfo ARGS((RgSchDlSf*, RgSchCellCb *cell, CmLListCp *dlDrxInactvTmrLst,
- CmLListCp *dlInActvLst, CmLListCp *ulInActvLst));
- /* CA dev End */
-S16 rgSCHUtlUpdSch ARGS((RgInfSfDatInd *subfrmInfo, RgSchCellCb *cellCb,
- RgSchUeCb *ueCb, RgInfUeDatInd *pdu,RgSchErrInfo *err));
-S16 rgSCHUtlHndlCcchBoUpdt ARGS((RgSchCellCb *cell,RgInfCmnBoRpt *boRpt));
-S16 rgSCHUtlHndlBcchPcchBoUpdt ARGS((RgSchCellCb *cell,RgInfCmnBoRpt
- *boUpdt));
-S16 rgSCHUtlRgrBndCfm ARGS ((Inst inst, SuId suId,uint8_t status));
-/* Added for sending TTI tick to RRM */
-#ifdef RGR_RRM_TICK
-S16 rgSCHUtlRgrTtiInd ARGS ((RgSchCellCb *cell, RgrTtiIndInfo *ttiInd));
-#endif
-S16 schSendCfgCfm ARGS ((Region reg, Pool pool, \
- RgrCfgTransId transId, uint8_t status));
-S16 rgSCHUtlProcMsg3 ARGS((RgInfSfDatInd *subfrmInfo, RgSchCellCb *cellCb,
- RgSchUeCb *ueCb, CmLteRnti rnti,RgInfUeDatInd *pdu,
- RgSchErrInfo *err ));
-#ifdef RG_PHASE_2
-S16 rgSCHUtlTfuGrpPwrCntrlReq ARGS((Inst inst,S16 sapId,
- TfuGrpPwrCntrlReqInfo *grpPwrCntrlReq));
-#endif
-S16 rgSCHUtlTfuCntrlReq ARGS((Inst inst, S16 sapId,
- TfuCntrlReqInfo *cntrlReq));
-S16 rgSCHUtlTfuRecpReq ARGS((Inst inst, S16 sapId,
- TfuRecpReqInfo *recpReq));
-S16 rgSCHUtlValidateTfuSap ARGS((Inst inst,SuId suId));
-S16 rgSCHUtlAllocEventMem ARGS((Inst inst,Ptr *memPtr,Size memSize));
-S16 rgSCHUtlGetEventMem ARGS((Ptr *ptr,Size len,Ptr memCpa));
-S16 rgSCHUtlGetRlsHqAlloc ARGS((RgSchCellCb *cell));
-S16 rgSCHUtlPutRlsHqAlloc ARGS((RgSchCellCb *cell));
-
-S16 rgSCHUtlDlActvtUe ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
-S16 rgSCHUtlUlActvtUe ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
-Void rgSCHUtlHdlUlTransInd ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- CmLteTimingInfo timingInfo));
-#ifdef TFU_UPGRADE
-Void rgSCHUtlUpdACqiTrigWt ARGS((RgSchUeCb *ue,RgSchUeCellInfo *sCellInfo, uint8_t isAck));
-#endif
-/* Nprb indication at PHY for common Ch */
-/* Corrected allocation for common channels */
-S32 rgSCHUtlGetAllwdCchTbSz ARGS((uint32_t bo, uint8_t *nPrb, uint8_t *mcs
-));
-/* CR timer changes*/
-S16 rgSCHUtlUpdtBo ARGS((RgSchCellCb *cell,
- RgInfCmnBoRpt *staRsp));
-S16 rgSCHUtlAddUeToCcchSduLst ARGS(
- (RgSchCellCb *cell,
- RgSchUeCb *ueCb));
-#ifdef EMTC_ENABLE
-S16 rgSCHUtlAddUeToEmtcCcchSduLst ARGS(
- (RgSchCellCb *cell,
- RgSchUeCb *ueCb));
-
-S16 rgSCHRamRmvFrmEmtcRaInfoSchdLst ARGS((RgSchCellCb *cell, RgSchRaCb *raCb));
-Void rgSCHRamEmtcDelRaCb ARGS((RgSchCellCb *cell, RgSchRaCb *raCb));
-S16 rgSCHRamEmtcUpdtBo ARGS((RgSchCellCb *cell, RgSchRaCb *raCb,
- RgInfCmnBoRpt *staRsp));
-#endif
-/* Added for SI Enhancement*/
-#ifdef RGR_SI_SCH
-Void rgSCHUtlPutSiInfo ARGS((RgSchCellCb *cell));
-Void rgSCHUtlFreeWarningSiSeg ARGS((Region reg,Pool pool,
- CmLListCp *siPduLst));
-Void rgSCHUtlFreeWarningSiPdu ARGS((RgSchCellCb *cell));
-Buffer *rgSCHUtlGetWarningSiPdu ARGS((RgSchCellCb *cell));
-S16 rgSCHUtlGetMcsAndNPrb ARGS((RgSchCellCb *cell, uint8_t *nPrb, uint8_t *mcs, MsgLen *msgLen));
-S16 rgSCHUtlCalMcsAndNPrb ARGS((RgSchCellCb *cell, uint8_t cfgType, MsgLen msgLen, uint8_t siId));
-#endif/*RGR_SI_SCH*/
-
-#ifdef LTE_TDD
-S16 rgSCHUtlAllocUeANFdbkInfo ARGS((RgSchUeCb *ue,uint8_t servCellIdx));
-Void rgSCHUtlDelUeANFdbkInfo ARGS((RgSchUeCb *ue,uint8_t servCellIdx));
-S16 rgSCHUtlInitUeANFdbkInfo ARGS((RgSchTddANInfo *anInfo));
-RgSchTddANInfo* rgSCHUtlGetUeANFdbkInfo ARGS((RgSchUeCb *ueCb, CmLteTimingInfo *timeInfo,uint8_t servCellIdx));
-uint8_t rgSCHUtlGetDlSfIdx ARGS((RgSchCellCb *cell, CmLteTimingInfo *timeInfo));
-Void rgSCHUtlPrachCfgInit ARGS((RgSchCellCb *cell, RgrCellCfg *cellCfg ));
-Void rgSCHUtlGetNxtDlSfInfo ARGS((CmLteTimingInfo curDlTime, RgSchCellCb *cell, RgSchDlSf *dlSf, RgSchDlSf **nxtDlsf, CmLteTimingInfo *nxtDlTime));
-Void rgSCHUtlGetPrevDlSfInfo ARGS((RgSchCellCb * cell, CmLteTimingInfo curDlTime, CmLteTimingInfo *prevDlTime, uint8_t *numSubfrm));
-#endif
-Void rgSCHCmnDlSch ARGS
-((
-RgSchCellCb *cell
-));
-Void rgSCHCmnSndCnsldtInfo ARGS
-((
-RgSchCellCb *cell
-));
-Void rgSCHCmnCnsldtSfAlloc ARGS
-((
-RgSchCellCb *cell
-));
-
-/* Added support for SPS*/
-Void rgSCHCmnDlAllocFnlz ARGS
-((
-RgSchCellCb *cell
-));
-
-#ifdef LTEMAC_SPS
-Void rgSCHUtlDlRelPdcchFbk ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-Bool isAck
-));
-
-Void rgSCHUtlDlProcAck ARGS((
-RgSchCellCb *cell,
-RgSchDlHqProcCb *hqP
-));
-S16 rgSCHUtlSpsRelInd ARGS((
-RgSchCellCb *cellCb,
-RgSchUeCb *ueCb,
-Bool isExplRel
-));
-
-Void rgSCHCmnDlSch ARGS
-((
-RgSchCellCb *cell
-));
-
-S16 rgSCHUtlSpsActInd ARGS((
-RgSchCellCb *cellCb,
-RgSchUeCb *ueCb,
-uint16_t spsSduSize
-));
-
-Void rgSCHUtlHdlCrcFailInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-CmLteTimingInfo timingInfo
-));
-
-Void rgSCHUtlHdlCrntiCE ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-
-#endif /* LTEMAC_SPS*/
-
-/******* </AllocHolesMemMgmnt>: START *****/
-S16 rgSCHUtlUlSfInit ARGS((
- RgSchCellCb *cell,
- RgSchUlSf *sf,
- uint8_t idx,
- uint8_t maxUePerSf
- ));
-Void rgSCHUtlUlSfDeinit ARGS((
- RgSchCellCb *cell,
- RgSchUlSf *sf
- ));
-RgSchUlAlloc *rgSCHUtlUlAllocGetHole ARGS((
- RgSchUlSf *sf,
- uint8_t numRb,
- RgSchUlHole *hole
- ));
-RgSchUlAlloc *rgSCHUtlUlAllocGetCompHole ARGS((
- RgSchUlSf *sf,
- RgSchUlHole *hole
- ));
-RgSchUlAlloc *rgSCHUtlUlAllocGetPartHole ARGS((
- RgSchUlSf *sf,
- uint8_t numRb,
- RgSchUlHole *hole
- ));
-Void rgSCHUtlUlAllocRls ARGS((
- RgSchUlSf *sf,
- RgSchUlAlloc *alloc
- ));
-
-/* UL_ALLOC_ENHANCEMENT */
-Void rgSCHUtlUlAllocRelease ARGS((
- RgSchUlAlloc *alloc
- ));
-RgSchUlAlloc *rgSCHUtlUlAllocFirst ARGS((
- RgSchUlSf *sf
- ));
-RgSchUlAlloc *rgSCHUtlUlAllocNxt ARGS((
- RgSchUlSf *sf,
- RgSchUlAlloc *alloc
- ));
-RgSchUlHole *rgSCHUtlUlHoleFirst ARGS((
- RgSchUlSf *sf
- ));
-RgSchUlHole *rgSCHUtlUlHoleNxt ARGS((
- RgSchUlSf *sf,
- RgSchUlHole *hole
- ));
-RgSchUlAlloc *rgSCHUtlUlAllocGetAdjNxt ARGS((
- RgSchUlAllocDb *db,
- RgSchUlAlloc *prv
- ));
-RgSchUlAlloc *rgSCHUtlUlAllocGetFirst ARGS((
- RgSchUlAllocDb *db
- ));
-Void rgSCHUtlUlHoleAddAlloc ARGS((
- RgSchUlSf *sf,
- RgSchUlAlloc *alloc
- ));
-/* UL_ALLOC_ENHANCEMENT */
-Void rgSCHUtlUlHoleAddAllocation ARGS((
- RgSchUlAlloc *alloc
- ));
-
-Void rgSCHUtlUlHoleJoin ARGS((
- RgSchUlHoleDb *db,
- RgSchUlHole *prv,
- RgSchUlHole *nxt,
- RgSchUlAlloc *alloc
- ));
-Void rgSCHUtlUlHoleExtndRight ARGS((
- RgSchUlHoleDb *db,
- RgSchUlHole *prv,
- RgSchUlAlloc *alloc
- ));
-Void rgSCHUtlUlHoleExtndLeft ARGS((
- RgSchUlHoleDb *db,
- RgSchUlHole *nxt,
- RgSchUlAlloc *alloc
- ));
-Void rgSCHUtlUlHoleNew ARGS((
- RgSchUlHoleDb *db,
- RgSchUlAlloc *alloc
- ));
-Void rgSCHUtlUlHoleUpdAllocLnks ARGS((
- RgSchUlHole *hole,
- RgSchUlAlloc *prvAlloc,
- RgSchUlAlloc *nxtAlloc
- ));
-Void rgSCHUtlUlHoleIns ARGS((
- RgSchUlHoleDb *db,
- RgSchUlHole *hole
- ));
-Void rgSCHUtlUlHoleIncr ARGS((
- RgSchUlHoleDb *db,
- RgSchUlHole *hole
- ));
-Void rgSCHUtlUlHoleDecr ARGS((
- RgSchUlHoleDb *db,
- RgSchUlHole *hole
- ));
-Void rgSCHUtlUlHoleRls ARGS((
- RgSchUlHoleDb *db,
- RgSchUlHole *hole
- ));
-S16 rgSCHUtlUlAllocMemInit ARGS((
- RgSchCellCb *cell,
- RgSchUlAllocMem *mem,
- uint8_t maxAllocs
- ));
-Void rgSCHUtlUlAllocMemDeinit ARGS((
- RgSchCellCb *cell,
- RgSchUlAllocMem *mem
- ));
-S16 rgSCHUtlUlHoleMemInit ARGS((
- RgSchCellCb *cell,
- RgSchUlHoleMem *mem,
- uint8_t maxHoles,
- RgSchUlHole **holeRef
- ));
-Void rgSCHUtlUlHoleMemDeinit ARGS((
- RgSchCellCb *cell,
- RgSchUlHoleMem *mem
- ));
-RgSchUlAlloc *rgSCHUtlUlAllocMemGet ARGS((
- RgSchUlAllocMem *mem
- ));
-Void rgSCHUtlUlAllocMemRls ARGS((
- RgSchUlAllocMem *mem,
- RgSchUlAlloc *alloc
- ));
-RgSchUlHole *rgSCHUtlUlHoleMemGet ARGS((
- RgSchUlHoleMem *mem
- ));
-Void rgSCHUtlUlHoleMemRls ARGS((
- RgSchUlHoleMem *mem,
- RgSchUlHole *hole
- ));
-RgSchUlAlloc *rgSCHUtlUlGetSpfcAlloc ARGS((
- RgSchUlSf *sf,
- uint8_t startSb,
- uint8_t numSb
-));
-/******* </AllocHolesMemMgmnt>: END *****/
-
-/* DRX function declarations */
-S16 rgSCHDrxCellCfg ARGS((RgSchCellCb *cell, RgrCellCfg *cellCfg));
-Void rgSCHDrxCellDel ARGS((RgSchCellCb *cell));
-S16 rgSCHDrxUeCfg ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgrUeCfg *ueCfg));
-#ifdef RGR_V2
-S16 rgSCHDrxUeReCfg ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgrUeRecfg *ueCfg));
-#endif
-S16 rgSCHDrxUeDel ARGS((RgSchCellCb *cell,RgSchUeCb *ue));
-Void rgSCHDrxTtiInd ARGS ((RgSchCellCb *cell));
-
-S16 rgSCHDrxSfAlloc ARGS ((RgSchCellCb *cellCb, RgSchDlSf
- *dlSf));
-S16 rgSCHDrxDlTrnsFail ARGS((RgSchCellCb *cell, RgSchDlHqProcCb
- *dlHq));
-Void rgSCHDrxDedRa ARGS((RgSchCellCb *cellCb, RgSchUeCb* ueCb));
-S16 rgSCHDrxSrInd ARGS((RgSchCellCb *cell,RgSchUeCb *ue));
-
-Void rgSCHDrxStrtInActvTmr ARGS((RgSchCellCb *cell,
- CmLListCp *ueLst,
- uint8_t direction));
-S16 rgSCHUtlGetDrxSchdUesInDl ARGS((RgSchCellCb *cellCb,
- RgSchUeCb *ueCb,
- RgSchDlHqProcCb *dlHq,
- RgInfUeAlloc *allocInfo,
- CmLListCp *dlDrxInactvTmrLst,
- CmLListCp *dlInActvLst,
- CmLListCp *ulInActvLst));
-Void rgSCHDrxStartHarqRTTTmr ARGS((RgSchCellCb *cell,
- RgSchDlHqProcCb *hqP,
- uint8_t tbCnt));
-Void rgSCHDrxUeHqReset ARGS((RgSchCellCb *cell,
- RgSchUeCb *ue,
- RgSchDlHqEnt *hqE,
- uint8_t cellIdx));
-
-#ifdef TFU_UPGRADE
-#ifdef LTE_TDD
-const RgSchTddCellSpSrsSubfrmTbl rgSchTddCellSpSrsSubfrmTbl;
-#else
-const RgSchFddCellSpSrsSubfrmTbl rgSchFddCellSpSrsSubfrmTbl;
-#endif
-#endif
-
-#ifdef LTEMAC_HDFDD
-S16 rgSCHHdFddUeCfg ARGS((
- RgSchCellCb *cellCb,
- RgSchUeCb *ueCb,
- Bool hdFdd));
-S16 rgSCHHdFddUeDel ARGS((
- RgSchCellCb *cellCb,
- RgSchUeCb *ueCb));
-Void rgSCHCmnHdFddPtUlMrk ARGS((
- RgSchCellCb *cellCb));
-Void rgSCHCmnHdFddChkUlAllow ARGS((
- RgSchCellCb *cellCb,
- RgSchUeCb *ueCb,
- uint8_t *flag));
-Void rgSCHCmnHdFddChkDlAllow ARGS((
- RgSchCellCb *cellCb,
- RgSchUeCb *ueCb,
- Bool *flag));
-Void rgSCHCmnHdFddChkNackAllow ARGS((
- RgSchCellCb *cellCb,
- RgSchUeCb *ueCb,
- CmLteTimingInfo timInfo,
- Bool *flag));
-Void rgSCHCmnHdFddUpdULMark ARGS((
- RgSchCellCb *cellCb,
- RgSchUeCb *ueCb));
-Void rgSCHCmnHdFddUpdDLMark ARGS((
- RgSchCellCb *cellCb,
- RgSchUeCb *ueCb));
-Void rgSCHHdFddGetSfn ARGS((
- uint16_t *sfn,
- CmLteTimingInfo timeInfo,
- S16 offset));
-#endif /* ifdef LTEMAC_HDFDD */
-
-/* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
-S16 rgSCHUtlRgrStaInd ARGS((
-RgSchCellCb *cell,
-RgrStaIndInfo *rgrSta
-));
-
-S16 rgSCHUtlFillSndStaInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrStaIndInfo *staInfo,
-uint8_t numCqiRept
-));
-#endif /* End of RGR_CQI_REPT */
-S16 rgSCHUtlRgrUeStaInd ARGS((
-RgSchCellCb *cell,
-RgrUeStaIndInfo *rgrUeSta
-));
-
-S16 rgSCHUtlFillSndUeStaInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeStaIndInfo *ueStaInfo
-));
-
-
-/* LTE_ADV_FLAG_REMOVED_START */
-S16 rgSCHUtlRgrLoadInfInd ARGS((
-RgSchCellCb *cell,
-RgrLoadInfIndInfo *rgrLoadInf
-));
-/* LTE_ADV_FLAG_REMOVED_END */
-#ifdef LTE_ADV
-#ifdef TFU_UPGRADE
-TfuAckNackMode rgSchUtlGetFdbkMode ARGS((
-RgrSchFrmt1b3TypEnum fdbkType
-));
-
-TfuAckNackMode rgSchUtlGetFdbkMode ARGS((
-RgrSchFrmt1b3TypEnum fdbkType
-));
-
-#endif /*TFU_UPGRADE */
-#endif /* LTE_ADV */
-/* FIX */
-Void rgSCHUtlRlsRnti ARGS((
-RgSchCellCb *cellCb,
-RgSchRntiLnk *rntiLnk,
-Bool ueIdChngd,
-CmLteRnti newRnti
-));
-S16 rgSCHUtlRgmBndCfm ARGS((
-Inst instId,
-SuId suId,
-uint8_t status
-));
-Void rgSCHDhmDelHqEnt ARGS((
-RgSchCellCb *cell,
-RgSchDlHqEnt **hqE
-));
-Void rgSCHDhmAssgnUeHqEntFrmRaCb ARGS((
-RgSchUeCb *ue,
-RgSchRaCb *raCb
-));
- Void rgSCHUtlReTxTa ARGS((
-RgSchCellCb *cellCb,
-RgSchUeCb *ueCb));
-/* LTE_ADV_FLAG_REMOVED_START */
-Void rgSchSFRTotalPoolFree ARGS((
-RgSchSFRTotalPoolInfo *sfrTotalPoolInfo,
-RgSchCellCb *cell));
-Void rgSchDSFRPwrCheck ARGS((
-RgSchDlSf *sf,
-Bool *isAllUePwrHigh));
-/* LTE_ADV_FLAG_REMOVED_END */
-
-S16 rgSCHUtlUpdAvgPrbUsage ARGS((
-RgSchCellCb *cell
-));
-
-uint8_t rgSchUtlCfg0ReTxIdx ARGS((
-RgSchCellCb *cell,
-CmLteTimingInfo phichTime,
-uint8_t hqFdbkIdx
-));
-
-S16 rgSCHUtlBuildNSendLcgReg ARGS((
-RgSchCellCb *cell,
-CmLteRnti crnti,
-uint8_t lcgId,
-Bool isGbr
-));
-
-Void rgSCHUtlPdcchInit ARGS((
- RgSchCellCb *cell,
- RgSchDlSf *subFrm,
- uint16_t nCce));
-Void rgSCHDynCfiReCfg ARGS((
- RgSchCellCb *cell,
- Bool isDynCfiEnb
-));
-Void rgSchUtlCalcTotalPrbReq ARGS((RgSchCellCb *cell,
- RgSchUeCb *ue,
- uint32_t bo,
- uint32_t *prbReqrd));
-uint8_t rgSchUtlGetNumSbs ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint32_t *numSbs
-));
-
-uint8_t rgSchUtlSortInsUeLst ARGS((
-RgSchCellCb *cell,
-CmLListCp *ueLst,
-CmLList *node,
-uint8_t subbandRequired
-));
-S16 rgSCHUtlResetCpuOvrLdState ARGS((
- RgSchCellCb *cell,
- uint8_t cnrtCpuOvrLdIns
-));
-Void rgSCHUtlCpuOvrLdAdjItbsCap ARGS((
- RgSchCellCb *cell
-));
-#ifdef TFU_UPGRADE
-S16 rgSCHTomUtlPcqiSbCalcBpIdx ARGS((
-CmLteTimingInfo crntTimInfo,
-RgSchUeCb *ueCb,
-RgSchUePCqiCb *cqiCb
-));
-
-#ifdef LTE_ADV
-S16 rgSCHUtlSCellHndlCqiCollsn ARGS((
-RgSchUePCqiCb *cqiCb
-));
-
-S16 rgSCHUtlSCellHndlRiCollsn ARGS((
-RgSchUePCqiCb *cqiCb
-));
-
-#endif/*LTE_ADV*/
-#endif/*TFU_UPGRADE*/
-
-Void rgSCHTomUtlGetTrigSet ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ueCb,
- uint8_t cqiReq,
- uint8_t *triggerSet
-));
-
-Void rgSCHUtlUpdUeDciSize ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ueCb,
-Bool isCsi2Bit
-));
-Void rgSCHUtlCalcDciSizes ARGS((
-RgSchCellCb *cell
-));
-
-Void rgSchCmnPreDlSch ARGS ((
- RgSchCellCb **cell,
- uint8_t nCell,
- RgSchCellCb **cellLst
- ));
-
-Void rgSchCmnPstDlSch ARGS ((
- RgSchCellCb *cell
- ));
-
-uint8_t rgSCHCmnGetBiIndex ARGS ((
-RgSchCellCb *cell,
-uint32_t ueCount
-));
-
-uint8_t SchSendCfgCfm(Pst *pst, RgMngmt *cfm);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* __SCH__ */
-
-\f
-/**********************************************************************
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Entry point functions.
-
- File: rg_sch_cfg.c
-
-**********************************************************************/
-
-/** @file rg_sch_cfg.c
-@brief This module handles the configuration of SCH by RRC and RRM.
-*/
-
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "lrg.h"
-#include "rgr.h"
-#include "rgm.h"
-#include "tfu.h"
-#include "rg_env.h"
-#include "rg_sch_inf.h"
-#include "rg_sch.h"
-#include "rg_sch_err.h"
-#include "rg_sch_cmn.h"
-
-/* header/extern include files (.x) */
-#include "tfu.x" /* TFU types */
-#include "lrg.x" /* layer management typedefs for MAC */
-#include "rgr.x" /* layer management typedefs for MAC */
-#include "rgm.x" /* layer management typedefs for MAC */
-#include "rg_sch_inf.x" /* typedefs for MAC */
-#include "rg_sch.x" /* typedefs for MAC */
-/* [ccpu00124018]-MOD- Retrieving CQI value from cell config*/
-#include "rg_sch_cmn.x"
-#include "rg_sch_clist.x"
-
-
-/* LTE-MAC Scheduler instance control block structures */
-RgSchCb rgSchCb[RGSCH_MAX_INST];
-
-#ifdef PHY_ERROR_LOGING
-RgSchUlAllocCntr rgSchUlAllocCntr;
-#endif
-
-#ifdef EMTC_ENABLE
-Void rgSCHEmtcPOTrigger ARGS ((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-
-S16 rgSchEmtcUpdSiCfg ARGS ((
-RgSchCellCb *cell,
-RgrCellRecfg *cellRecfg
-));
-
-S16 rgSCHEmtcCfgVldtDrxReTxCfg ARGS((
-uint16_t reTxTmr
-));
-
-S16 rgSCHEmtcCfgVldtDrxUlReTxCfg ARGS((
-uint16_t reTxTmr
-));
-#endif
-
-S16 rgSCHEnbPfsDlCfg ARGS((
- Inst instIdx,
- RgSchErrInfo *err
- ));
-/* local defines */
-static S16 rgSCHCfgRgrUeRecfgRntiChg ARGS (( RgSchCellCb *cell,
- RgSchUeCb *ue, RgrUeRecfg *ueRecfg, RgSchErrInfo *errInfo));
-static S16 rgSCHCfgVldtUePwrCfg ARGS((RgSchCellCb *cell,
- RgrUeUlPwrCfg *pwrCfg));
-static S16 rgSCHCfgVldtUeGrpPwrCfg ARGS((RgSchCellCb *cell,
- RgrUeGrpPwrCfg *grpPwrCfg));
-#ifdef LTEMAC_SPS
-static S16 rgSCHCfgVldtUeDlSpsCfg ARGS((RgSchCellCb *cell,
- RgrUeSpsDlCfg *dlSpsCfg));
-static S16 rgSCHCfgVldtSpsReCfg ARGS ((RgSchCellCb *cell,
- RgSchUeCb *ue, RgrUeRecfg *ueRecfg));
-#endif /*LTEMAC_SPS*/
-static S16 rgSCHCfgVldtUeCqiModeCfg ARGS((RgSchCellCb *cell,RgrUeDlCqiCfg *ueDlCqiCfg));
-static S16 rgSCHCfgVldtUeMeasGapAckNakRepCfg ARGS ((RgSchCellCb *cell,
- RgrUeCfg *ueCfg));
-static S16 rgSCHCfgVldtUeMeasGapAckNakRepRecfg ARGS ((RgSchCellCb *cell,
- RgrUeRecfg *ueRecfg));
-static Void rgSCHCfgFreeDlDedLcCb ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgSchDlLcCb *dlLc));
-static Void rgSCHCfgFreeDlCmnLcCb ARGS((RgSchClcDlLcCb *cmnDlLc));
-static Void rgSCHCfgFreeUeCb ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
-static Void rgSCHCfgFreeRgrCfgLst ARGS((RgSchCellCb *cell));
-static Void rgSCHCfgFreeCmnLcLst ARGS((RgSchCellCb *cell));
-static Void rgSCHCfgFreeUeLst ARGS((RgSchCellCb *cell));
-#ifdef LTEMAC_SPS
-static Void rgSCHCfgFreeSpsUeLst ARGS((RgSchCellCb *cell));
-#endif
-static S16 rgSCHCfgVldtRgrCmnLcCfg ARGS((Inst inst, RgrCellCfg *cellCfg,
- RgSchErrInfo *errInfo));
-static S16 rgSCHCfgVldtRgrCellPwrCfg ARGS((Inst inst, RgrCellCfg *cellCfg,
- RgSchErrInfo *errInfo));
-static S16 rgSCHCfgVldtRgrCellSchCfg ARGS((Inst inst, RgrCellCfg *cellCfg));
-static S16 rgSCHCfgVldtRgrSchCfg ARGS((Inst inst, RgrSchedEnbCfg *schedEnbCfg));
-static S16 rgSCHCfgVldtRgrCellRACfg ARGS((Inst inst, RgrCellCfg *cellCfg));
-static Void rgSCHCfgRgrUePhrMsg3 ARGS(( RgSchCellCb *cell,
- RgSchRaCb *raCb,RgSchUeCb *ue, RgSchErrInfo *errInfo));
-static S16 rgSCHCfgRgrCmnLcCfg ARGS((RgSchCellCb *cell, RgrCmnLchCfg *lcCfg,
- RgSchErrInfo *errInfo));
-Void rgSCHSCellFreeBuf ARGS((Inst inst,RgSchUeCb *ue,RgrUeRecfg *ueRecfg,uint8_t idx));
-#ifdef RGR_SI_SCH
-static S16 rgSCHCfgVldtRgrCellSiCfg ARGS(( Inst inst, RgrSiCfg *siCfg));
-#endif/*RGR_SI_SCH */
-
-/* LTE_ADV_FLAG_REMOVED_START */
-static S16 rgSCHCfgVldtRgrCellLteAdvCfg ARGS(( Inst inst,
- RgrLteAdvancedCellConfig *lteAdvCfg, uint8_t dlTotalBw));
-/* LTE_ADV_FLAG_REMOVED_END */
-
-static S16 rgSCHCfgVldtDrxUeCfg ARGS ((RgSchCellCb *cell,
- RgrUeDrxCfg *ueDrxCfg));
-static S16 rgSCHCfgVldtDrxOnDurCfg ARGS((uint8_t onDurTmr));
-static S16 rgSCHCfgVldtDrxInActvCfg ARGS((uint16_t inActvTmr));
-static S16 rgSCHCfgVldtDrxReTxCfg ARGS((uint8_t reTxTmr));
-static S16 rgSCHCfgVldtDrxLngCycCfg ARGS((RgrDrxLongCycleOffst lngCycleOffst));
-static S16 rgSCHCfgVldtDrxLngCyclTmrs ARGS((uint16_t val));
-static S16 rgSCHCfgVldtDrxShrtCycCfg ARGS((RgrDrxShortDrx shrtCycCfg));
-static S16 rgSCHCfgVldtRgrCellCsgParamCfg ARGS((Inst inst,
- RgrCellCsgParamCfg *csgParam));
-#ifdef TFU_UPGRADE
-
-S16 rgSCHCfgACqiUeCfg ARGS(( RgSchCellCb *cellCb,RgSchUeCb *ue, RgSchUeACqiCb *aCqiCb,
- RgrTxMode ueTxMode,RgrUeAprdDlCqiCfg *aCqiCfg, CmLteUeCategory ueCat ));
-
-S16 rgSCHCfgAcqiUeReCfg ARGS(( RgSchCellCb *cellCb, RgSchUeCb *ueCb,
- RgrUeAprdDlCqiCfg *acqiCfg, CmLteUeCategory ueCat ));
-
-S16 rgSCHUtlGetCfgPerOff ARGS(( RgSchPerTbl tbl, uint16_t cfgIdx,
- uint16_t *peri, uint16_t *offset ));
-
-S16 rgSCHCfgRiUeCfg ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb,
- RgrUePrdDlCqiCfg *cqiCfg, CmLteUeCategory ueCat ));
-
-S16 rgSCHCfgPCqiUeCfg ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb,
- RgrUePrdDlCqiCfg *cqiCfg,CmLteUeCategory ueCat ));
-
-S16 rgSCHCfgSrsUeCfg ARGS((RgSchCellCb *cellCb,RgSchUeCb *ueCb,
- RgrUeUlSrsCfg *srsCfg ));
-
-S16 rgSCHCfgSrUeCfg ARGS((RgSchCellCb *cellCb,RgSchUeCb *ueCb,
- RgrUeSrCfg *srCfg));
-
-S16 rgSCHCfgPCqiUeReCfg ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb,
- RgrUePrdDlCqiCfg *cqiCfg,CmLteUeCategory ueCat));
-
-S16 rgSCHCfgSrsUeReCfg ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb,
- RgrUeUlSrsCfg *srsCfg));
-
-S16 rgSCHCfgSrUeReCfg ARGS((RgSchCellCb *cellCb, RgSchUeCb *ueCb,
- RgrUeSrCfg *srCfg));
-
-S16 rgSCHCfgVldtRgrTxmodePuschMode ARGS((RgSchCellCb *cellCb,
- RgrTxMode txMde, RgrAprdCqiMode puschMode,RgSchErrInfo *errInfo));
-
-S16 rgSCHCfgVldtRgrUeACqiCfg ARGS(( RgSchCellCb *cellCb,
- CmLteRnti crnti, RgrUeAprdDlCqiCfg *acqiCfg, RgrUeTxModeCfg txMode,
- RgSchErrInfo *errInfo ));
-
-S16 rgSCHCfgVldtRgrTxmodePucchMode ARGS((RgSchCellCb *cellCb,
- RgrTxMode txMde, RgrPrdCqiMode pucchMode,RgSchErrInfo *errInfo));
-
-#ifdef LTEMAC_HDFDD
-S16 rgSCHCfgVldtRgrUePCqiCfg ARGS(( RgSchCellCb *cellCb,
- CmLteRnti crnti, RgrUePrdDlCqiCfg *cqiCfg, Bool hdFdd,
- RgrUeTxModeCfg txMode, RgSchErrInfo *errInfo));
-#else
-S16 rgSCHCfgVldtRgrUePCqiCfg ARGS(( RgSchCellCb *cellCb,
- CmLteRnti crnti, RgrUePrdDlCqiCfg *cqiCfg, RgrUeTxModeCfg txMode,
- RgSchErrInfo *errInfo));
-#endif
-#ifdef LTEMAC_HDFDD
-S16 rgSCHCfgVldtRgrUeUlSrsCfg ARGS ((RgSchCellCb *cellCb,
- CmLteRnti crnti, RgrUeUlSrsCfg *srsCfg, Bool hdFdd,
- RgSchErrInfo *errInfo));
-#else
-S16 rgSCHCfgVldtRgrUeUlSrsCfg ARGS ((RgSchCellCb *cellCb,
- CmLteRnti crnti, RgrUeUlSrsCfg *srsCfg,
- RgSchErrInfo *errInfo));
-#endif
-
-#ifdef LTEMAC_HDFDD
-S16 rgSCHCfgVldtRgrUeSrCfg ARGS((RgSchCellCb *cellCb, CmLteRnti crnti,
- RgrUeSrCfg *srCfg, Bool hdFdd, RgSchErrInfo *errInfo));
-#else
-S16 rgSCHCfgVldtRgrUeSrCfg ARGS((RgSchCellCb *cellCb, CmLteRnti crnti,
- RgrUeSrCfg *srCfg, RgSchErrInfo *errInfo));
-#endif
-static S16 rgSCHCfgVldtCqiSrSrsUeCfg ARGS (( RgSchCellCb *cellCb,
- RgrUeCfg *ueCfg,
- RgSchErrInfo *errInfo));
-
-static S16 rgSCHCfgVldtCqiSrSrsUeReCfg ARGS (( RgSchCellCb *cellCb,
- RgSchUeCb *ueCb,
- RgrUeRecfg *ueReCfg,
- RgSchErrInfo *errInfo ));
-
-S16 rgSCHCfgPCqiSrsSrUeDel ARGS ((RgSchCellCb *cellCb,
- RgSchUeCb *ueCb));
-
-static Void rgSCHCfgUtlFetchAcqiBitSz ARGS (( RgSchUeACqiCb *acqiCb,uint8_t numTxAnt,
- uint8_t* cqiPmiSzR1,uint8_t* cqiPmiSzRn1 ));
-
-/* Added the function to be used instead of the
- * MACRO RG_SCH_GET_PERIODICITY_TBL */
-static const RgSchUePCqiSrsSrCfgIdxTbl* rgSCHCfgUtlGetPcqiSrsSrRiTbl ARGS ((
- RgSchPerTbl tblType,
- uint8_t * min,
- uint8_t * max));
-
-#endif /* TFU_UPGRADE */
-static Void rgSCHCfgUeTaRecfg ARGS (( RgSchCellCb *cellCb,
- RgSchUeCb *ueCb,
- RgrUeRecfg *ueReCfg,
- RgSchErrInfo *errInfo ));
-#ifdef LTE_ADV
-S16 rgSCHSCellCfgUeCfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeRecfg *ueRecfg,
-RgSchErrInfo *err
-));
-
-S16 rgSCHSCellCfgUePucchReCfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeRecfg *ueRecfg,
-RgSchErrInfo *err
-));
-S16 rgSCHCfgVldtRgrUeSCellRecfg ARGS((
-RgrUeRecfg *ueRecfg,
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchErrInfo *errInfo
-));
-static S16 rgSCHSCellCfgUeCfgRollBack ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeRecfg *ueRecfg
-));
-#endif
-
-/* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#if ((defined (RGR_CQI_REPT)) && (defined (RGR_V2)))
-static S16 rgSCHCfgUeCqiReptReCfg ARGS ((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeRecfg *ueRecfg
-));
-
-static S16 rgSCHCfgVldtCqiReptReCfg ARGS ((
-RgSchCellCb *cell,
-RgrUeRecfg *ueRecfg
-));
-#endif
-/*LTE_L2_MEAS_PHASE2*/
-#ifdef LTE_L2_MEAS
-static S16 rgSchAddToL2Meas ARGS ((RgSchCellCb *cellCb,RgSchDlLcCb *dlLc));
-#endif
-#ifdef EMTC_ENABLE
-S16 rgSCHEmtcCfgVldtDrxOnDurCfg
-(
-uint16_t onDurTmr
-);
-Void rgSCHUtlUpdEmtcY
-(
-RgSchUeCb *ue
-);
-Void rgSCHEmtcHqPAlloc
-(
-RgSchCellCb *cell,
-RgSchDlHqEnt *hqEnt
-);
-#endif
-
-/* local typedefs */
-const RgSchSrsTxOffst rgSrsTxOffstTbl[RGSCH_MAX_SRS_SFCFG_IDX+1]=
- {{1,{0,0,0,0,0,0,0,0}},
- {1,{0,0,0,0,0,0,0,0}},
- {1,{1,0,0,0,0,0,0,0}},
- {1,{0,0,0,0,0,0,0,0}},
- {1,{1,0,0,0,0,0,0,0}},
- {1,{2,0,0,0,0,0,0,0}},
- {1,{3,0,0,0,0,0,0,0}},
- {2,{0,1,0,0,0,0,0,0}},
- {2,{2,3,0,0,0,0,0,0}},
- {1,{0,0,0,0,0,0,0,0}},
- {1,{1,0,0,0,0,0,0,0}},
- {1,{2,0,0,0,0,0,0,0}},
- {1,{3,0,0,0,0,0,0,0}},
- {7,{0,1,2,3,4,6,8,0}},
- {8,{0,1,2,3,4,5,6,8}},
- {0,{0,0,0,0,0,0,0,0}}};
-
-/* local externs */
-
-#ifdef TFU_UPGRADE
-/* SRSCfg Table: Ref 36.213, Table: 8.2.1 */
-const RgSchUePCqiSrsSrCfgIdxTbl
-rgSchUeSrsCfgIdxFddTbl[RG_SCH_SRS_ISRS_INDX_MAX_FDD]=
-{
- { 0,1, 2, 0 },
- { 2,6, 5, 2 },
- { 7,16, 10, 7 },
- { 17,36, 20, 17},
- { 37,76, 40, 37},
- { 77,156, 80, 77},
- { 157,316,160,157},
- { 317,636,320,317 }
-};
-
-/* Reference : 36.213 Table 8.2-2 */
-const RgSchUePCqiSrsSrCfgIdxTbl
-rgSchUeSrsCfgIdxTddTbl[RG_SCH_SRS_ISRS_INDX_MAX_TDD]=
-{
- { 10,14, 5, 10 },
- { 15,24, 10, 15 },
- { 25,44, 20, 25 },
- { 45,84, 40, 45 },
- { 85,164, 80, 85 },
- { 165,324,160, 165 },
- { 325,644,320, 325 }
- /* RESERVED: Configuration Module should not allow Res values */
-};
-
-/*Reference: 36.213 Table:7.2.2-1A */
-const RgSchUePCqiSrsSrCfgIdxTbl
-rgSchUePCqiCfgIdxFddTbl[RG_SCH_CQIPMI_CFGIDX_MAX_FDD]=
-{
- { 0,1, 2, 0 },
- { 2,6, 5, 2 },
- { 7,16, 10,7 },
- {17,36, 20,17},
- {37,76, 40, 37},
- {77,156, 80, 77},
- {157,316,160,157},
- {318,349,32,318},
- {350,413,64, 350},
- {414,541,128,414 }
- /* RESERVED: Configuration should not allow Res values */
-};
-
-/* Reference: 36.213 Table:7.2.2-1C */
-const RgSchUePCqiSrsSrCfgIdxTbl
-rgSchUeCqiPmiCfgIdxTddTbl[RG_SCH_CQIPMI_CFGIDX_MAX_TDD]=
-{
- { 0,0, 1, 0 },
- { 1,5, 5, 1 },
- { 6,15, 10,6 },
- {16,35, 20,16},
- {36,75, 40,36},
- {76,155, 80,76},
- {156,315,160,156}
- /* RESERVED: Configuration should not allow Res values */
-};
-
-/* Note: RI table is same for FDD and TDD */
-/*Reference: 36.213 Table:7.2.2-1B */
-const RgSchUePCqiSrsSrCfgIdxTbl
-rgSchUeRiCfgIdxTbl[RG_SCH_RI_CFGIDX_MAX]=
-{
- { 0,160, 1, 0 },
- { 161,321, 2, 161 },
- { 322,482, 4, 322 },
- { 483,643, 8, 483},
- { 644,804, 16,644},
- { 805,965, 32,805 }
- /* RESERVED: Configuration should not allow Res values */
-};
-
-/*Reference: 36.213 Table:7.2.2-2 */
-const RgSchUeBwSubSzBwParts
-rgSchUeBwSubSzBwPartsTbl[RG_SCH_BW_SUBSZ_BWPARTS_MAX]=
-{
- {6,7, 0, 0}, /*TODO: 6,7, NA, NA */
- {8, 10, 4,1},
- {11, 26, 4,2},
- {27, 63, 6,3},
- {64, 110, 8,4}
-};
-
-
-/* Reference : 36.213 Table 10.1-5 */
-/* Note: SR is same table for TDD and FDD */
-const RgSchUePCqiSrsSrCfgIdxTbl rgSchUeSrCfgIdxTbl[RG_SCH_ISR_INDX_MAX]=
-{
- { 0,4, 5, 0 },
- { 5,14, 10, 5 },
- { 15,34, 20,15 },
- { 35,74, 40,35},
- { 75,154, 80, 75}
- /* RESERVED: Configuration should not allow Res values */
-};
-
-/*Reference:36.213: Derived from Table: 7.2.1-5 for Label L.
- The Label L is CEIL(log2(BinCoe(N and M)))*/
-const uint8_t RgSCHUeAcqi2022LBitWidth[6][28] ={
-{0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5},
-{0,0,2,3,4,4,5,5,6,6,6,7,7,7,7,7,8,8,8,8,8,8,8,9,9,9,9,9},
-{0,0,0,2,4,5,6,6,7,7,8,8,9,9,9,10,10,10,10,11,11,11,11,11,12,12,12,12},
-{0,0,0,0,3,4,6,7,7,8,9,9,10,10,11,11,12,12,12,13,13,13,14,14,14,14,15,15},
-{0,0,0,0,0,3,5,6,7,8,9,10,11,11,12,13,13,14,14,14,15,15,16,16,16,17,17,17},
-{0,0,0,0,0,0,3,5,7,8,9,10,11,12,13,13,14,15,15,16,16,17,17,18,18,18,19,19}
-};
-
-#endif
-
-extern uint8_t rgSchCmnHarqRtt[];
-#ifdef EMTC_ENABLE
-S16 rgSCHEmtcCellAlloc ARGS((RgSchCellCb *cel));
-Void rgSCHEmtcCellFree ARGS((RgSchCellCb *cel));
-Void rgSCHEmtcUeInfoFree ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
-uint8_t rgSchfillPucchSrRepNumCountemtc ARGS((RgSchUeCb *ueCb));
-uint8_t rgSchfillPucchCqiRepNumCountemtc ARGS((RgSchUePCqiCb *cqiCb, RgSchUeCb *ueCb));
-S16 rgEmtcvalidateSiCfg ARGS((RgrSiCfgReqInfo *siCfg,RgSchCellCb *cell));
-#endif
-/* forward references */
-
-
-/**
- * @brief Validates the SCH EndoeB configuration request from RRM to SCH.
- *
- * @details
- *
- * Function : rgSCHCfgVldtRgrSchedEnbCfg
- *
- ** Processing Steps:
- * - Retrieve the cell control block.
- * - If successful,
- * - Validate the range of configured values recieved in
- * configuration request.
- * - If validated successfully,
- * - Return ROK and pointer to the cell.
- * - Else
- * - Return RFAILED.
- * - Else return RFAILED.
- * @param[in] Inst inst
- * @param[in] RgrSchedEnbCfg *schedEnbCfg
- * @param[out] RgSchCellCb **cell
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgVldtRgrSchedEnbCfg
-(
-Inst inst,
-RgrSchedEnbCfg *schedEnbCfg,
-RgSchErrInfo *errInfo
-)
-{
- DU_LOG("\nDEBUG --> SCH : VALIDATE RGR SCH ENB CONFIG: \n");
-
- errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_ENB_CFG;
-
- // TODO
- if ((rgSCHCfgVldtRgrSchCfg(inst, schedEnbCfg)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Validation for scheduler related "
- "config failed\n");
- return RFAILED;
- }
-
- DU_LOG("\nINFO --> SCH : MIMO_DBG:: SCH:: numAntPorts=%d\n",schedEnbCfg->numTxAntPorts);
-
- /* Validation for the ENB parameters */
- if ((schedEnbCfg->numTxAntPorts == 0) || (schedEnbCfg->numTxAntPorts > 4))
- {
- DU_LOG("\nERROR --> SCH : Invalid number of transmit antenna"
- " ports %d\n", schedEnbCfg->numTxAntPorts);
- return RFAILED;
- }
-
- /* Validate csg access mode */
- if((schedEnbCfg->accsMode < RGR_CELL_ACCS_OPEN) ||
- (schedEnbCfg->accsMode > RGR_CELL_ACCS_HYBRID))
- {
- DU_LOG("\nERROR --> SCH : Invalid CSG Access mode\n");
- return RFAILED;
- }
-
- errInfo->errCause = RGSCHERR_NONE;
- DU_LOG("\nINFO --> SCH : RGR SCHED ENB config validation done:");
-
- return ROK;
-} /* rgSCHCfgVldtRgrSchedEnbCfg */
-
-/**
- * @brief Validates the cell configuration request from RRM to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgVldtRgrCellCfg
- *
- * Processing Steps:
- * - Retrieve the cell control block.
- * - If successful,
- * - Validate the range of configured values recieved in
- * configuration request.
- * - If validated successfully,
- * - Return ROK and pointer to the cell.
- * - Else
- * - Return RFAILED.
- * - Else return RFAILED.
- * @param[in] Inst inst
- * @param[in] RgrCellCfg *cellCfg
- * @param[out] RgSchCellCb **cell
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgVldtRgrCellCfg
-(
-Inst inst,
-RgrCellCfg *cellCfg,
-RgSchCellCb *cell,
-RgSchErrInfo *errInfo
-)
-{
- errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_CELL_CFG;
-
- /* check if cell exists already */
- if ((uint8_t *)cell != NULLP)
- {
- DU_LOG("\nERROR --> SCH : Cell Id already exists");
- return RFAILED;
- }
-
- if(cellCfg->macInst >= SCH_INST_START)
- {
- DU_LOG("\nERROR --> SCH : Invalid MAC Instance %d ",
- cellCfg->macInst);
- return RFAILED;
- }
-
- if (cellCfg->macRnti.startRnti < RGSCH_MIN_MAC_RNTI )
- {
- DU_LOG("\nERROR --> SCH : Invalid start RNTI %d for cell ",
- cellCfg->macRnti.startRnti);
- return RFAILED;
- }
-
- if ((rgSCHCfgVldtRgrCellSchCfg(inst, cellCfg)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Validation for scheduler related "
- "config failed");
- return RFAILED;
- }
-
- if ((cellCfg->dlHqCfg.maxDlHqTx < RGSCH_MIN_HQ_TX) ||
- (cellCfg->dlHqCfg.maxMsg4HqTx < RGSCH_MIN_HQ_TX))
- {
- DU_LOG("\nERROR --> SCH : Invalid Downlink HARQ configuration:"
- " maxDlHqTx %d maxMsg4HqTx %d", cellCfg->dlHqCfg.maxDlHqTx,
- cellCfg->dlHqCfg.maxMsg4HqTx);
- return RFAILED;
- }
- if ((cellCfg->cfiCfg.cfi < RGSCH_MIN_CFI_VAL) ||
- (cellCfg->cfiCfg.cfi > RGSCH_MAX_CFI_VAL))
- {
- DU_LOG("\nERROR --> SCH : Invalid CFI configuration %d",
- cellCfg->cfiCfg.cfi);
- return RFAILED;
- }
- if (((cellCfg->puschSubBand.subbandStart) +
- ((cellCfg->puschSubBand.numSubbands -1) * cellCfg->puschSubBand.size))
- > (cellCfg->bwCfg.ulTotalBw - 1))
- {
- DU_LOG("\nERROR --> SCH : Invalid PUSCH subband configuration:"
- " subBandStart %d numSubBands %d subBandSize %d ulTotBw %d",
- cellCfg->puschSubBand.subbandStart,
- cellCfg->puschSubBand.numSubbands, cellCfg->puschSubBand.size,
- cellCfg->bwCfg.ulTotalBw);
- return RFAILED;
- }
-
- if (((cellCfg->bwCfg.dlTotalBw < RGSCH_MIN_DL_BW) ||
- (cellCfg->bwCfg.dlTotalBw > RGSCH_MAX_DL_BW)) ||
- ((cellCfg->bwCfg.ulTotalBw < RGSCH_MIN_UL_BW) ||
- (cellCfg->bwCfg.ulTotalBw > RGSCH_MAX_UL_BW)))
- {
- DU_LOG("\nERROR --> SCH : Invalid Bandwidth configuration:"
- " ul %d dl %d",cellCfg->bwCfg.ulTotalBw,
- cellCfg->bwCfg.dlTotalBw);
- return RFAILED;
- }
- if (cellCfg->phichCfg.ngEnum > RGR_NG_TWO)
- {
- DU_LOG("\nERROR --> SCH : Invalid PHICH Ng configuration %d",
- (uint8_t)cellCfg->phichCfg.ngEnum);
- return RFAILED;
- }
- /* Validation for extended PHICH Duration */
- if ((cellCfg->phichCfg.isDurExtend == TRUE) &&
- (cellCfg->bwCfg.dlTotalBw <= 10) && (cellCfg->cfiCfg.cfi < 2))
- {
- DU_LOG("\nERROR --> SCH : Invalid cfi value for"
- "Extended PHICH duration cfi:%d dlBw:%d",
- (uint8_t)cellCfg->cfiCfg.cfi, cellCfg->bwCfg.dlTotalBw);
- return RFAILED;
- }
- if ((cellCfg->phichCfg.isDurExtend == TRUE) &&
- (cellCfg->bwCfg.dlTotalBw > 10) && (cellCfg->cfiCfg.cfi < 3))
- {
- DU_LOG("\nERROR --> SCH : Invalid cfi value for"
- "Extended PHICH duration cfi:%d dlBw:%d",
- (uint8_t)cellCfg->cfiCfg.cfi, cellCfg->bwCfg.dlTotalBw);
- return RFAILED;
- }
- DU_LOG("\nINFO --> SCH : CA_DBG:: PUCCH configuration:"
- " N2_RB %d N1_PUCCH %d deltaShift %d cyclicShift %d",
- cellCfg->pucchCfg.resourceSize,
- cellCfg->pucchCfg.n1PucchAn,
- cellCfg->pucchCfg.deltaShift,
- cellCfg->pucchCfg.cyclicShift);
-
- /* ccpu00138567- Removing validation check for resourceSize as 0.
- * From the spec, n2RB value 0 is a valid config. */
- if ((cellCfg->pucchCfg.resourceSize >= cellCfg->bwCfg.ulTotalBw/2) ||
- (cellCfg->pucchCfg.n1PucchAn == 0) ||
- (cellCfg->pucchCfg.deltaShift < RGSCH_PUCCH_MINVAL_DS) ||
- (cellCfg->pucchCfg.deltaShift > RGSCH_PUCCH_MAXVAL_DS) ||
- (cellCfg->pucchCfg.cyclicShift > RGSCH_PUCCH_MAXVAL_CS))
- {
- DU_LOG("\nERROR --> SCH : Invalid PUCCH configuration:"
- " N2_RB %d N1_PUCCH %d deltaShift %d cyclicShift %d",
- cellCfg->pucchCfg.resourceSize,
- cellCfg->pucchCfg.n1PucchAn,
- cellCfg->pucchCfg.deltaShift,
- cellCfg->pucchCfg.cyclicShift);
- return RFAILED;
- }
- if (cellCfg->srsCfg.isSrsCfgSetup && cellCfg->srsCfg.srsBwEnum > RGR_SRS_BWCFG_7)
- {
- DU_LOG("\nERROR --> SCH : Invalid SRS configuration: "
- " srsBw %d", (uint8_t)cellCfg->srsCfg.srsBwEnum);
- return RFAILED;
- }
-
- if ((rgSCHCfgVldtRgrCellRACfg(inst, cellCfg)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Validation for Random access related"
- "config failed");
- return RFAILED;
- }
-
- if ((rgSCHCfgVldtRgrCellPwrCfg(inst, cellCfg, errInfo)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Validation for cell power "
- "config failed");
- return RFAILED;
- }
-
- /* Validate the common logical channel configuration */
- if( (cellCfg->numCmnLcs < RGR_MIN_CMN_LC_PER_CELL)||
- (cellCfg->numCmnLcs > RGR_MAX_CMN_LC_PER_CELL))
- {
- DU_LOG("\nERROR --> SCH : Invalid number(%d) of common logical"
- "channels in cell config", cellCfg->numCmnLcs);
- return RFAILED;
- }
- if ((rgSCHCfgVldtRgrCmnLcCfg(inst, cellCfg, errInfo)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Validation for common logical"
- "channels failed");
- return RFAILED;
- }
-
- /* Added 0 as a valid value for number of TICKs RRM
- * 0 implies no ticks i.e. shutting off the feature.*/
-
-#ifdef RGR_SI_SCH
- if ((rgSCHCfgVldtRgrCellSiCfg(inst, &(cellCfg->siCfg))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Validation for SI"
- "configuration failed");
- return RFAILED;
- }
-#endif /*RGR_SI_SCH */
-
- /*ccpu00116923 - ADD - Srs Present support - Start*/
-#ifdef TFU_UPGRADE
-#ifdef LTE_TDD
- if(cellCfg->srsCfg.isSrsCfgSetup && cellCfg->srsCfg.srsSubFrameCfg > 13)
-#else
- if(cellCfg->srsCfg.isSrsCfgSetup && cellCfg->srsCfg.srsSubFrameCfg > 14)
-#endif
- {
- DU_LOG("\nERROR --> SCH : Invalid"
- "Subframe configuration");
- return RFAILED;
- }
-#endif
- /*ccpu00116923 - ADD - Srs Present support - End*/
-
- if ((cellCfg->bcchTxPwrOffset > 10000) ||
- (cellCfg->pcchTxPwrOffset > 10000) ||
- (cellCfg->rarTxPwrOffset > 10000) ||
- (cellCfg->phichTxPwrOffset > 10000)
- )
- {
- DU_LOG("\nERROR --> SCH : Invalid txPower offset ");
-
- return RFAILED;
- }
-
-/* LTE_ADV_FLAG_REMOVED_START */
- /* Checking Whether DSFR is enabled without enabling SFR */
- if(((cellCfg->rgrLteAdvCfg.pres & RGR_DSFR) &&
- (RGR_ENABLE == cellCfg->rgrLteAdvCfg.dsfrCfg.status)) &&
- (!((cellCfg->rgrLteAdvCfg.pres & RGR_SFR) &&
- (RGR_ENABLE == cellCfg->rgrLteAdvCfg.sfrCfg.status))))
- {
- DU_LOG("\nERROR --> SCH : DSFR is enbaled"
- "Without enabling SFR");
- return RFAILED;
- }
-
- if ((rgSCHCfgVldtRgrCellLteAdvCfg(inst, &(cellCfg->rgrLteAdvCfg),
- cellCfg->bwCfg.dlTotalBw)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Validation for LTE Adv"
- "configuration failed");
- return RFAILED;
- }
-#ifdef LTE_ADV
- if ((rgSCHCfgVldtRgrCellLteLAACfg(inst, cellCfg)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Validation for LTE LAA"
- "configuration failed");
- return RFAILED;
- }
-#endif
-/* LTE_ADV_FLAG_REMOVED_END */
- if (cellCfg->msg4pAVal > RGRUE_DLPWRCNTRL_PA_DB3)
- {
- DU_LOG("\nERROR --> SCH : Invalid"
- "msg4pAVal %u", cellCfg->msg4pAVal);
- return RFAILED;
- }
-
- /* Validate RgrCellCsgParamCfg */
- if(rgSchCb[inst].rgrSchedEnbCfg.accsMode == RGR_CELL_ACCS_HYBRID)
- {
- if((rgSCHCfgVldtRgrCellCsgParamCfg(inst,
- &(cellCfg->csgParamCfg)) != ROK))
- {
- DU_LOG("\nERROR --> SCH : Validation failed for \n"
- "Access CSG parameter failed\n");
- return RFAILED;
- }
- }
-#ifdef EMTC_ENABLE
- if (cellCfg->emtcEnable)
- {
- if(ROK != rgSCHCfgVldtRgrEmtcCellCfg(cellCfg))
- {
- DU_LOG("\nERROR --> SCH : Invalid EMTC cell Configuration %d for cell" ,cellCfg->cellId);
- return RFAILED;
- }
- }
-#endif
- errInfo->errCause = RGSCHERR_NONE;
- return ROK;
-} /* rgSCHCfgVldtRgrCellCfg */
-
-/**
- * @brief Validates the scheduler related configuration request from RRM to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgVldtRgrSchCfg
- *
- * Processing Steps:
- * - Validate the scheduler related configuration request from RRC to MAC at CFG:
- * validate the value range for the configured values.
- * - If validated successfully,
- * - Return ROK .
- * - Else
- * - Return RFAILED.
- *
- * @param[in] Inst inst
- * @param[out] RgSchedCfg *rgSchedCfg
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgVldtRgrSchCfg
-(
-Inst inst,
-RgrSchedEnbCfg *rgSchedCfg
-)
-{
- DU_LOG("\nDEBUG --> SCH : rgSCHCfgVldtRgrSchCfg:Validating \
- scheduler related Configuration");
- if (rgSchedCfg->ulSchdType > (RGSCH_NUM_SCHEDULERS - 1))
- {
- DU_LOG("\nERROR --> SCH : rgSCHCfgVldtRgrSchCfg:Invalid \
- UL scheduler type %d \n", rgSchedCfg->ulSchdType);
- return RFAILED;
- }
- if (rgSchedCfg->dlSchdType > (RGSCH_NUM_SCHEDULERS - 1))
- {
- DU_LOG("\nERROR --> SCH : rgSCHCfgVldtRgrSchCfg:Invalid \
- DL scheduler type %d \n", rgSchedCfg->dlSchdType);
- return RFAILED;
- }
- return ROK;
-}
-/**
- * @brief Validates the scheduler related configuration request from RRM to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgVldtRgrCellSchCfg
- *
- * Processing Steps:
- * - Validate the scheduler related configuration request from RRC to MAC at CFG:
- * validate the value range for the configured values.
- * - If validated successfully,
- * - Return ROK and pointer to the cell of UE.
- * - Else
- * - Return RFAILED.
- *
- * @param[in] Inst inst
- * @param[out] RgSchCellCfg *cellCfg
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgVldtRgrCellSchCfg
-(
-Inst inst,
-RgrCellCfg *cellCfg
-)
-{
-
-#if RGSCH_NUM_DLFS_SCHEDULERS
- if (cellCfg->dlfsSchdType > RGSCH_NUM_DLFS_SCHEDULERS - 1)
- {
- DU_LOG("\nERROR --> SCH : Invalid dlfs scheduler type %d for cell",
- cellCfg->dlfsSchdType);
- return RFAILED;
- }
-#endif
- return ROK;
-}
-/**
- * @brief Validates the RACH related configuration request from RRM to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgVldtRgrCellRACfg
- *
- * Processing Steps:
- * - Validate the RA configuration request from RRC to MAC at CFG:
- * validate the value range for the configured values.
- * - If validated successfully,
- * - Return ROK and pointer to the cell of UE.
- * - Else
- * - Return RFAILED.
- *
- * @param[in] Inst inst
- * @param[out] RgSchCellCfg *cellCfg
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgVldtRgrCellRACfg
-(
-Inst inst,
-RgrCellCfg *cellCfg
-)
-{
-
-#ifdef LTE_TDD
- if ((cellCfg->rachCfg.preambleFormat > RGSCH_MAX_TDD_RA_PREAMBLE_FMT) ||
-#else
- if ((cellCfg->rachCfg.preambleFormat > RGSCH_MAX_RA_PREAMBLE_FMT) ||
-#endif
- (cellCfg->rachCfg.raWinSize < RGSCH_MIN_RA_WINSIZE) ||
- (cellCfg->rachCfg.raWinSize > RGSCH_MAX_RA_WINSIZE) ||
- (cellCfg->rachCfg.maxMsg3Tx < RGSCH_MIN_HQ_TX) ||
- (cellCfg->rachCfg.numRaPreamble < RGSCH_MIN_NUM_RA_PREAMBLE) ||
- (cellCfg->rachCfg.numRaPreamble > RGSCH_MAX_NUM_RA_PREAMBLE) ||
- (cellCfg->rachCfg.sizeRaPreambleGrpA >
- cellCfg->rachCfg.numRaPreamble) ||
- (cellCfg->rachCfg.prachResource >
- (cellCfg->bwCfg.ulTotalBw - RGSCH_NUM_RA_RB)))
- {
- DU_LOG("\nERROR --> SCH : Invalid RACH configuration:"
- "preamble Fmt %d raWinSize %d maxMsg3Tx %d",
- cellCfg->rachCfg.preambleFormat, cellCfg->rachCfg.raWinSize,
- cellCfg->rachCfg.maxMsg3Tx);
- DU_LOG("\nERROR --> SCH : Invalid numRaPreamble %d sizeRaPreambleGrpA %d",
- cellCfg->rachCfg.numRaPreamble,
- cellCfg->rachCfg.sizeRaPreambleGrpA);
- return RFAILED;
- }
- /* RACHO */
- /* verify that the ded Preambles cfgd for Pdcch Order
- * do not collide with that of non-dedicated and validates against
- * the configuration index and number of RACH
- * ded-preambles. For non-zero ded preamble cfg,
- * the config index is expected to be != NA.*/
- if ((cellCfg->macPreambleSet.pres) &&
- ((cellCfg->macPreambleSet.start < cellCfg->rachCfg.numRaPreamble) ||
- (cellCfg->macPreambleSet.start >= RGSCH_MAX_NUM_RA_PREAMBLE) ||
- (cellCfg->macPreambleSet.size < 1) ||
- (cellCfg->macPreambleSet.size > RGSCH_MAX_NUM_RA_PREAMBLE-
- cellCfg->rachCfg.numRaPreamble) ||
- (cellCfg->rachCfg.raOccasion.sfnEnum == RGR_SFN_NA)))
- {
- DU_LOG("\nERROR --> SCH : Invalid RACH Preambleset conf:"
- "preambleSet Start %d preambleSet Size %d",
- cellCfg->macPreambleSet.start, cellCfg->macPreambleSet.size);
- return RFAILED;
- }
-#ifdef RGR_V1
- if(cellCfg->rachCfg.contResTmr)
- {
- uint8_t idx;
-#ifdef LTE_TDD
- idx = cellCfg->ulDlCfgIdx;
-#else
- idx = 7; /* FDD */
-#endif
- /* maxMsg4TxDelay = (HARQ_RTT * MAX_MSG4_HARQ_RETX) +
- 3 TTI (MAX L1+L2 processing delay at the UE) */
- uint8_t maxMsg4TxDelay = (cellCfg->dlHqCfg.maxMsg4HqTx-1) *
- rgSchCmnHarqRtt[idx] + 3;
-
-
- if(maxMsg4TxDelay >= cellCfg->rachCfg.contResTmr)
- {
- DU_LOG("\nERROR --> SCH : Warining !: Contention Resolution timer not greater than the "
- "guard timer. Conte Res timer %d Guard timer %d",
- cellCfg->rachCfg.contResTmr,
- maxMsg4TxDelay );
- /* [ccpu00138532]-DEL- removed return fail here as it is ok if the
- max Msg4 Tx delay is more than the contension Resolution timer.
- In such case, the CRI CE will be scheduled immediately once
- msg3 is received */
- }
- }
- else
- {
- /* ccpu00128575 ADD - If contention resolution timer is configured as 0,
- Then return fail*/
- DU_LOG("\nERROR --> SCH : Contention Resolution timer is configured as '0'");
- return RFAILED;
- }
-#endif
-
- return ROK;
-}
-
-/**
- * @brief Validates the UE configuration request from RRM to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgVldtRgrUeCfg
- *
- * Processing Steps:
- * - Validate the UE configuration request from RRC to MAC at CFG:
- * validate the value range for the configured values.
- * - If validated successfully,
- * - Return ROK and pointer to the cell of UE.
- * - Else
- * - Return RFAILED.
- *
- * @param[in] Inst inst
- * @param[in] RgrUeCfg *ueCfg
- * @param[out] RgSchCellCb **cell
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgVldtRgrUeCfg
-(
-Inst inst,
-RgrUeCfg *ueCfg,
-RgSchCellCb **cell,
-RgSchErrInfo *errInfo
-)
-{
- errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_UE_CFG;
-
- if (((*cell) == NULLP) ||
- ((*cell)->cellId != ueCfg->cellId))
- {
- DU_LOG("\nERROR --> SCH : Cell does not exist %d",
- ueCfg->cellId);
- return RFAILED;
- }
- /* RACHO:
- * Check configured preamble id not colliding with non dedicated or PDCCH
- * order preamble sets. When valid preamble id given check that C-RNTI given
- * in configuration is not amongst the C-RNTI'smanaged by scheduler */
- if ((rgSCHRamVldtUeCfg(*cell, ueCfg)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : CELLID:%d Preamble Id configuration"
- "failed ",ueCfg->cellId);
- return RFAILED;
- }
- /* Check if Ue already configured */
- if (rgSCHDbmGetUeCb(*cell, ueCfg->crnti) != NULLP)
- {
- DU_LOG("\nERROR --> SCH : CELLID:%d UEID already exists",
- ueCfg->cellId);
- return RFAILED;
- }
- /* Validate Transmission UE modes */
- if ((ueCfg->txMode.pres == TRUE) && ((ueCfg->txMode.txModeEnum < RGR_UE_TM_1)
- || (ueCfg->txMode.txModeEnum > RGR_UE_TM_7)))
- {
- DU_LOG("\nERROR --> SCH : CELLID:%d Invalid transmission mode for"
- " UE is %d", ueCfg->cellId,(uint8_t)ueCfg->txMode.txModeEnum);
- return RFAILED;
- }
-
- /* Validate UE Category */
- if (ueCfg->ueCatEnum > CM_LTE_UE_CAT_8)
- {
- DU_LOG("\nERROR --> SCH : CELLID:%d Invalid category for UE %d",
- ueCfg->cellId,(uint8_t)ueCfg->ueCatEnum);
- return RFAILED;
- }
-
- /* Validate UE Access Stratum Release */
- if (ueCfg->accessStratumRls > RGR_REL_10)
- {
- RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "Invalid Access Stratum Release %u for UE\n",
- ueCfg->accessStratumRls));
- return RFAILED;
- }
- RGSCHDBGINFONEW(inst, (rgSchPBuf(inst), "Configured Access Stratum Release %u\n", \
- ueCfg->accessStratumRls));
-
- if ((*cell)->numTxAntPorts == 1)
- {
- if ((ueCfg->txMode.pres == TRUE) &&
- (ueCfg->txMode.txModeEnum > RGR_UE_TM_1))
- {
- DU_LOG("\nERROR --> SCH : CELLID:%d Invalid transmission mode for"
- " UE (%d) for the configured Cell Antenna Ports",ueCfg->cellId,
- (uint8_t)ueCfg->txMode.txModeEnum);
- return RFAILED;
- }
- }
-
- if ((rgSCHCfgVldtUeCqiModeCfg(*cell, &ueCfg->ueDlCqiCfg)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : CELLID:%d Invalid CQI Mode configuration",
- ueCfg->cellId);
- return RFAILED;
- }
-
- /* Validate Max Uplink HARQ transmission value */
- if (ueCfg->ueUlHqCfg.maxUlHqTx < RGSCH_MIN_HQ_TX)
- {
- DU_LOG("\nERROR --> SCH : CELLID:%d Invalid Uplink HARQ config for "
- "UE %d",ueCfg->cellId,ueCfg->ueUlHqCfg.maxUlHqTx);
- return RFAILED;
- }
-
- if (rgSCHCfgVldtUePwrCfg(*cell, &ueCfg->ueUlPwrCfg) != ROK)
- {
- DU_LOG("\nERROR --> SCH : CELLID:%d Invalid PUSCH Group power"
- " configuration",ueCfg->cellId);
- return RFAILED;
- }
-
- if (rgSCHCfgVldtUeMeasGapAckNakRepCfg(*cell, ueCfg) != ROK)
- {
- DU_LOG("\nERROR --> SCH : CELLID:%d Invalid MeasGap/AckNackRep"
- " configuration",ueCfg->cellId);
- return RFAILED;
- }
-
-#ifdef LTEMAC_SPS
- /* Validating SPS RNTI */
- if (((ueCfg->ueSpsCfg.spsRnti >= (*cell)->rntiDb.rntiStart) &&
- (ueCfg->ueSpsCfg.spsRnti<=((*cell)->rntiDb.rntiStart+(*cell)->rntiDb.maxRntis)))
- ||(ueCfg->ueSpsCfg.spsRnti == RGSCH_SI_RNTI)
- ||(ueCfg->ueSpsCfg.spsRnti == RGSCH_P_RNTI))
- {
- DU_LOG("\nERROR --> SCH : CELLID:%d Invalid SPS RNTI "
- " in DL SPS Config",ueCfg->cellId);
- return RFAILED;
- }
-
- if (ueCfg->ueSpsCfg.dlSpsCfg.isDlSpsEnabled)
- {
- if (rgSCHCfgVldtUeDlSpsCfg(*cell, &ueCfg->ueSpsCfg.dlSpsCfg) != ROK)
- {
- DU_LOG("\nERROR --> SCH : CELLID:%d Invalid DL SPS configuration"
- " for the UE",ueCfg->cellId);
- return RFAILED;
- }
- }
-#endif
-#ifdef TFU_UPGRADE
- /* Validated Periodic CQI/PMI, RI , SRS and SR related UeCfg */
- if ( ROK != rgSCHCfgVldtCqiSrSrsUeCfg(*cell, ueCfg, errInfo))
- {
- DU_LOG("\nERROR --> SCH : CELLID:%d Invalid Periodic CQI/SR/SRS"
- "configuration",ueCfg->cellId);
- return RFAILED;
- }
-#endif
-
- /* Validate DRX specific parameters */
- if ( ROK != rgSCHCfgVldtDrxUeCfg(*cell, &(ueCfg->ueDrxCfg)))
- {
- DU_LOG("\nERROR --> SCH : CELLID:%d Invalid DRX configuration",
- ueCfg->cellId);
- return RFAILED;
- }
-
-/* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
- if (ueCfg->ueCqiReptCfg.numColltdCqiRept > RGR_CQIRPTS_MAXN)
- {
- DU_LOG("\nERROR --> SCH : CELLID:%d Invalid numColltdCqiRept,"
- "MAX supported %d",RGR_CQIRPTS_MAXN,ueCfg->cellId);
- return RFAILED;
- }
-#endif /* End of RGR_CQI_REPT */
-
-#ifdef EMTC_ENABLE
-/*This is to validate the EMTC related configuration if a UE is an EMTC UE*/
- if(TRUE == ueCfg->emtcUeCfg.pres)
- {
- if ( ROK != rgSCHCfgVldtEmtcUeCfg(*cell, &(ueCfg->emtcUeCfg)))
- {
- DU_LOG("\nERROR --> SCH : CELLID:%d Invalid EMTC UE configurationfor crnti:%d",
- ueCfg->cellId, ueCfg->crnti);
- return RFAILED;
- }
- }
-#endif
- errInfo->errCause = RGSCHERR_NONE;
- return ROK;
-} /* rgSCHCfgVldtRgrUeCfg */
-
-
-/**
- * @brief Validates the cell reconfiguration request from RRM to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgVldtRgrCellRecfg
- *
- * Processing Steps:
- * - Retrieve the cell control block.
- * - If successful,
- * - Validate the range of reconfigured values recieved in
- * re-configuration request.
- * - If validated successfully,
- * - Return ROK and pointer to the cell.
- * - Else
- * - Return RFAILED.
- * - Else return RFAILED.
- *
- * @param[in] Inst inst
- * @param[in] RgrCellRecfg *cellRecfg
- * @param[out] RgSchCellCb **cell
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgVldtRgrCellRecfg
-(
-Inst inst,
-RgrCellRecfg *cellRecfg,
-RgSchCellCb **cell,
-RgSchErrInfo *errInfo
-)
-{
-
- errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_CELL_RECFG;
-
- /* Fetch cell and validate cell Id with the cell control block*/
- if (((*cell) == NULLP) ||
- ((*cell)->cellId != cellRecfg->cellId))
- {
- DU_LOG("\nERROR --> SCH : Cell control block does not exist");
- return RFAILED;
- }
-
- /* Validate recieved values */
- if ((cellRecfg->recfgTypes & RGR_CELL_DL_HARQ_RECFG) &&
- ((cellRecfg->dlHqRecfg.maxDlHqTx < RGSCH_MIN_HQ_TX) ||
- (cellRecfg->dlHqRecfg.maxMsg4HqTx < RGSCH_MIN_HQ_TX)))
- {
- DU_LOG("\nERROR --> SCH : Invalid Downlink HARQ configuration:"
- " maxDlHqTx %d maxMsg4HqTx %d", cellRecfg->dlHqRecfg.maxDlHqTx,
- cellRecfg->dlHqRecfg.maxMsg4HqTx);
- return RFAILED;
- }
- if ((cellRecfg->recfgTypes & RGR_CELL_CFI_RECFG) &&
- ((cellRecfg->cfiRecfg.cfi < RGSCH_MIN_CFI_VAL) ||
- (cellRecfg->cfiRecfg.cfi > RGSCH_MAX_CFI_VAL)))
- {
- DU_LOG("\nERROR --> SCH : Invalid CFI configuration %d",
- cellRecfg->cfiRecfg.cfi);
- return RFAILED;
- }
- if (cellRecfg->recfgTypes & RGR_CELL_PUCCH_RECFG)
- {
- /* ccpu00138567- Removing validation check for resourceSize as 0.
- * From the spec, n2RB value 0 is a valid config. */
- if ((cellRecfg->pucchRecfg.n1PucchAn == 0) ||
- (cellRecfg->pucchRecfg.resourceSize >= (*cell)->bwCfg.ulTotalBw/2)||
- ((cellRecfg->pucchRecfg.deltaShift < RGSCH_PUCCH_MINVAL_DS) ||
- (cellRecfg->pucchRecfg.deltaShift > RGSCH_PUCCH_MAXVAL_DS)) ||
- (cellRecfg->pucchRecfg.cyclicShift > RGSCH_PUCCH_MAXVAL_CS))
- {
- DU_LOG("\nERROR --> SCH : Invalid PUCCH configuration: "
- "N2_RB %d N1_PUCCH %d deltaShift %d cyclicShift %d",
- cellRecfg->pucchRecfg.resourceSize,
- cellRecfg->pucchRecfg.n1PucchAn,
- cellRecfg->pucchRecfg.deltaShift,
- cellRecfg->pucchRecfg.cyclicShift);
- return RFAILED;
- }
- }
- if (cellRecfg->recfgTypes & RGR_CELL_SRS_RECFG)
- {
- if (cellRecfg->srsRecfg.isSrsCfgSetup && cellRecfg->srsRecfg.srsBwEnum > RGR_SRS_BWCFG_7)
- {
- DU_LOG("\nERROR --> SCH : Invalid SRS configuration: "
- "srsBw %d", (uint8_t)cellRecfg->srsRecfg.srsBwEnum);
- return RFAILED;
- }
-
- /*ccpu00116923 - ADD - Srs Present support - Start*/
-#ifdef TFU_UPGRADE
-#ifdef LTE_TDD
- if(cellRecfg->srsRecfg.isSrsCfgSetup && cellRecfg->srsRecfg.srsSubFrameCfg > 13)
-#else
- if(cellRecfg->srsRecfg.isSrsCfgSetup && cellRecfg->srsRecfg.srsSubFrameCfg > 14)
-#endif
- {
- DU_LOG("\nERROR --> SCH : Invalid Subframe configuration ");
- return RFAILED;
- }
-#endif
- /*ccpu00116923 - ADD - Srs Present support - End*/
- }
- if (cellRecfg->recfgTypes & RGR_CELL_RACH_RECFG)
- {
- if ((cellRecfg->rachRecfg.preambleFormat > RGSCH_MAX_RA_PREAMBLE_FMT) ||
- ((cellRecfg->rachRecfg.raWinSize < RGSCH_MIN_RA_WINSIZE) ||
- (cellRecfg->rachRecfg.raWinSize > RGSCH_MAX_RA_WINSIZE)) ||
- (cellRecfg->rachRecfg.maxMsg3Tx < RGSCH_MIN_HQ_TX) ||
- ((cellRecfg->rachRecfg.numRaPreamble < RGSCH_MIN_NUM_RA_PREAMBLE)
- || (cellRecfg->rachRecfg.numRaPreamble > RGSCH_MAX_NUM_RA_PREAMBLE))
- || (cellRecfg->rachRecfg.sizeRaPreambleGrpA >
- cellRecfg->rachRecfg.numRaPreamble) ||
- (cellRecfg->rachRecfg.prachResource >
- (*cell)->bwCfg.ulTotalBw - RGSCH_NUM_RA_RB))
- {
- DU_LOG("\nERROR --> SCH : Invalid RACH configuration:"
- " preamble Fmt %d raWinSize %d maxMsg3Tx %d",
- cellRecfg->rachRecfg.preambleFormat,
- cellRecfg->rachRecfg.raWinSize,
- cellRecfg->rachRecfg.maxMsg3Tx);
- DU_LOG("\nERROR --> SCH : Invalid RACH configuration:"
- "numRaPreamble %d sizeRaPreambleGrpA %d",
- cellRecfg->rachRecfg.numRaPreamble,
- cellRecfg->rachRecfg.sizeRaPreambleGrpA);
- return RFAILED;
- }
- }
-
-#ifdef RGR_SI_SCH
- if (cellRecfg->recfgTypes & RGR_CELL_SI_RECFG)
- {
- if ((rgSCHCfgVldtRgrCellSiCfg(inst, &(cellRecfg->siReCfg))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Validation for SI"
- "Re-configuration failed");
- return RFAILED;
- }
- }
-#endif /*RGR_SI_SCH */
-
-/* LTE_ADV_FLAG_REMOVED_START */
- if (cellRecfg->recfgTypes & RGR_CELL_LTEA_FEATURE_RECFG)
- {
- /* Checkin whether DSFR is enbaled without enabling SFR.
- * So we need to check if SFR is enabled along with DSFR
- * in the same reconfiguration or it is already enabled earlier*/
- if((cellRecfg->rgrLteAdvCfg.pres & RGR_DSFR) &&
- (RGR_ENABLE == cellRecfg->rgrLteAdvCfg.dsfrCfg.status))
- {
- if(!(((cellRecfg->rgrLteAdvCfg.pres & RGR_SFR) &&
- (RGR_ENABLE == cellRecfg->rgrLteAdvCfg.sfrCfg.status)) ||
- ((*cell)->lteAdvCb.sfrCfg.status == RGR_ENABLE)))
- {
- DU_LOG("\nERROR --> SCH : DSFR is enbaled"
- "Without enabling SFR");
- return RFAILED;
- }
- }
- if ((rgSCHCfgVldtRgrCellLteAdvCfg(inst, &(cellRecfg->rgrLteAdvCfg),
- (*cell)->bwCfg.dlTotalBw)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Validation for Lte Adv"
- "Re-configuration failed");
- return RFAILED;
- }
- }
-/* LTE_ADV_FLAG_REMOVED_END */
-
- /* Validating minimum resource for non-CSG users */
- if (cellRecfg->recfgTypes & RGR_CELL_CSG_PARAM_RECFG)
- {
- if (cellRecfg->csgParamCfg.minDlResNonCsg > 100)
- {
- DU_LOG("\nERROR --> SCH : Invalid Configuration "
- "of minimum DL resources for NON-CSG");
- return RFAILED;
- }
- if (cellRecfg->csgParamCfg.minUlResNonCsg > 100)
- {
- DU_LOG("\nERROR --> SCH : Invalid Configuration "
- "of minimum UL resources for NON-CSG");
- return RFAILED;
- }
- }
- errInfo->errCause = RGSCHERR_NONE;
- return ROK;
-} /* rgSCHCfgVldtRgrCellRecfg */
-
-#ifdef LTE_ADV
-/**
- * @brief Ue SCell configuration for scheduler. It is invoked during first time
- * Scell configuration. It is not for reconfiguration
- *
- * @details
- *
- * Function : rgSCHSCellCfgUeCfg
- *
- * This functions updates UE specific scheduler
- * information upon UE SCell first time Scell configuration
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[int] RgrUeRecfg *ueRecfg
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHSCellCfgUeCfg
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeRecfg *ueRecfg,
-RgSchErrInfo *err
-)
-{
- uint8_t idx;
- Inst inst = cell->instIdx;
- RgSchCellCb *secCellCb = NULLP;
- uint8_t sCellidx = 0;
- RgSchUeCellInfo *sCellInfo = NULLP;
- RgrUeSecCellCfg *sCellInfoCfg = NULLP;
-#ifdef TFU_UPGRADE
- RgrUeAprdDlCqiCfg *aCqiCfg;
- RgrUePrdDlCqiCfg *pCqiCfg;
-#endif
-
- DU_LOG("\nINFO --> SCH : SCELL recfg received from APP \n");
-
- RGSCHDBGINFONEW(inst, (rgSchPBuf(inst),
- "--------------------------------------------------------------------\n"
- "UE SCell ReConfiguration at SCH: rnti (%u) cell(%u)\n"
- "--------------------------------------------------------------------\n",
- ue->ueId, cell->cellId));
-
-
- for(idx = 0; idx < ueRecfg->ueSCellCfgInfo.numSCells; idx++)
- {
- /* Allocate the Ue control block */
- if (((rgSCHUtlAllocSBuf(inst, (Data **)&sCellInfo,
- sizeof(RgSchUeCellInfo))) != ROK))
- {
- RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "[%d]SCellIdx :Memomy allocation "
- "Failed while Adding SCell Information\n", idx));
- return RFAILED;
- }
-
-
- sCellInfoCfg = &ueRecfg->ueSCellCfgInfo.ueSCellDedCfg[idx];
-
-
- sCellInfo->sCellIdx = sCellInfoCfg->sCellIdx;
- sCellInfo->sCellId = sCellInfoCfg->sCellId;
-
- if(PRSNT_NODEF == sCellInfoCfg->sCellDeActTmr.pres)
- {
- /* Configure implicit release */
- ue->sCellDeactTmrVal.val = sCellInfoCfg->sCellDeActTmr.val;
- ue->isScellExplicitDeAct = FALSE;
- ue->sCellDeactTmrVal.pres = PRSNT_NODEF;
- }
- else if (rgSchCb[cell->instIdx].genCfg.isSCellActDeactAlgoEnable == TRUE)
- {
- /* Configure explicit release */
- ue->sCellDeactTmrVal.val = RGSCH_SCELL_DEACT_TMR_INFINITY_VAL;
- ue->isScellExplicitDeAct = TRUE;
- ue->sCellDeactTmrVal.pres = PRSNT_NODEF;
- }
- else
- {
- ue->sCellDeactTmrVal.val = 0;
- ue->isScellExplicitDeAct = FALSE;
- ue->sCellDeactTmrVal.pres = NOTPRSNT;
- }
-
- sCellInfo->sCellState = RG_SCH_SCELL_INACTIVE;
-
- sCellInfo->ue = ue;
- ue->cellInfo[(sCellInfoCfg->sCellIdx)] = sCellInfo;
- sCellidx = ((sCellInfo->sCellId -
- rgSchCb[cell->instIdx].genCfg.startCellId)&(CM_LTE_MAX_CELLS-1));
- ue->cellIdToCellIdxMap[sCellidx] = sCellInfo->sCellIdx;
-
- /* For for time one Scell got added, setting allocCmnUlPdcch flag to TRUE, So that
- we will allocate PDCCH from common search space and the csiRequest field in DCI0 will
- be one bit (spec 36.213 sec 7.2.1)*/
-#ifdef LTE_ADV
- if ( ue->numSCells == 0)
- {
- ue->allocCmnUlPdcch = TRUE;
- }
-#endif
- ue->numSCells++;
-#ifdef CA_DBG
- DU_LOG("\nDEBUG --> SCH : SCell added for ue %d numScells %d\n",ue->ueId,ue->numSCells);
-#endif
- /* retrieve teh sec cell Cb */
- if((secCellCb = (RgSchCellCb *)rgSchUtlGetCellCb(inst, sCellInfo->sCellId)) == NULLP)
- {
- DU_LOG("\nERROR --> SCH : SCell doesnt exists");
- rgSCHSCellFreeBuf (inst,ue,ueRecfg,idx);
- return RFAILED;
- }
-
- if(TRUE == sCellInfoCfg->txMode.pres)
- {
- sCellInfo->txMode = sCellInfoCfg->txMode;
- }
- else
- {
- DU_LOG("\nERROR --> SCH : [%d]SCellIdx Tx mode not present ",idx);
- sCellInfoCfg->txMode.pres = TRUE;
- sCellInfoCfg->txMode.txModeEnum = RGR_UE_TM_1;
-
- sCellInfo->txMode = sCellInfoCfg->txMode;
- }
- cmInitTimers (&sCellInfo->actDelayTmr, 1);
- cmInitTimers (&sCellInfo->deactTmr, 1);
-
- ue->f1bCsAVal += rgSCHUtlGetMaxTbSupp(sCellInfo->txMode.txModeEnum);
-
-#ifdef TFU_UPGRADE
- if(TRUE == sCellInfoCfg->ueSCellDlCqiCfg.aprdCqiCfg.pres)
- {
- sCellInfo->acqiCb.aCqiCfg.aprdModeEnum =
- sCellInfoCfg->ueSCellDlCqiCfg.aprdCqiCfg.aprdModeEnum;
- }
-
- if(TRUE == sCellInfoCfg->uePdschDedCfg.uepACfg.pAPrsnt)
- {
- sCellInfo->pA.pres = TRUE;
- sCellInfo->pA.val = sCellInfoCfg->uePdschDedCfg.uepACfg.pA;
- }
- else
- {
- sCellInfo->pA.pres = FALSE;
- }
-
- aCqiCfg = &sCellInfoCfg->ueSCellDlCqiCfg.aprdCqiCfg;
- DU_LOG("\nDEBUG --> SCH : rgSCHCfgACqiUeCfg cellId =%d,Config Presence =%d for \
- Sec Cell Id = %d\n",
- cellCb->cellId, aCqiCfg->pres,sCellInfo->sCellId);
-
- /* if aperiodic cqi is present then only call the below function as it is
- * not mandatory*/
- if(aCqiCfg->pres)
- {
- if( ROK != rgSCHCfgACqiUeCfg(secCellCb,ue, &sCellInfo->acqiCb,
- sCellInfo->txMode.txModeEnum, aCqiCfg, ue->ueCatEnum))
- {
- DU_LOG("\nERROR --> SCH : [%d]SCellIdx ACQI Cfg"
- "failed..n\n", idx);
- rgSCHSCellFreeBuf (inst,ue,ueRecfg,idx);
- return RFAILED;
- }
- }
- /* Configuring PCQI */
- /* Scell needs to be added to the
- * pcqi list only after activation */
- pCqiCfg = &sCellInfoCfg->ueSCellDlCqiCfg.prdCqiCfg;
-
- if(ROK != rgSCHSCellPCqiCfg(cell,secCellCb,ue,pCqiCfg,
- ue->ueCatEnum,sCellInfoCfg->sCellIdx))
- {
- DU_LOG("\nERROR --> SCH : [%d]SCellIdx PCQI Cfg failed..n\n", idx);
- rgSCHSCellFreeBuf (inst,ue,ueRecfg,idx);
- return RFAILED;
- }
-#endif
-
- /* Configuring ACQI */
-
- /* Stroing the secCell for easy access */
- sCellInfo->cell = secCellCb;
-
-
-#ifdef LTE_ADV
- if (ROK != rgSCHLaaInitDlRbAllocCb(secCellCb,
- &sCellInfo->dlAllocCb))
- {
- return RFAILED;
- }
-#endif
- /* Initialize Harq entity */
-
- sCellInfo->hqEnt = rgSCHDhmHqEntInit(secCellCb);
- if (sCellInfo->hqEnt == NULLP)
- {
- DU_LOG("\nERROR --> SCH : [%d]UEID:Hq Entity Initialization "
- "failed in config\n", ue->ueId);
- rgSCHSCellFreeBuf (inst,ue,ueRecfg,idx);
- return RFAILED;
- }
-#ifdef EMTC_ENABLE
- rgSCHEmtcHqPAlloc(secCellCb, sCellInfo->hqEnt);
-#endif
- rgSCHCmnDlInitHqEnt(secCellCb, sCellInfo->hqEnt);
-
- sCellInfo->hqEnt->ue = ue;
- /* Init SCell Specific Sched Spfc UE DL CB */
- if ((secCellCb->sc.apis->rgSCHRgrSCellUeCfg(secCellCb, ue, sCellInfoCfg, err)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Spec Sched DL UE CFG FAILED\n");
- rgSCHSCellFreeBuf (inst,ue,ueRecfg,idx);
- return RFAILED;
- }
-
-#ifdef LTE_TDD
- if((rgSCHUtlAllocUeANFdbkInfo(ue,sCellInfoCfg->sCellIdx)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : [%d]UEID:Memomy allocation "
- "Failed while UE related Ack Nack Information\n",
- ue->ueId);
- rgSCHSCellFreeBuf (inst,ue,ueRecfg,idx);
- return RFAILED;
- }
-#endif /* LTE_TDD */
-
-#ifdef LTE_ADV
- sCellInfo->sCellLnk.node = (PTR)sCellInfo;
- cmLListAdd2Tail(&secCellCb->sCellUeLst, &sCellInfo->sCellLnk);
-#endif
-
- /* Inserting UECB into SCELL DBM */
- rgSCHDbmInsUeCb(secCellCb, ue);
- }
-
-#ifndef MAC_5GTF_UPDATE
- ue->ul.useExtBSRSizes = ueRecfg->ueSCellCfgInfo.useExtBSRSizes;
-#else
- ue->ul.useExtBSRSizes = TRUE;
-#endif
-
- for (idx = 0; idx < RGSCH_ULCTRL_RECP_DIST; idx++)
- {
- ue->ul.ctrlOnServCellIdx[idx] = 0xFF;
- }
- /* Trigger SCell addition to primary MAC */
- return ROK;
-
-} /* rgSCHSCellCfgUeCfg */
-/*f1b_Sprint */
-/**
- * @brief UE SCell PUCCH reconfiguration for scheduler
- *
- * @details
- *
- * Function : rgSCHSCellCfgUePucchReCfg
- *
- * This functions updates UE specific scheduler
- * information upon UE SCell PUCCH reconfiguration
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[int] RgrUeRecfg *ueRecfg
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHSCellCfgUePucchReCfg
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeRecfg *ueRecfg,
-RgSchErrInfo *err
-)
-{
- Inst inst = cell->instIdx;
- RgrUeSCellAckPucchCfg *sCellPucchRecfg = NULLP;
- uint8_t idx;
-
- RGSCHDBGINFONEW(inst, (rgSchPBuf(inst),
- "--------------------------------------------------------------------\n"
- "UE SCell PUCCH ReConfiguration at SCH: rnti (%u) cell(%u)\n"
- "--------------------------------------------------------------------\n",
- ue->ueId, cell->cellId));
-
-
- sCellPucchRecfg = &ueRecfg->sCellAckN1ResCfg;
- /* Copy the UCI format type suported/configured for UE */
- ue->uciFrmtTyp = sCellPucchRecfg->pucchFormatType;
-
- if (ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS)
- {
- ue->n1PucchF1bResCb.cw1N1ResCount = sCellPucchRecfg->u.format1Bcs.sCellAckN1ResTb1Count;
- ue->n1PucchF1bResCb.cw2N1ResCount = sCellPucchRecfg->u.format1Bcs.sCellAckN1ResTb2Count;
-
- for(idx = 0; idx < sCellPucchRecfg->u.format1Bcs.sCellAckN1ResTb1Count; idx++)
- {
- ue->n1PucchF1bResCb.cw1N1Res[idx].n1PucchIdx = sCellPucchRecfg->u.format1Bcs.sCellAckN1ResTb1[idx];
- }
-
- for(idx = 0; idx < sCellPucchRecfg->u.format1Bcs.sCellAckN1ResTb2Count; idx++)
- {
- ue->n1PucchF1bResCb.cw2N1Res[idx].n1PucchIdx = sCellPucchRecfg->u.format1Bcs.sCellAckN1ResTb2[idx];
- }
- }
-#ifdef LTE_ADV
- else if (ue->uciFrmtTyp == RG_SCH_UCI_FORMAT3)
- {
- ue->n3PucchResCb.antP0N3ResCount = sCellPucchRecfg->u.format3.sCellAckN3ResAntP0Count;
- ue->n3PucchResCb.antP1N3ResCount = sCellPucchRecfg->u.format3.sCellAckN3ResAntP1Count;
- for (idx = 0;idx < ue->n3PucchResCb.antP0N3ResCount; idx++ )
- {
- ue->n3PucchResCb.antP0N3Res[idx].n3PucchIdx
- = sCellPucchRecfg->u.format3.sCellAckN3ResAntP0[idx];
- ue->n3PucchResCb.antP0N3Res[idx].n3Lnk.node = NULLP;
- ue->n3PucchResCb.antP0N3Res[idx].sCellIdx = RGSCH_INVALID_CELL_IDX;
- }
- for (idx = 0;idx < ue->n3PucchResCb.antP1N3ResCount; idx++ )
- {
- ue->n3PucchResCb.antP1N3Res[idx].n3PucchIdx
- = sCellPucchRecfg->u.format3.sCellAckN3ResAntP1[idx];
- ue->n3PucchResCb.antP1N3Res[idx].n3Lnk.node = NULLP;
- ue->n3PucchResCb.antP1N3Res[idx].sCellIdx = RGSCH_INVALID_CELL_IDX;
- }
- ue->simulAckNackCQIFormat3 = ueRecfg->simulAckNackCQIFormat3;
- }
-#endif
- else
- {
- DU_LOG("\nERROR --> SCH : Wrong PUCCH Format:%d configured for CA",ue->uciFrmtTyp);
- }
-
- return ROK;
-
-} /* rgSCHSCellCfgUePucchReCfg */
-/**
- * @brief Validates the UE SCell Reconfiguration request from APP to SCH.
- *
- * @details
- *
- * Function : rgSCHCfgVldtRgrUeSCellRecfg
- *
- * Processing Steps:
- * - Validate Number of SCells
- * - If validated successfully,
- * - Process Number of SCells
- * - Else
- * - Return RFAILED.
- * - Validate SCellIdx value,
- * - If validated successfully,
- * - Process Number of RgrUeSecCellCfg
- * - Else
- * - Return RFAILED.
- *
- * @param[in] RgrUeRecfg *ueRecfg
- * @param[out] RgSchCellCb *cell
- * @param[out] RgSchUeCb *ue
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgVldtRgrUeSCellRecfg
-(
-RgrUeRecfg *ueRecfg,
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchErrInfo *errInfo
-)
-{
- RgrUeSecCellCfg *ueSCellDedCfg = NULLP;
- RgSchCellCb *sCell = NULLP;
- Inst inst = cell->instIdx;
-
-
- DU_LOG("\nDEBUG --> SCH : VALIDATE RGR UE SCELL RECONFIG: cellId %d "
- "oldUeId %d cell %p \n", ueRecfg->cellId, ueRecfg->oldCrnti);
- errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_UE_SCELL_RECFG;
-
- if((ueRecfg->ueSCellCfgInfo.numSCells > RGR_MAX_SCELL_PER_UE) ||
- (ueRecfg->ueSCellCfgInfo.numSCells < 1))
- {
- DU_LOG("\nERROR --> SCH : Invalid number of SCELL "
- " in SCELL Recfg\n");
- return RFAILED;
- }
-
- for(uint8_t idx = 0; idx < ueRecfg->ueSCellCfgInfo.numSCells; idx++)
- {
- ueSCellDedCfg = &ueRecfg->ueSCellCfgInfo.ueSCellDedCfg[idx];
- if(ROK != rgSchUtlVldtCellId(inst, ueSCellDedCfg->sCellId))
- {
- DU_LOG("\nERROR --> SCH : SCellId is out of range");
- return RFAILED;
- }
- /* Validate existence of sec cell */
- sCell = rgSchUtlGetCellCb(inst, ueSCellDedCfg->sCellId);
- if(NULLP == sCell )
- {
- DU_LOG("\nERROR --> SCH : SCell doesnt exists");
- return RFAILED;
- }
-
- /* validate the range of serv cell index */
- if((ueSCellDedCfg->sCellIdx < 1) ||
- (ueSCellDedCfg->sCellIdx > RGR_MAX_SCELL_PER_UE))
- {
- DU_LOG("\nERROR --> SCH : Invalid Serv Cell Idx %d\n",
- ueSCellDedCfg->sCellIdx);
- return RFAILED;
- }
-
- /* Is this sec cell alredy confiured */
- if(NULLP != ue->cellInfo[ueSCellDedCfg->sCellIdx])
- {
- DU_LOG("\nERROR --> SCH : Secll with id %d already added\n",
- ueSCellDedCfg->sCellIdx);
- return RFAILED;
- }
-
- /* Validate CQI config params */
- if((rgSCHCfgVldtUeCqiModeCfg(sCell, &ueSCellDedCfg->ueSCellDlCqiCfg)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Invalid CQI Mode "
- " configuration for Ue %d\n",ue->ueId);
- return RFAILED;
- }
-#ifdef TFU_UPGRADE
- /* 1. Validate UE Aperiodic CQI related parameters */
- if( ROK != rgSCHCfgVldtRgrUeACqiCfg (sCell, ue->ueId,
- &ueSCellDedCfg->ueSCellDlCqiCfg.aprdCqiCfg, ueSCellDedCfg->txMode,
- errInfo ))
- {
- DU_LOG("\nERROR --> SCH : rgSCHCfgVldtCqiSrSrsUeCfg: Invalid Aperiodic CQI configuration\n");
- return RFAILED;
- }
-
-#ifdef LTEMAC_HDFDD
- if( ROK != rgSCHCfgVldtRgrUePCqiCfg (sCell, ue->ueId,
- &ueSCellDedCfg->ueSCellDlCqiCfg.prdCqiCfg, ueRecfg->isHdFddEnbld,
- ueSCellDedCfg->txMode, errInfo ))
-#else
- if( ROK != rgSCHCfgVldtRgrUePCqiCfg (sCell, ue->ueId,
- &ueSCellDedCfg->ueSCellDlCqiCfg.prdCqiCfg,
- ueSCellDedCfg->txMode,
- errInfo ))
-#endif
- {
- DU_LOG("\nERROR --> SCH : rgSCHCfgVldtCqiSrSrsUeCfg: Invalid Periodic CQI configuration\n");
- return RFAILED;
- }
-
- if((ueSCellDedCfg->txMode.txModeEnum < RGR_UE_TM_1) ||
- (ueSCellDedCfg->txMode.txModeEnum > RGR_UE_TM_9))
- {
- DU_LOG("\nERROR --> SCH : SCELL Invalid transmission mode for"
- " UE %d\n", (uint8_t)ueSCellDedCfg->txMode.txModeEnum);
- return RFAILED;
- }
-#endif
- }
-
- errInfo->errCause = RGSCHERR_NONE;
- DU_LOG("\nDEBUG --> SCH : RGR Ue SCell Reconfig validation done: "
- "cellId %d oldUeId %d\n", ueRecfg->cellId, ue->ueId);
- return ROK;
-} /* rgSCHCfgVldtRgrUeSCellRecfg */
-
-/**
- * @brief Ue SCell configuration roll back due to failure during configuration
- * of any scell
- *
- * @details
- *
- * Function : rgSCHSCellCfgUeCfgRollBack
- *
- * This functions roll backs the configuration of successfully added Scell
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[int] RgrUeRecfg *ueRecfg
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHSCellCfgUeCfgRollBack
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeRecfg *ueRecfg
-)
-{
- Inst inst = cell->instIdx;
- RgrUeSecCellCfg *sCellInfoCfg = NULLP;
- RgSchUeCellInfo *sCellInfo = NULLP;
- RgSchCmnCell *cellSch = NULLP;
-
- RGSCHDBGINFONEW(inst, (rgSchPBuf(inst),
- "--------------------------------------------------------------------\n"
- "UE SCell config roll back at SCH: rnti (%u) cell(%u)\n"
- "--------------------------------------------------------------------\n",
- ue->ueId, cell->cellId));
-
- /* Free all Added scell in this transaction */
- for(uint8_t idx = 0; idx < ueRecfg->ueSCellCfgInfo.numSCells; idx++)
- {
- sCellInfoCfg = &ueRecfg->ueSCellCfgInfo.ueSCellDedCfg[idx];
- sCellInfo = ue->cellInfo[(sCellInfoCfg->sCellIdx)];
-
- /* if sCellInfo is not NULLP that means this Scell is added hence
- * delte it*/
- if (NULLP != sCellInfo)
- {
- /* Clear Scheduler specific list for this UE from the
- * corresponding CELL */
- cellSch = RG_SCH_CMN_GET_CELL(sCellInfo->cell);
- cellSch->apisDl->rgSCHDlUeReset(sCellInfo->cell, sCellInfo->ue);
-
- /* Delete harq Entity of Scell*/
- rgSCHDhmDelHqEnt(cell, &(sCellInfo->hqEnt));
-
- rgSCHUtlFreeSBuf(inst, (Data**)&(sCellInfo),
- sizeof(RgSchUeCellInfo));
-
- ue->cellInfo[(sCellInfoCfg->sCellIdx)] = NULLP;
- ue->numSCells--;
-#ifdef LTE_ADV
- if (ue->numSCells == 0)
- {
- ue->allocCmnUlPdcch = TRUE;
- /* As there is no SCell left so DCI 0 size at UE specific search space
- * will be recalculated as the CSI is reduced to 1 bit */
- rgSCHUtlUpdUeDciSize(cell, ue, FALSE);
- }
-#endif
- }
- }
- return ROK;
-}
-#endif /* LTE_ADV */
-/**
- * @brief Validates the UE reconfiguration request from RRC to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgVldtRgrUeRecfg
- *
- * Processing Steps:
- * - Retrieve the UE control block.
- * - If successful,
- * - Validate the range of reconfigured values recieved in
- * re-configuration request.
- * - If validated successfully,
- * - Return ROK and pointer to the cell and ue.
- * - Else
- * - Return RFAILED.
- * - Else return RFAILED.
- *
- * @param[in] Inst inst
- * @param[in] RgrUeRecfg *ueRecfg
- * @param[out] RgSchCellCb **cell
- * @param[out] RgSchUeCb **ue
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgVldtRgrUeRecfg
-(
-Inst inst,
-RgrUeRecfg *ueRecfg,
-RgSchCellCb **cell,
-RgSchUeCb **ue,
-RgSchErrInfo *errInfo
-)
-{
-
- errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_UE_RECFG;
-
- if (((*cell) == NULLP) ||
- ((*cell)->cellId != ueRecfg->cellId))
- {
- DU_LOG("\nERROR --> SCH : Cell does not exist for OLD CRNTI:%d",ueRecfg->oldCrnti);
- return RFAILED;
- }
-
- /* Fetch the Old Ue */
- if ((*ue = rgSCHDbmGetUeCb(*cell, ueRecfg->oldCrnti)) == NULLP)
- {
- DU_LOG("\nERROR --> SCH : OLD CRNTI:%d does not exist",
- ueRecfg->oldCrnti);
- return RFAILED;
- }
-
-#ifdef LTE_ADV
- if(RGR_UE_SCELL_ADD_RECFG & ueRecfg->ueRecfgTypes)
- {
- S16 ret = rgSCHCfgVldtRgrUeSCellRecfg(ueRecfg,*cell, *ue, errInfo);
- if ( ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Ue SCell Recfg Validation FAILED\n");
- return RFAILED;
- }
- errInfo->errCause = RGSCHERR_NONE;
- return ROK;
- }
-#endif
-
- if (ueRecfg->oldCrnti != ueRecfg->newCrnti)
- {
- if (rgSCHDbmGetUeCb(*cell, ueRecfg->newCrnti) != NULLP)
- {
- DU_LOG("\nERROR --> SCH : NEW CRNTI:%d already exists",
- ueRecfg->newCrnti);
- return RFAILED;
- }
- }
-
- if ((ueRecfg->ueRecfgTypes & RGR_UE_CSG_PARAM_RECFG) &&\
- ((*ue)->csgMmbrSta == ueRecfg->csgMmbrSta))
- {
- DU_LOG("\nERROR --> SCH : UE ID [%d] invalid CSG Membership reconfig :%d ",
- ueRecfg->newCrnti, (uint8_t)ueRecfg->csgMmbrSta);
- return RFAILED;
- }
- /* Validate values */
- if ((ueRecfg->ueRecfgTypes & RGR_UE_TXMODE_RECFG) &&
- (ueRecfg->txMode.pres == TRUE) &&
- ((ueRecfg->txMode.txModeEnum < RGR_UE_TM_1) ||
- (ueRecfg->txMode.txModeEnum > RGR_UE_TM_7)))
- {
- DU_LOG("\nERROR --> SCH : Invalid transmission mode %d"
- "for NEW CRNTI:%d", (uint8_t)ueRecfg->txMode.txModeEnum,ueRecfg->newCrnti);
- return RFAILED;
- }
-#ifndef TFU_UPGRADE
- if ((ueRecfg->ueRecfgTypes & RGR_UE_PRD_DLCQI_RECFG) &&
- (((ueRecfg->prdDlCqiRecfg.k < 1) || (ueRecfg->prdDlCqiRecfg.k > 4)) ||
- ((ueRecfg->prdDlCqiRecfg.cqiPmiCfgIdx < 1) ||
- (ueRecfg->prdDlCqiRecfg.cqiPmiCfgIdx > 1024))))
- {
- DU_LOG("\nERROR --> SCH : Invalid Periodic CQI INFO"
- "OLD CRNTI:%d NEW CRNTI:%d",(uint8_t)ueRecfg->oldCrnti,ueRecfg->newCrnti);
- return RFAILED;
- }
-#endif
- if ((ueRecfg->ueRecfgTypes & RGR_UE_ULHARQ_RECFG) &&
- (ueRecfg->ueUlHqRecfg.maxUlHqTx < RGSCH_MIN_HQ_TX))
- {
- DU_LOG("\nERROR --> SCH : Invalid Uplink HARQ config %d"
- "for NEW CRNTI:%d", ueRecfg->ueUlHqRecfg.maxUlHqTx,ueRecfg->newCrnti);
- return RFAILED;
- }
-#ifndef TFU_UPGRADE
- if ((ueRecfg->ueRecfgTypes & RGR_UE_PRD_DLCQI_RECFG) &&
- (ueRecfg->prdDlCqiRecfg.prdModeEnum > RGR_PRD_CQI_MOD21))
- {
- DU_LOG("\nERROR --> SCH : Invalid periodic mode config for"
- " DL CQI %d NEW CRNTI:%d", (uint8_t)ueRecfg->prdDlCqiRecfg.prdModeEnum,ueRecfg->newCrnti);
- return RFAILED;
- }
-#else
- if ((ueRecfg->ueRecfgTypes & RGR_UE_PCQI_RECFG) &&
- (ueRecfg->cqiCfg.cqiSetup.prdModeEnum > RGR_PRD_CQI_MOD21))
- {
- DU_LOG("\nERROR --> SCH : Invalid periodic mode config for "
- "DL CQI %d for NEW CRNTI:%d",(uint8_t)ueRecfg->cqiCfg.cqiSetup.prdModeEnum,ueRecfg->newCrnti);
- return RFAILED;
- }
-#endif /* TFU_UPGRADE */
- /* Validate UE Category */
- if (ueRecfg->ueCatEnum > CM_LTE_UE_CAT_8)
- {
- DU_LOG("\nERROR --> SCH : Invalid category %d for NEW CRNTI:%d",
- (uint8_t)ueRecfg->ueCatEnum,ueRecfg->newCrnti);
- return RFAILED;
- }
-
- /* Validate UE Access Stratum Release */
- if ((ueRecfg->ueRecfgTypes & RGR_UE_UE_ACCESS_STRATUM_REL_RECFG) && \
- (ueRecfg->accessStratumRls > RGR_REL_11))
- {
- DU_LOG("\nERROR --> SCH : Invalid Access Stratum Release %u for UE\n",
- ueRecfg->accessStratumRls);
- return RFAILED;
- }
- DU_LOG("\nINFO --> SCH : Configured Access Stratum Release %u\n", \
- ueRecfg->accessStratumRls);
-
- if ((ueRecfg->ueRecfgTypes & RGR_UE_APRD_DLCQI_RECFG) &&
- ((ueRecfg->aprdDlCqiRecfg.pres == TRUE) &&
- ((ueRecfg->aprdDlCqiRecfg.aprdModeEnum > RGR_APRD_CQI_MOD31) ||
- (*cell)->bwCfg.dlTotalBw <= 7)))
- {
- DU_LOG("\nERROR --> SCH : Invalid aperiodic mode config for"
- " DL CQI %d for NEW CRNTI:%d", (uint8_t)ueRecfg->aprdDlCqiRecfg.aprdModeEnum,ueRecfg->newCrnti);
- return RFAILED;
- }
- if ((ueRecfg->ueRecfgTypes & RGR_UE_ULPWR_RECFG) &&
- (rgSCHCfgVldtUePwrCfg(*cell, &ueRecfg->ueUlPwrRecfg) != ROK))
- {
- DU_LOG("\nERROR --> SCH : Invalid PUSCH Group power"
- " Reconfiguration for NEW CRNTI:%d",ueRecfg->newCrnti);
- return RFAILED;
- }
-
-
- if ((ueRecfg->ueRecfgTypes & RGR_UE_ACKNACK_MEASGAP_RECFG) &&
- (rgSCHCfgVldtUeMeasGapAckNakRepRecfg(*cell, ueRecfg) != ROK))
- {
- DU_LOG("\nERROR --> SCH : Invalid MeasGap/AckNackRep"
- " Reconfiguration for NEW CRNTI:%d",ueRecfg->newCrnti);
- return RFAILED;
- }
-#ifdef LTEMAC_SPS
- if(rgSCHCfgVldtSpsReCfg(*cell, *ue, ueRecfg)!= ROK)
- {
- DU_LOG("\nERROR --> SCH : Invalid SPS"
- " Reconfiguration for NEW CRNTI:%d",ueRecfg->newCrnti);
- return RFAILED;
- }
-#endif
-#ifdef TFU_UPGRADE
- /* Validated Periodic CQI/PMI, RI , SRS and SR related UeCfg */
- if ( ROK != rgSCHCfgVldtCqiSrSrsUeReCfg(*cell, *ue, ueRecfg, errInfo))
- {
- DU_LOG("\nERROR --> SCH : Invalid ACQI, PCQI/SR/SRS "
- "Re-configuration for NEW CRNTI:%d",ueRecfg->newCrnti);
- return RFAILED;
- }
-#endif
- if ((ueRecfg->ueRecfgTypes & RGR_UE_DRX_RECFG) &&
- (rgSCHCfgVldtDrxUeCfg(*cell, &(ueRecfg->ueDrxRecfg)) != ROK))
- {
- DU_LOG("\nERROR --> SCH : Invalid drxParams"
- " Reconfiguration for NEW CRNTI:%d",ueRecfg->newCrnti);
- return RFAILED;
- }
-
-/* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
- /* Validate DL Power Control Config parameters */
- if(rgSCHCfgVldtCqiReptReCfg(*cell, ueRecfg)!= ROK)
- {
- DU_LOG("\nERROR --> SCH : Invalid DL Power Control"
- " Reconfiguration for NEW CRNTI:%d",ueRecfg->newCrnti);
- return RFAILED;
- }
-#endif /* End of RGR_CQI_REPT */
- errInfo->errCause = RGSCHERR_NONE;
- return ROK;
-} /* rgSCHCfgVldtRgrUeRecfg */
-
-
-/**
- * @brief Validates the logical channel reconfiguration request from
- * RRC to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgVldtRgrLchRecfg
- *
- * Processing Steps:
- * - Retrieve the uplink and downlink logical channel control block.
- * - If successful,
- * - Validate the range of reconfigured values recieved in
- * re-configuration request.
- * - If validated successfully,
- * - Return ROK and pointer to the cell, UE and logical channel.
- * - Else
- * - Return RFAILED.
- * - Else return RFAILED.
- *
- * @param[in] RgrLchRecfg *lcRecfg
- * @param[out] RgSchCellCb **cell
- * @param[out] RgSchUeCb **ue
- * @param[out] RgSchUlLcCb **ulLc
- * @param[out] RgSchDlLcCb **dlLc
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgVldtRgrLchRecfg
-(
-Inst inst,
-RgrLchRecfg *lcRecfg,
-RgSchCellCb **cell,
-RgSchUeCb **ue,
-RgSchDlLcCb **dlLc,
-RgSchErrInfo *errInfo
-)
-{
- errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_LC_RECFG;
-
- if (((*cell) == NULLP) ||
- ((*cell)->cellId != lcRecfg->cellId))
- {
- DU_LOG("\nERROR --> SCH : Cell does not exist "
- "for CRNTI:%d LCID:%d",lcRecfg->crnti,lcRecfg->lcId);
- return RFAILED;
- }
-
- /* Fetch the Ue for dedicated channels */
- if ((*ue = rgSCHDbmGetUeCb(*cell, lcRecfg->crnti)) == NULLP)
- {
- DU_LOG("\nERROR --> SCH : UEID does not exist"
- "dedicated logical channel for CRNTI:%d LCID:%d",lcRecfg->crnti,lcRecfg->lcId);
- return RFAILED;
- }
-
- if ((*dlLc = rgSCHDbmGetDlDedLcCb((*ue), lcRecfg->lcId)) == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Dedicated DL LC does not "
- "exist for CRNTI:%d LCID:%d",lcRecfg->crnti,lcRecfg->lcId);
- return RFAILED;
- }
-
- errInfo->errCause = RGSCHERR_NONE;
- return ROK;
-} /* rgSCHCfgVldtRgrLchRecfg */
-
-/**
- * @brief Validates the UE Reset request from RRM to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgVldtRgrUeReset
- *
- * Processing Steps:
- * - Retrieve the CELL control block
- * - If cell does not exist return RFAILED
- * - Retrieve UE Control block
- * - If UE does not exist return RFAILED
- * - Return ROK
- *
- * @param[in] Inst inst
- * @param[in] RgrRst *reset
- * @param[out] RgSchCellCb **cell
- * @param[out] RgSchUeCb **ue
- * @param[out] RgErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgVldtRgrUeReset
-(
-Inst inst,
-RgrRst *reset,
-RgSchCellCb *cell,
-RgSchUeCb **ue,
-RgSchErrInfo *errInfo
-)
-{
-
- errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_UE_RESET;
-
- if ((cell == NULLP) || (cell->cellId != reset->cellId))
- {
- DU_LOG("\nERROR --> SCH : CELL does not exist for CRNTI:%d",
- reset->crnti);
- return RFAILED;
- }
- /* Fetch the Ue */
- if ((*ue = rgSCHDbmGetUeCb(&(*cell), reset->crnti)) == NULLP)
- {
- DU_LOG("\nERROR --> SCH : UE does not exist for CRNTI:%d",
- reset->crnti);
- return RFAILED;
- }
-
- errInfo->errCause = RGSCHERR_NONE;
-
- return ROK;
-} /* rgSCHCfgVldtRgrUeReset */
-
-
-/**
- * @brief Validates the logical channel reconfiguration request from
- * RRC to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgVldtRgrLcgRecfg
- *
- * Processing Steps:
- * - Retrieve the uplink and downlink logical channel control block.
- * - If successful,
- * - Validate the range of reconfigured values recieved in
- * re-configuration request.
- * - If validated successfully,
- * - Return ROK and pointer to the cell, UE and logical channel.
- * - Else
- * - Return RFAILED.
- * - Else return RFAILED.
- *
- * @param[in] RgrLchRecfg *lcRecfg
- * @param[out] RgSchCellCb **cell
- * @param[out] RgSchUeCb **ue
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgVldtRgrLcgRecfg
-(
-Inst inst,
-RgrLcgRecfg *lcgRecfg,
-RgSchCellCb *cell,
-RgSchUeCb **ue,
-RgSchErrInfo *errInfo
-)
-{
- errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_LCG_RECFG;
-
- if (((cell) == NULLP) ||
- ((cell)->cellId != lcgRecfg->cellId))
- {
- DU_LOG("\nERROR --> SCH : Cell does not exist for"
- "CRNTI:%d LCGID:%d",lcgRecfg->crnti,lcgRecfg->ulRecfg.lcgId);
- return RFAILED;
- }
-
- /* Fetch the Ue for dedicated channels */
- if ((*ue = rgSCHDbmGetUeCb(&(*cell), lcgRecfg->crnti)) == NULLP)
- {
- DU_LOG("\nERROR --> SCH : UE does not exist for "
- "dedicated logical channel group CRNTI:%d LCGID:%d",
- lcgRecfg->crnti,lcgRecfg->ulRecfg.lcgId);
- return RFAILED;
- }
- if (lcgRecfg->ulRecfg.lcgId > (RGSCH_MAX_LCG_PER_UE - 1))
- {
- DU_LOG("\nERROR --> SCH : Invalid lcgId for uplink logical"
- "channel CRNTI:%d LCGID:%d",
- lcgRecfg->crnti,lcgRecfg->ulRecfg.lcgId);
- return RFAILED;
- }
-
- if ((lcgRecfg->ulRecfg.gbr != 0) && (lcgRecfg->ulRecfg.mbr < lcgRecfg->ulRecfg.gbr))
- {
- DU_LOG("\nERROR --> SCH : Dedicated Logical Group %d validation failed"\
- " for ue %d for cell %d\n", lcgRecfg->ulRecfg.lcgId,(*ue)->ueId, cell->cellId);
- return RFAILED;
- }
- errInfo->errCause = RGSCHERR_NONE;
- return ROK;
-} /* rgSCHCfgVldtRgrLcgRecfg */
-
-/**
- *
- * @details
- *
- * Function : rgSCHDynCfiCfg
- *
- * @param[in] RgSchCellCb *cell
- * RgrCellCfg *cellCfg
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHDynCfiCfg
-(
-RgSchCellCb *cell,
-RgrCellCfg *cellCfg
-)
-{
- uint8_t cfi;
-#ifdef LTE_TDD
- uint8_t ulDlCfgIdx = cellCfg->ulDlCfgIdx;
- uint8_t mphIdx;
- uint8_t maxMPhich;
- uint16_t numDlSf;
-#endif
-
- cell->dynCfiCb.isDynCfiEnb = cellCfg->isDynCfiEnb;
-
- /* Initializing Failure Sample Period */
- cell->dynCfiCb.failSamplePrd = (RGSCH_CFI_TTI_MON_INTRVL *
- RGSCH_CFI_STEP_UP_TTI_PRCNTG)/100;
- /* Initializing Number of Failure Samples */
- cell->dynCfiCb.numFailSamples = (RGSCH_CFI_TTI_MON_INTRVL/
- cell->dynCfiCb.failSamplePrd);
- cell->dynCfiCb.maxCfi = RGSCH_MAX_CFI_VAL;
- /* Allocating memory for CCE failure average array based on
- * monitoring interval and CCE failure sample period */
- if((rgSCHUtlAllocSBuf(cell->instIdx, (Data**)&(cell->dynCfiCb.cceFailSamples),
- (cell->dynCfiCb.numFailSamples * sizeof(uint16_t)))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED for cell");
- return RFAILED;
- }
-
- /* Setting the Invalid value 0xFF to pdcchSfIdx, it will be assigned
- * a valid value during CFI swithing is done */
- cell->dynCfiCb.pdcchSfIdx = 0xFF;
-
-#ifdef LTE_TDD
- /* In case of config index 0, the mphich index can be upto 2
- * in other config index cases, it will always be set as 1*/
- if(ulDlCfgIdx == 0)
- {
- maxMPhich = RG_SCH_MAX_MPHICH;
- }
- else
- {
- maxMPhich = RG_SCH_MAX_MPHICH -1;
- }
- /* Calculate the number of CCEs in the cell */
- for(cfi = 1; cfi < RG_SCH_CMN_MAX_CFI; cfi++)
- {
- for(mphIdx = 0; mphIdx < maxMPhich; mphIdx++)
- {
- cell->dynCfiCb.cfi2NCceTbl[mphIdx][cfi] =
- rgSCHUtlCalcNCce(cell->bwCfg.dlTotalBw,
- cell->phichCfg.ngEnum, cfi, mphIdx,
- cell->numTxAntPorts,
- cell->isCpDlExtend);
- }
- }
-#else
- /* Calculate the number of CCEs in the cell */
- for(cfi = 1; cfi < RG_SCH_CMN_MAX_CFI; cfi++)
- {
- /* CFI Index starts from 1 so that there can be a direct mapping from
- actual CFI value to cfi Index. mPhich index will always be set
- as 0 for FDD */
- cell->dynCfiCb.cfi2NCceTbl[0][cfi] =
- rgSCHUtlCalcNCce(cell->bwCfg.dlTotalBw, cell->phichCfg.ngEnum,
- cfi, cell->numTxAntPorts, cell->isCpDlExtend);
- }
-
- /* Calculate the number of CCEs in the cell */
- if(cell->dynCfiCb.isDynCfiEnb == TRUE)
- {
- /* In case if Dynamic CFI feature is enabled, default CFI
- * value 1 is used */
- cell->nCce = cell->dynCfiCb.cfi2NCceTbl[0][1];
- }
- else
- {
- cell->nCce = cell->dynCfiCb.cfi2NCceTbl[0][cellCfg->cfiCfg.cfi];
- }
-#endif
-
-#ifdef LTE_TDD
- numDlSf = rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][9] *
- (RGSCH_CFI_TTI_MON_INTRVL/10);
- cell->dynCfiCb.cfiStepUpTtiCnt =
- (RGSCH_CFI_STEP_UP_TTI_PRCNTG * numDlSf)/100;
- cell->dynCfiCb.cfiStepDownTtiCnt =
- (RGSCH_CFI_STEP_DOWN_TTI_PERCNTG * numDlSf)/100;
-#else
- cell->dynCfiCb.cfiStepUpTtiCnt = (RGSCH_CFI_STEP_UP_TTI_PRCNTG *
- RGSCH_CFI_TTI_MON_INTRVL)/100;
- cell->dynCfiCb.cfiStepDownTtiCnt = (RGSCH_CFI_STEP_DOWN_TTI_PERCNTG *
- RGSCH_CFI_TTI_MON_INTRVL)/100;
-#endif
-
- return ROK;
-}
-
-/**
- * @brief Handler for the SCHED Enb configuration request from RRM to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgRgrSchedEnbCfg
- *
- * Processing Steps:
- * - Invoke SCH with SCHEDULER control block to update
- * scheduler specific information.
- * - Update rgSch control block with the values recieved in the
- * configuration.
- * - If successful, return ROK else RFAILED.
- *
- * @param[in] RgSchCb *instCb
- * @param[in] SpId spId
- * @param[in] RgSchSchedEnbCfg *schedEnbCfg
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgRgrSchedEnbCfg
-(
-Inst inst,
-SpId spId,
-RgrSchedEnbCfg *schedEnbCfg,
-RgSchErrInfo *errInfo
-)
-{
-
- DU_LOG("\nDEBUG --> SCH : APPLYING RGR SCH ENB CONFIG: \n");
- errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_ENB_CFG;
-
- rgSchCb[inst].rgrSchedEnbCfg = *schedEnbCfg;
- DU_LOG("\nDEBUG --> SCH : dlSchdType %d ulSchdType %d dlTptCoeffi %d"
- "dlFairCoeffi %d ulTptCoeffi %d ulFairCoeffi %d\n",
- schedEnbCfg->dlSchdType, schedEnbCfg->ulSchdType, schedEnbCfg->dlSchInfo.dlPfs.tptCoeffi,
- schedEnbCfg->dlSchInfo.dlPfs.fairCoeffi, schedEnbCfg->ulSchInfo.ulPfs.tptCoeffi,
- schedEnbCfg->ulSchInfo.ulPfs.fairCoeffi);
-
-#ifdef RG_5GTF
- rgSchCb[inst].rgSchDynTdd.isDynTddEnbld = schedEnbCfg->isDynTddEnbld;
-#endif
-# if 0
- if(RGR_SCH_TYPE_PFS == schedEnbCfg->dlSchdType)
- {
- rgSCHEnbPfsDlCfg(inst, errInfo);
- }
-#endif
- errInfo->errCause = RGSCHERR_NONE;
- DU_LOG("\nINFO --> SCH : RGR SCH gNB done: \n");
- return ROK;
-} /* rgSCHCfgRgrSchedEnbCfg */
-
-#ifdef RG_5GTF
-/**
- * @brief Handler for the cell configuration of 5gtf.
- *
- * @details
- *
- * Function : rgSCH5gtfCellCfg
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchCellCfg *cellCfg
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCH5gtfCellCfg
-(
-RgSchCellCb *cell,
-RgrCellCfg *cellCfg
-)
-{
- uint8_t idx;
-
- for(idx = 0; idx < MAX_5GTF_GROUP; idx++)
- {
- cell->cell5gtfCb.ueGrp5gConf[idx].beamBitMask = 0;
- }
-
- for(idx = 0 ; idx < MAX_5GTF_SUBFRAME_INFO ; ++idx)
- {
- cell->cell5gtfCb.dynConfig[idx] = cellCfg->Cell5gtfCfg.dynConfig[idx];
- }
- cell->cell5gtfCb.numUes = cellCfg->Cell5gtfCfg.numUes;
- cell->cell5gtfCb.uePerGrpPerTti = cellCfg->Cell5gtfCfg.uePerGrp;
- cell->cell5gtfCb.ueGrpPerTti = cellCfg->Cell5gtfCfg.ueGrpPerTti;
- cell->cell5gtfCb.numCCs = cellCfg->Cell5gtfCfg.numOfCC;
- cell->cell5gtfCb.bwPerCC = cellCfg->Cell5gtfCfg.bwPerCC;
- DU_LOG("\nINFO --> SCH : cell cfg at schd,numUes:%u,uepergrp:%u,uegrppertti:%u,numCC:%u,bwPerc:%u cfi %u\n",
- cell->cell5gtfCb.numUes,cell->cell5gtfCb.uePerGrpPerTti,cell->cell5gtfCb.ueGrpPerTti,
- cell->cell5gtfCb.numCCs,cell->cell5gtfCb.bwPerCC, cell->cell5gtfCb.cfi);
- return ROK;
-}
-#endif
-
-#ifdef XEON_LMT_ITBS
-uint16_t gWrMaxDlItbs;
-uint16_t gWrMaxUlItbs;
-#endif
-/**
- * @brief Handler for the cell configuration request from RRM to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgRgrCellCfg
- *
- * Processing Steps:
- * - Invoke SCH with cell control block to update
- * scheduler specific information.
- * - Update cell control block with the values recieved in the
- * configuration.
- * - Add to the active list of cells if cell becomes ACTIVE.
- * - If successful, return ROK else RFAILED.
- *
- * @param[in] RgSchCb *instCb
- * @param[in] SpId spId
- * @param[in] RgSchCellCfg *cellCfg
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgRgrCellCfg
-(
-RgSchCb *instCb,
-SpId spId,
-RgrCellCfg *cellCfg,
-RgSchErrInfo *errInfo
-)
-{
- S16 ret;
- uint8_t idx;
- Pst pst;
- RgInfCellReg cellRegReq;
- RgSchCellCb *cell = NULLP;
- Inst inst = instCb->rgSchInit.inst;
- uint32_t Idx1 = (uint8_t)((cellCfg->cellId - instCb->genCfg.startCellId)&(CM_LTE_MAX_CELLS-1));
-
- errInfo->errCause = RGSCHERR_CFG_RGR_CELL_CFG;
-
- memset(&pst, 0, sizeof(Pst));
-
- /* Allocate the scheduler's cell control block */
- if((ret = rgSCHUtlAllocSBuf(inst, (Data**)&cell, sizeof(RgSchCellCb)))
- != ROK)
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED for cell");
- return RFAILED;
- }
-#ifdef EMTC_ENABLE
- if(cellCfg->emtcEnable)
- {
- if((ret = rgSCHEmtcCellAlloc(cell))
- != ROK)
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED for emtc cell");
- return RFAILED;
- }
- }
-#endif
- if ((uint8_t *)cell == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED for cell");
- return RFAILED;
- }
- /* Initialize the lists of the cell */
- ret = rgSCHDbmInitCell(cell);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : DBM initialization FAILED for cell");
- rgSCHCfgFreeCellCb(cell);
- return RFAILED;
- }
-/* LTE_ADV_FLAG_REMOVED_START */
- if(cellCfg->rgrLteAdvCfg.pres & RGR_ABS)
- {
- cell->lteAdvCb.absCfg =
- cellCfg->rgrLteAdvCfg.absCfg;
- memset(cell->lteAdvCb.absLoadInfo, 0, sizeof(uint32_t)*RGR_ABS_PATTERN_LEN);
- cell->lteAdvCb.absLoadTtiCnt = 0;
- }
-
- if(cellCfg->rgrLteAdvCfg.pres & RGR_SFR)
- {
- cell->lteAdvCb.sfrCfg =
- cellCfg->rgrLteAdvCfg.sfrCfg;
- }
- if(cellCfg->rgrLteAdvCfg.pres & RGR_DSFR)
- {
- cell->lteAdvCb.dsfrCfg =
- cellCfg->rgrLteAdvCfg.dsfrCfg;
- }
-/* LTE_ADV_FLAG_REMOVED_END */
-
-#ifdef EMTC_ENABLE
- cell->emtcEnable = cellCfg->emtcEnable;
-#endif
- /* Initialize the cell */
- cell->cellId = cellCfg->cellId;
- cell->instIdx = inst;
- cell->macInst = cellCfg->macInst;
- cell->isCpUlExtend = cellCfg->isCpUlExtend;
- cell->isCpDlExtend = cellCfg->isCpDlExtend;
-
- cell->numTxAntPorts = rgSchCb[inst].rgrSchedEnbCfg.numTxAntPorts;
- if(cell->numTxAntPorts == 1)
- {
- cell->numCellRSPerSf = RGSCH_NUM_CELL_RS_ONE_ANT_PORT;
- }
- else if(cell->numTxAntPorts == 2)
- {
- cell->numCellRSPerSf = RGSCH_NUM_CELL_RS_TWO_ANT_PORT;
- }
- else
- {
- cell->numCellRSPerSf = RGSCH_NUM_CELL_RS_FOUR_ANT_PORT;
- }
- cell->bwCfg = cellCfg->bwCfg;
- cell->pbchRbStart = ((((cell->bwCfg.dlTotalBw * 12)/2) - 36)/12); /* Ref section 6.6 in 36.211 */
- cell->pbchRbEnd = cell->pbchRbStart + 5;
- cell->pucchCfg = cellCfg->pucchCfg;
- cell->rachCfg = cellCfg->rachCfg;
- cell->siCfg = cellCfg->siCfg;
- cell->t300TmrVal = cellCfg->t300TmrVal;
-#ifdef RGR_SI_SCH
- /*Initialize the SI CB in Cell CB */
- memset(&cell->siCb, 0, sizeof(RgSchSiCb));
-#endif
- /*Fix: Added Guard Pool for RNTI which will contain RNTIs
- *for UEs deleted from Scheduler but not yet from MAC*/
- cmLListInit(&cell->rntiDb.rntiGuardPool);
-
- /* Initialize the inWindow to sync with scheduler time when ticks starts */
-#ifdef LTEMAC_HDFDD
- cell->siCb.inWindow = (cellCfg->siCfg.siWinSize -
- (RG_SCH_CMN_DL_DELTA + RG_SCH_CMN_HARQ_INTERVAL));
-#else
- cell->siCb.inWindow = (cellCfg->siCfg.siWinSize -
- (RG_SCH_CMN_DL_DELTA));
-#endif
-
- if(cell->siCb.inWindow < 0)
- {
- cell->siCb.inWindow = 0;
- }
- cell->macPreambleSet = cellCfg->macPreambleSet;
- cell->phichCfg = cellCfg->phichCfg;
-
- /* Initialize UL and DL CCCH logical channels */
- cell->ulCcchId = RGSCH_INVALID_LC_ID;
- cell->dlCcchId = RGSCH_INVALID_LC_ID;
-
- /* Update SRS configuration */
- cell->srsCfg.isSrsCfgPres = cellCfg->srsCfg.isSrsCfgSetup;
- if(cellCfg->srsCfg.isSrsCfgSetup)
- {
- cell->srsCfg.srsCfgPrdEnum = cellCfg->srsCfg.srsCfgPrdEnum;
- cell->srsCfg.srsBwEnum = cellCfg->srsCfg.srsBwEnum;
- cell->srsCfg.srsTxOffst =
- rgSrsTxOffstTbl[cellCfg->srsCfg.srsSubFrameCfg];
- /*ccpu00116923 - ADD - Srs Present support */
-#ifdef TFU_UPGRADE
- cell->srsCfg.srsSubFrameCfg = cellCfg->srsCfg.srsSubFrameCfg;
-#endif
- }
-
- /* Configure all the common logical channels for the cell */
- for(idx = 0; idx < cellCfg->numCmnLcs; idx++)
- {
- /* This never returns failure and hence not checked for */
- rgSCHCfgRgrCmnLcCfg(cell, &(cellCfg->cmnLcCfg[idx]), errInfo);
- }
-
- /* Invoke the MeasGap and ACK NACK Rep handler for cell cfg */
-
- /* Dynamic CFI cell configuration */
- ret = rgSCHDynCfiCfg(cell, cellCfg);
- if(ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Rgr cell Config failed at "
- "Scheduler for cell");
- rgSCHCfgFreeCellCb(cell);
- return RFAILED;
- }
- /* Updating Auto TM Mode enable/diable flag */
- cell->isAutoCfgModeEnb = cellCfg->isAutoCfgModeEnb;
- {
- if(cell->isAutoCfgModeEnb)
- {
- DU_LOG("\nINFO --> SCH : Auto Mode Cfg enabled durint cell cfg\n");
- }
- }
- /* CPU OvrLoad State Initialization */
-#ifdef XEON_LMT_ITBS
- cell->thresholds.maxDlItbs = gWrMaxDlItbs;
- cell->thresholds.maxUlItbs = gWrMaxUlItbs;
- DU_LOG("\nINFO --> SCH : LIMIT DL and UL ITBS %d:%d \n",gWrMaxDlItbs,gWrMaxUlItbs);
-#else
- cell->thresholds.maxDlItbs = RG_SCH_DL_MAX_ITBS;
- cell->thresholds.maxUlItbs = RG_SCH_UL_MAX_ITBS;
-#endif
- cell->measurements.dlTpt = 0;
- cell->measurements.ulTpt = 0;
- cell->measurements.dlBytesCnt = 0;
- cell->measurements.ulBytesCnt = 0;
- cell->cpuOvrLdCntrl.cpuOvrLdIns = 0; /* 0 - No command */
- cell->cpuOvrLdCntrl.dlNxtIndxDecNumUeTti = 0;
- cell->cpuOvrLdCntrl.ulNxtIndxDecNumUeTti = 0;
- for ( idx = 0; idx < 10; idx++ )
- {
- cell->cpuOvrLdCntrl.maxUeNewTxPerTti[idx] = cellCfg->maxDlUeNewTxPerTti;
- cell->cpuOvrLdCntrl.maxUeNewRxPerTti[idx] = cellCfg->maxUlUeNewTxPerTti;
- }
-
- /* Invoke scheduler to update scheduler specific information */
- ret = rgSCHUtlRgrCellCfg(cell, cellCfg, errInfo);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Rgr cell Config failed at "
- "Scheduler for cell ");
- rgSCHCfgFreeCellCb(cell);
- return RFAILED;
- }
-
- /* Invoke DHM to update DHM specific information */
- rgSCHDhmRgrCellCfg(cell, cellCfg, errInfo);
-
-
- /* Initialize RNTI DB */
- ret = rgSCHDbmRntiDbInit(cell, cellCfg->macRnti.startRnti,
- cellCfg->macRnti.size);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Rgr Cell Config failed at"
- " RNTI DB init for cell");
- rgSCHCfgFreeCellCb(cell);
- return RFAILED;
- }
-
- /* Update the cell with recieved configuration */
- cell->dlHqCfg = cellCfg->dlHqCfg;
-
- DU_LOG("\nINFO --> SCH : Config DL HQTX = %d\n",cell->dlHqCfg.maxDlHqTx);
-
- cell->crntSfIdx = 0;
- /* Allocate the subframe allocation information */
- if((ret = rgSCHUtlGetSfAlloc(cell)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED for "
- "cell");
- rgSCHCfgFreeCellCb(cell);
- return RFAILED;
- }
- /* Update RACH Related information
- * XXX: Below function yet to be written in RAM
- * To store the preambles given in the configuration for PDCCH order in the
- * scheduler cell control block. Initialize the PRACH Mask Index allocated
- * for these preambles to invalid values */
-
- cell->crntHqIdx = 0;
- /* Allocate the subframe allocation information */
- if((ret = rgSCHUtlGetRlsHqAlloc(cell)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED for"
- "cell");
- rgSCHCfgFreeCellCb(cell);
- return RFAILED;
- }
-
- /* Associate a pair of upper and lower sapCbs with this cell */
- instCb->rgrSap[spId].cell = cell;
- instCb->tfuSap[spId].cell = cell;
- instCb->rgmSap[spId].cell = cell;
- cell->tfuSap = &(instCb->tfuSap[spId]);
-
- /* CaDev Start */
- instCb->cells[Idx1] = cell;
- /* CaDev End */
-
- /* rg001.201: Added for sending TTI tick to RRM */
-#if (defined(RGR_RRM_TICK) || defined(RGR_CQI_REPT))
- /* Associate the RGR SAP as well utilized while sending TTI
- * Ticks to RGR User. */
- cell->rgrSap = &(instCb->rgrSap[spId]);
-#endif
- cell->rgmSap = &(instCb->rgmSap[spId]);
-#ifdef RGR_RRM_TICK
- /* Store the periodicity configured */
- cell->rrmTtiIndPrd = cellCfg->rrmTtiIndPrd;
-#endif
-
-#ifdef LTE_L2_MEAS
- cmLListInit(&cell->l2mList);
-#endif
-
- if (rgSCHDrxCellCfg(cell,cellCfg) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Drx Memory allocation FAILED for"
- " cell");
- rgSCHCfgFreeCellCb(cell);
- return RFAILED;
- }
- cell->overLoadBackOffEnab = FALSE;/* Disabling RachOverload by default */
- /* Updating CSG Parameters */
- cell->minDlResNonCsg = cellCfg->csgParamCfg.minDlResNonCsg;
- cell->minUlResNonCsg = cellCfg->csgParamCfg.minUlResNonCsg;
-
- /* Register the cell with MAC */
- rgSCHUtlGetPstToLyr(&pst, instCb, cell->macInst);
- cellRegReq.cellId = cell->cellId;
- cellRegReq.cellSapId = spId;
-#ifdef LTE_TDD
- cellRegReq.maxDlHqProcPerUe = rgSchTddDlNumHarqProcTbl[cellCfg->ulDlCfgIdx];
-#else
- cellRegReq.maxDlHqProcPerUe = RGSCH_MAX_DL_HQ_PROC;
-#endif
- RgSchMacCellReg(&pst, &cellRegReq);
-
-#ifdef TENB_STATS
- cell->tenbStats = TSL2AllocCellStatsBlk(cell->cellId);
- cell->tenbStats->cellId = cell->cellId;
-#endif
-
- rgSCHUtlCalcDciSizes(cell);
-
-#ifdef LTE_ADV
- /* Initilalization of the list of UE for which this cell is secondary cell*/
- cmLListInit(&cell->sCellUeLst);
-#endif
-
-
-#ifdef LTE_ADV
- ret = rgSCHLaaSCellCbInit(cell, cellCfg);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Rgr Cell Config failed at"
- " Initializing the LAA Cell Control Cb");
- rgSCHCfgFreeCellCb(cell);
- return RFAILED;
- }
- cell->isPucchFormat3Sptd = cellCfg->isPucchFormat3Sptd;
- DU_LOG("\nINFO --> SCH : Format 3 is Enabled");
- DU_LOG ("\n Format 3 is Enabled for CELL:%d",cell->cellId);
-#endif
-
-
-#ifdef EMTC_ENABLE
-
- if(cell->emtcEnable)
- {
- if (rgSCHCfgEmtcCellCfg(cell,&(cellCfg->emtcCellCfg)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : EMTC Config Failed cell");
- return RFAILED;
- }
- }
-#endif
-
-#ifdef RG_5GTF
- ret = rgSCH5gtfCellCfg(cell, cellCfg);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : 5GTF Rgr Cell Config failed");
- rgSCHCfgFreeCellCb(cell);
- return RFAILED;
- }
-#endif
- errInfo->errCause = RGSCHERR_NONE;
- return ROK;
-} /* rgSCHCfgRgrCellCfg */
-
-/**
- * @brief Handler for the UE configuration request from RRC to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgRgrUeCfg
- *
- * Processing Steps:
- * - Allocate and create UE control block.
- * - Update UE control block with the values recieved in the
- * configuration.
- * - Invoke RAM, SCH, UHM and DHM with created UE control block, to
- * update random access, scheduler, uplink harq and downlink harq
- * specific information respectively.
- * - If successful, add the control block to hash list of UEs for the cell
- * else Rollback and FAIL.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgrUeCfg *ueCfg
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgRgrUeCfg
-(
-RgSchCellCb *cell,
-RgrUeCfg *ueCfg,
-RgSchErrInfo *errInfo
-)
-{
- S16 ret;
- RgSchRaCb *raCb=NULLP;
- RgSchUeCb *ue = NULLP;
- Inst inst = cell->instIdx;
- uint32_t lcgCnt;
- RgSchDlHqEnt *hqEnt = NULLP;
-#ifdef LTE_TDD
- uint8_t ulDlCfgIdx = cell->ulDlCfgIdx;
- uint8_t maxSubframes ;
- uint8_t maxDlSubframes;
-#endif
- uint32_t idx = 0;
-#ifdef TFU_UPGRADE
- RgSchUePCqiCb *cqiCb = NULLP;
-#endif
-
- do {
- errInfo->errCause = RGSCHERR_CFG_RGR_UE_CFG;
- /* RACHO : Check for raCb only if preamble Id not provded */
-#ifndef PRE_DEF_UE_CTX
- if (ueCfg->dedPreambleId.pres == NOTPRSNT)
- {
- if ((raCb = rgSCHDbmGetRaCb(cell, ueCfg->crnti)) == NULLP)
- {
- DU_LOG("\nERROR --> SCH : No RaCb exists for"
- "CRNTI:%d ",ueCfg->crnti);
- break;
- }
- }
-#endif
-
- /* Allocate the Ue control block */
- if (((rgSCHUtlAllocSBuf(inst, (Data **)&ue, sizeof(RgSchUeCb))) != ROK) ||
- ((uint8_t *)ue == NULLP))
- {
- DU_LOG("\nERROR --> SCH : Memory allocation"
- " FAILED for CRNTI:%d", ueCfg->crnti);
- break;
- }
-
- /* Inititialize Ue control block */
- ue->ueId = ueCfg->crnti;
- ue->cell = cell;
- /*ccpu00117778- Initialize Transmission Indices upon UE CB creation */
-#ifdef LA
- ue->lastRprdAckNackTime.sfn = cell->crntTime.sfn;
- ue->lastRprdAckNackTime.subframe = cell->crntTime.slot;
- ue->ueIdle = FALSE;
-#endif
-
- /* Allocate the Ue control block */
- if (((rgSCHUtlAllocSBuf(inst, (Data **)&(ue->cellInfo[RGSCH_PCELL_INDEX]),
- sizeof(RgSchUeCellInfo))) != ROK))
- {
-#ifndef ALIGN_64BIT
- DU_LOG("\nERROR --> SCH : [%lu]SCellIdx :Memomy allocation "
- "Failed while Adding SCell Information\n", idx);
-#else
- DU_LOG("\nERROR --> SCH : [%u]SCellIdx :Memomy allocation "
- "Failed while Adding SCell Information\n", idx);
-#endif
- return RFAILED;
- }
-
- ue->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)] = RGSCH_PCELL_INDEX;
- ue->cellInfo[RGSCH_PCELL_INDEX]->cell = cell;
- ue->cellInfo[RGSCH_PCELL_INDEX]->ue = ue;
-#ifdef LTE_ADV
- ue->cellInfo[RGSCH_PCELL_INDEX]->sCellState = RG_SCH_SCELL_ACTIVE;
- ue->cellInfo[RGSCH_PCELL_INDEX]->sCellIdx = RGSCH_PCELL_INDEX;
- ue->cellInfo[RGSCH_PCELL_INDEX]->sCellId = cell->cellId;
-
- if (ROK != rgSCHLaaInitDlRbAllocCb(cell,
- &ue->cellInfo[RGSCH_PCELL_INDEX]->dlAllocCb))
- {
- return RFAILED;
- }
-#endif
-#ifdef TFU_UPGRADE
- cqiCb = RG_SCH_GET_UE_CELL_CQI_CB(ue,cell);
- cqiCb->nCqiTrIdx = RG_SCH_INVALID_IDX;
- cqiCb->nRiTrIdx = RG_SCH_INVALID_IDX;
- ue->srsCb.nSrsTrIdx = RG_SCH_INVALID_IDX;
- ue->srCb.nSrTrIdx = RG_SCH_INVALID_IDX;
-#endif
- /* LTE_ADV_FLAG_REMOVED_START */
- /* While doing UE configuration for SFR at SCH, by default
- * CC UE power is configured as LOW */
- ue->lteAdvUeCb.isCCUePHigh = FALSE;
- /* LTE_ADV_FLAG_REMOVED_END */
-
- /* Initialize the lists of the UE */
- if((rgSCHDbmInitUe(ue)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : DBM initialization "
- "failed for CRNTI:%d", ueCfg->crnti);
- break;
- }
-#ifdef EMTC_ENABLE
- if(raCb != NULLP)
- {
- if(TRUE == raCb->isEmtcRaCb)
- {
- ue->isEmtcUe = TRUE;
- if (rgSCHUtlUpdUeEmtcInfo(cell, ueCfg, ue) != ROK)
- {
- DU_LOG("\nERROR --> SCH : EMTC UE Cfg"
- "failed for CRNTI:%d", ueCfg->crnti);
- break;
- }
- }
- }
-#endif
-
- /* Initialize scheduler related information for UE */
- if(rgSCHUtlRgrUeCfg(cell, ue, ueCfg, errInfo) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Scheduler handling "
- "failed in config for CRNTI:%d", ueCfg->crnti);
- break;
- }
-
- ret = rgSCHUhmHqEntInit(cell, ue);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : UHM HARQ Ent Init "
- "Failed for CRNTI:%d", ueCfg->crnti);
- break;
- }
-
- /* Initialize RAM related information for UE
- * RACHO: if preamble Id is present in ueCfg then raCb will be NULL
- * so rgSCHRamRgrUeCfg should take care of creating raCb */
- if ((ueCfg->dedPreambleId.pres == NOTPRSNT) && (NULLP != raCb) )
- {
- if((rgSCHRamRgrUeCfg(cell, ue, raCb, errInfo)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Random access "
- "handling config failed for CRNTI:%d", ueCfg->crnti);
- break;
- }
- }
- else /* if HO Ue */
- {
- RG_SCH_CMN_GET_UE_HQE(ue, cell) = rgSCHDhmHqEntInit(cell);
- hqEnt = RG_SCH_CMN_GET_UE_HQE(ue, cell);
- if (hqEnt == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Hq Entity Initialization "
- "failed in config for CRNTI:%d", ueCfg->crnti);
- break;
- }
-#ifdef EMTC_ENABLE
- rgSCHEmtcHqPAlloc(cell, hqEnt);
-#endif
- hqEnt->ue = ue;
- /* Fix : syed Assign hqEnt to UE only if msg4 is done */
-
- rgSCHCmnDlInitHqEnt(cell, hqEnt);
-
- /* For Hand-In UE Request Aper CQI report
- * immediately */
- if (ueCfg->ueDlCqiCfg.aprdCqiCfg.pres)
- {
- /* Set APCQI for Pcell only*/
- ue->dl.reqForCqi = RG_SCH_APCQI_SERVING_CC;
- }
- }
- /* CA dev Start */
-#ifdef LTE_TDD
- maxDlSubframes = rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1];
- maxSubframes = 2 * maxDlSubframes;
- ue->dl.numHqDlSfInfo = maxSubframes;
- rgSCHUtlAllocSBuf(cell->instIdx,
- (Data **)&ue->dl.dlSfHqInfo, sizeof(RgSchDlHqInfo) * (ue->dl.numHqDlSfInfo));
-
-#else
- ue->dl.numHqDlSfInfo = RGSCH_NUM_DL_slotS;
-#endif
-#ifndef RG_5GTF
- for (idx =0;idx < ue->dl.numHqDlSfInfo; idx++)
- {
- cmLListInit(&ue->dl.dlSfHqInfo[idx].hqPLst);
- ue->dl.dlSfHqInfo[idx].dlSfUeLnk.node = NULLP;
-
- }
-#else
- {
- uint8_t cellIdx=0;
- for (cellIdx = 0;cellIdx < MAX_5GTF_CELL ; cellIdx++)
- {
- for (idx =0;idx < ue->dl.numHqDlSfInfo; idx++)
- {
- cmLListInit(&ue->dl.dlSfHqInfo[cellIdx][idx].hqPLst);
- ue->dl.dlSfHqInfo[cellIdx][idx].dlSfUeLnk.node = NULLP;
- }
- }
- }
-#endif
-#ifdef LTE_ADV
- rgSCHLaaInitDlHqInfo(cell, ue);
-#endif
- /* CA dev End */
-
- /* Initialize lcgIds to Invalid */
- for (lcgCnt = 0; lcgCnt < RGSCH_MAX_LCG_PER_UE; lcgCnt++)
- {
- ue->ul.lcgArr[lcgCnt].lcgId = RGSCH_INVALID_LCG_ID;
- }
- if(raCb != NULLP)
- {
- rgSCHCfgRgrUePhrMsg3(cell,raCb,ue,errInfo);
- /* Moved this code out of rgSCHCfgRgrUePhrMsg3()
- * as it was not the appropriate place to
- * do this. */
- if (raCb->raState == RGSCH_RA_MSG4_DONE)
- {
- DU_LOG("\nERROR --> SCH : RNTI:%d RaCb deleted as Msg4 transmission is done",
- raCb->tmpCrnti);
- rgSCHRamDelRaCb(cell, raCb, FALSE);
- }
- }
- /* Initialize uplink HARQ related information for UE */
- rgSCHUhmRgrUeCfg(cell, ue, ueCfg);
- cmInitTimers(&ue->bsrTmr, 1);
-#ifdef RGR_V1
- /* Added periodic BSR timer */
- cmInitTimers(&ue->bsrTmr, 1);
-
- /* Fix - Added proper configuration from U-ARM */
- if(ueCfg->ueBsrTmrCfg.isPrdBsrTmrPres == TRUE)
- {
- ue->ul.bsrTmrCfg.isPrdBsrTmrPres = TRUE;
- ue->ul.bsrTmrCfg.prdBsrTmr = ueCfg->ueBsrTmrCfg.prdBsrTmr;
- ue->ul.bsrTmrCfg.retxBsrTmr = ueCfg->ueBsrTmrCfg.retxBsrTmr;
- }
-
-#endif
- /* Initialize downlink HARQ related information for UE */
- rgSCHDhmRgrUeCfg(cell, ue, ueCfg, errInfo);
-
- /* Initialize MeasureGap and Acknack Rep Information for UE */
- if((rgSCHMeasGapANRepUeCfg(cell, ue, ueCfg)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Measurement Gap and"
- " AckNack Rep failed in Config for CRNTI:%d", ueCfg->crnti);
- break;
- }
-
-
-#ifdef LTE_TDD
- if((rgSCHUtlAllocUeANFdbkInfo(ue,RGSCH_PCELL_INDEX)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Memomy allocation "
- "Failed while UE related Ack Nack Information for CRNTI:%d",
- ueCfg->crnti);
- break;
- }
- ue->dl.ackNackMode = ueCfg->ackNackModeEnum;
-#endif /* LTE_TDD */
-
- /* Insert Ue */
- rgSCHDbmInsUeCb(cell, ue);
-
-#ifdef TFU_UPGRADE
- /* Int ialize APeriodic CQI/PMI/RI Information for UE */
-
- DU_LOG("\nDEBUG --> SCH : rgSCHCfgRgrUeCfg CellID=%d UeId =%d AcqiCfg Pres =%d", cell->cellId, ue->ueId,\
- ueCfg->ueDlCqiCfg.aprdCqiCfg.pres);
-
- /*Store Trigger Set Bit String to UE */
-
- ret = rgSCHCfgACqiUeCfg(cell,ue, (RG_SCH_CMN_GET_ACQICB(ue,cell)),ue->mimoInfo.txMode,
- &ueCfg->ueDlCqiCfg.aprdCqiCfg, ue->ueCatEnum);
-
- ue->cqiRiWritIdx = 0;
- ue->cqiRiReadIdx = 0;
- /* Initialize Periodic CQI/PMI, RI Information for UE */
- ret = rgSCHCfgPCqiUeCfg(cell, ue, &ueCfg->ueDlCqiCfg.prdCqiCfg,
- ue->ueCatEnum);
-
- /* Initialize UL SRS Information for UE */
- ret = rgSCHCfgSrsUeCfg(cell, ue, &ueCfg->srsCfg);
-
- /* Initialize SR Information for UE */
- ret = rgSCHCfgSrUeCfg(cell, ue, &ueCfg->srCfg);
-#endif
-
-#ifdef LTEMAC_HDFDD
- if (rgSCHHdFddUeCfg(cell, ue, ueCfg->isHdFddEnbld) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Could not do HD-FDD config for CRNTI:%d",ueCfg->crnti);
- break;
- }
-
-#endif /* LTEMAC_HDFDD */
- /* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
- ue->cqiReptCfgInfo.numColltdCqiRept =
- ueCfg->ueCqiReptCfg.numColltdCqiRept;
-#endif /* End of RGR_CQI_REPT */
-#ifdef TFU_UPGRADE
- RG_SCH_CMN_GET_PA(ue,cell).pres = FALSE;
- if (RG_SCH_UE_CFG_ISPAPRSNT(ueCfg->uePdschDedCfg.uepACfg))
- {
- RG_SCH_CMN_GET_PA(ue,cell).pres = TRUE;
- RG_SCH_CMN_GET_PA(ue,cell).val = ueCfg->uePdschDedCfg.uepACfg.pA;
- }
-#endif
- ue->isDrxEnabled = ueCfg->ueDrxCfg.isDrxEnabled;
-
- if ( ue->isDrxEnabled )
- {
- if((rgSCHDrxUeCfg(cell,ue,ueCfg)) != ROK )
- {
- DU_LOG("\nERROR --> SCH : DRX configuration failed");
- break;
- }
- }
-
- /* LTE_ADV_FLAG_REMOVED_START */
- if ((cell->lteAdvCb.sfrCfg.status == RGR_ENABLE) || \
- (cell->lteAdvCb.absCfg.status == RGR_ENABLE))
- {
- ue->lteAdvUeCb.rgrLteAdvUeCfg = ueCfg->ueLteAdvCfg;
- }
- /* LTE_ADV_FLAG_REMOVED_END */
-
-#ifdef TENB_STATS
- ue->tenbStats = TSL2AllocUeStatsBlk(ue->ueId);
- ue->tenbStats->stats.rnti = ue->ueId;
-#endif
-#ifdef LTE_ADV
- /*Update A Value for PCell TBs*/
- ue->f1bCsAVal = rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode);
- DU_LOG("\nERROR --> SCH : UeCfg A value is %d\n",ue->f1bCsAVal);
-#endif
- errInfo->errCause = RGSCHERR_NONE;
-
- ue->accessStratumRls = ueCfg->accessStratumRls;
- if (ue->numSCells > 0)
- {
- /* 2 bit CSI */
- rgSCHUtlUpdUeDciSize(cell, ue, TRUE);
- }
- else
- {
- /* 1 bit CSI Access Stratum Release Change */
- rgSCHUtlUpdUeDciSize(cell, ue, FALSE);
- }
-
- return ROK;
- }while(0);
-
- if (ue)
- {
- rgSCHCfgFreeUeCb(cell, ue);
- }
- return RFAILED;
-} /* rgSCHCfgRgrUeCfg */
-
-/**
- * @brief Handler for PHR for MSG3.
- *
- * @details
- *
- * Function : rgSCHCfgRgrUePhrMsg3
- *
- * Processing Steps:
- * Handle PHR related config for MSG3
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgrUeCb *ueCb
- * @param[in] RgSchRaCb *raCb
- * @param[out] RgSchErrInfo *errInfo
- **/
-static Void rgSCHCfgRgrUePhrMsg3
-(
-RgSchCellCb *cell,
-RgSchRaCb *raCb,
-RgSchUeCb *ue,
-RgSchErrInfo *errInfo
-)
-{
-
- /* Record msg3 allocation in the UE */
- rgSCHUtlRecMsg3Alloc(cell, ue, raCb);
-
- /* If raCb received PHR, update scheduler */
- if(raCb->phr.pres == TRUE)
- {
- ue->macCeRptTime = raCb->msg3AllocTime;
- rgSCHUtlUpdPhr(cell, ue, raCb->phr.val, errInfo);
- }
-
- return;
-}
-
-/**
- *
- * @details
- *
- * Function : rgSCHDynCfiReCfg
- *
- * @param[in] RgSchCellCb *cell
- * Bool isDynCfiEnb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-Void rgSCHDynCfiReCfg
-(
-RgSchCellCb *cell,
-Bool isDynCfiEnb
-)
-{
- uint8_t idx;
- RgSchCmnDlCell *cellSchDl = RG_SCH_CMN_GET_DL_CELL(cell);
-
- if(isDynCfiEnb)
- {
- cell->dynCfiCb.ttiCnt = 0;
- cellSchDl->newCfi = cellSchDl->currCfi;
- }
- else
- {
- /* Resetting the parameters*/
- cell->dynCfiCb.cceFailCnt = 0;
- cell->dynCfiCb.cceFailSum = 0;
- cell->dynCfiCb.prevCceFailIdx = 0;
-
- for(idx = 0; idx < cell->dynCfiCb.numFailSamples; idx++)
- {
- cell->dynCfiCb.cceFailSamples[idx] = 0;
- }
-
- cell->dynCfiCb.cceUsed = 0;
- cell->dynCfiCb.lowCceCnt = 0;
- cell->dynCfiCb.ttiCnt = 0;
- }
-}
-/**
- * @brief Handler for the cell reconfiguration request from RRM to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgRgrCellRecfg
- *
- * Processing Steps:
- * - Invoke SCH with cell control block to update
- * scheduler specific information.
- * - Update cell control block with the values recieved in the
- * configuration.
- * - If successful, return ROK else RFAILED.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgrCellRecfg *cellRecfg
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgRgrCellRecfg
-(
-RgSchCellCb *cell,
-RgrCellRecfg *cellRecfg,
-RgSchErrInfo *errInfo
-)
-{
- S16 ret;
- Inst inst = cell->instIdx;
-/* LTE_ADV_FLAG_REMOVED_START */
- uint8_t i = 0;
- uint16_t len; /* dsfr_pal_fixes ** 21-March-2013 ** SKS */
-/* LTE_ADV_FLAG_REMOVED_END */
-
- errInfo->errCause = RGSCHERR_CFG_RGR_CELL_RECFG;
-
- /* Invoke scheduler to update scheduler specific information */
- ret = rgSCHUtlRgrCellRecfg(cell, cellRecfg, errInfo);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : RGR Cell re-configuration failed "
- "at Scheduler ");
- return RFAILED;
- }
-
- /* Invoke DHM to update DHM specific information */
- rgSCHDhmRgrCellRecfg(cell, cellRecfg, errInfo);
-
- /* PUCCH Reconfiguration */
- if (cellRecfg->recfgTypes & RGR_CELL_PUCCH_RECFG)
- {
- cell->pucchCfg = cellRecfg->pucchRecfg;
- }
-
- /* SRS Reconfiguration */
- if (cellRecfg->recfgTypes & RGR_CELL_SRS_RECFG)
- {
- cell->srsCfg.isSrsCfgPres = cellRecfg->srsRecfg.isSrsCfgSetup;
- if(cellRecfg->srsRecfg.isSrsCfgSetup)
- {
- cell->srsCfg.srsCfgPrdEnum = cellRecfg->srsRecfg.srsCfgPrdEnum;
- cell->srsCfg.srsBwEnum = cellRecfg->srsRecfg.srsBwEnum;
- cell->srsCfg.srsTxOffst =
- rgSrsTxOffstTbl[cellRecfg->srsRecfg.srsSubFrameCfg];
- /*ccpu00116923 - ADD - Srs Present support */
-#ifdef TFU_UPGRADE
- cell->srsCfg.srsSubFrameCfg = cellRecfg->srsRecfg.srsSubFrameCfg;
-#endif
- }
- }
-
- /* RACH Reconfiguration */
- if (cellRecfg->recfgTypes & RGR_CELL_RACH_RECFG)
- {
- cell->rachCfg = cellRecfg->rachRecfg;
- }
-
- /* ccpu00132256:MOD: Moved this assignment from Validation to here.*/
- if (cellRecfg->recfgTypes & RGR_CELL_TMRS_RECFG)
- {
- cell->t300TmrVal = cellRecfg->t300TmrVal;
- }
-#ifdef RGR_SI_SCH
- /* SI Reconfiguration */
- if (cellRecfg->recfgTypes & RGR_CELL_SI_RECFG)
- {
- /*Set the specified SI configuration. */
- cell->siCb.newSiCfg = cellRecfg->siReCfg;
- /* Set the Bit mask for SI re-configuration */
- cell->siCb.siBitMask |= RGSCH_SI_SICFG_UPD;
-#ifdef EMTC_ENABLE
- if(cell->emtcEnable)
- {
- rgSchEmtcUpdSiCfg(cell, cellRecfg);
- }
-#endif
- }
-#endif /*RGR_SI_SCH */
-
- /* Overload RACH Control changes */
- if (cellRecfg->recfgTypes & RGR_CELL_CNTRL_CMD_RECFG)
- {
- if (cellRecfg->cntrlCmdCfg.cmdType == RGR_CNTRL_CMD_RACH_OVRLD)
- {
- cell->overLoadBackOffEnab = cellRecfg->cntrlCmdCfg.cmdDesc.rachOvrLd.backOffEnb;
- cell->overLoadBackOffval = cellRecfg->cntrlCmdCfg.cmdDesc.rachOvrLd.backOffVal;
- }
- else if (cellRecfg->cntrlCmdCfg.cmdType == RGR_CNTRL_CMD_CPU_OVRLD)
- {
- if( ROK != rgSCHUtlResetCpuOvrLdState(cell, cellRecfg->cntrlCmdCfg.cmdDesc.\
- cpuOvrLd.instruction))
- {
- DU_LOG("\nERROR --> SCH : Invalid CPU OvrLd Ins %d for cell",
- cellRecfg->cntrlCmdCfg.cmdDesc.cpuOvrLd.instruction);
- return RFAILED;
- }
- }
- }
-
-/* LTE_ADV_FLAG_REMOVED_START */
- if (cellRecfg->recfgTypes & RGR_CELL_LTEA_FEATURE_RECFG)
- {
- if(cellRecfg->rgrLteAdvCfg.pres & RGR_ABS)
- {
- cell->lteAdvCb.absCfg =
- cellRecfg->rgrLteAdvCfg.absCfg;
- }
- if(cellRecfg->rgrLteAdvCfg.pres & RGR_SFR)
- {
- memcpy(&cell->lteAdvCb.sfrCfg, &cellRecfg->rgrLteAdvCfg.sfrCfg,
- sizeof(RgrSfrConfig));
- /* dsfr_pal_fixes ** 21-March-2013 ** SKS */
- if (cellRecfg->rgrLteAdvCfg.sfrCfg.status == RGR_ENABLE)
- {
- for(i = 0; i < RGSCH_NUM_DL_slotS; i++)
- {
- /*initialise the pools of CC and CE*/
- if(rgSchSFRTotalPoolInit(cell, cell->subFrms[i]))
- {
- return RFAILED;
- }
- }
- }
- else
- {
- for(i = 0; i < RGSCH_NUM_DL_slotS; i++)
- {
- /*initialise the pools of CC and CE*/
- rgSchSFRTotalPoolFree(&cell->subFrms[i]->sfrTotalPoolInfo, cell);
- }
-
- if (cell->lteAdvCb.dsfrCfg.status == RGR_ENABLE)
- {
- /* releasing rntp info val from each subframe */
- for(i = 0; i < RGSCH_NUM_DL_slotS; i++)
- {
- rgSchDSFRRntpInfoFree(&cell->subFrms[i]->rntpInfo, cell, cell->bwCfg.dlTotalBw);
- }
-
- /* releasing RNTP Aggregation Info from CellCb*/
- rgSchDSFRRntpInfoFree(&cell->rntpAggrInfo, cell, cell->bwCfg.dlTotalBw);
-
- cell->lteAdvCb.dsfrCfg.status = RGR_DISABLE;
- }
- }
- }
- /* dsfr_pal_fixes ** 21-March-2013 ** SKS ** Start */
- if(cellRecfg->rgrLteAdvCfg.pres & RGR_DSFR)
- {
- cell->lteAdvCb.dsfrCfg =
- cellRecfg->rgrLteAdvCfg.dsfrCfg;
- if (cell->lteAdvCb.dsfrCfg.status == RGR_ENABLE)
- {
- for(i = 0; i < RGSCH_NUM_DL_slotS; i++)
- {
- /*initialise the pools of CC and CE*/
- if(rgSchDSFRRntpInfoInit(&cell->subFrms[i]->rntpInfo,cell,cell->bwCfg.dlTotalBw))
- {
- return RFAILED;
- }
- }
- /*Calculating the length of RNTP array based on Dl Bandwidth */
- len = (uint16_t)((cell->bwCfg.dlTotalBw % 8 == 0) ? (cell->bwCfg.dlTotalBw/8) : (cell->bwCfg.dlTotalBw/8 + 1)); /* KW fix for LTE_ADV */
- if(cell->rntpAggrInfo.pres == NOTPRSNT)
- {
- if((rgSCHUtlAllocSBuf(inst, (Data**)&(cell->rntpAggrInfo.val),
- (len * sizeof(uint8_t)))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED for RNTP Alloc");
- return RFAILED;
- }
- cell->rntpAggrInfo.pres = PRSNT_NODEF;
- cell->rntpAggrInfo.len = len;
- }
- }
- /* in case if DSFR is disabled, need to free RNTP pattern val*/
- else
- {
- /* releasing rntp info val from each subframe */
- for(i = 0; i < RGSCH_NUM_DL_slotS; i++)
- {
- rgSchDSFRRntpInfoFree(&cell->subFrms[i]->rntpInfo, cell, cell->bwCfg.dlTotalBw);
- }
-
- /* releasing RNTP Aggregation Info from CellCb*/
- rgSchDSFRRntpInfoFree(&cell->rntpAggrInfo, cell, cell->bwCfg.dlTotalBw);
- }
- }
- /* dsfr_pal_fixes ** 21-March-2013 ** SKS ** End */
- }
-/* LTE_ADV_FLAG_REMOVED_END */
-
- /* Dynamic CFI cell Reconfiguration */
- if(cellRecfg->recfgTypes & RGR_CELL_DYN_CFI_RECFG)
- {
- if(cell->dynCfiCb.isDynCfiEnb != cellRecfg->isDynCfiEnb)
- {
- if(cell->dynCfiCb.switchOvrInProgress)
- {
- cell->dynCfiCb.dynCfiRecfgPend = TRUE;
- }
- else
- {
- cell->dynCfiCb.isDynCfiEnb = cellRecfg->isDynCfiEnb;
- rgSCHDynCfiReCfg(cell, cellRecfg->isDynCfiEnb);
- }
- }
- else
- {
- /* To hanlde the case where reconfiguration comes for disabling
- * and then enabling before switchover period expires */
- cell->dynCfiCb.dynCfiRecfgPend = FALSE;
- }
- }
- /* Dynamic config of AUTO chnage flag */
- if(cellRecfg->recfgTypes & RGR_CELL_AUTO_CFG_MODE_RECFG)
- {
- if(cell->isAutoCfgModeEnb != cellRecfg->isAutoCfgModeEnb)
- {
- cell->isAutoCfgModeEnb = cellRecfg->isAutoCfgModeEnb;
- }
- }
- {
- if(cell->isAutoCfgModeEnb)
- {
- DU_LOG("\nINFO --> SCH : Auto Mode Cfg enabled durint cell recfg\n");
- }
- }
-
- if (cellRecfg->recfgTypes & RGR_CELL_CSG_PARAM_RECFG)
- {
- cell->minDlResNonCsg = cellRecfg->csgParamCfg.minDlResNonCsg;
- cell->minUlResNonCsg = cellRecfg->csgParamCfg.minUlResNonCsg;
- }
-
- errInfo->errCause = RGSCHERR_NONE;
- return ROK;
-} /* rgSCHCfgRgrCellRecfg */
-
-/**
- * @brief Handler for the UE reconfiguration request from RRC to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgRgrUeRecfgRntiChg
- *
- * Processing Steps:
- * - If rnti changes,
- * - Invoke RAM for UE reconfiguration.
- * - Delete old UE from the list.
- * - Update the new rnti and re-insert the UE in the list.
- * - If successful, return ROK else RFAILED.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrUeRecfg *ueRecfg
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHCfgRgrUeRecfgRntiChg
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeRecfg *ueRecfg,
-RgSchErrInfo *errInfo
-)
-{
-#ifdef LTE_ADV
- uint8_t sCellIdx;
-#endif
- S16 ret;
- RgSchRaCb *raCb;
- RgSchRaCb *oldRaCb;
- RgSchDlHqEnt **hqEnt = &(RG_SCH_CMN_GET_UE_HQE(ue, cell));
- uint8_t idx;
-
- /* Handle CRNTI change in reconfiguration */
- if (ueRecfg->oldCrnti != ueRecfg->newCrnti)
- {
- RgSchRntiLnk *oldRntiLnk=NULLP;
- CmLteRnti oldRnti = 0;
- if ((raCb = rgSCHDbmGetRaCb(cell, ueRecfg->newCrnti)) == NULLP)
- {
- DU_LOG("\nERROR --> SCH : UEID:No RaCb exists while"
- "Reconfig for OLD CRNTI:%d NEW CRNTI:%d",ueRecfg->oldCrnti,ueRecfg->newCrnti);
- return RFAILED;
- }
-
- /* rntiLnk does not exist for a HandIn UE. Hence this check. */
- if(ue->rntiLnk)
- {
- oldRntiLnk = ue->rntiLnk;
- }
- else
- {
- /* Fix : syed HO UE does not have a valid ue->rntiLnk */
- oldRnti = ue->ueId;
- }
-
- DU_LOG("\nINFO --> SCH : UE ID CHNG OLD %d new %d",ueRecfg->oldCrnti, ueRecfg->newCrnti);
-
- /* Fix : syed Deleting Old DL HqEnt. It would be assigned after
- * reest RACH(msg4) is completed. */
- rgSCHDhmDelHqEnt(cell, hqEnt);
-
- /* Initialize RAM related information for UE */
- ret = rgSCHRamRgrUeCfg(cell, ue, raCb, errInfo);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : RAM Handling for UE Reconfig failed"
- "for OLD CRNTI:%d NEW CRNTI:%d",ueRecfg->oldCrnti,ueRecfg->newCrnti);
- return RFAILED;
- }
- /* Delete Ue from the ue list */
- rgSCHDbmDelUeCb(cell, ue);
-
-#ifdef LTE_ADV
- if (ue->numSCells)
- {
- for ( sCellIdx = 1; sCellIdx < CM_LTE_MAX_CELLS; sCellIdx++)
- {
- if(ue->cellInfo[sCellIdx] != NULLP)
- {
- rgSCHDbmDelUeCb(ue->cellInfo[sCellIdx]->cell, ue);
- }
- }
- }
-#endif
-
- /* Inititialize Ue control block */
- ue->ueId = ueRecfg->newCrnti;
- DU_LOG("\nDEBUG --> SCH : Changing RNTI from %d to %d",
- ueRecfg->oldCrnti,
- ueRecfg->newCrnti);
-#ifdef EMTC_ENABLE
- if(ue->isEmtcUe)
- {
- rgSCHUtlUpdEmtcY(ue);
- }
-#endif
-
- /* Fix ccpu00122631: PCell_Reest: Updating new Rnti in all the cells
- * dlAllocCb
- */
- for(idx = 0; idx < CM_LTE_MAX_CELLS; idx++)
- {
- if(ue->cellInfo[idx])
- {
- ue->cellInfo[idx]->dlAllocCb.rnti = ueRecfg->newCrnti;
- }
- }
-
- rgSCHUtlRecMsg3Alloc(cell, ue, raCb);
-
- /* If raCb received PHR, update scheduler */
- if(raCb->phr.pres == TRUE)
- {
- ue->macCeRptTime = raCb->msg3AllocTime;
- rgSCHUtlUpdPhr(cell, ue, raCb->phr.val, errInfo);
- }
-
-#ifdef RGR_V2 /* Acc Fix */
- if(TRUE == ue->isDrxEnabled)
- {
- ueRecfg->ueDrxRecfg.isDrxEnabled = TRUE;
- ret = rgSCHDrxUeReCfg(cell,ue,ueRecfg);
-
- if ( ret != ROK )
- {
- DU_LOG("\nERROR --> SCH : UE DRX re-est failed"
- "for OLD CRNTI:%d NEW CRNTI:%d",ueRecfg->oldCrnti,ueRecfg->newCrnti);
- return RFAILED;
- }
- }
-#endif /* Acc Fix */
-
- /* Re-insert updated Ue */
- rgSCHDbmInsUeCb(cell, ue);
-
-#ifdef LTE_ADV
- if (ue->numSCells)
- {
- for ( sCellIdx = 1; sCellIdx < CM_LTE_MAX_CELLS; sCellIdx++)
- {
- if(ue->cellInfo[sCellIdx] != NULLP)
- {
- rgSCHDbmInsUeCb(ue->cellInfo[sCellIdx]->cell, ue);
- }
- }
- }
-#endif
-
-
-#ifdef TENB_STATS
- ue->tenbStats->stats.rnti = ue->ueId;
-#endif
-
- /* Fix : syed If MSG4 is done, since corresponding ueCb
- * is ready, the raCb should be cleared immediately.
- * Otherwise it would remain in the cell until timed out
- * and till then the hq Feedbacks will be assumed to be
- * for msg4 */
- if (raCb->raState == RGSCH_RA_MSG4_DONE)
- {
- DU_LOG("\nDEBUG --> SCH : RNTI:%d with RaCb deleted as Msg4 transmission is done",
- raCb->tmpCrnti);
- rgSCHRamDelRaCb(cell, raCb, FALSE);
- }
- /* Fix : syed moving the UL CQI initialization to UERESET */
-
- /* Release Older rnti */
- if(oldRntiLnk)
- {
- /* This is the rare case in which back to back reestablishment is
- * happening and previous re-est was not done completely (MSG4 was
- * not done) for an UE, and again re-est is triggered for the same
- * UE. We are deleting the old RA CB for the previous re-est which
- * still exist due to MSG4 not transmitted successfully */
- if ((oldRaCb = rgSCHDbmGetRaCb(cell, oldRntiLnk->rnti)) != NULLP)
- {
- rgSCHRamDelRaCb(cell, oldRaCb, FALSE);
- }
-
- rgSCHUtlRlsRnti(cell, oldRntiLnk, TRUE, ueRecfg->newCrnti);
- }
- else
- {
- /* Fix : syed HO UE does not have a valid ue->rntiLnk */
- /* Just indicate to MAC, no need to release at SCH */
- DU_LOG("\nDEBUG --> SCH : HO OldRnti:%d RLS and NewRnti:%d CHNG IND TO MAC",
- oldRnti, ueRecfg->newCrnti);
- rgSCHUtlIndRntiRls2Mac(cell, oldRnti, TRUE, ueRecfg->newCrnti);
- }
- }
- return ROK;
-}
-/**
- * @brief Handler for the UE reconfiguration request from RRC to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgRgrUeRecfg
- *
- * Processing Steps:
- * - If rnti changes,
- * - Invoke RAM for UE reconfiguration.
- * - Delete old UE from the list.
- * - Update the new rnti and re-insert the UE in the list.
- * - Update the UE control block with the reconfigured values.
- * - Invoke SCH, UHM and DHM with updated UE control block to
- * update scheduler, uplink HARQ and downlink HARQ specific
- * parameters.
- * - If successful, return ROK else RFAILED.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrUeRecfg *ueRecfg
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgRgrUeRecfg
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeRecfg *ueRecfg,
-RgSchErrInfo *errInfo
-)
-{
- S16 ret;
-#ifdef LTE_ADV
- Bool dciChange = TRUE;
-#endif
-
- errInfo->errCause = RGSCHERR_CFG_RGR_UE_RECFG;
-
-#ifdef LTE_ADV
- if (ue->numSCells > 0)
- {
- dciChange = FALSE;
- }
- if ((ueRecfg->ueRecfgTypes & RGR_UE_UE_ACCESS_STRATUM_REL_RECFG) && \
- (ue->accessStratumRls != ueRecfg->accessStratumRls))
- {
- ue->accessStratumRls = ueRecfg->accessStratumRls;
- dciChange = TRUE;
- }
-
- /* if SCELL_RECFG is present , no other
- * type will be present. Process Scell addition
- * and return
- * */
- if (ueRecfg->ueRecfgTypes & RGR_UE_SCELL_ADD_RECFG)
- {
- ret = rgSCHSCellCfgUeCfg(cell, ue, ueRecfg, errInfo);
- if( ret != ROK)
- {
- errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_UE_SCELL_RECFG;
- /*FH: SCell config failed for a scell index hence revert all successful
- * Scell config and send negative confirmation to APP*/
- rgSCHSCellCfgUeCfgRollBack(cell, ue, ueRecfg);
- return RFAILED;
- }
- }
- if (dciChange == TRUE)
- {
- if (ue->numSCells > 0)
- {
- /* 2 bit CSI */
- rgSCHUtlUpdUeDciSize(cell, ue, TRUE);
- }
- else
- {
- /* 1 bit CSI Access Stratum Release Change */
- rgSCHUtlUpdUeDciSize(cell, ue, FALSE);
- }
- }
- if (ueRecfg->ueRecfgTypes & RGR_UE_SCELL_PUCCH_RECFG)
- {
- ret = rgSCHSCellCfgUePucchReCfg(cell, ue, ueRecfg, errInfo);
- if( ret != ROK)
- {
- errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_UE_SCELL_PUCCH_RECFG;
- return RFAILED;
- }
- }
-#else
- if ((ueRecfg->ueRecfgTypes & RGR_UE_UE_ACCESS_STRATUM_REL_RECFG) && \
- (ue->accessStratumRls != ueRecfg->accessStratumRls))
- {
- ue->accessStratumRls = ueRecfg->accessStratumRls;
- rgSCHUtlUpdUeDciSize(cell, ue, FALSE);
- }
-#endif /* LTE_ADV */
-
- if (ueRecfg->ueRecfgTypes)
- {
- /* Update scheduler related information for UE */
- ret = rgSCHUtlRgrUeRecfg(cell, ue, ueRecfg, errInfo);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Scheduler handling while reconfig failed"
- "for OLD CRNTI:%d NEW CRNTI:%d",ueRecfg->oldCrnti,ueRecfg->newCrnti);
- return RFAILED;
- }
-
- /* Update uplink HARQ related information for UE */
- rgSCHUhmRgrUeRecfg(cell, ue, ueRecfg);
-
- /* Update TA related information for UE */
- if (ueRecfg->ueRecfgTypes & RGR_UE_TATMR_RECFG)
- {
- rgSCHCfgUeTaRecfg(cell, ue, ueRecfg, errInfo);
- }
-
- /*Update Measurement Gap and AckNack Details */
- /* After merging from 2.2 */
- if (ueRecfg->ueRecfgTypes & RGR_UE_ACKNACK_MEASGAP_RECFG)
- {
- ret = rgSCHMeasGapANRepUeRecfg(cell, ue, ueRecfg);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Measurement Gap and"
- "AckNack Rep Recfg failed for OLD CRNTI:%d NEW CRNTI:%d",
- ueRecfg->oldCrnti,ueRecfg->newCrnti);
- return RFAILED;
- }
- }
- if (ueRecfg->ueRecfgTypes & RGR_UE_BSRTMR_RECFG)
- {
- cmInitTimers(&ue->bsrTmr, 1);
- ue->ul.bsrTmrCfg = ueRecfg->ueBsrTmrRecfg;
- if ((ue->ul.bsrTmrCfg.isPrdBsrTmrPres) &&
- (ue->ul.bsrTmrCfg.prdBsrTmr == 0xFFFF))
- {
- ue->ul.bsrTmrCfg.isPrdBsrTmrPres = FALSE;
- }
- }
- }
-
- if (RFAILED == rgSCHCfgRgrUeRecfgRntiChg (cell, ue, ueRecfg, errInfo))
- {
- DU_LOG("\nERROR --> SCH : RNTI change "
- "failed for OLD CRNTI:%d NEW CRNTI:%d",
- ueRecfg->oldCrnti,ueRecfg->newCrnti);
- return RFAILED;
- }
-
-#ifdef TFU_UPGRADE
- /* Re-Initialize Aperiodic CQI Information for UE*/
- if ( ueRecfg->ueRecfgTypes & RGR_UE_APRD_DLCQI_RECFG )
- {
- ret = rgSCHCfgAcqiUeReCfg(cell, ue, &ueRecfg->aprdDlCqiRecfg,
- ue->ueCatEnum);
- }
- /* Re-Initialize Periodic CQI/PMI, RI Information for UE */
- if ( ueRecfg->ueRecfgTypes & RGR_UE_PCQI_RECFG)
- {
- ret = rgSCHCfgPCqiUeReCfg(cell, ue, &ueRecfg->cqiCfg,
- ue->ueCatEnum);
- }
- /* Re-Initialize UL SRS Information for UE */
- if ( ueRecfg->ueRecfgTypes & RGR_UE_SRS_RECFG)
- {
- ret = rgSCHCfgSrsUeReCfg(cell, ue, &ueRecfg->srsCfg);
- }
- /* Re-Initialize SR Information for UE */
- if ( ueRecfg->ueRecfgTypes & RGR_UE_SR_RECFG)
- {
- ret = rgSCHCfgSrUeReCfg(cell, ue, &ueRecfg->srCfg);
- }
-#endif
-
-#ifdef LTEMAC_HDFDD
- if(ueRecfg->isHdFddEnbld)
- {
- ret = rgSCHHdFddUeCfg(cell, ue, ueRecfg->isHdFddEnbld);
- if (ret != ROK)
- {
- errInfo->errCause = RGSCHERR_HDFDD_SPSCFGRD;
- return (ret);
- }
- }
-#endif /* LTEMAC_HDFDD */
-#ifdef RGR_V2
- if ( ueRecfg->ueRecfgTypes & RGR_UE_DRX_RECFG)
- {
- ret = rgSCHDrxUeReCfg(cell,ue,ueRecfg);
-
- if ( ret != ROK )
- {
- DU_LOG("\nERROR --> SCH : UE DRX reconfig failed"
- "failed for OLD CRNTI:%d NEW CRNTI:%d",
- ueRecfg->oldCrnti,ueRecfg->newCrnti);
- return RFAILED;
- }
- }
-#endif
-/* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
- /* CQI Reporting (N) Re-configuration */
- if(ueRecfg->ueRecfgTypes & RGR_UE_CQIREPT_RECFG)
- {
- ret = rgSCHCfgUeCqiReptReCfg(cell, ue, ueRecfg);
- if(ret != OK)
- {
- errInfo->errCause = RGSCHERR_CQIREPT;
- return (ret);
- }
- }
-#endif /* End of RGR_CQI_REPT */
-#ifdef TFU_UPGRADE
- /* pA Re-configuration */
- if((ueRecfg->ueRecfgTypes & RGR_UE_PA_RECFG) &&
- RG_SCH_UE_CFG_ISPAPRSNT(ueRecfg->uePdschDedCfg.uepACfg))
- {
- RG_SCH_CMN_GET_PA(ue,cell).pres = TRUE;
- RG_SCH_CMN_GET_PA(ue,cell).val = ueRecfg->uePdschDedCfg.uepACfg.pA;
- }
-#endif
-
-/* LTE_ADV_FLAG_REMOVED_START */
- if(ueRecfg->ueRecfgTypes & RGR_UE_LTEA_RECFG)
- {
- if(ueRecfg->ueLteAdvCfg.pres & RGR_ABS)
- {
- ue->lteAdvUeCb.rgrLteAdvUeCfg.isAbsUe = ueRecfg->ueLteAdvCfg.isAbsUe;
- }
-
- if(ueRecfg->ueLteAdvCfg.pres & RGR_SFR)
- {
- ue->lteAdvUeCb.rgrLteAdvUeCfg.isUeCellEdge = ueRecfg->ueLteAdvCfg.isUeCellEdge;
- }
- }
-/* LTE_ADV_FLAG_REMOVED_END */
-#ifdef EMTC_ENABLE
- if(ueRecfg->ueRecfgTypes & RGR_UE_EMTC_DPLXMODE_RECFG)
- {
- rgSCHEmtcHdFddUeCfg (cell, ue,
- ueRecfg->emtcUeRecfg.isHdFddEnbld);
- }
- if(ueRecfg->ueRecfgTypes & RGR_UE_EMTC_PO_TRIGGER)
- {
- rgSCHEmtcPOTrigger(cell, ue);
- }
-#endif
- errInfo->errCause = RGSCHERR_NONE;
-
- return ROK;
-} /* rgSCHCfgRgrUeRecfg */
-
-
-/**
- * @brief Handler for the logical channel reconfiguration request from
- * RRC to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgRgrLchRecfg
- *
- * Processing Steps:
- * - Invoke scheduler to update scheduler specific information.
- * - Update the dedicated logical channel Cb with the reconfigured
- * values.
- * - If successful, return ROK else RFAILED.
- *
- * @param[in] RgUlCellCb *cell
- * @param[in] RgUlUeCb *ue
- * @param[in] RgSchUlLcCb *ulLc
- * @param[in] RgSchDlLcCb *dlLc
- * @param[in] RgrLchRecfg *lcRecfg
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgRgrLchRecfg
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *dlLc,
-RgrLchRecfg *lcRecfg,
-RgSchErrInfo *errInfo
-)
-{
- S16 ret = ROK;
-
- errInfo->errCause = RGSCHERR_CFG_RGR_LC_RECFG;
- /* Invoke Scheduler to update the new configuration */
- ret = rgSCHUtlRgrLcRecfg(cell, ue, dlLc, lcRecfg, errInfo);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Scheduler handling for LC Recfg"
- " failed for CRNTI:%d LCID:%d",lcRecfg->crnti,lcRecfg->lcId);
- return RFAILED;
- }
-
- errInfo->errCause = RGSCHERR_NONE;
- return ROK;
-} /* rgSCHCfgRgrLchRecfg */
-/**
- * @brief Handler for the logical channel reconfiguration request from
- * RRC to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgRgrLcgRecfg
- *
- * Processing Steps:
- * - Invoke scheduler to update scheduler specific information.
- * - Update the dedicated logical channel Cb with the re-configured
- * values.
- * - If successful, return ROK else RFAILED.
- *
- * @param[in] RgUlCellCb *cell
- * @param[in] RgUlUeCb *ue
- * @param[in] RgrLcgRecfg *lcgRecfg
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgRgrLcgRecfg
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrLcgRecfg *lcgRecfg,
-RgSchErrInfo *errInfo
-)
-{
- S16 ret = ROK;
-
- errInfo->errCause = RGSCHERR_CFG_RGR_LCG_RECFG;
-
- /*Added for handling LCG ReConfig if the LCG was deleted */
- ue->ul.lcgArr[lcgRecfg->ulRecfg.lcgId].lcgId = lcgRecfg->ulRecfg.lcgId;
-
- /* Invoke Scheduler to update the new configuration */
- ret = rgSCHUtlRgrLcgRecfg(cell, ue, lcgRecfg, errInfo);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Scheduler handling for LCG Recfg"
- " failed for CRNTI:%d LCGID:%d",lcgRecfg->crnti,lcgRecfg->ulRecfg.lcgId);
- return RFAILED;
- }
-
- errInfo->errCause = RGSCHERR_NONE;
- return ROK;
-} /* rgSCHCfgRgrLcgRecfg */
-
-/**
- * @brief Handler for the UE Reset request from RRM to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgRgrUeReset
- *
- * Processing Steps:
- * - Call Measument Gap Module and Ack/Nack Module for resetting UE.
- * - Call Common Schduler UE rest API which inturn will call scheduler
- * specific UE Reset APis to reset UE.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrRst *reset
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgRgrUeReset
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrRst *reset,
-RgSchErrInfo *errInfo
-)
-{
- uint32_t idx;
- RgSchRaCb *raCb;
-
- errInfo->errCause = RGSCHERR_CFG_RGR_UE_RESET;
-
- /* Setting BO of Each Logical Channel of the UE to 0 */
- for (idx = 0; idx < RGSCH_MAX_LC_PER_UE; idx++)
- {
- if(ue->dl.lcCb[idx] != NULLP)
- ue->dl.lcCb[idx]->bo = 0;
- }
-
- /* Reset the totalBo */
- ue->totalBo = 0;
- /* Call DRX module to stop all DRX timers */
- /* ccpu00129899 */
- if(ue->drxCb != NULLP)
- {
- (Void)rgSCHDrxUeDel(cell,ue);
- }
-
- /* ccpu00140894- Stop TXMode transiition timer if it is running*/
- if (ue->txModeTransTmr.tmrEvnt != TMR_NONE)
- {
- rgSCHTmrStopTmr(cell, RG_SCH_TMR_TXMODE_TRNSTN, ue);
- ue->txModeTransCmplt =TRUE;
- }
-
- /* ccpu00133470- Meas Gap should be released during RRC re-establishment */
- rgSCHMeasGapANRepUeDel(cell, ue, FALSE);
-
- /* Call Common scheduler which in turn will call specific scheduler for UE
- * Reset*/
- rgSCHUtlUeReset(cell, ue);
-#ifdef LTE_ADV
- /*PCell which is at idx 0 is always active. Adding a line after the loop
- *setting RGSCH_PCELL_INDEX to SCELL ACTIVE*/
- ue->cellInfo[RGSCH_PCELL_INDEX]->sCellState = RG_SCH_SCELL_ACTIVE;
-#endif
-
- /* In case of back to back reestablishments, when this UE's
- * previous ReEst is still in progress and has got RESET
- * as part of new ReEst */
- if((raCb = rgSCHDbmGetRaCb(cell, ue->ueId)) != NULLP)
- {
- rgSCHRamDelRaCb(cell, raCb, FALSE);
- }
- /* Fix : syed set UE inactive in DL until UE is reinitialization completed */
- ue->dl.dlInactvMask |= RG_HQENT_INACTIVE;
- ue->ul.ulInactvMask |= RG_HQENT_INACTIVE;
- /* [ccpu00127141] Resetting TA related parameters */
- ue->dl.taCb.ta = RGSCH_NO_TA_RQD;
- ue->dl.taCb.state = RGSCH_TA_IDLE;
-
- /*[ccpu00121813]-ADD-Initializing outstanding TA value */
- ue->dl.taCb.outStndngTa = FALSE;
- ue->dl.taCb.outStndngTaval = RGSCH_NO_TA_RQD;
-
- if (ue->dl.taCb.cfgTaTmr)
- {
- rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_TA, ue->dl.taCb.cfgTaTmr);
- }
-
-#ifdef DL_LA
- /* Resetting the Tx mode change factor on UE reset */
- ue->mimoInfo.txModUpChgFactor = 0;
- ue->mimoInfo.txModDownChgFactor = 0;
-#endif
-
- errInfo->errCause = RGSCHERR_NONE;
- return ROK;
-} /* rgSCHCfgRgrUeReset */
-
-/**
- * @brief Handler for the cell delete request from RRM to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgRgrCellDel
- *
- * Processing Steps:
- * - Fetch the cell control block.
- * - Remove the cell control block from the hash list of cells.
- * - Free the cell control block.
- * - If successful, return ROK else return RFAILED.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgrDel *cellDelInfo
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgRgrCellDel
-(
-RgSchCellCb *cell,
-RgrDel *cellDelInfo,
-RgSchErrInfo *errInfo
-)
-{
-
- errInfo->errCause = RGSCHERR_CFG_RGR_CELL_DEL;
-
- if (cell->cellId != cellDelInfo->u.cellDel.cellId)
- {
- DU_LOG("\nERROR --> SCH : Cell does not exist");
- return RFAILED;
- }
-
- /* Free the active cell */
- rgSCHCfgFreeCellCb(cell);
-
- errInfo->errCause = RGSCHERR_NONE;
- return ROK;
-} /* rgSCHCfgRgrCellDel */
-
-
-/**
- * @brief Handler for the UE delete request from RRM to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgRgrUeDel
- *
- * Processing Steps:
- * - Fetch the UE control block.
- * - Remove the UE control block from the hash list of UEs for the cell.
- * - Free the UE control block.
- * - If successful, return ROK else return RFAILED.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgrDel *ueDelInfo
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgRgrUeDel
-(
-RgSchCellCb *cell,
-RgrDel *ueDelInfo,
-RgSchErrInfo *errInfo
-)
-{
- RgSchUeCb *ue;
- RgSchRaCb *raCb;
-#ifdef LTE_ADV
- Inst inst = cell->instIdx;
- RgSchCellCb *secCellCb = NULLP;
-#endif
-
- errInfo->errCause = RGSCHERR_CFG_RGR_UE_DEL;
-
- if (cell->cellId != ueDelInfo->u.ueDel.cellId)
- {
- DU_LOG("\nERROR --> SCH : Cell does not exist CRNTI:%d",
- ueDelInfo->u.ueDel.crnti);
- return RFAILED;
- }
- if ((ue = rgSCHDbmGetUeCb(cell, ueDelInfo->u.ueDel.crnti)) == NULLP)
- {
- if((raCb = rgSCHDbmGetRaCb(cell, ueDelInfo->u.ueDel.crnti)) == NULLP)
- {
- DU_LOG("\nERROR --> SCH : RaCb does not exist for CRNTI:%d",ueDelInfo->u.ueDel.crnti);
- return RFAILED;
- }
- else
- {
- /* This happens in case of Msg4 rejection */
- raCb->toDel = TRUE;
- return ROK;
- }
- }
- else
- {
-#ifdef LTE_ADV
- if(ueDelInfo->u.ueScellRel.ueDelTypes & RGR_UE_SCELL_DEL_RECFG)
- {
- for(uint8_t idx = 0; idx < ueDelInfo->u.ueScellRel.ueSCellRelCfgInfo.numSCells; idx++)
- {
- if(NULLP != (secCellCb = (RgSchCellCb *)rgSchUtlGetCellCb(inst, \
- ueDelInfo->u.ueScellRel.ueSCellRelCfgInfo.ueSCellRelDedCfg[idx].sCellId)))
- {
- rgSCHUtlSndUeSCellDel2Mac(secCellCb, ue->ueId);
- rgSCHSCellDelUeSCell(cell,ue,ueDelInfo->u.ueScellRel.ueSCellRelCfgInfo.ueSCellRelDedCfg[idx].sCellIdx);
- ue->numSCells--;
- if ( ue->numSCells == 0)
- {
- ue->allocCmnUlPdcch = TRUE;
- }
- }
- }
- if (ue->numSCells == 0)
- {
- /* As there is no SCell left so DCI 0 size at UE specific search space
- * will be recalculated as the CSI is reduced to 1 bit */
- rgSCHUtlUpdUeDciSize(cell, ue, FALSE);
- }
- }
- else
-#endif
- {
- /* Delete Ue from the UE list of CELL*/
- rgSCHDbmDelUeCb(cell, ue);
-
-#ifdef LTE_L2_MEAS
- rgSCHDbmDelL2MUe(cell, ue);
-#endif
-
- /* Call MeasGap and AckNakRep processing module */
- rgSCHMeasGapANRepUeDel(cell, ue, TRUE);
-
- /* ccpu00140894- Stop TXMode transiition timer if it is running*/
- if (ue->txModeTransTmr.tmrEvnt != TMR_NONE)
- {
- rgSCHTmrStopTmr(cell, RG_SCH_TMR_TXMODE_TRNSTN, ue);
- }
-
- /* Call DRX module to remove UEs from various
- * lists it maintain
- */
- /* ccpu00129899 */
- if(ue->drxCb != NULLP)
- {
- (Void)rgSCHDrxUeDel(cell,ue);
- /* Free Ue */
- }
- /*Fix: If RA CB exists, delete it*/
- if((raCb = rgSCHDbmGetRaCb(cell, ueDelInfo->u.ueDel.crnti)) != NULLP)
- {
- /* Fix : syed RNTI was getting released twice, once by racb del
- * and subsequently by ueDel. Let it get released by ueDel alone */
- rgSCHRamDelRaCb(cell, raCb, FALSE);
- }
-#ifdef EMTC_ENABLE
- if(ue->isEmtcUe)
- {
- rgSCHEmtcUeDel(cell, ue);
- }
-#endif
-
- rgSCHCfgFreeUeCb(cell, ue);
-
- errInfo->errCause = RGSCHERR_NONE;
-
- }
- return ROK;
- }
-} /* rgSCHCfgRgrUeDel */
-
-
-/**
- * @brief Handler for the logical channel delete request from
- * RRM to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgRgrLcDel
- *
- * Processing Steps:
- * - Fetch the logical channel control block.
- * - Free the logical channel control block.
- * - If successful, return ROK else return RFAILED.
- *
- * @param[in] RgrDel *lcDelInfo
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgRgrLcDel
-(
-RgSchCellCb *cell,
-RgrDel *lcDelInfo,
-RgSchErrInfo *errInfo
-)
-{
- RgSchUeCb *ue;
- RgSchDlLcCb *dlLc;
-#ifdef LTE_L2_MEAS
- uint8_t lcId;
- uint8_t idx;
- RgSchUlLcCb *ulLc;
-#endif
-
- errInfo->errCause = RGSCHERR_CFG_RGR_LC_DEL;
-
- /* Fetch the Active cell */
- if (cell->cellId != lcDelInfo->u.lchDel.cellId)
- {
- DU_LOG("\nERROR --> SCH : Cell does not exist %d",
- lcDelInfo->u.lchDel.cellId);
- return RFAILED;
- }
-
- /* Fetch the Ue */
- if ((ue = rgSCHDbmGetUeCb(cell, lcDelInfo->u.lchDel.crnti)) == NULLP)
- {
- DU_LOG("\nERROR --> SCH : UE does not exist for CRNTI:%d LCID:%d",
- lcDelInfo->u.lchDel.crnti,lcDelInfo->u.lchDel.lcId);
- return RFAILED;
- }
- if (lcDelInfo->u.lchDel.lcgId > 3)
- {
- DU_LOG("\nERROR --> SCH : [%d]UEID:For LC %d, LCGid %d is invalid",
- lcDelInfo->u.lchDel.crnti,lcDelInfo->u.lchDel.lcId,
- lcDelInfo->u.lchDel.lcgId);
- return RFAILED;
- }
- if ((dlLc = rgSCHDbmGetDlDedLcCb(ue, lcDelInfo->u.lchDel.lcId))
- == NULLP)
- {
- DU_LOG("\nERROR --> SCH : LC does not exist for CRNTI:%d LCID:%d",
- lcDelInfo->u.lchDel.crnti, lcDelInfo->u.lchDel.lcId);
- return RFAILED;
- }
- rgSCHUtlRgrLcDel(cell, ue, lcDelInfo->u.lchDel.lcId,lcDelInfo->u.lchDel.lcgId);
-
- /* Reduce any pending bo from this LC(if any)
- * from the UE's total BO */
- if(dlLc->bo)
- {
- if(ue->totalBo >= dlLc->bo)
- {
- ue->totalBo -= dlLc->bo;
- }
- else
- {
- ue->totalBo = 0; /* this scenario should not occur */
- }
- }
- rgSCHDbmDelDlDedLcCb(ue, dlLc);
- rgSCHCfgFreeDlDedLcCb(cell, ue, dlLc);
-
-#ifdef LTE_L2_MEAS
- lcId = lcDelInfo->u.lchDel.lcId;
- if (TRUE == ue->ul.lcCb[lcId -1].isValid)
- {
- ulLc = &(ue->ul.lcCb[lcId -1]);
- ue->ul.lcCb[lcId -1].isValid = FALSE;
-
- if((ulLc->qciCb->ulUeCount) &&
- (ue->ulActiveLCs & (1 << (ulLc->qciCb->qci -1))))
- {
- ulLc->qciCb->ulUeCount--;
- ue->ulActiveLCs &= ~(1 << (ulLc->qciCb->qci -1));
- }
- /* Shifting LCs in LCG Array because of LC deletion */
- for (idx = ulLc->lcgArrIdx +1; idx < ulLc->lcg->numLch;
- idx++)
- {
- ulLc->lcg->lcArray[idx -1] =
- ulLc->lcg->lcArray[idx];
- ulLc->lcg->lcArray[idx -1]->lcgArrIdx = idx -1;
- }
- ulLc->lcg->numLch--;
- ulLc->lcg->lcArray[idx -1] = NULLP;
- }
-#endif /* LTE_L2_MEAS */
-
-
- errInfo->errCause = RGSCHERR_NONE;
- return ROK;
-} /* rgSCHCfgRgrLcDel */
-
-
-
-/**
- * @brief Handler for the logical channel delete request from
- * RRM to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgRgrLcgDel
- *
- * Processing Steps:
- * - Fetch the logical channel control block.
- * - Free the logical channel control block.
- * - If successful, return ROK else return RFAILED.
- *
- * @param[in] RgrDel *lcDelInfo
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgRgrLcgDel
-(
-RgSchCellCb *cell,
-RgrDel *lcDelInfo,
-RgSchErrInfo *errInfo
-)
-{
- RgSchUeCb *ue = NULLP;
-#ifdef LTE_L2_MEAS
- uint8_t lcCount = 0;
-#endif
- uint8_t lcgId = 0;
-
- lcgId = lcDelInfo->u.lcgDel.lcgId;
-
- errInfo->errCause = RGSCHERR_CFG_RGR_LCG_DEL;
-
- /* Fetch the Active cell */
- if (cell->cellId != lcDelInfo->u.lcgDel.cellId)
- {
- DU_LOG("\nERROR --> SCH : CELL does not exist for CRNTI:%d LCGID:%d",
- lcDelInfo->u.lchDel.crnti,lcDelInfo->u.lchDel.lcId);
- return RFAILED;
- }
-
- /* Fetch the Ue */
- if ((ue = rgSCHDbmGetUeCb(cell, lcDelInfo->u.lcgDel.crnti)) == NULLP)
- {
- DU_LOG("\nERROR --> SCH : UE does not exist for CRNTI:%d LCGID:%d",
- lcDelInfo->u.lchDel.crnti,lcDelInfo->u.lchDel.lcId);
- return RFAILED;
- }
-
- /* set lcgId in UEs lcg cntrl blk to invalid */
- rgSCHUtlRgrLcgDel(cell, ue, lcgId);
- ue->ul.lcgArr[lcgId].lcgId = RGSCH_INVALID_LCG_ID;
-
-#ifdef LTE_L2_MEAS
- /* Since LCs are being deleted, if any of them are contributing
- to Active UE count for a QCI, decrease the count */
- for (lcCount =0; (lcCount < RGSCH_MAX_LC_PER_UE) &&
- (lcCount < ue->ul.lcgArr[lcgId].numLch) ; lcCount++)
- {
- if (ue->ul.lcgArr[lcgId].lcArray[lcCount])
- {
- if((ue->ul.lcgArr[lcgId].
- lcArray[lcCount]->qciCb->ulUeCount) &&
- (ue->ulActiveLCs &
- (1 << ((ue->ul.lcgArr[lcgId].
- lcArray[lcCount])->qciCb->qci -1))))
- {
- /* L2_COUNTERS */
- ue->ul.lcgArr[lcgId].
- lcArray[lcCount]->qciCb->ulUeCount--;
- ue->ulActiveLCs &= ~(1 <<
- (ue->ul.lcgArr[lcgId].
- lcArray[lcCount]->qciCb->qci -1));
- }
- }
- }
-#endif
-
- errInfo->errCause = RGSCHERR_NONE;
- return ROK;
-} /* rgSCHCfgRgrLcgDel */
-
-
-
-/***********************************************************
- *
- * Func : rgSCHCfgVldtRgrLcCfg
- *
- *
- * Desc : Validates dedicated logical channel configuration recieved from RRM.
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-S16 rgSCHCfgVldtRgrLcCfg
-(
-Inst inst,
-RgrLchCfg *lcCfg,
-RgSchCellCb **cell,
-RgSchUeCb **ue,
-RgSchErrInfo *errInfo
-)
-{
-
- errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_DED_LC_CFG;
-
- if (((*cell) == NULLP) ||
- ((*cell)->cellId != lcCfg->cellId))
- {
- DU_LOG("\nERROR --> SCH : Cell does not existi for "
- "CRNTI:%d LCID:%d",lcCfg->crnti, lcCfg->lcId);
- return RFAILED;
- }
-
- /* Fetch the Ue */
- if ((*ue = rgSCHDbmGetUeCb(*cell, lcCfg->crnti)) == NULLP)
- {
- DU_LOG("\nERROR --> SCH : UE does not exist for dedicated"
- " logical channel CRNTI:%d LCID:%d", lcCfg->crnti, lcCfg->lcId);
- return RFAILED;
- }
-
- /* Validate logical channel Id */
- if ((lcCfg->lcId < RGSCH_DEDLC_MIN_LCID)
- ||(lcCfg->lcId > RGSCH_DEDLC_MAX_LCID))
- {
- DU_LOG("\nERROR --> SCH : Invalid logical channel Id:%d"
- "for CRNTI:%d",lcCfg->lcId,lcCfg->crnti);
- return RFAILED;
- }
-
- if (lcCfg->lcType != CM_LTE_LCH_DTCH && lcCfg->lcType != CM_LTE_LCH_DCCH)
- {
- DU_LOG("\nERROR --> SCH : Invalid logical channel Type %d"
- "CRNTI:%d LCID:%d",lcCfg->lcType,lcCfg->crnti, lcCfg->lcId);
- return RFAILED;
- }
-
- return ROK;
-} /* rgSCHCfgVldtRgrLcCfg */
-
-/***********************************************************
- *
- * Func : rgSCHCfgVldtRgrLcgCfg
- *
- *
- * Desc : Validates dedicated logical channel group configuration recieved from RRM.
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-S16 rgSCHCfgVldtRgrLcgCfg
-(
-Inst inst,
-RgrLcgCfg *lcgCfg,
-RgSchCellCb **cell,
-RgSchUeCb **ue,
-RgSchErrInfo *errInfo
-)
-{
-
- errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_DED_LCG_CFG;
-
- if (((*cell) == NULLP) ||
- ((*cell)->cellId != lcgCfg->cellId))
- {
- DU_LOG("\nERROR --> SCH : Cell does not exist for"
- "CRNTI:%d LCGID:%d",lcgCfg->crnti,lcgCfg->ulInfo.lcgId);
- return RFAILED;
- }
-
- /* Fetch the Ue */
- if ((*ue = rgSCHDbmGetUeCb(*cell, lcgCfg->crnti)) == NULLP)
- {
- DU_LOG("\nERROR --> SCH : UE does not exist for "
- "dedicated logical channel CRNTI:%d LCGID:%d", lcgCfg->crnti, lcgCfg->ulInfo.lcgId);
- return RFAILED;
- }
-
- if ((lcgCfg->ulInfo.gbr != 0) && (lcgCfg->ulInfo.mbr < lcgCfg->ulInfo.gbr))
- {
- return RFAILED;
- }
-
- return ROK;
-} /* rgSCHCfgVldtRgrLcgCfg */
-
-
-/***********************************************************
- *
- * Func : rgSCHCfgVldtRgrCellPwrCfg
- *
- * Desc : Validates cell power configuration.
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCfgVldtRgrCellPwrCfg
-(
-Inst inst,
-RgrCellCfg *cellCfg,
-RgSchErrInfo *errInfo
-)
-{
- UNUSED(inst);
- UNUSED(cellCfg);
- UNUSED(errInfo);
-
- /* This function does nothing now, placeholder for
- * subsequent power config validations that may be needed */
-
-
- return ROK;
-} /* rgSCHCfgVldtRgrCellPwrCfg */
-
-
-/***********************************************************
- *
- * Func : rgSCHCfgVldtRgrCmnLcCfg
- *
- *
- * Desc : Validates common logical channel configuration recieved from RRM.
- *
- * @param[in] Inst inst
- * @param[in] RgrCellCfg *cellCfg
- * @param[out] RgSchErrInfo *errInfo
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCfgVldtRgrCmnLcCfg
-(
-Inst inst,
-RgrCellCfg *cellCfg,
-RgSchErrInfo *errInfo
-)
-{
- uint8_t idx;
- RgrCmnLchCfg *lcCfg;
- uint8_t dirVld = FALSE;
- uint8_t bitMask = 0x00;
- uint8_t cnt=0;
-
- errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_CMN_LC_CFG;
-
- for (idx = 0; idx < cellCfg->numCmnLcs; idx++)
- {
- lcCfg = &(cellCfg->cmnLcCfg[idx]);
- /* Validate downlink info */
- if (lcCfg->dir & RGR_DIR_TX)
- {
- if (lcCfg->lcType == CM_LTE_LCH_BCCH)
- {
- if (lcCfg->dlTrchType == CM_LTE_TRCH_DL_SCH)
- {
- if(cnt == 0)
- {
- bitMask |= RGSCH_BCCH_DLSCH_CFG1;
- cnt++;
- }
- else
- {
-
- if((
- (cellCfg->siCfg.siWinSize == 1) ||
- (cellCfg->siCfg.siWinSize == 2) ||
- (cellCfg->siCfg.siWinSize == 5) ||
- (cellCfg->siCfg.siWinSize == 10) ||
- (cellCfg->siCfg.siWinSize == 15) ||
- (cellCfg->siCfg.siWinSize == 20) ||
- (cellCfg->siCfg.siWinSize == 40)) &&
- (cellCfg->siCfg.retxCnt>0)
- )
- {
- bitMask |= RGSCH_BCCH_DLSCH_CFG2;
- }
- else
- {
- DU_LOG("\nERROR --> SCH : Invalid si config for cell");
- return RFAILED;
- }
- }
- }
- else if (lcCfg->dlTrchType == CM_LTE_TRCH_BCH)
- {
- bitMask |= RGSCH_BCCH_BCH_CFG;
- }
- else
- {
- DU_LOG("\nERROR --> SCH : Invalid transport channel %d for cell", lcCfg->dlTrchType);
- return RFAILED;
- }
- }
- else if (lcCfg->lcType == CM_LTE_LCH_PCCH)
- {
- bitMask |= RGSCH_PCCH_CFG;
- }
- else if (lcCfg->lcType == CM_LTE_LCH_CCCH)
- {
- bitMask |= RGSCH_DL_CCCH_CFG;
- }
- dirVld = TRUE;
- }
-
- /* Validate uplink info */
- if (lcCfg->dir & RGR_DIR_RX)
- {
- /* Uplink CCCH */
- if (lcCfg->lcType != CM_LTE_LCH_CCCH)
- {
- DU_LOG("\nERROR --> SCH : Invalid UL common lcType %d for cell", lcCfg->lcType);
- return RFAILED;
- }
- else
- {
- bitMask |= RGSCH_UL_CCCH_CFG;
- }
- dirVld = TRUE;
- }
-
- /* Invalid direction */
- if (!dirVld)
- {
- DU_LOG("\nERROR --> SCH : Invalid Direction %d", lcCfg->dir);
- return RFAILED;
- }
- }
- if (bitMask != RGSCH_CELL_ACTIVE_CFG)
- {
- DU_LOG("\nERROR --> SCH : Invalid Common channel config for cell");
- return RFAILED;
- }
-
- return ROK;
-} /* rgSCHCfgVldtRgrCmnLcCfg */
-
-
-/***********************************************************
- *
- * Func : rgSCHCfgVldtUeCqiModeCfg
- *
- *
- * Desc : Validates UE CQI modes Configuration recieved from RRC.
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCfgVldtUeCqiModeCfg
-(
-RgSchCellCb *cell,
-RgrUeDlCqiCfg *ueDlCqiCfg
-)
-{
-
-#ifndef TFU_UPGRADE
- if((ueDlCqiCfg->prdCqiCfg.cqiPmiCfgIdx < 1) ||
- (ueDlCqiCfg->prdCqiCfg.cqiPmiCfgIdx > 1024))
- {
- DU_LOG("\nERROR --> SCH : Invalid Periodic CQI Info");
- return RFAILED;
- }
-#endif
- /* Validate UE Aperiodic CQI mode */
- if ((ueDlCqiCfg->aprdCqiCfg.pres == TRUE) &&
- ((ueDlCqiCfg->aprdCqiCfg.aprdModeEnum > RGR_APRD_CQI_MOD31) ||
- (cell->bwCfg.dlTotalBw <= 7)))
- {
- DU_LOG("\nERROR --> SCH : Invalid Aperiodic mode config for DL CQI");
- return RFAILED;
- }
-#ifndef TFU_UPGRADE
- /* Validate UE Periodic CQI mode */
- if (ueDlCqiCfg->prdCqiCfg.prdModeEnum > RGR_PRD_CQI_MOD21)
- {
- DU_LOG("\nERROR --> SCH : Invalid periodic mode config for DL CQI");
- return RFAILED;
- }
- /* Validate K value in periodic CQI Config */
- if(((ueDlCqiCfg->prdCqiCfg.prdModeEnum == RGR_PRD_CQI_MOD20) ||
- (ueDlCqiCfg->prdCqiCfg.prdModeEnum == RGR_PRD_CQI_MOD21)) &&
- ((ueDlCqiCfg->prdCqiCfg.k < 1)||
- (ueDlCqiCfg->prdCqiCfg.k > 4)))
- {
- DU_LOG("\nERROR --> SCH : Invalid K for Subband CQI reporting");
- return RFAILED;
- }
-#else
- if ((ueDlCqiCfg->prdCqiCfg.type == 1) &&
- (ueDlCqiCfg->prdCqiCfg.cqiSetup.prdModeEnum > RGR_PRD_CQI_MOD21))
- {
- DU_LOG("\nERROR --> SCH : Invalid periodic mode config for DL CQI");
- return RFAILED;
- }
-
-#endif
-
- return ROK;
-
-}
-/***********************************************************
- *
- * Func : rgSCHCfgVldtUeMeasGapAckNakRepCfg
- *
- *
- * Desc : Validates UE Measurement Gap and Ack Nack Repetition Configuration recieved from RRC.
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCfgVldtUeMeasGapAckNakRepCfg
-(
-RgSchCellCb *cell,
-RgrUeCfg *ueCfg
-)
-{
-
-#ifdef LTE_TDD
- if ((ueCfg->ackNackModeEnum == RGR_TDD_ACKNACK_MODE_MULT) &&
- (ueCfg->ueAckNackCfg.isAckNackEnabled == TRUE))
- {
- DU_LOG("\nERROR --> SCH : TDD ACK NACK Multiplexing Mode"
- "is not allowed when Ack/Nack is Enabled: %d CRNTI:%d",
- ueCfg->ueAckNackCfg.ackNackRepFactor,ueCfg->crnti);
- return RFAILED;
- }
-#endif /* LTE_TDD */
- /* Validate AckNackRep Factor */
- if((ueCfg->ueAckNackCfg.isAckNackEnabled == FALSE) &&
- (!ueCfg->ueMesGapCfg.isMesGapEnabled))
- {
- return ROK;
- }
-
- if(ueCfg->ueAckNackCfg.isAckNackEnabled)
- {
- if ( (ueCfg->ueAckNackCfg.ackNackRepFactor < RGR_ACKNACK_REPFACT_N2)
- || (ueCfg->ueAckNackCfg.ackNackRepFactor > RGR_ACKNACK_REPFACT_N6))
- {
- DU_LOG("\nERROR --> SCH : Invalid ACK NACK REP Factor:%d CRNTI:%d",
- ueCfg->ueAckNackCfg.ackNackRepFactor,ueCfg->crnti);
- return RFAILED;
- }
- }
- if(ueCfg->ueMesGapCfg.isMesGapEnabled)
- {
- switch(ueCfg->ueMesGapCfg.gapPrd)
- {
- case RG_MEAS_GAPPRD_40:
- if(ueCfg->ueMesGapCfg.gapOffst >= RG_MEAS_GAPPRD_40)
- {
- DU_LOG("\nERROR --> SCH : Invalid GAP Offset:%d CRNTI:%d",
- ueCfg->ueMesGapCfg.gapOffst,ueCfg->crnti);
- return RFAILED;
- }
- break;
- case RG_MEAS_GAPPRD_80:
- if(ueCfg->ueMesGapCfg.gapOffst >= RG_MEAS_GAPPRD_80)
- {
- DU_LOG("\nERROR --> SCH : Invalid GAP Offset:%d CRNTI:%d",
- ueCfg->ueMesGapCfg.gapOffst,ueCfg->crnti);
- return RFAILED;
- }
- break;
- default:
- {
- DU_LOG("\nERROR --> SCH : Invalid GAP Periodicity Settings:%d"
- "CRNTI:%d", ueCfg->ueMesGapCfg.gapPrd,ueCfg->crnti);
- return RFAILED;
- }
- }
- }
-
- return ROK;
-} /* rgSCHCfgVldtUeMeasGapAckNakRepCfg*/
-
-
-/***********************************************************
- *
- * Func : rgSCHCfgVldtUeMeasGapAckNakRepRecfg
- *
- *
- * Desc : Validates UE Measurement Gap and Ack Nack Repetition Configuration recieved from RRC.
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCfgVldtUeMeasGapAckNakRepRecfg
-(
-RgSchCellCb *cell,
-RgrUeRecfg *ueRecfg
-)
-{
-
- if((ueRecfg->ueAckNackRecfg.isAckNackEnabled == FALSE) &&
- (!ueRecfg->ueMeasGapRecfg.isMesGapEnabled))
- {
- return ROK;
- }
-
- if(ueRecfg->ueAckNackRecfg.isAckNackEnabled )
- {
- /* Validate AckNackRep Factor */
- if ( (ueRecfg->ueAckNackRecfg.ackNackRepFactor < RGR_ACKNACK_REPFACT_N2)
- || (ueRecfg->ueAckNackRecfg.ackNackRepFactor > RGR_ACKNACK_REPFACT_N6))
- {
- DU_LOG("\nERROR --> SCH : Invalid ACK NACK REP Factor:%d"
- "NEW CRNTI:%d",ueRecfg->ueAckNackRecfg.ackNackRepFactor,ueRecfg->newCrnti);
- return RFAILED;
- }
- }
- if(ueRecfg->ueMeasGapRecfg.isMesGapEnabled)
- {
- switch(ueRecfg->ueMeasGapRecfg.gapPrd)
- {
- case RG_MEAS_GAPPRD_40:
- if(ueRecfg->ueMeasGapRecfg.gapOffst >= RG_MEAS_GAPPRD_40)
- {
- DU_LOG("\nERROR --> SCH : Invalid GAP Offset:%d"
- "NEW CRNTI:%d",ueRecfg->ueMeasGapRecfg.gapOffst,ueRecfg->newCrnti);
- return RFAILED;
- }
- break;
- case RG_MEAS_GAPPRD_80:
- if(ueRecfg->ueMeasGapRecfg.gapOffst >= RG_MEAS_GAPPRD_80)
- {
- DU_LOG("\nERROR --> SCH : Invalid GAP Offset:%d"
- "NEW CRNTI:%d",ueRecfg->ueMeasGapRecfg.gapOffst,ueRecfg->newCrnti);
- return RFAILED;
- }
- break;
- default:
- {
- DU_LOG("\nERROR --> SCH : Invalid GAP Periodicity Settings:%d"
- "NEW CRNTI:%d",ueRecfg->ueMeasGapRecfg.gapPrd,ueRecfg->newCrnti);
- return RFAILED;
- }
- }
- }
-
- return ROK;
-} /* rgSCHCfgVldtUeMeasGapAckNakRepRecfg*/
-
-#ifdef LTEMAC_SPS
-/***********************************************************
- *
- * Func : rgSCHCfgVldtUeDlSpsCfg
- *
- *
- * Desc : Validates UE's DL SPS configuration recieved from RRC.
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCfgVldtUeDlSpsCfg
-(
-RgSchCellCb *cell,
-RgrUeSpsDlCfg *dlSpsCfg
-)
-{
-
- uint8_t idx = 0;
-
- /* peridicity validation done in SPS module */
- if ((dlSpsCfg->numPucchVal > RG_SCH_MAX_NUM_N1PUCCH_PER_UE) ||
- (dlSpsCfg->numPucchVal == 0))
- {
- DU_LOG("\nERROR --> SCH : Invalid number of n1Pucch values"
- " in DL SPS Config");
- return RFAILED;
- }
-
- for (idx = 0; idx < dlSpsCfg->numPucchVal; ++idx)
- {
- if (dlSpsCfg->n1PucchVal[idx] > RG_SCH_MAX_N1PUCCH_VAL)
- {
-#ifdef ALIGN_64BIT
- DU_LOG("\nERROR --> SCH : Invalid N1Pucch value"
- " in DL SPS Config %u", dlSpsCfg->n1PucchVal[idx]);
-#else
- DU_LOG("\nERROR --> SCH : Invalid N1Pucch value"
- " in DL SPS Config %lu", dlSpsCfg->n1PucchVal[idx]);
-#endif
- return RFAILED;
- }
- }
- /* SPS_TODO: check will change for TDD */
- if ((dlSpsCfg->numSpsHqProc == 0) ||
- (dlSpsCfg->numSpsHqProc > RGSCH_MAX_DL_HQ_PROC))
- {
- DU_LOG("\nERROR --> SCH : Invalid number of SPS HARQ procs"
- " in DL SPS Config");
- return RFAILED;
- }
-
- return ROK;
-} /* rgSCHCfgVldtDlSpsCfg */
-#endif /* LTEMAC_SPS */
-
-/***********************************************************
- *
- * Func : rgSCHCfgVldtUePwrCfg
- *
- *
- * Desc : Validates UE Group power configuration recieved from RRC.
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCfgVldtUePwrCfg
-(
-RgSchCellCb *cell,
-RgrUeUlPwrCfg *pwrCfg
-)
-{
-
- /* Group power control works only in accumulated mode */
- if (!pwrCfg->isAccumulated)
- {
- /* Fix */
- if (pwrCfg->uePuschPwr.pres)
- {
- DU_LOG("\nERROR --> SCH : Accumulation configutation"
- " not in sync with group power configuration");
- return RFAILED;
- }
- }
-
- if (rgSCHCfgVldtUeGrpPwrCfg(cell, &pwrCfg->uePuschPwr) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Invalid PUSCH Group power"
- " configuration");
- return RFAILED;
- }
- if (rgSCHCfgVldtUeGrpPwrCfg(cell, &pwrCfg->uePucchPwr) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Invalid PUSCH Group power"
- " configuration");
- return RFAILED;
- }
-
- return ROK;
-} /* rgSCHCfgVldtUePwrCfg */
-
-/***********************************************************
- *
- * Func : rgSCHCfgVldtUeGrpPwrCfg
- *
- *
- * Desc : Validates UE Group power configuration recieved from RRC.
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCfgVldtUeGrpPwrCfg
-(
-RgSchCellCb *cell,
-RgrUeGrpPwrCfg *grpPwrCfg
-)
-{
-
- if ((grpPwrCfg->pres) &&
- (((grpPwrCfg->tpcRnti > cell->rntiDb.rntiStart) &&
- ((grpPwrCfg->tpcRnti <
- (cell->rntiDb.rntiStart + cell->rntiDb.maxRntis))))))
- {
- DU_LOG("\nERROR --> SCH : Invalid Uplink Group power "
- "configuration");
- return RFAILED;
- }
-
- return ROK;
-} /* rgSCHCfgVldtUeGrpPwrCfg */
-
-#ifdef LTEMAC_SPS
-/***********************************************************
- *
- * Func : rgSCHCfgVldtSpsReCfg
- *
- *
- * Desc : Validates UE SPS and other SPS dependent
- * configuration recieved from RRC.
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCfgVldtSpsReCfg
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeRecfg *ueRecfg
-)
-{
-
- if ((ueRecfg->ueRecfgTypes & RGR_UE_DLSPS_RECFG) &&
- (ueRecfg->ueSpsRecfg.dlSpsCfg.isDlSpsEnabled))
- {
- /* Validating SPS RNTI */
- if (((ueRecfg->ueSpsRecfg.spsRnti >= cell->rntiDb.rntiStart) &&
- (ueRecfg->ueSpsRecfg.spsRnti<=
- (cell->rntiDb.rntiStart+cell->rntiDb.maxRntis)))||
- (ueRecfg->ueSpsRecfg.spsRnti == RGSCH_SI_RNTI) ||
- (ueRecfg->ueSpsRecfg.spsRnti == RGSCH_P_RNTI))
- {
- DU_LOG("\nERROR --> SCH : Invalid SPS RNTI "
- " in DL SPS Recfg OLD CRNTI:%d NEW CCRNTI:%d",
- ueRecfg->oldCrnti,ueRecfg->newCrnti);
- return RFAILED;
- }
- if (rgSCHCfgVldtUeDlSpsCfg(cell, &ueRecfg->ueSpsRecfg.dlSpsCfg) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Invalid DL SPS configuration"
- " for the OLD CRNTI:%d NEW CRNTI:%d",
- ueRecfg->oldCrnti,ueRecfg->newCrnti);
- return RFAILED;
- }
- }
-
-#if RG_SPS_UNUSED
- if(ueRecfg->ueSpsRecfg.dlSpsCfg.isDlSpsEnabled)
- {
- if (ueRecfg->ueRecfgTypes & RGR_UE_DRX_RECFG)
- {
- /* ccpu00117035 - MOD - changed instIdx to inst */
- /* ccpu00117035 - MOD - changed ueID to oldCrnti*/
- DU_LOG("\nERROR --> SCH : DRX reconfig not supported DL SPS enabled for OLD CRNTI:%d NEW CRNTI:%d",
- ueRecfg->oldCrnti,ueRecfg->newCrnti);
- return RFAILED;
- }
- }
-#endif
-/* ccpu00117627 - ADD - SPS recfg validation against HDFDD */
-#ifdef LTEMAC_HDFDD
- if(ueRecfg->ueSpsRecfg.dlSpsCfg.isDlSpsEnabled)
- {
- if(ue->hdFddEnbld == TRUE)
- {
- DU_LOG("\nERROR --> SCH : DL SPS is not supported for HDFDD enabled for OLD CRNTI:%d NEW CRNTI:%d",
- ueRecfg->oldCrnti,ueRecfg->newCrnti);
- return RFAILED;
- }
- }
- if(ueRecfg->ueSpsRecfg.ulSpsCfg.isUlSpsEnabled)
- {
- if(ue->hdFddEnbld == TRUE)
- {
- DU_LOG("\nERROR --> SCH : UL SPS is not supported for HDFDD enabled for OLD CRNTI:%d NEW CRNTI:%d",
- ueRecfg->oldCrnti,ueRecfg->newCrnti);
- return RFAILED;
- }
- }
-#endif
-
- return ROK;
-} /*rgSCHCfgVldtSpsReCfg*/
-#endif
-
-#if ((defined (RGR_CQI_REPT)) && (defined (RGR_V2)))
-/***********************************************************
- *
- * Func : rgSCHCfgVldtCqiReptReCfg
- *
- *
- * Desc : Validates UE CQI report for DL Power control
- * configuration recieved from RRC.
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCfgVldtCqiReptReCfg
-(
-RgSchCellCb *cell,
-RgrUeRecfg *ueRecfg
-)
-{
-
- /* Validate DL Power Control Config parameters */
- if (ueRecfg->ueCqiReptCfg.numColltdCqiRept > RGR_CQIRPTS_MAXN)
- {
- DU_LOG("\nERROR --> SCH : Invalide numColltdCqiRept,"
- "MAX supported %d for OLD CRNTI:%d NEW CRNTI:%d",RGR_CQIRPTS_MAXN,
- ueRecfg->oldCrnti,ueRecfg->newCrnti);
- return RFAILED;
- }
-
- return ROK;
-} /*rgSCHCfgVldtCqiReptReCfg*/
-#endif
-
-/***********************************************************
- *
- * Func : rgSCHCfgRgrLcChfg
- *
- *
- * Desc : Handles dedicated logical channel configuration
- * recieved from RRC.
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-S16 rgSCHCfgRgrLchCfg
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrLchCfg *lcCfg,
-RgSchErrInfo *errInfo
-)
-{
- S16 ret;
- RgSchDlLcCb *dlLc = NULLP;
- Inst inst = cell->instIdx;
-#ifdef LTE_L2_MEAS
- RgSchUlLcCb *ulLc;
-#endif
-
- errInfo->errCause = RGSCHERR_CFG_RGR_DED_LC_CFG;
-
- /* Allocate the downlink logical channel control block */
- if((ret = rgSCHUtlAllocSBuf(inst, (Data**)&dlLc,
- sizeof(RgSchDlLcCb))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED for "
- "Downlink LCId:%d CRNTI:%d", lcCfg->lcId,lcCfg->crnti);
- return RFAILED;
- }
- if ((uint8_t *)dlLc == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED for "
- "Downlink LCID:%d CRNTI:%d", lcCfg->lcId,lcCfg->crnti);
- return RFAILED;
- }
- dlLc->lcId = lcCfg->lcId;
-#ifdef LTE_ADV
- rgSCHLaaLcCfg(cell, dlLc, lcCfg);
-#endif
-
- rgSCHDbmInsDlDedLcCb(ue, dlLc);
-
- ret = rgSCHUtlRgrLcCfg(cell, ue, dlLc, lcCfg, errInfo);
-
- if (ret != ROK)
- {
- /* ROLLBACK */
- if (dlLc)
- {
- rgSCHDbmDelDlDedLcCb(ue, dlLc);
- rgSCHCfgFreeDlDedLcCb(cell, ue, dlLc);
- }
-
- DU_LOG("\nERROR --> SCH : Dedicated logical channel "
- "configuration failed at SCH:UEID:%d LCID:%d CRNTI:%d",
- ue->ueId, lcCfg->lcId,lcCfg->crnti);
- return RFAILED;
- }
-#ifdef LTE_L2_MEAS
- RGSCH_ARRAY_BOUND_CHECK(inst, ue->ul.lcCb, (lcCfg->lcId -1));
- if ( !lcCfg->lcId ||
- (TRUE == ue->ul.lcCb[lcCfg->lcId -1].isValid))
- {
- /* ROLLBACK */
- if (dlLc)
- {
- rgSCHDbmDelDlDedLcCb(ue, dlLc);
- rgSCHCfgFreeDlDedLcCb(cell, ue, dlLc);
- }
-
- DU_LOG("\nERROR --> SCH : Dedicated logical channel "
- "configuration failed at SCH: UL LC CB already existing"
- " UEID:%d LCID:%d CRNTI:%d",
- ue->ueId, lcCfg->lcId,lcCfg->crnti);
- return RFAILED;
- }
-
- /* Create UL LC context to maintain LCG to LC mapping and
- LC and QCI mapping, this is for L2 Counters :UL ACTIVE UE
- PER QCI */
- ue->ul.lcCb[lcCfg->lcId -1].isValid = TRUE;
- ulLc = &(ue->ul.lcCb[lcCfg->lcId -1]);
-
- ulLc->lcId = lcCfg->lcId;
- ulLc->qciCb = &(cell->qciArray[lcCfg->dlInfo.dlQos.qci]);
- ulLc->qciCb->qci = lcCfg->dlInfo.dlQos.qci;
- ue->ul.lcgArr[lcCfg->lcgId].lcArray[ue->ul.lcgArr[lcCfg->lcgId].numLch] = ulLc;
- ulLc->lcg = &ue->ul.lcgArr[lcCfg->lcgId];
- ulLc->lcgArrIdx = ue->ul.lcgArr[lcCfg->lcgId].numLch;
- ue->ul.lcgArr[lcCfg->lcgId].numLch++;
-
- dlLc->qciCb = &(cell->qciArray[lcCfg->dlInfo.dlQos.qci]);
- dlLc->qciCb->qci = lcCfg->dlInfo.dlQos.qci;
- if(lcCfg->lcType == CM_LTE_LCH_DTCH)
- {
- rgSchAddToL2Meas(cell,dlLc); /*LTE_L2_MEAS_PHASE2*/
- }
-#endif /* LTE_L2_MEAS */
-
- return ROK;
-} /* rgSCHCfgRgrLchCfg */
-
-/***********************************************************
- *
- * Func : rgSCHCfgRgrLcgCfg
- *
- *
- * Desc : Handles dedicated logical channel group configuration
- * recieved from RRM.
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-S16 rgSCHCfgRgrLcgCfg
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrLcgCfg *lcgCfg,
-RgSchErrInfo *errInfo
-)
-{
- S16 ret = ROK;
-
-#ifdef RG_UNUSED
-//#ifdef LTE_L2_MEAS
- uint32_t idx;
- RgSchUlLcCb *ulLc;
-#endif
-
- errInfo->errCause = RGSCHERR_CFG_RGR_DED_LCG_CFG;
-
- ue->ul.lcgArr[lcgCfg->ulInfo.lcgId].lcgId = lcgCfg->ulInfo.lcgId;
-
- ret = rgSCHUtlRgrLcgCfg(cell, ue, lcgCfg, errInfo);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Dedicated logical channel "
- "configuration failed at SCH: UEID:%d LCGID:%d CRNTI:%d",
- ue->ueId, lcgCfg->ulInfo.lcgId,lcgCfg->crnti);
- /* Roll back lcgCfg */
- ue->ul.lcgArr[lcgCfg->ulInfo.lcgId].lcgId = RGSCH_INVALID_LCG_ID;
- rgSCHUtlRgrLcgDel(cell, ue, lcgCfg->ulInfo.lcgId);
- return RFAILED;
- }
-#ifdef RG_UNUSED
-//#ifdef LTE_L2_MEAS
- /* Copy all info of UL LCH in cfg to ulLcgCb */
- for (idx = 0; idx < lcgCfg->ulInfo.numLch; idx++)
- {
- /* Allocate the uplink logical channel control block */
- if((ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data**)&ulLc,
- sizeof(RgSchUlLcCb))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED ");
- return RFAILED;
- }
- if ((uint8_t *)ulLc == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED ");
- return RFAILED;
- }
- /* Create UL LC context to maintain LCG to LC mapping and
- LC and QCI mapping, this is for L2 Counters :UL ACTIVE UE
- PER QCI */
- ulLc->lcId = lcgCfg->ulInfo.lchUlCfg[idx].lcId;
- ulLc->qciCb = &(cell->qciArray[lcgCfg->ulInfo.lchUlCfg[idx].qci]);
- ulLc->qciCb->qci = lcgCfg->ulInfo.lchUlCfg[idx].qci;
- ue->ul.lcgArr[lcgCfg->ulInfo.lcgId].lcArray[idx] = ulLc;
- /* L2_COUNTERS */
- ue->ul.lcCb[ulLc->lcId -1] = ulLc;
- ulLc->lcg = &ue->ul.lcgArr[lcgCfg->ulInfo.lcgId];
- ulLc->lcgArrIdx = idx;
- }
- ue->ul.lcgArr[lcgCfg->ulInfo.lcgId].numLch = lcgCfg->ulInfo.numLch;
-#endif /* LTE_L2_MEAS */
-
- return ROK;
-} /* rgSCHCfgRgrLcgCfg */
-
-
-
-/***********************************************************
- *
- * Func : rgSCHCfgRgrCmnLcCfg
- *
- *
- * Desc : Handles dedicated logical channel configuration
- * recieved from RRC.
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCfgRgrCmnLcCfg
-(
-RgSchCellCb *cell,
-RgrCmnLchCfg *lcCfg,
-RgSchErrInfo *errInfo
-)
-{
- RgSchClcDlLcCb cmnLcCb;
-
- errInfo->errCause = RGSCHERR_CFG_RGR_CMN_LC_CFG;
-
- memset(&cmnLcCb, 0, sizeof(cmnLcCb));
-
- /* Handle configuration for CCCH/BCCH/PCCH */
- if (lcCfg->lcType == CM_LTE_LCH_CCCH)
- {
- /* UL and DL CCCH configuration */
- if (lcCfg->dir & RGR_DIR_TX)
- {
- cell->dlCcchId = lcCfg->lcId;
- }
-
- if (lcCfg->dir & RGR_DIR_RX)
- {
- cell->ulCcchId = lcCfg->lcId;
- }
- }
- else
- {
- cmnLcCb.lcId = lcCfg->lcId;
- rgSCHDbmInitCmnLcBoLst(&cmnLcCb);
- if (lcCfg->lcType == CM_LTE_LCH_BCCH)
- {
- /* BCCH on BCH and DLSCH configuration */
- if (lcCfg->dlTrchType == CM_LTE_TRCH_DL_SCH)
- {
- rgSCHDbmInsBcchOnDlsch(cell, &cmnLcCb);
- }
- else
- {
- rgSCHDbmInsBcchOnBch(cell, &cmnLcCb);
- }
- }
- else /* PCCH configuration */
- {
- rgSCHDbmInsPcch(cell, &cmnLcCb);
- }
- }
-
- return ROK;
-} /* rgSCHCfgRgrCmnLcCfg */
-
-
-
-/***********************************************************
- *
- * Func : rgSCHCfgFreeDlDedLcCb
- *
- *
- * Desc :
- * - Processing Steps:
- * - Frees downlink dedicated logical channel control block.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHCfgFreeDlDedLcCb
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *dlLc
-)
-{
- Inst inst = cell->instIdx;
-
- rgSCHUtlFreeDlLc(cell, ue, dlLc);
-
- /* De-allocate the Cb */
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(inst, (Data **)&dlLc, sizeof(*dlLc));
-
-
- /* Stack Crash problem for TRACE5 changes. Added the return below */
- return;
-
-} /* rgSCHCfgFreeDlDedLcCb */
-
-
-/***********************************************************
- *
- * Func : rgSCHCfgFreeDlCmnLcCb
- *
- *
- * Desc :
- * - Processing Steps:
- * - Frees downlink common logical channel control block.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHCfgFreeDlCmnLcCb(RgSchClcDlLcCb *cmnDlLc)
-{
-
- memset(cmnDlLc, 0, sizeof(*cmnDlLc));
- cmnDlLc->lcId = RGSCH_INVALID_LC_ID;
- return;
-} /* rgSCHCfgFreeDlCmnLcCb */
-
-
-/***********************************************************
- *
- * Func : rgSCHCfgFreeCellCb
- *
- *
- * Desc :
- * - Processing Steps:
- * - Frees scheduler cell control block.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHCfgFreeCellCb(RgSchCellCb *cell)
-{
- Inst inst = cell->instIdx;
- CmLList *node;
- Buffer *pdu;
- RgSchWarningSiInfo *warningSi;
- RgSchWarningSiPdu *warningSiPdu;
- uint8_t idx;
-
- /* ccpu00132385- SI Warning PDUs which are not processed need to be deleted */
- /* Search for used index in WarningSi */
- for(idx = 0; idx < RGR_MAX_NUM_WARNING_SI; idx++)
- {
- if(cell->siCb.warningSi[idx].siId == 0)
- continue;
- cell->siCb.siCtx.siId = cell->siCb.warningSi[idx].siId;
- warningSi = (RgSchWarningSiInfo *) cell->siCb.
- siArray[cell->siCb.siCtx.siId-1].si;
- if(warningSi != NULLP)
- {
- /* ccpu00136659: CMAS ETWS design change */
- while (CM_LLIST_FIRST_NODE(&warningSi->warningSiMsg.segLstCp, node))
- {
- warningSiPdu = (RgSchWarningSiPdu *)node->node;
- pdu = warningSiPdu->pdu;
- /* ccpu00136659: CMAS ETWS design change */
- cmLListDelFrm(&warningSi->warningSiMsg.segLstCp, node);
- RGSCH_FREE_MSG(pdu);
- }
- cell->siCb.siArray[cell->siCb.siCtx.siId-1].si = NULLP;
- }
- }
- /* Free lists of the cell */
- rgSCHCfgFreeUeLst(cell);
-#ifdef LTEMAC_SPS
- rgSCHCfgFreeSpsUeLst(cell);
-#endif /* LTEMAC_SPS */
-#ifdef EMTC_ENABLE
- if ( TRUE == cell->emtcEnable )
- {
- rgSCHEmtcCellDel(cell);
- }
-#endif
- rgSCHRamFreeCell(cell);
-
- rgSCHDbmRntiDbDeInit(cell);
- /* Deallocate the subframe allocation information */
- rgSCHUtlPutSfAlloc(cell);
- rgSCHUtlFreeCell(cell);
-
- rgSCHCfgFreeRgrCfgLst(cell);
- rgSCHCfgFreeCmnLcLst(cell);
-
- rgSCHUtlPutRlsHqAlloc(cell);
-
-#ifdef LTE_TDD
- rgSCHDbmDeInitUeTfuPendLst(cell);
-#endif /* LTE_TDD */
-
-#ifdef RGR_SI_SCH
- rgSCHUtlPutSiInfo(cell);
-#endif/*RGR_SI_SCH*/
-
- (Void)rgSCHDrxCellDel(cell);
-
- rgSCHUtlFreeSBuf(inst, (Data**)&(cell->dynCfiCb.cceFailSamples),
- (cell->dynCfiCb.numFailSamples * sizeof(uint16_t)));
-
-#ifdef TENB_STATS
- TSL2DeallocCellStatsBlk(cell->cellId);
-#endif
-
-#ifdef LTE_ADV
- /* LAA_SCELL: Trigger the De-Init function for the LAA Module */
- rgSCHLaaSCellCbDeInit(cell);
-#endif
-
-#ifdef EMTC_ENABLE
- if(cell->emtcEnable)
- {
- rgSCHEmtcCellFree(cell);
- }
-#endif
- /* De-allocate the Cell */
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(inst, (Data **)&cell, sizeof(*cell));
-
-
-
- /* Stack Crash problem for TRACE5 changes. Added the return below */
- return;
-
-} /* rgSCHCfgFreeCellCb */
-
-
-/***********************************************************
- *
- * Func : rgSCHCfgFreeUeCb
- *
- *
- * Desc :
- * - Processing Steps:
- * - Frees UE control block.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHCfgFreeUeCb
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue
-)
-{
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell);
- RgUeUlHqCb *ulHqEnt;
- RgSchDlLcCb *dlLc;
- Inst inst = cell->instIdx;
- uint8_t lcCnt;
- uint8_t lcgId;
-
- /* Free all logical channel info per UE */
- while((dlLc = rgSCHDbmGetNextDlDedLcCb(ue, NULLP)) != NULLP)
- {
- rgSCHDbmDelDlDedLcCb(ue, dlLc);
- rgSCHCfgFreeDlDedLcCb(cell, ue, dlLc);
- }
- for (lcCnt =0; lcCnt<RGSCH_MAX_LC_PER_UE; lcCnt++)
- {
- if(ue->ul.lcCb[lcCnt].isValid == TRUE)
- {
- lcgId = ue->ul.lcCb[lcCnt].lcg->lcgId;
- if (lcgId <=3)
- {
- rgSCHUtlRgrLcDel(cell, ue, ue->ul.lcCb[lcCnt].lcId,lcgId);
- ue->ul.lcCb[lcCnt].isValid = FALSE;
- }
- }
- }
-
- ulHqEnt = &(ueUl->hqEnt);
- /* Free Scheduler specific information per UE */
- rgSCHUtlFreeUe(cell, ue);
-
- /* Free Uplink HARQ specific information per UE */
- rgSCHUhmFreeUe(cell, ulHqEnt);
-
- if ( ue->drxCb != NULLP)
- {
- /* free drxCb */
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx,
- (Data**)(&(ue->drxCb)),
- sizeof(RgSchDrxUeCb));
- }
-
- ue->drxCb = (RgSchDrxUeCb *)NULLP;
- /* Free Downlink HARQ specific information per UE */
- rgSCHDhmFreeUe(ue);
- /* Release the RNTI */
- if (ue->rntiLnk)
- {
- rgSCHUtlRlsRnti(cell, ue->rntiLnk, FALSE, 0);
- }
- else
- {
- /* Fix : syed HO UE does not have a valid ue->rntiLnk */
- /* Just indicate to MAC, no need to release at SCH */
- rgSCHUtlIndRntiRls2Mac(cell, ue->ueId, FALSE, 0);
- }
-/* rg009.201. Added changes of TFU_UPGRADE */
-#ifdef TFU_UPGRADE
- rgSCHCfgPCqiSrsSrUeDel(cell,ue);
-#endif
-#ifdef LTEMAC_HDFDD
- rgSCHHdFddUeDel(cell, ue);
-#endif
-#ifdef TENB_STATS
- if (ue->tenbStats)
- {
- TSL2DeallocUeStatsBlk(ue->ueId, ue->tenbStats);
- }
-#endif
-
- /* CA TODO Some handling needed while SCell Delete*/
-#ifdef LTE_ADV
- /* Delete the UE from the PCell secCellActCeLst*/
- rgSCHSCellRmvFrmActLst(cell, ue);
- rgSCHSCellDelUe(cell,ue);
-#endif
-
-#ifdef LTE_ADV
- rgSCHLaaDeInitDlRbAllocCb(cell, &ue->cellInfo[RGSCH_PCELL_INDEX]->dlAllocCb);
-#endif
-
- rgSCHUtlFreeSBuf(inst, (Data **)&ue->cellInfo[0], sizeof(RgSchUeCellInfo));
- /* De-allocate the Ue */
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
-#ifdef EMTC_ENABLE
- if(ue->isEmtcUe)
- {
- rgSCHEmtcUeInfoFree(cell, ue);
- }
-#endif
- rgSCHUtlFreeSBuf(inst, (Data **)&ue, sizeof(*ue));
-
- /* Stack Crash problem for TRACE5 changes. Added the return below */
- return;
-
-} /* rgSCHCfgFreeUeCb */
-
-/***********************************************************
- *
- * Func : rgSCHCfgFreeRgrCfgLst
- *
- *
- * Desc :
- * - Processing Steps:
- * - Frees configuration lists in cell control block.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHCfgFreeRgrCfgLst
-(
-RgSchCellCb *cell
-)
-{
- RgSchCfgElem *rgCfgElem;
- Inst inst = cell->instIdx;
-
- /* Free CURRENT RGR cfg list */
- while ((rgCfgElem = rgSCHDbmGetNextCrntRgrCfgElem(cell, NULLP)) != NULLP)
- {
- rgSCHDbmDelCrntRgrCfgElem(cell, rgCfgElem);
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(inst, (Data **)&rgCfgElem, sizeof(*rgCfgElem));
- }
-
- /* Free PENDING RGR cfg list */
- while ((rgCfgElem = rgSCHDbmGetNextPndngRgrCfgElem(cell, NULLP)) != NULLP)
- {
- rgSCHDbmDelPndngRgrCfgElem(cell, rgCfgElem);
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(inst, (Data **)&rgCfgElem, sizeof(*rgCfgElem));
- }
-
-
- /* Stack Crash problem for TRACE5 changes. Added the return below */
- return;
-
-} /* rgSCHCfgFreeRgrCfgLst */
-
-
-/***********************************************************
- *
- * Func : rgSCHCfgFreeCmnLcLst
- *
- *
- * Desc :
- * - Processing Steps:
- * - Frees common logical channels in cell control block.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHCfgFreeCmnLcLst
-(
-RgSchCellCb *cell
-)
-{
- RgSchClcDlLcCb *dlCmnLc;
-
-
- if ((dlCmnLc = rgSCHDbmGetBcchOnBch(cell)) != NULLP)
- {
- rgSCHCfgFreeDlCmnLcCb(dlCmnLc);
- }
- if ((dlCmnLc = rgSCHDbmGetFirstBcchOnDlsch(cell)) != NULLP)
- {
- rgSCHCfgFreeDlCmnLcCb(dlCmnLc);
- }
- if ((dlCmnLc = rgSCHDbmGetSecondBcchOnDlsch(cell)) != NULLP)
- {
- rgSCHCfgFreeDlCmnLcCb(dlCmnLc);
- }
- if ((dlCmnLc = rgSCHDbmGetPcch(cell)) != NULLP)
- {
- rgSCHCfgFreeDlCmnLcCb(dlCmnLc);
- }
-
-
- /* Stack Crash problem for TRACE5 changes. Added the return below */
- return;
-
-} /* rgSCHCfgFreeCmnLcLst */
-
-
-/***********************************************************
- *
- * Func : rgSCHCfgFreeUeLst
- *
- *
- * Desc :
- * - Processing Steps:
- * - Frees UE list in cell control block.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHCfgFreeUeLst
-(
-RgSchCellCb *cell
-)
-{
- RgSchUeCb *ue;
-#ifdef LTE_ADV
- RgSchUeCellInfo *sCellInfo;
- CmLList *node;
-#endif
-
- /* Free Ues in the list */
- while ((ue = rgSCHDbmGetNextUeCb(cell, NULLP)) != NULLP)
- {
- rgSCHDbmDelUeCb(cell, ue);
-
-#ifdef LTE_ADV
- if(ue->cell != cell)
- {
- continue;
- }
-#endif
-
- /* Call MeasGap and AckNakRep processing module */
- rgSCHMeasGapANRepUeDel(cell, ue, TRUE);
-
- rgSCHCfgFreeUeCb(cell, ue);
- }
-
- /* De-initialize the Ue list */
- rgSCHDbmDeInitUeCbLst(cell);
-
-
-#ifdef LTE_ADV
- node = cell->sCellUeLst.first;
- while(node)
- {
- sCellInfo = (RgSchUeCellInfo *)node->node;
- node = node->next;
- rgSCHSCellDelUeSCell(sCellInfo->ue->cell, sCellInfo->ue, sCellInfo->sCellIdx);
- }
-#endif
-
- /* Stack Crash problem for TRACE5 changes. Added the return below */
- return;
-
-} /* rgSCHCfgFreeUeLst */
-
-#ifdef LTEMAC_SPS
-/***********************************************************
- *
- * Func : rgSCHCfgFreeSpsUeLst
- *
- *
- * Desc :
- * - Processing Steps:
- * - Frees Sps UE list in cell control block.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHCfgFreeSpsUeLst(RgSchCellCb *cell)
-{
- RgSchUeCb *ue;
-
- /* Free Ues in the list */
- while ((ue = rgSCHDbmGetNextSpsUeCb(cell, NULLP)))
- {
- rgSCHDbmDelSpsUeCb(cell, ue);
- }
-
- /* De-initialize the Ue list */
- rgSCHDbmDeInitSpsUeCbLst(cell);
-
-} /* rgSCHCfgFreeSpsUeLst */
-
-#endif /* LTEMAC_SPS */
-
-#ifdef RGR_SI_SCH
-/***********************************************************
- *
- * Func : rgSCHCfgVldtRgrCellSiCfg
- *
- * Desc : Validates SI Configuration for SI
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCfgVldtRgrCellSiCfg
-(
-Inst inst,
-RgrSiCfg *siCfg
-)
-{
- uint8_t idx; /* idx for iteration */
-
- UNUSED(inst);
-
-#ifndef LTE_TDD
- /* Check that retxCnt value should be <= value of siWinSize.
- This validation is only applicable for FDD mode. */
- if(siCfg->retxCnt > siCfg->siWinSize)
- {
- DU_LOG("\nERROR --> SCH : retxCnt is greater than siWinSize, validation failed");
- return RFAILED;
- }
-#endif
-
- /* Validate that a valid value for numSi has been specified */
- if(siCfg->numSi > RGR_MAX_NUM_SI)
- {
- DU_LOG("\nERROR --> SCH : Validation for numSi in SI CFG failed");
- return RFAILED;
- }
-
- /* MinPeriodicity will have the least configured periodicity
- * Hence initializing with Max periodicity */
- siCfg->minPeriodicity = RGR_SI_PERD_512;
-
- /*Validate the value of periodicity specified for SIs */
- for(idx = 0;idx < siCfg->numSi;idx++)
- {
- siCfg->minPeriodicity = RGSCH_MIN(siCfg->minPeriodicity,
- siCfg->siPeriodicity[idx]);
- /* Set the siPeriodicity as a multiple of 80 subframes */
- switch(siCfg->siPeriodicity[idx])
- {
- case RGR_SI_PERD_8:
- case RGR_SI_PERD_16:
- case RGR_SI_PERD_32:
- case RGR_SI_PERD_64:
- case RGR_SI_PERD_128:
- case RGR_SI_PERD_256:
- case RGR_SI_PERD_512:
- continue;
-
- default:
- DU_LOG("\nERROR --> SCH : Validation for SI Periodicity in SI-CFG failed");
- return RFAILED;
- }
- }
-
- return ROK;
-} /* rgSCHCfgVldtRgrCellSiCfg */
-
-/* LTE_ADV_FLAG_REMOVED_START */
-/***********************************************************
- *
- * Func : rgSCHCfgVldtRgrCellLtrAdvCfg
- *
- * Desc : Validates Lte Adv Configuration
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCfgVldtRgrCellLteAdvCfg
-(
-Inst inst,
-RgrLteAdvancedCellConfig *lteAdvCfg,
-uint8_t dlTotalBw
-)
-{
- uint8_t temp[RGR_ABS_PATTERN_LEN];
- uint32_t idx;
- UNUSED(inst);
-
- if((lteAdvCfg->pres & RGR_SFR) && (RGR_ENABLE == lteAdvCfg->sfrCfg.status))
- {
- if(lteAdvCfg->sfrCfg.cellEdgeRbRange.startRb > lteAdvCfg->sfrCfg.cellEdgeRbRange.endRb)
- {
- DU_LOG("\nERROR --> SCH : Invalid configuration of cell edge bandwidth for SFR feature");
- return RFAILED;
- }
-
- if(lteAdvCfg->sfrCfg.cellEdgeRbRange.endRb >= dlTotalBw)
- {
- DU_LOG("\nERROR --> SCH : Invalid configuration of cell edge end RB for SFR feature");
- return RFAILED;
- }
-
-#ifdef TFU_UPGRADE
- if(lteAdvCfg->sfrCfg.pwrThreshold.pLow >= lteAdvCfg->sfrCfg.pwrThreshold.pHigh)
- {
- DU_LOG("\nERROR --> SCH : Invalid configuration of power threshold for SFR feature");
- return RFAILED;
- }
-#endif
- }
-
- if((lteAdvCfg->pres & RGR_ABS) && (RGR_ENABLE == lteAdvCfg->absCfg.status))
- {
- if((RGR_ABS_MUTE != lteAdvCfg->absCfg.absPatternType) &&
- (RGR_ABS_TRANSMIT != lteAdvCfg->absCfg.absPatternType))
- {
- DU_LOG("\nERROR --> SCH : Invalid configuration of ABS pattern type");
- return RFAILED;
- }
-
- memcpy(temp, lteAdvCfg->absCfg.absPattern,RGR_ABS_PATTERN_LEN);
-
- /* Added validation for ABS pattern len */
- for(idx = 0; idx < RGR_ABS_PATTERN_LEN; idx++)
- {
- if((temp[idx] != 1) && (temp[idx] != 0))
- {
- DU_LOG("\nERROR --> SCH : Invalid configuration of ABS pattern type");
- return RFAILED;
- }
- }
- }
-
- return ROK;
-}
-/* LTE_ADV_FLAG_REMOVED_END */
-
-
-/***********************************************************
- *
- * Func : rgSCHCfgVldtRgrCellCsgParamCfg
- *
- * Desc : Validates CSG Parameter Configuration
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCfgVldtRgrCellCsgParamCfg
-(
-Inst inst,
-RgrCellCsgParamCfg *csgParam
-)
-{
-
- DU_LOG("\nDEBUG --> SCH : Validating CSG Parameters \n");
-
- if(csgParam->minDlResNonCsg > 100)
- {
- DU_LOG("\nERROR --> SCH : Invalid Configuration of minimum DL resources "
- "for NON-CSG");
- return RFAILED;
- }
- if(csgParam->minUlResNonCsg > 100)
- {
- DU_LOG("\nERROR --> SCH : Invalid Configuration of minimum UL resources "
- "for NON-CSG");
- return RFAILED;
- }
- return ROK;
-}
-
-/**
- * @brief Validates the SI configuration request from RRM to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgVldtRgrSiCfg
- *
- * Processing Steps:
- * - Validate the range of configured values recieved in
- * configuration request.
- * - If validated successfully,
- * - Return ROK
- * - Else
- * - Return RFAILED.
- * - Else return RFAILED.
- * @param[in] Inst inst
- * @param[in] RgrCellCfg *siCfg
- * @param[out] RgSchCellCb *cell
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgVldtRgrSiCfg
-(
-Inst inst,
-RgrSiCfgReqInfo *siCfg,
-RgSchCellCb *cell,
-RgSchErrInfo *errInfo
-)
-{
- MsgLen msgLen = 0;
- uint8_t numSi;
-
- errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_SI_CFG;
-
- /*Validate the cfgType parameter */
- switch(siCfg->cfgType)
- {
- /*ccpu00140789*/
- case RGR_SI_STOP:
- numSi = (cell->siCb.siBitMask & RGSCH_SI_SICFG_UPD) ?
- cell->siCb.newSiCfg.numSi : cell->siCfg.numSi;
- if((siCfg->siId < RGSCH_SI_SIID_LOWER_LMT) ||
- (siCfg->siId > numSi))
- {
- DU_LOG("\nERROR --> SCH : Invalid SI Id value"
- " specified");
- return RFAILED;
- }
- errInfo->errCause = RGSCHERR_NONE;
- return ROK;
- break;
- case RGR_SI_CFG_TYPE_MIB: /* SI CFG Type MIB */
- case RGR_SI_CFG_TYPE_SIB1: /* SI CFG TYPE SIB1 */
- case RGR_SI_CFG_TYPE_SIB1_PWS: /* SI CFG TYPE SIB1_PWS */
- case RGR_SI_CFG_TYPE_SIB8_CDMA: /* SI CFG TYPE SIB 8 CDMA */
-#ifdef EMTC_ENABLE
- case RGR_SI_CFG_EMTC_TYPE_SIB1_BR:
- case RGR_SI_CFG_EMTC_TYPE_SIB1_BR_PER:
-#endif
- break;
-
- case RGR_SI_CFG_TYPE_SI: /* SI CFG TYPE SI */
- /*Check that value of SI should be less than equal
- to configured numSi parameter value */
- /* Added siId validation for lower limit */
- numSi = (cell->siCb.siBitMask & RGSCH_SI_SICFG_UPD) ?
- cell->siCb.newSiCfg.numSi : cell->siCfg.numSi;
- if((siCfg->siId < RGSCH_SI_SIID_LOWER_LMT) ||
- (siCfg->siId > numSi))
- {
- DU_LOG("\nERROR --> SCH : Invalid SI Id value"
- " specified");
- return RFAILED;
- }
-
- if(siCfg->siId > ((cell->siCfg.minPeriodicity * 10)/cell->siCfg.siWinSize))
- {
- DU_LOG("\nERROR --> SCH : SiId can not be scheduled ");
- return RFAILED;
- }
- break;
-
-#ifdef EMTC_ENABLE
- case RGR_SI_CFG_EMTC_TYPE_SI:
- case RGR_SI_CFG_EMTC_TYPE_SI_PER:
- if(ROK != rgEmtcvalidateSiCfg(siCfg,cell))
- {
- return RFAILED;
- }
- break;
-#endif
- default:
- DU_LOG("\nERROR --> SCH : Invalid cfgType "
- "parameter value");
- return RFAILED;
- }
-
- /*Validate the specified pdu */
- if(NULLP == siCfg->pdu)
- {
- DU_LOG("\nERROR --> SCH : Invalid NULLP pdu "
- "specified");
- return RFAILED;
- }
-
- /*Check if PDU is of 0 length*/
- SFndLenMsg(siCfg->pdu, &msgLen);
- if(0 == msgLen)
- {
- DU_LOG("\nERROR --> SCH : Invalid pdu "
- "specified");
- return RFAILED;
- }
-
- errInfo->errCause = RGSCHERR_NONE;
-
-
- return ROK;
-} /* rgSCHCfgVldtRgrSiCfg */
-#endif /*RGR_SI_SCH*/
-
-/* LTE_ADV_FLAG_REMOVED_START */
-/**
- * @brief Validates the RNTP INF request from RRM to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgVldtRgrLoadInf
- *
- * Processing Steps:
- * - Validate the range of configured values recieved in
- * LOAD INF request.
- * - If validated successfully,
- * - Return ROK
- * - Else
- * - Return RFAILED.
- * - Else return RFAILED.
- * @param[in] Inst inst
- * @param[in] RgrLoadInfReqInfo *loadInfReq
- * @param[out] RgSchCellCb *cell
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCfgVldtRgrLoadInf
-(
-Inst inst,
-RgrLoadInfReqInfo *loadInfReq,
-RgSchCellCb *cell,
-RgSchErrInfo *errInfo
-)
-{
-
- errInfo->errCause = RGSCHERR_CFG_INVALID_RGR_LOAD_INF;
-
- /* Validate if the CC startRb which we have received from DSFR lies in CE sub-band of the receiving eNB */
- if((loadInfReq->rgrCcPHighStartRb >= cell->lteAdvCb.sfrCfg.cellEdgeRbRange.startRb) &&
- (loadInfReq->rgrCcPHighStartRb <= cell->lteAdvCb.sfrCfg.cellEdgeRbRange.endRb))
- {
- DU_LOG("\nERROR --> SCH : Invalid rgrCcPHighStartRb received specified");
- return RFAILED;
- }
-
- /* Validate if the CC endRb which we have received from DSFR lies in CE sub-band of the receiving eNB */
- if((loadInfReq->rgrCcPHighEndRb >= cell->lteAdvCb.sfrCfg.cellEdgeRbRange.startRb) &&
- (loadInfReq->rgrCcPHighEndRb <= cell->lteAdvCb.sfrCfg.cellEdgeRbRange.endRb))
- {
- DU_LOG("\nERROR --> SCH : Invalid rgrCcPHighEndRb received specified");
- return RFAILED;
- }
-
- errInfo->errCause = RGSCHERR_NONE;
-
-
- return ROK;
-} /* rgSCHCfgVldtRgrLoadInf */
-/* LTE_ADV_FLAG_REMOVED_END */
-
-#ifdef TFU_UPGRADE
-
-/********************************************************************
- * UE ACQI, PCQI, RI, SRS and SR Re/Configuration Validation Functions *
- * *
- *********************************************************************/
-
- /*
- * @brief Validates the Tx Mode and PUSCH Mode configuration.
- *
- * @details
- *
- * Function : rgSCHCfgVldtRgrTxmodePuschMode
- *
- * Processing Steps:
- * - Validate whether the configured PUSCH Mode and the
- * Configured Tx Mode are in the right combination
- * - If validated successfully,
- * - Return ROK.
- * - Else
- * - Return RFAILED.
- *
- * @param[in] RgSchCellCb *cellCb
- * @param[in] RgrTxMode txMde
- * @param[in] RgrAprdCqiMode puschMode
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-S16 rgSCHCfgVldtRgrTxmodePuschMode
-(
-RgSchCellCb *cellCb,
-RgrTxMode txMde,
-RgrAprdCqiMode puschMode,
-RgSchErrInfo *errInfo
-)
-{
-
- if (txMde == RGR_UE_TM_1 || txMde == RGR_UE_TM_2 ||
- txMde == RGR_UE_TM_3 || txMde == RGR_UE_TM_7)
- {
- if (puschMode == RGR_APRD_CQI_MOD12 ||
- puschMode == RGR_APRD_CQI_MOD22 ||
- puschMode == RGR_APRD_CQI_MOD31)
- {
- return RFAILED;
- }
- }
-
- if (txMde == RGR_UE_TM_4 || txMde == RGR_UE_TM_6)
- {
- if (puschMode == RGR_APRD_CQI_MOD20 ||
- puschMode == RGR_APRD_CQI_MOD30)
- {
- return RFAILED;
- }
- }
-
- if (txMde == RGR_UE_TM_5 )
- {
- if (puschMode != RGR_APRD_CQI_MOD31)
- {
- return RFAILED;
- }
- }
-#ifdef LTE_ADV
- /* TOODO:: Tm8 and TM9 validation has to
- * be changed as mentioned inthe commented
- * code below*/
- /* TM8 and TM9 supports all modes
- * Mode 1-2, 2-2, 3-1 if pmi/ri reporting enabled
- * 2-0,3-0 of pmi/ri reporitng isdisabled *
- * if pmi/ri is enabled
- * Mode 1-2, 2-2, 3-1 if with pmi/ri and csi-rs ports > 1
- * 2-0,3-0 of pmi/ri reporitng isdisabled and csi-rs ports == 1*/
-
-#endif
- return ROK;
-}/*rgSCHCfgVldtRgrTxmodePuschMode ends*/
-
- /*
- * @brief Validates the UE ACQI configuration request from RRM to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgVldtRgrUeACqiCfg
- *
- * Processing Steps:
- * - Validate the UE configuration request from RRC to MAC at CFG:
- * validate the ACQI Configuration
- * - If validated successfully,
- * - Return ROK.
- * - Else
- * - Return RFAILED.
- *
- * @param[in] RgSchCellCb *cellCb,
- * @param[in] CmLteRnti crnti,
- * @param[in] RgrUeAprdDlCqiCfg *acqiCfg,
- * @param[in] RgrUeTxModeCfg txMode,
- * @param[out] RgSchErrInfo *errInfo
-
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-S16 rgSCHCfgVldtRgrUeACqiCfg
-(
-RgSchCellCb *cellCb,
-CmLteRnti crnti,
-RgrUeAprdDlCqiCfg *acqiCfg,
-RgrUeTxModeCfg txMode,
-RgSchErrInfo *errInfo
-)
-{
- RgrTxMode txMde;
- RgrAprdCqiMode puschMode;
-
- if(acqiCfg->pres)
- {
- if(txMode.pres == TRUE)
- {
- txMde = txMode.txModeEnum;
- puschMode = acqiCfg->aprdModeEnum;
- if ( ROK != rgSCHCfgVldtRgrTxmodePuschMode(cellCb, txMde,
- puschMode, errInfo))
- {
- DU_LOG("\nERROR --> SCH : Invalid Aperiodic CQI configuration CRNTI:%d",crnti);
- return RFAILED;
- }
- }
- }
- return ROK;
-}
-
- /*
- * @brief Validates the Tx Mode and PUCCH Mode configuration.
- *
- * @details
- *
- * Function : rgSCHCfgVldtRgrTxmodePucchMode
- *
- * Processing Steps:
- * - Validate whether the configured PUCCH Mode and the
- * Configured Tx Mode are in the right combination
- * - If validated successfully,
- * - Return ROK.
- * - Else
- * - Return RFAILED.
- *
- * @param[in] RgSchCellCb *cellCb
- * @param[in] RgrTxMode txMde
- * @param[in] RgrPrdCqiMode pucchMode
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-S16 rgSCHCfgVldtRgrTxmodePucchMode
-(
-RgSchCellCb *cellCb,
-RgrTxMode txMde,
-RgrPrdCqiMode pucchMode,
-RgSchErrInfo *errInfo
-)
-{
-
- if (pucchMode == RGR_PRD_CQI_MOD10 || pucchMode == RGR_PRD_CQI_MOD20 )
- {
- if (txMde ==RGR_UE_TM_4 || txMde ==RGR_UE_TM_5 || txMde ==RGR_UE_TM_6)
- {
- return RFAILED;
- }
- }
- else if (pucchMode == RGR_PRD_CQI_MOD11 || pucchMode == RGR_PRD_CQI_MOD21)
- {
- if (txMde ==RGR_UE_TM_1 || txMde ==RGR_UE_TM_2 || txMde ==RGR_UE_TM_3 \
- || txMde ==RGR_UE_TM_7)
- {
- return RFAILED;
- }
- }
- /* TODO:: Tm8 and TM9 validation needs to be added */
- return ROK;
-}
-
-/*
- * @brief Validates the UE Periodic CQI, PMI, RI, re/configuration request from RRM to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgVldtRgrUePCqiCfg
- *
- * Processing Steps:
- * - Validate the UE configuration request from RRC to MAC at CFG:
- * validate the value range for Periodic CQI, PMI, RI values.
- * - If validated successfully,
- * - Return ROK.
- * - Else
- * - Return RFAILED.
- *
- * @param[in] RgSchCellCb *cellCb,
- * @param[in] CmLteRnti crnti,
- * @param[in] RgrUePrdDlCqiCfg *cqiCfg,
- * @param[in] RgrUeTxModeCfg txMode,
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-#ifdef LTEMAC_HDFDD
-S16 rgSCHCfgVldtRgrUePCqiCfg
-(
-RgSchCellCb *cellCb,
-CmLteRnti crnti,
-RgrUePrdDlCqiCfg *cqiCfg,
-Bool hdFdd,
-RgrUeTxModeCfg txMode,
-RgSchErrInfo *errInfo
-)
-#else
-S16 rgSCHCfgVldtRgrUePCqiCfg
-(
-RgSchCellCb *cellCb,
-CmLteRnti crnti,
-RgrUePrdDlCqiCfg *cqiCfg,
-RgrUeTxModeCfg txMode,
-RgSchErrInfo *errInfo
-)
-#endif
-{
- RgrTxMode txMde;
- RgrPrdCqiMode pucchMode;
-
- txMde = RGR_UE_TM_1;
- pucchMode = RGR_PRD_CQI_MOD20;
- if ( RGR_SCH_PCQI_SETUP == cqiCfg->type )
- {
- /*1. Validate for Tx Mode and PUCCH Mode combination*/
- if(txMode.pres == TRUE)
- {
- txMde = txMode.txModeEnum;
- pucchMode = cqiCfg->cqiSetup.prdModeEnum;
- if ( ROK != rgSCHCfgVldtRgrTxmodePucchMode(cellCb, txMde,
- pucchMode, errInfo))
- {
- DU_LOG("\nERROR --> SCH : Invalid Tx Mode-PUCCH Mode combination CRNTI:%d",crnti);
- return RFAILED;
- }
- }
-
- /*2. Validate for PCQI Reporting Type and PUCCH Mode combination*/
- if((cqiCfg->cqiSetup.cqiRepType==1) &&
- ((pucchMode == RGR_PRD_CQI_MOD20) ||
- (pucchMode == RGR_PRD_CQI_MOD21)))
- {
- DU_LOG("\nERROR --> SCH : Invalid Reporting Type-PUCCH Mode combination CRNTI:%d",crnti);
- return RFAILED;
- }
-
- if((cqiCfg->cqiSetup.cqiRepType==2) &&
- ((pucchMode == RGR_PRD_CQI_MOD10) ||
- (pucchMode == RGR_PRD_CQI_MOD11)))
- {
- DU_LOG("\nERROR --> SCH : Invalid Reporting Type-PUCCH Mode combination CRNTI:%d",crnti);
- return RFAILED;
- }
-
- /*3. Validate CQI/PMI and RI Configuration related parameter values */
- /*TODO- To be compared with configured n2Pucch Index*/
- if (cqiCfg->cqiSetup.cqiPResIdx > RG_SCH_PUCCH_RES_MAX_SUPP )
- {
- DU_LOG("\nERROR --> SCH : Not Supported or Invalid CQI-PUCCH resourceIndex=%d Cfg Val=%d CRNTI:%d",
- RG_SCH_PUCCH_RES_MAX_SUPP, cqiCfg->type,crnti);
- return RFAILED;
- }
-
-#ifdef LTEMAC_HDFDD
- if(hdFdd)
- {
- if((cqiCfg->cqiSetup.cqiPCfgIdx > RG_SCH_ICQI_MAX_SUPP)||
- (cqiCfg->cqiSetup.cqiPCfgIdx < 7) ||
- (cqiCfg->cqiSetup.cqiPCfgIdx == 317))
- {
- DU_LOG("\nERROR --> SCH : Not Supported or Invalid Cfg CQI Min Index Sup =%d"
- "Max Index Sup=%d Cfg Val=%d CRNTI:%d", RG_SCH_ICQI_MIN_SUPP,
- RG_SCH_ICQI_MAX_SUPP, cqiCfg->type,crnti);
- return RFAILED;
- }
- }
- else
- {
- if((cqiCfg->cqiSetup.cqiPCfgIdx > RG_SCH_ICQI_MAX_SUPP)||
- (cqiCfg->cqiSetup.cqiPCfgIdx == 317))
- {
- DU_LOG("\nERROR --> SCH : Not Supported or Invalid Cfg CQI Min Index Sup =%d "
- "Max Index Sup=%d Cfg Val=%d CRNTI:%d", RG_SCH_ICQI_MIN_SUPP,
- RG_SCH_ICQI_MAX_SUPP, cqiCfg->type,crnti);
- return RFAILED;
- }
- }
-#else
- if((cqiCfg->cqiSetup.cqiPCfgIdx > RG_SCH_ICQI_MAX_SUPP)||
- (cqiCfg->cqiSetup.cqiPCfgIdx == 317))
- {
- DU_LOG("\nERROR --> SCH : Not Supported or Invalid Cfg CQI Min Index Sup =%d"
- "Max Index Sup=%d Cfg Val=%d CRNTI;%d", RG_SCH_ICQI_MIN_SUPP,
- RG_SCH_ICQI_MAX_SUPP, cqiCfg->type,crnti);
- return RFAILED;
- }
-#endif
-
- if((cqiCfg->cqiSetup.cqiRepType < RGR_UE_PCQI_WB_REP) ||
- (cqiCfg->cqiSetup.cqiRepType > RGR_UE_PCQI_SB_REP))
- {
- DU_LOG("\nERROR --> SCH : Invalid Cfg CQI Report"
- "ModeCfg Val=%d CRNTI:%d", cqiCfg->type,crnti);
- return RFAILED;
- }
-
- if((cqiCfg->cqiSetup.cqiRepType == RGR_UE_PCQI_SB_REP) &&
- ((cqiCfg->cqiSetup.k < RG_SCH_CQI_K_MIN) ||
- (cqiCfg->cqiSetup.k > RG_SCH_CQI_K_MAX)))
- {
- DU_LOG("\nERROR --> SCH : Invalid CQI Cfg K Cfg Val=%d CRNTI:%d", cqiCfg->type,crnti);
- return RFAILED;
- }
-
- if((cqiCfg->cqiSetup.cqiRepType == RGR_UE_PCQI_SB_REP) &&
- (cellCb->bwCfg.dlTotalBw <= 7))
- {
- DU_LOG("\nERROR --> SCH : Invalid Periodic CQI mode Cfg for dlTotalBw (%d) for CRNTI:%d",
- cellCb->bwCfg.dlTotalBw, crnti);
- return RFAILED;
- }
-
-#ifndef LTE_TDD
- if (cqiCfg->cqiSetup.cqiPCfgIdx == RG_SCH_ICQI_RESV_FDD )
- {
- DU_LOG("\nERROR --> SCH : Reserved value Cfg =%d CRNTI:%d",
- cqiCfg->cqiSetup.cqiPResIdx,crnti);
- return RFAILED;
- }
-#endif
-
- /* 4. Check RI Configuration values */
- if(cqiCfg->cqiSetup.riEna == TRUE)
- {
- if(txMode.pres == TRUE)
- {
- if((txMde != RGR_UE_TM_3)
- && (txMde != RGR_UE_TM_4)
- && (txMde != RGR_UE_TM_8)
-#ifdef LTE_ADV
- && (txMde != RGR_UE_TM_9)
-#endif
- )
- {
- DU_LOG("\nERROR --> SCH : Invalid Transmission Mode =%d CRNTI:%d",
- txMde,crnti);
- return RFAILED;
- }
- }
-
- if(cqiCfg->cqiSetup.riCfgIdx > RG_SCH_IRI_MAX_SUPP)
- {
- DU_LOG("\nERROR --> SCH : Invalid Index RI value Cfg =%d CRNTI:%d",
- cqiCfg->cqiSetup.riCfgIdx,crnti);
- return RFAILED;
- }
- }
- }
-
-
- return ROK;
-}
-
-/*
- * @brief Validates the UE SRS Re/Configuation request from RRM to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgVldtRgrUeUlSrsCfg
- *
- * Processing Steps:
- * - Validate the UE configuration request from RRC to MAC at CFG:
- * validate the value range for SRS values.
- * - If validated successfully,
- * - Return ROK.
- * - Else
- * - Return RFAILED.
- *
- * @param[in] RgSchCellCb *cellCb,
- * @param[in] CmLteRnti crnti,
- * @param[in] RgrUeUlSrsCfg *srsCfg,
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-#ifdef LTEMAC_HDFDD
-S16 rgSCHCfgVldtRgrUeUlSrsCfg
-(
- RgSchCellCb *cellCb,
- CmLteRnti crnti,
- RgrUeUlSrsCfg *srsCfg,
- Bool hdFdd,
- RgSchErrInfo *errInfo
- )
-#else
-S16 rgSCHCfgVldtRgrUeUlSrsCfg
-(
-RgSchCellCb *cellCb,
-CmLteRnti crnti,
-RgrUeUlSrsCfg *srsCfg,
-RgSchErrInfo *errInfo
-)
-#endif
-{
- uint16_t srsPeri=0;
- uint16_t srsOffset=0;
- uint8_t srsSubframe=0;
-
- if ( RGR_SCH_SRS_SETUP == srsCfg->type )
- {
-
- /*ccpu00130768 - ADD - if cell specific SRS is not configured*/
- if(cellCb->srsCfg.isSrsCfgPres == FALSE)
- {
- DU_LOG("\nERROR --> SCH : Cell specific SRS is not configured CRNTI:%d",crnti);
- return RFAILED;
- }
-
- /* 1. Validate SRS Configuration related parameter values */
- /* 1.1 iSRS should be 0-636; Ref: 36.213. Table 8.2-1 */
-#ifdef LTEMAC_HDFDD
- if(hdFdd)
- {
- if ( (srsCfg->srsSetup.srsCfgIdx < 7) ||
- (srsCfg->srsSetup.srsCfgIdx > RG_SCH_ISRS_MAX_SUPP) )
- {
- DU_LOG("\nERROR --> SCH : Not Supported or Invalid Cfg "
- "SRS Min Index Sup =%d Max Index Sup=%d Cfg Val=%d CRNTI:%d",
- RG_SCH_ISRS_MIN_SUPP, RG_SCH_ISRS_MAX_SUPP,
- srsCfg->srsSetup.srsCfgIdx,crnti);
- return RFAILED;
- }
- }
- else
- {
- if ( srsCfg->srsSetup.srsCfgIdx > RG_SCH_ISRS_MAX_SUPP )
- {
- DU_LOG("\nERROR --> SCH : Not Supported or Invalid Cfg"
- "SRS Min Index Sup =%d Max Index Sup=%d Cfg Val=%d CRNTI:%d",
- RG_SCH_ISRS_MIN_SUPP, RG_SCH_ISRS_MAX_SUPP,
- srsCfg->srsSetup.srsCfgIdx,crnti);
- return RFAILED;
- }
-
- }
-#else
- if ( srsCfg->srsSetup.srsCfgIdx > RG_SCH_ISRS_MAX_SUPP )
- {
- DU_LOG("\nERROR --> SCH : Not Supported or Invalid Cfg"
- "SRS Min Index Sup =%d Max Index Sup=%d Cfg Val=%d CRNTI:%d",
- RG_SCH_ISRS_MIN_SUPP, RG_SCH_ISRS_MAX_SUPP,
- srsCfg->srsSetup.srsCfgIdx,crnti);
- return RFAILED;
- }
-#endif
-#ifdef LTE_TDD
- /* Compute SRS Offset and Periodicity */
- rgSCHUtlGetCfgPerOff( RG_SCH_TDD_SRS_TBL,
- srsCfg->srsSetup.srsCfgIdx,
- &srsPeri, &srsOffset);
-#else
- rgSCHUtlGetCfgPerOff( RG_SCH_FDD_SRS_TBL,
- srsCfg->srsSetup.srsCfgIdx,
- &srsPeri, &srsOffset);
-#endif
- srsSubframe = srsOffset%RGSCH_NUM_SUB_FRAMES;
-#ifdef LTE_TDD
- if(rgSchTddCellSpSrsSubfrmTbl[cellCb->srsCfg.srsSubFrameCfg][srsSubframe] == FALSE) {
-#else
- if(rgSchFddCellSpSrsSubfrmTbl[cellCb->srsCfg.srsSubFrameCfg][srsSubframe] == FALSE) {
-#endif
- DU_LOG("\nERROR --> SCH : UE specific SRS is not occuring in Cell specific SRS subframe"
- "srs Cfg Idx =%d CRNTI:%d",
- srsCfg->srsSetup.srsCfgIdx,crnti);
- return RFAILED;
- }
-
-
- if ( srsCfg->srsSetup.fDomPosi > RG_SCH_SRS_FREQDOM_POS_MAX )
- {
- DU_LOG("\nERROR --> SCH : Not Supported or Invalid Cfg"
- "SRS Min Freq Domain Position =%d"
- "Max Freq Domain Position =%d Cfg Val=%d CRNTI:%d",
- RG_SCH_SRS_FREQDOM_POS_MIN, RG_SCH_SRS_FREQDOM_POS_MAX,
- srsCfg->srsSetup.srsCfgIdx,crnti);
- return RFAILED;
- }
-
- if ( srsCfg->srsSetup.txComb > RG_SCH_SRS_TXCOMB_MAX )
- {
- DU_LOG("\nERROR --> SCH : Not Supported or Invalid Cfg"
- "SRS Min TX Comb =%d Max TX Comb =%d Cfg Val=%d CRNTI:%d",
- RG_SCH_SRS_TXCOMB_MIN, RG_SCH_SRS_TXCOMB_MAX,
- srsCfg->srsSetup.srsCfgIdx,crnti);
- return RFAILED;
- }
- }
- return ROK;
-}
-
-/*
- * @brief Validates the UE SR Re/configuration request from RRM to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgVldtRgrUeSrCfg
- *
- * Processing Steps:
- * - Validate the UE re/configuration request from RRC to MAC at CFG:
- * validate the value range for SR values.
- * - If validated successfully,
- * - Return ROK.
- * - Else
- * - Return RFAILED.
- *
- * @param[in] RgSchCellCb *cellCb,
- * @param[in] CmLteRnti crnti,
- * @param[in] RgrUeSrCfg *srCfg,
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-#ifdef LTEMAC_HDFDD
-S16 rgSCHCfgVldtRgrUeSrCfg
-(
- RgSchCellCb *cellCb,
- CmLteRnti crnti,
- RgrUeSrCfg *srCfg,
- Bool hdFdd,
- RgSchErrInfo *errInfo
- )
-#else
-S16 rgSCHCfgVldtRgrUeSrCfg
-(
- RgSchCellCb *cellCb,
- CmLteRnti crnti,
- RgrUeSrCfg *srCfg,
- RgSchErrInfo *errInfo
- )
-#endif
-{
-
- if ( RGR_SCH_SR_SETUP == srCfg->type )
- {
- /* 1. Validate SR Configuration related parameter values */
-#ifdef LTEMAC_HDFDD
- if(hdFdd)
- {
- if (( srCfg->srSetup.srResIdx > RG_SCH_SR_RES_IDX ) ||
- ( srCfg->srSetup.srCfgIdx < 5 ) ||
- ( srCfg->srSetup.srCfgIdx > RG_SCH_ISR_MAX_SUPP ))
- {
- DU_LOG("\nERROR --> SCH : Invalid SR Index Cfg =%d"
- "Max Supp=%d,Min Supp=%d CRNTI:%d", srCfg->srSetup.srCfgIdx,
- RG_SCH_ISR_MAX_SUPP, RG_SCH_ISR_MIN_SUPP,crnti);
-
- return RFAILED;
- }
- }
- else
- {
- if (( srCfg->srSetup.srResIdx > RG_SCH_SR_RES_IDX ) ||
- ( srCfg->srSetup.srCfgIdx > RG_SCH_ISR_MAX_SUPP ))
- {
- DU_LOG("\nERROR --> SCH : Invalid SR Index Cfg =%d"
- "Max Supp=%d,Min Supp=%d CRNTI:%d", srCfg->srSetup.srCfgIdx,
- RG_SCH_ISR_MAX_SUPP, RG_SCH_ISR_MIN_SUPP,crnti);
-
- return RFAILED;
- }
- }
-#else
- if (( srCfg->srSetup.srResIdx > RG_SCH_SR_RES_IDX ) ||
- ( srCfg->srSetup.srCfgIdx > RG_SCH_ISR_MAX_SUPP ))
- {
- DU_LOG("\nERROR --> SCH : Invalid SR Index Cfg =%d"
- "Max Supp=%d,Min Supp=%d CRNTI:%d", srCfg->srSetup.srCfgIdx,
- RG_SCH_ISR_MAX_SUPP, RG_SCH_ISR_MIN_SUPP,crnti);
-
- return RFAILED;
- }
-#endif
- }
- return ROK;
-}
-
-
-/*
- * @brief Validates the UE Aperiodic & Periodic CQI, PMI, RI, SRS and SR Configuration
- * request from RRM to MAC.
- *
- * @details
- *
- * Function :rgSCHCfgVldtCqiSrSrsUeCfg
- *
- * Processing Steps:
- * - Validate the UE configuration request from RRC to MAC at CFG:
- * validate the value range for Aperiodic & Periodic CQI, PMI, RI , SRS and SR values.
- * - If validated successfully,
- * - Return ROK.
- * - Else
- * - Return RFAILED.
- *
- * @param[in] RgSchCellCb *cellCb
- * @param[in] RgrUeCfg *ueCfg
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-static S16 rgSCHCfgVldtCqiSrSrsUeCfg
-(
-RgSchCellCb *cellCb,
-RgrUeCfg *ueCfg,
-RgSchErrInfo *errInfo
-)
-{
-
- /* 1. Validate UE Aperiodic CQI related parameters */
- if ( ROK != rgSCHCfgVldtRgrUeACqiCfg (cellCb, ueCfg->crnti,
- &ueCfg->ueDlCqiCfg.aprdCqiCfg, ueCfg->txMode, errInfo ))
- {
- DU_LOG("\nERROR --> SCH : Invalid Aperiodic CQI configuration CRNTI:%d",ueCfg->crnti);
- return RFAILED;
- }
-
- /* 1. Validate UE Periodic CQI/PMI, SRS and SR related parameters */
-#ifdef LTEMAC_HDFDD
- if ( ROK != rgSCHCfgVldtRgrUePCqiCfg (cellCb, ueCfg->crnti,
- &ueCfg->ueDlCqiCfg.prdCqiCfg, ueCfg->isHdFddEnbld,
- ueCfg->txMode, errInfo ))
-#else
- if ( ROK != rgSCHCfgVldtRgrUePCqiCfg (cellCb, ueCfg->crnti,
- &ueCfg->ueDlCqiCfg.prdCqiCfg, ueCfg->txMode, errInfo ))
-#endif
- {
- DU_LOG("\nERROR --> SCH : Invalid Periodic CQI configuration CRNTI:%d",ueCfg->crnti);
- return RFAILED;
- }
-
- /* 2. Validate SRS Configuration related parameter values */
-#ifdef LTEMAC_HDFDD
- if ( ROK != rgSCHCfgVldtRgrUeUlSrsCfg(cellCb, ueCfg->crnti, &ueCfg->srsCfg,
- ueCfg->isHdFddEnbld, errInfo ))
-#else
- if ( ROK != rgSCHCfgVldtRgrUeUlSrsCfg(cellCb, ueCfg->crnti,
- &ueCfg->srsCfg, errInfo ))
-#endif
- {
- DU_LOG("\nERROR --> SCH : Invalid SRS configuration CRNTI:%d",ueCfg->crnti);
- return RFAILED;
- }
-
- /* 3. Validate SR Configuration related parameter values */
-#ifdef LTEMAC_HDFDD
- if ( ROK != rgSCHCfgVldtRgrUeSrCfg (cellCb, ueCfg->crnti, &ueCfg->srCfg,
- ueCfg->isHdFddEnbld, errInfo))
-#else
- if ( ROK != rgSCHCfgVldtRgrUeSrCfg (cellCb, ueCfg->crnti,
- &ueCfg->srCfg, errInfo))
-#endif
- {
- DU_LOG("\nERROR --> SCH : Invalid SR configuration CRNTI:%d",ueCfg->crnti);
- return RFAILED;
- }
-
- return ROK;
-
-}
-
-
-
-/*****************************************************************
- * UE PCQI, RI, SRS and SR Re Configuration Validation Functions *
- * *
- ******************************************************************/
-/*
- * @brief Validates the UE Periodic CQI, PMI, RI, SRS and SR
- * Re-configuration request from RRM to MAC.
- *
- * @details
- *
- * Function : rgSCHCfgVldtCqiSrSrsUeReCfg
- *
- * Processing Steps:
- * - Validate the UE Re configuration request from RRC to MAC at CFG:
- * validate the value range for Periodic CQI, PMI, RI, SRS and SR values.
- * - If validated successfully,
- * - Return ROK.
- * - Else
- * - Return RFAILED.
- *
- * @param[in] RgSchCellCb *cellCb
- * @param[in] RgSchUeCb *ueCb
- * @param[in] RgrUeCfg *ueCfg
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-static S16 rgSCHCfgVldtCqiSrSrsUeReCfg
-(
-RgSchCellCb *cellCb,
-RgSchUeCb *ueCb,
-RgrUeRecfg *ueReCfg,
-RgSchErrInfo *errInfo
-)
-{
- RgrUeTxModeCfg txMode;
-
- txMode.pres = TRUE;
- txMode.tmTrnstnState = RGR_TXMODE_RECFG_CMPLT;
- if ((ueReCfg->ueRecfgTypes & RGR_UE_TXMODE_RECFG) &&
- (ueReCfg->txMode.pres == TRUE))
- {
- txMode.txModeEnum = ueReCfg->txMode.txModeEnum;
- }
- else
- {
- txMode.txModeEnum = ueCb->mimoInfo.txMode;
- }
-
- /* 1. Validate UE CQI/PMI, SRS and SR related parameters */
-
- if ( ueReCfg->ueRecfgTypes & RGR_UE_APRD_DLCQI_RECFG )
- {
- if ( ROK != rgSCHCfgVldtRgrUeACqiCfg (cellCb, ueReCfg->oldCrnti,
- &ueReCfg->aprdDlCqiRecfg, txMode, errInfo ))
- {
- DU_LOG("\nERROR --> SCH : Invalid Aperiodic CQI configuration OLD CRNTI:%d",ueReCfg->oldCrnti);
- return RFAILED;
- }
- }
-
-
- /* 2. Validate UE CQI/PMI, SRS and SR related parameters */
-
- if ( ueReCfg->ueRecfgTypes & RGR_UE_PCQI_RECFG )
- {
-#ifdef LTEMAC_HDFDD
- if ( ROK != rgSCHCfgVldtRgrUePCqiCfg (cellCb, ueReCfg->oldCrnti,
- &ueReCfg->cqiCfg, ueReCfg->isHdFddEnbld, txMode, errInfo ))
-#else
- if ( ROK != rgSCHCfgVldtRgrUePCqiCfg (cellCb, ueReCfg->oldCrnti,
- &ueReCfg->cqiCfg, txMode, errInfo ))
-#endif
-
- {
- DU_LOG("\nERROR --> SCH : Invalid Periodic CQI configuration OLD CRNTI:%d",ueReCfg->oldCrnti);
- return RFAILED;
- }
- }
-
- if(ueReCfg->ueRecfgTypes & RGR_UE_SRS_RECFG )
- {
-#ifdef LTEMAC_HDFDD
- if ( ROK != rgSCHCfgVldtRgrUeUlSrsCfg(cellCb, ueReCfg->oldCrnti,
- &ueReCfg->srsCfg, ueReCfg->isHdFddEnbld, errInfo ))
-#else
- if ( ROK != rgSCHCfgVldtRgrUeUlSrsCfg(cellCb, ueReCfg->oldCrnti,
- &ueReCfg->srsCfg, errInfo ))
-#endif
- {
- DU_LOG("\nERROR --> SCH : Invalid SRS configuration OLD CRNTI:%d",ueReCfg->oldCrnti);
- return RFAILED;
- }
-
- }
-
- if ( ueReCfg->ueRecfgTypes & RGR_UE_SR_RECFG )
- {
-#ifdef LTEMAC_HDFDD
- if ( ROK != rgSCHCfgVldtRgrUeSrCfg (cellCb, ueReCfg->oldCrnti,
- &ueReCfg->srCfg, ueReCfg->isHdFddEnbld, errInfo))
-#else
- if ( ROK != rgSCHCfgVldtRgrUeSrCfg (cellCb, ueReCfg->oldCrnti,
- &ueReCfg->srCfg, errInfo))
-#endif
- {
- DU_LOG("\nERROR --> SCH : Invalid SR configuration OLD CRNTI:%d",ueReCfg->oldCrnti);
- return RFAILED;
- }
- }
-
- return ROK;
-}
-
-
-/*****************************************************************
- * UE ACQI, PCQI, RI, SRS SR Configuration Functions *
- * *
- ******************************************************************/
- /**
- * @brief Handles Aperiodic CQI , PMI, RI configuration for a UE.
- *
- * @details
- *
- * Function : rgSCHCfgACqiUeCfg
- *
- * Invoking Module Processing:
- * - This shall be invoked by SCH_GOM at UE configuration. It
- * shall do the validations for the spec-defined values.
- *
- * Processing Steps:
- *
- * - Return ROK
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgrTxMode txMode
- * @param[in] RgrUeAprdDlCqiCfg *aCqiCfg
- * @param[in] CmLteUeCategory ueCat
- * @return S16
- * -# ROK
- *
- **/
-S16 rgSCHCfgACqiUeCfg
-(
-RgSchCellCb *cellCb,
-RgSchUeCb *ue,
-RgSchUeACqiCb *acqiCb,
-RgrTxMode ueTxMode,
-RgrUeAprdDlCqiCfg *aCqiCfg,
-CmLteUeCategory ueCat
-)
-{
- uint8_t M; /*Num of Subbands -- Applicable only for Mode 2-0 and 2-2*/
- uint8_t k; /*SubBand Size (RB) --
- Holds different values depending on Mode*/
- uint8_t cqiPmiSzR1; /*CQIPMI Size for Rank =1*/
- uint8_t cqiPmiSzRn1; /*CQIPMI Size for Rank > 1*/
-
- cqiPmiSzR1 = 0;
- cqiPmiSzRn1 = 0;
-
- acqiCb->aCqiCfg.pres = aCqiCfg->pres;
- acqiCb->aCqiCfg.aprdModeEnum = aCqiCfg->aprdModeEnum;
-
- if(aCqiCfg->pres)
- {
-#ifdef LTE_ADV
- /*Store Trigger Set Bit String to UE */
- RgSchUeCellInfo *pCellInfo = RG_SCH_CMN_GET_PCELL_INFO(ue);
- pCellInfo->acqiCb.aCqiCfg.triggerSet1 = aCqiCfg->triggerSet1;
- pCellInfo->acqiCb.aCqiCfg.triggerSet2 = aCqiCfg->triggerSet2;
-#endif
-
-
- switch(aCqiCfg->aprdModeEnum)
- {
- case RGR_APRD_CQI_MOD12:
- case RGR_APRD_CQI_MOD30:
- case RGR_APRD_CQI_MOD31:
- RG_SCH_GET_CQI_K_VAL(cellCb->bwCfg.dlTotalBw, k);
- acqiCb->N = RGSCH_CEIL(cellCb->bwCfg.dlTotalBw, k);
- acqiCb->k = k;
- break;
-
- case RGR_APRD_CQI_MOD20:
- case RGR_APRD_CQI_MOD22:
- RG_SCH_GET_SBCQI_M_K_VAL(cellCb->bwCfg.dlTotalBw, M, k);
- acqiCb->N = RGSCH_CEIL(cellCb->bwCfg.dlTotalBw, k);
- acqiCb->k = k;
- acqiCb->M = M;
- acqiCb->L = RgSCHUeAcqi2022LBitWidth[M-1][acqiCb->N-1];
- break;
-
- default:
- break;
- }
- if((ueTxMode == RGR_UE_TM_3) ||
- (ueTxMode == RGR_UE_TM_4))
- {
- if(cellCb->numTxAntPorts ==2)
- {
- acqiCb->riNumBits = 1;
- }
- else if(cellCb->numTxAntPorts ==4)
- {
- if(ueCat == CM_LTE_UE_CAT_8)
- {
- acqiCb->riNumBits = 3;
- }
- else if(ueCat >= CM_LTE_UE_CAT_5)
- {
- acqiCb->riNumBits = 2;
- }
- else
- {
- acqiCb->riNumBits = 1;
- }
- }
- }
- rgSCHCfgUtlFetchAcqiBitSz(acqiCb, cellCb->numTxAntPorts,
- &cqiPmiSzR1, &cqiPmiSzRn1);
- acqiCb->cqiPmiSzR1 = cqiPmiSzR1;
- acqiCb->cqiPmiSzRn1 = cqiPmiSzRn1;
- }
- acqiCb->cqiReqField = TRUE;
-#ifdef LTE_ADV
- rgSchCmnSetCqiReqField(RG_SCH_CMN_GET_SCELL_INFO(ue, cellCb),ue,&acqiCb->cqiReqField);
-#endif
-
- return ROK;
-}
-
-/**
- * @brief Handles Periodic CQI , PMI, RI configuration for a UE.
- *
- * @details
- *
- * Function : rgSCHCfgPCqiUeCfg
- *
- * Invoking Module Processing:
- * - This shall be invoked by SCH_GOM at UE configuration. It shall do the
- * validations for the spec-defined values.
- *
- * Processing Steps:
- * - For UE-specific Periodic CQI related configuration,
- * - If Periodic CQI/PMI is configured,
- * - Update UE with the configured values.
- - Compute and Update next occurance of CQI/PMI or RI Tranmission instance.
- - Update the CQI offset and CQI perodicity information
- - Add Ue to cell's list
- *
- *
- * - For UE-specific Periodic RI related configuration,
- * - If Periodic RI is configured,
- * - Update UE with the configured values.
- - Compute and Update next occurance of RI Tranmission instance.
- - Update the RI offset and RI perodicity information
- *
- *
- * - Return ROK
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrUePrdDlCqiCfg *cqiCfg
- * @param[in] CmLteUeCategory ueCat
- * @return S16
- * -# ROK
- *
- **/
-S16 rgSCHCfgPCqiUeCfg
-(
-RgSchCellCb *cellCb,
-RgSchUeCb *ueCb,
-RgrUePrdDlCqiCfg *cqiCfg,
-CmLteUeCategory ueCat
-)
-{
- CmLteTimingInfo timingInfo;
- uint16_t crntTime;
- uint16_t cqiTrInstTime;
- uint8_t j; /*Bandwidth Parts*/
- uint8_t temp;
- uint8_t loop;
- RgSchUePCqiCb *cqiCb = NULLP;
-
- crntTime = (cellCb->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)+
- (cellCb->crntTime.slot);
- cqiCb = RG_SCH_GET_UE_CELL_CQI_CB(ueCb,cellCb);
- cqiCb->servCellInfo = ueCb->cellInfo[0];
- /* Periodic CQI is setup */
- if (cqiCfg->type == RGR_SCH_PCQI_SETUP)
- {
- for(loop = 0; loop < MAX_CQI_RI_RPT_BUFF;loop++)
- {
- ueCb->rawCqiBitW[loop].type = TFU_RECP_REQ_INVLD; /* setting invalid type*/
- }
- /* 1. Copy the Received CQI Cfg parameters to ueCb */
- memcpy(&cqiCb->cqiCfg, cqiCfg,
- sizeof(RgrUePrdDlCqiCfg));
-
- /* 2. Compute Periodic CQI Periodicity and subframe offset */
-#ifndef LTE_TDD
- rgSCHUtlGetCfgPerOff(RG_SCH_FDD_PCQI_TBL, cqiCfg->cqiSetup.cqiPCfgIdx,
- &cqiCb->cqiPeri, &cqiCb->cqiOffset);
-#else
- rgSCHUtlGetCfgPerOff( RG_SCH_TDD_PCQI_TBL,
- cqiCfg->cqiSetup.cqiPCfgIdx,
- &cqiCb->cqiPeri, &cqiCb->cqiOffset);
-#endif
- DU_LOG("\nDEBUG --> SCH : rgSCHCfgPCqiUeCfg(): UEID:%d CQI Peri=%d, CQI Offset=%d",
- ueCb->ueId,
- cqiCb->cqiPeri,
- cqiCb->cqiOffset);
-
-
- cqiTrInstTime = ((cqiCb->cqiPeri+crntTime) - cqiCb->cqiOffset)
- %cqiCb->cqiPeri;
- cqiCb->nCqiTrIdx = (crntTime +
- (cqiCb->cqiPeri - cqiTrInstTime));
- /* Introduced timing delta for reception req
- * in FDD*/
- if(cqiCb->nCqiTrIdx <= (crntTime + TFU_RECPREQ_DLDELTA))
- {
- cqiCb->nCqiTrIdx = cqiCb->nCqiTrIdx + cqiCb->cqiPeri;
- }
-
- /* To handle the SFN wrap around case */
- cqiCb->nCqiTrIdx = cqiCb->nCqiTrIdx % (RGSCH_MAX_SFN * RGSCH_NUM_SUB_FRAMES_5G);
-
- timingInfo.sfn = cqiCb->nCqiTrIdx/RGSCH_NUM_SUB_FRAMES_5G;
- timingInfo.slot = cqiCb->nCqiTrIdx % RGSCH_NUM_SUB_FRAMES_5G;
-
- cqiCb->nCqiTrIdx = cqiCb->nCqiTrIdx
- %RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
-
-#ifdef EMTC_ENABLE
- /*CQI Repetition configuration*/
- if(ueCb->isEmtcUe)
- {
- rgSchfillPucchCqiRepNumCountemtc(cqiCb, ueCb);
- }
-#endif
-
- if(RGR_UE_PCQI_SB_REP == cqiCfg->cqiSetup.cqiRepType)
- {
- uint8_t k; /*SubBand Size (RB) */
- RG_SCH_GET_CQI_J_VAL(cellCb->bwCfg.dlTotalBw, j);
- RG_SCH_GET_CQI_K_VAL(cellCb->bwCfg.dlTotalBw, k);
- cqiCb->J = j; /*Number of Bandwidth Parts*/
- /*h: reporting instances required for a complete CQI/PMI report */
- /*j:Number of bandwidth parts; k: Subband Size*/
- cqiCb->h = (cqiCb->cqiCfg.cqiSetup.k *j )+1;
- /* ccpu00140905- L-size is coming as 3 for 100Rbs where it should be 2*/
- temp = RGSCH_CEIL(cellCb->bwCfg.dlTotalBw, (j*k));
- cqiCb->label = (temp & (temp-1)) ?
- (1+ rgSCHUtlLog32bitNbase2(temp)) : rgSCHUtlLog32bitNbase2(temp);
-
- rgSCHTomUtlPcqiSbCalcBpIdx(timingInfo,ueCb, cqiCb);
- }
-#ifdef LTE_ADV
- else
- {
- cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_1;
- }
-#endif
-
- /* Place the UE in cellCb->tIUeLstCp */
- cqiCb->cqiLstEnt.node=(PTR) cqiCb;
-#ifdef LTE_ADV
- cqiCb->isCqiIgnoByCollsn = FALSE;
- cqiCb->isRiIgnoByCollsn = FALSE;
-#endif
-
-
- cmLListAdd2Tail(&cellCb->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst,
- &cqiCb->cqiLstEnt);
-
-
- /* 4. Rank Indicator Cfg handler */
- rgSCHCfgRiUeCfg(cellCb, ueCb, cqiCfg, ueCat);
- }
- else
- {
- cqiCb->cqiCfg.type = RGR_SCH_PCQI_REL;
- if(cqiCb->nCqiTrIdx != RG_SCH_INVALID_IDX)
- {
- cmLListDelFrm(&cellCb->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst,\
- &cqiCb->cqiLstEnt);
- }
- if(cqiCb->nRiTrIdx != RG_SCH_INVALID_IDX)
- {
- cmLListDelFrm(&cellCb->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst, \
- &cqiCb->riLstEnt);
- RG_SCH_RECORD(&cqiCb->histElem,RGSCH_ACTION_DEL,
- &cellCb->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst);
- }
- cqiCb->nCqiTrIdx = RG_SCH_INVALID_IDX;
- cqiCb->nRiTrIdx = RG_SCH_INVALID_IDX;
- cqiCb->riDist = RG_SCH_INVALID_IDX;
- }
- ueCb->nPCqiCb = cqiCb;
- ueCb->nPRiCb = cqiCb;
- return ROK;
-}
-
-/**
- * @brief Handles Periodic RI configuration for a UE.
- *
- * @details
- *
- * Function : rgSCHCfgRiUeCfg
- *
- * Invoking Module Processing:
- * - This shall be invoked by SCH_GOM at UE configuration. It shall do the
- * validations for the spec-defined values.
- *
- * Processing Steps:
- * - For UE-specific Periodic RI related configuration,
- * - If Periodic RI is configured,
- * - Update UE with the configured values.
- - Compute and Update next occurance of RI Tranmission instance.
- - Update the RI offset and RI perodicity information
- *
- * - Return ROK
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrUePrdDlCqiCfg *cqiCfg
- * @param[in] CmLteUeCategory ueCat
- * @return S16
- * -# ROK
- *
- **/
-S16 rgSCHCfgRiUeCfg
-(
-RgSchCellCb *cellCb,
-RgSchUeCb *ueCb,
-RgrUePrdDlCqiCfg *cqiCfg,
-CmLteUeCategory ueCat
-)
-{
- uint16_t crntTime;
- uint16_t riTrInsTime;
- uint8_t j; /*Bandwidth parts. Valid for Modes 2-0, 2-1*/
- uint16_t periodicity;
- uint16_t tempIdx;
- RgSchUePCqiCb *cqiCb = NULLP;
-
- crntTime = (cellCb->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)
- +(cellCb->crntTime.slot);
- cqiCb = RG_SCH_GET_UE_CELL_CQI_CB(ueCb,cellCb);
- /* 1. Rank Indicator is enabled */
- if(cqiCfg->cqiSetup.riEna)
- {
-
- rgSCHUtlGetCfgPerOff(RG_SCH_RI_TBL,
- cqiCfg->cqiSetup.riCfgIdx,
- &cqiCb->riPeri, &cqiCb->riOffset);
-
- DU_LOG("\nDEBUG --> SCH : rgSCHCfgRiUeCfg(): RI Peri=%d, RI Offset=%d UEID:%d",
- cqiCb->riPeri, cqiCb->riOffset,ueCb->ueId);
-
- cqiCb->perRiVal = 1;
- cqiCb->invalidateCqi = FALSE;
-
- if(RGR_UE_PCQI_WB_REP == cqiCfg->cqiSetup.cqiRepType)
- {
- /*
- 1. wideband RI reporting is configured
- (Mode 1-0 or 1-1)
- (10*sfn+floor(subframe)-Noffsetcqi-NoffsetRI )Mod(NCqiperiod
- *MriPeriod)=0
- */
- periodicity = cqiCb->cqiPeri * cqiCb->riPeri;
- }
- else
- {
- /*
- * Where Widesband and Subband RI reporting is configured
- * (Mode 2-0 or 2-1 )
- * (10*sfn+floor(subframe)-Noffsetcqi-NoffsetRI )
- * Mod(H. NCqiperiod *MriPeriod )=0
- * where H= J * K +1; J=Number of bandwidth parts(BW/subsize).
- * K is RGR interf input
- */
-
- RG_SCH_GET_CQI_J_VAL(cellCb->bwCfg.dlTotalBw, j);
- cqiCb->h = (cqiCb->cqiCfg.cqiSetup.k *j )+1;
- periodicity = cqiCb->h * cqiCb->cqiPeri *
- cqiCb->riPeri;
- }
-
- /* In case of SFN wraparound, the SB CQI reporting cycle breaks
- * and RI->WB CQI->SBCQI.. should resume. RI is repositioned
- * accordingly. WBCQI handling is naturally accomplished */
- if (periodicity >= RGSCH_MAX_SUBFRM_5G)
- {
- periodicity = cqiCb->cqiOffset - cqiCb->riOffset +
- RGSCH_MAX_SUBFRM_5G - (crntTime);
- tempIdx = crntTime + periodicity;
- DU_LOG("\nINFO --> SCH : CHECK_SID - periodicity %d tempIdx %d\n", periodicity, tempIdx);
- }
- else
- {
- if ((crntTime + TFU_RECPREQ_DLDELTA + periodicity) >
- (RGSCH_MAX_SUBFRM_5G - 1))
- {
- riTrInsTime = (periodicity - cqiCb->cqiOffset + cqiCb->riOffset) % periodicity;
- tempIdx = RGSCH_MAX_SUBFRM_5G + (periodicity - riTrInsTime);
- }
- else
- {
- riTrInsTime = ((periodicity +crntTime )- \
- cqiCb->cqiOffset + cqiCb->riOffset)\
- % periodicity;
- tempIdx = (crntTime + (periodicity -riTrInsTime));
- }
- }
- if (tempIdx <= (crntTime + TFU_RECPREQ_DLDELTA))
- {
- tempIdx = tempIdx + periodicity;
- }
- cqiCb->nRiTrIdx = tempIdx
- % RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
- if(periodicity >= RG_SCH_PCQI_SRS_SR_TRINS_SIZE)
- {
- cqiCb->riDist = rgSCHUtlFindDist((uint16_t)(crntTime + TFU_RECPREQ_DLDELTA),
- (uint16_t) tempIdx);
- }
- else
- {
- cqiCb->riDist =0;
- }
- if(ueCb->mimoInfo.txMode == RGR_UE_TM_3
- || ueCb->mimoInfo.txMode == RGR_UE_TM_4)
- {
- if (cellCb->numTxAntPorts ==2)
- {
- cqiCb->riNumBits = 1;
- }
- else if(cellCb->numTxAntPorts ==4)
- {
- if(ueCat == CM_LTE_UE_CAT_8)
- {
- cqiCb->riNumBits = 3;
- }
- else if(ueCat >= CM_LTE_UE_CAT_5)
- {
- cqiCb->riNumBits = 2;
- }
- else
- {
- cqiCb->riNumBits = 1;
- }
- }
- }
- /* Place the UE in cellCb->tIUeLstCp */
- cqiCb->riLstEnt.node=(PTR) cqiCb;
-
- cmLListAdd2Tail(&cellCb->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst,
- &cqiCb->riLstEnt);
- RG_SCH_RECORD(&cqiCb->histElem,RGSCH_ACTION_ADD,
- &cellCb->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst);
-
-
- }
- else
- {
- cqiCb->nRiTrIdx = RG_SCH_INVALID_IDX;
- cqiCb->riDist = RG_SCH_INVALID_IDX;
- }
-
- return ROK;
-
-}
-
-/* @brief Handles SRS configuration for a UE.
- *
- * @details
- *
- * Function : rgSCHCfgSrsUeCfg
- *
- * Invoking Module Processing:
- * - This shall be invoked by SCH_GOM at UE configuration. It shall do the
- * validations for the spec-defined values.
- *
- * Processing Steps:
- * - For UE-specific SRS related configuration,
- * - If SRS is configured,
- * - Update UE with the configured values.
- - Compute and Update next occurance of SRS Tranmission instance.
- - Update the SRS offset and SRS perodicity information
- - Add Ue to cell's srs list
- * - else
- * - next occurance transmission instance of SRS = RG_SCH_INVALID_IDX
- *
- * - Return ROK
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrUeUlSrsCfg *srsCfg
- *
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-S16 rgSCHCfgSrsUeCfg
-(
-RgSchCellCb *cellCb,
-RgSchUeCb *ueCb,
-RgrUeUlSrsCfg *srsCfg
-)
-{
- uint16_t srsTrInsTime;
- uint16_t crntTime;
- uint16_t tempIdx;
-
- crntTime = (cellCb->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)
- +(cellCb->crntTime.slot);
-
- if(RGR_SCH_SRS_SETUP == srsCfg->type)
- {
- /* 1. Copy the Received Cfg parameters to local cb */
- memcpy(&ueCb->srsCb.srsCfg, srsCfg, sizeof(RgrUeUlSrsCfg));
-
-#ifndef LTE_TDD
- /* 2. Compute SRS Offset and Periodicity */
- rgSCHUtlGetCfgPerOff( RG_SCH_FDD_SRS_TBL,
- srsCfg->srsSetup.srsCfgIdx,
- &ueCb->srsCb.peri, &ueCb->srsCb.offset);
-#else
- rgSCHUtlGetCfgPerOff( RG_SCH_TDD_SRS_TBL,
- srsCfg->srsSetup.srsCfgIdx,
- &ueCb->srsCb.peri, &ueCb->srsCb.offset);
-#endif
-
- DU_LOG("\nDEBUG --> SCH : rgSCHCfgSrsUeCfg(): SRS Peri=%d, SRS Offset=%d UEID:%d",
- ueCb->srsCb.peri,ueCb->srsCb.offset,ueCb->ueId);
-
- /* 3. Compute next Tranmission index for SRS */
- /* Referenence: 36.213 Section:8.2
- i. SRS transmission instances for TDD with period > 2 and for FDD are
- ((10*sfn +Ksrs-suframeoffset))/mod(periodicity))
- FDD: Ksrs is 0...9
- TDD: Ksrs Table 8.2-3:
- ii.The SRS transmission instances for TDD (periodicity == 2)
- (Ksrs-Toffset)mod(5)==0. Note: This is not supported now
- */
-
- srsTrInsTime = ((ueCb->srsCb.peri+crntTime) - ueCb->srsCb.offset)
- %ueCb->srsCb.peri;
- tempIdx = (crntTime + (ueCb->srsCb.peri - srsTrInsTime));
-#ifdef LTE_TDD
- if (tempIdx <= (crntTime + TFU_DELTA))
-#else
- if (tempIdx <= (crntTime + TFU_RECPREQ_DLDELTA))
-#endif
- {
- tempIdx = tempIdx + ueCb->srsCb.peri;
- }
- ueCb->srsCb.nSrsTrIdx =(uint16_t) (tempIdx
- % RG_SCH_PCQI_SRS_SR_TRINS_SIZE);
- if(ueCb->srsCb.peri >= RG_SCH_PCQI_SRS_SR_TRINS_SIZE)
- {
-#ifdef LTE_TDD
- ueCb->srsCb.srsDist = rgSCHUtlFindDist((uint8_t)(crntTime+TFU_DELTA),
- (uint16_t)tempIdx);
-#else
- ueCb->srsCb.srsDist = rgSCHUtlFindDist((uint8_t)(crntTime + TFU_RECPREQ_DLDELTA),
- (uint16_t)tempIdx);
-#endif
- }
- else
- {
- ueCb->srsCb.srsDist = 0;
- }
-
- /*UE Tx Antenna Selection - START*/
- if(ueCb->ul.ulTxAntSel.pres == TRUE )
- {
- /*for both partial and full sounding bandwidth,
- and when frequency hopping is disabled */
- ueCb->srsCb.selectedAnt = (crntTime/ueCb->srsCb.peri)%2;
- }
- else
- {
- /* TS 36.213 specifies that if Tx Antenna Selection is
- disabled/not supported then its Port 0*/
- ueCb->srsCb.selectedAnt=0;
- }
- ueCb->validTxAnt = ueCb->srsCb.selectedAnt;
- /*UE Tx Antenna Selection - ENDS*/
-
- ueCb->srsCb.srsLstEnt.node=(PTR)ueCb;
- cmLListAdd2Tail(&cellCb->pCqiSrsSrLst[ueCb->srsCb.nSrsTrIdx].srsLst,
- &ueCb->srsCb.srsLstEnt);
-
-
- }
- else
- {
- /* SRS Release / Not configured */
- ueCb->srsCb.srsCfg.type = RGR_SCH_SRS_REL;
- if(ueCb->srsCb.nSrsTrIdx != RG_SCH_INVALID_IDX)
- {
- cmLListDelFrm(&cellCb->pCqiSrsSrLst[ueCb->srsCb.nSrsTrIdx].srsLst,
- &ueCb->srsCb.srsLstEnt);
- }
- ueCb->srsCb.nSrsTrIdx = RG_SCH_INVALID_IDX;
- ueCb->srsCb.srsLstEnt.node =(PTR) NULLP;
- }
-
- return ROK;
-}
-
-
-/* * @brief Handles SR configuration for a UE.
- *
- * @details
- *
- * Function : rgSCHCfgSrUeCfg
- *
- * Invoking Module Processing:
- * - This shall be invoked by SCH_GOM at UE configuration. It shall do the
- * validations for the spec-defined values.
- *
- * - If SR is configured,
- * - Update UE with the configured values.
- - Compute and Update next occurance of SR Tranmission instance.
- - Update the SR offset and SR perodicity information
- - Add Ue to cell->tIUeLstCp[n]
- * - else
- * - next occurance transmission instance of SR = RG_INVALID_SR_ID
- *
- *
- * - Return ROK
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrUeSrCfg *srCfg
- *
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-S16 rgSCHCfgSrUeCfg
-(
-RgSchCellCb *cellCb,
-RgSchUeCb *ueCb,
-RgrUeSrCfg *srCfg
-)
-{
- uint16_t srTrInsTime;
- uint16_t crntTime;
-
-
- crntTime = (cellCb->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)
- +(cellCb->crntTime.slot);
- if(srCfg->type == RGR_SCH_SR_SETUP)
- {
- /* 1. Copy the Received Cfg parameters to local cb */
- memcpy(&ueCb->srCb.srCfg, srCfg, sizeof(RgrUeSrCfg));
-
-
- /* 2. Compute SR periodicity and offset */
- rgSCHUtlGetCfgPerOff( RG_SCH_SR_TBL,
- srCfg->srSetup.srCfgIdx,
- &ueCb->srCb.peri, &ueCb->srCb.offset);
-
- DU_LOG("\nDEBUG --> SCH : SR Config: idx(%u), period (%u) offset (%u) UEID:%d",
- srCfg->srSetup.srCfgIdx,
- ueCb->srCb.peri,
- ueCb->srCb.offset,
- ueCb->ueId);
-#ifdef EMTC_ENABLE
- if(ueCb->isEmtcUe)
- {
- rgSchfillPucchSrRepNumCountemtc(ueCb);
- }
-#endif
- /* 3. Compute Next Transmission Instance */
-
- srTrInsTime = ((ueCb->srCb.peri+crntTime) - ueCb->srCb.offset)
- %ueCb->srCb.peri;
- ueCb->srCb.nSrTrIdx = (crntTime + (ueCb->srCb.peri- srTrInsTime));
-#ifdef LTE_TDD
- if (ueCb->srCb.nSrTrIdx <= (crntTime + TFU_DELTA))
-#else
- if (ueCb->srCb.nSrTrIdx <= (crntTime + TFU_RECPREQ_DLDELTA))
-#endif
- {
- ueCb->srCb.nSrTrIdx = ueCb->srCb.nSrTrIdx + ueCb->srCb.peri;
- }
- ueCb->srCb.nSrTrIdx = ueCb->srCb.nSrTrIdx
- % RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
- ueCb->srCb.srLstEnt.node= (PTR) ueCb;
-
- /* 4. Place UE in Cell SR Tranmisison Instance List */
- cmLListAdd2Tail(&cellCb->pCqiSrsSrLst[ueCb->srCb.nSrTrIdx].srLst,
- &ueCb->srCb.srLstEnt);
- }
- else
- {
- ueCb->srCb.srCfg.type = RGR_SCH_SR_REL;
-
- if(ueCb->srCb.nSrTrIdx != RG_SCH_INVALID_IDX)
- {
- cmLListDelFrm(&cellCb->pCqiSrsSrLst[ueCb->srCb.nSrTrIdx].srLst,
- &ueCb->srCb.srLstEnt);
- }
- ueCb->srCb.nSrTrIdx = RG_SCH_INVALID_IDX;
- ueCb->srCb.srLstEnt.node = (PTR)NULLP;
- }
-
- return ROK;
-}
-
-
-/*****************************************************************
- * UE PCQI, RI, SRS and SR Re Configuration Functions *
- * *
- ******************************************************************/
-
-
-/* * @brief Handles Periodic CQI, PMI, RI Re-configuration for a UE.
- *
- * @details
- *
- * Function : rgSCHCfgPCqiUeReCfg
- *
- * Invoking Module Processing:
- * - This shall be invoked by SCH_GOM at UE Re configuration. It shall do the
- * validations for the spec-defined values.
- *
- * Processing Steps:
- * - For UE-specific Periodic CQI related configuration,
- * - If Periodic CQI/PMI is re configured(first time enabled),
- * - Update UE with the configured values.
- * - Compute and Update next occurance of CQI/PMI or RI Tranmission
- * instance.
- * - Update the CQI offset and CQI perodicity information
- * - Add Ue to cell's list
- * - If Periodic CQI/PMI is re configured(modify),
- * - Update UE with the configured values.
- * - Del Ue from cell->tIUeLstCp list
- * - Compute and Update next occurance of CQI/PMI or RI Tranmission
- * instance.
- * - Update the CQI offset and CQI perodicity information
- * - Add Ue to cell's list
- * - If Periodic CQI/PMI is re configured(disabled),
- * - Update UE with the configured values.
- * - Del Ue from cell's list
- * - Update next occurance of CQI/PMI or RI Tranmission instance.
- * - next occurance of CQI/PMI = RG_INVALID_CQIPMI_ID
- *
- * - For UE-specific Periodic RI related configuration,
- * - If Periodic RI is configured(first time enabled),
- * - Update UE with the configured values.
- * - Compute and Update next occurance of RI Tranmission instance.
- * - Update the RI offset and RI perodicity information
- * - If Periodic RI is configured(modify),
- * - Update UE with the configured values.
- * - Compute and Update next occurance of RI Tranmission instance.
- * - Update the RI offset and RI perodicity information
- * - else
- * - next occurance of RI = RG_INVALID_CQIPMI_ID
- *
- * - Return ROK
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrUeCfg *ueCfg
- *
- * @return S16
- * -# ROK
- *
- */
-S16 rgSCHCfgPCqiUeReCfg
-(
-RgSchCellCb *cellCb,
-RgSchUeCb *ueCb,
-RgrUePrdDlCqiCfg *cqiCfg,
-CmLteUeCategory ueCat
-)
-{
-
- RgSchUePCqiCb *cqiCb = NULLP;
-
- cqiCb = RG_SCH_GET_UE_CELL_CQI_CB(ueCb,cellCb);
- /* Fix: ccpu00124008 Fix for incorrect check causing missed CQI reception instance */
- if((cqiCfg->type == RGR_SCH_PCQI_SETUP) &&
- (cqiCb->cqiCfg.type != RGR_SCH_PCQI_SETUP))
- {
- /* 1. cqi is in Release (Disable) state, Recfg is allowing Setup (Enable)
- */
- rgSCHCfgPCqiUeCfg(cellCb, ueCb, cqiCfg, ueCat);
-
- }
- else if((cqiCfg->type == RGR_SCH_PCQI_SETUP) &&
- (cqiCb->cqiCfg.type == RGR_SCH_PCQI_SETUP ))
- {
-
- /*
- 2. Present is SETUP(Enable) state, Recfg is modifying SETUP(Enable)
-
- 2.1 Delete UE from the cqiList
- 2.2 Set next occurance Transmission instace to "INVALID"
- 2.3 Compute Next occurance Transmission instace
- 2.4 Placed ue in Transmission instance list.
- */
- if(cqiCb->nCqiTrIdx != RG_SCH_INVALID_IDX )
- cmLListDelFrm(&cellCb->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst,
- &cqiCb->cqiLstEnt);
-
- if(cqiCb->nRiTrIdx != RG_SCH_INVALID_IDX )
- {
- cmLListDelFrm(&cellCb->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst,
- &cqiCb->riLstEnt);
- RG_SCH_RECORD(&cqiCb->histElem,RGSCH_ACTION_DEL,
- &cellCb->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst);
- }
-
-
- cqiCb->cqiLstEnt.next = NULLP;
- cqiCb->cqiLstEnt.prev = NULLP;
- cqiCb->nCqiTrIdx = RG_SCH_INVALID_IDX;
- cqiCb->nRiTrIdx = RG_SCH_INVALID_IDX;
- cqiCb->riDist = RG_SCH_INVALID_IDX;
-
- rgSCHCfgPCqiUeCfg(cellCb, ueCb, cqiCfg, ueCat);
- }
- else
- {
- /* Present is SETUP(Enable) state, Recfg is Release(Disable) */
- rgSCHCfgPCqiUeCfg(cellCb, ueCb, cqiCfg, ueCat);
- }
-
- /* ccpu00140578:: */
- cqiCb->riRecpPrcsd = FALSE;
- return ROK;
-}
-
-
-/* * @brief Handles SRS Re-configuration for a UE.
- *
- * @details
- *
- * Function : rgSCHCfgSrsUeReCfg
- *
- * Invoking Module Processing:
- * - This shall be invoked by SCH_GOM at UE Re configuration. It shall do the
- * validations for the spec-defined values.
- *
- * Processing Steps:
- * - For UE-specific SRS related re configuration,
- * - If SRS is configured modified(First time Enabled),
- * - Update UE with the configured values.
- * - Compute and Update next occurance of SRS Tranmission instance.
- * - Update the SRS offset and SRS perodicity information
- * - Add Ue to cell's list
- * - If SRS is configured modified(Changed offset or index ),
- * - Delete UE from cell->tIUeLstCp[n] if present
- * - Update UE with the configured values.
- * - Compute and Update next occurance of SRS Tranmission instance.
- * - Update the SRS offset and SRS perodicity information
- * - Add Ue to cell's list
- * - If SRS is configured modified(disabled),
- * - Delete UE from cell->tIUeLstCp[n] if present
- * - Update next occurance of SRS Tranmission instance to "INVALID".
- * - Update the SRS offset and SRS perodicity information "INVALID"
- * - else
- * - ROK
- *
- * - Return ROK
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrUeUlSrsCfg *srsCfg
- *
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-S16 rgSCHCfgSrsUeReCfg
-(
-RgSchCellCb *cellCb,
-RgSchUeCb *ueCb,
-RgrUeUlSrsCfg *srsCfg
-)
-{
-
-
- if(( RGR_SCH_SRS_SETUP == srsCfg->type) ||
- ( RGR_SCH_SRS_SETUP != ueCb->srsCb.srsCfg.type ))
- {
- /* 1. Present is Release(Disable) state, Recfg is allowing
- * SETUP(Enable) */
- rgSCHCfgSrsUeCfg(cellCb, ueCb, srsCfg);
- }
- else if (( RGR_SCH_SRS_SETUP == srsCfg->type ) &&
- ( RGR_SCH_SRS_SETUP == ueCb->srsCb.srsCfg.type))
- {
-
- /* 2. Present is SETUP(Eanble) state, Recfg is modifying SETUP(Enable)
-
- 2.1 Delete UE from the cqiList
- 2.2 Set next occurance Transmission instance to "INVALID"
- 2.3 Compute Next occurance Transmission instance
- 2.4 Placed ue in Transmission instance list.
- */
- if (ueCb->srsCb.nSrsTrIdx != RG_SCH_INVALID_IDX)
- {
- cmLListDelFrm(&cellCb->pCqiSrsSrLst[ueCb->srsCb.nSrsTrIdx].srsLst,
- &ueCb->srsCb.srsLstEnt);
- ueCb->srsCb.nSrsTrIdx = RG_SCH_INVALID_IDX;
- }
-
- rgSCHCfgSrsUeCfg(cellCb, ueCb, srsCfg);
- }
- else
- {
- /* 3. Present is SETUP(Enable) state, Recfg is Release(Disable)*/
- rgSCHCfgSrsUeCfg(cellCb, ueCb, srsCfg);
- }
- /* ccpu00140578:: */
- ueCb->srsCb.srsRecpPrcsd = FALSE;
-
- return ROK;
-}
-
-/* @brief Handles SR Re-configuration for a UE.
- *
- * @details
- *
- * Function : rgSCHCfgSrUeReCfg
- *
- * Invoking Module Processing:
- * - This shall be invoked by SCH_GOM at UE Re configuration.
- * It shall do the validations for the spec-defined values.
- *
- * Processing Steps:
- * - For UE-specific SR related re configuration,
- * - If SR is configured modified(First time Enabled),
- * - Update UE with the configured values.
- * - Compute and Update next occurance of SR Tranmission instance.
- * - Update the SR offset and SR perodicity information
- * - Add Ue to cell->tIUeLstCp[n]
- * - If SR is configured modified(Changed offset or index ),
- * - Delete UE from cell->tIUeLstCp[n] if present
- * - Update UE with the configured values.
- * - Compute and Update next occurance of SR Tranmission instance.
- * - Update the SR offset and SR perodicity information
- * - Add Ue to cell->tIUeLstCp[n]
- * - If SR is configured modified(disabled),
- * - Delete UE from cell->tIUeLstCp[n] if present
- * - Update next occurance of SR Tranmission instance to "INVALID".
- * - Update the SR offset and SR perodicity information "INVALID"
- * - else
- * - ROK
- *
- *
- *
- * - Return ROK
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrUeCfg *ueCfg
- *
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-S16 rgSCHCfgSrUeReCfg
-(
-RgSchCellCb *cellCb,
-RgSchUeCb *ueCb,
-RgrUeSrCfg *srCfg
-)
-{
-
- /* Fix : syed Incorrect check for SR RECFG */
- if((srCfg->type == RGR_SCH_SR_SETUP) &&
- (ueCb->srCb.srCfg.type != RGR_SCH_SR_SETUP))
- {
- /*
- 1. Present is Release(Disable) state, Recfg is allowing SETUP(Enable)
- */
- rgSCHCfgSrUeCfg(cellCb, ueCb, srCfg);
- }
- else if((srCfg->type == RGR_SCH_SR_SETUP) &&
- (ueCb->srCb.srCfg.type == RGR_SCH_SR_SETUP))
- {
-
- /* 2. Present is SETUP(Eanble) state, Recfg is modifying SETUP(Enable)
-
- 2.1 Delete UE from the cqiList
- 2.2 Compute Next occurance Transmission instace
- */
- if(ueCb->srCb.nSrTrIdx != RG_SCH_INVALID_IDX )
- {
- cmLListDelFrm(&cellCb->pCqiSrsSrLst[ueCb->srCb.nSrTrIdx].srLst,
- &ueCb->srCb.srLstEnt);
- ueCb->srCb.nSrTrIdx = RG_SCH_INVALID_IDX;
- }
- rgSCHCfgSrUeCfg(cellCb, ueCb, srCfg);
-
- }
- else
- {
- /* 3. Present is SETUP(Enable) state, Recfg is Release(Disable) */
- rgSCHCfgSrUeCfg(cellCb, ueCb, srCfg);
- }
-
- return ROK;
-}
-
-/* @brief Handles ACQI Re-configuration for a UE.
- *
- * @details
- *
- * Function : rgSCHCfgAcqiUeReCfg
- *
- * Invoking Module Processing:
- * - This shall be invoked by SCH_GOM at UE Re configuration.
- * It shall do the validations for the spec-defined values.
- *
- * Processing Steps:
- * - For UE-specific ACQI related re configuration,
- * - Check if the ACQI Mode has been changed from the
- * existing Configuration.
- * - If the configuration has been changed,
- * - Call Aperiodic Config function to change the config
- * - else
- * - ROK
- *
- *
- * - Return ROK
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrUeAprdDlCqiCfg *acqiCfg
- *
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-S16 rgSCHCfgAcqiUeReCfg
-(
-RgSchCellCb *cellCb,
-RgSchUeCb *ueCb,
-RgrUeAprdDlCqiCfg *acqiCfg,
-CmLteUeCategory ueCat
-)
-{
-
- return (rgSCHCfgACqiUeCfg(cellCb,ueCb,(RG_SCH_CMN_GET_ACQICB(ueCb,cellCb))
- ,ueCb->mimoInfo.txMode, acqiCfg, ueCat));
-
-}
-
-/*****************************************************************
- * UE PCQI, RI, SRS and SR Configuration Delete *
- * *
- *****************************************************************/
-
-/* @brief Free Periodic CQI/PMI/RI, SRS and SR transmission instance
- * related data structures of this UE from CellCb
- *
- * @details
- *
- * Function : rgSCHCfgPCqiSrsSrUeDel
- *
- * Invoking Module Processing:
- * - This shall be invoked by SCH_GOM at Ue deletion.
- *
- * Processing Steps:
- * - For SRS Transmission Instance
- * - if (srsTxInst!= RG_INVALID)
- * - Remove from the cellCb->tIUeLstCp[srsTxInst*3+2]
- * - else
- * - Nothing to do
- * - For SR Transmission Instance
- * - if (srTxInst!= RG_INVALID)
- * - Remove from the cellCb->tIUeLstCp[srTxInst*3+1]
- * - else
- * - Nothing to do
- * - For Periodic CQI/PMI RI Transmission Instance
- * - if (pCqiTxInst!= RG_INVALID)
- * - Remove from the cellCb->tIUeLstCp[srTxInst*3+0]
- * - else
- * - Nothing to do
- * - Return ROK
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- *
- * @return S16
- * -# ROK
- */
-S16 rgSCHCfgPCqiSrsSrUeDel
-(
-RgSchCellCb *cellCb,
-RgSchUeCb *ueCb
-)
-{
-#ifdef LTE_ADV
- uint32_t cellIdx;
- uint32_t sCellCnt = 0;
-#endif
- RgSchUePCqiCb *cqiRiCb = NULLP;
-
- cqiRiCb = RG_SCH_GET_UE_CELL_CQI_CB(ueCb,cellCb);
-
-
-
- /* Delete SRS Transmission Instance */
- if (ueCb->srsCb.nSrsTrIdx != RG_SCH_INVALID_IDX)
- {
- cmLListDelFrm(&cellCb->pCqiSrsSrLst[ueCb->srsCb.nSrsTrIdx].srsLst,
- &ueCb->srsCb.srsLstEnt);
- ueCb->srsCb.nSrsTrIdx = RG_SCH_INVALID_IDX;
- }
-
- /* Delete SR Transmission Instance */
- if (ueCb->srCb.nSrTrIdx != RG_SCH_INVALID_IDX)
- {
- cmLListDelFrm(&cellCb->pCqiSrsSrLst[ueCb->srCb.nSrTrIdx].srLst,
- &ueCb->srCb.srLstEnt);
- ueCb->srCb.nSrTrIdx = RG_SCH_INVALID_IDX;
- }
-
- /* Delete Periodic CQI/PMI Transmission Instance */
- if (cqiRiCb->nCqiTrIdx != RG_SCH_INVALID_IDX)
- {
- cmLListDelFrm(&cellCb->pCqiSrsSrLst[cqiRiCb->nCqiTrIdx].cqiLst,
- &cqiRiCb->cqiLstEnt);
- cqiRiCb->nCqiTrIdx = RG_SCH_INVALID_IDX;
-
- /* Delete Periodic RI Transmission Instance */
-
- if (cqiRiCb->nRiTrIdx != RG_SCH_INVALID_IDX)
- {
- cmLListDelFrm(&cellCb->pCqiSrsSrLst[cqiRiCb->nRiTrIdx].riLst,
- &cqiRiCb->riLstEnt);
- RG_SCH_RECORD(&cqiRiCb->histElem,RGSCH_ACTION_DEL,
- &cellCb->pCqiSrsSrLst[cqiRiCb->nRiTrIdx].riLst);
- cqiRiCb->nRiTrIdx = RG_SCH_INVALID_IDX;
- }
- }
-
-#ifdef LTE_ADV
- for (cellIdx =1; cellIdx <= RG_SCH_MAX_SCELL; cellIdx++)
- {
- /* If a serving cell is configured */
- if(ueCb->cellInfo[cellIdx] != NULLP)
- {
- /* If the serving cell is in ACTIVE state and
- If it is not the same serving cell as cqiRiCb for which
- collision is being checked */
- cqiRiCb = &ueCb->cellInfo[cellIdx]->cqiCb;
- /* Delete Periodic CQI/PMI Transmission Instance */
- if (cqiRiCb->nCqiTrIdx != RG_SCH_INVALID_IDX)
- {
- cmLListDelFrm(&cellCb->pCqiSrsSrLst[cqiRiCb->nCqiTrIdx].cqiLst,
- &cqiRiCb->cqiLstEnt);
- cqiRiCb->nCqiTrIdx = RG_SCH_INVALID_IDX;
-
- /* Delete Periodic RI Transmission Instance */
-
- if (cqiRiCb->nRiTrIdx != RG_SCH_INVALID_IDX)
- {
- cmLListDelFrm(&cellCb->pCqiSrsSrLst[cqiRiCb->nRiTrIdx].riLst,
- &cqiRiCb->riLstEnt);
- RG_SCH_RECORD(&cqiRiCb->histElem,RGSCH_ACTION_DEL,
- &cellCb->pCqiSrsSrLst[cqiRiCb->nRiTrIdx].riLst);
- cqiRiCb->nRiTrIdx = RG_SCH_INVALID_IDX;
- }
- }
- sCellCnt++;
- /* If all of the num of configured scells are checked then break */
- if (sCellCnt == ueCb->numSCells)
- {
- break;
- }
- }
- }
-#endif
-
- return ROK;
-}
-
-
-/* @brief Search the cfgIdx in given table and retrive periodicity & offset
- * @details
- *
- * Function : rgSCHUtlGetCfgPerOff
- *
- * Invoking Module Processing:
- * - This shall be invoked by Cfg Module
- *
- * Processing Steps:
- * binary search for given entry in table
- * find the periodicty, offset for a given config index from the table
- * - Return ROK
- * @param[in] RgSchPerTbl tbl
- * @param[in] uint16_t cfgIdx
- * @param[out] uint16_t *peri
- * @param[out] uint16_t *offset
- *
- * @return S16
- * -# ROK
- *
- */
-S16 rgSCHUtlGetCfgPerOff
-(
-RgSchPerTbl tbl,
-uint16_t cfgIdx,
-uint16_t *peri,
-uint16_t *offset
-)
-{
- uint8_t mid;
- uint8_t min = 0;
- uint8_t max = 0;
- const RgSchUePCqiSrsSrCfgIdxTbl* table;
-
- /* Added the function instead of the MACRO to get the
- * periodicity table */
- table = rgSCHCfgUtlGetPcqiSrsSrRiTbl ( tbl,&min,&max );
- do{
- mid = (min+max)/2;
- if (( cfgIdx >= table[mid].min) &&
- ( cfgIdx <= table[mid].max))
- {
- *peri = table[mid].peri;
- *offset = cfgIdx - table[mid].offset;
- break;
- }
-
- if ( cfgIdx > table[mid].min)
- {
- min = mid+1;
- }
- else
- {
- max = mid-1;
- }
-
- }while( min <= max );
-
- return ROK;
-}
-
-
-/***********************************************************
- *
- * Func : rgSCHCfgUtlFetchAcqiBitSz
- *
- *
- * Desc : Fetch the CQI/PMI bits for a UE based on the mode and store them
- * for decoding.
- *
- * Ret : Void
- * ROK - void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHCfgUtlFetchAcqiBitSz
-(
-RgSchUeACqiCb *acqiCb,
-uint8_t numTxAnt,
-uint8_t* cqiPmiSzR1,
-uint8_t* cqiPmiSzRn1
-)
-{
-
- uint32_t confRepMode;
-
- confRepMode = acqiCb->aCqiCfg.aprdModeEnum;
- switch(confRepMode)
- {
- case RGR_APRD_CQI_MOD12:
- {
- if(numTxAnt == 2)
- {
- *cqiPmiSzR1 = 4 + 2*acqiCb->N;
- *cqiPmiSzRn1 = 8+ acqiCb->N;
- }
- else if(numTxAnt == 4)
- {
- *cqiPmiSzR1 = 4 + 4*acqiCb->N;
- *cqiPmiSzRn1 = 8 + 4*acqiCb->N;
- }
- }
- break;
-
- case RGR_APRD_CQI_MOD20:
- {
- *cqiPmiSzR1 = 6 + acqiCb->L;
- *cqiPmiSzRn1 = 6 + acqiCb->L;
- }
- break;
-
- case RGR_APRD_CQI_MOD22:
- {
- if(numTxAnt == 2)
- {
- *cqiPmiSzR1 = 10 + acqiCb->L;
- *cqiPmiSzRn1 = 14 + acqiCb->L;
- }
- else if(numTxAnt == 4)
- {
- *cqiPmiSzR1 = 14 + acqiCb->L;
- *cqiPmiSzRn1 = 20 + acqiCb->L;
- }
- }
- break;
-
- case RGR_APRD_CQI_MOD30:
- {
- *cqiPmiSzR1 = 4 + 2*acqiCb->N;
- *cqiPmiSzRn1 = 4 + 2*acqiCb->N;
- }
- break;
-
- case RGR_APRD_CQI_MOD31:
- {
- if(numTxAnt == 2)
- {
- *cqiPmiSzR1 = 6 + 2*acqiCb->N;
- *cqiPmiSzRn1 = 9 + 4*acqiCb->N;
- }
- else if(numTxAnt == 4)
- {
- *cqiPmiSzR1 = 8 + 2*acqiCb->N;
- *cqiPmiSzRn1 = 12 + 4*acqiCb->N;
- }
- }
- break;
- default:
- break;
- }
- return;
-}
-/* Added the function rgSCHCfgUtlGetPcqiCrsSrRiTbl to be used
- * instead of the MACRO RG_SCH_GET_PERIODICITY_TBL */
-/***********************************************************
- *
- * Func : rgSCHCfgUtlGetPcqiCrsSrRiTbl
- *
- *
- * Desc : Get the Srs Cqi Crs Ri Table
- *
- * Ret : Void
- * ROK - void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-
-static const RgSchUePCqiSrsSrCfgIdxTbl * rgSCHCfgUtlGetPcqiSrsSrRiTbl
-(
-RgSchPerTbl tblType,
-uint8_t* min,
-uint8_t* max
-)
-{
- const RgSchUePCqiSrsSrCfgIdxTbl * table;
-
- switch (tblType)
- {
-
- case RG_SCH_FDD_PCQI_TBL:
- {
- table = rgSchUePCqiCfgIdxFddTbl;
- * min = 0;
- * max=RG_SCH_CQIPMI_CFGIDX_MAX_FDD;
- break;
- }
- case RG_SCH_TDD_PCQI_TBL:
- {
- table = rgSchUeCqiPmiCfgIdxTddTbl;
- * min = 0;
- * max=RG_SCH_CQIPMI_CFGIDX_MAX_TDD;
- break;
- }
- case RG_SCH_RI_TBL:
- {
- table = rgSchUeRiCfgIdxTbl;
- * min = 0;
- * max=RG_SCH_RI_CFGIDX_MAX;
- break;
- }
- case RG_SCH_FDD_SRS_TBL:
- {
- table = rgSchUeSrsCfgIdxFddTbl;
- * min = 0;
- * max=RG_SCH_SRS_ISRS_INDX_MAX_FDD;
- break;
- }
- case RG_SCH_TDD_SRS_TBL:
- {
- table = rgSchUeSrsCfgIdxTddTbl;
- * min = 0;
- * max=RG_SCH_SRS_ISRS_INDX_MAX_TDD;
- break;
- }
- case RG_SCH_SR_TBL:
- {
- table = rgSchUeSrCfgIdxTbl;
- * min = 0;
- * max=RG_SCH_ISR_INDX_MAX;
- break;
- }
- default:
- {
- table = (const RgSchUePCqiSrsSrCfgIdxTbl *) 0;
- * min = 0;
- * max = 0;
- break;
- }
-
- }
- return ( table );
-}
-/* #endif */
-#endif /* TFU_UPGRADE */
-
-/***********************************************************
- *
- * Func : rgSCHCfgVldtDrxUeCfg
- *
- *
- * Desc : Validates UE DRX Timers Configuration recieved from RRC.
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCfgVldtDrxUeCfg
-(
-RgSchCellCb *cell,
-RgrUeDrxCfg *ueDrxCfg
-)
-{
-
- if (ueDrxCfg->isDrxEnabled == FALSE)
- {
- return ROK;
- }
-
-#ifdef LTEMAC_R9
- if ( ueDrxCfg->cqiMask.pres )
- {
- if ( ueDrxCfg->cqiMask.val != RGR_DRX_SETUP )
- {
-#ifdef ALIGN_64BIT
- DU_LOG("\nERROR --> SCH : Invalid cqiMask configuration (%d)",
- ueDrxCfg->cqiMask.val);
-#else
- DU_LOG("\nERROR --> SCH : Invalid cqiMask configuration(%ld)",
- ueDrxCfg->cqiMask.val);
-#endif
- return RFAILED;
- }
- }
-#endif /*LTEMAC_R9*/
-#ifdef EMTC_ENABLE
- if(ueDrxCfg->isEmtcUe)
- {
- if(ueDrxCfg->drxOnDurTmrR13Pres)
- {
- if ( rgSCHEmtcCfgVldtDrxOnDurCfg(ueDrxCfg->drxOnDurTmr) != ROK )
- {
- DU_LOG("\nERROR --> SCH : Invalid onDurTimer configuration(%d)",
- ueDrxCfg->drxOnDurTmr);
- return RFAILED;
- }
- }
- else
- {
- if (rgSCHCfgVldtDrxOnDurCfg(ueDrxCfg->drxOnDurTmr) != ROK )
- {
- DU_LOG("\nERROR --> SCH : Invalid onDurTimer configuration(%d) for EMTC",
- ueDrxCfg->drxOnDurTmr);
- return RFAILED;
- }
-
- }
- }
- else
-#endif
- {
- if ( rgSCHCfgVldtDrxOnDurCfg(ueDrxCfg->drxOnDurTmr) != ROK )
- {
- DU_LOG("\nERROR --> SCH : Invalid onDurTimer configuration(%d) for EMTC",
- ueDrxCfg->drxOnDurTmr);
- return RFAILED;
- }
- }
-
- if ( rgSCHCfgVldtDrxInActvCfg(ueDrxCfg->drxInactvTmr) != ROK )
- {
- DU_LOG("\nERROR --> SCH : Invalid Inactivity configuration(%d)",
- ueDrxCfg->drxInactvTmr);
- return RFAILED;
- }
-#ifdef EMTC_ENABLE
- if(ueDrxCfg->isEmtcUe)
- {
- if(ueDrxCfg->drxRetxTmrR13Pres)
- {
- if ( rgSCHEmtcCfgVldtDrxReTxCfg(ueDrxCfg->drxRetxTmr) != ROK )
- {
- DU_LOG("\nERROR --> SCH : Invalid DrxReTX configuration(%d) for EMTC",
- ueDrxCfg->drxRetxTmr);
- return RFAILED;
- }
- }
- else
- {
- if (rgSCHCfgVldtDrxReTxCfg(ueDrxCfg->drxRetxTmr) != ROK )
- {
- DU_LOG("\nERROR --> SCH : Invalid DrxReTX configuration(%d)",
- ueDrxCfg->drxRetxTmr);
- return RFAILED;
- }
-
- }
- }
- else
-#endif
- {
- if ( rgSCHCfgVldtDrxReTxCfg(ueDrxCfg->drxRetxTmr) != ROK )
- {
- DU_LOG("\nERROR --> SCH : Invalid DrxReTX configuration(%d)",
- ueDrxCfg->drxRetxTmr);
- return RFAILED;
- }
- }
-#ifdef EMTC_ENABLE
- if(ueDrxCfg->isEmtcUe)
- {
- if ( rgSCHEmtcCfgVldtDrxUlReTxCfg(ueDrxCfg->emtcDrxUlRetxTmr) != ROK )
- {
- DU_LOG("\nERROR --> SCH : Invalid DrxReTX configuration(%d) for EMTC",
- ueDrxCfg->drxRetxTmr);
- return RFAILED;
- }
-
- }
-#endif
-
- if ( rgSCHCfgVldtDrxLngCycCfg(ueDrxCfg->drxLongCycleOffst) != ROK )
- {
- DU_LOG("\nERROR --> SCH : Invalid LongCycle configuration");
- return RFAILED;
- }
-
- if ( ueDrxCfg->drxLongCycleOffst.longDrxCycle < ueDrxCfg->drxOnDurTmr )
- {
- DU_LOG("\nERROR --> SCH : Invalid combination of Long DRX Cycle "
- " and onDuration timer values");
- return RFAILED;
- }
-
-#ifdef LTE_TDD
- if( rgSCHCfgVldtTddDrxCycCfg(cell, ueDrxCfg->drxLongCycleOffst.longDrxCycle,
- ueDrxCfg->drxOnDurTmr, ueDrxCfg->drxLongCycleOffst.drxStartOffst) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Invalid combination of Long DRX Cycle "
- " and onDuration timer values");
- return RFAILED;
- }
-#endif
-
- if( TRUE == ueDrxCfg->drxShortDrx.pres )
- {
- if ( ueDrxCfg->drxShortDrx.shortDrxCycle < ueDrxCfg->drxOnDurTmr )
- {
- DU_LOG("\nERROR --> SCH : Invalid combination of short DRX "
- "Cycle and onDuration timer values");
- return RFAILED;
- }
-
- if ( (ueDrxCfg->drxLongCycleOffst.longDrxCycle %
- ueDrxCfg->drxShortDrx.shortDrxCycle) != 0)
- {
- DU_LOG("\nERROR --> SCH : Long DRX cycle is not multiple of "
- "short DRX cycle");
- return RFAILED;
- }
-
- if ( rgSCHCfgVldtDrxShrtCycCfg(ueDrxCfg->drxShortDrx) != ROK )
- {
- DU_LOG("\nERROR --> SCH : Invalid Short Cycle configuration");
- return RFAILED;
- }
-
-#ifdef LTE_TDD
- if( rgSCHCfgVldtTddDrxCycCfg(cell, ueDrxCfg->drxShortDrx.shortDrxCycle,
- ueDrxCfg->drxOnDurTmr,
- ueDrxCfg->drxLongCycleOffst.drxStartOffst %
- ueDrxCfg->drxShortDrx.shortDrxCycle) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Invalid combination of Long DRX Cycle "
- " and onDuration timer values");
- return RFAILED;
- }
-#endif
- }
-
- return ROK;
-}/*rgSCHCfgVldtDrxUeCfg*/
-
-/***********************************************************
- *
- * Func : rgSCHCfgVldtDrxOnDurCfg
- *
- *
- * Desc : Validates UE DRX On Duration configuration
- * recieved from RRC.
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCfgVldtDrxOnDurCfg
-(
-uint8_t onDurTmr
-)
-{
-
- switch ( onDurTmr )
- {
- case RGR_DRX_PRD_1PSF:
- case RGR_DRX_PRD_2PSF:
- case RGR_DRX_PRD_3PSF:
- case RGR_DRX_PRD_4PSF:
- case RGR_DRX_PRD_5PSF:
- case RGR_DRX_PRD_6PSF:
- case RGR_DRX_PRD_8PSF:
- case RGR_DRX_PRD_10PSF:
- case RGR_DRX_PRD_20PSF:
- case RGR_DRX_PRD_30PSF:
- case RGR_DRX_PRD_40PSF:
- case RGR_DRX_PRD_50PSF:
- case RGR_DRX_PRD_60PSF:
- case RGR_DRX_PRD_80PSF:
- case RGR_DRX_PRD_100PSF:
- case RGR_DRX_PRD_200PSF:
- break;
-
- default:
- {
- return RFAILED;
- }
- }/*switch(onDurTmr)*/
-
- return ROK;
-}/*rgSCHCfgVldtOnDurCfg*/
-
-/***********************************************************
- *
- * Func : rgSCHCfgVldtDrxInActvCfg
- *
- *
- * Desc : Validates UE DRX InActivity configuration
- * recieved from RRC.
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCfgVldtDrxInActvCfg(uint16_t inActvTmr)
-{
- switch ( inActvTmr )
- {
- case RGR_DRX_PRD_1PSF:
- case RGR_DRX_PRD_2PSF:
- case RGR_DRX_PRD_3PSF:
- case RGR_DRX_PRD_4PSF:
- case RGR_DRX_PRD_5PSF:
- case RGR_DRX_PRD_6PSF:
- case RGR_DRX_PRD_8PSF:
- case RGR_DRX_PRD_10PSF:
- case RGR_DRX_PRD_20PSF:
- case RGR_DRX_PRD_30PSF:
- case RGR_DRX_PRD_40PSF:
- case RGR_DRX_PRD_50PSF:
- case RGR_DRX_PRD_60PSF:
- case RGR_DRX_PRD_80PSF:
- case RGR_DRX_PRD_100PSF:
- case RGR_DRX_PRD_200PSF:
- case RGR_DRX_PRD_300PSF:
- case RGR_DRX_PRD_500PSF:
- case RGR_DRX_PRD_750PSF:
- case RGR_DRX_PRD_1280PSF:
- case RGR_DRX_PRD_1920PSF:
- case RGR_DRX_PRD_2560PSF:
- break;
-
- default:
- {
- return RFAILED;
- }
- }/*switch(InactvTmr)*/
-
- return ROK;
-}/*rgSCHCfgVldtDrxInActvCfg*/
-
-/***********************************************************
- *
- * Func : rgSCHCfgVldtDrxReTxCfg
- *
- *
- * Desc : Validates DRX ReTx timer configuration
- * recieved from RRC.
- *
- * Ret : S16
- * ROK - Success
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCfgVldtDrxReTxCfg(uint8_t reTxTmr)
-{
- switch ( reTxTmr )
- {
- case RGR_DRX_PRD_1PSF:
- case RGR_DRX_PRD_2PSF:
- case RGR_DRX_PRD_4PSF:
- case RGR_DRX_PRD_6PSF:
- case RGR_DRX_PRD_8PSF:
- case RGR_DRX_PRD_16PSF:
- case RGR_DRX_PRD_24PSF:
- case RGR_DRX_PRD_33PSF:
- break;
-
- default:
- {
- return RFAILED;
- }
- }/*switch(drxRetxTmr)*/
-
- return ROK;
-}/*rgSCHCfgVldtDrxReTxCfg*/
-
-/***********************************************************
- *
- * Func : rgSCHCfgVldtDrxShrtCycCfg
- *
- *
- * Desc : Validates DRX Short Cycle timer configuration
- * recieved from RRC.
- *
- * Ret : S16
- * ROK - Success
- *
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCfgVldtDrxLngCycCfg(RgrDrxLongCycleOffst lngCycleOffst)
-{
- if ( rgSCHCfgVldtDrxLngCyclTmrs(lngCycleOffst.longDrxCycle) != ROK )
- {
- return RFAILED;
- }
-
- if ( lngCycleOffst.drxStartOffst >= lngCycleOffst.longDrxCycle )
- {
- return RFAILED;
- }
-
- return ROK;
-}/*rgSCHCfgVldtDrxLngCycCfg*/
-
-/***********************************************************
- *
- * Func : rgSCHCfgVldtDrxLngCyclTmrs
- *
- *
- * Desc : Validates DRX Long Cycle timer values
- * recieved from RRC.
- *
- * Ret : S16
- * ROK - Success
- *
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCfgVldtDrxLngCyclTmrs(uint16_t val)
-{
-
- switch ( val )
- {
- case RGR_DRX_PRD_10SF:
- case RGR_DRX_PRD_20SF:
- case RGR_DRX_PRD_32SF:
- case RGR_DRX_PRD_40SF:
- case RGR_DRX_PRD_64SF:
- case RGR_DRX_PRD_80SF:
- case RGR_DRX_PRD_128SF:
- case RGR_DRX_PRD_160SF:
- case RGR_DRX_PRD_256SF:
- case RGR_DRX_PRD_320SF:
- case RGR_DRX_PRD_512SF:
- case RGR_DRX_PRD_640SF:
- case RGR_DRX_PRD_1024SF:
- case RGR_DRX_PRD_1280SF:
- case RGR_DRX_PRD_2048SF:
- case RGR_DRX_PRD_2560SF:
- break;
-
- default:
- {
- return RFAILED;
- }
- }/*switch(longDrxCycle)*/
-
- return ROK;
-}/*rgSCHCfgVldtDrxLngCyclTmrs*/
-
-/***********************************************************
- *
- * Func : rgSCHCfgVldtDrxShrtCycCfg
- *
- *
- * Desc : Validates DRX Short Cycle timer configuration
- * recieved from RRC.
- *
- * Ret : S16
- * ROK - Success
- *
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCfgVldtDrxShrtCycCfg(RgrDrxShortDrx shrtCycCfg )
-{
- switch(shrtCycCfg.shortDrxCycle)
- {
- case RGR_DRX_PRD_2SF:
- case RGR_DRX_PRD_5SF:
- case RGR_DRX_PRD_8SF:
- case RGR_DRX_PRD_10SF:
- case RGR_DRX_PRD_16SF:
- case RGR_DRX_PRD_20SF:
- case RGR_DRX_PRD_32SF:
- case RGR_DRX_PRD_40SF:
- case RGR_DRX_PRD_64SF:
- case RGR_DRX_PRD_80SF:
- case RGR_DRX_PRD_128SF:
- case RGR_DRX_PRD_160SF:
- case RGR_DRX_PRD_256SF:
- case RGR_DRX_PRD_320SF:
- case RGR_DRX_PRD_640SF:
- break;
-
- default:
- {
- return RFAILED;
- }
-
- }/*switch(shortDrxCycle)*/
-
- if ( (shrtCycCfg.drxShortCycleTmr < RGR_DRX_SHRTCYCLE_MIN) ||
- (shrtCycCfg.drxShortCycleTmr > RGR_DRX_SHRTCYCLE_MAX)
- )
- {
- return RFAILED;
- }
-
- return ROK;
-}
-
-/**
- * @brief Handler for TA related UE Reconfiguration.
- *
- * @details
- *
- * Function : rgSCHCfgUeTaRecfg
- *
- * This function shall fetch the TA timer related information into the
- * respective ueCb from the UE configuration as provided by the
- * upper layers.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ueCb
- * @param[in] RgrUeCfg *ueCfg
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static Void rgSCHCfgUeTaRecfg
-(
-RgSchCellCb *cell,
-RgSchUeCb *ueCb,
-RgrUeRecfg *ueCfg,
-RgSchErrInfo *err
-)
-{
- UNUSED(err);
-
- /* Update the TA related information */
-
- if (ueCfg->ueTaTmrRecfg.pres)
- {
- /* Configuring taTmr with 30 deficit, to enable eNodeB sending
- * TA command before the expiry of TA at UE. Also considering for
- * possible retx for this TA command */
- /* [ccpu00121813]-ADD-Added chk if tatmr val > 30 */
- if(ueCfg->ueTaTmrRecfg.taTmr > 30)
- {
- ueCb->dl.taCb.cfgTaTmr = ueCfg->ueTaTmrRecfg.taTmr - 30;
- }
- /* If TA Timer is running. Stop it and then start it*/
- if (ueCb->taTmr.tmrEvnt != TMR_NONE)
- {
- rgSCHTmrStopTmr(cell, ueCb->taTmr.tmrEvnt, ueCb);
- rgSCHTmrStartTmr(cell, ueCb, RG_SCH_TMR_TA, ueCb->dl.taCb.cfgTaTmr);
- }
- else
- {
- rgSCHTmrStartTmr(cell, ueCb, RG_SCH_TMR_TA, ueCb->dl.taCb.cfgTaTmr);
- }
- }
- return;
-} /* rgSCHCfgUeTaRecfg */
-
-/* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#if ((defined (RGR_CQI_REPT)) && (defined (RGR_V2)))
-/***********************************************************
- *
- * Func : rgSCHCfgUeCqiReptReCfg
- *
- *
- * Desc : Reconfiguration of PUSH N CQI Reporting
- *
- * Ret : RFAILED in case of failure
- * ROK if success
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCfgUeCqiReptReCfg
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeRecfg *ueRecfg
-)
-{
- S16 retVal;
-
- /* Check has it been disabled */
- if(ueRecfg->ueCqiReptCfg.numColltdCqiRept)
- {
- /* Check if we need to send CQI reports collagted so far and send if so */
- if(ue->schCqiInfo.cqiCount >=
- ueRecfg->ueCqiReptCfg.numColltdCqiRept)
- {
- RgrStaIndInfo *staInfo;
- /* if yes, Send StaInd to RRM */
- retVal = rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&staInfo,
- sizeof(RgrStaIndInfo));
- if(retVal != ROK)
- {
- DU_LOG("\nERROR --> SCH : Could not allocate memory for sending StaInd OLD CRNTI:%d",ueRecfg->oldCrnti);
- return (retVal);
- }
-
- /* Fill StaInd for sending collated N CQI rpeort */
- rgSCHUtlFillSndStaInd(cell, ue, staInfo,
- ueRecfg->ueCqiReptCfg.numColltdCqiRept);
- }
- }
- else
- {
- ue->schCqiInfo.cqiCount = 0;
- }
-
- ue->cqiReptCfgInfo.numColltdCqiRept =
- ueRecfg->ueCqiReptCfg.numColltdCqiRept;
- return ROK;
-} /* End of rgSCHCfgUeCqiReptReCfg */
-#endif /* End of RGR_CQI_REPT */
-/*This function Added Ue in ongoing L2 Meas*/
-/*LTE_L2_MEAS_PHASE2*/
-#ifdef LTE_L2_MEAS
-static S16 rgSchAddToL2Meas(RgSchCellCb *cellCb,RgSchDlLcCb *dlLc)
-{
- CmLList *lnk;
- uint16_t idx;
- RgSchL2MeasCb *measCb = NULLP;
- lnk = cellCb->l2mList.first;
-
- while(lnk != NULLP)
- {
- /* Get the MeasCb : RgSchL2MeasCb */
- measCb = (RgSchL2MeasCb *)lnk->node;
- if (measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_PER_QCI_DL)
- {
- for(idx = 0;idx < measCb->measReq.avgPrbQciDl.numQci;idx++)
- {
- if(measCb->measReq.avgPrbQciDl.qci[idx] == dlLc->qciCb->qci)
- {
- break; /*exit from for loop*/
- }
- }
- if(idx == measCb->measReq.avgPrbQciDl.numQci)
- {
- measCb->measReq.avgPrbQciDl.qci[measCb->measReq.avgPrbQciDl.numQci++] = dlLc->qciCb->qci;
- }
- }
- lnk = lnk->next;
- }/*End of while loop*/
-
- return ROK;
-}
-#endif
-#ifdef LTE_ADV
-/**
- * @brief UE SCell Buffer Free
- *
- * @details
- *
- * Function : rgSCHSCellFreeBuf
- *
- * This functions will free allocated memory
- * for UE secondart cellCB
- *
- *
- * @param[in] Inst inst
- * @param[in] RgSchUeCb *ue
- * @param[int] RgrUeRecfg *ueRecfg
- * @param[out] uint8_t idx
- * @return VOID
- **/
-Void rgSCHSCellFreeBuf
-(
-Inst inst,
-RgSchUeCb *ue,
-RgrUeRecfg *ueRecfg,
-uint8_t idx
-)
-{
- RgSchUeCellInfo *sCellInfo = NULLP;
- RgrUeSecCellCfg *sCellInfoRecfg = NULLP;
-
-
- for(uint8_t i = 0; i <= idx; i++)
- {
- sCellInfoRecfg = &ueRecfg->ueSCellCfgInfo.ueSCellDedCfg[i];
- sCellInfo = ue->cellInfo[(sCellInfoRecfg->sCellIdx)];
-
- if (NULLP != sCellInfo)
- {
- rgSCHUtlFreeSBuf(inst, (Data**)&(sCellInfo),
- sizeof(RgSchUeCellInfo));
- ue->cellInfo[(sCellInfoRecfg->sCellIdx)] = NULLP;
-
- }
- }
- return;
-}
-#endif
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/********************************************************************20**
-
- Name: common - linked list functions
-
- Type: C include file
-
- Desc: Structures, variables and typedefs required by the
- linked list management routines.
-
- File: rg_sch_clist.x
-
-*********************************************************************21*/
-
-#ifndef __RGSCHRRCLIST__
-#define __RGSCHRRCLIST__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-typedef struct rgSchRrCList RgSchRrCList;
-typedef struct rgSchRrCListCp RgSchRrCListCp;
-
-/* doubly linked list */
-struct rgSchRrCList
-{
- RgSchRrCList *next; /* next */
- RgSchRrCList *prev; /* previous */
- PTR node; /* node */
-};
-
-struct rgSchRrCListCp
-{
- RgSchRrCList *first; /* first entry in list */
- RgSchRrCList *crnt; /* entry last accessed */
- uint32_t count; /* number of entries */
-};
-
-Void rgSCHRrCListInit ARGS ((RgSchRrCListCp *lList));
-Void rgSCHRrCListAdd2Tail ARGS ((RgSchRrCListCp *lList, \
- RgSchRrCList *node));
-/* Renamed functions to start with rgSCH */
-RgSchRrCList *rgSCHRrCListDelFrm ARGS ((RgSchRrCListCp *lList, \
- RgSchRrCList *node));
-Void rgSCHRrCListInsrtAtCrnt ARGS ((RgSchRrCListCp *lList, \
- RgSchRrCList *node));
-/* LTE_ADV_FLAG_REMOVED_START */
-Void rgSCHRrCListAdd2Crnt ARGS ((RgSchRrCListCp *lList, \
- RgSchRrCList *node));
-/* LTE_ADV_FLAG_REMOVED_END */
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __RRCLIST__ */
-
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Entry point fucntions
-
- File: rg_sch_cmn.c
-
-**********************************************************************/
-
-/** @file rg_sch_cmn.c
-@brief This file implements the schedulers main access to MAC layer code.
-*/
-
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "lrg.h"
-#include "rgr.h"
-#include "tfu.h"
-#include "rgm.h"
-#include "rg_env.h"
-#include "rg_sch_err.h"
-#include "rg_sch_inf.h"
-#include "rg_sch.h"
-#include "rg_sch_cmn.h"
-/* header/extern include files (.x) */
-#include "tfu.x" /* TFU types */
-#include "lrg.x" /* layer management typedefs for MAC */
-#include "rgr.x" /* layer management typedefs for MAC */
-#include "rgm.x" /* layer management typedefs for MAC */
-#include "rg_sch_inf.x" /* typedefs for Scheduler */
-#include "rg_sch.x" /* typedefs for Scheduler */
-#include "rg_sch_cmn.x" /* typedefs for Scheduler */
-#include "sch_utils.h"
-#ifdef MAC_SCH_STATS
-#include "lrg.x" /* Stats Structures */
-#endif /* MAC_SCH_STATS */
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#ifdef EMTC_ENABLE
-uint32_t emtcStatsUlTomSrInd;
-uint32_t emtcStatsUlBsrTmrTxp;
-#endif
-
-#define RG_ITBS_DIFF(_x, _y) ((_x) > (_y) ? (_x) - (_y) : (_y) - (_x))
-Void rgSCHSc1UlInit ARGS((RgUlSchdApis *apis));
-#ifdef RG_PHASE2_SCHED
-Void rgSCHRrUlInit ARGS((RgUlSchdApis *apis));
-#ifdef EMTC_ENABLE
-Void rgSCHEmtcHqInfoFree ARGS((RgSchCellCb *cell, RgSchDlHqProcCb *hqP));
-Void rgSCHEmtcRrUlInit ARGS((RgUlSchdApis *apis));
-Void rgSCHEmtcCmnDlInit ARGS((Void));
-Void rgSCHEmtcCmnUlInit ARGS((Void));
-Void rgSCHEmtcCmnUeNbReset ARGS((RgSchUeCb *ueCb));
-RgSchCmnCqiToTbs *rgSchEmtcCmnCqiToTbs[RGSCH_MAX_NUM_LYR_PERCW][RG_SCH_CMN_MAX_CP][RG_SCH_CMN_MAX_CFI];
-#endif
-Void rgSCHMaxciUlInit ARGS((RgUlSchdApis *apis));
-Void rgSCHPfsUlInit ARGS((RgUlSchdApis *apis));
-#endif
-Void rgSCHSc1DlInit ARGS((RgDlSchdApis *apis));
-#ifdef RG_PHASE2_SCHED
-Void rgSCHRrDlInit ARGS((RgDlSchdApis *apis));
-#ifdef EMTC_ENABLE
-Void rgSCHEmtcRrDlInit ARGS((RgDlEmtcSchdApis *apis));
-#endif
-Void rgSCHMaxciDlInit ARGS((RgDlSchdApis *apis));
-Void rgSCHPfsDlInit ARGS((RgDlSchdApis *apis));
-#ifdef TFU_UPGRADE
-Void rgSCHDlfsInit ARGS((RgDlfsSchdApis *apis));
-#endif
-#endif
-#ifdef EMTC_ENABLE
-Void rgSCHCmnGetCqiEmtcDciFrmt2AggrLvl ARGS((RgSchCellCb *cell));
-Void rgSCHCmnGetEmtcDciFrmtSizes ARGS((RgSchCellCb *cell));
-Void rgSCHEmtcRrUlProcRmvFrmRetx ARGS((RgSchCellCb *cell, RgSchUlHqProcCb *proc));
-S16 rgSCHCmnPrecompEmtcMsg3Vars
-ARGS((
-RgSchCmnUlCell *cellUl,
-uint8_t ccchCqi,
-uint16_t msgSzA,
-uint8_t sbSize,
-Bool isEcp
-));
-Void rgSCHEmtcCmnUeCcchSduDel
-(
-RgSchCellCb *cell,
-RgSchUeCb *ueCb
-);
-Void rgSCHEmtcRmvFrmTaLst
-(
-RgSchCmnDlCell *cellDl,
-RgSchUeCb *ue
-);
-Void rgSCHEmtcInitTaLst
-(
-RgSchCmnDlCell *cellDl
-);
-Void rgSCHEmtcAddToTaLst
-(
-RgSchCmnDlCell *cellDl,
-RgSchUeCb *ue
-);
-
-#endif
-
-#ifdef RGR_SI_SCH
-static Void rgSCHDlSiSched ARGS((RgSchCellCb *cell,
- RgSchCmnDlRbAllocInfo *allocInfo,
- RgInfSfAlloc *subfrmAlloc));
-static Void rgSCHChkNUpdSiCfg ARGS((RgSchCellCb *cell));
-static Void rgSCHSelectSi ARGS((RgSchCellCb *cell));
-#endif /*RGR_SI_SCH*/
-/* LTE_ADV_FLAG_REMOVED_START */
-#ifdef UNUSED_FUNC
-#ifndef LTE_TDD
-static S16 rgSCHCmnNonDlfsUpdDSFRTyp2Alloc
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlSf *dlSf,
-uint8_t rbStrt,
-uint8_t numRb
-);
-static S16 rgSCHCmnBuildRntpInfo (
-RgSchCellCb *cell,
-uint8_t *rntpPtr,
-uint8_t startRb,
-uint8_t nmbRb,
-uint16_t bw
-);
-#endif
-static Void rgSCHCmnNonDlfsType0Alloc
-(
-RgSchCellCb *cell,
-RgSchDlSf *dlSf,
-RgSchDlRbAlloc *allocInfo,
-RgSchUeCb *ue
-);
-static uint8_t rgSchCmnUlRvIdxToIMcsTbl[4] = {32, 30, 31, 29};
-static Void rgSCHCmnUlNonadapRetx ARGS((
-RgSchCmnUlCell *cellUl,
-RgSchUlAlloc *alloc,
-uint8_t idx
-));
-static Void rgSCHCmnUlSfRlsRetxProcs ARGS((
-RgSchCellCb *cell,
-RgSchUlSf *sf
-));
-
-#ifdef TFU_UPGRADE
-static S16 rgSCHCmnUlMdfyGrntForCqi ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint32_t maxRb,
-uint32_t *numSb,
-uint8_t *iTbs,
-uint32_t hqSz,
-uint32_t stepDownItbs,
-uint32_t effTgt
-));
-#endif
-static Void rgSCHCmnFillHqPPdcchDciFrmt1 ARGS((
-RgSchCellCb *cell,
-RgSchDlRbAlloc *rbAllocInfo,
-RgSchDlHqProcCb *hqP,
-RgSchPdcch *pdcch,
-uint8_t tpc
-));
-static Void rgSCHCmnFillHqPPdcchDciFrmt1A ARGS((
-RgSchCellCb *cell,
-RgSchDlRbAlloc *rbAllocInfo,
-RgSchDlHqProcCb *hqP,
-RgSchPdcch *pdcch,
-uint8_t tpc
-));
-static Void rgSCHCmnFillHqPPdcchDciFrmt1B ARGS((
-RgSchCellCb *cell,
-RgSchDlRbAlloc *rbAllocInfo,
-RgSchDlHqProcCb *hqP,
-RgSchPdcch *pdcch,
-uint8_t tpc
-));
-static Void rgSCHCmnFillHqPPdcchDciFrmt2 ARGS((
-RgSchCellCb *cell,
-RgSchDlRbAlloc *rbAllocInfo,
-RgSchDlHqProcCb *hqP,
-RgSchPdcch *pdcch,
-uint8_t tpc
-));
-static Void rgSCHCmnFillHqPPdcchDciFrmt2A ARGS((
-RgSchCellCb *cell,
-RgSchDlRbAlloc *rbAllocInfo,
-RgSchDlHqProcCb *hqP,
-RgSchPdcch *pdcch,
-uint8_t tpc
-));
-
-#endif
-
-Void rgSCHCmnDlSpsSch
-(
- RgSchCellCb *cell
-);
-/* LTE_ADV_FLAG_REMOVED_END */
-
-static Void rgSCHCmnNonDlfsBcchPcchRbAlloc ARGS((
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *allocInfo
-));
-static Void rgSCHBcchPcchDlRbAlloc ARGS((
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *allocInfo
-));
-static Void rgSCHCmnDlBcchPcchAlloc ARGS((
-RgSchCellCb *cell
-));
-#ifdef RGR_CQI_REPT
-static Void rgSCHCmnDlCqiOnPucchInd ARGS ((
- RgSchCellCb *cell,
- RgSchUeCb *ue,
- TfuDlCqiPucch *pucchCqi,
- RgrUeCqiRept *ueCqiRept,
- Bool *isCqiAvail,
- Bool *is2ndCwCqiAvail
- ));
-static Void rgSCHCmnDlCqiOnPuschInd ARGS ((
- RgSchCellCb *cell,
- RgSchUeCb *ue,
- TfuDlCqiPusch *puschCqi,
- RgrUeCqiRept *ueCqiRept,
- Bool *isCqiAvail,
- Bool *is2ndCwCqiAvail
- ));
-#else
-static Void rgSCHCmnDlCqiOnPucchInd ARGS ((
- RgSchCellCb *cell,
- RgSchUeCb *ue,
- TfuDlCqiPucch *pucchCqi
- ));
-static Void rgSCHCmnDlCqiOnPuschInd ARGS ((
- RgSchCellCb *cell,
- RgSchUeCb *ue,
- TfuDlCqiPusch *puschCqi
- ));
-#endif
-/* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
-static S16 rgSCHCmnUeDlPwrCtColltCqiRept ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue,
- RgrUeCqiRept *ueCqiRept));
-#endif /* End of RGR_CQI_REPT */
-/* Fix: syed align multiple UEs to refresh at same time */
-static Void rgSCHCmnGetRefreshPer ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue,
- uint32_t *waitPer));
-static S16 rgSCHCmnApplyUeRefresh ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue));
-#ifdef DL_LA
-Void rgSCHCmnDlSetUeAllocLmtLa ARGS
-((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-static Void rgSCHCheckAndSetTxScheme ARGS
-((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-#endif
-
-#ifdef LTE_TDD
-static uint32_t rgSCHCmnCalcDwPtsTbSz ARGS
-((
-RgSchCellCb *cell,
-uint32_t bo,
-uint8_t *rb,
-uint8_t *iTbs,
-uint8_t lyr,
-uint8_t cfi
-));
-
-static Void rgSCHCmnCalcDwPtsTbSz2Cw ARGS
-((
-RgSchCellCb *cell,
-uint32_t bo,
-uint8_t *rb,
-uint8_t maxRb,
-uint8_t *iTbs1,
-uint8_t *iTbs2,
-uint8_t lyr1,
-uint8_t lyr2,
-uint32_t *tb1Sz,
-uint32_t *tb2Sz,
-uint8_t cfi
-));
-
-#endif
-static Void rgSCHCmnInitRbAlloc ARGS
-((
-RgSchCellCb *cell
-));
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-/* local defines */
- RgSchdApis rgSchCmnApis;
-static RgUlSchdApis rgSchUlSchdTbl[RGSCH_NUM_SCHEDULERS];
-static RgDlSchdApis rgSchDlSchdTbl[RGSCH_NUM_SCHEDULERS];
-#ifdef EMTC_ENABLE
-static RgUlSchdApis rgSchEmtcUlSchdTbl[RGSCH_NUM_EMTC_SCHEDULERS];
-static RgDlEmtcSchdApis rgSchEmtcDlSchdTbl[RGSCH_NUM_EMTC_SCHEDULERS];
-#endif
-#ifdef RG_PHASE2_SCHED
-static RgDlfsSchdApis rgSchDlfsSchdTbl[RGSCH_NUM_DLFS_SCHEDULERS];
-#endif
-RgUlSchdInits rgSchUlSchdInits = RGSCH_ULSCHED_INITS;
-RgDlSchdInits rgSchDlSchdInits = RGSCH_DLSCHED_INITS;
-#ifdef EMTC_ENABLE
-static RgEmtcUlSchdInits rgSchEmtcUlSchdInits = RGSCH_EMTC_ULSCHED_INITS;
-static RgEmtcDlSchdInits rgSchEmtcDlSchdInits = RGSCH_EMTC_DLSCHED_INITS;
-#endif
-#if (defined (RG_PHASE2_SCHED) && defined (TFU_UPGRADE))
-static RgDlfsSchdInits rgSchDlfsSchdInits = RGSCH_DLFSSCHED_INITS;
-#endif
-
-typedef Void (*RgSchCmnDlAllocRbFunc) ARGS((RgSchCellCb *cell, RgSchDlSf *subFrm,
-RgSchUeCb *ue, uint32_t bo, uint32_t *effBo, RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo));
-typedef uint8_t (*RgSchCmnDlGetPrecInfFunc) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- uint8_t numLyrs, Bool bothCwEnbld));
-static Void rgSCHCmnDlAllocTxRbTM1 ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-));
-static Void rgSCHCmnDlAllocTxRbTM2 ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-));
-static Void rgSCHCmnDlAllocTxRbTM3 ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-));
-static Void rgSCHCmnDlAllocTxRbTM4 ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-));
-#ifdef RG_UNUSED
-static Void rgSCHCmnDlAllocTxRbTM5 ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-));
-#endif
-static Void rgSCHCmnDlAllocTxRbTM6 ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-));
-static Void rgSCHCmnDlAllocTxRbTM7 ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-));
-static Void rgSCHCmnDlAllocRetxRbTM1 ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-));
-static Void rgSCHCmnDlAllocRetxRbTM2 ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-));
-static Void rgSCHCmnDlAllocRetxRbTM3 ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-));
-static Void rgSCHCmnDlAllocRetxRbTM4 ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-));
-#ifdef RG_UNUSED
-static Void rgSCHCmnDlAllocRetxRbTM5 ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-));
-#endif
-static Void rgSCHCmnDlAllocRetxRbTM6 ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-));
-static Void rgSCHCmnDlAllocRetxRbTM7 ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-));
-
-#ifdef LTE_ADV
-static uint8_t rgSchGetN1ResCount ARGS ((
- RgSchUeCb *ue,
- uint16_t servCellId
-));
-Bool rgSchCmnChkDataOnlyOnPcell
-(
- RgSchUeCb *ue,
- RgSchDlSf *dlSf
-);
-#endif /*LTE_ADV */
-uint8_t rgSCHCmnCalcPcqiBitSz
-(
- RgSchUeCb *ueCb,
- uint8_t numTxAnt
-);
-
-#ifndef LTE_ADV
-/* Functions specific to each transmission mode for DL Tx RB Allocation*/
-RgSchCmnDlAllocRbFunc dlAllocTxRbFunc[7] = {rgSCHCmnDlAllocTxRbTM1,
-rgSCHCmnDlAllocTxRbTM2, rgSCHCmnDlAllocTxRbTM3, rgSCHCmnDlAllocTxRbTM4,
-NULLP, rgSCHCmnDlAllocTxRbTM6, rgSCHCmnDlAllocTxRbTM7};
-
-/* Functions specific to each transmission mode for DL Retx RB Allocation*/
-RgSchCmnDlAllocRbFunc dlAllocRetxRbFunc[7] = {rgSCHCmnDlAllocRetxRbTM1,
-rgSCHCmnDlAllocRetxRbTM2, rgSCHCmnDlAllocRetxRbTM3, rgSCHCmnDlAllocRetxRbTM4,
-NULLP, rgSCHCmnDlAllocRetxRbTM6, rgSCHCmnDlAllocRetxRbTM7};
-#else
-/* Functions specific to each transmission mode for DL Tx RB Allocation*/
-RgSchCmnDlAllocRbFunc dlAllocTxRbFunc[9] = {rgSCHCmnDlAllocTxRbTM1,
-rgSCHCmnDlAllocTxRbTM2, rgSCHCmnDlAllocTxRbTM3, rgSCHCmnDlAllocTxRbTM4,
-NULLP, rgSCHCmnDlAllocTxRbTM6, rgSCHCmnDlAllocTxRbTM7, NULLP, NULLP};
-
-/* Functions specific to each transmission mode for DL Retx RB Allocation*/
-RgSchCmnDlAllocRbFunc dlAllocRetxRbFunc[9] = {rgSCHCmnDlAllocRetxRbTM1,
-rgSCHCmnDlAllocRetxRbTM2, rgSCHCmnDlAllocRetxRbTM3, rgSCHCmnDlAllocRetxRbTM4,
-NULLP, rgSCHCmnDlAllocRetxRbTM6, rgSCHCmnDlAllocRetxRbTM7, NULLP, NULLP};
-
-#endif
-
-
-static uint8_t rgSCHCmnDlTM3PrecInf2 ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint8_t numTxLyrs,
-Bool bothCwEnbld
-));
-static uint8_t rgSCHCmnDlTM3PrecInf4 ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint8_t numTxLyrs,
-Bool bothCwEnbld
-));
-static uint8_t rgSCHCmnDlTM4PrecInf2 ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint8_t numTxLyrs,
-Bool bothCwEnbld
-));
-static uint8_t rgSCHCmnDlTM4PrecInf4 ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint8_t numTxLyrs,
-Bool bothCwEnbld
-));
-/* Functions specific to each transmission mode for DL RB Allocation*/
-RgSchCmnDlGetPrecInfFunc getPrecInfoFunc[2][2] = {
-{rgSCHCmnDlTM3PrecInf2, rgSCHCmnDlTM3PrecInf4},
-{rgSCHCmnDlTM4PrecInf2, rgSCHCmnDlTM4PrecInf4}
-};
-
-static S16 rgSCHCmnDlAlloc1CwRetxRb ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-RgSchDlHqTbCb *tbInfo,
-uint8_t noLyr,
-uint8_t *numRb,
-uint32_t *effBo
-));
-static S16 rgSCHCmnDlAlloc2CwRetxRb ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-RgSchDlHqProcCb *proc,
-uint8_t *numRb,
-Bool *swpFlg,
-uint32_t *effBo
-));
-static Void rgSCHCmnDlTM3TxTx ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-));
-static Void rgSCHCmnDlTM3TxRetx ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-));
-static Void rgSCHCmnDlTM3RetxRetx ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-));
-
-static Void rgSCHCmnNonDlfsUpdTyp2Alloc ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *dlSf,
-uint8_t rbStrt,
-uint8_t numRb
-));
-/* LTE_ADV_FLAG_REMOVED_START */
-#ifndef LTE_TDD
-static Void rgSCHCmnNonDlfsSFRCmnChannelUpdTyp2Alloc ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *dlSf,
-uint8_t rbStrt,
-uint8_t numRb
-));
-#endif
-/* LTE_ADV_FLAG_REMOVED_END */
-static Void rgSCHCmnDlRbInfoAddUeTx ARGS((
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *allocInfo,
-RgSchUeCb *ue,
-RgSchDlHqProcCb *proc
-));
-static Void rgSCHCmnDlRbInfoAddUeRetx ARGS((
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *allocInfo,
-RgSchUeCb *ue,
-RgSchDlHqProcCb *hqP
-));
-static Void rgSCHCmnDlAdd2NonSchdRetxLst ARGS((
-RgSchCmnDlRbAllocInfo *allocInfo,
-RgSchUeCb *ue,
-RgSchDlHqProcCb *proc
-));
-static S16 rgSCHCmnDlAlloc2CwTxRetxRb ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-RgSchDlHqTbCb *reTxTb,
-RgSchDlHqTbCb *txTb,
-uint8_t *numRb,
-uint32_t *effBo
-));
-static S16 rgSCHCmnDlAlloc2CwTxRb ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-RgSchDlHqProcCb *proc,
-uint32_t bo,
-uint8_t *numRb,
-uint32_t *effBo
-));
-static S16 rgSCHCmnDlAlloc1CwTxRb ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-RgSchDlHqTbCb *tbInfo,
-uint32_t bo,
-uint8_t *numRb,
-uint32_t *effBo
-));
-#ifndef LTEMAC_SPS
-static Void rgSCHCmnFillHqPTb ARGS((
-RgSchCellCb *cell,
-RgSchDlRbAlloc *rbAllocInfo,
-uint8_t tbAllocIdx,
-RgSchPdcch *pdcch
-));
-#endif
-#ifdef LTEMAC_SPS
-static Void rgSCHCmnDlGetBestFitHole ARGS((
-uint32_t *allocMask,
-uint8_t numMaskRbs,
-uint32_t *crntAllocMask,
-uint8_t rbsReq,
-uint8_t *allocStart,
-uint8_t *allocNumRbs,
-Bool isPartialAlloc
-));
-#ifdef RGSCH_SPS_UNUSED
-static uint32_t rgSCHCmnGetRaType1Mask ARGS((
-uint8_t rbIdx,
-uint8_t rbgSize,
-uint8_t *type1Subset
-));
-#endif
-static uint32_t rgSCHCmnGetRaType0Mask ARGS((
-uint8_t rbIdx,
-uint8_t rbgSize
-));
-static uint32_t rgSCHCmnGetRaType2Mask ARGS((
-uint8_t rbIdx,
-uint8_t *maskIdx
-));
-#endif
-
-Bool rgSCHCmnRetxAllocAvoid ARGS((
-RgSchDlSf *subFrm,
-RgSchCellCb *cell,
-RgSchDlHqProcCb *proc
-));
-
-uint16_t rgSCHCmnGetSiSetId ARGS((
-uint16_t sfn,
-uint8_t sf,
-uint16_t minPeriodicity
-));
-
-
-#ifdef RG_5GTF
-//TODO_SID: Currenly table is only for 100 Prbs. Need to modify wrt VRBG table 8.1.5.2.1-1 V5G_213
-uint32_t rgSch5gtfTbSzTbl[MAX_5GTF_MCS] =
- {1864, 5256, 8776, 13176, 17576, 21976, 26376, 31656, 35176, 39576, 43976, 47496, 52776, 59376, 66392};
-uint32_t g5gtfTtiCnt = 0;
-uint32_t gUl5gtfSrRecv = 0;
-uint32_t gUl5gtfBsrRecv = 0;
-uint32_t gUl5gtfUeSchPick = 0;
-uint32_t gUl5gtfPdcchSchd = 0;
-uint32_t gUl5gtfAllocAllocated = 0;
-uint32_t gUl5gtfUeRbAllocDone = 0;
-uint32_t gUl5gtfUeRmvFnlzZeroBo = 0;
-uint32_t gUl5gtfUeFnlzReAdd = 0;
-uint32_t gUl5gtfPdcchSend = 0;
-uint32_t gUl5gtfRbAllocFail = 0;
-uint32_t ul5gtfsidUlMarkUl = 0;
-uint32_t ul5gtfsidDlSchdPass = 0;
-uint32_t ul5gtfsidDlAlreadyMarkUl = 0;
-uint32_t ul5gtfTotSchdCnt = 0;
-#endif
-
-/* CQI Offset Index to Beta CQI Offset value mapping,
- * stored as parts per 1000. Reserved is set to 0.
- * Refer 36.213 sec 8.6.3 Tbl 8.6.3-3 */
-uint32_t rgSchCmnBetaCqiOffstTbl[16] = {0, 0, 1125,
- 1250, 1375, 1625, 1750, 2000, 2250, 2500, 2875,
- 3125, 3500, 4000, 5000, 6250};
-uint32_t rgSchCmnBetaHqOffstTbl[16] = {2000, 2500, 3125,
- 4000, 5000, 6250, 8000,10000, 12625, 15875, 20000,
- 31000, 50000,80000,126000,0};
-uint32_t rgSchCmnBetaRiOffstTbl[16] = {1250, 1625, 2000,
- 2500, 3125, 4000, 5000, 6250, 8000, 10000,12625,
- 15875,20000,0,0,0};
-S8 rgSchCmnDlCqiDiffOfst[8] = {0, 1, 2, 3, -4, -3, -2, -1};
-
-/* Include CRS REs while calculating Efficiency */
-const static uint8_t rgSchCmnAntIdx[5] = {0,0,1,0,2};
-const static uint8_t rgSchCmnNumResForCrs[5] = {0,6,12,0,16};
-uint32_t cfiSwitchCnt ;
-uint32_t cfiIncr ;
-uint32_t cfiDecr ;
-
-
-#ifdef TFU_UPGRADE
-S8 rgSchCmnApUeSelDiffCqi[4] = {1, 2, 3, 4};
-S8 rgSchCmnApEnbConfDiffCqi[4] = {0, 1, 2, -1};
-#endif
-
-typedef struct rgSchCmnDlUeDciFrmtOptns
-{
- TfuDciFormat spfcDciFrmt; /* TM(Transmission Mode) specific DCI format.
- * Search space : UE Specific by C-RNTI only. */
- uint8_t spfcDciRAType; /* Resource Alloctn(RA) type for spfcDciFrmt */
- TfuDciFormat prfrdDciFrmt; /* Preferred DCI format among the available
- * options for TD (Transmit Diversity) */
- uint8_t prfrdDciRAType; /* Resource Alloctn(RA) type for prfrdDciFrmt */
-}RgSchCmnDlUeDciFrmtOptns;
-#ifndef LTE_ADV
-
-/* DCI Format options for each Transmission Mode */
-RgSchCmnDlUeDciFrmtOptns rgSchCmnDciFrmtOptns[7] = {
- {TFU_DCI_FORMAT_1, RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2},
- {TFU_DCI_FORMAT_1, RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2},
- {TFU_DCI_FORMAT_2A,RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2},
- {TFU_DCI_FORMAT_2, RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2},
- {TFU_DCI_FORMAT_1D,RG_SCH_CMN_RA_TYPE2, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2},
- {TFU_DCI_FORMAT_1B,RG_SCH_CMN_RA_TYPE2, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2},
- {TFU_DCI_FORMAT_1, RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}
-};
-
-#else
-/* DCI Format options for each Transmission Mode */
-RgSchCmnDlUeDciFrmtOptns rgSchCmnDciFrmtOptns[9] = {
- {TFU_DCI_FORMAT_1, RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2},
- {TFU_DCI_FORMAT_1, RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2},
- {TFU_DCI_FORMAT_2A,RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2},
- {TFU_DCI_FORMAT_2, RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2},
- {TFU_DCI_FORMAT_1D,RG_SCH_CMN_RA_TYPE2, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2},
- {TFU_DCI_FORMAT_1B,RG_SCH_CMN_RA_TYPE2, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2},
- {TFU_DCI_FORMAT_1, RG_SCH_CMN_RA_TYPE0, TFU_DCI_FORMAT_1A, RG_SCH_CMN_RA_TYPE2}
-};
-#endif
-
-
-typedef struct rgSchCmnDlImcsTbl
-{
- uint8_t modOdr; /* Modulation Order */
- uint8_t iTbs; /* ITBS */
-}RgSchCmnDlImcsTbl[29];
-
-const struct rgSchCmnMult235Info
-{
- uint8_t match; /* Closest number satisfying 2^a.3^b.5^c, with a bias
- * towards the smaller number */
- uint8_t prvMatch; /* Closest number not greater than array index
- * satisfying 2^a.3^b.5^c */
-} rgSchCmnMult235Tbl[110+1] = {
- {0, 0}, /* dummy */
- {1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}, {6, 6}, {8, 8},
- {9, 9}, {10, 10}, {10, 10}, {12, 12}, {12, 12}, {15, 12}, {15, 15},
- {16, 16}, {16, 16}, {18, 18}, {18, 18}, {20, 20}, {20, 20}, {20, 20},
- {24, 20}, {24, 24}, {25, 25}, {25, 25}, {27, 27}, {27, 27}, {30, 27},
- {30, 30}, {30, 30}, {32, 32}, {32, 32}, {32, 32}, {36, 32}, {36, 36},
- {36, 36}, {36, 36}, {40, 36}, {40, 40}, {40, 40}, {40, 40}, {45, 40},
- {45, 40}, {45, 45}, {45, 45}, {48, 45}, {48, 48}, {48, 48}, {50, 50},
- {50, 50}, {50, 50}, {54, 50}, {54, 54}, {54, 54}, {54, 54}, {54, 54},
- {60, 54}, {60, 54}, {60, 60}, {60, 60}, {60, 60}, {64, 60}, {64, 64},
- {64, 64}, {64, 64}, {64, 64}, {64, 64}, {72, 64}, {72, 64}, {72, 64},
- {72, 72}, {72, 72}, {75, 72}, {75, 75}, {75, 75}, {75, 75}, {80, 75},
- {80, 75}, {80, 80}, {81, 81}, {81, 81}, {81, 81}, {81, 81}, {81, 81},
- {90, 81}, {90, 81}, {90, 81}, {90, 81}, {90, 90}, {90, 90}, {90, 90},
- {90, 90}, {96, 90}, {96, 90}, {96, 96}, {96, 96}, {96, 96}, {100, 96},
- {100, 100}, {100, 100}, {100, 100}, {100, 100}, {100, 100}, {108, 100},
- {108, 100}, {108, 100}, {108, 108}, {108, 108}, {108, 108}
-};
-
-/* R8 Upgrade */
-/* BI table from 36.321 Table 7.2.1 */
-const static S16 rgSchCmnBiTbl[RG_SCH_CMN_NUM_BI_VAL] = {
- 0, 10, 20, 30,40,60,80,120,160,240,320,480,960};
-RgSchCmnUlCqiInfo rgSchCmnUlCqiTbl[RG_SCH_CMN_UL_NUM_CQI] = {
- { 0, 0 },
- {RGSCH_CMN_QM_CQI_1,RGSCH_CMN_UL_EFF_CQI_1 },
- {RGSCH_CMN_QM_CQI_2,RGSCH_CMN_UL_EFF_CQI_2 },
- {RGSCH_CMN_QM_CQI_3,RGSCH_CMN_UL_EFF_CQI_3 },
- {RGSCH_CMN_QM_CQI_4,RGSCH_CMN_UL_EFF_CQI_4 },
- {RGSCH_CMN_QM_CQI_5,RGSCH_CMN_UL_EFF_CQI_5 },
- {RGSCH_CMN_QM_CQI_6,RGSCH_CMN_UL_EFF_CQI_6 },
- {RGSCH_CMN_QM_CQI_7,RGSCH_CMN_UL_EFF_CQI_7 },
- {RGSCH_CMN_QM_CQI_8,RGSCH_CMN_UL_EFF_CQI_8 },
- {RGSCH_CMN_QM_CQI_9,RGSCH_CMN_UL_EFF_CQI_9 },
- {RGSCH_CMN_QM_CQI_10,RGSCH_CMN_UL_EFF_CQI_10 },
- {RGSCH_CMN_QM_CQI_11,RGSCH_CMN_UL_EFF_CQI_11 },
- {RGSCH_CMN_QM_CQI_12,RGSCH_CMN_UL_EFF_CQI_12 },
- {RGSCH_CMN_QM_CQI_13,RGSCH_CMN_UL_EFF_CQI_13 },
- {RGSCH_CMN_QM_CQI_14,RGSCH_CMN_UL_EFF_CQI_14 },
- {RGSCH_CMN_QM_CQI_15,RGSCH_CMN_UL_EFF_CQI_15 },
-};
-
-#ifdef RG_UNUSED
-/* This table maps a (delta_offset * 2 + 2) to a (beta * 8)
- * where beta is 10^-(delta_offset/10) rounded off to nearest 1/8
- */
-static uint16_t rgSchCmnUlBeta8Tbl[29] = {
- 6, RG_SCH_CMN_UL_INVALID_BETA8, 8, 9, 10, 11, 13, 14, 16, 18, 20, 23,
- 25, 28, 32, RG_SCH_CMN_UL_INVALID_BETA8, 40, RG_SCH_CMN_UL_INVALID_BETA8,
- 50, RG_SCH_CMN_UL_INVALID_BETA8, 64, RG_SCH_CMN_UL_INVALID_BETA8, 80,
- RG_SCH_CMN_UL_INVALID_BETA8, 101, RG_SCH_CMN_UL_INVALID_BETA8, 127,
- RG_SCH_CMN_UL_INVALID_BETA8, 160
-};
-#endif
-
-/* QCI to SVC priority mapping. Index specifies the Qci*/
-static uint8_t rgSchCmnDlQciPrio[RG_SCH_CMN_MAX_QCI] = RG_SCH_CMN_QCI_TO_PRIO;
-
-/* The configuration is efficiency measured per 1024 REs. */
-/* The first element stands for when CQI is not known */
-/* This table is used to translate CQI to its corrospoding */
-/* allocation parameters. These are currently from 36.213 */
-/* Just this talbe needs to be edited for modifying the */
-/* the resource allocation behaviour */
-
-/* ADD CQI to MCS mapping correction
- * single dimensional array is replaced by 2 dimensions for different CFI*/
-static uint16_t rgSchCmnCqiPdschEff[4][16] = {RG_SCH_CMN_CQI_TO_PDSCH_EFF_CFI0 ,RG_SCH_CMN_CQI_TO_PDSCH_EFF_CFI1,
- RG_SCH_CMN_CQI_TO_PDSCH_EFF_CFI2,RG_SCH_CMN_CQI_TO_PDSCH_EFF_CFI3};
-
-static uint16_t rgSchCmn2LyrCqiPdschEff[4][16] = {RG_SCH_CMN_2LYR_CQI_TO_PDSCH_EFF_CFI0 ,RG_SCH_CMN_2LYR_CQI_TO_PDSCH_EFF_CFI1,
- RG_SCH_CMN_2LYR_CQI_TO_PDSCH_EFF_CFI2, RG_SCH_CMN_2LYR_CQI_TO_PDSCH_EFF_CFI3};
-
-/* This configuration determines the transalation of a UEs CQI to its */
-/* PDCCH coding efficiency. This may be edited based on the installation */
-static uint8_t rgSchCmnDlRvTbl[4] = {0, 2, 3, 1}; /* RVIdx sequence is corrected*/
-
-/* Indexed by [DciFrmt].
- * Considering the following definition in determining the dciFrmt index.
- * typedef enum
-{
- TFU_DCI_FORMAT_0,
- TFU_DCI_FORMAT_1,
- TFU_DCI_FORMAT_1A,
- TFU_DCI_FORMAT_1B,
- TFU_DCI_FORMAT_1C,
- TFU_DCI_FORMAT_1D,
- TFU_DCI_FORMAT_2,
- TFU_DCI_FORMAT_2A,
- TFU_DCI_FORMAT_3,
- TFU_DCI_FORMAT_3A
-} TfuDciFormat;
-*/
-static uint16_t rgSchCmnDciFrmtSizes[10];
-
-static uint16_t rgSchCmnCqiPdcchEff[16] = RG_SCH_CMN_CQI_TO_PDCCH_EFF;
-
-#ifdef LTE_TDD
-
-RgSchTddUlDlSubfrmTbl rgSchTddUlDlSubfrmTbl = {
- {RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME},
- {RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME},
- {RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME},
- {RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME},
- {RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME},
- {RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME},
- {RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME, RG_SCH_TDD_SPL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_UL_SUBFRAME, RG_SCH_TDD_DL_SUBFRAME}
-};
-
-/* SPS_INTG_FIX */
-#ifdef LTEMAC_SPS
-uint8_t rgSchTddSpsDlMaxRetxTbl[RGSCH_MAX_TDD_UL_DL_CFG] = {
- /* 0 */ 6,
- /* 1 */ 7,
- /* 2 */ 8,
- /* 3 */ 11,
- /* 4 */ 12,
- /* 5 */ 13,
- /* 6 */ 7};
-
-#endif
-
-
-/* Special Subframes in OFDM symbols */
-/* ccpu00134197-MOD-Correct the number of symbols */
-RgSchTddSplSubfrmInfoTbl rgSchTddSplSubfrmInfoTbl = {
- {3, 1, 1, 3, 1, 1},
- {9, 1, 1, 8, 1, 1},
- {10, 1, 1, 9, 1, 1},
- {11, 1, 1, 10, 1, 1},
- {12, 1, 1, 3, 2, 2},
- {3, 2, 2, 8, 2, 2},
- {9, 2, 2, 9, 2, 2},
- {10, 2, 2, 0, 0, 0},
- {11, 2, 2, 0, 0, 0}
-};
-
-/* PHICH 'm' value Table */
-RgSchTddPhichMValTbl rgSchTddPhichMValTbl = {
- {2, 1, 0, 0, 0, 2, 1, 0, 0, 0},
- {0, 1, 0, 0, 1, 0, 1, 0, 0, 1},
- {0, 0, 0, 1, 0, 0, 0, 0, 1, 0},
- {1, 0, 0, 0, 0, 0, 0, 0, 1, 1},
- {0, 0, 0, 0, 0, 0, 0, 0, 1, 1},
- {0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
- {1, 1, 0, 0, 0, 1, 1, 0, 0, 1}
-};
-
-/* PHICH 'K' value Table */
-RgSchTddKPhichTbl rgSchTddKPhichTbl = {
- {0, 0, 4, 7, 6, 0, 0, 4, 7, 6},
- {0, 0, 4, 6, 0, 0, 0, 4, 6, 0},
- {0, 0, 6, 0, 0, 0, 0, 6, 0, 0},
- {0, 0, 6, 6, 6, 0, 0, 0, 0, 0},
- {0, 0, 6, 6, 0, 0, 0, 0, 0, 0},
- {0, 0, 6, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 4, 6, 6, 0, 0, 4, 7, 0}
-};
-
-/* Uplink association index 'K' value Table */
-RgSchTddUlAscIdxKDashTbl rgSchTddUlAscIdxKDashTbl = {
- {0, 0, 6, 4, 0, 0, 0, 6, 4, 0},
- {0, 0, 4, 0, 0, 0, 0, 4, 0, 0},
- {0, 0, 4, 4, 4, 0, 0, 0, 0, 0},
- {0, 0, 4, 4, 0, 0, 0, 0, 0, 0},
- {0, 0, 4, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 7, 7, 5, 0, 0, 7, 7, 0}
-};
-
-
-/* PUSCH 'K' value Table */
-RgSchTddPuschTxKTbl rgSchTddPuschTxKTbl = {
- {4, 6, 0, 0, 0, 4, 6, 0, 0, 0},
- {0, 6, 0, 0, 4, 0, 6, 0, 0, 4},
- {0, 0, 0, 4, 0, 0, 0, 0, 4, 0},
- {4, 0, 0, 0, 0, 0, 0, 0, 4, 4},
- {0, 0, 0, 0, 0, 0, 0, 0, 4, 4},
- {0, 0, 0, 0, 0, 0, 0, 0, 4, 0},
- {7, 7, 0, 0, 0, 7, 7, 0, 0, 5}
-};
-
-/* PDSCH to PUCCH Table for DL Harq Feed back. Based on the
- Downlink association set index 'K' table */
-uint8_t rgSchTddPucchTxTbl[7][10] = {
- {4, 6, 0, 0, 0, 4, 6, 0, 0, 0},
- {7, 6, 0, 0, 4, 7, 6, 0, 0, 4},
- {7, 6, 0, 4, 8, 7, 6, 0, 4, 8},
- {4, 11, 0, 0, 0, 7, 6, 6, 5, 5},
- {12, 11, 0, 0, 8, 7, 7, 6, 5, 4},
- {12, 11, 0, 9, 8, 7, 6, 5, 4, 13},
- {7, 7, 0, 0, 0, 7, 7, 0, 0, 5}
-};
-
-/* Table to fetch the next DL sf idx for applying the
- new CFI. The next Dl sf Idx at which the new CFI
- is applied is always the starting Sf of the next ACK/NACK
- Fdbk bundle.
-
- Ex: In Cfg-2, sf4 and sf9 are the only subframes at which
- a new ACK/NACK bundle of DL subframes can start
-
- D S U D D D S U D D D S U D D D S U D D
- 4 9
-
- dlSf Array for Cfg-2:
- sfNum: 0 1 3 4 5 6 8 9 0 1 3 4 5 6 8 9
- sfIdx: 0 1 2 3 4 5 6 7 8 9 10 11 12 12 14 15
-
- If CFI changes at sf0, nearest DL SF bundle >= 4 TTI is sf4
- So at sf4 the new CFI can be applied. To arrive at sf4 from
- sf0, the sfIdx has to be increased by 3 */
-
-uint8_t rgSchTddPdcchSfIncTbl[7][10] = {
- /* A/N Bundl: 0,1,5,6*/ {2, 1, 0, 0, 0, 2, 1, 0, 0, 0},
- /* A/N Bundl: 0,4,5,9*/ {2, 2, 0, 0, 3, 2, 2, 0, 0, 3},
- /* A/N Bundl: 4,9*/ {3, 6, 0, 5, 4, 3, 6, 0, 5, 4},
- /* A/N Bundl: 1,7,9*/ {4, 3, 0, 0, 0, 4, 5, 4, 6, 5},
- /* A/N Bundl: 0,6*/ {4, 3, 0, 0, 6, 5, 4, 7, 6, 5},
- /* A/N Bundl: 9*/ {8, 7, 0, 6, 5, 4, 12, 11, 10, 9},
- /* A/N Bundl: 0,1,5,6,9*/ {2, 1, 0, 0, 0, 2, 2, 0, 0, 3}
-};
-
-
-/* combine compilation fixes */
-#ifdef LTEMAC_SPS
-/* subframe offset values to be used when twoIntervalsConfig is enabled in UL
- * SPS for a UE */
-RgSchTddSfOffTbl rgSchTddSfOffTbl = {
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 1, -1, 0, 0, 0, 1, -1, 0},
- {0, 0, 5, 0, 0, 0, 0, -5, 0, 0},
- {0, 0, 1, 1, -2, 0, 0, 0, 0, 0},
- {0, 0, 1, -1, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-};
-
-
-/* Table to determine when uplink SPS configured grants should
- * explicitly be reserved in a subframe. When enries are same
- * as that of Msg3SubfrmTbl, indicates competition with msg3.
- * As of now, this is same as Msg3SubfrmTbl (leaving out uldlcfg 2),
- * except that all 255s are now zeros. */
-RgSchTddSpsUlRsrvTbl rgSchTddSpsUlRsrvTbl = {
- {0, 0, 0, 6, 8, 0, 0, 0, 6, 8},
- {0, 0, 6, 9, 0, 0, 0, 6, 9, 0},
- {0, 0, 10, 0, 0, 0, 0, 10, 0, 0},
- {0, 0, 0, 0, 8, 0, 7, 7, 14, 0},
- {0, 0, 0, 9, 0, 0, 7, 15, 0, 0},
- {0, 0, 10, 0, 0, 0, 16, 0, 0, 0},
- {0, 0, 0, 0, 8, 0, 0, 0, 9, 0}
-};
-
-/* Inverse DL Assoc Set index Table */
-RgSchTddInvDlAscSetIdxTbl rgSchTddInvDlAscSetIdxTbl = {
- {4, 6, 0, 0, 0, 4, 6, 0, 0, 0},
- {7, 6, 0, 0, 4, 7, 6, 0, 0, 4},
- {7, 6, 0, 4, 8, 7, 6, 0, 4, 8},
- {4, 11, 0, 0, 0, 7, 6, 6, 5, 5},
- {12, 11, 0, 0, 8, 7, 7, 6, 5, 4},
- {12, 11, 0, 9, 8, 7, 6, 5, 4, 13},
- {7, 7, 0, 0, 0, 7, 7, 0, 0, 5}
-};
-
-#endif /* (LTEMAC_SPS ) */
-
-/* Number of Uplink subframes Table */
-static uint8_t rgSchTddNumUlSf[] = {6, 4, 2, 3, 2, 1, 5};
-
-/* Downlink HARQ processes Table */
-RgSchTddUlNumHarqProcTbl rgSchTddUlNumHarqProcTbl = { 7, 4, 2, 3, 2, 1, 6};
-
-/* Uplink HARQ processes Table */
-RgSchTddDlNumHarqProcTbl rgSchTddDlNumHarqProcTbl = { 4, 7, 10, 9, 12, 15, 6};
-
-/* Downlink association index set 'K' value Table */
-RgSchTddDlAscSetIdxKTbl rgSchTddDlAscSetIdxKTbl = {
- { {0, {0}}, {0, {0}}, {1, {6}}, {0, {0}}, {1, {4}}, {0, {0}}, {0, {0}}, {1, {6}}, {0, {0}}, {1, {4}} },
-
- { {0, {0}}, {0, {0}}, {2, {7, 6}}, {1, {4}}, {0, {0}}, {0, {0}}, {0, {0}}, {2, {7, 6}}, {1, {4}}, {0, {0}} },
-
- { {0, {0}}, {0, {0}}, {4, {8, 7, 4, 6}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {4, {8, 7, 4, 6}}, {0, {0}}, {0, {0}} },
-
- { {0, {0}}, {0, {0}}, {3, {7, 6, 11}}, {2, {6, 5}}, {2, {5, 4}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}} },
-
- { {0, {0}}, {0, {0}}, {4, {12, 8, 7, 11}}, {4, {6, 5, 4, 7}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}} },
-
- { {0, {0}}, {0, {0}}, {9, {13, 12, 9, 8, 7, 5, 4, 11, 6}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}} },
-
- { {0, {0}}, {0, {0}}, {1, {7}}, {1, {7}}, {1, {5}}, {0, {0}}, {0, {0}}, {1, {7}}, {1, {7}}, {0, {0}} }
-};
-
- /* ccpu132282-ADD-the table rgSchTddDlAscSetIdxKTbl is rearranged in
- * decreasing order of Km, this is used to calculate the NCE used for
- * calculating N1Pucch Resource for Harq*/
-RgSchTddDlAscSetIdxKTbl rgSchTddDlHqPucchResCalTbl = {
- { {0, {0}}, {0, {0}}, {1, {6}}, {0, {0}}, {1, {4}}, {0, {0}}, {0, {0}}, {1, {6}}, {0, {0}}, {1, {4}} },
-
- { {0, {0}}, {0, {0}}, {2, {7, 6}}, {1, {4}}, {0, {0}}, {0, {0}}, {0, {0}}, {2, {7, 6}}, {1, {4}}, {0, {0}} },
-
- { {0, {0}}, {0, {0}}, {4, {8, 7, 6, 4}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {4, {8, 7, 6, 4}}, {0, {0}}, {0, {0}} },
-
- { {0, {0}}, {0, {0}}, {3, {11, 7, 6}}, {2, {6, 5}}, {2, {5, 4}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}} },
-
- { {0, {0}}, {0, {0}}, {4, {12, 11, 8, 7}}, {4, {7, 6, 5, 4}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}} },
-
- { {0, {0}}, {0, {0}}, {9, {13, 12, 11, 9, 8, 7, 6, 5, 4}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}} },
-
- { {0, {0}}, {0, {0}}, {1, {7}}, {1, {7}}, {1, {5}}, {0, {0}}, {0, {0}}, {1, {7}}, {1, {7}}, {0, {0}} }
-};
-
-/* Minimum number of Ack/Nack feeback information to be
- stored for each UL-DL configuration */
-RgSchTddANFdbkMapTbl rgSchTddANFdbkMapTbl = {4, 4, 2, 3, 2, 1, 5};
-
-/* Uplink switch points and number of UL subframes Table */
-RgSchTddMaxUlSubfrmTbl rgSchTddMaxUlSubfrmTbl = {
- {2,3,3}, {2,2,2}, {2,1,1}, {1,3,0}, {1,2,0}, {1,1,0}, {2,3,2}
-};
-
-/* Uplink switch points and number of DL subframes Table */
-RgSchTddMaxDlSubfrmTbl rgSchTddMaxDlSubfrmTbl = {
- {2,2,2}, {2,3,3}, {2,4,4}, {1,7,0}, {1,8,0}, {1,9,0}, {2,2,3}
-};
-
-/* Number of UL subframes present before a particular subframe */
-RgSchTddNumUlSubfrmTbl rgSchTddNumUlSubfrmTbl = {
- {0, 0, 1, 2, 3, 3, 3, 4, 5, 6},
- {0, 0, 1, 2, 2, 2, 2, 3, 4, 4},
- {0, 0, 1, 1, 1, 1, 1, 2, 2, 2},
- {0, 0, 1, 2, 3, 3, 3, 3, 3, 3},
- {0, 0, 1, 2, 2, 2, 2, 2, 2, 2},
- {0, 0, 1, 1, 1, 1, 1, 1, 1, 1},
- {0, 0, 1, 2, 3, 3, 3, 4, 5, 5}
-};
-
-/* Number of DL subframes present till a particular subframe */
-RgSchTddNumDlSubfrmTbl rgSchTddNumDlSubfrmTbl = {
- {1, 2, 2, 2, 2, 3, 4, 4, 4, 4},
- {1, 2, 2, 2, 3, 4, 5, 5, 5, 6},
- {1, 2, 2, 3, 4, 5, 6, 6, 7, 8},
- {1, 2, 2, 2, 2, 3, 4, 5, 6, 7},
- {1, 2, 2, 2, 3, 4, 5, 6, 7, 8},
- {1, 2, 2, 3, 4, 5, 6, 7, 8, 9},
- {1, 2, 2, 2, 2, 3, 4, 4, 4, 5}
-};
-
-
-/* Nearest possible UL subframe Index from UL subframe
- * DL Index < UL Index */
-RgSchTddLowDlSubfrmIdxTbl rgSchTddLowDlSubfrmIdxTbl = {
- {0, 1, 1, 1, 1, 5, 6, 6, 6, 6},
- {0, 1, 1, 1, 4, 5, 6, 6, 6, 9},
- {0, 1, 1, 3, 4, 5, 6, 6, 8, 9},
- {0, 1, 1, 1, 1, 5, 6, 7, 8, 9},
- {0, 1, 1, 1, 4, 5, 6, 7, 8, 9},
- {0, 1, 1, 3, 4, 5, 6, 7, 8, 9},
- {0, 1, 1, 1, 1, 5, 6, 6, 6, 9}
-};
-
-/* Nearest possible DL subframe Index from UL subframe
- * DL Index > UL Index
- * 10 represents Next SFN low DL Idx */
-RgSchTddHighDlSubfrmIdxTbl rgSchTddHighDlSubfrmIdxTbl = {
- {0, 1, 5, 5, 5, 5, 6, 10, 10, 10},
- {0, 1, 4, 4, 4, 5, 6, 9, 9, 9},
- {0, 1, 3, 3, 4, 5, 6, 8, 8, 9},
- {0, 1, 5, 5, 5, 5, 6, 7, 8, 9},
- {0, 1, 4, 4, 4, 5, 6, 7, 8, 9},
- {0, 1, 3, 3, 4, 5, 6, 7, 8, 9},
- {0, 1, 5, 5, 5, 5, 6, 9, 9, 9}
-};
-
-/* RACH Message3 related information */
-RgSchTddMsg3SubfrmTbl rgSchTddMsg3SubfrmTbl = {
- {7, 6, 255, 255, 255, 7, 6, 255, 255, 255},
- {7, 6, 255, 255, 8, 7, 6, 255, 255, 8},
- {7, 6, 255, 9, 8, 7, 6, 255, 9, 8},
- {12, 11, 255, 255, 255, 7, 6, 6, 6, 13},
- {12, 11, 255, 255, 8, 7, 6, 6, 14, 13},
- {12, 11, 255, 9, 8, 7, 6, 15, 14, 13},
- {7, 6, 255, 255, 255, 7, 6, 255, 255, 8}
-};
-
-/* ccpu00132341-DEL Removed rgSchTddRlsDlSubfrmTbl and used Kset table for
- * releasing DL HARQs */
-
-/* DwPTS Scheduling Changes Start */
-/* Provides the number of Cell Reference Signals in DwPTS
- * region per RB */
-static uint8_t rgSchCmnDwptsCrs[2][3] = {/* [Spl Sf cfg][Ant Port] */
- {4, 8, 16}, /* Spl Sf cfg 1,2,3,6,7,8 */
- {6, 12, 20}, /* Spl Sf cfg 4 */
-};
-
-static S8 rgSchCmnSplSfDeltaItbs[9] = RG_SCH_DWPTS_ITBS_ADJ;
-/* DwPTS Scheduling Changes End */
-#endif
-
-
-static uint32_t rgSchCmnBsrTbl[64] = {
- 0, 10, 12, 14, 17, 19, 22, 26,
- 31, 36, 42, 49, 57, 67, 78, 91,
- 107, 125, 146, 171, 200, 234, 274, 321,
- 376, 440, 515, 603, 706, 826, 967, 1132,
- 1326, 1552, 1817, 2127, 2490, 2915, 3413, 3995,
- 4677, 5476, 6411, 7505, 8787, 10287, 12043, 14099,
- 16507, 19325, 22624, 26487, 31009, 36304, 42502, 49759,
- 58255, 68201, 79846, 93479, 109439, 128125, 150000, 220000
-};
-
-static uint32_t rgSchCmnExtBsrTbl[64] = {
- 0, 10, 13, 16, 19, 23, 29, 35,
- 43, 53, 65, 80, 98, 120, 147, 181,
- 223, 274, 337, 414, 509, 625, 769, 945,
- 1162, 1429, 1757, 2161, 2657, 3267, 4017, 4940,
- 6074, 7469, 9185, 11294, 13888, 17077, 20999, 25822,
- 31752, 39045, 48012, 59039, 72598, 89272, 109774, 134986,
- 165989, 204111, 250990, 308634, 379519, 466683, 573866, 705666,
- 867737, 1067031, 1312097, 1613447, 1984009, 2439678, 3000000, 3100000
-};
-
-uint8_t rgSchCmnUlCqiToTbsTbl[RG_SCH_CMN_MAX_CP][RG_SCH_CMN_UL_NUM_CQI];
-
-RgSchTbSzTbl rgTbSzTbl = {
- {
- {16, 32, 56, 88, 120, 152, 176, 208, 224, 256, 288, 328, 344, 376, 392, 424, 456, 488, 504, 536, 568, 600, 616, 648, 680, 712, 744, 776, 776, 808, 840, 872, 904, 936, 968, 1000, 1032, 1032, 1064, 1096, 1128, 1160, 1192, 1224, 1256, 1256, 1288, 1320, 1352, 1384, 1416, 1416, 1480, 1480, 1544, 1544, 1608, 1608, 1608, 1672, 1672, 1736, 1736, 1800, 1800, 1800, 1864, 1864, 1928, 1928, 1992, 1992, 2024, 2088, 2088, 2088, 2152, 2152, 2216, 2216, 2280, 2280, 2280, 2344, 2344, 2408, 2408, 2472, 2472, 2536, 2536, 2536, 2600, 2600, 2664, 2664, 2728, 2728, 2728, 2792, 2792, 2856, 2856, 2856, 2984, 2984, 2984, 2984, 2984, 3112},
- {24, 56, 88, 144, 176, 208, 224, 256, 328, 344, 376, 424, 456, 488, 520, 568, 600, 632, 680, 712, 744, 776, 808, 872, 904, 936, 968, 1000, 1032, 1064, 1128, 1160, 1192, 1224, 1256, 1288, 1352, 1384, 1416, 1416, 1480, 1544, 1544, 1608, 1608, 1672, 1736, 1736, 1800, 1800, 1864, 1864, 1928, 1992, 1992, 2024, 2088, 2088, 2152, 2152, 2216, 2280, 2280, 2344, 2344, 2408, 2472, 2472, 2536, 2536, 2600, 2600, 2664, 2728, 2728, 2792, 2792, 2856, 2856, 2856, 2984, 2984, 2984, 3112, 3112, 3112, 3240, 3240, 3240, 3240, 3368, 3368, 3368, 3496, 3496, 3496, 3496, 3624, 3624, 3624, 3752, 3752, 3752, 3752, 3880, 3880, 3880, 4008, 4008, 4008},
- {32, 72, 144, 176, 208, 256, 296, 328, 376, 424, 472, 520, 568, 616, 648, 696, 744, 776, 840, 872, 936, 968, 1000, 1064, 1096, 1160, 1192, 1256, 1288, 1320, 1384, 1416, 1480, 1544, 1544, 1608, 1672, 1672, 1736, 1800, 1800, 1864, 1928, 1992, 2024, 2088, 2088, 2152, 2216, 2216, 2280, 2344, 2344, 2408, 2472, 2536, 2536, 2600, 2664, 2664, 2728, 2792, 2856, 2856, 2856, 2984, 2984, 3112, 3112, 3112, 3240, 3240, 3240, 3368, 3368, 3368, 3496, 3496, 3496, 3624, 3624, 3624, 3752, 3752, 3880, 3880, 3880, 4008, 4008, 4008, 4136, 4136, 4136, 4264, 4264, 4264, 4392, 4392, 4392, 4584, 4584, 4584, 4584, 4584, 4776, 4776, 4776, 4776, 4968, 4968},
- {40, 104, 176, 208, 256, 328, 392, 440, 504, 568, 616, 680, 744, 808, 872, 904, 968, 1032, 1096, 1160, 1224, 1256, 1320, 1384, 1416, 1480, 1544, 1608, 1672, 1736, 1800, 1864, 1928, 1992, 2024, 2088, 2152, 2216, 2280, 2344, 2408, 2472, 2536, 2536, 2600, 2664, 2728, 2792, 2856, 2856, 2984, 2984, 3112, 3112, 3240, 3240, 3368, 3368, 3496, 3496, 3624, 3624, 3624, 3752, 3752, 3880, 3880, 4008, 4008, 4136, 4136, 4264, 4264, 4392, 4392, 4392, 4584, 4584, 4584, 4776, 4776, 4776, 4776, 4968, 4968, 4968, 5160, 5160, 5160, 5352, 5352, 5352, 5352, 5544, 5544, 5544, 5736, 5736, 5736, 5736, 5992, 5992, 5992, 5992, 6200, 6200, 6200, 6200, 6456, 6456},
- {56, 120, 208, 256, 328, 408, 488, 552, 632, 696, 776, 840, 904, 1000, 1064, 1128, 1192, 1288, 1352, 1416, 1480, 1544, 1608, 1736, 1800, 1864, 1928, 1992, 2088, 2152, 2216, 2280, 2344, 2408, 2472, 2600, 2664, 2728, 2792, 2856, 2984, 2984, 3112, 3112, 3240, 3240, 3368, 3496, 3496, 3624, 3624, 3752, 3752, 3880, 4008, 4008, 4136, 4136, 4264, 4264, 4392, 4392, 4584, 4584, 4584, 4776, 4776, 4968, 4968, 4968, 5160, 5160, 5160, 5352, 5352, 5544, 5544, 5544, 5736, 5736, 5736, 5992, 5992, 5992, 5992, 6200, 6200, 6200, 6456, 6456, 6456, 6456, 6712, 6712, 6712, 6968, 6968, 6968, 6968, 7224, 7224, 7224, 7480, 7480, 7480, 7480, 7736, 7736, 7736, 7992},
- {72, 144, 224, 328, 424, 504, 600, 680, 776, 872, 968, 1032, 1128, 1224, 1320, 1384, 1480, 1544, 1672, 1736, 1864, 1928, 2024, 2088, 2216, 2280, 2344, 2472, 2536, 2664, 2728, 2792, 2856, 2984, 3112, 3112, 3240, 3368, 3496, 3496, 3624, 3752, 3752, 3880, 4008, 4008, 4136, 4264, 4392, 4392, 4584, 4584, 4776, 4776, 4776, 4968, 4968, 5160, 5160, 5352, 5352, 5544, 5544, 5736, 5736, 5736, 5992, 5992, 5992, 6200, 6200, 6200, 6456, 6456, 6712, 6712, 6712, 6968, 6968, 6968, 7224, 7224, 7224, 7480, 7480, 7480, 7736, 7736, 7736, 7992, 7992, 7992, 8248, 8248, 8248, 8504, 8504, 8760, 8760, 8760, 8760, 9144, 9144, 9144, 9144, 9528, 9528, 9528, 9528, 9528},
- {328, 176, 256, 392, 504, 600, 712, 808, 936, 1032, 1128, 1224, 1352, 1480, 1544, 1672, 1736, 1864, 1992, 2088, 2216, 2280, 2408, 2472, 2600, 2728, 2792, 2984, 2984, 3112, 3240, 3368, 3496, 3496, 3624, 3752, 3880, 4008, 4136, 4136, 4264, 4392, 4584, 4584, 4776, 4776, 4968, 4968, 5160, 5160, 5352, 5352, 5544, 5736, 5736, 5992, 5992, 5992, 6200, 6200, 6456, 6456, 6456, 6712, 6712, 6968, 6968, 6968, 7224, 7224, 7480, 7480, 7736, 7736, 7736, 7992, 7992, 8248, 8248, 8248, 8504, 8504, 8760, 8760, 8760, 9144, 9144, 9144, 9144, 9528, 9528, 9528, 9528, 9912, 9912, 9912, 10296, 10296, 10296, 10296, 10680, 10680, 10680, 10680, 11064, 11064, 11064, 11448, 11448, 11448},
- {104, 224, 328, 472, 584, 712, 840, 968, 1096, 1224, 1320, 1480, 1608, 1672, 1800, 1928, 2088, 2216, 2344, 2472, 2536, 2664, 2792, 2984, 3112, 3240, 3368, 3368, 3496, 3624, 3752, 3880, 4008, 4136, 4264, 4392, 4584, 4584, 4776, 4968, 4968, 5160, 5352, 5352, 5544, 5736, 5736, 5992, 5992, 6200, 6200, 6456, 6456, 6712, 6712, 6712, 6968, 6968, 7224, 7224, 7480, 7480, 7736, 7736, 7992, 7992, 8248, 8248, 8504, 8504, 8760, 8760, 8760, 9144, 9144, 9144, 9528, 9528, 9528, 9912, 9912, 9912, 10296, 10296, 10296, 10680, 10680, 10680, 11064, 11064, 11064, 11448, 11448, 11448, 11448, 11832, 11832, 11832, 12216, 12216, 12216, 12576, 12576, 12576, 12960, 12960, 12960, 12960, 13536, 13536},
- {120, 256, 392, 536, 680, 808, 968, 1096, 1256, 1384, 1544, 1672, 1800, 1928, 2088, 2216, 2344, 2536, 2664, 2792, 2984, 3112, 3240, 3368, 3496, 3624, 3752, 3880, 4008, 4264, 4392, 4584, 4584, 4776, 4968, 4968, 5160, 5352, 5544, 5544, 5736, 5992, 5992, 6200, 6200, 6456, 6456, 6712, 6968, 6968, 7224, 7224, 7480, 7480, 7736, 7736, 7992, 7992, 8248, 8504, 8504, 8760, 8760, 9144, 9144, 9144, 9528, 9528, 9528, 9912, 9912, 9912, 10296, 10296, 10680, 10680, 10680, 11064, 11064, 11064, 11448, 11448, 11448, 11832, 11832, 12216, 12216, 12216, 12576, 12576, 12576, 12960, 12960, 12960, 13536, 13536, 13536, 13536, 14112, 14112, 14112, 14112, 14688, 14688, 14688, 14688, 15264, 15264, 15264, 15264},
- {136, 296, 456, 616, 776, 936, 1096, 1256, 1416, 1544, 1736, 1864, 2024, 2216, 2344, 2536, 2664, 2856, 2984, 3112, 3368, 3496, 3624, 3752, 4008, 4136, 4264, 4392, 4584, 4776, 4968, 5160, 5160, 5352, 5544, 5736, 5736, 5992, 6200, 6200, 6456, 6712, 6712, 6968, 6968, 7224, 7480, 7480, 7736, 7992, 7992, 8248, 8248, 8504, 8760, 8760, 9144, 9144, 9144, 9528, 9528, 9912, 9912, 10296, 10296, 10296, 10680, 10680, 11064, 11064, 11064, 11448, 11448, 11832, 11832, 11832, 12216, 12216, 12576, 12576, 12960, 12960, 12960, 13536, 13536, 13536, 13536, 14112, 14112, 14112, 14112, 14688, 14688, 14688, 15264, 15264, 15264, 15264, 15840, 15840, 15840, 16416, 16416, 16416, 16416, 16992, 16992, 16992, 16992, 17568},
- {144, 328, 504, 680, 872, 1032, 1224, 1384, 1544, 1736, 1928, 2088, 2280, 2472, 2664, 2792, 2984, 3112, 3368, 3496, 3752, 3880, 4008, 4264, 4392, 4584, 4776, 4968, 5160, 5352, 5544, 5736, 5736, 5992, 6200, 6200, 6456, 6712, 6712, 6968, 7224, 7480, 7480, 7736, 7992, 7992, 8248, 8504, 8504, 8760, 9144, 9144, 9144, 9528, 9528, 9912, 9912, 10296, 10296, 10680, 10680, 11064, 11064, 11448, 11448, 11448, 11832, 11832, 12216, 12216, 12576, 12576, 12960, 12960, 12960, 13536, 13536, 13536, 14112, 14112, 14112, 14688, 14688, 14688, 14688, 15264, 15264, 15264, 15840, 15840, 15840, 16416, 16416, 16416, 16992, 16992, 16992, 16992, 17568, 17568, 17568, 18336, 18336, 18336, 18336, 18336, 19080, 19080, 19080, 19080},
- {176, 376, 584, 776, 1000, 1192, 1384, 1608, 1800, 2024, 2216, 2408, 2600, 2792, 2984, 3240, 3496, 3624, 3880, 4008, 4264, 4392, 4584, 4776, 4968, 5352, 5544, 5736, 5992, 5992, 6200, 6456, 6712, 6968, 6968, 7224, 7480, 7736, 7736, 7992, 8248, 8504, 8760, 8760, 9144, 9144, 9528, 9528, 9912, 9912, 10296, 10680, 10680, 11064, 11064, 11448, 11448, 11832, 11832, 12216, 12216, 12576, 12576, 12960, 12960, 13536, 13536, 13536, 14112, 14112, 14112, 14688, 14688, 14688, 15264, 15264, 15840, 15840, 15840, 16416, 16416, 16416, 16992, 16992, 16992, 17568, 17568, 17568, 18336, 18336, 18336, 18336, 19080, 19080, 19080, 19080, 19848, 19848, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 21384, 21384, 22152, 22152, 22152},
- {208, 440, 680, 904, 1128, 1352, 1608, 1800, 2024, 2280, 2472, 2728, 2984, 3240, 3368, 3624, 3880, 4136, 4392, 4584, 4776, 4968, 5352, 5544, 5736, 5992, 6200, 6456, 6712, 6712, 6968, 7224, 7480, 7736, 7992, 8248, 8504, 8760, 8760, 9144, 9528, 9528, 9912, 9912, 10296, 10680, 10680, 11064, 11064, 11448, 11832, 11832, 12216, 12216, 12576, 12576, 12960, 12960, 13536, 13536, 14112, 14112, 14112, 14688, 14688, 15264, 15264, 15264, 15840, 15840, 16416, 16416, 16416, 16992, 16992, 17568, 17568, 17568, 18336, 18336, 18336, 19080, 19080, 19080, 19080, 19848, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 21384, 21384, 22152, 22152, 22152, 22920, 22920, 22920, 23688, 23688, 23688, 23688, 24496, 24496, 24496, 24496, 25456},
- {224, 488, 744, 1000, 1256, 1544, 1800, 2024, 2280, 2536, 2856, 3112, 3368, 3624, 3880, 4136, 4392, 4584, 4968, 5160, 5352, 5736, 5992, 6200, 6456, 6712, 6968, 7224, 7480, 7736, 7992, 8248, 8504, 8760, 9144, 9144, 9528, 9912, 9912, 10296, 10680, 10680, 11064, 11448, 11448, 11832, 12216, 12216, 12576, 12960, 12960, 13536, 13536, 14112, 14112, 14688, 14688, 14688, 15264, 15264, 15840, 15840, 16416, 16416, 16992, 16992, 16992, 17568, 17568, 18336, 18336, 18336, 19080, 19080, 19080, 19848, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 21384, 22152, 22152, 22152, 22920, 22920, 22920, 23688, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 25456, 25456, 26416, 26416, 26416, 26416, 27376, 27376, 27376, 27376, 28336, 28336},
- {256, 552, 840, 1128, 1416, 1736, 1992, 2280, 2600, 2856, 3112, 3496, 3752, 4008, 4264, 4584, 4968, 5160, 5544, 5736, 5992, 6200, 6456, 6968, 7224, 7480, 7736, 7992, 8248, 8504, 8760, 9144, 9528, 9912, 9912, 10296, 10680, 11064, 11064, 11448, 11832, 12216, 12216, 12576, 12960, 12960, 13536, 13536, 14112, 14112, 14688, 14688, 15264, 15264, 15840, 15840, 16416, 16416, 16992, 16992, 17568, 17568, 18336, 18336, 18336, 19080, 19080, 19848, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 22152, 22152, 22152, 22920, 22920, 22920, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 25456, 25456, 26416, 26416, 26416, 27376, 27376, 27376, 28336, 28336, 28336, 28336, 29296, 29296, 29296, 29296, 30576, 30576, 30576, 30576, 31704, 31704},
- {280, 600, 904, 1224, 1544, 1800, 2152, 2472, 2728, 3112, 3368, 3624, 4008, 4264, 4584, 4968, 5160, 5544, 5736, 6200, 6456, 6712, 6968, 7224, 7736, 7992, 8248, 8504, 8760, 9144, 9528, 9912, 10296, 10296, 10680, 11064, 11448, 11832, 11832, 12216, 12576, 12960, 12960, 13536, 13536, 14112, 14688, 14688, 15264, 15264, 15840, 15840, 16416, 16416, 16992, 16992, 17568, 17568, 18336, 18336, 18336, 19080, 19080, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 22152, 22152, 22152, 22920, 22920, 23688, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 25456, 26416, 26416, 26416, 27376, 27376, 27376, 28336, 28336, 28336, 29296, 29296, 29296, 29296, 30576, 30576, 30576, 30576, 31704, 31704, 31704, 31704, 32856, 32856, 32856, 34008, 34008},
- {328, 632, 968, 1288, 1608, 1928, 2280, 2600, 2984, 3240, 3624, 3880, 4264, 4584, 4968, 5160, 5544, 5992, 6200, 6456, 6712, 7224, 7480, 7736, 7992, 8504, 8760, 9144, 9528, 9912, 9912, 10296, 10680, 11064, 11448, 11832, 12216, 12216, 12576, 12960, 13536, 13536, 14112, 14112, 14688, 14688, 15264, 15840, 15840, 16416, 16416, 16992, 16992, 17568, 17568, 18336, 18336, 19080, 19080, 19848, 19848, 19848, 20616, 20616, 21384, 21384, 22152, 22152, 22152, 22920, 22920, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 25456, 26416, 26416, 26416, 27376, 27376, 27376, 28336, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 30576, 30576, 31704, 31704, 31704, 31704, 32856, 32856, 32856, 34008, 34008, 34008, 34008, 35160, 35160, 35160, 35160},
- {336, 696, 1064, 1416, 1800, 2152, 2536, 2856, 3240, 3624, 4008, 4392, 4776, 5160, 5352, 5736, 6200, 6456, 6712, 7224, 7480, 7992, 8248, 8760, 9144, 9528, 9912, 10296, 10296, 10680, 11064, 11448, 11832, 12216, 12576, 12960, 13536, 13536, 14112, 14688, 14688, 15264, 15264, 15840, 16416, 16416, 16992, 17568, 17568, 18336, 18336, 19080, 19080, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 22152, 22152, 22920, 22920, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 26416, 26416, 26416, 27376, 27376, 27376, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 30576, 30576, 31704, 31704, 31704, 32856, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 35160, 35160, 36696, 36696, 36696, 36696, 37888, 37888, 37888, 39232, 39232, 39232, 39232},
- {376, 776, 1160, 1544, 1992, 2344, 2792, 3112, 3624, 4008, 4392, 4776, 5160, 5544, 5992, 6200, 6712, 7224, 7480, 7992, 8248, 8760, 9144, 9528, 9912, 10296, 10680, 11064, 11448, 11832, 12216, 12576, 12960, 13536, 14112, 14112, 14688, 15264, 15264, 15840, 16416, 16416, 16992, 17568, 17568, 18336, 18336, 19080, 19080, 19848, 19848, 20616, 21384, 21384, 22152, 22152, 22920, 22920, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 26416, 26416, 27376, 27376, 27376, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 30576, 31704, 31704, 31704, 32856, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 40576, 40576, 42368, 42368, 42368, 42368, 43816, 43816},
- {408, 840, 1288, 1736, 2152, 2600, 2984, 3496, 3880, 4264, 4776, 5160, 5544, 5992, 6456, 6968, 7224, 7736, 8248, 8504, 9144, 9528, 9912, 10296, 10680, 11064, 11448, 12216, 12576, 12960, 13536, 13536, 14112, 14688, 15264, 15264, 15840, 16416, 16992, 16992, 17568, 18336, 18336, 19080, 19080, 19848, 20616, 20616, 21384, 21384, 22152, 22152, 22920, 22920, 23688, 24496, 24496, 25456, 25456, 25456, 26416, 26416, 27376, 27376, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 30576, 31704, 31704, 32856, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 40576, 40576, 42368, 42368, 42368, 43816, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 46888},
- {440, 904, 1384, 1864, 2344, 2792, 3240, 3752, 4136, 4584, 5160, 5544, 5992, 6456, 6968, 7480, 7992, 8248, 8760, 9144, 9912, 10296, 10680, 11064, 11448, 12216, 12576, 12960, 13536, 14112, 14688, 14688, 15264, 15840, 16416, 16992, 16992, 17568, 18336, 18336, 19080, 19848, 19848, 20616, 20616, 21384, 22152, 22152, 22920, 22920, 23688, 24496, 24496, 25456, 25456, 26416, 26416, 27376, 27376, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 31704, 31704, 31704, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 46888, 48936, 48936, 48936, 48936, 48936, 51024, 51024, 51024},
- {488, 1000, 1480, 1992, 2472, 2984, 3496, 4008, 4584, 4968, 5544, 5992, 6456, 6968, 7480, 7992, 8504, 9144, 9528, 9912, 10680, 11064, 11448, 12216, 12576, 12960, 13536, 14112, 14688, 15264, 15840, 15840, 16416, 16992, 17568, 18336, 18336, 19080, 19848, 19848, 20616, 21384, 21384, 22152, 22920, 22920, 23688, 24496, 24496, 25456, 25456, 26416, 26416, 27376, 27376, 28336, 28336, 29296, 29296, 30576, 30576, 31704, 31704, 31704, 32856, 32856, 34008, 34008, 35160, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 46888, 48936, 48936, 48936, 48936, 51024, 51024, 51024, 51024, 52752, 52752, 52752, 52752, 55056, 55056, 55056},
- {520, 1064, 1608, 2152, 2664, 3240, 3752, 4264, 4776, 5352, 5992, 6456, 6968, 7480, 7992, 8504, 9144, 9528, 10296, 10680, 11448, 11832, 12576, 12960, 13536, 14112, 14688, 15264, 15840, 16416, 16992, 16992, 17568, 18336, 19080, 19080, 19848, 20616, 21384, 21384, 22152, 22920, 22920, 23688, 24496, 24496, 25456, 25456, 26416, 27376, 27376, 28336, 28336, 29296, 29296, 30576, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 48936, 48936, 48936, 48936, 51024, 51024, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 55056, 57336, 57336, 57336, 57336, 59256, 59256, 59256},
- {552, 1128, 1736, 2280, 2856, 3496, 4008, 4584, 5160, 5736, 6200, 6968, 7480, 7992, 8504, 9144, 9912, 10296, 11064, 11448, 12216, 12576, 12960, 13536, 14112, 14688, 15264, 15840, 16416, 16992, 17568, 18336, 19080, 19848, 19848, 20616, 21384, 22152, 22152, 22920, 23688, 24496, 24496, 25456, 25456, 26416, 27376, 27376, 28336, 28336, 29296, 29296, 30576, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 35160, 35160, 36696, 36696, 37888, 37888, 37888, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 55056, 57336, 57336, 57336, 57336, 59256, 59256, 59256, 59256, 61664, 61664, 61664, 61664, 63776},
- {584, 1192, 1800, 2408, 2984, 3624, 4264, 4968, 5544, 5992, 6712, 7224, 7992, 8504, 9144, 9912, 10296, 11064, 11448, 12216, 12960, 13536, 14112, 14688, 15264, 15840, 16416, 16992, 17568, 18336, 19080, 19848, 19848, 20616, 21384, 22152, 22920, 22920, 23688, 24496, 25456, 25456, 26416, 26416, 27376, 28336, 28336, 29296, 29296, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 39232, 39232, 40576, 40576, 42368, 42368, 42368, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 51024, 52752, 52752, 52752, 52752, 55056, 55056, 55056, 57336, 57336, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 61664, 61664, 63776, 63776, 63776, 63776, 66592, 66592, 66592, 66592},
- {616, 1256, 1864, 2536, 3112, 3752, 4392, 5160, 5736, 6200, 6968, 7480, 8248, 8760, 9528, 10296, 10680, 11448, 12216, 12576, 13536, 14112, 14688, 15264, 15840, 16416, 16992, 17568, 18336, 19080, 19848, 20616, 20616, 21384, 22152, 22920, 23688, 24496, 24496, 25456, 26416, 26416, 27376, 28336, 28336, 29296, 29296, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 35160, 35160, 36696, 36696, 37888, 37888, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 46888, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 55056, 57336, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 61664, 61664, 63776, 63776, 63776, 63776, 66592, 66592, 66592, 66592, 68808, 68808, 68808, 71112},
- {712, 1480, 2216, 2984, 3752, 4392, 5160, 5992, 6712, 7480, 8248, 8760, 9528, 10296, 11064, 11832, 12576, 13536, 14112, 14688, 15264, 16416, 16992, 17568, 18336, 19080, 19848, 20616, 21384, 22152, 22920, 23688, 24496, 25456, 25456, 26416, 27376, 28336, 29296, 29296, 30576, 30576, 31704, 32856, 32856, 34008, 35160, 35160, 36696, 36696, 37888, 37888, 39232, 40576, 40576, 40576, 42368, 42368, 43816, 43816, 45352, 45352, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 55056, 57336, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 61664, 63776, 63776, 63776, 66592, 66592, 66592, 68808, 68808, 68808, 71112, 71112, 71112, 73712, 73712, 75376, 75376, 75376, 75376, 75376, 75376, 75376, 75376, 75376, 75376, 75376}
- },
- {
- {32, 88, 152, 208, 256, 328, 376, 424, 488, 536, 600, 648, 712, 776, 808, 872, 936, 1000, 1032, 1096, 1160, 1224, 1256, 1320, 1384, 1416, 1480, 1544, 1608, 1672, 1736, 1800, 1800, 1864, 1928, 1992, 2088, 2088, 2152, 2216, 2280, 2344, 2408, 2472, 2536, 2536, 2600, 2664, 2728, 2792, 2856, 2856, 2984, 2984, 3112, 3112, 3240, 3240, 3240, 3368, 3368, 3496, 3496, 3624, 3624, 3624, 3752, 3752, 3880, 3880, 4008, 4008, 4008, 4136, 4136, 4136, 4264, 4264, 4392, 4392, 4584, 4584, 4584, 4776, 4776, 4776, 4776, 4968, 4968, 5160, 5160, 5160, 5160, 5160, 5352, 5352, 5544, 5544, 5544, 5544, 5544, 5736, 5736, 5736, 5992, 5992, 5992, 5992, 5992, 6200},
- {56, 144, 208, 256, 344, 424, 488, 568, 632, 712, 776, 872, 936, 1000, 1064, 1160, 1224, 1288, 1384, 1416, 1544, 1608, 1672, 1736, 1800, 1864, 1992, 2024, 2088, 2152, 2280, 2344, 2408, 2472, 2536, 2600, 2728, 2792, 2856, 2856, 2984, 3112, 3112, 3240, 3240, 3368, 3496, 3496, 3624, 3624, 3752, 3752, 3880, 4008, 4008, 4008, 4136, 4136, 4264, 4264, 4392, 4584, 4584, 4776, 4776, 4776, 4968, 4968, 5160, 5160, 5160, 5160, 5352, 5544, 5544, 5544, 5544, 5736, 5736, 5736, 5992, 5992, 5992, 6200, 6200, 6200, 6456, 6456, 6456, 6456, 6712, 6712, 6712, 6968, 6968, 6968, 6968, 7224, 7224, 7224, 7480, 7480, 7480, 7480, 7736, 7736, 7736, 7992, 7992, 7992},
- {72, 176, 256, 328, 424, 520, 616, 696, 776, 872, 968, 1064, 1160, 1256, 1320, 1416, 1544, 1608, 1672, 1800, 1864, 1992, 2088, 2152, 2216, 2344, 2408, 2536, 2600, 2664, 2792, 2856, 2984, 3112, 3112, 3240, 3368, 3368, 3496, 3624, 3624, 3752, 3880, 4008, 4008, 4136, 4264, 4264, 4392, 4584, 4584, 4584, 4776, 4776, 4968, 5160, 5160, 5160, 5352, 5352, 5544, 5544, 5736, 5736, 5736, 5992, 5992, 6200, 6200, 6200, 6456, 6456, 6456, 6712, 6712, 6712, 6968, 6968, 6968, 7224, 7224, 7224, 7480, 7480, 7736, 7736, 7736, 7992, 7992, 7992, 8248, 8248, 8248, 8504, 8504, 8504, 8760, 8760, 8760, 9144, 9144, 9144, 9144, 9144, 9528, 9528, 9528, 9528, 9912, 9912},
- {104, 208, 328, 440, 568, 680, 808, 904, 1032, 1160, 1256, 1384, 1480, 1608, 1736, 1864, 1992, 2088, 2216, 2344, 2472, 2536, 2664, 2792, 2856, 2984, 3112, 3240, 3368, 3496, 3624, 3752, 3880, 4008, 4136, 4264, 4392, 4392, 4584, 4776, 4776, 4968, 4968, 5160, 5352, 5352, 5544, 5544, 5736, 5736, 5992, 5992, 6200, 6200, 6456, 6456, 6712, 6712, 6968, 6968, 7224, 7224, 7224, 7480, 7480, 7736, 7736, 7992, 7992, 8248, 8248, 8504, 8504, 8760, 8760, 8760, 9144, 9144, 9144, 9528, 9528, 9528, 9528, 9912, 9912, 9912, 10296, 10296, 10296, 10680, 10680, 10680, 10680, 11064, 11064, 11064, 11448, 11448, 11448, 11448, 11832, 11832, 11832, 11832, 12576, 12576, 12576, 12576, 12960, 12960},
- {120, 256, 408, 552, 696, 840, 1000, 1128, 1288, 1416, 1544, 1736, 1864, 1992, 2152, 2280, 2408, 2600, 2728, 2856, 2984, 3112, 3240, 3496, 3624, 3752, 3880, 4008, 4136, 4264, 4392, 4584, 4776, 4968, 4968, 5160, 5352, 5544, 5544, 5736, 5992, 5992, 6200, 6200, 6456, 6456, 6712, 6968, 6968, 7224, 7224, 7480, 7480, 7736, 7992, 7992, 8248, 8248, 8504, 8504, 8760, 8760, 9144, 9144, 9144, 9528, 9528, 9912, 9912, 9912, 10296, 10296, 10296, 10680, 10680, 11064, 11064, 11064, 11448, 11448, 11448, 11832, 11832, 11832, 11832, 12576, 12576, 12576, 12960, 12960, 12960, 12960, 13536, 13536, 13536, 14112, 14112, 14112, 14112, 14688, 14688, 14688, 14688, 14688, 14688, 14688, 15264, 15264, 15264, 15840},
- {144, 328, 504, 680, 872, 1032, 1224, 1384, 1544, 1736, 1928, 2088, 2280, 2472, 2664, 2792, 2984, 3112, 3368, 3496, 3752, 3880, 4008, 4264, 4392, 4584, 4776, 4968, 5160, 5352, 5544, 5736, 5736, 5992, 6200, 6200, 6456, 6712, 6968, 6968, 7224, 7480, 7480, 7736, 7992, 7992, 8248, 8504, 8760, 8760, 9144, 9144, 9528, 9528, 9528, 9912, 9912, 10296, 10296, 10680, 10680, 11064, 11064, 11448, 11448, 11448, 11832, 11832, 11832, 12576, 12576, 12576, 12960, 12960, 13536, 13536, 13536, 14112, 14112, 14112, 14688, 14688, 14688, 14688, 14688, 14688, 15264, 15264, 15264, 15840, 15840, 15840, 16416, 16416, 16416, 16992, 16992, 17568, 17568, 17568, 17568, 18336, 18336, 18336, 18336, 19080, 19080, 19080, 19080, 19080},
- {176, 392, 600, 808, 1032, 1224, 1480, 1672, 1864, 2088, 2280, 2472, 2728, 2984, 3112, 3368, 3496, 3752, 4008, 4136, 4392, 4584, 4776, 4968, 5160, 5352, 5736, 5992, 5992, 6200, 6456, 6712, 6968, 6968, 7224, 7480, 7736, 7992, 8248, 8248, 8504, 8760, 9144, 9144, 9528, 9528, 9912, 9912, 10296, 10296, 10680, 10680, 11064, 11448, 11448, 11832, 11832, 11832, 12576, 12576, 12960, 12960, 12960, 13536, 13536, 14112, 14112, 14112, 14688, 14688, 14688, 14688, 15264, 15264, 15264, 15840, 15840, 16416, 16416, 16416, 16992, 16992, 17568, 17568, 17568, 18336, 18336, 18336, 18336, 19080, 19080, 19080, 19080, 19848, 19848, 19848, 20616, 20616, 20616, 20616, 21384, 21384, 21384, 21384, 24264, 24264, 24264, 22920, 22920, 22920},
- {224, 472, 712, 968, 1224, 1480, 1672, 1928, 2216, 2472, 2664, 2984, 3240, 3368, 3624, 3880, 4136, 4392, 4584, 4968, 5160, 5352, 5736, 5992, 6200, 6456, 6712, 6712, 6968, 7224, 7480, 7736, 7992, 8248, 8504, 8760, 9144, 9144, 9528, 9912, 9912, 10296, 10680, 10680, 11064, 11448, 11448, 11832, 11832, 12216, 12576, 12576, 12960, 12960, 13536, 13536, 14112, 14112, 14688, 14688, 14688, 14688, 15264, 15264, 15840, 15840, 16416, 16416, 16992, 16992, 17568, 17568, 17568, 18336, 18336, 18336, 19080, 19080, 19080, 19848, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 21384, 24264, 24264, 24264, 22920, 22920, 22920, 22920, 23688, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 25456, 25456, 25456, 25456, 25456, 27376, 27376},
- {256, 536, 808, 1096, 1384, 1672, 1928, 2216, 2536, 2792, 3112, 3368, 3624, 3880, 4264, 4584, 4776, 4968, 5352, 5544, 5992, 6200, 6456, 6712, 6968, 7224, 7480, 7736, 7992, 8504, 8760, 9144, 9144, 9528, 9912, 9912, 10296, 10680, 11064, 11064, 11448, 11832, 12216, 12216, 12576, 12960, 12960, 13536, 13536, 14112, 14112, 14688, 14688, 15264, 15264, 15264, 15840, 15840, 16416, 16992, 16992, 17568, 17568, 18336, 18336, 18336, 19080, 19080, 19080, 19848, 19848, 19848, 20616, 20616, 21384, 21384, 21384, 24264, 24264, 24264, 22920, 22920, 22920, 23688, 23688, 24496, 24496, 24496, 25456, 25456, 25456, 25456, 25456, 25456, 27376, 27376, 27376, 27376, 28336, 28336, 28336, 28336, 29296, 29296, 29296, 29296, 30576, 30576, 30576, 30576},
- {296, 616, 936, 1256, 1544, 1864, 2216, 2536, 2856, 3112, 3496, 3752, 4136, 4392, 4776, 5160, 5352, 5736, 5992, 6200, 6712, 6968, 7224, 7480, 7992, 8248, 8504, 8760, 9144, 9528, 9912, 10296, 10296, 10680, 11064, 11448, 11832, 11832, 12216, 12576, 12960, 13536, 13536, 14112, 14112, 14688, 14688, 15264, 15264, 15840, 16416, 16416, 16992, 16992, 17568, 17568, 18336, 18336, 18336, 19080, 19080, 19848, 19848, 20616, 20616, 20616, 21384, 21384, 24264, 24264, 24264, 22920, 22920, 23688, 23688, 23688, 24496, 24496, 25456, 25456, 25456, 25456, 25456, 27376, 27376, 27376, 27376, 28336, 28336, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 30576, 30576, 31704, 31704, 31704, 32856, 32856, 32856, 32856, 34008, 34008, 34008, 34008, 35160},
- {328, 680, 1032, 1384, 1736, 2088, 2472, 2792, 3112, 3496, 3880, 4264, 4584, 4968, 5352, 5736, 5992, 6200, 6712, 6968, 7480, 7736, 7992, 8504, 8760, 9144, 9528, 9912, 10296, 10680, 11064, 11448, 11448, 11832, 12216, 12576, 12960, 13536, 13536, 14112, 14688, 14688, 15264, 15264, 15840, 16416, 16416, 16992, 16992, 17568, 18336, 18336, 18336, 19080, 19080, 19848, 19848, 20616, 20616, 21384, 21384, 24264, 24264, 22920, 22920, 22920, 23688, 23688, 24496, 24496, 25456, 25456, 25456, 25456, 25456, 27376, 27376, 27376, 28336, 28336, 28336, 29296, 29296, 29296, 29296, 30576, 30576, 30576, 31704, 31704, 31704, 32856, 32856, 32856, 34008, 34008, 34008, 34008, 35160, 35160, 35160, 36696, 36696, 36696, 36696, 36696, 37888, 37888, 37888, 37888},
- {376, 776, 1192, 1608, 2024, 2408, 2792, 3240, 3624, 4008, 4392, 4776, 5352, 5736, 5992, 6456, 6968, 7224, 7736, 7992, 8504, 8760, 9144, 9528, 9912, 10680, 11064, 11448, 11832, 12216, 12576, 12960, 13536, 13536, 14112, 14688, 14688, 15264, 15840, 16416, 16416, 16992, 17568, 17568, 18336, 18336, 19080, 19080, 19848, 19848, 20616, 21384, 21384, 22152, 22152, 22920, 22920, 23688, 23688, 24496, 24496, 25456, 25456, 25456, 25456, 27376, 27376, 27376, 28336, 28336, 28336, 29296, 29296, 29296, 30576, 30576, 31704, 31704, 31704, 32856, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 35160, 36696, 36696, 36696, 36696, 37888, 37888, 37888, 37888, 39232, 39232, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 42368, 42368, 43816, 43816, 43816},
- {440, 904, 1352, 1800, 2280, 2728, 3240, 3624, 4136, 4584, 4968, 5544, 5992, 6456, 6712, 7224, 7736, 8248, 8760, 9144, 9528, 9912, 10680, 11064, 11448, 11832, 12216, 12576, 12960, 13536, 14112, 14688, 15264, 15264, 15840, 16416, 16992, 17568, 17568, 18336, 19080, 19080, 19848, 19848, 20616, 21384, 21384, 22152, 22152, 22920, 23688, 23688, 24496, 24496, 25456, 25456, 25456, 25456, 27376, 27376, 28336, 28336, 28336, 29296, 29296, 30576, 30576, 30576, 31704, 31704, 32856, 32856, 32856, 34008, 34008, 35160, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 46888, 48936, 48936, 48936, 48936, 51024},
- {488, 1000, 1544, 2024, 2536, 3112, 3624, 4136, 4584, 5160, 5736, 6200, 6712, 7224, 7736, 8248, 8760, 9144, 9912, 10296, 10680, 11448, 11832, 12216, 12960, 13536, 14112, 14688, 14688, 15264, 15840, 16416, 16992, 17568, 18336, 18336, 19080, 19848, 19848, 20616, 21384, 21384, 22152, 22920, 22920, 23688, 24496, 24496, 25456, 25456, 26416, 26416, 27376, 27376, 28336, 29296, 29296, 29296, 30576, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 34008, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 51024, 51024, 52752, 52752, 52752, 52752, 55056, 55056, 55056, 55056, 57336, 57336},
- {552, 1128, 1736, 2280, 2856, 3496, 4008, 4584, 5160, 5736, 6200, 6968, 7480, 7992, 8504, 9144, 9912, 10296, 11064, 11448, 12216, 12576, 12960, 13536, 14112, 14688, 15264, 15840, 16416, 16992, 17568, 18336, 19080, 19848, 19848, 20616, 21384, 22152, 22152, 22920, 23688, 24496, 24496, 25456, 25456, 26416, 27376, 27376, 28336, 28336, 29296, 29296, 30576, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 45352, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 57336, 57336, 57336, 57336, 59256, 59256, 59256, 59256, 61664, 61664, 61664, 61664, 63776, 63776},
- {600, 1224, 1800, 2472, 3112, 3624, 4264, 4968, 5544, 6200, 6712, 7224, 7992, 8504, 9144, 9912, 10296, 11064, 11832, 12216, 12960, 13536, 14112, 14688, 15264, 15840, 16416, 16992, 17568, 18336, 19080, 19848, 20616, 20616, 21384, 22152, 22920, 23688, 23688, 24496, 25456, 25456, 26416, 27376, 27376, 28336, 29296, 29296, 30576, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 35160, 35160, 36696, 36696, 36696, 37888, 37888, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 46888, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 57336, 57336, 57336, 59256, 59256, 59256, 59256, 61664, 61664, 61664, 61664, 63776, 63776, 63776, 63776, 66592, 66592, 66592, 68808, 68808},
- {632, 1288, 1928, 2600, 3240, 3880, 4584, 5160, 5992, 6456, 7224, 7736, 8504, 9144, 9912, 10296, 11064, 11832, 12216, 12960, 13536, 14112, 14688, 15840, 16416, 16992, 17568, 18336, 19080, 19848, 19848, 20616, 21384, 22152, 22920, 23688, 24496, 24496, 25456, 26416, 26416, 27376, 28336, 28336, 29296, 30576, 30576, 31704, 31704, 32856, 32856, 34008, 34008, 35160, 35160, 36696, 36696, 37888, 37888, 39232, 39232, 39232, 40576, 40576, 42368, 42368, 43816, 43816, 43816, 45352, 45352, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 57336, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 61664, 61664, 63776, 63776, 63776, 63776, 66592, 66592, 66592, 68808, 68808, 68808, 68808, 71112, 71112, 71112, 71112},
- {696, 1416, 2152, 2856, 3624, 4392, 5160, 5736, 6456, 7224, 7992, 8760, 9528, 10296, 10680, 11448, 12216, 12960, 13536, 14688, 15264, 15840, 16416, 17568, 18336, 19080, 19848, 20616, 20616, 21384, 22152, 22920, 23688, 24496, 25456, 26416, 26416, 27376, 28336, 29296, 29296, 30576, 30576, 31704, 32856, 32856, 34008, 35160, 35160, 36696, 36696, 37888, 37888, 39232, 39232, 40576, 40576, 40576, 42368, 42368, 43816, 43816, 45352, 45352, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 52752, 52752, 52752, 55056, 55056, 55056, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 61664, 61664, 63776, 63776, 63776, 66592, 66592, 66592, 68808, 68808, 68808, 71112, 71112, 71112, 71112, 73712, 73712, 73712, 73712, 76208, 76208, 76208, 78704, 78704, 78704, 78704},
- {776, 1544, 2344, 3112, 4008, 4776, 5544, 6200, 7224, 7992, 8760, 9528, 10296, 11064, 11832, 12576, 13536, 14112, 15264, 15840, 16416, 17568, 18336, 19080, 19848, 20616, 21384, 22152, 22920, 23688, 24496, 25456, 26416, 27376, 27376, 28336, 29296, 30576, 30576, 31704, 32856, 32856, 34008, 35160, 35160, 36696, 37888, 37888, 39232, 39232, 40576, 40576, 42368, 42368, 43816, 43816, 45352, 45352, 46888, 46888, 48936, 48936, 48936, 51024, 51024, 52752, 52752, 55056, 55056, 55056, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 61664, 63776, 63776, 63776, 66592, 66592, 66592, 68808, 68808, 68808, 71112, 71112, 71112, 73712, 73712, 73712, 76208, 76208, 76208, 76208, 78704, 78704, 78704, 81176, 81176, 81176, 81176, 84760, 84760, 84760, 84760, 87936, 87936},
- {840, 1736, 2600, 3496, 4264, 5160, 5992, 6968, 7736, 8504, 9528, 10296, 11064, 12216, 12960, 13536, 14688, 15264, 16416, 16992, 18336, 19080, 19848, 20616, 21384, 22152, 22920, 24496, 25456, 25456, 26416, 27376, 28336, 29296, 30576, 30576, 31704, 32856, 34008, 34008, 35160, 36696, 36696, 37888, 39232, 39232, 40576, 40576, 42368, 43816, 43816, 45352, 45352, 46888, 46888, 48936, 48936, 51024, 51024, 51024, 52752, 52752, 55056, 55056, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 61664, 63776, 63776, 66592, 66592, 66592, 68808, 68808, 68808, 71112, 71112, 71112, 73712, 73712, 73712, 76208, 76208, 76208, 78704, 78704, 78704, 81176, 81176, 81176, 81176, 84760, 84760, 84760, 87936, 87936, 87936, 87936, 90816, 90816, 90816, 93800, 93800, 93800, 93800},
- {904, 1864, 2792, 3752, 4584, 5544, 6456, 7480, 8248, 9144, 10296, 11064, 12216, 12960, 14112, 14688, 15840, 16992, 17568, 18336, 19848, 20616, 21384, 22152, 22920, 24496, 25456, 26416, 27376, 28336, 29296, 29296, 30576, 31704, 32856, 34008, 34008, 35160, 36696, 36696, 37888, 39232, 40576, 40576, 42368, 42368, 43816, 45352, 45352, 46888, 46888, 48936, 48936, 51024, 51024, 52752, 52752, 55056, 55056, 57336, 57336, 59256, 59256, 59256, 61664, 61664, 63776, 63776, 63776, 66592, 66592, 68808, 68808, 68808, 71112, 71112, 71112, 73712, 73712, 73712, 76208, 76208, 78704, 78704, 78704, 81176, 81176, 81176, 84760, 84760, 84760, 84760, 87936, 87936, 87936, 90816, 90816, 90816, 93800, 93800, 93800, 93800, 97896, 97896, 97896, 97896, 97896, 101840, 101840, 101840},
- {1000, 1992, 2984, 4008, 4968, 5992, 6968, 7992, 9144, 9912, 11064, 12216, 12960, 14112, 15264, 15840, 16992, 18336, 19080, 19848, 21384, 22152, 22920, 24496, 25456, 26416, 27376, 28336, 29296, 30576, 31704, 31704, 32856, 34008, 35160, 36696, 36696, 37888, 39232, 40576, 40576, 42368, 43816, 43816, 45352, 46888, 46888, 48936, 48936, 51024, 51024, 52752, 52752, 55056, 55056, 57336, 57336, 59256, 59256, 61664, 61664, 63776, 63776, 63776, 66592, 66592, 68808, 68808, 71112, 71112, 71112, 73712, 73712, 73712, 76208, 76208, 78704, 78704, 78704, 81176, 81176, 81176, 84760, 84760, 84760, 87936, 87936, 87936, 90816, 90816, 90816, 93800, 93800, 93800, 93800, 97896, 97896, 97896, 97896, 101840, 101840, 101840, 101840, 105528, 105528, 105528, 105528, 110136, 110136, 110136},
- {1064, 2152, 3240, 4264, 5352, 6456, 7480, 8504, 9528, 10680, 11832, 12960, 14112, 15264, 16416, 16992, 18336, 19080, 20616, 21384, 22920, 23688, 24496, 25456, 27376, 28336, 29296, 30576, 31704, 32856, 34008, 34008, 35160, 36696, 37888, 39232, 40576, 40576, 42368, 43816, 43816, 45352, 46888, 46888, 48936, 48936, 51024, 51024, 52752, 55056, 55056, 57336, 57336, 59256, 59256, 61664, 61664, 63776, 63776, 66592, 66592, 68808, 68808, 68808, 71112, 71112, 73712, 73712, 73712, 76208, 76208, 78704, 78704, 81176, 81176, 81176, 84760, 84760, 84760, 87936, 87936, 87936, 90816, 90816, 90816, 93800, 93800, 93800, 97896, 97896, 97896, 97896, 101840, 101840, 101840, 101840, 105528, 105528, 105528, 110136, 110136, 110136, 110136, 115040, 115040, 115040, 115040, 119816, 119816, 119816},
- {1128, 2280, 3496, 4584, 5736, 6968, 7992, 9144, 10296, 11448, 12576, 13536, 14688, 15840, 16992, 18336, 19848, 20616, 22152, 22920, 24496, 25456, 26416, 27376, 28336, 29296, 30576, 31704, 32856, 34008, 35160, 36696, 37888, 39232, 40576, 40576, 42368, 43816, 45352, 45352, 46888, 48936, 48936, 51024, 51024, 52752, 55056, 55056, 57336, 57336, 59256, 59256, 61664, 61664, 63776, 63776, 66592, 66592, 68808, 68808, 71112, 71112, 73712, 73712, 76208, 76208, 76208, 78704, 78704, 81176, 81176, 81176, 84760, 84760, 87936, 87936, 87936, 90816, 90816, 90816, 93800, 93800, 93800, 97896, 97896, 97896, 101840,101840,101840,101840,105528, 105528, 105528, 110136, 110136, 110136, 110136, 115040, 115040, 115040, 115040, 119816, 119816, 119816, 119816, 124464, 124464, 124464, 124464, 128496},
- {1192, 2408, 3624, 4968, 5992, 7224, 8504, 9912, 11064, 12216, 13536, 14688, 15840, 16992, 18336, 19848, 20616, 22152, 22920, 24496, 25456, 26416, 28336, 29296, 30576, 31704, 32856, 34008, 35160, 36696, 37888, 39232, 40576, 42368, 42368, 43816, 45352, 46888, 46888, 48936, 51024, 51024, 52752, 52752, 55056, 57336, 57336, 59256, 59256, 61664, 61664, 63776, 63776, 66592, 66592, 68808, 71112, 71112, 73712, 73712, 73712, 76208, 76208, 78704, 78704, 81176, 81176, 84760, 84760, 84760, 87936, 87936, 90816, 90816, 90816, 93800, 93800, 93800, 97896, 97896, 97896, 101840, 101840, 101840, 105528, 105528, 105528, 105528, 110136, 110136, 110136, 115040, 115040, 115040, 115040, 119816, 119816, 119816, 124464, 124464, 124464, 124464, 128496, 128496, 128496, 128496, 133208, 133208, 133208, 133208},
- {1256, 2536, 3752, 5160, 6200, 7480, 8760, 10296, 11448, 12576, 14112, 15264, 16416, 17568, 19080, 20616, 21384, 22920, 24496, 25456, 26416, 28336, 29296, 30576, 31704, 32856, 34008, 35160, 36696, 37888, 39232, 40576, 42368, 43816, 43816, 45352, 46888, 48936, 48936, 51024, 52752, 52752, 55056, 55056, 57336, 59256, 59256, 61664, 61664, 63776, 63776, 66592, 66592, 68808, 71112, 71112, 73712, 73712, 76208, 76208, 78704, 78704, 81176, 81176, 81176, 84760, 84760, 87936, 87936, 87936, 90816, 90816, 93800, 93800, 93800, 97896, 97896, 97896, 101840, 101840, 101840, 105528, 105528, 105528, 110136, 110136, 110136, 110136, 115040,115040, 115040, 119816, 119816, 119816, 124464, 124464, 124464, 124464, 128496, 128496, 128496, 128496, 133208, 133208, 133208, 133208, 137792, 137792, 137792, 142248},
- {1480, 2984, 4392, 5992, 7480, 8760, 10296, 11832, 13536, 14688, 16416, 17568, 19080, 20616, 22152, 23688, 25456, 26416, 28336, 29296, 30576, 32856, 34008, 35160, 36696, 37888, 40576, 40576, 42368, 43816, 45352, 46888, 48936, 51024, 52752, 52752, 55056, 55056, 57336, 59256, 59256, 61664, 63776, 63776, 66592, 68808, 68808, 71112, 73712, 75376, 75376, 75376, 75376, 75376, 75376, 81176, 84760, 84760, 87936, 87936, 90816, 90816, 93800, 93800, 97896, 97896, 97896, 101840, 101840, 105528, 105528, 105528, 110136, 110136, 110136, 110136, 115040, 115040, 115040, 119816, 119816, 119816, 124464, 124464, 124464, 128496, 128496, 128496, 133208, 133208, 133208, 137792, 137792, 137792, 142248, 142248, 142248, 146856, 146856,149776, 149776, 149776, 149776, 149776, 149776, 149776, 149776, 149776, 149776, 149776}
- }
-};
-RgSchUlIMcsTbl rgUlIMcsTbl = {
- {2, 0}, {2, 1}, {2, 2}, {2, 3}, {2, 4}, {2, 5},
- {2, 6}, {2, 7}, {2, 8}, {2, 9}, {2, 10},
- {4, 10}, {4, 11}, {4, 12}, {4, 13}, {4, 14},
- {4, 15}, {4, 16}, {4, 17}, {4, 18}, {4, 19},
- {6, 19}, {6, 20}, {6, 21}, {6, 22}, {6, 23},
- {6, 24}, {6, 25}, {6, 26}
-};
-RgSchUeCatTbl rgUeCatTbl = {
- /*Column1:Maximum number of bits of an UL-SCH
- transport block transmitted within a TTI
- - maxUlBits
- Column2:Maximum number of bits of a DLSCH
- transport block received within a TTI
- - maxDlBits
- Column3:Total number of soft channel bits
- - maxSftChBits
- Column4:Support for 64QAM in UL
- - ul64qamSup
- Column5:Maximum number of DL-SCH transport
- block bits received within a TTI
- - maxDlTbBits
- Column6:Maximum number of supported layers for
- spatial multiplexing in DL
- - maxTxLyrs*/
- {5160, {10296,0}, 250368, FALSE, 10296, 1},
- {25456, {51024,0}, 1237248, FALSE, 51024, 2},
- {51024, {75376,0}, 1237248, FALSE, 102048, 2},
- {51024, {75376,0}, 1827072, FALSE, 150752, 2},
- {75376, {149776,0}, 3667200, TRUE, 299552, 4},
- {51024, {75376,149776}, 3654144, FALSE, 301504, 4},
- {51024, {75376,149776}, 3654144, FALSE, 301504, 4},
- {149776,{299856,0}, 35982720,TRUE, 2998560, 8}
-};
-
-/* [ccpu00138532]-ADD-The below table stores the min HARQ RTT time
- in Downlink for TDD and FDD. Indices 0 to 6 map to tdd UL DL config 0-6.
- Index 7 map to FDD */
-uint8_t rgSchCmnHarqRtt[8] = {4,7,10,9,12,15,6,8};
-/* Number of CFI Switchover Index is equals to 7 TDD Indexes + 1 FDD index */
-uint8_t rgSchCfiSwitchOvrWinLen[] = {7, 4, 2, 3, 2, 1, 6, 8};
-
-/* EffTbl is calculated for single layer and two layers.
- * CqiToTbs is calculated for single layer and two layers */
-RgSchCmnTbSzEff rgSchCmnNorCfi1Eff[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnNorCfi2Eff[RGSCH_MAX_NUM_LYR_PERCW];
-RgSchCmnTbSzEff rgSchCmnNorCfi3Eff[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnNorCfi4Eff[RGSCH_MAX_NUM_LYR_PERCW];
-/* New variable to store UL effiency values for normal and extended CP*/
-RgSchCmnTbSzEff rgSchCmnNorUlEff[1],rgSchCmnExtUlEff[1];
-RgSchCmnCqiToTbs rgSchCmnNorCfi1CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnNorCfi2CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW];
-RgSchCmnCqiToTbs rgSchCmnNorCfi3CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnNorCfi4CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW];
-RgSchCmnCqiToTbs *rgSchCmnCqiToTbs[RGSCH_MAX_NUM_LYR_PERCW][RG_SCH_CMN_MAX_CP][RG_SCH_CMN_MAX_CFI];
-RgSchCmnTbSzEff rgSchCmnExtCfi1Eff[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnExtCfi2Eff[RGSCH_MAX_NUM_LYR_PERCW];
-RgSchCmnTbSzEff rgSchCmnExtCfi3Eff[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnExtCfi4Eff[RGSCH_MAX_NUM_LYR_PERCW];
-RgSchCmnCqiToTbs rgSchCmnExtCfi1CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnExtCfi2CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW];
-RgSchCmnCqiToTbs rgSchCmnExtCfi3CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnExtCfi4CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW];
-/* Include CRS REs while calculating Efficiency */
-RgSchCmnTbSzEff *rgSchCmnEffTbl[RGSCH_MAX_NUM_LYR_PERCW][RG_SCH_CMN_MAX_CP][RG_SCH_CMN_MAX_ANT_CONF][RG_SCH_CMN_MAX_CFI];
-RgSchCmnTbSzEff *rgSchCmnUlEffTbl[RG_SCH_CMN_MAX_CP];
-#ifdef LTE_TDD
-RgSchRaPrmblToRaFrmTbl rgRaPrmblToRaFrmTbl = {1, 2, 2, 3, 1};
-#else
-/* Added matrix 'rgRaPrmblToRaFrmTbl'for computation of RA sub-frames from RA preamble */
-RgSchRaPrmblToRaFrmTbl rgRaPrmblToRaFrmTbl = {1, 2, 2, 3};
-#endif
-
- RgUlSchdInits rgSchUlSchdInits;
- RgDlSchdInits rgSchDlSchdInits;
- RgDlfsSchdInits rgSchDlfsSchdInits;
-#ifdef EMTC_ENABLE
- RgEmtcUlSchdInits rgSchEmtcUlSchdInits;
- RgEmtcDlSchdInits rgSchEmtcDlSchdInits;
-#endif
-
-/* RACHO : start */
-static S16 rgSCHCmnUeIdleExdThrsld ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-RgSchUeCb* rgSCHCmnGetHoUe ARGS((
-RgSchCellCb *cell,
-uint16_t rapId
-));
-static Void rgSCHCmnDelDedPreamble ARGS((
-RgSchCellCb *cell,
-uint8_t preambleId
-));
-RgSchUeCb* rgSCHCmnGetPoUe ARGS((
-RgSchCellCb *cell,
-uint16_t rapId,
-CmLteTimingInfo timingInfo
-));
-static Void rgSCHCmnDelRachInfo ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-static S16 rgSCHCmnUlRbAllocForPoHoUe ARGS((
-RgSchCellCb *cell,
-RgSchUlSf *sf,
-RgSchUeCb *ue,
-uint8_t maxRb
-));
-static Void rgSCHCmnHdlHoPo ARGS((
-RgSchCellCb *cell,
-CmLListCp *raRspLst,
-RgSchRaReqInfo *raReq
-));
-static Void rgSCHCmnAllocPoHoGrnt ARGS((
-RgSchCellCb *cell,
-CmLListCp *raRspLst,
-RgSchUeCb *ue,
-RgSchRaReqInfo *raReq
-));
-static Void rgSCHCmnFillPdcchOdr2Sf ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchPdcch *pdcc,
-uint8_t rapId,
-uint8_t prachMskIdx
-));
-static Void rgSCHCmnDlAdd2PdcchOdrQ ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-static Void rgSCHCmnDlRmvFrmPdcchOdrQ ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-static Void rgSCHCmnUpdNxtPrchMskIdx ARGS((
-RgSchCellCb *cell
-));
-static Void rgSCHCmnUpdRachParam ARGS((
-RgSchCellCb *cell
-));
-static S16 rgSCHCmnAllocPOParam ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *dlSf,
-RgSchUeCb *ue,
-RgSchPdcch **pdcch,
-uint8_t *rapId,
-uint8_t *prachMskIdx
-));
-static Void rgSCHCmnGenPdcchOrder ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *dlSf
-));
-static Void rgSCHCmnCfgRachDedPrm ARGS((
-RgSchCellCb *cell
-));
-/* RACHO : end */
-
-static Void rgSCHCmnHdlUlInactUes ARGS((
-RgSchCellCb *cell
-));
-static Void rgSCHCmnHdlDlInactUes ARGS((
-RgSchCellCb *cell
-));
-static Void rgSCHCmnUlInit ARGS((Void
-));
-static Void rgSCHCmnDlInit ARGS((Void
-));
-static Void rgSCHCmnInitDlRbAllocInfo ARGS((
-RgSchCmnDlRbAllocInfo *allocInfo
-));
-static Void rgSCHCmnUpdUlCompEffBsr ARGS((
-RgSchUeCb *ue
-));
-#if RG_UNUSED
-static Void rgSCHCmnUlSetAllUnSched ARGS((
-RgSchCmnUlRbAllocInfo *allocInfo
-));
-static Void rgSCHCmnUlUpdSf ARGS((
- RgSchCellCb *cell,
- RgSchCmnUlRbAllocInfo *allocInfo,
- RgSchUlSf *sf
- ));
-static Void rgSCHCmnUlHndlAllocRetx ARGS((
- RgSchCellCb *cell,
- RgSchCmnUlRbAllocInfo *allocInfo,
- RgSchUlSf *sf,
- RgSchUlAlloc *alloc
- ));
-#endif
-static Void rgSCHCmnGrpPwrCntrlPucch ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *dlSf
-));
-static Void rgSCHCmnGrpPwrCntrlPusch ARGS((
-RgSchCellCb *cell,
-RgSchUlSf *ulSf
-));
-static Void rgSCHCmnDelUeFrmRefreshQ ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-static S16 rgSCHCmnTmrExpiry ARGS((
-PTR cb, /* Pointer to timer control block */
-S16 tmrEvnt /* Timer Event */
-));
-static S16 rgSCHCmnTmrProc ARGS((
-RgSchCellCb *cell
-));
-static Void rgSCHCmnAddUeToRefreshQ ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint32_t wait
-));
-static Void rgSCHCmnDlCcchRetx ARGS((
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *allocInfo
-));
-static Void rgSCHCmnUpdUeMimoInfo ARGS((
-RgrUeCfg *ueCfg,
-RgSchCmnDlUe *ueDl,
-RgSchCellCb *cell,
-RgSchCmnCell *cellSchd
-));
-static Void rgSCHCmnUpdUeUlCqiInfo ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchCmnUlUe *ueUl,
-RgSchCmnUe *ueSchCmn,
-RgSchCmnCell *cellSchd,
-Bool isEcp
-));
-#ifdef RGR_V1
-static Void rgSCHCmnDlCcchSduRetx ARGS((
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *allocInfo
-));
-static Void rgSCHCmnDlCcchSduTx ARGS((
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *allocInfo
-));
-static S16 rgSCHCmnCcchSduAlloc ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ueCb,
-RgSchCmnDlRbAllocInfo *allocInfo
-));
-static S16 rgSCHCmnCcchSduDedAlloc ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ueCb
-));
-static S16 rgSCHCmnNonDlfsCcchSduRbAlloc ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ueCb,
-RgSchDlSf *dlSf
-));
-#endif
-static Void rgSCHCmnInitVars ARGS((
- RgSchCellCb *cell
- ));
-
-/*ccpu00117180 - DEL - Moved rgSCHCmnUpdVars to .x as its access is now */
-static Void rgSCHCmnUlRbAllocForLst ARGS((
- RgSchCellCb *cell,
- RgSchUlSf *sf,
- uint32_t count,
- CmLListCp *reqLst,
- CmLListCp *schdLst,
- CmLListCp *nonSchdLst,
- Bool isNewTx
- ));
-static S16 rgSCHCmnUlRbAllocForUe ARGS((
- RgSchCellCb *cell,
- RgSchUlSf *sf,
- RgSchUeCb *ue,
- uint8_t maxRb,
- RgSchUlHole *hole
- ));
-static Void rgSCHCmnMsg3GrntReq ARGS((
- RgSchCellCb *cell,
- CmLteRnti rnti,
- Bool preamGrpA,
- RgSchUlHqProcCb *hqProc,
- RgSchUlAlloc **ulAllocRef,
- uint8_t *hqProcIdRef
- ));
-static Void rgSCHCmnDlCcchRarAlloc ARGS((
-RgSchCellCb *cell
-));
-static Void rgSCHCmnDlCcchTx ARGS((
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *allocInfo
-));
-static Void rgSCHCmnDlBcchPcch ARGS((
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *allocInfo,
-RgInfSfAlloc *subfrmAlloc
-));
-Bool rgSCHCmnChkInWin ARGS((
-CmLteTimingInfo frm,
-CmLteTimingInfo start,
-CmLteTimingInfo end
-));
-Bool rgSCHCmnChkPastWin ARGS((
-CmLteTimingInfo frm,
-CmLteTimingInfo end
-));
-static Void rgSCHCmnClcAlloc ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *sf,
-RgSchClcDlLcCb *lch,
-uint16_t rnti,
-RgSchCmnDlRbAllocInfo *allocInfo
-));
-#ifndef LTEMAC_SPS
-static Void rgSCHCmnClcRbAlloc ARGS((
-RgSchCellCb *cell,
-uint32_t bo,
-uint8_t cqi,
-uint8_t *rb,
-uint32_t *tbs,
-uint8_t *mcs,
-RgSchDlSf *sf
-));
-#endif
-
-static S16 rgSCHCmnMsg4Alloc ARGS((
-RgSchCellCb *cell,
-RgSchRaCb *raCb,
-RgSchCmnDlRbAllocInfo *allocInfo
-));
-static S16 rgSCHCmnMsg4DedAlloc ARGS((
-RgSchCellCb *cell,
-RgSchRaCb *raCb
-));
-static Void rgSCHCmnDlRaRsp ARGS((
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *allocInfo
-));
-static S16 rgSCHCmnRaRspAlloc ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-uint16_t rntiIdx,
-uint16_t rarnti,
-uint8_t noRaRnti,
-RgSchCmnDlRbAllocInfo *allocInfo
-));
-static Void rgSCHCmnUlUeDelAllocs ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-static Void rgSCHCmnDlSetUeAllocLmt ARGS((
-RgSchCellCb *cell,
-RgSchCmnDlUe *ueDl,
-Bool isEmtcUe
-));
-static S16 rgSCHCmnDlRgrCellCfg ARGS((
-RgSchCellCb *cell,
-RgrCellCfg *cfg,
-RgSchErrInfo *err
-));
-static Void rgSCHCmnUlAdapRetx ARGS((
-RgSchUlAlloc *alloc,
-RgSchUlHqProcCb *proc
-));
-static Void rgSCHCmnUlUpdAllocRetx ARGS((
-RgSchCellCb *cell,
-RgSchUlAlloc *alloc
-));
-static Void rgSCHCmnUlSfReTxAllocs ARGS((
-RgSchCellCb *cell,
-RgSchUlSf *sf
-));
-/* Fix: syed Adaptive Msg3 Retx crash. */
-#ifdef TFU_UPGRADE
-static Void rgSCHCmnDlHdlTxModeRecfg ARGS
-((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeRecfg *ueRecfg,
-uint8_t numTxPorts
-));
-#else
-static Void rgSCHCmnDlHdlTxModeRecfg ARGS
-((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeRecfg *ueRecfg
-));
-#endif
-
-
-/*
- * DL RB allocation specific functions
- */
-
-static Void rgSCHCmnDlRbAlloc ARGS((
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *allocInfo
-));
-static Void rgSCHCmnNonDlfsRbAlloc ARGS((
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *allocInfo
-));
-static S16 rgSCHCmnNonDlfsCmnRbAlloc ARGS((
-RgSchCellCb *cell,
-RgSchDlRbAlloc *cmnAllocInfo));
-
-#ifndef LTE_TDD
-static Void rgSCHCmnNonDlfsPbchRbAllocAdj ARGS((
-RgSchCellCb *cell,
-RgSchDlRbAlloc *cmnAllocInfo,
-uint8_t pbchSsRsSym,
-Bool isBcchPcch
-));
-/* Added function to adjust TBSize*/
-static Void rgSCHCmnNonDlfsPbchTbSizeAdj ARGS((
-RgSchDlRbAlloc *allocInfo,
-uint8_t numOvrlapgPbchRb,
-uint8_t pbchSsRsSym,
-uint8_t idx,
-uint32_t bytesReq
-));
-
-/* Added function to find num of overlapping PBCH rb*/
-static Void rgSCHCmnFindNumPbchOvrlapRbs ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *dlSf,
-RgSchDlRbAlloc *allocInfo,
-uint8_t *numOvrlapgPbchRb
-));
-
-static uint8_t rgSCHCmnFindNumAddtlRbsAvl ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *dlSf,
-RgSchDlRbAlloc *allocInfo
-));
-#ifdef DEBUGP
-#ifdef UNUSED_FUNC
-static Void rgSCHCmnFindCodeRate ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *dlSf,
-RgSchDlRbAlloc *allocInfo,
-uint8_t idx
-));
-#endif
-#endif
-#endif
-static Void rgSCHCmnNonDlfsMsg4Alloc ARGS((
-RgSchCellCb *cell,
-RgSchCmnMsg4RbAlloc *msg4AllocInfo,
-uint8_t isRetx
-));
-static S16 rgSCHCmnNonDlfsMsg4RbAlloc ARGS((
-RgSchCellCb *cell,
-RgSchRaCb *raCb,
-RgSchDlSf *dlSf
-));
-
-static S16 rgSCHCmnNonDlfsUeRbAlloc ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlSf *dlSf,
-uint8_t *isDlBwAvail
-));
-#ifndef LTEMAC_SPS
-static uint32_t rgSCHCmnCalcRiv ARGS(( uint8_t bw,
- uint8_t rbStart,
- uint8_t numRb));
-#endif
-
-#ifdef LTE_TDD
-static Void rgSCHCmnUpdHqAndDai ARGS((
-RgSchDlHqProcCb *hqP,
-RgSchDlSf *subFrm,
-RgSchDlHqTbCb *tbCb,
-uint8_t tbAllocIdx
-));
-static S16 rgSCHCmnUlCalcAvailBw ARGS((
-RgSchCellCb *cell,
-RgrCellCfg *cellCfg,
-uint8_t cfi,
-uint8_t *rbStartRef,
-uint8_t *bwAvailRef
-));
-static S16 rgSCHCmnDlKdashUlAscInit ARGS((
-RgSchCellCb *cell
-));
-static S16 rgSCHCmnDlANFdbkInit ARGS((
-RgSchCellCb *cell
-));
-static S16 rgSCHCmnDlNpValInit ARGS((
-RgSchCellCb *cell
-));
-static S16 rgSCHCmnDlCreateRachPrmLst ARGS((
-RgSchCellCb *cell
-));
-static S16 rgSCHCmnDlCpyRachInfo ARGS((
-RgSchCellCb *cell,
-RgSchTddRachRspLst rachRspLst[][RGSCH_NUM_SUB_FRAMES],
-uint8_t raArrSz
-));
-static S16 rgSCHCmnDlRachInfoInit ARGS((
-RgSchCellCb *cell
-));
-static S16 rgSCHCmnDlPhichOffsetInit ARGS((
-RgSchCellCb *cell
-));
-#endif
-#ifdef TFU_UPGRADE
-static Void rgSCHCmnFindUlCqiUlTxAnt ARGS
-((
- RgSchCellCb *cell,
- RgSchUeCb *ue,
- uint8_t wideCqi
- ));
- static RgSchCmnRank rgSCHCmnComputeRank ARGS
-((
- RgrTxMode txMode,
- uint32_t *pmiBitMap,
- uint8_t numTxPorts
- ));
-
- static RgSchCmnRank rgSCHCmnComp2TxMode3 ARGS
-((
- uint32_t *pmiBitMap
- ));
-
- static RgSchCmnRank rgSCHCmnComp4TxMode3 ARGS
-((
- uint32_t *pmiBitMap
- ));
-
- static RgSchCmnRank rgSCHCmnComp2TxMode4 ARGS
-((
- uint32_t *pmiBitMap
- ));
-
- static RgSchCmnRank rgSCHCmnComp4TxMode4 ARGS
-((
- uint32_t *pmiBitMap
- ));
-
- static uint8_t rgSCHCmnCalcWcqiFrmSnr ARGS
-((
- RgSchCellCb *cell,
- TfuSrsRpt *srsRpt
- ));
-#endif
-
-/* comcodsepa : start */
-\f
-/**
- * @brief This function computes efficiency and stores in a table.
- *
- * @details
- *
- * Function: rgSCHCmnCompEff
- * Purpose: this function computes the efficiency as number of
- * bytes per 1024 symbols. The CFI table is also filled
- * with the same information such that comparison is valid
- *
- * Invoked by: Scheduler
- *
- * @param[in] uint8_t noPdcchSym
- * @param[in] uint8_t cpType
- * @param[in] uint8_t txAntIdx
- * @param[in] RgSchCmnTbSzEff* effTbl
- * @return Void
- *
- **/
-static Void rgSCHCmnCompEff(uint8_t noPdcchSym,uint8_t cpType,uint8_t txAntIdx,RgSchCmnTbSzEff *effTbl)
-{
- uint8_t noResPerRb;
- uint8_t noSymPerRb;
- uint8_t resOfCrs; /* Effective REs occupied by CRS */
- uint8_t i, j;
-
-
- switch (cpType)
- {
- case RG_SCH_CMN_NOR_CP:
- noSymPerRb = 14;
- break;
- case RG_SCH_CMN_EXT_CP:
- noSymPerRb = 12;
- break;
- default:
- /* Generate a log error. This case should never be executed */
- return;
- }
-
- /* Depending on the Tx Antenna Index, deduct the
- * Resource elements for the CRS */
- switch (txAntIdx)
- {
- case 0:
- resOfCrs = RG_SCH_CMN_EFF_CRS_ONE_ANT_PORT;
- break;
- case 1:
- resOfCrs = RG_SCH_CMN_EFF_CRS_TWO_ANT_PORT;
- break;
- case 2:
- resOfCrs = RG_SCH_CMN_EFF_CRS_FOUR_ANT_PORT;
- break;
- default:
- /* Generate a log error. This case should never be executed */
- return;
- }
- noResPerRb = ((noSymPerRb - noPdcchSym) * RB_SCH_CMN_NUM_SCS_PER_RB) - resOfCrs;
- for (i = 0; i < RG_SCH_CMN_NUM_TBS; i++)
- {
- (*effTbl)[i] = 0;
- for (j = 0; j < RG_SCH_CMN_NUM_RBS; j++)
- {
- /* This line computes the coding efficiency per 1024 REs */
- (*effTbl)[i] += (rgTbSzTbl[0][i][j] * 1024) / (noResPerRb * (j+1));
- }
- (*effTbl)[i] /= RG_SCH_CMN_NUM_RBS;
- }
- return;
-}
-/**
- * @brief This function computes efficiency and stores in a table.
- *
- * @details
- *
- * Function: rgSCHCmnCompUlEff
- * Purpose: this function computes the efficiency as number of
- * bytes per 1024 symbols. The CFI table is also filled
- * with the same information such that comparison is valid
- *
- * Invoked by: Scheduler
- *
- * @param[in] uint8_t noUlRsSym
- * @param[in] uint8_t cpType
- * @param[in] uint8_t txAntIdx
- * @param[in] RgSchCmnTbSzEff* effTbl
- * @return Void
- *
- **/
-static Void rgSCHCmnCompUlEff(uint8_t noUlRsSym,uint8_t cpType,RgSchCmnTbSzEff *effTbl)
-{
- uint8_t noResPerRb;
- uint8_t noSymPerRb;
- uint8_t i, j;
-
-
- switch (cpType)
- {
- case RG_SCH_CMN_NOR_CP:
- noSymPerRb = 14;
- break;
- case RG_SCH_CMN_EXT_CP:
- noSymPerRb = 12;
- break;
- default:
- /* Generate a log error. This case should never be executed */
- return;
- }
-
- noResPerRb = ((noSymPerRb - noUlRsSym) * RB_SCH_CMN_NUM_SCS_PER_RB);
- for (i = 0; i < RG_SCH_CMN_NUM_TBS; i++)
- {
- (*effTbl)[i] = 0;
- for (j = 0; j < RG_SCH_CMN_NUM_RBS; j++)
- {
- /* This line computes the coding efficiency per 1024 REs */
- (*effTbl)[i] += (rgTbSzTbl[0][i][j] * 1024) / (noResPerRb * (j+1));
- }
- (*effTbl)[i] /= RG_SCH_CMN_NUM_RBS;
- }
- return;
-}
-
-/**
- * @brief This function computes efficiency for 2 layers and stores in a table.
- *
- * @details
- *
- * Function: rgSCHCmn2LyrCompEff
- * Purpose: this function computes the efficiency as number of
- * bytes per 1024 symbols. The CFI table is also filled
- * with the same information such that comparison is valid
- *
- * Invoked by: Scheduler
- *
- * @param[in] uint8_t noPdcchSym
- * @param[in] uint8_t cpType
- * @param[in] uint8_t txAntIdx
- * @param[in] RgSchCmnTbSzEff* effTbl2Lyr
- * @return Void
- *
- **/
-static Void rgSCHCmn2LyrCompEff(uint8_t noPdcchSym,uint8_t cpType,uint8_t txAntIdx,RgSchCmnTbSzEff *effTbl2Lyr)
-{
- uint8_t noResPerRb;
- uint8_t noSymPerRb;
- uint8_t resOfCrs; /* Effective REs occupied by CRS */
- uint8_t i, j;
-
-
- switch (cpType)
- {
- case RG_SCH_CMN_NOR_CP:
- noSymPerRb = 14;
- break;
- case RG_SCH_CMN_EXT_CP:
- noSymPerRb = 12;
- break;
- default:
- /* Generate a log error. This case should never be executed */
- return;
- }
-
- /* Depending on the Tx Antenna Index, deduct the
- * Resource elements for the CRS */
- switch (txAntIdx)
- {
- case 0:
- resOfCrs = RG_SCH_CMN_EFF_CRS_ONE_ANT_PORT;
- break;
- case 1:
- resOfCrs = RG_SCH_CMN_EFF_CRS_TWO_ANT_PORT;
- break;
- case 2:
- resOfCrs = RG_SCH_CMN_EFF_CRS_FOUR_ANT_PORT;
- break;
- default:
- /* Generate a log error. This case should never be executed */
- return;
- }
-
- noResPerRb = ((noSymPerRb - noPdcchSym) * RB_SCH_CMN_NUM_SCS_PER_RB) - resOfCrs;
- for (i = 0; i < RG_SCH_CMN_NUM_TBS; i++)
- {
- (*effTbl2Lyr)[i] = 0;
- for (j = 0; j < RG_SCH_CMN_NUM_RBS; j++)
- {
- /* This line computes the coding efficiency per 1024 REs */
- (*effTbl2Lyr)[i] += (rgTbSzTbl[1][i][j] * 1024) / (noResPerRb * (j+1));
- }
- (*effTbl2Lyr)[i] /= RG_SCH_CMN_NUM_RBS;
- }
- return;
-}
-
-\f
-/**
- * @brief This function initializes the rgSchCmnDciFrmtSizes table.
- *
- * @details
- *
- * Function: rgSCHCmnGetDciFrmtSizes
- * Purpose: This function determines the sizes of all
- * the available DCI Formats. The order of
- * bits addition for each format is inaccordance
- * with the specs.
- * Invoked by: rgSCHCmnRgrCellCfg
- *
- * @return Void
- *
- **/
-static Void rgSCHCmnGetDciFrmtSizes(RgSchCellCb *cell)
-{
-
-
- /* DCI Format 0 size determination */
- rgSchCmnDciFrmtSizes[0] = 1 +
- 1 +
- rgSCHUtlLog32bitNbase2((cell->bwCfg.ulTotalBw * \
- (cell->bwCfg.ulTotalBw + 1))/2) +
- 5 +
- 1 +
- 2 +
- 3 +
-#ifdef LTE_TDD
- 2 +
- 2 +
-#endif
- 1;
- /* DCI Format 1 size determination */
- rgSchCmnDciFrmtSizes[1] = 1 +
- RGSCH_CEIL(cell->bwCfg.dlTotalBw, cell->rbgSize) +
- 5 +
-#ifndef LTE_TDD
- 3 +
-#else
- 4 + 2 + /* HqProc Id and DAI */
-#endif
- 1 +
- 2 +
- 2;
-
- /* DCI Format 1A size determination */
- rgSchCmnDciFrmtSizes[2] = 1 + /* Flag for format0/format1a differentiation */
- 1 + /* Localized/distributed VRB assignment flag */
- 5 + /* For mcs */
-#ifndef LTE_TDD
- 3 + /* Harq process Id */
-#else
- 4 + /* Harq process Id */
- 2 + /* UL Index or DAI */
-#endif
- 1 + /* New Data Indicator */
- 2 + /* For RV */
- 2 + /* For tpc */
- 1 + rgSCHUtlLog32bitNbase2((cell->bwCfg.dlTotalBw * \
- (cell->bwCfg.dlTotalBw + 1))/2);
- /* Resource block assignment ceil[log2(bw(bw+1)/2)] : \
- Since VRB is local */
-
- /* DCI Format 1B size determination */
- rgSchCmnDciFrmtSizes[3] = 1 +
- rgSCHUtlLog32bitNbase2((cell->bwCfg.dlTotalBw * \
- (cell->bwCfg.dlTotalBw + 1))/2) +
- 5 +
- 3 +
-#ifdef LTE_TDD
- 1 + /* HqP */
- 2 + /* Dai */
-#endif
- 1 +
- 2 +
- 2 +
- ((cell->numTxAntPorts == 4)? 4:2) +
- 1;
-
- /* DCI Format 1C size determination */
- /* Approximation: NDLVrbGap1 ~= Nprb for DL */
- rgSchCmnDciFrmtSizes[4] = (cell->bwCfg.dlTotalBw < 50)? 0:1 +
- (cell->bwCfg.dlTotalBw < 50)?
- (rgSCHUtlLog32bitNbase2((cell->bwCfg.dlTotalBw/2 * \
- (cell->bwCfg.dlTotalBw/2 + 1))/2)) :
- (rgSCHUtlLog32bitNbase2((cell->bwCfg.dlTotalBw/4 * \
- (cell->bwCfg.dlTotalBw/4 + 1))/2)) +
- 5;
-
- /* DCI Format 1D size determination */
- rgSchCmnDciFrmtSizes[5] = 1 +
- rgSCHUtlLog32bitNbase2((cell->bwCfg.dlTotalBw * \
- (cell->bwCfg.dlTotalBw + 1))/2) +
- 5 +
- 3 +
-#ifdef LTE_TDD
- 1 + 2 +
-#endif
- 1 +
- 2 +
- 2 +
- ((cell->numTxAntPorts == 4)? 4:2) +
- 1;
-
- /* DCI Format 2 size determination */
- rgSchCmnDciFrmtSizes[6] = ((cell->bwCfg.dlTotalBw < 10)?0:1) +
- RGSCH_CEIL(cell->bwCfg.dlTotalBw, cell->rbgSize) +
- 2 +
-#ifdef LTE_TDD
- 2 + 1 +
-#endif
- 3 +
- 1 +
- (5 + 1 + 2)*2 +
- ((cell->numTxAntPorts == 4)? 6:3);
-
- /* DCI Format 2A size determination */
- rgSchCmnDciFrmtSizes[7] = ((cell->bwCfg.dlTotalBw < 10)?0:1) +
- RGSCH_CEIL(cell->bwCfg.dlTotalBw, cell->rbgSize) +
- 2 +
-#ifdef LTE_TDD
- 2 + 1 +
-#endif
- 3 +
- 1 +
- (5 + 1 + 2)*2 +
- ((cell->numTxAntPorts == 4)? 2:0);
-
- /* DCI Format 3 size determination */
- rgSchCmnDciFrmtSizes[8] = rgSchCmnDciFrmtSizes[0];
-
- /* DCI Format 3A size determination */
- rgSchCmnDciFrmtSizes[9] = rgSchCmnDciFrmtSizes[0];
-
- return;
-}
-
-
-/**
- * @brief This function initializes the cmnCell->dciAggrLvl table.
- *
- * @details
- *
- * Function: rgSCHCmnGetCqiDciFrmt2AggrLvl
- * Purpose: This function determines the Aggregation level
- * for each CQI level against each DCI format.
- * Invoked by: rgSCHCmnRgrCellCfg
- *
- * @return Void
- *
- **/
-static Void rgSCHCmnGetCqiDciFrmt2AggrLvl(RgSchCellCb *cell)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- uint8_t i;
- uint8_t j;
-
-
- for (i = 0; i < RG_SCH_CMN_MAX_CQI; i++)
- {
- for (j = 0; j < 10; j++)
- {
- uint32_t pdcchBits; /* Actual number of phy bits needed for a given DCI Format
- * for a given CQI Level */
- pdcchBits = (rgSchCmnDciFrmtSizes[j] * 1024)/rgSchCmnCqiPdcchEff[i];
- /* V5G_211 : 6.6 */
- if (pdcchBits < 192)
- {
- cellSch->dciAggrLvl[i][j] = CM_LTE_AGGR_LVL2;
- continue;
- }
- if (pdcchBits < 384)
- {
- cellSch->dciAggrLvl[i][j] = CM_LTE_AGGR_LVL4;
- continue;
- }
- if (pdcchBits < 768)
- {
- cellSch->dciAggrLvl[i][j] = CM_LTE_AGGR_LVL8;
- continue;
- }
- cellSch->dciAggrLvl[i][j] = CM_LTE_AGGR_LVL16;
- }
- }
- return;
-}
-\f
-/**
- * @brief This function initializes all the data for the scheduler.
- *
- * @details
- *
- * Function: rgSCHCmnDlInit
- * Purpose: This function initializes the following information:
- * 1. Efficiency table
- * 2. CQI to table index - It is one row for upto 3 RBs
- * and another row for greater than 3 RBs
- * currently extended prefix is compiled out.
- * Invoked by: MAC intialization code..may be ActvInit
- *
- * @return Void
- *
- **/
-static Void rgSCHCmnDlInit()
-{
- uint8_t i;
- S16 j;
- S16 k;
- uint8_t idx;
- RgSchCmnTbSzEff *effTbl;
- RgSchCmnCqiToTbs *tbsTbl;
-
-
- /* 0 corresponds to Single layer case, 1 corresponds to 2 layers case*/
- /* Init Efficiency table for normal cyclic prefix */
- /*Initialize Efficiency table for Layer Index 0 */
- /*Initialize Efficiency table for Tx Antenna Port Index 0 */
- /*Initialize Efficiency table for each of the CFI indices. The
- * 4th Dimension of the rgSCHCmnEffTbl table refers to the CFI Index*/
- rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][0][0] = &rgSchCmnNorCfi1Eff[0];
- rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][0][1] = &rgSchCmnNorCfi2Eff[0];
- rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][0][2] = &rgSchCmnNorCfi3Eff[0];
- rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][0][3] = &rgSchCmnNorCfi4Eff[0];
- /*Initialize Efficency table for Tx Antenna Port Index 1 */
- rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][1][0] = &rgSchCmnNorCfi1Eff[0];
- rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][1][1] = &rgSchCmnNorCfi2Eff[0];
- rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][1][2] = &rgSchCmnNorCfi3Eff[0];
- rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][1][3] = &rgSchCmnNorCfi4Eff[0];
- /*Initialize Efficency table for Tx Antenna Port Index 2 */
- rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][2][0] = &rgSchCmnNorCfi1Eff[0];
- rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][2][1] = &rgSchCmnNorCfi2Eff[0];
- rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][2][2] = &rgSchCmnNorCfi3Eff[0];
- rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][2][3] = &rgSchCmnNorCfi4Eff[0];
-
- /*Initialize CQI to TBS table for Layer Index 0 for Normal CP */
- rgSchCmnCqiToTbs[0][RG_SCH_CMN_NOR_CP][0] = &rgSchCmnNorCfi1CqiToTbs[0];
- rgSchCmnCqiToTbs[0][RG_SCH_CMN_NOR_CP][1] = &rgSchCmnNorCfi2CqiToTbs[0];
- rgSchCmnCqiToTbs[0][RG_SCH_CMN_NOR_CP][2] = &rgSchCmnNorCfi3CqiToTbs[0];
- rgSchCmnCqiToTbs[0][RG_SCH_CMN_NOR_CP][3] = &rgSchCmnNorCfi4CqiToTbs[0];
-
- /*Intialize Efficency table for Layer Index 1 */
- /*Initialize Efficiency table for Tx Antenna Port Index 0 */
- /*Initialize Efficiency table for each of the CFI indices. The
- * 4th Dimension of the rgSCHCmnEffTbl table refers to the CFI Index*/
- rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][0][0] = &rgSchCmnNorCfi1Eff[1];
- rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][0][1] = &rgSchCmnNorCfi2Eff[1];
- rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][0][2] = &rgSchCmnNorCfi3Eff[1];
- rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][0][3] = &rgSchCmnNorCfi4Eff[1];
- /*Initialize Efficiency table for Tx Antenna Port Index 1 */
- rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][1][0] = &rgSchCmnNorCfi1Eff[1];
- rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][1][1] = &rgSchCmnNorCfi2Eff[1];
- rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][1][2] = &rgSchCmnNorCfi3Eff[1];
- rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][1][3] = &rgSchCmnNorCfi4Eff[1];
- /*Initialize Efficiency table for Tx Antenna Port Index 2 */
- rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][2][0] = &rgSchCmnNorCfi1Eff[1];
- rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][2][1] = &rgSchCmnNorCfi2Eff[1];
- rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][2][2] = &rgSchCmnNorCfi3Eff[1];
- rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][2][3] = &rgSchCmnNorCfi4Eff[1];
-
- /*Initialize CQI to TBS table for Layer Index 1 for Normal CP */
- rgSchCmnCqiToTbs[1][RG_SCH_CMN_NOR_CP][0] = &rgSchCmnNorCfi1CqiToTbs[1];
- rgSchCmnCqiToTbs[1][RG_SCH_CMN_NOR_CP][1] = &rgSchCmnNorCfi2CqiToTbs[1];
- rgSchCmnCqiToTbs[1][RG_SCH_CMN_NOR_CP][2] = &rgSchCmnNorCfi3CqiToTbs[1];
- rgSchCmnCqiToTbs[1][RG_SCH_CMN_NOR_CP][3] = &rgSchCmnNorCfi4CqiToTbs[1];
-
- for (idx = 0; idx < RG_SCH_CMN_MAX_ANT_CONF; idx++)
- {
- for (i = 0; i < RG_SCH_CMN_MAX_CFI; i++)
- {
- /* EfficiencyTbl calculation incase of 2 layers for normal CP */
- rgSCHCmnCompEff((uint8_t)(i + 1), RG_SCH_CMN_NOR_CP, idx,\
- rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][idx][i]);
- rgSCHCmn2LyrCompEff((uint8_t)(i + 1), RG_SCH_CMN_NOR_CP, idx, \
- rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][idx][i]);
- }
- }
-
- for (idx = 0; idx < RG_SCH_CMN_MAX_ANT_CONF; idx++)
- {
- for (i = 0; i < RG_SCH_CMN_MAX_CFI; i++)
- {
- effTbl = rgSchCmnEffTbl[0][RG_SCH_CMN_NOR_CP][idx][i];
- tbsTbl = rgSchCmnCqiToTbs[0][RG_SCH_CMN_NOR_CP][i];
- for (j = RG_SCH_CMN_NUM_TBS - 1, k = RG_SCH_CMN_MAX_CQI - 1;
- (j >= 0) && (k > 0); --j)
- {
- /* ADD CQI to MCS mapping correction
- * single dimensional array is replaced by 2 dimensions for different CFI*/
- if ((*effTbl)[j] <= rgSchCmnCqiPdschEff[i][k])
- {
- (*tbsTbl)[k--] = (uint8_t)j;
- }
- }
- for (; k > 0; --k)
- {
- (*tbsTbl)[k] = 0;
- }
- /* effTbl,tbsTbl calculation incase of 2 layers for normal CP */
- effTbl = rgSchCmnEffTbl[1][RG_SCH_CMN_NOR_CP][idx][i];
- tbsTbl = rgSchCmnCqiToTbs[1][RG_SCH_CMN_NOR_CP][i];
- for (j = RG_SCH_CMN_NUM_TBS - 1, k = RG_SCH_CMN_MAX_CQI - 1;
- (j >= 0) && (k > 0); --j)
- {
- /* ADD CQI to MCS mapping correction
- * single dimensional array is replaced by 2 dimensions for different CFI*/
- if ((*effTbl)[j] <= rgSchCmn2LyrCqiPdschEff[i][k])
- {
- (*tbsTbl)[k--] = (uint8_t)j;
- }
- }
- for (; k > 0; --k)
- {
- (*tbsTbl)[k] = 0;
- }
- }
- }
-
- /* Efficiency Table for Extended CP */
- /*Initialize Efficiency table for Layer Index 0 */
- /*Initialize Efficiency table for Tx Antenna Port Index 0 */
- /*Initialize Efficiency table for each of the CFI indices. The
- * 4th Dimension of the rgSCHCmnEffTbl table refers to the CFI Index*/
- rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][0][0] = &rgSchCmnExtCfi1Eff[0];
- rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][0][1] = &rgSchCmnExtCfi2Eff[0];
- rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][0][2] = &rgSchCmnExtCfi3Eff[0];
- rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][0][3] = &rgSchCmnExtCfi4Eff[0];
- /*Initialize Efficency table for Tx Antenna Port Index 1 */
- rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][1][0] = &rgSchCmnExtCfi1Eff[0];
- rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][1][1] = &rgSchCmnExtCfi2Eff[0];
- rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][1][2] = &rgSchCmnExtCfi3Eff[0];
- rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][1][3] = &rgSchCmnExtCfi4Eff[0];
- /*Initialize Efficency table for Tx Antenna Port Index 2 */
- rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][2][0] = &rgSchCmnExtCfi1Eff[0];
- rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][2][1] = &rgSchCmnExtCfi2Eff[0];
- rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][2][2] = &rgSchCmnExtCfi3Eff[0];
- rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][2][3] = &rgSchCmnExtCfi4Eff[0];
-
- /*Initialize CQI to TBS table for Layer Index 0 for Extended CP */
- rgSchCmnCqiToTbs[0][RG_SCH_CMN_EXT_CP][0] = &rgSchCmnExtCfi1CqiToTbs[0];
- rgSchCmnCqiToTbs[0][RG_SCH_CMN_EXT_CP][1] = &rgSchCmnExtCfi2CqiToTbs[0];
- rgSchCmnCqiToTbs[0][RG_SCH_CMN_EXT_CP][2] = &rgSchCmnExtCfi3CqiToTbs[0];
- rgSchCmnCqiToTbs[0][RG_SCH_CMN_EXT_CP][3] = &rgSchCmnExtCfi4CqiToTbs[0];
-
- /*Initialize Efficiency table for Layer Index 1 */
- /*Initialize Efficiency table for each of the CFI indices. The
- * 4th Dimension of the rgSCHCmnEffTbl table refers to the CFI Index*/
- /*Initialize Efficency table for Tx Antenna Port Index 0 */
- rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][0][0] = &rgSchCmnExtCfi1Eff[1];
- rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][0][1] = &rgSchCmnExtCfi2Eff[1];
- rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][0][2] = &rgSchCmnExtCfi3Eff[1];
- rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][0][3] = &rgSchCmnExtCfi4Eff[1];
- /*Initialize Efficency table for Tx Antenna Port Index 1 */
- rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][1][0] = &rgSchCmnExtCfi1Eff[1];
- rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][1][1] = &rgSchCmnExtCfi2Eff[1];
- rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][1][2] = &rgSchCmnExtCfi3Eff[1];
- rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][1][3] = &rgSchCmnExtCfi4Eff[1];
- /*Initialize Efficency table for Tx Antenna Port Index 2 */
- rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][2][0] = &rgSchCmnExtCfi1Eff[1];
- rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][2][1] = &rgSchCmnExtCfi2Eff[1];
- rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][2][2] = &rgSchCmnExtCfi3Eff[1];
- rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][2][3] = &rgSchCmnExtCfi4Eff[1];
-
- /*Initialize CQI to TBS table for Layer Index 1 for Extended CP */
- rgSchCmnCqiToTbs[1][RG_SCH_CMN_EXT_CP][0] = &rgSchCmnExtCfi1CqiToTbs[1];
- rgSchCmnCqiToTbs[1][RG_SCH_CMN_EXT_CP][1] = &rgSchCmnExtCfi2CqiToTbs[1];
- rgSchCmnCqiToTbs[1][RG_SCH_CMN_EXT_CP][2] = &rgSchCmnExtCfi3CqiToTbs[1];
- rgSchCmnCqiToTbs[1][RG_SCH_CMN_EXT_CP][3] = &rgSchCmnExtCfi4CqiToTbs[1];
- /* Activate this code when extended cp is supported */
- for (idx = 0; idx < RG_SCH_CMN_MAX_ANT_CONF; idx++)
- {
- for (i = 0; i < RG_SCH_CMN_MAX_CFI; i++)
- {
- /* EfficiencyTbl calculation incase of 2 layers for extendedl CP */
- rgSCHCmnCompEff( (uint8_t)(i + 1 ), (uint8_t)RG_SCH_CMN_EXT_CP, idx,\
- rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][idx][i]);
- rgSCHCmn2LyrCompEff((uint8_t)(i + 1), (uint8_t) RG_SCH_CMN_EXT_CP,idx, \
- rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][idx][i]);
- }
- }
-
- for (idx = 0; idx < RG_SCH_CMN_MAX_ANT_CONF; idx++)
- {
- for (i = 0; i < RG_SCH_CMN_MAX_CFI; i++)
- {
- effTbl = rgSchCmnEffTbl[0][RG_SCH_CMN_EXT_CP][idx][i];
- tbsTbl = rgSchCmnCqiToTbs[0][RG_SCH_CMN_EXT_CP][i];
- for (j = RG_SCH_CMN_NUM_TBS - 1, k = RG_SCH_CMN_MAX_CQI - 1;
- (j >= 0) && (k > 0); --j)
- {
- /* ADD CQI to MCS mapping correction
- * single dimensional array is replaced by 2 dimensions for different CFI*/
- if ((*effTbl)[j] <= rgSchCmnCqiPdschEff[i][k])
- {
- (*tbsTbl)[k--] = (uint8_t)j;
- }
- }
- for (; k > 0; --k)
- {
- (*tbsTbl)[k] = 0;
- }
- /* effTbl,tbsTbl calculation incase of 2 layers for extended CP */
- effTbl = rgSchCmnEffTbl[1][RG_SCH_CMN_EXT_CP][idx][i];
- tbsTbl = rgSchCmnCqiToTbs[1][RG_SCH_CMN_EXT_CP][i];
- for (j = RG_SCH_CMN_NUM_TBS - 1, k = RG_SCH_CMN_MAX_CQI - 1;
- (j >= 0) && (k > 0); --j)
- {
- /* ADD CQI to MCS mapping correction
- * single dimensional array is replaced by 2 dimensions for different CFI*/
- if ((*effTbl)[j] <= rgSchCmn2LyrCqiPdschEff[i][k])
- {
- (*tbsTbl)[k--] = (uint8_t)j;
- }
- }
- for (; k > 0; --k)
- {
- (*tbsTbl)[k] = 0;
- }
- }
- }
- return;
-}
-\f
-/**
- * @brief This function initializes all the data for the scheduler.
- *
- * @details
- *
- * Function: rgSCHCmnUlInit
- * Purpose: This function initializes the following information:
- * 1. Efficiency table
- * 2. CQI to table index - It is one row for upto 3 RBs
- * and another row for greater than 3 RBs
- * currently extended prefix is compiled out.
- * Invoked by: MAC intialization code..may be ActvInit
- *
- * @return Void
- *
- **/
-static Void rgSCHCmnUlInit()
-{
- uint8_t *mapTbl = &rgSchCmnUlCqiToTbsTbl[RG_SCH_CMN_NOR_CP][0];
- RgSchCmnTbSzEff *effTbl = &rgSchCmnNorUlEff[0];
- const RgSchCmnUlCqiInfo *cqiTbl = &rgSchCmnUlCqiTbl[0];
- S16 i;
- S16 j;
-
- /* Initaializing new variable added for UL eff */
- rgSchCmnUlEffTbl[RG_SCH_CMN_NOR_CP] = &rgSchCmnNorUlEff[0];
- /* Reason behind using 3 as the number of symbols to rule out for
- * efficiency table computation would be that we are using 2 symbols for
- * DMRS(1 in each slot) and 1 symbol for SRS*/
- rgSCHCmnCompUlEff(RGSCH_UL_SYM_DMRS_SRS,RG_SCH_CMN_NOR_CP,rgSchCmnUlEffTbl[RG_SCH_CMN_NOR_CP]);
-
- for (i = RGSCH_NUM_ITBS - 1, j = RG_SCH_CMN_UL_NUM_CQI - 1;
- i >= 0 && j > 0; --i)
- {
- if ((*effTbl)[i] <= cqiTbl[j].eff)
- {
- mapTbl[j--] = (uint8_t)i;
- }
- }
- for (; j > 0; --j)
- {
- mapTbl[j] = 0;
- }
- effTbl = &rgSchCmnExtUlEff[0];
- mapTbl = &rgSchCmnUlCqiToTbsTbl[RG_SCH_CMN_EXT_CP][0];
-
- /* Initaializing new variable added for UL eff */
- rgSchCmnUlEffTbl[RG_SCH_CMN_EXT_CP] = &rgSchCmnExtUlEff[0];
- /* Reason behind using 3 as the number of symbols to rule out for
- * efficiency table computation would be that we are using 2 symbols for
- * DMRS(1 in each slot) and 1 symbol for SRS*/
- rgSCHCmnCompUlEff(3,RG_SCH_CMN_EXT_CP,rgSchCmnUlEffTbl[RG_SCH_CMN_EXT_CP]);
-
- for (i = RGSCH_NUM_ITBS - 1, j = RG_SCH_CMN_UL_NUM_CQI - 1;
- i >= 0 && j > 0; --i)
- {
- if ((*effTbl)[i] <= cqiTbl[j].eff)
- {
- mapTbl[j--] = (uint8_t)i;
- }
- }
- for (; j > 0; --j)
- {
- mapTbl[j] = 0;
- }
- rgSCHPwrInit();
- return;
-}
-
-/**
- * @brief This function initializes all the data for the scheduler.
- *
- * @details
- *
- * Function: rgSCHCmnInit
- * Purpose: This function initializes the following information:
- * 1. Efficiency table
- * 2. CQI to table index - It is one row for upto 3 RBs
- * and another row for greater than 3 RBs
- * currently extended prefix is compiled out.
- * Invoked by: MAC intialization code..may be ActvInit
- *
- * @return Void
- *
- **/
-Void rgSCHCmnInit()
-{
- uint8_t idx;
-
- rgSCHCmnDlInit();
- rgSCHCmnUlInit();
-#ifdef EMTC_ENABLE
- rgSCHEmtcCmnDlInit();
- rgSCHEmtcCmnUlInit();
-#endif
-#ifdef LTEMAC_SPS
- rgSCHCmnSpsInit();
-#endif
-
- /* Init the function pointers */
- rgSchCmnApis.rgSCHRgrUeCfg = rgSCHCmnRgrUeCfg;
- rgSchCmnApis.rgSCHRgrUeRecfg = rgSCHCmnRgrUeRecfg;
- rgSchCmnApis.rgSCHFreeUe = rgSCHCmnUeDel;
- rgSchCmnApis.rgSCHRgrCellCfg = rgSCHCmnRgrCellCfg;
- rgSchCmnApis.rgSCHRgrCellRecfg = rgSCHCmnRgrCellRecfg;
- rgSchCmnApis.rgSCHFreeCell = rgSCHCmnCellDel;
- rgSchCmnApis.rgSCHRgrLchCfg = rgSCHCmnRgrLchCfg;
- rgSchCmnApis.rgSCHRgrLcgCfg = rgSCHCmnRgrLcgCfg;
- rgSchCmnApis.rgSCHRgrLchRecfg = rgSCHCmnRgrLchRecfg;
- rgSchCmnApis.rgSCHRgrLcgRecfg = rgSCHCmnRgrLcgRecfg;
- rgSchCmnApis.rgSCHFreeDlLc = rgSCHCmnFreeDlLc;
- rgSchCmnApis.rgSCHFreeLcg = rgSCHCmnLcgDel;
- rgSchCmnApis.rgSCHRgrLchDel = rgSCHCmnRgrLchDel;
- rgSchCmnApis.rgSCHActvtUlUe = rgSCHCmnActvtUlUe;
- rgSchCmnApis.rgSCHActvtDlUe = rgSCHCmnActvtDlUe;
- rgSchCmnApis.rgSCHHdlUlTransInd = rgSCHCmnHdlUlTransInd;
- rgSchCmnApis.rgSCHDlDedBoUpd = rgSCHCmnDlDedBoUpd;
- rgSchCmnApis.rgSCHUlRecMsg3Alloc = rgSCHCmnUlRecMsg3Alloc;
- rgSchCmnApis.rgSCHUlCqiInd = rgSCHCmnUlCqiInd;
- rgSchCmnApis.rgSCHPucchDeltaPwrInd = rgSCHPwrPucchDeltaInd;
- rgSchCmnApis.rgSCHUlHqProcForUe = rgSCHCmnUlHqProcForUe;
-#ifdef RG_UNUSED
- rgSchCmnApis.rgSCHUpdUlHqProc = rgSCHCmnUpdUlHqProc;
-#endif
- rgSchCmnApis.rgSCHUpdBsrShort = rgSCHCmnUpdBsrShort;
- rgSchCmnApis.rgSCHUpdBsrTrunc = rgSCHCmnUpdBsrTrunc;
- rgSchCmnApis.rgSCHUpdBsrLong = rgSCHCmnUpdBsrLong;
- rgSchCmnApis.rgSCHUpdPhr = rgSCHCmnUpdPhr;
- rgSchCmnApis.rgSCHUpdExtPhr = rgSCHCmnUpdExtPhr;
- rgSchCmnApis.rgSCHContResUlGrant = rgSCHCmnContResUlGrant;
- rgSchCmnApis.rgSCHSrRcvd = rgSCHCmnSrRcvd;
- rgSchCmnApis.rgSCHFirstRcptnReq = rgSCHCmnFirstRcptnReq;
- rgSchCmnApis.rgSCHNextRcptnReq = rgSCHCmnNextRcptnReq;
- rgSchCmnApis.rgSCHFirstHqFdbkAlloc = rgSCHCmnFirstHqFdbkAlloc;
- rgSchCmnApis.rgSCHNextHqFdbkAlloc = rgSCHCmnNextHqFdbkAlloc;
- rgSchCmnApis.rgSCHDlProcAddToRetx = rgSCHCmnDlProcAddToRetx;
- rgSchCmnApis.rgSCHDlCqiInd = rgSCHCmnDlCqiInd;
-#ifdef EMTC_ENABLE
- rgSchCmnApis.rgSCHUlProcAddToRetx = rgSCHCmnEmtcUlProcAddToRetx;
-#endif
-#ifdef TFU_UPGRADE
- rgSchCmnApis.rgSCHSrsInd = rgSCHCmnSrsInd;
-#endif
- rgSchCmnApis.rgSCHDlTARpt = rgSCHCmnDlTARpt;
- rgSchCmnApis.rgSCHDlRlsSubFrm = rgSCHCmnDlRlsSubFrm;
- rgSchCmnApis.rgSCHUeReset = rgSCHCmnUeReset;
-#ifdef LTEMAC_SPS
- rgSchCmnApis.rgSCHHdlCrntiCE = rgSCHCmnHdlCrntiCE;
- rgSchCmnApis.rgSCHDlProcAck = rgSCHCmnDlProcAck;
- rgSchCmnApis.rgSCHDlRelPdcchFbk = rgSCHCmnDlRelPdcchFbk;
- rgSchCmnApis.rgSCHUlSpsRelInd = rgSCHCmnUlSpsRelInd;
- rgSchCmnApis.rgSCHUlSpsActInd = rgSCHCmnUlSpsActInd;
- rgSchCmnApis.rgSCHUlCrcFailInd = rgSCHCmnUlCrcFailInd;
- rgSchCmnApis.rgSCHUlCrcInd = rgSCHCmnUlCrcInd;
-#endif
- rgSchCmnApis.rgSCHDrxStrtInActvTmrInUl = rgSCHCmnDrxStrtInActvTmrInUl;
- rgSchCmnApis.rgSCHUpdUeDataIndLcg = rgSCHCmnUpdUeDataIndLcg;
-
- for (idx = 0; idx < RGSCH_NUM_SCHEDULERS; ++idx)
- {
- rgSchUlSchdInits[idx](&rgSchUlSchdTbl[idx]);
- rgSchDlSchdInits[idx](&rgSchDlSchdTbl[idx]);
- }
-#ifdef EMTC_ENABLE
- for (idx = 0; idx < RGSCH_NUM_EMTC_SCHEDULERS; ++idx)
- {
- rgSchEmtcUlSchdInits[idx](&rgSchEmtcUlSchdTbl[idx]);
- rgSchEmtcDlSchdInits[idx](&rgSchEmtcDlSchdTbl[idx]);
- }
-#endif
-#if (defined (RG_PHASE2_SCHED) && defined(TFU_UPGRADE))
- for (idx = 0; idx < RGSCH_NUM_DLFS_SCHEDULERS; ++idx)
- {
- rgSchDlfsSchdInits[idx](&rgSchDlfsSchdTbl[idx]);
- }
-#endif
-#ifdef LTE_ADV
- rgSchCmnApis.rgSCHRgrSCellUeCfg = rgSCHCmnRgrSCellUeCfg;
- rgSchCmnApis.rgSCHRgrSCellUeDel = rgSCHCmnRgrSCellUeDel;
-#endif
- return;
-}
-
-\f
-/**
- * @brief This function is a wrapper to call scheduler specific API.
- *
- * @details
- *
- * Function: rgSCHCmnDlRlsSubFrm
- * Purpose: Releases scheduler Information from DL SubFrm.
- *
- * Invoked by: DHM
- *
- * @param[in] RgSchCellCb *cell
- * @param[out] CmLteTimingInfo frm
- * @return Void
- *
- **/
-Void rgSCHCmnDlRlsSubFrm(RgSchCellCb *cell,CmLteTimingInfo frm)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- RgSchDlSf *sf;
-
-
- /* Get the pointer to the subframe */
- sf = rgSCHUtlSubFrmGet(cell, frm);
-
- rgSCHUtlSubFrmPut(cell, sf);
- if (sf->dlfsSf)
- {
- /* Re-initialize DLFS specific information for the sub-frame */
- cellSch->apisDlfs->rgSCHDlfsReinitSf(cell, sf);
- }
- return;
-}
-
-
-\f
-/**
- * @brief This function is the starting function for DL allocation.
- *
- * @details
- *
- * Function: rgSCHCmnDlCmnChAlloc
- * Purpose: Scheduling for downlink. It performs allocation in the order
- * of priority wich BCCH/PCH first, CCCH, Random Access and TA.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[out] RgSchCmnDlRbAllocInfo* allocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlCcchRarAlloc(RgSchCellCb *cell)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-
-
- rgSCHCmnDlCcchRetx(cell, &cellSch->allocInfo);
- /* LTE_ADV_FLAG_REMOVED_START */
- if(RG_SCH_ABS_ENABLED_ABS_SF == cell->lteAdvCb.absDlSfInfo)
- {
- if(cell->lteAdvCb.absCfg.absPatternType & RGR_ABS_MUTE)
- {
- /*eNodeB need to blank the subframe */
- }
- else
- {
- rgSCHCmnDlCcchTx(cell, &cellSch->allocInfo);
- }
- }
- else
- {
- rgSCHCmnDlCcchTx(cell, &cellSch->allocInfo);
- }
- /* LTE_ADV_FLAG_REMOVED_END */
-
-#ifdef RGR_V1
-
- /*Added these function calls for processing CCCH SDU arriving
- * after guard timer expiry.Functions differ from above two functions
- * in using ueCb instead of raCb.*/
- rgSCHCmnDlCcchSduRetx(cell, &cellSch->allocInfo);
- /* LTE_ADV_FLAG_REMOVED_START */
- if(RG_SCH_ABS_ENABLED_ABS_SF == cell->lteAdvCb.absDlSfInfo)
- {
- if(cell->lteAdvCb.absCfg.absPatternType & RGR_ABS_MUTE)
- {
- /*eNodeB need to blank the subframe */
- }
- else
- {
- rgSCHCmnDlCcchSduTx(cell, &cellSch->allocInfo);
- }
- }
- else
- {
- rgSCHCmnDlCcchSduTx(cell, &cellSch->allocInfo);
- }
- /* LTE_ADV_FLAG_REMOVED_END */
-#endif
-
-#ifdef LTE_TDD
- if(cellSch->ul.msg3SchdIdx != RGSCH_INVALID_INFO)
- {
- /* Do not schedule msg3 if there is a CFI change ongoing */
- if (cellSch->dl.currCfi == cellSch->dl.newCfi)
- {
- rgSCHCmnDlRaRsp(cell, &cellSch->allocInfo);
- }
- }
-#else
- /* LTE_ADV_FLAG_REMOVED_START */
- if(RG_SCH_ABS_ENABLED_ABS_SF == cell->lteAdvCb.absDlSfInfo)
- {
- if(cell->lteAdvCb.absCfg.absPatternType & RGR_ABS_MUTE)
- {
- /*eNodeB need to blank the subframe */
- }
- else
- {
- /* Do not schedule msg3 if there is a CFI change ongoing */
- if (cellSch->dl.currCfi == cellSch->dl.newCfi)
- {
- rgSCHCmnDlRaRsp(cell, &cellSch->allocInfo);
- }
- }
- }
- else
- {
- /* Do not schedule msg3 if there is a CFI change ongoing */
- if (cellSch->dl.currCfi == cellSch->dl.newCfi)
- {
- rgSCHCmnDlRaRsp(cell, &cellSch->allocInfo);
- }
- }
- /* LTE_ADV_FLAG_REMOVED_END */
-#endif
-
- return;
-}
-
-#ifdef RGR_V1
-/**
- * @brief Scheduling for CCCH SDU.
- *
- * @details
- *
- * Function: rgSCHCmnCcchSduAlloc
- * Purpose: Scheduling for CCCH SDU
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ueCb
- * @param[out] RgSchCmnDlRbAllocInfo *allocInfo
- * @return S16
- *
- **/
-static S16 rgSCHCmnCcchSduAlloc(RgSchCellCb *cell,RgSchUeCb *ueCb,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- RgSchDlRbAlloc *rbAllocInfo;
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ueCb,cell);
-
-
- /* Return if subframe BW exhausted */
- if (allocInfo->ccchSduAlloc.ccchSduDlSf->bw <=
- allocInfo->ccchSduAlloc.ccchSduDlSf->bwAssigned)
- {
- DU_LOG("\nERROR --> SCH : bw<=bwAssigned for UEID:%d",ueCb->ueId);
- return RFAILED;
- }
-
- if (rgSCHDhmGetCcchSduHqProc(ueCb, cellSch->dl.time, &(ueDl->proc)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : rgSCHDhmGetCcchSduHqProc failed UEID:%d",ueCb->ueId);
- return RFAILED;
- }
-
- rbAllocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ueCb, cell);
- rbAllocInfo->dlSf = allocInfo->ccchSduAlloc.ccchSduDlSf;
-
- if (rgSCHCmnCcchSduDedAlloc(cell, ueCb) != ROK)
- {
- /* Fix : syed Minor failure handling, release hqP if Unsuccessful */
- rgSCHDhmRlsHqpTb(ueDl->proc, 0, FALSE);
- DU_LOG("\nERROR --> SCH : rgSCHCmnCcchSduDedAlloc failed UEID:%d",ueCb->ueId);
- return RFAILED;
- }
- cmLListAdd2Tail(&allocInfo->ccchSduAlloc.ccchSduTxLst, &ueDl->proc->reqLnk);
- ueDl->proc->reqLnk.node = (PTR)ueDl->proc;
- allocInfo->ccchSduAlloc.ccchSduDlSf->schdCcchUe++;
-
- return ROK;
-}
-/**
- * @brief This function scheduler for downlink CCCH messages.
- *
- * @details
- *
- * Function: rgSCHCmnDlCcchSduTx
- * Purpose: Scheduling for downlink CCCH
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[out] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlCcchSduTx(RgSchCellCb *cell,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- CmLList *node;
- RgSchUeCb *ueCb;
- RgSchCmnDlUe *ueCmnDl;
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- RgSchDlSf *dlSf = allocInfo->ccchSduAlloc.ccchSduDlSf;
-
-
- node = cell->ccchSduUeLst.first;
- while(node)
- {
- if(cellSch->dl.maxCcchPerDlSf &&
- dlSf->schdCcchUe == cellSch->dl.maxCcchPerDlSf)
- {
- break;
- }
- else
- {
- ueCb = (RgSchUeCb *)(node->node);
- ueCmnDl = RG_SCH_CMN_GET_DL_UE(ueCb,cell);
- node = node->next;
- /* Fix : syed postpone scheduling for this
- * until msg4 is done */
- /* Fix : syed RLC can erroneously send CCCH SDU BO
- * twice. Hence an extra guard to avoid if already
- * scheduled for RETX */
- if ((!(ueCb->dl.dlInactvMask & RG_HQENT_INACTIVE)) &&
- (!ueCmnDl->proc))
- {
- if ((rgSCHCmnCcchSduAlloc(cell, ueCb, allocInfo)) != ROK)
- {
- break;
- }
- }
- else
- {
- DU_LOG("\nERROR --> SCH : THIS SHOULD "
- "NEVER HAPPEN for UEID:%d", ueCb->ueId);
- continue;
- }
- }
- }
- return;
-}
-#endif
-\f
-/**
- * @brief This function scheduler for downlink CCCH messages.
- *
- * @details
- *
- * Function: rgSCHCmnDlCcchTx
- * Purpose: Scheduling for downlink CCCH
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[out] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlCcchTx(RgSchCellCb *cell,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- CmLList *node;
- RgSchRaCb *raCb;
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- RgSchDlSf *dlSf = allocInfo->msg4Alloc.msg4DlSf;
-
- node = cell->raInfo.toBeSchdLst.first;
- while(node)
- {
- if(cellSch->dl.maxCcchPerDlSf &&
- dlSf->schdCcchUe == cellSch->dl.maxCcchPerDlSf)
- {
- break;
- }
- else
- {
-
- raCb = (RgSchRaCb *)(node->node);
- node = node->next;
- /* Address allocation for this UE for MSG 4 */
- /* Allocation for Msg4 */
- if ((rgSCHCmnMsg4Alloc(cell, raCb, allocInfo)) != ROK)
- {
- break;
- }
- }
- }
- return;
-}
-
-#ifdef RGR_V1
-/**
- * @brief This function scheduler for downlink CCCH messages.
- *
- * @details
- *
- * Function: rgSCHCmnDlCcchSduRetx
- * Purpose: Scheduling for downlink CCCH
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[out] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlCcchSduRetx(RgSchCellCb *cell,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- RgSchDlRbAlloc *rbAllocInfo;
- CmLList *node;
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- RgSchUeCb *ueCb;
- RgSchDlHqProcCb *hqP;
- uint8_t retxBw = 0;
- RgSchCmnDlUe *ueDl;
- RgSchDlSf *dlSf = allocInfo->ccchSduAlloc.ccchSduDlSf;
-
-
- node = cellSch->dl.ccchSduRetxLst.first;
- while(node)
- {
- if(cellSch->dl.maxCcchPerDlSf &&
- dlSf->schdCcchUe == cellSch->dl.maxCcchPerDlSf)
- {
- break;
- }
- else
- {
-
- hqP = (RgSchDlHqProcCb *)(node->node);
- node = node->next;
-
- /* DwPts Scheduling Changes Start */
-#ifdef LTE_TDD
- if (rgSCHCmnRetxAvoidTdd(allocInfo->ccchSduAlloc.ccchSduDlSf,
- cell, hqP) == TRUE)
- {
- continue;
- }
-#endif
- /* DwPts Scheduling Changes End */
-
- if (hqP->tbInfo[0].dlGrnt.numRb > (dlSf->bw - dlSf->bwAssigned))
- {
- break;
- }
- ueCb = (RgSchUeCb*)(hqP->hqE->ue);
- ueDl = RG_SCH_CMN_GET_DL_UE(ueCb,cell);
-
- rbAllocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ueCb, cell);
- /* Fill RB Alloc Info */
- rbAllocInfo->dlSf = dlSf;
- rbAllocInfo->tbInfo[0].bytesReq = hqP->tbInfo[0].ccchSchdInfo.totBytes;
- rbAllocInfo->rbsReq = hqP->tbInfo[0].dlGrnt.numRb;
- /* Fix : syed iMcs setting did not correspond to RETX */
- RG_SCH_CMN_GET_MCS_FOR_RETX((&hqP->tbInfo[0]),
- rbAllocInfo->tbInfo[0].imcs);
- rbAllocInfo->rnti = ueCb->ueId;
- rbAllocInfo->tbInfo[0].noLyr = hqP->tbInfo[0].numLyrs;
- /* Fix : syed Copying info in entirety without depending on stale TX information */
- rbAllocInfo->tbInfo[0].tbCb = &hqP->tbInfo[0];
- rbAllocInfo->tbInfo[0].schdlngForTb = TRUE;
- /* Fix : syed Assigning proc to scratchpad */
- ueDl->proc = hqP;
-
- retxBw += rbAllocInfo->rbsReq;
-
- cmLListAdd2Tail(&allocInfo->ccchSduAlloc.ccchSduRetxLst, \
- &hqP->reqLnk);
- hqP->reqLnk.node = (PTR)hqP;
- dlSf->schdCcchUe++;
- }
- }
- dlSf->bwAssigned += retxBw;
- return;
-}
-#endif
-\f
-/**
- * @brief This function scheduler for downlink CCCH messages.
- *
- * @details
- *
- * Function: rgSCHCmnDlCcchRetx
- * Purpose: Scheduling for downlink CCCH
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[out] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlCcchRetx(RgSchCellCb *cell,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- CmLList *node;
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- RgSchRaCb *raCb;
- RgSchDlHqProcCb *hqP;
- uint8_t retxBw = 0;
- RgSchDlSf *dlSf = allocInfo->msg4Alloc.msg4DlSf;
-
-
- node = cellSch->dl.msg4RetxLst.first;
- while(node)
- {
- if(cellSch->dl.maxCcchPerDlSf &&
- dlSf->schdCcchUe == cellSch->dl.maxCcchPerDlSf)
- {
- break;
- }
- else
- {
- hqP = (RgSchDlHqProcCb *)(node->node);
-
- node = node->next;
-
- /* DwPts Scheduling Changes Start */
-#ifdef LTE_TDD
- if (rgSCHCmnRetxAvoidTdd(allocInfo->msg4Alloc.msg4DlSf,
- cell, hqP) == TRUE)
- {
- continue;
- }
-#endif
- /* DwPts Scheduling Changes End */
-
- if (hqP->tbInfo[0].dlGrnt.numRb > (dlSf->bw - dlSf->bwAssigned))
- {
- break;
- }
- raCb = (RgSchRaCb*)(hqP->hqE->raCb);
- /* Fill RB Alloc Info */
- raCb->rbAllocInfo.dlSf = dlSf;
- raCb->rbAllocInfo.tbInfo[0].bytesReq = hqP->tbInfo[0].ccchSchdInfo.totBytes;
- raCb->rbAllocInfo.rbsReq = hqP->tbInfo[0].dlGrnt.numRb;
- /* Fix : syed iMcs setting did not correspond to RETX */
- RG_SCH_CMN_GET_MCS_FOR_RETX((&hqP->tbInfo[0]),
- raCb->rbAllocInfo.tbInfo[0].imcs);
- raCb->rbAllocInfo.rnti = raCb->tmpCrnti;
- raCb->rbAllocInfo.tbInfo[0].noLyr = hqP->tbInfo[0].numLyrs;
- /* Fix; syed Copying info in entirety without depending on stale TX information */
- raCb->rbAllocInfo.tbInfo[0].tbCb = &hqP->tbInfo[0];
- raCb->rbAllocInfo.tbInfo[0].schdlngForTb = TRUE;
-
- retxBw += raCb->rbAllocInfo.rbsReq;
-
- cmLListAdd2Tail(&allocInfo->msg4Alloc.msg4RetxLst, \
- &hqP->reqLnk);
- hqP->reqLnk.node = (PTR)hqP;
- dlSf->schdCcchUe++;
- }
- }
- dlSf->bwAssigned += retxBw;
- return;
-}
-
-\f
-/**
- * @brief This function implements scheduler DL allocation for
- * for broadcast (on PDSCH) and paging.
- *
- * @details
- *
- * Function: rgSCHCmnDlBcchPcch
- * Purpose: This function implements scheduler for DL allocation
- * for broadcast (on PDSCH) and paging.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static Void rgSCHCmnDlBcchPcch(RgSchCellCb *cell,RgSchCmnDlRbAllocInfo *allocInfo,RgInfSfAlloc *subfrmAlloc)
-{
- CmLteTimingInfo frm;
- RgSchDlSf *sf;
- RgSchClcDlLcCb *pcch;
- RgSchClcBoRpt *bo;
-#ifndef RGR_SI_SCH
- Bool valid;
- RgSchClcDlLcCb *bcch, *bch;
-#endif/*RGR_SI_SCH*/
-
-
- frm = cell->crntTime;
-#ifdef LTEMAC_HDFDD
- /* For HDFDD we need scheduling information at least RG_SCH_CMN_DL_DELTA
- + RG_SCH_CMN_HARQ_INTERVAL (7) subframes ahead */
- RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA + RG_SCH_CMN_HARQ_INTERVAL);
-#else
- // RGSCH_SUBFRAME_INDEX(frm);
- //RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA);
-#endif
-
- /* Compute the subframe for which allocation is being made */
- /* essentially, we need pointer to the dl frame for this subframe */
- sf = rgSCHUtlSubFrmGet(cell, frm);
-
-
-#ifndef RGR_SI_SCH
- bch = rgSCHDbmGetBcchOnBch(cell);
-#if (ERRCLASS & ERRCLS_DEBUG)
- if (bch == NULLP)
- {
- DU_LOG("\nERROR --> SCH : BCCH on BCH is not configured");
- return;
- }
-#endif
- if (bch->boLst.first != NULLP)
- {
- bo = (RgSchClcBoRpt *)(bch->boLst.first->node);
- if (RGSCH_TIMEINFO_SAME(frm, bo->timeToTx))
- {
- sf->bch.tbSize = bo->bo;
- cmLListDelFrm(&bch->boLst, bch->boLst.first);
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&bo, sizeof(*bo));
- rgSCHUtlFillRgInfCmnLcInfo(sf, subfrmAlloc, bch->lcId,TRUE);
- }
- }
- else
- {
- if ((frm.sfn % 4 == 0) && (frm.subframe == 0))
- {
- }
- }
-
- allocInfo->bcchAlloc.schdFirst = FALSE;
- bcch = rgSCHDbmGetFirstBcchOnDlsch(cell);
-#if (ERRCLASS & ERRCLS_DEBUG)
- if (bcch == NULLP)
- {
- DU_LOG("\nERROR --> SCH : BCCH on DLSCH is not configured");
- return;
- }
-#endif
- if (bcch->boLst.first != NULLP)
- {
- bo = (RgSchClcBoRpt *)(bcch->boLst.first->node);
-
- if (RGSCH_TIMEINFO_SAME(frm, bo->timeToTx))
- {
- allocInfo->bcchAlloc.schdFirst = TRUE;
- /* Time to perform allocation for this BCCH transmission */
- rgSCHCmnClcAlloc(cell, sf, bcch, RGSCH_SI_RNTI, allocInfo);
- }
- }
-
- if(!allocInfo->bcchAlloc.schdFirst)
- {
- CmLList *lnk;
- bcch = rgSCHDbmGetSecondBcchOnDlsch(cell);
-#if (ERRCLASS & ERRCLS_DEBUG)
- if (bcch == NULLP)
- {
- DU_LOG("\nERROR --> SCH : BCCH on DLSCH is not configured");
- return;
- }
-#endif
- lnk = bcch->boLst.first;
- while (lnk != NULLP)
- {
- bo = (RgSchClcBoRpt *)(lnk->node);
- lnk = lnk->next;
- valid = rgSCHCmnChkInWin(frm, bo->timeToTx, bo->maxTimeToTx);
-
- if(valid)
- {
- bo->i = RGSCH_CALC_SF_DIFF(frm, bo->timeToTx);
- /* Time to perform allocation for this BCCH transmission */
- rgSCHCmnClcAlloc(cell, sf, bcch, RGSCH_SI_RNTI, allocInfo);
- break;
- }
- else
- {
- valid = rgSCHCmnChkPastWin(frm, bo->maxTimeToTx);
- if(valid)
- {
- cmLListDelFrm(&bcch->boLst, &bo->boLstEnt);
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&bo,
- sizeof(RgSchClcBoRpt));
- }
- }
- }
- }
-#else
- rgSCHDlSiSched(cell, allocInfo, subfrmAlloc);
-#endif/*RGR_SI_SCH*/
-
- pcch = rgSCHDbmGetPcch(cell);
-#ifdef ERRCLS_KW
- if (pcch == NULLP)
- {
- DU_LOG("\nERROR --> SCH : PCCH on DLSCH is not configured");
- return;
- }
-#endif
- if (pcch->boLst.first != NULLP)
- {
- bo = (RgSchClcBoRpt *)(pcch->boLst.first->node);
-
- if (RGSCH_TIMEINFO_SAME(frm, bo->timeToTx))
- {
- /* Time to perform allocation for this PCCH transmission */
- rgSCHCmnClcAlloc(cell, sf, pcch, RGSCH_P_RNTI, allocInfo);
- }
- }
- return;
-}
-
-/*
-*
-* Fun: rgSCHCmnChkInWin
-*
-* Desc: This function checks if frm occurs in window
-*
-* Ret: TRUE - if in window
-* FALSE - otherwise
-*
-* Notes: None
-*
-* File: rg_sch_cmn.c
-*
-*/
-Bool rgSCHCmnChkInWin(CmLteTimingInfo frm,CmLteTimingInfo start,CmLteTimingInfo end)
-{
- Bool inWin = FALSE;
-
-
- if (end.sfn > start.sfn)
- {
- if (frm.sfn > start.sfn
- || (frm.sfn == start.sfn && frm.slot >= start.slot))
- {
- if (frm.sfn < end.sfn
-#ifdef EMTC_ENABLE
- || (frm.sfn == end.sfn && frm.slot <= end.slot))
-#else
- || (frm.sfn == end.sfn && frm.slot <= start.slot))
-#endif
- {
- inWin = TRUE;
- }
- }
- }
- /* Testing for wrap around, sfn wraparound check should be enough */
- else if (end.sfn < start.sfn)
- {
- if (frm.sfn > start.sfn
- || (frm.sfn == start.sfn && frm.slot >= start.slot))
- {
- inWin = TRUE;
- }
- else
- {
- if (frm.sfn < end.sfn
- || (frm.sfn == end.sfn && frm.slot <= end.slot))
- {
- inWin = TRUE;
- }
- }
- }
- else /* start.sfn == end.sfn */
- {
- if (frm.sfn == start.sfn
- && (frm.slot >= start.slot
- && frm.slot <= end.slot))
- {
- inWin = TRUE;
- }
- }
-
- return (inWin);
-} /* end of rgSCHCmnChkInWin*/
-
-/*
-*
-* Fun: rgSCHCmnChkPastWin
-*
-* Desc: This function checks if frm has gone past window edge
-*
-* Ret: TRUE - if past window edge
-* FALSE - otherwise
-*
-* Notes: None
-*
-* File: rg_sch_cmn.c
-*
-*/
-Bool rgSCHCmnChkPastWin(CmLteTimingInfo frm,CmLteTimingInfo end)
-{
- CmLteTimingInfo refFrm = end;
- Bool pastWin;
-
-
- RGSCH_INCR_FRAME(refFrm.sfn);
- RGSCH_INCR_SUB_FRAME(end, 1);
- pastWin = rgSCHCmnChkInWin(frm, end, refFrm);
-
- return (pastWin);
-} /* end of rgSCHCmnChkPastWin*/
-\f
-/**
- * @brief This function implements allocation of the resources for common
- * channels BCCH, PCCH.
- *
- * @details
- *
- * Function: rgSCHCmnClcAlloc
- * Purpose: This function implements selection of number of RBs based
- * the allowed grant for the service. It is also responsible
- * for selection of MCS for the transmission.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell,
- * @param[in] RgSchDlSf *sf,
- * @param[in] RgSchClcDlLcCb *lch,
- * @param[in] uint16_t rnti,
- * @param[out] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnClcAlloc(RgSchCellCb *cell,RgSchDlSf *sf,RgSchClcDlLcCb *lch,uint16_t rnti,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
- RgSchClcBoRpt *bo;
- uint32_t rb=0;
- uint8_t mcs;
- uint32_t tbs;
-#ifdef LTE_TDD
- uint8_t lostRe;
- uint8_t cfi = cellDl->currCfi;
-#endif
-
-
- bo = (RgSchClcBoRpt *)(lch->boLst.first->node);
-
- mcs = bo->mcs;
- tbs = bo->bo;
- /* rgSCHCmnClcRbAllocForFxdTb(cell, bo->bo, cellDl->ccchCqi, &rb);*/
- if(cellDl->bitsPerRb==0)
- {
- while ((rgTbSzTbl[0][0][rb]) < (tbs*8))
- {
- rb++;
- }
- rb = rb+1;
- }
- else
- {
- rb = RGSCH_CEIL((tbs*8), cellDl->bitsPerRb);
- }
- /* DwPTS Scheduling Changes Start */
-#ifdef LTE_TDD
- if(sf->sfType == RG_SCH_SPL_SF_DATA)
- {
- RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, cfi);
-
- /* Calculate the less RE's because of DwPTS */
- lostRe = rb * (cellDl->noResPerRb[cfi] - cellDl->numReDwPts[cfi]);
-
- /* Increase number of RBs in Spl SF to compensate for lost REs */
- rb += RGSCH_CEIL(lostRe, cellDl->numReDwPts[cfi]);
- }
-#endif
- /* DwPTS Scheduling Changes End */
- /*ccpu00115595- end*/
- /* additional check to see if required RBs
- * exceeds the available */
- if (rb > sf->bw - sf->bwAssigned)
- {
- DU_LOG("\nERROR --> SCH : BW allocation "
- "failed for CRNTI:%d",rnti);
- return;
- }
-
- /* Update the subframe Allocated BW field */
- sf->bwAssigned = sf->bwAssigned + rb;
- /* Fill in the BCCH/PCCH transmission info to the RBAllocInfo struct */
- if (rnti == RGSCH_SI_RNTI)
- {
- allocInfo->bcchAlloc.rnti = rnti;
- allocInfo->bcchAlloc.dlSf = sf;
- allocInfo->bcchAlloc.tbInfo[0].bytesReq = tbs;
- allocInfo->bcchAlloc.rbsReq = rb;
- allocInfo->bcchAlloc.tbInfo[0].imcs = mcs;
- allocInfo->bcchAlloc.tbInfo[0].noLyr = 1;
- /* Nprb indication at PHY for common Ch */
- allocInfo->bcchAlloc.nPrb = bo->nPrb;
- }
- else
- {
- allocInfo->pcchAlloc.rnti = rnti;
- allocInfo->pcchAlloc.dlSf = sf;
- allocInfo->pcchAlloc.tbInfo[0].bytesReq = tbs;
- allocInfo->pcchAlloc.rbsReq = rb;
- allocInfo->pcchAlloc.tbInfo[0].imcs = mcs;
- allocInfo->pcchAlloc.tbInfo[0].noLyr = 1;
- allocInfo->pcchAlloc.nPrb = bo->nPrb;
- }
- return;
-}
-
-\f
-/**
- * @brief This function implements PDCCH allocation for common channels.
- *
- * @details
- *
- * Function: rgSCHCmnCmnPdcchAlloc
- * Purpose: This function implements allocation of PDCCH for a UE.
- * 1. This uses index 0 of PDCCH table for efficiency.
- * 2. Uses he candidate PDCCH count for the aggr level.
- * 3. Look for availability for each candidate and choose
- * the first one available.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *sf
- * @return RgSchPdcch *
- * -# NULLP when unsuccessful
- *
- **/
-RgSchPdcch *rgSCHCmnCmnPdcchAlloc(RgSchCellCb *cell,RgSchDlSf *subFrm)
-{
- CmLteAggrLvl aggrLvl;
- RgSchPdcchInfo *pdcchInfo;
- RgSchPdcch *pdcch;
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- uint8_t numCce; /*store num CCEs based on
- aggregation level */
-
- aggrLvl = cellSch->dl.cmnChAggrLvl;
-
- pdcchInfo = &(subFrm->pdcchInfo);
-
- /* Updating the no. of nCce in pdcchInfo, in case if CFI
- * was changed */
-#ifdef LTE_TDD
- if(subFrm->nCce != pdcchInfo->nCce)
- {
- rgSCHUtlPdcchInit(cell, subFrm, subFrm->nCce);
- }
-#else
- if(cell->nCce != pdcchInfo->nCce)
- {
- rgSCHUtlPdcchInit(cell, subFrm, cell->nCce);
- }
-#endif
-
- switch (aggrLvl)
- {
- case CM_LTE_AGGR_LVL4:
- numCce = 4;
- break;
- case CM_LTE_AGGR_LVL8:
- numCce = 8;
- break;
- case CM_LTE_AGGR_LVL16:
- numCce = 16;
- break;
- default:
- return (NULLP);
- }
-
- if (rgSCHUtlPdcchAvail(cell, pdcchInfo, aggrLvl, &pdcch) == TRUE)
- {
-#ifdef LTEMAC_SPS
- pdcch->isSpsRnti = FALSE;
-#endif
- /* Increment the CCE used counter in the current subframe */
- subFrm->cceCnt += numCce;
- pdcch->pdcchSearchSpace = RG_SCH_CMN_SEARCH_SPACE;
-
- return (pdcch);
- }
-
- /* PDCCH Allocation Failed, Mark cceFailure flag as TRUE */
- subFrm->isCceFailure = TRUE;
- DU_LOG("\nDEBUG --> SCH : PDCCH ERR: NO PDDCH AVAIL IN COMMON SEARCH SPACE aggr:%u",
- aggrLvl);
- return (NULLP);
-}
-
-\f
-/**
- * @brief This function implements bandwidth allocation for common channels.
- *
- * @details
- *
- * Function: rgSCHCmnClcRbAlloc
- * Purpose: This function implements bandwith allocation logic
- * for common control channels.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] uint32_t bo
- * @param[in] uint8_t cqi
- * @param[in] uint8_t *rb
- * @param[in] uint32_t *tbs
- * @param[in] uint8_t *mcs
- * @param[in] RgSchDlSf *sf
- * @return Void
- *
- **/
-#ifdef LTEMAC_SPS
-Void rgSCHCmnClcRbAlloc
-(
-RgSchCellCb *cell,
-uint32_t bo,
-uint8_t cqi,
-uint8_t *rb,
-uint32_t *tbs,
-uint8_t *mcs,
-uint8_t *iTbs,
-Bool isSpsBo,
-RgSchDlSf *sf
-)
-#else
-static Void rgSCHCmnClcRbAlloc
-(
-RgSchCellCb *cell,
-uint32_t bo,
-uint8_t cqi,
-uint8_t *rb,
-uint32_t *tbs,
-uint8_t *mcs,
-RgSchDlSf *sf
-)
-#endif /* LTEMAC_SPS */
-{
- uint8_t iTbsVal;
- RgSchCmnTbSzEff *effTbl;
- uint32_t eff;
- uint32_t noRes;
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- uint8_t cfi = cellSch->dl.currCfi;
- uint32_t tmpRb=0;
-
- /* first get the CQI to MCS table and determine the number of RBs */
- effTbl = (RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[0][cfi]);
- iTbsVal = (*(RgSchCmnCqiToTbs *)(cellSch->dl.cqiToTbsTbl[0][cfi]))[cqi];
- RG_SCH_CMN_DL_TBS_TO_MCS(iTbsVal, *mcs);
-
- /* Efficiency is number of bits per 1024 REs */
- eff = (*effTbl)[iTbsVal];
-
- /* Get the number of REs needed for this bo */
- noRes = ((bo * 8 * 1024) / eff );
-
- /* Get the number of RBs needed for this transmission */
- /* Number of RBs = No of REs / No of REs per RB */
- tmpRb = RGSCH_CEIL(noRes, cellSch->dl.noResPerRb[cfi]);
- /* KWORK_FIX: added check to see if rb has crossed maxRb*/
- RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(cell->instIdx, rgTbSzTbl[0][0], (tmpRb-1));
- if (tmpRb > cellSch->dl.maxDlBwPerUe)
- {
- tmpRb = cellSch->dl.maxDlBwPerUe;
- }
- while ((rgTbSzTbl[0][iTbsVal][tmpRb-1]/8) < bo &&
- (tmpRb < cellSch->dl.maxDlBwPerUe))
- {
- tmpRb++;
- RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(cell->instIdx, rgTbSzTbl[0][0], (tmpRb-1));
- }
- *tbs = rgTbSzTbl[0][iTbsVal][tmpRb-1]/8;
- *rb = (uint8_t)tmpRb;
- RG_SCH_CMN_DL_TBS_TO_MCS(iTbsVal, *mcs);
-
- return;
-}
-
-\f
-
-/**
- * @brief Scheduling for MSG4.
- *
- * @details
- *
- * Function: rgSCHCmnMsg4Alloc
- * Purpose: Scheduling for MSG4
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchRaCb* raCb
- * @param[out] RgSchCmnDlRbAllocInfo *allocInfo
- * @return S16
- *
- **/
-static S16 rgSCHCmnMsg4Alloc(RgSchCellCb *cell,RgSchRaCb *raCb,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-
-
- /* SR_RACH_STATS : MSG4 TO BE TXED */
- rgNumMsg4ToBeTx++;
- /* Return if subframe BW exhausted */
- if (allocInfo->msg4Alloc.msg4DlSf->bw <=
- allocInfo->msg4Alloc.msg4DlSf->bwAssigned)
- {
- DU_LOG("\nERROR --> SCH : bw<=bwAssigned");
- return RFAILED;
- }
-
- if (rgSCHDhmGetMsg4HqProc(raCb, cellSch->dl.time) != ROK)
- {
- DU_LOG("\nERROR --> SCH : rgSCHDhmGetMsg4HqProc failed");
- return RFAILED;
- }
-
- raCb->rbAllocInfo.dlSf = allocInfo->msg4Alloc.msg4DlSf;
-
- if (rgSCHCmnMsg4DedAlloc(cell, raCb) != ROK)
- {
- /* Fix : syed Minor failure handling, release hqP if Unsuccessful */
- rgSCHDhmRlsHqpTb(raCb->dlHqE->msg4Proc, 0, FALSE);
- DU_LOG("\nERROR --> SCH : rgSCHCmnMsg4DedAlloc failed.");
- return RFAILED;
- }
- cmLListAdd2Tail(&allocInfo->msg4Alloc.msg4TxLst, &raCb->dlHqE->msg4Proc->reqLnk);
- raCb->dlHqE->msg4Proc->reqLnk.node = (PTR)raCb->dlHqE->msg4Proc;
- allocInfo->msg4Alloc.msg4DlSf->schdCcchUe++;
-
- return ROK;
-}
-
-\f
-/**
- * @brief This function implements PDCCH allocation for an UE.
- *
- * @details
- *
- * Function: PdcchAlloc
- * Purpose: This function implements allocation of PDCCH for an UE.
- * 1. Get the aggregation level for the CQI of the UE.
- * 2. Get the candidate PDCCH count for the aggr level.
- * 3. Look for availability for each candidate and choose
- * the first one available.
- *
- * Invoked by: Scheduler
- *
- * @param[in] cell
- * @param[in] subFrm
- * @param[in] cqi
- * @param[in] dciFrmt
- * @return RgSchPdcch *
- * -# NULLP when unsuccessful
- *
- **/
-RgSchPdcch *rgSCHCmnPdcchAlloc(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlSf *subFrm,uint8_t cqi,TfuDciFormat dciFrmt,Bool isDtx)
-{
- CmLteAggrLvl aggrLvl;
- RgSchPdcchInfo *pdcchInfo;
- RgSchPdcch *pdcch;
-
-
- /* 3.1 consider the selected DCI format size in determining the
- * aggregation level */
- //TODO_SID Need to update. Currently using 4 aggregation level
- aggrLvl = CM_LTE_AGGR_LVL2;//cellSch->dciAggrLvl[cqi][dciFrmt];
-
-#ifdef LTE_ADV
- if((dciFrmt == TFU_DCI_FORMAT_1A) &&
- ((ue) && (ue->allocCmnUlPdcch)) )
- {
- pdcch = rgSCHCmnCmnPdcchAlloc(cell, subFrm);
- /* Since CRNTI Scrambled */
- if(NULLP != pdcch)
- {
- pdcch->dciNumOfBits = ue->dciSize.cmnSize[dciFrmt];
- // prc_trace_format_string(PRC_TRACE_GROUP_PS, PRC_TRACE_INFO_LOW,"Forcing alloc in CMN search spc size %d fmt %d \n",
- // pdcch->dciNumOfBits, dciFrmt);
- }
- return (pdcch);
- }
-#endif
-
- /* Incrementing aggrLvl by 1 if it not AGGR_LVL8(MAX SIZE)
- * inorder to increse the redudancy bits for better decoding of UE */
- if (isDtx)
- {
- if (aggrLvl != CM_LTE_AGGR_LVL16)
- {
- switch(aggrLvl)
- {
- case CM_LTE_AGGR_LVL2:
- aggrLvl = CM_LTE_AGGR_LVL4;
- break;
- case CM_LTE_AGGR_LVL4:
- aggrLvl = CM_LTE_AGGR_LVL8;
- break;
- case CM_LTE_AGGR_LVL8:
- aggrLvl = CM_LTE_AGGR_LVL16;
- break;
- default:
- break;
- }
- /* aggrLvl += 1; */
- }
- }
-
- pdcchInfo = &subFrm->pdcchInfo;
-
- /* Updating the no. of nCce in pdcchInfo, in case if CFI
- * was changed */
-#ifdef LTE_TDD
- if(subFrm->nCce != pdcchInfo->nCce)
- {
- rgSCHUtlPdcchInit(cell, subFrm, subFrm->nCce);
- }
-#else
- if(cell->nCce != pdcchInfo->nCce)
- {
- rgSCHUtlPdcchInit(cell, subFrm, cell->nCce);
- }
-#endif
-
- if (pdcchInfo->nCce < (1 << (aggrLvl - 1)))
- {
- /* PDCCH Allocation Failed, Mark cceFailure flag as TRUE */
- subFrm->isCceFailure = TRUE;
- DU_LOG("\nDEBUG --> SCH : PDCCH ERR: NO PDDCH AVAIL IN UE SEARCH SPACE :aggr(%u)",
- aggrLvl);
-
- return (NULLP);
- }
-
- if (rgSCHUtlPdcchAvail(cell, pdcchInfo, aggrLvl, &pdcch) == TRUE)
- {
- /* SR_RACH_STATS : Reset isTBMsg4 */
- pdcch->dci.u.format1aInfo.t.pdschInfo.isTBMsg4= FALSE;
- pdcch->dci.u.format0Info.isSrGrant = FALSE;
-#ifdef LTEMAC_SPS
- pdcch->isSpsRnti = FALSE;
-#endif
- /* Increment the CCE used counter in the current subframe */
- subFrm->cceCnt += aggrLvl;
- pdcch->pdcchSearchSpace = RG_SCH_UE_SPECIFIC_SEARCH_SPACE;
- if (ue != NULLP)
- {
-#ifdef LTE_ADV
- if (ue->cell != cell)
- {
- /* Secondary Cell */
- //pdcch->dciNumOfBits = ue->dciSize.noUlCcSize[dciFrmt];
- pdcch->dciNumOfBits = MAX_5GTF_DCIA1B1_SIZE;
- }
- else
-#endif
- {
- //pdcch->dciNumOfBits = ue->dciSize.dedSize[dciFrmt];
- //TODO_SID Need to update dci size.
- pdcch->dciNumOfBits = MAX_5GTF_DCIA1B1_SIZE;
- }
- }
- else
- {
- /* MSG4 */
- pdcch->dciNumOfBits = cell->dciSize.size[dciFrmt];
- }
- return (pdcch);
- }
-
- /* PDCCH Allocation Failed, Mark cceFailure flag as TRUE */
- subFrm->isCceFailure = TRUE;
-
- DU_LOG("\nDEBUG --> SCH : PDCCH ERR: NO PDDCH AVAIL IN UE SEARCH SPACE :aggr(%u)",
- aggrLvl);
- return (NULLP);
-}
-
-#ifdef RGR_V1
-/**
- * @brief This function implements BW allocation for CCCH SDU
- *
- * @details
- *
- * Function: rgSCHCmnCcchSduDedAlloc
- * Purpose: Downlink bandwidth Allocation for CCCH SDU.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[out] RgSchUeCb *ueCb
- * @return S16
- *
- **/
-static S16 rgSCHCmnCcchSduDedAlloc(RgSchCellCb *cell,RgSchUeCb *ueCb)
-{
- RgSchDlHqEnt *hqE = NULLP;
- uint32_t effBo;
- RgSchDlRbAlloc *rbAllocinfo = NULLP;
- RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
- uint8_t iTbs;
- uint8_t numRb;
-#ifdef LTE_TDD
- uint8_t cfi = cellDl->currCfi;
-#endif
-
-
- rbAllocinfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ueCb, cell);
-
- effBo = ueCb->dlCcchInfo.bo + RGSCH_CCCH_SDU_HDRSIZE;
-
-#ifndef LTEMAC_SPS
- rgSCHCmnClcRbAlloc(cell, effBo, cellDl->ccchCqi, &rbAllocinfo->rbsReq, \
- &rbAllocinfo->tbInfo[0].bytesReq,
- &rbAllocinfo->tbInfo[0].imcs, rbAllocinfo->dlSf);
-#else /* LTEMAC_SPS */
- rgSCHCmnClcRbAlloc(cell, effBo, cellDl->ccchCqi, &rbAllocinfo->rbsReq, \
- &rbAllocinfo->tbInfo[0].bytesReq,\
- &rbAllocinfo->tbInfo[0].imcs, &iTbs, FALSE,
- rbAllocinfo->dlSf);
-#endif /* LTEMAC_SPS */
-
- iTbs = 0;
- /* Cannot exceed the total number of RBs in the cell */
- if ((S16)rbAllocinfo->rbsReq > ((S16)(rbAllocinfo->dlSf->bw - \
- rbAllocinfo->dlSf->bwAssigned)))
- {
- /* Check if atleast one allocation was possible.
- This may be the case where the Bw is very less and
- with the configured CCCH CQI, CCCH SDU exceeds the min Bw */
- if (rbAllocinfo->dlSf->bwAssigned == 0)
- {
- numRb = rbAllocinfo->dlSf->bw;
- RG_SCH_CMN_DL_MCS_TO_TBS(rbAllocinfo->tbInfo[0].imcs, iTbs);
- while (rgTbSzTbl[0][++iTbs][numRb-1]/8 < effBo)
- {
- iTbs++;
- }
- rbAllocinfo->rbsReq = numRb;
- rbAllocinfo->tbInfo[0].bytesReq = rgTbSzTbl[0][iTbs][numRb-1]/8;
- /* DwPTS Scheduling Changes Start */
-#ifdef LTE_TDD
- if(rbAllocinfo->dlSf->sfType == RG_SCH_SPL_SF_DATA)
- {
- rbAllocinfo->tbInfo[0].bytesReq =
- rgSCHCmnCalcDwPtsTbSz(cell, effBo, &numRb, &iTbs, 1,cfi);
- }
-#endif
- /* DwPTS Scheduling Changes End */
- RG_SCH_CMN_DL_TBS_TO_MCS(iTbs, rbAllocinfo->tbInfo[0].imcs);
- }
- else
- {
- return RFAILED;
- }
- }
-
- /* Update the subframe Allocated BW field */
- rbAllocinfo->dlSf->bwAssigned = rbAllocinfo->dlSf->bwAssigned + \
- rbAllocinfo->rbsReq;
- hqE = RG_SCH_CMN_GET_UE_HQE(ueCb, cell);
- rbAllocinfo->tbInfo[0].tbCb = &hqE->ccchSduProc->tbInfo[0];
- rbAllocinfo->rnti = ueCb->ueId;
- rbAllocinfo->tbInfo[0].noLyr = 1;
-
- return ROK;
-}
-#endif
-\f
-/**
- * @brief This function implements BW allocation for MSG4
- *
- * @details
- *
- * Function: rgSCHCmnMsg4DedAlloc
- * Purpose: Downlink bandwidth Allocation for MSG4.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[out] RgSchRaCb *raCb
- * @return S16
- *
- **/
-static S16 rgSCHCmnMsg4DedAlloc(RgSchCellCb *cell,RgSchRaCb *raCb)
-{
- uint32_t effBo;
- RgSchDlRbAlloc *rbAllocinfo = &raCb->rbAllocInfo;
- uint8_t iTbs;
- uint8_t numRb;
-#ifdef LTE_TDD
- RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
- uint8_t cfi = cellDl->currCfi;
-#endif
-
-
- effBo = raCb->dlCcchInfo.bo + RGSCH_MSG4_HDRSIZE + RGSCH_CONT_RESID_SIZE;
-
-#ifndef LTEMAC_SPS
- rgSCHCmnClcRbAlloc(cell, effBo, raCb->ccchCqi, &rbAllocinfo->rbsReq, \
- &rbAllocinfo->tbInfo[0].bytesReq,\
- &rbAllocinfo->tbInfo[0].imcs, rbAllocinfo->dlSf);
-#else /* LTEMAC_SPS */
- rgSCHCmnClcRbAlloc(cell, effBo, raCb->ccchCqi, &rbAllocinfo->rbsReq, \
- &rbAllocinfo->tbInfo[0].bytesReq,\
- &rbAllocinfo->tbInfo[0].imcs, &iTbs, FALSE,
- rbAllocinfo->dlSf);
-#endif /* LTEMAC_SPS */
-
- iTbs = 0;
- /* Cannot exceed the total number of RBs in the cell */
- if ((S16)rbAllocinfo->rbsReq > ((S16)(rbAllocinfo->dlSf->bw - \
- rbAllocinfo->dlSf->bwAssigned)))
- {
- /* Check if atleast one allocation was possible.
- This may be the case where the Bw is very less and
- with the configured CCCH CQI, CCCH SDU exceeds the min Bw */
- if (rbAllocinfo->dlSf->bwAssigned == 0)
- {
- numRb = rbAllocinfo->dlSf->bw;
- RG_SCH_CMN_DL_MCS_TO_TBS(rbAllocinfo->tbInfo[0].imcs, iTbs);
- while (rgTbSzTbl[0][++iTbs][numRb-1]/8 < effBo)
- {
- iTbs++;
- }
- rbAllocinfo->rbsReq = numRb;
- rbAllocinfo->tbInfo[0].bytesReq = rgTbSzTbl[0][iTbs][numRb-1]/8;
- /* DwPTS Scheduling Changes Start */
-#ifdef LTE_TDD
- if(rbAllocinfo->dlSf->sfType == RG_SCH_SPL_SF_DATA)
- {
- rbAllocinfo->tbInfo[0].bytesReq =
- rgSCHCmnCalcDwPtsTbSz(cell, effBo, &numRb, &iTbs, 1, cfi);
- }
-#endif
- /* DwPTS Scheduling Changes End */
- RG_SCH_CMN_DL_TBS_TO_MCS(iTbs, rbAllocinfo->tbInfo[0].imcs);
- }
- else
- {
- return RFAILED;
- }
- }
-
- /* Update the subframe Allocated BW field */
- rbAllocinfo->dlSf->bwAssigned = rbAllocinfo->dlSf->bwAssigned + \
- rbAllocinfo->rbsReq;
- rbAllocinfo->rnti = raCb->tmpCrnti;
- rbAllocinfo->tbInfo[0].tbCb = &raCb->dlHqE->msg4Proc->tbInfo[0];
- rbAllocinfo->tbInfo[0].schdlngForTb = TRUE;
- rbAllocinfo->tbInfo[0].noLyr = 1;
-
- return ROK;
-}
-
-#ifdef LTE_TDD
-/**
- * @brief This function implements scheduling for RA Response.
- *
- * @details
- *
- * Function: rgSCHCmnDlRaRsp
- * Purpose: Downlink scheduling for RA responses.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @return Void
- *
- **/
-static Void rgSCHCmnDlRaRsp(RgSchCellCb *cell,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- CmLteTimingInfo frm;
- CmLteTimingInfo schFrm;
- RgSchDlSf *subFrm;
- uint16_t rarnti;
- uint8_t i;
- uint8_t noRaRnti=0;
- uint8_t raIdx;
- RgSchTddRachRspLst *rachRsp;
- uint8_t ulDlCfgIdx = cell->ulDlCfgIdx;
- uint8_t sfnIdx;
- uint8_t subfrmIdx;
- uint16_t rntiIdx=0;
-
- frm = cell->crntTime;
- RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA);
-
- /* Compute the subframe for which allocation is being made */
- /* essentially, we need pointer to the dl frame for this subframe */
- subFrm = rgSCHUtlSubFrmGet(cell, frm);
-
- /* Get the RACH Response scheduling related information
- * for the subframe with RA index */
- raIdx = rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][frm.subframe]-1;
-
- rachRsp = &cell->rachRspLst[raIdx];
-
- for(sfnIdx = 0; sfnIdx < rachRsp->numRadiofrms; sfnIdx++)
- {
- /* For all scheduled RACH Responses in SFNs */
- schFrm = frm;
- RG_SCH_CMN_DECR_FRAME(schFrm.sfn, rachRsp->rachRsp[sfnIdx].sfnOffset);
- /* For all scheduled RACH Responses in subframes */
- for(subfrmIdx = 0;
- subfrmIdx < rachRsp->rachRsp[sfnIdx].numSubfrms; subfrmIdx++)
- {
- schFrm.subframe = rachRsp->rachRsp[sfnIdx].subframe[subfrmIdx];
- /* compute the last RA RNTI used in the previous subframe */
- raIdx = (((schFrm.sfn % cell->raInfo.maxRaSize) * \
- RGSCH_NUM_SUB_FRAMES * RGSCH_MAX_RA_RNTI_PER_SUBFRM) \
- + schFrm.subframe);
-
- /* For all RA RNTIs within a subframe */
-
- for(i=0; (i < RGSCH_MAX_RA_RNTI_PER_SUBFRM) && \
- (noRaRnti < RGSCH_MAX_TDD_RA_RSP_ALLOC); i++)
- {
- rarnti = (schFrm.subframe + RGSCH_NUM_SUB_FRAMES*i + 1);
- rntiIdx = (raIdx + RGSCH_NUM_SUB_FRAMES*i);
-
- if (cell->raInfo.raReqLst[rntiIdx].first != NULLP)
- {
- /* compute the next RA RNTI */
- if (rgSCHCmnRaRspAlloc(cell, subFrm, rntiIdx,
- rarnti, noRaRnti, allocInfo) != ROK)
- {
- /* The resources are exhausted */
- break;
- }
- noRaRnti++;
- }
- }
- noRaRnti=0;
- }
- }
-
- return;
-}
-#else
-/**
- * @brief This function implements scheduling for RA Response.
- *
- * @details
- *
- * Function: rgSCHCmnDlRaRsp
- * Purpose: Downlink scheduling for RA responses.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[out] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlRaRsp(RgSchCellCb *cell,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- CmLteTimingInfo frm;
- CmLteTimingInfo winStartFrm;
- RgSchDlSf *subFrm;
- uint8_t winStartIdx;
- uint8_t winGap;
- uint8_t rarnti;
- uint8_t raIdx;
- RgSchCmnCell *sched;
- uint8_t i,noRaRnti=0;
-
- frm = cell->crntTime;
- RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA);
-
- /* Compute the subframe for which allocation is being made */
- /* essentially, we need pointer to the dl frame for this subframe */
- subFrm = rgSCHUtlSubFrmGet(cell, frm);
- sched = RG_SCH_CMN_GET_CELL(cell);
-
- /* ccpu00132523 - Window Start calculated by considering RAR window size,
- * RAR Wait period, Subframes occuppied for respective preamble format*/
- winGap = (sched->dl.numRaSubFrms-1) + (cell->rachCfg.raWinSize-1)
- +RGSCH_RARSP_WAIT_PERIOD;
-
- /* Window starting occassion is retrieved using the gap and tried to
- * fit to the size of raReqLst array*/
- RGSCHDECRFRMCRNTTIME(frm, winStartFrm, winGap);
-
- //5G_TODO TIMING update. Need to check
- winStartIdx = (winStartFrm.sfn & 1) * RGSCH_MAX_RA_RNTI+ winStartFrm.slot;
-
- for(i = 0; ((i < cell->rachCfg.raWinSize) && (noRaRnti < RG_SCH_CMN_MAX_CMN_PDCCH)); i++)
- {
- raIdx = (winStartIdx + i) % RGSCH_RAREQ_ARRAY_SIZE;
-
- if (cell->raInfo.raReqLst[raIdx].first != NULLP)
- {
- allocInfo->raRspAlloc[noRaRnti].biEstmt = \
- (!i * RGSCH_ONE_BIHDR_SIZE);
- rarnti = raIdx % RGSCH_MAX_RA_RNTI+ 1;
- if (rgSCHCmnRaRspAlloc(cell, subFrm, raIdx,
- rarnti, noRaRnti, allocInfo) != ROK)
- {
- /* The resources are exhausted */
- break;
- }
- /* ccpu00132523- If all the RAP ids are not scheduled then need not
- * proceed for next RA RNTIs*/
- if(allocInfo->raRspAlloc[noRaRnti].numRapids < cell->raInfo.raReqLst[raIdx].count)
- {
- break;
- }
- noRaRnti++; /* Max of RG_SCH_CMN_MAX_CMN_PDCCH RARNTIs
- for response allocation */
- }
- }
- return;
-}
-#endif
-
-\f
-/**
- * @brief This function allocates the resources for an RARNTI.
- *
- * @details
- *
- * Function: rgSCHCmnRaRspAlloc
- * Purpose: Allocate resources to a RARNTI.
- * 0. Allocate PDCCH for sending the response.
- * 1. Locate the number of RA requests pending for the RARNTI.
- * 2. Compute the size of data to be built.
- * 3. Using common channel CQI, compute the number of RBs.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell,
- * @param[in] RgSchDlSf *subFrm,
- * @param[in] uint16_t rarnti,
- * @param[in] uint8_t noRaRnti
- * @param[out] RgSchCmnDlRbAllocInfo *allocInfo
- * @return S16
- *
- **/
-static S16 rgSCHCmnRaRspAlloc(RgSchCellCb *cell,RgSchDlSf *subFrm,uint16_t raIndex,uint16_t rarnti,uint8_t noRaRnti,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- uint16_t noBytes;
- uint32_t rb = 0;
- uint32_t tbs;
- /*ccpu00116700,ccpu00116708- Corrected the wrong type for mcs*/
- uint8_t mcs;
- CmLListCp *reqLst;
- /* RACH handling related changes */
- Bool isAlloc = FALSE;
- static uint8_t schdNumRapid = 0;
- uint8_t remNumRapid = 0;
- uint8_t nPrb = 0;
- S32 allwdTbSz = 0;
-#ifdef LTE_TDD
- uint16_t lostRe;
- uint8_t cfi = cellDl->currCfi;
-#endif
-
-#ifndef RGR_V1
- UNUSED(cellUl);
-#endif
-
- /* ccpu00132523: Resetting the schdRap Id count in every scheduling subframe*/
- if(noRaRnti == 0)
- {
- schdNumRapid = 0;
- }
-
-
- if (subFrm->bw == subFrm->bwAssigned)
- {
- DU_LOG("\nERROR --> SCH : bw == bwAssigned RARNTI:%d",rarnti);
- return RFAILED;
- }
-
- reqLst = &cell->raInfo.raReqLst[raIndex];
- if (reqLst->count == 0)
- {
- DU_LOG("\nERROR --> SCH : reqLst Count=0 RARNTI:%d",rarnti);
- return RFAILED;
- }
- remNumRapid = reqLst->count;
-
-#ifdef RGR_V1
- /* Limit number of rach rsps to maxMsg3PerUlsf */
- if ( schdNumRapid+remNumRapid > cellUl->maxMsg3PerUlSf )
- {
- remNumRapid = cellUl->maxMsg3PerUlSf-schdNumRapid;
- }
-#endif
-
- while (remNumRapid)
- {
- /* Try allocating for as many RAPIDs as possible */
- /* BI sub-header size to the tbSize requirement */
- noBytes = RGSCH_GET_RAR_BYTES(remNumRapid) +\
- allocInfo->raRspAlloc[noRaRnti].biEstmt;
- if ((allwdTbSz = rgSCHUtlGetAllwdCchTbSz(noBytes*8, &nPrb, &mcs)) == -1)
- {
- remNumRapid--;
- continue;
- }
-
- /* rgSCHCmnClcRbAllocForFxdTb(cell, allwdTbSz/8, cellDl->ccchCqi, &rb);*/
- if(cellDl->bitsPerRb==0)
- {
- while ((rgTbSzTbl[0][0][rb]) <(uint32_t) allwdTbSz)
- {
- rb++;
- }
- rb = rb+1;
- }
- else
- {
- rb = RGSCH_CEIL(allwdTbSz, cellDl->bitsPerRb);
- }
- /* DwPTS Scheduling Changes Start */
-#ifdef LTE_TDD
- if (subFrm->sfType == RG_SCH_SPL_SF_DATA)
- {
- RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, cfi);
-
- /* Calculate the less RE's because of DwPTS */
- lostRe = rb * (cellDl->noResPerRb[cfi] -
- cellDl->numReDwPts[cfi]);
-
- /* Increase number of RBs in Spl SF to compensate for lost REs */
- rb += RGSCH_CEIL(lostRe, cellDl->numReDwPts[cfi]);
- }
-#endif
- /* DwPTS Scheduling Changes End */
-
- /*ccpu00115595- end*/
- if (rb > subFrm->bw - subFrm->bwAssigned)
- {
- remNumRapid--;
- continue;
- }
- /* Allocation succeeded for 'remNumRapid' */
- isAlloc = TRUE;
- tbs = allwdTbSz/8;
- DU_LOG("\nINFO --> SCH : RAR alloc noBytes:%u,allwdTbSz:%u,tbs:%u,rb:%u\n",
- noBytes,allwdTbSz,tbs,rb);
- break;
- }
- if (!isAlloc)
- {
- DU_LOG("\nERROR --> SCH : BW alloc Failed");
- return RFAILED;
- }
-
- subFrm->bwAssigned = subFrm->bwAssigned + rb;
-
- /* Fill AllocInfo structure */
- allocInfo->raRspAlloc[noRaRnti].rnti = rarnti;
- allocInfo->raRspAlloc[noRaRnti].tbInfo[0].bytesReq = tbs;
- allocInfo->raRspAlloc[noRaRnti].rbsReq = rb;
- allocInfo->raRspAlloc[noRaRnti].dlSf = subFrm;
- allocInfo->raRspAlloc[noRaRnti].tbInfo[0].imcs = mcs;
- allocInfo->raRspAlloc[noRaRnti].raIndex = raIndex;
- /* RACH changes for multiple RAPID handling */
- allocInfo->raRspAlloc[noRaRnti].numRapids = remNumRapid;
- allocInfo->raRspAlloc[noRaRnti].nPrb = nPrb;
- allocInfo->raRspAlloc[noRaRnti].tbInfo[0].noLyr = 1;
- allocInfo->raRspAlloc[noRaRnti].vrbgReq = RGSCH_CEIL(nPrb,MAX_5GTF_VRBG_SIZE);
- schdNumRapid += remNumRapid;
- return ROK;
-}
-
-/***********************************************************
- *
- * Func : rgSCHCmnUlAllocFillRbInfo
- *
- * Desc : Fills the start RB and the number of RBs for
- * uplink allocation.
- *
- * Ret : void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHCmnUlAllocFillRbInfo(RgSchCellCb *cell,RgSchUlSf *sf,RgSchUlAlloc *alloc)
-{
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
- uint8_t cfi = cellDl->currCfi;
-
-
- alloc->grnt.rbStart = (alloc->sbStart * cellUl->sbSize) +
- cell->dynCfiCb.bwInfo[cfi].startRb;
-
- /* Num RBs = numSbAllocated * sbSize - less RBs in the last SB */
- alloc->grnt.numRb = (alloc->numSb * cellUl->sbSize);
-
- return;
-}
-
-/**
- * @brief Grant request for Msg3.
- *
- * @details
- *
- * Function : rgSCHCmnMsg3GrntReq
- *
- * This is invoked by downlink scheduler to request allocation
- * for msg3.
- * Steps:
- * - Attempt to allocate msg3 in the current msg3 subframe
- * Allocation attempt based on whether preamble is from group A
- * and the value of MESSAGE_SIZE_GROUP_A
- * - Link allocation with passed RNTI and msg3 HARQ process
- * - Set the HARQ process ID (*hqProcIdRef)
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] CmLteRnti rnti
- * @param[in] Bool preamGrpA
- * @param[in] RgSchUlHqProcCb *hqProc
- * @param[out] RgSchUlAlloc **ulAllocRef
- * @param[out] uint8_t *hqProcIdRef
- * @return Void
- **/
-static Void rgSCHCmnMsg3GrntReq
-(
-RgSchCellCb *cell,
-CmLteRnti rnti,
-Bool preamGrpA,
-RgSchUlHqProcCb *hqProc,
-RgSchUlAlloc **ulAllocRef,
-uint8_t *hqProcIdRef
-)
-{
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- RgSchUlSf *sf = &cellUl->ulSfArr[cellUl->msg3SchdIdx];
- RgSchUlHole *hole;
- RgSchUlAlloc *alloc;
- uint8_t iMcs;
- uint8_t numSb;
-
-
- *ulAllocRef = NULLP;
-
- /* Fix: ccpu00120610 Use remAllocs from subframe during msg3 allocation */
- if (*sf->allocCountRef >= cellUl->maxAllocPerUlSf)
- {
- return;
- }
- if (preamGrpA == FALSE)
- {
- numSb = cellUl->ra.prmblBNumSb;
- iMcs = cellUl->ra.prmblBIMcs;
- }
- else
- {
- numSb = cellUl->ra.prmblANumSb;
- iMcs = cellUl->ra.prmblAIMcs;
- }
-
- if ((hole = rgSCHUtlUlHoleFirst(sf)) != NULLP)
- {
- if(*sf->allocCountRef == 0)
- {
- RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
- /* Reinitialize the hole */
- if (sf->holeDb->count == 1 && (hole->start == 0)) /* Sanity check of holeDb */
- {
- hole->num = cell->dynCfiCb.bwInfo[cellDl->currCfi].numSb;
- /* Re-Initialize available subbands because of CFI change*/
- hole->num = cell->dynCfiCb.bwInfo[cellDl->currCfi].numSb;
- }
- else
- {
- DU_LOG("\nERROR --> SCH : holeDb sanity check failed RNTI:%d",rnti);
- }
- }
- if (numSb <= hole->num)
- {
- uint8_t iTbs;
- alloc = rgSCHUtlUlAllocGetHole(sf, numSb, hole);
- rgSCHCmnUlAllocFillRbInfo(cell, sf, alloc);
- alloc->grnt.iMcs = iMcs;
- alloc->grnt.iMcsCrnt = iMcs;
- iTbs = rgSCHCmnUlGetITbsFrmIMcs(iMcs);
- RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgTbSzTbl[0], iTbs);
- /* To include the length and ModOrder in DataRecp Req.*/
- alloc->grnt.datSz = rgTbSzTbl[0][iTbs][alloc->grnt.numRb-1] / 8;
- RG_SCH_UL_MCS_TO_MODODR(iMcs, alloc->grnt.modOdr);
- /* RACHO : setting nDmrs to 0 and UlDelaybit to 0*/
- alloc->grnt.nDmrs = 0;
- alloc->grnt.hop = 0;
- alloc->grnt.delayBit = 0;
- alloc->grnt.isRtx = FALSE;
- *ulAllocRef = alloc;
- *hqProcIdRef = (cellUl->msg3SchdHqProcIdx);
- hqProc->procId = *hqProcIdRef;
- hqProc->ulSfIdx = (cellUl->msg3SchdIdx);
- alloc->rnti = rnti;
- alloc->ue = NULLP;
- alloc->pdcch = FALSE;
- alloc->forMsg3 = TRUE;
- alloc->hqProc = hqProc;
- rgSCHUhmNewTx(hqProc, (uint8_t)(cell->rachCfg.maxMsg3Tx - 1), alloc);
- DU_LOG("\nDEBUG --> SCH : RNTI:%d MSG3 ALLOC proc(%lu)procId(%d)schdIdx(%d)\n",
- alloc->rnti,
- ((PTR)alloc->hqProc),
- alloc->hqProc->procId,
- alloc->hqProc->ulSfIdx);
- DU_LOG("\nDEBUG --> SCH : alloc(%p)maxMsg3Tx(%d)",
- ((void *)alloc),
- cell->rachCfg.maxMsg3Tx);
- }
- }
-
- return;
-}
-
-\f
-/**
- * @brief This function determines the allocation limits and
- * parameters that aid in DL scheduling.
- *
- * @details
- *
- * Function: rgSCHCmnDlSetUeAllocLmt
- * Purpose: This function determines the Maximum RBs
- * a UE is eligible to get based on softbuffer
- * limitation and cell->>>maxDlBwPerUe. The Codeword
- * specific parameters like iTbs, eff and noLyrs
- * are also set in this function. This function
- * is called while UE configuration and UeDlCqiInd.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cellCb
- * @param[in] RgSchCmnDlUe *ueDl
- * @return Void
- *
- **/
-static Void rgSCHCmnDlSetUeAllocLmt(RgSchCellCb *cell,RgSchCmnDlUe *ueDl,Bool isEmtcUe)
-{
- uint8_t modOrder;
- uint32_t maxRb;
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- uint8_t cfi = cellSch->dl.currCfi;
-
-
-#ifdef EMTC_ENABLE
- if(TRUE == isEmtcUe)
- {
- /* ITbs for CW0 for 1 Layer Tx */
- ueDl->mimoInfo.cwInfo[0].iTbs[0] = (*(RgSchEmtcCmnCqiToTbs *)(cellSch->dl.emtcCqiToTbsTbl[0][cfi]))\
- [ueDl->mimoInfo.cwInfo[0].cqi];
- /* ITbs for CW0 for 2 Layer Tx */
- ueDl->mimoInfo.cwInfo[0].iTbs[1] = (*(RgSchEmtcCmnCqiToTbs *)(cellSch->dl.emtcCqiToTbsTbl[1][cfi]))\
- [ueDl->mimoInfo.cwInfo[0].cqi];
- /* Eff for CW0 for 1 Layer Tx */
- ueDl->mimoInfo.cwInfo[0].eff[0] = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[0][cfi]))\
- [ueDl->mimoInfo.cwInfo[0].iTbs[0]];
- /* Eff for CW0 for 2 Layer Tx */
- ueDl->mimoInfo.cwInfo[0].eff[1] = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[1][cfi]))\
- [ueDl->mimoInfo.cwInfo[0].iTbs[1]];
-
- /* ITbs for CW1 for 1 Layer Tx */
- ueDl->mimoInfo.cwInfo[1].iTbs[0] = (*(RgSchEmtcCmnCqiToTbs *)(cellSch->dl.emtcCqiToTbsTbl[0][cfi]))\
- [ueDl->mimoInfo.cwInfo[1].cqi];
- /* ITbs for CW1 for 2 Layer Tx */
- ueDl->mimoInfo.cwInfo[1].iTbs[1] = (*(RgSchEmtcCmnCqiToTbs *)(cellSch->dl.emtcCqiToTbsTbl[1][cfi]))\
- [ueDl->mimoInfo.cwInfo[1].cqi];
- /* Eff for CW1 for 1 Layer Tx */
- ueDl->mimoInfo.cwInfo[1].eff[0] = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[0][cfi]))\
- [ueDl->mimoInfo.cwInfo[1].iTbs[0]];
- /* Eff for CW1 for 2 Layer Tx */
- ueDl->mimoInfo.cwInfo[1].eff[1] = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[1][cfi]))\
- [ueDl->mimoInfo.cwInfo[1].iTbs[1]];
- }
- else
-#endif
- {
- /* ITbs for CW0 for 1 Layer Tx */
- ueDl->mimoInfo.cwInfo[0].iTbs[0] = (*(RgSchCmnCqiToTbs *)(cellSch->dl.cqiToTbsTbl[0][cfi]))\
- [ueDl->mimoInfo.cwInfo[0].cqi];
- /* ITbs for CW0 for 2 Layer Tx */
- ueDl->mimoInfo.cwInfo[0].iTbs[1] = (*(RgSchCmnCqiToTbs *)(cellSch->dl.cqiToTbsTbl[1][cfi]))\
- [ueDl->mimoInfo.cwInfo[0].cqi];
- /* Eff for CW0 for 1 Layer Tx */
- ueDl->mimoInfo.cwInfo[0].eff[0] = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[0][cfi]))\
- [ueDl->mimoInfo.cwInfo[0].iTbs[0]];
- /* Eff for CW0 for 2 Layer Tx */
- ueDl->mimoInfo.cwInfo[0].eff[1] = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[1][cfi]))\
- [ueDl->mimoInfo.cwInfo[0].iTbs[1]];
-
- /* ITbs for CW1 for 1 Layer Tx */
- ueDl->mimoInfo.cwInfo[1].iTbs[0] = (*(RgSchCmnCqiToTbs *)(cellSch->dl.cqiToTbsTbl[0][cfi]))\
- [ueDl->mimoInfo.cwInfo[1].cqi];
- /* ITbs for CW1 for 2 Layer Tx */
- ueDl->mimoInfo.cwInfo[1].iTbs[1] = (*(RgSchCmnCqiToTbs *)(cellSch->dl.cqiToTbsTbl[1][cfi]))\
- [ueDl->mimoInfo.cwInfo[1].cqi];
- /* Eff for CW1 for 1 Layer Tx */
- ueDl->mimoInfo.cwInfo[1].eff[0] = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[0][cfi]))\
- [ueDl->mimoInfo.cwInfo[1].iTbs[0]];
- /* Eff for CW1 for 2 Layer Tx */
- ueDl->mimoInfo.cwInfo[1].eff[1] = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[1][cfi]))\
- [ueDl->mimoInfo.cwInfo[1].iTbs[1]];
- }
-
-//#ifdef DL_LA
- // ueDl->laCb.cqiBasediTbs = ueDl->mimoInfo.cwInfo[0].iTbs[0] * 100;
-//#endif
- /* Assigning noLyrs to each CW assuming optimal Spatial multiplexing
- * capability */
- (ueDl->mimoInfo.ri/2 == 0)? (ueDl->mimoInfo.cwInfo[0].noLyr = 1) : \
- (ueDl->mimoInfo.cwInfo[0].noLyr = ueDl->mimoInfo.ri/2);
- ueDl->mimoInfo.cwInfo[1].noLyr = ueDl->mimoInfo.ri - ueDl->mimoInfo.cwInfo[0].noLyr;
- /* rg002.101:ccpu00102106: correcting DL harq softbuffer limitation logic.
- * The maxTbSz is the maximum number of PHY bits a harq process can
- * hold. Hence we limit our allocation per harq process based on this.
- * Earlier implementation we misinterpreted the maxTbSz to be per UE
- * per TTI, but in fact it is per Harq per TTI. */
- /* rg002.101:ccpu00102106: cannot exceed the harq Tb Size
- * and harq Soft Bits limit.*/
-
- /* Considering iTbs corresponding to 2 layer transmission for
- * codeword0(approximation) and the maxLayers supported by
- * this UE at this point of time. */
- RG_SCH_CMN_TBS_TO_MODODR(ueDl->mimoInfo.cwInfo[0].iTbs[1], modOrder);
-
- /* Bits/modOrder gives #REs, #REs/noResPerRb gives #RBs */
- /* rg001.301 -MOD- [ccpu00119213] : avoiding wraparound */
- maxRb = ((ueDl->maxSbSz)/(cellSch->dl.noResPerRb[cfi] * modOrder *\
- ueDl->mimoInfo.ri));
- if (cellSch->dl.isDlFreqSel)
- {
- /* Rounding off to left nearest multiple of RBG size */
- maxRb -= maxRb % cell->rbgSize;
- }
- ueDl->maxRb = RGSCH_MIN(maxRb, cellSch->dl.maxDlBwPerUe);
- if (cellSch->dl.isDlFreqSel)
- {
- /* Rounding off to right nearest multiple of RBG size */
- if (ueDl->maxRb % cell->rbgSize)
- {
- ueDl->maxRb += (cell->rbgSize -
- (ueDl->maxRb % cell->rbgSize));
- }
- }
-
- /* Set the index of the cwInfo, which is better in terms of
- * efficiency. If RI<2, only 1 CW, hence btrCwIdx shall be 0 */
- if (ueDl->mimoInfo.ri < 2)
- {
- ueDl->mimoInfo.btrCwIdx = 0;
- }
- else
- {
- if (ueDl->mimoInfo.cwInfo[0].eff[ueDl->mimoInfo.cwInfo[0].noLyr-1] <\
- ueDl->mimoInfo.cwInfo[1].eff[ueDl->mimoInfo.cwInfo[1].noLyr-1])
- {
- ueDl->mimoInfo.btrCwIdx = 1;
- }
- else
- {
- ueDl->mimoInfo.btrCwIdx = 0;
- }
- }
-
- return;
- }
-
-#ifdef DL_LA
-
-/**
- * @brief This function updates TX Scheme.
- *
- * @details
- *
- * Function: rgSCHCheckAndSetTxScheme
- * Purpose: This function determines the Maximum RBs
- * a UE is eligible to get based on softbuffer
- * limitation and cell->>>maxDlBwPerUe. The Codeword
- * specific parameters like iTbs, eff and noLyrs
- * are also set in this function. This function
- * is called while UE configuration and UeDlCqiInd.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- *
- **/
-static Void rgSCHCheckAndSetTxScheme(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue ,cell);
- uint8_t cfi = cellSch->dl.currCfi;
- uint8_t maxiTbs;
- uint8_t cqiBasediTbs;
- uint8_t actualiTbs;
-
-
- maxiTbs = (*(RgSchCmnCqiToTbs*)(cellSch->dl.cqiToTbsTbl[0][cfi]))\
- [RG_SCH_CMN_MAX_CQI - 1];
- cqiBasediTbs = (ueDl->laCb[0].cqiBasediTbs)/100;
- actualiTbs = ueDl->mimoInfo.cwInfo[0].iTbs[0];
-
- if((actualiTbs < RG_SCH_TXSCHEME_CHNG_ITBS_FACTOR) && (cqiBasediTbs >
- actualiTbs) && ((cqiBasediTbs - actualiTbs) > RG_SCH_TXSCHEME_CHNG_THRSHD))
- {
- RG_SCH_CMN_SET_FORCE_TD(ue,cell, RG_SCH_CMN_TD_TXSCHEME_CHNG);
- }
-
- if(actualiTbs >= maxiTbs)
- {
- RG_SCH_CMN_UNSET_FORCE_TD(ue,cell, RG_SCH_CMN_TD_TXSCHEME_CHNG);
- }
-
- return;
-}
-
-/**
- * @brief This function determines the allocation limits and
- * parameters that aid in DL scheduling.
- *
- * @details
- *
- * Function: rgSCHCmnDlSetUeAllocLmtLa
- * Purpose: This function determines the Maximum RBs
- * a UE is eligible to get based on softbuffer
- * limitation and cell->>>maxDlBwPerUe. The Codeword
- * specific parameters like iTbs, eff and noLyrs
- * are also set in this function. This function
- * is called while UE configuration and UeDlCqiInd.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- *
- **/
-Void rgSCHCmnDlSetUeAllocLmtLa(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- uint8_t modOrder;
- uint32_t maxRb;
- uint8_t reportediTbs;
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- uint8_t cfi = cellSch->dl.currCfi;
- uint8_t maxiTbs;
- uint8_t cwIdx = 0;
-
-
- maxiTbs = (*(RgSchCmnCqiToTbs *)(cellSch->dl.cqiToTbsTbl[0][cfi]))[RG_SCH_CMN_MAX_CQI - 1];
- if(ueDl->cqiFlag == TRUE)
- {
- for(cwIdx=0; cwIdx < RG_SCH_CMN_MAX_CW_PER_UE; cwIdx++)
- {
- S32 iTbsNew;
-
- /* Calcluating the reported iTbs for code word 0 */
- reportediTbs = ue->ue5gtfCb.mcs;
-
- iTbsNew = (S32) reportediTbs;
-
- if(!ueDl->laCb[cwIdx].notFirstCqi)
- {
- /* This is the first CQI report from UE */
- ueDl->laCb[cwIdx].cqiBasediTbs = (iTbsNew * 100);
- ueDl->laCb[cwIdx].notFirstCqi = TRUE;
- }
- else if ((RG_ITBS_DIFF(reportediTbs, ueDl->mimoInfo.cwInfo[cwIdx].iTbs[0])) > 5)
- {
- /* Ignore this iTBS report and mark that last iTBS report was */
- /* ignored so that subsequently we reset the LA algorithm */
- ueDl->laCb[cwIdx].lastiTbsIgnored = TRUE;
- ueDl->laCb[cwIdx].numLastiTbsIgnored++;
- if( ueDl->laCb[cwIdx].numLastiTbsIgnored > 10)
- {
- /* CQI reported by UE is not catching up. Reset the LA algorithm */
- ueDl->laCb[cwIdx].cqiBasediTbs = (iTbsNew * 100);
- ueDl->laCb[cwIdx].deltaiTbs = 0;
- ueDl->laCb[cwIdx].lastiTbsIgnored = FALSE;
- ueDl->laCb[cwIdx].numLastiTbsIgnored = 0;
- }
- }
- else
- {
- if (ueDl->laCb[cwIdx].lastiTbsIgnored != TRUE)
- {
- ueDl->laCb[cwIdx].cqiBasediTbs = ((20 * iTbsNew * 100) +
- (80 * ueDl->laCb[cwIdx].cqiBasediTbs))/100;
- }
- else
- {
- /* Reset the LA as iTbs in use caught up with the value */
- /* reported by UE. */
- ueDl->laCb[cwIdx].cqiBasediTbs = ((20 * iTbsNew * 100) +
- (80 * ueDl->mimoInfo.cwInfo[cwIdx].iTbs[0] * 100))/100;
- ueDl->laCb[cwIdx].deltaiTbs = 0;
- ueDl->laCb[cwIdx].lastiTbsIgnored = FALSE;
- }
- }
-
- iTbsNew = (ueDl->laCb[cwIdx].cqiBasediTbs + ueDl->laCb[cwIdx].deltaiTbs)/100;
-
- RG_SCH_CHK_ITBS_RANGE(iTbsNew, maxiTbs);
-
- ueDl->mimoInfo.cwInfo[cwIdx].iTbs[0] = RGSCH_MIN(iTbsNew, cell->thresholds.maxDlItbs);
- //ueDl->mimoInfo.cwInfo[cwIdx].iTbs[1] = ueDl->mimoInfo.cwInfo[cwIdx].iTbs[0];
-#ifdef RG_5GTF
- ue->ue5gtfCb.mcs = ueDl->mimoInfo.cwInfo[cwIdx].iTbs[0];
- /*
- DU_LOG("\nINFO --> SCH : reportediTbs[%d] cqiBasediTbs[%d] deltaiTbs[%d] iTbsNew[%d] mcs[%d] cwIdx[%d]\n",
- reportediTbs, ueDl->laCb[cwIdx].cqiBasediTbs, ueDl->laCb[cwIdx].deltaiTbs,
- iTbsNew, ue->ue5gtfCb.mcs, cwIdx);
- */
-#endif
-
- if((ue->mimoInfo.txMode != RGR_UE_TM_3) && (ue->mimoInfo.txMode != RGR_UE_TM_4))
- {
- break;
- }
- }
- ueDl->cqiFlag = FALSE;
- }
-
-
- return;
-}
-#endif
-/***********************************************************
- *
- * Func : rgSCHCmnDlUeResetTemp
- *
- * Desc : Reset whatever variables where temporarily used
- * during UE scheduling.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHCmnDlHqPResetTemp(RgSchDlHqProcCb *hqP)
-{
-
- /* Fix: syed having a hqP added to Lists for RB assignment rather than
- * a UE, as adding UE was limiting handling some scenarios */
- hqP->reqLnk.node = (PTR)NULLP;
- hqP->schdLstLnk.node = (PTR)NULLP;
-
- return;
-} /* rgSCHCmnDlHqPResetTemp */
-
-/***********************************************************
- *
- * Func : rgSCHCmnDlUeResetTemp
- *
- * Desc : Reset whatever variables where temporarily used
- * during UE scheduling.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHCmnDlUeResetTemp(RgSchUeCb *ue,RgSchDlHqProcCb *hqP)
-{
- RgSchDlRbAlloc *allocInfo;
- RgSchCmnDlUe *cmnUe = RG_SCH_CMN_GET_DL_UE(ue,hqP->hqE->cell);
-#ifdef LTE_ADV
- Void *tmpCb;
-#endif
-
-
- /* Fix : syed check for UE's existence was useless.
- * Instead we need to check that reset is done only for the
- * information of a scheduled harq proc, which is cmnUe->proc.
- * Reset should not be done for non-scheduled hqP */
- if((cmnUe->proc == hqP) || (cmnUe->proc == NULLP))
- {
- cmnUe->proc = NULLP;
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, hqP->hqE->cell);
-#ifdef LTE_ADV
- tmpCb = allocInfo->laaCb;
-#endif
- memset(allocInfo, 0, sizeof(RgSchDlRbAlloc));
- allocInfo->rnti = ue->ueId;
-#ifdef LTE_ADV
- allocInfo->laaCb = tmpCb;
-#endif
- /* Fix: syed moving this to a common function for both scheduled
- * and non-scheduled UEs */
- cmnUe->outStndAlloc = 0;
- }
- rgSCHCmnDlHqPResetTemp(hqP);
-
- return;
-} /* rgSCHCmnDlUeResetTemp */
-
-/***********************************************************
- *
- * Func : rgSCHCmnUlUeResetTemp
- *
- * Desc : Reset whatever variables where temporarily used
- * during UE scheduling.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHCmnUlUeResetTemp(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnUlUe *cmnUlUe = RG_SCH_CMN_GET_UL_UE(ue,cell);
-
- memset(&cmnUlUe->alloc, 0, sizeof(cmnUlUe->alloc));
-
- return;
-} /* rgSCHCmnUlUeResetTemp */
-
-
-\f
-/**
- * @brief This function fills the PDCCH information from dlProc.
- *
- * @details
- *
- * Function: rgSCHCmnFillPdcch
- * Purpose: This function fills in the PDCCH information
- * obtained from the RgSchDlRbAlloc
- * during common channel scheduling(P, SI, RA - RNTI's).
- *
- * Invoked by: Downlink Scheduler
- *
- * @param[out] RgSchPdcch* pdcch
- * @param[in] RgSchDlRbAlloc* rbAllocInfo
- * @return Void
- *
- **/
-Void rgSCHCmnFillPdcch(RgSchCellCb *cell,RgSchPdcch *pdcch,RgSchDlRbAlloc *rbAllocInfo)
-{
-
- /* common channel pdcch filling,
- * only 1A and Local is supported */
- pdcch->rnti = rbAllocInfo->rnti;
- pdcch->dci.dciFormat = rbAllocInfo->dciFormat;
- switch(rbAllocInfo->dciFormat)
- {
-#ifdef RG_5GTF /* ANOOP: ToDo: DCI format B1/B2 filling */
- case TFU_DCI_FORMAT_B1:
- {
- /* ToDo: Anoop */
- pdcch->dci.u.formatB1Info.formatType = 0;
- pdcch->dci.u.formatB1Info.xPDSCHRange = rbAllocInfo->tbInfo[0].cmnGrnt.xPDSCHRange;
- pdcch->dci.u.formatB1Info.RBAssign = rbAllocInfo->tbInfo[0].cmnGrnt.rbAssign;
- pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.hqProcId = 0;
- pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.mcs = rbAllocInfo->tbInfo[0].imcs;
- pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.ndi = 0;
- //pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.ndi = rbAllocInfo->tbInfo[0].ndi;
- pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.RV = rbAllocInfo->tbInfo[0].cmnGrnt.rv;
- pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.bmiHqAckNack = 0;
- pdcch->dci.u.formatB1Info.CSI_BSI_BRI_Req = 0;
- pdcch->dci.u.formatB1Info.CSIRS_BRRS_TxTiming = 0;
- pdcch->dci.u.formatB1Info.CSIRS_BRRS_SymbIdx = 0;
- pdcch->dci.u.formatB1Info.CSIRS_BRRS_ProcInd = 0;
- pdcch->dci.u.formatB1Info.xPUCCH_TxTiming = 0;
- //TODO_SID: Need to update
- pdcch->dci.u.formatB1Info.freqResIdx_xPUCCH = 0;
- pdcch->dci.u.formatB1Info.beamSwitch = 0;
- pdcch->dci.u.formatB1Info.SRS_Config = 0;
- pdcch->dci.u.formatB1Info.SRS_Symbol = 0;
- //TODO_SID: Need to check.Currently setting 0(1 layer, ports(8) w/o OCC).
- pdcch->dci.u.formatB1Info.AntPorts_numLayers = 0;
- pdcch->dci.u.formatB1Info.SCID = rbAllocInfo->tbInfo[0].cmnGrnt.SCID;
- //TODO_SID: Hardcoding TPC command to 1 i.e. No change
- pdcch->dci.u.formatB1Info.tpcCmd = 1; //tpc;
- pdcch->dci.u.formatB1Info.DL_PCRS = 0;
-
- break; /* case TFU_DCI_FORMAT_B1: */
- }
-
- case TFU_DCI_FORMAT_B2:
- {
- //DU_LOG("\nINFO --> SCH : RG_5GTF:: Pdcch filling with DCI format B2\n");
- /* ToDo: Anoop */
- break; /* case TFU_DCI_FORMAT_B2: */
- }
-#endif
- case TFU_DCI_FORMAT_1A:
- pdcch->dci.u.format1aInfo.isPdcchOrder = FALSE;
-
- /*Nprb indication at PHY for common Ch
- *setting least significant bit of tpc field to 1 if
- nPrb=3 and 0 otherwise. */
- if (rbAllocInfo->nPrb == 3)
- {
- pdcch->dci.u.format1aInfo.t.pdschInfo.tpcCmd = 1;
- }
- else
- {
- pdcch->dci.u.format1aInfo.t.pdschInfo.tpcCmd = 0;
- }
- pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.nGap2.pres = NOTPRSNT;
- pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.isLocal = TRUE;
- pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.mcs = \
- rbAllocInfo->tbInfo[0].imcs;
- pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.ndi = 0;
- pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.rv = 0;
- /* Add RIV CALC */
- pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.type =
- TFU_ALLOC_TYPE_RIV;
- pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.u.riv =
- rgSCHCmnCalcRiv (cell->bwCfg.dlTotalBw,
- rbAllocInfo->allocInfo.raType2.rbStart,
- rbAllocInfo->allocInfo.raType2.numRb);
-
-#ifdef LTE_TDD
- pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.harqProcId.pres = \
- FALSE;
-#ifdef TFU_TDD
- pdcch->dci.u.format1aInfo.t.pdschInfo.dai.pres = TRUE;
- pdcch->dci.u.format1aInfo.t.pdschInfo.dai.val = 1;
-#endif
-#endif
- break; /* case TFU_DCI_FORMAT_1A: */
- case TFU_DCI_FORMAT_1:
- pdcch->dci.u.format1Info.tpcCmd = 0;
- /* Avoiding this check,as we dont support Type1 RA */
-#ifdef RG_UNUSED
- if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE0)
- {
-#endif
- pdcch->dci.u.format1Info.allocInfo.isAllocType0 = TRUE;
- pdcch->dci.u.format1Info.allocInfo.resAllocMap[0] =
- ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 24)
- & 0xff);
- pdcch->dci.u.format1Info.allocInfo.resAllocMap[1] =
- ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 16)
- & 0x00ff);
- pdcch->dci.u.format1Info.allocInfo.resAllocMap[2] =
- ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 8)
- & 0x0000ff);
- pdcch->dci.u.format1Info.allocInfo.resAllocMap[3] =
- ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask & 0x000000ff));
-#ifdef RG_UNUSED
- }
-#endif
- pdcch->dci.u.format1Info.allocInfo.harqProcId = 0;
- pdcch->dci.u.format1Info.allocInfo.ndi = 0;
- pdcch->dci.u.format1Info.allocInfo.mcs = rbAllocInfo->tbInfo[0].imcs;
- pdcch->dci.u.format1Info.allocInfo.rv = 0;
-#ifdef TFU_TDD
- pdcch->dci.u.format1Info.dai = 1;
-#endif
- break;
- default:
- DU_LOG("\nERROR --> SCH : Allocator's icorrect "
- "dciForamt Fill RNTI:%d",rbAllocInfo->rnti);
- break;
- }
- return;
-}
-
-#ifdef LTE_TDD
-/**
- * @brief This function finds whether the subframe is special subframe or not.
- *
- * @details
- *
- * Function: rgSCHCmnIsSplSubfrm
- * Purpose: This function finds the subframe index of the special subframe
- * and finds whether the current DL index matches it or not.
- *
- * Invoked by: Scheduler
- *
- * @param[in] uint8_t splfrmCnt
- * @param[in] uint8_t curSubfrmIdx
- * @param[in] uint8_t periodicity
- * @param[in] RgSchTddSubfrmInfo *subfrmInfo
- * @return Bool
- *
- **/
-static Bool rgSCHCmnIsSplSubfrm(uint8_t splfrmCnt,uint8_t curSubfrmIdx,uint8_t periodicity,RgSchTddSubfrmInfo *subfrmInfo)
-{
- uint8_t dlSfCnt = 0;
- uint8_t splfrmIdx = 0;
-
- if(splfrmCnt > 0)
- {
- if(periodicity == RG_SCH_CMN_5_MS_PRD)
- {
- if(splfrmCnt%2)
- {
- dlSfCnt = ((splfrmCnt-1)/2) *\
- (subfrmInfo->numFrmHf1 + subfrmInfo->numFrmHf2);
- dlSfCnt = dlSfCnt + subfrmInfo->numFrmHf1;
- }
- else
- {
- dlSfCnt = (splfrmCnt/2) * \
- (subfrmInfo->numFrmHf1 + subfrmInfo->numFrmHf2);
- }
- }
- else
- {
- dlSfCnt = splfrmCnt * subfrmInfo->numFrmHf1;
- }
- splfrmIdx = RG_SCH_CMN_SPL_SUBFRM_1 +\
- (periodicity*splfrmCnt - dlSfCnt);
- }
- else
- {
- splfrmIdx = RG_SCH_CMN_SPL_SUBFRM_1;
- }
-
- if(splfrmIdx == curSubfrmIdx)
- {
- return (TRUE);
- }
-
- return (FALSE);
-}
-
-/**
- * @brief This function updates DAI or UL index.
- *
- * @details
- *
- * Function: rgSCHCmnUpdHqAndDai
- * Purpose: Updates the DAI based on UL-DL Configuration
- * index and UE. It also updates the HARQ feedback
- * time and 'm' index.
- *
- * Invoked by: TOM
- *
- * @param[in] RgDlHqProcCb *hqP
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchDlHqTbCb *tbCb
- * @param[in] uint8_t tbAllocIdx
- * @return Void
- *
- **/
-static Void rgSCHCmnUpdHqAndDai(RgSchDlHqProcCb *hqP,RgSchDlSf *subFrm,RgSchDlHqTbCb *tbCb,uint8_t tbAllocIdx)
-{
- RgSchUeCb *ue = hqP->hqE->ue;
-
-
- if(subFrm != NULLP)
- {
- /* set the time at which UE shall send the feedback
- * for this process */
- tbCb->fdbkTime.sfn = (tbCb->timingInfo.sfn + \
- subFrm->dlFdbkInfo.sfnOffset) % RGSCH_MAX_SFN;
- tbCb->fdbkTime.subframe = subFrm->dlFdbkInfo.subframe;
- tbCb->m = subFrm->dlFdbkInfo.m;
- }
- else
- {
- /* set the time at which UE shall send the feedback
- * for this process */
- tbCb->fdbkTime.sfn = (tbCb->timingInfo.sfn + \
- hqP->subFrm->dlFdbkInfo.sfnOffset) % RGSCH_MAX_SFN;
- tbCb->fdbkTime.subframe = hqP->subFrm->dlFdbkInfo.subframe;
- tbCb->m = hqP->subFrm->dlFdbkInfo.m;
- }
-
- /* ccpu00132340-MOD- DAI need to be updated for first TB only*/
- if(ue && !tbAllocIdx)
- {
- Bool havePdcch = (tbCb->hqP->pdcch ? TRUE : FALSE);
- uint8_t dlDai;
-
- dlDai = rgSCHCmnUpdDai(ue, &tbCb->fdbkTime, tbCb->m, havePdcch,tbCb->hqP,
- &tbCb->dai);
- if(havePdcch)
- {/* Non SPS occasions */
- tbCb->hqP->pdcch->dlDai = dlDai;
- /* hqP->ulDai is used for N1 resource filling
- * when SPS occaions present in a bundle */
- tbCb->hqP->ulDai = tbCb->dai;
- tbCb->hqP->dlDai = dlDai;
- }
- }
-
- /* Updatijng pucchFdbkIdx for both PUCCH or PUSCH
- fdbk reception */
- tbCb->pucchFdbkIdx = tbCb->hqP->ulDai;
-
- return;
-}
-
-
-/**
- * @brief This function updates DAI or UL index.
- *
- * @details
- *
- * Function: rgSCHCmnUpdDai
- * Purpose: Updates the DAI in the ack-nack info, a valid
- * ue should be passed
- *
- * Invoked by: TOM
- *
- * @param[in] RgDlHqProcCb *hqP
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchDlHqTbCb *tbCb
- * @return uint8_t dlDai
- *
- **/
-uint8_t rgSCHCmnUpdDai
-(
-RgSchUeCb *ue,
-CmLteTimingInfo *fdbkTime,
-uint8_t m,
-Bool havePdcch,
-RgSchDlHqProcCb *hqP,
-uint8_t *ulDai
-)
-{
- RgSchTddANInfo *anInfo;
- uint8_t servCellIdx;
- uint8_t ackNackFdbkArrSize;
-
- if(hqP != NULLP)
- {/* Non SPS */
-#ifdef LTE_ADV
- servCellIdx = rgSchUtlGetServCellIdx(hqP->hqE->cell->instIdx,
- hqP->hqE->cell->cellId,
- ue);
-#else
- servCellIdx = RGSCH_PCELL_INDEX;
-#endif
- ackNackFdbkArrSize = hqP->hqE->cell->ackNackFdbkArrSize;
- }else
- {/* SPS on primary cell */
- servCellIdx = RGSCH_PCELL_INDEX;
- ackNackFdbkArrSize = ue->cell->ackNackFdbkArrSize;
- }
-
-
- anInfo = rgSCHUtlGetUeANFdbkInfo(ue, fdbkTime,servCellIdx);
-
- /* If no ACK/NACK feedback already present, create a new one */
- if(NULLP == anInfo)
- {
- anInfo = &ue->cellInfo[servCellIdx]->anInfo[ue->cellInfo[servCellIdx]->nextFreeANIdx];
- anInfo->sfn = fdbkTime->sfn;
- anInfo->subframe = fdbkTime->subframe;
- anInfo->latestMIdx = m;
- /* Fixing DAI value - ccpu00109162 */
- /* Handle TDD case as in MIMO definition of the function */
- anInfo->ulDai = 1;
- if (havePdcch)
- {
- anInfo->dlDai = 1;
- }
- anInfo->isSpsOccasion = FALSE;
- /* set the free Index to store Ack/Nack Information*/
- ue->cellInfo[servCellIdx]->nextFreeANIdx = (ue->cellInfo[servCellIdx]->nextFreeANIdx + 1) %
- ackNackFdbkArrSize;
-
- }
- else
- {
- anInfo->latestMIdx = m;
- /* Fixing DAI value - ccpu00109162 */
- /* Handle TDD case as in MIMO definition of the function */
- anInfo->ulDai = anInfo->ulDai + 1;
- if (havePdcch)
- {
- anInfo->dlDai = anInfo->dlDai + 1;
- }
- }
-#ifdef LTE_ADV
- /* ignoring the Scell check,
- * for primary cell this field is unused*/
- if(hqP != NULLP)
- {/* SPS*/
- anInfo->n1ResTpcIdx = hqP->tpc;
- }
-
- if(ulDai)
- {/* As this not required for release pdcch */
- *ulDai = anInfo->ulDai;
- }
-#endif
- return (anInfo->dlDai);
-
-}
-#endif /* ifdef LTE_TDD */
-
-uint32_t rgHqRvRetxCnt[4][2];
-uint32_t rgUlrate_grant;
-
-/**
- * @brief This function fills the HqP TB with rbAllocInfo.
- *
- * @details
- *
- * Function: rgSCHCmnFillHqPTb
- * Purpose: This function fills in the HqP TB with rbAllocInfo.
- *
- * Invoked by: rgSCHCmnFillHqPTb
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchDlRbAlloc *rbAllocInfo,
- * @param[in] uint8_t tbAllocIdx
- * @param[in] RgSchPdcch *pdcch
- * @return Void
- *
- **/
-#ifdef LTEMAC_SPS
-Void rgSCHCmnFillHqPTb
-(
-RgSchCellCb *cell,
-RgSchDlRbAlloc *rbAllocInfo,
-uint8_t tbAllocIdx,
-RgSchPdcch *pdcch
-)
-#else
-static Void rgSCHCmnFillHqPTb
-(
-RgSchCellCb *cell,
-RgSchDlRbAlloc *rbAllocInfo,
-uint8_t tbAllocIdx,
-RgSchPdcch *pdcch
-)
-#endif /* LTEMAC_SPS */
-{
- RgSchCmnDlCell *cmnCellDl = RG_SCH_CMN_GET_DL_CELL(cell);
- RgSchDlTbAllocInfo *tbAllocInfo = &rbAllocInfo->tbInfo[tbAllocIdx];
- RgSchDlHqTbCb *tbInfo = tbAllocInfo->tbCb;
- RgSchDlHqProcCb *hqP = tbInfo->hqP;
-
-
- /*ccpu00120365-ADD-if tb is disabled, set mcs=0,rv=1.
- * Relevant for DCI format 2 & 2A as per 36.213-7.1.7.2
- */
- if ( tbAllocInfo->isDisabled)
- {
-
- tbInfo->dlGrnt.iMcs = 0;
- tbInfo->dlGrnt.rv = 1;
- }
- /* Fill for TB retransmission */
- else if (tbInfo->txCntr > 0)
- {
-
- tbInfo->timingInfo = cmnCellDl->time;
- /* Fix */
- if ((tbInfo->isAckNackDtx == TFU_HQFDB_DTX))
- {
- tbInfo->dlGrnt.iMcs = tbAllocInfo->imcs;
- rgHqRvRetxCnt[tbInfo->dlGrnt.rv][tbInfo->tbIdx]++;
- }
- else
- {
- tbInfo->dlGrnt.rv = rgSchCmnDlRvTbl[++(tbInfo->ccchSchdInfo.rvIdx) & 0x03];
- }
-
- /* fill the scheduler information of hqProc */
- tbInfo->ccchSchdInfo.totBytes = tbAllocInfo->bytesAlloc;
- RGSCH_ARRAY_BOUND_CHECK(cell->instIdx,hqP->tbInfo,tbInfo->tbIdx );
- rgSCHDhmHqTbRetx(hqP->hqE, tbInfo->timingInfo, hqP, tbInfo->tbIdx);
- }
- /* Fill for TB transmission */
- else
- {
- /* Fill the HqProc */
- tbInfo->dlGrnt.iMcs = tbAllocInfo->imcs;
- tbInfo->tbSz = tbAllocInfo->bytesAlloc;
- tbInfo->timingInfo = cmnCellDl->time;
-
- tbInfo->dlGrnt.rv = rgSchCmnDlRvTbl[0];
- /* fill the scheduler information of hqProc */
- tbInfo->ccchSchdInfo.rvIdx = 0;
- tbInfo->ccchSchdInfo.totBytes = tbAllocInfo->bytesAlloc;
- /* DwPts Scheduling Changes Start */
- /* DwPts Scheduling Changes End */
- cell->measurements.dlBytesCnt += tbAllocInfo->bytesAlloc;
- }
-
- /*ccpu00120365:-ADD-only add to subFrm list if tb is not disabled */
- if ( tbAllocInfo->isDisabled == FALSE )
- {
- /* Set the number of transmitting SM layers for this TB */
- tbInfo->numLyrs = tbAllocInfo->noLyr;
- /* Set the TB state as WAITING to indicate TB has been
- * considered for transmission */
- tbInfo->state = HQ_TB_WAITING;
- hqP->subFrm = rbAllocInfo->dlSf;
- tbInfo->hqP->pdcch = pdcch;
- //tbInfo->dlGrnt.numRb = rbAllocInfo->rbsAlloc;
- rgSCHUtlDlHqPTbAddToTx(hqP->subFrm, hqP, tbInfo->tbIdx);
- }
- return;
-}
-
-/**
- * @brief This function fills the PDCCH DCI format 2 information from dlProc.
- *
- * @details
- *
- * Function: rgSCHCmnFillHqPPdcchDciFrmt2
- * Purpose: This function fills in the PDCCH information
- * obtained from the RgSchDlHqProcCb and RgSchDlRbAlloc
- * for dedicated service scheduling. It also
- * obtains TPC to be filled in from the power module.
- * Assign the PDCCH to HQProc.
- *
- * Invoked by: Downlink Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchDlRbAlloc* rbAllocInfo
- * @param[in] RgDlHqProc* hqP
- * @param[out] RgSchPdcch *pdcch
- * @param[in] uint8_t tpc
- * @return Void
- *
- **/
-static Void rgSCHCmnFillHqPPdcchDciFrmtB1B2
-(
-RgSchCellCb *cell,
-RgSchDlRbAlloc *rbAllocInfo,
-RgSchDlHqProcCb *hqP,
-RgSchPdcch *pdcch,
-uint8_t tpc
-)
-{
-
-
- rgSCHCmnFillHqPTb(cell, rbAllocInfo, 0, pdcch);
- //Currently hardcoding values here.
- //DU_LOG("\nINFO --> SCH : Filling 5GTF UL DCI for rnti %d \n",alloc->rnti);
- switch(rbAllocInfo->dciFormat)
- {
- case TFU_DCI_FORMAT_B1:
- {
- pdcch->dci.u.formatB1Info.formatType = 0;
- pdcch->dci.u.formatB1Info.xPDSCHRange = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.xPDSCHRange;
- pdcch->dci.u.formatB1Info.RBAssign = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rbAssign;
- pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.hqProcId = hqP->procId;
- pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.mcs = rbAllocInfo->tbInfo[0].imcs;
- pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.ndi = rbAllocInfo->tbInfo[0].tbCb->ndi;
- pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.RV = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rv;
- pdcch->dci.u.formatB1Info.u.rbAssignB1Val324.bmiHqAckNack = 0;
- pdcch->dci.u.formatB1Info.CSI_BSI_BRI_Req = 0;
- pdcch->dci.u.formatB1Info.CSIRS_BRRS_TxTiming = 0;
- pdcch->dci.u.formatB1Info.CSIRS_BRRS_SymbIdx = 0;
- pdcch->dci.u.formatB1Info.CSIRS_BRRS_ProcInd = 0;
- pdcch->dci.u.formatB1Info.xPUCCH_TxTiming = 0;
- //TODO_SID: Need to update
- pdcch->dci.u.formatB1Info.freqResIdx_xPUCCH = 0;
- pdcch->dci.u.formatB1Info.beamSwitch = 0;
- pdcch->dci.u.formatB1Info.SRS_Config = 0;
- pdcch->dci.u.formatB1Info.SRS_Symbol = 0;
- //TODO_SID: Need to check.Currently setting 0(1 layer, ports(8) w/o OCC).
- pdcch->dci.u.formatB1Info.AntPorts_numLayers = 0;
- pdcch->dci.u.formatB1Info.SCID = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.SCID;
- //TODO_SID: Hardcoding TPC command to 1 i.e. No change
- pdcch->dci.u.formatB1Info.tpcCmd = 1; //tpc;
- pdcch->dci.u.formatB1Info.DL_PCRS = 0;
- break;
- }
- case TFU_DCI_FORMAT_B2:
- {
- pdcch->dci.u.formatB2Info.formatType = 1;
- pdcch->dci.u.formatB2Info.xPDSCHRange = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.xPDSCHRange;
- pdcch->dci.u.formatB2Info.RBAssign = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rbAssign;
- pdcch->dci.u.formatB2Info.u.rbAssignB1Val324.hqProcId = hqP->procId;
- pdcch->dci.u.formatB2Info.u.rbAssignB1Val324.mcs = rbAllocInfo->tbInfo[0].imcs;
- pdcch->dci.u.formatB2Info.u.rbAssignB1Val324.ndi = rbAllocInfo->tbInfo[0].tbCb->ndi;
- pdcch->dci.u.formatB2Info.u.rbAssignB1Val324.RV = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rv;
- pdcch->dci.u.formatB2Info.u.rbAssignB1Val324.bmiHqAckNack = 0;
- pdcch->dci.u.formatB2Info.CSI_BSI_BRI_Req = 0;
- pdcch->dci.u.formatB2Info.CSIRS_BRRS_TxTiming = 0;
- pdcch->dci.u.formatB2Info.CSIRS_BRRS_SymbIdx = 0;
- pdcch->dci.u.formatB2Info.CSIRS_BRRS_ProcInd = 0;
- pdcch->dci.u.formatB2Info.xPUCCH_TxTiming = 0;
- //TODO_SID: Need to update
- pdcch->dci.u.formatB2Info.freqResIdx_xPUCCH = 0;
- pdcch->dci.u.formatB2Info.beamSwitch = 0;
- pdcch->dci.u.formatB2Info.SRS_Config = 0;
- pdcch->dci.u.formatB2Info.SRS_Symbol = 0;
- //TODO_SID: Need to check.Currently setting 4(2 layer, ports(8,9) w/o OCC).
- pdcch->dci.u.formatB2Info.AntPorts_numLayers = 4;
- pdcch->dci.u.formatB2Info.SCID = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.SCID;
- //TODO_SID: Hardcoding TPC command to 1 i.e. No change
- pdcch->dci.u.formatB2Info.tpcCmd = 1; //tpc;
- pdcch->dci.u.formatB2Info.DL_PCRS = 0;
- break;
- }
- default:
- DU_LOG("\nERROR --> SCH : 5GTF_ERROR Allocator's incorrect "
- "dciForamt Fill RNTI:%d",rbAllocInfo->rnti);
- break;
- }
-
- return;
-}
-
-uint32_t totPcellSCell;
-uint32_t addedForScell;
-uint32_t addedForScell1;
-uint32_t addedForScell2;
-/**
- * @brief This function fills the PDCCH information from dlProc.
- *
- * @details
- *
- * Function: rgSCHCmnFillHqPPdcch
- * Purpose: This function fills in the PDCCH information
- * obtained from the RgSchDlHqProcCb and RgSchDlRbAlloc
- * for dedicated service scheduling. It also
- * obtains TPC to be filled in from the power module.
- * Assign the PDCCH to HQProc.
- *
- * Invoked by: Downlink Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchDlRbAlloc* rbAllocInfo
- * @param[in] RgDlHqProc* hqP
- * @return Void
- *
- **/
-Void rgSCHCmnFillHqPPdcch(RgSchCellCb *cell,RgSchDlRbAlloc *rbAllocInfo,RgSchDlHqProcCb *hqP)
-{
- RgSchCmnDlCell *cmnCell = RG_SCH_CMN_GET_DL_CELL(cell);
- RgSchPdcch *pdcch = rbAllocInfo->pdcch;
- uint8_t tpc = 1;
-
-
- if (hqP->hqE->ue)
- {
-#ifdef LTE_ADV
- if(RG_SCH_IS_CELL_SEC(hqP->hqE->ue, cell))
- {
- tpc = hqP->tpc;
- }
- else
-#endif
- {
- tpc = rgSCHPwrPucchTpcForUe(cell, hqP->hqE->ue);
- }
- /* Fix: syed moving this to a common function for both scheduled
- * and non-scheduled UEs */
-
- pdcch->ue = hqP->hqE->ue;
- if (hqP->hqE->ue->csgMmbrSta == FALSE)
- {
- cmnCell->ncsgPrbCnt += rbAllocInfo->rbsAlloc;
- }
- cmnCell->totPrbCnt += rbAllocInfo->rbsAlloc;
-#ifdef TENB_STATS
- {
- hqP->hqE->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(hqP->hqE->cell)].dlPrbUsg +=
- rbAllocInfo->rbsAlloc;
- hqP->hqE->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(hqP->hqE->cell)].dlSumCw0iTbs +=
- rbAllocInfo->tbInfo[0].iTbs;
- hqP->hqE->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(hqP->hqE->cell)].dlNumCw0iTbs ++;
- hqP->hqE->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(hqP->hqE->cell)].dlTpt +=
- (rbAllocInfo->tbInfo[0].bytesAlloc << 3);
-
-#ifdef LTE_ADV
- totPcellSCell += (rbAllocInfo->tbInfo[0].bytesAlloc << 3);
- if(RG_SCH_IS_CELL_SEC(hqP->hqE->ue, cell))
- {
- addedForScell += (rbAllocInfo->tbInfo[0].bytesAlloc << 3);
- addedForScell1 += (rbAllocInfo->tbInfo[0].bytesAlloc << 3);
-/*
- DU_LOG("\nINFO --> SCH : Hqp %d cell %d addedForScell %lu addedForScell1 %lu sfn:sf %d:%d \n",
- hqP->procId,
- hqP->hqE->cell->cellId,
- addedForScell,
- addedForScell1,
- cell->crntTime.sfn,
- cell->crntTime.slot);
- */
- }
-#endif
- hqP->hqE->cell->tenbStats->sch.dlPrbUsage[0] +=
- rbAllocInfo->rbsAlloc;
- hqP->hqE->cell->tenbStats->sch.dlSumCw0iTbs +=
- rbAllocInfo->tbInfo[0].iTbs;
- hqP->hqE->cell->tenbStats->sch.dlNumCw0iTbs ++;
- hqP->hqE->cell->tenbStats->sch.dlTtlTpt +=
- (rbAllocInfo->tbInfo[0].bytesAlloc << 3);
- if (rbAllocInfo->tbInfo[1].schdlngForTb)
- {
- hqP->hqE->cell->tenbStats->sch.dlSumCw1iTbs +=
- rbAllocInfo->tbInfo[1].iTbs;
- hqP->hqE->cell->tenbStats->sch.dlNumCw1iTbs ++;
- hqP->hqE->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(hqP->hqE->cell)].dlSumCw1iTbs +=
- rbAllocInfo->tbInfo[1].iTbs;
- hqP->hqE->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(hqP->hqE->cell)].dlNumCw1iTbs ++;
- hqP->hqE->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(hqP->hqE->cell)].dlTpt +=
- (rbAllocInfo->tbInfo[1].bytesAlloc << 3);
-
-
-#ifdef LTE_ADV
- if(RG_SCH_IS_CELL_SEC(hqP->hqE->ue, cell))
- {
- addedForScell += (rbAllocInfo->tbInfo[1].bytesAlloc << 3);
- addedForScell2 += (rbAllocInfo->tbInfo[1].bytesAlloc << 3);
-/*
- DU_LOG("\nINFO --> SCH : Hqp %d cell %d addedForScell %lu addedForScell2 %lu \n",
- hqP->procId,
- hqP->hqE->cell->cellId,
- addedForScell,
- addedForScell2);
- */
- }
- totPcellSCell += (rbAllocInfo->tbInfo[1].bytesAlloc << 3);
-#endif
-
-
- hqP->hqE->cell->tenbStats->sch.dlTtlTpt +=
- (rbAllocInfo->tbInfo[1].bytesAlloc << 3);
- }
- /*
- DU_LOG("\nINFO --> SCH : add DL TPT is %lu sfn:sf %d:%d \n", hqP->hqE->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(hqP->hqE->cell)].dlTpt ,
- cell->crntTime.sfn,
- cell->crntTime.slot);
- */
- }
-#endif
- }
-
- pdcch->rnti = rbAllocInfo->rnti;
- pdcch->dci.dciFormat = rbAllocInfo->dciFormat;
- /* Update subframe and pdcch info in HqTb control block */
- switch(rbAllocInfo->dciFormat)
- {
-#ifdef RG_5GTF
- case TFU_DCI_FORMAT_B1:
- case TFU_DCI_FORMAT_B2:
- {
- // DU_LOG("\nINFO --> SCH : RG_5GTF:: Pdcch filling with DCI format B1/B2\n");
- rgSCHCmnFillHqPPdcchDciFrmtB1B2(cell, rbAllocInfo, hqP, \
- pdcch, tpc);
- break;
- }
-#endif
- default:
- DU_LOG("\nERROR --> SCH : Allocator's incorrect dciForamt Fill for RNTI:%d",rbAllocInfo->rnti);
- break;
- }
- return;
-}
-#ifdef UNUSED_FUNC
-/**
- * @brief This function fills the PDCCH DCI format 1 information from dlProc.
- *
- * @details
- *
- * Function: rgSCHCmnFillHqPPdcchDciFrmt1
- * Purpose: This function fills in the PDCCH information
- * obtained from the RgSchDlHqProcCb and RgSchDlRbAlloc
- * for dedicated service scheduling. It also
- * obtains TPC to be filled in from the power module.
- * Assign the PDCCH to HQProc.
- *
- * Invoked by: Downlink Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchDlRbAlloc* rbAllocInfo
- * @param[in] RgDlHqProc* hqP
- * @param[out] RgSchPdcch *pdcch
- * @param[in] uint8_t tpc
- * @return Void
- *
- **/
-
-static Void rgSCHCmnFillHqPPdcchDciFrmt1
-(
-RgSchCellCb *cell,
-RgSchDlRbAlloc *rbAllocInfo,
-RgSchDlHqProcCb *hqP,
-RgSchPdcch *pdcch,
-uint8_t tpc
-)
-{
-
-#ifdef LTE_TDD
- RgSchTddANInfo *anInfo;
-#endif
-
-#ifdef LTEMAC_SPS
-/* For activation or reactivation,
- * Harq ProcId should be 0 */
- RgSchCmnDlHqProc *cmnHqDl = RG_SCH_CMN_GET_DL_HQP(hqP);
-#endif
-
-
- rgSCHCmnFillHqPTb(cell, rbAllocInfo, 0, pdcch);
- pdcch->dci.u.format1Info.tpcCmd = tpc;
- /* Avoiding this check,as we dont support Type1 RA */
-#ifdef RG_UNUSED
- if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE0)
- {
-#endif
- pdcch->dci.u.format1Info.allocInfo.isAllocType0 = TRUE;
- pdcch->dci.u.format1Info.allocInfo.resAllocMap[0] =
- ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 24)
- & 0xff);
- pdcch->dci.u.format1Info.allocInfo.resAllocMap[1] =
- ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 16)
- & 0x00ff);
- pdcch->dci.u.format1Info.allocInfo.resAllocMap[2] =
- ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 8)
- & 0x0000ff);
- pdcch->dci.u.format1Info.allocInfo.resAllocMap[3] =
- ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask & 0x000000ff));
-#ifdef RG_UNUSED
- }
-#endif
-#ifdef LTEMAC_SPS
- if ((!(hqP->tbInfo[0].txCntr)) &&
- (cmnHqDl != (RgSchCmnDlHqProc*)NULLP &&
- ((cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_ACTV) ||
- (cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_REACTV)))
- )
- {
- pdcch->dci.u.format1Info.allocInfo.harqProcId = 0;
- }
- else
- {
- pdcch->dci.u.format1Info.allocInfo.harqProcId = hqP->procId;
- }
-#else
- pdcch->dci.u.format1Info.allocInfo.harqProcId = hqP->procId;
-#endif
-
- pdcch->dci.u.format1Info.allocInfo.ndi =
- rbAllocInfo->tbInfo[0].tbCb->ndi;
- pdcch->dci.u.format1Info.allocInfo.mcs =
- rbAllocInfo->tbInfo[0].imcs;
- pdcch->dci.u.format1Info.allocInfo.rv =
- rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rv;
-#ifdef LTE_TDD
- if(hqP->hqE->ue != NULLP)
- {
-#ifdef LTE_ADV
- uint8_t servCellIdx = rgSchUtlGetServCellIdx(hqP->hqE->cell->instIdx,
- hqP->hqE->cell->cellId,
- hqP->hqE->ue);
-
- anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue,
- &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),servCellIdx);
-#else
- anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue,
- &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),0);
-#endif
-#ifdef TFU_TDD
- if(anInfo)
- {
- pdcch->dci.u.format1Info.dai = RG_SCH_GET_DAI_VALUE(anInfo->dlDai);
- }
- else
- {
- /* Fixing DAI value - ccpu00109162 */
- pdcch->dci.u.format1Info.dai = RG_SCH_MAX_DAI_IDX;
- }
-#endif
- }
- else
- {
- /* always 0 for RACH */
- pdcch->dci.u.format1Info.allocInfo.harqProcId = 0;
-#ifdef TFU_TDD
- /* Fixing DAI value - ccpu00109162 */
- pdcch->dci.u.format1Info.dai = 1;
-#endif
- }
-#endif
-
-
- return;
-}
-/**
- * @brief This function fills the PDCCH DCI format 1A information from dlProc.
- *
- * @details
- *
- * Function: rgSCHCmnFillHqPPdcchDciFrmt1A
- * Purpose: This function fills in the PDCCH information
- * obtained from the RgSchDlHqProcCb and RgSchDlRbAlloc
- * for dedicated service scheduling. It also
- * obtains TPC to be filled in from the power module.
- * Assign the PDCCH to HQProc.
- *
- * Invoked by: Downlink Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchDlRbAlloc* rbAllocInfo
- * @param[in] RgDlHqProc* hqP
- * @param[out] RgSchPdcch *pdcch
- * @param[in] uint8_t tpc
- * @return Void
- *
- **/
-static Void rgSCHCmnFillHqPPdcchDciFrmt1A
-(
-RgSchCellCb *cell,
-RgSchDlRbAlloc *rbAllocInfo,
-RgSchDlHqProcCb *hqP,
-RgSchPdcch *pdcch,
-uint8_t tpc
-)
-{
-
-#ifdef LTE_TDD
- RgSchTddANInfo *anInfo;
-#endif
-
-#ifdef LTEMAC_SPS
- RgSchCmnDlHqProc *cmnHqDl = RG_SCH_CMN_GET_DL_HQP(hqP);
-#endif
-
-
- rgSCHCmnFillHqPTb(cell, rbAllocInfo, 0, pdcch);
- pdcch->dci.u.format1aInfo.isPdcchOrder = FALSE;
- pdcch->dci.u.format1aInfo.t.pdschInfo.tpcCmd = tpc;
- pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.mcs = \
- rbAllocInfo->tbInfo[0].imcs;
- pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.harqProcId.pres = TRUE;
-#ifdef LTEMAC_SPS
- if ((!(hqP->tbInfo[0].txCntr)) &&
- ( cmnHqDl != (RgSchCmnDlHqProc*)NULLP &&
- ((cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_ACTV) ||
- (cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_REACTV))
- ))
- {
- pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.harqProcId.val = 0;
- }
- else
- {
- pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.harqProcId.val
- = hqP->procId;
- }
-#else
- pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.harqProcId.val =
- hqP->procId;
-#endif
- pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.ndi = \
- rbAllocInfo->tbInfo[0].tbCb->ndi;
- pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.rv = \
- rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rv;
- /* As of now, we do not support Distributed allocations */
- pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.isLocal = TRUE;
- pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.nGap2.pres = NOTPRSNT;
- pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.type =
- TFU_ALLOC_TYPE_RIV;
- pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.u.riv =
- rgSCHCmnCalcRiv (cell->bwCfg.dlTotalBw,
- rbAllocInfo->allocInfo.raType2.rbStart,
- rbAllocInfo->allocInfo.raType2.numRb);
-#ifdef LTE_TDD
- if(hqP->hqE->ue != NULLP)
- {
-#ifdef LTE_ADV
- uint8_t servCellIdx = rgSchUtlGetServCellIdx(hqP->hqE->cell->instIdx,
- hqP->hqE->cell->cellId,
- hqP->hqE->ue);
- anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue,
- &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),servCellIdx);
-#else
- anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue,
- &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),0);
-#endif
-#ifdef TFU_TDD
- pdcch->dci.u.format1aInfo.t.pdschInfo.dai.pres = TRUE;
- if(anInfo)
- {
- pdcch->dci.u.format1aInfo.t.pdschInfo.dai.val =
- RG_SCH_GET_DAI_VALUE(anInfo->dlDai);
- }
- else
- {
- /* Fixing DAI value - ccpu00109162 */
- pdcch->dci.u.format1aInfo.t.pdschInfo.dai.val = RG_SCH_MAX_DAI_IDX;
- DU_LOG("\nERROR --> SCH : PDCCH is been scheduled without updating anInfo RNTI:%d",
- rbAllocInfo->rnti);
- }
-#endif
- }
- else
- {
- /* always 0 for RACH */
- pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.harqProcId.pres
- = FALSE;
-#ifdef TFU_TDD
- pdcch->dci.u.format1aInfo.t.pdschInfo.dai.pres = TRUE;
- /* Fixing DAI value - ccpu00109162 */
- pdcch->dci.u.format1aInfo.t.pdschInfo.dai.val = 1;
-#endif
- }
-#endif
-
- return;
-}
-/**
- * @brief This function fills the PDCCH DCI format 1B information from dlProc.
- *
- * @details
- *
- * Function: rgSCHCmnFillHqPPdcchDciFrmt1B
- * Purpose: This function fills in the PDCCH information
- * obtained from the RgSchDlHqProcCb and RgSchDlRbAlloc
- * for dedicated service scheduling. It also
- * obtains TPC to be filled in from the power module.
- * Assign the PDCCH to HQProc.
- *
- * Invoked by: Downlink Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchDlRbAlloc* rbAllocInfo
- * @param[in] RgDlHqProc* hqP
- * @param[out] RgSchPdcch *pdcch
- * @param[in] uint8_t tpc
- * @return Void
- *
- **/
-static Void rgSCHCmnFillHqPPdcchDciFrmt1B
-(
-RgSchCellCb *cell,
-RgSchDlRbAlloc *rbAllocInfo,
-RgSchDlHqProcCb *hqP,
-RgSchPdcch *pdcch,
-uint8_t tpc
-)
-{
-
-#ifdef LTE_TDD
- RgSchTddANInfo *anInfo;
-#endif
-
-#ifdef LTEMAC_SPS
- RgSchCmnDlHqProc *cmnHqDl = RG_SCH_CMN_GET_DL_HQP(hqP);
-#endif
-
-
- rgSCHCmnFillHqPTb(cell, rbAllocInfo, 0, pdcch);
- pdcch->dci.u.format1bInfo.tpcCmd = tpc;
- pdcch->dci.u.format1bInfo.allocInfo.mcs = \
- rbAllocInfo->tbInfo[0].imcs;
-#ifdef LTEMAC_SPS
- if ((!(hqP->tbInfo[0].txCntr)) &&
- ( cmnHqDl != (RgSchCmnDlHqProc*)NULLP &&
- ((cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_ACTV) ||
- (cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_REACTV))
- ))
- {
- pdcch->dci.u.format1bInfo.allocInfo.harqProcId = 0;
- }
- else
- {
- pdcch->dci.u.format1bInfo.allocInfo.harqProcId = hqP->procId;
- }
-#else
- pdcch->dci.u.format1bInfo.allocInfo.harqProcId = hqP->procId;
-#endif
- pdcch->dci.u.format1bInfo.allocInfo.ndi = \
- rbAllocInfo->tbInfo[0].tbCb->ndi;
- pdcch->dci.u.format1bInfo.allocInfo.rv = \
- rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rv;
- /* As of now, we do not support Distributed allocations */
- pdcch->dci.u.format1bInfo.allocInfo.isLocal = TRUE;
- pdcch->dci.u.format1bInfo.allocInfo.nGap2.pres = NOTPRSNT;
- pdcch->dci.u.format1bInfo.allocInfo.alloc.type =
- TFU_ALLOC_TYPE_RIV;
- pdcch->dci.u.format1bInfo.allocInfo.alloc.u.riv =
- rgSCHCmnCalcRiv (cell->bwCfg.dlTotalBw,
- rbAllocInfo->allocInfo.raType2.rbStart,
- rbAllocInfo->allocInfo.raType2.numRb);
- /* Fill precoding Info */
- pdcch->dci.u.format1bInfo.allocInfo.pmiCfm = \
- rbAllocInfo->mimoAllocInfo.precIdxInfo >> 4;
- pdcch->dci.u.format1bInfo.allocInfo.tPmi = \
- rbAllocInfo->mimoAllocInfo.precIdxInfo & 0x0F;
-#ifdef LTE_TDD
- if(hqP->hqE->ue != NULLP)
- {
-#ifdef LTE_ADV
- uint8_t servCellIdx = rgSchUtlGetServCellIdx(hqP->hqE->cell->instIdx,
- hqP->hqE->cell->cellId,
- hqP->hqE->ue);
- anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue,
- &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),servCellIdx);
-#else
- anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue,
- &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),0);
-#endif
-#ifdef TFU_TDD
- if(anInfo)
- {
- pdcch->dci.u.format1bInfo.dai =
- RG_SCH_GET_DAI_VALUE(anInfo->dlDai);
- }
- else
- {
- pdcch->dci.u.format1bInfo.dai = RG_SCH_MAX_DAI_IDX;
- DU_LOG("\nERROR --> SCH : PDCCH is been scheduled without updating anInfo RNTI:%d",
- rbAllocInfo->rnti);
- }
-#endif
- }
-#endif
-
- return;
-
-}
-/**
- * @brief This function fills the PDCCH DCI format 2 information from dlProc.
- *
- * @details
- *
- * Function: rgSCHCmnFillHqPPdcchDciFrmt2
- * Purpose: This function fills in the PDCCH information
- * obtained from the RgSchDlHqProcCb and RgSchDlRbAlloc
- * for dedicated service scheduling. It also
- * obtains TPC to be filled in from the power module.
- * Assign the PDCCH to HQProc.
- *
- * Invoked by: Downlink Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchDlRbAlloc* rbAllocInfo
- * @param[in] RgDlHqProc* hqP
- * @param[out] RgSchPdcch *pdcch
- * @param[in] uint8_t tpc
- * @return Void
- *
- **/
-static Void rgSCHCmnFillHqPPdcchDciFrmt2
-(
-RgSchCellCb *cell,
-RgSchDlRbAlloc *rbAllocInfo,
-RgSchDlHqProcCb *hqP,
-RgSchPdcch *pdcch,
-uint8_t tpc
-)
-{
-
-#ifdef LTE_TDD
- RgSchTddANInfo *anInfo;
-#endif
-
-#ifdef LTEMAC_SPS
-/* ccpu00119023-ADD-For activation or reactivation,
- * Harq ProcId should be 0 */
- RgSchCmnDlHqProc *cmnHqDl = RG_SCH_CMN_GET_DL_HQP(hqP);
-#endif
-
-
- rgSCHCmnFillHqPTb(cell, rbAllocInfo, 0, pdcch);
- /*ccpu00120365:-ADD-call also if tb is disabled */
- if (rbAllocInfo->tbInfo[1].schdlngForTb ||
- rbAllocInfo->tbInfo[1].isDisabled)
- {
- rgSCHCmnFillHqPTb(cell, rbAllocInfo, 1, pdcch);
- }
- pdcch->dci.u.format2Info.tpcCmd = tpc;
- /* Avoiding this check,as we dont support Type1 RA */
-#ifdef RG_UNUSED
- if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE0)
- {
-#endif
- pdcch->dci.u.format2Info.allocInfo.isAllocType0 = TRUE;
- pdcch->dci.u.format2Info.allocInfo.resAllocMap[0] =
- ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 24)
- & 0xff);
- pdcch->dci.u.format2Info.allocInfo.resAllocMap[1] =
- ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 16)
- & 0x00ff);
- pdcch->dci.u.format2Info.allocInfo.resAllocMap[2] =
- ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 8)
- & 0x0000ff);
- pdcch->dci.u.format2Info.allocInfo.resAllocMap[3] =
- ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask & 0x000000ff));
-#ifdef RG_UNUSED
- }
-#endif
-#ifdef LTEMAC_SPS
- if ((!(hqP->tbInfo[0].txCntr)) &&
- ( cmnHqDl != (RgSchCmnDlHqProc*)NULLP &&
- ((cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_ACTV) ||
- (cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_REACTV))
- ))
- {
- pdcch->dci.u.format2Info.allocInfo.harqProcId = 0;
- }
- else
- {
- pdcch->dci.u.format2Info.allocInfo.harqProcId = hqP->procId;
- }
-#else
- pdcch->dci.u.format2Info.allocInfo.harqProcId = hqP->procId;
-#endif
- /* Initialize the TB info for both the TBs */
- pdcch->dci.u.format2Info.allocInfo.tbInfo[0].mcs = 0;
- pdcch->dci.u.format2Info.allocInfo.tbInfo[0].rv = 1;
- pdcch->dci.u.format2Info.allocInfo.tbInfo[1].mcs = 0;
- pdcch->dci.u.format2Info.allocInfo.tbInfo[1].rv = 1;
- /* Fill tbInfo for scheduled TBs */
- pdcch->dci.u.format2Info.allocInfo.tbInfo[rbAllocInfo->tbInfo[0].\
- tbCb->tbIdx].ndi = rbAllocInfo->tbInfo[0].tbCb->ndi;
- pdcch->dci.u.format2Info.allocInfo.tbInfo[rbAllocInfo->tbInfo[0].\
- tbCb->tbIdx].mcs = rbAllocInfo->tbInfo[0].imcs;
- pdcch->dci.u.format2Info.allocInfo.tbInfo[rbAllocInfo->tbInfo[0].\
- tbCb->tbIdx].rv = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rv;
- /* If we reach this function. It is safely assumed that
- * rbAllocInfo->tbInfo[0] always has non default valid values.
- * rbAllocInfo->tbInfo[1]'s scheduling is optional */
- if (rbAllocInfo->tbInfo[1].schdlngForTb == TRUE)
- {
- pdcch->dci.u.format2Info.allocInfo.tbInfo[rbAllocInfo->tbInfo[1].\
- tbCb->tbIdx].ndi = rbAllocInfo->tbInfo[1].tbCb->ndi;
- pdcch->dci.u.format2Info.allocInfo.tbInfo[rbAllocInfo->tbInfo[1].\
- tbCb->tbIdx].mcs = rbAllocInfo->tbInfo[1].imcs;
- pdcch->dci.u.format2Info.allocInfo.tbInfo[rbAllocInfo->tbInfo[1].\
- tbCb->tbIdx].rv = rbAllocInfo->tbInfo[1].tbCb->dlGrnt.rv;
- }
- pdcch->dci.u.format2Info.allocInfo.transSwap =
- rbAllocInfo->mimoAllocInfo.swpFlg;
- pdcch->dci.u.format2Info.allocInfo.precoding =
- rbAllocInfo->mimoAllocInfo.precIdxInfo;
-#ifdef LTE_TDD
- if(hqP->hqE->ue != NULLP)
- {
-
-#ifdef LTE_ADV
- uint8_t servCellIdx = rgSchUtlGetServCellIdx(hqP->hqE->cell->instIdx,
- hqP->hqE->cell->cellId,
- hqP->hqE->ue);
- anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue,
- &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),servCellIdx);
-#else
- anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue,
- &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),0);
-#endif
-#ifdef TFU_TDD
- if(anInfo)
- {
- pdcch->dci.u.format2Info.dai = RG_SCH_GET_DAI_VALUE(anInfo->dlDai);
- }
- else
- {
- pdcch->dci.u.format2Info.dai = RG_SCH_MAX_DAI_IDX;
- DU_LOG("\nERROR --> SCH : PDCCH is been scheduled without updating anInfo RNTI:%d",
- rbAllocInfo->rnti);
- }
-#endif
- }
-#endif
-
- return;
-}
-/**
- * @brief This function fills the PDCCH DCI format 2A information from dlProc.
- *
- * @details
- *
- * Function: rgSCHCmnFillHqPPdcchDciFrmt2A
- * Purpose: This function fills in the PDCCH information
- * obtained from the RgSchDlHqProcCb and RgSchDlRbAlloc
- * for dedicated service scheduling. It also
- * obtains TPC to be filled in from the power module.
- * Assign the PDCCH to HQProc.
- *
- * Invoked by: Downlink Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchDlRbAlloc* rbAllocInfo
- * @param[in] RgDlHqProc* hqP
- * @param[out] RgSchPdcch *pdcch
- * @param[in] uint8_t tpc
- * @return Void
- *
- **/
-static Void rgSCHCmnFillHqPPdcchDciFrmt2A
-(
-RgSchCellCb *cell,
-RgSchDlRbAlloc *rbAllocInfo,
-RgSchDlHqProcCb *hqP,
-RgSchPdcch *pdcch,
-uint8_t tpc
-)
-{
-#ifdef LTE_TDD
- RgSchTddANInfo *anInfo;
-#endif
-
-#ifdef LTEMAC_SPS
- RgSchCmnDlHqProc *cmnHqDl = RG_SCH_CMN_GET_DL_HQP(hqP);
-#endif
-
-
- rgSCHCmnFillHqPTb(cell, rbAllocInfo, 0, pdcch);
- /*ccpu00120365:-ADD-call also if tb is disabled */
- if (rbAllocInfo->tbInfo[1].schdlngForTb ||
- rbAllocInfo->tbInfo[1].isDisabled)
- {
-
- rgSCHCmnFillHqPTb(cell, rbAllocInfo, 1, pdcch);
- }
-
- pdcch->dci.u.format2AInfo.tpcCmd = tpc;
- /* Avoiding this check,as we dont support Type1 RA */
-#ifdef RG_UNUSED
- if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE0)
- {
-#endif
- pdcch->dci.u.format2AInfo.allocInfo.isAllocType0 = TRUE;
- pdcch->dci.u.format2AInfo.allocInfo.resAllocMap[0] =
- ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 24)
- & 0xff);
- pdcch->dci.u.format2AInfo.allocInfo.resAllocMap[1] =
- ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 16)
- & 0x00ff);
- pdcch->dci.u.format2AInfo.allocInfo.resAllocMap[2] =
- ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask >> 8)
- & 0x0000ff);
- pdcch->dci.u.format2AInfo.allocInfo.resAllocMap[3] =
- ((rbAllocInfo->allocInfo.raType0.dlAllocBitMask & 0x000000ff));
-#ifdef RG_UNUSED
- }
-#endif
-#ifdef LTEMAC_SPS
- if ((!(hqP->tbInfo[0].txCntr)) &&
- ( cmnHqDl != (RgSchCmnDlHqProc*)NULLP &&
- ((cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_ACTV) ||
- (cmnHqDl->spsAction & RG_SCH_CMN_SPS_DL_REACTV))
- ))
- {
- pdcch->dci.u.format2AInfo.allocInfo.harqProcId = 0;
- }
- else
- {
- pdcch->dci.u.format2AInfo.allocInfo.harqProcId = hqP->procId;
- }
-#else
- pdcch->dci.u.format2AInfo.allocInfo.harqProcId = hqP->procId;
-#endif
- /* Initialize the TB info for both the TBs */
- pdcch->dci.u.format2AInfo.allocInfo.tbInfo[0].mcs = 0;
- pdcch->dci.u.format2AInfo.allocInfo.tbInfo[0].rv = 1;
- pdcch->dci.u.format2AInfo.allocInfo.tbInfo[1].mcs = 0;
- pdcch->dci.u.format2AInfo.allocInfo.tbInfo[1].rv = 1;
- /* Fill tbInfo for scheduled TBs */
- pdcch->dci.u.format2AInfo.allocInfo.tbInfo[rbAllocInfo->tbInfo[0].\
- tbCb->tbIdx].ndi = rbAllocInfo->tbInfo[0].tbCb->ndi;
- pdcch->dci.u.format2AInfo.allocInfo.tbInfo[rbAllocInfo->tbInfo[0].\
- tbCb->tbIdx].mcs = rbAllocInfo->tbInfo[0].imcs;
- pdcch->dci.u.format2AInfo.allocInfo.tbInfo[rbAllocInfo->tbInfo[0].\
- tbCb->tbIdx].rv = rbAllocInfo->tbInfo[0].tbCb->dlGrnt.rv;
- /* If we reach this function. It is safely assumed that
- * rbAllocInfo->tbInfo[0] always has non default valid values.
- * rbAllocInfo->tbInfo[1]'s scheduling is optional */
-
- if (rbAllocInfo->tbInfo[1].schdlngForTb == TRUE)
- {
- pdcch->dci.u.format2AInfo.allocInfo.tbInfo[rbAllocInfo->tbInfo[1].\
- tbCb->tbIdx].ndi = rbAllocInfo->tbInfo[1].tbCb->ndi;
- pdcch->dci.u.format2AInfo.allocInfo.tbInfo[rbAllocInfo->tbInfo[1].\
- tbCb->tbIdx].mcs = rbAllocInfo->tbInfo[1].imcs;
- pdcch->dci.u.format2AInfo.allocInfo.tbInfo[rbAllocInfo->tbInfo[1].\
- tbCb->tbIdx].rv = rbAllocInfo->tbInfo[1].tbCb->dlGrnt.rv;
-
- }
- pdcch->dci.u.format2AInfo.allocInfo.transSwap =
- rbAllocInfo->mimoAllocInfo.swpFlg;
- pdcch->dci.u.format2AInfo.allocInfo.precoding =
- rbAllocInfo->mimoAllocInfo.precIdxInfo;
-#ifdef LTE_TDD
- if(hqP->hqE->ue != NULLP)
- {
-#ifdef LTE_ADV
- uint8_t servCellIdx = rgSchUtlGetServCellIdx(hqP->hqE->cell->instIdx,
- hqP->hqE->cell->cellId,
- hqP->hqE->ue);
- anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue,
- &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),servCellIdx);
-#else
- anInfo = rgSCHUtlGetUeANFdbkInfo(hqP->hqE->ue,
- &(rbAllocInfo->tbInfo[0].tbCb->fdbkTime),0);
-#endif
-#ifdef TFU_TDD
- if(anInfo)
- {
- pdcch->dci.u.format2AInfo.dai = RG_SCH_GET_DAI_VALUE(anInfo->dlDai);
- }
- else
- {
- pdcch->dci.u.format2AInfo.dai = RG_SCH_MAX_DAI_IDX;
- DU_LOG("\nERROR --> SCH : PDCCH is been scheduled without updating anInfo RNTI:%d",
- rbAllocInfo->rnti);
- }
-#endif
- }
-#endif
-
-
- return;
-}
-#endif
-/**
- * @brief init of Sch vars.
- *
- * @details
- *
- * Function: rgSCHCmnInitVars
- Purpose: Initialization of various UL subframe indices
- *
- * @param[in] RgSchCellCb *cell
- * @return Void
- *
- **/
-static Void rgSCHCmnInitVars(RgSchCellCb *cell)
-{
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
-
-
- cellUl->idx = RGSCH_INVALID_INFO;
- cellUl->schdIdx = RGSCH_INVALID_INFO;
- cellUl->schdHqProcIdx = RGSCH_INVALID_INFO;
- cellUl->msg3SchdIdx = RGSCH_INVALID_INFO;
-#ifdef EMTC_ENBLE
- cellUl->emtcMsg3SchdIdx = RGSCH_INVALID_INFO;
-#endif
- cellUl->msg3SchdHqProcIdx = RGSCH_INVALID_INFO;
- cellUl->rcpReqIdx = RGSCH_INVALID_INFO;
- cellUl->hqFdbkIdx[0] = RGSCH_INVALID_INFO;
- cellUl->hqFdbkIdx[1] = RGSCH_INVALID_INFO;
- cellUl->reTxIdx[0] = RGSCH_INVALID_INFO;
- cellUl->reTxIdx[1] = RGSCH_INVALID_INFO;
- /* Stack Crash problem for TRACE5 Changes. Added the return below */
- return;
-
-}
-
-#ifndef LTE_TDD
-/**
- * @brief Updation of Sch vars per TTI.
- *
- * @details
- *
- * Function: rgSCHCmnUpdVars
- * Purpose: Updation of Sch vars per TTI.
- *
- * @param[in] RgSchCellCb *cell
- * @return Void
- *
- **/
-Void rgSCHCmnUpdVars(RgSchCellCb *cell)
-{
- CmLteTimingInfo timeInfo;
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- uint16_t idx;
-
-
- idx = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G + cell->crntTime.slot);
- cellUl->idx = ((idx) % (RG_SCH_CMN_UL_NUM_SF));
-#ifdef UL_ADPT_DBG
- DU_LOG("\nDEBUG --> SCH : idx %d cellUl->idx %d RGSCH_NUM_SUB_FRAMES_5G %d time(%d %d) \n",idx,cellUl->idx ,RGSCH_NUM_SUB_FRAMES_5G,cell->crntTime.sfn,cell->crntTime.slot);
-#endif
- /* Need to scheduler for after SCHED_DELTA */
- /* UL allocation has been advanced by 1 subframe
- * so that we do not wrap around and send feedback
- * before the data is even received by the PHY */
- /* Introduced timing delta for UL control */
- idx = (cellUl->idx + TFU_ULCNTRL_DLDELTA + RGSCH_PDCCH_PUSCH_DELTA);
- cellUl->schdIdx = ((idx) % (RG_SCH_CMN_UL_NUM_SF));
-
- RGSCHCMNADDTOCRNTTIME(cell->crntTime,timeInfo,
- TFU_ULCNTRL_DLDELTA + RGSCH_PDCCH_PUSCH_DELTA)
- cellUl->schdHqProcIdx = rgSCHCmnGetUlHqProcIdx(&timeInfo, cell);
-
- /* ccpu00127193 filling schdTime for logging and enhancement purpose*/
- cellUl->schdTime = timeInfo;
-
- /* msg3 scheduling two subframes after general scheduling */
- idx = (cellUl->idx + RG_SCH_CMN_DL_DELTA + RGSCH_RARSP_MSG3_DELTA);
- cellUl->msg3SchdIdx = ((idx) % (RG_SCH_CMN_UL_NUM_SF));
-
- RGSCHCMNADDTOCRNTTIME(cell->crntTime,timeInfo,
- RG_SCH_CMN_DL_DELTA+ RGSCH_RARSP_MSG3_DELTA)
- cellUl->msg3SchdHqProcIdx = rgSCHCmnGetUlHqProcIdx(&timeInfo, cell);
-
- idx = (cellUl->idx + TFU_RECPREQ_DLDELTA);
-
- cellUl->rcpReqIdx = ((idx) % (RG_SCH_CMN_UL_NUM_SF));
-
- /* Downlink harq feedback is sometime after data reception / harq failure */
- /* Since feedback happens prior to scheduling being called, we add 1 to */
- /* take care of getting the correct subframe for feedback */
- idx = (cellUl->idx - TFU_CRCIND_ULDELTA + RG_SCH_CMN_UL_NUM_SF);
-#ifdef UL_ADPT_DBG
- DU_LOG("\nDEBUG --> SCH : Finally setting cellUl->hqFdbkIdx[0] = %d TFU_CRCIND_ULDELTA %d RG_SCH_CMN_UL_NUM_SF %d\n",idx,TFU_CRCIND_ULDELTA,RG_SCH_CMN_UL_NUM_SF);
-#endif
- cellUl->hqFdbkIdx[0] = (idx % (RG_SCH_CMN_UL_NUM_SF));
-
- idx = ((cellUl->schdIdx) % (RG_SCH_CMN_UL_NUM_SF));
-
- cellUl->reTxIdx[0] = (uint8_t) idx;
-#ifdef UL_ADPT_DBG
- DU_LOG("\nDEBUG --> SCH : cellUl->hqFdbkIdx[0] %d cellUl->reTxIdx[0] %d \n",cellUl->hqFdbkIdx[0], cellUl->reTxIdx[0] );
-#endif
- /* RACHO: update cmn sched specific RACH variables,
- * mainly the prachMaskIndex */
- rgSCHCmnUpdRachParam(cell);
-
- return;
-}
-#endif
-
-#ifdef LTE_TDD
-
-/**
- * @brief To get uplink subframe index associated with current PHICH
- * transmission.
- *
- * @details
- *
- * Function: rgSCHCmnGetPhichUlSfIdx
- * Purpose: Gets uplink subframe index associated with current PHICH
- * transmission based on SFN and subframe no
- *
- * @param[in] CmLteTimingInfo *timeInfo
- * @param[in] RgSchCellCb *cell
- * @return uint8_t
- *
- **/
-uint8_t rgSCHCmnGetPhichUlSfIdx(CmLteTimingInfo *timeInfo,RgSchCellCb *cell)
-{
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- RgSchDlSf *dlsf;
- uint8_t ulDlCfgIdx = cell->ulDlCfgIdx;
- uint8_t idx;
- uint16_t numUlSf;
- uint16_t sfn;
- uint8_t subframe;
-
-
- dlsf = rgSCHUtlSubFrmGet(cell, *timeInfo);
-
- if(dlsf->phichOffInfo.sfnOffset == RGSCH_INVALID_INFO)
- {
- return (RGSCH_INVALID_INFO);
- }
- subframe = dlsf->phichOffInfo.subframe;
-
- sfn = (RGSCH_MAX_SFN + timeInfo->sfn -
- dlsf->phichOffInfo.sfnOffset) % RGSCH_MAX_SFN;
-
- /* ccpu00130980: numUlSf(uint16_t) parameter added to avoid integer
- * wrap case such that idx will be proper*/
- numUlSf = rgSchTddNumUlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1];
- numUlSf = ((numUlSf * sfn) + rgSchTddNumUlSubfrmTbl[ulDlCfgIdx][subframe]) - 1;
- idx = numUlSf % (cellUl->numUlSubfrms);
-
- return (idx);
-}
-
-/**
- * @brief To get uplink subframe index.
- *
- * @details
- *
- *
- * Function: rgSCHCmnGetUlSfIdx
- * Purpose: Gets uplink subframe index based on SFN and subframe number.
- *
- * @param[in] CmLteTimingInfo *timeInfo
- * @param[in] uint8_t ulDlCfgIdx
- * @return uint8_t
- *
- **/
-uint8_t rgSCHCmnGetUlSfIdx(CmLteTimingInfo *timeInfo,RgSchCellCb *cell)
-{
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- uint8_t ulDlCfgIdx = cell->ulDlCfgIdx;
- uint8_t idx = 0;
- uint16_t numUlSf;
-
-
- /* ccpu00130980: numUlSf(uint16_t) parameter added to avoid integer
- * wrap case such that idx will be proper*/
- numUlSf = rgSchTddNumUlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1];
- numUlSf = ((numUlSf * timeInfo->sfn) + \
- rgSchTddNumUlSubfrmTbl[ulDlCfgIdx][timeInfo->subframe]) - 1;
- idx = numUlSf % (cellUl->numUlSubfrms);
-
- return (idx);
-}
-
-#endif
-
-/**
- * @brief To get uplink hq index.
- *
- * @details
- *
- *
- * Function: rgSCHCmnGetUlHqProcIdx
- * Purpose: Gets uplink subframe index based on SFN and subframe number.
- *
- * @param[in] CmLteTimingInfo *timeInfo
- * @param[in] uint8_t ulDlCfgIdx
- * @return uint8_t
- *
- **/
-uint8_t rgSCHCmnGetUlHqProcIdx(CmLteTimingInfo *timeInfo,RgSchCellCb *cell)
-{
- uint8_t procId;
- uint32_t numUlSf;
-
-#ifndef LTE_TDD
- numUlSf = (timeInfo->sfn * RGSCH_NUM_SUB_FRAMES_5G + timeInfo->slot);
- procId = numUlSf % RGSCH_NUM_UL_HQ_PROC;
-#else
- uint8_t ulDlCfgIdx = cell->ulDlCfgIdx;
- /*ccpu00130639 - MOD - To get correct UL HARQ Proc IDs for all UL/DL Configs*/
- uint8_t numUlSfInSfn;
- S8 sfnCycle = cell->tddHqSfnCycle;
- uint8_t numUlHarq = rgSchTddUlNumHarqProcTbl[ulDlCfgIdx]
-
- /* TRACE 5 Changes */
-
- /* Calculate the number of UL SF in one SFN */
- numUlSfInSfn = RGSCH_NUM_SUB_FRAMES -
- rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1];
-
- /* Check for the SFN wrap around case */
- if(cell->crntTime.sfn == 1023 && timeInfo->sfn == 0)
- {
- sfnCycle++;
- }
- else if(cell->crntTime.sfn == 0 && timeInfo->sfn == 1023)
- {
- /* sfnCycle decremented by 1 */
- sfnCycle = (sfnCycle + numUlHarq-1) % numUlHarq;
- }
- /* Calculate the total number of UL sf */
- /* -1 is done since uplink sf are counted from 0 */
- numUlSf = numUlSfInSfn * (timeInfo->sfn + (sfnCycle*1024)) +
- rgSchTddNumUlSubfrmTbl[ulDlCfgIdx][timeInfo->slot] - 1;
-
- procId = numUlSf % numUlHarq;
-#endif
- return (procId);
-}
-
-
-/* UL_ALLOC_CHANGES */
-/***********************************************************
- *
- * Func : rgSCHCmnUlFreeAlloc
- *
- * Desc : Free an allocation - invokes UHM and releases
- * alloc for the scheduler
- * Doest need subframe as argument
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHCmnUlFreeAlloc(RgSchCellCb *cell,RgSchUlAlloc *alloc)
-{
- RgSchUlHqProcCb *hqProc;
-
- if (alloc->forMsg3)
- {
- /* Fix : Release RNTI upon MSG3 max TX failure for non-HO UEs */
- if ((alloc->hqProc->remTx == 0) &&
- (alloc->hqProc->rcvdCrcInd == FALSE) &&
- (alloc->raCb))
- {
- RgSchRaCb *raCb = alloc->raCb;
- rgSCHUhmFreeProc(alloc->hqProc, cell);
- rgSCHUtlUlAllocRelease(alloc);
- rgSCHRamDelRaCb(cell, raCb, TRUE);
- return;
- }
- }
-
- hqProc = alloc->hqProc;
- rgSCHUtlUlAllocRelease(alloc);
- rgSCHUhmFreeProc(hqProc, cell);
- return;
-}
-
-
-/***********************************************************
- *
- * Func : rgSCHCmnUlFreeAllocation
- *
- * Desc : Free an allocation - invokes UHM and releases
- * alloc for the scheduler
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHCmnUlFreeAllocation(RgSchCellCb *cell,RgSchUlSf *sf,RgSchUlAlloc *alloc)
-{
- RgSchUlHqProcCb *hqProc;
-
-
- if (alloc->forMsg3)
- {
- /* Fix : Release RNTI upon MSG3 max TX failure for non-HO UEs */
- if ((alloc->hqProc->remTx == 0) &&
- (alloc->hqProc->rcvdCrcInd == FALSE) &&
- (alloc->raCb))
- {
- RgSchRaCb *raCb = alloc->raCb;
- rgSCHUhmFreeProc(alloc->hqProc, cell);
- rgSCHUtlUlAllocRls(sf, alloc);
- rgSCHRamDelRaCb(cell, raCb, TRUE);
- return;
- }
- }
-
- hqProc = alloc->hqProc;
- rgSCHUhmFreeProc(hqProc, cell);
-#ifdef LTE_L2_MEAS
- /* re-setting the PRB count while freeing the allocations */
- sf->totPrb = 0;
-#endif
- rgSCHUtlUlAllocRls(sf, alloc);
-
- return;
-}
-
-/**
- * @brief This function implements PDCCH allocation for an UE
- * in the currently running subframe.
- *
- * @details
- *
- * Function: rgSCHCmnPdcchAllocCrntSf
- * Purpose: This function determines current DL subframe
- * and UE DL CQI to call the actual pdcch allocator
- * function.
- * Note that this function is called only
- * when PDCCH request needs to be made during
- * uplink scheduling.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return RgSchPdcch *
- * -# NULLP when unsuccessful
- **/
-RgSchPdcch *rgSCHCmnPdcchAllocCrntSf(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- CmLteTimingInfo frm = cell->crntTime;
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- RgSchDlSf *sf;
- RgSchPdcch *pdcch = NULLP;
-
- RGSCH_INCR_SUB_FRAME(frm, TFU_ULCNTRL_DLDELTA);
- sf = rgSCHUtlSubFrmGet(cell, frm);
-
-#ifdef LTE_ADV
- if (ue->allocCmnUlPdcch)
- {
- pdcch = rgSCHCmnCmnPdcchAlloc(cell, sf);
- /* Since CRNTI Scrambled */
- if(NULLP != pdcch)
- {
- pdcch->dciNumOfBits = ue->dciSize.cmnSize[TFU_DCI_FORMAT_0];
- }
- }
- else
-#endif
- {
- //pdcch = rgSCHCmnPdcchAlloc(cell, ue, sf, y, ueDl->mimoInfo.cwInfo[0].cqi, TFU_DCI_FORMAT_0, FALSE);
- pdcch = rgSCHCmnPdcchAlloc(cell, ue, sf, ueDl->mimoInfo.cwInfo[0].cqi, TFU_DCI_FORMAT_A1, FALSE);
- }
- return (pdcch);
-}
-
-/***********************************************************
- *
- * Func : rgSCHCmnUlAllocFillNdmrs
- *
- * Desc : Determines and fills N_dmrs for a UE uplink
- * allocation.
- *
- * Ret :
- *
- * Notes: N_dmrs determination is straightforward, so
- * it is configured per subband
- *
- * File :
- *
- **********************************************************/
-Void rgSCHCmnUlAllocFillNdmrs(RgSchCmnUlCell *cellUl,RgSchUlAlloc *alloc)
-{
- alloc->grnt.nDmrs = cellUl->dmrsArr[alloc->sbStart];
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHCmnUlAllocLnkHqProc
- *
- * Desc : Links a new allocation for an UE with the
- * appropriate HARQ process of the UE.
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHCmnUlAllocLnkHqProc(RgSchUeCb *ue,RgSchUlAlloc *alloc,RgSchUlHqProcCb *proc,Bool isRetx)
-{
-
- if(TRUE == isRetx)
- {
- rgSCHCmnUlAdapRetx(alloc, proc);
- }
- else
- {
-#ifdef LTE_L2_MEAS /* L2_COUNTERS */
- alloc->ue = ue;
-#endif
- rgSCHUhmNewTx(proc, (((RgUeUlHqCb*)proc->hqEnt)->maxHqRetx), alloc);
- }
- return;
-}
-
-/**
- * @brief This function releases a PDCCH in the subframe that is
- * currently being allocated for.
- *
- * @details
- *
- * Function: rgSCHCmnPdcchRlsCrntSf
- * Purpose: This function determines current DL subframe
- * which is considered for PDCCH allocation,
- * and then calls the actual function that
- * releases a PDCCH in a specific subframe.
- * Note that this function is called only
- * when PDCCH release needs to be made during
- * uplink scheduling.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchPdcch *pdcch
- * @return Void
- **/
-Void rgSCHCmnPdcchRlsCrntSf(RgSchCellCb *cell,RgSchPdcch *pdcch)
-{
- CmLteTimingInfo frm = cell->crntTime;
- RgSchDlSf *sf;
-
- RGSCH_INCR_SUB_FRAME(frm, TFU_ULCNTRL_DLDELTA);
- sf = rgSCHUtlSubFrmGet(cell, frm);
- rgSCHUtlPdcchPut(cell, &sf->pdcchInfo, pdcch);
- return;
-}
-/***********************************************************
- *
- * Func : rgSCHCmnUlFillPdcchWithAlloc
- *
- * Desc : Fills a PDCCH with format 0 information.
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHCmnUlFillPdcchWithAlloc(RgSchPdcch *pdcch,RgSchUlAlloc *alloc,RgSchUeCb *ue)
-{
-
- pdcch->ue = ue;
- pdcch->rnti = alloc->rnti;
- //pdcch->dci.dciFormat = TFU_DCI_FORMAT_A2;
- pdcch->dci.dciFormat = alloc->grnt.dciFrmt;
-
- //Currently hardcoding values here.
- //DU_LOG("\nINFO --> SCH : Filling 5GTF UL DCI for rnti %d \n",alloc->rnti);
- switch(pdcch->dci.dciFormat)
- {
- case TFU_DCI_FORMAT_A1:
- {
- pdcch->dci.u.formatA1Info.formatType = 0;
- pdcch->dci.u.formatA1Info.xPUSCHRange = alloc->grnt.xPUSCHRange;
- pdcch->dci.u.formatA1Info.xPUSCH_TxTiming = 0;
- pdcch->dci.u.formatA1Info.RBAssign = alloc->grnt.rbAssign;
- pdcch->dci.u.formatA1Info.u.rbAssignA1Val324.hqProcId = alloc->grnt.hqProcId;
- pdcch->dci.u.formatA1Info.u.rbAssignA1Val324.mcs = alloc->grnt.iMcsCrnt;
- pdcch->dci.u.formatA1Info.u.rbAssignA1Val324.ndi = alloc->hqProc->ndi;
- pdcch->dci.u.formatA1Info.CSI_BSI_BRI_Req = 0;
- pdcch->dci.u.formatA1Info.CSIRS_BRRS_TxTiming = 0;
- pdcch->dci.u.formatA1Info.CSIRS_BRRS_SymbIdx = 0;
- pdcch->dci.u.formatA1Info.CSIRS_BRRS_ProcInd = 0;
- pdcch->dci.u.formatA1Info.numBSI_Reports = 0;
- pdcch->dci.u.formatA1Info.uciOnxPUSCH = alloc->grnt.uciOnxPUSCH;
- pdcch->dci.u.formatA1Info.beamSwitch = 0;
- pdcch->dci.u.formatA1Info.SRS_Config = 0;
- pdcch->dci.u.formatA1Info.SRS_Symbol = 0;
- pdcch->dci.u.formatA1Info.REMapIdx_DMRS_PCRS_numLayers = 0;
- pdcch->dci.u.formatA1Info.SCID = alloc->grnt.SCID;
- pdcch->dci.u.formatA1Info.PMI = alloc->grnt.PMI;
- pdcch->dci.u.formatA1Info.UL_PCRS = 0;
- pdcch->dci.u.formatA1Info.tpcCmd = alloc->grnt.tpc;
- break;
- }
- case TFU_DCI_FORMAT_A2:
- {
- pdcch->dci.u.formatA2Info.formatType = 1;
- pdcch->dci.u.formatA2Info.xPUSCHRange = alloc->grnt.xPUSCHRange;
- pdcch->dci.u.formatA2Info.xPUSCH_TxTiming = 0;
- pdcch->dci.u.formatA2Info.RBAssign = alloc->grnt.rbAssign;
- pdcch->dci.u.formatA2Info.u.rbAssignA1Val324.hqProcId = alloc->grnt.hqProcId;
- pdcch->dci.u.formatA2Info.u.rbAssignA1Val324.mcs = alloc->grnt.iMcsCrnt;
- pdcch->dci.u.formatA2Info.u.rbAssignA1Val324.ndi = alloc->hqProc->ndi;
- pdcch->dci.u.formatA2Info.CSI_BSI_BRI_Req = 0;
- pdcch->dci.u.formatA2Info.CSIRS_BRRS_TxTiming = 0;
- pdcch->dci.u.formatA2Info.CSIRS_BRRS_SymbIdx = 0;
- pdcch->dci.u.formatA2Info.CSIRS_BRRS_ProcInd = 0;
- pdcch->dci.u.formatA2Info.numBSI_Reports = 0;
- pdcch->dci.u.formatA2Info.uciOnxPUSCH = alloc->grnt.uciOnxPUSCH;
- pdcch->dci.u.formatA2Info.beamSwitch = 0;
- pdcch->dci.u.formatA2Info.SRS_Config = 0;
- pdcch->dci.u.formatA2Info.SRS_Symbol = 0;
- pdcch->dci.u.formatA2Info.REMapIdx_DMRS_PCRS_numLayers = 0;
- pdcch->dci.u.formatA2Info.SCID = alloc->grnt.SCID;
- pdcch->dci.u.formatA2Info.PMI = alloc->grnt.PMI;
- pdcch->dci.u.formatA2Info.UL_PCRS = 0;
- pdcch->dci.u.formatA2Info.tpcCmd = alloc->grnt.tpc;
- break;
- }
- default:
- DU_LOG("\nERROR --> SCH : 5GTF_ERROR UL Allocator's icorrect "
- "dciForamt Fill RNTI:%d",alloc->rnti);
- break;
- }
-
-
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHCmnUlAllocFillTpc
- *
- * Desc : Determines and fills TPC for an UE allocation.
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHCmnUlAllocFillTpc(RgSchCellCb *cell,RgSchUeCb *ue,RgSchUlAlloc *alloc)
-{
- alloc->grnt.tpc = rgSCHPwrPuschTpcForUe(cell, ue);
- return;
-}
-
-
-/***********************************************************
- *
- * Func : rgSCHCmnAddUeToRefreshQ
- *
- * Desc : Adds a UE to refresh queue, so that the UE is
- * periodically triggered to refresh it's GBR and
- * AMBR values.
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHCmnAddUeToRefreshQ(RgSchCellCb *cell,RgSchUeCb *ue,uint32_t wait)
-{
- RgSchCmnCell *sched = RG_SCH_CMN_GET_CELL(cell);
- CmTmrArg arg;
- RgSchCmnUeInfo *ueSchd = RG_SCH_CMN_GET_CMN_UE(ue);
-
- UNUSED(cell);
-
- memset(&arg, 0, sizeof(arg));
- arg.tqCp = &sched->tmrTqCp;
- arg.tq = sched->tmrTq;
- arg.timers = &ueSchd->tmr;
- arg.cb = (PTR)ue;
- arg.tNum = 0;
- arg.max = 1;
- arg.evnt = RG_SCH_CMN_EVNT_UE_REFRESH;
- arg.wait = wait;
- cmPlcCbTq(&arg);
- return;
-}
-
-/**
- * @brief Perform UE reset procedure.
- *
- * @details
- *
- * Function : rgSCHCmnUlUeReset
- *
- * This functions performs BSR resetting and
- * triggers UL specific scheduler
- * to Perform UE reset procedure.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-static Void rgSCHCmnUlUeReset(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell);
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell);
- uint8_t lcgCnt=0;
- RgSchCmnLcg *lcgCmn;
- CmLList *node;
- RgSchCmnAllocRecord *allRcd;
-
- ue->ul.minReqBytes = 0;
- ue->ul.totalBsr = 0;
- ue->ul.effBsr = 0;
- ue->ul.nonGbrLcgBs = 0;
- ue->ul.effAmbr = ue->ul.cfgdAmbr;
-
- node = ueUl->ulAllocLst.first;
- while (node)
- {
- allRcd = (RgSchCmnAllocRecord *)node->node;
- allRcd->alloc = 0;
- node = node->next;
- }
- for(lcgCnt = 0; lcgCnt < RGSCH_MAX_LCG_PER_UE; lcgCnt++)
- {
- lcgCmn = RG_SCH_CMN_GET_UL_LCG(&ue->ul.lcgArr[lcgCnt]);
- lcgCmn->bs = 0;
- lcgCmn->reportedBs = 0;
- lcgCmn->effGbr = lcgCmn->cfgdGbr;
- lcgCmn->effDeltaMbr = lcgCmn->deltaMbr;
- }
- rgSCHCmnUlUeDelAllocs(cell, ue);
-
- ue->isSrGrant = FALSE;
-
- cellSchd->apisUl->rgSCHUlUeReset(cell, ue);
-
- /* Stack Crash problem for TRACE5 changes. Added the return below */
- return;
-
-}
-
-/**
- * @brief RESET UL CQI and DL CQI&RI to conservative values
- * for a reestablishing UE.
- *
- * @details
- *
- * Function : rgSCHCmnResetRiCqi
- *
- * RESET UL CQI and DL CQI&RI to conservative values
- * for a reestablishing UE
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-static Void rgSCHCmnResetRiCqi(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell);
- RgSchCmnUe *ueSchCmn = RG_SCH_CMN_GET_UE(ue,cell);
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell);
-
-
- rgSCHCmnUpdUeUlCqiInfo(cell, ue, ueUl, ueSchCmn, cellSchd,
- cell->isCpUlExtend);
-
- ueDl->mimoInfo.cwInfo[0].cqi = cellSchd->dl.ccchCqi;
- ueDl->mimoInfo.cwInfo[1].cqi = cellSchd->dl.ccchCqi;
- ueDl->mimoInfo.ri = 1;
- if ((ue->mimoInfo.txMode == RGR_UE_TM_4) ||
- (ue->mimoInfo.txMode == RGR_UE_TM_6))
- {
- RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_NO_PMI);
- }
- if (ue->mimoInfo.txMode == RGR_UE_TM_3)
- {
- RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_RI_1);
- }
-#ifdef EMTC_ENABLE
- rgSCHCmnDlSetUeAllocLmt(cell, ueDl, ue->isEmtcUe);
-#else
- rgSCHCmnDlSetUeAllocLmt(cell, ueDl, FALSE);
-#endif
-
-#ifdef TFU_UPGRADE
- /* Request for an early Aper CQI in case of reest */
- RgSchUeACqiCb *acqiCb = RG_SCH_CMN_GET_ACQICB(ue,cell);
- if(acqiCb && acqiCb->aCqiCfg.pres)
- {
- acqiCb->aCqiTrigWt = 0;
- }
-#endif
-
- return;
-}
-
-/**
- * @brief Perform UE reset procedure.
- *
- * @details
- *
- * Function : rgSCHCmnDlUeReset
- *
- * This functions performs BO resetting and
- * triggers DL specific scheduler
- * to Perform UE reset procedure.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-static Void rgSCHCmnDlUeReset(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell);
- RgSchCmnDlCell *cellCmnDl = RG_SCH_CMN_GET_DL_CELL(cell);
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
-
-
- if (ueDl->rachInfo.poLnk.node != NULLP)
- {
- rgSCHCmnDlRmvFrmPdcchOdrQ(cell, ue);
- }
-
- /* Fix: syed Remove from TA List if this UE is there.
- * If TA Timer is running. Stop it */
- if (ue->dlTaLnk.node)
- {
- cmLListDelFrm(&cellCmnDl->taLst, &ue->dlTaLnk);
- ue->dlTaLnk.node = (PTR)NULLP;
- }
- else if (ue->taTmr.tmrEvnt != TMR_NONE)
- {
- rgSCHTmrStopTmr(cell, ue->taTmr.tmrEvnt, ue);
- }
-
- cellSchd->apisDl->rgSCHDlUeReset(cell, ue);
-#ifdef LTE_ADV
- if (ue->numSCells)
- {
- rgSCHSCellDlUeReset(cell,ue);
- }
-#endif
-}
-
-/**
- * @brief Perform UE reset procedure.
- *
- * @details
- *
- * Function : rgSCHCmnUeReset
- *
- * This functions triggers specific scheduler
- * to Perform UE reset procedure.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-Void rgSCHCmnUeReset(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- uint8_t idx;
- Pst pst;
- RgInfResetHqEnt hqEntRstInfo;
-
- /* RACHO: remove UE from pdcch, handover and rapId assoc Qs */
- rgSCHCmnDelRachInfo(cell, ue);
-
- rgSCHPwrUeReset(cell, ue);
-
- rgSCHCmnUlUeReset(cell, ue);
- rgSCHCmnDlUeReset(cell, ue);
-
-#ifdef LTE_ADV
- /* Making allocCmnUlPdcch TRUE to allocate DCI0/1A from Common search space.
- As because multiple cells are added hence 2 bits CqiReq is there
- This flag will be set to FALSE once we will get Scell READY */
- ue->allocCmnUlPdcch = TRUE;
-#endif
-
- /* Fix : syed RESET UL CQI and DL CQI&RI to conservative values
- * for a reestablishing UE */
- /*Reset Cqi Config for all the configured cells*/
- for (idx = 0;idx < CM_LTE_MAX_CELLS; idx++)
- {
- if (ue->cellInfo[idx] != NULLP)
- {
- rgSCHCmnResetRiCqi(ue->cellInfo[idx]->cell, ue);
- }
- }
- /*After Reset Trigger APCQI for Pcell*/
- RgSchUeCellInfo *pCellInfo = RG_SCH_CMN_GET_PCELL_INFO(ue);
- if(pCellInfo->acqiCb.aCqiCfg.pres)
- {
- ue->dl.reqForCqi = RG_SCH_APCQI_SERVING_CC;
- }
-
-/* sending HqEnt reset to MAC */
- hqEntRstInfo.cellId = cell->cellId;
- hqEntRstInfo.crnti = ue->ueId;
-
- rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], cell->macInst);
- RgSchMacRstHqEnt(&pst,&hqEntRstInfo);
-
- return;
-}
-
-/**
- * @brief UE out of MeasGap or AckNackReptn.
- *
- * @details
- *
- * Function : rgSCHCmnActvtUlUe
- *
- * This functions triggers specific scheduler
- * to start considering it for scheduling.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-Void rgSCHCmnActvtUlUe(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell);
-
- /* : take care of this in UL retransmission */
- cellSchd->apisUl->rgSCHUlActvtUe(cell, ue);
- return;
-}
-
-/**
- * @brief UE out of MeasGap or AckNackReptn.
- *
- * @details
- *
- * Function : rgSCHCmnActvtDlUe
- *
- * This functions triggers specific scheduler
- * to start considering it for scheduling.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-Void rgSCHCmnActvtDlUe(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell);
-
- cellSchd->apisDl->rgSCHDlActvtUe(cell, ue);
- return;
-}
-
-/**
- * @brief This API is invoked to indicate scheduler of a CRC indication.
- *
- * @details
- *
- * Function : rgSCHCmnHdlUlTransInd
- * This API is invoked to indicate scheduler of a CRC indication.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] CmLteTimingInfo timingInfo
- *
- * @return Void
- **/
-Void rgSCHCmnHdlUlTransInd(RgSchCellCb *cell,RgSchUeCb *ue,CmLteTimingInfo timingInfo)
-{
-
- /* Update the latest UL dat/sig transmission time */
- RGSCHCPYTIMEINFO(timingInfo, ue->ul.ulTransTime);
- if (RG_SCH_CMN_IS_UE_PDCCHODR_INACTV(ue))
- {
- /* Some UL Transmission from this UE.
- * Activate this UE if it was inactive */
- RG_SCH_CMN_DL_UPDT_INACTV_MASK ( cell, ue, RG_PDCCHODR_INACTIVE);
- RG_SCH_CMN_UL_UPDT_INACTV_MASK ( cell, ue, RG_PDCCHODR_INACTIVE);
- }
- return;
-}
-
-#ifdef TFU_UPGRADE
-
-/**
- * @brief Compute the minimum Rank based on Codebook subset
- * restriction configuration for 4 Tx Ports and Tx Mode 4.
- *
- * @details
- *
- * Function : rgSCHCmnComp4TxMode4
- *
- * Depending on BitMap set at CBSR during Configuration
- * - return the least possible Rank
- *
- *
- * @param[in] uint32_t *pmiBitMap
- * @return RgSchCmnRank
- **/
-static RgSchCmnRank rgSCHCmnComp4TxMode4(uint32_t *pmiBitMap)
-{
- uint32_t bitMap0, bitMap1;
- bitMap0 = pmiBitMap[0];
- bitMap1 = pmiBitMap[1];
- if((bitMap1) & 0xFFFF)
- {
- return (RG_SCH_CMN_RANK_1);
- }
- else if((bitMap1>>16) & 0xFFFF)
- {
- return (RG_SCH_CMN_RANK_2);
- }
- else if((bitMap0) & 0xFFFF)
- {
- return (RG_SCH_CMN_RANK_3);
- }
- else if((bitMap0>>16) & 0xFFFF)
- {
- return (RG_SCH_CMN_RANK_4);
- }
- else
- {
- return (RG_SCH_CMN_RANK_1);
- }
-}
-
-
-/**
- * @brief Compute the minimum Rank based on Codebook subset
- * restriction configuration for 2 Tx Ports and Tx Mode 4.
- *
- * @details
- *
- * Function : rgSCHCmnComp2TxMode4
- *
- * Depending on BitMap set at CBSR during Configuration
- * - return the least possible Rank
- *
- *
- * @param[in] uint32_t *pmiBitMap
- * @return RgSchCmnRank
- **/
-static RgSchCmnRank rgSCHCmnComp2TxMode4(uint32_t *pmiBitMap)
-{
- uint32_t bitMap0;
- bitMap0 = pmiBitMap[0];
- if((bitMap0>>26)& 0x0F)
- {
- return (RG_SCH_CMN_RANK_1);
- }
- else if((bitMap0>>30) & 3)
- {
- return (RG_SCH_CMN_RANK_2);
- }
- else
- {
- return (RG_SCH_CMN_RANK_1);
- }
-}
-
-/**
- * @brief Compute the minimum Rank based on Codebook subset
- * restriction configuration for 4 Tx Ports and Tx Mode 3.
- *
- * @details
- *
- * Function : rgSCHCmnComp4TxMode3
- *
- * Depending on BitMap set at CBSR during Configuration
- * - return the least possible Rank
- *
- *
- * @param[in] uint32_t *pmiBitMap
- * @return RgSchCmnRank
- **/
-static RgSchCmnRank rgSCHCmnComp4TxMode3(uint32_t *pmiBitMap)
-{
- uint32_t bitMap0;
- bitMap0 = pmiBitMap[0];
- if((bitMap0>>28)& 1)
- {
- return (RG_SCH_CMN_RANK_1);
- }
- else if((bitMap0>>29) &1)
- {
- return (RG_SCH_CMN_RANK_2);
- }
- else if((bitMap0>>30) &1)
- {
- return (RG_SCH_CMN_RANK_3);
- }
- else if((bitMap0>>31) &1)
- {
- return (RG_SCH_CMN_RANK_4);
- }
- else
- {
- return (RG_SCH_CMN_RANK_1);
- }
-}
-
-/**
- * @brief Compute the minimum Rank based on Codebook subset
- * restriction configuration for 2 Tx Ports and Tx Mode 3.
- *
- * @details
- *
- * Function : rgSCHCmnComp2TxMode3
- *
- * Depending on BitMap set at CBSR during Configuration
- * - return the least possible Rank
- *
- *
- * @param[in] uint32_t *pmiBitMap
- * @return RgSchCmnRank
- **/
-static RgSchCmnRank rgSCHCmnComp2TxMode3(uint32_t *pmiBitMap)
-{
- uint32_t bitMap0;
- bitMap0 = pmiBitMap[0];
- if((bitMap0>>30)& 1)
- {
- return (RG_SCH_CMN_RANK_1);
- }
- else if((bitMap0>>31) &1)
- {
- return (RG_SCH_CMN_RANK_2);
- }
- else
- {
- return (RG_SCH_CMN_RANK_1);
- }
-}
-
-/**
- * @brief Compute the minimum Rank based on Codebook subset
- * restriction configuration.
- *
- * @details
- *
- * Function : rgSCHCmnComputeRank
- *
- * Depending on Num Tx Ports and Transmission mode
- * - return the least possible Rank
- *
- *
- * @param[in] RgrTxMode txMode
- * @param[in] uint32_t *pmiBitMap
- * @param[in] uint8_t numTxPorts
- * @return RgSchCmnRank
- **/
-static RgSchCmnRank rgSCHCmnComputeRank(RgrTxMode txMode,uint32_t *pmiBitMap,uint8_t numTxPorts)
-{
-
- if (numTxPorts ==2 && txMode == RGR_UE_TM_3)
- {
- return (rgSCHCmnComp2TxMode3(pmiBitMap));
- }
- else if (numTxPorts ==4 && txMode == RGR_UE_TM_3)
- {
- return (rgSCHCmnComp4TxMode3(pmiBitMap));
- }
- else if (numTxPorts ==2 && txMode == RGR_UE_TM_4)
- {
- return (rgSCHCmnComp2TxMode4(pmiBitMap));
- }
- else if (numTxPorts ==4 && txMode == RGR_UE_TM_4)
- {
- return (rgSCHCmnComp4TxMode4(pmiBitMap));
- }
- else
- {
- return (RG_SCH_CMN_RANK_1);
- }
-}
-
-#endif
-
-/**
- * @brief Harq Entity Deinitialization for CMN SCH.
- *
- * @details
- *
- * Function : rgSCHCmnDlDeInitHqEnt
- *
- * Harq Entity Deinitialization for CMN SCH
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlHqEnt *hqE
- * @return VOID
- **/
-/*KWORK_FIX:Changed function return type to void */
-Void rgSCHCmnDlDeInitHqEnt(RgSchCellCb *cell,RgSchDlHqEnt *hqE)
-{
- RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell);
- RgSchDlHqProcCb *hqP;
- uint8_t cnt;
- S16 ret;
-
- ret = cellSchd->apisDl->rgSCHDlUeHqEntDeInit(cell, hqE);
- /* Free only If the Harq proc are created*/
- if(RFAILED == ret)
- {
- }
-
- for(cnt = 0; cnt < hqE->numHqPrcs; cnt++)
- {
- hqP = &hqE->procs[cnt];
- if ((RG_SCH_CMN_GET_DL_HQP(hqP)))
- {
- rgSCHUtlFreeSBuf(cell->instIdx,
- (Data**)(&(hqP->sch)), (sizeof(RgSchCmnDlHqProc)));
- }
- }
-#ifdef LTE_ADV
- rgSCHLaaDeInitDlHqProcCb (cell, hqE);
-#endif
-
- return;
-}
-
-/**
- * @brief Harq Entity initialization for CMN SCH.
- *
- * @details
- *
- * Function : rgSCHCmnDlInitHqEnt
- *
- * Harq Entity initialization for CMN SCH
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCmnDlInitHqEnt(RgSchCellCb *cell,RgSchDlHqEnt *hqEnt)
-{
- RgSchDlHqProcCb *hqP;
- uint8_t cnt;
- RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell);
-
- for(cnt = 0; cnt < hqEnt->numHqPrcs; cnt++)
- {
- hqP = &hqEnt->procs[cnt];
- if (rgSCHUtlAllocSBuf(cell->instIdx,
- (Data**)&(hqP->sch), (sizeof(RgSchCmnDlHqProc))) != ROK)
- {
- return RFAILED;
- }
- }
-#ifdef EMTC_ENABLE
- if((cell->emtcEnable) &&(hqEnt->ue->isEmtcUe))
- {
- if(ROK != cellSchd->apisEmtcDl->rgSCHDlUeHqEntInit(cell, hqEnt))
- {
- return RFAILED;
- }
-
- }
- else
-#endif
- {
- if(ROK != cellSchd->apisDl->rgSCHDlUeHqEntInit(cell, hqEnt))
- {
- return RFAILED;
- }
- }
-
- return ROK;
-} /* rgSCHCmnDlInitHqEnt */
-
-/**
- * @brief This function computes distribution of refresh period
- *
- * @details
- *
- * Function: rgSCHCmnGetRefreshDist
- * Purpose: This function computes distribution of refresh period
- * This is required to align set of UEs refresh
- * around the different consecutive subframe.
- *
- * Invoked by: rgSCHCmnGetRefreshPerDist
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- *
- **/
-static uint8_t rgSCHCmnGetRefreshDist(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- uint8_t refOffst;
-
- for(refOffst = 0; refOffst < RGSCH_MAX_REFRESH_OFFSET; refOffst++)
- {
- if(cell->refreshUeCnt[refOffst] < RGSCH_MAX_REFRESH_GRPSZ)
- {
- cell->refreshUeCnt[refOffst]++;
- ue->refreshOffset = refOffst;
- /* DU_LOG("\nINFO --> SCH : UE[%d] refresh offset[%d]. Cell refresh ue count[%d].\n", ue->ueId, refOffst, cell->refreshUeCnt[refOffst]); */
- return (refOffst);
- }
- }
-
- DU_LOG("\nERROR --> SCH : Allocation of refresh distribution failed\n");
- /* We should not enter here normally, but incase of failure, allocating from last offset*/
- cell->refreshUeCnt[refOffst-1]++;
- ue->refreshOffset = refOffst-1;
-
- return (refOffst-1);
-}
-/**
- * @brief This function computes initial Refresh Wait Period.
- *
- * @details
- *
- * Function: rgSCHCmnGetRefreshPer
- * Purpose: This function computes initial Refresh Wait Period.
- * This is required to align multiple UEs refresh
- * around the same time.
- *
- * Invoked by: rgSCHCmnGetRefreshPer
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t *waitPer
- * @return Void
- *
- **/
-static Void rgSCHCmnGetRefreshPer(RgSchCellCb *cell,RgSchUeCb *ue,uint32_t *waitPer)
-{
- uint32_t refreshPer;
- uint32_t crntSubFrm;
-
-
- refreshPer = RG_SCH_CMN_REFRESH_TIME * RG_SCH_CMN_REFRESH_TIMERES;
- crntSubFrm = cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G + cell->crntTime.slot;
- /* Fix: syed align multiple UEs to refresh at same time */
- *waitPer = refreshPer - (crntSubFrm % refreshPer);
- *waitPer = RGSCH_CEIL(*waitPer, RG_SCH_CMN_REFRESH_TIMERES);
- *waitPer = *waitPer + rgSCHCmnGetRefreshDist(cell, ue);
-
- return;
-}
-
-
-#ifdef LTE_ADV
-/**
- * @brief UE initialisation for scheduler.
- *
- * @details
- *
- * Function : rgSCHCmnRgrSCellUeCfg
- *
- * This functions intialises UE specific scheduler
- * information for SCELL
- * 0. Perform basic validations
- * 1. Allocate common sched UE cntrl blk
- * 2. Perform DL cfg (allocate Hq Procs Cmn sched cntrl blks)
- * 3. Perform UL cfg
- * 4. Perform DLFS cfg
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCmnRgrSCellUeCfg(RgSchCellCb *sCell,RgSchUeCb *ue,RgrUeSecCellCfg *sCellInfoCfg,RgSchErrInfo *err)
-{
- uint8_t i;
- S16 ret;
- uint8_t cnt;
- RgSchCmnAllocRecord *allRcd;
- RgSchDlRbAlloc *allocInfo;
- RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(ue->cell);
- RgSchCmnUlUe *ueUl;
- RgSchCmnUlUe *ueUlPcell;
- RgSchCmnUe *pCellUeSchCmn;
- RgSchCmnUe *ueSchCmn;
- RgSchCmnDlUe *ueDl;
- RgSchCmnDlUe *pCellUeDl;
-#ifdef DEBUGP
- Inst inst = ue->cell->instIdx;
-#endif
- uint32_t idx = (uint8_t)((sCell->cellId - rgSchCb[sCell->instIdx].genCfg.startCellId)&(CM_LTE_MAX_CELLS-1));
-
- pCellUeSchCmn = RG_SCH_CMN_GET_UE(ue,ue->cell);
- pCellUeDl = &pCellUeSchCmn->dl;
-
- /* 1. Allocate Common sched control block */
- if((rgSCHUtlAllocSBuf(sCell->instIdx,
- (Data**)&(((ue->cellInfo[ue->cellIdToCellIdxMap[idx]])->sch)), (sizeof(RgSchCmnUe))) != ROK))
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED\n");
- err->errCause = RGSCHERR_SCH_CFG;
- return RFAILED;
- }
- ueSchCmn = RG_SCH_CMN_GET_UE(ue,sCell);
-
- /*2. Perform UEs downlink configuration */
- ueDl = &ueSchCmn->dl;
-
- /*CA TODO*/
- ueDl->mimoInfo = pCellUeDl->mimoInfo;
-
- if ((ue->mimoInfo.txMode == RGR_UE_TM_4) ||
- (ue->mimoInfo.txMode == RGR_UE_TM_6))
- {
- RG_SCH_CMN_SET_FORCE_TD(ue, sCell, RG_SCH_CMN_TD_NO_PMI);
- }
- if (ue->mimoInfo.txMode == RGR_UE_TM_3)
- {
- RG_SCH_CMN_SET_FORCE_TD(ue, sCell, RG_SCH_CMN_TD_RI_1);
- }
- RGSCH_ARRAY_BOUND_CHECK(sCell->instIdx, rgUeCatTbl, pCellUeSchCmn->cmn.ueCat);
- ueDl->maxTbBits = rgUeCatTbl[pCellUeSchCmn->cmn.ueCat].maxDlTbBits;
- /*CA dev-Start*/
- uint8_t ri = 0;
- ri = RGSCH_MIN(ri, sCell->numTxAntPorts);
- if(((CM_LTE_UE_CAT_6 == pCellUeSchCmn->cmn.ueCat )
- ||(CM_LTE_UE_CAT_7 == pCellUeSchCmn->cmn.ueCat))
- && (4 == ri))
- {
- ueDl->maxTbSz = rgUeCatTbl[pCellUeSchCmn->cmn.ueCat].maxDlBits[1];
- }
- else
- {
- ueDl->maxTbSz = rgUeCatTbl[pCellUeSchCmn->cmn.ueCat].maxDlBits[0];
- }
- /*CA dev-End*/
- /* Fix : syed Assign hqEnt to UE only if msg4 is done */
-#ifdef LTE_TDD
- ueDl->maxSbSz = (rgUeCatTbl[pCellUeSchCmn->cmn.ueCat].maxSftChBits/
- rgSchTddDlNumHarqProcTbl[sCell->ulDlCfgIdx]);
-#else
- ueDl->maxSbSz = (rgUeCatTbl[pCellUeSchCmn->cmn.ueCat].maxSftChBits/
- RGSCH_NUM_DL_HQ_PROC);
-#endif
-#ifdef EMTC_ENABLE
- rgSCHCmnDlSetUeAllocLmt(sCell, ueDl, ue->isEmtcUe);
-#else
- rgSCHCmnDlSetUeAllocLmt(sCell, ueDl, FALSE);
-#endif
-
- /* DL ambr */
- /* ambrCfgd config moved to ueCb.dl, as it's not needed for per cell wise*/
-
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, sCell);
- allocInfo->rnti = ue->ueId;
-
- /* Initializing the lastCfi value to current cfi value */
- ueDl->lastCfi = cellSchd->dl.currCfi;
-
- if ((cellSchd->apisDl->rgSCHRgrSCellDlUeCfg(sCell, ue, err)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Spec Sched DL UE CFG FAILED\n");
- return RFAILED;
- }
-
- /* TODO: enhance for DLFS RB Allocation for SCELLs in future dev */
-
- /* DLFS UE Config */
- if (cellSchd->dl.isDlFreqSel)
- {
- if ((cellSchd->apisDlfs->rgSCHDlfsSCellUeCfg(sCell, ue, sCellInfoCfg, err)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : DLFS UE config FAILED\n");
- return RFAILED;
- }
- }
-
- /* TODO: Do UL SCELL CFG during UL CA dev */
- {
- ueUl = RG_SCH_CMN_GET_UL_UE(ue, sCell);
-
- /* TODO_ULCA: SRS for SCELL needs to be handled in the below function call */
- rgSCHCmnUpdUeUlCqiInfo(sCell, ue, ueUl, ueSchCmn, cellSchd,
- sCell->isCpUlExtend);
-
- ret = rgSCHUhmHqEntInit(sCell, ue);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : SCELL UHM HARQ Ent Init "
- "Failed for CRNTI:%d", ue->ueId);
- return RFAILED;
- }
-
- ueUlPcell = RG_SCH_CMN_GET_UL_UE(ue, ue->cell);
- /* Initialize uplink HARQ related information for UE */
- ueUl->hqEnt.maxHqRetx = ueUlPcell->hqEnt.maxHqRetx;
- cmLListInit(&ueUl->hqEnt.free);
- cmLListInit(&ueUl->hqEnt.inUse);
- for(i=0; i < ueUl->hqEnt.numHqPrcs; i++)
- {
- ueUl->hqEnt.hqProcCb[i].hqEnt = (void*)(&ueUl->hqEnt);
- ueUl->hqEnt.hqProcCb[i].procId = i;
- ueUl->hqEnt.hqProcCb[i].ulSfIdx = RGSCH_INVALID_INFO;
- ueUl->hqEnt.hqProcCb[i].alloc = NULLP;
-#ifdef LTEMAC_SPS
- /* ccpu00139513- Initializing SPS flags*/
- ueUl->hqEnt.hqProcCb[i].isSpsActvnHqP = FALSE;
- ueUl->hqEnt.hqProcCb[i].isSpsOccnHqP = FALSE;
-#endif
- cmLListAdd2Tail(&ueUl->hqEnt.free, &ueUl->hqEnt.hqProcCb[i].lnk);
- ueUl->hqEnt.hqProcCb[i].lnk.node = (PTR)&ueUl->hqEnt.hqProcCb[i];
- }
-
- /* Allocate UL BSR allocation tracking List */
- cmLListInit(&ueUl->ulAllocLst);
-
- for (cnt = 0; cnt < RG_SCH_CMN_MAX_ALLOC_TRACK; cnt++)
- {
- if((rgSCHUtlAllocSBuf(sCell->instIdx,
- (Data**)&(allRcd),sizeof(RgSchCmnAllocRecord)) != ROK))
- {
- DU_LOG("\nERROR --> SCH : SCELL Memory allocation FAILED"
- "for CRNTI:%d",ue->ueId);
- err->errCause = RGSCHERR_SCH_CFG;
- return RFAILED;
- }
- allRcd->allocTime = sCell->crntTime;
- cmLListAdd2Tail(&ueUl->ulAllocLst, &allRcd->lnk);
- allRcd->lnk.node = (PTR)allRcd;
- }
-
- /* After initialising UL part, do power related init */
- ret = rgSCHPwrUeSCellCfg(sCell, ue, sCellInfoCfg);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Could not do "
- "power config for UE CRNTI:%d",ue->ueId);
- return RFAILED;
- }
-
-#ifdef EMTC_ENABLE
- if(TRUE == ue->isEmtcUe)
- {
- if ((cellSchd->apisEmtcUl->rgSCHRgrUlUeCfg(sCell, ue, NULL, err)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Spec Sched UL UE CFG FAILED"
- "for CRNTI:%d",ue->ueId);
- return RFAILED;
- }
- }
- else
-#endif
- {
- if ((cellSchd->apisUl->rgSCHRgrUlUeCfg(sCell, ue, NULL, err)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Spec Sched UL UE CFG FAILED"
- "for CRNTI:%d",ue->ueId);
- return RFAILED;
- }
- }
-
- ue->ul.isUlCaEnabled = TRUE;
- }
-
- return ROK;
-} /* rgSCHCmnRgrSCellUeCfg */
-
-
-/**
- * @brief UE initialisation for scheduler.
- *
- * @details
- *
- * Function : rgSCHCmnRgrSCellUeDel
- *
- * This functions Delete UE specific scheduler
- * information for SCELL
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCmnRgrSCellUeDel(RgSchUeCellInfo *sCellInfo,RgSchUeCb *ue)
-{
- RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(ue->cell);
- Inst inst = ue->cell->instIdx;
-
-
- cellSchd->apisDl->rgSCHRgrSCellDlUeDel(sCellInfo, ue);
-
- /* UL CA */
- rgSCHCmnUlUeDelAllocs(sCellInfo->cell, ue);
-
-#ifdef EMTC_ENABLE
- if(TRUE == ue->isEmtcUe)
- {
- cellSchd->apisEmtcUl->rgSCHFreeUlUe(sCellInfo->cell, ue);
- }
- else
-#endif
- {
- cellSchd->apisUl->rgSCHFreeUlUe(sCellInfo->cell, ue);
- }
-
- /* DLFS UE Config */
- if (cellSchd->dl.isDlFreqSel)
- {
- if ((cellSchd->apisDlfs->rgSCHDlfsSCellUeDel(sCellInfo->cell, ue)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : DLFS Scell del FAILED\n");
- return RFAILED;
- }
- }
-
- rgSCHUtlFreeSBuf(sCellInfo->cell->instIdx,
- (Data**)(&(sCellInfo->sch)), (sizeof(RgSchCmnUe)));
-
-
- return ROK;
-} /* rgSCHCmnRgrSCellUeDel */
-
-#endif
-
-#ifdef RG_5GTF
-/**
- * @brief Handles 5gtf configuration for a UE
- *
- * @details
- *
- * Function : rgSCHCmn5gtfUeCfg
- *
- * Processing Steps:
- *
- * - Return ROK
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrUeCfg *cfg
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCmn5gtfUeCfg(RgSchCellCb *cell,RgSchUeCb *ue,RgrUeCfg *cfg)
-{
-
- RgSchUeGrp *ue5gtfGrp;
- ue->ue5gtfCb.grpId = cfg->ue5gtfCfg.grpId;
- ue->ue5gtfCb.BeamId = cfg->ue5gtfCfg.BeamId;
- ue->ue5gtfCb.numCC = cfg->ue5gtfCfg.numCC;
- ue->ue5gtfCb.mcs = cfg->ue5gtfCfg.mcs;
- ue->ue5gtfCb.maxPrb = cfg->ue5gtfCfg.maxPrb;
-
- ue->ue5gtfCb.cqiRiPer = 100;
- /* 5gtf TODO: CQIs to start from (10,0)*/
- ue->ue5gtfCb.nxtCqiRiOccn.sfn = 10;
- ue->ue5gtfCb.nxtCqiRiOccn.slot = 0;
- ue->ue5gtfCb.rank = 1;
-
- DU_LOG("\nINFO --> SCH : schd cfg at mac,%u,%u,%u,%u,%u\n",ue->ue5gtfCb.grpId,ue->ue5gtfCb.BeamId,ue->ue5gtfCb.numCC,
- ue->ue5gtfCb.mcs,ue->ue5gtfCb.maxPrb);
-
- ue5gtfGrp = &(cell->cell5gtfCb.ueGrp5gConf[ue->ue5gtfCb.BeamId]);
-
- /* TODO_5GTF: Currently handling 1 group only. Need to update when multi group
- scheduling comes into picture */
- if(ue5gtfGrp->beamBitMask & (1 << ue->ue5gtfCb.BeamId))
- {
- DU_LOG("\nERROR --> SCH : 5GTF_ERROR Invalid beam id CRNTI:%d",cfg->crnti);
- return RFAILED;
- }
- ue5gtfGrp->beamBitMask |= (1 << ue->ue5gtfCb.BeamId);
-
- return ROK;
-}
-#endif
-
-/**
- * @brief UE initialisation for scheduler.
- *
- * @details
- *
- * Function : rgSCHCmnRgrUeCfg
- *
- * This functions intialises UE specific scheduler
- * information
- * 0. Perform basic validations
- * 1. Allocate common sched UE cntrl blk
- * 2. Perform DL cfg (allocate Hq Procs Cmn sched cntrl blks)
- * 3. Perform UL cfg
- * 4. Perform DLFS cfg
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[int] RgrUeCfg *ueCfg
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCmnRgrUeCfg(RgSchCellCb *cell,RgSchUeCb *ue,RgrUeCfg *ueCfg,RgSchErrInfo *err)
-{
- RgSchDlRbAlloc *allocInfo;
- S16 ret;
- RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell);
- RgSchCmnUe *ueSchCmn;
- RgSchCmnUlUe *ueUl;
- RgSchCmnDlUe *ueDl;
- uint8_t cnt;
- RgSchCmnAllocRecord *allRcd;
- uint32_t waitPer;
- uint32_t idx = (uint8_t)((cell->cellId - rgSchCb[cell->instIdx].genCfg.startCellId)&(CM_LTE_MAX_CELLS-1));
- RgSchUeCellInfo *pCellInfo = RG_SCH_CMN_GET_PCELL_INFO(ue);
-
-
- /* 1. Allocate Common sched control block */
- if((rgSCHUtlAllocSBuf(cell->instIdx,
- (Data**)&(((ue->cellInfo[ue->cellIdToCellIdxMap[idx]])->sch)), (sizeof(RgSchCmnUe))) != ROK))
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED for CRNTI:%d",ueCfg->crnti);
- err->errCause = RGSCHERR_SCH_CFG;
- return RFAILED;
- }
- ueSchCmn = RG_SCH_CMN_GET_UE(ue,cell);
- ue->dl.ueDlCqiCfg = ueCfg->ueDlCqiCfg;
- pCellInfo->acqiCb.aCqiCfg = ueCfg->ueDlCqiCfg.aprdCqiCfg;
- if(ueCfg->ueCatEnum > 0 )
- {
- /*KWORK_FIX removed NULL chk for ueSchCmn*/
- ueSchCmn->cmn.ueCat = ueCfg->ueCatEnum - 1;
- }
- else
- {
- ueSchCmn->cmn.ueCat = 0; /* Assuming enum values correctly set */
- }
- cmInitTimers(&ueSchCmn->cmn.tmr, 1);
-
- /*2. Perform UEs downlink configuration */
- ueDl = &ueSchCmn->dl;
- /* RACHO : store the rapId assigned for HandOver UE.
- * Append UE to handover list of cmnCell */
- if (ueCfg->dedPreambleId.pres == PRSNT_NODEF)
- {
- rgSCHCmnDelDedPreamble(cell, ueCfg->dedPreambleId.val);
- ueDl->rachInfo.hoRapId = ueCfg->dedPreambleId.val;
- cmLListAdd2Tail(&cellSchd->rachCfg.hoUeLst, &ueDl->rachInfo.hoLnk);
- ueDl->rachInfo.hoLnk.node = (PTR)ue;
- }
-
- rgSCHCmnUpdUeMimoInfo(ueCfg, ueDl, cell, cellSchd);
-
- if (ueCfg->txMode.pres == TRUE)
- {
- if ((ueCfg->txMode.txModeEnum == RGR_UE_TM_4) ||
- (ueCfg->txMode.txModeEnum == RGR_UE_TM_6))
- {
- RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_NO_PMI);
- }
- if (ueCfg->txMode.txModeEnum == RGR_UE_TM_3)
- {
- RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_RI_1);
- }
- }
- RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgUeCatTbl, ueSchCmn->cmn.ueCat);
- ueDl->maxTbBits = rgUeCatTbl[ueSchCmn->cmn.ueCat].maxDlTbBits;
- /*CA dev-Start*/
- uint8_t ri = 0;
- ri = RGSCH_MIN(ri, cell->numTxAntPorts);
- if(((CM_LTE_UE_CAT_6 == ueSchCmn->cmn.ueCat )
- ||(CM_LTE_UE_CAT_7 == ueSchCmn->cmn.ueCat))
- && (4 == ri))
- {
- ueDl->maxTbSz = rgUeCatTbl[ueSchCmn->cmn.ueCat].maxDlBits[1];
- }
- else
- {
- ueDl->maxTbSz = rgUeCatTbl[ueSchCmn->cmn.ueCat].maxDlBits[0];
- }
- /*CA dev-End*/
- /* Fix : syed Assign hqEnt to UE only if msg4 is done */
-#ifdef LTE_TDD
- ueDl->maxSbSz = (rgUeCatTbl[ueSchCmn->cmn.ueCat].maxSftChBits/
- rgSchTddDlNumHarqProcTbl[cell->ulDlCfgIdx]);
-#else
- ueDl->maxSbSz = (rgUeCatTbl[ueSchCmn->cmn.ueCat].maxSftChBits/
- RGSCH_NUM_DL_HQ_PROC);
-#endif
-#ifdef EMTC_ENABLE
- rgSCHCmnDlSetUeAllocLmt(cell, ueDl, ue->isEmtcUe);
-#else
- rgSCHCmnDlSetUeAllocLmt(cell, ueDl, FALSE);
-#endif
- /* if none of the DL and UL AMBR are configured then fail the configuration
- */
- if((ueCfg->ueQosCfg.dlAmbr == 0) && (ueCfg->ueQosCfg.ueBr == 0))
- {
- DU_LOG("\nERROR --> SCH : UL Ambr and DL Ambr are"
- "configured as 0 for CRNTI:%d",ueCfg->crnti);
- err->errCause = RGSCHERR_SCH_CFG;
- return RFAILED;
- }
- /* DL ambr */
- ue->dl.ambrCfgd = (ueCfg->ueQosCfg.dlAmbr * RG_SCH_CMN_REFRESH_TIME)/100;
-
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, cell);
- allocInfo->rnti = ue->ueId;
-
- /* Initializing the lastCfi value to current cfi value */
- ueDl->lastCfi = cellSchd->dl.currCfi;
-#ifdef EMTC_ENABLE
- if(cell->emtcEnable && ue->isEmtcUe)
- {
- if ((cellSchd->apisEmtcDl->rgSCHRgrDlUeCfg(cell, ue, ueCfg, err)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Spec Sched DL UE CFG FAILED for CRNTI:%d",ueCfg->crnti);
- return RFAILED;
- }
-
- }
- else
-#endif
- {
- if ((cellSchd->apisDl->rgSCHRgrDlUeCfg(cell, ue, ueCfg, err)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Spec Sched DL UE CFG FAILED for CRNTI:%d",ueCfg->crnti);
- return RFAILED;
- }
- }
-
-
-
- /* 3. Initialize ul part */
- ueUl = &ueSchCmn->ul;
-
- rgSCHCmnUpdUeUlCqiInfo(cell, ue, ueUl, ueSchCmn, cellSchd,
- cell->isCpUlExtend);
-
- ue->ul.maxBytesPerUePerTti = rgUeCatTbl[ueSchCmn->cmn.ueCat].maxUlBits * \
- RG_SCH_CMN_MAX_BITS_RATIO / (RG_SCH_CMN_UL_COM_DENOM*8);
-
- ue->ul.cfgdAmbr = (ueCfg->ueQosCfg.ueBr * RG_SCH_CMN_REFRESH_TIME)/100;
- ue->ul.effAmbr = ue->ul.cfgdAmbr;
- RGSCHCPYTIMEINFO(cell->crntTime, ue->ul.ulTransTime);
-
- /* Allocate UL BSR allocation tracking List */
- cmLListInit(&ueUl->ulAllocLst);
-
- for (cnt = 0; cnt < RG_SCH_CMN_MAX_ALLOC_TRACK; cnt++)
- {
- if((rgSCHUtlAllocSBuf(cell->instIdx,
- (Data**)&(allRcd),sizeof(RgSchCmnAllocRecord)) != ROK))
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED"
- "for CRNTI:%d",ueCfg->crnti);
- err->errCause = RGSCHERR_SCH_CFG;
- return RFAILED;
- }
- allRcd->allocTime = cell->crntTime;
- cmLListAdd2Tail(&ueUl->ulAllocLst, &allRcd->lnk);
- allRcd->lnk.node = (PTR)allRcd;
- }
- /* Allocate common sch cntrl blocks for LCGs */
- for (cnt=0; cnt<RGSCH_MAX_LCG_PER_UE; cnt++)
- {
- ret = rgSCHUtlAllocSBuf(cell->instIdx,
- (Data**)&(ue->ul.lcgArr[cnt].sch), (sizeof(RgSchCmnLcg)));
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : SCH struct alloc failed for CRNTI:%d",ueCfg->crnti);
- err->errCause = RGSCHERR_SCH_CFG;
- return (ret);
- }
- }
- /* After initialising UL part, do power related init */
- ret = rgSCHPwrUeCfg(cell, ue, ueCfg);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Could not do "
- "power config for UE CRNTI:%d",ueCfg->crnti);
- return RFAILED;
- }
-#ifdef LTEMAC_SPS
- ret = rgSCHCmnSpsUeCfg(cell, ue, ueCfg, err);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Could not do "
- "SPS config for CRNTI:%d",ueCfg->crnti);
- return RFAILED;
- }
-#endif /* LTEMAC_SPS */
-
-#ifdef EMTC_ENABLE
- if(TRUE == ue->isEmtcUe)
- {
- if ((cellSchd->apisEmtcUl->rgSCHRgrUlUeCfg(cell, ue, ueCfg, err)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Spec Sched UL UE CFG FAILED"
- "for CRNTI:%d",ueCfg->crnti);
- return RFAILED;
- }
- }
- else
-#endif
- {
- if ((cellSchd->apisUl->rgSCHRgrUlUeCfg(cell, ue, ueCfg, err)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Spec Sched UL UE CFG FAILED"
- "for CRNTI:%d",ueCfg->crnti);
- return RFAILED;
- }
- }
-
- /* DLFS UE Config */
- if (cellSchd->dl.isDlFreqSel)
- {
- if ((cellSchd->apisDlfs->rgSCHDlfsUeCfg(cell, ue, ueCfg, err)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : DLFS UE config FAILED"
- "for CRNTI:%d",ueCfg->crnti);
- return RFAILED;
- }
- }
-
- /* Fix: syed align multiple UEs to refresh at same time */
- rgSCHCmnGetRefreshPer(cell, ue, &waitPer);
- /* Start UE Qos Refresh Timer */
- rgSCHCmnAddUeToRefreshQ(cell, ue, waitPer);
-#ifdef RG_5GTF
- rgSCHCmn5gtfUeCfg(cell, ue, ueCfg);
-#endif
-
- return ROK;
-} /* rgSCHCmnRgrUeCfg */
-
-/**
- * @brief UE TX mode reconfiguration handler.
- *
- * @details
- *
- * Function : rgSCHCmnDlHdlTxModeRecfg
- *
- * This functions updates UE specific scheduler
- * information upon UE reconfiguration.
- *
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrUeRecfg *ueRecfg
- * @return Void
- **/
-#ifdef TFU_UPGRADE
-static Void rgSCHCmnDlHdlTxModeRecfg(RgSchCellCb *cell,RgSchUeCb *ue,RgrUeRecfg *ueRecfg,uint8_t numTxPorts)
-#else
-static Void rgSCHCmnDlHdlTxModeRecfg(RgSchCellCb *cell,RgSchUeCb *ue,RgrUeRecfg *ueRecfg)
-#endif
-{
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
-
- if (ueRecfg->txMode.pres != PRSNT_NODEF)
- {
- return;
- }
- /* ccpu00140894- Starting Timer for TxMode Transition Completion*/
- ue->txModeTransCmplt =FALSE;
- rgSCHTmrStartTmr (ue->cell, ue, RG_SCH_TMR_TXMODE_TRNSTN, RG_SCH_TXMODE_TRANS_TIMER);
- if (ueRecfg->txMode.tmTrnstnState == RGR_TXMODE_RECFG_CMPLT)
- {
- RG_SCH_CMN_UNSET_FORCE_TD(ue, cell,
- RG_SCH_CMN_TD_TXMODE_RECFG);
- /* MS_WORKAROUND for ccpu00123186 MIMO Fix Start: need to set FORCE TD bitmap based on TX mode */
- ueDl->mimoInfo.ri = 1;
- if ((ueRecfg->txMode.txModeEnum == RGR_UE_TM_4) ||
- (ueRecfg->txMode.txModeEnum == RGR_UE_TM_6))
- {
- RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_NO_PMI);
- }
- if (ueRecfg->txMode.txModeEnum == RGR_UE_TM_3)
- {
- RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_RI_1);
- }
- /* MIMO Fix End: need to set FORCE TD bitmap based on TX mode */
- return;
- }
- if (ueRecfg->txMode.tmTrnstnState == RGR_TXMODE_RECFG_START)
- {
- /* start afresh forceTD masking */
- RG_SCH_CMN_INIT_FORCE_TD(ue, cell, 0);
- RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_TXMODE_RECFG);
- /* Intialize MIMO related parameters of UE */
-
-#ifdef TFU_UPGRADE
- if(ueRecfg->txMode.pres)
- {
- if((ueRecfg->txMode.txModeEnum ==RGR_UE_TM_3) ||
- (ueRecfg->txMode.txModeEnum ==RGR_UE_TM_4))
- {
- if(ueRecfg->ueCodeBookRstRecfg.pres)
- {
- ueDl->mimoInfo.ri =
- rgSCHCmnComputeRank(ueRecfg->txMode.txModeEnum,
- ueRecfg->ueCodeBookRstRecfg.pmiBitMap, numTxPorts);
- }
- else
- {
- ueDl->mimoInfo.ri = 1;
- }
- }
- else
- {
- ueDl->mimoInfo.ri = 1;
- }
- }
- else
- {
- ueDl->mimoInfo.ri = 1;
- }
-#else
- ueDl->mimoInfo.ri = 1;
-#endif /* TFU_UPGRADE */
- if ((ueRecfg->txMode.txModeEnum == RGR_UE_TM_4) ||
- (ueRecfg->txMode.txModeEnum == RGR_UE_TM_6))
- {
- RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_NO_PMI);
- }
- if (ueRecfg->txMode.txModeEnum == RGR_UE_TM_3)
- {
- RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_RI_1);
- }
- return;
- }
-}
-/***********************************************************
- *
- * Func : rgSCHCmnUpdUeMimoInfo
- *
- * Desc : Updates UL and DL Ue Information
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHCmnUpdUeMimoInfo(RgrUeCfg *ueCfg,RgSchCmnDlUe *ueDl,RgSchCellCb *cell,RgSchCmnCell *cellSchd)
-{
-#ifdef TFU_UPGRADE
- if(ueCfg->txMode.pres)
- {
- if((ueCfg->txMode.txModeEnum ==RGR_UE_TM_3) ||
- (ueCfg->txMode.txModeEnum ==RGR_UE_TM_4))
- {
- if(ueCfg->ueCodeBookRstCfg.pres)
- {
- ueDl->mimoInfo.ri =
- rgSCHCmnComputeRank(ueCfg->txMode.txModeEnum,
- ueCfg->ueCodeBookRstCfg.pmiBitMap, cell->numTxAntPorts);
- }
- else
- {
- ueDl->mimoInfo.ri = 1;
- }
- }
- else
- {
- ueDl->mimoInfo.ri = 1;
- }
- }
- else
- {
- ueDl->mimoInfo.ri = 1;
- }
-
-#else
- ueDl->mimoInfo.ri = 1;
-#endif /*TFU_UPGRADE */
- ueDl->mimoInfo.cwInfo[0].cqi = cellSchd->dl.ccchCqi;
- ueDl->mimoInfo.cwInfo[1].cqi = cellSchd->dl.ccchCqi;
-
- return;
-}
-/***********************************************************
- *
- * Func : rgSCHCmnUpdUeUlCqiInfo
- *
- * Desc : Updates UL and DL Ue Information
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHCmnUpdUeUlCqiInfo(RgSchCellCb *cell,RgSchUeCb *ue,RgSchCmnUlUe *ueUl,RgSchCmnUe *ueSchCmn,RgSchCmnCell *cellSchd,Bool isEcp)
-{
-
-#ifdef TFU_UPGRADE
- if(ue->srsCb.srsCfg.type == RGR_SCH_SRS_SETUP)
- {
- if(ue->ul.ulTxAntSel.pres)
- {
- ueUl->crntUlCqi[ue->srsCb.selectedAnt] = cellSchd->ul.dfltUlCqi;
- ueUl->validUlCqi = ueUl->crntUlCqi[ue->srsCb.selectedAnt];
- }
- else
- {
- ueUl->crntUlCqi[0] = cellSchd->ul.dfltUlCqi;
- ueUl->validUlCqi = ueUl->crntUlCqi[0];
- }
- ue->validTxAnt = ue->srsCb.selectedAnt;
- }
- else
- {
- ueUl->validUlCqi = cellSchd->ul.dfltUlCqi;
- ue->validTxAnt = 0;
- }
-#ifdef UL_LA
- ueUl->ulLaCb.cqiBasediTbs = rgSchCmnUlCqiToTbsTbl[isEcp]
- [ueUl->validUlCqi] * 100;
- ueUl->ulLaCb.deltaiTbs = 0;
-#endif
-
-#else
- ueUl->crntUlCqi[0] = cellSchd->ul.dfltUlCqi;
-#endif /*TFU_UPGRADE */
- RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgUeCatTbl, ueSchCmn->cmn.ueCat);
- if (rgUeCatTbl[ueSchCmn->cmn.ueCat].ul64qamSup == FALSE)
- {
- ueUl->maxUlCqi = cellSchd->ul.max16qamCqi;
- }
- else
- {
- ueUl->maxUlCqi = RG_SCH_CMN_UL_NUM_CQI - 1;
- }
-
- return;
-}
-/***********************************************************
- *
- * Func : rgSCHCmnUpdUeCatCfg
- *
- * Desc : Updates UL and DL Ue Information
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHCmnUpdUeCatCfg(RgSchUeCb *ue,RgSchCellCb *cell)
-{
- RgSchDlHqEnt *hqE = NULLP;
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell);
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- RgSchCmnUe *ueSchCmn = RG_SCH_CMN_GET_UE(ue,cell);
- RgSchCmnCell *cellSchd = RG_SCH_CMN_GET_CELL(cell);
-
-
- ueDl->maxTbBits = rgUeCatTbl[ueSchCmn->cmn.ueCat].maxDlTbBits;
-
- hqE = RG_SCH_CMN_GET_UE_HQE(ue, cell);
- /*CA dev-Start*/
- uint8_t ri = 0;
- ri = RGSCH_MIN(ri, cell->numTxAntPorts);
- if(((CM_LTE_UE_CAT_6 == ueSchCmn->cmn.ueCat )
- ||(CM_LTE_UE_CAT_7 == ueSchCmn->cmn.ueCat))
- && (RG_SCH_MAX_TX_LYRS_4 == ri))
- {
- ueDl->maxTbSz = rgUeCatTbl[ueSchCmn->cmn.ueCat].maxDlBits[1];
- }
- else
- {
- ueDl->maxTbSz = rgUeCatTbl[ueSchCmn->cmn.ueCat].maxDlBits[0];
- }
- /*CA dev-End*/
- ueDl->maxSbSz = (rgUeCatTbl[ueSchCmn->cmn.ueCat].maxSftChBits/
- hqE->numHqPrcs);
- if (rgUeCatTbl[ueSchCmn->cmn.ueCat].ul64qamSup == FALSE)
- {
- ueUl->maxUlCqi = cellSchd->ul.max16qamCqi;
- }
- else
- {
- ueUl->maxUlCqi = RG_SCH_CMN_UL_NUM_CQI - 1;
- }
- ue->ul.maxBytesPerUePerTti = rgUeCatTbl[ueSchCmn->cmn.ueCat].maxUlBits * \
- RG_SCH_CMN_MAX_BITS_RATIO / (RG_SCH_CMN_UL_COM_DENOM*8);
- return;
-}
-
-/**
- * @brief UE reconfiguration for scheduler.
- *
- * @details
- *
- * Function : rgSChCmnRgrUeRecfg
- *
- * This functions updates UE specific scheduler
- * information upon UE reconfiguration.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[int] RgrUeRecfg *ueRecfg
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCmnRgrUeRecfg(RgSchCellCb *cell,RgSchUeCb *ue,RgrUeRecfg *ueRecfg,RgSchErrInfo *err)
-{
- RgSchCmnCell *cellSchCmn = RG_SCH_CMN_GET_CELL(cell);
- uint32_t waitPer;
-
- /* Basic validations */
- if (ueRecfg->ueRecfgTypes & RGR_UE_TXMODE_RECFG)
- {
-#ifdef TFU_UPGRADE
- rgSCHCmnDlHdlTxModeRecfg(cell, ue, ueRecfg, cell->numTxAntPorts);
-#else
- rgSCHCmnDlHdlTxModeRecfg(cell, ue, ueRecfg);
-#endif /* TFU_UPGRADE */
- }
- if(ueRecfg->ueRecfgTypes & RGR_UE_CSG_PARAM_RECFG)
- {
- ue->csgMmbrSta = ueRecfg->csgMmbrSta;
- }
- /* Changes for UE Category reconfiguration feature */
- if(ueRecfg->ueRecfgTypes & RGR_UE_UECAT_RECFG)
- {
- rgSCHCmnUpdUeCatCfg(ue, cell);
- }
- if (ueRecfg->ueRecfgTypes & RGR_UE_APRD_DLCQI_RECFG)
- {
- RgSchUeCellInfo *pCellInfo = RG_SCH_CMN_GET_PCELL_INFO(ue);
- pCellInfo->acqiCb.aCqiCfg = ueRecfg->aprdDlCqiRecfg;
- }
-#ifndef TFU_UPGRADE
- if (ueRecfg->ueRecfgTypes & RGR_UE_PRD_DLCQI_RECFG)
- {
- if ((ueRecfg->prdDlCqiRecfg.pres == TRUE)
- && (ueRecfg->prdDlCqiRecfg.prdModeEnum != RGR_PRD_CQI_MOD10)
- && (ueRecfg->prdDlCqiRecfg.prdModeEnum != RGR_PRD_CQI_MOD20))
- {
- DU_LOG("\nERROR --> SCH : Unsupported periodic CQI "
- "reporting mode %d for old CRNIT:%d",
- (int)ueRecfg->prdDlCqiRecfg.prdModeEnum,ueRecfg->oldCrnti);
- err->errCause = RGSCHERR_SCH_CFG;
- return RFAILED;
- }
- ue->dl.ueDlCqiCfg.prdCqiCfg = ueRecfg->prdDlCqiRecfg;
- }
-#endif
-
- if (ueRecfg->ueRecfgTypes & RGR_UE_ULPWR_RECFG)
- {
- if (rgSCHPwrUeRecfg(cell, ue, ueRecfg) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Power Reconfiguration Failed for OLD CRNTI:%d",ueRecfg->oldCrnti);
- return RFAILED;
- }
- }
-
- if (ueRecfg->ueRecfgTypes & RGR_UE_QOS_RECFG)
- {
- /* Uplink Sched related Initialization */
- if ((ueRecfg->ueQosRecfg.dlAmbr == 0) && (ueRecfg->ueQosRecfg.ueBr == 0))
- {
- DU_LOG("\nERROR --> SCH : Ul Ambr and DL Ambr "
- "configured as 0 for OLD CRNTI:%d",ueRecfg->oldCrnti);
- err->errCause = RGSCHERR_SCH_CFG;
- return RFAILED;
- }
- ue->ul.cfgdAmbr = (ueRecfg->ueQosRecfg.ueBr * \
- RG_SCH_CMN_REFRESH_TIME)/100;
- /* Downlink Sched related Initialization */
- ue->dl.ambrCfgd = (ueRecfg->ueQosRecfg.dlAmbr * \
- RG_SCH_CMN_REFRESH_TIME)/100;
- /* Fix: syed Update the effAmbr and effUeBR fields w.r.t the
- * new QOS configuration */
- rgSCHCmnDelUeFrmRefreshQ(cell, ue);
- /* Fix: syed align multiple UEs to refresh at same time */
- rgSCHCmnGetRefreshPer(cell, ue, &waitPer);
- rgSCHCmnApplyUeRefresh(cell, ue);
- rgSCHCmnAddUeToRefreshQ(cell, ue, waitPer);
- }
-#ifdef EMTC_ENABLE
- if((cell->emtcEnable)&&(TRUE == ue->isEmtcUe))
- {
- if ((cellSchCmn->apisEmtcUl->rgSCHRgrUlUeRecfg(cell, ue, ueRecfg, err)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Spec Sched UL UE ReCFG FAILED for CRNTI:%d",ue->ueId);
- return RFAILED;
- }
- if ((cellSchCmn->apisEmtcDl->rgSCHRgrDlUeRecfg(cell, ue, ueRecfg, err)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Spec Sched DL UE ReCFG FAILED for CRNTI:%d",ue->ueId);
- return RFAILED;
- }
- }
- else
-#endif
- {
- if ((cellSchCmn->apisUl->rgSCHRgrUlUeRecfg(cell, ue, ueRecfg, err)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Spec Sched UL UE ReCFG FAILED for CRNTI:%d",ue->ueId);
- return RFAILED;
- }
- if ((cellSchCmn->apisDl->rgSCHRgrDlUeRecfg(cell, ue, ueRecfg, err)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Spec Sched DL UE ReCFG FAILED for CRNTI:%d",ue->ueId);
- return RFAILED;
- }
- }
- /* DLFS UE Config */
- if (cellSchCmn->dl.isDlFreqSel)
- {
- if ((cellSchCmn->apisDlfs->rgSCHDlfsUeRecfg(cell, ue, \
- ueRecfg, err)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : DLFS UE re-config FAILED for CRNTI:%d",ue->ueId);
- return RFAILED;
- }
- }
-
-#ifdef LTEMAC_SPS
- /* Invoke re-configuration on SPS module */
- if (rgSCHCmnSpsUeRecfg(cell, ue, ueRecfg, err) != ROK)
- {
- DU_LOG("\nERROR --> SCH : DL SPS ReCFG FAILED for UE CRNTI:%d", ue->ueId);
- return RFAILED;
- }
-#endif
-
- return ROK;
-} /* rgSCHCmnRgrUeRecfg*/
-
-/***********************************************************
- *
- * Func : rgSCHCmnUlUeDelAllocs
- *
- * Desc : Deletion of all UE allocations.
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHCmnUlUeDelAllocs(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell);
- uint8_t i;
-#ifdef LTEMAC_SPS
- RgSchCmnUlUeSpsInfo *ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue,cell);
-#endif
-
- for (i = 0; i < ueUl->hqEnt.numHqPrcs; ++i)
- {
- RgSchUlHqProcCb *proc = rgSCHUhmGetUlHqProc(cell, ue, i);
-
-#ifdef ERRCLS_KW
- /* proc can't be NULL here */
- if (proc)
-#endif
- {
- /* R8 Upgrade */
- proc->ndi = 0;
- if (proc->alloc)
- {
- /* Added Insure Fixes Of reading Dangling memory.NULLed crntAlloc */
-#ifdef LTEMAC_SPS
- if(proc->alloc == ulSpsUe->ulSpsSchdInfo.crntAlloc)
- {
- ulSpsUe->ulSpsSchdInfo.crntAlloc = NULLP;
- ulSpsUe->ulSpsSchdInfo.crntAllocSf = NULLP;
- }
-#endif
-#ifdef EMTC_ENABLE
- rgSCHCmnUlFreeAllocation(cell, &cellUl->ulSfArr[proc->ulSfIdx],
- proc->alloc,ue->isEmtcUe);
-#else
- rgSCHCmnUlFreeAllocation(cell, &cellUl->ulSfArr[proc->ulSfIdx],
- proc->alloc);
-#endif
- /* PHY probably needn't be intimated since
- * whatever intimation it needs happens at the last minute
- */
- }
- /* Fix: syed Adaptive Msg3 Retx crash. Remove the harqProc
- * from adaptive retx List. */
- if (proc->reTxLnk.node)
- {
- {
- //TODO_SID: Need to take care
- cmLListDelFrm(&cellUl->reTxLst, &proc->reTxLnk);
- proc->reTxLnk.node = (PTR)NULLP;
- }
- }
- }
- }
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHCmnDelUeFrmRefreshQ
- *
- * Desc : Adds a UE to refresh queue, so that the UE is
- * periodically triggered to refresh it's GBR and
- * AMBR values.
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHCmnDelUeFrmRefreshQ(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnCell *sched = RG_SCH_CMN_GET_CELL(cell);
- CmTmrArg arg;
- RgSchCmnUeInfo *ueSchd = RG_SCH_CMN_GET_CMN_UE(ue);
-
-
-#ifdef RGL_SPECIFIC_CHANGES
- if(ue->refreshOffset < RGSCH_MAX_REFRESH_GRPSZ)
- {
- if(cell->refreshUeCnt[ue->refreshOffset])
- {
- cell->refreshUeCnt[ue->refreshOffset]--;
- }
- }
-#endif
-
-
- memset(&arg, 0, sizeof(arg));
- arg.tqCp = &sched->tmrTqCp;
- arg.tq = sched->tmrTq;
- arg.timers = &ueSchd->tmr;
- arg.cb = (PTR)ue;
- arg.tNum = 0;
- arg.max = 1;
- arg.evnt = RG_SCH_CMN_EVNT_UE_REFRESH;
-
- cmRmvCbTq(&arg);
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHCmnUeCcchSduDel
- *
- * Desc : Clear CCCH SDU scheduling context.
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHCmnUeCcchSduDel(RgSchCellCb *cell,RgSchUeCb *ueCb)
-{
- RgSchDlHqEnt *hqE = NULLP;
- RgSchDlHqProcCb *ccchSduHqP = NULLP;
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-
-
- hqE = RG_SCH_CMN_GET_UE_HQE(ueCb, cell);
- if (hqE == NULLP)
- {
- return;
- }
- ccchSduHqP = hqE->ccchSduProc;
- if(ueCb->ccchSduLnk.node != NULLP)
- {
- /* Remove the ccchSduProc if it is in the Tx list */
- cmLListDelFrm(&(cell->ccchSduUeLst), &(ueCb->ccchSduLnk));
- ueCb->ccchSduLnk.node = NULLP;
- }
- else if(ccchSduHqP != NULLP)
- {
- /* Fix for crash due to stale pdcch. Release ccch pdcch*/
- if(ccchSduHqP->pdcch)
- {
- cmLListDelFrm(&ccchSduHqP->subFrm->pdcchInfo.pdcchs,
- &ccchSduHqP->pdcch->lnk);
- cmLListAdd2Tail(&cell->pdcchLst, &ccchSduHqP->pdcch->lnk);
- ccchSduHqP->pdcch = NULLP;
- }
- if(ccchSduHqP->tbInfo[0].ccchSchdInfo.retxLnk.node != NULLP)
- {
- /* Remove the ccchSduProc if it is in the retx list */
- cmLListDelFrm(&cellSch->dl.ccchSduRetxLst,
- &ccchSduHqP->tbInfo[0].ccchSchdInfo.retxLnk);
- /* ccchSduHqP->tbInfo[0].ccchSchdInfo.retxLnk.node = NULLP; */
- rgSCHDhmRlsHqpTb(ccchSduHqP, 0, TRUE);
- }
- else if ((ccchSduHqP->subFrm != NULLP) &&
- (ccchSduHqP->hqPSfLnk.node != NULLP))
- {
- rgSCHUtlDlHqPTbRmvFrmTx(ccchSduHqP->subFrm,
- ccchSduHqP, 0, FALSE);
- rgSCHDhmRlsHqpTb(ccchSduHqP, 0, TRUE);
- }
- }
- return;
-}
-
-
-
-
-/**
- * @brief UE deletion for scheduler.
- *
- * @details
- *
- * Function : rgSCHCmnUeDel
- *
- * This functions deletes all scheduler information
- * pertaining to an UE.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-Void rgSCHCmnUeDel(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchDlHqEnt *hqE = NULLP;
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell);
- CmLList *node;
- RgSchCmnAllocRecord *allRcd;
- uint8_t cnt;
- RgSchCmnCell *cellSchCmn = RG_SCH_CMN_GET_CELL(cell);
- uint32_t idx = 0;
-
- if (RG_SCH_CMN_GET_UE(ue,cell) == NULLP)
- {
- /* Common scheduler config has not happened yet */
- return;
- }
- hqE = RG_SCH_CMN_GET_UE_HQE(ue, cell);
- if(hqE)
- {
- /* UE Free can be triggered before MSG4 done when dlHqE is not updated */
-#ifdef EMTC_ENABLE
- if(ue->isEmtcUe)
- {
- rgSCHEmtcCmnUeCcchSduDel(cell, ue);
- }
- else
-#endif
- {
- rgSCHCmnUeCcchSduDel(cell, ue);
- }
- }
- rgSCHCmnDelUeFrmRefreshQ(cell, ue);
-
- rgSCHCmnUlUeDelAllocs(cell, ue);
-
- rgSCHCmnDelRachInfo(cell, ue);
-
-#ifdef EMTC_ENABLE
- if(TRUE == ue->isEmtcUe)
- {
- cellSchCmn->apisEmtcUl->rgSCHFreeUlUe(cell, ue);
- }
- else
-#endif
- {
- cellSchCmn->apisUl->rgSCHFreeUlUe(cell, ue);
- }
-#ifdef LTE_ADV
- if (ue->numSCells)
- {
- for(idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
- {
- if(ue->cellInfo[idx] != NULLP)
- {
- rgSCHSCellDelUeSCell(cell,ue,idx);
- }
- }
-
- }
-#endif
-#ifdef EMTC_ENABLE
- if((cell->emtcEnable)&&(TRUE == ue->isEmtcUe))
- {
- cellSchCmn->apisEmtcDl->rgSCHFreeDlUe(cell, ue);
- }
- else
-#endif
- {
- cellSchCmn->apisDl->rgSCHFreeDlUe(cell, ue);
- }
- rgSCHPwrUeDel(cell, ue);
-
-#ifdef LTEMAC_SPS
- rgSCHCmnSpsUeDel(cell, ue);
-#endif /* LTEMAC_SPS*/
-
- /* CA Dev Start*/
- rgSchCmnDlSfHqDel(ue, cell);
- /* CA Dev End*/
- /* DLFS UE delete */
- if (cellSchCmn->dl.isDlFreqSel)
- {
- cellSchCmn->apisDlfs->rgSCHDlfsUeDel(cell, ue);
- }
- node = ueUl->ulAllocLst.first;
-
-/* ccpu00117052 - MOD - Passing double pointer in all the places of
- rgSCHUtlFreeSBuf function call for proper NULLP assignment*/
- while(node)
- {
- allRcd = (RgSchCmnAllocRecord *)node->node;
- node = node->next;
- cmLListDelFrm(&ueUl->ulAllocLst, &allRcd->lnk);
- rgSCHUtlFreeSBuf(cell->instIdx,
- (Data**)(&allRcd), (sizeof(RgSchCmnAllocRecord)));
- }
-
- for(cnt = 0; cnt < RGSCH_MAX_LCG_PER_UE; cnt++)
- {
- if (ue->ul.lcgArr[cnt].sch != NULLP)
- {
- rgSCHUtlFreeSBuf(cell->instIdx,
- (Data**)(&(ue->ul.lcgArr[cnt].sch)), (sizeof(RgSchCmnLcg)));
- }
- }
-
- /* Fix : syed Moved hqEnt deinit to rgSCHCmnDlDeInitHqEnt */
- idx = (uint8_t)((cell->cellId - rgSchCb[cell->instIdx].genCfg.startCellId) & (CM_LTE_MAX_CELLS - 1));
- rgSCHUtlFreeSBuf(cell->instIdx,
- (Data**)(&(((ue->cellInfo[ue->cellIdToCellIdxMap[idx]])->sch))), (sizeof(RgSchCmnUe)));
- return;
-} /* rgSCHCmnUeDel */
-
-\f
-/**
- * @brief This function handles the common code rate configurations
- * done as part of RgrCellCfg/RgrCellRecfg.
- *
- * @details
- *
- * Function: rgSCHCmnDlCnsdrCmnRt
- * Purpose: This function handles the common code rate configurations
- * done as part of RgrCellCfg/RgrCellRecfg.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgrDlCmnCodeRateCfg *dlCmnCodeRate
- * @return S16
- *
- **/
-static S16 rgSCHCmnDlCnsdrCmnRt(RgSchCellCb *cell,RgrDlCmnCodeRateCfg *dlCmnCodeRate)
-{
- RgSchCmnCell *cellDl = RG_SCH_CMN_GET_CELL(cell);
- uint32_t bitsPerRb;
- uint32_t bitsPer2Rb;
- uint32_t bitsPer3Rb;
- uint8_t i, rbNum;
- uint32_t pdcchBits;
-
-
- /* code rate is bits per 1024 phy bits, since modl'n scheme is 2. it is
- * bits per 1024/2 REs */
- if (dlCmnCodeRate->bcchPchRaCodeRate != 0)
- {
- bitsPerRb = ((dlCmnCodeRate->bcchPchRaCodeRate * 2) *
- cellDl->dl.noResPerRb[3])/1024;
- }
- else
- {
- bitsPerRb = ((RG_SCH_CMN_DEF_BCCHPCCH_CODERATE * 2) *
- cellDl->dl.noResPerRb[3])/1024;
- }
- /* Store bitsPerRb in cellDl->dl to use later to determine
- * Number of RBs for UEs with SI-RNTI, P-RNTI and RA-RNTI */
- cellDl->dl.bitsPerRb = bitsPerRb;
- /* ccpu00115595 end*/
- /* calculate the ITbs for 2 RBs. Initialize ITbs to MAX value */
- i = 0;
- rbNum = 2;
- bitsPer2Rb = bitsPerRb * rbNum;
- while ((i < 9) && (rgTbSzTbl[0][i][rbNum - 1] <= bitsPer2Rb))
- i++;
-
- (i <= 1)? (cellDl->dl.cmnChITbs.iTbs2Rbs = 0) :
- (cellDl->dl.cmnChITbs.iTbs2Rbs = i-1);
-
- /* calculate the ITbs for 3 RBs. Initialize ITbs to MAX value */
- i = 0;
- rbNum = 3;
- bitsPer3Rb = bitsPerRb * rbNum;
- while ((i < 9) && (rgTbSzTbl[0][i][rbNum - 1] <= bitsPer3Rb))
- i++;
-
- (i <= 1)? (cellDl->dl.cmnChITbs.iTbs3Rbs = 0) :
- (cellDl->dl.cmnChITbs.iTbs3Rbs = i-1);
-
-
- pdcchBits = 1 + /* Flag for format0/format1a differentiation */
- 1 + /* Localized/distributed VRB assignment flag */
- 5 + /* For mcs */
-#ifndef LTE_TDD
- 3 + /* Harq process Id */
-#else
- 4 + /* Harq process Id */
- 2 + /* UL Index or DAI */
-#endif
- 1 + /* New Data Indicator */
- 2 + /* For RV */
- 2 + /* For tpc */
- 1 + rgSCHUtlLog32bitNbase2((cell->bwCfg.dlTotalBw * \
- (cell->bwCfg.dlTotalBw + 1))/2);
- /* Resource block assignment ceil[log2(bw(bw+1)/2)] : \
- Since VRB is local */
- /* For TDD consider DAI */
-
- /* Convert the pdcchBits to actual pdcchBits required for transmission */
- if (dlCmnCodeRate->pdcchCodeRate != 0)
- {
- pdcchBits = (pdcchBits * 1024)/dlCmnCodeRate->pdcchCodeRate;
- if (pdcchBits <= 288) /* 288 : Num of pdcch bits for aggrLvl=4 */
- {
- cellDl->dl.cmnChAggrLvl = CM_LTE_AGGR_LVL4;
- }
- else /* 576 : Num of pdcch bits for aggrLvl=8 */
- {
- cellDl->dl.cmnChAggrLvl = CM_LTE_AGGR_LVL8;
- }
- }
- else
- {
- cellDl->dl.cmnChAggrLvl = CM_LTE_AGGR_LVL4;
- }
- if (dlCmnCodeRate->ccchCqi == 0)
- {
- return RFAILED;
- }
- else
- {
- cellDl->dl.ccchCqi = dlCmnCodeRate->ccchCqi;
- }
- return ROK;
-}
-
-#ifdef LTE_TDD
-/**
- * @brief This function handles the configuration of cell for the first
- * time by the scheduler.
- *
- * @details
- *
- * Function: rgSCHCmnDlRgrCellCfg
- * Purpose: Configuration received is stored into the data structures
- * Also, update the scheduler with the number of frames of
- * RACH preamble transmission.
- *
- * Invoked by: BO and Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgrCellCfg* cfg
- * @return S16
- *
- **/
-static S16 rgSCHCmnDlRgrCellCfg(RgSchCellCb *cell,RgrCellCfg *cfg,RgSchErrInfo *err)
-{
- RgSchCmnCell *cellSch;
- uint8_t cp;
- uint8_t sfCount;
- uint8_t numPdcchSym;
- uint8_t noSymPerSlot;
- uint8_t maxDlSubfrms = cell->numDlSubfrms;
- uint8_t splSubfrmIdx = cfg->spclSfCfgIdx;
- uint8_t swPtCnt = 0;
- Bool isSplfrm;
- RgSchTddSubfrmInfo subfrmInfo = rgSchTddMaxUlSubfrmTbl[cell->ulDlCfgIdx];
- S16 ret;
- uint8_t splSfIdx;
- uint8_t antPortIdx;
- uint8_t numCrs;
- uint8_t cfi;
- uint8_t cfiIdx;
- RgSchDlSf *sf;
- uint8_t splSfCfi;
- uint8_t mPhich;
-
-
-
- cellSch = RG_SCH_CMN_GET_CELL(cell);
- cellSch->dl.numRaSubFrms = rgRaPrmblToRaFrmTbl[cell->\
- rachCfg.preambleFormat];
- /*[ccpu00138532]-ADD-fill the Msg4 Harq data */
- cell->dlHqCfg.maxMsg4HqTx = cfg->dlHqCfg.maxMsg4HqTx;
-
- /* Msg4 Tx Delay = (HARQ_RTT * MAX_MSG4_HARQ_RETX) +
- 3 TTI (MAX L1+L2 processing delay at the UE) */
- cellSch->dl.msg4TxDelay = (cfg->dlHqCfg.maxMsg4HqTx-1) *
- rgSchCmnHarqRtt[cell->ulDlCfgIdx] + 3;
- cellSch->dl.maxUePerDlSf = cfg->maxUePerDlSf;
- cellSch->dl.maxUeNewTxPerTti = cfg->maxDlUeNewTxPerTti;
- if (cfg->maxUePerDlSf == 0)
- {
- cellSch->dl.maxUePerDlSf = RG_SCH_CMN_MAX_UE_PER_DL_SF;
- }
- if (cellSch->dl.maxUePerDlSf < cellSch->dl.maxUeNewTxPerTti)
- {
- return RFAILED;
- }
-
-
- if (cell->bwCfg.dlTotalBw <= 10)
- {
- cfiIdx = 1;
- numPdcchSym = 2;
- }
- else
- {
- cfiIdx = 0;
- numPdcchSym = 1;
- }
- /* DwPTS Scheduling Changes Start */
- cellSch->dl.splSfCfg = splSubfrmIdx;
-
- if (cfg->isCpDlExtend == TRUE)
- {
- if((0 == splSubfrmIdx) || (4 == splSubfrmIdx) ||
- (7 == splSubfrmIdx) || (8 == splSubfrmIdx)
- )
- {
- cell->splSubfrmCfg.isDlDataAllowed = FALSE;
- }
- else
- {
- cell->splSubfrmCfg.isDlDataAllowed = TRUE;
- }
- }
- else
- {
- /* Refer to 36.213 Section 7.1.7 */
- if((0 == splSubfrmIdx) || (5 == splSubfrmIdx))
- {
- cell->splSubfrmCfg.isDlDataAllowed = FALSE;
- }
- else
- {
- cell->splSubfrmCfg.isDlDataAllowed = TRUE;
- }
- }
- /* DwPTS Scheduling Changes End */
-
- splSfCfi = RGSCH_MIN(cell->dynCfiCb.maxCfi, cellSch->cfiCfg.cfi);
- RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, splSfCfi);
-
- for (sfCount = 0; sfCount < maxDlSubfrms; sfCount++)
- {
- sf = cell->subFrms[sfCount];
- /* Sfcount matches the first special subframe occurs at Index 0
- * or subsequent special subframes */
- if(subfrmInfo.switchPoints == 1)
- {
- isSplfrm = rgSCHCmnIsSplSubfrm(swPtCnt, sfCount,
- RG_SCH_CMN_10_MS_PRD, &subfrmInfo);
- }
- else
- {
- isSplfrm = rgSCHCmnIsSplSubfrm(swPtCnt, sfCount,
- RG_SCH_CMN_5_MS_PRD, &subfrmInfo);
- }
- if(isSplfrm == TRUE)
- {
- swPtCnt++;
- /* DwPTS Scheduling Changes Start */
- if (cell->splSubfrmCfg.isDlDataAllowed == TRUE)
- {
- sf->sfType = RG_SCH_SPL_SF_DATA;
- }
- else
- {
- sf->sfType = RG_SCH_SPL_SF_NO_DATA;
- }
- /* DwPTS Scheduling Changes End */
- }
- else
- {
- /* DwPTS Scheduling Changes Start */
- if (sf->sfNum != 0)
- {
- sf->sfType = RG_SCH_DL_SF;
- }
- else
- {
- sf->sfType = RG_SCH_DL_SF_0;
- }
- /* DwPTS Scheduling Changes End */
- }
-
- /* Calculate the number of CCEs per subframe in the cell */
- mPhich = rgSchTddPhichMValTbl[cell->ulDlCfgIdx][sf->sfNum];
- if(cell->dynCfiCb.isDynCfiEnb == TRUE)
- {
- /* In case if Dynamic CFI feature is enabled, default CFI
- * value 1 is used */
- sf->nCce = cell->dynCfiCb.cfi2NCceTbl[mPhich][1];
- }
- else
- {
- if (sf->sfType == RG_SCH_SPL_SF_DATA)
- {
- sf->nCce = cell->dynCfiCb.cfi2NCceTbl[mPhich][splSfCfi];
- }
- else
- {
- sf->nCce = cell->dynCfiCb.cfi2NCceTbl[mPhich][RGSCH_MIN(cell->dynCfiCb.maxCfi, cellSch->cfiCfg.cfi)];
- }
- }
- }
-
- /* Intialize the RACH response scheduling related infromation */
- if(rgSCHCmnDlRachInfoInit(cell) != ROK)
- {
- return RFAILED;
- }
-
- /* Allocate PRACH preamble list */
- rgSCHCmnDlCreateRachPrmLst(cell);
-
- /* Initialize PHICH offset information */
- rgSCHCmnDlPhichOffsetInit(cell);
-
- /* Update the size of HARQ ACK/NACK feedback table */
- /* The array size is increased by 2 to have enough free indices, where other
- * indices are busy waiting for HARQ feedback */
- cell->ackNackFdbkArrSize = rgSchTddANFdbkMapTbl[cell->ulDlCfgIdx] + 2;
-
- /* Initialize expected HARQ ACK/NACK feedback time */
- rgSCHCmnDlANFdbkInit(cell);
-
- /* Initialize UL association set index */
- if(cell->ulDlCfgIdx != 0)
- {
- rgSCHCmnDlKdashUlAscInit(cell);
- }
-
- if (cfg->isCpDlExtend == TRUE)
- {
- cp = RG_SCH_CMN_EXT_CP;
- noSymPerSlot = 6;
- cell->splSubfrmCfg.dwPts =
- rgSchTddSplSubfrmInfoTbl[splSubfrmIdx].extDlDwPts;
-
- if ( cell->splSubfrmCfg.dwPts == 0 )
- {
- cell->isDwPtsCnted = FALSE;
- }
- else
- {
- cell->isDwPtsCnted = TRUE;
- }
-
- if(cfg->isCpUlExtend == TRUE)
- {
- cell->splSubfrmCfg.upPts =
- rgSchTddSplSubfrmInfoTbl[splSubfrmIdx].extDlExtUpPts;
- }
- else
- {
- cell->splSubfrmCfg.upPts =
- rgSchTddSplSubfrmInfoTbl[splSubfrmIdx].extDlNorUpPts;
- }
- }
- else
- {
- cp = RG_SCH_CMN_NOR_CP;
- noSymPerSlot = 7;
- cell->splSubfrmCfg.dwPts =
- rgSchTddSplSubfrmInfoTbl[splSubfrmIdx].norDlDwPts;
- cell->isDwPtsCnted = TRUE;
-
- if(cfg->isCpUlExtend == TRUE)
- {
- cell->splSubfrmCfg.upPts =
- rgSchTddSplSubfrmInfoTbl[splSubfrmIdx].norDlExtUpPts;
- }
- else
- {
- cell->splSubfrmCfg.upPts =
- rgSchTddSplSubfrmInfoTbl[splSubfrmIdx].norDlNorUpPts;
- }
- }
-
- /* Initializing the cqiToEffTbl and cqiToTbsTbl for every CFI value */
- for(cfi = 1; cfi < RG_SCH_CMN_MAX_CFI; cfi++,cfiIdx++)
- {
- cellSch->dl.cqiToTbsTbl[0][cfi] = rgSchCmnCqiToTbs[0][cp][cfiIdx];
- cellSch->dl.cqiToEffTbl[0][cfi] = rgSchCmnEffTbl[0][cp][rgSchCmnAntIdx\
- [cell->numTxAntPorts]][cfiIdx];
- cellSch->dl.cqiToTbsTbl[1][cfi] = rgSchCmnCqiToTbs[1][cp][cfiIdx];
- cellSch->dl.cqiToEffTbl[1][cfi] = rgSchCmnEffTbl[1][cp][rgSchCmnAntIdx\
- [cell->numTxAntPorts]][cfiIdx];
- }
-
- /* Initializing the values of CFI parameters */
- if(cell->dynCfiCb.isDynCfiEnb)
- {
- /* If DCFI is enabled, current CFI value will start from 1 */
- cellSch->dl.currCfi = cellSch->dl.newCfi = 1;
- }
- else
- {
- /* If DCFI is disabled, current CFI value is set as default max allowed CFI value */
- cellSch->dl.currCfi = RGSCH_MIN(cell->dynCfiCb.maxCfi, cellSch->cfiCfg.cfi);
- cellSch->dl.newCfi = cellSch->dl.currCfi;
- }
-
- /* Include CRS REs while calculating Efficiency
- * The number of Resource Elements occupied by CRS depends on Number of
- * Antenna Ports. Please refer to Section 6.10.1 of 3GPP TS 36.211 V8.8.0.
- * Also, please refer to Figures 6.10.1.2-1 and 6.10.1.2-2 for diagrammatic
- * details of the same. Please note that PDCCH overlap symbols would not
- * considered in CRS REs deduction */
- for (cfi = 1; cfi < RG_SCH_CMN_MAX_CFI; cfi++, numPdcchSym++)
- {
- cellSch->dl.noResPerRb[cfi] = (((noSymPerSlot * RG_SCH_CMN_NUM_SLOTS_PER_SF)
- - numPdcchSym) *RB_SCH_CMN_NUM_SCS_PER_RB) - rgSchCmnNumResForCrs[cell->numTxAntPorts];
- }
-
- /* DwPTS Scheduling Changes Start */
- antPortIdx = (cell->numTxAntPorts == 1)? 0:
- ((cell->numTxAntPorts == 2)? 1: 2);
-
- if (cp == RG_SCH_CMN_NOR_CP)
- {
- splSfIdx = (splSubfrmIdx == 4)? 1: 0;
- }
- else
- {
- splSfIdx = (splSubfrmIdx == 3)? 1: 0;
- }
-
- numCrs = rgSchCmnDwptsCrs[splSfIdx][antPortIdx];
-
- for (cfi = 1; cfi < RG_SCH_CMN_MAX_CFI-1; cfi++)
- {
- /* If CFI is 2 and Ant Port is 4, don't consider the sym 1 CRS REs */
- if (antPortIdx == 2 && cfi == 2)
- {
- numCrs -= 4;
- }
- cellSch->dl.numReDwPts[cfi] = ((cell->splSubfrmCfg.dwPts - cfi)*
- RB_SCH_CMN_NUM_SCS_PER_RB) - numCrs;
- }
- /* DwPTS Scheduling Changes End */
-
- if (cfg->maxDlBwPerUe == 0)
- {
- cellSch->dl.maxDlBwPerUe = RG_SCH_CMN_MAX_DL_BW_PERUE;
- }
- else
- {
- cellSch->dl.maxDlBwPerUe = cfg->maxDlBwPerUe;
- }
- if (cfg->maxDlRetxBw == 0)
- {
- cellSch->dl.maxDlRetxBw = RG_SCH_CMN_MAX_DL_RETX_BW;
- }
- else
- {
- cellSch->dl.maxDlRetxBw = cfg->maxDlRetxBw;
- }
- /* Fix: MUE_PERTTI_DL*/
- cellSch->dl.maxUePerDlSf = cfg->maxUePerDlSf;
- cellSch->dl.maxUeNewTxPerTti = cfg->maxDlUeNewTxPerTti;
- if (cfg->maxUePerDlSf == 0)
- {
- cellSch->dl.maxUePerDlSf = RG_SCH_CMN_MAX_UE_PER_DL_SF;
- }
- RG_SCH_RESET_HCSG_DL_PRB_CNTR(&cellSch->dl);
- /*[ccpu00138609]-ADD- Configure the Max CCCH Counter */
- if (cfg->maxCcchPerDlSf > cfg->maxUePerDlSf)
- {
- DU_LOG("\nERROR --> SCH : Invalid configuration !: "
- "maxCcchPerDlSf %u > maxUePerDlSf %u",
- cfg->maxCcchPerDlSf, cfg->maxUePerDlSf );
-
- return RFAILED;
- }
- else if (!cfg->maxCcchPerDlSf)
- {
- /* ccpu00143032: maxCcchPerDlSf 0 means not configured by application
- * hence setting to maxUePerDlSf. If maxCcchPerDlSf is 0 then scheduler
- * does't consider CCCH allocation in MaxUePerTti cap. Hence more than
- * 4UEs getting schduled & SCH expects >16 Hq PDUs in a TTI which causes
- * FLE crash in PHY as PHY has limit of 16 max*/
- cellSch->dl.maxCcchPerDlSf = cfg->maxUePerDlSf;
- }
- else
- {
- cellSch->dl.maxCcchPerDlSf = cfg->maxCcchPerDlSf;
- }
- if (rgSCHCmnDlCnsdrCmnRt(cell, &cfg->dlCmnCodeRate) != ROK)
- {
- return RFAILED;
- }
-
- /*ccpu00118273 - ADD - start */
- cmLListInit(&cellSch->dl.msg4RetxLst);
-#ifdef RGR_V1
- cmLListInit(&cellSch->dl.ccchSduRetxLst);
-#endif
-
-#ifdef RG_PHASE2_SCHED
- if (cellSch->apisDlfs == NULLP) /* DFLS specific initialization */
- {
- cellSch->apisDlfs = &rgSchDlfsSchdTbl[cfg->dlfsSchdType];
- }
- if (cfg->dlfsCfg.isDlFreqSel)
- {
- ret = cellSch->apisDlfs->rgSCHDlfsCellCfg(cell, cfg, err);
- if (ret != ROK)
- {
- return RFAILED;
- }
- }
- cellSch->dl.isDlFreqSel = cfg->dlfsCfg.isDlFreqSel;
-#endif
-
- /* Power related configuration */
- ret = rgSCHPwrCellCfg(cell, cfg);
- if (ret != ROK)
- {
- return RFAILED;
- }
-
- cellSch->dl.bcchTxPwrOffset = cfg->bcchTxPwrOffset;
- cellSch->dl.pcchTxPwrOffset = cfg->pcchTxPwrOffset;
- cellSch->dl.rarTxPwrOffset = cfg->rarTxPwrOffset;
- cellSch->dl.phichTxPwrOffset = cfg->phichTxPwrOffset;
- cellSch->dl.msg4pAVal = cfg->msg4pAVal;
- return ROK;
-}
-#else /* LTE_TDD */
-/**
- * @brief This function handles the configuration of cell for the first
- * time by the scheduler.
- *
- * @details
- *
- * Function: rgSCHCmnDlRgrCellCfg
- * Purpose: Configuration received is stored into the data structures
- * Also, update the scheduler with the number of frames of
- * RACH preamble transmission.
- *
- * Invoked by: BO and Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgrCellCfg* cfg
- * @param[in] RgSchErrInfo* err
- * @return S16
- *
- **/
-static S16 rgSCHCmnDlRgrCellCfg(RgSchCellCb *cell,RgrCellCfg *cfg,RgSchErrInfo *err)
-{
- S16 ret;
- RgSchCmnCell *cellSch;
- uint8_t cp;
- uint8_t numPdcchSym;
- uint8_t noSymPerSlot;
- uint8_t cfi;
- uint8_t cfiIdx;
-
-
- cellSch = RG_SCH_CMN_GET_CELL(cell);
-
- /* Initialize the parameters with the ones received in the */
- /* configuration. */
-
- /* Added matrix 'rgRaPrmblToRaFrmTbl' for computation of RA
- * sub-frames from preamble format */
- cellSch->dl.numRaSubFrms = rgRaPrmblToRaFrmTbl[cell->rachCfg.preambleFormat];
-
- /*[ccpu00138532]-ADD-fill the Msg4 Harq data */
- cell->dlHqCfg.maxMsg4HqTx = cfg->dlHqCfg.maxMsg4HqTx;
-
- /* Msg4 Tx Delay = (HARQ_RTT * MAX_MSG4_HARQ_RETX) +
- 3 TTI (MAX L1+L2 processing delay at the UE) */
- cellSch->dl.msg4TxDelay = (cfg->dlHqCfg.maxMsg4HqTx-1) *
- rgSchCmnHarqRtt[7] + 3;
-
- if (cell->bwCfg.dlTotalBw <= 10)
- {
- cfiIdx = 1;
- numPdcchSym = 2;
- }
- else
- {
- cfiIdx = 0;
- numPdcchSym = 1;
- }
-
- if (cell->isCpDlExtend == TRUE)
- {
- cp = RG_SCH_CMN_EXT_CP;
- noSymPerSlot = 6;
- }
- else
- {
- cp = RG_SCH_CMN_NOR_CP;
- noSymPerSlot = 7;
- }
-
- /* Initializing the cqiToEffTbl and cqiToTbsTbl for every CFI value */
- for(cfi = 1; cfi < RG_SCH_CMN_MAX_CFI; cfi++, cfiIdx++)
- {
- cellSch->dl.cqiToTbsTbl[0][cfi] = rgSchCmnCqiToTbs[0][cp][cfiIdx];
-#ifdef EMTC_ENABLE
- cellSch->dl.emtcCqiToTbsTbl[0][cfi] = rgSchEmtcCmnCqiToTbs[0][cp][cfiIdx];
-#endif
- cellSch->dl.cqiToEffTbl[0][cfi] = rgSchCmnEffTbl[0][cp][rgSchCmnAntIdx\
- [cell->numTxAntPorts]][cfiIdx];
- cellSch->dl.cqiToTbsTbl[1][cfi] = rgSchCmnCqiToTbs[1][cp][cfiIdx];
-#ifdef EMTC_ENABLE
- cellSch->dl.emtcCqiToTbsTbl[1][cfi] = rgSchEmtcCmnCqiToTbs[1][cp][cfiIdx];
-#endif
- cellSch->dl.cqiToEffTbl[1][cfi] = rgSchCmnEffTbl[1][cp][rgSchCmnAntIdx\
- [cell->numTxAntPorts]][cfiIdx];
- }
-
- /* Initializing the values of CFI parameters */
- if(cell->dynCfiCb.isDynCfiEnb)
- {
- /* If DCFI is enabled, current CFI value will start from 1 */
- cellSch->dl.currCfi = cellSch->dl.newCfi = 1;
- }
- else
- {
- /* If DCFI is disabled, current CFI value is set as default CFI value */
- cellSch->dl.currCfi = cellSch->cfiCfg.cfi;
- cellSch->dl.newCfi = cellSch->dl.currCfi;
- }
-
- /* Include CRS REs while calculating Efficiency
- * The number of Resource Elements occupied by CRS depends on Number of
- * Antenna Ports. Please refer to Section 6.10.1 of 3GPP TS 36.211 V8.8.0.
- * Also, please refer to Figures 6.10.1.2-1 and 6.10.1.2-2 for diagrammatic
- * details of the same. Please note that PDCCH overlap symbols would not
- * considered in CRS REs deduction */
- for (cfi = 1; cfi < RG_SCH_CMN_MAX_CFI; cfi++, numPdcchSym++)
- {
- cellSch->dl.noResPerRb[cfi] = (((noSymPerSlot * RG_SCH_CMN_NUM_SLOTS_PER_SF)
- - numPdcchSym) * RB_SCH_CMN_NUM_SCS_PER_RB) - rgSchCmnNumResForCrs[cell->numTxAntPorts];
- }
-
- if (cfg->maxDlBwPerUe == 0)
- {
- cellSch->dl.maxDlBwPerUe = RG_SCH_CMN_MAX_DL_BW_PERUE;
- }
- else
- {
- cellSch->dl.maxDlBwPerUe = cfg->maxDlBwPerUe;
- }
- if (cfg->maxDlRetxBw == 0)
- {
- cellSch->dl.maxDlRetxBw = RG_SCH_CMN_MAX_DL_RETX_BW;
- }
- else
- {
- cellSch->dl.maxDlRetxBw = cfg->maxDlRetxBw;
- }
-
- /* Fix: MUE_PERTTI_DL*/
- cellSch->dl.maxUePerDlSf = cfg->maxUePerDlSf;
- cellSch->dl.maxUeNewTxPerTti = cfg->maxDlUeNewTxPerTti;
- if (cfg->maxUePerDlSf == 0)
- {
- cellSch->dl.maxUePerDlSf = RG_SCH_CMN_MAX_UE_PER_DL_SF;
- }
- /* Fix: MUE_PERTTI_DL syed validating Cell Configuration */
- if (cellSch->dl.maxUePerDlSf < cellSch->dl.maxUeNewTxPerTti)
- {
- DU_LOG("\nERROR --> SCH : FAILED MaxUePerDlSf(%u) < MaxDlUeNewTxPerTti(%u)",
- cellSch->dl.maxUePerDlSf,
- cellSch->dl.maxUeNewTxPerTti);
- return RFAILED;
- }
- /*[ccpu00138609]-ADD- Configure the Max CCCH Counter */
- if (cfg->maxCcchPerDlSf > cfg->maxUePerDlSf)
- {
- DU_LOG("\nERROR --> SCH : Invalid configuration !: "
- "maxCcchPerDlSf %u > maxUePerDlSf %u",
- cfg->maxCcchPerDlSf, cfg->maxUePerDlSf );
-
- return RFAILED;
- }
- else if (!cfg->maxCcchPerDlSf)
- {
- /* ccpu00143032: maxCcchPerDlSf 0 means not configured by application
- * hence setting to maxUePerDlSf. If maxCcchPerDlSf is 0 then scheduler
- * does't consider CCCH allocation in MaxUePerTti cap. Hence more than
- * 4UEs getting schduled & SCH expects >16 Hq PDUs in a TTI which causes
- * FLE crash in PHY as PHY has limit of 16 max*/
- cellSch->dl.maxCcchPerDlSf = cfg->maxUePerDlSf;
- }
- else
- {
- cellSch->dl.maxCcchPerDlSf = cfg->maxCcchPerDlSf;
- }
-
-
- if (rgSCHCmnDlCnsdrCmnRt(cell, &cfg->dlCmnCodeRate) != ROK)
- {
- return RFAILED;
- }
- cmLListInit(&cellSch->dl.msg4RetxLst);
-#ifdef RGR_V1
- cmLListInit(&cellSch->dl.ccchSduRetxLst);
-#endif
-
-#ifdef RG_PHASE2_SCHED
- if (cellSch->apisDlfs == NULLP) /* DFLS specific initialization */
- {
- cellSch->apisDlfs = &rgSchDlfsSchdTbl[cfg->dlfsSchdType];
- }
- if (cfg->dlfsCfg.isDlFreqSel)
- {
- ret = cellSch->apisDlfs->rgSCHDlfsCellCfg(cell, cfg, err);
- if (ret != ROK)
- {
- return RFAILED;
- }
- }
- cellSch->dl.isDlFreqSel = cfg->dlfsCfg.isDlFreqSel;
-#endif
-
- /* Power related configuration */
- ret = rgSCHPwrCellCfg(cell, cfg);
- if (ret != ROK)
- {
- return RFAILED;
- }
-
- cellSch->dl.bcchTxPwrOffset = cfg->bcchTxPwrOffset;
- cellSch->dl.pcchTxPwrOffset = cfg->pcchTxPwrOffset;
- cellSch->dl.rarTxPwrOffset = cfg->rarTxPwrOffset;
- cellSch->dl.phichTxPwrOffset = cfg->phichTxPwrOffset;
- RG_SCH_RESET_HCSG_DL_PRB_CNTR(&cellSch->dl);
- return ROK;
-}
-#endif /* LTE_TDD */
-
-/***********************************************************
- *
- * Func : rgSCHCmnUlCalcReqRbCeil
- *
- * Desc : Calculate RB required to satisfy 'bytes' for
- * a given CQI.
- * Returns number of RBs such that requirement
- * is necessarily satisfied (does a 'ceiling'
- * computation).
- *
- * Ret : Required RBs (uint8_t)
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-uint8_t rgSCHCmnUlCalcReqRbCeil(uint32_t bytes,uint8_t cqi,RgSchCmnUlCell *cellUl)
-{
- uint32_t numRe = RGSCH_CEIL((bytes * 8) * 1024, rgSchCmnUlCqiTbl[cqi].eff);
- return ((uint8_t)RGSCH_CEIL(numRe, RG_SCH_CMN_UL_NUM_RE_PER_RB(cellUl)));
-}
-
-/***********************************************************
- *
- * Func : rgSCHCmnPrecompMsg3Vars
- *
- * Desc : Precomputes the following for msg3 allocation:
- * 1. numSb and Imcs for msg size A
- * 2. numSb and Imcs otherwise
- *
- * Ret :
- *
- * Notes: The corresponding vars in cellUl struct is filled
- * up
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCmnPrecompMsg3Vars(RgSchCmnUlCell *cellUl,uint8_t ccchCqi,uint16_t msgSzA,uint8_t sbSize,Bool isEcp)
-{
- uint8_t numSb;
- uint8_t ccchTbs;
- uint8_t ccchMcs;
- uint8_t numRb = 0;
- uint8_t iTbs = 0;
- uint16_t msg3GrntSz = 0;
-
-
- if (ccchCqi > cellUl->max16qamCqi)
- {
- ccchCqi = cellUl->max16qamCqi;
- }
-/* #ifndef RG_SCH_CMN_EXP_CP_SUP For ECP Pick the index 1 */
- /* Fix */
- ccchTbs = rgSchCmnUlCqiToTbsTbl[(uint8_t)isEcp][ccchCqi];
- ccchMcs = rgSCHCmnUlGetIMcsFrmITbs(ccchTbs, CM_LTE_UE_CAT_1);
-
- /* MCS should fit in 4 bits in RAR */
- if (ccchMcs >= 15)
- {
- ccchMcs = 15;
- }
-
- /* Limit the ccchMcs to 15 as it
- * can be inferred from 36.213, section 6.2 that msg3 imcs
- * field is 4 bits.
- * Since, UE doesn't exist right now, we use CAT_1 for ue
- * category*/
- while((ccchMcs = (rgSCHCmnUlGetIMcsFrmITbs(
- rgSchCmnUlCqiToTbsTbl[(uint8_t)isEcp][ccchCqi],CM_LTE_UE_CAT_1))
- ) >
- RG_SCH_CMN_MAX_MSG3_IMCS)
- {
- ccchCqi--;
- }
-
- iTbs = rgSchCmnUlCqiToTbsTbl[(uint8_t)isEcp][ccchCqi];
-
- if (msgSzA < RGSCH_MIN_MSG3_GRNT_SZ)
- {
- return RFAILED;
- }
- numSb = RGSCH_CEIL(rgSCHCmnUlCalcReqRbCeil(msgSzA, ccchCqi, cellUl), sbSize);
-
- numRb = numSb * sbSize;
- msg3GrntSz = 8 * msgSzA;
-
- while( (rgTbSzTbl[0][iTbs][numRb - 1]) < msg3GrntSz)
- {
- ++numSb;
- numRb = numSb * sbSize;
- }
- while (rgSchCmnMult235Tbl[numSb].match != numSb)
- {
- ++numSb;
- }
- /* Reversed(Corrected) the assignment for preamble-GrpA
- * Refer- TG36.321- section- 5.1.2*/
- cellUl->ra.prmblBNumSb = numSb;
- cellUl->ra.prmblBIMcs = ccchMcs;
- numSb = RGSCH_CEIL(rgSCHCmnUlCalcReqRbCeil(RGSCH_MIN_MSG3_GRNT_SZ, \
- ccchCqi, cellUl),
- sbSize);
-
- numRb = numSb * sbSize;
- msg3GrntSz = 8 * RGSCH_MIN_MSG3_GRNT_SZ;
- while( (rgTbSzTbl[0][iTbs][numRb - 1]) < msg3GrntSz)
- {
- ++numSb;
- numRb = numSb * sbSize;
- }
- while (rgSchCmnMult235Tbl[numSb].match != numSb)
- {
- ++numSb;
- }
- /* Reversed(Corrected) the assignment for preamble-GrpA
- * Refer- TG36.321- section- 5.1.2*/
- cellUl->ra.prmblANumSb = numSb;
- cellUl->ra.prmblAIMcs = ccchMcs;
- return ROK;
-}
-
-uint32_t gPrntPucchDet=0;
-
-#ifdef LTE_TDD
-/***********************************************************
- *
- * Func : rgSCHCmnUlCalcAvailBw
- *
- * Desc : Calculates bandwidth available for PUSCH scheduling.
- *
- * Ret : S16 (ROK/RFAILED)
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCmnUlCalcAvailBw(RgSchCellCb *cell,RgrCellCfg *cellCfg,uint8_t cfi,uint8_t *rbStartRef,uint8_t *bwAvailRef)
-{
- uint8_t c = 3;
- uint8_t ulBw = cell->bwCfg.ulTotalBw;
- uint8_t n2Rb = cell->pucchCfg.resourceSize;
- uint8_t pucchDeltaShft = cell->pucchCfg.deltaShift;
- uint16_t n1Pucch = cell->pucchCfg.n1PucchAn;
- uint8_t n1Cs = cell->pucchCfg.cyclicShift;
- uint8_t n1PerRb;
- uint8_t totalCce;
- uint16_t n1Max;
- uint8_t n1Rb;
- uint32_t mixedRb;
- uint8_t exclRb; /* RBs to exclude */
- uint8_t n1RbPart;
- uint8_t puschRbStart;
- /* To avoid PUCCH and PUSCH collision issue */
- uint8_t P;
- uint8_t n1PlusOne;
- uint8_t mi;
- /* Maximum value of M as per Table 10.1-1 */
- uint8_t M[RGSCH_MAX_TDD_UL_DL_CFG] = {1, 2, 4, 3, 4, 9, 1};
-
-
- if (cell->isCpUlExtend)
- {
- c = 2;
- }
-
- n1PerRb = c * 12 / pucchDeltaShft; /* 12/18/36 */
-
- /* Considering the max no. of CCEs for PUSCH BW calculation
- * based on min mi value */
- if (cell->ulDlCfgIdx == 0 || cell->ulDlCfgIdx == 6)
- {
- mi = 1;
- }
- else
- {
- mi = 0;
- }
-
- totalCce = cell->dynCfiCb.cfi2NCceTbl[mi][cfi];
-
- P = rgSCHCmnGetPValFrmCCE(cell, totalCce-1);
- n1PlusOne = cell->rgSchTddNpValTbl[P + 1];
- n1Max = (M[cell->ulDlCfgIdx] - 1)*n1PlusOne + (totalCce-1) + n1Pucch;
-
- /* ccpu00129978- MOD- excluding RBs based on formula in section 5.4.3 in
- * TS 36.211 */
- n1RbPart = (c*n1Cs)/pucchDeltaShft;
- n1Rb = (n1Max - n1RbPart)/ n1PerRb;
- mixedRb = RGSCH_CEIL(n1Cs, 8); /* same as 'mixedRb = n1Cs ? 1 : 0' */
-
- /* get the total Number of RB's to be excluded for PUSCH */
- /* ccpu00137339 */
- if(n1Pucch < n1RbPart)
- {
- exclRb = n2Rb;
- }
- else
- {
- exclRb = n2Rb + mixedRb + n1Rb; /* RBs to exclude */
- }
- puschRbStart = exclRb/2 + 1;
-
- /* Num of PUCCH RBs = puschRbStart*2 */
- if (puschRbStart * 2 >= ulBw)
- {
- DU_LOG("\nERROR --> SCH : No bw available for PUSCH");
- return RFAILED;
- }
-
- *rbStartRef = puschRbStart;
- *bwAvailRef = ulBw - puschRbStart * 2;
-
- if(cell->pucchCfg.maxPucchRb !=0 &&
- (puschRbStart * 2 > cell->pucchCfg.maxPucchRb))
- {
- cell->dynCfiCb.maxCfi = RGSCH_MIN(cfi-1, cell->dynCfiCb.maxCfi);
- }
-
- return ROK;
-}
-#else
-
-/***********************************************************
- *
- * Func : rgSCHCmnUlCalcAvailBw
- *
- * Desc : Calculates bandwidth available for PUSCH scheduling.
- *
- * Ret : S16 (ROK/RFAILED)
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCmnUlCalcAvailBw(RgSchCellCb *cell,RgrCellCfg *cellCfg,uint8_t cfi,uint8_t *rbStartRef,uint8_t *bwAvailRef)
-{
- uint8_t c = 3;
- uint8_t ulBw = cell->bwCfg.ulTotalBw;
- uint8_t n2Rb = cell->pucchCfg.resourceSize;
- uint8_t pucchDeltaShft = cell->pucchCfg.deltaShift;
- uint16_t n1Pucch = cell->pucchCfg.n1PucchAn;
- uint8_t n1Cs = cell->pucchCfg.cyclicShift;
- uint8_t n1PerRb;
- uint8_t totalCce;
- uint16_t n1Max;
- uint8_t n1Rb;
- uint32_t mixedRb;
- uint8_t exclRb; /* RBs to exclude */
- uint8_t n1RbPart;
- uint8_t puschRbStart;
-#ifdef LTE_ADV
- uint16_t numOfN3PucchRb;
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-#endif
-
-
- if (cell->isCpUlExtend)
- {
- c = 2;
- }
-
- n1PerRb = c * 12 / pucchDeltaShft; /* 12/18/36 */
-
- totalCce = cell->dynCfiCb.cfi2NCceTbl[0][cfi];
-
- n1Max = n1Pucch + totalCce-1;
-
- /* ccpu00129978- MOD- excluding RBs based on formula in section 5.4.3 in
- * TS 36.211 */
- n1RbPart = (c*n1Cs)/pucchDeltaShft;
- n1Rb = (uint8_t)((n1Max - n1RbPart) / n1PerRb);
- mixedRb = RGSCH_CEIL(n1Cs, 8); /* same as 'mixedRb = n1Cs ? 1 : 0' */
-
- /* get the total Number of RB's to be excluded for PUSCH */
- /* ccpu00137339 */
- if(n1Pucch < n1RbPart)
- {
- exclRb = n2Rb;
- }
- else
- {
- exclRb = n2Rb + mixedRb + n1Rb; /* RBs to exclude */
- }
- /*Support for PUCCH Format 3*/
-#ifdef LTE_ADV
- if (cell->isPucchFormat3Sptd)
- {
- numOfN3PucchRb = RGSCH_CEIL(cellSch->dl.maxUePerDlSf,5);
- exclRb = exclRb + numOfN3PucchRb;
- }
-#endif
- puschRbStart = exclRb/2 + 1;
-
- if(gPrntPucchDet)
- {
-#ifndef ALIGN_64BIT
- DU_LOG("\nDEBUG --> SCH : CA_DBG:: puschRbStart:n1Rb:mixedRb:n1PerRb:totalCce:n1Max:n1RbPart:n2Rb::[%d:%d] [%d:%d:%ld:%d:%d:%d:%d:%d]\n",
- cell->crntTime.sfn, cell->crntTime.slot, puschRbStart, n1Rb, mixedRb,n1PerRb, totalCce, n1Max, n1RbPart, n2Rb);
-#else
- DU_LOG("\nDEBUG --> SCH : CA_DBG:: puschRbStart:n1Rb:mixedRb:n1PerRb:totalCce:n1Max:n1RbPart:n2Rb::[%d:%d] [%d:%d:%d:%d:%d:%d:%d:%d]\n",
- cell->crntTime.sfn, cell->crntTime.slot, puschRbStart, n1Rb, mixedRb,n1PerRb, totalCce, n1Max, n1RbPart, n2Rb);
-#endif
- }
-
- if (puschRbStart*2 >= ulBw)
- {
- DU_LOG("\nERROR --> SCH : No bw available for PUSCH");
- return RFAILED;
- }
-
- *rbStartRef = puschRbStart;
- *bwAvailRef = ulBw - puschRbStart * 2;
-
- if(cell->pucchCfg.maxPucchRb !=0 &&
- (puschRbStart * 2 > cell->pucchCfg.maxPucchRb))
- {
- cell->dynCfiCb.maxCfi = RGSCH_MIN(cfi-1, cell->dynCfiCb.maxCfi);
- }
-
- return ROK;
-}
-#endif
-
-
-
-/***********************************************************
- *
- * Func : rgSCHCmnUlCellInit
- *
- * Desc : Uplink scheduler initialisation for cell.
- *
- * Ret : S16
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCmnUlCellInit(RgSchCellCb *cell,RgrCellCfg *cellCfg)
-{
- S16 ret;
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- uint8_t maxUePerUlSf = cellCfg->maxUePerUlSf;
-#ifdef RGR_V1
- /* Added configuration for maximum number of MSG3s */
- uint8_t maxMsg3PerUlSf = cellCfg->maxMsg3PerUlSf;
-#endif
- uint8_t maxUlBwPerUe = cellCfg->maxUlBwPerUe;
- uint8_t sbSize = cellCfg->puschSubBand.size;
- uint8_t i;
- uint8_t rbStart;
- uint8_t bwAvail;
- uint8_t cfi;
- uint8_t maxSbPerUe;
- uint8_t numSb;
-#ifdef LTE_TDD
- uint16_t ulDlCfgIdx = cell->ulDlCfgIdx;
- /* [ccpu00127294]-MOD-Change the max Ul subfrms size in TDD */
- uint8_t maxSubfrms = 2 * rgSchTddNumUlSf[ulDlCfgIdx];
- uint8_t ulToDlMap[12] = {0}; /* maximum 6 Subframes in UL * 2 */
- uint8_t maxUlsubfrms = rgSchTddNumUlSubfrmTbl[ulDlCfgIdx]\
- [RGSCH_NUM_SUB_FRAMES-1];
- uint16_t subfrm;
- S8 dlIdx;
-#else
- uint8_t maxSubfrms = RG_SCH_CMN_UL_NUM_SF;
-#endif
-#ifdef LTE_L2_MEAS
- uint8_t idx;
-#endif
- uint8_t iTbs;
-#if (defined(LTE_L2_MEAS) )
- Inst inst = cell->instIdx;
-#endif /* #if (defined(LTE_L2_MEAS) || defined(DEBUGP) */
- RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch);
-
-
- cellUl->maxUeNewTxPerTti = cellCfg->maxUlUeNewTxPerTti;
- if (maxUePerUlSf == 0)
- {
- maxUePerUlSf = RG_SCH_CMN_MAX_UE_PER_UL_SF;
- }
-#ifdef RGR_V1
- if (maxMsg3PerUlSf == 0)
- {
- maxMsg3PerUlSf = RG_SCH_CMN_MAX_MSG3_PER_UL_SF;
- }
- /* fixed the problem while sending raRsp
- * if maxMsg3PerUlSf is greater than
- * RGSCH_MAX_RNTI_PER_RARNTI
- * */
- if(maxMsg3PerUlSf > RGSCH_MAX_RNTI_PER_RARNTI)
- {
- maxMsg3PerUlSf = RGSCH_MAX_RNTI_PER_RARNTI;
- }
-
- if(maxMsg3PerUlSf > maxUePerUlSf)
- {
- maxMsg3PerUlSf = maxUePerUlSf;
- }
-
- /*cellUl->maxAllocPerUlSf = maxUePerUlSf + maxMsg3PerUlSf;*/
- /*Max MSG3 should be a subset of Max UEs*/
- cellUl->maxAllocPerUlSf = maxUePerUlSf;
- cellUl->maxMsg3PerUlSf = maxMsg3PerUlSf;
-#else
- cellUl->maxAllocPerUlSf = maxUePerUlSf;
-#endif
- /* Fix: MUE_PERTTI_UL syed validating Cell Configuration */
- if (cellUl->maxAllocPerUlSf < cellUl->maxUeNewTxPerTti)
- {
- DU_LOG("\nERROR --> SCH : FAILED: MaxUePerUlSf(%u) < MaxUlUeNewTxPerTti(%u)",
- cellUl->maxAllocPerUlSf,
- cellUl->maxUeNewTxPerTti);
- return RFAILED;
- }
-
-#ifdef LTE_L2_MEAS
-#ifdef LTE_TDD
- for(idx = 0; idx < RGSCH_SF_ALLOC_SIZE; idx++)
-#else
- for(idx = 0; idx < RGSCH_NUM_SUB_FRAMES; idx++)
-#endif
- {
-
- ret = rgSCHUtlAllocSBuf(inst, (Data **)&(cell->sfAllocArr[idx].
- ulUeInfo.ulAllocInfo), (cellUl->maxAllocPerUlSf * sizeof(RgInfUeUlAlloc)));
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Memory allocation failed ");
- return (ret);
- }
- }
-#endif
- if (maxUlBwPerUe == 0)
- {
- /* ccpu00139362- Setting to configured UL BW instead of MAX BW(100)*/
- maxUlBwPerUe = cell->bwCfg.ulTotalBw;
- }
- cellUl->maxUlBwPerUe = maxUlBwPerUe;
-
- /* FOR RG_SCH_CMN_EXT_CP_SUP */
- if (!cellCfg->isCpUlExtend)
- {
- cellUl->ulNumRePerRb = 12 * (14 - RGSCH_UL_SYM_DMRS_SRS);
- }
- else
- {
- cellUl->ulNumRePerRb = 12 * (12 - RGSCH_UL_SYM_DMRS_SRS);
- }
-
- if (sbSize != rgSchCmnMult235Tbl[sbSize].match)
- {
- DU_LOG("\nERROR --> SCH : Invalid subband size %d", sbSize);
- return RFAILED;
- }
- //Setting the subband size to 4 which is size of VRBG in 5GTF
-#ifdef RG_5GTF
- sbSize = MAX_5GTF_VRBG_SIZE;
-#endif
-
- maxSbPerUe = maxUlBwPerUe / sbSize;
- if (maxSbPerUe == 0)
- {
- DU_LOG("\nERROR --> SCH : rgSCHCmnUlCellInit(): "
- "maxUlBwPerUe/sbSize is zero");
- return RFAILED;
- }
- cellUl->maxSbPerUe = rgSchCmnMult235Tbl[maxSbPerUe].prvMatch;
-
- /* CQI related updations */
- if ((!RG_SCH_CMN_UL_IS_CQI_VALID(cellCfg->ulCmnCodeRate.ccchCqi))
- || (!RG_SCH_CMN_UL_IS_CQI_VALID(cellCfg->trgUlCqi.trgCqi)))
- {
- DU_LOG("\nERROR --> SCH : rgSCHCmnUlCellInit(): "
- "Invalid cqi");
- return RFAILED;
- }
- cellUl->dfltUlCqi = cellCfg->ulCmnCodeRate.ccchCqi;
-
- /* Changed the logic to determine maxUlCqi.
- * For a 16qam UE, maxUlCqi is the CQI Index at which
- * efficiency is as close as possible to RG_SCH_MAX_CODE_RATE_16QAM
- * Refer to 36.213-8.6.1 */
- for (i = RG_SCH_CMN_UL_NUM_CQI - 1;i > 0; --i)
- {
- DU_LOG("\nINFO --> SCH : CQI %u:iTbs %u",i,
- rgSchCmnUlCqiToTbsTbl[cell->isCpUlExtend][i]);
-#ifdef MAC_SCH_STATS
- /* ccpu00128489 ADD Update mcs in hqFailStats here instead of at CRC
- * since CQI to MCS mapping does not change. The only exception is for
- * ITBS = 19 where the MCS can be 20 or 21 based on the UE cat. We
- * choose 20, instead of 21, ie UE_CAT_3 */
- iTbs = rgSchCmnUlCqiToTbsTbl[cell->isCpUlExtend][i];
- RG_SCH_CMN_UL_TBS_TO_MCS(iTbs, hqFailStats.ulCqiStat[i - 1].mcs);
-#endif
- }
- for (i = RG_SCH_CMN_UL_NUM_CQI - 1; i != 0; --i)
- {
- /* Fix for ccpu00123912*/
- iTbs = rgSchCmnUlCqiToTbsTbl[cell->isCpUlExtend][i];
- if (iTbs <= RGSCH_UL_16QAM_MAX_ITBS) /* corresponds to 16QAM */
- {
- DU_LOG("\nINFO --> SCH : 16 QAM CQI %u", i);
- cellUl->max16qamCqi = i;
- break;
- }
- }
-
-#ifdef EMTC_ENABLE
- /* Precompute useful values for RA msg3 */
- ret = rgSCHCmnPrecompEmtcMsg3Vars(cellUl, cellCfg->ulCmnCodeRate.ccchCqi,
- cell->rachCfg.msgSizeGrpA, sbSize, cell->isCpUlExtend);
- if (ret != ROK)
- {
- return (ret);
- }
-#endif
-
- /* Precompute useful values for RA msg3 */
- ret = rgSCHCmnPrecompMsg3Vars(cellUl, cellCfg->ulCmnCodeRate.ccchCqi,
- cell->rachCfg.msgSizeGrpA, sbSize, cell->isCpUlExtend);
- if (ret != ROK)
- {
- return (ret);
- }
-
- cellUl->sbSize = sbSize;
-
-#ifdef LTE_TDD
- cellUl->numUlSubfrms = maxSubfrms;
-
- ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&cellUl->ulSfArr,
- cellUl->numUlSubfrms * sizeof(RgSchUlSf));
-
- if (ret != ROK)
- {
- cellUl->numUlSubfrms = 0;
- return (ret);
- }
-
- /* store the DL subframe corresponding to the PUSCH offset
- * in their respective UL subframe */
- for(i=0; i < RGSCH_NUM_SUB_FRAMES; i++)
- {
- if(rgSchTddPuschTxKTbl[ulDlCfgIdx][i] != 0)
- {
- subfrm = (i + rgSchTddPuschTxKTbl[ulDlCfgIdx][i]) % \
- RGSCH_NUM_SUB_FRAMES;
- subfrm = rgSchTddNumUlSubfrmTbl[ulDlCfgIdx][subfrm]-1;
- dlIdx = rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][i]-1;
- RGSCH_ARRAY_BOUND_CHECK( cell->instIdx, ulToDlMap, subfrm);
- ulToDlMap[subfrm] = dlIdx;
- }
- }
- /* Copy the information in the remaining UL subframes based
- * on number of HARQ processes */
- for(i=maxUlsubfrms; i < maxSubfrms; i++)
- {
- subfrm = i-maxUlsubfrms;
- RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, ulToDlMap, i);
- RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, ulToDlMap, subfrm)
- ulToDlMap[i] = ulToDlMap[subfrm];
- }
-#endif
-
- for (cfi = 1; cfi < RG_SCH_CMN_MAX_CFI; cfi++)
- {
-#ifdef LTE_TDD
- ret = rgSCHCmnUlCalcAvailBw(cell, cellCfg, cfi, &rbStart, &bwAvail);
-#else
- ret = rgSCHCmnUlCalcAvailBw(cell, cellCfg, cfi, &rbStart, &bwAvail);
-#endif
- if (ret != ROK)
- {
- return (ret);
- }
-
- if (cfi == 1)
- {
- cell->ulAvailBw = bwAvail;
- }
-
- numSb = bwAvail/sbSize;
-
- cell->dynCfiCb.bwInfo[cfi].startRb = rbStart;
- cell->dynCfiCb.bwInfo[cfi].numSb = numSb;
- }
-
- if(0 == cell->dynCfiCb.maxCfi)
- {
- DU_LOG("\nERROR --> SCH : Incorrect Default CFI(%u), maxCfi(%u), maxPucchRb(%d)",
- cellSch->cfiCfg.cfi, cell->dynCfiCb.maxCfi,
- cell->pucchCfg.maxPucchRb);
-
- return RFAILED;
- }
-
- /* DMRS values */
- cellUl->dmrsArrSize = cell->dynCfiCb.bwInfo[1].numSb;
- ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&cellUl->dmrsArr,
- cellUl->dmrsArrSize * sizeof(*cellUl->dmrsArr));
- if (ret != ROK)
- {
- return (ret);
- }
- for (i = 0; i < cellUl->dmrsArrSize; ++i)
- {
- cellUl->dmrsArr[i] = cellCfg->puschSubBand.dmrs[i];
- }
-
- /* Init subframes */
- for (i = 0; i < maxSubfrms; ++i)
- {
- ret = rgSCHUtlUlSfInit(cell, &cellUl->ulSfArr[i], i,
- cellUl->maxAllocPerUlSf);
- if (ret != ROK)
- {
- for (; i != 0; --i)
- {
- rgSCHUtlUlSfDeinit(cell, &cellUl->ulSfArr[i-1]);
- }
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(cellUl->dmrsArr)),
- cellUl->dmrsArrSize * sizeof(*cellUl->dmrsArr));
-#ifdef LTE_TDD
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx,
- (Data **)(&(cellUl->ulSfArr)), maxSubfrms * sizeof(RgSchUlSf));
-#endif
- return (ret);
- }
- }
- RG_SCH_RESET_HCSG_UL_PRB_CNTR(cellUl);
- return ROK;
-}
-
-/**
- * @brief Scheduler processing on cell configuration.
- *
- * @details
- *
- * Function : rgSCHCmnRgrCellCfg
- *
- * This function does requisite initialisation
- * and setup for scheduler1 when a cell is
- * configured.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgrCellCfg *cellCfg
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCmnRgrCellCfg(RgSchCellCb *cell,RgrCellCfg *cellCfg,RgSchErrInfo *err)
-{
- S16 ret;
- RgSchCmnCell *cellSch;
-
- /* As part of RGR cell configuration, validate the CRGCellCfg
- * There is no trigger for crgCellCfg from SC1 */
- /* Removed failure check for Extended CP */
-
- if (((ret = rgSCHUtlAllocSBuf(cell->instIdx,
- (Data**)&(cell->sc.sch), (sizeof(RgSchCmnCell)))) != ROK))
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED");
- err->errCause = RGSCHERR_SCH_CFG;
- return (ret);
- }
- cellSch = (RgSchCmnCell *)(cell->sc.sch);
- cellSch->cfiCfg = cellCfg->cfiCfg;
- cellSch->trgUlCqi.trgCqi = cellCfg->trgUlCqi.trgCqi;
- /* Initialize the scheduler refresh timer queues */
- cellSch->tmrTqCp.nxtEnt = 0;
- cellSch->tmrTqCp.tmrLen = RG_SCH_CMN_NUM_REFRESH_Q;
-
- /* RACHO Intialize the RACH ded Preamble Information */
- rgSCHCmnCfgRachDedPrm(cell);
-#ifdef LTE_TDD
- /* Initialize 'Np' value for each 'p' used for
- * HARQ ACK/NACK reception */
- rgSCHCmnDlNpValInit(cell);
-#endif
-
- /* Initialize 'Np' value for each 'p' used for
- * HARQ ACK/NACK reception */
-#ifdef LTE_TDD
- rgSCHCmnDlNpValInit(cell);
-#endif
-
- /* Now perform uplink related initializations */
- ret = rgSCHCmnUlCellInit(cell, cellCfg);
- if (ret != ROK)
- {
- /* There is no downlink deinit to be performed */
- err->errCause = RGSCHERR_SCH_CFG;
- return (ret);
- }
- ret = rgSCHCmnDlRgrCellCfg(cell, cellCfg, err);
- if (ret != ROK)
- {
- err->errCause = RGSCHERR_SCH_CFG;
- return (ret);
- }
- /* DL scheduler has no initializations to make */
- /* As of now DL scheduler always returns ROK */
-
- rgSCHCmnGetDciFrmtSizes(cell);
- rgSCHCmnGetCqiDciFrmt2AggrLvl(cell);
-#ifdef EMTC_ENABLE
- rgSCHCmnGetEmtcDciFrmtSizes(cell);
- rgSCHCmnGetCqiEmtcDciFrmt2AggrLvl(cell);
-#endif /* EMTC_ENABLE */
-
-#ifdef EMTC_ENABLE
- if(TRUE == cellCfg->emtcEnable)
- {
- cellSch->apisEmtcUl = &rgSchEmtcUlSchdTbl[0];
- ret = cellSch->apisEmtcUl->rgSCHRgrUlCellCfg(cell, cellCfg, err);
- if (ret != ROK)
- {
- return (ret);
- }
- }
-#endif
- cellSch->apisUl = &rgSchUlSchdTbl[RG_SCH_CMN_GET_UL_SCHED_TYPE(cell)];
- ret = cellSch->apisUl->rgSCHRgrUlCellCfg(cell, cellCfg, err);
- if (ret != ROK)
- {
- return (ret);
- }
-#ifdef EMTC_ENABLE
- if(TRUE == cellCfg->emtcEnable)
- {
- cellSch->apisEmtcDl = &rgSchEmtcDlSchdTbl[0];
- ret = cellSch->apisEmtcDl->rgSCHRgrDlCellCfg(cell, cellCfg, err);
- if (ret != ROK)
- {
- return (ret);
- }
- }
-#endif
- cellSch->apisDl = &rgSchDlSchdTbl[RG_SCH_CMN_GET_DL_SCHED_TYPE(cell)];
-#ifdef LTEMAC_SPS
- /* Perform SPS specific initialization for the cell */
- ret = rgSCHCmnSpsCellCfg(cell, cellCfg, err);
- if (ret != ROK)
- {
- return (ret);
- }
-#endif
- ret = cellSch->apisDl->rgSCHRgrDlCellCfg(cell, cellCfg, err);
- if (ret != ROK)
- {
- return (ret);
- }
- rgSCHCmnInitVars(cell);
-
- return ROK;
-} /* rgSCHCmnRgrCellCfg*/
-
-\f
-/**
- * @brief This function handles the reconfiguration of cell.
- *
- * @details
- *
- * Function: rgSCHCmnRgrCellRecfg
- * Purpose: Update the reconfiguration parameters.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @return Void
- *
- **/
-S16 rgSCHCmnRgrCellRecfg(RgSchCellCb *cell,RgrCellRecfg *recfg,RgSchErrInfo *err)
-{
- S16 ret;
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
-
-
- if (recfg->recfgTypes & RGR_CELL_UL_CMNRATE_RECFG)
- {
- uint8_t oldCqi = cellUl->dfltUlCqi;
- if (!RG_SCH_CMN_UL_IS_CQI_VALID(recfg->ulCmnCodeRate.ccchCqi))
- {
- err->errCause = RGSCHERR_SCH_CFG;
- DU_LOG("\nERROR --> SCH : rgSCHCmnRgrCellRecfg(): "
- "Invalid cqi");
- return RFAILED;
- }
- cellUl->dfltUlCqi = recfg->ulCmnCodeRate.ccchCqi;
- ret = rgSCHCmnPrecompMsg3Vars(cellUl, recfg->ulCmnCodeRate.ccchCqi,
- cell->rachCfg.msgSizeGrpA, cellUl->sbSize, cell->isCpUlExtend);
- if (ret != ROK)
- {
- cellUl->dfltUlCqi = oldCqi;
- rgSCHCmnPrecompMsg3Vars(cellUl, recfg->ulCmnCodeRate.ccchCqi,
- cell->rachCfg.msgSizeGrpA, cellUl->sbSize, cell->isCpUlExtend);
- return (ret);
- }
- }
-
- if (recfg->recfgTypes & RGR_CELL_DL_CMNRATE_RECFG)
- {
- if (rgSCHCmnDlCnsdrCmnRt(cell, &recfg->dlCmnCodeRate) != ROK)
- {
- err->errCause = RGSCHERR_SCH_CFG;
- return RFAILED;
- }
- }
-
-#ifdef EMTC_ENABLE
- if(TRUE == cell->emtcEnable)
- {
- /* Invoke UL sched for cell Recfg */
- ret = cellSch->apisEmtcUl->rgSCHRgrUlCellRecfg(cell, recfg, err);
- if (ret != ROK)
- {
- return RFAILED;
- }
-
- /* Invoke DL sched for cell Recfg */
- ret = cellSch->apisEmtcDl->rgSCHRgrDlCellRecfg(cell, recfg, err);
- if (ret != ROK)
- {
- return RFAILED;
- }
- }
- else
-#endif
- {
- /* Invoke UL sched for cell Recfg */
- ret = cellSch->apisUl->rgSCHRgrUlCellRecfg(cell, recfg, err);
- if (ret != ROK)
- {
- return RFAILED;
- }
-
- /* Invoke DL sched for cell Recfg */
- ret = cellSch->apisDl->rgSCHRgrDlCellRecfg(cell, recfg, err);
- if (ret != ROK)
- {
- return RFAILED;
- }
- }
-
- if (recfg->recfgTypes & RGR_CELL_DLFS_RECFG)
- {
- ret = cellSch->apisDlfs->rgSCHDlfsCellRecfg(cell, recfg, err);
- if (ret != ROK)
- {
- return RFAILED;
- }
- cellSch->dl.isDlFreqSel = recfg->dlfsRecfg.isDlFreqSel;
- }
-
- if (recfg->recfgTypes & RGR_CELL_PWR_RECFG)
- {
- ret = rgSCHPwrCellRecfg(cell, recfg);
- if (ret != ROK)
- {
- return RFAILED;
- }
- }
-
- return ROK;
-}
-
-/***********************************************************
- *
- * Func : rgSCHCmnUlCellDeinit
- *
- * Desc : Uplink scheduler de-initialisation for cell.
- *
- * Ret : S16
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHCmnUlCellDeinit(RgSchCellCb *cell)
-{
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- uint8_t ulSfIdx;
-#ifdef LTE_TDD
- uint8_t maxSubfrms = cellUl->numUlSubfrms;
-#endif
-#ifdef LTE_L2_MEAS
- CmLList *lnk = NULLP;
- RgSchL2MeasCb *measCb;
-#endif
-#ifdef LTE_L2_MEAS
-#ifdef LTE_TDD
- for(ulSfIdx = 0; ulSfIdx < RGSCH_SF_ALLOC_SIZE; ulSfIdx++)
-#else
- for(ulSfIdx = 0; ulSfIdx < RGSCH_NUM_SUB_FRAMES; ulSfIdx++)
-#endif
- {
- if(cell->sfAllocArr[ulSfIdx].ulUeInfo.ulAllocInfo != NULLP)
- {
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx,
- (Data **)(&(cell->sfAllocArr[ulSfIdx].ulUeInfo.ulAllocInfo)),
- cellUl->maxAllocPerUlSf * sizeof(RgInfUeUlAlloc));
-
- /* ccpu00117052 - DEL - removed explicit NULLP assignment
- as it is done in above utility function */
- }
- }
- /* Free the memory allocated to measCb */
- lnk = cell->l2mList.first;
- while(lnk != NULLP)
- {
- measCb = (RgSchL2MeasCb *)lnk->node;
- cmLListDelFrm(&cell->l2mList, lnk);
- lnk = lnk->next;
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb,\
- sizeof(RgSchL2MeasCb));
- }
-#endif
- if (cellUl->dmrsArr != NULLP)
- {
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx,(Data **)(&(cellUl->dmrsArr)),
- cellUl->dmrsArrSize * sizeof(*cellUl->dmrsArr));
- }
- /* De-init subframes */
-#ifdef LTE_TDD
- for (ulSfIdx = 0; ulSfIdx < maxSubfrms; ++ulSfIdx)
-#else
- for (ulSfIdx = 0; ulSfIdx < RG_SCH_CMN_UL_NUM_SF; ++ulSfIdx)
-#endif
- {
- rgSCHUtlUlSfDeinit(cell, &cellUl->ulSfArr[ulSfIdx]);
- }
-
-#ifdef LTE_TDD
- if (cellUl->ulSfArr != NULLP)
- {
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx,
- (Data **)(&(cellUl->ulSfArr)), maxSubfrms * sizeof(RgSchUlSf));
- }
-#endif
-
- return;
-}
-
-/**
- * @brief Scheduler processing for cell delete.
- *
- * @details
- *
- * Function : rgSCHCmnCellDel
- *
- * This functions de-initialises and frees memory
- * taken up by scheduler1 for the entire cell.
- *
- * @param[in] RgSchCellCb *cell
- * @return Void
- **/
-Void rgSCHCmnCellDel(RgSchCellCb *cell)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-
-#ifdef LTE_L2_MEAS
- glblTtiCnt = 0;
-#endif
- if (cellSch == NULLP)
- {
- return;
- }
- /* Perform the deinit for the UL scheduler */
- rgSCHCmnUlCellDeinit(cell);
-#ifdef EMTC_ENABLE
- if(TRUE == cell->emtcEnable)
- {
- if (cellSch->apisEmtcUl)
- {
- cellSch->apisEmtcUl->rgSCHFreeUlCell(cell);
- }
- }
-#endif
- if (cellSch->apisUl)
- {
- /* api pointer checks added (here and below in
- * this function). pl check. - antriksh */
- cellSch->apisUl->rgSCHFreeUlCell(cell);
- }
-
- /* Perform the deinit for the DL scheduler */
- cmLListInit(&cellSch->dl.taLst);
- if (cellSch->apisDl)
- {
- cellSch->apisDl->rgSCHFreeDlCell(cell);
- }
-#ifdef EMTC_ENABLE
- if (cellSch->apisEmtcDl)
- {
- rgSCHEmtcInitTaLst(&cellSch->dl);
-
- cellSch->apisEmtcDl->rgSCHFreeDlCell(cell);
- }
-#endif
-
- /* DLFS de-initialization */
- if (cellSch->dl.isDlFreqSel && cellSch->apisDlfs)
- {
- cellSch->apisDlfs->rgSCHDlfsCellDel(cell);
- }
-
- rgSCHPwrCellDel(cell);
-#ifdef LTEMAC_SPS
- rgSCHCmnSpsCellDel(cell);
-#endif
-
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx,
- (Data**)(&(cell->sc.sch)), (sizeof(RgSchCmnCell)));
- return;
-} /* rgSCHCmnCellDel */
-
-\f
-/**
- * @brief This function validates QOS parameters for DL.
- *
- * @details
- *
- * Function: rgSCHCmnValidateDlQos
- * Purpose: This function validates QOS parameters for DL.
- *
- * Invoked by: Scheduler
- *
- * @param[in] CrgLchQosCfg *dlQos
- * @return S16
- *
- **/
-static S16 rgSCHCmnValidateDlQos(RgrLchQosCfg *dlQos)
-{
- uint8_t qci = dlQos->qci;
- if ( qci < RG_SCH_CMN_MIN_QCI || qci > RG_SCH_CMN_MAX_QCI )
- {
- return RFAILED;
- }
-
- if ((qci >= RG_SCH_CMN_GBR_QCI_START) &&
- (qci <= RG_SCH_CMN_GBR_QCI_END))
- {
- if ((dlQos->mbr == 0) || (dlQos->mbr < dlQos->gbr))
- {
- return RFAILED;
- }
- }
- return ROK;
-}
-
-/**
- * @brief Scheduler invocation on logical channel addition.
- *
- * @details
- *
- * Function : rgSCHCmnRgrLchCfg
- *
- * This functions does required processing when a new
- * (dedicated) logical channel is added. Assumes lcg
- * pointer in ulLc is set.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchDlLcCb *dlLc
- * @param[int] RgrLchCfg *lcCfg
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCmnRgrLchCfg
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *dlLc,
-RgrLchCfg *lcCfg,
-RgSchErrInfo *err
-)
-{
- S16 ret;
-
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-
-
- ret = rgSCHUtlAllocSBuf(cell->instIdx,
- (Data**)&((dlLc)->sch), (sizeof(RgSchCmnDlSvc)));
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : rgSCHCmnRgrLchCfg(): "
- "SCH struct alloc failed for CRNTI:%d LCID:%d",ue->ueId,lcCfg->lcId);
- err->errCause = RGSCHERR_SCH_CFG;
- return (ret);
- }
- if(lcCfg->lcType != CM_LTE_LCH_DCCH)
- {
- ret = rgSCHCmnValidateDlQos(&lcCfg->dlInfo.dlQos);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : rgSchCmnCrgLcCfg(): "
- "DlQos validation failed for CRNTI:%d LCID:%d",ue->ueId,lcCfg->lcId);
- err->errCause = RGSCHERR_SCH_CFG;
- return (ret);
- }
- /* Perform DL service activation in the scheduler */
- ((RgSchCmnDlSvc *)(dlLc->sch))->qci = lcCfg->dlInfo.dlQos.qci;
- ((RgSchCmnDlSvc *)(dlLc->sch))->prio = rgSchCmnDlQciPrio[lcCfg->dlInfo.dlQos.qci - 1];
- ((RgSchCmnDlSvc *)(dlLc->sch))->gbr = (lcCfg->dlInfo.dlQos.gbr * \
- RG_SCH_CMN_REFRESH_TIME)/100;
- ((RgSchCmnDlSvc *)(dlLc->sch))->mbr = (lcCfg->dlInfo.dlQos.mbr * \
- RG_SCH_CMN_REFRESH_TIME)/100;
- }
- else
- {
- /*assigning highest priority to DCCH */
- ((RgSchCmnDlSvc *)(dlLc->sch))->prio=RG_SCH_CMN_DCCH_PRIO;
- }
- dlLc->ue = ue;
- dlLc->lcType=lcCfg->lcType;
-
-#ifdef EMTC_ENABLE
- if((cell->emtcEnable)&&(TRUE == ue->isEmtcUe))
- {
- ret = cellSch->apisEmtcDl->rgSCHRgrDlLcCfg(cell, ue,dlLc ,lcCfg, err);
- if (ret != ROK)
- {
- return RFAILED;
- }
- }
- else
-#endif
- {
- ret = cellSch->apisDl->rgSCHRgrDlLcCfg(cell, ue, dlLc, lcCfg, err);
- if (ret != ROK)
- {
- return RFAILED;
- }
- }
-
-#ifdef EMTC_ENABLE
- if(TRUE == ue->isEmtcUe)
- {
- ret = cellSch->apisEmtcUl->rgSCHRgrUlLcCfg(cell, ue, lcCfg, err);
- if (ret != ROK)
- {
- return RFAILED;
- }
- }
- else
-#endif
- {
- ret = cellSch->apisUl->rgSCHRgrUlLcCfg(cell, ue, lcCfg, err);
- if (ret != ROK)
- {
- return RFAILED;
- }
- }
-
-#ifdef LTE_ADV
- if (ue->numSCells)
- {
- rgSCHSCellDlLcCfg(cell, ue, dlLc);
- }
-#endif
-
-
-#ifdef LTEMAC_SPS
- if(lcCfg->dlInfo.dlSpsCfg.isSpsEnabled)
- {
- /* Invoke SPS module if SPS is enabled for the service */
- ret = rgSCHCmnSpsDlLcCfg(cell, ue, dlLc, lcCfg, err);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : rgSchCmnRgrLchCfg(): "
- "SPS configuration failed for DL LC for CRNTI:%d LCID:%d",ue->ueId,lcCfg->lcId);
- err->errCause = RGSCHERR_SCH_CFG;
- return RFAILED;
- }
- }
-#endif
-
- return ROK;
-}
-
-/**
- * @brief Scheduler invocation on logical channel addition.
- *
- * @details
- *
- * Function : rgSCHCmnRgrLchRecfg
- *
- * This functions does required processing when an existing
- * (dedicated) logical channel is reconfigured. Assumes lcg
- * pointer in ulLc is set to the old value.
- * Independent of whether new LCG is meant to be configured,
- * the new LCG scheduler information is accessed and possibly modified.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchDlLcCb *dlLc
- * @param[int] RgrLchRecfg *lcRecfg
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCmnRgrLchRecfg
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *dlLc,
-RgrLchRecfg *lcRecfg,
-RgSchErrInfo *err
-)
-{
- S16 ret;
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-
-
- if(dlLc->lcType != CM_LTE_LCH_DCCH)
- {
- ret = rgSCHCmnValidateDlQos(&lcRecfg->dlRecfg.dlQos);
-
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : DlQos validation failed for CRNTI:%d LCID:%d",ue->ueId,lcRecfg->lcId);
- err->errCause = RGSCHERR_SCH_CFG;
- return (ret);
- }
- if (((RgSchCmnDlSvc *)(dlLc->sch))->qci != lcRecfg->dlRecfg.dlQos.qci)
- {
- DU_LOG("\nERROR --> SCH : Qci, hence lc Priority change "
- "not supported for CRNTI:%d LCID:%d",ue->ueId,lcRecfg->lcId);
- err->errCause = RGSCHERR_SCH_CFG;
- return (ret);
- }
- ((RgSchCmnDlSvc *)(dlLc->sch))->gbr = (lcRecfg->dlRecfg.dlQos.gbr * \
- RG_SCH_CMN_REFRESH_TIME)/100;
- ((RgSchCmnDlSvc *)(dlLc->sch))->mbr = (lcRecfg->dlRecfg.dlQos.mbr * \
- RG_SCH_CMN_REFRESH_TIME)/100;
- }
- else
- {
- /*assigning highest priority to DCCH */
- ((RgSchCmnDlSvc *)(dlLc->sch))->prio = RG_SCH_CMN_DCCH_PRIO;
- }
-
-#ifdef EMTC_ENABLE
- if((cell->emtcEnable)&&(TRUE == ue->isEmtcUe))
- {
- ret = cellSch->apisEmtcDl->rgSCHRgrDlLcRecfg(cell, ue, dlLc, lcRecfg, err);
- if (ret != ROK)
- {
- return RFAILED;
- }
- ret = cellSch->apisEmtcUl->rgSCHRgrUlLcRecfg(cell, ue, lcRecfg, err);
- if (ret != ROK)
- {
- return RFAILED;
- }
- }
- else
-#endif
- {
- ret = cellSch->apisDl->rgSCHRgrDlLcRecfg(cell, ue, dlLc, lcRecfg, err);
- if (ret != ROK)
- {
- return RFAILED;
- }
- ret = cellSch->apisUl->rgSCHRgrUlLcRecfg(cell, ue, lcRecfg, err);
- if (ret != ROK)
- {
- return RFAILED;
- }
- }
-
-#ifdef LTEMAC_SPS
- if (lcRecfg->recfgTypes & RGR_DL_LC_SPS_RECFG)
- {
- /* Invoke SPS module if SPS is enabled for the service */
- if(lcRecfg->dlRecfg.dlSpsRecfg.isSpsEnabled)
- {
- ret = rgSCHCmnSpsDlLcRecfg(cell, ue, dlLc, lcRecfg, err);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : SPS re-configuration not "
- "supported for dlLC Ignore this CRNTI:%d LCID:%d",ue->ueId,lcRecfg->lcId);
- }
- }
- return ROK;
- }
-#endif
-
- return ROK;
-}
-
-/**
- * @brief Scheduler invocation on logical channel addition.
- *
- * @details
- *
- * Function : rgSCHCmnRgrLcgCfg
- *
- * This functions does required processing when a new
- * (dedicated) logical channel is added. Assumes lcg
- * pointer in ulLc is set.
- *
- * @param[in] RgSchCellCb *cell,
- * @param[in] RgSchUeCb *ue,
- * @param[in] RgSchLcgCb *lcg,
- * @param[in] RgrLcgCfg *lcgCfg,
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCmnRgrLcgCfg
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchLcgCb *lcg,
-RgrLcgCfg *lcgCfg,
-RgSchErrInfo *err
-)
-{
- S16 ret;
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- RgSchCmnLcg *ulLcg = ((RgSchCmnLcg *)(ue->ul.lcgArr[lcgCfg->ulInfo.lcgId].sch));
-
-
- ulLcg->cfgdGbr = (lcgCfg->ulInfo.gbr * RG_SCH_CMN_REFRESH_TIME)/100;
- ulLcg->effGbr = ulLcg->cfgdGbr;
- ulLcg->deltaMbr = ((lcgCfg->ulInfo.mbr - lcgCfg->ulInfo.gbr) * RG_SCH_CMN_REFRESH_TIME)/100;
- ulLcg->effDeltaMbr = ulLcg->deltaMbr;
-
-#ifdef EMTC_ENABLE
- if(TRUE == ue->isEmtcUe)
- {
- ret = cellSch->apisEmtcUl->rgSCHRgrUlLcgCfg(cell, ue, lcg, lcgCfg, err);
- if (ret != ROK)
- {
- return RFAILED;
- }
- }
- else
-#endif
- {
- ret = cellSch->apisUl->rgSCHRgrUlLcgCfg(cell, ue, lcg, lcgCfg, err);
- if (ret != ROK)
- {
- return RFAILED;
- }
- }
- if (RGSCH_IS_GBR_BEARER(ulLcg->cfgdGbr))
- {
- /* Indicate MAC that this LCG is GBR LCG */
- rgSCHUtlBuildNSendLcgReg(cell, ue->ueId, lcgCfg->ulInfo.lcgId, TRUE);
- }
- return ROK;
-}
-
-/**
- * @brief Scheduler invocation on logical channel addition.
- *
- * @details
- *
- * Function : rgSCHCmnRgrLcgRecfg
- *
- * This functions does required processing when a new
- * (dedicated) logical channel is added. Assumes lcg
- * pointer in ulLc is set.
- *
- * @param[in] RgSchCellCb *cell,
- * @param[in] RgSchUeCb *ue,
- * @param[in] RgSchLcgCb *lcg,
- * @param[in] RgrLcgRecfg *reCfg,
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCmnRgrLcgRecfg
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchLcgCb *lcg,
-RgrLcgRecfg *reCfg,
-RgSchErrInfo *err
-)
-{
- S16 ret;
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- RgSchCmnLcg *ulLcg = ((RgSchCmnLcg *)(ue->ul.lcgArr[reCfg->ulRecfg.lcgId].sch));
-
-
- ulLcg->cfgdGbr = (reCfg->ulRecfg.gbr * RG_SCH_CMN_REFRESH_TIME)/100;
- ulLcg->effGbr = ulLcg->cfgdGbr;
- ulLcg->deltaMbr = ((reCfg->ulRecfg.mbr - reCfg->ulRecfg.gbr) * RG_SCH_CMN_REFRESH_TIME)/100;
- ulLcg->effDeltaMbr = ulLcg->deltaMbr;
-
-#ifdef EMTC_ENABLE
- if(TRUE == ue->isEmtcUe)
- {
- ret = cellSch->apisEmtcUl->rgSCHRgrUlLcgRecfg(cell, ue, lcg, reCfg, err);
- if (ret != ROK)
- {
- return RFAILED;
- }
- }
- else
-#endif
- {
- ret = cellSch->apisUl->rgSCHRgrUlLcgRecfg(cell, ue, lcg, reCfg, err);
- if (ret != ROK)
- {
- return RFAILED;
- }
- }
- if (RGSCH_IS_GBR_BEARER(ulLcg->cfgdGbr))
- {
- /* Indicate MAC that this LCG is GBR LCG */
- rgSCHUtlBuildNSendLcgReg(cell, ue->ueId, reCfg->ulRecfg.lcgId, TRUE);
- }
- else
- {
- /* In case of RAB modification */
- rgSCHUtlBuildNSendLcgReg(cell, ue->ueId, reCfg->ulRecfg.lcgId, FALSE);
- }
- return ROK;
-}
-
-/***********************************************************
- *
- * Func : rgSCHCmnRgrLchDel
- *
- * Desc : Scheduler handling for a (dedicated)
- * uplink logical channel being deleted.
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- **********************************************************/
-S16 rgSCHCmnRgrLchDel(RgSchCellCb *cell,RgSchUeCb *ue,CmLteLcId lcId,uint8_t lcgId)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-#ifdef EMTC_ENABLE
- if(TRUE == ue->isEmtcUe)
- {
- cellSch->apisEmtcUl->rgSCHRgrUlLchDel(cell, ue, lcId, lcgId);
- }
- else
-#endif
- {
- cellSch->apisUl->rgSCHRgrUlLchDel(cell, ue, lcId, lcgId);
- }
- return ROK;
-}
-
-/***********************************************************
- *
- * Func : rgSCHCmnLcgDel
- *
- * Desc : Scheduler handling for a (dedicated)
- * uplink logical channel being deleted.
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHCmnLcgDel(RgSchCellCb *cell,RgSchUeCb *ue,RgSchLcgCb *lcg)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- RgSchCmnLcg *lcgCmn = RG_SCH_CMN_GET_UL_LCG(lcg);
-
- if (lcgCmn == NULLP)
- {
- return;
- }
-
- if (RGSCH_IS_GBR_BEARER(lcgCmn->cfgdGbr))
- {
- /* Indicate MAC that this LCG is GBR LCG */
- rgSCHUtlBuildNSendLcgReg(cell, ue->ueId, lcg->lcgId, FALSE);
- }
-
-#ifdef LTEMAC_SPS
- if (ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE)
- {
- rgSCHCmnSpsUlLcgDel(cell, ue, lcg);
- }
-#endif /* LTEMAC_SPS */
-
- lcgCmn->effGbr = 0;
- lcgCmn->reportedBs = 0;
- lcgCmn->cfgdGbr = 0;
- /* set lcg bs to 0. Deletion of control block happens
- * at the time of UE deletion. */
- lcgCmn->bs = 0;
-#ifdef EMTC_ENABLE
- if(TRUE == ue->isEmtcUe)
- {
- cellSch->apisEmtcUl->rgSCHFreeUlLcg(cell, ue, lcg);
- }
- else
-#endif
- {
- cellSch->apisUl->rgSCHFreeUlLcg(cell, ue, lcg);
- }
- return;
-}
-
-\f
-/**
- * @brief This function deletes a service from scheduler.
- *
- * @details
- *
- * Function: rgSCHCmnFreeDlLc
- * Purpose: This function is made available through a FP for
- * making scheduler aware of a service being deleted from UE.
- *
- * Invoked by: BO and Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @param[in] RgSchDlLcCb* svc
- * @return Void
- *
- **/
-Void rgSCHCmnFreeDlLc(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *svc)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- if (svc->sch == NULLP)
- {
- return;
- }
-#ifdef EMTC_ENABLE
- if((cell->emtcEnable)&&(TRUE == ue->isEmtcUe))
- {
- cellSch->apisEmtcDl->rgSCHFreeDlLc(cell, ue, svc);
- }
- else
-#endif
- {
- cellSch->apisDl->rgSCHFreeDlLc(cell, ue, svc);
- }
-
-#ifdef LTE_ADV
- if (ue->numSCells)
- {
- rgSCHSCellDlLcDel(cell, ue, svc);
- }
-#endif
-
-#ifdef LTEMAC_SPS
- /* If SPS service, invoke SPS module */
- if (svc->dlLcSpsCfg.isSpsEnabled)
- {
- rgSCHCmnSpsDlLcDel(cell, ue, svc);
- }
-#endif
-
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx,
- (Data**)(&(svc->sch)), (sizeof(RgSchCmnDlSvc)));
-
-#ifdef LTE_ADV
- rgSCHLaaDeInitDlLchCb(cell, svc);
-#endif
-
- return;
-}
-
-#ifdef RGR_V1
-
-/**
- * @brief This function Processes the Final Allocations
- * made by the RB Allocator against the requested
- * CCCH SDURetx Allocations.
- *
- * @details
- *
- * Function: rgSCHCmnDlCcchSduRetxFnlz
- * Purpose: This function Processes the Final Allocations
- * made by the RB Allocator against the requested
- * CCCH Retx Allocations.
- * Scans through the scheduled list of ccchSdu retrans
- * fills the corresponding pdcch, adds the hqProc to
- * the corresponding SubFrm and removes the hqP from
- * cells retx List.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlCcchSduRetxFnlz(RgSchCellCb *cell,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- CmLList *node;
- RgSchCmnDlCell *cmnCellDl = RG_SCH_CMN_GET_DL_CELL(cell);
- RgSchDlRbAlloc *rbAllocInfo;
- RgSchDlHqProcCb *hqP;
- RgSchUeCb *ue;
-
- /* Traverse through the Scheduled Retx List */
- node = allocInfo->ccchSduAlloc.schdCcchSduRetxLst.first;
- while (node)
- {
- hqP = (RgSchDlHqProcCb *)(node->node);
- ue = hqP->hqE->ue;
- rbAllocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, cell);
- node = node->next;
- rgSCHCmnFillHqPPdcch(cell, rbAllocInfo, hqP);
-
- /* Remove the HqP from cell's ccchSduRetxLst */
- cmLListDelFrm(&cmnCellDl->ccchSduRetxLst, &hqP->tbInfo[0].ccchSchdInfo.retxLnk);
- hqP->tbInfo[0].ccchSchdInfo.retxLnk.node = (PTR)NULLP;
-
- /* Fix: syed dlAllocCb reset should be performed.
- * zombie info in dlAllocCb leading to crash rbNum wraparound */
- rgSCHCmnDlUeResetTemp(ue, hqP);
- }
- /* Fix: syed dlAllocCb reset should be performed.
- * zombie info in dlAllocCb leading to crash rbNum wraparound */
- node = allocInfo->ccchSduAlloc.nonSchdCcchSduRetxLst.first;
- while(node)
- {
- hqP = (RgSchDlHqProcCb *)(node->node);
- ue = hqP->hqE->ue;
- node = node->next;
- /* reset the UE allocation Information */
- rgSCHCmnDlUeResetTemp(ue, hqP);
- }
- return;
-}
-#endif
-/**
- * @brief This function Processes the Final Allocations
- * made by the RB Allocator against the requested
- * CCCH Retx Allocations.
- *
- * @details
- *
- * Function: rgSCHCmnDlCcchRetxFnlz
- * Purpose: This function Processes the Final Allocations
- * made by the RB Allocator against the requested
- * CCCH Retx Allocations.
- * Scans through the scheduled list of msg4 retrans
- * fills the corresponding pdcch, adds the hqProc to
- * the corresponding SubFrm and removes the hqP from
- * cells retx List.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlCcchRetxFnlz(RgSchCellCb *cell,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- CmLList *node;
- RgSchCmnDlCell *cmnCellDl = RG_SCH_CMN_GET_DL_CELL(cell);
- RgSchDlRbAlloc *rbAllocInfo;
- RgSchDlHqProcCb *hqP;
- RgSchRaCb *raCb;
-
- /* Traverse through the Scheduled Retx List */
- node = allocInfo->msg4Alloc.schdMsg4RetxLst.first;
- while (node)
- {
- hqP = (RgSchDlHqProcCb *)(node->node);
- raCb = hqP->hqE->raCb;
- rbAllocInfo = &raCb->rbAllocInfo;
- node = node->next;
- rgSCHCmnFillHqPPdcch(cell, rbAllocInfo, hqP);
-
- /* Remove the HqP from cell's msg4RetxLst */
- cmLListDelFrm(&cmnCellDl->msg4RetxLst, &hqP->tbInfo[0].ccchSchdInfo.retxLnk);
- hqP->tbInfo[0].ccchSchdInfo.retxLnk.node = (PTR)NULLP;
- /* Fix: syed dlAllocCb reset should be performed.
- * zombie info in dlAllocCb leading to crash rbNum wraparound */
- memset(rbAllocInfo, 0, sizeof(*rbAllocInfo));
- rgSCHCmnDlHqPResetTemp(hqP);
- }
- /* Fix: syed dlAllocCb reset should be performed.
- * zombie info in dlAllocCb leading to crash rbNum wraparound */
- node = allocInfo->msg4Alloc.nonSchdMsg4RetxLst.first;
- while(node)
- {
- hqP = (RgSchDlHqProcCb *)(node->node);
- raCb = hqP->hqE->raCb;
- node = node->next;
- memset(&raCb->rbAllocInfo, 0, sizeof(raCb->rbAllocInfo));
- rgSCHCmnDlHqPResetTemp(hqP);
- }
- return;
-}
-
-#ifdef RGR_V1
-/**
- * @brief This function Processes the Final Allocations
- * made by the RB Allocator against the requested
- * CCCH SDU tx Allocations.
- *
- * @details
- *
- * Function: rgSCHCmnDlCcchSduTxFnlz
- * Purpose: This function Processes the Final Allocations
- * made by the RB Allocator against the requested
- * CCCH tx Allocations.
- * Scans through the scheduled list of CCCH SDU trans
- * fills the corresponding pdcch, adds the hqProc to
- * the corresponding SubFrm and removes the hqP from
- * cells tx List.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlCcchSduTxFnlz(RgSchCellCb *cell,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- CmLList *node;
- RgSchUeCb *ueCb;
- RgSchDlRbAlloc *rbAllocInfo;
- RgSchDlHqProcCb *hqP;
- RgSchLchAllocInfo lchSchdData;
-
- /* Traverse through the Scheduled Retx List */
- node = allocInfo->ccchSduAlloc.schdCcchSduTxLst.first;
- while (node)
- {
- hqP = (RgSchDlHqProcCb *)(node->node);
- ueCb = hqP->hqE->ue;
- node = node->next;
- rbAllocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ueCb, cell);
-
- /* fill the pdcch and HqProc */
- rgSCHCmnFillHqPPdcch(cell, rbAllocInfo, hqP);
-
- /* Remove the raCb from cell's toBeSchdLst */
- cmLListDelFrm(&cell->ccchSduUeLst, &ueCb->ccchSduLnk);
- ueCb->ccchSduLnk.node = (PTR)NULLP;
-
- /* Fix : Resetting this required to avoid complication
- * in reestablishment case */
- ueCb->dlCcchInfo.bo = 0;
-
- /* Indicate DHM of the CCCH LC scheduling */
- hqP->tbInfo[0].contResCe = NOTPRSNT;
- lchSchdData.lcId = 0;
- lchSchdData.schdData = hqP->tbInfo[0].ccchSchdInfo.totBytes -
- (RGSCH_MSG4_HDRSIZE);
- rgSCHDhmAddLcData(cell->instIdx, &lchSchdData, &hqP->tbInfo[0]);
-
- /* Fix: syed dlAllocCb reset should be performed.
- * zombie info in dlAllocCb leading to crash rbNum wraparound */
- rgSCHCmnDlUeResetTemp(ueCb, hqP);
- }
- /* Fix: syed dlAllocCb reset should be performed.
- * zombie info in dlAllocCb leading to crash rbNum wraparound */
- node = allocInfo->ccchSduAlloc.nonSchdCcchSduTxLst.first;
- while(node)
- {
- hqP = (RgSchDlHqProcCb *)(node->node);
- ueCb = hqP->hqE->ue;
- node = node->next;
- /* Release HqProc */
- rgSCHDhmRlsHqpTb(hqP, 0, FALSE);
- /*Fix: Removing releasing of TB1 as it will not exist for CCCH SDU and hence caused a crash*/
- /*rgSCHDhmRlsHqpTb(hqP, 1, FALSE);*/
- /* reset the UE allocation Information */
- rgSCHCmnDlUeResetTemp(ueCb, hqP);
- }
- return;
-}
-
-#endif
-/**
- * @brief This function Processes the Final Allocations
- * made by the RB Allocator against the requested
- * CCCH tx Allocations.
- *
- * @details
- *
- * Function: rgSCHCmnDlCcchTxFnlz
- * Purpose: This function Processes the Final Allocations
- * made by the RB Allocator against the requested
- * CCCH tx Allocations.
- * Scans through the scheduled list of msg4 trans
- * fills the corresponding pdcch, adds the hqProc to
- * the corresponding SubFrm and removes the hqP from
- * cells tx List.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlCcchTxFnlz(RgSchCellCb *cell,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- CmLList *node;
- RgSchRaCb *raCb;
- RgSchDlRbAlloc *rbAllocInfo;
- RgSchDlHqProcCb *hqP;
- RgSchLchAllocInfo lchSchdData;
-
- /* Traverse through the Scheduled Retx List */
- node = allocInfo->msg4Alloc.schdMsg4TxLst.first;
- while (node)
- {
- hqP = (RgSchDlHqProcCb *)(node->node);
- raCb = hqP->hqE->raCb;
- node = node->next;
- rbAllocInfo = &raCb->rbAllocInfo;
-
- /* fill the pdcch and HqProc */
- rgSCHCmnFillHqPPdcch(cell, rbAllocInfo, hqP);
- /* MSG4 Fix Start */
-
- rgSCHRamRmvFrmRaInfoSchdLst(cell, raCb);
- /* MSG4 Fix End */
-
- /* Indicate DHM of the CCCH LC scheduling */
- lchSchdData.lcId = 0;
- lchSchdData.schdData = hqP->tbInfo[0].ccchSchdInfo.totBytes -
- (RGSCH_MSG4_HDRSIZE + RGSCH_CONT_RESID_SIZE);
- /* TRansmitting presence of cont Res CE across MAC-SCH interface to
- * identify CCCH SDU transmissions which need to be done
- * without the
- * contention resolution CE*/
- hqP->tbInfo[0].contResCe = PRSNT_NODEF;
- /*Dont add lc if only cont res CE is being transmitted*/
- if(raCb->dlCcchInfo.bo)
- {
- rgSCHDhmAddLcData(cell->instIdx, &lchSchdData, &hqP->tbInfo[0]);
- }
- else
- {
- }
- /* Fix: syed dlAllocCb reset should be performed.
- * zombie info in dlAllocCb leading to crash rbNum wraparound */
- memset(&raCb->rbAllocInfo, 0, sizeof(raCb->rbAllocInfo));
- rgSCHCmnDlHqPResetTemp(hqP);
- }
- node = allocInfo->msg4Alloc.nonSchdMsg4TxLst.first;
- while(node)
- {
- hqP = (RgSchDlHqProcCb *)(node->node);
- raCb = hqP->hqE->raCb;
- node = node->next;
- rbAllocInfo = &raCb->rbAllocInfo;
- /* Release HqProc */
- rgSCHDhmRlsHqpTb(hqP, 0, FALSE);
- /*Fix: Removing releasing of TB1 as it will not exist for MSG4 and hence caused a crash*/
- /* rgSCHDhmRlsHqpTb(hqP, 1, FALSE);*/
- /* reset the UE allocation Information */
- memset(rbAllocInfo, 0, sizeof(*rbAllocInfo));
- rgSCHCmnDlHqPResetTemp(hqP);
- }
-
- return;
-}
-/* R8 Upgrade */
-/**
- * @brief This function calculates the BI Index to be sent in the Bi header
- * field.
- *
- * @details
- * Function: rgSCHCmnGetBiIndex
- * Purpose: This function Processes utilizes the previous BI time value
- * calculated and the difference last BI sent time and current time. To
- * calculate the latest BI Index. It also considers the how many UE's
- * Unserved in this subframe.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] uint32_t ueCount
- * @return uint8_t
- *
- **/
-uint8_t rgSCHCmnGetBiIndex(RgSchCellCb *cell,uint32_t ueCount)
-{
- S16 prevVal = 0; /* To Store Intermediate Value */
- uint16_t newBiVal = 0; /* To store Bi Value in millisecond */
- uint8_t idx = 0;
- uint16_t timeDiff = 0;
-
-
- if (cell->biInfo.prevBiTime != 0)
- {
-#ifdef EMTC_ENABLE
- if(cell->emtcEnable == TRUE)
- {
- timeDiff =(RGSCH_CALC_SF_DIFF_EMTC(cell->crntTime, cell->biInfo.biTime));
- }
- else
-#endif
- {
- timeDiff =(RGSCH_CALC_SF_DIFF(cell->crntTime, cell->biInfo.biTime));
- }
-
- prevVal = cell->biInfo.prevBiTime - timeDiff;
- }
- if (prevVal < 0)
- {
- prevVal = 0;
- }
- newBiVal = RG_SCH_CMN_GET_BI_VAL(prevVal,ueCount);
- /* To be used next time when BI is calculated */
-#ifdef EMTC_ENABLE
- if(cell->emtcEnable == TRUE)
- {
- RGSCHCPYTIMEINFO_EMTC(cell->crntTime, cell->biInfo.biTime)
- }
- else
-#endif
- {
- RGSCHCPYTIMEINFO(cell->crntTime, cell->biInfo.biTime)
- }
-
- /* Search the actual BI Index from table Backoff Parameters Value and
- * return that Index */
- do
- {
- if (rgSchCmnBiTbl[idx] > newBiVal)
- {
- break;
- }
- idx++;
- }while(idx < RG_SCH_CMN_NUM_BI_VAL-1);
- cell->biInfo.prevBiTime = rgSchCmnBiTbl[idx];
- /* For 16 Entries in Table 7.2.1 36.321.880 - 3 reserved so total 13 Entries */
- return (idx); /* Returning reserved value from table UE treats it has 960 ms */
-} /* rgSCHCmnGetBiIndex */
-
-
-/**
- * @brief This function Processes the Final Allocations
- * made by the RB Allocator against the requested
- * RAR allocations. Assumption: The reuqested
- * allocations are always satisfied completely.
- * Hence no roll back.
- *
- * @details
- *
- * Function: rgSCHCmnDlRaRspFnlz
- * Purpose: This function Processes the Final Allocations
- * made by the RB Allocator against the requested.
- * Takes care of PDCCH filling.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlRaRspFnlz(RgSchCellCb *cell,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- uint32_t rarCnt = 0;
- RgSchDlRbAlloc *raRspAlloc;
- RgSchDlSf *subFrm = NULLP;
- RgSchRaCb *raCb;
- RgSchErrInfo err;
- CmLListCp *reqLst;
- RgSchRaReqInfo *raReq;
- Bool preamGrpA;
- RgSchUlAlloc *ulAllocRef=NULLP;
- RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
- uint8_t allocRapidCnt = 0;
-#ifdef LTE_TDD
- uint32_t msg3SchdIdx = 0;
- uint8_t ulDlCfgIdx = cell->ulDlCfgIdx;
- uint8_t msg3Subfrm;
-#endif
-
-
- for (rarCnt=0; rarCnt<RG_SCH_CMN_MAX_CMN_PDCCH; rarCnt++)
- {
- raRspAlloc = &allocInfo->raRspAlloc[rarCnt];
- /* Having likely condition first for optimization */
- if (!raRspAlloc->pdcch)
- {
- continue;
- }
- else
- {
- subFrm = raRspAlloc->dlSf;
- reqLst = &cell->raInfo.raReqLst[raRspAlloc->raIndex];
- /* Corrected RACH handling for multiple RAPIDs per RARNTI */
- allocRapidCnt = raRspAlloc->numRapids;
- while (allocRapidCnt)
- {
- raReq = (RgSchRaReqInfo *)(reqLst->first->node);
- /* RACHO: If dedicated preamble, then allocate UL Grant
- * (consequence of handover/pdcchOrder) and continue */
- if (RGSCH_IS_DEDPRM(cell, raReq->raReq.rapId))
- {
- rgSCHCmnHdlHoPo(cell, &subFrm->raRsp[rarCnt].contFreeUeLst,
- raReq);
- cmLListDelFrm(reqLst, reqLst->first);
- allocRapidCnt--;
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&raReq,
- sizeof(RgSchRaReqInfo));
- continue;
- }
- /* ccpu00139815 */
- if(cell->overLoadBackOffEnab)
- {/* rach Overlaod conrol is triggerd, Skipping this rach */
- cmLListDelFrm(reqLst, reqLst->first);
- allocRapidCnt--;
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&raReq,
- sizeof(RgSchRaReqInfo));
- continue;
- }
- /* Attempt to include each RA request into the RSP */
- /* Any failure in the procedure is considered to */
- /* affect futher allocations in the same TTI. When */
- /* a failure happens, we break out and complete */
- /* the processing for random access */
- if (rgSCHRamCreateRaCb(cell, &raCb, &err) != ROK)
- {
- break;
- }
- /* Msg3 allocation request to USM */
- if (raReq->raReq.rapId < cell->rachCfg.sizeRaPreambleGrpA)
- preamGrpA = TRUE;
- else
- preamGrpA = FALSE;
- /*ccpu00128820 - MOD - Msg3 alloc double delete issue*/
- rgSCHCmnMsg3GrntReq(cell, raCb->tmpCrnti, preamGrpA, \
- &(raCb->msg3HqProc), &ulAllocRef, &raCb->msg3HqProcId);
- if (ulAllocRef == NULLP)
- {
- rgSCHRamDelRaCb(cell, raCb, TRUE);
- break;
- }
- if (raReq->raReq.cqiPres)
- {
- raCb->ccchCqi = raReq->raReq.cqiIdx;
- }
- else
- {
- raCb->ccchCqi = cellDl->ccchCqi;
- }
- raCb->rapId = raReq->raReq.rapId;
- raCb->ta.pres = TRUE;
- raCb->ta.val = raReq->raReq.ta;
- raCb->msg3Grnt = ulAllocRef->grnt;
- /* Populating the tpc value received */
- raCb->msg3Grnt.tpc = raReq->raReq.tpc;
- /* PHR handling for MSG3 */
- ulAllocRef->raCb = raCb;
-#ifndef LTE_TDD
- /* To the crntTime, add the MIN time at which UE will
- * actually send MSG3 i.e DL_DELTA+6 */
- raCb->msg3AllocTime = cell->crntTime;
- RGSCH_INCR_SUB_FRAME(raCb->msg3AllocTime, RG_SCH_CMN_MIN_MSG3_RECP_INTRVL);
-#else
- msg3SchdIdx = (cell->crntTime.slot+RG_SCH_CMN_DL_DELTA) %
- RGSCH_NUM_SUB_FRAMES;
- /*[ccpu00134666]-MOD-Modify the check to schedule the RAR in
- special subframe */
- if(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][msg3SchdIdx] !=
- RG_SCH_TDD_UL_SUBFRAME)
- {
- RGSCHCMNADDTOCRNTTIME(cell->crntTime,raCb->msg3AllocTime,
- RG_SCH_CMN_DL_DELTA)
- msg3Subfrm = rgSchTddMsg3SubfrmTbl[ulDlCfgIdx][
- raCb->msg3AllocTime.slot];
- RGSCHCMNADDTOCRNTTIME(raCb->msg3AllocTime, raCb->msg3AllocTime,
- msg3Subfrm);
- }
-#endif
- cmLListAdd2Tail(&subFrm->raRsp[rarCnt].raRspLst, &raCb->rspLnk);
- raCb->rspLnk.node = (PTR)raCb;
- cmLListDelFrm(reqLst, reqLst->first);
- allocRapidCnt--;
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&raReq,
- sizeof(RgSchRaReqInfo));
-
- /* SR_RACH_STATS : RAR scheduled */
- rgNumRarSched++;
-
- }
- /* R8 Upgrade */
- /* Fill subframe data members */
- subFrm->raRsp[rarCnt].raRnti = raRspAlloc->rnti;
- subFrm->raRsp[rarCnt].pdcch = raRspAlloc->pdcch;
- subFrm->raRsp[rarCnt].tbSz = raRspAlloc->tbInfo[0].bytesAlloc;
- /* Fill PDCCH data members */
- rgSCHCmnFillPdcch(cell, subFrm->raRsp[rarCnt].pdcch, raRspAlloc);
-
- /* ccpu00139815 */
- if(cell->overLoadBackOffEnab)
- {/* rach Overlaod conrol is triggerd, Skipping this rach */
- subFrm->raRsp[rarCnt].backOffInd.pres = PRSNT_NODEF;
- subFrm->raRsp[rarCnt].backOffInd.val = cell->overLoadBackOffval;
- continue;
- }
- else
- {
- subFrm->raRsp[rarCnt].backOffInd.pres = NOTPRSNT;
- }
-
- /*[ccpu00125212] Avoiding sending of empty RAR in case of RAR window
- is short and UE is sending unauthorised preamble.*/
- reqLst = &cell->raInfo.raReqLst[raRspAlloc->raIndex];
- if ((raRspAlloc->biEstmt) && (reqLst->count))
- {
- subFrm->raRsp[0].backOffInd.pres = PRSNT_NODEF;
- /* Added as part of Upgrade */
- subFrm->raRsp[0].backOffInd.val =
- rgSCHCmnGetBiIndex(cell, reqLst->count);
-
- /* SR_RACH_STATS : Back Off Inds */
- rgNumBI++;
-
- }
- else if ((subFrm->raRsp[rarCnt].raRspLst.first == NULLP) &&
- (subFrm->raRsp[rarCnt].contFreeUeLst.first == NULLP))
- {
- /* Return the grabbed PDCCH */
- rgSCHUtlPdcchPut(cell, &subFrm->pdcchInfo, raRspAlloc->pdcch);
- subFrm->raRsp[rarCnt].pdcch = NULLP;
- DU_LOG("\nERROR --> SCH : rgSCHCmnRaRspAlloc(): "
- "Not even one RaReq.");
- return;
- }
- }
- DU_LOG("\nDEBUG --> SCH : RNTI:%d Scheduled RAR @ (%u,%u) ",
- raRspAlloc->rnti,
- cell->crntTime.sfn,
- cell->crntTime.slot);
- }
- return;
-}
-
-/**
- * @brief This function computes rv.
- *
- * @details
- *
- * Function: rgSCHCmnDlCalcRvForBcch
- * Purpose: This function computes rv.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] Bool si
- * @param[in] uint16_t i
- * @return uint8_t
- *
- **/
-static uint8_t rgSCHCmnDlCalcRvForBcch(RgSchCellCb *cell,Bool si,uint16_t i)
-{
- uint8_t k, rv;
- CmLteTimingInfo frm;
-
- frm = cell->crntTime;
- RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA);
-
- if(si)
- {
- k = i % 4;
- }
- else
- {
- k = (frm.sfn/2) % 4;
- }
- rv = RGSCH_CEIL(3*k, 2) % 4;
- return (rv);
-}
-
-/**
- * @brief This function Processes the Final Allocations
- * made by the RB Allocator against the requested
- * BCCH/PCCH allocations. Assumption: The reuqested
- * allocations are always satisfied completely.
- * Hence no roll back.
- *
- * @details
- *
- * Function: rgSCHCmnDlBcchPcchFnlz
- * Purpose: This function Processes the Final Allocations
- * made by the RB Allocator against the requested.
- * Takes care of PDCCH filling.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlBcchPcchFnlz(RgSchCellCb *cell,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- RgSchDlRbAlloc *rbAllocInfo;
- RgSchDlSf *subFrm;
-
-#ifdef LTE_TDD
- uint8_t nextSfIdx = (cell->crntSfIdx) % RGSCH_SF_ALLOC_SIZE;
-#else
-#ifdef LTEMAC_HDFDD
- uint8_t nextSfIdx = (cell->crntSfIdx + RG_SCH_CMN_HARQ_INTERVAL) % RGSCH_NUM_SUB_FRAMES;
-#else
- uint8_t nextSfIdx = (cell->crntSfIdx) % RGSCH_NUM_SUB_FRAMES;
-#endif
-#endif
-
- /* Moving variables to available scope for optimization */
- RgSchClcDlLcCb *pcch;
- RgSchClcBoRpt *bo;
-#ifndef RGR_SI_SCH
- RgSchClcDlLcCb *bcch;
- Bool sendInd=TRUE;
-#endif
- RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
-
-
- /* handle PCCH */
- rbAllocInfo = &allocInfo->pcchAlloc;
- if (rbAllocInfo->pdcch)
- {
- RgInfSfAlloc *subfrmAlloc = &(cell->sfAllocArr[nextSfIdx]);
-
- /* Added sfIdx calculation for TDD as well */
-#ifndef LTE_TDD
-#ifdef LTEMAC_HDFDD
- nextSfIdx = (cell->crntSfIdx + RG_SCH_CMN_HARQ_INTERVAL) % RGSCH_NUM_SUB_FRAMES;
-#else
- nextSfIdx = (cell->crntSfIdx) % RGSCH_NUM_SUB_FRAMES;
-#endif
-#endif
- subFrm = rbAllocInfo->dlSf;
- pcch = rgSCHDbmGetPcch(cell);
- if(pcch == NULLP)
- {
- DU_LOG("\nERROR --> SCH : rgSCHCmnDlBcchPcchFnlz( ): "
- "No Pcch Present");
- return;
- }
-
- /* Added Dl TB count for paging message transmission*/
-#ifdef LTE_L2_MEAS
- cell->dlUlTbCnt.tbTransDlTotalCnt++;
-#endif
- bo = (RgSchClcBoRpt *)pcch->boLst.first->node;
- cmLListDelFrm(&pcch->boLst, &bo->boLstEnt);
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&bo, sizeof(RgSchClcBoRpt));
- /* Fill subframe data members */
- subFrm->pcch.tbSize = rbAllocInfo->tbInfo[0].bytesAlloc;
- subFrm->pcch.pdcch = rbAllocInfo->pdcch;
- /* Fill PDCCH data members */
- rgSCHCmnFillPdcch(cell, subFrm->pcch.pdcch, rbAllocInfo);
- rgSCHUtlFillRgInfCmnLcInfo(subFrm, subfrmAlloc, pcch->lcId, TRUE);
- /* ccpu00132314-ADD-Update the tx power allocation info
- TODO-Need to add a check for max tx power per symbol */
- subfrmAlloc->cmnLcInfo.pcchInfo.txPwrOffset = cellDl->pcchTxPwrOffset;
- }
-
- /* handle BCCH */
- rbAllocInfo = &allocInfo->bcchAlloc;
- if (rbAllocInfo->pdcch)
- {
- RgInfSfAlloc *subfrmAlloc = &(cell->sfAllocArr[nextSfIdx]);
-#ifndef LTE_TDD
-#ifdef LTEMAC_HDFDD
- nextSfIdx = (cell->crntSfIdx + RG_SCH_CMN_HARQ_INTERVAL) % RGSCH_NUM_SUB_FRAMES;
-#else
- nextSfIdx = (cell->crntSfIdx) % RGSCH_NUM_SUB_FRAMES;
-#endif
-#endif
- subFrm = rbAllocInfo->dlSf;
-
- /* Fill subframe data members */
- subFrm->bcch.tbSize = rbAllocInfo->tbInfo[0].bytesAlloc;
- subFrm->bcch.pdcch = rbAllocInfo->pdcch;
- /* Fill PDCCH data members */
- rgSCHCmnFillPdcch(cell, subFrm->bcch.pdcch, rbAllocInfo);
-
- if(rbAllocInfo->schdFirst)
- {
-#ifndef RGR_SI_SCH
- bcch = rgSCHDbmGetFirstBcchOnDlsch(cell);
- bo = (RgSchClcBoRpt *)bcch->boLst.first->node;
-#else
- /*Copy the SIB1 msg buff into interface buffer */
- SCpyMsgMsg(cell->siCb.crntSiInfo.sib1Info.sib1,
- rgSchCb[cell->instIdx].rgSchInit.region,
- rgSchCb[cell->instIdx].rgSchInit.pool,
- &subfrmAlloc->cmnLcInfo.bcchInfo.pdu);
-#endif/*RGR_SI_SCH*/
- subFrm->bcch.pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.rv =
- rgSCHCmnDlCalcRvForBcch(cell, FALSE, 0);
- }
- else
- {
- uint16_t i;
-#ifdef RGR_SI_SCH
- Buffer *pdu;
-
- i = cell->siCb.siCtx.i;
- /*Decrement the retransmission count */
- cell->siCb.siCtx.retxCntRem--;
-
- /*Copy the SI msg buff into interface buffer */
- if(cell->siCb.siCtx.warningSiFlag == FALSE)
- {
- SCpyMsgMsg(cell->siCb.siArray[cell->siCb.siCtx.siId-1].si,
- rgSchCb[cell->instIdx].rgSchInit.region,
- rgSchCb[cell->instIdx].rgSchInit.pool,
- &subfrmAlloc->cmnLcInfo.bcchInfo.pdu);
- }
- else
- {
- pdu = rgSCHUtlGetWarningSiPdu(cell);
- RGSCH_NULL_CHECK(cell->instIdx, pdu);
- SCpyMsgMsg(pdu,
- rgSchCb[cell->instIdx].rgSchInit.region,
- rgSchCb[cell->instIdx].rgSchInit.pool,
- &subfrmAlloc->cmnLcInfo.bcchInfo.pdu);
- if(cell->siCb.siCtx.retxCntRem == 0)
- {
- rgSCHUtlFreeWarningSiPdu(cell);
- cell->siCb.siCtx.warningSiFlag = FALSE;
-
- }
- }
-#else
- bcch = rgSCHDbmGetSecondBcchOnDlsch(cell);
- bo = (RgSchClcBoRpt *)bcch->boLst.first->node;
- bo->retxCnt--;
- if(bo->retxCnt != cell->siCfg.retxCnt-1)
- {
- sendInd=FALSE;
- }
- i = bo->i;
-#endif/*RGR_SI_SCH*/
- subFrm->bcch.pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.rv =
- rgSCHCmnDlCalcRvForBcch(cell, TRUE, i);
- }
-
- /* Added Dl TB count for SIB1 and SI messages transmission.
- * This counter will be incremented only for the first transmission
- * (with RV 0) of these messages*/
-#ifdef LTE_L2_MEAS
- if(subFrm->bcch.pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.rv == 0)
- {
- cell->dlUlTbCnt.tbTransDlTotalCnt++;
- }
-#endif
-#ifndef RGR_SI_SCH
- if(bo->retxCnt == 0)
- {
- cmLListDelFrm(&bcch->boLst, &bo->boLstEnt);
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&bo, sizeof(RgSchClcBoRpt));
- }
- rgSCHUtlFillRgInfCmnLcInfo(subFrm, subfrmAlloc, bcch->lcId, sendInd);
-#else
- /*Fill the interface info */
- rgSCHUtlFillRgInfCmnLcInfo(subFrm, subfrmAlloc, NULLD, NULLD);
-
- /* ccpu00132314-ADD-Update the tx power allocation info
- TODO-Need to add a check for max tx power per symbol */
- subfrmAlloc->cmnLcInfo.bcchInfo.txPwrOffset = cellDl->bcchTxPwrOffset;
-
- /*mBuf has been already copied above */
-#endif/*RGR_SI_SCH*/
- }
-
- return;
-}
-
-
-#if RG_UNUSED
-/**
- * @brief
- *
- * @details
- *
- * Function: rgSCHCmnUlSetAllUnSched
- * Purpose:
- *
- * Invoked by: Common Scheduler
- *
- * @param[out] RgSchCmnUlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnUlSetAllUnSched(RgSchCmnUlRbAllocInfo *allocInfo)
-{
- CmLList *node;
-
-
- node = allocInfo->contResLst.first;
- while (node)
- {
- rgSCHCmnUlMov2NonSchdCntResLst(allocInfo, (RgSchUeCb *)node->node);
- node = allocInfo->contResLst.first;
- }
-
- node = allocInfo->retxUeLst.first;
- while (node)
- {
- rgSCHCmnUlMov2NonSchdRetxUeLst(allocInfo, (RgSchUeCb *)node->node);
- node = allocInfo->retxUeLst.first;
- }
-
- node = allocInfo->ueLst.first;
- while (node)
- {
- rgSCHCmnUlMov2NonSchdUeLst(allocInfo, (RgSchUeCb *)node->node);
- node = allocInfo->ueLst.first;
- }
-
- return;
-}
-#endif
-
-/**
- * @brief
- *
- * @details
- *
- * Function: rgSCHCmnUlAdd2CntResLst
- * Purpose:
- *
- * Invoked by: Common Scheduler
- *
- * @param[out] RgSchCmnUlRbAllocInfo *allocInfo
- * @param[in] RgSchUeCb *ue
- * @return Void
- *
- **/
-Void rgSCHCmnUlAdd2CntResLst(RgSchCmnUlRbAllocInfo *allocInfo,RgSchUeCb *ue)
-{
- RgSchCmnUeUlAlloc *ulAllocInfo = &((RG_SCH_CMN_GET_UL_UE(ue,ue->cell))->alloc);
- cmLListAdd2Tail(&allocInfo->contResLst, &ulAllocInfo->reqLnk);
- ulAllocInfo->reqLnk.node = (PTR)ue;
- return;
-}
-
-/**
- * @brief
- *
- * @details
- *
- * Function: rgSCHCmnUlAdd2UeLst
- * Purpose:
- *
- * Invoked by: Common Scheduler
- *
- * @param[out] RgSchCmnUlRbAllocInfo *allocInfo
- * @param[in] RgSchUeCb *ue
- * @return Void
- *
- **/
-Void rgSCHCmnUlAdd2UeLst(RgSchCellCb *cell,RgSchCmnUlRbAllocInfo *allocInfo,RgSchUeCb *ue)
-{
- RgSchCmnUeUlAlloc *ulAllocInfo = &((RG_SCH_CMN_GET_UL_UE(ue,cell))->alloc);
- if (ulAllocInfo->reqLnk.node == NULLP)
- {
- cmLListAdd2Tail(&allocInfo->ueLst, &ulAllocInfo->reqLnk);
- ulAllocInfo->reqLnk.node = (PTR)ue;
- }
- return;
-}
-
-/**
- * @brief
- *
- * @details
- *
- * Function: rgSCHCmnAllocUlRb
- * Purpose: To do RB allocations for uplink
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchCmnUlRbAllocInfo *allocInfo
- * @return Void
- **/
-Void rgSCHCmnAllocUlRb(RgSchCellCb *cell,RgSchCmnUlRbAllocInfo *allocInfo)
-{
- RgSchUlSf *sf = allocInfo->sf;
-
- /* Schedule for new transmissions */
- rgSCHCmnUlRbAllocForLst(cell, sf, allocInfo->ueLst.count,
- &allocInfo->ueLst, &allocInfo->schdUeLst,
- &allocInfo->nonSchdUeLst, (Bool)TRUE);
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHCmnUlRbAllocForLst
- *
- * Desc : Allocate for a list in cmn rb alloc information passed
- * in a subframe.
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHCmnUlRbAllocForLst
-(
-RgSchCellCb *cell,
-RgSchUlSf *sf,
-uint32_t count,
-CmLListCp *reqLst,
-CmLListCp *schdLst,
-CmLListCp *nonSchdLst,
-Bool isNewTx
-)
-{
- CmLList *lnk;
- RgSchUlHole *hole;
-#ifdef LTE_L2_MEAS
-#ifdef LTE_TDD
- uint8_t k;
- CmLteTimingInfo timeInfo;
-#endif
-#endif
-
- if(schdLst->count == 0)
- {
- cmLListInit(schdLst);
- }
-
- cmLListInit(nonSchdLst);
-#ifdef LTE_L2_MEAS
- if(isNewTx == TRUE)
- {
- cell->sfAllocArr[cell->crntSfIdx].ulUeInfo.numUes = (uint8_t) count;
-#ifdef LTE_TDD
- RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timeInfo, TFU_ULCNTRL_DLDELTA);
- k = rgSchTddPuschTxKTbl[cell->ulDlCfgIdx][timeInfo.subframe];
- RG_SCH_ADD_TO_CRNT_TIME(timeInfo,
- cell->sfAllocArr[cell->crntSfIdx].ulUeInfo.timingInfo, k);
-#else
- RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime,cell->sfAllocArr[cell->crntSfIdx].ulUeInfo.timingInfo,
- (TFU_ULCNTRL_DLDELTA + RGSCH_PDCCH_PUSCH_DELTA));
-#endif
- }
-#endif
-
- for (lnk = reqLst->first; count; lnk = lnk->next, --count)
- {
- RgSchUeCb *ue = (RgSchUeCb *)lnk->node;
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell);
- S16 ret;
- uint8_t maxRb;
-
-
- if ((hole = rgSCHUtlUlHoleFirst(sf)) == NULLP)
- {
- break;
- }
-
- ueUl->subbandShare = ueUl->subbandRequired;
- if(isNewTx == TRUE)
- {
- maxRb = RGSCH_MIN((ueUl->subbandRequired * MAX_5GTF_VRBG_SIZE), ue->ue5gtfCb.maxPrb);
- }
- ret = rgSCHCmnUlRbAllocForUe(cell, sf, ue, maxRb, hole);
- if (ret == ROK)
- {
- rgSCHCmnUlRbAllocAddUeToLst(cell, ue, schdLst);
- rgSCHCmnUlUeFillAllocInfo(cell, ue);
- }
- else
- {
- gUl5gtfRbAllocFail++;
-#if defined (TENB_STATS) && defined (RG_5GTF)
- cell->tenbStats->sch.ul5gtfRbAllocFail++;
-#endif
- rgSCHCmnUlRbAllocAddUeToLst(cell, ue, nonSchdLst);
- ue->isMsg4PdcchWithCrnti = FALSE;
- ue->isSrGrant = FALSE;
- }
-#ifdef LTE_L2_MEAS
- if(isNewTx == TRUE)
- {
- cell->sfAllocArr[cell->crntSfIdx].ulUeInfo.
- ulAllocInfo[count - 1].rnti = ue->ueId;
- cell->sfAllocArr[cell->crntSfIdx].ulUeInfo.
- ulAllocInfo[count - 1].numPrb = ue->ul.nPrb;
- }
-#endif
- ueUl->subbandShare = 0; /* This reset will take care of
- * all scheduler types */
- }
- for (; count; lnk = lnk->next, --count)
- {
- RgSchUeCb *ue = (RgSchUeCb *)lnk->node;
- rgSCHCmnUlRbAllocAddUeToLst(cell, ue, nonSchdLst);
- ue->isMsg4PdcchWithCrnti = FALSE;
- }
- return;
-}
-
-#ifdef UNUSED_FUNC
-#ifdef TFU_UPGRADE
-/***********************************************************
- *
- * Func : rgSCHCmnUlMdfyGrntForCqi
- *
- * Desc : Modify UL Grant to consider presence of
- * CQI along with PUSCH Data.
- *
- * Ret :
- *
- * Notes:
- * - Scale down iTbs based on betaOffset and
- * size of Acqi Size.
- * - Optionally attempt to increase numSb by 1
- * if input payload size does not fit in due
- * to reduced tbSz as a result of iTbsNew.
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCmnUlMdfyGrntForCqi
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint32_t maxRb,
-uint32_t *numSb,
-uint8_t *iTbs,
-uint32_t hqSz,
-uint32_t stepDownItbs,
-uint32_t effTgt
-)
-{
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(ue->cell);
- uint32_t nPrb;
- uint32_t totREs;
- uint32_t cqiRiREs;
- uint32_t hqREs;
- uint32_t remREsForPusch;
- uint32_t bitsPerRe;
- uint32_t tbSz;
- uint32_t betaOffVal = ue->ul.betaOffstVal;
- uint32_t cqiRiRptSz = ue->ul.cqiRiSz;
- uint32_t betaOffHqVal = rgSchCmnBetaHqOffstTbl[ue->ul.betaHqOffst];
- uint32_t resNumSb = *numSb;
- uint32_t puschEff = 1000;
- uint8_t modOdr;
- uint8_t iMcs;
- Bool mdfyiTbsFlg = FALSE;
- uint8_t resiTbs = *iTbs;
-
-
-
- do
- {
- iMcs = rgSCHCmnUlGetIMcsFrmITbs(resiTbs, RG_SCH_CMN_GET_UE_CTGY(ue));
- RG_SCH_UL_MCS_TO_MODODR(iMcs, modOdr);
- if (RG_SCH_CMN_GET_UE_CTGY(ue) != CM_LTE_UE_CAT_5)
- {
- modOdr = RGSCH_MIN(RGSCH_QM_QPSK, modOdr);
- }
- else
- {
- modOdr = RGSCH_MIN(RGSCH_QM_64QAM, modOdr);
- }
- nPrb = resNumSb * cellUl->sbSize;
- /* Restricting the minumum iTbs requried to modify to 10 */
- if ((nPrb >= maxRb) && (resiTbs <= 10))
- {
- /* Could not accomodate ACQI */
- return RFAILED;
- }
- totREs = nPrb * RG_SCH_CMN_UL_NUM_RE_PER_RB(cellUl);
- tbSz = rgTbSzTbl[0][resiTbs][nPrb-1];
- /* totalREs/tbSz = num of bits perRE. */
- cqiRiREs = (totREs * betaOffVal * cqiRiRptSz)/(1000 * tbSz); /* betaOffVal is represented
- as parts per 1000 */
- hqREs = (totREs * betaOffHqVal * hqSz)/(1000 * tbSz);
- if ((cqiRiREs + hqREs) < totREs)
- {
- remREsForPusch = totREs - cqiRiREs - hqREs;
- bitsPerRe = (tbSz * 1000)/remREsForPusch; /* Multiplying by 1000 for Interger Oper */
- puschEff = bitsPerRe/modOdr;
- }
- if (puschEff < effTgt)
- {
- /* ensure resultant efficiency for PUSCH Data is within 0.93*/
- break;
- }
- else
- {
- /* Alternate between increasing SB or decreasing iTbs until eff is met */
- if (mdfyiTbsFlg == FALSE)
- {
- if (nPrb < maxRb)
- {
- resNumSb = resNumSb + 1;
- }
- mdfyiTbsFlg = TRUE;
- }
- else
- {
- if (resiTbs > 10)
- {
- resiTbs-= stepDownItbs;
- }
- mdfyiTbsFlg = FALSE;
- }
- }
- }while (1); /* Loop breaks if efficency is met
- or returns RFAILED if not able to meet the efficiency */
-
- *numSb = resNumSb;
- *iTbs = resiTbs;
-
- return ROK;
-}
-#endif
-#endif
-/***********************************************************
- *
- * Func : rgSCHCmnUlRbAllocForUe
- *
- * Desc : Do uplink RB allocation for an UE.
- *
- * Ret :
- *
- * Notes: Note that as of now, for retx, maxRb
- * is not considered. Alternatives, such
- * as dropping retx if it crosses maxRb
- * could be considered.
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCmnUlRbAllocForUe
-(
-RgSchCellCb *cell,
-RgSchUlSf *sf,
-RgSchUeCb *ue,
-uint8_t maxRb,
-RgSchUlHole *hole
-)
-{
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell);
- RgSchUlAlloc *alloc = NULLP;
- uint32_t nPrb = 0;
- uint8_t numVrbg;
- uint8_t iMcs;
- uint8_t iMcsCrnt;
-#ifndef RG_5GTF
- RgSchUlHqProcCb *proc = &ueUl->hqEnt.hqProcCb[cellUl->schdHqProcIdx];
-#else
- RgSchUlHqProcCb *proc = NULLP;
-#endif
- RgSchPdcch *pdcch;
- uint32_t reqVrbg;
- uint8_t numVrbgTemp;
-#ifdef RG_5GTF
- TfuDciFormat dciFrmt;
- uint8_t numLyr;
-#endif
-
-#ifdef RG_5GTF
- rgSCHUhmGetAvlHqProc(cell, ue, &proc);
- if (proc == NULLP)
- {
- //DU_LOG("\nINFO --> SCH : UE [%d] HQ Proc unavailable\n", ue->ueId);
- return RFAILED;
- }
-#endif
-
- if (ue->ue5gtfCb.rank == 2)
- {
- dciFrmt = TFU_DCI_FORMAT_A2;
- numLyr = 2;
- }
- else
- {
- dciFrmt = TFU_DCI_FORMAT_A1;
- numLyr = 1;
- }
- /* 5gtf TODO : To pass dci frmt to this function */
- pdcch = rgSCHCmnPdcchAllocCrntSf(cell, ue);
- if(pdcch == NULLP)
- {
- DU_LOG("\nDEBUG --> SCH : rgSCHCmnUlRbAllocForUe(): Could not get PDCCH for CRNTI:%d",ue->ueId);
- return RFAILED;
- }
- gUl5gtfPdcchSchd++;
-#if defined (TENB_STATS) && defined (RG_5GTF)
- cell->tenbStats->sch.ul5gtfPdcchSchd++;
-#endif
-
- //TODO_SID using configured prb as of now
- nPrb = ue->ue5gtfCb.maxPrb;
- reqVrbg = nPrb/MAX_5GTF_VRBG_SIZE;
- iMcs = ue->ue5gtfCb.mcs; //gSCHCmnUlGetIMcsFrmITbs(iTbs,ueCtg);
- iMcsCrnt = iMcs;
- numVrbg = reqVrbg;
-
- if((sf->sfBeamInfo[ue->ue5gtfCb.BeamId].vrbgStart > MAX_5GTF_VRBG)
- || (sf->sfBeamInfo[ue->ue5gtfCb.BeamId].totVrbgAllocated > MAX_5GTF_VRBG))
- {
- DU_LOG("\nINFO --> SCH : 5GTF_ERROR vrbg > 25 valstart = %d valalloc %d\n", sf->sfBeamInfo[ue->ue5gtfCb.BeamId].vrbgStart
- , sf->sfBeamInfo[ue->ue5gtfCb.BeamId].totVrbgAllocated);
- int *p=NULLP;
- *p = 10;
- }
-
- /*TODO_SID: Workaround for alloc. Currently alloc is ulsf based. To handle multiple beams, we need a different
- design. Now alloc are formed based on MAX_5GTF_UE_SCH macro. */
- numVrbgTemp = MAX_5GTF_VRBG/MAX_5GTF_UE_SCH;
- if(numVrbg)
- {
- alloc = rgSCHCmnUlSbAlloc(sf, numVrbgTemp,\
- hole);
- }
- if (alloc == NULLP)
- {
- DU_LOG("\nERROR --> SCH : rgSCHCmnUlRbAllocForUe(): Could not get UlAlloc %d CRNTI:%d",numVrbg,ue->ueId);
- rgSCHCmnPdcchRlsCrntSf(cell, pdcch);
- return RFAILED;
- }
- gUl5gtfAllocAllocated++;
-#if defined (TENB_STATS) && defined (RG_5GTF)
- cell->tenbStats->sch.ul5gtfAllocAllocated++;
-#endif
- alloc->grnt.vrbgStart = sf->sfBeamInfo[ue->ue5gtfCb.BeamId].vrbgStart;
- alloc->grnt.numVrbg = numVrbg;
- alloc->grnt.numLyr = numLyr;
- alloc->grnt.dciFrmt = dciFrmt;
-
- sf->sfBeamInfo[ue->ue5gtfCb.BeamId].vrbgStart += numVrbg;
- sf->sfBeamInfo[ue->ue5gtfCb.BeamId].totVrbgAllocated += numVrbg;
-
- //rgSCHCmnUlAllocFillRbInfo(cell, sf, alloc);
-#ifdef LTE_L2_MEAS
- sf->totPrb += alloc->grnt.numRb;
- ue->ul.nPrb = alloc->grnt.numRb;
-#endif
- if (ue->csgMmbrSta != TRUE)
- {
- cellUl->ncsgPrbCnt += alloc->grnt.numRb;
- }
- cellUl->totPrbCnt += (alloc->grnt.numVrbg * MAX_5GTF_VRBG_SIZE);
- alloc->pdcch = pdcch;
- alloc->grnt.iMcs = iMcs;
- alloc->grnt.iMcsCrnt = iMcsCrnt;
- alloc->grnt.hop = 0;
- /* Initial Num RBs support for UCI on PUSCH */
-#ifdef TFU_UPGRADE
- ue->initNumRbs = (alloc->grnt.numVrbg * MAX_5GTF_VRBG_SIZE);
-#endif
- alloc->forMsg3 = FALSE;
- //RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgTb5gtfSzTbl[0], (iTbs));
-
- //ueUl->alloc.allocdBytes = rgTbSzTbl[0][iTbs][alloc->grnt.numRb-1] / 8;
- /* TODO_SID Allocating based on configured MCS as of now.
- Currently for format A2. When doing multi grp per tti, need to update this. */
- ueUl->alloc.allocdBytes = (rgSch5gtfTbSzTbl[iMcs]/8) * ue->ue5gtfCb.rank;
-
- alloc->grnt.datSz = ueUl->alloc.allocdBytes;
- //TODO_SID Need to check mod order.
- RG_SCH_CMN_TBS_TO_MODODR(iMcs, alloc->grnt.modOdr);
- //alloc->grnt.modOdr = 6;
- alloc->grnt.isRtx = FALSE;
-
- alloc->grnt.rbAssign = rgSCHCmnCalcRiv(MAX_5GTF_VRBG, alloc->grnt.vrbgStart, alloc->grnt.numVrbg);
- alloc->grnt.SCID = 0;
- alloc->grnt.xPUSCHRange = MAX_5GTF_XPUSCH_RANGE;
- alloc->grnt.PMI = 0;
- alloc->grnt.uciOnxPUSCH = 0;
- alloc->grnt.hqProcId = proc->procId;
-
- alloc->hqProc = proc;
- alloc->hqProc->ulSfIdx = cellUl->schdIdx;
- alloc->ue = ue;
- /*commenting to retain the rnti used for transmission SPS/c-rnti */
- alloc->rnti = ue->ueId;
- ueUl->alloc.alloc = alloc;
- /*rntiwari-Adding the debug for generating the graph.*/
- /* No grant attr recorded now */
- return ROK;
-}
-
-/***********************************************************
- *
- * Func : rgSCHCmnUlRbAllocAddUeToLst
- *
- * Desc : Add UE to list (scheduled/non-scheduled list)
- * for UL RB allocation information.
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHCmnUlRbAllocAddUeToLst(RgSchCellCb *cell,RgSchUeCb *ue,CmLListCp *lst)
-{
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell);
- UNUSED(cell);
-
- gUl5gtfUeRbAllocDone++;
-#if defined (TENB_STATS) && defined (RG_5GTF)
- cell->tenbStats->sch.ul5gtfUeRbAllocDone++;
-#endif
- cmLListAdd2Tail(lst, &ueUl->alloc.schdLstLnk);
- ueUl->alloc.schdLstLnk.node = (PTR)ue;
-}
-
-
-/**
- * @brief This function Processes the Final Allocations
- * made by the RB Allocator against the requested.
- *
- * @details
- *
- * Function: rgSCHCmnUlAllocFnlz
- * Purpose: This function Processes the Final Allocations
- * made by the RB Allocator against the requested.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchCmnUlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnUlAllocFnlz(RgSchCellCb *cell,RgSchCmnUlRbAllocInfo *allocInfo)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-
- /* call scheduler specific Finalization */
- cellSch->apisUl->rgSCHUlAllocFnlz(cell, allocInfo);
-
- return;
-}
-
-/**
- * @brief This function Processes the Final Allocations
- * made by the RB Allocator against the requested.
- *
- * @details
- *
- * Function: rgSCHCmnDlAllocFnlz
- * Purpose: This function Processes the Final Allocations
- * made by the RB Allocator against the requested.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @return Void
- *
- **/
-Void rgSCHCmnDlAllocFnlz(RgSchCellCb *cell)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- RgSchCmnDlRbAllocInfo *allocInfo = &cellSch->allocInfo;
-
-
- rgSCHCmnDlCcchRetxFnlz(cell, allocInfo);
- rgSCHCmnDlCcchTxFnlz(cell, allocInfo);
-#ifdef RGR_V1
- /* Added below functions for handling CCCH SDU transmission received
- * after
- * * guard timer expiry*/
- rgSCHCmnDlCcchSduRetxFnlz(cell, allocInfo);
- rgSCHCmnDlCcchSduTxFnlz(cell, allocInfo);
-#endif
- rgSCHCmnDlRaRspFnlz(cell, allocInfo);
- /* call scheduler specific Finalization */
- cellSch->apisDl->rgSCHDlAllocFnlz(cell, allocInfo);
-
- /* Stack Crash problem for TRACE5 Changes. Added the return below */
- return;
-
-}
-
-#ifdef RG_UNUSED
-/**
- * @brief Update an uplink subframe.
- *
- * @details
- *
- * Function : rgSCHCmnUlUpdSf
- *
- * For each allocation
- * - if no more tx needed
- * - Release allocation
- * - else
- * - Perform retransmission
- *
- * @param[in] RgSchUlSf *sf
- * @return Void
- **/
-static Void rgSCHCmnUlUpdSf(RgSchCellCb *cell,RgSchCmnUlRbAllocInfo *allocInfo,RgSchUlSf *sf)
-{
- CmLList *lnk;
-
- while ((lnk = sf->allocs.first))
- {
- RgSchUlAlloc *alloc = (RgSchUlAlloc *)lnk->node;
- lnk = lnk->next;
-
- if ((alloc->hqProc->rcvdCrcInd) || (alloc->hqProc->remTx == 0))
- {
- }
- else
- {
- /* If need to handle all retx together, run another loop separately */
- rgSCHCmnUlHndlAllocRetx(cell, allocInfo, sf, alloc);
- }
- rgSCHCmnUlRlsUlAlloc(cell, sf, alloc);
- }
-
- /* By this time, all allocs would have been cleared and
- * SF is reset to be made ready for new allocations. */
- rgSCHCmnUlSfReset(cell, sf);
- /* In case there are timing problems due to msg3
- * allocations being done in advance, (which will
- * probably happen with the current FDD code that
- * handles 8 subframes) one solution
- * could be to hold the (recent) msg3 allocs in a separate
- * list, and then possibly add that to the actual
- * list later. So at this time while allocations are
- * traversed, the recent msg3 ones are not seen. Anytime after
- * this (a good time is when the usual allocations
- * are made), msg3 allocations could be transferred to the
- * normal list. Not doing this now as it is assumed
- * that incorporation of TDD shall take care of this.
- */
-
-
- return;
-}
-
-/**
- * @brief Handle uplink allocation for retransmission.
- *
- * @details
- *
- * Function : rgSCHCmnUlHndlAllocRetx
- *
- * Processing Steps:
- * - Add to queue for retx.
- * - Do not release here, release happends as part
- * of the loop that calls this function.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchCmnUlRbAllocInfo *allocInfo
- * @param[in] RgSchUlSf *sf
- * @param[in] RgSchUlAlloc *alloc
- * @return Void
- **/
-static Void rgSCHCmnUlHndlAllocRetx(RgSchCellCb *cell,RgSchCmnUlRbAllocInfo *allocInfo,RgSchUlSf *sf,RgSchUlAlloc *alloc)
-{
- uint32_t bytes;
- RgSchCmnUlUe *ueUl;
- bytes = \
- rgTbSzTbl[0][rgSCHCmnUlGetITbsFrmIMcs(alloc->grnt.iMcs)]\
- [alloc->grnt.numRb-1]/8;
- if (!alloc->forMsg3)
- {
- ueUl = RG_SCH_CMN_GET_UL_UE(alloc->ue);
- ueUl->alloc.reqBytes = bytes;
- rgSCHUhmRetx(alloc->hqProc);
- rgSCHCmnUlAdd2RetxUeLst(allocInfo, alloc->ue);
- }
- else
- {
- /* RACHO msg3 retx handling. Part of RACH procedure changes. */
- retxAlloc = rgSCHCmnUlGetUlAlloc(cell, sf, alloc->numSb);
- if (retxAlloc == NULLP)
- {
- DU_LOG("\nERROR --> SCH : rgSCHCmnUlRbAllocForUe():Could not get UlAlloc for msg3Retx RNTI:%d",
- alloc->rnti);
- return;
- }
- retxAlloc->grnt.iMcs = alloc->grnt.iMcs;
- retxAlloc->grnt.iMcsCrnt = rgSchCmnUlRvIdxToIMcsTbl\
- [alloc->hqProc->rvIdx];
- retxAlloc->grnt.nDmrs = 0;
- retxAlloc->grnt.hop = 0;
- retxAlloc->grnt.delayBit = 0;
- retxAlloc->rnti = alloc->rnti;
- retxAlloc->ue = NULLP;
- retxAlloc->pdcch = FALSE;
- retxAlloc->forMsg3 = TRUE;
- retxAlloc->raCb = alloc->raCb;
- retxAlloc->hqProc = alloc->hqProc;
- rgSCHUhmRetx(retxAlloc->hqProc);
- }
- return;
-}
-#endif
-
-/**
- * @brief Uplink Scheduling Handler.
- *
- * @details
- *
- * Function: rgSCHCmnUlAlloc
- * Purpose: This function Handles Uplink Scheduling.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @return Void
- **/
-/* ccpu00132653- The definition of this function made common for TDD and FDD*/
-static Void rgSCHCmnUlAlloc(RgSchCellCb *cell)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
- RgSchCmnUlRbAllocInfo allocInfo;
- RgSchCmnUlRbAllocInfo *allocInfoRef = &allocInfo;
-#ifdef RG_5GTF
- uint8_t idx;
-
-#endif
-
-
- /* Initializing RgSchCmnUlRbAllocInfo structure */
- rgSCHCmnInitUlRbAllocInfo(allocInfoRef);
-
- /* Get Uplink Subframe */
- allocInfoRef->sf = &cellUl->ulSfArr[cellUl->schdIdx];
-#ifdef LTE_L2_MEAS
- /* initializing the UL PRB count */
- allocInfoRef->sf->totPrb = 0;
-#endif
-
-#ifdef LTEMAC_SPS
- rgSCHCmnSpsUlTti(cell, allocInfoRef);
-#endif
-
- if(*allocInfoRef->sf->allocCountRef == 0)
- {
- RgSchUlHole *hole;
-
- if ((hole = rgSCHUtlUlHoleFirst(allocInfoRef->sf)) != NULLP)
- {
- /* Sanity check of holeDb */
- if (allocInfoRef->sf->holeDb->count == 1 && hole->start == 0)
- {
- hole->num = cell->dynCfiCb.bwInfo[cellDl->currCfi].numSb;
- /* Re-Initialize available subbands because of CFI change*/
- allocInfoRef->sf->availSubbands = cell->dynCfiCb.\
- bwInfo[cellDl->currCfi].numSb;
- /*Currently initializing 5gtf ulsf specific initialization here.
- need to do at proper place */
-#ifdef RG_5GTF
- allocInfoRef->sf->numGrpPerTti = cell->cell5gtfCb.ueGrpPerTti;
- allocInfoRef->sf->numUePerGrp = cell->cell5gtfCb.uePerGrpPerTti;
- for(idx = 0; idx < MAX_5GTF_BEAMS; idx++)
- {
- allocInfoRef->sf->sfBeamInfo[idx].totVrbgAllocated = 0;
- allocInfoRef->sf->sfBeamInfo[idx].totVrbgRequired = 0;
- allocInfoRef->sf->sfBeamInfo[idx].vrbgStart = 0;
- }
-#endif
- }
- else
- {
- DU_LOG("\nERROR --> SCH : holeDb sanity check failed");
- }
- }
- }
-
- /* Fix: Adaptive re-transmissions prioritised over other transmissions */
- /* perform adaptive retransmissions */
- rgSCHCmnUlSfReTxAllocs(cell, allocInfoRef->sf);
-
- g5gtfTtiCnt++;
-
- /* Fix: syed Adaptive Msg3 Retx crash. Release all
- Harq processes for which adap Retx failed, to avoid
- blocking. This step should be done before New TX
- scheduling to make hqProc available. Right now we
- dont check if proc is in adap Retx list for considering
- it to be available. But now with this release that
- functionality would be correct. */
-#ifndef RG_5GTF
- rgSCHCmnUlSfRlsRetxProcs(cell, allocInfoRef->sf);
-#endif
-
- /* Specific UL scheduler to perform UE scheduling */
- cellSch->apisUl->rgSCHUlSched(cell, allocInfoRef);
-
- /* Call UL RB allocator module */
- rgSCHCmnAllocUlRb(cell, allocInfoRef);
-
- /* Do group power control for PUSCH */
- rgSCHCmnGrpPwrCntrlPusch(cell, allocInfoRef->sf);
-
- cell->sc.apis->rgSCHDrxStrtInActvTmrInUl(cell);
-
- rgSCHCmnUlAllocFnlz(cell, allocInfoRef);
- if(5000 == g5gtfTtiCnt)
- {
- ul5gtfsidDlAlreadyMarkUl = 0;
- ul5gtfsidDlSchdPass = 0;
- ul5gtfsidUlMarkUl = 0;
- ul5gtfTotSchdCnt = 0;
- g5gtfTtiCnt = 0;
- }
-
- return;
-}
-
-/**
- * @brief send Subframe Allocations.
- *
- * @details
- *
- * Function: rgSCHCmnSndCnsldtInfo
- * Purpose: Send the scheduled
- * allocations to MAC for StaInd generation to Higher layers and
- * for MUXing. PST's RgInfSfAlloc to MAC instance.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @return Void
- **/
-Void rgSCHCmnSndCnsldtInfo(RgSchCellCb *cell)
-{
- RgInfSfAlloc *subfrmAlloc;
- Pst pst;
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-
-
- subfrmAlloc = &(cell->sfAllocArr[cell->crntSfIdx]);
-
- /* Send the allocations to MAC for MUXing */
- rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], cell->macInst);
- subfrmAlloc->cellId = cell->cellId;
- /* Populate the List of UEs needing PDB-based Flow control */
- cellSch->apisDl->rgSCHDlFillFlwCtrlInfo(cell, subfrmAlloc);
-#ifdef LTE_L2_MEAS
- if((subfrmAlloc->rarInfo.numRaRntis) ||
-#ifdef EMTC_ENABLE
- (subfrmAlloc->emtcInfo.rarInfo.numRaRntis) ||
- (subfrmAlloc->emtcInfo.cmnLcInfo.bitMask) ||
- (subfrmAlloc->emtcInfo.ueInfo.numUes) ||
-#endif
- (subfrmAlloc->ueInfo.numUes) ||
- (subfrmAlloc->cmnLcInfo.bitMask) ||
- (subfrmAlloc->ulUeInfo.numUes) ||
- (subfrmAlloc->flowCntrlInfo.numUes))
-#else
- if((subfrmAlloc->rarInfo.numRaRntis) ||
-#ifdef EMTC_ENABLE
- (subfrmAlloc->emtcInfo.rarInfo.numRaRntis) ||
- (subfrmAlloc->emtcInfo.cmnLcInfo.bitMask) ||
- (subfrmAlloc->emtcInfo.ueInfo.numUes) ||
-#endif
- (subfrmAlloc->ueInfo.numUes) ||
- (subfrmAlloc->cmnLcInfo.bitMask) ||
- (subfrmAlloc->flowCntrlInfo.numUes))
-#endif
- {
- RgSchMacSfAlloc(&pst, subfrmAlloc);
- }
-#ifndef LTE_TDD
- cell->crntSfIdx = (cell->crntSfIdx + 1) % RGSCH_NUM_SUB_FRAMES;
-#else
- cell->crntSfIdx = (cell->crntSfIdx + 1) % RGSCH_SF_ALLOC_SIZE;
-#endif
-
- return;
-}
-/**
- * @brief Consolidate Subframe Allocations.
- *
- * @details
- *
- * Function: rgSCHCmnCnsldtSfAlloc
- * Purpose: Consolidate Subframe Allocations.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @return Void
- **/
-Void rgSCHCmnCnsldtSfAlloc(RgSchCellCb *cell)
-{
- RgInfSfAlloc *subfrmAlloc;
- CmLteTimingInfo frm;
- RgSchDlSf *dlSf;
- CmLListCp dlDrxInactvTmrLst;
- CmLListCp dlInActvLst;
- CmLListCp ulInActvLst;
- RgSchCmnCell *cellSch = NULLP;
-
-
- cmLListInit(&dlDrxInactvTmrLst);
- cmLListInit(&dlInActvLst);
- cmLListInit(&ulInActvLst);
-
- subfrmAlloc = &(cell->sfAllocArr[cell->crntSfIdx]);
-
- /* Get Downlink Subframe */
- frm = cell->crntTime;
- RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA);
- dlSf = rgSCHUtlSubFrmGet(cell, frm);
-
- /* Fill the allocation Info */
- rgSCHUtlFillRgInfRarInfo(dlSf, subfrmAlloc, cell);
-
- /* CA dev Start */
- rgSCHUtlFillRgInfUeInfo(dlSf, cell, &dlDrxInactvTmrLst,
- &dlInActvLst, &ulInActvLst);
-#ifdef RG_PFS_STATS
- cell->totalPrb += dlSf->bwAssigned;
-#endif
- /* Mark the following Ues inactive for UL*/
- cellSch = RG_SCH_CMN_GET_CELL(cell);
-
- /* Calling Scheduler specific function with DRX inactive UE list*/
- cellSch->apisUl->rgSCHUlInactvtUes(cell, &ulInActvLst);
- cellSch->apisDl->rgSCHDlInactvtUes(cell, &dlInActvLst);
-
- /* CA dev End */
- /*re/start DRX inactivity timer for the UEs*/
- (Void)rgSCHDrxStrtInActvTmr(cell,&dlDrxInactvTmrLst,RG_SCH_DRX_DL);
-
- return;
-}
-
-/**
- * @brief Initialize the DL Allocation Information Structure.
- *
- * @details
- *
- * Function: rgSCHCmnInitDlRbAllocInfo
- * Purpose: Initialize the DL Allocation Information Structure.
- *
- * Invoked by: Common Scheduler
- *
- * @param[out] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- **/
-static Void rgSCHCmnInitDlRbAllocInfo(RgSchCmnDlRbAllocInfo *allocInfo)
-{
- memset(&allocInfo->pcchAlloc, 0, sizeof(RgSchDlRbAlloc));
- memset(&allocInfo->bcchAlloc, 0, sizeof(RgSchDlRbAlloc));
- memset(allocInfo->raRspAlloc, 0, RG_SCH_CMN_MAX_CMN_PDCCH*sizeof(RgSchDlRbAlloc));
-
- allocInfo->msg4Alloc.msg4DlSf = NULLP;
- cmLListInit(&allocInfo->msg4Alloc.msg4TxLst);
- cmLListInit(&allocInfo->msg4Alloc.msg4RetxLst);
- cmLListInit(&allocInfo->msg4Alloc.schdMsg4TxLst);
- cmLListInit(&allocInfo->msg4Alloc.schdMsg4RetxLst);
- cmLListInit(&allocInfo->msg4Alloc.nonSchdMsg4TxLst);
- cmLListInit(&allocInfo->msg4Alloc.nonSchdMsg4RetxLst);
-#ifdef RGR_V1
- allocInfo->ccchSduAlloc.ccchSduDlSf = NULLP;
- cmLListInit(&allocInfo->ccchSduAlloc.ccchSduTxLst);
- cmLListInit(&allocInfo->ccchSduAlloc.ccchSduRetxLst);
- cmLListInit(&allocInfo->ccchSduAlloc.schdCcchSduTxLst);
- cmLListInit(&allocInfo->ccchSduAlloc.schdCcchSduRetxLst);
- cmLListInit(&allocInfo->ccchSduAlloc.nonSchdCcchSduTxLst);
- cmLListInit(&allocInfo->ccchSduAlloc.nonSchdCcchSduRetxLst);
-#endif
-
- allocInfo->dedAlloc.dedDlSf = NULLP;
- cmLListInit(&allocInfo->dedAlloc.txHqPLst);
- cmLListInit(&allocInfo->dedAlloc.retxHqPLst);
- cmLListInit(&allocInfo->dedAlloc.schdTxHqPLst);
- cmLListInit(&allocInfo->dedAlloc.schdRetxHqPLst);
- cmLListInit(&allocInfo->dedAlloc.nonSchdTxHqPLst);
- cmLListInit(&allocInfo->dedAlloc.nonSchdRetxHqPLst);
-
- cmLListInit(&allocInfo->dedAlloc.txRetxHqPLst);
- cmLListInit(&allocInfo->dedAlloc.schdTxRetxHqPLst);
- cmLListInit(&allocInfo->dedAlloc.nonSchdTxRetxHqPLst);
-#ifdef LTEMAC_SPS
- cmLListInit(&allocInfo->dedAlloc.txSpsHqPLst);
- cmLListInit(&allocInfo->dedAlloc.retxSpsHqPLst);
- cmLListInit(&allocInfo->dedAlloc.schdTxSpsHqPLst);
- cmLListInit(&allocInfo->dedAlloc.schdRetxSpsHqPLst);
- cmLListInit(&allocInfo->dedAlloc.nonSchdTxSpsHqPLst);
- cmLListInit(&allocInfo->dedAlloc.nonSchdRetxSpsHqPLst);
-#endif
-
-#ifdef LTE_ADV
- rgSCHLaaCmnInitDlRbAllocInfo (allocInfo);
-#endif
-
- cmLListInit(&allocInfo->dedAlloc.errIndTxHqPLst);
- cmLListInit(&allocInfo->dedAlloc.schdErrIndTxHqPLst);
- cmLListInit(&allocInfo->dedAlloc.nonSchdErrIndTxHqPLst);
- return;
-}
-
-/**
- * @brief Initialize the UL Allocation Information Structure.
- *
- * @details
- *
- * Function: rgSCHCmnInitUlRbAllocInfo
- * Purpose: Initialize the UL Allocation Information Structure.
- *
- * Invoked by: Common Scheduler
- *
- * @param[out] RgSchCmnUlRbAllocInfo *allocInfo
- * @return Void
- **/
-Void rgSCHCmnInitUlRbAllocInfo(RgSchCmnUlRbAllocInfo *allocInfo)
-{
- allocInfo->sf = NULLP;
- cmLListInit(&allocInfo->contResLst);
- cmLListInit(&allocInfo->schdContResLst);
- cmLListInit(&allocInfo->nonSchdContResLst);
- cmLListInit(&allocInfo->ueLst);
- cmLListInit(&allocInfo->schdUeLst);
- cmLListInit(&allocInfo->nonSchdUeLst);
-
- return;
-}
-
-/**
- * @brief Scheduling for PUCCH group power control.
- *
- * @details
- *
- * Function: rgSCHCmnGrpPwrCntrlPucch
- * Purpose: This function does group power control for PUCCH
- * corresponding to the subframe for which DL UE allocations
- * have happended.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @return Void
- **/
-static Void rgSCHCmnGrpPwrCntrlPucch(RgSchCellCb *cell,RgSchDlSf *dlSf)
-{
- rgSCHPwrGrpCntrlPucch(cell, dlSf);
- return;
-}
-
-/**
- * @brief Scheduling for PUSCH group power control.
- *
- * @details
- *
- * Function: rgSCHCmnGrpPwrCntrlPusch
- * Purpose: This function does group power control, for
- * the subframe for which UL allocation has (just) happened.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUlSf *ulSf
- * @return Void
- **/
-static Void rgSCHCmnGrpPwrCntrlPusch(RgSchCellCb *cell,RgSchUlSf *ulSf)
-{
- /*removed unused variable *cellSch*/
- CmLteTimingInfo frm;
- RgSchDlSf *dlSf;
-
-
- /* Got to pass DL SF corresponding to UL SF, so get that first.
- * There is no easy way of getting dlSf by having the RgSchUlSf*,
- * so use the UL delta from current time to get the DL SF. */
- frm = cell->crntTime;
-
-#ifdef EMTC_ENABLE
- if(cell->emtcEnable == TRUE)
- {
- RGSCH_INCR_SUB_FRAME_EMTC(frm, TFU_DLCNTRL_DLDELTA);
- }
- else
-#endif
- {
- RGSCH_INCR_SUB_FRAME(frm, TFU_DLCNTRL_DLDELTA);
- }
- /* Del filling of dl.time */
- dlSf = rgSCHUtlSubFrmGet(cell, frm);
-
- rgSCHPwrGrpCntrlPusch(cell, dlSf, ulSf);
-
- return;
-}
-
-/* Fix: syed align multiple UEs to refresh at same time */
-/***********************************************************
- *
- * Func : rgSCHCmnApplyUeRefresh
- *
- * Desc : Apply UE refresh in CMN and Specific
- * schedulers. Data rates and corresponding
- * scratchpad variables are updated.
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCmnApplyUeRefresh(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- uint32_t effGbrBsr = 0;
- uint32_t effNonGbrBsr = 0;
- uint32_t lcgId;
-
-
- /* Reset the refresh cycle variableCAP */
- ue->ul.effAmbr = ue->ul.cfgdAmbr;
-
- for (lcgId = 1; lcgId < RGSCH_MAX_LCG_PER_UE; lcgId++)
- {
- if (RGSCH_LCG_ISCFGD(&ue->ul.lcgArr[lcgId]))
- {
- RgSchCmnLcg *cmnLcg = ((RgSchCmnLcg *)(ue->ul.lcgArr[lcgId].sch));
-
- if (RGSCH_IS_GBR_BEARER(cmnLcg->cfgdGbr))
- {
- cmnLcg->effGbr = cmnLcg->cfgdGbr;
- cmnLcg->effDeltaMbr = cmnLcg->deltaMbr;
- cmnLcg->bs = RGSCH_MIN(cmnLcg->reportedBs, cmnLcg->effGbr + cmnLcg->effDeltaMbr);
- /* Considering GBR LCG will be prioritised by UE */
- effGbrBsr += cmnLcg->bs;
- }/* Else no remaing BS so nonLcg0 will be updated when BSR will be received */
- else
- {
- effNonGbrBsr += cmnLcg->reportedBs;
- cmnLcg->bs = RGSCH_MIN(cmnLcg->reportedBs, ue->ul.effAmbr);
- }
- }
- }
- effNonGbrBsr = RGSCH_MIN(effNonGbrBsr,ue->ul.effAmbr);
- ue->ul.nonGbrLcgBs = effNonGbrBsr;
-
- ue->ul.nonLcg0Bs = effGbrBsr + effNonGbrBsr;
- ue->ul.effBsr = ue->ul.nonLcg0Bs +\
- ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs;
-
-
- /* call scheduler specific event handlers
- * for refresh timer expiry */
- cellSch->apisUl->rgSCHUlUeRefresh(cell, ue);
- cellSch->apisDl->rgSCHDlUeRefresh(cell, ue);
-
- return ROK;
-}
-
-/***********************************************************
- *
- * Func : rgSCHCmnTmrExpiry
- *
- * Desc : Adds an UE to refresh queue, so that the UE is
- * periodically triggered to refresh it's GBR and
- * AMBR values.
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCmnTmrExpiry
-(
-PTR cb, /* Pointer to timer control block */
-S16 tmrEvnt /* Timer Event */
-)
-{
- RgSchUeCb *ue = (RgSchUeCb *)cb;
- RgSchCellCb *cell = ue->cell;
-#if (ERRCLASS & ERRCLS_DEBUG)
-#endif
-
-
-#if (ERRCLASS & ERRCLS_DEBUG)
- if (tmrEvnt != RG_SCH_CMN_EVNT_UE_REFRESH)
- {
- DU_LOG("\nERROR --> SCH : rgSCHCmnTmrExpiry(): Invalid "
- "timer event CRNTI:%d",ue->ueId);
- return RFAILED;
- }
-#else
- UNUSED(tmrEvnt);
-#endif
-
- rgSCHCmnApplyUeRefresh(cell, ue);
-
- rgSCHCmnAddUeToRefreshQ(cell, ue, RG_SCH_CMN_REFRESH_TIME);
-
- return ROK;
-}
-
-/***********************************************************
- *
- * Func : rgSCHCmnTmrProc
- *
- * Desc : Timer entry point per cell. Timer
- * processing is triggered at every frame boundary
- * (every 10 ms).
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCmnTmrProc(RgSchCellCb *cell)
-{
- RgSchCmnDlCell *cmnDlCell = RG_SCH_CMN_GET_DL_CELL(cell);
- RgSchCmnUlCell *cmnUlCell = RG_SCH_CMN_GET_UL_CELL(cell);
- /* Moving the assignment of scheduler pointer
- to available scope for optimization */
-
- if ((cell->crntTime.slot % RGSCH_NUM_SUB_FRAMES_5G) == 0)
- {
- /* Reset the counters periodically */
- if ((cell->crntTime.sfn % RG_SCH_CMN_CSG_REFRESH_TIME) == 0)
- {
- RG_SCH_RESET_HCSG_DL_PRB_CNTR(cmnDlCell);
- RG_SCH_RESET_HCSG_UL_PRB_CNTR(cmnUlCell);
- }
- if ((cell->crntTime.sfn % RG_SCH_CMN_OVRLDCTRL_REFRESH_TIME) == 0)
- {
-
- cell->measurements.ulTpt = ((cell->measurements.ulTpt * 95) + ( cell->measurements.ulBytesCnt * 5))/100;
- cell->measurements.dlTpt = ((cell->measurements.dlTpt * 95) + ( cell->measurements.dlBytesCnt * 5))/100;
-
- rgSCHUtlCpuOvrLdAdjItbsCap(cell);
- /* reset cell level tpt measurements for next cycle */
- cell->measurements.ulBytesCnt = 0;
- cell->measurements.dlBytesCnt = 0;
- }
- /* Comparing with Zero instead of % is being done for efficiency.
- * If Timer resolution changes then accordingly update the
- * macro RG_SCH_CMN_REFRESH_TIMERES */
- RgSchCmnCell *sched = RG_SCH_CMN_GET_CELL(cell);
- cmPrcTmr(&sched->tmrTqCp, sched->tmrTq, (PFV)rgSCHCmnTmrExpiry);
- }
-
- return ROK;
-}
-
-
-/***********************************************************
- *
- * Func : rgSchCmnUpdCfiVal
- *
- * Desc : Update the CFI value if CFI switch was done
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSchCmnUpdCfiVal(RgSchCellCb *cell,uint8_t delta)
-{
- RgSchDlSf *dlSf;
- CmLteTimingInfo pdsch;
- RgSchCmnDlCell *cellCmnDl = RG_SCH_CMN_GET_DL_CELL(cell);
- uint8_t dlIdx;
-#ifdef LTE_TDD
- uint8_t mPhich;
- RgSchDlSf *tddSf;
- uint8_t idx;
- uint8_t splSfCfi = 0;
-#endif
-
-
- pdsch = cell->crntTime;
- RGSCH_INCR_SUB_FRAME(pdsch, delta);
- dlSf = rgSCHUtlSubFrmGet(cell, pdsch);
- /* Fix for DCFI FLE issue: when DL delta is 1 and UL delta is 0 and CFI
- *change happens in that SF then UL PDCCH allocation happens with old CFI
- *but CFI in control Req goes updated one since it was stored in the CELL
- */
- dlSf->pdcchInfo.currCfi = cellCmnDl->currCfi;
- if(cell->dynCfiCb.pdcchSfIdx != 0xFF)
- {
-#ifdef LTE_TDD
- dlIdx = rgSCHUtlGetDlSfIdx(cell, &pdsch);
-#else
- dlIdx = (((pdsch.sfn & 1) * RGSCH_NUM_SUB_FRAMES) + (pdsch.slot % RGSCH_NUM_SUB_FRAMES));
- RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, cell->subFrms, dlIdx);
-#endif
- /* If current downlink subframe index is same as pdcch SF index,
- * perform the switching of CFI in this subframe */
- if(cell->dynCfiCb.pdcchSfIdx == dlIdx)
- {
- cellCmnDl->currCfi = cellCmnDl->newCfi;
- cell->dynCfiCb.pdcchSfIdx = 0xFF;
-
- /* Updating the nCce value based on the new CFI */
-#ifdef LTE_TDD
- splSfCfi = cellCmnDl->newCfi;
- for(idx = 0; idx < cell->numDlSubfrms; idx++)
- {
- tddSf = cell->subFrms[idx];
-
- mPhich = rgSchTddPhichMValTbl[cell->ulDlCfgIdx][tddSf->sfNum];
-
- if(tddSf->sfType == RG_SCH_SPL_SF_DATA)
- {
- RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, splSfCfi);
-
- tddSf->nCce = cell->dynCfiCb.cfi2NCceTbl[mPhich][splSfCfi];
- }
- else
- {
- tddSf->nCce = cell->dynCfiCb.cfi2NCceTbl[mPhich][cellCmnDl->currCfi];
- }
- }
- /* Setting the switch over window length based on config index.
- * During switch over period all the UL trnsmissions are Acked
- * to UEs */
- cell->dynCfiCb.switchOvrWinLen =
- rgSchCfiSwitchOvrWinLen[cell->ulDlCfgIdx];
-#else
- cell->nCce = cell->dynCfiCb.cfi2NCceTbl[0][cellCmnDl->currCfi];
- /* Fix for DCFI FLE issue: when DL delta is 1 and UL delta is 0 and CFI
- *change happens in that SF then UL PDCCH allocation happens with old CFI
- *but CFI in control Req goes updated one since it was stored in the CELL
- */
- dlSf->pdcchInfo.currCfi = cellCmnDl->currCfi;
- cell->dynCfiCb.switchOvrWinLen = rgSchCfiSwitchOvrWinLen[7];
-#endif
- }
- }
-
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSchCmnUpdtPdcchSfIdx
- *
- * Desc : Update the switch over window length
- *
- * Ret : void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-#ifdef LTE_TDD
-static Void rgSchCmnUpdtPdcchSfIdx(RgSchCellCb *cell,uint8_t dlIdx,uint8_t sfNum)
-#else
-static Void rgSchCmnUpdtPdcchSfIdx(RgSchCellCb *cell,uint8_t dlIdx)
-#endif
-{
- uint8_t idx;
-
-
- /* Resetting the parameters on CFI switching */
- cell->dynCfiCb.cceUsed = 0;
- cell->dynCfiCb.lowCceCnt = 0;
-
- cell->dynCfiCb.cceFailSum = 0;
- cell->dynCfiCb.cceFailCnt = 0;
- cell->dynCfiCb.prevCceFailIdx = 0;
-
- cell->dynCfiCb.switchOvrInProgress = TRUE;
-
- for(idx = 0; idx < cell->dynCfiCb.numFailSamples; idx++)
- {
- cell->dynCfiCb.cceFailSamples[idx] = 0;
- }
-
- cell->dynCfiCb.ttiCnt = 0;
-
- cell->dynCfiCb.cfiSwitches++;
- cfiSwitchCnt = cell->dynCfiCb.cfiSwitches;
-
-#ifdef LTE_TDD
- cell->dynCfiCb.pdcchSfIdx = (dlIdx +
- rgSchTddPdcchSfIncTbl[cell->ulDlCfgIdx][sfNum]) % cell->numDlSubfrms;
-#else
- cell->dynCfiCb.pdcchSfIdx = (dlIdx + RG_SCH_CFI_APPLY_DELTA) % \
- RGSCH_NUM_DL_slotS;
-#endif
-}
-
-/***********************************************************
- *
- * Func : rgSchCmnUpdCfiDb
- *
- * Desc : Update the counters related to dynamic
- * CFI feature in cellCb.
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSchCmnUpdCfiDb(RgSchCellCb *cell,uint8_t delta)
-{
- CmLteTimingInfo frm;
- RgSchDlSf *dlSf;
-#ifdef LTE_TDD
- uint8_t mPhich;
- Bool isHiDci0;
-#endif
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- uint8_t nCceLowerCfi = 0;
- uint8_t currCfi;
- uint8_t cceFailIdx;
- uint32_t totalCce;
- uint8_t dlIdx;
- uint16_t ttiMod;
-
-
- /* Get Downlink Subframe */
- frm = cell->crntTime;
- RGSCH_INCR_SUB_FRAME(frm, delta);
-
-#ifdef LTE_TDD
- dlIdx = rgSCHUtlGetDlSfIdx(cell, &frm);
- dlSf = cell->subFrms[dlIdx];
- isHiDci0 = rgSchTddPuschTxKTbl[cell->ulDlCfgIdx][dlSf->sfNum];
-#else
- /* Changing the idexing
- so that proper subframe is selected */
- dlIdx = (((frm.sfn & 1) * RGSCH_NUM_SUB_FRAMES) + (frm.slot % RGSCH_NUM_SUB_FRAMES));
- RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, cell->subFrms, dlIdx);
- dlSf = cell->subFrms[dlIdx];
-#endif
-
- currCfi = cellSch->dl.currCfi;
-
- if(!cell->dynCfiCb.switchOvrInProgress)
- {
- do{
- if(!cell->dynCfiCb.isDynCfiEnb)
- {
- if(currCfi != cellSch->cfiCfg.cfi)
- {
- if(currCfi < cellSch->cfiCfg.cfi)
- {
- RG_SCH_CFI_STEP_UP(cell, cellSch, currCfi)
- cfiIncr = cell->dynCfiCb.cfiIncr;
- }
- else
- {
- RG_SCH_CFI_STEP_DOWN(cell, cellSch, currCfi)
- cfiDecr = cell->dynCfiCb.cfiDecr;
- }
- }
- break;
- }
-
-#ifdef LTE_TDD
- /* Setting ttiMod to 0 for ttiCnt > 1000 in case if this
- * function was not called in UL subframe*/
- if(cell->dynCfiCb.ttiCnt > RGSCH_CFI_TTI_MON_INTRVL)
- {
- ttiMod = 0;
- }
- else
-#endif
- {
- ttiMod = cell->dynCfiCb.ttiCnt % RGSCH_CFI_TTI_MON_INTRVL;
- }
-
- dlSf->dlUlBothCmplt++;
-#ifdef LTE_TDD
- if((dlSf->dlUlBothCmplt == 2) || (!isHiDci0))
-#else
- if(dlSf->dlUlBothCmplt == 2)
-#endif
- {
- /********************STEP UP CRITERIA********************/
- /* Updating the CCE failure count parameter */
- cell->dynCfiCb.cceFailCnt += dlSf->isCceFailure;
- cell->dynCfiCb.cceFailSum += dlSf->isCceFailure;
-
- /* Check if cfi step up can be performed */
- if(currCfi < cell->dynCfiCb.maxCfi)
- {
- if(cell->dynCfiCb.cceFailSum >= cell->dynCfiCb.cfiStepUpTtiCnt)
- {
- RG_SCH_CFI_STEP_UP(cell, cellSch, currCfi)
- cfiIncr = cell->dynCfiCb.cfiIncr;
- break;
- }
- }
-
- /********************STEP DOWN CRITERIA********************/
-
- /* Updating the no. of CCE used in this dl subframe */
- cell->dynCfiCb.cceUsed += dlSf->cceCnt;
-
- if(currCfi > RGSCH_MIN_CFI_VAL)
- {
- /* calculating the number of CCE for next lower CFI */
-#ifdef LTE_TDD
- mPhich = rgSchTddPhichMValTbl[cell->ulDlCfgIdx][dlSf->sfNum];
- nCceLowerCfi = cell->dynCfiCb.cfi2NCceTbl[mPhich][currCfi-1];
-#else
- nCceLowerCfi = cell->dynCfiCb.cfi2NCceTbl[0][currCfi-1];
-#endif
- if(dlSf->cceCnt < nCceLowerCfi)
- {
- /* Updating the count of TTIs in which no. of CCEs
- * used were less than the CCEs of next lower CFI */
- cell->dynCfiCb.lowCceCnt++;
- }
-
- if(ttiMod == 0)
- {
- totalCce = (nCceLowerCfi * cell->dynCfiCb.cfiStepDownTtiCnt *
- RGSCH_CFI_CCE_PERCNTG)/100;
-
- if((!cell->dynCfiCb.cceFailSum) &&
- (cell->dynCfiCb.lowCceCnt >=
- cell->dynCfiCb.cfiStepDownTtiCnt) &&
- (cell->dynCfiCb.cceUsed < totalCce))
- {
- RG_SCH_CFI_STEP_DOWN(cell, cellSch, currCfi)
- cfiDecr = cell->dynCfiCb.cfiDecr;
- break;
- }
- }
- }
-
- cceFailIdx = ttiMod/cell->dynCfiCb.failSamplePrd;
-
- if(cceFailIdx != cell->dynCfiCb.prevCceFailIdx)
- {
- /* New sample period has started. Subtract the old count
- * from the new sample period */
- cell->dynCfiCb.cceFailSum -= cell->dynCfiCb.cceFailSamples[cceFailIdx];
-
- /* Store the previous sample period data */
- cell->dynCfiCb.cceFailSamples[cell->dynCfiCb.prevCceFailIdx]
- = cell->dynCfiCb.cceFailCnt;
-
- cell->dynCfiCb.prevCceFailIdx = cceFailIdx;
-
- /* Resetting the CCE failure count as zero for next sample period */
- cell->dynCfiCb.cceFailCnt = 0;
- }
-
- if(ttiMod == 0)
- {
- /* Restting the parametrs after Monitoring Interval expired */
- cell->dynCfiCb.cceUsed = 0;
- cell->dynCfiCb.lowCceCnt = 0;
- cell->dynCfiCb.ttiCnt = 0;
- }
-
- cell->dynCfiCb.ttiCnt++;
- }
- }while(0);
-
- if(cellSch->dl.newCfi != cellSch->dl.currCfi)
- {
-#ifdef LTE_TDD
- rgSchCmnUpdtPdcchSfIdx(cell, dlIdx, dlSf->sfNum);
-#else
- rgSchCmnUpdtPdcchSfIdx(cell, dlIdx);
-#endif
- }
- }
-}
-
-/**
- * @brief Dl Scheduler for Broadcast and Common channel scheduling.
- *
- * @details
- *
- * Function: rgSCHCmnDlCommonChSch
- * Purpose: This function schedules DL Common channels for LTE.
- * Invoked by TTI processing in TOM. Scheduling is done for
- * BCCH, PCCH, Msg4, CCCH SDU, RAR in that order
- *
- * Invoked by: TOM (TTI processing)
- *
- * @param[in] RgSchCellCb *cell
- * @return Void
- **/
-Void rgSCHCmnDlCommonChSch(RgSchCellCb *cell)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-
-
- cellSch->apisDl->rgSCHDlTickForPdbTrkng(cell);
- rgSchCmnUpdCfiVal(cell, RG_SCH_CMN_DL_DELTA);
-
- /* handle Inactive UEs for DL */
- rgSCHCmnHdlDlInactUes(cell);
-
- /* Send a Tick to Refresh Timer */
- rgSCHCmnTmrProc(cell);
-
- if (cell->isDlDataAllwd && (cell->stopSiSch == FALSE))
- {
- rgSCHCmnInitRbAlloc(cell);
- /* Perform DL scheduling of BCCH, PCCH */
- rgSCHCmnDlBcchPcchAlloc(cell);
- }
- else
- {
- if(cell->siCb.inWindow != 0)
- {
- cell->siCb.inWindow--;
- }
- }
- if (cell->isDlDataAllwd && (cell->stopDlSch == FALSE))
- {
- rgSCHCmnDlCcchRarAlloc(cell);
- }
- return;
-}
-
-/**
- * @brief Scheduler invocation per TTI.
- *
- * @details
- *
- * Function: rgSCHCmnUlSch
- * Purpose: This function implements UL scheduler alone. This is to
- * be able to perform scheduling with more flexibility.
- *
- * Invoked by: TOM (TTI processing)
- *
- * @param[in] RgSchCellCb *cell
- * @return Void
- **/
-Void rgSCHCmnUlSch(RgSchCellCb *cell)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-
-
-#ifdef LTE_ADV
- /* LAA_SCELL: */
- if(TRUE == rgSCHLaaSCellEnabled(cell))
- {
- return;
- }
-#endif
-
- if(cellSch->ul.schdIdx != RGSCH_INVALID_INFO)
- {
- rgSchCmnUpdCfiVal(cell, TFU_ULCNTRL_DLDELTA);
-
- /* Handle Inactive UEs for UL */
- rgSCHCmnHdlUlInactUes(cell);
- /* Perform UL Scheduling EVERY TTI */
- rgSCHCmnUlAlloc(cell);
-
- /* Calling function to update CFI parameters*/
- rgSchCmnUpdCfiDb(cell, TFU_ULCNTRL_DLDELTA);
-
- if(cell->dynCfiCb.switchOvrWinLen > 0)
- {
- /* Decrementing the switchover window length */
- cell->dynCfiCb.switchOvrWinLen--;
-
- if(!cell->dynCfiCb.switchOvrWinLen)
- {
- if(cell->dynCfiCb.dynCfiRecfgPend)
- {
- /* Toggling the Dynamic CFI enabling */
- cell->dynCfiCb.isDynCfiEnb ^= 1;
- rgSCHDynCfiReCfg(cell, cell->dynCfiCb.isDynCfiEnb);
- cell->dynCfiCb.dynCfiRecfgPend = FALSE;
- }
- cell->dynCfiCb.switchOvrInProgress = FALSE;
- }
- }
- }
-#ifdef LTE_TDD
-#ifdef LTEMAC_SPS
- else
- {
- rgSCHCmnSpsUlTti(cell, NULLP);
- }
-#endif
-#endif
-
- return;
-}
-
-\f
-/**
- * @brief This function updates the scheduler with service for an UE.
- *
- * @details
- *
- * Function: rgSCHCmnDlDedBoUpd
- * Purpose: This function should be called whenever there is a
- * change BO for a service.
- *
- * Invoked by: BO and Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @param[in] RgSchDlLcCb* svc
- * @return Void
- *
- **/
-Void rgSCHCmnDlDedBoUpd(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *svc)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-
- /* RACHO : if UEs idle time exceeded and a BO update
- * is received, then add UE to the pdcch Order Q */
- if (RG_SCH_CMN_IS_UE_PDCCHODR_INACTV(ue))
- {
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue, cell);
- /* If PDCCH order is already triggered and we are waiting for
- * RACH from UE then do not add to PdcchOdrQ. */
- if (ueDl->rachInfo.rapIdLnk.node == NULLP)
- {
- rgSCHCmnDlAdd2PdcchOdrQ(cell, ue);
- }
- }
-
-#ifdef LTEMAC_SPS
-
- /* If SPS service, invoke SPS module */
- if (svc->dlLcSpsCfg.isSpsEnabled)
- {
- rgSCHCmnSpsDlDedBoUpd(cell, ue, svc);
- /* Note: Retrun from here, no update needed in other schedulers */
- return;
- }
-#endif
-#ifdef EMTC_ENABLE
- if((cell->emtcEnable)&&(TRUE == ue->isEmtcUe))
- {
- cellSch->apisEmtcDl->rgSCHDlDedBoUpd(cell, ue, svc);
- //DU_LOG("\nINFO --> SCH : rgSCHEMTCDlDedBoUpd\n");
- }
- else
-#endif
- {
- cellSch->apisDl->rgSCHDlDedBoUpd(cell, ue, svc);
- }
-#ifdef LTE_ADV
- if (ue->numSCells)
- {
- rgSCHSCellDlDedBoUpd(cell, ue, svc);
- }
-#endif
- return;
-}
-
-\f
-/**
- * @brief Removes an UE from Cell's TA List.
- *
- * @details
- *
- * Function: rgSCHCmnRmvFrmTaLst
- * Purpose: Removes an UE from Cell's TA List.
- *
- * Invoked by: Specific Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @return Void
- *
- **/
-Void rgSCHCmnRmvFrmTaLst(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnDlCell *cellCmnDl = RG_SCH_CMN_GET_DL_CELL(cell);
-
-#ifdef EMTC_ENABLE
- if(cell->emtcEnable && ue->isEmtcUe)
- {
- rgSCHEmtcRmvFrmTaLst(cellCmnDl,ue);
- }
- else
-#endif
- {
- cmLListDelFrm(&cellCmnDl->taLst, &ue->dlTaLnk);
- ue->dlTaLnk.node = (PTR)NULLP;
- }
- return;
-}
-
-/* Fix: syed Remove the msg4Proc from cell
- * msg4Retx Queue. I have used CMN scheduler function
- * directly. Please define a new API and call this
- * function through that. */
-\f
-/**
- * @brief This function removes MSG4 HARQ process from cell RETX Queues.
- *
- * @details
- *
- * Function: rgSCHCmnDlMsg4ProcRmvFrmRetx
- * Purpose: This function removes MSG4 HARQ process from cell RETX Queues.
- *
- * Invoked by: UE/RACB deletion.
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchDlHqProc* hqP
- * @return Void
- *
- **/
-Void rgSCHCmnDlMsg4ProcRmvFrmRetx(RgSchCellCb *cell,RgSchDlHqProcCb *hqP)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-
- if (hqP->tbInfo[0].ccchSchdInfo.retxLnk.node)
- {
- if (hqP->hqE->msg4Proc == hqP)
- {
- cmLListDelFrm(&cellSch->dl.msg4RetxLst, \
- &hqP->tbInfo[0].ccchSchdInfo.retxLnk);
- hqP->tbInfo[0].ccchSchdInfo.retxLnk.node = (PTR)NULLP;
- }
-#ifdef RGR_V1
- else if(hqP->hqE->ccchSduProc == hqP)
- {
- cmLListDelFrm(&cellSch->dl.ccchSduRetxLst,
- &hqP->tbInfo[0].ccchSchdInfo.retxLnk);
- hqP->tbInfo[0].ccchSchdInfo.retxLnk.node = (PTR)NULLP;
- }
-#endif
- }
- return;
-}
-
-\f
-/**
- * @brief This function adds a HARQ process for retx.
- *
- * @details
- *
- * Function: rgSCHCmnDlProcAddToRetx
- * Purpose: This function adds a HARQ process to retransmission
- * queue. This may be performed when a HARQ ack is
- * unsuccessful.
- *
- * Invoked by: HARQ feedback processing
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchDlHqProc* hqP
- * @return Void
- *
- **/
-Void rgSCHCmnDlProcAddToRetx(RgSchCellCb *cell,RgSchDlHqProcCb *hqP)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-
- if (hqP->hqE->msg4Proc == hqP) /* indicating msg4 transmission */
- {
- cmLListAdd2Tail(&cellSch->dl.msg4RetxLst, \
- &hqP->tbInfo[0].ccchSchdInfo.retxLnk);
- hqP->tbInfo[0].ccchSchdInfo.retxLnk.node = (PTR)hqP;
- }
-#ifdef RGR_V1
- else if(hqP->hqE->ccchSduProc == hqP)
- {
- /*If CCCH SDU being transmitted without cont res CE*/
- cmLListAdd2Tail(&cellSch->dl.ccchSduRetxLst,
- &hqP->tbInfo[0].ccchSchdInfo.retxLnk);
- hqP->tbInfo[0].ccchSchdInfo.retxLnk.node = (PTR)hqP;
- }
-#endif
- else
- {
-#ifdef LTEMAC_SPS
- if (RG_SCH_CMN_SPS_DL_IS_SPS_HQP(hqP))
- {
- /* Invoke SPS module for SPS HARQ proc re-transmission handling */
- rgSCHCmnSpsDlProcAddToRetx(cell, hqP);
- return;
- }
-#endif /* LTEMAC_SPS */
-#ifdef EMTC_ENABLE
- if((TRUE == cell->emtcEnable)
- && (TRUE == hqP->hqE->ue->isEmtcUe))
- {
- cellSch->apisEmtcDl->rgSCHDlProcAddToRetx(cell, hqP);
- }
- else
-#endif
- {
- cellSch->apisDl->rgSCHDlProcAddToRetx(cell, hqP);
- }
- }
- return;
-}
-
-\f
-/**
- * @brief This function performs RI validation and
- * updates it to the ueCb.
- *
- * @details
- *
- * Function: rgSCHCmnDlSetUeRi
- * Purpose: This function performs RI validation and
- * updates it to the ueCb.
- *
- * Invoked by: rgSCHCmnDlCqiInd
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t ri
- * @param[in] Bool isPeriodic
- * @return Void
- *
- **/
-static Void rgSCHCmnDlSetUeRi(RgSchCellCb *cell,RgSchUeCb *ue,uint8_t ri,Bool isPer)
-{
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- RgSchCmnUeInfo *ueSchCmn = RG_SCH_CMN_GET_CMN_UE(ue);
-
-#ifdef TFU_UPGRADE
- RgSchUePCqiCb *cqiCb = RG_SCH_GET_UE_CELL_CQI_CB(ue,cell);
- UNUSED(isPer);
-#endif
-
-
- /* FIX for RRC Reconfiguration issue */
- /* ccpu00140894- During Tx Mode transition RI report will not entertained for
- * specific during which SCH expecting UE can complete TX mode transition*/
- if (ue->txModeTransCmplt == FALSE)
- {
- return;
- }
-
- /* Restrict the Number of TX layers to cell->numTxAntPorts.
- * Protection from invalid RI values. */
- ri = RGSCH_MIN(ri, cell->numTxAntPorts);
-
- /* Special case of converting PMI to sane value when
- * there is a switch in RI from 1 to 2 and PMI reported
- * for RI=1 is invalid for RI=2 */
- if ((cell->numTxAntPorts == 2) && (ue->mimoInfo.txMode == RGR_UE_TM_4))
- {
- if ((ri == 2) && ( ueDl->mimoInfo.ri == 1))
- {
- ueDl->mimoInfo.pmi = (ueDl->mimoInfo.pmi < 2)? 1:2;
- }
- }
-
- /* Restrict the Number of TX layers according to the UE Category */
- ueDl->mimoInfo.ri = RGSCH_MIN(ri, rgUeCatTbl[ueSchCmn->ueCat].maxTxLyrs);
-#ifdef TENB_STATS
- ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].riCnt[ueDl->mimoInfo.ri-1]++;
- cell->tenbStats->sch.riCnt[ueDl->mimoInfo.ri-1]++;
-#endif
-
-#ifdef TENB_STATS
- ue->tenbStats->stats.nonPersistent.sch[0].riCnt[ueDl->mimoInfo.ri-1]++;
- cell->tenbStats->sch.riCnt[ueDl->mimoInfo.ri-1]++;
-#endif
-
-#ifdef TFU_UPGRADE
- if (isPer)
- {
- /* If RI is from Periodic CQI report */
- cqiCb->perRiVal = ueDl->mimoInfo.ri;
- /* Reset at every Periodic RI Reception */
- cqiCb->invalidateCqi = FALSE;
- }
- else
- {
- /* If RI is from Aperiodic CQI report */
- if (cqiCb->perRiVal != ueDl->mimoInfo.ri)
- {
- /* if this aperRI is different from last reported
- * perRI then invalidate all CQI reports till next
- * perRI */
- cqiCb->invalidateCqi = TRUE;
- }
- else
- {
- cqiCb->invalidateCqi = FALSE;
- }
- }
-#endif
-
- if (ueDl->mimoInfo.ri > 1)
- {
- RG_SCH_CMN_UNSET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_RI_1);
- }
- else if (ue->mimoInfo.txMode == RGR_UE_TM_3) /* ri == 1 */
- {
- RG_SCH_CMN_SET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_RI_1);
- }
-
- return;
-}
-
-\f
-/**
- * @brief This function performs PMI validation and
- * updates it to the ueCb.
- *
- * @details
- *
- * Function: rgSCHCmnDlSetUePmi
- * Purpose: This function performs PMI validation and
- * updates it to the ueCb.
- *
- * Invoked by: rgSCHCmnDlCqiInd
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t pmi
- * @return Void
- *
- **/
-static S16 rgSCHCmnDlSetUePmi(RgSchCellCb *cell,RgSchUeCb *ue,uint8_t pmi)
-{
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
-
- if (ue->txModeTransCmplt == FALSE)
- {
- return RFAILED;
- }
-
- if (cell->numTxAntPorts == 2)
- {
- if (pmi > 3)
- {
- return RFAILED;
- }
- if (ueDl->mimoInfo.ri == 2)
- {
- /*ccpu00118150 - MOD - changed pmi value validation from 0 to 2*/
- /* PMI 2 and 3 are invalid incase of 2 TxAnt and 2 Layered SM */
- if (pmi == 2 || pmi == 3)
- {
- return RFAILED;
- }
- ueDl->mimoInfo.pmi = pmi+1;
- }
- else
- {
- ueDl->mimoInfo.pmi = pmi;
- }
- }
- else if (cell->numTxAntPorts == 4)
- {
- if (pmi > 15)
- {
- return RFAILED;
- }
- ueDl->mimoInfo.pmi = pmi;
- }
- /* Reset the No PMI Flag in forceTD */
- RG_SCH_CMN_UNSET_FORCE_TD(ue, cell, RG_SCH_CMN_TD_NO_PMI);
- return ROK;
-}
-
-/**
- * @brief This function Updates the DL CQI on PUCCH for the UE.
- *
- * @details
- *
- * Function: rgSCHCmnDlProcCqiMode10
- *
- * This function updates the DL CQI on PUCCH for the UE.
- *
- * Invoked by: rgSCHCmnDlCqiOnPucchInd
- *
- * Processing Steps:
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] TfuDlCqiRpt *dlCqiRpt
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-#ifdef RGR_CQI_REPT
-static inline Void rgSCHCmnDlProcCqiMode10
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-TfuDlCqiPucch *pucchCqi,
-Bool *isCqiAvail
-)
-#else
-static inline Void rgSCHCmnDlProcCqiMode10
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-TfuDlCqiPucch *pucchCqi
-)
-#endif
-{
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
-
- if (pucchCqi->u.mode10Info.type == TFU_RPT_CQI)
- {
- /*ccpu00109787 - ADD - Check for non-zero CQI*/
- /* Checking whether the decoded CQI is a value between 1 and 15*/
- if((pucchCqi->u.mode10Info.u.cqi) && (pucchCqi->u.mode10Info.u.cqi
- < RG_SCH_CMN_MAX_CQI))
- {
- ueDl->cqiFlag = TRUE;
- ueDl->mimoInfo.cwInfo[0].cqi = pucchCqi->u.mode10Info.u.cqi;
- ueDl->mimoInfo.cwInfo[1].cqi = ueDl->mimoInfo.cwInfo[0].cqi;
- /* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
- *isCqiAvail = TRUE;
-#endif
- }
- else
- {
- return;
- }
- }
- else if (pucchCqi->u.mode10Info.type == TFU_RPT_RI)
- {
- if ( RG_SCH_CMN_IS_RI_VALID(pucchCqi->u.mode10Info.u.ri) )
- {
- rgSCHCmnDlSetUeRi(cell, ue, pucchCqi->u.mode10Info.u.ri,
- TRUE);
- }
- else
- {
- DU_LOG("\nERROR --> SCH : Invalid RI value(%x) CRNTI:%d",
- pucchCqi->u.mode10Info.u.ri,ue->ueId);
- return;
- }
- }
-}
-
-/**
- * @brief This function Updates the DL CQI on PUCCH for the UE.
- *
- * @details
- *
- * Function: rgSCHCmnDlProcCqiMode11
- *
- * This function updates the DL CQI on PUCCH for the UE.
- *
- * Invoked by: rgSCHCmnDlCqiOnPucchInd
- *
- * Processing Steps:
- * Process CQI MODE 11
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] TfuDlCqiRpt *dlCqiRpt
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-#ifdef RGR_CQI_REPT
-static inline Void rgSCHCmnDlProcCqiMode11
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-TfuDlCqiPucch *pucchCqi,
-Bool *isCqiAvail,
-Bool *is2ndCwCqiAvail
-)
-#else
-static inline Void rgSCHCmnDlProcCqiMode11
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-TfuDlCqiPucch *pucchCqi
-)
-#endif
-{
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
-
- if (pucchCqi->u.mode11Info.type == TFU_RPT_CQI)
- {
- ue->mimoInfo.puschFdbkVld = FALSE;
- /*ccpu00109787 - ADD - Check for non-zero CQI*/
- if((pucchCqi->u.mode11Info.u.cqi.cqi) &&
- (pucchCqi->u.mode11Info.u.cqi.cqi < RG_SCH_CMN_MAX_CQI))
- {
- ueDl->cqiFlag = TRUE;
- /* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
- *isCqiAvail = TRUE;
-#endif
- ueDl->mimoInfo.cwInfo[0].cqi = pucchCqi->u.mode11Info.u.cqi.cqi;
- if (pucchCqi->u.mode11Info.u.cqi.wideDiffCqi.pres)
- {
- RG_SCH_UPDT_CW2_CQI(ueDl->mimoInfo.cwInfo[0].cqi, \
- ueDl->mimoInfo.cwInfo[1].cqi, \
- pucchCqi->u.mode11Info.u.cqi.wideDiffCqi.val);
-#ifdef RGR_CQI_REPT
- /* ccpu00117259 - ADD - Considering second codeword CQI info
- incase of MIMO for CQI Reporting */
- *is2ndCwCqiAvail = TRUE;
-#endif
- }
- }
- else
- {
- return;
- }
- rgSCHCmnDlSetUePmi(cell, ue, \
- pucchCqi->u.mode11Info.u.cqi.pmi);
- }
- else if (pucchCqi->u.mode11Info.type == TFU_RPT_RI)
- {
- if( RG_SCH_CMN_IS_RI_VALID(pucchCqi->u.mode11Info.u.ri))
- {
- rgSCHCmnDlSetUeRi(cell, ue, pucchCqi->u.mode11Info.u.ri,
- TRUE);
- }
- else
- {
- DU_LOG("\nERROR --> SCH : Invalid RI value(%x) CRNTI:%d",
- pucchCqi->u.mode11Info.u.ri,ue->ueId);
- return;
- }
- }
-}
-
-/**
- * @brief This function Updates the DL CQI on PUCCH for the UE.
- *
- * @details
- *
- * Function: rgSCHCmnDlProcCqiMode20
- *
- * This function updates the DL CQI on PUCCH for the UE.
- *
- * Invoked by: rgSCHCmnDlCqiOnPucchInd
- *
- * Processing Steps:
- * Process CQI MODE 20
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] TfuDlCqiRpt *dlCqiRpt
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-#ifdef RGR_CQI_REPT
-static inline Void rgSCHCmnDlProcCqiMode20
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-TfuDlCqiPucch *pucchCqi,
-Bool *isCqiAvail
-)
-#else
-static inline Void rgSCHCmnDlProcCqiMode20
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-TfuDlCqiPucch *pucchCqi
-)
-#endif
-{
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
-
- if (pucchCqi->u.mode20Info.type == TFU_RPT_CQI)
- {
- if (pucchCqi->u.mode20Info.u.cqi.isWideband)
- {
- /*ccpu00109787 - ADD - Check for non-zero CQI*/
- if((pucchCqi->u.mode20Info.u.cqi.u.wideCqi) &&
- (pucchCqi->u.mode20Info.u.cqi.u.wideCqi < RG_SCH_CMN_MAX_CQI))
- {
- ueDl->cqiFlag = TRUE;
- ueDl->mimoInfo.cwInfo[0].cqi = pucchCqi->u.mode20Info.u.cqi.\
- u.wideCqi;
- ueDl->mimoInfo.cwInfo[1].cqi = ueDl->mimoInfo.cwInfo[0].cqi;
- /* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
- *isCqiAvail = TRUE;
-#endif
- }
- else
- {
- return;
- }
- }
- }
- else if (pucchCqi->u.mode20Info.type == TFU_RPT_RI)
- {
- if(RG_SCH_CMN_IS_RI_VALID(pucchCqi->u.mode20Info.u.ri))
- {
- rgSCHCmnDlSetUeRi(cell, ue, pucchCqi->u.mode20Info.u.ri,
- TRUE);
- }
- else
- {
- DU_LOG("\nERROR --> SCH : Invalid RI value(%x) CRNTI:%d",
- pucchCqi->u.mode20Info.u.ri,ue->ueId);
- return;
- }
- }
-}
-
-
-/**
- * @brief This function Updates the DL CQI on PUCCH for the UE.
- *
- * @details
- *
- * Function: rgSCHCmnDlProcCqiMode21
- *
- * This function updates the DL CQI on PUCCH for the UE.
- *
- * Invoked by: rgSCHCmnDlCqiOnPucchInd
- *
- * Processing Steps:
- * Process CQI MODE 21
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] TfuDlCqiRpt *dlCqiRpt
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-#ifdef RGR_CQI_REPT
-static inline Void rgSCHCmnDlProcCqiMode21
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-TfuDlCqiPucch *pucchCqi,
-Bool *isCqiAvail,
-Bool *is2ndCwCqiAvail
-)
-#else
-static inline Void rgSCHCmnDlProcCqiMode21
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-TfuDlCqiPucch *pucchCqi
-)
-#endif
-{
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
-
- if (pucchCqi->u.mode21Info.type == TFU_RPT_CQI)
- {
- ue->mimoInfo.puschFdbkVld = FALSE;
- if (pucchCqi->u.mode21Info.u.cqi.isWideband)
- {
- /*ccpu00109787 - ADD - Check for non-zero CQI*/
- if((pucchCqi->u.mode21Info.u.cqi.u.wideCqi.cqi) &&
- (pucchCqi->u.mode21Info.u.cqi.u.wideCqi.cqi < RG_SCH_CMN_MAX_CQI))
- {
- ueDl->cqiFlag = TRUE;
- ueDl->mimoInfo.cwInfo[0].cqi = pucchCqi->u.mode21Info.u.cqi.\
- u.wideCqi.cqi;
- if (pucchCqi->u.mode21Info.u.cqi.u.wideCqi.diffCqi.pres)
- {
- RG_SCH_UPDT_CW2_CQI(ueDl->mimoInfo.cwInfo[0].cqi, \
- ueDl->mimoInfo.cwInfo[1].cqi, \
- pucchCqi->u.mode21Info.u.cqi.u.wideCqi.diffCqi.val);
-#ifdef RGR_CQI_REPT
- /* ccpu00117259 - ADD - Considering second codeword CQI info
- incase of MIMO for CQI Reporting */
- *is2ndCwCqiAvail = TRUE;
-#endif
- }
- /* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
- *isCqiAvail = TRUE;
-#endif
- }
- else
- {
- return;
- }
- rgSCHCmnDlSetUePmi(cell, ue, \
- pucchCqi->u.mode21Info.u.cqi.u.wideCqi.pmi);
- }
- }
- else if (pucchCqi->u.mode21Info.type == TFU_RPT_RI)
- {
- if(RG_SCH_CMN_IS_RI_VALID(pucchCqi->u.mode21Info.u.ri))
- {
- rgSCHCmnDlSetUeRi(cell, ue, pucchCqi->u.mode21Info.u.ri,
- TRUE);
- }
- else
- {
- DU_LOG("\nERROR --> SCH : Invalid RI value(%x) CRNTI:%d",
- pucchCqi->u.mode21Info.u.ri,ue->ueId);
- return;
- }
- }
-}
-
-
-/**
- * @brief This function Updates the DL CQI on PUCCH for the UE.
- *
- * @details
- *
- * Function: rgSCHCmnDlCqiOnPucchInd
- *
- * This function updates the DL CQI on PUCCH for the UE.
- *
- * Invoked by: rgSCHCmnDlCqiInd
- *
- * Processing Steps:
- * - Depending on the reporting mode of the PUCCH, the CQI/PMI/RI values
- * are updated and stored for each UE
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] TfuDlCqiRpt *dlCqiRpt
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-#ifdef RGR_CQI_REPT
-static Void rgSCHCmnDlCqiOnPucchInd
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-TfuDlCqiPucch *pucchCqi,
-RgrUeCqiRept *ueCqiRept,
-Bool *isCqiAvail,
-Bool *is2ndCwCqiAvail
-)
-#else
-static Void rgSCHCmnDlCqiOnPucchInd
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-TfuDlCqiPucch *pucchCqi
-)
-#endif
-{
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
-
- /* ccpu00117452 - MOD - Changed
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
- /* Save CQI mode information in the report */
- ueCqiRept->cqiMode = pucchCqi->mode;
-#endif
-
- switch(pucchCqi->mode)
- {
- case TFU_PUCCH_CQI_MODE10:
-#ifdef RGR_CQI_REPT
- rgSCHCmnDlProcCqiMode10(cell, ue, pucchCqi, isCqiAvail);
-#else
- rgSCHCmnDlProcCqiMode10(cell, ue, pucchCqi);
-#endif
- ueDl->cqiFlag = TRUE;
- break;
- case TFU_PUCCH_CQI_MODE11:
-#ifdef RGR_CQI_REPT
- rgSCHCmnDlProcCqiMode11(cell, ue, pucchCqi, isCqiAvail,
- is2ndCwCqiAvail);
-#else
- rgSCHCmnDlProcCqiMode11(cell, ue, pucchCqi);
-#endif
- ueDl->cqiFlag = TRUE;
- break;
- case TFU_PUCCH_CQI_MODE20:
-#ifdef RGR_CQI_REPT
- rgSCHCmnDlProcCqiMode20(cell, ue, pucchCqi, isCqiAvail);
-#else
- rgSCHCmnDlProcCqiMode20(cell, ue, pucchCqi);
-#endif
- ueDl->cqiFlag = TRUE;
- break;
- case TFU_PUCCH_CQI_MODE21:
-#ifdef RGR_CQI_REPT
- rgSCHCmnDlProcCqiMode21(cell, ue, pucchCqi, isCqiAvail,
- is2ndCwCqiAvail);
-#else
- rgSCHCmnDlProcCqiMode21(cell, ue, pucchCqi);
-#endif
- ueDl->cqiFlag = TRUE;
- break;
- default:
- {
- DU_LOG("\nERROR --> SCH : Unknown CQI Mode %d of UE %d",
- pucchCqi->mode,ue->ueId);
- /* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
- *isCqiAvail = FALSE;
-#endif
- }
- break;
- }
-
- return;
-} /* rgSCHCmnDlCqiOnPucchInd */
-
-
-/**
- * @brief This function Updates the DL CQI on PUSCH for the UE.
- *
- * @details
- *
- * Function: rgSCHCmnDlCqiOnPuschInd
- *
- * This function updates the DL CQI on PUSCH for the UE.
- *
- * Invoked by: rgSCHCmnDlCqiInd
- *
- * Processing Steps:
- * - Depending on the reporting mode of the PUSCH, the CQI/PMI/RI values
- * are updated and stored for each UE
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] TfuDlCqiRpt *dlCqiRpt
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-#ifdef RGR_CQI_REPT
-static Void rgSCHCmnDlCqiOnPuschInd
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-TfuDlCqiPusch *puschCqi,
-RgrUeCqiRept *ueCqiRept,
-Bool *isCqiAvail,
-Bool *is2ndCwCqiAvail
-)
-#else
-static Void rgSCHCmnDlCqiOnPuschInd
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-TfuDlCqiPusch *puschCqi
-)
-#endif
-{
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- uint32_t prevRiVal = 0;
- if (puschCqi->ri.pres == PRSNT_NODEF)
- {
- if (RG_SCH_CMN_IS_RI_VALID(puschCqi->ri.val))
- {
- /* Saving the previous ri value to revert back
- in case PMI update failed */
- if (RGR_UE_TM_4 == ue->mimoInfo.txMode ) /* Cheking for TM4. TM8 check later */
- {
- prevRiVal = ueDl->mimoInfo.ri;
- }
- rgSCHCmnDlSetUeRi(cell, ue, puschCqi->ri.val, FALSE);
- }
- else
- {
- DU_LOG("\nERROR --> SCH : Invalid RI value(%x) CRNTI:%d",
- puschCqi->ri.val,ue->ueId);
- return;
- }
- }
- ue->mimoInfo.puschFdbkVld = FALSE;
- /* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
- /* Save CQI mode information in the report */
- ueCqiRept->cqiMode = puschCqi->mode;
- /* ccpu00117259 - DEL - removed default setting of isCqiAvail to TRUE */
-#endif
-
- switch(puschCqi->mode)
- {
- case TFU_PUSCH_CQI_MODE_20:
- /*ccpu00109787 - ADD - Check for non-zero CQI*/
- /* Checking whether the decoded CQI is a value between 1 and 15*/
- if((puschCqi->u.mode20Info.wideBandCqi) &&
- (puschCqi->u.mode20Info.wideBandCqi < RG_SCH_CMN_MAX_CQI))
- {
- ueDl->mimoInfo.cwInfo[0].cqi = puschCqi->u.mode20Info.wideBandCqi;
- ueDl->mimoInfo.cwInfo[1].cqi = ueDl->mimoInfo.cwInfo[0].cqi;
- /* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
- *isCqiAvail = TRUE;
-#endif
- }
- else
- {
- return;
- }
- break;
- case TFU_PUSCH_CQI_MODE_30:
- /*ccpu00109787 - ADD - Check for non-zero CQI*/
- if((puschCqi->u.mode30Info.wideBandCqi) &&
- (puschCqi->u.mode30Info.wideBandCqi < RG_SCH_CMN_MAX_CQI))
- {
- ueDl->mimoInfo.cwInfo[0].cqi = puschCqi->u.mode30Info.wideBandCqi;
- ueDl->mimoInfo.cwInfo[1].cqi = ueDl->mimoInfo.cwInfo[0].cqi;
- /* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
- *isCqiAvail = TRUE;
-#endif
-#ifdef CA_DBG
- {
- uint32_t gACqiRcvdCount;
- gACqiRcvdCount++;
-
- }
-#endif
- }
- else
- {
- return;
- }
- break;
- case TFU_PUSCH_CQI_MODE_12:
- /*ccpu00109787 - ADD - Check for non-zero CQI*/
- if((puschCqi->u.mode12Info.cqiIdx[0]) &&
- (puschCqi->u.mode12Info.cqiIdx[0] < RG_SCH_CMN_MAX_CQI))
- {
- ueDl->mimoInfo.cwInfo[0].cqi = puschCqi->u.mode12Info.cqiIdx[0];
- /* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
- *isCqiAvail = TRUE;
-#endif
- }
- else
- {
- return;
- }
- if((puschCqi->u.mode12Info.cqiIdx[1]) &&
- (puschCqi->u.mode12Info.cqiIdx[1] < RG_SCH_CMN_MAX_CQI))
- {
- ueDl->mimoInfo.cwInfo[1].cqi = puschCqi->u.mode12Info.cqiIdx[1];
- /* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
- /* ccpu00117259 - ADD - Considering second codeword CQI info
- incase of MIMO for CQI Reporting */
- *is2ndCwCqiAvail = TRUE;
-#endif
- }
- else
- {
- return;
- }
- ue->mimoInfo.puschFdbkVld = TRUE;
- ue->mimoInfo.puschPmiInfo.mode = TFU_PUSCH_CQI_MODE_12;
- ue->mimoInfo.puschPmiInfo.u.mode12Info = puschCqi->u.mode12Info;
- /* : resetting this is time based. Make use of CQI reporting
- * periodicity, DELTA's in determining the exact time at which this
- * need to be reset. */
- break;
- case TFU_PUSCH_CQI_MODE_22:
- /*ccpu00109787 - ADD - Check for non-zero CQI*/
- if((puschCqi->u.mode22Info.wideBandCqi[0]) &&
- (puschCqi->u.mode22Info.wideBandCqi[0] < RG_SCH_CMN_MAX_CQI))
- {
- ueDl->mimoInfo.cwInfo[0].cqi = puschCqi->u.mode22Info.wideBandCqi[0];
- /* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
- *isCqiAvail = TRUE;
-#endif
- }
- else
- {
- return;
- }
- if((puschCqi->u.mode22Info.wideBandCqi[1]) &&
- (puschCqi->u.mode22Info.wideBandCqi[1] < RG_SCH_CMN_MAX_CQI))
- {
- ueDl->mimoInfo.cwInfo[1].cqi = puschCqi->u.mode22Info.wideBandCqi[1];
- /* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
- /* ccpu00117259 - ADD - Considering second codeword CQI info
- incase of MIMO for CQI Reporting */
- *is2ndCwCqiAvail = TRUE;
-#endif
- }
- else
- {
- return;
- }
- rgSCHCmnDlSetUePmi(cell, ue, puschCqi->u.mode22Info.wideBandPmi);
- ue->mimoInfo.puschFdbkVld = TRUE;
- ue->mimoInfo.puschPmiInfo.mode = TFU_PUSCH_CQI_MODE_22;
- ue->mimoInfo.puschPmiInfo.u.mode22Info = puschCqi->u.mode22Info;
- break;
- case TFU_PUSCH_CQI_MODE_31:
- /*ccpu00109787 - ADD - Check for non-zero CQI*/
- if((puschCqi->u.mode31Info.wideBandCqi[0]) &&
- (puschCqi->u.mode31Info.wideBandCqi[0] < RG_SCH_CMN_MAX_CQI))
- {
- ueDl->mimoInfo.cwInfo[0].cqi = puschCqi->u.mode31Info.wideBandCqi[0];
- /* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
- *isCqiAvail = TRUE;
-#endif
- }
- if (ueDl->mimoInfo.ri > 1)
- {
- if((puschCqi->u.mode31Info.wideBandCqi[1]) &&
- (puschCqi->u.mode31Info.wideBandCqi[1] < RG_SCH_CMN_MAX_CQI))
- {
- ueDl->mimoInfo.cwInfo[1].cqi = puschCqi->u.mode31Info.wideBandCqi[1];
- /* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
- /* ccpu00117259 - ADD - Considering second codeword CQI info
- incase of MIMO for CQI Reporting */
- *is2ndCwCqiAvail = TRUE;
-#endif
- }
- }
- if (rgSCHCmnDlSetUePmi(cell, ue, puschCqi->u.mode31Info.pmi) != ROK)
- {
- /* To avoid Rank and PMI inconsistency */
- if ((puschCqi->ri.pres == PRSNT_NODEF) &&
- (RGR_UE_TM_4 == ue->mimoInfo.txMode)) /* checking for TM4. TM8 check later */
- {
- ueDl->mimoInfo.ri = prevRiVal;
- }
- }
- ue->mimoInfo.puschPmiInfo.mode = TFU_PUSCH_CQI_MODE_31;
- ue->mimoInfo.puschPmiInfo.u.mode31Info = puschCqi->u.mode31Info;
- break;
- default:
- {
- DU_LOG("\nERROR --> SCH : Unknown CQI Mode %d CRNTI:%d",
- puschCqi->mode,ue->ueId);
- /* CQI decoding failed revert the RI to previous value */
- if ((puschCqi->ri.pres == PRSNT_NODEF) &&
- (RGR_UE_TM_4 == ue->mimoInfo.txMode)) /* checking for TM4. TM8 check later */
- {
- ueDl->mimoInfo.ri = prevRiVal;
- }
- /* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
- *isCqiAvail = FALSE;
- /* ccpu00117259 - ADD - Considering second codeword CQI info
- incase of MIMO for CQI Reporting */
- *is2ndCwCqiAvail = FALSE;
-#endif
- }
- break;
- }
-
- return;
-} /* rgSCHCmnDlCqiOnPuschInd */
-
-\f
-/**
- * @brief This function Updates the DL CQI for the UE.
- *
- * @details
- *
- * Function: rgSCHCmnDlCqiInd
- * Purpose: Updates the DL CQI for the UE
- *
- * Invoked by: TOM
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] TfuDlCqiRpt *dlCqi
- * @return Void
- *
- **/
-Void rgSCHCmnDlCqiInd
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-Bool isPucchInfo,
-Void *dlCqi,
-CmLteTimingInfo timingInfo
-)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-/* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- RgrUeCqiRept ueCqiRept = {{0}};
- Bool isCqiAvail = FALSE;
- /* ccpu00117259 - ADD - Considering second codeword CQI info
- incase of MIMO for CQI Reporting */
- Bool is2ndCwCqiAvail = FALSE;
-#endif
-
-
-#ifdef RGR_CQI_REPT
- if (isPucchInfo)
- {
- rgSCHCmnDlCqiOnPucchInd(cell, ue, (TfuDlCqiPucch *)dlCqi, &ueCqiRept, &isCqiAvail, &is2ndCwCqiAvail);
- }
- else
- {
- rgSCHCmnDlCqiOnPuschInd(cell, ue, (TfuDlCqiPusch *)dlCqi, &ueCqiRept, &isCqiAvail, &is2ndCwCqiAvail);
- }
-#else
- if (isPucchInfo)
- {
- rgSCHCmnDlCqiOnPucchInd(cell, ue, (TfuDlCqiPucch *)dlCqi);
- }
- else
- {
- rgSCHCmnDlCqiOnPuschInd(cell, ue, (TfuDlCqiPusch *)dlCqi);
- }
-#endif
-
-#ifdef CQI_CONFBITMASK_DROP
- if(!ue->cqiConfBitMask)
- {
- if (ueDl->mimoInfo.cwInfo[0].cqi >15)
- {
- ueDl->mimoInfo.cwInfo[0].cqi = ue->prevCqi;
- ueDl->mimoInfo.cwInfo[1].cqi = ue->prevCqi;
- }
- else if ( ueDl->mimoInfo.cwInfo[0].cqi >= ue->prevCqi)
- {
- ue->prevCqi = ueDl->mimoInfo.cwInfo[0].cqi;
- }
- else
- {
- uint8_t dlCqiDeltaPrev = 0;
- dlCqiDeltaPrev = ue->prevCqi - ueDl->mimoInfo.cwInfo[0].cqi;
- if (dlCqiDeltaPrev > 3)
- dlCqiDeltaPrev = 3;
- if ((ue->prevCqi - dlCqiDeltaPrev) < 6)
- {
- ue->prevCqi = 6;
- }
- else
- {
- ue->prevCqi = ue->prevCqi - dlCqiDeltaPrev;
- }
- ueDl->mimoInfo.cwInfo[0].cqi = ue->prevCqi;
- ueDl->mimoInfo.cwInfo[1].cqi = ue->prevCqi;
-
- }
- }
-#endif
-
-/* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
- /* ccpu00117259 - ADD - Considering second codeword CQI info
- incase of MIMO for CQI Reporting - added is2ndCwCqiAvail\
- in 'if' condition*/
- if (RG_SCH_CQIR_IS_PUSHNCQI_ENBLE(ue) && (isCqiAvail || is2ndCwCqiAvail))
- {
- ueCqiRept.cqi[0] = ueDl->mimoInfo.cwInfo[0].cqi;
-
- /* ccpu00117259 - ADD - Considering second codeword CQI info
- incase of MIMO for CQI Reporting - added is2ndCwCqiAvail
- in 'if' condition*/
- ueCqiRept.cqi[1] = 0;
- if(is2ndCwCqiAvail)
- {
- ueCqiRept.cqi[1] = ueDl->mimoInfo.cwInfo[1].cqi;
- }
- rgSCHCmnUeDlPwrCtColltCqiRept(cell, ue, &ueCqiRept);
-
- }
-#endif
-#ifdef DL_LA
- rgSCHCmnDlSetUeAllocLmtLa(cell, ue);
- rgSCHCheckAndSetTxScheme(cell, ue);
-#else
-#ifdef EMTC_ENABLE
- rgSCHCmnDlSetUeAllocLmt(cell, RG_SCH_CMN_GET_DL_UE(ue,cell), ue->isEmtcUe);
-#else
- rgSCHCmnDlSetUeAllocLmt(cell, RG_SCH_CMN_GET_DL_UE(ue,cell), FALSE);
-#endif
-#endif
-
- if (cellSch->dl.isDlFreqSel)
- {
- cellSch->apisDlfs->rgSCHDlfsDlCqiInd(cell, ue, isPucchInfo, dlCqi, timingInfo);
- }
-#ifdef LTEMAC_SPS
- /* Call SPS module to update CQI indication */
- rgSCHCmnSpsDlCqiIndHndlr(cell, ue, timingInfo);
-#endif
- /* Call Specific scheduler to process on dlCqiInd */
-#ifdef EMTC_ENABLE
- if((TRUE == cell->emtcEnable) && (TRUE == ue->isEmtcUe))
- {
- cellSch->apisEmtcDl->rgSCHDlCqiInd(cell, ue, isPucchInfo, dlCqi);
- }
- else
-#endif
- {
- cellSch->apisDl->rgSCHDlCqiInd(cell, ue, isPucchInfo, dlCqi);
- }
-
-#ifdef RG_PFS_STATS
- ue->pfsStats.cqiStats[(RG_SCH_GET_SCELL_INDEX(ue, cell))].avgCqi +=
- ueDl->mimoInfo.cwInfo[0].cqi;
- ue->pfsStats.cqiStats[(RG_SCH_GET_SCELL_INDEX(ue, cell))].totalCqiOcc++;
-#endif
-
-#ifdef SCH_STATS
- ueDl->avgCqi += ueDl->mimoInfo.cwInfo[0].cqi;
- ueDl->numCqiOccns++;
- if (ueDl->mimoInfo.ri == 1)
- {
- ueDl->numRi1++;
- }
- else
- {
- ueDl->numRi2++;
- }
-#endif
-
-#ifdef TENB_STATS
- ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].dlSumCw0Cqi += ueDl->mimoInfo.cwInfo[0].cqi;
- ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].dlSumCw1Cqi += ueDl->mimoInfo.cwInfo[1].cqi;
- ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].dlNumCw0Cqi ++;
- ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].dlNumCw1Cqi ++;
- cell->tenbStats->sch.dlSumCw0Cqi += ueDl->mimoInfo.cwInfo[0].cqi;
- cell->tenbStats->sch.dlSumCw1Cqi += ueDl->mimoInfo.cwInfo[1].cqi;
- cell->tenbStats->sch.dlNumCw0Cqi ++;
- cell->tenbStats->sch.dlNumCw1Cqi ++;
-#endif
- return;
-}
-
-#ifdef TFU_UPGRADE
-/**
- * @brief This function calculates the wideband CQI from SNR
- * reported for each RB.
- *
- * @details
- *
- * Function: rgSCHCmnCalcWcqiFrmSnr
- * Purpose: Wideband CQI calculation from SNR
- *
- * Invoked by: RG SCH
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] TfuSrsRpt *srsRpt,
- * @return Wideband CQI
- *
- **/
-static uint8_t rgSCHCmnCalcWcqiFrmSnr(RgSchCellCb *cell, TfuSrsRpt *srsRpt)
-{
- uint8_t wideCqi=1; /*Calculated value from SNR*/
- /*Need to map a certain SNR with a WideCQI value.
- * The CQI calculation is still primitive. Further, need to
- * use a improvized method for calculating WideCQI from SNR*/
- if (srsRpt->snr[0] <=50)
- {
- wideCqi=3;
- }
- else if (srsRpt->snr[0]>=51 && srsRpt->snr[0] <=100)
- {
- wideCqi=6;
- }
- else if (srsRpt->snr[0]>=101 && srsRpt->snr[0] <=150)
- {
- wideCqi=9;
- }
- else if (srsRpt->snr[0]>=151 && srsRpt->snr[0] <=200)
- {
- wideCqi=12;
- }
- else if (srsRpt->snr[0]>=201 && srsRpt->snr[0] <=250)
- {
- wideCqi=14;
- }
- else
- {
- wideCqi=15;
- }
- return (wideCqi);
-}/*rgSCHCmnCalcWcqiFrmSnr*/
-
-
-/**
- * @brief This function Updates the SRS for the UE.
- *
- * @details
- *
- * Function: rgSCHCmnSrsInd
- * Purpose: Updates the UL SRS for the UE
- *
- * Invoked by: TOM
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] TfuSrsRpt *srsRpt,
- * @return Void
- *
- **/
-Void rgSCHCmnSrsInd(RgSchCellCb *cell,RgSchUeCb *ue,TfuSrsRpt *srsRpt,CmLteTimingInfo timingInfo)
-{
- uint8_t wideCqi; /*Calculated value from SNR*/
- uint32_t recReqTime; /*Received Time in TTI*/
-
- recReqTime = (timingInfo.sfn * RGSCH_NUM_SUB_FRAMES_5G) + timingInfo.slot;
- ue->srsCb.selectedAnt = (recReqTime/ue->srsCb.peri)%2;
- if(srsRpt->wideCqiPres)
- {
- wideCqi = srsRpt->wideCqi;
- }
- else
- {
- wideCqi = rgSCHCmnCalcWcqiFrmSnr(cell, srsRpt);
- }
- rgSCHCmnFindUlCqiUlTxAnt(cell, ue, wideCqi);
- return;
-}/*rgSCHCmnSrsInd*/
-#endif
-
-\f
-/**
- * @brief This function is a handler for TA report for an UE.
- *
- * @details
- *
- * Function: rgSCHCmnDlTARpt
- * Purpose: Determine based on UE_IDLE_TIME threshold,
- * whether UE needs to be Linked to the scheduler's TA list OR
- * if it needs a PDCCH Order.
- *
- *
- * Invoked by: TOM
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- *
- **/
-Void rgSCHCmnDlTARpt(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- CmLListCp poInactvLst;
-
-
- /* RACHO: If UE idle time is more than threshold, then
- * set its poInactv pdcch order inactivity */
- /* Fix : syed Ignore if TaTmr is not configured */
- if ((ue->dl.taCb.cfgTaTmr) && (rgSCHCmnUeIdleExdThrsld(cell, ue) == ROK))
- {
- uint32_t prevDlMsk = ue->dl.dlInactvMask;
- uint32_t prevUlMsk = ue->ul.ulInactvMask;
- ue->dl.dlInactvMask |= RG_PDCCHODR_INACTIVE;
- ue->ul.ulInactvMask |= RG_PDCCHODR_INACTIVE;
- /* Indicate Specific scheduler for this UEs inactivity */
- cmLListInit(&poInactvLst);
- cmLListAdd2Tail(&poInactvLst, &ueDl->rachInfo.inActUeLnk);
- ueDl->rachInfo.inActUeLnk.node = (PTR)ue;
- /* Send inactivate ind only if not already sent */
- if (prevDlMsk == 0)
- {
- cellSch->apisDl->rgSCHDlInactvtUes(cell, &poInactvLst);
- }
- if (prevUlMsk == 0)
- {
- cellSch->apisUl->rgSCHUlInactvtUes(cell, &poInactvLst);
- }
- }
- else
- {
- /* Fix: ccpu00124009 Fix for loop in the linked list "cellDl->taLst" */
- if (!ue->dlTaLnk.node)
- {
-#ifdef EMTC_ENABLE
- if(cell->emtcEnable)
- {
- if(ue->isEmtcUe)
- {
- rgSCHEmtcAddToTaLst(cellDl,ue);
- }
- }
- else
-#endif
- {
-
- cmLListAdd2Tail(&cellDl->taLst, &ue->dlTaLnk);
- ue->dlTaLnk.node = (PTR)ue;
- }
- }
- else
- {
- DU_LOG("\nERROR --> SCH : <TA>TA duplicate entry attempt failed: UEID:%u",
- ue->ueId);
- }
- }
- return;
-}
-
-#ifdef TFU_UPGRADE
-/**
- * @brief Indication of UL CQI.
- *
- * @details
- *
- * Function : rgSCHCmnFindUlCqiUlTxAnt
- *
- * - Finds the Best Tx Antenna amongst the CQIs received
- * from Two Tx Antennas.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t wideCqi
- * @return Void
- **/
-static Void rgSCHCmnFindUlCqiUlTxAnt(RgSchCellCb *cell,RgSchUeCb *ue,uint8_t wideCqi)
-{
- ue->validTxAnt = 1;
- return;
-} /* rgSCHCmnFindUlCqiUlTxAnt */
-#endif
-
-/**
- * @brief Indication of UL CQI.
- *
- * @details
- *
- * Function : rgSCHCmnUlCqiInd
- *
- * - Updates uplink CQI information for the UE. Computes and
- * stores the lowest CQI of CQIs reported in all subbands.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] TfuUlCqiRpt *ulCqiInfo
- * @return Void
- **/
-Void rgSCHCmnUlCqiInd(RgSchCellCb *cell,RgSchUeCb *ue,TfuUlCqiRpt *ulCqiInfo)
-{
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell);
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-#ifdef UL_LA
- uint8_t iTbsNew;
- S32 previTbs;
-#endif
-#if (defined(SCH_STATS) || defined(TENB_STATS))
- CmLteUeCategory ueCtg = (CmLteUeCategory)(RG_SCH_CMN_GET_UE_CTGY(ue));
-#endif
-
- /* consider inputs from SRS handlers about SRS occassions
- * in determining the UL TX Antenna selection */
- ueUl->crntUlCqi[0] = ulCqiInfo->wideCqi;
-#ifdef TFU_UPGRADE
- ueUl->validUlCqi = ueUl->crntUlCqi[0];
- ue->validTxAnt = 0;
-#ifdef UL_LA
- iTbsNew = rgSchCmnUlCqiToTbsTbl[cell->isCpUlExtend][ueUl->validUlCqi];
- previTbs = (ueUl->ulLaCb.cqiBasediTbs + ueUl->ulLaCb.deltaiTbs)/100;
-
- if (RG_ITBS_DIFF(iTbsNew, previTbs) > 5)
- {
- /* Ignore this iTBS report and mark that last iTBS report was */
- /* ignored so that subsequently we reset the LA algorithm */
- ueUl->ulLaCb.lastiTbsIgnored = TRUE;
- }
- else
- {
- if (ueUl->ulLaCb.lastiTbsIgnored != TRUE)
- {
- ueUl->ulLaCb.cqiBasediTbs = ((20 * iTbsNew * 100) +
- (80 * ueUl->ulLaCb.cqiBasediTbs))/100;
- }
- else
- {
- /* Reset the LA as iTbs in use caught up with the value */
- /* reported by UE. */
- ueUl->ulLaCb.cqiBasediTbs = ((20 * iTbsNew * 100) +
- (80 * previTbs * 100))/100;
- ueUl->ulLaCb.deltaiTbs = 0;
- ueUl->ulLaCb.lastiTbsIgnored = FALSE;
- }
- }
-#endif
-#endif
- rgSCHPwrUlCqiInd(cell, ue);
-#ifdef LTEMAC_SPS
- if (ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE)
- {
- rgSCHCmnSpsUlCqiInd(cell, ue);
- }
-#endif
- /* Applicable to only some schedulers */
-#ifdef EMTC_ENABLE
- if((TRUE == cell->emtcEnable) && (TRUE == ue->isEmtcUe))
- {
- cellSch->apisEmtcUl->rgSCHUlCqiInd(cell, ue, ulCqiInfo);
- }
- else
-#endif
- {
- cellSch->apisUl->rgSCHUlCqiInd(cell, ue, ulCqiInfo);
- }
-
-#ifdef SCH_STATS
- ueUl->numCqiOccns++;
- ueUl->avgCqi += rgSCHCmnUlGetCqi(cell, ue, ueCtg);
-#endif
-
-#ifdef TENB_STATS
- {
- ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].ulSumCqi += rgSCHCmnUlGetCqi(cell, ue, ueCtg);
- ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].ulNumCqi ++;
- cell->tenbStats->sch.ulSumCqi += rgSCHCmnUlGetCqi(cell, ue, ueCtg);
- cell->tenbStats->sch.ulNumCqi ++;
- }
-#endif
-
- return;
-} /* rgSCHCmnUlCqiInd */
-
-/**
- * @brief Returns HARQ proc for which data expected now.
- *
- * @details
- *
- * Function: rgSCHCmnUlHqProcForUe
- * Purpose: This function returns the harq process for
- * which data is expected in the current subframe.
- * It does not validate that the HARQ process
- * has an allocation.
- *
- * Invoked by: TOM
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] CmLteTimingInfo frm
- * @param[in] RgSchUeCb *ue
- * @param[out] RgSchUlHqProcCb **procRef
- * @return Void
- **/
-Void rgSCHCmnUlHqProcForUe
-(
-RgSchCellCb *cell,
-CmLteTimingInfo frm,
-RgSchUeCb *ue,
-RgSchUlHqProcCb **procRef
-)
-{
-#ifndef RG_5GTF
- uint8_t procId = rgSCHCmnGetUlHqProcIdx(&frm, cell);
-#endif
-#ifndef RG_5GTF
- *procRef = rgSCHUhmGetUlHqProc(cell, ue, procId);
-#else
- *procRef = rgSCHUhmGetUlProcByTime(cell, ue, frm);
-#endif
- return;
-}
-
-#ifdef RG_UNUSED
-/**
- * @brief Update harq process for allocation.
- *
- * @details
- *
- * Function : rgSCHCmnUpdUlHqProc
- *
- * This function is invoked when harq process
- * control block is now in a new memory location
- * thus requiring a pointer/reference update.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUlHqProcCb *curProc
- * @param[in] RgSchUlHqProcCb *oldProc
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCmnUpdUlHqProc
-(
-RgSchCellCb *cell,
-RgSchUlHqProcCb *curProc,
-RgSchUlHqProcCb *oldProc
-)
-{
-
- UNUSED(cell);
- UNUSED(oldProc);
-#if (ERRCLASS & ERRCLS_DEBUG)
- if (curProc->alloc == NULLP)
- {
- return RFAILED;
- }
-#endif
- curProc->alloc->hqProc = curProc;
- return ROK;
-} /* rgSCHCmnUpdUlHqProc */
-#endif
-
-/*MS_WORKAROUND for CR FIXME */
-/**
- * @brief Hsndles BSR timer expiry
- *
- * @details
- *
- * Function : rgSCHCmnBsrTmrExpry
- *
- * This function is invoked when periodic BSR timer expires for a UE.
- *
- * @param[in] RgSchUeCb *ue
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCmnBsrTmrExpry(RgSchUeCb *ueCb)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(ueCb->cell);
-
-
- ueCb->isSrGrant = TRUE;
-
-#ifdef EMTC_ENABLE
- emtcStatsUlBsrTmrTxp++;
-#endif
-
-#ifdef EMTC_ENABLE
- if(ueCb->cell->emtcEnable)
- {
- if(ueCb->isEmtcUe)
- {
- cellSch->apisEmtcUl->rgSCHSrRcvd(ueCb->cell, ueCb);
- return ROK;
- }
- }
- else
-#endif
- {
- cellSch->apisUl->rgSCHSrRcvd(ueCb->cell, ueCb);
- }
-
- return (ROK);
-}
-
-/**
- * @brief Short BSR update.
- *
- * @details
- *
- * Function : rgSCHCmnUpdBsrShort
- *
- * This functions does requisite updates to handle short BSR reporting.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchLcgCb *ulLcg
- * @param[in] uint8_t bsr
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCmnUpdBsrShort
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchLcgCb *ulLcg,
-uint8_t bsr,
-RgSchErrInfo *err
-)
-{
- uint8_t lcgCnt;
-#ifdef LTE_L2_MEAS
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell);
-#endif
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- RgSchCmnLcg *cmnLcg = NULLP;
-
-#ifdef LTE_L2_MEAS
- uint8_t idx;
-#endif
-
- if (!RGSCH_LCG_ISCFGD(ulLcg))
- {
- err->errCause = RGSCHERR_SCH_LCG_NOT_CFGD;
- return RFAILED;
- }
- for (lcgCnt=0; lcgCnt<4; lcgCnt++)
- {
-#ifdef LTE_L2_MEAS
- /* Set BS of all other LCGs to Zero.
- If Zero BSR is reported in Short BSR include this LCG too */
- if ((lcgCnt != ulLcg->lcgId) ||
- (!bsr && !ueUl->hqEnt.numBusyHqProcs))
- {
- /* If old BO is zero do nothing */
- if(((RgSchCmnLcg *)(ue->ul.lcgArr[lcgCnt].sch))->bs != 0)
- {
- for(idx = 0; idx < ue->ul.lcgArr[lcgCnt].numLch; idx++)
- {
- if((ue->ul.lcgArr[lcgCnt].lcArray[idx]->qciCb->ulUeCount) &&
- (ue->ulActiveLCs & (1 <<
- (ue->ul.lcgArr[lcgCnt].lcArray[idx]->qciCb->qci -1))))
- {
- /* L2_COUNTER */
- ue->ul.lcgArr[lcgCnt].lcArray[idx]->qciCb->ulUeCount--;
- ue->ulActiveLCs &= ~(1 <<
- (ue->ul.lcgArr[lcgCnt].lcArray[idx]->qciCb->qci -1));
- }
- }
- }
- }
-#endif
- if (RGSCH_LCG_ISCFGD(&ue->ul.lcgArr[lcgCnt]))
- {
- ((RgSchCmnLcg *)(ue->ul.lcgArr[lcgCnt].sch))->bs = 0;
- ((RgSchCmnLcg *)(ue->ul.lcgArr[lcgCnt].sch))->reportedBs = 0;
- }
- }
-
-#ifdef LTE_L2_MEAS
- if(ulLcg->lcgId && bsr && (((RgSchCmnLcg *)(ulLcg->sch))->bs == 0))
- {
- for(idx = 0; idx < ulLcg->numLch; idx++)
- {
- /* L2_COUNTER */
- if (!(ue->ulActiveLCs & (1 << (ulLcg->lcArray[idx]->qciCb->qci -1))))
- {
- ulLcg->lcArray[idx]->qciCb->ulUeCount++;
- ue->ulActiveLCs |= (1 << (ulLcg->lcArray[idx]->qciCb->qci -1));
- }
- }
- }
-#endif
- /* Resetting the nonGbrLcgBs info here */
- ue->ul.nonGbrLcgBs = 0;
- ue->ul.nonLcg0Bs = 0;
-
- cmnLcg = ((RgSchCmnLcg *)(ulLcg->sch));
-
- if (TRUE == ue->ul.useExtBSRSizes)
- {
- cmnLcg->reportedBs = rgSchCmnExtBsrTbl[bsr];
- }
- else
- {
- cmnLcg->reportedBs = rgSchCmnBsrTbl[bsr];
- }
- if (RGSCH_IS_GBR_BEARER(cmnLcg->cfgdGbr))
- {
- /* TBD check for effGbr != 0 */
- cmnLcg->bs = RGSCH_MIN(cmnLcg->reportedBs, cmnLcg->effGbr + cmnLcg->effDeltaMbr);
- }
- else if (0 == ulLcg->lcgId)
- {
- /* This is added for handling LCG0 */
- cmnLcg->bs = cmnLcg->reportedBs;
- }
- else
- {
- /* Update non GBR LCG's BS*/
- ue->ul.nonGbrLcgBs = RGSCH_MIN(cmnLcg->reportedBs,ue->ul.effAmbr);
- cmnLcg->bs = ue->ul.nonGbrLcgBs;
- }
- ue->ul.totalBsr = cmnLcg->bs;
-
-#ifdef RGR_V1
- if ((ue->bsrTmr.tmrEvnt != TMR_NONE) && (bsr == 0))
- {
- rgSCHTmrStopTmr(cell, ue->bsrTmr.tmrEvnt, ue);
- }
-#endif
-#ifdef LTEMAC_SPS
- if (ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE)
- {
- rgSCHCmnSpsBsrRpt(cell, ue, ulLcg);
- }
-#endif
- rgSCHCmnUpdUlCompEffBsr(ue);
-
-#ifdef EMTC_ENABLE
- if(cell->emtcEnable)
- {
- if(ue->isEmtcUe)
- {
- cellSch->apisEmtcUl->rgSCHUpdBsrShort(cell, ue, ulLcg, bsr);
- return ROK;
- }
- }
- else
-#endif
- {
- cellSch->apisUl->rgSCHUpdBsrShort(cell, ue, ulLcg, bsr);
- }
-
-#ifdef LTE_ADV
- if (ue->ul.isUlCaEnabled && ue->numSCells)
- {
- for(uint8_t sCellIdx = 1; sCellIdx <= RG_SCH_MAX_SCELL ; sCellIdx++)
- {
-#ifndef PAL_ENABLE_UL_CA
- if((ue->cellInfo[sCellIdx] != NULLP) &&
- (ue->cellInfo[sCellIdx]->sCellState == RG_SCH_SCELL_ACTIVE))
-#else
- if(ue->cellInfo[sCellIdx] != NULLP)
-#endif
- {
- cellSch->apisUl->rgSCHUpdBsrShort(ue->cellInfo[sCellIdx]->cell,
- ue, ulLcg, bsr);
- }
- }
- }
-#endif
-
- return ROK;
-}
-
-/**
- * @brief Truncated BSR update.
- *
- * @details
- *
- * Function : rgSCHCmnUpdBsrTrunc
- *
- * This functions does required updates to handle truncated BSR report.
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchLcgCb *ulLcg
- * @param[in] uint8_t bsr
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCmnUpdBsrTrunc
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchLcgCb *ulLcg,
-uint8_t bsr,
-RgSchErrInfo *err
-)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- RgSchCmnLcg *cmnLcg = NULLP;
- S32 cnt;
-#ifdef LTE_L2_MEAS
- uint8_t idx;
-#endif
-
-
- if (!RGSCH_LCG_ISCFGD(ulLcg))
- {
- err->errCause = RGSCHERR_SCH_LCG_NOT_CFGD;
- return RFAILED;
- }
- /* set all higher prio lcgs bs to 0 and update this lcgs bs and
- total bsr= sumofall lcgs bs */
- if (ulLcg->lcgId)
- {
- for (cnt = ulLcg->lcgId-1; cnt >= 0; cnt--)
- {
-#ifdef LTE_L2_MEAS
- /* If Existing BO is zero the don't do anything */
- if(((RgSchCmnLcg *)(ue->ul.lcgArr[cnt].sch))->bs != 0)
- {
- for(idx = 0; idx < ue->ul.lcgArr[cnt].numLch; idx++)
- {
- /* L2_COUNTERS */
- if((ue->ul.lcgArr[cnt].lcArray[idx]->qciCb->ulUeCount) &&
- (ue->ulActiveLCs & (1 <<
- (ue->ul.lcgArr[cnt].lcArray[idx]->qciCb->qci -1))))
- {
- ue->ul.lcgArr[cnt].lcArray[idx]->qciCb->ulUeCount--;
- ue->ulActiveLCs &= ~(1 <<
- (ue->ul.lcgArr[cnt].lcArray[idx]->qciCb->qci -1));
- }
- }
- }
-#endif
- ((RgSchCmnLcg *)(ue->ul.lcgArr[cnt].sch))->bs = 0;
- ((RgSchCmnLcg *)(ue->ul.lcgArr[cnt].sch))->reportedBs = 0;
- }
- }
-
-#ifdef LTE_L2_MEAS
- for (cnt = ulLcg->lcgId; cnt < RGSCH_MAX_LCG_PER_UE; cnt++)
- {
- if (ulLcg->lcgId == 0)
- {
- continue;
- }
- /* If Existing BO is zero the don't do anything */
- if(((RgSchCmnLcg *)(ue->ul.lcgArr[cnt].sch))->bs == 0)
- {
- for(idx = 0; idx < ue->ul.lcgArr[cnt].numLch; idx++)
- {
- /* L2_COUNTERS */
- if (!(ue->ulActiveLCs & (1 <<
- (ue->ul.lcgArr[cnt].lcArray[idx]->qciCb->qci -1))))
- {
- ue->ul.lcgArr[cnt].lcArray[idx]->qciCb->ulUeCount++;
- ue->ulActiveLCs |= (1 <<
- (ue->ul.lcgArr[cnt].lcArray[idx]->qciCb->qci -1));
- }
- }
- }
- }
-#endif
- ue->ul.nonGbrLcgBs = 0;
- ue->ul.nonLcg0Bs = 0;
- cmnLcg = ((RgSchCmnLcg *)(ulLcg->sch));
- if (TRUE == ue->ul.useExtBSRSizes)
- {
- cmnLcg->reportedBs = rgSchCmnExtBsrTbl[bsr];
- }
- else
- {
- cmnLcg->reportedBs = rgSchCmnBsrTbl[bsr];
- }
- if (RGSCH_IS_GBR_BEARER(cmnLcg->cfgdGbr))
- {
- cmnLcg->bs = RGSCH_MIN(cmnLcg->reportedBs, cmnLcg->effGbr + cmnLcg->effDeltaMbr);
- }
- else if(ulLcg->lcgId == 0)
- {
- /* This is for handeling LCG0 */
- cmnLcg->bs = cmnLcg->reportedBs;
- }
- else
- {
- ue->ul.nonGbrLcgBs = RGSCH_MIN(cmnLcg->reportedBs, ue->ul.effAmbr);
- cmnLcg->bs = ue->ul.nonGbrLcgBs;
- }
- ue->ul.totalBsr = cmnLcg->bs;
-
- for (cnt = ulLcg->lcgId+1; cnt < RGSCH_MAX_LCG_PER_UE; cnt++)
- {
- /* TODO: The bs for the other LCGs may be stale because some or all of
- * the part of bs may have been already scheduled/data received. Please
- * consider this when truncated BSR is tested/implemented */
- ue->ul.totalBsr += ((RgSchCmnLcg *)(ue->ul.lcgArr[cnt].sch))->bs;
- }
-
- rgSCHCmnUpdUlCompEffBsr(ue);
-
-#ifdef EMTC_ENABLE
- if(cell->emtcEnable)
- {
- if(ue->isEmtcUe)
- {
- cellSch->apisEmtcUl->rgSCHUpdBsrTrunc(cell, ue, ulLcg, bsr);
- return ROK;
- }
- }
- else
-#endif
- {
- cellSch->apisUl->rgSCHUpdBsrTrunc(cell, ue, ulLcg, bsr);
- }
-
-#ifdef LTE_ADV
- if (ue->ul.isUlCaEnabled && ue->numSCells)
- {
- for(uint8_t sCellIdx = 1; sCellIdx <= RG_SCH_MAX_SCELL ; sCellIdx++)
- {
-#ifndef PAL_ENABLE_UL_CA
- if((ue->cellInfo[sCellIdx] != NULLP) &&
- (ue->cellInfo[sCellIdx]->sCellState == RG_SCH_SCELL_ACTIVE))
-#else
- if(ue->cellInfo[sCellIdx] != NULLP)
-#endif
- {
- cellSch->apisUl->rgSCHUpdBsrTrunc(ue->cellInfo[sCellIdx]->cell, ue, ulLcg, bsr);
- }
- }
- }
-#endif
-
- return ROK;
-}
-
-/**
- * @brief Long BSR update.
- *
- * @details
- *
- * Function : rgSCHCmnUpdBsrLong
- *
- * - Update BSRs for all configured LCGs.
- * - Update priority of LCGs if needed.
- * - Update UE's position within/across uplink scheduling queues.
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t bsArr[]
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCmnUpdBsrLong
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint8_t *bsArr,
-RgSchErrInfo *err
-)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- uint32_t tmpBsArr[4] = {0, 0, 0, 0};
- uint32_t nonGbrBs = 0;
-#ifdef LTE_L2_MEAS
- uint8_t idx1;
- uint8_t idx2;
-#endif
- uint32_t lcgId;
-
-#ifdef LTE_L2_MEAS
- for(idx1 = 1; idx1 < RGSCH_MAX_LCG_PER_UE; idx1++)
- {
- /* If Old BO is non zero then do nothing */
- if ((((RgSchCmnLcg *)(ue->ul.lcgArr[idx1].sch))->bs == 0)
- && bsArr[idx1] )
- {
- for(idx2 = 0; idx2 < ue->ul.lcgArr[idx1].numLch; idx2++)
- {
- /* L2_COUNTERS */
- if (!(ue->ulActiveLCs & (1 <<
- (ue->ul.lcgArr[idx1].lcArray[idx2]->qciCb->qci -1))))
- {
- ue->ul.lcgArr[idx1].lcArray[idx2]->qciCb->ulUeCount++;
- ue->ulActiveLCs |= (1 <<
- (ue->ul.lcgArr[idx1].lcArray[idx2]->qciCb->qci -1));
- }
- }
- }
- }
-#endif
- ue->ul.nonGbrLcgBs = 0;
- ue->ul.nonLcg0Bs = 0;
-
- if (RGSCH_LCG_ISCFGD(&ue->ul.lcgArr[0]))
- {
- if (TRUE == ue->ul.useExtBSRSizes)
- {
- ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs = rgSchCmnExtBsrTbl[bsArr[0]];
- ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->reportedBs = rgSchCmnExtBsrTbl[bsArr[0]];
- tmpBsArr[0] = rgSchCmnExtBsrTbl[bsArr[0]];
- }
- else
- {
- ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs = rgSchCmnBsrTbl[bsArr[0]];
- ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->reportedBs = rgSchCmnBsrTbl[bsArr[0]];
- tmpBsArr[0] = rgSchCmnBsrTbl[bsArr[0]];
- }
- }
- for (lcgId = 1; lcgId < RGSCH_MAX_LCG_PER_UE; lcgId++)
- {
- if (RGSCH_LCG_ISCFGD(&ue->ul.lcgArr[lcgId]))
- {
- RgSchCmnLcg *cmnLcg = ((RgSchCmnLcg *)(ue->ul.lcgArr[lcgId].sch));
-
- if (TRUE == ue->ul.useExtBSRSizes)
- {
- cmnLcg->reportedBs = rgSchCmnExtBsrTbl[bsArr[lcgId]];
- }
- else
- {
- cmnLcg->reportedBs = rgSchCmnBsrTbl[bsArr[lcgId]];
- }
- if (RGSCH_IS_GBR_BEARER(cmnLcg->cfgdGbr))
- {
- cmnLcg->bs = RGSCH_MIN(cmnLcg->reportedBs, cmnLcg->effGbr + cmnLcg->effDeltaMbr);
- tmpBsArr[lcgId] = cmnLcg->bs;
- }
- else
- {
- nonGbrBs += cmnLcg->reportedBs;
- tmpBsArr[lcgId] = cmnLcg->reportedBs;
- cmnLcg->bs = RGSCH_MIN(cmnLcg->reportedBs,ue->ul.effAmbr);
- }
- }
- }
- ue->ul.nonGbrLcgBs = RGSCH_MIN(nonGbrBs,ue->ul.effAmbr);
-
- ue->ul.totalBsr = tmpBsArr[0] + tmpBsArr[1] + tmpBsArr[2] + tmpBsArr[3];
-#ifdef RGR_V1
- if ((ue->bsrTmr.tmrEvnt != TMR_NONE) && (ue->ul.totalBsr == 0))
- {
- rgSCHTmrStopTmr(cell, ue->bsrTmr.tmrEvnt, ue);
- }
-#endif
-
-#ifdef LTEMAC_SPS
- if (ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE) /* SPS_FIX */
- {
- if(ue->ul.totalBsr - tmpBsArr[1] == 0)
- {/* Updaing the BSR to SPS only if LCG1 BS is present in sps active state */
- rgSCHCmnSpsBsrRpt(cell, ue, &ue->ul.lcgArr[1]);
- }
- }
-#endif
- rgSCHCmnUpdUlCompEffBsr(ue);
-
-#ifdef EMTC_ENABLE
- if(cell->emtcEnable)
- {
- if(ue->isEmtcUe)
- {
- cellSch->apisEmtcUl->rgSCHUpdBsrLong(cell, ue, bsArr);
- return ROK;
- }
- }
- else
-#endif
- {
- cellSch->apisUl->rgSCHUpdBsrLong(cell, ue, bsArr);
- }
-
-#ifdef LTE_ADV
- if (ue->ul.isUlCaEnabled && ue->numSCells)
- {
- for(uint8_t idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
- {
-#ifndef PAL_ENABLE_UL_CA
- if((ue->cellInfo[idx] != NULLP) &&
- (ue->cellInfo[idx]->sCellState == RG_SCH_SCELL_ACTIVE))
-#else
- if(ue->cellInfo[idx] != NULLP)
-#endif
- {
- cellSch->apisUl->rgSCHUpdBsrLong(ue->cellInfo[idx]->cell, ue, bsArr);
- }
- }
- }
-#endif
-
- return ROK;
-}
-
-/**
- * @brief PHR update.
- *
- * @details
- *
- * Function : rgSCHCmnUpdExtPhr
- *
- * Updates extended power headroom information for an UE.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t phr
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCmnUpdExtPhr
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgInfExtPhrCEInfo *extPhr,
-RgSchErrInfo *err
-)
-{
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell);
- RgSchCmnAllocRecord *allRcd;
- CmLList *node = ueUl->ulAllocLst.last;
-
-#ifdef LTEMAC_SPS
- RgSchCmnUlUeSpsInfo *ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue,cell);
-#endif
-
- UNUSED(err);
-
- while (node)
- {
- allRcd = (RgSchCmnAllocRecord *)node->node;
- node = node->prev;
- if (RGSCH_TIMEINFO_SAME(ue->macCeRptTime, allRcd->allocTime))
- {
- rgSCHPwrUpdExtPhr(cell, ue, extPhr, allRcd);
- break;
- }
- }
-#ifdef LTEMAC_SPS
- if(ulSpsUe->isUlSpsActv)
- {
- rgSCHCmnSpsPhrInd(cell,ue);
- }
-#endif
-
- return ROK;
-} /* rgSCHCmnUpdExtPhr */
-
-
-
-
-/**
- * @brief PHR update.
- *
- * @details
- *
- * Function : rgSCHCmnUpdPhr
- *
- * Updates power headroom information for an UE.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t phr
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCmnUpdPhr
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint8_t phr,
-RgSchErrInfo *err
-)
-{
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell);
- RgSchCmnAllocRecord *allRcd;
- CmLList *node = ueUl->ulAllocLst.last;
-
-#ifdef LTEMAC_SPS
- RgSchCmnUlUeSpsInfo *ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue,cell);
-#endif
-
- UNUSED(err);
-
- while (node)
- {
- allRcd = (RgSchCmnAllocRecord *)node->node;
- node = node->prev;
- if (RGSCH_TIMEINFO_SAME(ue->macCeRptTime, allRcd->allocTime))
- {
- rgSCHPwrUpdPhr(cell, ue, phr, allRcd, RG_SCH_CMN_PWR_USE_CFG_MAX_PWR);
- break;
- }
- }
-#ifdef LTEMAC_SPS
- if(ulSpsUe->isUlSpsActv)
- {
- rgSCHCmnSpsPhrInd(cell,ue);
- }
-#endif
-
- return ROK;
-} /* rgSCHCmnUpdPhr */
-
-/**
- * @brief UL grant for contention resolution.
- *
- * @details
- *
- * Function : rgSCHCmnContResUlGrant
- *
- * Add UE to another queue specifically for CRNTI based contention
- * resolution.
- *
- *
- * @param[in] RgSchUeCb *ue
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCmnContResUlGrant
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchErrInfo *err
-)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-
- #ifdef EMTC_ENABLE
- if(cell->emtcEnable)
- {
- if(ue->isEmtcUe)
- {
- cellSch->apisEmtcUl->rgSCHContResUlGrant(cell, ue);
- return ROK;
- }
- }
- else
-#endif
- {
- cellSch->apisUl->rgSCHContResUlGrant(cell, ue);
- }
- return ROK;
-}
-
-/**
- * @brief SR reception handling.
- *
- * @details
- *
- * Function : rgSCHCmnSrRcvd
- *
- * - Update UE's position within/across uplink scheduling queues
- * - Update priority of LCGs if needed.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] CmLteTimingInfo frm
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHCmnSrRcvd
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-CmLteTimingInfo frm,
-RgSchErrInfo *err
-)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell);
- CmLList *node = ueUl->ulAllocLst.last;
-
-
-#ifdef EMTC_ENABLE
- emtcStatsUlTomSrInd++;
-#endif
-
- RGSCH_INCR_SUB_FRAME(frm, 1); /* 1 TTI after the time SR was sent */
- while (node)
- {
- RgSchCmnAllocRecord *allRcd = (RgSchCmnAllocRecord *)node->node;
- if (RGSCH_TIMEINFO_SAME(frm, allRcd->allocTime))
- {
- break;
- }
- node = node->prev;
- }
- //TODO_SID Need to check when it is getting triggered
- ue->isSrGrant = TRUE;
-#ifdef EMTC_ENABLE
- if(cell->emtcEnable)
- {
- if(ue->isEmtcUe)
- {
- cellSch->apisEmtcUl->rgSCHSrRcvd(cell, ue);
- return ROK;
- }
- }
- else
-#endif
- {
- cellSch->apisUl->rgSCHSrRcvd(cell, ue);
- }
- return ROK;
-}
-
-/**
- * @brief Returns first uplink allocation to send reception
- * request to PHY.
- *
- * @details
- *
- * Function: rgSCHCmnFirstRcptnReq(cell)
- * Purpose: This function returns the first uplink allocation
- * (or NULLP if there is none) in the subframe
- * in which is expected to prepare and send reception
- * request to PHY.
- *
- * Invoked by: TOM
- *
- * @param[in] RgSchCellCb *cell
- * @return RgSchUlAlloc*
- **/
-RgSchUlAlloc *rgSCHCmnFirstRcptnReq(RgSchCellCb *cell)
-{
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
-/* ACC_TDD */
- RgSchUlAlloc* alloc = NULLP;
-
-
- if (cellUl->rcpReqIdx != RGSCH_INVALID_INFO)
- {
- RgSchUlSf* sf = &cellUl->ulSfArr[cellUl->rcpReqIdx];
- alloc = rgSCHUtlUlAllocFirst(sf);
-
- if (alloc && alloc->hqProc == NULLP)
- {
- alloc = rgSCHUtlUlAllocNxt(sf, alloc);
- }
- }
-
- return (alloc);
-}
-
-/**
- * @brief Returns first uplink allocation to send reception
- * request to PHY.
- *
- * @details
- *
- * Function: rgSCHCmnNextRcptnReq(cell)
- * Purpose: This function returns the next uplink allocation
- * (or NULLP if there is none) in the subframe
- * in which is expected to prepare and send reception
- * request to PHY.
- *
- * Invoked by: TOM
- *
- * @param[in] RgSchCellCb *cell
- * @return RgSchUlAlloc*
- **/
-RgSchUlAlloc *rgSCHCmnNextRcptnReq(RgSchCellCb *cell,RgSchUlAlloc *alloc)
-{
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
-/* ACC-TDD */
- //RgSchUlSf *sf = &cellUl->ulSfArr[cellUl->rcpReqIdx];
-
-/* ACC-TDD */
- if (cellUl->rcpReqIdx != RGSCH_INVALID_INFO)
- {
- RgSchUlSf *sf = &cellUl->ulSfArr[cellUl->rcpReqIdx];
-
- alloc = rgSCHUtlUlAllocNxt(sf, alloc);
- if (alloc && alloc->hqProc == NULLP)
- {
- alloc = rgSCHUtlUlAllocNxt(sf, alloc);
- }
- }
- else
- {
- alloc = NULLP;
- }
-
- return (alloc);
-}
-/**
- * @brief Collates DRX enabled UE's scheduled in this SF
- *
- * @details
- *
- * Function: rgSCHCmnDrxStrtInActvTmrInUl(cell)
- * Purpose: This function collates the link
- * of UE's scheduled in this SF who
- * have drx enabled. It then calls
- * DRX specific function to start/restart
- * inactivity timer in Ul
- *
- * Invoked by: TOM
- *
- * @param[in] RgSchCellCb *cell
- * @return Void
- **/
-Void rgSCHCmnDrxStrtInActvTmrInUl(RgSchCellCb *cell)
-{
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- RgSchUlSf *sf = &(cellUl->ulSfArr[cellUl->schdIdx]);
- RgSchUlAlloc *alloc = rgSCHUtlUlAllocFirst(sf);
- CmLListCp ulUeLst;
- RgSchUeCb *ueCb;
-
-
- cmLListInit(&ulUeLst);
-
- while(alloc)
- {
- ueCb = alloc->ue;
-
- if (ueCb)
- {
- if (!(alloc->grnt.isRtx) && ueCb->isDrxEnabled && !(ueCb->isSrGrant)
-#ifdef LTEMAC_SPS
- /* ccpu00139513- DRX inactivity timer should not be started for
- * UL SPS occasions */
- && (alloc->hqProc->isSpsOccnHqP == FALSE)
-#endif
- )
- {
- cmLListAdd2Tail(&ulUeLst,&(ueCb->ulDrxInactvTmrLnk));
- ueCb->ulDrxInactvTmrLnk.node = (PTR)ueCb;
- }
- }
-
- alloc = rgSCHUtlUlAllocNxt(sf, alloc);
- }/*while(alloc)*/
-
- (Void)rgSCHDrxStrtInActvTmr(cell,&ulUeLst,RG_SCH_DRX_UL);
-
- return;
-}
-
-
-/**
- * @brief Returns first uplink allocation to send HARQ feedback
- * request to PHY.
- *
- * @details
- *
- * Function: rgSCHCmnFirstHqFdbkAlloc
- * Purpose: This function returns the first uplink allocation
- * (or NULLP if there is none) in the subframe
- * for which it is expected to prepare and send HARQ
- * feedback to PHY.
- *
- * Invoked by: TOM
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] uint8_t idx
- * @return RgSchUlAlloc*
- **/
-RgSchUlAlloc *rgSCHCmnFirstHqFdbkAlloc(RgSchCellCb *cell,uint8_t idx)
-{
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
-/* ACC-TDD */
- RgSchUlAlloc *alloc = NULLP;
-
-
- if (cellUl->hqFdbkIdx[idx] != RGSCH_INVALID_INFO)
- {
- RgSchUlSf *sf = &cellUl->ulSfArr[cellUl->hqFdbkIdx[idx]];
- alloc = rgSCHUtlUlAllocFirst(sf);
-
- while (alloc && (alloc->hqProc == NULLP))
- {
- alloc = rgSCHUtlUlAllocNxt(sf, alloc);
- }
- }
-
- return (alloc);
-}
-
-/**
- * @brief Returns next allocation to send HARQ feedback for.
- *
- * @details
- *
- * Function: rgSCHCmnNextHqFdbkAlloc(cell)
- * Purpose: This function returns the next uplink allocation
- * (or NULLP if there is none) in the subframe
- * for which HARQ feedback needs to be sent.
- *
- * Invoked by: TOM
- *
- * @param[in] RgSchCellCb *cell
- * @return RgSchUlAlloc*
- **/
-RgSchUlAlloc *rgSCHCmnNextHqFdbkAlloc(RgSchCellCb *cell,RgSchUlAlloc *alloc,uint8_t idx)
-{
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
-
- if (cellUl->hqFdbkIdx[idx] != RGSCH_INVALID_INFO)
- {
- RgSchUlSf *sf = &cellUl->ulSfArr[cellUl->hqFdbkIdx[idx]];
-
- alloc = rgSCHUtlUlAllocNxt(sf, alloc);
- while (alloc && (alloc->hqProc == NULLP))
- {
- alloc = rgSCHUtlUlAllocNxt(sf, alloc);
- }
- }
- else
- {
- alloc = NULLP;
- }
- return (alloc);
-}
-
-/***********************************************************
- *
- * Func : rgSCHCmnUlGetITbsFrmIMcs
- *
- * Desc : Returns the Itbs that is mapped to an Imcs
- * for the case of uplink.
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-uint8_t rgSCHCmnUlGetITbsFrmIMcs(uint8_t iMcs)
-{
- return (rgUlIMcsTbl[iMcs].iTbs);
-}
-
-/***********************************************************
- *
- * Func : rgSCHCmnUlGetIMcsFrmITbs
- *
- * Desc : Returns the Imcs that is mapped to an Itbs
- * for the case of uplink.
- *
- * Ret :
- *
- * Notes: For iTbs 19, iMcs is dependant on modulation order.
- * Refer to 36.213, Table 8.6.1-1 and 36.306 Table 4.1-2
- * for UE capability information
- *
- * File :
- *
- **********************************************************/
-uint8_t rgSCHCmnUlGetIMcsFrmITbs(uint8_t iTbs,CmLteUeCategory ueCtg)
-{
- uint8_t iMcs;
-
- if (iTbs <= 10)
- {
- iMcs = iTbs;
- }
- /*a higher layer can force a 64QAM UE to transmit at 16QAM.
- * We currently do not support this. Once the support for such
- * is added, ueCtg should be replaced by current transmit
- * modulation configuration.Refer to 36.213 -8.6.1
- */
- else if ( iTbs < 19 )
- {
- iMcs = iTbs + 1;
- }
- else if ((iTbs == 19) && (ueCtg != CM_LTE_UE_CAT_5))
- {
- iMcs = iTbs + 1;
- }
- else
- {
- iMcs = iTbs + 2;
- }
-
-#ifdef LTE_TDD
- /* This is a Temp fix, done for TENBPLUS-3898, ULSCH SDU corruption
- was seen when IMCS exceeds 20 on T2k TDD*/
- if (iMcs > 20)
- {
- iMcs = 20;
- }
-#endif
-
- return (iMcs);
-}
-
-/***********************************************************
- *
- * Func : rgSCHCmnUlMinTbBitsForITbs
- *
- * Desc : Returns the minimum number of bits that can
- * be given as grant for a specific CQI.
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-uint32_t rgSCHCmnUlMinTbBitsForITbs(RgSchCmnUlCell *cellUl,uint8_t iTbs)
-{
-
- RGSCH_ARRAY_BOUND_CHECK(0, rgTbSzTbl[0], iTbs);
-
- return (rgTbSzTbl[0][iTbs][cellUl->sbSize-1]);
-}
-
-/***********************************************************
- *
- * Func : rgSCHCmnUlSbAlloc
- *
- * Desc : Given a required 'number of subbands' and a hole,
- * returns a suitable alloc such that the subband
- * allocation size is valid
- *
- * Ret :
- *
- * Notes: Does not assume either passed numSb or hole size
- * to be valid for allocation, and hence arrives at
- * an acceptable value.
- * File :
- *
- **********************************************************/
-RgSchUlAlloc *rgSCHCmnUlSbAlloc
-(
-RgSchUlSf *sf,
-uint8_t numSb,
-RgSchUlHole *hole
-)
-{
- uint8_t holeSz; /* valid hole size */
- RgSchUlAlloc *alloc;
-
- if ((holeSz = rgSchCmnMult235Tbl[hole->num].prvMatch) == hole->num)
- {
- numSb = rgSchCmnMult235Tbl[numSb].match;
- if (numSb >= holeSz)
- {
- alloc = rgSCHUtlUlAllocGetCompHole(sf, hole);
- }
- else
- {
- alloc = rgSCHUtlUlAllocGetPartHole(sf, numSb, hole);
- }
- }
- else
- {
- if (numSb < holeSz)
- {
- numSb = rgSchCmnMult235Tbl[numSb].match;
- }
- else
- {
- numSb = rgSchCmnMult235Tbl[numSb].prvMatch;
- }
-
- if ( numSb >= holeSz )
- {
- numSb = holeSz;
- }
- alloc = rgSCHUtlUlAllocGetPartHole(sf, numSb, hole);
- }
- return (alloc);
-}
-
-/**
- * @brief To fill the RgSchCmnUeUlAlloc structure of UeCb.
- *
- * @details
- *
- * Function: rgSCHCmnUlUeFillAllocInfo
- * Purpose: Specific scheduler to call this API to fill the alloc
- * information.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[out] RgSchUeCb *ue
- * @return Void
- **/
-Void rgSCHCmnUlUeFillAllocInfo(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- RgSchCmnUeUlAlloc *ulAllocInfo;
- RgSchCmnUlUe *ueUl;
-
-
- ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell);
- ulAllocInfo = &ueUl->alloc;
-
- /* Fill alloc structure */
- rgSCHCmnUlAllocFillTpc(cell, ue, ulAllocInfo->alloc);
- rgSCHCmnUlAllocFillNdmrs(cellUl, ulAllocInfo->alloc);
- rgSCHCmnUlAllocLnkHqProc(ue, ulAllocInfo->alloc, ulAllocInfo->alloc->hqProc,
- ulAllocInfo->alloc->hqProc->isRetx);
- /* Fill PDCCH */
- rgSCHCmnUlFillPdcchWithAlloc(ulAllocInfo->alloc->pdcch,
- ulAllocInfo->alloc, ue);
- /* Recording information about this allocation */
- rgSCHCmnUlRecordUeAlloc(cell, ue);
-
- /* Update the UE's outstanding allocation */
- if (!ulAllocInfo->alloc->hqProc->isRetx)
- {
- rgSCHCmnUlUpdOutStndAlloc(cell, ue, ulAllocInfo->allocdBytes);
- }
-
- return;
-}
-
-/**
- * @brief Update the UEs outstanding alloc based on the BSR report's timing.
- *
- *
- * @details
- *
- * Function: rgSCHCmnUpdUlCompEffBsr
- * Purpose: Clear off all the allocations from outstanding allocation that
- * are later than or equal to BSR timing information (stored in UEs datIndTime).
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-static Void rgSCHCmnUpdUlCompEffBsr(RgSchUeCb *ue)
-{
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,ue->cell);
- CmLList *node = ueUl->ulAllocLst.last;
- RgSchCmnAllocRecord *allRcd;
- uint32_t outStndAlloc=0;
- uint32_t nonLcg0OutStndAllocBs=0;
- uint32_t nonLcg0Bsr=0;
- uint8_t lcgId;
- RgSchCmnLcg *cmnLcg = NULLP;
-
- while (node)
- {
- allRcd = (RgSchCmnAllocRecord *)node->node;
- if (RGSCH_TIMEINFO_SAME(ue->macCeRptTime, allRcd->allocTime))
- {
- node = node->next;
- break;
- }
- node = node->prev;
- }
- while (node)
- {
- allRcd = (RgSchCmnAllocRecord *)node->node;
- node = node->next;
- outStndAlloc += allRcd->alloc;
- }
-
- cmnLcg = (RgSchCmnLcg *)(ue->ul.lcgArr[0].sch);
- /* Update UEs LCG0's bs according to the total outstanding BSR allocation.*/
- if (cmnLcg->bs > outStndAlloc)
- {
- cmnLcg->bs -= outStndAlloc;
- ue->ul.minReqBytes = cmnLcg->bs;
- outStndAlloc = 0;
- }
- else
- {
- nonLcg0OutStndAllocBs = outStndAlloc - cmnLcg->bs;
- cmnLcg->bs = 0;
- }
-
- for(lcgId = 1;lcgId < RGSCH_MAX_LCG_PER_UE; lcgId++)
- {
- if(RGSCH_LCG_ISCFGD(&ue->ul.lcgArr[lcgId]))
- {
- cmnLcg = ((RgSchCmnLcg *) (ue->ul.lcgArr[lcgId].sch));
- if (RGSCH_IS_GBR_BEARER(cmnLcg->cfgdGbr))
- {
- nonLcg0Bsr += cmnLcg->bs;
- }
- }
- }
- nonLcg0Bsr += ue->ul.nonGbrLcgBs;
- if (nonLcg0OutStndAllocBs > nonLcg0Bsr)
- {
- nonLcg0Bsr = 0;
- }
- else
- {
- nonLcg0Bsr -= nonLcg0OutStndAllocBs;
- }
- ue->ul.nonLcg0Bs = nonLcg0Bsr;
- /* Cap effBsr with nonLcg0Bsr and append lcg0 bs.
- * nonLcg0Bsr limit applies only to lcg1,2,3 */
- /* better be handled in individual scheduler */
- ue->ul.effBsr = nonLcg0Bsr +\
- ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs;
- return;
-}
-
-/**
- * @brief Records information about the current allocation.
- *
- * @details
- *
- * Function: rgSCHCmnUlRecordUeAlloc
- * Purpose: Records information about the curent allocation.
- * This includes the allocated bytes, as well
- * as some power information.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-Void rgSCHCmnUlRecordUeAlloc(RgSchCellCb *cell,RgSchUeCb *ue)
-{
-#ifdef LTE_TDD
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
-#endif
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell);
- CmLListCp *lst = &ueUl->ulAllocLst;
- CmLList *node = ueUl->ulAllocLst.first;
- RgSchCmnAllocRecord *allRcd = (RgSchCmnAllocRecord *)(node->node);
- RgSchCmnUeUlAlloc *ulAllocInfo = &ueUl->alloc;
- CmLteUeCategory ueCtg = (CmLteUeCategory)(RG_SCH_CMN_GET_UE_CTGY(ue));
-
- cmLListDelFrm(lst, &allRcd->lnk);
-#ifndef LTE_TDD
- /* To the crntTime, add the MIN time at which UE will
- * actually send the BSR i.e DELTA+4 */
- allRcd->allocTime = cell->crntTime;
- /*ccpu00116293 - Correcting relation between UL subframe and DL subframe based on RG_UL_DELTA*/
-#ifdef EMTC_ENABLE
- if(ue->isEmtcUe == TRUE)
- {
- RGSCH_INCR_SUB_FRAME_EMTC(allRcd->allocTime,
- (TFU_ULCNTRL_DLDELTA + RGSCH_PDCCH_PUSCH_DELTA));
- }
- else
-#endif
- {
- RGSCH_INCR_SUB_FRAME(allRcd->allocTime,
- (TFU_ULCNTRL_DLDELTA + RGSCH_PDCCH_PUSCH_DELTA));
- }
-#else
- allRcd->allocTime = cellUl->schdTime;
-#endif
- cmLListAdd2Tail(lst, &allRcd->lnk);
-
- /* Filling in the parameters to be recorded */
- allRcd->alloc = ulAllocInfo->allocdBytes;
- //allRcd->numRb = ulAllocInfo->alloc->grnt.numRb;
- allRcd->numRb = (ulAllocInfo->alloc->grnt.numVrbg * MAX_5GTF_VRBG_SIZE);
- /*Recording the UL CQI derived from the maxUlCqi */
- allRcd->cqi = rgSCHCmnUlGetCqi(cell, ue, ueCtg);
- allRcd->tpc = ulAllocInfo->alloc->grnt.tpc;
-
- rgSCHPwrRecordRbAlloc(cell, ue, allRcd->numRb);
-
- cell->measurements.ulBytesCnt += ulAllocInfo->allocdBytes;
-
- return;
-}
-
-/** PHR handling for MSG3
- * @brief Records allocation information of msg3 in the the UE.
- *
- * @details
- *
- * Function: rgSCHCmnUlRecMsg3Alloc
- * Purpose: Records information about msg3 allocation.
- * This includes the allocated bytes, as well
- * as some power information.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchRaCb *raCb
- * @return Void
- **/
-Void rgSCHCmnUlRecMsg3Alloc(RgSchCellCb *cell,RgSchUeCb *ue,RgSchRaCb *raCb)
-{
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell);
- CmLListCp *lst = &ueUl->ulAllocLst;
- CmLList *node = ueUl->ulAllocLst.first;
- RgSchCmnAllocRecord *allRcd = (RgSchCmnAllocRecord *)(node->node);
-
- /* Stack Crash problem for TRACE5 changes */
-
- cmLListDelFrm(lst, node);
- allRcd->allocTime = raCb->msg3AllocTime;
- cmLListAdd2Tail(lst, node);
-
- /* Filling in the parameters to be recorded */
- allRcd->alloc = raCb->msg3Grnt.datSz;
- allRcd->numRb = raCb->msg3Grnt.numRb;
- allRcd->cqi = raCb->ccchCqi;
- allRcd->tpc = raCb->msg3Grnt.tpc;
-
- rgSCHPwrRecordRbAlloc(cell, ue, allRcd->numRb);
-
- return;
-}
-/**
- * @brief Keeps track of the most recent RG_SCH_CMN_MAX_ALLOC_TRACK
- * allocations to track. Adds this allocation to the ueUl's ulAllocLst.
- *
- *
- * @details
- *
- * Function: rgSCHCmnUlUpdOutStndAlloc
- * Purpose: Recent Allocation shall be at First Pos'n.
- * Remove the last node, update the fields
- * with the new allocation and add at front.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t alloc
- * @return Void
- **/
-Void rgSCHCmnUlUpdOutStndAlloc(RgSchCellCb *cell,RgSchUeCb *ue,uint32_t alloc)
-{
- uint32_t nonLcg0Alloc=0;
-
- /* Update UEs LCG0's bs according to the total outstanding BSR allocation.*/
- if (((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs > alloc)
- {
- ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs -= alloc;
- }
- else
- {
- nonLcg0Alloc = alloc - ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs;
- ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs = 0;
- }
-
- if (nonLcg0Alloc >= ue->ul.nonLcg0Bs)
- {
- ue->ul.nonLcg0Bs = 0;
- }
- else
- {
- ue->ul.nonLcg0Bs -= nonLcg0Alloc;
- }
- /* Cap effBsr with effAmbr and append lcg0 bs.
- * effAmbr limit applies only to lcg1,2,3 non GBR LCG's*/
- /* better be handled in individual scheduler */
- ue->ul.effBsr = ue->ul.nonLcg0Bs +\
- ((RgSchCmnLcg *)(ue->ul.lcgArr[0].sch))->bs;
-#ifdef RGR_V1
- if (ue->ul.effBsr == 0)
- {
- if (ue->bsrTmr.tmrEvnt != TMR_NONE)
- {
- rgSCHTmrStopTmr(cell, ue->bsrTmr.tmrEvnt, ue);
- }
- /* ccpu00133008 */
- if (FALSE == ue->isSrGrant)
- {
- if (ue->ul.bsrTmrCfg.isPrdBsrTmrPres)
- {
- /*
- rgSCHTmrStartTmr(cell, ue, RG_SCH_TMR_BSR,
- ue->ul.bsrTmrCfg.prdBsrTmr);
- */
- }
- }
- }
-#endif
- /* Resetting UEs lower Cap */
- ue->ul.minReqBytes = 0;
-
- return;
-}
-
-
-/**
- * @brief Returns the "Itbs" for a given UE.
- *
- * @details
- *
- * Function: rgSCHCmnUlGetITbs
- * Purpose: This function returns the "Itbs" for a given UE.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchUeCb *ue
- * @return uint8_t
- **/
-uint8_t rgSCHCmnUlGetITbs
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-Bool isEcp
-)
-{
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell);
- /* CQI will be capped to maxUlCqi for 16qam UEs */
- CmLteUeCategory ueCtgy = (CmLteUeCategory)(RG_SCH_CMN_GET_UE_CTGY(ue));
- uint8_t cqi;
-#ifdef UL_LA
- S32 iTbs;
- uint8_t maxiTbs = rgSchCmnUlCqiToTbsTbl[(uint8_t)isEcp][ueUl->maxUlCqi];
-#endif
-
-
- /* #ifdef RG_SCH_CMN_EXT_CP_SUP For ECP pick index 1 */
-#ifdef TFU_UPGRADE
- if ( (ueCtgy != CM_LTE_UE_CAT_5) &&
- (ueUl->validUlCqi > ueUl->maxUlCqi)
- )
- {
- cqi = ueUl->maxUlCqi;
- }
- else
- {
- cqi = ueUl->validUlCqi;
- }
-
-#ifdef UL_LA
- iTbs = (ueUl->ulLaCb.cqiBasediTbs + ueUl->ulLaCb.deltaiTbs)/100;
-
- RG_SCH_CHK_ITBS_RANGE(iTbs, maxiTbs);
-
- iTbs = RGSCH_MIN(iTbs, ue->cell->thresholds.maxUlItbs);
-
-#ifdef LTE_TDD
- /* This is a Temp fix, done for TENBPLUS-3898, ULSCH SDU corruption
- was seen when IMCS exceeds 20 on T2k TDD */
- if (iTbs > 19)
- {
- iTbs = 19;
- }
-#endif
- return (iTbs);
-#endif
-#else
- if ( (ueCtgy != CM_LTE_UE_CAT_5) && (ueUl->crntUlCqi[0] > ueUl->maxUlCqi ))
- {
- cqi = ueUl->maxUlCqi;
- }
- else
- {
- cqi = ueUl->crntUlCqi[0];
- }
-#endif
- return (rgSchCmnUlCqiToTbsTbl[(uint8_t)isEcp][cqi]);
-}
-
-/**
- * @brief This function adds the UE to DLRbAllocInfo TX lst.
- *
- * @details
- *
- * Function: rgSCHCmnDlRbInfoAddUeTx
- * Purpose: This function adds the UE to DLRbAllocInfo TX lst.
- *
- * Invoked by: Common Scheduler
- *
- * @param[out] RgSchCmnDlRbAllocInfo *allocInfo
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchDlHqProcCb *hqP
- * @return Void
- *
- **/
-static Void rgSCHCmnDlRbInfoAddUeTx
-(
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *allocInfo,
-RgSchUeCb *ue,
-RgSchDlHqProcCb *hqP
-)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-
-
- if (hqP->reqLnk.node == NULLP)
- {
- if (cellSch->dl.isDlFreqSel)
- {
- cellSch->apisDlfs->rgSCHDlfsAddUeToLst(cell,
- &allocInfo->dedAlloc.txHqPLst, hqP);
- }
- else
- {
- {
- cmLListAdd2Tail(&allocInfo->dedAlloc.txHqPLst, &hqP->reqLnk);
- }
- hqP->reqLnk.node = (PTR)hqP;
- }
- }
- return;
-}
-
-/**
- * @brief This function adds the UE to DLRbAllocInfo RETX lst.
- *
- * @details
- *
- * Function: rgSCHCmnDlRbInfoAddUeRetx
- * Purpose: This function adds the UE to DLRbAllocInfo RETX lst.
- *
- * Invoked by: Common Scheduler
- *
- * @param[out] RgSchCmnDlRbAllocInfo *allocInfo
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchDlHqProcCb *hqP
- * @return Void
- *
- **/
-static Void rgSCHCmnDlRbInfoAddUeRetx
-(
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *allocInfo,
-RgSchUeCb *ue,
-RgSchDlHqProcCb *hqP
-)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(ue->cell);
-
-
- if (cellSch->dl.isDlFreqSel)
- {
- cellSch->apisDlfs->rgSCHDlfsAddUeToLst(cell,
- &allocInfo->dedAlloc.retxHqPLst, hqP);
- }
- else
- {
- /* checking UE's presence in this lst is unnecessary */
- cmLListAdd2Tail(&allocInfo->dedAlloc.retxHqPLst, &hqP->reqLnk);
- hqP->reqLnk.node = (PTR)hqP;
- }
- return;
-}
-
-/**
- * @brief This function adds the UE to DLRbAllocInfo TX-RETX lst.
- *
- * @details
- *
- * Function: rgSCHCmnDlRbInfoAddUeRetxTx
- * Purpose: This adds the UE to DLRbAllocInfo TX-RETX lst.
- *
- * Invoked by: Common Scheduler
- *
- * @param[out] RgSchCmnDlRbAllocInfo *allocInfo
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchDlHqProcCb *hqP
- * @return Void
- *
- **/
-static Void rgSCHCmnDlRbInfoAddUeRetxTx
-(
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *allocInfo,
-RgSchUeCb *ue,
-RgSchDlHqProcCb *hqP
-)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(ue->cell);
-
-
- if (cellSch->dl.isDlFreqSel)
- {
- cellSch->apisDlfs->rgSCHDlfsAddUeToLst(cell,
- &allocInfo->dedAlloc.txRetxHqPLst, hqP);
- }
- else
- {
- cmLListAdd2Tail(&allocInfo->dedAlloc.txRetxHqPLst, &hqP->reqLnk);
- hqP->reqLnk.node = (PTR)hqP;
- }
- return;
-}
-
-/**
- * @brief This function adds the UE to DLRbAllocInfo NonSchdRetxLst.
- *
- * @details
- *
- * Function: rgSCHCmnDlAdd2NonSchdRetxLst
- * Purpose: During RB estimation for RETX, if allocation fails
- * then appending it to NonSchdRetxLst, the further
- * action is taken as part of Finalization in
- * respective schedulers.
- *
- * Invoked by: Common Scheduler
- *
- * @param[out] RgSchCmnDlRbAllocInfo *allocInfo
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchDlHqProcCb *hqP
- * @return Void
- *
- **/
-static Void rgSCHCmnDlAdd2NonSchdRetxLst
-(
-RgSchCmnDlRbAllocInfo *allocInfo,
-RgSchUeCb *ue,
-RgSchDlHqProcCb *hqP
-)
-{
- CmLList *schdLnkNode;
-
-
-#ifdef LTEMAC_SPS
- if ( (hqP->sch != (RgSchCmnDlHqProc *)NULLP) &&
- (RG_SCH_CMN_SPS_DL_IS_SPS_HQP(hqP)))
- {
- return;
- }
-#endif
-
- schdLnkNode = &hqP->schdLstLnk;
- RG_SCH_CMN_INIT_SCHD_LNK(schdLnkNode, hqP);
- cmLListAdd2Tail(&allocInfo->dedAlloc.nonSchdRetxHqPLst, schdLnkNode);
-
- return;
-}
-
-
-
-/**
- * @brief This function adds the UE to DLRbAllocInfo NonSchdTxRetxLst.
- *
- * @details
- *
- * Function: rgSCHCmnDlAdd2NonSchdTxRetxLst
- * Purpose: During RB estimation for TXRETX, if allocation fails
- * then appending it to NonSchdTxRetxLst, the further
- * action is taken as part of Finalization in
- * respective schedulers.
- *
- * Invoked by: Common Scheduler
- *
- * @param[out] RgSchCmnDlRbAllocInfo *allocInfo
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchDlHqProcCb *hqP
- * @return Void
- *
- **/
-#ifdef LTE_TDD
-/**
- * @brief This function handles the initialisation of DL HARQ/ACK feedback
- * timing information for eaach DL subframe.
- *
- * @details
- *
- * Function: rgSCHCmnDlANFdbkInit
- * Purpose: Each DL subframe stores the sfn and subframe
- * information of UL subframe in which it expects
- * HARQ ACK/NACK feedback for this subframe.It
- * generates the information based on Downlink
- * Association Set Index table.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @return S16
- *
- **/
-static S16 rgSCHCmnDlANFdbkInit(RgSchCellCb *cell)
-{
- uint8_t sfCount;
- uint8_t ulDlCfgIdx = cell->ulDlCfgIdx;
- uint8_t maxDlSubfrms = cell->numDlSubfrms;
- uint8_t sfNum;
- uint8_t idx;
- uint8_t dlIdx;
- uint8_t calcSfnOffset;
- S8 calcSfNum;
- uint8_t ulSfCnt =0;
- RgSchTddSubfrmInfo ulSubfrmInfo;
- uint8_t maxUlSubfrms;
-
-
- ulSubfrmInfo = rgSchTddMaxUlSubfrmTbl[ulDlCfgIdx];
- maxUlSubfrms = rgSchTddNumUlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1];
-
- /* Generate HARQ ACK/NACK feedback information for each DL sf in a radio frame
- * Calculate this information based on DL Association set Index table */
- for (sfCount = 0, sfNum = 0; sfCount < maxUlSubfrms; sfCount++)
- {
- while(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][sfNum] !=
- RG_SCH_TDD_UL_SUBFRAME)
- {
- sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES;
- }
- ulSfCnt++;
-
- for(idx=0; idx < rgSchTddDlAscSetIdxKTbl[ulDlCfgIdx][sfNum].\
- numFdbkSubfrms; idx++)
- {
- calcSfNum = sfNum - rgSchTddDlAscSetIdxKTbl[ulDlCfgIdx][sfNum].\
- subfrmNum[idx];
- if(calcSfNum < 0)
- {
- calcSfnOffset = RGSCH_CEIL(-calcSfNum, RGSCH_NUM_SUB_FRAMES);
- }
- else
- {
- calcSfnOffset = 0;
- }
-
- calcSfNum = ((RGSCH_NUM_SUB_FRAMES * calcSfnOffset) + calcSfNum)\
- % RGSCH_NUM_SUB_FRAMES;
-
- if(calcSfNum <= RG_SCH_CMN_SPL_SUBFRM_1)
- {
- dlIdx = calcSfNum;
- }
- else if((ulSubfrmInfo.switchPoints == 2) && (calcSfNum <= \
- RG_SCH_CMN_SPL_SUBFRM_6))
- {
- dlIdx = calcSfNum - ulSubfrmInfo.numFrmHf1;
- }
- else
- {
- dlIdx = calcSfNum - maxUlSubfrms;
- }
-
- cell->subFrms[dlIdx]->dlFdbkInfo.subframe = sfNum;
- cell->subFrms[dlIdx]->dlFdbkInfo.sfnOffset = calcSfnOffset;
- cell->subFrms[dlIdx]->dlFdbkInfo.m = idx;
- }
- sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES;
- }
-
- /* DL subframes in the subsequent radio frames are initialized
- * with the previous radio frames */
- for(dlIdx = RGSCH_NUM_SUB_FRAMES - maxUlSubfrms; dlIdx < maxDlSubfrms;\
- dlIdx++)
- {
- sfNum = dlIdx - rgSchTddNumDlSubfrmTbl[ulDlCfgIdx]\
- [RGSCH_NUM_SUB_FRAMES-1];
- cell->subFrms[dlIdx]->dlFdbkInfo.subframe = \
- cell->subFrms[sfNum]->dlFdbkInfo.subframe;
- cell->subFrms[dlIdx]->dlFdbkInfo.sfnOffset = \
- cell->subFrms[sfNum]->dlFdbkInfo.sfnOffset;
- cell->subFrms[dlIdx]->dlFdbkInfo.m = cell->subFrms[sfNum]->dlFdbkInfo.m;
- }
- return ROK;
-}
-
-/**
- * @brief This function handles the initialization of uplink association
- * set information for each DL subframe.
- *
- *
- * @details
- *
- * Function: rgSCHCmnDlKdashUlAscInit
- * Purpose: Each DL sf stores the sfn and sf information of UL sf
- * in which it expects HQ ACK/NACK trans. It generates the information
- * based on k` in UL association set index table.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @return S16
- *
- **/
-static S16 rgSCHCmnDlKdashUlAscInit(RgSchCellCb *cell)
-{
- uint8_t sfCount;
- uint8_t ulDlCfgIdx = cell->ulDlCfgIdx;
- uint8_t maxDlSubfrms = cell->numDlSubfrms;
- uint8_t sfNum;
- uint8_t dlIdx;
- S8 calcSfnOffset;
- S8 calcSfNum;
- uint8_t ulSfCnt =0;
- RgSchTddSubfrmInfo ulSubfrmInfo = rgSchTddMaxUlSubfrmTbl[ulDlCfgIdx];
- uint8_t maxUlSubfrms = rgSchTddNumUlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1];
- uint8_t dlPres = 0;
-
-
- /* Generate ACK/NACK offset information for each DL subframe in a radio frame
- * Calculate this information based on K` in UL Association Set table */
- for (sfCount = 0, sfNum = 0; sfCount < maxUlSubfrms; sfCount++)
- {
- while(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][sfNum] !=
- RG_SCH_TDD_UL_SUBFRAME)
- {
- sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES;
- }
- ulSfCnt++;
-
- calcSfNum = (sfNum - rgSchTddUlAscIdxKDashTbl[ulDlCfgIdx-1][sfNum] + \
- RGSCH_NUM_SUB_FRAMES) % RGSCH_NUM_SUB_FRAMES;
- calcSfnOffset = sfNum - rgSchTddUlAscIdxKDashTbl[ulDlCfgIdx-1][sfNum];
- if(calcSfnOffset < 0)
- {
- calcSfnOffset = RGSCH_CEIL(-calcSfnOffset, RGSCH_NUM_SUB_FRAMES);
- }
- else
- {
- calcSfnOffset = 0;
- }
-
- if(calcSfNum <= RG_SCH_CMN_SPL_SUBFRM_1)
- {
- dlIdx = calcSfNum;
- }
- else if((ulSubfrmInfo.switchPoints == 2) &&
- (calcSfNum <= RG_SCH_CMN_SPL_SUBFRM_6))
- {
- dlIdx = calcSfNum - ulSubfrmInfo.numFrmHf1;
- }
- else
- {
- dlIdx = calcSfNum - maxUlSubfrms;
- }
-
- cell->subFrms[dlIdx]->ulAscInfo.subframe = sfNum;
- cell->subFrms[dlIdx]->ulAscInfo.sfnOffset = calcSfnOffset;
-
- /* set dlIdx for which ulAscInfo is updated */
- dlPres = dlPres | (1 << dlIdx);
- sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES;
- }
-
- /* Set Invalid information for which ulAscInfo is not present */
- for (sfCount = 0;
- sfCount < rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1];
- sfCount++)
- {
- /* If dlPres is 0, ulAscInfo is not present in that DL index */
- if(! ((dlPres >> sfCount)&0x01))
- {
- cell->subFrms[sfCount]->ulAscInfo.sfnOffset =
- RGSCH_INVALID_INFO;
- cell->subFrms[sfCount]->ulAscInfo.subframe =
- RGSCH_INVALID_INFO;
- }
- }
-
- /* DL subframes in the subsequent radio frames are initialized
- * with the previous radio frames */
- for(dlIdx = RGSCH_NUM_SUB_FRAMES - maxUlSubfrms; dlIdx < maxDlSubfrms;
- dlIdx++)
- {
- sfNum = dlIdx - \
- rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1];
- cell->subFrms[dlIdx]->ulAscInfo.subframe =
- cell->subFrms[sfNum]->ulAscInfo.subframe;
- cell->subFrms[dlIdx]->ulAscInfo.sfnOffset =
- cell->subFrms[sfNum]->ulAscInfo.sfnOffset;
- }
- return ROK;
-}
-
-
-/**
- * @brief This function initialises the 'Np' value for 'p'
- *
- * @details
- *
- * Function: rgSCHCmnDlNpValInit
- * Purpose: To initialise the 'Np' value for each 'p'. It is used
- * to find the mapping between nCCE and 'p' and used in
- * HARQ ACK/NACK reception.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @return S16
- *
- **/
-static S16 rgSCHCmnDlNpValInit(RgSchCellCb *cell)
-{
- uint8_t idx;
- uint16_t np;
-
- /* Always Np is 0 for p=0 */
- cell->rgSchTddNpValTbl[0] = 0;
-
- for(idx=1; idx < RGSCH_TDD_MAX_P_PLUS_ONE_VAL; idx++)
- {
- np = cell->bwCfg.dlTotalBw * (idx * RG_SCH_CMN_NUM_SUBCAR - 4);
- cell->rgSchTddNpValTbl[idx] = (uint8_t) (np/36);
- }
-
- return ROK;
-}
-
-/**
- * @brief This function handles the creation of RACH preamble
- * list to queue the preambles and process at the scheduled
- * time.
- *
- * @details
- *
- * Function: rgSCHCmnDlCreateRachPrmLst
- * Purpose: To create RACH preamble list based on RA window size.
- * It is used to queue the preambles and process it at the
- * scheduled time.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @return S16
- *
- **/
-static S16 rgSCHCmnDlCreateRachPrmLst(RgSchCellCb *cell)
-{
- uint8_t raArrSz;
- S16 ret;
- uint8_t lstSize;
-
- RG_SCH_CMN_CALC_RARSPLST_SIZE(cell, raArrSz);
-
- lstSize = raArrSz * RGSCH_MAX_RA_RNTI_PER_SUBFRM * RGSCH_NUM_SUB_FRAMES;
-
- cell->raInfo.maxRaSize = raArrSz;
- ret = rgSCHUtlAllocSBuf(cell->instIdx,
- (Data **)(&cell->raInfo.raReqLst), (Size)(lstSize * sizeof(CmLListCp)));
- if (ret != ROK)
- {
- return (ret);
- }
-
- cell->raInfo.lstSize = lstSize;
-
- return ROK;
-}
-
-
-/**
- * @brief This function handles the initialization of RACH Response
- * information at each DL subframe.
- *
- * @details
- *
- * Function: rgSCHCmnDlRachInfoInit
- * Purpose: Each DL subframe stores the sfn and subframe information of
- * possible RACH response allowed for UL subframes. It generates
- * the information based on PRACH configuration.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @return S16
- *
- **/
-static S16 rgSCHCmnDlRachInfoInit(RgSchCellCb *cell)
-{
- uint8_t sfCount;
- uint8_t ulDlCfgIdx = cell->ulDlCfgIdx;
- uint8_t sfNum;
- uint8_t ulSfCnt =0;
- uint8_t maxUlSubfrms = rgSchTddNumUlSubfrmTbl[ulDlCfgIdx]\
- [RGSCH_NUM_SUB_FRAMES-1];
- uint8_t raArrSz;
- RgSchTddRachRspLst rachRspLst[3][RGSCH_NUM_SUB_FRAMES];
- uint8_t startWin;
- uint8_t endWin;
- uint8_t sfnIdx;
- uint8_t subfrmIdx;
- uint8_t endSubfrmIdx;
- uint8_t startSubfrmIdx;
- S16 ret;
- RgSchTddRachDelInfo *delInfo;
- S8 sfnOffset;
- uint8_t numSubfrms;
-
-
- memset(rachRspLst, 0, sizeof(rachRspLst));
-
- RG_SCH_CMN_CALC_RARSPLST_SIZE(cell, raArrSz);
-
- /* Include Special subframes */
- maxUlSubfrms = maxUlSubfrms + \
- rgSchTddMaxUlSubfrmTbl[ulDlCfgIdx].switchPoints;
- for (sfCount = 0, sfNum = 0; sfCount < maxUlSubfrms; sfCount++)
- {
- while(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][sfNum] ==
- RG_SCH_TDD_DL_SUBFRAME)
- {
- sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES;
- }
- ulSfCnt++;
-
- startWin = (sfNum + RG_SCH_CMN_RARSP_WAIT_PRD + \
- ((RgSchCmnCell *)cell->sc.sch)->dl.numRaSubFrms);
- endWin = (startWin + cell->rachCfg.raWinSize - 1);
- startSubfrmIdx =
- rgSchTddHighDlSubfrmIdxTbl[ulDlCfgIdx][startWin%RGSCH_NUM_SUB_FRAMES];
- /* Find the next DL subframe starting from Subframe 0 */
- if((startSubfrmIdx % RGSCH_NUM_SUB_FRAMES) == 0)
- {
- startWin = RGSCH_CEIL(startWin, RGSCH_NUM_SUB_FRAMES);
- startWin = startWin * RGSCH_NUM_SUB_FRAMES;
- }
-
- endSubfrmIdx =
- rgSchTddLowDlSubfrmIdxTbl[ulDlCfgIdx][endWin%RGSCH_NUM_SUB_FRAMES];
- endWin = (endWin/RGSCH_NUM_SUB_FRAMES) * RGSCH_NUM_SUB_FRAMES \
- + endSubfrmIdx;
- if(startWin > endWin)
- {
- continue;
- }
- /* Find all the possible RACH Response transmission
- * time within the RA window size */
- startSubfrmIdx = startWin%RGSCH_NUM_SUB_FRAMES;
- for(sfnIdx = startWin/RGSCH_NUM_SUB_FRAMES;
- sfnIdx <= endWin/RGSCH_NUM_SUB_FRAMES; sfnIdx++)
- {
- if(sfnIdx == endWin/RGSCH_NUM_SUB_FRAMES)
- {
- endSubfrmIdx = endWin%RGSCH_NUM_SUB_FRAMES;
- }
- else
- {
- endSubfrmIdx = RGSCH_NUM_SUB_FRAMES-1;
- }
-
- /* Find all the possible RACH Response transmission
- * time within radio frame */
- for(subfrmIdx = startSubfrmIdx;
- subfrmIdx <= endSubfrmIdx; subfrmIdx++)
- {
- if(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][subfrmIdx] ==
- RG_SCH_TDD_UL_SUBFRAME)
- {
- continue;
- }
- subfrmIdx = rgSchTddHighDlSubfrmIdxTbl[ulDlCfgIdx][subfrmIdx];
- /* Find the next DL subframe starting from Subframe 0 */
- if(subfrmIdx == RGSCH_NUM_SUB_FRAMES)
- {
- break;
- }
- RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rachRspLst[sfnIdx], subfrmIdx);
- numSubfrms =
- rachRspLst[sfnIdx][subfrmIdx].rachRsp[0].numSubfrms;
- rachRspLst[sfnIdx][subfrmIdx].rachRsp[0].sfnOffset = sfnIdx;
- rachRspLst[sfnIdx][subfrmIdx].rachRsp[0].subframe[numSubfrms]
- = sfNum;
- rachRspLst[sfnIdx][subfrmIdx].rachRsp[0].numSubfrms++;
- }
- startSubfrmIdx = RG_SCH_CMN_SUBFRM_0;
- }
- /* Update the subframes to be deleted at this subframe */
- /* Get the subframe after the end of RA window size */
- endWin++;
- endSubfrmIdx++;
- sfnOffset = endWin/RGSCH_NUM_SUB_FRAMES;
- if(sfnOffset < 0)
- {
- sfnOffset += raArrSz;
- }
- sfnIdx = (endWin/RGSCH_NUM_SUB_FRAMES) % raArrSz;
-
- RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgSchTddHighDlSubfrmIdxTbl[ulDlCfgIdx],endSubfrmIdx-1);
- if((endSubfrmIdx == RGSCH_NUM_SUB_FRAMES) ||
- (rgSchTddHighDlSubfrmIdxTbl[ulDlCfgIdx][endSubfrmIdx] ==
- RGSCH_NUM_SUB_FRAMES))
- {
- subfrmIdx =
- rgSchTddHighDlSubfrmIdxTbl[ulDlCfgIdx][RG_SCH_CMN_SUBFRM_0];
- }
- else
- {
- subfrmIdx = rgSchTddHighDlSubfrmIdxTbl[ulDlCfgIdx][endSubfrmIdx];
- }
-
- delInfo = &rachRspLst[sfnIdx][subfrmIdx].delInfo;
- delInfo->sfnOffset = sfnOffset;
- delInfo->subframe[delInfo->numSubfrms] = sfNum;
- delInfo->numSubfrms++;
-
- sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES;
- }
-
- ret = rgSCHCmnDlCpyRachInfo(cell, rachRspLst, raArrSz);
- if (ret != ROK)
- {
- return (ret);
- }
-
- return ROK;
-}
-
-/**
- * @brief This function handles the initialization of PHICH information
- * for each DL subframe based on PHICH table.
- *
- * @details
- *
- * Function: rgSCHCmnDlPhichOffsetInit
- * Purpose: Each DL subf stores the sfn and subf information of UL subframe
- * for which it trnsmts PHICH in this subframe. It generates the information
- * based on PHICH table.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @return S16
- *
- **/
-static S16 rgSCHCmnDlPhichOffsetInit(RgSchCellCb *cell)
-{
- uint8_t sfCount;
- uint8_t ulDlCfgIdx = cell->ulDlCfgIdx;
- uint8_t maxDlSubfrms = cell->numDlSubfrms;
- uint8_t sfNum;
- uint8_t dlIdx;
- uint8_t dlPres = 0;
- uint8_t calcSfnOffset;
- uint8_t calcSfNum;
- uint8_t ulSfCnt =0;
- RgSchTddSubfrmInfo ulSubfrmInfo = rgSchTddMaxUlSubfrmTbl[ulDlCfgIdx];
- uint8_t maxUlSubfrms = rgSchTddNumUlSubfrmTbl[ulDlCfgIdx]\
- [RGSCH_NUM_SUB_FRAMES-1];
-
-
- /* Generate PHICH offset information for each DL subframe in a radio frame
- * Calculate this information based on K in PHICH table */
- for (sfCount = 0, sfNum = 0; sfCount < maxUlSubfrms; sfCount++)
- {
- while(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][sfNum] !=
- RG_SCH_TDD_UL_SUBFRAME)
- {
- sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES;
- }
- ulSfCnt++;
-
- calcSfNum = (rgSchTddKPhichTbl[ulDlCfgIdx][sfNum] + sfNum) % \
- RGSCH_NUM_SUB_FRAMES;
- calcSfnOffset = (rgSchTddKPhichTbl[ulDlCfgIdx][sfNum] + sfNum) / \
- RGSCH_NUM_SUB_FRAMES;
-
- if(calcSfNum <= RG_SCH_CMN_SPL_SUBFRM_1)
- {
- dlIdx = calcSfNum;
- }
- else if((ulSubfrmInfo.switchPoints == 2) &&
- (calcSfNum <= RG_SCH_CMN_SPL_SUBFRM_6))
- {
- dlIdx = calcSfNum - ulSubfrmInfo.numFrmHf1;
- }
- else
- {
- dlIdx = calcSfNum - maxUlSubfrms;
- }
-
- cell->subFrms[dlIdx]->phichOffInfo.subframe = sfNum;
- cell->subFrms[dlIdx]->phichOffInfo.numSubfrms = 1;
-
- cell->subFrms[dlIdx]->phichOffInfo.sfnOffset = calcSfnOffset;
-
- /* set dlIdx for which phich offset is updated */
- dlPres = dlPres | (1 << dlIdx);
- sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES;
- }
-
- /* Set Invalid information for which phich offset is not present */
- for (sfCount = 0;
- sfCount < rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1];
- sfCount++)
- {
- /* If dlPres is 0, phich offset is not present in that DL index */
- if(! ((dlPres >> sfCount)&0x01))
- {
- cell->subFrms[sfCount]->phichOffInfo.sfnOffset =
- RGSCH_INVALID_INFO;
- cell->subFrms[sfCount]->phichOffInfo.subframe =
- RGSCH_INVALID_INFO;
- cell->subFrms[sfCount]->phichOffInfo.numSubfrms = 0;
- }
- }
-
- /* DL subframes in the subsequent radio frames are
- * initialized with the previous radio frames */
- for(dlIdx = RGSCH_NUM_SUB_FRAMES - maxUlSubfrms;
- dlIdx < maxDlSubfrms; dlIdx++)
- {
- sfNum = dlIdx - \
- rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1];
-
- cell->subFrms[dlIdx]->phichOffInfo.subframe =
- cell->subFrms[sfNum]->phichOffInfo.subframe;
-
- cell->subFrms[dlIdx]->phichOffInfo.sfnOffset =
- cell->subFrms[sfNum]->phichOffInfo.sfnOffset;
- }
- return ROK;
-}
-
-
-/**
- * @brief Updation of Sch vars per TTI.
- *
- * @details
- *
- * Function: rgSCHCmnUpdVars
- * Purpose: Updation of Sch vars per TTI.
- *
- * @param[in] RgSchCellCb *cell
- * @return Void
- *
- **/
-Void rgSCHCmnUpdVars(RgSchCellCb *cell)
-{
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- CmLteTimingInfo timeInfo;
- uint8_t idx;
- uint8_t ulSubframe;
- uint8_t ulDlCfgIdx = cell->ulDlCfgIdx;
- uint8_t msg3Subfrm;
- uint8_t Mval;
-
- /* ccpu00132654-ADD- Initializing all the indices in every subframe*/
- rgSCHCmnInitVars(cell);
-
- idx = (cell->crntTime.slot + TFU_ULCNTRL_DLDELTA) % RGSCH_NUM_SUB_FRAMES;
- /* Calculate the UL scheduling subframe idx based on the
- Pusch k table */
- if(rgSchTddPuschTxKTbl[ulDlCfgIdx][idx] != 0)
- {
- /* PUSCH transmission is based on offset from DL
- * PDCCH scheduling */
- RGSCHCMNADDTOCRNTTIME(cell->crntTime,timeInfo, TFU_ULCNTRL_DLDELTA);
- ulSubframe = rgSchTddPuschTxKTbl[ulDlCfgIdx][timeInfo.subframe];
- /* Add the DCI-0 to PUSCH time to get the time of UL subframe */
- RGSCHCMNADDTOCRNTTIME(timeInfo, timeInfo, ulSubframe);
-#ifdef LTEMAC_SPS
- cellUl->schdTti = timeInfo.sfn * 10 + timeInfo.subframe;
-#endif
- /* Fetch the corresponding UL subframe Idx in UL sf array */
- cellUl->schdIdx = rgSCHCmnGetUlSfIdx(&timeInfo, cell);
- /* Fetch the corresponding UL Harq Proc ID */
- cellUl->schdHqProcIdx = rgSCHCmnGetUlHqProcIdx(&timeInfo, cell);
- cellUl->schdTime = timeInfo;
- }
- Mval = rgSchTddPhichMValTbl[ulDlCfgIdx][idx];
- if(Mval)
- {
- /* Fetch the tx time for DL HIDCI-0 */
- RGSCHCMNADDTOCRNTTIME(cell->crntTime,timeInfo, TFU_ULCNTRL_DLDELTA);
- /* Fetch the corresponding n-k tx time of PUSCH */
- cellUl->hqFdbkIdx[0] = rgSCHCmnGetPhichUlSfIdx(&timeInfo, cell);
- /* Retx will happen according to the Pusch k table */
- cellUl->reTxIdx[0] = cellUl->schdIdx;
-
- if(ulDlCfgIdx == 0)
- {
- /* Calculate the ReTxIdx corresponding to hqFdbkIdx[0] */
- cellUl->reTxIdx[0] = rgSchUtlCfg0ReTxIdx(cell,timeInfo,
- cellUl->hqFdbkIdx[0]);
- if(Mval == 2)
- {
- /* At Idx 1 store the UL SF adjacent(left) to the UL SF
- given at idx 0 */
- cellUl->hqFdbkIdx[1] = (cellUl->hqFdbkIdx[0]-1 +
- cellUl->numUlSubfrms) % cellUl->numUlSubfrms;
- /* Calculate the ReTxIdx corresponding to hqFdbkIdx[1] */
- cellUl->reTxIdx[1] = rgSchUtlCfg0ReTxIdx(cell,timeInfo,
- cellUl->hqFdbkIdx[1]);
- }
- }
- }
-
- idx = (cell->crntTime.slot + TFU_RECPREQ_DLDELTA) % RGSCH_NUM_SUB_FRAMES;
- if (rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][idx] == RG_SCH_TDD_UL_SUBFRAME)
- {
- RGSCHCMNADDTOCRNTTIME(cell->crntTime, timeInfo, TFU_RECPREQ_DLDELTA)
- cellUl->rcpReqIdx = rgSCHCmnGetUlSfIdx(&timeInfo, cell);
- }
- idx = (cell->crntTime.slot+RG_SCH_CMN_DL_DELTA) % RGSCH_NUM_SUB_FRAMES;
-
- /*[ccpu00134666]-MOD-Modify the check to schedule the RAR in
- special subframe */
- if(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][idx] != RG_SCH_TDD_UL_SUBFRAME)
- {
- RGSCHCMNADDTOCRNTTIME(cell->crntTime,timeInfo,RG_SCH_CMN_DL_DELTA)
- msg3Subfrm = rgSchTddMsg3SubfrmTbl[ulDlCfgIdx][timeInfo.subframe];
- RGSCHCMNADDTOCRNTTIME(timeInfo, timeInfo, msg3Subfrm);
- cellUl->msg3SchdIdx = rgSCHCmnGetUlSfIdx(&timeInfo, cell);
- cellUl->msg3SchdHqProcIdx = rgSCHCmnGetUlHqProcIdx(&timeInfo, cell);
- }
-#ifdef LTEMAC_SPS
- if(!rgSchTddSpsUlRsrvTbl[ulDlCfgIdx][idx])
- {
- cellUl->spsUlRsrvIdx = RGSCH_INVALID_INFO;
- }
- else
- {
- /* introduce some reuse with above code? */
- uint8_t offst;
- RGSCHCMNADDTOCRNTTIME(cell->crntTime,timeInfo,RG_SCH_CMN_DL_DELTA)
- //offst = rgSchTddMsg3SubfrmTbl[ulDlCfgIdx][timeInfo.subframe];
- offst = rgSchTddSpsUlRsrvTbl[ulDlCfgIdx][timeInfo.subframe];
- RGSCHCMNADDTOCRNTTIME(timeInfo, timeInfo, offst);
- cellUl->spsUlRsrvIdx = rgSCHCmnGetUlSfIdx(&timeInfo, cell);
- /* The harq proc continues to be accessed and used the same delta before
- * actual data occurance, and hence use the same idx */
- cellUl->spsUlRsrvHqProcIdx = cellUl->schdHqProcIdx;
- }
-#endif
-
- /* RACHO: update cmn sched specific RACH variables,
- * mainly the prachMaskIndex */
- rgSCHCmnUpdRachParam(cell);
-
- return;
-}
-
-/**
- * @brief To get 'p' value from nCCE.
- *
- * @details
- *
- * Function: rgSCHCmnGetPValFrmCCE
- * Purpose: Gets 'p' value for HARQ ACK/NACK reception from CCE.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] uint8_t cce
- * @return uint8_t
- *
- **/
-uint8_t rgSCHCmnGetPValFrmCCE(RgSchCellCb *cell,uint8_t cce)
-{
- uint8_t i;
-
- for(i=1; i < RGSCH_TDD_MAX_P_PLUS_ONE_VAL; i++)
- {
- if(cce < cell->rgSchTddNpValTbl[i])
- {
- return (i-1);
- }
- }
- return (0);
-}
-#endif
-
-/***********************************************************
- *
- * Func : rgSCHCmnUlAdapRetx
- *
- * Desc : Adaptive retransmission for an allocation.
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHCmnUlAdapRetx(RgSchUlAlloc *alloc,RgSchUlHqProcCb *proc)
-{
-
- rgSCHUhmRetx(proc, alloc);
-#ifndef RG_5GTF
- if (proc->rvIdx != 0)
- {
- alloc->grnt.iMcsCrnt = rgSchCmnUlRvIdxToIMcsTbl[proc->rvIdx];
- }
- else
-#endif
- {
- alloc->grnt.iMcsCrnt = alloc->grnt.iMcs;
- }
- return;
-}
-
-/**
- * @brief Scheduler invocation per TTI.
- *
- * @details
- *
- * Function: rgSCHCmnHdlUlInactUes
- * Purpose:
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @return Void
- **/
-static Void rgSCHCmnHdlUlInactUes(RgSchCellCb *cell)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- CmLListCp ulInactvLst;
- /* Get a List of Inactv UEs for UL*/
- cmLListInit(&ulInactvLst);
-
- /* Trigger Spfc Schedulers with Inactive UEs */
- rgSCHMeasGapANRepGetUlInactvUe (cell, &ulInactvLst);
- /* take care of this in UL retransmission */
- cellSch->apisUl->rgSCHUlInactvtUes(cell, &ulInactvLst);
-
- return;
-}
-
-/**
- * @brief Scheduler invocation per TTI.
- *
- * @details
- *
- * Function: rgSCHCmnHdlDlInactUes
- * Purpose:
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @return Void
- **/
-static Void rgSCHCmnHdlDlInactUes(RgSchCellCb *cell)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- CmLListCp dlInactvLst;
- /* Get a List of Inactv UEs for DL */
- cmLListInit(&dlInactvLst);
-
- /* Trigger Spfc Schedulers with Inactive UEs */
- rgSCHMeasGapANRepGetDlInactvUe (cell, &dlInactvLst);
-
- cellSch->apisDl->rgSCHDlInactvtUes(cell, &dlInactvLst);
- return;
-}
-
-/* RACHO: Rach handover functions start here */
-/***********************************************************
- *
- * Func : rgSCHCmnUeIdleExdThrsld
- *
- * Desc : RETURN ROK if UE has been idle more
- * than threshold.
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCmnUeIdleExdThrsld(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- /* Time difference in subframes */
- uint32_t sfDiff = RGSCH_CALC_SF_DIFF(cell->crntTime, ue->ul.ulTransTime);
-
- if (sfDiff > (uint32_t)RG_SCH_CMN_UE_IDLE_THRSLD(ue))
- {
- return ROK;
- }
- else
- {
- return RFAILED;
- }
-}
-
-\f
-/**
- * @brief Scheduler processing for Ded Preambles on cell configuration.
- *
- * @details
- *
- * Function : rgSCHCmnCfgRachDedPrm
- *
- * This function does requisite initialisation
- * for RACH Ded Preambles.
- *
- *
- * @param[in] RgSchCellCb *cell
- * @return Void
- **/
-static Void rgSCHCmnCfgRachDedPrm(RgSchCellCb *cell)
-{
- RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch);
- uint32_t gap = RG_SCH_CMN_MIN_PRACH_OPPR_GAP;
- uint32_t sfDiff;
- uint8_t cnt;
-
- if (cell->macPreambleSet.pres == NOTPRSNT)
- {
- return;
- }
- cellSch->rachCfg.numDedPrm = cell->macPreambleSet.size;
- cellSch->rachCfg.dedPrmStart = cell->macPreambleSet.start;
- /* Initialize handover List */
- cmLListInit(&cellSch->rachCfg.hoUeLst);
- /* Initialize pdcch Order List */
- cmLListInit(&cellSch->rachCfg.pdcchOdrLst);
-
- /* Intialize the rapId to UE mapping structure */
- for (cnt = 0; cnt<cellSch->rachCfg.numDedPrm; cnt++)
- {
- cellSch->rachCfg.rapIdMap[cnt].rapId = cellSch->rachCfg.dedPrmStart + \
- cnt;
- cmLListInit(&cellSch->rachCfg.rapIdMap[cnt].assgndUes);
- }
- /* Perform Prach Mask Idx, remDedPrm, applFrm initializations */
- /* Set remDedPrm as numDedPrm */
- cellSch->rachCfg.remDedPrm = cellSch->rachCfg.numDedPrm;
- /* Initialize applFrm */
- cellSch->rachCfg.prachMskIndx = 0;
- if (cell->rachCfg.raOccasion.sfnEnum == RGR_SFN_EVEN)
- {
- cellSch->rachCfg.applFrm.sfn = (cell->crntTime.sfn + \
- (cell->crntTime.sfn % 2)) % RGSCH_MAX_SFN;
- }
-#ifdef LTE_TDD
- else if (cell->rachCfg.raOccasion.sfnEnum == RGR_SFN_ODD)
- {
- if((cell->crntTime.sfn%2) == 0)
- {
- cellSch->rachCfg.applFrm.sfn = (cell->crntTime.sfn + 1)\
- % RGSCH_MAX_SFN;
- }
- }
-#endif
- else /* ANY sfn */
- {
- cellSch->rachCfg.applFrm.sfn = cell->crntTime.sfn;
- }
- /* Initialize cellSch->rachCfg.applFrm as >= crntTime.
- * This is because of RGSCH_CALC_SF_DIFF logic */
- if (cellSch->rachCfg.applFrm.sfn == cell->crntTime.sfn)
- {
- while (cellSch->rachCfg.prachMskIndx < cell->rachCfg.raOccasion.size)
- {
- if (cell->crntTime.slot <\
- cell->rachCfg.raOccasion.subFrameNum[cellSch->rachCfg.prachMskIndx])
- {
- break;
- }
- cellSch->rachCfg.prachMskIndx++;
- }
- if (cellSch->rachCfg.prachMskIndx == cell->rachCfg.raOccasion.size)
- {
- if (cell->rachCfg.raOccasion.sfnEnum == RGR_SFN_ANY)
- {
- cellSch->rachCfg.applFrm.sfn = (cellSch->rachCfg.applFrm.sfn+1) %\
- RGSCH_MAX_SFN;
- }
- else
- {
- cellSch->rachCfg.applFrm.sfn = (cellSch->rachCfg.applFrm.sfn+2) %\
- RGSCH_MAX_SFN;
- }
- cellSch->rachCfg.prachMskIndx = 0;
- }
- cellSch->rachCfg.applFrm.slot = \
- cell->rachCfg.raOccasion.subFrameNum[cellSch->rachCfg.prachMskIndx];
- }
- else
- {
- cellSch->rachCfg.applFrm.slot = \
- cell->rachCfg.raOccasion.subFrameNum[cellSch->rachCfg.prachMskIndx];
- }
-
- /* Note first param to this macro should always be the latest in time */
- sfDiff = RGSCH_CALC_SF_DIFF(cellSch->rachCfg.applFrm, cell->crntTime);
- while (sfDiff <= gap)
- {
- rgSCHCmnUpdNxtPrchMskIdx(cell);
- sfDiff = RGSCH_CALC_SF_DIFF(cellSch->rachCfg.applFrm, cell->crntTime);
- }
-
- return;
-}
-
-/**
- * @brief Updates the PRACH MASK INDEX.
- *
- * @details
- *
- * Function: rgSCHCmnUpdNxtPrchMskIdx
- * Purpose: Ensures the "applFrm" field of Cmn Sched RACH
- * CFG is always >= "n"+"DELTA", where "n" is the crntTime
- * of the cell. If not, applFrm is updated to the next avl
- * PRACH oppurtunity as per the PRACH Cfg Index configuration.
- *
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @return Void
- **/
-static Void rgSCHCmnUpdNxtPrchMskIdx(RgSchCellCb *cell)
-{
- RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch);
-
- /* Determine the next prach mask Index */
- if (cellSch->rachCfg.prachMskIndx == cell->rachCfg.raOccasion.size - 1)
- {
- /* PRACH within applFrm.sfn are done, go to next AVL sfn */
- cellSch->rachCfg.prachMskIndx = 0;
- if (cell->rachCfg.raOccasion.sfnEnum == RGR_SFN_ANY)
- {
- cellSch->rachCfg.applFrm.sfn = (cellSch->rachCfg.applFrm.sfn+1) % \
- RGSCH_MAX_SFN;
- }
- else/* RGR_SFN_EVEN or RGR_SFN_ODD */
- {
- cellSch->rachCfg.applFrm.sfn = (cellSch->rachCfg.applFrm.sfn+2) % \
- RGSCH_MAX_SFN;
- }
- cellSch->rachCfg.applFrm.slot = cell->rachCfg.raOccasion.\
- subFrameNum[0];
- }
- else /* applFrm.sfn is still valid */
- {
- cellSch->rachCfg.prachMskIndx += 1;
- if ( cellSch->rachCfg.prachMskIndx < RGR_MAX_SUBFRAME_NUM )
- {
- cellSch->rachCfg.applFrm.slot = \
- cell->rachCfg.raOccasion.subFrameNum[cellSch->rachCfg.prachMskIndx];
- }
- }
- return;
-}
-
-/**
- * @brief Updates the Ded preamble RACH parameters
- * every TTI.
- *
- * @details
- *
- * Function: rgSCHCmnUpdRachParam
- * Purpose: Ensures the "applFrm" field of Cmn Sched RACH
- * CFG is always >= "n"+"6"+"DELTA", where "n" is the crntTime
- * of the cell. If not, applFrm is updated to the next avl
- * PRACH oppurtunity as per the PRACH Cfg Index configuration,
- * accordingly the "remDedPrm" is reset to "numDedPrm" and
- * "prachMskIdx" field is updated as per "applFrm".
- *
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @return Void
- **/
-static Void rgSCHCmnUpdRachParam(RgSchCellCb *cell)
-{
-
- RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch);
- uint32_t gap = RG_SCH_CMN_MIN_PRACH_OPPR_GAP;
- uint32_t sfDiff;
-
- if (cell->macPreambleSet.pres == NOTPRSNT)
- {
- return;
- }
- sfDiff = RGSCH_CALC_SF_DIFF(cellSch->rachCfg.applFrm, \
- cell->crntTime);
- if (sfDiff > gap)
- {
- /* applFrm is still a valid next Prach Oppurtunity */
- return;
- }
- rgSCHCmnUpdNxtPrchMskIdx(cell);
- /* Reset remDedPrm as numDedPrm */
- cellSch->rachCfg.remDedPrm = cellSch->rachCfg.numDedPrm;
-
- return;
-}
-
-/**
- * @brief Dedicated Preamble allocation function.
- *
- * @details
- *
- * Function: rgSCHCmnAllocPOParam
- * Purpose: Allocate pdcch, rapId and PrachMskIdx.
- * Set mapping of UE with the allocated rapId.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *dlSf
- * @param[in] RgSchUeCb *ue
- * @param[out] RgSchPdcch **pdcch
- * @param[out] uint8_t *rapId
- * @param[out] uint8_t *prachMskIdx
- * @return Void
- **/
-static S16 rgSCHCmnAllocPOParam
-(
-RgSchCellCb *cell,
-RgSchDlSf *dlSf,
-RgSchUeCb *ue,
-RgSchPdcch **pdcch,
-uint8_t *rapId,
-uint8_t *prachMskIdx
-)
-{
-
- RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch);
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
-
-
- if (cell->macPreambleSet.pres == PRSNT_NODEF)
- {
- if (cellSch->rachCfg.remDedPrm == 0)
- {
- return RFAILED;
- }
- /* DTX Changes: One Variable is passed to check whether it is DTX or Not */
- if ((*pdcch = rgSCHCmnPdcchAlloc(cell, ue, dlSf, ueDl->mimoInfo.cwInfo[0].cqi, TFU_DCI_FORMAT_1A, FALSE)) == NULLP)
- {
- return RFAILED;
- }
- /* The stored prachMskIdx is the index of PRACH Oppurtunities in
- * raOccasions.subframes[].
- * Converting the same to the actual PRACHMskIdx to be transmitted. */
- *prachMskIdx = cellSch->rachCfg.prachMskIndx + 1;
- /* Distribution starts from dedPrmStart till dedPrmStart + numDedPrm */
- *rapId = cellSch->rachCfg.dedPrmStart +
- cellSch->rachCfg.numDedPrm - cellSch->rachCfg.remDedPrm;
- cellSch->rachCfg.remDedPrm--;
- /* Map UE with the allocated RapId */
- ueDl->rachInfo.asgnOppr = cellSch->rachCfg.applFrm;
- RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(cell->instIdx, cellSch->rachCfg.rapIdMap, (*rapId - cellSch->rachCfg.dedPrmStart));
- cmLListAdd2Tail(&cellSch->rachCfg.rapIdMap[*rapId - cellSch->rachCfg.dedPrmStart].assgndUes,
- &ueDl->rachInfo.rapIdLnk);
- ueDl->rachInfo.rapIdLnk.node = (PTR)ue;
- ueDl->rachInfo.poRapId = *rapId;
- }
- else /* if dedicated preambles not configured */
- {
- /* DTX Changes: One Variable is passed to check whether it is DTX or Not */
- if ((*pdcch = rgSCHCmnPdcchAlloc(cell, ue, dlSf, ueDl->mimoInfo.cwInfo[0].cqi, TFU_DCI_FORMAT_1A, FALSE)) == NULLP)
- {
- return RFAILED;
- }
- *prachMskIdx = 0;
- *rapId = 0;
- }
-
- return ROK;
-}
-
-/**
- * @brief Dowlink Scheduling Handler.
- *
- * @details
- *
- * Function: rgSCHCmnGenPdcchOrder
- * Purpose: For each UE in PO Q, grab a PDCCH,
- * get an available ded RapId and fill PDCCH
- * with PO information.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *dlSf
- * @return Void
- **/
-static Void rgSCHCmnGenPdcchOrder(RgSchCellCb *cell,RgSchDlSf *dlSf)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- CmLList *node = cellSch->rachCfg.pdcchOdrLst.first;
- RgSchUeCb *ue;
- uint8_t rapId;
- uint8_t prachMskIdx;
- RgSchPdcch *pdcch = NULLP;
-
- while (node)
- {
- ue = (RgSchUeCb *)node->node;
- node = node->next;
- /* Skip sending for this subframe is Measuring or inActive in UL due
- * to MeasGap or inactie due to DRX
- */
- if ((ue->measGapCb.isMeasuring == TRUE) ||
- (ue->ul.ulInactvMask & RG_MEASGAP_INACTIVE) ||
- (ue->isDrxEnabled &&
- ue->dl.dlInactvMask & RG_DRX_INACTIVE)
- )
- {
- continue;
- }
- if (rgSCHCmnAllocPOParam(cell, dlSf, ue, &pdcch, &rapId,\
- &prachMskIdx) != ROK)
- {
- /* No More rapIds left for the valid next avl Oppurtunity.
- * Unsatisfied UEs here would be given a chance, when the
- * prach Mask Index changes as per rachUpd every TTI */
-
- /* PDDCH can also be ordered with rapId=0, prachMskIdx=0
- * so that UE triggers a RACH procedure with non-dedicated preamble.
- * But the implementation here does not do this. Instead, the "break"
- * here implies, that PDCCH Odr always given with valid rapId!=0,
- * prachMskIdx!=0 if dedicated preambles are configured.
- * If not configured, then trigger a PO with rapId=0,prchMskIdx=0*/
- break;
- }
- /* Fill pdcch with pdcch odr information */
- rgSCHCmnFillPdcchOdr2Sf(cell, ue, pdcch, rapId, prachMskIdx);
- /* Remove this UE from the PDCCH ORDER QUEUE */
- rgSCHCmnDlRmvFrmPdcchOdrQ(cell, ue);
- /* Reset UE's power state */
- rgSCHPwrUeReset(cell, ue);
- }
- return;
-}
-
-\f
-/**
- * @brief This function add UE to PdcchOdr Q if not already present.
- *
- * @details
- *
- * Function: rgSCHCmnDlAdd2PdcchOdrQ
- * Purpose:
- *
- * Invoked by: CMN Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @return Void
- *
- **/
-static Void rgSCHCmnDlAdd2PdcchOdrQ(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
-
-
- if (ueDl->rachInfo.poLnk.node == NULLP)
- {
- cmLListAdd2Tail(&cellSch->rachCfg.pdcchOdrLst, &ueDl->rachInfo.poLnk);
- ueDl->rachInfo.poLnk.node = (PTR)ue;
- }
- return;
-}
-
-\f
-/**
- * @brief This function rmvs UE to PdcchOdr Q if not already present.
- *
- * @details
- *
- * Function: rgSCHCmnDlRmvFrmPdcchOdrQ
- * Purpose:
- *
- * Invoked by: CMN Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @return Void
- *
- **/
-static Void rgSCHCmnDlRmvFrmPdcchOdrQ(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
-
- cmLListDelFrm(&cellSch->rachCfg.pdcchOdrLst, &ueDl->rachInfo.poLnk);
- ueDl->rachInfo.poLnk.node = NULLP;
- return;
-}
-
-/**
- * @brief Fill pdcch with PDCCH order information.
- *
- * @details
- *
- * Function: rgSCHCmnFillPdcchOdr2Sf
- * Purpose: Fill PDCCH with PDCCH order information,
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchPdcch *pdcch
- * @param[in] uint8_t rapId
- * @param[in] uint8_t prachMskIdx
- * @return Void
- **/
-static Void rgSCHCmnFillPdcchOdr2Sf
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchPdcch *pdcch,
-uint8_t rapId,
-uint8_t prachMskIdx
-)
-{
- RgSchUeACqiCb *acqiCb = RG_SCH_CMN_GET_ACQICB(ue,cell);
-
-
- pdcch->rnti = ue->ueId;
- pdcch->dci.dciFormat = TFU_DCI_FORMAT_1A;
- pdcch->dci.u.format1aInfo.isPdcchOrder = TRUE;
- pdcch->dci.u.format1aInfo.t.pdcchOrder.preambleIdx = rapId;
- pdcch->dci.u.format1aInfo.t.pdcchOrder.prachMaskIdx = prachMskIdx;
-
- /* Request for APer CQI immediately after PDCCH Order */
- /* CR ccpu00144525 */
-#ifdef TFU_UPGRADE
- if(ue->dl.ueDlCqiCfg.aprdCqiCfg.pres)
- {
- ue->dl.reqForCqi = RG_SCH_APCQI_SERVING_CC;
- acqiCb->aCqiTrigWt = 0;
- }
-#endif
-
- return;
-}
-
-\f
-/**
- * @brief UE deletion for scheduler.
- *
- * @details
- *
- * Function : rgSCHCmnDelRachInfo
- *
- * This functions deletes all scheduler information
- * pertaining to an UE.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-static Void rgSCHCmnDelRachInfo(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- uint8_t rapIdIdx;
-
-
- if (ueDl->rachInfo.poLnk.node)
- {
- rgSCHCmnDlRmvFrmPdcchOdrQ(cell, ue);
- }
- if (ueDl->rachInfo.hoLnk.node)
- {
- cmLListDelFrm(&cellSch->rachCfg.hoUeLst, &ueDl->rachInfo.hoLnk);
- ueDl->rachInfo.hoLnk.node = NULLP;
- }
- if (ueDl->rachInfo.rapIdLnk.node)
- {
- rapIdIdx = ueDl->rachInfo.poRapId - cellSch->rachCfg.dedPrmStart;
- cmLListDelFrm(&cellSch->rachCfg.rapIdMap[rapIdIdx].assgndUes,
- &ueDl->rachInfo.rapIdLnk);
- ueDl->rachInfo.rapIdLnk.node = NULLP;
- }
- return;
-}
-
-/**
- * @brief This function retrieves the ue which has sent this raReq
- * and it allocates grant for UEs undergoing (for which RAR
- * is being generated) HandOver/PdcchOrder.
- *
- *
- * @details
- *
- * Function: rgSCHCmnHdlHoPo
- * Purpose: This function retrieves the ue which has sent this raReq
- * and it allocates grant for UEs undergoing (for which RAR
- * is being generated) HandOver/PdcchOrder.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[out] CmLListCp *raRspLst
- * @param[in] RgSchRaReqInfo *raReq
- * @return Void
- *
- **/
-static Void rgSCHCmnHdlHoPo
-(
-RgSchCellCb *cell,
-CmLListCp *raRspLst,
-RgSchRaReqInfo *raReq
-)
-{
- RgSchUeCb *ue = raReq->ue;
-
- if ( ue->isDrxEnabled )
- {
- rgSCHDrxDedRa(cell,ue);
- }
- rgSCHCmnAllocPoHoGrnt(cell, raRspLst, ue, raReq);
- return;
-}
-
-/**
- * @brief This function retrieves the UE which has sent this raReq
- * for handover case.
- *
- *
- * @details
- *
- * Function: rgSCHCmnGetHoUe
- * Purpose: This function retrieves the UE which has sent this raReq
- * for handover case.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchRaReqInfo *raReq
- * @return RgSchUeCb*
- *
- **/
-RgSchUeCb* rgSCHCmnGetHoUe(RgSchCellCb *cell,uint16_t rapId)
-{
- RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch);
- CmLList *node;
- CmLListCp *ueLst;
- RgSchUeCb *ue;
- RgSchCmnDlUe *ueDl;
-
- ueLst = &cellSch->rachCfg.hoUeLst;
- node = ueLst->first;
- while (node)
- {
- ue = (RgSchUeCb *)node->node;
- node = node->next;
- ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- if (ueDl->rachInfo.hoRapId == rapId)
- {
- return (ue);
- }
- }
- return (NULLP);
-}
-
-static Void rgSCHCmnDelDedPreamble(RgSchCellCb *cell,uint8_t preambleId)
-{
- RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch);
- CmLList *node;
- CmLListCp *ueLst;
- RgSchUeCb *ue;
- RgSchCmnDlUe *ueDl;
-
- ueLst = &cellSch->rachCfg.hoUeLst;
- node = ueLst->first;
- while (node)
- {
- ue = (RgSchUeCb *)node->node;
- node = node->next;
- ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- if (ueDl->rachInfo.hoRapId == preambleId)
- {
- cmLListDelFrm(ueLst, &ueDl->rachInfo.hoLnk);
- ueDl->rachInfo.hoLnk.node = (PTR)NULLP;
- }
- }
-}
-
-/**
- * @brief This function retrieves the UE which has sent this raReq
- * for PDCCh Order case.
- *
- *
- * @details
- *
- * Function: rgSCHCmnGetPoUe
- * Purpose: This function retrieves the UE which has sent this raReq
- * for PDCCH Order case.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchRaReqInfo *raReq
- * @return RgSchUeCb*
- *
- **/
-RgSchUeCb* rgSCHCmnGetPoUe
-(
-RgSchCellCb *cell,
-uint16_t rapId,
-CmLteTimingInfo timingInfo
-)
-{
- RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch);
- CmLList *node;
- CmLListCp *ueLst;
- RgSchUeCb *ue;
- RgSchCmnDlUe *ueDl;
- uint8_t rapIdIdx;
-
- rapIdIdx = rapId -cellSch->rachCfg.dedPrmStart;
- ueLst = &cellSch->rachCfg.rapIdMap[rapIdIdx].assgndUes;
- node = ueLst->first;
- while (node)
- {
- ue = (RgSchUeCb *)node->node;
- node = node->next;
- ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- /* Remove UEs irrespective.
- * Old UE associations are removed.*/
- cmLListDelFrm(ueLst, &ueDl->rachInfo.rapIdLnk);
- ueDl->rachInfo.rapIdLnk.node = (PTR)NULLP;
- if (RGSCH_TIMEINFO_SAME(ueDl->rachInfo.asgnOppr, timingInfo))
- {
- return (ue);
- }
- }
-
- return (NULLP);
-}
-
-
-/**
- * @brief This function returns the valid UL cqi for a given UE.
- *
- * @details
- *
- * Function: rgSCHCmnUlGetCqi
- * Purpose: This function returns the "valid UL cqi" for a given UE
- * based on UE category
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t ueCtgy
- * @return uint8_t
- **/
-uint8_t rgSCHCmnUlGetCqi
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-CmLteUeCategory ueCtgy
-)
-{
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell);
- uint8_t cqi;
-
-
- cqi = ueUl->maxUlCqi;
-#ifdef TFU_UPGRADE
- if (!((ueCtgy != CM_LTE_UE_CAT_5) &&
- (ueUl->validUlCqi > ueUl->maxUlCqi)))
- {
- cqi = ueUl->validUlCqi;
- }
-#else
- if (!((ueCtgy != CM_LTE_UE_CAT_5) &&
- (ueUl->crntUlCqi[0] > ueUl->maxUlCqi )))
- {
- cqi = ueUl->crntUlCqi[0];
- }
-#endif
- return (cqi);
-}/* End of rgSCHCmnUlGetCqi */
-
-/***********************************************************
- *
- * Func : rgSCHCmnUlRbAllocForPoHoUe
- *
- * Desc : Do uplink RB allocation for a HO/PO UE.
- *
- * Ret :
- *
- * Notes: Note that as of now, for retx, maxRb
- * is not considered. Alternatives, such
- * as dropping retx if it crosses maxRb
- * could be considered.
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHCmnUlRbAllocForPoHoUe
-(
-RgSchCellCb *cell,
-RgSchUlSf *sf,
-RgSchUeCb *ue,
-uint8_t maxRb
-)
-{
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell);
- uint8_t sbSize = cellUl->sbSize;
- uint32_t maxBits = ue->ul.maxBytesPerUePerTti*8;
- uint32_t bits;
- RgSchUlAlloc *alloc;
- uint32_t nPrb;
- uint8_t iTbs;
- uint32_t eff;
- uint32_t numSb;
- uint8_t iMcs;
- uint8_t iMcsCrnt;
- uint8_t cqi;
- uint8_t modOdr;
- RgSchUlHole *hole;
- RgSchUlHqProcCb *proc = &ueUl->hqEnt.hqProcCb[cellUl->msg3SchdHqProcIdx];
- CmLteUeCategory ueCtg = (CmLteUeCategory)(RG_SCH_CMN_GET_UE_CTGY(ue));
-
- if ((hole = rgSCHUtlUlHoleFirst(sf)) == NULLP)
- {
- return RFAILED;
- }
- /*MS_WORKAROUND for HO ccpu00121116*/
- cqi = rgSCHCmnUlGetCqi(cell, ue, ueCtg);
- RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgSchCmnUlCqiToTbsTbl[(uint8_t)cell->isCpUlExtend], cqi);
- iTbs = rgSchCmnUlCqiToTbsTbl[(uint8_t)cell->isCpUlExtend][cqi];
- iMcs = rgSCHCmnUlGetIMcsFrmITbs(iTbs,ueCtg);
- while(iMcs > RG_SCH_CMN_MAX_MSG3_IMCS)
- {
- cqi--;
- iTbs = rgSchCmnUlCqiToTbsTbl[(uint8_t)cell->isCpUlExtend][cqi];
- iMcs = rgSCHCmnUlGetIMcsFrmITbs(iTbs, ueCtg);
- }
- /* Filling the modorder in the grant structure*/
- RG_SCH_UL_MCS_TO_MODODR(iMcs,modOdr);
- if (!cell->isCpUlExtend)
- {
- eff = rgSchCmnNorUlEff[0][iTbs];
- }
- else
- {
- eff = rgSchCmnExtUlEff[0][iTbs];
- }
-
- bits = ueUl->alloc.reqBytes * 8;
-
-#if (ERRCLASS & ERRCLS_DEBUG)
- if (!bits)
- {
- return RFAILED;
- }
-#endif
-
- if (bits < rgSCHCmnUlMinTbBitsForITbs(cellUl, iTbs))
- {
- numSb = 1;
- nPrb = numSb * sbSize;
- }
- else
- {
- if (bits > maxBits)
- {
- bits = maxBits;
- nPrb = bits * 1024 / eff / RG_SCH_CMN_UL_NUM_RE_PER_RB(cellUl);
- if (nPrb > maxRb)
- {
- nPrb = maxRb;
- }
- numSb = nPrb / sbSize;
- }
- else
- {
- /*ccpu00128775:MOD-Change to get upper threshold nPrb*/
- nPrb = RGSCH_CEIL((RGSCH_CEIL(bits * 1024, eff)),
- RG_SCH_CMN_UL_NUM_RE_PER_RB(cellUl));
- if (nPrb > maxRb)
- {
- nPrb = maxRb;
- }
- numSb = RGSCH_DIV_ROUND(nPrb, sbSize);
- }
- }
- iMcsCrnt = iMcs;
-
- alloc = rgSCHCmnUlSbAlloc(sf, (uint8_t)RGSCH_MIN(numSb, cellUl->maxSbPerUe),\
- hole);
- if (alloc == NULLP)
- {
- DU_LOG("\nERROR --> SCH : rgSCHCmnUlRbAllocForPoHoUe(): Could not get UlAlloc");
- return RFAILED;
- }
- rgSCHCmnUlAllocFillRbInfo(cell, sf, alloc);
-
- /* Filling the modorder in the grant structure start*/
- alloc->grnt.modOdr = (TfuModScheme) modOdr;
- alloc->grnt.iMcs = iMcs;
- alloc->grnt.iMcsCrnt = iMcsCrnt;
- alloc->grnt.hop = 0;
- /* Fix for ccpu00123915*/
- alloc->forMsg3 = TRUE;
- alloc->hqProc = proc;
- alloc->hqProc->ulSfIdx = cellUl->msg3SchdIdx;
- alloc->ue = ue;
- alloc->rnti = ue->ueId;
- /* updating initNumRbs in case of HO */
-#ifdef TFU_UPGRADE
- ue->initNumRbs = alloc->grnt.numRb;
-#endif
- ueUl->alloc.alloc = alloc;
- iTbs = rgSCHCmnUlGetITbsFrmIMcs(iMcs);
- RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgTbSzTbl[0], iTbs);
- alloc->grnt.datSz = rgTbSzTbl[0][iTbs][alloc->grnt.numRb-1] / 8;
- /* MS_WORKAROUND for HO ccpu00121124*/
- /*[Adi temp change] Need to fil modOdr */
- RG_SCH_UL_MCS_TO_MODODR(alloc->grnt.iMcsCrnt,alloc->grnt.modOdr);
- rgSCHUhmNewTx(proc, ueUl->hqEnt.maxHqRetx, alloc);
- /* No grant attr recorded now */
- return ROK;
-}
-
-/**
- * @brief This function allocates grant for UEs undergoing (for which RAR
- * is being generated) HandOver/PdcchOrder.
- *
- *
- * @details
- *
- * Function: rgSCHCmnAllocPoHoGrnt
- * Purpose: This function allocates grant for UEs undergoing (for which RAR
- * is being generated) HandOver/PdcchOrder.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[out] CmLListCp *raRspLst,
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchRaReqInfo *raReq
- * @return Void
- *
- **/
-static Void rgSCHCmnAllocPoHoGrnt
-(
-RgSchCellCb *cell,
-CmLListCp *raRspLst,
-RgSchUeCb *ue,
-RgSchRaReqInfo *raReq
-)
-{
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell);
- RgSchUlGrnt *grnt;
- RgSchUlSf *sf = &cellUl->ulSfArr[cellUl->msg3SchdIdx];
-
-
- /* Clearing previous allocs if any*/
- rgSCHCmnUlUeDelAllocs(cell, ue);
- /* Fix : syed allocs are limited */
- if (*sf->allocCountRef >= cellUl->maxAllocPerUlSf)
- {
- return;
- }
- ueUl->alloc.reqBytes = RG_SCH_MIN_GRNT_HOPO;
- if (rgSCHCmnUlRbAllocForPoHoUe(cell, sf, ue, RGSCH_MAX_UL_RB) != ROK)
- {
- return;
- }
-
- /* Fill grant information */
- grnt = &ueUl->alloc.alloc->grnt;
-
- /* KWork fix */
- if (grnt == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Failed to get"
- "the grant for HO/PDCCH Order. CRNTI:%d",ue->ueId);
- return;
- }
- ue->ul.rarGrnt.rapId = raReq->raReq.rapId;
- ue->ul.rarGrnt.hop = grnt->hop;
- ue->ul.rarGrnt.rbStart = grnt->rbStart;
- ue->ul.rarGrnt.numRb = grnt->numRb;
- ue->ul.rarGrnt.tpc = grnt->tpc;
- ue->ul.rarGrnt.iMcsCrnt = grnt->iMcsCrnt;
- ue->ul.rarGrnt.ta.pres = TRUE;
- ue->ul.rarGrnt.ta.val = raReq->raReq.ta;
- ue->ul.rarGrnt.datSz = grnt->datSz;
- if((sf->numACqiCount < RG_SCH_MAX_ACQI_PER_ULSF) && (RG_SCH_APCQI_NO != ue->dl.reqForCqi))
- {
-#ifdef LTE_ADV
- uint8_t idx = 0;
- /* Send two bits cqireq field if more than one cells are configured else one*/
- for (idx = 1;idx < CM_LTE_MAX_CELLS;idx++)
- {
- if (ue->cellInfo[idx] != NULLP)
- {
- ue->ul.rarGrnt.cqiReqBit = ue->dl.reqForCqi;
- break;
- }
- }
- if (idx == CM_LTE_MAX_CELLS)
-#endif
- {
- ue->ul.rarGrnt.cqiReqBit = ue->dl.reqForCqi;
- }
- ue->dl.reqForCqi = RG_SCH_APCQI_NO;
- sf->numACqiCount++;
- }
- else
- {
- ue->ul.rarGrnt.cqiReqBit = 0;
- }
- /* Attach Ho/Po allocation to RAR Rsp cont free Lst */
- cmLListAdd2Tail(raRspLst, &ue->ul.rarGrnt.raRspLnk);
- ue->ul.rarGrnt.raRspLnk.node = (PTR)ue;
-
- return;
-}
-
-/**
- * @brief This is a utility function to set the fields in
- * an UL harq proc which is identified for non-adaptive retx
- *
- * @details
- *
- * Function: rgSCHCmnUlNonadapRetx
- * Purpose: Sets the fields in UL Harq proc for non-adaptive retx
- *
- * @param[in] RgSchCmnUlCell *cellUl
- * @param[out] RgSchUlAlloc *alloc
- * @param[in] uint8_t idx
- * @return Void
- *
- **/
-#ifdef UNUSED_FUNC
-static Void rgSCHCmnUlNonadapRetx
-(
-RgSchCmnUlCell *cellUl,
-RgSchUlAlloc *alloc,
-uint8_t idx
-)
-{
- rgSCHUhmRetx(alloc->hqProc, alloc);
-
- /* Update alloc to retx */
- alloc->hqProc->isRetx = TRUE;
- alloc->hqProc->ulSfIdx = cellUl->reTxIdx[idx];
-
- if (alloc->hqProc->rvIdx != 0)
- {
- alloc->grnt.iMcsCrnt = rgSchCmnUlRvIdxToIMcsTbl[alloc->hqProc->rvIdx];
- }
- else
- {
- alloc->grnt.iMcsCrnt = alloc->grnt.iMcs;
- }
- alloc->grnt.isRtx = TRUE;
- alloc->pdcch = NULLP;
- return;
-}
-/**
- * @brief Check if 2 allocs overlap
- *
- * @details
- *
- * Function : rgSCHCmnUlAllocsOvrLap
- *
- * - Return TRUE if alloc1 and alloc2 overlap.
- *
- * @param[in] RgSchUlAlloc *alloc1
- * @param[in] RgSchUlAlloc *alloc2
- * @return Bool
- **/
-static Bool rgSCHCmnUlAllocsOvrLap(RgSchUlAlloc *alloc1,RgSchUlAlloc *alloc2)
-{
-
- if (((alloc1->sbStart >= alloc2->sbStart) &&
- (alloc1->sbStart <= alloc2->sbStart + alloc2->numSb-1)) ||
- ((alloc2->sbStart >= alloc1->sbStart) &&
- (alloc2->sbStart <= alloc1->sbStart + alloc1->numSb-1)))
- {
- return (TRUE);
- }
- return (FALSE);
-}
-/**
- * @brief Copy allocation Info from src to dst.
- *
- * @details
- *
- * Function : rgSCHCmnUlCpyAllocInfo
- *
- * - Copy allocation Info from src to dst.
- *
- * @param[in] RgSchUlAlloc *srcAlloc
- * @param[in] RgSchUlAlloc *dstAlloc
- * @return Void
- **/
-static Void rgSCHCmnUlCpyAllocInfo(RgSchCellCb *cell,RgSchUlAlloc *srcAlloc,RgSchUlAlloc *dstAlloc)
-{
- RgSchCmnUlUe *ueUl;
-
- dstAlloc->grnt = srcAlloc->grnt;
- dstAlloc->hqProc = srcAlloc->hqProc;
- /* Fix : syed During UE context release, hqProc->alloc
- * was pointing to srcAlloc instead of dstAlloc and
- * freeing from incorrect sf->allocDb was
- * corrupting the list. */
- /* In case of SPS Occasion Allocation is done in advance and
- at a later time Hq Proc is linked. Hence HqProc
- pointer in alloc shall be NULL */
-#ifdef LTEMAC_SPS
- if (dstAlloc->hqProc)
-#endif
- {
- dstAlloc->hqProc->alloc = dstAlloc;
- }
- dstAlloc->ue = srcAlloc->ue;
- dstAlloc->rnti = srcAlloc->rnti;
- dstAlloc->forMsg3 = srcAlloc->forMsg3;
- dstAlloc->raCb = srcAlloc->raCb;
- dstAlloc->pdcch = srcAlloc->pdcch;
- /* Fix : syed HandIn Ue has forMsg3 and ue Set, but no RaCb */
- if (dstAlloc->ue)
- {
- ueUl = RG_SCH_CMN_GET_UL_UE(dstAlloc->ue,cell);
- ueUl->alloc.alloc = dstAlloc;
-#ifdef LTEMAC_SPS
- if (dstAlloc->ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE)
- {
- if((dstAlloc->ue->ul.ulSpsInfo.ulSpsSchdInfo.crntAlloc != NULLP)
- && (dstAlloc->ue->ul.ulSpsInfo.ulSpsSchdInfo.crntAlloc == srcAlloc))
- {
- dstAlloc->ue->ul.ulSpsInfo.ulSpsSchdInfo.crntAlloc = dstAlloc;
- }
- }
-#endif
- }
-
- return;
-}
-/**
- * @brief Update TX and RETX subframe's allocation
- * markings.
- *
- * @details
- *
- * Function : rgSCHCmnUlInsAllocFrmNewSf2OldSf
- *
- * - Release all preassigned allocations of newSf and merge
- * them to oldSf.
- * - If alloc of newSf collide with one or more allocs of oldSf
- * - mark all such allocs of oldSf for Adaptive Retx.
- * - Swap the alloc and hole DB references of oldSf and newSf.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUlSf *newSf
- * @param[in] RgSchUlSf *oldSf
- * @param[in] RgSchUlAlloc *srcAlloc
- * @return Void
- **/
-static Void rgSCHCmnUlInsAllocFrmNewSf2OldSf
-(
-RgSchCellCb *cell,
-RgSchUlSf *newSf,
-RgSchUlSf *oldSf,
-RgSchUlAlloc *srcAlloc
-)
-{
- RgSchUlAlloc *alloc, *dstAlloc, *nxtAlloc;
-
- /* MS_WORKAROUND ccpu00120827 */
- RgSchCmnCell *schCmnCell = (RgSchCmnCell *)(cell->sc.sch);
- uint8_t remAllocs;
-
- if ((alloc = rgSCHUtlUlAllocFirst(oldSf)) != NULLP)
- {
- do
- {
- nxtAlloc = rgSCHUtlUlAllocNxt(oldSf, alloc);
- /* If there is an overlap between alloc and srcAlloc
- * then alloc is marked for Adaptive retx and it is released
- * from txSf */
- if (rgSCHCmnUlAllocsOvrLap(alloc, srcAlloc) == TRUE)
- {
- rgSCHCmnUlUpdAllocRetx(cell, alloc);
- rgSCHUtlUlAllocRls(oldSf, alloc);
- }
- /* No further allocs spanning the srcAlloc subbands */
- if (srcAlloc->sbStart + srcAlloc->numSb - 1 <= alloc->sbStart)
- {
- break;
- }
- } while ((alloc = nxtAlloc) != NULLP);
- }
-
- /* After freeing all the colliding allocs, request for an allocation
- * specifying the start and numSb with in txSf. This function should
- * always return positively with a nonNULL dstAlloc */
- /* MS_WORKAROUND ccpu00120827 */
- remAllocs = schCmnCell->ul.maxAllocPerUlSf - *oldSf->allocCountRef;
- if (!remAllocs)
- {
- /* Fix : If oldSf already has max Allocs then release the
- * old RETX alloc to make space for new alloc of newSf.
- * newSf allocs(i.e new Msg3s) are given higher priority
- * over retx allocs. */
- if ((alloc = rgSCHUtlUlAllocFirst(oldSf)) != NULLP)
- {
- do
- {
- nxtAlloc = rgSCHUtlUlAllocNxt(oldSf, alloc);
- if (!alloc->mrgdNewTxAlloc)
- {
- /* If alloc is for RETX */
- /* TODO: Incase of this ad also in case of choosing
- * and alloc for ADAP RETX, we need to send ACK for
- * the corresponding alloc in PHICH */
-#ifndef EMTC_ENABLE
- rgSCHCmnUlFreeAllocation(cell, oldSf, alloc);
-#else
- rgSCHCmnUlFreeAllocation(cell, oldSf, alloc,FALSE);
-#endif
- break;
- }
- }while((alloc = nxtAlloc) != NULLP);
- }
- }
- dstAlloc = rgSCHUtlUlGetSpfcAlloc(oldSf, srcAlloc->sbStart, srcAlloc->numSb);
-#ifdef ERRCLS_KW
- /* This should never happen */
- if (dstAlloc == NULLP)
- {
- DU_LOG("\nERROR --> SCH : CRNTI:%d "
- "rgSCHUtlUlGetSpfcAlloc failed in rgSCHCmnUlInsAllocFrmNewSf2OldSf",
- srcAlloc->rnti);
- return;
- }
-#endif
- /* Copy the srcAlloc's state information in to dstAlloc */
- rgSCHCmnUlCpyAllocInfo(cell, srcAlloc, dstAlloc);
- /* Set new Tx merged Alloc Flag to TRUE, indicating that this
- * alloc shall not be processed for non-adaptive retransmission */
- dstAlloc->mrgdNewTxAlloc = TRUE;
- return;
-}
-/**
- * @brief Merge all allocations of newSf to oldSf.
- *
- * @details
- *
- * Function : rgSCHCmnUlMergeSfAllocs
- *
- * - Merge all allocations of newSf to oldSf.
- * - If newSf's alloc collides with oldSf's alloc
- * then oldSf's alloc is marked for adaptive Retx
- * and is released from oldSf to create space for
- * newSf's alloc.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUlSf *oldSf
- * @param[in] RgSchUlSf *newSf
- * @return Void
- **/
-static Void rgSCHCmnUlMergeSfAllocs(RgSchCellCb *cell,RgSchUlSf *oldSf,RgSchUlSf *newSf)
-{
- RgSchUlAlloc *alloc, *nxtAlloc;
- UNUSED(cell);
-
- /* Merge each alloc of newSf in to oldSf
- * and release it from newSf */
- if ((alloc = rgSCHUtlUlAllocFirst(newSf)) != NULLP)
- {
- do
- {
- nxtAlloc = rgSCHUtlUlAllocNxt(newSf, alloc);
- rgSCHCmnUlInsAllocFrmNewSf2OldSf(cell, newSf, oldSf, alloc);
- rgSCHUtlUlAllocRls(newSf, alloc);
- } while((alloc = nxtAlloc) != NULLP);
- }
- return;
-}
-/**
- * @brief Swap Hole/Alloc DB context of newSf and oldSf.
- *
- * @details
- *
- * Function : rgSCHCmnUlSwapSfAllocs
- *
- * - Swap Hole/Alloc DB context of newSf and oldSf.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUlSf *oldSf
- * @param[in] RgSchUlSf *newSf
- * @return Void
- **/
-static Void rgSCHCmnUlSwapSfAllocs(RgSchCellCb *cell,RgSchUlSf *oldSf,RgSchUlSf *newSf)
-{
- RgSchUlAllocDb *tempAllocDb = newSf->allocDb;
- RgSchUlHoleDb *tempHoleDb = newSf->holeDb;
- uint8_t tempAvailSbs = newSf->availSubbands;
-
- UNUSED(cell);
-
- newSf->allocDb = oldSf->allocDb;
- newSf->holeDb = oldSf->holeDb;
- newSf->availSubbands = oldSf->availSubbands;
-
- oldSf->allocDb = tempAllocDb;
- oldSf->holeDb = tempHoleDb;
- oldSf->availSubbands = tempAvailSbs;
-
- /* Fix ccpu00120610*/
- newSf->allocCountRef = &newSf->allocDb->count;
- oldSf->allocCountRef = &oldSf->allocDb->count;
- return;
-}
-/**
- * @brief Perform non-adaptive RETX for non-colliding allocs.
- *
- * @details
- *
- * Function : rgSCHCmnUlPrcNonAdptRetx
- *
- * - Perform non-adaptive RETX for non-colliding allocs.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUlSf *newSf
- * @param[in] uint8_t idx
- * @return Void
- **/
-static Void rgSCHCmnUlPrcNonAdptRetx(RgSchCellCb *cell,RgSchUlSf *newSf,uint8_t idx)
-{
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- RgSchUlAlloc *alloc, *nxtAlloc;
-
- /* perform non-adaptive retx allocation(adjustment) */
- if ((alloc = rgSCHUtlUlAllocFirst(newSf)) != NULLP)
- {
- do
- {
- nxtAlloc = rgSCHUtlUlAllocNxt(newSf, alloc);
- /* A merged new TX alloc, reset the state and skip */
- if (alloc->mrgdNewTxAlloc)
- {
- alloc->mrgdNewTxAlloc = FALSE;
- continue;
- }
-
-
- rgSCHCmnUlNonadapRetx(cellUl, alloc, idx);
-
- } while((alloc = nxtAlloc) != NULLP);
- }
- return;
-}
-
-/**
- * @brief Update TX and RETX subframe's allocation
- * markings.
- *
- * @details
- *
- * Function : rgSCHCmnUlPrfmSfMerge
- *
- * - Release all preassigned allocations of newSf and merge
- * them to oldSf.
- * - If alloc of newSf collide with one or more allocs of oldSf
- * - mark all such allocs of oldSf for Adaptive Retx.
- * - Swap the alloc and hole DB references of oldSf and newSf.
- * - The allocs which did not collide with pre-assigned msg3
- * allocs are marked for non-adaptive RETX.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUlSf *oldSf
- * @param[in] RgSchUlSf *newSf
- * @param[in] uint8_t idx
- * @return Void
- **/
-static Void rgSCHCmnUlPrfmSfMerge
-(
-RgSchCellCb *cell,
-RgSchUlSf *oldSf,
-RgSchUlSf *newSf,
-uint8_t idx
-)
-{
- /* Preassigned resources for msg3 in newSf.
- * Hence do adaptive retx for all NACKED TXs */
- rgSCHCmnUlMergeSfAllocs(cell, oldSf, newSf);
- /* swap alloc and hole DBs of oldSf and newSf. */
- rgSCHCmnUlSwapSfAllocs(cell, oldSf, newSf);
- /* Here newSf has the resultant merged allocs context */
- /* Perform non-adaptive RETX for non-colliding allocs */
- rgSCHCmnUlPrcNonAdptRetx(cell, newSf, idx);
-
- return;
-}
-#endif
-/**
- * @brief Update TX and RETX subframe's allocation
- * markings.
- *
- * @details
- *
- * Function : rgSCHCmnUlRmvCmpltdAllocs
- *
- * - Free all Transmission which are ACKED
- * OR for which MAX retransmission have
- * occurred.
- *
- *
- * @param[in] RgSchCellCb *cell,
- * @param[in] RgSchUlSf *sf
- * @return Void
- **/
-static Void rgSCHCmnUlRmvCmpltdAllocs(RgSchCellCb *cell,RgSchUlSf *sf)
-{
- RgSchUlAlloc *alloc, *nxtAlloc;
-
- if ((alloc = rgSCHUtlUlAllocFirst(sf)) == NULLP)
- {
- return;
- }
- do
- {
- nxtAlloc = rgSCHUtlUlAllocNxt(sf, alloc);
-#ifdef UL_ADPT_DBG
- DU_LOG("\nDEBUG --> SCH : rgSCHCmnUlRmvCmpltdAllocs:time(%d %d) alloc->hqProc->remTx %d hqProcId(%d) \n",cell->crntTime.sfn,cell->crntTime.slot,alloc->hqProc->remTx, alloc->grnt.hqProcId);
-#endif
- alloc->hqProc->rcvdCrcInd = TRUE;
- if ((alloc->hqProc->rcvdCrcInd) || (alloc->hqProc->remTx == 0))
- {
-
- /* SR_RACH_STATS : MSG 3 MAX RETX FAIL*/
- if ((alloc->forMsg3 == TRUE) && (alloc->hqProc->remTx == 0))
- {
- rgNumMsg3FailMaxRetx++;
-#ifdef TENB_STATS
- cell->tenbStats->sch.msg3Fail++;
-#endif
- }
-
-#ifdef MAC_SCH_STATS
- if(alloc->ue != NULLP)
- {
- /* access from ulHarqProc*/
- RgSchUeCb *ueCb = alloc->ue;
- RgSchCmnUe *cmnUe = (RgSchCmnUe*)ueCb->sch;
- RgSchCmnUlUe *ulUe = &(cmnUe->ul);
- uint8_t cqi = ulUe->crntUlCqi[0];
- uint16_t numUlRetx = ueCb->ul.hqEnt.maxHqRetx - alloc->hqProc->remTx;
-
- hqRetxStats.ulCqiStat[(cqi - 1)].mcs = alloc->grnt.iMcs;
-
- switch (numUlRetx)
- {
- case 1:
- hqRetxStats.ulCqiStat[(cqi - 1)].numOfHQ_1++;
- break;
- case 2:
- hqRetxStats.ulCqiStat[(cqi - 1)].numOfHQ_2++;
- break;
- case 3:
- hqRetxStats.ulCqiStat[(cqi - 1)].numOfHQ_3++;
- break;
- case 4:
- hqRetxStats.ulCqiStat[(cqi - 1)].numOfHQ_4++;
- break;
- }
- hqRetxStats.ulCqiStat[(cqi - 1)].totalTx = \
- hqRetxStats.ulCqiStat[(cqi - 1)].numOfHQ_1 + \
- (hqRetxStats.ulCqiStat[(cqi - 1)].numOfHQ_2 * 2) + \
- (hqRetxStats.ulCqiStat[(cqi - 1)].numOfHQ_3 * 3) + \
- (hqRetxStats.ulCqiStat[(cqi - 1)].numOfHQ_4 * 4);
- }
-
-#endif /*MAC_SCH_STATS*/
- rgSCHCmnUlFreeAllocation(cell, sf, alloc);
- }
- /*ccpu00106104 MOD added check for AckNackRep */
- /*added check for acknack so that adaptive retx considers ue
- inactivity due to ack nack repetition*/
- else if((alloc->ue != NULLP) && (TRUE != alloc->forMsg3))
- {
- rgSCHCmnUlUpdAllocRetx(cell, alloc);
- rgSCHUtlUlAllocRls(sf, alloc);
- }
- } while ((alloc = nxtAlloc) != NULLP);
-
- return;
-}
-
-/**
- * @brief Update an uplink subframe.
- *
- * @details
- *
- * Function : rgSCHCmnRlsUlSf
- *
- * For each allocation
- * - if no more tx needed
- * - Release allocation
- * - else
- * - Perform retransmission
- *
- * @param[in] RgSchUlSf *sf
- * @param[in] uint8_t idx
- * @return Void
- **/
-Void rgSCHCmnRlsUlSf(RgSchCellCb *cell,uint8_t idx)
-{
-
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- if (cellUl->hqFdbkIdx[idx] != RGSCH_INVALID_INFO)
- {
- RgSchUlSf *oldSf = &cellUl->ulSfArr[cellUl->hqFdbkIdx[idx]];
-
- /* Initialize the reTxLst of UL HqProcs for RETX subframe */
- if (rgSCHUtlUlAllocFirst(oldSf) == NULLP)
- {
- return;
- }
- /* Release all completed TX allocs from sf */
- rgSCHCmnUlRmvCmpltdAllocs(cell, oldSf);
-
- oldSf->numACqiCount = 0;
- }
- return;
-}
-
-/**
- * @brief Handle uplink allocation for retransmission.
- *
- * @details
- *
- * Function : rgSCHCmnUlUpdAllocRetx
- *
- * - Perform adaptive retransmission
- *
- * @param[in] RgSchUlSf *sf
- * @param[in] RgSchUlAlloc *alloc
- * @return Void
- **/
-static Void rgSCHCmnUlUpdAllocRetx(RgSchCellCb *cell,RgSchUlAlloc *alloc)
-{
- RgSchCmnUlCell *cmnUlCell = RG_SCH_CMN_GET_UL_CELL(cell);
-
- alloc->hqProc->reTxAlloc.rnti = alloc->rnti;
- alloc->hqProc->reTxAlloc.numSb = alloc->numSb;
- alloc->hqProc->reTxAlloc.iMcs = alloc->grnt.iMcs;
-#ifdef RG_5GTF
- alloc->hqProc->reTxAlloc.dciFrmt = alloc->grnt.dciFrmt;
- alloc->hqProc->reTxAlloc.numLyr = alloc->grnt.numLyr;
- alloc->hqProc->reTxAlloc.vrbgStart = alloc->grnt.vrbgStart;
- alloc->hqProc->reTxAlloc.numVrbg = alloc->grnt.numVrbg;
- alloc->hqProc->reTxAlloc.modOdr = alloc->grnt.modOdr;
-#endif
- //iTbs = rgSCHCmnUlGetITbsFrmIMcs(alloc->grnt.iMcs);
- //iTbs = alloc->grnt.iMcs;
- //RGSCH_ARRAY_BOUND_CHECK( 0, rgTbSzTbl[0], iTbs);
- alloc->hqProc->reTxAlloc.tbSz = alloc->grnt.datSz;
- //rgTbSzTbl[0][iTbs][alloc->grnt.numRb-1]/8;
- alloc->hqProc->reTxAlloc.ue = alloc->ue;
- alloc->hqProc->reTxAlloc.forMsg3 = alloc->forMsg3;
- alloc->hqProc->reTxAlloc.raCb = alloc->raCb;
-
- /* Set as retransmission is pending */
- alloc->hqProc->isRetx = TRUE;
- alloc->hqProc->alloc = NULLP;
- alloc->hqProc->ulSfIdx = RGSCH_INVALID_INFO;
-#ifdef UL_ADPT_DBG
- DU_LOG("\nDEBUG --> SCH : Adding Harq Proc Id in the retx list hqProcId %d \n",alloc->grnt.hqProcId);
-#endif
- cmLListAdd2Tail(&cmnUlCell->reTxLst, &alloc->hqProc->reTxLnk);
- alloc->hqProc->reTxLnk.node = (PTR)alloc->hqProc;
- return;
-}
-
-/**
- * @brief Attempts allocation for msg3s for which ADAP retransmissions
- * are required.
- *
- * @details
- *
- * Function : rgSCHCmnUlAdapRetxAlloc
- *
- * Attempts allocation for msg3s for which ADAP retransmissions
- * are required.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUlSf *sf
- * @param[in] RgSchUlHqProcCb *proc;
- * @param[in] RgSchUlHole *hole;
- * @return uint8_t
- **/
-static Bool rgSCHCmnUlAdapRetxAlloc
-(
-RgSchCellCb *cell,
-RgSchUlSf *sf,
-RgSchUlHqProcCb *proc,
-RgSchUlHole *hole
-)
-{
- uint8_t numSb = proc->reTxAlloc.numSb;
- uint8_t iMcs = proc->reTxAlloc.iMcs;
- CmLteTimingInfo frm = cell->crntTime;
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- RgSchDlSf *dlSf;
- RgSchPdcch *pdcch;
- RgSchUlAlloc *alloc;
-
- /* Fetch PDCCH for msg3 */
- /* ccpu00116293 - Correcting relation between UL subframe and DL subframe based on RG_UL_DELTA*/
- /* Introduced timing delta for UL control */
- RGSCH_INCR_SUB_FRAME(frm, TFU_ULCNTRL_DLDELTA);
- dlSf = rgSCHUtlSubFrmGet(cell, frm);
- pdcch = rgSCHCmnCmnPdcchAlloc(cell, dlSf);
- if (pdcch == NULLP)
- {
- return (FALSE);
- }
-
- /* Fetch UL Alloc for msg3 */
- if (numSb <= hole->num)
- {
- alloc = rgSCHUtlUlAllocGetHole(sf, numSb, hole);
-
- /* KWork fix */
- if(alloc == NULLP)
- {
- rgSCHUtlPdcchPut(cell, &dlSf->pdcchInfo, pdcch);
- DU_LOG("\nERROR --> SCH : UL Alloc fail for msg3 retx for rnti: %d\n",
- proc->reTxAlloc.rnti);
- return (FALSE);
- }
-
- rgSCHCmnUlAllocFillRbInfo(cell, sf, alloc);
- alloc->grnt.iMcs = iMcs;
- alloc->grnt.datSz = proc->reTxAlloc.tbSz;
-#ifdef RG_5GTF
-#else
- //RG_SCH_UL_MCS_TO_MODODR(iMcs, alloc->grnt.modOdr);
-#endif
- /* Fill UL Alloc for msg3 */
- /* RACHO : setting nDmrs to 0 and UlDelaybit to 0*/
- alloc->grnt.nDmrs = 0;
- alloc->grnt.hop = 0;
- alloc->grnt.delayBit = 0;
- alloc->grnt.isRtx = TRUE;
- proc->ulSfIdx = cellUl->schdIdx;
-#ifdef RG_5GTF
- proc->schdTime = cellUl->schdTime;
- alloc->grnt.hqProcId = proc->procId;
- alloc->grnt.dciFrmt = proc->reTxAlloc.dciFrmt;
- alloc->grnt.numLyr = proc->reTxAlloc.numLyr;
- alloc->grnt.vrbgStart = proc->reTxAlloc.vrbgStart;
- alloc->grnt.numVrbg = proc->reTxAlloc.numVrbg;
- alloc->grnt.rbAssign = rgSCHCmnCalcRiv(MAX_5GTF_VRBG, alloc->grnt.vrbgStart, alloc->grnt.numVrbg);
- alloc->grnt.modOdr = proc->reTxAlloc.modOdr;
-
- /* TODO : Hardcoding these as of now */
- alloc->grnt.hop = 0;
- alloc->grnt.SCID = 0;
- alloc->grnt.xPUSCHRange = MAX_5GTF_XPUSCH_RANGE;
- alloc->grnt.PMI = 0;
- alloc->grnt.uciOnxPUSCH = 0;
-#endif
- alloc->rnti = proc->reTxAlloc.rnti;
- /* Fix : syed HandIn Ue has forMsg3 and ue Set, but no RaCb */
- alloc->ue = proc->reTxAlloc.ue;
- alloc->pdcch = pdcch;
- alloc->forMsg3 = proc->reTxAlloc.forMsg3;
- alloc->raCb = proc->reTxAlloc.raCb;
- alloc->hqProc = proc;
- alloc->isAdaptive = TRUE;
-#ifdef LTE_L2_MEAS
- sf->totPrb += alloc->grnt.numRb;
-#endif
- /* FIX : syed HandIn Ue has forMsg3 and ue Set, but no RaCb */
- if (alloc->raCb)
- {
- alloc->raCb->msg3Grnt= alloc->grnt;
-#ifndef LTE_TDD
- /* To the crntTime, add the time at which UE will
- * actually send MSG3 */
- alloc->raCb->msg3AllocTime = cell->crntTime;
- RGSCH_INCR_SUB_FRAME(alloc->raCb->msg3AllocTime, RG_SCH_CMN_MIN_RETXMSG3_RECP_INTRVL);
-#else
- alloc->raCb->msg3AllocTime = cellUl->schdTime;
-#endif
- rgSCHCmnUlAdapRetx(alloc, proc);
- /* Fill PDCCH with alloc info */
- pdcch->rnti = alloc->rnti;
- pdcch->dci.dciFormat = TFU_DCI_FORMAT_0;
- pdcch->dci.u.format0Info.hoppingEnbld = alloc->grnt.hop;
- pdcch->dci.u.format0Info.rbStart = alloc->grnt.rbStart;
- pdcch->dci.u.format0Info.numRb = alloc->grnt.numRb;
- pdcch->dci.u.format0Info.mcs = alloc->grnt.iMcsCrnt;
- pdcch->dci.u.format0Info.ndi = alloc->hqProc->ndi;
- pdcch->dci.u.format0Info.nDmrs = alloc->grnt.nDmrs;
- pdcch->dci.u.format0Info.tpcCmd = alloc->grnt.tpc;
-
-#ifdef LTE_TDD
-#ifdef TFU_TDD
- /* ulIdx setting for cfg 0 shall be appropriately fixed thru ccpu00109015 */
- pdcch->dci.u.format0Info.ulIdx = RG_SCH_ULIDX_MSB;
- pdcch->dci.u.format0Info.dai = RG_SCH_MAX_DAI_IDX;
-#endif
-#endif
- pdcch->dciNumOfBits = cell->dciSize.size[TFU_DCI_FORMAT_0];
- }
- else
- {
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(alloc->ue,cell);
-#ifdef TFU_UPGRADE
- alloc->ue->initNumRbs = (alloc->grnt.numVrbg * MAX_5GTF_VRBG_SIZE);
-#endif
-#ifdef LTE_L2_MEAS
- ue->ul.nPrb = alloc->grnt.numRb;
-#endif
- ueUl->alloc.alloc = alloc;
- /* FIx: Removed the call to rgSCHCmnUlAdapRetx */
- rgSCHCmnUlUeFillAllocInfo(cell, alloc->ue);
- /* Setting csireq as false for Adaptive Retx*/
- ueUl->alloc.alloc->pdcch->dci.u.format0Info.cqiReq = RG_SCH_APCQI_NO;
- pdcch->dciNumOfBits = alloc->ue->dciSize.cmnSize[TFU_DCI_FORMAT_0];
- }
- /* Reset as retransmission is done */
- proc->isRetx = FALSE;
- }
- else /* Intg fix */
- {
- rgSCHUtlPdcchPut(cell, &dlSf->pdcchInfo, pdcch);
- DU_LOG("\nERROR --> SCH : Num SB not suffiecient for adap retx for rnti: %d",
- proc->reTxAlloc.rnti);
- return (FALSE);
- }
- return (TRUE);
-}
-
-/* Fix: syed Adaptive Msg3 Retx crash. */
-/**
- * @brief Releases all Adaptive Retx HqProcs which failed for
- * allocations in this scheduling occassion.
- *
- * @details
- *
- * Function : rgSCHCmnUlSfRlsRetxProcs
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUlSf *sf
- * @return uint8_t
- **/
-#ifdef UNUSED_FUNC
-static Void rgSCHCmnUlSfRlsRetxProcs(RgSchCellCb *cell,RgSchUlSf *sf)
-{
- CmLListCp *cp;
- CmLList *node;
- RgSchUlHqProcCb *proc;
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
-
- cp = &(cellUl->reTxLst);
- node = cp->first;
- while (node)
- {
- proc = (RgSchUlHqProcCb *)node->node;
- node = node->next;
- /* ccpu00137834 : Deleting reTxLnk from the respective reTxLst */
- cmLListDelFrm(&cellUl->reTxLst, &proc->reTxLnk);
- proc->reTxLnk.node = (PTR)NULLP;
- }
- return;
-}
-#endif
-
-/**
- * @brief Attempts allocation for UEs for which retransmissions
- * are required.
- *
- * @details
- *
- * Function : rgSCHCmnUlSfReTxAllocs
- *
- * Attempts allocation for UEs for which retransmissions
- * are required.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUlSf *sf
- * @return uint8_t
- **/
-static Void rgSCHCmnUlSfReTxAllocs(RgSchCellCb *cell,RgSchUlSf *sf)
-{
- CmLListCp *cp;
- CmLList *node;
- RgSchUlHqProcCb *proc;
- RgSchUlHole *hole;
- RgSchUeCb *ue;
- RgSchCmnCell *schCmnCell = (RgSchCmnCell *)(cell->sc.sch);
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
-
- cp = &(cellUl->reTxLst);
- node = cp->first;
- while ((node))
- {
- proc = (RgSchUlHqProcCb *)node->node;
- ue = proc->reTxAlloc.ue;
- node = node->next;
- /*ccpu00106104 MOD added check for AckNackRep */
- /*added check for acknack so that adaptive retx considers ue
- inactivity due to ack nack repetition*/
- if((ue != NULLP) &&
- ((ue->measGapCb.isMeasuring == TRUE)||
- (ue->ackNakRepCb.isAckNakRep == TRUE)))
- {
- continue;
- }
- /* Fix for ccpu00123917: Check if maximum allocs per UL sf have been exhausted */
- if (((hole = rgSCHUtlUlHoleFirst(sf)) == NULLP)
- || (sf->allocDb->count == schCmnCell->ul.maxAllocPerUlSf))
- {
- /* No more UL BW then return */
- break;
- }
- /* perform adaptive retx for UE's */
- if (rgSCHCmnUlAdapRetxAlloc(cell, sf, proc, hole) == FALSE)
- {
- continue;
- }
- /* ccpu00137834 : Deleting reTxLnk from the respective reTxLst */
- cmLListDelFrm(&cellUl->reTxLst, &proc->reTxLnk);
- /* Fix: syed Adaptive Msg3 Retx crash. */
- proc->reTxLnk.node = (PTR)NULLP;
- }
- return;
-}
-
-/**
- * @brief Handles RB allocation for downlink.
- *
- * @details
- *
- * Function : rgSCHCmnDlRbAlloc
- *
- * Invoking Module Processing:
- * - This function is invoked for DL RB allocation
- *
- * Processing Steps:
- * - If cell is frequency selecive,
- * - Call rgSCHDlfsAllocRb().
- * - else,
- * - Call rgSCHCmnNonDlfsRbAlloc().
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlRbAllocInfo *allocInfo
- * @return Void
- **/
-
-static Void rgSCHCmnDlRbAlloc(RgSchCellCb *cell,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-
- if (cellSch->dl.isDlFreqSel)
- {
- DU_LOG("\nINFO --> SCH : 5GTF_ERROR DLFS SCH Enabled\n");
- cellSch->apisDlfs->rgSCHDlfsAllocRb(cell, allocInfo);
- }
- else
- {
- rgSCHCmnNonDlfsRbAlloc(cell, allocInfo);
- }
- return;
-}
-
-#ifdef LTEMAC_SPS
-
-/**
- * @brief Determines number of RBGs and RBG subset sizes for the given DL
- * bandwidth and rbgSize
- *
- * @details
- * Function : rgSCHCmnDlGetRbgInfo
- *
- *
- * Processing Steps:
- * - Fill-up rbgInfo data structure for given DL bandwidth and rbgSize
- *
- * @param[in] uint8_t dlTotalBw
- * @param[in] uint8_t dlSubsetBw
- * @param[in] uint8_t maxRaType1SubsetBw
- * @param[in] uint8_t rbgSize
- * @param[out] RgSchBwRbgInfo *rbgInfo
- * @return Void
- **/
-Void rgSCHCmnDlGetRbgInfo
-(
-uint8_t dlTotalBw,
-uint8_t dlSubsetBw,
-uint8_t maxRaType1SubsetBw,
-uint8_t rbgSize,
-RgSchBwRbgInfo *rbgInfo
-)
-{
-#ifdef RGSCH_SPS_UNUSED
- uint8_t idx = 0;
- uint8_t lastRbgIdx = ((dlTotalBw + rbgSize - 1)/rbgSize) - 1;
- uint8_t currRbgSize = rbgSize;
- uint8_t subsetSizeIdx = 0;
- uint8_t subsetSize[RG_SCH_NUM_RATYPE1_SUBSETS] = {0};
- uint8_t lastRbgSize = rbgSize - (dlTotalBw - ((dlTotalBw/rbgSize) * rbgSize));
- uint8_t numRaType1Rbgs = (maxRaType1SubsetBw + rbgSize - 1)/rbgSize;
-#endif
-
- /* Compute maximum number of SPS RBGs for the cell */
- rbgInfo->numRbgs = ((dlSubsetBw + rbgSize - 1)/rbgSize);
-
-#ifdef RGSCH_SPS_UNUSED
- /* Distribute RBGs across subsets except last RBG */
- for (;idx < numRaType1Rbgs - 1; ++idx)
- {
- subsetSize[subsetSizeIdx] += currRbgSize;
- subsetSizeIdx = (subsetSizeIdx + 1) % rbgSize;
- }
-
- /* Computation for last RBG */
- if (idx == lastRbgIdx)
- {
- currRbgSize = lastRbgSize;
- }
- subsetSize[subsetSizeIdx] += currRbgSize;
- subsetSizeIdx = (subsetSizeIdx + 1) % rbgSize;
-#endif
-
- /* Update the computed sizes */
-#ifdef RGSCH_SPS_UNUSED
- rbgInfo->lastRbgSize = currRbgSize;
-#endif
- rbgInfo->lastRbgSize = rbgSize -
- (dlSubsetBw - ((dlSubsetBw/rbgSize) * rbgSize));
-#ifdef RGSCH_SPS_UNUSED
- memcpy(rbgInfo->rbgSubsetSize, subsetSize, 4 * sizeof(uint8_t));
-#endif
- rbgInfo->numRbs = (rbgInfo->numRbgs * rbgSize > dlTotalBw) ?
- dlTotalBw:(rbgInfo->numRbgs * rbgSize);
- rbgInfo->rbgSize = rbgSize;
-}
-
-/**
- * @brief Handles RB allocation for Resource allocation type 0
- *
- * @details
- *
- * Function : rgSCHCmnDlRaType0Alloc
- *
- * Invoking Module Processing:
- * - This function is invoked for DL RB allocation for resource allocation
- * type 0
- *
- * Processing Steps:
- * - Determine the available positions in the rbgMask.
- * - Allocate RBGs in the available positions.
- * - Update RA Type 0, RA Type 1 and RA type 2 masks.
- *
- * @param[in] RgSchDlSfAllocInfo *allocedInfo
- * @param[in] uint8_t rbsReq
- * @param[in] RgSchBwRbgInfo *rbgInfo
- * @param[out] uint8_t *numAllocRbs
- * @param[out] RgSchDlSfAllocInfo *resAllocInfo
- * @param[in] Bool isPartialAlloc
- *
- * @return Void
- **/
-
-uint8_t rgSCHCmnDlRaType0Alloc
-(
-RgSchDlSfAllocInfo *allocedInfo,
-uint8_t rbsReq,
-RgSchBwRbgInfo *rbgInfo,
-uint8_t *numAllocRbs,
-RgSchDlSfAllocInfo *resAllocInfo,
-Bool isPartialAlloc
-)
-{
- /* Note: This function atttempts allocation only full allocation */
- uint32_t remNumRbs, rbgPosInRbgMask, ueRaType2Mask;
- uint8_t type2MaskIdx, cnt, rbIdx;
- uint8_t maskSize, rbg;
- uint8_t bestNumAvailRbs = 0;
- uint8_t usedRbs = 0;
- uint8_t numAllocRbgs = 0;
- uint8_t rbgSize = rbgInfo->rbgSize;
- uint32_t *rbgMask = &(resAllocInfo->raType0Mask);
-#ifdef RGSCH_SPS_UNUSED
- uint8_t rbgSubset;
- uint32_t ueRaType1Mask;
- uint32_t *raType1Mask = resAllocInfo->raType1Mask;
- uint32_t *raType1UsedRbs = resAllocInfo->raType1UsedRbs;
-#endif
- uint32_t *raType2Mask = resAllocInfo->raType2Mask;
-
- uint32_t allocedMask = allocedInfo->raType0Mask;
-
- maskSize = rbgInfo->numRbgs;
-
- *numAllocRbs = 0;
- RG_SCH_CMN_DL_COUNT_ONES(allocedMask, maskSize, &usedRbs);
- if (maskSize == usedRbs)
- {
- /* All RBGs are allocated, including the last one */
- remNumRbs = 0;
- }
- else
- {
- remNumRbs = (maskSize - usedRbs - 1) * rbgSize; /* vamsee: removed minus 1 */
-
- /* If last RBG is available, add last RBG size */
- if (!(allocedMask & (1 << RG_SCH_CMN_DL_GET_POS_FRM_LSB(maskSize - 1))))
- {
- remNumRbs += rbgInfo->lastRbgSize;
- }
- }
-
- /* If complete allocation is needed, check if total requested RBs are available else
- * check the best available RBs */
- if (!isPartialAlloc)
- {
- if (remNumRbs >= rbsReq)
- {
- bestNumAvailRbs = rbsReq;
- }
- }
- else
- {
- bestNumAvailRbs = remNumRbs > rbsReq ? rbsReq : remNumRbs;
- }
-
- /* Allocate for bestNumAvailRbs */
- if (bestNumAvailRbs)
- {
- for (rbg = 0; rbg < maskSize - 1; ++rbg)
- {
- rbgPosInRbgMask = 1 << RG_SCH_CMN_DL_GET_POS_FRM_LSB(rbg);
- if (!(allocedMask & rbgPosInRbgMask))
- {
- /* Update RBG mask */
- *rbgMask |= rbgPosInRbgMask;
-
- /* Compute RB index of the first RB of the RBG allocated */
- rbIdx = rbg * rbgSize;
-
- for (cnt = 0; cnt < rbgSize; ++cnt)
- {
-#ifdef RGSCH_SPS_UNUSED
- ueRaType1Mask = rgSCHCmnGetRaType1Mask(rbIdx, rbgSize, &rbgSubset);
-#endif
- ueRaType2Mask = rgSCHCmnGetRaType2Mask(rbIdx, &type2MaskIdx);
-#ifdef RGSCH_SPS_UNUSED
- /* Update RBG mask for RA type 1 */
- raType1Mask[rbgSubset] |= ueRaType1Mask;
- raType1UsedRbs[rbgSubset]++;
-#endif
- /* Update RA type 2 mask */
- raType2Mask[type2MaskIdx] |= ueRaType2Mask;
- rbIdx++;
- }
- *numAllocRbs += rbgSize;
- remNumRbs -= rbgSize;
- ++numAllocRbgs;
- if (*numAllocRbs >= bestNumAvailRbs)
- {
- break;
- }
- }
- }
- /* If last RBG available and allocation is not completed, allocate
- * last RBG */
- if (*numAllocRbs < bestNumAvailRbs)
- {
- rbgPosInRbgMask = 1 << RG_SCH_CMN_DL_GET_POS_FRM_LSB(rbg);
- *rbgMask |= rbgPosInRbgMask;
- *numAllocRbs += rbgInfo->lastRbgSize;
-
- /* Compute RB index of the first RB of the last RBG */
- rbIdx = ((rbgInfo->numRbgs - 1 ) * rbgSize ); /* removed minus 1 vamsee */
-
- for (cnt = 0; cnt < rbgInfo->lastRbgSize; ++cnt)
- {
-#ifdef RGSCH_SPS_UNUSED
- ueRaType1Mask = rgSCHCmnGetRaType1Mask(rbIdx, rbgSize, &rbgSubset);
-#endif
- ueRaType2Mask = rgSCHCmnGetRaType2Mask(rbIdx, &type2MaskIdx);
-#ifdef RGSCH_SPS_UNUSED
- /* Update RBG mask for RA type 1 */
- raType1Mask[rbgSubset] |= ueRaType1Mask;
- raType1UsedRbs[rbgSubset]++;
-#endif
- /* Update RA type 2 mask */
- raType2Mask[type2MaskIdx] |= ueRaType2Mask;
- rbIdx++;
- }
- remNumRbs -= rbgInfo->lastRbgSize;
- ++numAllocRbgs;
- }
- /* Note: this should complete allocation, not checking for the
- * same */
- }
-
- return (numAllocRbgs);
-}
-
-#ifdef RGSCH_SPS_UNUSED
-/**
- * @brief Handles RB allocation for Resource allocation type 1
- *
- * @details
- *
- * Function : rgSCHCmnDlRaType1Alloc
- *
- * Invoking Module Processing:
- * - This function is invoked for DL RB allocation for resource allocation
- * type 1
- *
- * Processing Steps:
- * - Determine the available positions in the subsets.
- * - Allocate RB in the available subset.
- * - Update RA Type1, RA type 0 and RA type 2 masks.
- *
- * @param[in] RgSchDlSfAllocInfo *allocedInfo
- * @param[in] uint8_t rbsReq
- * @param[in] RgSchBwRbgInfo *rbgInfo
- * @param[in] uint8_t startRbgSubset
- * @param[in] uint8_t *allocRbgSubset
- * @param[out] rgSchDlSfAllocInfo *resAllocInfo
- * @param[in] Bool isPartialAlloc
- *
- * @return uint8_t
- * Number of allocated RBs
- **/
-
-uint8_t rgSCHCmnDlRaType1Alloc
-(
-RgSchDlSfAllocInfo *allocedInfo,
-uint8_t rbsReq,
-RgSchBwRbgInfo *rbgInfo,
-uint8_t startRbgSubset,
-uint8_t *allocRbgSubset,
-RgSchDlSfAllocInfo *resAllocInfo,
-Bool isPartialAlloc
-)
-{
- /* Note: This function atttempts only full allocation */
- uint8_t *rbgSubsetSzArr;
- uint8_t type2MaskIdx, subsetIdx, rbIdx, rbInSubset, rbgInSubset;
- uint8_t offset, rbg, maskSize, bestSubsetIdx;
- uint8_t startPos = 0;
- uint8_t bestNumAvailRbs = 0;
- uint8_t numAllocRbs = 0;
- uint32_t ueRaType2Mask, ueRaType0Mask, rbPosInSubset;
- uint32_t remNumRbs, allocedMask;
- uint8_t usedRbs = 0;
- uint8_t rbgSize = rbgInfo->rbgSize;
- uint8_t rbgSubset = startRbgSubset;
- uint32_t *rbgMask = &resAllocInfo->raType0Mask;
- uint32_t *raType1Mask = resAllocInfo->raType1Mask;
- uint32_t *raType2Mask = resAllocInfo->raType2Mask;
- uint32_t *raType1UsedRbs = resAllocInfo->raType1UsedRbs;
- uint32_t *allocMask = allocedInfo->raType1Mask;
-
- /* Initialize the subset size Array */
- rbgSubsetSzArr = rbgInfo->rbgSubsetSize;
-
- /* Perform allocation for RA type 1 */
- for (subsetIdx = 0;subsetIdx < rbgSize; ++subsetIdx)
- {
- allocedMask = allocMask[rbgSubset];
- maskSize = rbgSubsetSzArr[rbgSubset];
-
- /* Determine number of available RBs in the subset */
- usedRbs = allocedInfo->raType1UsedRbs[subsetIdx];
- remNumRbs = maskSize - usedRbs;
-
- if (remNumRbs >= rbsReq)
- {
- bestNumAvailRbs = rbsReq;
- bestSubsetIdx = rbgSubset;
- break;
- }
- else if (isPartialAlloc && (remNumRbs > bestNumAvailRbs))
- {
- bestNumAvailRbs = remNumRbs;
- bestSubsetIdx = rbgSubset;
- }
-
- rbgSubset = (rbgSubset + 1) % rbgSize;
- } /* End of for (each rbgsubset) */
-
- if (bestNumAvailRbs)
- {
- /* Initialize alloced mask and subsetSize depending on the RBG
- * subset of allocation */
- uint8_t startIdx = 0;
- maskSize = rbgSubsetSzArr[bestSubsetIdx];
- allocedMask = allocMask[bestSubsetIdx];
- RG_SCH_CMN_DL_GET_START_POS(allocedMask, maskSize,
- &startPos);
- for (; startIdx < rbgSize; ++startIdx, ++startPos)
- {
- for (rbInSubset = startPos; rbInSubset < maskSize;
- rbInSubset = rbInSubset + rbgSize)
- {
- rbPosInSubset = 1 << RG_SCH_CMN_DL_GET_POS_FRM_LSB(rbInSubset);
- if (!(allocedMask & rbPosInSubset))
- {
- raType1Mask[bestSubsetIdx] |= rbPosInSubset;
- raType1UsedRbs[bestSubsetIdx]++;
-
- /* Compute RB index value for the RB being allocated */
- rbgInSubset = rbInSubset /rbgSize;
- offset = rbInSubset % rbgSize;
- rbg = (rbgInSubset * rbgSize) + bestSubsetIdx;
- rbIdx = (rbg * rbgSize) + offset;
-
- /* Update RBG mask for RA type 0 allocation */
- ueRaType0Mask = rgSCHCmnGetRaType0Mask(rbIdx, rbgSize);
- *rbgMask |= ueRaType0Mask;
-
- /* Update RA type 2 mask */
- ueRaType2Mask = rgSCHCmnGetRaType2Mask(rbIdx, &type2MaskIdx);
- raType2Mask[type2MaskIdx] |= ueRaType2Mask;
-
- /* Update the counters */
- numAllocRbs++;
- remNumRbs--;
- if (numAllocRbs == bestNumAvailRbs)
- {
- break;
- }
- }
- } /* End of for (each position in the subset mask) */
- if (numAllocRbs == bestNumAvailRbs)
- {
- break;
- }
- } /* End of for startIdx = 0 to rbgSize */
-
- *allocRbgSubset = bestSubsetIdx;
- } /* End of if (bestNumAvailRbs) */
-
- return (numAllocRbs);
-}
-#endif
-/**
- * @brief Handles RB allocation for Resource allocation type 2
- *
- * @details
- *
- * Function : rgSCHCmnDlRaType2Alloc
- *
- * Invoking Module Processing:
- * - This function is invoked for DL RB allocation for resource allocation
- * type 2
- *
- * Processing Steps:
- * - Determine the available positions in the mask
- * - Allocate best fit cosecutive RBs.
- * - Update RA Type2, RA type 1 and RA type 0 masks.
- *
- * @param[in] RgSchDlSfAllocInfo *allocedInfo
- * @param[in] uint8_t rbsReq
- * @param[in] RgSchBwRbgInfo *rbgInfo
- * @param[out] uint8_t *rbStart
- * @param[out] rgSchDlSfAllocInfo *resAllocInfo
- * @param[in] Bool isPartialAlloc
- *
- * @return uint8_t
- * Number of allocated RBs
- **/
-
-uint8_t rgSCHCmnDlRaType2Alloc
-(
-RgSchDlSfAllocInfo *allocedInfo,
-uint8_t rbsReq,
-RgSchBwRbgInfo *rbgInfo,
-uint8_t *rbStart,
-RgSchDlSfAllocInfo *resAllocInfo,
-Bool isPartialAlloc
-)
-{
- uint8_t numAllocRbs = 0;
- uint8_t rbIdx;
- uint8_t rbgSize = rbgInfo->rbgSize;
- uint32_t *rbgMask = &resAllocInfo->raType0Mask;
-#ifdef RGSCH_SPS_UNUSED
- uint32_t *raType1Mask = resAllocInfo->raType1Mask;
-#endif
- uint32_t *raType2Mask = resAllocInfo->raType2Mask;
-#ifdef RGSCH_SPS_UNUSED
- uint32_t *raType1UsedRbs = resAllocInfo->raType1UsedRbs;
-#endif
- uint32_t *allocedMask = allocedInfo->raType2Mask;
-
- /* Note: This function atttempts only full allocation */
- rgSCHCmnDlGetBestFitHole(allocedMask, rbgInfo->numRbs,
- raType2Mask, rbsReq, rbStart, &numAllocRbs, isPartialAlloc);
- if (numAllocRbs)
- {
- /* Update the allocation in RA type 0 and RA type 1 masks */
- uint8_t rbCnt = numAllocRbs;
-#ifdef RGSCH_SPS_UNUSED
- uint8_t rbgSubset;
- uint32_t ueRaType1Mask;
-#endif
- uint32_t ueRaType0Mask;
- rbIdx = *rbStart;
-
- while(rbCnt)
- {
- /* Update RBG mask for RA type 0 allocation */
- ueRaType0Mask = rgSCHCmnGetRaType0Mask(rbIdx, rbgSize);
- *rbgMask |= ueRaType0Mask;
-
-#ifdef RGSCH_SPS_UNUSED
- /* Update RBG mask for RA type 1 */
- ueRaType1Mask = rgSCHCmnGetRaType1Mask(rbIdx, rbgSize, &rbgSubset);
- raType1Mask[rbgSubset] |= ueRaType1Mask;
- raType1UsedRbs[rbgSubset]++;
-#endif
- /* Update the counters */
- --rbCnt;
- rbIdx++;
- }
- }
-
- return (numAllocRbs);
-}
-
-/**
- * @brief Determines RA type 0 mask from given RB index.
- *
- * @details
- *
- * Function : rgSCHCmnGetRaType0Mask
- *
- *
- * Processing Steps:
- * - Determine RA Type 0 mask for given rbIdex and rbg size.
- *
- * @param[in] uint8_t rbIdx
- * @param[in] uint8_t rbgSize
- * @return uint32_t RA type 0 mask
- **/
-static uint32_t rgSCHCmnGetRaType0Mask(uint8_t rbIdx,uint8_t rbgSize)
-{
- uint8_t rbg;
- uint32_t rbgPosInRbgMask = 0;
-
- rbg = rbIdx/rbgSize;
- rbgPosInRbgMask = 1 << RG_SCH_CMN_DL_GET_POS_FRM_LSB(rbg);
-
- return (rbgPosInRbgMask);
-}
-
-#ifdef RGSCH_SPS_UNUSED
-/**
- * @brief Determines RA type 1 mask from given RB index.
- *
- * @details
- *
- * Function : rgSCHCmnGetRaType1Mask
- *
- *
- * Processing Steps:
- * - Determine RA Type 1 mask for given rbIdex and rbg size.
- *
- * @param[in] uint8_t rbIdx
- * @param[in] uint8_t rbgSize
- * @param[out] uint8_t *type1Subset
- * @return uint32_t RA type 1 mask
- **/
-static uint32_t rgSCHCmnGetRaType1Mask(uint8_t rbIdx,uint8_t rbgSize,uint8_t *type1Subset)
-{
- uint8_t rbg, rbgSubset, rbgInSubset, offset, rbInSubset;
- uint32_t rbPosInSubset;
-
- rbg = rbIdx/rbgSize;
- rbgSubset = rbg % rbgSize;
- rbgInSubset = rbg/rbgSize;
- offset = rbIdx % rbgSize;
- rbInSubset = rbgInSubset * rbgSize + offset;
- rbPosInSubset = 1 << RG_SCH_CMN_DL_GET_POS_FRM_LSB(rbInSubset);
-
- *type1Subset = rbgSubset;
- return (rbPosInSubset);
-}
-#endif /* RGSCH_SPS_UNUSED */
-/**
- * @brief Determines RA type 2 mask from given RB index.
- *
- * @details
- *
- * Function : rgSCHCmnGetRaType2Mask
- *
- *
- * Processing Steps:
- * - Determine RA Type 2 mask for given rbIdx and rbg size.
- *
- * @param[in] uint8_t rbIdx
- * @param[out] uint8_t *maskIdx
- * @return uint32_t RA type 2 mask
- **/
-static uint32_t rgSCHCmnGetRaType2Mask(uint8_t rbIdx,uint8_t *maskIdx)
-{
- uint32_t rbPosInType2;
-
- *maskIdx = rbIdx / 32;
- rbPosInType2 = 1 << RG_SCH_CMN_DL_GET_POS_FRM_LSB(rbIdx % 32);
-
- return (rbPosInType2);
-}
-
-/**
- * @brief Performs resource allocation for a non-SPS UE in SPS bandwidth
- *
- * @details
- *
- * Function : rgSCHCmnAllocUeInSpsBw
- *
- *
- * Processing Steps:
- * - Determine allocation for the UE.
- * - Use resource allocation type 0, 1 and 2 for allocation
- * within maximum SPS bandwidth.
- *
- * @param[in] RgSchDlSf *dlSf
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchDlRbAlloc *rbAllocInfo
- * @param[in] Bool isPartialAlloc
- * @return Bool
- * ROK success
- * RFAILED failed
- **/
-Bool rgSCHCmnAllocUeInSpsBw
-(
-RgSchDlSf *dlSf,
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlRbAlloc *rbAllocInfo,
-Bool isPartialAlloc
-)
-{
- uint8_t rbgSize = cell->rbgSize;
- uint8_t numAllocRbs = 0;
- uint8_t numAllocRbgs = 0;
- uint8_t rbStart = 0;
- uint8_t idx, noLyr, iTbs;
- RgSchCmnDlUe *dlUe = RG_SCH_CMN_GET_DL_UE(ue,cell);
- RgSchDlSfAllocInfo *dlSfAlloc = &rbAllocInfo->dlSf->dlSfAllocInfo;
- RgSchBwRbgInfo *spsRbgInfo = &cell->spsBwRbgInfo;
-
- /* SPS_FIX : Check if this Hq proc is scheduled */
- if ((0 == rbAllocInfo->tbInfo[0].schdlngForTb) &&
- (0 == rbAllocInfo->tbInfo[1].schdlngForTb))
- {
- return (TRUE);
- }
-
- /* Check if the requirement can be accomodated in SPS BW */
- if (dlSf->spsAllocdBw == spsRbgInfo->numRbs)
- {
- /* SPS Bandwidth has been exhausted: no further allocations possible */
- return (FALSE);
- }
- if (!isPartialAlloc)
- {
- if((dlSf->spsAllocdBw + rbAllocInfo->rbsReq) > spsRbgInfo->numRbs)
- {
- return (TRUE);
- }
- }
-
- /* Perform allocation for RA type 0 if rbsReq is multiple of RBG size (also
- * if RBG size = 1) */
- if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE0)
- {
- rbAllocInfo->rbsReq += (rbgSize - rbAllocInfo->rbsReq % rbgSize);
- numAllocRbgs = rgSCHCmnDlRaType0Alloc(dlSfAlloc,
- rbAllocInfo->rbsReq, spsRbgInfo, &numAllocRbs,
- &rbAllocInfo->resAllocInfo, isPartialAlloc);
- }
-#ifdef RGSCH_SPS_UNUSED
- else if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE1)
- {
- /* If no RBS could be allocated, attempt RA TYPE 1 */
-
- numAllocRbs = rgSCHCmnDlRaType1Alloc(dlSfAlloc,
- rbAllocInfo->rbsReq, spsRbgInfo, (uint8_t)dlSfAlloc->nxtRbgSubset,
- &rbAllocInfo->allocInfo.raType1.rbgSubset,
- &rbAllocInfo->resAllocInfo, isPartialAlloc);
-
- if(numAllocRbs)
- {
- dlSfAlloc->nxtRbgSubset =
- (rbAllocInfo->allocInfo.raType1.rbgSubset + 1 ) % rbgSize;
- }
- }
-#endif
- else if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE2)
- {
- numAllocRbs = rgSCHCmnDlRaType2Alloc(dlSfAlloc,
- rbAllocInfo->rbsReq, spsRbgInfo,
- &rbStart, &rbAllocInfo->resAllocInfo, isPartialAlloc);
- }
- if (!numAllocRbs)
- {
- return (TRUE);
- }
-
- if (!(rbAllocInfo->pdcch =
- rgSCHCmnPdcchAlloc(cell, ue, dlSf, dlUe->mimoInfo.cwInfo[0].cqi,\
- rbAllocInfo->dciFormat, FALSE)))
- {
- /* Note: Returning TRUE since PDCCH might be available for another UE */
- return (TRUE);
- }
-
- /* Update Tb info for each scheduled TB */
- iTbs = rbAllocInfo->tbInfo[0].iTbs;
- noLyr = rbAllocInfo->tbInfo[0].noLyr;
- rbAllocInfo->tbInfo[0].bytesAlloc =
- rgTbSzTbl[noLyr - 1][iTbs][numAllocRbs - 1]/8;
-
- if (rbAllocInfo->tbInfo[1].schdlngForTb)
- {
- iTbs = rbAllocInfo->tbInfo[1].iTbs;
- noLyr = rbAllocInfo->tbInfo[1].noLyr;
- rbAllocInfo->tbInfo[1].bytesAlloc =
- rgTbSzTbl[noLyr - 1][iTbs][numAllocRbs - 1]/8;
- }
-
- /* Update rbAllocInfo with the allocation information */
- if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE0)
- {
- rbAllocInfo->allocInfo.raType0.dlAllocBitMask =
- rbAllocInfo->resAllocInfo.raType0Mask;
- rbAllocInfo->allocInfo.raType0.numDlAlloc = numAllocRbgs;
- }
-#ifdef RGSCH_SPS_UNUSED
- else if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE1)
- {
- rbAllocInfo->allocInfo.raType1.dlAllocBitMask =
- rbAllocInfo->resAllocInfo.raType1Mask[rbAllocInfo->allocInfo.raType1.rbgSubset];
- rbAllocInfo->allocInfo.raType1.numDlAlloc = numAllocRbs;
- rbAllocInfo->allocInfo.raType1.shift = 0;
- }
-#endif
- else if (rbAllocInfo->raType == RG_SCH_CMN_RA_TYPE2)
- {
- rbAllocInfo->allocInfo.raType2.isLocal = TRUE;
- rbAllocInfo->allocInfo.raType2.rbStart = rbStart;
- rbAllocInfo->allocInfo.raType2.numRb = numAllocRbs;
- }
-
- rbAllocInfo->rbsAlloc = numAllocRbs;
- rbAllocInfo->tbInfo[0].schdlngForTb = TRUE;
-
- /* Update allocation masks for RA types 0, 1 and 2 in DL SF */
-
- /* Update type 0 allocation mask */
- dlSfAlloc->raType0Mask |= rbAllocInfo->resAllocInfo.raType0Mask;
-#ifdef RGSCH_SPS_UNUSED
- /* Update type 1 allocation masks */
- for (idx = 0; idx < RG_SCH_NUM_RATYPE1_32BIT_MASK; ++idx)
- {
- dlSfAlloc->raType1Mask[idx] |= rbAllocInfo->resAllocInfo.raType1Mask[idx];
- dlSfAlloc->raType1UsedRbs[idx] +=
- rbAllocInfo->resAllocInfo.raType1UsedRbs[idx];
- }
-#endif
- /* Update type 2 allocation masks */
- for (idx = 0; idx < RG_SCH_NUM_RATYPE2_32BIT_MASK; ++idx)
- {
- dlSfAlloc->raType2Mask[idx] |= rbAllocInfo->resAllocInfo.raType2Mask[idx];
- }
-
- dlSf->spsAllocdBw += numAllocRbs;
- return (TRUE);
-}
-
-/***********************************************************
- *
- * Func : rgSCHCmnDlGetBestFitHole
- *
- *
- * Desc : Converts the best fit hole into allocation and returns the
- * allocation information.
- *
- *
- * Ret : Void
- *
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHCmnDlGetBestFitHole
-(
-uint32_t *allocMask,
-uint8_t numMaskRbs,
-uint32_t *crntAllocMask,
-uint8_t rbsReq,
-uint8_t *allocStart,
-uint8_t *allocNumRbs,
-Bool isPartialAlloc
-)
-{
- uint8_t maskSz = (numMaskRbs + 31)/32;
- uint8_t maxMaskPos = (numMaskRbs % 32);
- uint8_t maskIdx, maskPos;
- uint8_t numAvailRbs = 0;
- uint8_t bestAvailNumRbs = 0;
- S8 bestStartPos = -1;
- S8 startPos = -1;
- uint32_t tmpMask[RG_SCH_NUM_RATYPE2_32BIT_MASK] = {0};
- uint32_t bestMask[RG_SCH_NUM_RATYPE2_32BIT_MASK] = {0};
-
- *allocNumRbs = numAvailRbs;
- *allocStart = 0;
-
- for (maskIdx = 0; maskIdx < maskSz; ++maskIdx)
- {
- maxMaskPos = 31;
- if (maskIdx == (maskSz - 1))
- {
- if (numMaskRbs % 32)
- {
- maxMaskPos = numMaskRbs % 32;
- }
- }
- for (maskPos = 0; maskPos < maxMaskPos; ++maskPos)
- {
- if (!(allocMask[maskIdx] & (1 << (31 - maskPos))))
- {
- tmpMask[maskIdx] |= (1 << (31 - maskPos));
- if (startPos == -1)
- {
- startPos = maskIdx * 32 + maskPos;
- }
- ++numAvailRbs;
- if (numAvailRbs == rbsReq)
- {
- *allocStart = (uint8_t)startPos;
- *allocNumRbs = rbsReq;
- break;
- }
- }
- else
- {
- if (numAvailRbs > bestAvailNumRbs)
- {
- bestAvailNumRbs = numAvailRbs;
- bestStartPos = startPos;
- memcpy(bestMask, tmpMask, 4 * sizeof(uint32_t));
- }
- numAvailRbs = 0;
- startPos = -1;
- memset(tmpMask, 0, 4 * sizeof(uint32_t));
- }
- }
- if (*allocNumRbs == rbsReq)
- {
- break;
- }
- }
-
- if (*allocNumRbs == rbsReq)
- {
- /* Convert the hole into allocation */
- memcpy(crntAllocMask, tmpMask, 4 * sizeof(uint32_t));
- return;
- }
- else
- {
- if (bestAvailNumRbs && isPartialAlloc)
- {
- /* Partial allocation could have been done */
- *allocStart = (uint8_t)bestStartPos;
- *allocNumRbs = bestAvailNumRbs;
- /* Convert the hole into allocation */
- memcpy(crntAllocMask, bestMask, 4 * sizeof(uint32_t));
- }
- }
-
- return;
-}
-#endif /* LTEMAC_SPS */
-
-/***************************************************************************
- *
- * NON-DLFS Allocation functions
- *
- * *************************************************************************/
-#ifndef LTE_TDD
-#ifdef DEBUGP
-/**
- * @brief Function to find out code rate
- *
- * @details
- *
- * Function : rgSCHCmnFindCodeRate
- *
- * Processing Steps:
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *dlSf
- * @param[in,out] RgSchDlRbAlloc *allocInfo
- * @return void
- **/
-#ifdef UNUSED_FUNC
-static Void rgSCHCmnFindCodeRate
-(
-RgSchCellCb *cell,
-RgSchDlSf *dlSf,
-RgSchDlRbAlloc *allocInfo,
-uint8_t idx
-)
-{
- return;
-
-}
-#endif
-
-/* Adjust the Imcs and bytes allocated also with respect to the adjusted
- RBs - Here we will find out the Imcs by identifying first Highest
- number of bits compared to the original bytes allocated. */
-/**
- * @brief Adjust IMCS according to tbSize and ITBS
- *
- * @details
- *
- * Function : rgSCHCmnNonDlfsPbchTbImcsAdj
- *
- * Processing Steps:
- * - Adjust Imcs according to tbSize and ITBS.
- *
- * @param[in,out] RgSchDlRbAlloc *allocInfo
- * @param[in] uint8_t *idx
- * @return void
- **/
-static Void rgSCHCmnNonDlfsPbchTbImcsAdj
-(
-RgSchCellCb *cell,
-RgSchDlRbAlloc *allocInfo,
-uint8_t idx,
-uint8_t rbsReq
-)
-{
- uint8_t noLyrs = 0;
- uint8_t tbs = 0;
- uint32_t origBytesReq;
- uint8_t noRbgs = 0;
- uint8_t noRbs = 0;
- RgSchDlSf *dlSf = allocInfo->dlSf;
-
- RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[idx].imcs, tbs);
- noLyrs = allocInfo->tbInfo[idx].noLyr;
-
- if((allocInfo->raType == RG_SCH_CMN_RA_TYPE0))
- {
- noRbgs = RGSCH_CEIL((allocInfo->rbsReq + dlSf->lstRbgDfct), cell->rbgSize);
- noRbs = (noRbgs * cell->rbgSize) - dlSf->lstRbgDfct;
- }
- else
- {
- noRbs = allocInfo->rbsReq;
- }
-
- /* This line will help in case if tbs is zero and reduction in MCS is not possible */
- if (allocInfo->rbsReq == 0 )
- {
- return;
- }
- origBytesReq = rgTbSzTbl[noLyrs - 1][tbs][rbsReq - 1]/8;
-
- /* Find out the ITbs & Imcs by identifying first Highest
- number of bits compared to the original bytes allocated.*/
- if(tbs > 0)
- {
- if(((rgTbSzTbl[noLyrs - 1][0][noRbs - 1])/8) < origBytesReq)
- {
- RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgTbSzTbl[noLyrs - 1], tbs);
- while(((rgTbSzTbl[noLyrs - 1][tbs][noRbs - 1])/8) > origBytesReq)
- {
- tbs--;
- }
- }
- else
- {
- tbs = 0;
- }
- allocInfo->tbInfo[idx].bytesReq = rgTbSzTbl[noLyrs - 1][tbs][noRbs - 1]/8;
- allocInfo->tbInfo[idx].iTbs = tbs;
- RG_SCH_CMN_DL_TBS_TO_MCS(tbs,allocInfo->tbInfo[idx].imcs);
- }
-
- return;
-}
-/* Added funcion to adjust TBSize*/
-/**
- * @brief Function to adjust the tbsize in case of subframe 0 & 5 when
- * we were not able to do RB alloc adjustment by adding extra required Rbs
- *
- * @details
- *
- * Function : rgSCHCmnNonDlfsPbchTbSizeAdj
- *
- * Processing Steps:
- *
- * @param[in,out] RgSchDlRbAlloc *allocInfo
- * @param[in] uint8_t numOvrlapgPbchRb
- * @param[in] uint8_t idx
- * @param[in] uint8_t pbchSsRsSym
- * @return void
- **/
-static Void rgSCHCmnNonDlfsPbchTbSizeAdj
-(
-RgSchDlRbAlloc *allocInfo,
-uint8_t numOvrlapgPbchRb,
-uint8_t pbchSsRsSym,
-uint8_t idx,
-uint32_t bytesReq
-)
-{
- uint32_t reducedTbs = 0;
- uint8_t noLyrs = 0;
- uint8_t tbs = 0;
-
- noLyrs = allocInfo->tbInfo[idx].noLyr;
-
- RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[idx].imcs, tbs);
-
- reducedTbs = bytesReq - (((uint32_t)numOvrlapgPbchRb * (uint32_t)pbchSsRsSym * 6)/8);
-
- /* find out the ITbs & Imcs by identifying first Highest
- number of bits compared with reduced bits considering the bits that are
- reserved for PBCH/PSS/SSS */
- if(((rgTbSzTbl[noLyrs - 1][0][allocInfo->rbsReq - 1])/8) < reducedTbs)
- {
- while(((rgTbSzTbl[noLyrs - 1][tbs][allocInfo->rbsReq - 1])/8) > reducedTbs)
- {
- tbs--;
- }
- }
- else
- {
- tbs = 0;
- }
- allocInfo->tbInfo[idx].bytesReq = rgTbSzTbl[noLyrs - 1][tbs][allocInfo->rbsReq - 1]/8;
- allocInfo->tbInfo[idx].iTbs = tbs;
- RG_SCH_CMN_DL_TBS_TO_MCS(tbs,allocInfo->tbInfo[idx].imcs);
-
- return;
-}
-
-/* Added this function to find num of ovrlapping PBCH rb*/
-/**
- * @brief Function to find out how many additional rbs are available
- * in the entire bw which can be allocated to a UE
- * @details
- *
- * Function : rgSCHCmnFindNumAddtlRbsAvl
- *
- * Processing Steps:
- * - Calculates number of additinal rbs available
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *dlSf
- * @param[in,out] RgSchDlRbAlloc *allocInfo
- * @param[out] uint8_t addtlRbsAvl
- * @return void
- **/
-static uint8_t rgSCHCmnFindNumAddtlRbsAvl(RgSchCellCb *cell,RgSchDlSf *dlSf,RgSchDlRbAlloc *allocInfo)
-{
- uint8_t addtlRbsAvl = 0;
- if (allocInfo->raType == RG_SCH_CMN_RA_TYPE0)
- {
- addtlRbsAvl = (((dlSf->type0End - dlSf->type2End + 1)*\
- cell->rbgSize) - dlSf->lstRbgDfct) - allocInfo->rbsReq;
- }
- else if (allocInfo->raType == RG_SCH_CMN_RA_TYPE2)
- {
- addtlRbsAvl = (dlSf->bw - dlSf->bwAlloced) - allocInfo->rbsReq;
- }
-
- return (addtlRbsAvl);
-
-}
-/* Added this function to find num of ovrlapping PBCH rb*/
-/**
- * @brief Function to find out how many of the requested RBs are
- * falling in the center 6 RBs of the downlink bandwidth.
- * @details
- *
- * Function : rgSCHCmnFindNumPbchOvrlapRbs
- *
- * Processing Steps:
- * - Calculates number of overlapping rbs
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *dlSf
- * @param[in,out] RgSchDlRbAlloc *allocInfo
- * @param[out] uint8_t* numOvrlapgPbchRb
- * @return void
- **/
-static Void rgSCHCmnFindNumPbchOvrlapRbs
-(
-RgSchCellCb *cell,
-RgSchDlSf *dlSf,
-RgSchDlRbAlloc *allocInfo,
-uint8_t *numOvrlapgPbchRb
-)
-{
- *numOvrlapgPbchRb = 0;
- /*Find if we have already crossed the start boundary for PBCH 6 RBs,
- * if yes then lets find the number of RBs which are getting overlapped
- * with this allocation.*/
- if(dlSf->bwAlloced <= (cell->pbchRbStart))
- {
- /*We have not crossed the start boundary of PBCH RBs. Now we need
- * to know that if take this allocation then how much PBCH RBs
- * are overlapping with this allocation.*/
- /* Find out the overlapping RBs in the centre 6 RBs */
- if((dlSf->bwAlloced + allocInfo->rbsReq) > cell->pbchRbStart)
- {
- *numOvrlapgPbchRb = (dlSf->bwAlloced + allocInfo->rbsReq) - (cell->pbchRbStart);
- if(*numOvrlapgPbchRb > 6)
- *numOvrlapgPbchRb = 6;
- }
- }
- else if ((dlSf->bwAlloced > (cell->pbchRbStart)) &&
- (dlSf->bwAlloced < (cell->pbchRbEnd)))
- {
- /*We have already crossed the start boundary of PBCH RBs.We need to
- * find that if we take this allocation then how much of the RBs for
- * this allocation will overlap with PBCH RBs.*/
- /* Find out the overlapping RBs in the centre 6 RBs */
- if(dlSf->bwAlloced + allocInfo->rbsReq < (cell->pbchRbEnd))
- {
- /*If we take this allocation then also we are not crossing the
- * end boundary of PBCH 6 RBs.*/
- *numOvrlapgPbchRb = allocInfo->rbsReq;
- }
- else
- {
- /*If we take this allocation then we are crossing the
- * end boundary of PBCH 6 RBs.*/
- *numOvrlapgPbchRb = (cell->pbchRbEnd) - dlSf->bwAlloced;
- }
- }
- return;
-
-}
-/**
- * @brief Performs RB allocation adjustment if the requested RBs are
- * falling in the center 6 RBs of the downlink bandwidth.
- * @details
- *
- * Function : rgSCHCmnNonDlfsPbchRbAllocAdj
- *
- * Processing Steps:
- * - Allocate consecutively available RBs.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in,out] RgSchDlRbAlloc *allocInfo
- * @param[in] uint8_t pbchSsRsSym
- * @return void
- **/
-static Void rgSCHCmnNonDlfsPbchRbAllocAdj
-(
-RgSchCellCb *cell,
-RgSchDlRbAlloc *allocInfo,
-uint8_t pbchSsRsSym,
-Bool isBcchPcch
-)
-{
- RgSchDlSf *dlSf = allocInfo->dlSf;
- uint8_t numOvrlapgPbchRb = 0;
- uint8_t numOvrlapgAdtlPbchRb = 0;
- uint8_t totSym;
- uint8_t addtlRbsReq = 0;
- uint8_t moreAddtlRbsReq = 0;
- uint8_t addtlRbsAdd = 0;
- uint8_t moreAddtlRbsAdd = 0;
- uint8_t tbs;
- uint8_t origRbsReq = 0;
- uint32_t bytesReq;
- uint8_t noLyr;
- uint8_t divResult;
-
-
-
-
- origRbsReq = allocInfo->rbsReq;
- rgSCHCmnFindNumPbchOvrlapRbs(cell,dlSf,allocInfo,&numOvrlapgPbchRb);
-
- totSym = (cell->isCpDlExtend) ? RGSCH_TOT_NUM_SYM_EXTCP : RGSCH_TOT_NUM_SYM_NORCP;
-
- /* Additional RBs are allocated by considering the loss due to
- the reserved symbols for CFICH, PBCH, PSS, SSS and cell specific RS */
-
- divResult = (numOvrlapgPbchRb * pbchSsRsSym)/totSym;
- if((numOvrlapgPbchRb * pbchSsRsSym) % totSym)
- {
- divResult++;
- }
- addtlRbsReq = divResult;
-
- RG_SCH_CMN_UPD_RBS_TO_ADD(cell, dlSf, allocInfo, addtlRbsReq, addtlRbsAdd)
-
- /*Now RBs requires is original requested RBs + these additional RBs to make
- * up for PSS/SSS/BCCH.*/
- allocInfo->rbsReq = allocInfo->rbsReq + addtlRbsAdd;
-
- /*Check if with these additional RBs we have taken up, these are also falling
- * under PBCH RBs range, if yes then we would need to account for
- * PSS/BSS/BCCH for these additional RBs too.*/
- if(addtlRbsAdd && ((dlSf->bwAlloced + allocInfo->rbsReq - addtlRbsAdd) < (cell->pbchRbEnd)))
- {
- if((dlSf->bwAlloced + allocInfo->rbsReq) <= (cell->pbchRbEnd))
- {
- /*With additional RBs taken into account, we are not crossing the
- * PBCH RB end boundary.Thus here we need to account just for
- * overlapping PBCH RBs for these additonal RBs.*/
- divResult = (addtlRbsAdd * pbchSsRsSym)/totSym;
- if((addtlRbsAdd * pbchSsRsSym) % totSym)
- {
- divResult++;
- }
-
- moreAddtlRbsReq = divResult;
-
- RG_SCH_CMN_UPD_RBS_TO_ADD(cell, dlSf, allocInfo, moreAddtlRbsReq, moreAddtlRbsAdd)
-
- allocInfo->rbsReq = allocInfo->rbsReq + moreAddtlRbsAdd;
- }
- else
- {
-
- /*Here we have crossed the PBCH RB end boundary, thus we need to take
- * into account the overlapping RBs for additional RBs which will be
- * subset of addtlRbs.*/
- numOvrlapgAdtlPbchRb = (cell->pbchRbEnd) - ((dlSf->bwAlloced + allocInfo->rbsReq) - addtlRbsAdd);
-
- divResult = (numOvrlapgAdtlPbchRb * pbchSsRsSym)/totSym;
- if((numOvrlapgAdtlPbchRb * pbchSsRsSym) % totSym)
- {
- divResult++;
- }
-
- moreAddtlRbsReq = divResult;
-
- RG_SCH_CMN_UPD_RBS_TO_ADD(cell, dlSf, allocInfo, moreAddtlRbsReq, moreAddtlRbsAdd)
-
- allocInfo->rbsReq = allocInfo->rbsReq + moreAddtlRbsAdd;
- }
- }
- if (isBcchPcch == TRUE)
- {
- return;
- }
-
- RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[0].imcs, tbs);
- if(tbs == 6)
- {
- /* This case might be for Imcs value 6 and NPrb = 1 case - Not
- Adjusting either RBs or Imcs or Bytes Allocated */
- allocInfo->rbsReq = allocInfo->rbsReq - addtlRbsAdd - moreAddtlRbsAdd;
- }
- else if(tbs && ((0 == addtlRbsAdd) && (moreAddtlRbsAdd == 0)))
- {
- /*In case of a situation where we the entire bandwidth is already occupied
- * and we dont have room to add additional Rbs then in order to decrease the
- * code rate we reduce the tbsize such that we reduce the present calculated
- * tbsize by number of bytes that would be occupied by PBCH/PSS/SSS in overlapping
- * rbs and find the nearest tbsize which would be less than this deduced value*/
-
- rgSCHCmnFindNumPbchOvrlapRbs(cell,dlSf,allocInfo,&numOvrlapgPbchRb);
-
- noLyr = allocInfo->tbInfo[0].noLyr;
- RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgTbSzTbl[noLyr - 1], tbs);
- bytesReq = rgTbSzTbl[noLyr - 1][tbs][allocInfo->rbsReq - 1]/8;
-
- rgSCHCmnNonDlfsPbchTbSizeAdj(allocInfo,numOvrlapgPbchRb,pbchSsRsSym,0,bytesReq);
-
- if(allocInfo->tbInfo[1].schdlngForTb == TRUE)
- {
- noLyr = allocInfo->tbInfo[1].noLyr;
- bytesReq = rgTbSzTbl[noLyr - 1][tbs][allocInfo->rbsReq - 1]/8;
- rgSCHCmnNonDlfsPbchTbSizeAdj(allocInfo,numOvrlapgPbchRb,pbchSsRsSym,1,bytesReq);
- }
-
- }
- else if(tbs && ((addtlRbsAdd != addtlRbsReq) ||
- (addtlRbsAdd && (moreAddtlRbsReq != moreAddtlRbsAdd))))
- {
- /*In case of a situation where we were not able to add required number of
- * additional RBs then we adjust the Imcs based on original RBs requested.
- * Doing this would comensate for the few extra Rbs we have added but inorder
- * to comensate for number of RBS we couldnt add we again do the TBSize adjustment*/
-
- rgSCHCmnNonDlfsPbchTbImcsAdj(cell, allocInfo, 0 , origRbsReq);
-
- if(allocInfo->tbInfo[1].schdlngForTb == TRUE)
- {
- rgSCHCmnNonDlfsPbchTbImcsAdj(cell, allocInfo, 1 , origRbsReq);
- }
-
- rgSCHCmnFindNumPbchOvrlapRbs(cell,dlSf,allocInfo,&numOvrlapgPbchRb);
- numOvrlapgPbchRb = numOvrlapgPbchRb - (addtlRbsAdd + moreAddtlRbsAdd);
-
- rgSCHCmnNonDlfsPbchTbSizeAdj(allocInfo,numOvrlapgPbchRb,pbchSsRsSym,0,allocInfo->tbInfo[0].bytesReq);
-
- if(allocInfo->tbInfo[1].schdlngForTb == TRUE)
- {
- rgSCHCmnNonDlfsPbchTbSizeAdj(allocInfo,numOvrlapgPbchRb,pbchSsRsSym,1,allocInfo->tbInfo[1].bytesReq);
- }
-
- }
- else
- {
- /*We hit this code when we were able to add the required additional RBS
- * hence we should adjust the IMcs based on orignals RBs requested*/
-
- rgSCHCmnNonDlfsPbchTbImcsAdj(cell, allocInfo, 0 , origRbsReq);
-
- if(allocInfo->tbInfo[1].schdlngForTb == TRUE)
- {
- rgSCHCmnNonDlfsPbchTbImcsAdj(cell, allocInfo, 1 , origRbsReq);
- }
- }
-
- return;
-} /* end of rgSCHCmnNonDlfsPbchRbAllocAdj */
-#endif
-#endif
-/**
- * @brief Performs RB allocation for frequency non-selective cell.
- *
- * @details
- *
- * Function : rgSCHCmnNonDlfsCmnRbAlloc
- *
- * Processing Steps:
- * - Allocate consecutively available RBs for BCCH/PCCH/RAR.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in, out] RgSchDlRbAlloc *allocInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHCmnNonDlfsCmnRbAlloc(RgSchCellCb *cell,RgSchDlRbAlloc *allocInfo)
-{
-#ifndef LTE_TDD
-#ifdef LTEMAC_SPS
-#endif
- uint8_t pbchSsRsSym = 0;
- uint8_t pbchFrame = 0;
- uint8_t tbs = 0;
- RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
-#endif
- RgSchDlSf *dlSf = allocInfo->dlSf;
-#ifdef LTEMAC_SPS
- uint8_t rbStart = 0;
- uint8_t spsRbsAlloc = 0;
- RgSchDlSfAllocInfo *dlSfAlloc = &allocInfo->dlSf->dlSfAllocInfo;
-#endif
-
- allocInfo->tbInfo[0].noLyr = 1;
-
-#ifdef LTEMAC_SPS
- /* Note: Initialize the masks to 0, this might not be needed since alloInfo
- * is initialized to 0 at the beginning of allcoation */
- allocInfo->resAllocInfo.raType0Mask = 0;
- memset(allocInfo->resAllocInfo.raType1Mask, 0,
- RG_SCH_NUM_RATYPE1_32BIT_MASK * sizeof (uint32_t));
- memset(allocInfo->resAllocInfo.raType2Mask, 0,
- RG_SCH_NUM_RATYPE2_32BIT_MASK * sizeof (uint32_t));
-
- if ((dlSf->spsAllocdBw >= cell->spsBwRbgInfo.numRbs) &&
- (dlSf->bwAlloced == dlSf->bw))
-#else
- if(dlSf->bwAlloced == dlSf->bw)
-#endif
- {
- return RFAILED;
- }
-#ifndef LTE_TDD
- if (allocInfo->rbsReq > (dlSf->bw - dlSf->bwAlloced))
- {
-#ifdef LTEMAC_SPS
- if ((allocInfo->tbInfo[0].imcs < 29) && (dlSf->bwAlloced < dlSf->bw))
-#else
- if(allocInfo->tbInfo[0].imcs < 29)
-#endif
- {
- /* set the remaining RBs for the requested UE */
- allocInfo->rbsReq = dlSf->bw - dlSf->bwAlloced;
- RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[0].imcs, tbs);
- allocInfo->tbInfo[0].bytesReq = rgTbSzTbl[0][tbs][allocInfo->rbsReq - 1]/8;
- }
- else
- {
-#ifdef LTEMAC_SPS
- /* Attempt RA Type 2 allocation in SPS Bandwidth */
- if (dlSf->spsAllocdBw < cell->spsBwRbgInfo.numRbs)
- {
- spsRbsAlloc =
- rgSCHCmnDlRaType2Alloc(dlSfAlloc,
- allocInfo->rbsReq, &cell->spsBwRbgInfo, &rbStart,
- &allocInfo->resAllocInfo, FALSE);
- /* rbsAlloc assignment moved from line 16671 to here to avoid
- * compilation error. Recheck */
- dlSf->spsAllocdBw += spsRbsAlloc;
- }
- if (!spsRbsAlloc)
-#endif /* LTEMAC_SPS */
- {
- return RFAILED;
- }
- }
- }
-#endif
-
- /* Update allocation information */
- allocInfo->pdcch = rgSCHCmnCmnPdcchAlloc(cell, dlSf);
- if (allocInfo->pdcch == NULLP)
- {
- return RFAILED;
- }
- allocInfo->dciFormat = TFU_DCI_FORMAT_1A;
- allocInfo->pdcch->dciNumOfBits = cell->dciSize.size[TFU_DCI_FORMAT_1A];
- allocInfo->raType = RG_SCH_CMN_RA_TYPE2;
- allocInfo->allocInfo.raType2.isLocal = TRUE;
-#ifdef LTEMAC_SPS
- if (spsRbsAlloc)
- {
- allocInfo->allocInfo.raType2.rbStart = rbStart;
- allocInfo->allocInfo.raType2.numRb = allocInfo->rbsReq;
- allocInfo->rbsAlloc = allocInfo->rbsReq;
- }
-#endif
-
-#ifdef LTEMAC_SPS
- if (!spsRbsAlloc)
- {
-#endif
-#ifndef LTE_TDD
- if(dlSf->sfNum)
- {
- if(!(dlSf->sfNum == 5))
- {
- /* case for subframes 1 to 9 except 5 */
-#ifdef LTEMAC_SPS
- allocInfo->allocInfo.raType2.rbStart = rbStart;
-#else
- /*Fix for ccpu00123918*/
- allocInfo->allocInfo.raType2.rbStart = (uint8_t)dlSf->type2Start;
-#endif
- }
- else
- {
- pbchFrame = 1; /* case for subframe 5 */
- /* In subframe 5, symbols are reserved for PSS and SSS and CFICH
- and Cell Specific Reference Signals */
- pbchSsRsSym = (((cellDl->currCfi) + RGSCH_NUM_PSS_SSS_SYM) *
- RGSCH_NUM_SC_IN_RB + cell->numCellRSPerSf);
- }
- }
- else
- {
- pbchFrame = 1;
- /* In subframe 0, symbols are reserved for PSS, SSS, PBCH, CFICH and
- and Cell Specific Reference signals */
- pbchSsRsSym = (((cellDl->currCfi) + RGSCH_NUM_PBCH_SYM +
- RGSCH_NUM_PSS_SSS_SYM) * RGSCH_NUM_SC_IN_RB +
- cell->numCellRSPerSf);
- } /* end of outer else */
-
- if((pbchFrame) &&
- (((dlSf->bwAlloced + allocInfo->rbsReq) - cell->pbchRbStart) > 0)&&
- (dlSf->bwAlloced < cell->pbchRbEnd))
- {
- if(allocInfo->tbInfo[0].imcs < 29)
- {
- rgSCHCmnNonDlfsPbchRbAllocAdj(cell, allocInfo, pbchSsRsSym, TRUE);
- }
- }
-#endif
-#ifdef LTEMAC_SPS
- }
-#endif
-
-#ifdef LTEMAC_SPS
- if (!spsRbsAlloc)
- {
-#endif
- /*Fix for ccpu00123918*/
- allocInfo->allocInfo.raType2.rbStart = (uint8_t)dlSf->type2Start;
- allocInfo->allocInfo.raType2.numRb = allocInfo->rbsReq;
- allocInfo->rbsAlloc = allocInfo->rbsReq;
-
- /* LTE_ADV_FLAG_REMOVED_START */
-#ifndef LTE_TDD
- if (cell->lteAdvCb.sfrCfg.status == RGR_ENABLE)
- {
- rgSCHCmnNonDlfsSFRCmnChannelUpdTyp2Alloc(cell, dlSf, \
- allocInfo->allocInfo.raType2.rbStart, \
- allocInfo->allocInfo.raType2.numRb);
- }
- else
-#endif
- {
- rgSCHCmnNonDlfsUpdTyp2Alloc(cell, dlSf, \
- allocInfo->allocInfo.raType2.rbStart, \
- allocInfo->allocInfo.raType2.numRb);
- }
-
-#ifdef LTEMAC_SPS
- }
-#endif
- /* LTE_ADV_FLAG_REMOVED_END */
- allocInfo->tbInfo[0].bytesAlloc = allocInfo->tbInfo[0].bytesReq;
-
-
-#ifdef LTEMAC_SPS
- if (spsRbsAlloc)
- {
- uint8_t idx;
- /* Update type 0, 1 and 2 masks */
- dlSfAlloc->raType0Mask |= allocInfo->resAllocInfo.raType0Mask;
-#ifdef RGSCH_SPS_UNUSED
- for (idx = 0; idx < RG_SCH_NUM_RATYPE1_32BIT_MASK; ++idx)
- {
- dlSfAlloc->raType1Mask[idx] |=
- allocInfo->resAllocInfo.raType1Mask[idx];
- dlSfAlloc->raType1UsedRbs[idx] +=
- allocInfo->resAllocInfo.raType1UsedRbs[idx];
- }
-#endif
- for (idx = 0; idx < RG_SCH_NUM_RATYPE2_32BIT_MASK; ++idx)
- {
- dlSfAlloc->raType2Mask[idx] |=
- allocInfo->resAllocInfo.raType2Mask[idx];
- }
- }
-#endif
-
- return ROK;
-}
-
-
-/**
- * @brief Performs RB allocation for frequency non-selective cell.
- *
- * @details
- *
- * Function : rgSCHCmnNonDlfsCmnRbAllocRar
- *
- * Processing Steps:
- * - Allocate consecutively available RBs for BCCH/PCCH/RAR.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in, out] RgSchDlRbAlloc *allocInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHCmnNonDlfsCmnRbAllocRar(RgSchCellCb *cell,RgSchDlRbAlloc *allocInfo)
-{
- RgSchDlSf *dlSf = allocInfo->dlSf;
-
- if(dlSf->bwAlloced == dlSf->bw)
- {
- return RFAILED;
- }
-
- allocInfo->tbInfo[0].noLyr = 1;
-#ifndef RG_5GTF
- /* Update allocation information */
- allocInfo->pdcch = rgSCHCmnCmnPdcchAlloc(cell, dlSf);
- if (allocInfo->pdcch == NULLP)
- {
- return RFAILED;
- }
- allocInfo->dciFormat = TFU_DCI_FORMAT_1A;
- allocInfo->pdcch->dciNumOfBits = cell->dciSize.size[TFU_DCI_FORMAT_1A];
- allocInfo->raType = RG_SCH_CMN_RA_TYPE2;
- allocInfo->allocInfo.raType2.isLocal = TRUE;
-
- /*Fix for ccpu00123918*/
- allocInfo->allocInfo.raType2.rbStart = (uint8_t)dlSf->type2Start;
- allocInfo->allocInfo.raType2.numRb = allocInfo->rbsReq;
- allocInfo->rbsAlloc = allocInfo->rbsReq;
-
- /* LTE_ADV_FLAG_REMOVED_END */
- allocInfo->tbInfo[0].bytesAlloc = allocInfo->tbInfo[0].bytesReq;
-
-#else
- allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, NULLP, dlSf, 13, TFU_DCI_FORMAT_B1, FALSE);
- if (allocInfo->pdcch == NULLP)
- {
- return RFAILED;
- }
- RgSchSfBeamInfo *beamInfo = &(dlSf->sfBeamInfo[0]);
- if(beamInfo->totVrbgAllocated > MAX_5GTF_VRBG)
- {
- DU_LOG("\nINFO --> SCH : 5GTF_ERROR vrbg allocated > 25\n");
- return RFAILED;
- }
-
- allocInfo->tbInfo[0].cmnGrnt.vrbgStart = beamInfo->vrbgStart;
- allocInfo->tbInfo[0].cmnGrnt.numVrbg = allocInfo->vrbgReq;
-
- /* Update allocation information */
- allocInfo->dciFormat = TFU_DCI_FORMAT_B1;
-
- allocInfo->tbInfo[0].cmnGrnt.xPDSCHRange = 1;
- allocInfo->tbInfo[0].cmnGrnt.rbAssign = rgSCHCmnCalcRiv(MAX_5GTF_VRBG,
- allocInfo->tbInfo[0].cmnGrnt.vrbgStart, allocInfo->tbInfo[0].cmnGrnt.numVrbg);
-
- allocInfo->tbInfo[0].cmnGrnt.rbStrt = (allocInfo->tbInfo[0].cmnGrnt.vrbgStart * MAX_5GTF_VRBG_SIZE);
- allocInfo->tbInfo[0].cmnGrnt.numRb = (allocInfo->tbInfo[0].cmnGrnt.numVrbg * MAX_5GTF_VRBG_SIZE);
-
- beamInfo->vrbgStart += allocInfo->tbInfo[0].cmnGrnt.numVrbg;
- beamInfo->totVrbgAllocated += allocInfo->tbInfo[0].cmnGrnt.numVrbg;
- allocInfo->tbInfo[0].cmnGrnt.rv = 0;
- allocInfo->tbInfo[0].bytesAlloc = allocInfo->tbInfo[0].bytesReq;
-
-#endif
- DU_LOG("\nINFO --> SCH : [%s],allocInfo->tbInfo[0].bytesAlloc:%u,vrbgReq:%u\n",
- __func__,allocInfo->tbInfo[0].bytesAlloc,allocInfo->vrbgReq);
-
- return ROK;
-}
-
-
-/* LTE_ADV_FLAG_REMOVED_START */
-#ifndef LTE_TDD
-/**
- * @brief To check if DL BW available for non-DLFS allocation.
- *
- * @details
- *
- * Function : rgSCHCmnNonDlfsBwAvlbl
- *
- * Processing Steps:
- * - Determine availability based on RA Type.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *dlSf
- * @param[in] RgSchDlRbAlloc *allocInfo
- *
- * @return Bool
- * -# TRUE
- * -# FALSE
- **/
-#ifdef UNUSED_FUNC
-static Bool rgSCHCmnNonDlfsSFRBwAvlbl
-(
-RgSchCellCb *cell,
-RgSchSFRPoolInfo **sfrpoolInfo,
-RgSchDlSf *dlSf,
-RgSchDlRbAlloc *allocInfo,
-Bool isUeCellEdge
-)
-{
- CmLListCp *l;
- CmLListCp *l1;
- CmLList *n;
- CmLList *n1;
- RgSchSFRPoolInfo *sfrPool;
- RgSchSFRPoolInfo *sfrCEPool;
-
- uint8_t tbs;
- uint8_t noLyrs;
- RgSchSFRPoolInfo *poolWithMaxAvlblBw = NULLP;
- uint32_t bwAvlbl = 0;
- uint32_t addtnlPRBs = 0;
-
- if (dlSf->bw <= dlSf->bwAlloced)
- {
- DU_LOG("\nERROR --> SCH : BW is fully allocated for subframe (%d) CRNTI:%d", dlSf->sfNum,allocInfo->rnti);
- return FALSE;
- }
-
- if (dlSf->sfrTotalPoolInfo.ccBwFull == TRUE)
- {
- DU_LOG("\nERROR --> SCH : BW is fully allocated for CC Pool CRNTI:%d",allocInfo->rnti);
- return FALSE;
- }
-
- if ((dlSf->sfrTotalPoolInfo.ceBwFull == TRUE) && (isUeCellEdge))
- {
- DU_LOG("\nERROR --> SCH : BW is fully allocated for CE Pool CRNTI:%d",allocInfo->rnti);
- return FALSE;
- }
-
- /* We first check if the ue scheduled is a cell edge or cell centre and accordingly check the avaialble
- memory in their pool. If the cell centre UE doesnt have Bw available in its pool, then it will check
- Bw availability in cell edge pool but the other way around is NOT possible. */
- if(isUeCellEdge)
- {
- l = &dlSf->sfrTotalPoolInfo.cePool;
- }
- else
- {
- l = &dlSf->sfrTotalPoolInfo.ccPool;
- }
-
- n = cmLListFirst(l);
-
- while(n)
- {
- if (allocInfo->raType == RG_SCH_CMN_RA_TYPE0)
- {
- sfrPool = (RgSchSFRPoolInfo*)(n->node);
-
- /* MS_FIX for ccpu00123919 : Number of RBs in case of RETX should be same as that of initial transmission. */
- if(allocInfo->tbInfo[0].tbCb->txCntr)
- {
- /* If RB assignment is being done for RETX. Then if reqRbs are a multiple of rbgSize then ignore lstRbgDfct. If reqRbs is
- * not a multiple of rbgSize then check if lsgRbgDfct exists */
- if (allocInfo->rbsReq % cell->rbgSize == 0)
- {
- if ((sfrPool->type2End == dlSf->type2End) && dlSf->lstRbgDfct)
- {
- /* In this scenario we are wasting the last RBG for this dlSf */
- sfrPool->type0End--;
- sfrPool->bwAlloced += (cell->rbgSize - dlSf->lstRbgDfct);
-
- dlSf->lstRbgDfct = 0;
-
- /*ABHINAV To check if these variables need to be taken care of*/
- dlSf->type0End--;
- dlSf->bwAlloced += (cell->rbgSize - dlSf->lstRbgDfct);
- }
- }
- else
- {
- if (dlSf->lstRbgDfct)
- {
- /* Check if type0 allocation can cater to this RETX requirement */
- if ((allocInfo->rbsReq % cell->rbgSize) != (cell->rbgSize - dlSf->lstRbgDfct))
- {
- return (FALSE);
- }
- else
- {
- if (sfrPool->type2End != dlSf->type2End) /*Search again for some pool which has the END RBG of the BandWidth*/
- {
- continue;
- }
- }
- }
- else
- {
- /* cannot allocate same number of required RBs */
- return (FALSE);
- }
- }
- }
-
- /*rg002.301 ccpu00120391 MOD condition is modified approprialtely to find if rbsReq is less than available RBS*/
- if(allocInfo->rbsReq <= (((sfrPool->type0End - sfrPool->type2End + 1)*\
- cell->rbgSize) - dlSf->lstRbgDfct))
- {
- *sfrpoolInfo = sfrPool;
- return (TRUE);
- }
- else
- {
- if (sfrPool->bw <= sfrPool->bwAlloced + cell->rbgSize)
- {
- n = cmLListNext(l);
- /* If the ue is cell centre then it will simply check the memory available in next pool.
- But if there are no more memory pools available, then cell centre Ue will try to look for memory in cell edge pool */
-
- if((!isUeCellEdge) && (!n->node))
- {
- l = &dlSf->sfrTotalPoolInfo.cePool;
- n = cmLListFirst(l);
- }
-
- continue;
- }
-
- /* MS_FIX: Number of RBs in case of RETX should be same as that of initial transmission */
- if(allocInfo->tbInfo[0].tbCb->txCntr == 0)
- {
- /*rg002.301 ccpu00120391 MOD setting the remaining RBs for the requested UE*/
- allocInfo->rbsReq = (((sfrPool->type0End - sfrPool->type2End + 1)*\
- cell->rbgSize) - dlSf->lstRbgDfct);
- RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[0].imcs, tbs);
- noLyrs = allocInfo->tbInfo[0].noLyr;
- allocInfo->tbInfo[0].bytesReq = rgTbSzTbl[noLyrs-1][tbs][allocInfo->rbsReq - 1]/8;
- *sfrpoolInfo = sfrPool;
- return (TRUE);
- }
- else
- {
- n = cmLListNext(l);
-
- /* If the ue is cell centre then it will simply check the memory available in next pool.
- But if there are no more memory pools available, then cell centre Ue will try to look for memory in cell edge pool */
- if((!isUeCellEdge) && (!n->node))
- {
- l = &dlSf->sfrTotalPoolInfo.cePool;
- n = cmLListFirst(l);
- }
-
- continue;
- }
-
- // return (FALSE);
- }
- }
- else if (allocInfo->raType == RG_SCH_CMN_RA_TYPE2)
- {
- sfrPool = (RgSchSFRPoolInfo*)(n->node);
- /* This is a Case where a UE was CC and had more RBs allocated than present in CE pool.
- In case this UE whn become CE with retx going on, then BW is not sufficient for Retx */
- if ((isUeCellEdge) &&
- (allocInfo->tbInfo[0].tbCb->txCntr != 0))
- {
- if(allocInfo->rbsReq > (sfrPool->bw - sfrPool->bwAlloced))
- {
- /* Adjust CE BW such that Retx alloc is successful */
- /* Check if merging CE with adjacent CC pool will be sufficient to process Retx */
-
- /* If no Type 0 allocations are made from this pool */
- if (sfrPool->type0End == (((sfrPool->poolendRB + 1) / cell->rbgSize) - 1))
- {
- if (sfrPool->adjCCPool &&
- (sfrPool->adjCCPool->type2Start == sfrPool->poolendRB + 1) &&
- (allocInfo->rbsReq <= ((sfrPool->bw - sfrPool->bwAlloced) +
- ((sfrPool->adjCCPool->bw - sfrPool->adjCCPool->bwAlloced)))))
- {
- addtnlPRBs = allocInfo->rbsReq - (sfrPool->bw - sfrPool->bwAlloced);
-
- /* Adjusting CE Pool Info */
- sfrPool->bw += addtnlPRBs;
- sfrPool->type0End = ((sfrPool->poolendRB + addtnlPRBs + 1) /
- cell->rbgSize) - 1;
-
- /* Adjusting CC Pool Info */
- sfrPool->adjCCPool->type2Start += addtnlPRBs;
- sfrPool->adjCCPool->type2End = RGSCH_CEIL(sfrPool->adjCCPool->type2Start,
- cell->rbgSize);
- sfrPool->adjCCPool->bw -= addtnlPRBs;
- *sfrpoolInfo = sfrPool;
- return (TRUE);
- }
- }
- }
- }
-
- /* Check if CC pool is one of the following:
- * 1. |CE| + |CC "CCPool2Exists" = TRUE|
- * 2. |CC "CCPool2Exists" = FALSE| + |CE| + |CC "CCPool2Exists" = TRUE|
- */
- if(TRUE == sfrPool->CCPool2Exists)
- {
- l1 = &dlSf->sfrTotalPoolInfo.cePool;
- n1 = cmLListFirst(l1);
- sfrCEPool = (RgSchSFRPoolInfo*)(n1->node);
- if(allocInfo->rbsReq <= (sfrCEPool->bw - sfrCEPool->bwAlloced))
- {
- *sfrpoolInfo = sfrCEPool;
- return (TRUE);
- }
- else if(allocInfo->rbsReq <= (sfrPool->bw - sfrPool->bwAlloced))
- {
- *sfrpoolInfo = sfrPool;
- return (TRUE);
- }
- /* Check if CE and CC boundary has unallocated prbs */
- else if ((sfrPool->poolstartRB == sfrPool->type2Start) &&
- (sfrCEPool->type0End == ((sfrCEPool->poolendRB + 1) / cell->rbgSize) - 1))
- {
- if(allocInfo->rbsReq <= (sfrCEPool->bw - sfrCEPool->bwAlloced) +
- (sfrPool->bw - sfrPool->bwAlloced))
- {
- /* Checking if BW can be allocated partly from CE pool and partly
- * from CC pool
- */
- addtnlPRBs = allocInfo->rbsReq - (sfrPool->bw - sfrPool->bwAlloced);
- /* Updating CE and CC type2 parametrs based on the RBs allocated
- * from these pools*/
- sfrPool->type2Start -= addtnlPRBs;
- sfrPool->type2End = RGSCH_CEIL(sfrPool->type2Start, cell->rbgSize);
- sfrPool->bw += addtnlPRBs;
- if (addtnlPRBs == (sfrCEPool->bw - sfrCEPool->bwAlloced))
- {
- sfrCEPool->bwAlloced = sfrCEPool->bw;
- dlSf->sfrTotalPoolInfo.ceBwFull = TRUE;
- }
- else
- {
- sfrCEPool->bw -= addtnlPRBs;
- sfrCEPool->type0End = ((sfrCEPool->poolendRB + 1 - addtnlPRBs) / cell->rbgSize) - 1;
- }
- *sfrpoolInfo = sfrPool;
- return (TRUE);
- }
- else if ( bwAvlbl <
- ((sfrCEPool->bw - sfrCEPool->bwAlloced) +
- (sfrPool->bw - sfrPool->bwAlloced)))
- {
- /* All the Prbs from CE BW shall be allocated */
- if(allocInfo->tbInfo[0].tbCb->txCntr == 0)
- {
- sfrPool->type2Start = sfrCEPool->type2Start;
- sfrPool->bw += sfrCEPool->bw - sfrCEPool->bwAlloced;
- sfrCEPool->type2Start = sfrCEPool->poolendRB + 1;
- sfrCEPool->bwAlloced = sfrCEPool->bw;
- dlSf->sfrTotalPoolInfo.ceBwFull = TRUE;
-
- /* set the remaining RBs for the requested UE */
- allocInfo->rbsReq = (sfrPool->bw - sfrPool->bwAlloced);
- RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[0].imcs, tbs);
- noLyrs = allocInfo->tbInfo[0].noLyr;
- allocInfo->tbInfo[0].bytesReq =
- rgTbSzTbl[noLyrs-1][tbs][allocInfo->rbsReq - 1]/8;
- *sfrpoolInfo = sfrPool;
- return (TRUE);
- }
- else
- {
- return (FALSE);
- }
- }
- }
- }
-
- /* Checking if no. of RBs required can be allocated from
- * SFR pool.
- * 1. If available return the SFR pool.
- * 2. Else update the RBs required parameter based on the
- * BW available in the pool
- * 3. Return FALSE if no B/W is available.
- */
- if (allocInfo->rbsReq <= (sfrPool->bw - sfrPool->bwAlloced))
- {
- *sfrpoolInfo = sfrPool;
- return (TRUE);
- }
- else
- {
- if(allocInfo->tbInfo[0].tbCb->txCntr == 0)
- {
- if (bwAvlbl < sfrPool->bw - sfrPool->bwAlloced)
- {
- if (isUeCellEdge)
- {
- dlSf->sfrTotalPoolInfo.ceBwFull = TRUE;
- }
- bwAvlbl = sfrPool->bw - sfrPool->bwAlloced;
- poolWithMaxAvlblBw = sfrPool;
- }
- n = cmLListNext(l);
-
- if ((isUeCellEdge == FALSE) && (n == NULLP))
- {
- if(l != &dlSf->sfrTotalPoolInfo.cePool)
- {
- l = &dlSf->sfrTotalPoolInfo.cePool;
- n = cmLListFirst(l);
- }
- }
-
- if (n == NULLP)
- {
- if (bwAvlbl == 0)
- {
- if (isUeCellEdge)
- {
- dlSf->sfrTotalPoolInfo.ceBwFull = TRUE;
- }
- else
- {
- dlSf->sfrTotalPoolInfo.ccBwFull = TRUE;
- }
- return (FALSE);
- }
- else
- {
- /* set the remaining RBs for the requested UE */
- allocInfo->rbsReq = poolWithMaxAvlblBw->bw -
- poolWithMaxAvlblBw->bwAlloced;
- RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[0].imcs, tbs);
- noLyrs = allocInfo->tbInfo[0].noLyr;
- allocInfo->tbInfo[0].bytesReq =
- rgTbSzTbl[noLyrs-1][tbs][allocInfo->rbsReq - 1]/8;
- *sfrpoolInfo = poolWithMaxAvlblBw;
- return (TRUE);
- }
- }
- }
- else
- {
- n = cmLListNext(l);
-
- if ((isUeCellEdge == FALSE) && (n == NULLP))
- {
- if(l != &dlSf->sfrTotalPoolInfo.cePool)
- {
- l = &dlSf->sfrTotalPoolInfo.cePool;
- n = cmLListFirst(l);
- }
- }
-
- if (n == NULLP)
- {
- return (FALSE);
- }
- }
-
- }
- }
- }
- return (FALSE);
-}
-#endif
-#endif /* end of ifndef LTE_TDD*/
-/* LTE_ADV_FLAG_REMOVED_END */
-
-/**
- * @brief To check if DL BW available for non-DLFS allocation.
- *
- * @details
- *
- * Function : rgSCHCmnNonDlfsUeRbAlloc
- *
- * Processing Steps:
- * - Determine availability based on RA Type.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *dlSf
- * @param[in] RgSchDlRbAlloc *allocInfo
- *
- * @return Bool
- * -# TRUE
- * -# FALSE
- **/
-#ifdef UNUSED_FUNC
-static Bool rgSCHCmnNonDlfsBwAvlbl
-(
-RgSchCellCb *cell,
-RgSchDlSf *dlSf,
-RgSchDlRbAlloc *allocInfo
-)
-{
- uint8_t tbs;
- uint8_t noLyrs;
- uint8_t ignoredDfctRbg = FALSE;
-
- if (dlSf->bw <= dlSf->bwAlloced)
- {
- DU_LOG("\nERROR --> SCH : (%d:%d)FAILED CRNTI:%d",
- dlSf->bw, dlSf->bwAlloced,allocInfo->rnti);
- return (FALSE);
- }
- if (allocInfo->raType == RG_SCH_CMN_RA_TYPE0)
- {
- /* Fix for ccpu00123919 : Number of RBs in case of RETX should be same as
- * that of initial transmission. */
- if(allocInfo->tbInfo[0].tbCb->txCntr)
- {
- /* If RB assignment is being done for RETX. Then if reqRbs are
- * a multiple of rbgSize then ignore lstRbgDfct. If reqRbs is
- * not a multiple of rbgSize then check if lsgRbgDfct exists */
- if (allocInfo->rbsReq % cell->rbgSize == 0)
- {
- if (dlSf->lstRbgDfct)
- {
- /* In this scenario we are wasting the last RBG for this dlSf */
-
- dlSf->type0End--;
- dlSf->bwAlloced += (cell->rbgSize - dlSf->lstRbgDfct);
- /* Fix: MUE_PERTTI_DL */
- dlSf->lstRbgDfct = 0;
- ignoredDfctRbg = TRUE;
-
- }
- }
- else
- {
- if (dlSf->lstRbgDfct)
- {
- /* Check if type0 allocation can cater to this RETX requirement */
- if ((allocInfo->rbsReq % cell->rbgSize) != (cell->rbgSize - dlSf->lstRbgDfct))
- {
- return (FALSE);
- }
- }
- else
- {
- /* cannot allocate same number of required RBs */
- return (FALSE);
- }
- }
- }
-
- /* Condition is modified approprialtely to find
- * if rbsReq is less than available RBS*/
- if(allocInfo->rbsReq <= (((dlSf->type0End - dlSf->type2End + 1)*\
- cell->rbgSize) - dlSf->lstRbgDfct))
- {
- return (TRUE);
- }
- /* ccpu00132358:MOD- Removing "ifndef LTE_TDD" for unblocking the RB
- * allocation in TDD when requested RBs are more than available RBs*/
- else
- {
- /* MS_WORKAROUND for ccpu00122022 */
- if (dlSf->bw < dlSf->bwAlloced + cell->rbgSize)
- {
- /* ccpu00132358- Re-assigning the values which were updated above
- * if it is RETX and Last RBG available*/
- if(ignoredDfctRbg == TRUE)
- {
- dlSf->type0End++;
- dlSf->bwAlloced -= (cell->rbgSize - dlSf->lstRbgDfct);
- dlSf->lstRbgDfct = 1;
- }
-
-
- return (FALSE);
- }
- /* Fix: Number of RBs in case of RETX should be same as
- * that of initial transmission. */
- if(allocInfo->tbInfo[0].tbCb->txCntr == 0
-#ifdef LTE_ADV
- && (FALSE == rgSCHLaaIsLaaTB(allocInfo))
-#endif
- )
- {
- /* Setting the remaining RBs for the requested UE*/
- allocInfo->rbsReq = (((dlSf->type0End - dlSf->type2End + 1)*\
- cell->rbgSize) - dlSf->lstRbgDfct);
- RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[0].imcs, tbs);
- noLyrs = allocInfo->tbInfo[0].noLyr;
- allocInfo->tbInfo[0].bytesReq = rgTbSzTbl[noLyrs-1][tbs][allocInfo->rbsReq - 1]/8;
- /* DwPts Scheduling Changes Start */
-#if LTE_TDD
- if (dlSf->sfType == RG_SCH_SPL_SF_DATA)
- {
- allocInfo->tbInfo[0].bytesReq =
- rgTbSzTbl[noLyrs-1][tbs][RGSCH_MAX(allocInfo->rbsReq*3/4,1) - 1]/8;
- }
-#endif
- /* DwPts Scheduling Changes End */
- }
- else
- {
- /* ccpu00132358- Re-assigning the values which were updated above
- * if it is RETX and Last RBG available*/
- if(ignoredDfctRbg == TRUE)
- {
- dlSf->type0End++;
- dlSf->bwAlloced -= (cell->rbgSize - dlSf->lstRbgDfct);
- dlSf->lstRbgDfct = 1;
- }
-
- DU_LOG("\nERROR --> SCH : FAILED for CRNTI:%d",
- allocInfo->rnti);
- DU_LOG("\nERROR --> SCH : RB Alloc failed for LAA TB type 0\n");
- return (FALSE);
- }
- return (TRUE);
- }
- }
- else if (allocInfo->raType == RG_SCH_CMN_RA_TYPE2)
- {
- if (allocInfo->rbsReq <= (dlSf->bw - dlSf->bwAlloced))
- {
- return (TRUE);
- }
- /* ccpu00132358:MOD- Removing "ifndef LTE_TDD" for unblocking the RB
- * allocation in TDD when requested RBs are more than available RBs*/
- else
- {
- /* Fix: Number of RBs in case of RETX should be same as
- * that of initial transmission. */
- if((allocInfo->tbInfo[0].tbCb->txCntr == 0)
-#ifdef LTE_ADV
- && (FALSE == rgSCHLaaIsLaaTB(allocInfo))
-#endif
- )
- {
- /* set the remaining RBs for the requested UE */
- allocInfo->rbsReq = dlSf->bw - dlSf->bwAlloced;
- RG_SCH_CMN_DL_MCS_TO_TBS(allocInfo->tbInfo[0].imcs, tbs);
- noLyrs = allocInfo->tbInfo[0].noLyr;
- allocInfo->tbInfo[0].bytesReq = rgTbSzTbl[noLyrs-1][tbs][allocInfo->rbsReq - 1]/8;
- /* DwPts Scheduling Changes Start */
-#ifdef LTE_TDD
- if (dlSf->sfType == RG_SCH_SPL_SF_DATA)
- {
- allocInfo->tbInfo[0].bytesReq =
- rgTbSzTbl[noLyrs-1][tbs][RGSCH_MAX(allocInfo->rbsReq*3/4,1) - 1]/8;
- }
-#endif
- /* DwPts Scheduling Changes End */
- }
- else
- {
- DU_LOG("\nERROR --> SCH : RB Alloc failed for LAA TB type 2\n");
- DU_LOG("\nERROR --> SCH : FAILED for CRNTI:%d",allocInfo->rnti);
- return (FALSE);
- }
- /* Fix: Number of RBs in case of RETX should be same as
- * that of initial transmission. */
- return (TRUE);
- }
- }
- DU_LOG("\nERROR --> SCH : FAILED for CRNTI:%d",allocInfo->rnti);
- return (FALSE);
-}
-#endif
-/* LTE_ADV_FLAG_REMOVED_START */
-#ifndef LTE_TDD
-/**
- * @brief To update non-DLFS alloc'n parameters after TYPE2 Allocation.
- *
- * @details
- *
- * Function : rgSCHCmnNonDlfsSFRCmnChannelUpdTyp2Alloc
- *
- * Processing Steps:
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *dlSf
- * @param[in] uint8_t rbStrt
- * @param[in] uint8_t numRb
- *
- * @return Void
- **/
-Void rgSCHCmnNonDlfsSFRCmnChannelUpdTyp2Alloc
-(
-RgSchCellCb *cell,
-RgSchDlSf *dlSf,
-uint8_t rbStrt,
-uint8_t numRb
-)
-{
- CmLListCp *l;
- CmLList *n;
- RgSchSFRPoolInfo *sfrPool;
-
- l = &dlSf->sfrTotalPoolInfo.ccPool;
-
- dlSf->type2End = RGSCH_CEIL((rbStrt+numRb), cell->rbgSize);
- dlSf->bwAlloced += numRb;
- dlSf->type2Start += numRb;
- n = cmLListFirst(l);
-
- while(n->node)
- {
- sfrPool = (RgSchSFRPoolInfo*)(n->node);
- n = cmLListNext(l);
-
- /* If the pool contains some RBs allocated in this allocation, e.g: Pool is [30.50]. Pool->type2Start is 40 , dlSf->type2Start is 45. then update the variables in pool */
- if((sfrPool->poolendRB >= dlSf->type2Start) && (sfrPool->type2Start < dlSf->type2Start))
- {
- sfrPool->type2End = dlSf->type2End;
- sfrPool->bwAlloced = dlSf->type2Start - sfrPool->poolstartRB;
- sfrPool->type2Start = dlSf->type2Start;
- }
- else
- {
- /* If the pool contains all RBs allocated in this allocation*/
- if(dlSf->type2Start > sfrPool->poolendRB)
- {
- sfrPool->type2End = sfrPool->type0End + 1;
- sfrPool->bwAlloced = sfrPool->bw;
- sfrPool->type2Start = sfrPool->poolendRB + 1;
- }
- }
- if (!n)
- {
- if (l != &dlSf->sfrTotalPoolInfo.cePool)
- {
- l = &dlSf->sfrTotalPoolInfo.cePool;
- n = cmLListFirst(l);
- }
- else
- return;
- }
- }
- return;
-}
-
-/**
- * @brief To update non-DLFS alloc'n parameters after TYPE2 Allocation.
- *
- * @details
- *
- * Function : rgSCHCmnNonDlfsUpdDSFRTyp2Alloc
- *
- * Processing Steps:
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *dlSf
- * @param[in] uint8_t rbStrt
- * @param[in] uint8_t numRb
- *
- * @return Void
- **/
-#ifdef UNUSED_FUNC
-static S16 rgSCHCmnNonDlfsUpdDSFRTyp2Alloc
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlSf *dlSf,
-uint8_t rbStrt,
-uint8_t numRb
-)
-{
- CmLListCp *l;
- CmLList *n;
- RgSchSFRPoolInfo *sfrCCPool1 = NULL;
- RgSchSFRPoolInfo *sfrCCPool2 = NULL;
- S16 ret = RFAILED;
-
- /* Move the type2End pivot forward */
-
-
- l = &dlSf->sfrTotalPoolInfo.ccPool;
- n = cmLListFirst(l);
- while(n)
- {
- sfrCCPool1 = (RgSchSFRPoolInfo*)(n->node);
- /* KWork fix */
- if (sfrCCPool1 == NULLP)
- {
- DU_LOG("\nERROR --> SCH : rgSCHCmnNonDlfsUpdDSFRTyp2Alloc():"
- "sfrCCPool1 is NULL for CRNTI:%d",ue->ueId);
- return RFAILED;
- }
- n = cmLListNext(l);
- if(n)
- {
- sfrCCPool2 = (RgSchSFRPoolInfo*)(n->node);
- n = cmLListNext(l);
- }
- if((sfrCCPool1) && (sfrCCPool2))
- {
- /* Based on RNTP info, the CC user is assigned high power per subframe basis */
- if(((dlSf->type2Start >= sfrCCPool1->pwrHiCCRange.startRb) &&
- (dlSf->type2Start + numRb < sfrCCPool1->pwrHiCCRange.endRb)) ||
- ((dlSf->type2Start >= sfrCCPool2->pwrHiCCRange.startRb) &&
- (dlSf->type2Start + numRb < sfrCCPool2->pwrHiCCRange.endRb)))
- {
- ue->lteAdvUeCb.isCCUePHigh = TRUE;
-
- /* Calling rgSCHCmnBuildRntpInfo function to update RNTP BitMap */
- ret = rgSCHCmnBuildRntpInfo(cell, dlSf->rntpInfo.val, dlSf->type2Start, numRb, dlSf->bw);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : rgSCHCmnNonDlfsUpdDSFRTyp2Alloc():"
- "rgSCHCmnBuildRntpInfo() function returned RFAILED for CRNTI:%d",ue->ueId);
- return RFAILED;
- }
- }
- }
- else
- {
- if((dlSf->type2Start >= sfrCCPool1->pwrHiCCRange.startRb) &&
- (dlSf->type2Start + numRb < sfrCCPool1->pwrHiCCRange.endRb))
- {
- ue->lteAdvUeCb.isCCUePHigh = TRUE;
-
- /* Calling rgSCHCmnBuildRntpInfo function to update RNTP BitMap */
- ret = rgSCHCmnBuildRntpInfo(cell, dlSf->rntpInfo.val, dlSf->type2Start, numRb, dlSf->bw);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : rgSCHCmnNonDlfsUpdDSFRTyp2Alloc():"
- "rgSCHCmnBuildRntpInfo() function returned RFAILED CRNTI:%d",ue->ueId);
- return RFAILED;
- }
- }
- }
- }
- dlSf->type2End = RGSCH_CEIL((rbStrt+numRb), cell->rbgSize);
-#ifndef LTEMAC_SPS
- dlSf->bwAlloced += numRb;
- /*MS_FIX for ccpu00123918*/
- dlSf->type2Start += numRb;
-#endif
- return ROK;
-
-}
-#endif
-#endif /* end of ifndef LTE_TDD*/
-/* LTE_ADV_FLAG_REMOVED_END */
-/**
- * @brief To update non-DLFS alloc'n parameters after TYPE2 Allocation.
- *
- * @details
- *
- * Function : rgSCHCmnNonDlfsUpdTyp2Alloc
- *
- * Processing Steps:
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *dlSf
- * @param[in] uint8_t rbStrt
- * @param[in] uint8_t numRb
- *
- * @return Void
- **/
-static Void rgSCHCmnNonDlfsUpdTyp2Alloc
-(
-RgSchCellCb *cell,
-RgSchDlSf *dlSf,
-uint8_t rbStrt,
-uint8_t numRb
-)
-{
- /* Move the type2End pivot forward */
- dlSf->type2End = RGSCH_CEIL((rbStrt+numRb), cell->rbgSize);
-//#ifndef LTEMAC_SPS
- dlSf->bwAlloced += numRb;
- /*Fix for ccpu00123918*/
- dlSf->type2Start += numRb;
-//#endif
- return;
-}
-
-/**
- * @brief To do DL allocation using TYPE0 RA.
- *
- * @details
- *
- * Function : rgSCHCmnNonDlfsType0Alloc
- *
- * Processing Steps:
- * - Perform TYPE0 allocation using the RBGs between
- * type0End and type2End.
- * - Build the allocation mask as per RBG positioning.
- * - Update the allocation parameters.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *dlSf
- * @param[in] RgSchDlRbAlloc *allocInfo
- *
- * @return Void
- **/
-#ifdef UNUSED_FUNC
-static Void rgSCHCmnNonDlfsType0Alloc
-(
-RgSchCellCb *cell,
-RgSchDlSf *dlSf,
-RgSchDlRbAlloc *allocInfo,
-RgSchUeCb *ue
-)
-{
- uint32_t dlAllocMsk = 0;
- uint8_t rbgFiller = dlSf->lstRbgDfct;
- uint8_t noRbgs = RGSCH_CEIL((allocInfo->rbsReq + rbgFiller), cell->rbgSize);
- //uint8_t noRbgs = (allocInfo->rbsReq + rbgFiller)/ cell->rbgSize;
- uint8_t noRbs;
- uint8_t noLyr;
- uint8_t iTbs;
- uint32_t tb1BytesAlloc = 0;
- uint32_t tb2BytesAlloc = 0;
- RgSchCmnDlUe *dlUe = RG_SCH_CMN_GET_DL_UE(ue,cell);
-
- //if(noRbgs == 0) noRbgs = 1; /* Not required as ceilling is used above*/
-
- /* Fix for ccpu00123919*/
- noRbs = (noRbgs * cell->rbgSize) - rbgFiller;
- if (dlSf->bwAlloced + noRbs > dlSf->bw)
- {
- if (--noRbgs == 0)
- {
- return;
- }
- noRbs = (noRbgs * cell->rbgSize) - rbgFiller;
- }
-
- /* Fix for ccpu00138701: Ceilling is using to derive num of RBGs, Therefore,
- * after this operation,checking Max TB size and Max RBs are not crossed
- * if it is crossed then decrement num of RBGs. */
- //if((noRbs + rbgFiller) % cell->rbgSize)
- if((noRbs > allocInfo->rbsReq) &&
- (allocInfo->rbsReq + rbgFiller) % cell->rbgSize)
- {/* considering ue category limitation
- * due to ceiling */
-
-#ifdef LTE_ADV
- if (rgSCHLaaIsLaaTB(allocInfo)== FALSE)
-#endif
- {
- if ((allocInfo->tbInfo[0].schdlngForTb) && (!allocInfo->tbInfo[0].tbCb->txCntr))
- {
- iTbs = allocInfo->tbInfo[0].iTbs;
- noLyr = allocInfo->tbInfo[0].noLyr;
- tb1BytesAlloc = rgTbSzTbl[noLyr - 1][iTbs][noRbs - 1]/8;
- }
-
- if ((allocInfo->tbInfo[1].schdlngForTb) && (!allocInfo->tbInfo[1].tbCb->txCntr))
- {
- iTbs = allocInfo->tbInfo[1].iTbs;
- noLyr = allocInfo->tbInfo[1].noLyr;
- tb2BytesAlloc = rgTbSzTbl[noLyr - 1][iTbs][noRbs - 1]/8;
- }
- }
-
- /* Only Check for New Tx No need for Retx */
- if (tb1BytesAlloc || tb2BytesAlloc)
- {
- if (( ue->dl.aggTbBits >= dlUe->maxTbBits) ||
- (tb1BytesAlloc >= dlUe->maxTbSz/8) ||
- (tb2BytesAlloc >= dlUe->maxTbSz/8) ||
- (noRbs >= dlUe->maxRb))
- {
- if (--noRbgs == 0)
- {
- return;
- }
- noRbs = (noRbgs * cell->rbgSize) - rbgFiller;
- }
- }
- }
- /* type0End would have been initially (during subfrm Init) at the bit position
- * (cell->noOfRbgs - 1), 0 being the most significant.
- * Getting DlAllocMsk for noRbgs and at the appropriate position */
- dlAllocMsk |= (((1 << noRbgs) - 1) << (31 - dlSf->type0End));
- /* Move backwards the type0End pivot */
- dlSf->type0End -= noRbgs;
- /*Fix for ccpu00123919*/
- /*noRbs = (noRbgs * cell->rbgSize) - rbgFiller;*/
- /* Update the bwAlloced field accordingly */
-//#ifndef LTEMAC_SPS /* ccpu00129474*/
- dlSf->bwAlloced += noRbs;
-//#endif
- /* Update Type0 Alloc Info */
- allocInfo->allocInfo.raType0.numDlAlloc = noRbgs;
- allocInfo->allocInfo.raType0.dlAllocBitMask |= dlAllocMsk;
- allocInfo->rbsAlloc = noRbs;
-
- /* Update Tb info for each scheduled TB */
- iTbs = allocInfo->tbInfo[0].iTbs;
- noLyr = allocInfo->tbInfo[0].noLyr;
- /* Fix for ccpu00123919: For a RETX TB the iTbs is irrelevant.
- * RETX TB Size is same as Init TX TB Size */
- if (allocInfo->tbInfo[0].tbCb->txCntr)
- {
- allocInfo->tbInfo[0].bytesAlloc =
- allocInfo->tbInfo[0].bytesReq;
- }
- else
- {
- allocInfo->tbInfo[0].bytesAlloc =
- rgTbSzTbl[noLyr - 1][iTbs][noRbs - 1]/8;
- /* DwPts Scheduling Changes Start */
-#ifdef LTE_TDD
- if (dlSf->sfType == RG_SCH_SPL_SF_DATA)
- {
- allocInfo->tbInfo[0].bytesAlloc =
- rgTbSzTbl[noLyr - 1][iTbs][RGSCH_MAX(noRbs*3/4,1) - 1]/8;
- }
-#endif
- /* DwPts Scheduling Changes End */
- }
-
- if (allocInfo->tbInfo[1].schdlngForTb)
- {
- iTbs = allocInfo->tbInfo[1].iTbs;
- noLyr = allocInfo->tbInfo[1].noLyr;
- /* Fix for ccpu00123919: For a RETX TB the iTbs is irrelevant
- * RETX TB Size is same as Init TX TB Size */
- if (allocInfo->tbInfo[1].tbCb->txCntr)
- {
- allocInfo->tbInfo[1].bytesAlloc =
- allocInfo->tbInfo[1].bytesReq;
- }
- else
- {
- allocInfo->tbInfo[1].bytesAlloc =
- rgTbSzTbl[noLyr - 1][iTbs][noRbs - 1]/8;
- /* DwPts Scheduling Changes Start */
-#ifdef LTE_TDD
- if (dlSf->sfType == RG_SCH_SPL_SF_DATA)
- {
- allocInfo->tbInfo[1].bytesAlloc =
- rgTbSzTbl[noLyr - 1][iTbs][RGSCH_MAX(noRbs*3/4,1) - 1]/8;
- }
-#endif
- /* DwPts Scheduling Changes End */
- }
- }
-
- /* The last RBG which can be smaller than the RBG size is consedered
- * only for the first time allocation of TYPE0 UE */
- dlSf->lstRbgDfct = 0;
- return;
-}
-#endif
-#ifndef LTE_TDD
-
-/**
- * @brief To prepare RNTP value from the PRB allocation (P-High -> 1 and P-Low -> 0)
- *
- * @details
- *
- * Function : rgSCHCmnBuildRntpInfo
- *
- * Processing Steps:
- *
- * @param[in] uint8_t *rntpPtr
- * @param[in] uint8_t startRb
- * @param[in] uint8_t numRb
- *
- * @return Void
- **/
-#ifdef UNUSED_FUNC
-static S16 rgSCHCmnBuildRntpInfo
-(
-RgSchCellCb *cell,
-uint8_t *rntpPtr,
-uint8_t startRb,
-uint8_t nmbRb,
-uint16_t bw
-)
-{
- uint16_t rbPtrStartIdx; /* Start Index of Octete Buffer to be filled */
- uint16_t rbPtrEndIdx; /* End Index of Octete Buffer to be filled */
- uint16_t rbBitLoc; /* Bit Location to be set as 1 in the current Byte */
- uint16_t nmbRbPerByte; /* PRB's to be set in the current Byte (in case of multiple Bytes) */
-
-
- rbPtrStartIdx = (startRb)/8;
- rbPtrEndIdx = (startRb + nmbRb)/8;
-
- if (rntpPtr == NULLP)
- {
- DU_LOG("\nERROR --> SCH : rgSCHCmnBuildRntpInfo():"
- "rntpPtr can't be NULLP (Memory Allocation Failed)");
- return RFAILED;
- }
-
- while(rbPtrStartIdx <= rbPtrEndIdx)
- {
- rbBitLoc = (startRb)%8;
-
- /* case 1: startRb and endRb lies in same Byte */
- if (rbPtrStartIdx == rbPtrEndIdx)
- {
- rntpPtr[rbPtrStartIdx] = rntpPtr[rbPtrStartIdx]
- | (((1<<nmbRb)-1)<<rbBitLoc);
- }
-
- /* case 2: startRb and endRb lies in different Byte */
- if (rbPtrStartIdx != rbPtrEndIdx)
- {
- nmbRbPerByte = 8 - rbBitLoc;
- nmbRb = nmbRb - nmbRbPerByte;
- rntpPtr[rbPtrStartIdx] = rntpPtr[rbPtrStartIdx]
- | (((1<<nmbRbPerByte)-1)<<rbBitLoc);
- startRb = startRb + nmbRbPerByte;
- }
-
- rbPtrStartIdx++;
- }
-
- /* dsfr_pal_fixes ** 21-March-2013 ** SKS ** Adding Debug logs */
-
- /* dsfr_pal_fixes ** 25-March-2013 ** SKS ** Adding Debug logs to print RNTP */
-
- return ROK;
-}
-
-/**
- * @brief To update non-DLFS alloc'n parameters after TYPE2 Allocation.
- *
- * @details
- *
- * Function : rgSCHCmnNonDlfsUpdSFRPoolTyp2Alloc
- *
- * Processing Steps:
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *dlSf
- * @param[in] uint8_t rbStrt
- * @param[in] uint8_t numRb
- *
- * @return Void
- **/
-static S16 rgSCHCmnNonDlfsUpdSFRPoolTyp2Alloc
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlSf *dlSf,
-RgSchSFRPoolInfo *sfrPool,
-uint8_t rbStrt,
-uint8_t numRb
-)
-{
-#ifndef LTEMAC_SPS
- S16 ret;
-#endif
-
- dlSf->type2End = RGSCH_CEIL((rbStrt+numRb), cell->rbgSize);
- sfrPool->type2End = RGSCH_CEIL((rbStrt+numRb), cell->rbgSize);
-
-#ifndef LTEMAC_SPS
- dlSf->type2Start += numRb;
- dlSf->bwAlloced += numRb;
-
- if(cell->lteAdvCb.dsfrCfg.status == RGR_ENABLE)
- {
- /* Based on RNTP info, the CC user is assigned high power per subframe basis */
- if(FALSE == ue->lteAdvUeCb.rgrLteAdvUeCfg.isUeCellEdge)
- {
- if((sfrPool->type2Start >= sfrPool->pwrHiCCRange.startRb) &&
- (sfrPool->type2Start + numRb < sfrPool->pwrHiCCRange.endRb))
- {
- ue->lteAdvUeCb.isCCUePHigh = TRUE;
-
- /* Calling rgSCHCmnBuildRntpInfo function to update RNTP BitMap */
- ret = rgSCHCmnBuildRntpInfo(cell, dlSf->rntpInfo.val, sfrPool->type2Start, numRb, dlSf->bw);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : rgSCHCmnNonDlfsUpdSFRPoolTyp2Alloc():"
- "rgSCHCmnBuildRntpInfo() function returned RFAILED for CRNTI:%d",ue->ueId);
- return RFAILED;
- }
- }
- }
- else
- {
- /* Calling rgSCHCmnBuildRntpInfo function to update RNTP BitMap */
- ret = rgSCHCmnBuildRntpInfo(cell, dlSf->rntpInfo.val, sfrPool->type2Start, numRb, dlSf->bw);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : rgSCHCmnNonDlfsUpdSFRPoolTyp2Alloc():"
- "rgSCHCmnBuildRntpInfo() function returned RFAILED for CRNTI:%d",ue->ueId);
- return RFAILED;
- }
- }
- }
- sfrPool->type2Start += numRb;
- sfrPool->bwAlloced += numRb;
-#endif
-
- return ROK;
-}
-
-/**
- * @brief To do DL allocation using TYPE0 RA.
- *
- * @details
- *
- * Function : rgSCHCmnNonDlfsSFRPoolType0Alloc
- *
- * Processing Steps:
- * - Perform TYPE0 allocation using the RBGs between type0End and type2End.
- * - Build the allocation mask as per RBG positioning.
- * - Update the allocation parameters.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *dlSf
- * @param[in] RgSchDlRbAlloc *allocInfo
- *
- * @return Void
- **/
-static Void rgSCHCmnNonDlfsSFRPoolType0Alloc
-(
-RgSchCellCb *cell,
-RgSchDlSf *dlSf,
-RgSchSFRPoolInfo *poolInfo,
-RgSchDlRbAlloc *allocInfo
-)
-{
- uint32_t dlAllocMsk = 0;
- uint8_t rbgFiller = 0;
- uint8_t noRbgs = 0;
- uint8_t noRbs;
- uint8_t noLyr;
- uint8_t iTbs;
-
-
- if (poolInfo->poolstartRB + poolInfo->bw == dlSf->bw)
- {
- if (poolInfo->type0End == dlSf->bw/4)
- {
- rbgFiller = dlSf->lstRbgDfct;
- /* The last RBG which can be smaller than the RBG size is consedered
- * only for the first time allocation of TYPE0 UE */
- dlSf->lstRbgDfct = 0;
- }
- }
-
- noRbgs = RGSCH_CEIL((allocInfo->rbsReq + rbgFiller), cell->rbgSize);
-
- /* Abhinav to-do start */
- /* MS_FIX for ccpu00123919*/
- noRbs = (noRbgs * cell->rbgSize) - rbgFiller;
- if (dlSf->bwAlloced + noRbs > dlSf->bw)
- {
- if (--noRbgs == 0)
- {
- return;
- }
- noRbs = (noRbgs * cell->rbgSize) - rbgFiller;
- }
- /* Abhinav to-do end */
-
-
-
- /* type0End would have been initially (during subfrm Init) at the bit position
- * (cell->noOfRbgs - 1), 0 being the most significant.
- * Getting DlAllocMsk for noRbgs and at the appropriate position */
- dlAllocMsk |= (((1 << noRbgs) - 1) << (31 - poolInfo->type0End));
- /* Move backwards the type0End pivot */
- poolInfo->type0End -= noRbgs;
- /*MS_FIX for ccpu00123919*/
- /*noRbs = (noRbgs * cell->rbgSize) - rbgFiller;*/
- /* Update the bwAlloced field accordingly */
- poolInfo->bwAlloced += noRbs + dlSf->lstRbgDfct;
- dlSf->bwAlloced += noRbs + dlSf->lstRbgDfct;
-
- /* Update Type0 Alloc Info */
- allocInfo->allocInfo.raType0.numDlAlloc = noRbgs;
- allocInfo->allocInfo.raType0.dlAllocBitMask |= dlAllocMsk;
- allocInfo->rbsAlloc = noRbs;
-
- /* Update Tb info for each scheduled TB */
- iTbs = allocInfo->tbInfo[0].iTbs;
- noLyr = allocInfo->tbInfo[0].noLyr;
- /* Fix for ccpu00123919: For a RETX TB the iTbs is irrelevant.
- * RETX TB Size is same as Init TX TB Size */
- if (allocInfo->tbInfo[0].tbCb->txCntr)
- {
- allocInfo->tbInfo[0].bytesAlloc =
- allocInfo->tbInfo[0].bytesReq;
- }
- else
- {
- allocInfo->tbInfo[0].bytesAlloc =
- rgTbSzTbl[noLyr - 1][iTbs][noRbs - 1]/8;
- }
-
- if (allocInfo->tbInfo[1].schdlngForTb)
- {
- iTbs = allocInfo->tbInfo[1].iTbs;
- noLyr = allocInfo->tbInfo[1].noLyr;
- /* Fix for ccpu00123919: For a RETX TB the iTbs is irrelevant
- * RETX TB Size is same as Init TX TB Size */
- if (allocInfo->tbInfo[1].tbCb->txCntr)
- {
- allocInfo->tbInfo[1].bytesAlloc =
- allocInfo->tbInfo[1].bytesReq;
- }
- else
- {
- allocInfo->tbInfo[1].bytesAlloc =
- rgTbSzTbl[noLyr - 1][iTbs][noRbs - 1]/8;
- }
- }
-
- /* The last RBG which can be smaller than the RBG size is consedered
- * only for the first time allocation of TYPE0 UE */
- dlSf->lstRbgDfct = 0;
- return;
-}
-#endif
-/**
- * @brief Computes RNTP Info for a subframe.
- *
- * @details
- *
- * Function : rgSCHCmnNonDlfsDsfrRntpComp
- *
- * Processing Steps:
- * - Computes RNTP info from individual pools.
- *
- * @param[in] RgSchDlSf *dlSf
- *
- * @return void
-
- **/
-static void rgSCHCmnNonDlfsDsfrRntpComp(RgSchCellCb *cell,RgSchDlSf *dlSf)
-{
- static uint16_t samples = 0;
- uint16_t i;
- uint16_t bwBytes = (dlSf->bw-1)/8;
- RgrLoadInfIndInfo *rgrLoadInf;
- uint16_t len;
- uint16_t ret = ROK;
-
-
- len = (dlSf->bw % 8 == 0) ? dlSf->bw/8 : dlSf->bw/8 + 1;
-
- /* RNTP info is ORed every TTI and the sample is stored in cell control block */
- for(i = 0; i <= bwBytes; i++)
- {
- cell->rntpAggrInfo.val[i] |= dlSf->rntpInfo.val[i];
- }
- samples = samples + 1;
- /* After every 1000 ms, the RNTP info will be sent to application to be further sent to all neighbouring eNB
- informing them about the load indication for cell edge users */
- if(RG_SCH_MAX_RNTP_SAMPLES == samples)
- {
- /* ccpu00134492 */
- ret = rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&rgrLoadInf,
- sizeof(RgrLoadInfIndInfo));
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Could not "
- "allocate memory for sending LoadInfo");
- return;
- }
-
- rgrLoadInf->u.rntpInfo.pres = cell->rntpAggrInfo.pres;
- /* dsfr_pal_fixes ** 21-March-2013 ** SKS */
- rgrLoadInf->u.rntpInfo.len = len;
-
- /* dsfr_pal_fixes ** 21-March-2013 ** SKS */
- rgrLoadInf->u.rntpInfo.val = cell->rntpAggrInfo.val;
- rgrLoadInf->cellId = cell->cellId;
-
- /* dsfr_pal_fixes ** 22-March-2013 ** SKS */
- rgrLoadInf->bw = dlSf->bw;
- rgrLoadInf->type = RGR_SFR;
-
- ret = rgSCHUtlRgrLoadInfInd(cell, rgrLoadInf);
- if(ret == RFAILED)
- {
- DU_LOG("\nERROR --> SCH : rgSCHCmnNonDlfsDsfrRntpComp():"
- "rgSCHUtlRgrLoadInfInd() returned RFAILED");
- }
-
- memset(cell->rntpAggrInfo.val,0,len);
- samples = 0;
- }
- }
-/* LTE_ADV_FLAG_REMOVED_END */
-
-/* LTE_ADV_FLAG_REMOVED_START */
-/**
- * @brief Performs RB allocation per UE from a pool.
- *
- * @details
- *
- * Function : rgSCHCmnSFRNonDlfsUeRbAlloc
- *
- * Processing Steps:
- * - Allocate consecutively available RBs.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchDlSf *dlSf
- * @param[out] uint8_t *isDlBwAvail
- *
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-#ifdef UNUSED_FUNC
-static S16 rgSCHCmnSFRNonDlfsUeRbAlloc
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlSf *dlSf,
-uint8_t *isDlBwAvail
-)
-{
- RgSchDlRbAlloc *allocInfo;
- RgSchCmnDlUe *dlUe;
- Bool isUECellEdge;
- RgSchSFRPoolInfo *sfrpoolInfo = NULLP;
-
-
- isUECellEdge = RG_SCH_CMN_IS_UE_CELL_EDGE(ue);
-
- dlUe = RG_SCH_CMN_GET_DL_UE(ue,cell);
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell);
- *isDlBwAvail = TRUE;
-
- /*Find which pool is available for this UE*/
- if (rgSCHCmnNonDlfsSFRBwAvlbl(cell, &sfrpoolInfo, dlSf, allocInfo, isUECellEdge) != TRUE)
- {
- /* SFR_FIX - If this is CE UE there may be BW available in CC Pool
- So CC UEs will be scheduled */
- if (isUECellEdge)
- {
- *isDlBwAvail = TRUE;
- }
- else
- {
- *isDlBwAvail = FALSE;
- }
- return RFAILED;
- }
-
- if (dlUe->proc->tbInfo[0].isAckNackDtx == TFU_HQFDB_DTX || dlUe->proc->tbInfo[1].isAckNackDtx)
- {
- allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, ue, dlSf, dlUe->mimoInfo.cwInfo[0].cqi, allocInfo->dciFormat, TRUE);
- }
- else
- {
- allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, ue, dlSf, dlUe->mimoInfo.cwInfo[0].cqi, allocInfo->dciFormat,FALSE);
- }
-
- if (!(allocInfo->pdcch))
- {
- /* Returning ROK since PDCCH might be available for another UE and further allocations could be done */
- return RFAILED;
- }
-
-#ifdef LTEMAC_SPS
- allocInfo->rnti = ue->ueId;
-#endif
-
- if (allocInfo->raType == RG_SCH_CMN_RA_TYPE2)
- {
- allocInfo->allocInfo.raType2.isLocal = TRUE;
- /* rg004.201 patch - ccpu00109921 fix end */
- /* MS_FIX for ccpu00123918*/
- allocInfo->allocInfo.raType2.rbStart = (uint8_t)sfrpoolInfo->type2Start;
- allocInfo->allocInfo.raType2.numRb = allocInfo->rbsReq;
- /* rg007.201 - Changes for MIMO feature addition */
- /* rg008.201 - Removed dependency on MIMO compile-time flag */
- rgSCHCmnNonDlfsUpdSFRPoolTyp2Alloc(cell, ue, dlSf, sfrpoolInfo, \
- allocInfo->allocInfo.raType2.rbStart, \
- allocInfo->allocInfo.raType2.numRb);
- allocInfo->rbsAlloc = allocInfo->rbsReq;
- allocInfo->tbInfo[0].bytesAlloc = allocInfo->tbInfo[0].bytesReq;
- }
- else if (allocInfo->raType == RG_SCH_CMN_RA_TYPE0)
- {
- rgSCHCmnNonDlfsSFRPoolType0Alloc(cell, dlSf, sfrpoolInfo, allocInfo);
- }
-#ifndef LTE_TDD
-#ifdef DEBUGP
- rgSCHCmnFindCodeRate(cell,dlSf,allocInfo,0);
- if(allocInfo->tbInfo[1].schdlngForTb == TRUE)
- {
- rgSCHCmnFindCodeRate(cell,dlSf,allocInfo,1);
- }
-#endif
-#endif
-
-#if defined(LTEMAC_SPS)
- /* Update the sub-frame with new allocation */
- dlSf->bwAlloced += allocInfo->rbsReq;
-#endif
-
- return ROK;
-}
-#endif
-/* LTE_ADV_FLAG_REMOVED_END */
-#endif /* LTE_TDD */
-
-/**
- * @brief Performs RB allocation per UE for frequency non-selective cell.
- *
- * @details
- *
- * Function : rgSCHCmnNonDlfsUeRbAlloc
- *
- * Processing Steps:
- * - Allocate consecutively available RBs.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchDlSf *dlSf
- * @param[out] uint8_t *isDlBwAvail
- *
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHCmnNonDlfsUeRbAlloc
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlSf *dlSf,
-uint8_t *isDlBwAvail
-)
-{
- RgSchDlRbAlloc *allocInfo;
- RgSchCmnDlUe *dlUe;
-#ifdef LAA_DBG
- uint32_t dbgRbsReq = 0;
-#endif
-
-#ifdef RG_5GTF
- RgSch5gtfUeCb *ue5gtfCb = &(ue->ue5gtfCb);
- RgSchSfBeamInfo *beamInfo = &(dlSf->sfBeamInfo[ue5gtfCb->BeamId]);
-#endif
- dlUe = RG_SCH_CMN_GET_DL_UE(ue,cell);
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell);
- *isDlBwAvail = TRUE;
-
- if(beamInfo->totVrbgAllocated > MAX_5GTF_VRBG)
- {
- DU_LOG("\nERROR --> SCH : 5GTF_ERROR : vrbg allocated > 25 :ue (%u)",
- ue->ueId);
- DU_LOG("\nERROR --> SCH : 5GTF_ERROR vrbg allocated > 25\n");
- return RFAILED;
- }
-
- if (dlUe->proc->tbInfo[0].isAckNackDtx == TFU_HQFDB_DTX
- || dlUe->proc->tbInfo[1].isAckNackDtx)
- {
- allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, ue, dlSf, dlUe->mimoInfo.cwInfo[0].cqi, allocInfo->dciFormat, TRUE);
- }
- else
- {
- allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, ue, dlSf, dlUe->mimoInfo.cwInfo[0].cqi, allocInfo->dciFormat,FALSE);
- }
- if (!(allocInfo->pdcch))
- {
- /* Returning ROK since PDCCH might be available for another UE and
- * further allocations could be done */
- DU_LOG("\nERROR --> SCH : 5GTF_ERROR : PDCCH allocation failed :ue (%u)",
- ue->ueId);
- DU_LOG("\nERROR --> SCH : 5GTF_ERROR PDCCH allocation failed\n");
- return RFAILED;
- }
-#ifdef RG_5GTF
- //maxPrb = RGSCH_MIN((allocInfo->vrbgReq * MAX_5GTF_VRBG_SIZE), ue5gtfCb->maxPrb);
- //maxPrb = RGSCH_MIN(maxPrb,
- //((beamInfo->totVrbgAvail - beamInfo->vrbgStart)* MAX_5GTF_VRBG_SIZE)));
- //TODO_SID Need to check for vrbg available after scheduling for same beam.
- allocInfo->tbInfo[0].tbCb->dlGrnt.vrbgStart = beamInfo->vrbgStart;
- allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg = allocInfo->vrbgReq;
- //TODO_SID: Setting for max TP
- allocInfo->tbInfo[0].tbCb->dlGrnt.xPDSCHRange = 1;
- allocInfo->tbInfo[0].tbCb->dlGrnt.rbAssign = rgSCHCmnCalcRiv(MAX_5GTF_VRBG,
- allocInfo->tbInfo[0].tbCb->dlGrnt.vrbgStart, allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg);
- allocInfo->tbInfo[0].tbCb->dlGrnt.SCID = 0;
- allocInfo->tbInfo[0].tbCb->dlGrnt.dciFormat = allocInfo->dciFormat;
- //Filling temporarily
- allocInfo->tbInfo[0].tbCb->dlGrnt.rbStrt = (allocInfo->tbInfo[0].tbCb->dlGrnt.vrbgStart * MAX_5GTF_VRBG_SIZE);
- allocInfo->tbInfo[0].tbCb->dlGrnt.numRb = (allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg * MAX_5GTF_VRBG_SIZE);
-
- beamInfo->vrbgStart += allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg;
- beamInfo->totVrbgAllocated += allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg;
- allocInfo->tbInfo[0].bytesAlloc = allocInfo->tbInfo[0].bytesReq;
-#endif
-
- return ROK;
-}
-
-#ifdef RGR_V1
-/**
- * @brief Performs RB allocation for Msg4 for frequency non-selective cell.
- *
- * @details
- *
- * Function : rgSCHCmnNonDlfsCcchSduAlloc
- *
- * Processing Steps:
- * - For each element in the list, Call rgSCHCmnNonDlfsCcchSduRbAlloc().
- * - If allocation is successful, add the ueCb to scheduled list of CCCH
- * SDU.
- * - else, add UeCb to non-scheduled list.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in, out] RgSchCmnCcchSduRbAlloc *allocInfo
- * @param[in] uint8_t isRetx
- *
- * @return Void
- **/
-static Void rgSCHCmnNonDlfsCcchSduAlloc
-(
-RgSchCellCb *cell,
-RgSchCmnCcchSduRbAlloc *allocInfo,
-uint8_t isRetx
-)
-{
- S16 ret;
- CmLListCp *ccchSduLst = NULLP;
- CmLListCp *schdCcchSduLst = NULLP;
- CmLListCp *nonSchdCcchSduLst = NULLP;
- CmLList *schdLnkNode = NULLP;
- CmLList *toBeSchdLnk = NULLP;
- RgSchDlSf *dlSf = allocInfo->ccchSduDlSf;
- RgSchUeCb *ueCb = NULLP;
- RgSchDlHqProcCb *hqP = NULLP;
-
- if (isRetx)
- {
- /* Initialize re-transmitting lists */
- ccchSduLst = &(allocInfo->ccchSduRetxLst);
- schdCcchSduLst = &(allocInfo->schdCcchSduRetxLst);
- nonSchdCcchSduLst = &(allocInfo->nonSchdCcchSduRetxLst);
- }
- else
- {
- /* Initialize transmitting lists */
- ccchSduLst = &(allocInfo->ccchSduTxLst);
- schdCcchSduLst = &(allocInfo->schdCcchSduTxLst);
- nonSchdCcchSduLst = &(allocInfo->nonSchdCcchSduTxLst);
- }
-
- /* Perform allocaations for the list */
- toBeSchdLnk = cmLListFirst(ccchSduLst);
- for (; toBeSchdLnk; toBeSchdLnk = toBeSchdLnk->next)
- {
- hqP = (RgSchDlHqProcCb *)(toBeSchdLnk->node);
- ueCb = hqP->hqE->ue;
- schdLnkNode = &hqP->schdLstLnk;
- RG_SCH_CMN_INIT_SCHD_LNK(schdLnkNode, hqP);
- ret = rgSCHCmnNonDlfsCcchSduRbAlloc(cell, ueCb, dlSf);
- if (ret != ROK)
- {
- /* Allocation failed: Add remaining MSG4 nodes to non-scheduled
- * list and return */
- do
- {
- hqP = (RgSchDlHqProcCb *)(toBeSchdLnk->node);
- ueCb = hqP->hqE->ue;
- schdLnkNode = &hqP->schdLstLnk;
- RG_SCH_CMN_INIT_SCHD_LNK(schdLnkNode, hqP);
- cmLListAdd2Tail(nonSchdCcchSduLst, schdLnkNode);
- toBeSchdLnk = toBeSchdLnk->next;
- } while(toBeSchdLnk);
- return;
- }
-
- /* Allocation successful: Add UE to the scheduled list */
- cmLListAdd2Tail(schdCcchSduLst, schdLnkNode);
- }
-
-
- return;
-}
-
-/**
- * @brief Performs RB allocation for CcchSdu for frequency non-selective cell.
- *
- * @details
- *
- * Function : rgSCHCmnNonDlfsCcchSduRbAlloc
- *
- * Processing Steps:
- * - Fetch PDCCH
- * - Allocate consecutively available RBs
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ueCb
- * @param[in] RgSchDlSf *dlSf
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHCmnNonDlfsCcchSduRbAlloc
-(
-RgSchCellCb *cell,
-RgSchUeCb *ueCb,
-RgSchDlSf *dlSf
-)
-{
- RgSchDlRbAlloc *allocInfo;
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ueCb,cell);
-
-
-
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ueCb,cell);
-
- /* [ccpu00138802]-MOD-If Bw is less than required, return fail
- It will be allocated in next TTI */
-#ifdef LTEMAC_SPS
- if ((dlSf->spsAllocdBw >= cell->spsBwRbgInfo.numRbs) &&
- (dlSf->bwAlloced == dlSf->bw))
-#else
- if((dlSf->bwAlloced == dlSf->bw) ||
- (allocInfo->rbsReq > (dlSf->bw - dlSf->bwAlloced)))
-#endif
- {
- return RFAILED;
- }
- /* Retrieve PDCCH */
- /* DTX Changes: One Variable is passed to check whether it is DTX or Not */
- if (ueDl->proc->tbInfo[0].isAckNackDtx == TFU_HQFDB_DTX)
- {
- /* allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, dlSf, y, ueDl->cqi,
- * TFU_DCI_FORMAT_1A, TRUE);*/
- allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, ueCb, dlSf, ueDl->mimoInfo.cwInfo[0].cqi, TFU_DCI_FORMAT_1A, TRUE);
- }
- else
- {
- allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, ueCb, dlSf, ueDl->mimoInfo.cwInfo[0].cqi, TFU_DCI_FORMAT_1A, FALSE);
- }
- if (!(allocInfo->pdcch))
- {
- /* Returning RFAILED since PDCCH not available for any CCCH allocations */
- return RFAILED;
- }
-
- /* Update allocation information */
- allocInfo->dciFormat = TFU_DCI_FORMAT_1A;
- allocInfo->raType = RG_SCH_CMN_RA_TYPE2;
- allocInfo->allocInfo.raType2.isLocal = TRUE;
-
- /*Fix for ccpu00123918*/
- /* Push this harq process back to the free queue */
- allocInfo->allocInfo.raType2.rbStart = (uint8_t)dlSf->type2Start;
- allocInfo->allocInfo.raType2.numRb = allocInfo->rbsReq;
- allocInfo->rbsAlloc = allocInfo->rbsReq;
- allocInfo->tbInfo[0].bytesAlloc = allocInfo->tbInfo[0].bytesReq;
- /* Update the sub-frame with new allocation */
- /* ccpu00129469 */
- /* LTE_ADV_FLAG_REMOVED_START */
-#ifndef LTE_TDD
- if (cell->lteAdvCb.sfrCfg.status == RGR_ENABLE)
- {
- rgSCHCmnNonDlfsSFRCmnChannelUpdTyp2Alloc(cell, dlSf,
- allocInfo->allocInfo.raType2.rbStart,
- allocInfo->allocInfo.raType2.numRb);
- }
- else
-#endif /* end of ifndef LTE_TDD*/
- {
- rgSCHCmnNonDlfsUpdTyp2Alloc(cell, dlSf,
- allocInfo->allocInfo.raType2.rbStart,
- allocInfo->allocInfo.raType2.numRb);
- }
-
- /* LTE_ADV_FLAG_REMOVED_END */
- /* ccpu00131941 - bwAlloced is updated from SPS bandwidth */
-
-
- return ROK;
-}
-#endif
-
-/**
- * @brief Performs RB allocation for Msg4 for frequency non-selective cell.
- *
- * @details
- *
- * Function : rgSCHCmnNonDlfsMsg4RbAlloc
- *
- * Processing Steps:
- * - Fetch PDCCH
- * - Allocate consecutively available RBs
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchRaCb *raCb
- * @param[in] RgSchDlSf *dlSf
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHCmnNonDlfsMsg4RbAlloc
-(
-RgSchCellCb *cell,
-RgSchRaCb *raCb,
-RgSchDlSf *dlSf
-)
-{
- RgSchDlRbAlloc *allocInfo;
-
-
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_RACB(raCb);
-
-#ifdef RG_5GTF
- RgSchSfBeamInfo *beamInfo = &(dlSf->sfBeamInfo[0]);
- if(beamInfo->totVrbgAllocated > MAX_5GTF_VRBG)
- {
- DU_LOG("\nERROR --> SCH : 5GTF_ERROR : vrbg allocated > 25 :ue (%u)",
- raCb->ue->ueId);
- DU_LOG("\nERROR --> SCH : 5GTF_ERROR vrbg allocated > 25\n");
- return RFAILED;
- }
-#endif
-#ifdef LTEMAC_SPS
- if ((dlSf->spsAllocdBw >= cell->spsBwRbgInfo.numRbs) &&
- (dlSf->bwAlloced == dlSf->bw))
-#else
- if((dlSf->bwAlloced == dlSf->bw) ||
- (allocInfo->rbsReq > (dlSf->bw - dlSf->bwAlloced)))
-#endif
- {
-
- return RFAILED;
- }
-
- /* DTX Changes: One Variable is passed to check whether it is DTX or Not */
- if (raCb->dlHqE->msg4Proc->tbInfo[0].isAckNackDtx == TFU_HQFDB_DTX)
- {
- allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, raCb->ue, dlSf, raCb->ccchCqi, TFU_DCI_FORMAT_B1, TRUE);
- }
- else
- {
- allocInfo->pdcch = rgSCHCmnPdcchAlloc(cell, raCb->ue, dlSf, raCb->ccchCqi, TFU_DCI_FORMAT_B1, FALSE);
- }
- if (!(allocInfo->pdcch))
- {
- /* Returning RFAILED since PDCCH not available for any CCCH allocations */
- return RFAILED;
- }
-
-#ifndef RG_5GTF
- /* SR_RACH_STATS : MSG4 TX Failed */
- allocInfo->pdcch->dci.u.format1aInfo.t.pdschInfo.isTBMsg4 = TRUE;
-
- /* Update allocation information */
- allocInfo->dciFormat = TFU_DCI_FORMAT_1A;
- allocInfo->raType = RG_SCH_CMN_RA_TYPE2;
- allocInfo->allocInfo.raType2.isLocal = TRUE;
-
-
- /*Fix for ccpu00123918*/
- allocInfo->allocInfo.raType2.rbStart = (uint8_t)dlSf->type2Start;
- allocInfo->allocInfo.raType2.numRb = allocInfo->rbsReq;
- /* LTE_ADV_FLAG_REMOVED_START */
-#ifndef LTE_TDD
- if (cell->lteAdvCb.sfrCfg.status == RGR_ENABLE)
- {
- rgSCHCmnNonDlfsSFRCmnChannelUpdTyp2Alloc(cell, dlSf, \
- allocInfo->allocInfo.raType2.rbStart, \
- allocInfo->allocInfo.raType2.numRb);
- }
- else
-#endif /* end of ifndef LTE_TDD */
- {
- rgSCHCmnNonDlfsUpdTyp2Alloc(cell, dlSf, \
- allocInfo->allocInfo.raType2.rbStart, \
- allocInfo->allocInfo.raType2.numRb);
- }
- /* LTE_ADV_FLAG_REMOVED_END */
-
- allocInfo->rbsAlloc = allocInfo->rbsReq;
- allocInfo->tbInfo[0].bytesAlloc = allocInfo->tbInfo[0].bytesReq;
-
-#else
-
- allocInfo->pdcch->dci.u.format1aInfo.t.pdschInfo.isTBMsg4 = TRUE;
-
- allocInfo->tbInfo[0].tbCb->dlGrnt.vrbgStart = beamInfo->vrbgStart;
- allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg = allocInfo->vrbgReq;
-
- /* Update allocation information */
- allocInfo->dciFormat = TFU_DCI_FORMAT_B1;
-
- allocInfo->tbInfo[0].tbCb->dlGrnt.xPDSCHRange = 1;
- allocInfo->tbInfo[0].tbCb->dlGrnt.rbAssign = rgSCHCmnCalcRiv(MAX_5GTF_VRBG,
- allocInfo->tbInfo[0].tbCb->dlGrnt.vrbgStart, allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg);
-
- allocInfo->tbInfo[0].tbCb->dlGrnt.rbStrt = (allocInfo->tbInfo[0].tbCb->dlGrnt.vrbgStart * MAX_5GTF_VRBG_SIZE);
- allocInfo->tbInfo[0].tbCb->dlGrnt.numRb = (allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg * MAX_5GTF_VRBG_SIZE);
-
-
- beamInfo->vrbgStart += allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg;
- beamInfo->totVrbgAllocated += allocInfo->tbInfo[0].tbCb->dlGrnt.numVrbg;
- allocInfo->tbInfo[0].bytesAlloc = allocInfo->tbInfo[0].bytesReq;
-
-#endif
-
- return ROK;
-}
-
-/**
- * @brief Performs RB allocation for Msg4 lists of frequency non-selective cell.
- *
- * @details
- *
- * Function : rgSCHCmnNonDlfsMsg4Alloc
- *
- * Processing Steps:
- * - For each element in the list, Call rgSCHCmnNonDlfsMsg4RbAlloc().
- * - If allocation is successful, add the raCb to scheduled list of MSG4.
- * - else, add RaCb to non-scheduled list.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in, out] RgSchCmnMsg4RbAlloc *allocInfo
- * @param[in] uint8_t isRetx
- *
- * @return Void
- **/
-static Void rgSCHCmnNonDlfsMsg4Alloc
-(
-RgSchCellCb *cell,
-RgSchCmnMsg4RbAlloc *allocInfo,
-uint8_t isRetx
-)
-{
- S16 ret;
- CmLListCp *msg4Lst = NULLP;
- CmLListCp *schdMsg4Lst = NULLP;
- CmLListCp *nonSchdMsg4Lst = NULLP;
- CmLList *schdLnkNode = NULLP;
- CmLList *toBeSchdLnk = NULLP;
- RgSchDlSf *dlSf = allocInfo->msg4DlSf;
- RgSchRaCb *raCb = NULLP;
- RgSchDlHqProcCb *hqP = NULLP;
-
- if (isRetx)
- {
- /* Initialize re-transmitting lists */
- msg4Lst = &(allocInfo->msg4RetxLst);
- schdMsg4Lst = &(allocInfo->schdMsg4RetxLst);
- nonSchdMsg4Lst = &(allocInfo->nonSchdMsg4RetxLst);
- }
- else
- {
- /* Initialize transmitting lists */
- msg4Lst = &(allocInfo->msg4TxLst);
- schdMsg4Lst = &(allocInfo->schdMsg4TxLst);
- nonSchdMsg4Lst = &(allocInfo->nonSchdMsg4TxLst);
- }
-
- /* Perform allocaations for the list */
- toBeSchdLnk = cmLListFirst(msg4Lst);
- for (; toBeSchdLnk; toBeSchdLnk = toBeSchdLnk->next)
- {
- hqP = (RgSchDlHqProcCb *)(toBeSchdLnk->node);
- raCb = hqP->hqE->raCb;
- schdLnkNode = &hqP->schdLstLnk;
- RG_SCH_CMN_INIT_SCHD_LNK(schdLnkNode, hqP);
- ret = rgSCHCmnNonDlfsMsg4RbAlloc(cell, raCb, dlSf);
- if (ret != ROK)
- {
- /* Allocation failed: Add remaining MSG4 nodes to non-scheduled
- * list and return */
- do
- {
- hqP = (RgSchDlHqProcCb *)(toBeSchdLnk->node);
- raCb = hqP->hqE->raCb;
- schdLnkNode = &hqP->schdLstLnk;
- RG_SCH_CMN_INIT_SCHD_LNK(schdLnkNode, hqP);
- cmLListAdd2Tail(nonSchdMsg4Lst, schdLnkNode);
- toBeSchdLnk = toBeSchdLnk->next;
- } while(toBeSchdLnk);
- return;
- }
-
- /* Allocation successful: Add UE to the scheduled list */
- cmLListAdd2Tail(schdMsg4Lst, schdLnkNode);
- if (isRetx)
- {
- }
- }
-
-
- return;
-}
-
-/**
- * @brief Performs RB allocation for the list of UEs of a frequency
- * non-selective cell.
- *
- * @details
- *
- * Function : rgSCHCmnNonDlfsDedRbAlloc
- *
- * Processing Steps:
- * - For each element in the list, Call rgSCHCmnNonDlfsUeRbAlloc().
- * - If allocation is successful, add the ueCb to scheduled list of UEs.
- * - else, add ueCb to non-scheduled list of UEs.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in, out] RgSchCmnUeRbAlloc *allocInfo
- * @param[in] CmLListCp *ueLst,
- * @param[in, out] CmLListCp *schdHqPLst,
- * @param[in, out] CmLListCp *nonSchdHqPLst
- *
- * @return Void
- **/
-Void rgSCHCmnNonDlfsDedRbAlloc
-(
-RgSchCellCb *cell,
-RgSchCmnUeRbAlloc *allocInfo,
-CmLListCp *ueLst,
-CmLListCp *schdHqPLst,
-CmLListCp *nonSchdHqPLst
-)
-{
- S16 ret;
- CmLList *schdLnkNode = NULLP;
- CmLList *toBeSchdLnk = NULLP;
- RgSchDlSf *dlSf = allocInfo->dedDlSf;
- RgSchUeCb *ue = NULLP;
- RgSchDlHqProcCb *hqP = NULLP;
- uint8_t isDlBwAvail;
-
-
- /* Perform allocaations for the list */
- toBeSchdLnk = cmLListFirst(ueLst);
- for (; toBeSchdLnk; toBeSchdLnk = toBeSchdLnk->next)
- {
- hqP = (RgSchDlHqProcCb *)(toBeSchdLnk->node);
- ue = hqP->hqE->ue;
- schdLnkNode = &hqP->schdLstLnk;
- RG_SCH_CMN_INIT_SCHD_LNK(schdLnkNode, hqP);
-
- ret = rgSCHCmnNonDlfsUeRbAlloc(cell, ue, dlSf, &isDlBwAvail);
- if (!isDlBwAvail)
- {
- /* Allocation failed: Add remaining UEs to non-scheduled
- * list and return */
- do
- {
- hqP = (RgSchDlHqProcCb *)(toBeSchdLnk->node);
- ue = hqP->hqE->ue;
- schdLnkNode = &hqP->schdLstLnk;
- RG_SCH_CMN_INIT_SCHD_LNK(schdLnkNode, hqP);
- cmLListAdd2Tail(nonSchdHqPLst, schdLnkNode);
- toBeSchdLnk = toBeSchdLnk->next;
- } while(toBeSchdLnk);
- break;
- }
-
- if (ret == ROK)
- {
-#if defined (TENB_STATS) && defined (RG_5GTF)
- cell->tenbStats->sch.dl5gtfRbAllocPass++;
-#endif
- /* Allocation successful: Add UE to the scheduled list */
- cmLListAdd2Tail(schdHqPLst, schdLnkNode);
- }
- else
- {
-#if defined (TENB_STATS) && defined (RG_5GTF)
- cell->tenbStats->sch.dl5gtfRbAllocFail++;
-#endif
- /* Allocation failed : Add UE to the non-scheduled list */
- DU_LOG("\nERROR --> SCH : 5GTF_ERROR Dl rb alloc failed adding nonSchdHqPLst\n");
- cmLListAdd2Tail(nonSchdHqPLst, schdLnkNode);
- }
- }
-
- return;
-}
-
-/**
- * @brief Handles RB allocation for frequency non-selective cell.
- *
- * @details
- *
- * Function : rgSCHCmnNonDlfsRbAlloc
- *
- * Invoking Module Processing:
- * - SCH shall invoke this if downlink frequency selective is disabled for
- * the cell for RB allocation.
- * - MAX C/I/PFS/RR shall provide the requiredBytes, required RBs
- * estimate and subframe for each allocation to be made to SCH.
- *
- * Processing Steps:
- * - Allocate sequentially for common channels.
- * - For transmitting and re-transmitting UE list.
- * - For each UE:
- * - Perform wide-band allocations for UE in increasing order of
- * frequency.
- * - Determine Imcs for the allocation.
- * - Determine RA type.
- * - Determine DCI format.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- **/
-
-Void rgSCHCmnNonDlfsRbAlloc
-(
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *allocInfo
-)
-{
- uint8_t raRspCnt = 0;
- RgSchDlRbAlloc *reqAllocInfo;
-
- /* Allocate for MSG4 retransmissions */
- if (allocInfo->msg4Alloc.msg4RetxLst.count)
- {
- DU_LOG("\nINFO --> SCH : 5GTF_ERROR rgSCHCmnNonDlfsMsg4Alloc RetxLst\n");
- rgSCHCmnNonDlfsMsg4Alloc(cell, &(allocInfo->msg4Alloc), TRUE);
- }
-
- /* Allocate for MSG4 transmissions */
- /* Assuming all the nodes in the list need allocations: rbsReq is valid */
- if (allocInfo->msg4Alloc.msg4TxLst.count)
- {
- DU_LOG("\nINFO --> SCH : 5GTF_ERROR rgSCHCmnNonDlfsMsg4Alloc txLst\n");
- rgSCHCmnNonDlfsMsg4Alloc(cell, &(allocInfo->msg4Alloc), FALSE);
- }
-#ifdef RGR_V1
- /* Allocate for CCCH SDU (received after guard timer expiry)
- * retransmissions */
- if (allocInfo->ccchSduAlloc.ccchSduRetxLst.count)
- {
- DU_LOG("\nINFO --> SCH : 5GTF_ERROR rgSCHCmnNonDlfsCcchSduAlloc\n");
- rgSCHCmnNonDlfsCcchSduAlloc(cell, &(allocInfo->ccchSduAlloc), TRUE);
- }
-
- /* Allocate for CCCD SDU transmissions */
- /* Allocate for CCCH SDU (received after guard timer expiry) transmissions */
- if (allocInfo->ccchSduAlloc.ccchSduTxLst.count)
- {
- DU_LOG("\nINFO --> SCH : 5GTF_ERROR rgSCHCmnNonDlfsCcchSduAlloc\n");
- rgSCHCmnNonDlfsCcchSduAlloc(cell, &(allocInfo->ccchSduAlloc), FALSE);
- }
-#endif
-
- /* Allocate for Random access response */
- for (raRspCnt = 0; raRspCnt < RG_SCH_CMN_MAX_CMN_PDCCH; ++raRspCnt)
- {
- /* Assuming that the requests will be filled in sequentially */
- reqAllocInfo = &(allocInfo->raRspAlloc[raRspCnt]);
- if (!reqAllocInfo->rbsReq)
- {
- break;
- }
- DU_LOG("\nINFO --> SCH : 5GTF_ERROR calling RAR rgSCHCmnNonDlfsCmnRbAlloc\n");
- // if ((rgSCHCmnNonDlfsCmnRbAlloc(cell, reqAllocInfo)) != ROK)
- if ((rgSCHCmnNonDlfsCmnRbAllocRar(cell, reqAllocInfo)) != ROK)
- {
- break;
- }
- }
-
- /* Allocate for RETX+TX UEs */
- if(allocInfo->dedAlloc.txRetxHqPLst.count)
- {
- DU_LOG("\nDEBUG --> SCH : 5GTF_ERROR TX RETX rgSCHCmnNonDlfsDedRbAlloc\n");
- rgSCHCmnNonDlfsDedRbAlloc(cell, &(allocInfo->dedAlloc),
- &(allocInfo->dedAlloc.txRetxHqPLst),
- &(allocInfo->dedAlloc.schdTxRetxHqPLst),
- &(allocInfo->dedAlloc.nonSchdTxRetxHqPLst));
- }
-
- if((allocInfo->dedAlloc.retxHqPLst.count))
- {
- rgSCHCmnNonDlfsDedRbAlloc(cell, &(allocInfo->dedAlloc),
- &(allocInfo->dedAlloc.retxHqPLst),
- &(allocInfo->dedAlloc.schdRetxHqPLst),
- &(allocInfo->dedAlloc.nonSchdRetxHqPLst));
- }
-
- /* Allocate for transmitting UEs */
- if((allocInfo->dedAlloc.txHqPLst.count))
- {
- rgSCHCmnNonDlfsDedRbAlloc(cell, &(allocInfo->dedAlloc),
- &(allocInfo->dedAlloc.txHqPLst),
- &(allocInfo->dedAlloc.schdTxHqPLst),
- &(allocInfo->dedAlloc.nonSchdTxHqPLst));
- }
- {
- RgSchCmnCell *cmnCell = RG_SCH_CMN_GET_CELL(cell);
- if ((allocInfo->dedAlloc.txRetxHqPLst.count +
- allocInfo->dedAlloc.retxHqPLst.count +
- allocInfo->dedAlloc.txHqPLst.count) >
- cmnCell->dl.maxUePerDlSf)
- {
-#ifndef ALIGN_64BIT
- DU_LOG("\nERROR --> SCH : UEs selected by"
- " scheduler exceed maximumUePerDlSf(%u)tx-retx %ld retx %ld tx %ld\n",
- cmnCell->dl.maxUePerDlSf, allocInfo->dedAlloc.txRetxHqPLst.count,
- allocInfo->dedAlloc.retxHqPLst.count,
- allocInfo->dedAlloc.txHqPLst.count);
-#else
- DU_LOG("\nERROR --> SCH : UEs selected by"
- " scheduler exceed maximumUePerDlSf(%u)tx-retx %d retx %d tx %d\n",
- cmnCell->dl.maxUePerDlSf, allocInfo->dedAlloc.txRetxHqPLst.count,
- allocInfo->dedAlloc.retxHqPLst.count,
- allocInfo->dedAlloc.txHqPLst.count);
-#endif
- }
- }
-#ifndef LTE_TDD
- /* LTE_ADV_FLAG_REMOVED_START */
- if(cell->lteAdvCb.dsfrCfg.status == RGR_ENABLE)
- {
- DU_LOG("\nINFO --> SCH : 5GTF_ERROR RETX rgSCHCmnNonDlfsDsfrRntpComp\n");
- rgSCHCmnNonDlfsDsfrRntpComp(cell, allocInfo->dedAlloc.dedDlSf);
- }
- /* LTE_ADV_FLAG_REMOVED_END */
-#endif /* LTE_TDD */
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHCmnCalcRiv
- *
- * Desc : This function calculates RIV.
- *
- * Ret : None.
- *
- * Notes: None.
- *
- * File : rg_sch_utl.c
- *
- **********************************************************/
-#ifdef LTEMAC_SPS
-uint32_t rgSCHCmnCalcRiv
-(
-uint8_t bw,
-uint8_t rbStart,
-uint8_t numRb
-)
-#else
-uint32_t rgSCHCmnCalcRiv
-(
-uint8_t bw,
-uint8_t rbStart,
-uint8_t numRb
-)
-#endif
-{
- uint8_t numRbMinus1 = numRb - 1;
- uint32_t riv;
-
-
- if (numRbMinus1 <= bw/2)
- {
- riv = bw * numRbMinus1 + rbStart;
- }
- else
- {
- riv = bw * (bw - numRbMinus1) + (bw - rbStart - 1);
- }
- return (riv);
-} /* rgSCHCmnCalcRiv */
-
-#ifdef LTE_TDD
-/**
- * @brief This function allocates and copies the RACH response scheduling
- * related information into cell control block.
- *
- * @details
- *
- * Function: rgSCHCmnDlCpyRachInfo
- * Purpose: This function allocates and copies the RACH response
- * scheduling related information into cell control block
- * for each DL subframe.
- *
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchTddRachRspLst rachRspLst[][RGSCH_NUM_SUB_FRAMES]
- * @param[in] uint8_t raArrSz
- * @return S16
- *
- **/
-static S16 rgSCHCmnDlCpyRachInfo
-(
-RgSchCellCb *cell,
-RgSchTddRachRspLst rachRspLst[][RGSCH_NUM_SUB_FRAMES],
-uint8_t raArrSz
-)
-{
- uint8_t ulDlCfgIdx = cell->ulDlCfgIdx;
- uint8_t sfNum;
- S16 sfnIdx;
- uint16_t subfrmIdx;
- uint8_t numRfs;
- uint8_t numSubfrms;
- uint8_t sfcount;
- S16 ret;
-
-
- /* Allocate RACH response information for each DL
- * subframe in a radio frame */
- ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&cell->rachRspLst,
- rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1] *
- sizeof(RgSchTddRachRspLst));
- if (ret != ROK)
- {
- return (ret);
- }
-
- for(sfnIdx=raArrSz-1; sfnIdx>=0; sfnIdx--)
- {
- for(subfrmIdx=0; subfrmIdx < RGSCH_NUM_SUB_FRAMES; subfrmIdx++)
- {
- subfrmIdx = rgSchTddHighDlSubfrmIdxTbl[ulDlCfgIdx][subfrmIdx];
- if(subfrmIdx == RGSCH_NUM_SUB_FRAMES)
- {
- break;
- }
-
- RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rachRspLst[sfnIdx],subfrmIdx);
- numSubfrms =
- rachRspLst[sfnIdx][subfrmIdx].rachRsp[0].numSubfrms;
-
- RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, rgSchTddNumDlSubfrmTbl[ulDlCfgIdx],subfrmIdx);
- sfNum = rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][subfrmIdx]-1;
- numRfs = cell->rachRspLst[sfNum].numRadiofrms;
- /* For each DL subframe in which RACH response can
- * be sent is updated */
- if(numSubfrms > 0)
- {
- cell->rachRspLst[sfNum].rachRsp[numRfs].sfnOffset =
- rachRspLst[sfnIdx][subfrmIdx].rachRsp[0].sfnOffset;
- for(sfcount=0; sfcount < numSubfrms; sfcount++)
- {
- cell->rachRspLst[sfNum].rachRsp[numRfs].\
- subframe[sfcount] =
- rachRspLst[sfnIdx][subfrmIdx].rachRsp[0].\
- subframe[sfcount];
- }
- cell->rachRspLst[sfNum].rachRsp[numRfs].numSubfrms =
- rachRspLst[sfnIdx][subfrmIdx].rachRsp[0].numSubfrms;
- cell->rachRspLst[sfNum].numRadiofrms++;
- }
-
- /* Copy the subframes to be deleted at ths subframe */
- numSubfrms =
- rachRspLst[sfnIdx][subfrmIdx].delInfo.numSubfrms;
- if(numSubfrms > 0)
- {
- cell->rachRspLst[sfNum].delInfo.sfnOffset =
- rachRspLst[sfnIdx][subfrmIdx].delInfo.sfnOffset;
- for(sfcount=0; sfcount < numSubfrms; sfcount++)
- {
- cell->rachRspLst[sfNum].delInfo.subframe[sfcount] =
- rachRspLst[sfnIdx][subfrmIdx].delInfo.subframe[sfcount];
- }
- cell->rachRspLst[sfNum].delInfo.numSubfrms =
- rachRspLst[sfnIdx][subfrmIdx].delInfo.numSubfrms;
- }
- }
- }
- return ROK;
-}
-#endif
-/**
- * @brief This function determines the iTbs based on the new CFI,
- * CQI and BLER based delta iTbs
- *
- * @details
- *
- * Function: rgSchCmnFetchItbs
- * Purpose: Fetch the new iTbs when CFI changes.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchCmnDlUe *ueDl
- * @param[in] uint8_t cqi
- *
- * @return S32 iTbs
- *
- **/
-#ifdef LTE_TDD
-static S32 rgSchCmnFetchItbs
-(
-RgSchCellCb *cell,
-RgSchCmnDlUe *ueDl,
-RgSchDlSf *subFrm,
-uint8_t cqi,
-uint8_t cfi,
-uint8_t cwIdx,
-uint8_t noLyr
-)
-#else
-static S32 rgSchCmnFetchItbs
-(
-RgSchCellCb *cell,
-RgSchCmnDlUe *ueDl,
-uint8_t cqi,
-uint8_t cfi,
-uint8_t cwIdx,
-uint8_t noLyr
-)
-#endif
-{
-
- RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
- S32 iTbs = 0;
-
-
-#ifdef LTE_TDD
- /* Special Handling for Spl Sf when CFI is 3 as
- * CFI in Spl Sf will be max 2 */
- if(subFrm->sfType == RG_SCH_SPL_SF_DATA)
- {
- if((cellDl->currCfi == 3) ||
- ((cell->bwCfg.dlTotalBw <= 10) && (cellDl->currCfi == 1)))
- {
- /* Use CFI 2 in this case */
- iTbs = (ueDl->laCb[cwIdx].deltaiTbs +
- ((*(RgSchCmnCqiToTbs *)(cellDl->cqiToTbsTbl[0][2]))[cqi])* 100)/100;
-
- RG_SCH_CHK_ITBS_RANGE(iTbs, RGSCH_NUM_ITBS - 1);
- }
- else
- {
- iTbs = ueDl->mimoInfo.cwInfo[cwIdx].iTbs[noLyr - 1];
- }
- iTbs = RGSCH_MIN(iTbs, cell->thresholds.maxDlItbs);
- }
- else /* CFI Changed. Update with new iTbs Reset the BLER*/
-#endif
- {
- S32 tmpiTbs = (*(RgSchCmnCqiToTbs *)(cellDl->cqiToTbsTbl[0][cfi]))[cqi];
-
- iTbs = (ueDl->laCb[cwIdx].deltaiTbs + tmpiTbs*100)/100;
-
- RG_SCH_CHK_ITBS_RANGE(iTbs, tmpiTbs);
-
- iTbs = RGSCH_MIN(iTbs, cell->thresholds.maxDlItbs);
-
- ueDl->mimoInfo.cwInfo[cwIdx].iTbs[noLyr - 1] = iTbs;
-
- ueDl->lastCfi = cfi;
- ueDl->laCb[cwIdx].deltaiTbs = 0;
- }
-
- return (iTbs);
-}
-\f
-/**
- * @brief This function determines the RBs and Bytes required for BO
- * transmission for UEs configured with TM 1/2/6/7.
- *
- * @details
- *
- * Function: rgSCHCmnDlAllocTxRb1Tb1Cw
- * Purpose: Allocate TB1 on CW1.
- *
- * Reference Parameter effBo is filled with alloced bytes.
- * Returns RFAILED if BO not satisfied at all.
- *
- * Invoked by: rgSCHCmnDlAllocTxRbTM1/2/6/7
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *effBo
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlAllocTxRb1Tb1Cw
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-)
-{
- RgSchDlRbAlloc *allocInfo;
- S16 ret;
- uint8_t numRb;
-
- ret = ROK;
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell);
-#ifdef RG_5GTF
- if (ue->ue5gtfCb.rank == 2)
- {
- allocInfo->dciFormat = TFU_DCI_FORMAT_B2;
- }
- else
- {
- allocInfo->dciFormat = TFU_DCI_FORMAT_B1;
- }
-#else
- allocInfo->dciFormat = rgSCHCmnSlctPdcchFrmt(cell, ue, \
- allocInfo->raType);
-#endif
- ret = rgSCHCmnDlAlloc1CwTxRb(cell, subFrm, ue, &proc->tbInfo[0],\
- bo, &numRb, effBo);
- if (ret == RFAILED)
- {
- /* If allocation couldn't be made then return */
- return;
- }
- /* Adding UE to RbAllocInfo TX Lst */
- rgSCHCmnDlRbInfoAddUeTx(cell, cellWdAllocInfo, ue, proc);
- /* Fill UE alloc Info */
- allocInfo->rbsReq = numRb;
- allocInfo->dlSf = subFrm;
-#ifdef RG_5GTF
- allocInfo->vrbgReq = numRb/MAX_5GTF_VRBG_SIZE;
-#endif
-
- return;
-}
-
-\f
-/**
- * @brief This function determines the RBs and Bytes required for BO
- * retransmission for UEs configured with TM 1/2/6/7.
- *
- * @details
- *
- * Function: rgSCHCmnDlAllocRetxRb1Tb1Cw
- * Purpose: Allocate TB1 on CW1.
- *
- * Reference Parameter effBo is filled with alloced bytes.
- * Returns RFAILED if BO not satisfied at all.
- *
- * Invoked by: rgSCHCmnDlAllocRetxRbTM1/2/6/7
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *effBo
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlAllocRetxRb1Tb1Cw
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-)
-{
- RgSchDlRbAlloc *allocInfo;
- S16 ret;
- uint8_t numRb;
-
- ret = ROK;
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell);
-
-#ifndef RG_5GTF
- /* 5GTF: RETX DCI format same as TX */
- allocInfo->dciFormat = rgSCHCmnSlctPdcchFrmt(cell, ue, \
- &allocInfo->raType);
-#endif
-
- /* Get the Allocation in terms of RBs that are required for
- * this retx of TB1 */
- ret = rgSCHCmnDlAlloc1CwRetxRb(cell, subFrm, ue, &proc->tbInfo[0],
- 1, &numRb, effBo);
- if (ret == RFAILED)
- {
- /* Allocation couldn't be made for Retx */
- /* Fix : syed If TxRetx allocation failed then add the UE along with the proc
- * to the nonSchdTxRetxUeLst and let spfc scheduler take care of it during
- * finalization. */
- rgSCHCmnDlAdd2NonSchdRetxLst(cellWdAllocInfo, ue, proc);
- return;
- }
- rgSCHCmnDlRbInfoAddUeRetx(cell, cellWdAllocInfo, ue, proc);
- /* Fill UE alloc Info */
- allocInfo->rbsReq = numRb;
- allocInfo->dlSf = subFrm;
-#ifdef RG_5GTF
- allocInfo->vrbgReq = numRb/MAX_5GTF_VRBG_SIZE;
-#endif
-
- return;
-}
-
-\f
-/**
- * @brief This function determines the RBs and Bytes required for BO
- * transmission for UEs configured with TM 2.
- *
- * @details
- *
- * Function: rgSCHCmnDlAllocTxRbTM1
- * Purpose:
- *
- * Reference Parameter effBo is filled with alloced bytes.
- * Returns RFAILED if BO not satisfied at all.
- *
- * Invoked by: rgSCHCmnDlAllocTxRb
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *effBo
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlAllocTxRbTM1
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-)
-{
- rgSCHCmnDlAllocTxRb1Tb1Cw(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo);
- return;
-}
-
-\f
-/**
- * @brief This function determines the RBs and Bytes required for BO
- * retransmission for UEs configured with TM 2.
- *
- * @details
- *
- * Function: rgSCHCmnDlAllocRetxRbTM1
- * Purpose:
- *
- * Reference Parameter effBo is filled with alloced bytes.
- * Returns RFAILED if BO not satisfied at all.
- *
- * Invoked by: rgSCHCmnDlAllocRetxRb
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *effBo
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlAllocRetxRbTM1
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-)
-{
- rgSCHCmnDlAllocRetxRb1Tb1Cw(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo);
- return;
-}
-
-\f
-/**
- * @brief This function determines the RBs and Bytes required for BO
- * transmission for UEs configured with TM 2.
- *
- * @details
- *
- * Function: rgSCHCmnDlAllocTxRbTM2
- * Purpose:
- *
- * Reference Parameter effBo is filled with alloced bytes.
- * Returns RFAILED if BO not satisfied at all.
- *
- * Invoked by: rgSCHCmnDlAllocTxRb
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *effBo
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlAllocTxRbTM2
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-)
-{
- rgSCHCmnDlAllocTxRb1Tb1Cw(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo);
- return;
-}
-
-\f
-/**
- * @brief This function determines the RBs and Bytes required for BO
- * retransmission for UEs configured with TM 2.
- *
- * @details
- *
- * Function: rgSCHCmnDlAllocRetxRbTM2
- * Purpose:
- *
- * Reference Parameter effBo is filled with alloced bytes.
- * Returns RFAILED if BO not satisfied at all.
- *
- * Invoked by: rgSCHCmnDlAllocRetxRb
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *effBo
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlAllocRetxRbTM2
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-)
-{
- rgSCHCmnDlAllocRetxRb1Tb1Cw(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo);
- return;
-}
-
-\f
-/**
- * @brief This function determines the RBs and Bytes required for BO
- * transmission for UEs configured with TM 3.
- *
- * @details
- *
- * Function: rgSCHCmnDlAllocTxRbTM3
- * Purpose:
- *
- * Reference Parameter effBo is filled with alloced bytes.
- * Returns RFAILED if BO not satisfied at all.
- *
- * Invoked by: rgSCHCmnDlAllocTxRb
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *effBo
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlAllocTxRbTM3
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-)
-{
-
-
- /* Both TBs free for TX allocation */
- rgSCHCmnDlTM3TxTx(cell, subFrm, ue, bo, effBo,\
- proc, cellWdAllocInfo);
-
- return;
-}
-
-\f
-/**
- * @brief This function determines the RBs and Bytes required for BO
- * retransmission for UEs configured with TM 3.
- *
- * @details
- *
- * Function: rgSCHCmnDlAllocRetxRbTM3
- * Purpose:
- *
- * Reference Parameter effBo is filled with alloced bytes.
- * Returns RFAILED if BO not satisfied at all.
- *
- * Invoked by: rgSCHCmnDlAllocRetxRb
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *effBo
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlAllocRetxRbTM3
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-)
-{
-
-
- if ((proc->tbInfo[0].state == HQ_TB_NACKED) &&
- (proc->tbInfo[1].state == HQ_TB_NACKED))
- {
-#ifdef LAA_DBG_LOG
- DU_LOG("\nDEBUG --> SCH : RETX RB TM3 nack for both hqp %d cell %d \n", proc->procId, proc->hqE->cell->cellId);
-#endif
- /* Both TBs require RETX allocation */
- rgSCHCmnDlTM3RetxRetx(cell, subFrm, ue, bo, effBo,\
- proc, cellWdAllocInfo);
- }
- else
- {
- /* One of the TBs need RETX allocation. Other TB may/maynot
- * be available for new TX allocation. */
- rgSCHCmnDlTM3TxRetx(cell, subFrm, ue, bo, effBo,\
- proc, cellWdAllocInfo);
- }
-
- return;
-}
-
-\f
-/**
- * @brief This function performs the DCI format selection in case of
- * Transmit Diversity scheme where there can be more
- * than 1 option for DCI format selection.
- *
- * @details
- *
- * Function: rgSCHCmnSlctPdcchFrmt
- * Purpose: 1. If DLFS is enabled, then choose TM specific
- * DCI format for Transmit diversity. All the
- * TM Specific DCI Formats support Type0 and/or
- * Type1 resource allocation scheme. DLFS
- * supports only Type-0&1 Resource allocation.
- * 2. If DLFS is not enabled, select a DCI format
- * which is of smaller size. Since Non-DLFS
- * scheduler supports all Resource allocation
- * schemes, selection is based on efficiency.
- *
- * Invoked by: DL UE Allocation by Common Scheduler.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[out] uint8_t *raType
- * @return TfuDciFormat
- *
- **/
-TfuDciFormat rgSCHCmnSlctPdcchFrmt
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint8_t *raType
-)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-
-
- /* ccpu00140894- Selective DCI Format and RA type should be selected only
- * after TX Mode transition is completed*/
- if ((cellSch->dl.isDlFreqSel) && (ue->txModeTransCmplt))
- {
- *raType = rgSchCmnDciFrmtOptns[ue->mimoInfo.txMode-1].spfcDciRAType;
- return (rgSchCmnDciFrmtOptns[ue->mimoInfo.txMode-1].spfcDciFrmt);
- }
- else
- {
- *raType = rgSchCmnDciFrmtOptns[ue->mimoInfo.txMode-1].prfrdDciRAType;
- return (rgSchCmnDciFrmtOptns[ue->mimoInfo.txMode-1].prfrdDciFrmt);
- }
-}
-
-\f
-/**
- * @brief This function handles Retx allocation in case of TM3 UEs
- * where both the TBs were NACKED previously.
- *
- * @details
- *
- * Function: rgSCHCmnDlTM3RetxRetx
- * Purpose: If forceTD flag enabled
- * TD for TB1 on CW1.
- * Else
- * DCI Frmt 2A and RA Type 0
- * RI layered SM of both TBs on 2 CWs
- * Add UE to cell Alloc Info.
- * Fill UE alloc Info.
- *
- *
- * Successful allocation is indicated by non-zero effBo value.
- *
- * Invoked by: rgSCHCmnDlAllocRbTM3
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *effBo
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlTM3RetxRetx
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-)
-{
- S16 ret;
- RgSchDlRbAlloc *allocInfo;
- uint8_t numRb;
- Bool swpFlg;
- uint8_t precInfo;
- uint8_t noTxLyrs;
- uint8_t precInfoAntIdx;
-
-
- ret = ROK;
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell);
- swpFlg = FALSE;
-/* Fix for ccpu00123927: Retransmit 2 codewords irrespective of current rank */
- {
- allocInfo->dciFormat = TFU_DCI_FORMAT_2A;
- allocInfo->raType = RG_SCH_CMN_RA_TYPE0;
-
- ret = rgSCHCmnDlAlloc2CwRetxRb(cell, subFrm, ue, proc, &numRb, &swpFlg,\
- effBo);
- if (ret == RFAILED)
- {
- /* Allocation couldn't be made for Retx */
- rgSCHCmnDlAdd2NonSchdRetxLst(cellWdAllocInfo, ue, proc);
- return;
- }
- /* Fix for ccpu00123927: Retransmit 2 codewords irrespective of current rank */
- noTxLyrs = proc->tbInfo[0].numLyrs + proc->tbInfo[1].numLyrs;
-#ifdef FOUR_TX_ANTENNA
- /*Chandra: For 4X4 MIM RETX with noTxLyrs=3, CW0 should be 1-LyrTB and CW1 should
- * have 2-LyrTB as per Table 6.3.3.2-1 of 36.211 */
- if(noTxLyrs == 3 && proc->tbInfo[0].numLyrs==2)
- {
- swpFlg = TRUE;
- proc->cwSwpEnabled = TRUE;
- }
-#endif
- precInfoAntIdx = cell->numTxAntPorts/2 - 1;
- precInfo = (getPrecInfoFunc[0][precInfoAntIdx])(cell, ue, noTxLyrs, TRUE);
- }
-
-#ifdef LTEMAC_SPS
- if (!RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc))
-#endif
- {
- /* Adding UE to allocInfo RETX Lst */
- rgSCHCmnDlRbInfoAddUeRetx(cell, cellWdAllocInfo, ue, proc);
- }
- /* Fill UE alloc Info scratch pad */
- RG_SCH_CMN_FILL_DL_TXINFO(allocInfo, numRb, swpFlg, \
- precInfo, noTxLyrs, subFrm);
-
- return;
-}
-
-\f
-/**
- * @brief This function handles Retx allocation in case of TM4 UEs
- * where both the TBs were NACKED previously.
- *
- * @details
- *
- * Function: rgSCHCmnDlTM4RetxRetx
- * Purpose: If forceTD flag enabled
- * TD for TB1 on CW1.
- * Else
- * DCI Frmt 2 and RA Type 0
- * If RI == 1
- * 1 layer SM of TB1 on CW1.
- * Else
- * RI layered SM of both TBs on 2 CWs
- * Add UE to cell Alloc Info.
- * Fill UE alloc Info.
- *
- *
- * Successful allocation is indicated by non-zero effBo value.
- *
- * Invoked by: rgSCHCmnDlAllocRbTM4
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *effBo
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlTM4RetxRetx
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-)
-{
- S16 ret;
- RgSchDlRbAlloc *allocInfo;
- uint8_t numRb;
- Bool swpFlg = FALSE;
- uint8_t precInfo;
-#ifdef FOUR_TX_ANTENNA
- uint8_t precInfoAntIdx;
-#endif
- uint8_t noTxLyrs;
-
-
- ret = ROK;
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell);
-
- /* Irrespective of RI Schedule both CWs */
- allocInfo->dciFormat = TFU_DCI_FORMAT_2;
- allocInfo->raType = RG_SCH_CMN_RA_TYPE0;
-
- ret = rgSCHCmnDlAlloc2CwRetxRb(cell, subFrm, ue, proc, &numRb, &swpFlg,\
- effBo);
- if (ret == RFAILED)
- {
- /* Allocation couldn't be made for Retx */
- rgSCHCmnDlAdd2NonSchdRetxLst(cellWdAllocInfo, ue, proc);
- return;
- }
- noTxLyrs = proc->tbInfo[0].numLyrs + proc->tbInfo[1].numLyrs;
- precInfo = 0;
-#ifdef FOUR_TX_ANTENNA
- /*Chandra: For 4X4 MIM RETX with noTxLyrs=3, CW0 should be 1-LyrTB and CW1
- * should have 2-LyrTB as per Table 6.3.3.2-1 of 36.211 */
- if(noTxLyrs == 3 && proc->tbInfo[0].numLyrs==2)
- {
- swpFlg = TRUE;
- proc->cwSwpEnabled = TRUE;
-}
-precInfoAntIdx = cell->numTxAntPorts/2 - 1;
-precInfo = (getPrecInfoFunc[1][precInfoAntIdx])(cell, ue, noTxLyrs, TRUE);
-#endif
-
-#ifdef LTEMAC_SPS
- if (!RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc))
-#endif
- {
- /* Adding UE to allocInfo RETX Lst */
- rgSCHCmnDlRbInfoAddUeRetx(cell, cellWdAllocInfo, ue, proc);
- }
- /* Fill UE alloc Info scratch pad */
- RG_SCH_CMN_FILL_DL_TXINFO(allocInfo, numRb, swpFlg, \
- precInfo, noTxLyrs, subFrm);
-
- return;
-}
-
-
-\f
-/**
- * @brief This function determines Transmission attributes
- * incase of Spatial multiplexing for TX and RETX TBs.
- *
- * @details
- *
- * Function: rgSCHCmnDlSMGetAttrForTxRetx
- * Purpose: 1. Reached here for a TM3/4 UE's HqP whose one of the TBs is
- * NACKED and the other TB is either NACKED or WAITING.
- * 2. Select the NACKED TB for RETX allocation.
- * 3. Allocation preference for RETX TB by mapping it to a better
- * CW (better in terms of efficiency).
- * 4. Determine the state of the other TB.
- * Determine if swapFlag were to be set.
- * Swap flag would be set if Retx TB is cross
- * mapped to a CW.
- * 5. If UE has new data available for TX and if the other TB's state
- * is ACKED then set furtherScope as TRUE.
- *
- * Invoked by: rgSCHCmnDlTM3[4]TxRetx
- *
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchDlHqTbCb **retxTb
- * @param[out] RgSchDlHqTbCb **txTb
- * @param[out] Bool *frthrScp
- * @param[out] Bool *swpFlg
- * @return Void
- *
- **/
-static Void rgSCHCmnDlSMGetAttrForTxRetx
-(
-RgSchUeCb *ue,
-RgSchDlHqProcCb *proc,
-RgSchDlHqTbCb **retxTb,
-RgSchDlHqTbCb **txTb,
-Bool *frthrScp,
-Bool *swpFlg
-)
-{
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,proc->hqE->cell);
- RgSchDlRbAlloc *allocInfo;
-
-
- if (proc->tbInfo[0].state == HQ_TB_NACKED)
- {
- *retxTb = &proc->tbInfo[0];
- *txTb = &proc->tbInfo[1];
- /* TENB_BRDCM_TM4- Currently disabling swapflag for TM3/TM4, since
- * HqFeedback processing does not consider a swapped hq feedback */
- if ((ue->mimoInfo.txMode == RGR_UE_TM_4) && (ueDl->mimoInfo.btrCwIdx == 1))
- {
- *swpFlg = TRUE;
- proc->cwSwpEnabled = TRUE;
- }
- if (proc->tbInfo[1].state == HQ_TB_ACKED)
- {
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, proc->hqE->cell);
- *frthrScp = allocInfo->mimoAllocInfo.hasNewTxData;
- }
- }
- else
- {
- *retxTb = &proc->tbInfo[1];
- *txTb = &proc->tbInfo[0];
- /* TENB_BRDCM_TM4 - Currently disabling swapflag for TM3/TM4, since
- * HqFeedback processing does not consider a swapped hq feedback */
- if ((ue->mimoInfo.txMode == RGR_UE_TM_4) && (ueDl->mimoInfo.btrCwIdx == 0))
- {
- *swpFlg = TRUE;
- proc->cwSwpEnabled = TRUE;
- }
- if (proc->tbInfo[0].state == HQ_TB_ACKED)
- {
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, proc->hqE->cell);
- *frthrScp = allocInfo->mimoAllocInfo.hasNewTxData;
- }
- }
- return;
-}
-
-\f
-/**
- * @brief Determine Precoding information for TM3 2 TX Antenna.
- *
- * @details
- *
- * Function: rgSCHCmnDlTM3PrecInf2
- * Purpose:
- *
- * Invoked by: rgSCHCmnDlGetAttrForTM3
- *
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t numTxLyrs
- * @param[in] Bool bothCwEnbld
- * @return uint8_t
- *
- **/
-static uint8_t rgSCHCmnDlTM3PrecInf2
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint8_t numTxLyrs,
-Bool bothCwEnbld
-)
-{
-
- return (0);
-}
-
-\f
-/**
- * @brief Determine Precoding information for TM4 2 TX Antenna.
- *
- * @details
- *
- * Function: rgSCHCmnDlTM4PrecInf2
- * Purpose: To determine a logic of deriving precoding index
- * information from 36.212 table 5.3.3.1.5-4
- *
- * Invoked by: rgSCHCmnDlGetAttrForTM4
- *
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t numTxLyrs
- * @param[in] Bool bothCwEnbld
- * @return uint8_t
- *
- **/
-static uint8_t rgSCHCmnDlTM4PrecInf2
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint8_t numTxLyrs,
-Bool bothCwEnbld
-)
-{
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- uint8_t precIdx;
-
-
- if (ueDl->mimoInfo.ri == numTxLyrs)
- {
- if (ueDl->mimoInfo.ri == 2)
- {
- /* PrecInfo corresponding to 2 CW
- Transmission */
- if (ue->mimoInfo.puschFdbkVld)
- {
- precIdx = 2;
- }
- else
- {
- precIdx = ueDl->mimoInfo.pmi - 1;
- }
- }
- else
- {
- /* PrecInfo corresponding to 1 CW
- * Transmission */
- if (ue->mimoInfo.puschFdbkVld)
- {
- precIdx = 5;
- }
- else
- {
- precIdx = ueDl->mimoInfo.pmi + 1;
- }
- }
- }
- else if (ueDl->mimoInfo.ri > numTxLyrs)
- {
- /* In case of choosing among the columns of a
- * precoding matrix, choose the column corresponding
- * to the MAX-CQI */
- if (ue->mimoInfo.puschFdbkVld)
- {
- precIdx = 5;
- }
- else
- {
- precIdx = (ueDl->mimoInfo.pmi- 1)* 2 + 1;
- }
- }
- else /* if RI < numTxLyrs */
- {
- precIdx = (ueDl->mimoInfo.pmi < 2)? 0:1;
- }
- return (precIdx);
-}
-
-\f
-/**
- * @brief Determine Precoding information for TM3 4 TX Antenna.
- *
- * @details
- *
- * Function: rgSCHCmnDlTM3PrecInf4
- * Purpose: To determine a logic of deriving precoding index
- * information from 36.212 table 5.3.3.1.5A-2
- *
- * Invoked by: rgSCHCmnDlGetAttrForTM3
- *
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t numTxLyrs
- * @param[in] Bool bothCwEnbld
- * @return uint8_t
- *
- **/
-static uint8_t rgSCHCmnDlTM3PrecInf4
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint8_t numTxLyrs,
-Bool bothCwEnbld
-)
-{
- uint8_t precIdx;
-
-
- if (bothCwEnbld)
- {
- precIdx = numTxLyrs - 2;
- }
- else /* one 1 CW transmission */
- {
- precIdx = 1;
- }
- return (precIdx);
-}
-
-\f
-/**
- * @brief Determine Precoding information for TM4 4 TX Antenna.
- *
- * @details
- *
- * Function: rgSCHCmnDlTM4PrecInf4
- * Purpose: To determine a logic of deriving precoding index
- * information from 36.212 table 5.3.3.1.5-5
- *
- * Invoked by: rgSCHCmnDlGetAttrForTM4
- *
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t numTxLyrs
- * @param[in] Bool bothCwEnbld
- * @return uint8_t
- *
- **/
-static uint8_t rgSCHCmnDlTM4PrecInf4
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint8_t numTxLyrs,
-Bool bothCwEnbld
-)
-{
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- uint8_t precInfoBaseIdx, precIdx;
-
-
- precInfoBaseIdx = (ue->mimoInfo.puschFdbkVld)? (16):
- (ueDl->mimoInfo.pmi);
- if (bothCwEnbld)
- {
- precIdx = precInfoBaseIdx + (numTxLyrs-2)*17;
- }
- else /* one 1 CW transmission */
- {
- precInfoBaseIdx += 1;
- precIdx = precInfoBaseIdx + (numTxLyrs-1)*17;
- }
- return (precIdx);
-}
-
-\f
-/**
- * @brief This function determines Transmission attributes
- * incase of TM3 scheduling.
- *
- * @details
- *
- * Function: rgSCHCmnDlGetAttrForTM3
- * Purpose: Determine retx TB and tx TB based on TB states.
- * If forceTD enabled
- * perform only retx TB allocation.
- * If retxTB == TB2 then DCI Frmt = 2A, RA Type = 0.
- * Else DCI Frmt and RA Type based on cell->isDlfsEnbld
- * If RI == 1
- * perform retxTB allocation on CW1.
- * Else if RI > 1
- * Determine further Scope and Swap Flag attributes
- * assuming a 2 CW transmission of RetxTB and new Tx TB.
- * If no further scope for new TX allocation
- * Allocate only retx TB using 2 layers if
- * this TB was previously transmitted using 2 layers AND
- * number of Tx antenna ports == 4.
- * otherwise do single layer precoding.
- *
- * Invoked by: rgSCHCmnDlTM3TxRetx
- *
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] uint8_t *numTxLyrs
- * @param[out] Bool *isTraDiv
- * @param[out] uint8_t *prcdngInf
- * @param[out] uint8_t *raType
- * @return Void
- *
- **/
-static Void rgSCHCmnDlGetAttrForTM3
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlHqProcCb *proc,
-uint8_t *numTxLyrs,
-TfuDciFormat *dciFrmt,
-uint8_t *prcdngInf,
-RgSchDlHqTbCb **retxTb,
-RgSchDlHqTbCb **txTb,
-Bool *frthrScp,
-Bool *swpFlg,
-uint8_t *raType
-)
-{
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- uint8_t precInfoAntIdx;
-
-
- /* Avoiding Tx-Retx for LAA cell as firstSchedTime is associated with
- HQP */
- /* Integration_fix: SPS Proc shall always have only one Cw */
-#ifdef LTEMAC_SPS
- if (((RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) ||
- (ueDl->mimoInfo.forceTD))
-#ifdef LTE_ADV
- ||(TRUE == rgSCHLaaSCellEnabled(cell))
-#endif
- )
-#else
- if ((ueDl->mimoInfo.forceTD)
-#ifdef LTE_ADV
- || (TRUE == rgSCHLaaSCellEnabled(cell))
-#endif
- )
-#endif
- {
- /* Transmit Diversity. Format based on dlfsEnabled
- * No further scope */
- if (proc->tbInfo[0].state == HQ_TB_NACKED)
- {
- *retxTb = &proc->tbInfo[0];
- *dciFrmt = rgSCHCmnSlctPdcchFrmt(cell, ue, raType);
- }
- else
- {
- *retxTb = &proc->tbInfo[1];
- *dciFrmt = TFU_DCI_FORMAT_2A;
- *raType = RG_SCH_CMN_RA_TYPE0;
- }
- *numTxLyrs = 1;
- *frthrScp = FALSE;
- *prcdngInf = 0;
- return;
- }
-
- /* Determine the 2 TB transmission attributes */
- rgSCHCmnDlSMGetAttrForTxRetx(ue, proc, retxTb, txTb, \
- frthrScp, swpFlg);
- if (*frthrScp)
- {
- /* Prefer allocation of RETX TB over 2 layers rather than combining
- * it with a new TX. */
- if ((ueDl->mimoInfo.ri == 2)
- && ((*retxTb)->numLyrs == 2) && (cell->numTxAntPorts == 4))
- {
- /* Allocate TB on CW1, using 2 Lyrs,
- * Format 2, precoding accordingly */
- *numTxLyrs = 2;
- *frthrScp = FALSE;
- }
- else
- {
- *numTxLyrs= ((*retxTb)->numLyrs + ueDl->mimoInfo.cwInfo[!(ueDl->mimoInfo.btrCwIdx)].noLyr);
-
- if((*retxTb)->tbIdx == 0 && ((*retxTb)->numLyrs == 2 ) && *numTxLyrs ==3)
- {
- *swpFlg = TRUE;
- proc->cwSwpEnabled = TRUE;
- }
- else if((*retxTb)->tbIdx == 1 && ((*retxTb)->numLyrs == 1) && *numTxLyrs ==3)
- {
- *swpFlg = TRUE;
- proc->cwSwpEnabled = TRUE;
- }
- }
-
- precInfoAntIdx = cell->numTxAntPorts/2 - 1;
- *prcdngInf = (getPrecInfoFunc[0][precInfoAntIdx])\
- (cell, ue, ueDl->mimoInfo.ri, *frthrScp);
- *dciFrmt = TFU_DCI_FORMAT_2A;
- *raType = RG_SCH_CMN_RA_TYPE0;
- }
- else /* frthrScp == FALSE */
- {
- if (cell->numTxAntPorts == 2)
- {
- /* Transmit Diversity */
- *numTxLyrs = 1;
- if ((*retxTb)->tbIdx == 0)
- {
- *dciFrmt = rgSCHCmnSlctPdcchFrmt(cell, ue, raType);
- }
- else
- {
- /* If retxTB is TB2 then use format 2A */
- *dciFrmt = TFU_DCI_FORMAT_2A;
- *raType = RG_SCH_CMN_RA_TYPE0;
- }
- *prcdngInf = 0;
- return;
- }
- else /* NumAntPorts == 4 */
- {
- if ((*retxTb)->numLyrs == 2)
- {
- /* Allocate TB on CW1, using 2 Lyrs,
- * Format 2A, precoding accordingly */
- *numTxLyrs = 2;
- *dciFrmt = TFU_DCI_FORMAT_2A;
- *raType = RG_SCH_CMN_RA_TYPE0;
- precInfoAntIdx = cell->numTxAntPorts/2 - 1;
- *prcdngInf = (getPrecInfoFunc[0][precInfoAntIdx])(cell, ue, *numTxLyrs, *frthrScp);
- return;
- }
- else
- {
- /* Transmit Diversity */
- *numTxLyrs = 1;
- if ((*retxTb)->tbIdx == 0)
- {
- *dciFrmt = rgSCHCmnSlctPdcchFrmt(cell, ue, raType);
- }
- else
- {
- /* If retxTB is TB2 then use format 2A */
- *dciFrmt = TFU_DCI_FORMAT_2A;
- *raType = RG_SCH_CMN_RA_TYPE0;
- }
- *prcdngInf = 0;
- return;
- }
- }
- }
-
- return;
-}
-
-
-\f
-/**
- * @brief This function determines Transmission attributes
- * incase of TM4 scheduling.
- *
- * @details
- *
- * Function: rgSCHCmnDlGetAttrForTM4
- * Purpose: Determine retx TB and tx TB based on TB states.
- * If forceTD enabled
- * perform only retx TB allocation.
- * If retxTB == TB2 then DCI Frmt = 2, RA Type = 0.
- * Else DCI Frmt and RA Type based on cell->isDlfsEnbld
- * If RI == 1
- * perform retxTB allocation on CW1.
- * Else if RI > 1
- * Determine further Scope and Swap Flag attributes
- * assuming a 2 CW transmission of RetxTB and new Tx TB.
- * If no further scope for new TX allocation
- * Allocate only retx TB using 2 layers if
- * this TB was previously transmitted using 2 layers AND
- * number of Tx antenna ports == 4.
- * otherwise do single layer precoding.
- *
- * Invoked by: rgSCHCmnDlTM4TxRetx
- *
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] uint8_t *numTxLyrs
- * @param[out] Bool *isTraDiv
- * @param[out] uint8_t *prcdngInf
- * @param[out] uint8_t *raType
- * @return Void
- *
- **/
-static Void rgSCHCmnDlGetAttrForTM4
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlHqProcCb *proc,
-uint8_t *numTxLyrs,
-TfuDciFormat *dciFrmt,
-uint8_t *prcdngInf,
-RgSchDlHqTbCb **retxTb,
-RgSchDlHqTbCb **txTb,
-Bool *frthrScp,
-Bool *swpFlg,
-uint8_t *raType
-)
-{
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- uint8_t precInfoAntIdx;
-
-
- *frthrScp = FALSE;
- /* Integration_fix: SPS Proc shall always have only one Cw */
-#ifdef LTEMAC_SPS
- if (((RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) ||
- (ueDl->mimoInfo.forceTD))
-#ifdef LTE_ADV
- ||(TRUE == rgSCHLaaSCellEnabled(cell))
-#endif
- )
-#else
- if ((ueDl->mimoInfo.forceTD)
-#ifdef LTE_ADV
- || (TRUE == rgSCHLaaSCellEnabled(cell))
-#endif
- )
-#endif
- {
- /* Transmit Diversity. Format based on dlfsEnabled
- * No further scope */
- if (proc->tbInfo[0].state == HQ_TB_NACKED)
- {
- *retxTb = &proc->tbInfo[0];
- *dciFrmt = rgSCHCmnSlctPdcchFrmt(cell, ue, raType);
- }
- else
- {
- *retxTb = &proc->tbInfo[1];
- *dciFrmt = TFU_DCI_FORMAT_2;
- *raType = RG_SCH_CMN_RA_TYPE0;
- }
- *numTxLyrs = 1;
- *frthrScp = FALSE;
- *prcdngInf = 0;
- return;
- }
-
- if (ueDl->mimoInfo.ri == 1)
- {
- /* single layer precoding. Format 2.
- * No further scope */
- if (proc->tbInfo[0].state == HQ_TB_NACKED)
- {
- *retxTb = &proc->tbInfo[0];
- }
- else
- {
- *retxTb = &proc->tbInfo[1];
- }
- *numTxLyrs = 1;
- *dciFrmt = TFU_DCI_FORMAT_2;
- *raType = RG_SCH_CMN_RA_TYPE0;
- *frthrScp = FALSE;
- *prcdngInf = 0; /*When RI= 1*/
- return;
- }
-
- /* Determine the 2 TB transmission attributes */
- rgSCHCmnDlSMGetAttrForTxRetx(ue, proc, retxTb, txTb, \
- frthrScp, swpFlg);
- *dciFrmt = TFU_DCI_FORMAT_2;
- *raType = RG_SCH_CMN_RA_TYPE0;
- if (*frthrScp)
- {
- /* Prefer allocation of RETX TB over 2 layers rather than combining
- * it with a new TX. */
- if ((ueDl->mimoInfo.ri == 2)
- && ((*retxTb)->numLyrs == 2) && (cell->numTxAntPorts == 4))
- {
- /* Allocate TB on CW1, using 2 Lyrs,
- * Format 2, precoding accordingly */
- *numTxLyrs = 2;
- *frthrScp = FALSE;
- }
- precInfoAntIdx = cell->numTxAntPorts/2 - 1;
- *prcdngInf = (getPrecInfoFunc[1][precInfoAntIdx])
- (cell, ue, ueDl->mimoInfo.ri, *frthrScp);
- }
- else /* frthrScp == FALSE */
- {
- if (cell->numTxAntPorts == 2)
- {
- /* single layer precoding. Format 2. */
- *numTxLyrs = 1;
- *prcdngInf = (getPrecInfoFunc[1][cell->numTxAntPorts/2 - 1])\
- (cell, ue, *numTxLyrs, *frthrScp);
- return;
- }
- else /* NumAntPorts == 4 */
- {
- if ((*retxTb)->numLyrs == 2)
- {
- /* Allocate TB on CW1, using 2 Lyrs,
- * Format 2, precoding accordingly */
- *numTxLyrs = 2;
- precInfoAntIdx = cell->numTxAntPorts/2 - 1;
- *prcdngInf = (getPrecInfoFunc[1][precInfoAntIdx])\
- (cell, ue, *numTxLyrs, *frthrScp);
- return;
- }
- else
- {
- /* Allocate TB with 1 lyr precoding,
- * Format 2, precoding info accordingly */
- *numTxLyrs = 1;
- precInfoAntIdx = cell->numTxAntPorts/2 - 1;
- *prcdngInf = (getPrecInfoFunc[1][precInfoAntIdx])\
- (cell, ue, *numTxLyrs, *frthrScp);
- return;
- }
- }
- }
-
- return;
-}
-
-\f
-/**
- * @brief This function handles Retx allocation in case of TM3 UEs
- * where previously one of the TBs was NACKED and the other
- * TB is either ACKED/WAITING.
- *
- * @details
- *
- * Function: rgSCHCmnDlTM3TxRetx
- * Purpose: Determine the TX attributes for TM3 TxRetx Allocation.
- * If futher Scope for New Tx Allocation on other TB
- * Perform RETX alloc'n on 1 CW and TX alloc'n on other.
- * Add UE to cell wide RetxTx List.
- * Else
- * Perform only RETX alloc'n on CW1.
- * Add UE to cell wide Retx List.
- *
- * effBo is set to a non-zero value if allocation is
- * successful.
- *
- * Invoked by: rgSCHCmnDlAllocRbTM3
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *effBo
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlTM3TxRetx
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-)
-{
- S16 ret;
- RgSchDlRbAlloc *allocInfo;
- uint8_t numRb;
- RgSchDlHqTbCb *retxTb, *txTb;
- Bool frthrScp;
- Bool swpFlg;
- uint8_t prcdngInf;
- uint8_t numTxLyrs;
-
- frthrScp = FALSE;
-
- ret = ROK;
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell);
- swpFlg = FALSE;
-
- /* Determine the transmission attributes */
- rgSCHCmnDlGetAttrForTM3(cell, ue, proc, &numTxLyrs, &allocInfo->dciFormat,\
- &prcdngInf, &retxTb, &txTb, &frthrScp, &swpFlg,\
- &allocInfo->raType);
-
- if (frthrScp)
- {
-#ifdef LAA_DBG_LOG
- DU_LOG("\nDEBUG --> SCH : TX RETX called from proc %d cell %d \n",proc->procId, cell->cellId);
-#endif
- ret = rgSCHCmnDlAlloc2CwTxRetxRb(cell, subFrm, ue, retxTb, txTb,\
- &numRb, effBo);
- if (ret == RFAILED)
- {
- /* Allocation couldn't be made for Retx */
- rgSCHCmnDlAdd2NonSchdRetxLst(cellWdAllocInfo, ue, proc);
- return;
- }
- /* Adding UE to RbAllocInfo RETX-TX Lst */
- rgSCHCmnDlRbInfoAddUeRetxTx(cell, cellWdAllocInfo, ue, proc);
- }
- else
- {
- ret = rgSCHCmnDlAlloc1CwRetxRb(cell, subFrm, ue, retxTb,
- numTxLyrs, &numRb, effBo);
- if (ret == RFAILED)
- {
- /* Allocation couldn't be made for Retx */
- rgSCHCmnDlAdd2NonSchdRetxLst(cellWdAllocInfo, ue, proc);
- return;
- }
-#ifdef LTEMAC_SPS
- if (!RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc))
-#endif
- {
- /* Adding UE to allocInfo RETX Lst */
- rgSCHCmnDlRbInfoAddUeRetx(cell, cellWdAllocInfo, ue, proc);
- }
- }
- RG_SCH_CMN_FILL_DL_TXINFO(allocInfo, numRb, swpFlg, \
- prcdngInf, numTxLyrs, subFrm);
-
- return;
-}
-
-\f
-/**
- * @brief This function handles Retx allocation in case of TM4 UEs
- * where previously one of the TBs was NACKED and the other
- * TB is either ACKED/WAITING.
- *
- * @details
- *
- * Function: rgSCHCmnDlTM4TxRetx
- * Purpose: Determine the TX attributes for TM4 TxRetx Allocation.
- * If futher Scope for New Tx Allocation on other TB
- * Perform RETX alloc'n on 1 CW and TX alloc'n on other.
- * Add UE to cell wide RetxTx List.
- * Else
- * Perform only RETX alloc'n on CW1.
- * Add UE to cell wide Retx List.
- *
- * effBo is set to a non-zero value if allocation is
- * successful.
- *
- * Invoked by: rgSCHCmnDlAllocRbTM4
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *effBo
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlTM4TxRetx
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-)
-{
- S16 ret;
- RgSchDlRbAlloc *allocInfo;
- uint8_t numRb;
- RgSchDlHqTbCb *retxTb, *txTb;
- Bool frthrScp;
- Bool swpFlg;
- uint8_t prcdngInf;
- uint8_t numTxLyrs;
-
-
- ret = ROK;
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell);
- swpFlg = FALSE;
-
- /* Determine the transmission attributes */
- rgSCHCmnDlGetAttrForTM4(cell, ue, proc, &numTxLyrs, &allocInfo->dciFormat,\
- &prcdngInf, &retxTb, &txTb, &frthrScp, &swpFlg,\
- &allocInfo->raType);
-
- if (frthrScp)
- {
- ret = rgSCHCmnDlAlloc2CwTxRetxRb(cell, subFrm, ue, retxTb, txTb,\
- &numRb, effBo);
- if (ret == RFAILED)
- {
- /* Fix : syed If TxRetx allocation failed then add the UE along
- * with the proc to the nonSchdTxRetxUeLst and let spfc scheduler
- * take care of it during finalization. */
- rgSCHCmnDlAdd2NonSchdRetxLst(cellWdAllocInfo, ue, proc);
- return;
- }
- /* Adding UE to RbAllocInfo RETX-TX Lst */
- rgSCHCmnDlRbInfoAddUeRetxTx(cell, cellWdAllocInfo, ue, proc);
- }
- else
- {
- ret = rgSCHCmnDlAlloc1CwRetxRb(cell, subFrm, ue, retxTb,
- numTxLyrs, &numRb, effBo);
- if (ret == RFAILED)
- {
- /* Allocation couldn't be made for Retx */
- rgSCHCmnDlAdd2NonSchdRetxLst(cellWdAllocInfo, ue, proc);
- return;
- }
-#ifdef LTEMAC_SPS
- if (!RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc))
-#endif
- {
- /* Adding UE to allocInfo RETX Lst */
- rgSCHCmnDlRbInfoAddUeRetx(cell, cellWdAllocInfo, ue, proc);
- }
- }
- RG_SCH_CMN_FILL_DL_TXINFO(allocInfo, numRb, swpFlg, \
- prcdngInf, numTxLyrs, subFrm)
-
- return;
-}
-
-\f
-/**
- * @brief This function handles Retx allocation in case of TM4 UEs
- * where previously both the TBs were ACKED and ACKED
- * respectively.
- *
- * @details
- *
- * Function: rgSCHCmnDlTM3TxTx
- * Purpose: Reached here for a TM3 UE's HqP's fresh allocation
- * where both the TBs are free for TX scheduling.
- * If forceTD flag is set
- * perform TD on CW1 with TB1.
- * precInfo = 0
- * else
- * DCI Format = 2A.
- * RA Type = Type0.
- * RI layered precoding 2 TB on 2 CW.
- * Set precoding info.
- * Add UE to cellAllocInfo.
- * Fill ueAllocInfo.
- *
- * effBo is set to a non-zero value if allocation is
- * successful.
- *
- * Invoked by: rgSCHCmnDlAllocRbTM3
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *effBo
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlTM3TxTx
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-)
-{
- RgSchCmnDlUe *ueDl;
- RgSchDlRbAlloc *allocInfo;
- uint8_t numRb;
- uint8_t noTxLyrs;
- uint8_t precInfo;
- S16 ret;
- uint8_t precInfoAntIdx;
-
-
- ret = ROK;
- ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell);
-
- /* Integration_fix: SPS Proc shall always have only one Cw */
-#ifdef LTEMAC_SPS
-#ifdef FOUR_TX_ANTENNA
- if ((RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) ||
- (ueDl->mimoInfo.forceTD) || proc->hasDcch) /*Chandra Avoid DCCH to be SM */
-#else
- if ((RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) ||
- (ueDl->mimoInfo.forceTD))
-#endif
-#else
- if (ueDl->mimoInfo.forceTD) /* Transmit Diversity (TD) */
-#endif
- {
- allocInfo->dciFormat = rgSCHCmnSlctPdcchFrmt(cell, ue, \
- &allocInfo->raType);
- ret = rgSCHCmnDlAlloc1CwTxRb(cell, subFrm, ue, &proc->tbInfo[0],\
- bo, &numRb, effBo);
- if (ret == RFAILED)
- {
- /* If allocation couldn't be made then return */
- return;
- }
- noTxLyrs = 1;
- precInfo = 0; /* TD */
- }
- else /* Precoding */
- {
- allocInfo->dciFormat = TFU_DCI_FORMAT_2A;
- allocInfo->raType = RG_SCH_CMN_RA_TYPE0;
-
- /* Spatial Multiplexing using 2 CWs */
- ret = rgSCHCmnDlAlloc2CwTxRb(cell, subFrm, ue, proc, bo, &numRb, effBo);
- if (ret == RFAILED)
- {
- /* If allocation couldn't be made then return */
- return;
- }
- noTxLyrs = ueDl->mimoInfo.ri;
- precInfoAntIdx = cell->numTxAntPorts/2 - 1;
- RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, getPrecInfoFunc[0], precInfoAntIdx);
- precInfo = (getPrecInfoFunc[0][precInfoAntIdx])(cell, ue, noTxLyrs, TRUE);
- }
-
-#ifdef LTEMAC_SPS
- if (!RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc))
-#endif
- {
- /* Adding UE to RbAllocInfo TX Lst */
- rgSCHCmnDlRbInfoAddUeTx(cell, cellWdAllocInfo, ue, proc);
- }
- /* Fill UE allocInfo scrath pad */
- RG_SCH_CMN_FILL_DL_TXINFO(allocInfo, numRb, FALSE, \
- precInfo, noTxLyrs, subFrm);
-
- return;
-}
-
-\f
-/**
- * @brief This function handles Retx allocation in case of TM4 UEs
- * where previously both the TBs were ACKED and ACKED
- * respectively.
- *
- * @details
- *
- * Function: rgSCHCmnDlTM4TxTx
- * Purpose: Reached here for a TM4 UE's HqP's fresh allocation
- * where both the TBs are free for TX scheduling.
- * If forceTD flag is set
- * perform TD on CW1 with TB1.
- * precInfo = 0
- * else
- * DCI Format = 2.
- * RA Type = Type0.
- * If Rank == 1
- * Single layer precoding of TB1 on CW1.
- * Set precoding info.
- * else
- * RI layered precoding 2 TB on 2 CW.
- * Set precoding info.
- * Add UE to cellAllocInfo.
- * Fill ueAllocInfo.
- *
- * effBo is set to a non-zero value if allocation is
- * successful.
- *
- * Invoked by: rgSCHCmnDlAllocRbTM4
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *effBo
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlTM4TxTx
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-)
-{
- RgSchCmnDlUe *ueDl;
- RgSchDlRbAlloc *allocInfo;
- uint8_t numRb;
- uint8_t precInfo;
- uint8_t noTxLyrs;
- uint8_t precInfoAntIdx;
- S16 ret;
-
-
- ret = ROK;
- ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell);
-
- /* Integration_fix: SPS Proc shall always have only one Cw */
-#ifdef LTEMAC_SPS
-#ifdef FOUR_TX_ANTENNA
- if ((RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) ||
- (ueDl->mimoInfo.forceTD) || proc->hasDcch) /*Chandra Avoid DCCH to be SM */
-#else
- if ((RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc)) ||
- (ueDl->mimoInfo.forceTD))
-#endif
-#else
- if (ueDl->mimoInfo.forceTD) /* Transmit Diversity (TD) */
-#endif
- {
- allocInfo->dciFormat = rgSCHCmnSlctPdcchFrmt(cell, ue, \
- &allocInfo->raType);
-
- ret = rgSCHCmnDlAlloc1CwTxRb(cell, subFrm, ue, &proc->tbInfo[0],\
- bo, &numRb, effBo);
- if (ret == RFAILED)
- {
- /* If allocation couldn't be made then return */
- return;
- }
- noTxLyrs = 1;
- precInfo = 0; /* TD */
- }
- else /* Precoding */
- {
- allocInfo->dciFormat = TFU_DCI_FORMAT_2;
- allocInfo->raType = RG_SCH_CMN_RA_TYPE0;
-
- if (ueDl->mimoInfo.ri == 1)
- {
- /* Single Layer SM using FORMAT 2 */
- ret = rgSCHCmnDlAlloc1CwTxRb(cell, subFrm, ue, &proc->tbInfo[0],\
- bo, &numRb, effBo);
- if (ret == RFAILED)
- {
- /* If allocation couldn't be made then return */
- return;
- }
- noTxLyrs = 1;
- precInfo = 0; /* PrecInfo as 0 for RI=1*/
- }
- else
- {
- /* Spatial Multiplexing using 2 CWs */
- ret = rgSCHCmnDlAlloc2CwTxRb(cell, subFrm, ue, proc, bo, &numRb, effBo);
- if (ret == RFAILED)
- {
- /* If allocation couldn't be made then return */
- return;
- }
- noTxLyrs = ueDl->mimoInfo.ri;
- precInfoAntIdx = cell->numTxAntPorts/2 - 1;
- precInfo = (getPrecInfoFunc[1][precInfoAntIdx])(cell, ue, noTxLyrs, TRUE);
- }
- }
-
-
-#ifdef LTEMAC_SPS
- if (!RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc))
-#endif
- {
- /* Adding UE to RbAllocInfo TX Lst */
- rgSCHCmnDlRbInfoAddUeTx(cell, cellWdAllocInfo, ue, proc);
- }
-
- /* Fill UE allocInfo scrath pad */
- RG_SCH_CMN_FILL_DL_TXINFO(allocInfo, numRb, FALSE, \
- precInfo, noTxLyrs, subFrm);
-
- return;
-}
-
-\f
-/**
- * @brief This function determines the RBs and Bytes required for BO
- * transmission for UEs configured with TM 4.
- *
- * @details
- *
- * Function: rgSCHCmnDlAllocTxRbTM4
- * Purpose: Invokes the functionality particular to the
- * current state of the TBs of the "proc".
- *
- * Reference Parameter effBo is filled with alloced bytes.
- * Returns RFAILED if BO not satisfied at all.
- *
- * Invoked by: rgSCHCmnDlAllocTxRb
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *effBo
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlAllocTxRbTM4
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-)
-{
-
- /* Both TBs free for TX allocation */
- rgSCHCmnDlTM4TxTx(cell, subFrm, ue, bo, effBo,\
- proc, cellWdAllocInfo);
-
- return;
-}
-
-\f
-/**
- * @brief This function determines the RBs and Bytes required for BO
- * retransmission for UEs configured with TM 4.
- *
- * @details
- *
- * Function: rgSCHCmnDlAllocRetxRbTM4
- * Purpose: Invokes the functionality particular to the
- * current state of the TBs of the "proc".
- *
- * Reference Parameter effBo is filled with alloced bytes.
- * Returns RFAILED if BO not satisfied at all.
- *
- * Invoked by: rgSCHCmnDlAllocRetxRb
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *effBo
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlAllocRetxRbTM4
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-)
-{
-
- if ((proc->tbInfo[0].state == HQ_TB_NACKED) &&
- (proc->tbInfo[1].state == HQ_TB_NACKED))
- {
- /* Both TBs require RETX allocation */
- rgSCHCmnDlTM4RetxRetx(cell, subFrm, ue, bo, effBo,\
- proc, cellWdAllocInfo);
- }
- else
- {
- /* One of the TBs need RETX allocation. Other TB may/maynot
- * be available for new TX allocation. */
- rgSCHCmnDlTM4TxRetx(cell, subFrm, ue, bo, effBo,\
- proc, cellWdAllocInfo);
- }
-
- return;
-}
-
-#ifdef RG_UNUSED
-\f
-/**
- * @brief This function determines the RBs and Bytes required for BO
- * transmission for UEs configured with TM 5.
- *
- * @details
- *
- * Function: rgSCHCmnDlAllocTxRbTM5
- * Purpose:
- *
- * Reference Parameter effBo is filled with alloced bytes.
- * Returns RFAILED if BO not satisfied at all.
- *
- * Invoked by: rgSCHCmnDlAllocTxRb
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *effBo
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlAllocTxRbTM5
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-)
-{
-#if (ERRCLASS & ERRCLS_DEBUG)
- DU_LOG("\nERROR --> SCH : Invalid TM 5 for CRNTI:%d",ue->ueId);
-#endif
- return;
-}
-
-\f
-/**
- * @brief This function determines the RBs and Bytes required for BO
- * retransmission for UEs configured with TM 5.
- *
- * @details
- *
- * Function: rgSCHCmnDlAllocRetxRbTM5
- * Purpose:
- *
- * Reference Parameter effBo is filled with alloced bytes.
- * Returns RFAILED if BO not satisfied at all.
- *
- * Invoked by: rgSCHCmnDlAllocRetxRb
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *effBo
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlAllocRetxRbTM5
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-)
-{
-#if (ERRCLASS & ERRCLS_DEBUG)
- DU_LOG("\nERROR --> SCH : Invalid TM 5 for CRNTI:%d",ue->ueId);
-#endif
- return;
-}
-#endif
-
-\f
-/**
- * @brief This function determines the RBs and Bytes required for BO
- * transmission for UEs configured with TM 6.
- *
- * @details
- *
- * Function: rgSCHCmnDlAllocTxRbTM6
- * Purpose:
- *
- * Reference Parameter effBo is filled with alloced bytes.
- * Returns RFAILED if BO not satisfied at all.
- *
- * Invoked by: rgSCHCmnDlAllocTxRb
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *effBo
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlAllocTxRbTM6
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-)
-{
- RgSchDlRbAlloc *allocInfo;
- RgSchCmnDlUe *ueDl;
- S16 ret;
- uint8_t numRb;
-
-
- ret = ROK;
- ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell);
-
- if (ueDl->mimoInfo.forceTD)
- {
- allocInfo->dciFormat = TFU_DCI_FORMAT_1A;
- allocInfo->raType = RG_SCH_CMN_RA_TYPE2;
- }
- else
- {
- allocInfo->dciFormat = TFU_DCI_FORMAT_1B;
- allocInfo->raType = RG_SCH_CMN_RA_TYPE2;
- /* Fill precoding information for FORMAT 1B */
- /* First 4 least significant bits to indicate PMI.
- * 4th most significant corresponds to pmi Confirmation.
- */
- allocInfo->mimoAllocInfo.precIdxInfo |= ue->mimoInfo.puschFdbkVld << 4;
- allocInfo->mimoAllocInfo.precIdxInfo |= ueDl->mimoInfo.pmi;
- }
- ret = rgSCHCmnDlAlloc1CwTxRb(cell, subFrm, ue, &proc->tbInfo[0],\
- bo, &numRb, effBo);
- if (ret == RFAILED)
- {
- /* If allocation couldn't be made then return */
- return;
- }
-
-#ifdef LTEMAC_SPS
- if (!RG_SCH_CMN_SPS_DL_IS_SPS_HQP(proc))
-#endif
- {
- /* Adding UE to RbAllocInfo TX Lst */
- rgSCHCmnDlRbInfoAddUeTx(cell, cellWdAllocInfo, ue, proc);
- }
- /* Fill UE alloc Info */
- allocInfo->rbsReq = numRb;
- allocInfo->dlSf = subFrm;
- return;
-}
-
-\f
-/**
- * @brief This function determines the RBs and Bytes required for BO
- * retransmission for UEs configured with TM 6.
- *
- * @details
- *
- * Function: rgSCHCmnDlAllocRetxRbTM6
- * Purpose:
- *
- * Reference Parameter effBo is filled with alloced bytes.
- * Returns RFAILED if BO not satisfied at all.
- *
- * Invoked by: rgSCHCmnDlAllocRetxRb
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *effBo
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlAllocRetxRbTM6
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-)
-{
- RgSchDlRbAlloc *allocInfo;
- RgSchCmnDlUe *ueDl;
- S16 ret;
- uint8_t numRb;
-
-
- ret = ROK;
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell);
- ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
-
- if (ueDl->mimoInfo.forceTD)
- {
- allocInfo->dciFormat = TFU_DCI_FORMAT_1A;
- allocInfo->raType = RG_SCH_CMN_RA_TYPE2;
- }
- else
- {
- allocInfo->dciFormat = TFU_DCI_FORMAT_1B;
- allocInfo->raType = RG_SCH_CMN_RA_TYPE2;
- /* Fill precoding information for FORMAT 1B */
- /* First 4 least significant bits to indicate PMI.
- * 4th most significant corresponds to pmi Confirmation.
- */
- allocInfo->mimoAllocInfo.precIdxInfo |= ue->mimoInfo.puschFdbkVld << 4;
- allocInfo->mimoAllocInfo.precIdxInfo |= ueDl->mimoInfo.pmi;
- }
-
- /* Get the Allocation in terms of RBs that are required for
- * this retx of TB1 */
- ret = rgSCHCmnDlAlloc1CwRetxRb(cell, subFrm, ue, &proc->tbInfo[0],
- 1, &numRb, effBo);
- if (ret == RFAILED)
- {
- /* Allocation couldn't be made for Retx */
- rgSCHCmnDlAdd2NonSchdRetxLst(cellWdAllocInfo, ue, proc);
- return;
- }
- /* Adding UE to allocInfo RETX Lst */
- rgSCHCmnDlRbInfoAddUeRetx(cell, cellWdAllocInfo, ue, proc);
- /* Fill UE alloc Info */
- allocInfo->rbsReq = numRb;
- allocInfo->dlSf = subFrm;
- return;
-}
-
-\f
-/**
- * @brief This function determines the RBs and Bytes required for BO
- * transmission for UEs configured with TM 7.
- *
- * @details
- *
- * Function: rgSCHCmnDlAllocTxRbTM7
- * Purpose:
- *
- * Reference Parameter effBo is filled with alloced bytes.
- * Returns RFAILED if BO not satisfied at all.
- *
- * Invoked by: rgSCHCmnDlAllocTxRb
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *effBo
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlAllocTxRbTM7
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-)
-{
- rgSCHCmnDlAllocTxRb1Tb1Cw(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo);
- return;
-}
-
-\f
-/**
- * @brief This function determines the RBs and Bytes required for BO
- * retransmission for UEs configured with TM 7.
- *
- * @details
- *
- * Function: rgSCHCmnDlAllocRetxRbTM7
- * Purpose:
- *
- * Reference Parameter effBo is filled with alloced bytes.
- * Returns RFAILED if BO not satisfied at all.
- *
- * Invoked by: rgSCHCmnDlAllocRetxRb
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *effBo
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo
- * @return Void
- *
- **/
-static Void rgSCHCmnDlAllocRetxRbTM7
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-)
-{
- rgSCHCmnDlAllocRetxRb1Tb1Cw(cell, subFrm, ue, bo, effBo, proc, cellWdAllocInfo);
- return;
-}
-
-\f
-/**
- * @brief This function invokes the TM specific DL TX RB Allocation routine.
- *
- * @details
- *
- * Function: rgSCHCmnDlAllocTxRb
- * Purpose: This function invokes the TM specific
- * DL TX RB Allocation routine.
- *
- * Invoked by: Specific Schedulers
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *effBo
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo
- * @return S16
- *
- **/
-S16 rgSCHCmnDlAllocTxRb
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-)
-{
- uint32_t newSchBits = 0;
- uint32_t prevSchBits = 0;
- RgSchDlRbAlloc *allocInfo;
-
-
- if ( !RGSCH_TIMEINFO_SAME((cell->crntTime),(ue->dl.lstSchTime) ))
- {
- ue->dl.aggTbBits = 0;
- }
- *effBo = 0;
-
- /* Calculate totals bits previously allocated */
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell);
- if (allocInfo->tbInfo[0].schdlngForTb)
- {
- prevSchBits += allocInfo->tbInfo[0].bytesReq;
- }
- if (allocInfo->tbInfo[1].schdlngForTb)
- {
- prevSchBits += allocInfo->tbInfo[1].bytesReq;
- }
-
- /* Call TM specific RB allocation routine */
- (dlAllocTxRbFunc[ue->mimoInfo.txMode - 1])(cell, subFrm, ue, bo, effBo, \
- proc, cellWdAllocInfo);
-
- if (*effBo)
- {
- /* Calculate totals bits newly allocated */
- if (allocInfo->tbInfo[0].schdlngForTb)
- {
- newSchBits += allocInfo->tbInfo[0].bytesReq;
- }
- if (allocInfo->tbInfo[1].schdlngForTb)
- {
- newSchBits += allocInfo->tbInfo[1].bytesReq;
- }
- if (newSchBits > prevSchBits)
- {
- ue->dl.aggTbBits += ((newSchBits - prevSchBits) * 8);
- RGSCHCPYTIMEINFO((cell->crntTime),(ue->dl.lstSchTime))
- }
- }
-
- return ROK;
-}
-
-/* DwPTS Scheduling Changes Start */
-#ifdef LTE_TDD
-/**
- * @brief Retransmit decision for TDD. Retx is avoided in below cases
- * 1) DL Sf -> Spl Sf
- * 2) DL SF -> DL SF 0
- *
- * @details
- *
- * Function: rgSCHCmnRetxAvoidTdd
- * Purpose: Avoid allocating RETX for cases 1, 2
- *
- * Invoked by: rgSCHCmnRetxAvoidTdd
- *
- * @param[in] RgSchDlSf *curSf
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlHqProcCb *proc
- * @return Bool
- *
- **/
-Bool rgSCHCmnRetxAvoidTdd
-(
-RgSchDlSf *curSf,
-RgSchCellCb *cell,
-RgSchDlHqProcCb *proc
-)
-{
- RgSchTddSfType txSfType = 0;
-
-
- /* Get the RBs of TB that will be retransmitted */
- if (proc->tbInfo[0].state == HQ_TB_NACKED)
- {
- txSfType = proc->tbInfo[0].sfType;
-
-#ifdef XEON_SPECIFIC_CHANGES
-#ifndef XEON_TDD_SPCL
- /* Avoid re-transmission on Normal SF when the corresponding TB wss transmitted on SPCL SF */
- if(txSfType <= RG_SCH_SPL_SF_DATA && curSf->sfType >= RG_SCH_DL_SF_0)
- {
- return (TRUE);
- }
-#endif
-#endif
- }
- if (proc->tbInfo[1].state == HQ_TB_NACKED)
- {
- /* Select the TxSf with the highest num of possible REs
- * In ascending order -> 1) SPL SF 2) DL_SF_0 3) DL_SF */
- txSfType = RGSCH_MAX(txSfType, proc->tbInfo[1].sfType);
-
-#ifdef XEON_SPECIFIC_CHANGES
-#ifndef XEON_TDD_SPCL
- /* Avoid re-transmission on Normal SF when the corresponding TB wss tranmitted on SPCL SF */
- if(txSfType <= RG_SCH_SPL_SF_DATA && curSf->sfType >= RG_SCH_DL_SF_0)
- {
- return (TRUE);
- }
-#endif
-#endif
- }
-
- if (txSfType > curSf->sfType)
- {
- /* Avoid retx */
- return (TRUE);
- }
-
- /* Allow Retx */
- return (FALSE);
-}
-
-#else
-/* DwPTS Scheduling Changes End */
-\f
-/**
- * @brief Avoid allocating RETX incase of collision
- * with reserved resources for BCH/PSS/SSS occassions.
- *
- * @details
- *
- * Function: rgSCHCmnRetxAllocAvoid
- * Purpose: Avoid allocating RETX incase of collision
- * with reserved resources for BCH/PSS/SSS occassions
- *
- * Invoked by: rgSCHCmnDlAllocRetxRb
- *
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchDlHqProcCb *proc
- * @return Bool
- *
- **/
-Bool rgSCHCmnRetxAllocAvoid
-(
-RgSchDlSf *subFrm,
-RgSchCellCb *cell,
-RgSchDlHqProcCb *proc
-)
-{
- uint8_t reqRbs;
-
-
- if (proc->tbInfo[0].state == HQ_TB_NACKED)
- {
- reqRbs = proc->tbInfo[0].dlGrnt.numRb;
- }
- else
- {
- reqRbs = proc->tbInfo[1].dlGrnt.numRb;
- }
- /* Consider the dlGrnt.numRb of the Retransmitting proc->tbInfo
- * and current available RBs to determine if this RETX TB
- * will collide with the BCH/PSS/SSS occassion */
- if (subFrm->sfNum % 5 == 0)
- {
- if ((subFrm->bwAssigned < cell->pbchRbEnd) &&
- (((subFrm->bwAssigned + reqRbs) - cell->pbchRbStart) > 0))
- {
- return (TRUE);
- }
- }
- return (FALSE);
-}
-
-#endif
-
-\f
-/**
- * @brief This function invokes the TM specific DL RETX RB Allocation routine.
- *
- * @details
- *
- * Function: rgSCHCmnDlAllocRetxRb
- * Purpose: This function invokes the TM specific
- * DL RETX RB Allocation routine.
- *
- * Invoked by: Specific Schedulers
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *effBo
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] RgSchCmnDlRbAllocInfo *cellWdAllocInfo
- * @return S16
- *
- **/
-S16 rgSCHCmnDlAllocRetxRb
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-)
-{
- uint32_t newSchBits = 0;
- RgSchDlRbAlloc *allocInfo;
-
-
- if ( !RGSCH_TIMEINFO_SAME((cell->crntTime),(ue->dl.lstSchTime) ))
- {
- ue->dl.aggTbBits = 0;
- }
-
- *effBo = 0;
- /* Check for DL BW exhaustion */
- if (subFrm->bw <= subFrm->bwAssigned)
- {
- return RFAILED;
- }
- /* Call TM specific RB allocation routine */
- (dlAllocRetxRbFunc[ue->mimoInfo.txMode - 1])(cell, subFrm, ue, bo, effBo, \
- proc, cellWdAllocInfo);
-
- if (*effBo)
- {
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell);
- /* Calculate totals bits newly allocated */
- if (allocInfo->tbInfo[0].schdlngForTb)
- {
- newSchBits += allocInfo->tbInfo[0].bytesReq;
- }
- if (allocInfo->tbInfo[1].schdlngForTb)
- {
- newSchBits += allocInfo->tbInfo[1].bytesReq;
- }
- ue->dl.aggTbBits += (newSchBits * 8);
- RGSCHCPYTIMEINFO((cell->crntTime),(ue->dl.lstSchTime))
- }
-
- return ROK;
-}
-
-\f
-/**
- * @brief This function determines the RBs and Bytes required for
- * Transmission on 1 CW.
- *
- * @details
- *
- * Function: rgSCHCmnDlAlloc1CwTxRb
- * Purpose: This function determines the RBs and Bytes required
- * for Transmission of DL SVC BO on 1 CW.
- * Also, takes care of SVC by SVC allocation by tracking
- * previous SVCs allocations.
- * Returns RFAILED if BO not satisfied at all.
- *
- * Invoked by: DL UE Allocation
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchDlHqTbCb *tbInfo
- * @param[in] uint32_t bo
- * @param[out] uint8_t *numRb
- * @param[out] uint32_t *effBo
- * @return S16
- *
- **/
-static S16 rgSCHCmnDlAlloc1CwTxRb
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-RgSchDlHqTbCb *tbInfo,
-uint32_t bo,
-uint8_t *numRb,
-uint32_t *effBo
-)
-{
- uint32_t tbSz;
- uint8_t imcs;
- uint8_t iTbs;
- RgSchCmnDlUe *ueDl;
- RgSchDlRbAlloc *allocInfo;
- uint32_t oldReq;
- uint32_t reqBytes;
- /* Correcting wrap around issue.
- * This change has been done at mutliple places in this function.*/
- uint32_t tempNumRb;
-
- reqBytes = bo;
- ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell);
- oldReq = ueDl->outStndAlloc;
-
-#ifdef RG_5GTF
- //TODO_SID: Currently setting max Tb size wrt to 5GTF TM3
- iTbs = ue->ue5gtfCb.mcs;
- ueDl->maxTbSz = MAX_5GTF_TB_SIZE * ue->ue5gtfCb.rank;
- ueDl->maxRb = MAX_5GTF_PRBS;
-#endif
- ueDl->outStndAlloc += bo;
- /* consider Cumulative amount of this BO and bytes so far allocated */
- bo = RGSCH_MIN(ueDl->outStndAlloc, ueDl->maxTbSz/8);
- /* Get the number of REs needed for this bo. */
- //noRes = ((bo * 8 * 1024) / eff);
-
- /* Get the number of RBs needed for this transmission */
- /* Number of RBs = No of REs / No of REs per RB */
- //tempNumRb = RGSCH_CEIL(noRes, cellDl->noResPerRb[cfi]);
- tempNumRb = MAX_5GTF_PRBS;
- tbSz = RGSCH_MIN(bo, (rgSch5gtfTbSzTbl[iTbs]/8) * ue->ue5gtfCb.rank);
-
- /* DwPts Scheduling Changes End */
- *effBo = RGSCH_MIN(tbSz - oldReq, reqBytes);
-
-#ifdef RG_5GTF
- //RG_SCH_CMN_DL_TBS_TO_MCS(iTbs, imcs);
- imcs = iTbs;
-#endif
-
-
- RG_SCH_CMN_FILL_DL_TBINFO(&allocInfo->tbInfo[0], tbSz, \
- iTbs, imcs, tbInfo, ue->ue5gtfCb.rank);
- *numRb = (uint8_t) tempNumRb;
-
- /* Update the subframe Allocated BW field */
- subFrm->bwAssigned = subFrm->bwAssigned + tempNumRb - allocInfo->rbsReq;
-
- return ROK;
-}
-
-\f
-/**
- * @brief This function is invoked in the event of any TB's allocation
- * being underutilized by the specific scheduler. Here we reduce iMcs
- * to increase redundancy and hence increase reception quality at UE.
- *
- * @details
- *
- * Function: rgSCHCmnRdcImcsTxTb
- * Purpose: This function shall reduce the iMcs in accordance with
- * the total consumed bytes by the UE at allocation
- * finalization.
- *
- * Invoked by: UE DL Allocation finalization routine
- * of specific scheduler.
- *
- * @param[in] RgSchDlRbAlloc *allocInfo
- * @param[in] uint8_t tbInfoIdx
- * @param[in] uint32_t cnsmdBytes
- * @return Void
- *
- **/
-Void rgSCHCmnRdcImcsTxTb
-(
-RgSchDlRbAlloc *allocInfo,
-uint8_t tbInfoIdx,
-uint32_t cnsmdBytes
-)
-{
- return;
- /*The below functionality is not needed.*/
- uint8_t noLyr;
- uint8_t iTbs;
- uint16_t numRb;
-
-
- iTbs = allocInfo->tbInfo[tbInfoIdx].iTbs;
- noLyr = allocInfo->tbInfo[tbInfoIdx].noLyr;
- numRb = allocInfo->rbsAlloc;
- if ( numRb > 0)
- {
- if ((rgTbSzTbl[noLyr-1][iTbs][numRb-1]/8) == cnsmdBytes)
- {
- return;
- }
- }
- /* Get iTbs as suitable for the consumed bytes */
- while((rgTbSzTbl[noLyr-1][iTbs][numRb-1]/8) > cnsmdBytes)
- {
- if (iTbs == 0)
- {
- RG_SCH_CMN_DL_TBS_TO_MCS(iTbs, allocInfo->tbInfo[tbInfoIdx].\
- tbCb->dlGrnt.iMcs);
- return;
- }
- iTbs--;
- }
- iTbs++;
- RG_SCH_CMN_DL_TBS_TO_MCS(iTbs, allocInfo->tbInfo[tbInfoIdx].tbCb->dlGrnt.iMcs);
-
- return;
-}
-
-\f
-/**
- * @brief This function determines the RBs and Bytes required for
- * Transmission on 2 CWs.
- *
- * @details
- *
- * Function: rgSCHCmnDlAlloc2CwTxRb
- * Purpose: This function determines the RBs and Bytes required
- * for Transmission of DL SVC BO on 2 CWs.
- * Also, takes care of SVC by SVC allocation by tracking
- * previous SVCs allocations.
- * Returns RFAILED if BO not satisfied at all.
- *
- * Invoked by: TM3 and TM4 DL UE Allocation
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchDlHqProcCb *proc
- * @param[in] RgSchDlHqProcCb bo
- * @param[out] uint8_t *numRb
- * @param[out] uint32_t *effBo
- * @return Void
- *
- **/
-static S16 rgSCHCmnDlAlloc2CwTxRb
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-RgSchDlHqProcCb *proc,
-uint32_t bo,
-uint8_t *numRbRef,
-uint32_t *effBo
-)
-{
- uint32_t noRes;
- uint32_t eff1, eff2;
- uint32_t tb1Sz, tb2Sz;
- uint8_t imcs1, imcs2;
- uint8_t noLyr1, noLyr2;
- uint8_t iTbs1, iTbs2;
- RgSchCmnDlCell *cellDl;
- RgSchCmnDlUe *ueDl;
- RgSchDlRbAlloc *allocInfo;
- uint32_t oldReq;
- uint32_t reqBytes;
- /* Fix: MUE_PERTTI_DL */
- uint32_t numRb;
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- uint8_t cfi = cellSch->dl.currCfi;
- S16 availBw;
- uint32_t availBits = 0;
-#ifdef LTE_ADV
- uint32_t boTmp = bo;
-#endif
-
-
- reqBytes = bo;
- cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
- ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell);
- oldReq = ueDl->outStndAlloc;
-
-
- if (ueDl->maxTbBits > ue->dl.aggTbBits)
- {
- availBits = ueDl->maxTbBits - ue->dl.aggTbBits;
- }
- /* check if we can further allocate to this UE */
- if ((ue->dl.aggTbBits >= ueDl->maxTbBits) ||
- (allocInfo->tbInfo[0].bytesReq >= ueDl->maxTbSz/8) ||
- (allocInfo->tbInfo[1].bytesReq >= ueDl->maxTbSz/8) ||
- (allocInfo->rbsReq >= ueDl->maxRb))
- {
- DU_LOG("\nDEBUG --> SCH : rgSCHCmnDlAllocRb(): UEs max allocation exceed");
- return RFAILED;
- }
-
- noLyr1 = ueDl->mimoInfo.cwInfo[0].noLyr;
- noLyr2 = ueDl->mimoInfo.cwInfo[1].noLyr;
-
- /* If there is no CFI change, continue to use the BLER based
- * iTBS value */
- if (ueDl->lastCfi == cfi)
- {
- iTbs1 = ueDl->mimoInfo.cwInfo[0].iTbs[noLyr1 - 1];
- iTbs2 = ueDl->mimoInfo.cwInfo[1].iTbs[noLyr2 - 1];
- }
- else
- {
- uint8_t cqi = ueDl->mimoInfo.cwInfo[0].cqi;
-#ifdef LTE_TDD
- iTbs1 = (uint8_t) rgSchCmnFetchItbs(cell, ueDl, subFrm, cqi, cfi, 0, noLyr1);
-#else
- iTbs1 = (uint8_t) rgSchCmnFetchItbs(cell, ueDl, cqi, cfi, 0, noLyr1);
-#endif
-
- cqi = ueDl->mimoInfo.cwInfo[1].cqi;
-#ifdef LTE_TDD
- iTbs2 = (uint8_t) rgSchCmnFetchItbs(cell, ueDl, subFrm, cqi, cfi, 1, noLyr2);
-#else
- iTbs2 = (uint8_t) rgSchCmnFetchItbs(cell, ueDl, cqi, cfi, 1, noLyr2);
-#endif
- }
-
- /*ccpu00131191 and ccpu00131317 - Fix for RRC Reconfig failure
- * issue for VoLTE call */
- //if ((proc->hasDcch) || (TRUE == rgSCHLaaSCellEnabled(cell)))
- if (proc->hasDcch)
- {
- if (iTbs1 > 5)
- {
- iTbs1 = iTbs1 - 5;
- }
- else
- {
- iTbs1 = 0;
- }
- if (iTbs2 > 5)
- {
- iTbs2 = iTbs2 - 5;
- }
- else
- {
- iTbs2 = 0;
- }
- }
- else if(!cellSch->dl.isDlFreqSel)
- {
-#ifdef LTE_TDD
- /* for Tdd reduce iTbs only for SF0. SF5 contains only
- * SSS and can be ignored */
- if (subFrm->sfNum == 0)
- {
- (iTbs1 > 1)? (iTbs1 -= 1) : (iTbs1 = 0);
- (iTbs2 > 1)? (iTbs2 -= 1) : (iTbs2 = 0);
- }
- /* For SF 3 and 8 CRC is getting failed in DL.
- Need to do proper fix after the replay from
- BRCM PHY team*/
-#ifdef CA_PHY_BRDCM_61765
- if ((subFrm->sfNum == 3) || (subFrm->sfNum == 8))
- {
- (iTbs1 > 2)? (iTbs1 -= 2) : (iTbs1 = 0);
- (iTbs2 > 2)? (iTbs2 -= 2) : (iTbs2 = 0);
- }
-#endif
-#else
-#endif
- }
-
-#ifdef LTE_TDD
- if(subFrm->sfType == RG_SCH_SPL_SF_DATA)
- {
- RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, cfi);
- }
-#endif
-
- eff1 = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[noLyr1 - 1][cfi]))[iTbs1];
- eff2 = (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[noLyr2 - 1][cfi]))[iTbs2];
-
-
- bo = RGSCH_MIN(bo,availBits/8);
- ueDl->outStndAlloc += bo;
- /* consider Cumulative amount of this BO and bytes so far allocated */
- bo = RGSCH_MIN(ueDl->outStndAlloc, ueDl->maxTbBits/8);
- bo = RGSCH_MIN(RGSCH_MAX(RGSCH_CMN_MIN_GRNT_HDR, (bo*eff1)/(eff1+eff2)),
- ueDl->maxTbSz/8) +
- RGSCH_MIN(RGSCH_MAX(RGSCH_CMN_MIN_GRNT_HDR, (bo*eff2)/(eff1+eff2)),
- (ueDl->maxTbSz)/8) +
- 1; /* Add 1 to adjust the truncation at weighted averaging */
- /* Get the number of REs needed for this bo. */
- noRes = ((bo * 8 * 1024) / (eff1 + eff2));
-
- /* Get the number of RBs needed for this transmission */
- /* Number of RBs = No of REs / No of REs per RB */
- numRb = RGSCH_CEIL(noRes, cellDl->noResPerRb[cfi]);
- /* Cannot exceed the maximum number of RBs per UE */
- if (numRb > ueDl->maxRb)
- {
- numRb = ueDl->maxRb;
- }
- else
- {
-#ifdef LTE_ADV
- if(RFAILED == rgSCHLaaCmn2CwAdjustPrb(allocInfo, boTmp, &numRb, ueDl, noLyr1, noLyr2, iTbs1, iTbs2))
-#endif
- {
- while ((numRb <= ueDl->maxRb) &&
- (rgTbSzTbl[noLyr1 - 1][iTbs1][numRb-1] <= ueDl->maxTbSz) &&
- (rgTbSzTbl[noLyr2 - 1][iTbs2][numRb-1] <= ueDl->maxTbSz) &&
- ((rgTbSzTbl[noLyr1 - 1][iTbs1][numRb-1]/8 +
- rgTbSzTbl[noLyr2 - 1][iTbs2][numRb-1]/8) <= bo))
- {
- (numRb)++;
- }
- }
- }
- availBw = subFrm->bw - subFrm->bwAssigned;
- /* Cannot exceed the total number of RBs in the cell */
- if ((S16)(numRb - allocInfo->rbsReq) > availBw)
- {
- numRb = availBw + allocInfo->rbsReq;
- }
- tb1Sz = rgTbSzTbl[noLyr1 - 1][iTbs1][numRb-1]/8;
- tb2Sz = rgTbSzTbl[noLyr2 - 1][iTbs2][numRb-1]/8;
- /* DwPts Scheduling Changes Start */
-#ifdef LTE_TDD
- if(subFrm->sfType == RG_SCH_SPL_SF_DATA)
- {
- /* Max Rb for Special Sf is approximated as 4/3 of maxRb */
- rgSCHCmnCalcDwPtsTbSz2Cw(cell, bo, (uint8_t*)&numRb, ueDl->maxRb*4/3,
- &iTbs1, &iTbs2, noLyr1,
- noLyr2, &tb1Sz, &tb2Sz, cfi);
- /* Check for available Bw */
- if ((S16)numRb - allocInfo->rbsReq > availBw)
- {
- numRb = availBw + allocInfo->rbsReq;
- tb1Sz = rgTbSzTbl[noLyr1-1][iTbs1][RGSCH_MAX(numRb*3/4,1)-1]/8;
- tb2Sz = rgTbSzTbl[noLyr2-1][iTbs2][RGSCH_MAX(numRb*3/4,1)-1]/8;
- }
- }
-#endif
- /* DwPts Scheduling Changes End */
- /* Update the subframe Allocated BW field */
- subFrm->bwAssigned = subFrm->bwAssigned + numRb - \
- allocInfo->rbsReq;
-
- *effBo = RGSCH_MIN((tb1Sz + tb2Sz) - oldReq, reqBytes);
-
-#ifdef LTE_ADV
- if (ROK != rgSCHLaaCmn2TBPrbCheck(allocInfo, tb1Sz, tb2Sz, boTmp, effBo, iTbs1, iTbs2, numRb, proc))
- {
- return RFAILED;
- }
-#endif
-
- RG_SCH_CMN_DL_TBS_TO_MCS(iTbs1, imcs1);
- RG_SCH_CMN_DL_TBS_TO_MCS(iTbs2, imcs2);
- RG_SCH_CMN_FILL_DL_TBINFO(&allocInfo->tbInfo[0], tb1Sz, \
- iTbs1, imcs1, &proc->tbInfo[0], noLyr1);
- RG_SCH_CMN_FILL_DL_TBINFO(&allocInfo->tbInfo[1], tb2Sz, \
- iTbs2, imcs2, &proc->tbInfo[1], noLyr2);
- *numRbRef = (uint8_t)numRb;
-
-
- return ROK;
-}
-
-\f
-/**
- * @brief This function determines the RBs and Bytes required for
- * Transmission & Retransmission on 2 CWs.
- *
- * @details
- *
- * Function: rgSCHCmnDlAlloc2CwTxRetxRb
- * Purpose: This function determines the RBs and Bytes required
- * for Transmission & Retransmission on 2 CWs. Allocate
- * RETX TB on a better CW and restrict new TX TB by
- * RETX allocation.
- * Returns RFAILED if BO not satisfied at all.
- *
- * Invoked by: TM3 and TM4 DL UE Allocation
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchDlHqTbCb *reTxTb
- * @param[in] RgSchDlHqTbCb *txTb
- * @param[out] uint8_t *numRb
- * @param[out] uint32_t *effBo
- * @return Void
- *
- **/
-static S16 rgSCHCmnDlAlloc2CwTxRetxRb
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-RgSchDlHqTbCb *reTxTb,
-RgSchDlHqTbCb *txTb,
-uint8_t *numRb,
-uint32_t *effBo
-)
-{
- RgSchCmnDlUe *ueDl;
- RgSchDlRbAlloc *allocInfo;
- uint8_t imcs1, imcs2;
- uint8_t noLyr2;
- uint16_t tb2Sz;
- RgSchCmnDlUeCwInfo *otherCw;
- S16 availBw;
- RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
- uint8_t cfi = cellDl->currCfi;
- uint8_t iTbs;
-
-
- ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell);
- otherCw = &ueDl->mimoInfo.cwInfo[!(ueDl->mimoInfo.btrCwIdx)];
-
-
- /* Fix for ccpu00123919: In case of RETX TB scheduling avoiding recomputation of RB
- * and Tbs. Set all parameters same as Init TX except RV(only for NACKED) and
- * MCS. */
- availBw = subFrm->bw - subFrm->bwAssigned;
- *numRb = reTxTb->dlGrnt.numRb;
-
-#ifdef XEON_TDD_SPCL
- *numRb = (reTxTb->initTxNumRbs);
- if(reTxTb->sfType == RG_SCH_SPL_SF_DATA && subFrm->sfType != RG_SCH_SPL_SF_DATA)
- {
- *numRb = (reTxTb->initTxNumRbs*3/4);
-
- if(*numRb <= 3)
- {
- DU_LOG("\nERROR --> SCH : Number of RBs [%d] are less than or equal to 3",*numRb);
- return RFAILED;
- }
- }
-#endif
-
- if ((S16)*numRb > availBw)
- {
- return RFAILED;
- }
- /* Update the subframe Allocated BW field */
- subFrm->bwAssigned += *numRb;
- noLyr2 = otherCw->noLyr;
- RG_SCH_CMN_GET_MCS_FOR_RETX(reTxTb, imcs1);
-
- /* If there is no CFI change, continue to use the BLER based
- * iTBS value */
- if (ueDl->lastCfi == cfi)
- {
- iTbs = otherCw->iTbs[noLyr2-1];
- }
- else
- {
-#ifdef LTE_TDD
- iTbs = (uint8_t) rgSchCmnFetchItbs(cell, ueDl, subFrm, otherCw->cqi, cfi,
- !(ueDl->mimoInfo.btrCwIdx), noLyr2);
-#else
- iTbs = (uint8_t) rgSchCmnFetchItbs(cell, ueDl, otherCw->cqi, cfi,
- !(ueDl->mimoInfo.btrCwIdx), noLyr2);
-#endif
- }
- tb2Sz = rgTbSzTbl[noLyr2-1][iTbs][*numRb-1]/8;
- /* DwPts Scheduling Changes Start */
-#ifdef LTE_TDD
-#endif
- /* DwPts Scheduling Changes End */
- RG_SCH_CMN_DL_TBS_TO_MCS(iTbs, imcs2);
-
- RG_SCH_CMN_FILL_DL_TBINFO(&allocInfo->tbInfo[0], reTxTb->tbSz, \
- 0, imcs1, reTxTb, reTxTb->numLyrs);
-
- RG_SCH_CMN_FILL_DL_TBINFO(&allocInfo->tbInfo[1], tb2Sz, \
- iTbs, imcs2, txTb, noLyr2);
-
- *effBo = reTxTb->tbSz + tb2Sz;
-
- return ROK;
-}
-
-\f
-/**
- * @brief This function determines the RBs and Bytes required for BO
- * Retransmission on 2 CWs.
- *
- * @details
- *
- * Function: rgSCHCmnDlAlloc2CwRetxRb
- * Purpose: This function determines the RBs and Bytes required
- * for BO Retransmission on 2 CWs. Allocate larger TB
- * on a better CW and check if the smaller TB can be
- * accomodated on the other CW.
- * Returns RFAILED if BO not satisfied at all.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchDlHqProcCb *proc
- * @param[out] uint8_t *numRb
- * @param[out] Bool *swpFlg
- * @param[out] uint32_t *effBo
- * @return Void
- *
- **/
-static S16 rgSCHCmnDlAlloc2CwRetxRb
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-RgSchDlHqProcCb *proc,
-uint8_t *numRb,
-Bool *swpFlg,
-uint32_t *effBo
-)
-{
- RgSchDlRbAlloc *allocInfo;
- uint8_t imcs1;
- uint8_t imcs2;
- RgSchDlHqTbCb *lrgTbInfo, *othrTbInfo;
-
-
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell);
-
-
- /* Fix for ccpu00123919: In case of RETX TB scheduling avoiding recomputation of RB
- * and Tbs. Set all parameters same as Init TX except RV(only for NACKED) and
- * MCS. */
- lrgTbInfo = &proc->tbInfo[0];
- othrTbInfo = &proc->tbInfo[1];
- *numRb = lrgTbInfo->dlGrnt.numRb;
-#ifdef XEON_TDD_SPCL
- if((lrgTbInfo->sfType == RG_SCH_SPL_SF_DATA || othrTbInfo->sfType == RG_SCH_SPL_SF_DATA))
- {
- if(lrgTbInfo->sfType == RG_SCH_SPL_SF_DATA)
- {
- *numRb = (lrgTbInfo->initTxNumRbs);
- }
- else
- {
- *numRb = (othrTbInfo->initTxNumRbs);
- }
-
- if(subFrm->sfType != RG_SCH_SPL_SF_DATA)
- {
- *numRb = (*numRb)*3/4;
- }
-
- if(*numRb <= 3)
- {
- DU_LOG("\nERROR --> SCH : Number of RBs [%d] are less than or equal to 3",*numRb);
- return RFAILED;
- }
- }
-#endif
- if ((S16)*numRb > (S16)(subFrm->bw - subFrm->bwAssigned))
- {
- return RFAILED;
- }
- /* Update the subframe Allocated BW field */
- subFrm->bwAssigned += *numRb;
- RG_SCH_CMN_GET_MCS_FOR_RETX(lrgTbInfo, imcs1);
- RG_SCH_CMN_GET_MCS_FOR_RETX(othrTbInfo, imcs2);
- RG_SCH_CMN_FILL_DL_TBINFO(&allocInfo->tbInfo[0], lrgTbInfo->tbSz, \
- 0, imcs1, lrgTbInfo, lrgTbInfo->numLyrs);
- RG_SCH_CMN_FILL_DL_TBINFO(&allocInfo->tbInfo[1], othrTbInfo->tbSz, \
- 0, imcs2, othrTbInfo, othrTbInfo->numLyrs);
- *effBo = lrgTbInfo->tbSz + othrTbInfo->tbSz;
-
-
-
- return ROK;
-}
-
-\f
-/**
- * @brief This function determines the RBs and Bytes required for BO
- * Retransmission on 1 CW.
- *
- * @details
- *
- * Function: rgSCHCmnDlAlloc1CwRetxRb
- * Purpose: This function determines the RBs and Bytes required
- * for BO Retransmission on 1 CW, the first CW.
- * Returns RFAILED if BO not satisfied at all.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchDlHqTbCb *tbInfo
- * @param[in] uint8_t noLyr
- * @param[out] uint8_t *numRb
- * @param[out] uint32_t *effBo
- * @return S16
- *
- **/
-static S16 rgSCHCmnDlAlloc1CwRetxRb
-(
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-RgSchDlHqTbCb *tbInfo,
-uint8_t noLyr,
-uint8_t *numRb,
-uint32_t *effBo
-)
-{
- RgSchDlRbAlloc *allocInfo;
- uint8_t imcs;
-
-
- allocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue,cell);
-
-
- /* Fix for ccpu00123919: In case of RETX TB scheduling avoiding recomputation of RB
- * and Tbs. Set all parameters same as Init TX except RV(only for NACKED) and
- * MCS. */
- *numRb = tbInfo->dlGrnt.numRb;
- if ((S16)*numRb > (S16)(subFrm->bw - subFrm->bwAssigned))
- {
- return RFAILED;
- }
- /* Update the subframe Allocated BW field */
- subFrm->bwAssigned += *numRb;
- imcs = tbInfo->dlGrnt.iMcs;
- allocInfo->dciFormat = tbInfo->dlGrnt.dciFormat;
- /* Fix: For a RETX TB the iTbs is irrelevant, hence setting 0 */
- RG_SCH_CMN_FILL_DL_TBINFO(&allocInfo->tbInfo[0], tbInfo->tbSz, \
- 0, imcs, tbInfo, tbInfo->numLyrs);
- *effBo = tbInfo->tbSz;
-
- return ROK;
-}
-
-#ifdef LTEMAC_SPS
-
-/**
- * @brief This function is called to handle Release PDCCH feedback for SPS UE
- *
- * @details
- *
- * Function: rgSCHCmnDlRelPdcchFbk
- * Purpose: Invokes SPS module to handle release PDCCH feedback
- *
- * Invoked by: DHM
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] Bool isAck
- * @return Void
- *
- **/
-Void rgSCHCmnDlRelPdcchFbk
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-Bool isAck
-)
-{
-
- rgSCHCmnSpsDlRelPdcchFbk(cell, ue, isAck);
- return;
-
-}
-
-
-/**
- * @brief This function is invoked to handle Ack processing for a HARQ proc.
- *
- * @details
- *
- * Function: rgSCHCmnDlProcAck
- * Purpose: DTX processing for HARQ proc
- *
- * Invoked by: DHM
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlHqProcCb *hqP
- * @return Void
- *
- **/
-Void rgSCHCmnDlProcAck
-(
-RgSchCellCb *cell,
-RgSchDlHqProcCb *hqP
-)
-{
-
-
- if (RG_SCH_CMN_SPS_DL_IS_SPS_HQP(hqP))
- {
- /* Invoke SPS module if SPS service was scheduled for this HARQ proc */
- rgSCHCmnSpsDlProcAck(cell, hqP);
- }
- return;
-}
-#ifdef RGSCH_SPS_STATS
-uint32_t rgSchStatCrntiCeRcvCnt;
-#endif
-/**
- * @brief This function is invoked to handle CRNTI CE reception for an UE
- *
- * @details
- *
- * Function: rgSCHCmnHdlCrntiCE
- * Purpose: Handle CRNTI CE reception
- *
- * Invoked by: DHM
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlHqProcCb *hqP
- * @return Void
- *
- **/
-Void rgSCHCmnHdlCrntiCE
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue
-)
-{
-
-#ifdef RGSCH_SPS_STATS
- rgSchStatCrntiCeRcvCnt++;
-#endif
-
- /* When UL sync lost happened due to TA timer expiry UE is being moved to
- PDCCH order inactivity list.But when CRNTI CE received in msg3 from UE
- we are not moving UE into active state due to that RRC Reconfiguration is
- not happening.
- So here we are moving UE to active list whenever we receive the CRNTI CE and
- UE is inactive */
- /* CR ccpu00144525 */
- if (RG_SCH_CMN_IS_UE_PDCCHODR_INACTV(ue))
- {
- /* Activate this UE if it was inactive */
- RG_SCH_CMN_DL_UPDT_INACTV_MASK ( cell, ue, RG_PDCCHODR_INACTIVE);
- RG_SCH_CMN_UL_UPDT_INACTV_MASK ( cell, ue, RG_PDCCHODR_INACTIVE);
- }
-
- /* Handling is same as reception of UE RESET for both DL and UL */
- if (ue->dl.dlSpsCfg.isDlSpsEnabled)
- {
- rgSCHCmnSpsDlUeReset(cell, ue);
- }
- if (ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE)
- {
- rgSCHCmnSpsUlUeReset(cell, ue);
- }
-
- return;
-}
-
-
-/**
- * @brief This function is called to handle relInd from MAC for a UE
- *
- * @details
- *
- * Function: rgSCHCmnUlSpsRelInd
- * Purpose: Invokes SPS module to handle UL SPS release for a UE
- *
- * Invoked by: SCH_UTL
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] Bool isExplRel
- * @return Void
- *
- **/
-Void rgSCHCmnUlSpsRelInd
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-Bool isExplRel
-)
-{
-
- rgSCHCmnSpsUlProcRelInd(cell, ue, isExplRel);
- return;
-
-} /* end of rgSCHCmnUlSpsRelInd */
-
-/**
- * @brief This function is called to handle SPS Activate Ind from MAC for a UE
- *
- * @details
- *
- * Function: rgSCHCmnUlSpsActInd
- * Purpose: Invokes SPS module to handle UL SPS activate for a UE
- *
- * Invoked by: SCH_UTL
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- *
- **/
-Void rgSCHCmnUlSpsActInd
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint16_t spsSduSize
-)
-{
-
-
- if (ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE)
- {
- rgSCHCmnSpsUlProcActInd(cell, ue,spsSduSize);
- }
- return;
-
-} /* end of rgSCHCmnUlSpsActInd */
-
-/**
- * @brief This function is called to handle CRC in UL for UEs
- * undergoing SPS release
- *
- * @details
- *
- * Function: rgSCHCmnUlCrcInd
- * Purpose: Invokes SPS module to handle CRC in UL for SPS UE
- *
- * Invoked by: SCH_UTL
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] CmLteTimingInfo crcTime
- * @return Void
- *
- **/
-Void rgSCHCmnUlCrcInd
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-CmLteTimingInfo crcTime
-)
-{
-
- if (ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE)
- {
- rgSCHCmnSpsUlProcCrcInd(cell, ue, crcTime);
- }
- return;
-
-} /* end of rgSCHCmnUlCrcFailInd */
-
-/**
- * @brief This function is called to handle CRC failure in UL
- *
- * @details
- *
- * Function: rgSCHCmnUlCrcFailInd
- * Purpose: Invokes SPS module to handle CRC failure in UL for SPS UE
- *
- * Invoked by: SCH_UTL
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] CmLteTimingInfo crcTime
- * @return Void
- *
- **/
-Void rgSCHCmnUlCrcFailInd
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-CmLteTimingInfo crcTime
-)
-{
-
- if (ue->ul.ulSpsCfg.isUlSpsEnabled == TRUE)
- {
- rgSCHCmnSpsUlProcDtxInd(cell, ue, crcTime);
- }
- return;
-
-} /* end of rgSCHCmnUlCrcFailInd */
-
-#endif /* LTEMAC_SPS */
-
-/**
- * @brief BCH,BCCH,PCCH Dowlink Scheduling Handler.
- *
- * @details
- *
- * Function: rgSCHCmnDlBcchPcchAlloc
- * Purpose: This function calls common scheduler APIs to
- * schedule for BCCH/PCCH.
- * It then invokes Allocator for actual RB
- * allocations. It processes on the actual resources allocated
- * against requested to the allocator module.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @return Void
- **/
-static Void rgSCHCmnDlBcchPcchAlloc(RgSchCellCb *cell)
-{
-#ifdef LTE_TDD
- uint8_t nextSfIdx = (cell->crntSfIdx) % RGSCH_SF_ALLOC_SIZE;
-#else
-#ifdef LTEMAC_HDFDD
- uint8_t nextSfIdx = (cell->crntSfIdx + RG_SCH_CMN_HARQ_INTERVAL) % RGSCH_NUM_SUB_FRAMES;
-#else
- uint8_t nextSfIdx = (cell->crntSfIdx) % RGSCH_NUM_SUB_FRAMES;
-#endif
-#endif
- RgInfSfAlloc *nextsfAlloc = &(cell->sfAllocArr[nextSfIdx]);
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- RgSchCmnDlRbAllocInfo *allocInfo = &cellSch->allocInfo;
-
-
-
- /*Reset the bitmask for BCCH/PCCH*/
- rgSCHUtlResetSfAlloc(nextsfAlloc,TRUE,FALSE);
-#ifndef DISABLE_MIB_SIB /* Not sending MIB and SIB to CL */
-#ifdef RGR_SI_SCH
- rgSCHChkNUpdSiCfg(cell);
- rgSCHSelectSi(cell);
-#endif
-
- /*Perform the scheduling for BCCH,PCCH*/
- rgSCHCmnDlBcchPcch(cell, allocInfo, nextsfAlloc);
-
- /* Call common allocator for RB Allocation */
- rgSCHBcchPcchDlRbAlloc(cell, allocInfo);
-
- /* Finalize the Allocations for reqested Against alloced */
- rgSCHCmnDlBcchPcchFnlz(cell, allocInfo);
-#endif /* DISABLE_MIB_SIB */
- return;
-}
-
-/**
- * @brief Handles RB allocation for BCCH/PCCH for downlink.
- *
- * @details
- *
- * Function : rgSCHBcchPcchDlRbAlloc
- *
- * Invoking Module Processing:
- * - This function is invoked for DL RB allocation of BCCH/PCCH
- *
- * Processing Steps:
- * - If cell is frequency selecive,
- * - Call rgSCHDlfsBcchPcchAllocRb().
- * - else,
- * - Do the processing
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlRbAllocInfo *allocInfo
- * @return Void
- **/
-
-static Void rgSCHBcchPcchDlRbAlloc
-(
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *allocInfo
-)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-
-
-
- if (cellSch->dl.isDlFreqSel)
- {
- cellSch->apisDlfs->rgSCHDlfsBcchPcchAllocRb(cell, allocInfo);
- }
- else
- {
- rgSCHCmnNonDlfsBcchPcchRbAlloc(cell, allocInfo);
- }
-
- return;
-}
-
-/**
- * @brief Handles RB allocation for BCCH,PCCH for frequency
- * non-selective cell.
- *
- * @details
- *
- * Function : rgSCHCmnNonDlfsBcchPcchRbAlloc
- *
- * Invoking Module Processing:
- * - SCH shall invoke this if downlink frequency selective is disabled for
- * the cell for RB allocation.
- * - MAX C/I/PFS/RR shall provide the requiredBytes, required RBs
- * estimate and subframe for each allocation to be made to SCH.
- *
- * Processing Steps:
- * - Allocate sequentially for BCCH,PCCH common channels.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- **/
-
-static Void rgSCHCmnNonDlfsBcchPcchRbAlloc
-(
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *allocInfo
-)
-{
- RgSchDlRbAlloc *reqAllocInfo;
-
-
- /* 143473 */
- /* Allocate for PCCH */
- reqAllocInfo = &(allocInfo->pcchAlloc);
- if (reqAllocInfo->rbsReq)
- {
- rgSCHCmnNonDlfsCmnRbAlloc(cell, reqAllocInfo);
- }
- /* Allocate for BCCH on DLSCH */
- reqAllocInfo = &(allocInfo->bcchAlloc);
- if (reqAllocInfo->rbsReq)
- {
- rgSCHCmnNonDlfsCmnRbAlloc(cell, reqAllocInfo);
- }
- return;
-}
-
-
-#ifdef RGR_SI_SCH
-/**
- * @brief This function implements the handling to check and
- * update the SI cfg at the start of the modificiation period.
- *
- * @details
- *
- * Function: rgSCHChkNUpdSiCfg
- * Purpose: This function implements handling for update of SI Cfg
- * at the start of modification period.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static Void rgSCHChkNUpdSiCfg
-(
-RgSchCellCb *cell
-)
-{
- CmLteTimingInfo pdSchTmInfo;
-
-
-
- pdSchTmInfo = cell->crntTime;
-#ifdef LTEMAC_HDFDD
- /* For HDFDD we need scheduling information at least RG_SCH_CMN_DL_DELTA
- + RG_SCH_CMN_HARQ_INTERVAL (7) subframes ahead */
- RGSCH_INCR_SUB_FRAME(pdSchTmInfo, RG_SCH_CMN_DL_DELTA + RG_SCH_CMN_HARQ_INTERVAL);
-#else
- RGSCH_INCR_SUB_FRAME(pdSchTmInfo, RG_SCH_CMN_DL_DELTA);
-#endif
-
-
- /* Updating the SIB1 for Warning SI message immediately after it is received
- * from application. No need to wait for next modification period.
- */
- if((pdSchTmInfo.sfn % RGSCH_SIB1_RPT_PERIODICITY == 0)
- && (RGSCH_SIB1_TX_SF_NUM == (pdSchTmInfo.slot % RGSCH_NUM_SUB_FRAMES)))
- {
- /*Check whether SIB1 with PWS has been updated*/
- if(cell->siCb.siBitMask & RGSCH_SI_SIB1_PWS_UPD)
- {
- RGSCH_SET_SI_INFO(cell->siCb.crntSiInfo.sib1Info.sib1,
- cell->siCb.newSiInfo.sib1Info.sib1);
- cell->siCb.crntSiInfo.sib1Info.mcs =
- cell->siCb.newSiInfo.sib1Info.mcs;
- cell->siCb.crntSiInfo.sib1Info.nPrb =
- cell->siCb.newSiInfo.sib1Info.nPrb;
- cell->siCb.crntSiInfo.sib1Info.msgLen =
- cell->siCb.newSiInfo.sib1Info.msgLen;
- cell->siCb.siBitMask &= ~RGSCH_SI_SIB1_PWS_UPD;
- }
- }
-
- /*Check if this SFN and SF No marks the start of next modification
- period. If current SFN,SF No doesn't marks the start of next
- modification period, then return. */
- if(!((pdSchTmInfo.sfn % cell->siCfg.modPrd == 0)
- && (0 == pdSchTmInfo.slot)))
- /*if(!((((pdSchTmInfo.hSfn * 1024) + pdSchTmInfo.sfn) % cell->siCfg.modPrd == 0)
- && (0 == pdSchTmInfo.slot)))*/
- {
- return;
- }
-
- /*Check whether MIB has been updated*/
- if(cell->siCb.siBitMask & RGSCH_SI_MIB_UPD)
- {
- RGSCH_SET_SI_INFO(cell->siCb.crntSiInfo.mib,
- cell->siCb.newSiInfo.mib);
- cell->siCb.siBitMask &= ~RGSCH_SI_MIB_UPD;
- }
-
- /*Check whether SIB1 has been updated*/
- if(cell->siCb.siBitMask & RGSCH_SI_SIB1_UPD)
- {
- RGSCH_SET_SI_INFO(cell->siCb.crntSiInfo.sib1Info.sib1,
- cell->siCb.newSiInfo.sib1Info.sib1);
- cell->siCb.crntSiInfo.sib1Info.mcs = cell->siCb.newSiInfo.sib1Info.mcs;
- cell->siCb.crntSiInfo.sib1Info.nPrb = cell->siCb.newSiInfo.sib1Info.nPrb;
- cell->siCb.crntSiInfo.sib1Info.msgLen =
- cell->siCb.newSiInfo.sib1Info.msgLen;
- cell->siCb.siBitMask &= ~RGSCH_SI_SIB1_UPD;
- }
-
- /*Check whether SIs have been updated*/
- if(cell->siCb.siBitMask & RGSCH_SI_SI_UPD)
- {
- uint8_t idx;
-
- /*Check if SI cfg have been modified And Check if numSi have
- been changed, if yes then we would need to update the
- pointers for all the SIs */
- if((cell->siCb.siBitMask & RGSCH_SI_SICFG_UPD) &&
- (cell->siCfg.numSi != cell->siCb.newSiCfg.numSi))
- {
- for(idx = 0;idx < cell->siCb.newSiCfg.numSi;idx++)
- {
- RGSCH_SET_SI_INFO(cell->siCb.crntSiInfo.siInfo[idx].si,
- cell->siCb.newSiInfo.siInfo[idx].si);
- cell->siCb.siArray[idx].si = cell->siCb.crntSiInfo.siInfo[idx].si;
- cell->siCb.siArray[idx].isWarningSi = FALSE;
-
- cell->siCb.crntSiInfo.siInfo[idx].mcs = cell->siCb.newSiInfo.siInfo[idx].mcs;
- cell->siCb.crntSiInfo.siInfo[idx].nPrb = cell->siCb.newSiInfo.siInfo[idx].nPrb;
- cell->siCb.crntSiInfo.siInfo[idx].msgLen = cell->siCb.newSiInfo.siInfo[idx].msgLen;
- }
-
- /*If numSi have been reduced then we need to free the
- pointers at the indexes in crntSiInfo which haven't
- been exercised. If numSi has increased then nothing
- additional is requires as above handling has taken
- care.*/
- if(cell->siCfg.numSi > cell->siCb.newSiCfg.numSi)
- {
- for(idx = cell->siCb.newSiCfg.numSi;
- idx < cell->siCfg.numSi;idx++)
- {
- RGSCH_FREE_MSG(cell->siCb.crntSiInfo.siInfo[idx].si);
- cell->siCb.siArray[idx].si = NULLP;
- }
- }
- }
- else
- {
- /*numSi has not been updated, we just need to update the
- pointers for the SIs which are set to NON NULLP */
- /*ccpu00118260 - Correct Update of SIB2 */
- for(idx = 0;idx < cell->siCfg.numSi;idx++)
- {
- if(NULLP != cell->siCb.newSiInfo.siInfo[idx].si)
- {
- RGSCH_SET_SI_INFO(cell->siCb.crntSiInfo.siInfo[idx].si,
- cell->siCb.newSiInfo.siInfo[idx].si);
-
- cell->siCb.siArray[idx].si = cell->siCb.crntSiInfo.siInfo[idx].si;
- cell->siCb.siArray[idx].isWarningSi = FALSE;
- cell->siCb.crntSiInfo.siInfo[idx].mcs = cell->siCb.newSiInfo.siInfo[idx].mcs;
- cell->siCb.crntSiInfo.siInfo[idx].nPrb = cell->siCb.newSiInfo.siInfo[idx].nPrb;
- cell->siCb.crntSiInfo.siInfo[idx].msgLen = cell->siCb.newSiInfo.siInfo[idx].msgLen;
- }
- }
- }
- cell->siCb.siBitMask &= ~RGSCH_SI_SI_UPD;
- }
-
- /*Check whether SI cfg have been updated*/
- if(cell->siCb.siBitMask & RGSCH_SI_SICFG_UPD)
- {
- cell->siCfg = cell->siCb.newSiCfg;
- cell->siCb.siBitMask &= ~RGSCH_SI_SICFG_UPD;
- }
-
- return;
-}
-
-
-/**
- * @brief This function implements the selection of the SI
- * that is to be scheduled.
- *
- * @details
- *
- * Function: rgSCHSelectSi
- * Purpose: This function implements the selection of SI
- * that is to be scheduled.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static Void rgSCHSelectSi
-(
-RgSchCellCb *cell
-)
-{
- CmLteTimingInfo crntTmInfo;
- uint8_t siWinSize;
- uint16_t x;
- uint16_t windowId;
-
-
-
- crntTmInfo = cell->crntTime;
-#ifdef LTEMAC_HDFDD
- /* For HDFDD we need scheduling information at least RG_SCH_CMN_DL_DELTA
- + RG_SCH_CMN_HARQ_INTERVAL (7) subframes ahead */
- RGSCH_INCR_SUB_FRAME(crntTmInfo, RG_SCH_CMN_DL_DELTA + RG_SCH_CMN_HARQ_INTERVAL);
-#else
- RGSCH_INCR_SUB_FRAME(crntTmInfo, RG_SCH_CMN_DL_DELTA);
-#endif
-
- siWinSize = cell->siCfg.siWinSize;
-
- /* Select SI only once at the starting of the new window */
- if(cell->siCb.inWindow)
- {
- if ((crntTmInfo.sfn % cell->siCfg.minPeriodicity) == 0 &&
- crntTmInfo.slot == 0)
- {
- /* Reinit inWindow at the beginning of every SI window */
- cell->siCb.inWindow = siWinSize - 1;
- }
- else
- {
- cell->siCb.inWindow--;
- return;
- }
- }
- else /* New window. Re-init the winSize counter with the window length */
- {
- if((cell->siCb.siArray[cell->siCb.siCtx.siId - 1].isWarningSi == TRUE)&&
- (cell->siCb.siCtx.retxCntRem != 0))
- {
- rgSCHUtlFreeWarningSiPdu(cell);
- cell->siCb.siCtx.warningSiFlag = FALSE;
- }
-
- cell->siCb.inWindow = siWinSize - 1;
- }
-
- x = rgSCHCmnGetSiSetId(crntTmInfo.sfn, crntTmInfo.slot,
- cell->siCfg.minPeriodicity);
-
- /* Window Id within a SI set. This window Id directly maps to a
- * unique SI Id */
- windowId = (((crntTmInfo.sfn * RGSCH_NUM_SUB_FRAMES_5G) +
- crntTmInfo.slot) - (x * (cell->siCfg.minPeriodicity * 10)))
- / siWinSize;
-
- if(windowId >= RGR_MAX_NUM_SI)
- return;
-
- /* Update the siCtx if there is a valid SI and its periodicity
- * has occurred */
- if (NULLP != cell->siCb.siArray[windowId].si)
- {
- /* Warning SI Periodicity is same as SIB2 Periodicity */
- if(((cell->siCb.siArray[windowId].isWarningSi == FALSE) &&
- (x % (cell->siCfg.siPeriodicity[windowId]
- /cell->siCfg.minPeriodicity) == 0)) ||
- ((cell->siCb.siArray[windowId].isWarningSi == TRUE) &&
- (x % (cell->siCfg.siPeriodicity[0]
- /cell->siCfg.minPeriodicity) == 0)))
- {
- cell->siCb.siCtx.siId = windowId+1;
- cell->siCb.siCtx.retxCntRem = cell->siCfg.retxCnt;
- cell->siCb.siCtx.warningSiFlag = cell->siCb.siArray[windowId].
- isWarningSi;
- cell->siCb.siCtx.timeToTx.sfn = crntTmInfo.sfn;
- cell->siCb.siCtx.timeToTx.slot = crntTmInfo.slot;
-
- RG_SCH_ADD_TO_CRNT_TIME(cell->siCb.siCtx.timeToTx,
- cell->siCb.siCtx.maxTimeToTx, (siWinSize - 1))
- }
- }
- else
- {/* Update the siCtx with invalid si Id */
- cell->siCb.siCtx.siId = 0;
- }
-
- return;
-}
-
-
-/**
- * @brief This function implements scheduler DL allocation for
- * SI.
- *
- * @details
- *
- * Function: rgSCHDlSiSched
- * Purpose: This function implements scheduler for DL allocation
- * for SI.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static Void rgSCHDlSiSched
-(
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *allocInfo,
-RgInfSfAlloc *subfrmAlloc
-)
-{
- CmLteTimingInfo crntTimInfo;
- RgSchDlSf *sf;
- uint8_t nPrb = 0;
- uint8_t mcs = 0;
- MsgLen msgLen = 0;
- uint32_t rb=0;
- RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
- /* DwPTS Scheduling Changes Start */
-#ifdef LTE_TDD
- uint16_t lostRe;
- uint8_t cfi = cellDl->currCfi;
-#endif
- /* DwPTS Scheduling Changes End */
-
-
-
- crntTimInfo = cell->crntTime;
-#ifdef LTEMAC_HDFDD
- /* For HDFDD we need scheduling information at least RG_SCH_CMN_DL_DELTA
- + RG_SCH_CMN_HARQ_INTERVAL (7) subframes ahead */
- RGSCH_INCR_SUB_FRAME(crntTimInfo, RG_SCH_CMN_DL_DELTA + RG_SCH_CMN_HARQ_INTERVAL);
-#else
- RGSCH_INCR_SUB_FRAME(crntTimInfo, RG_SCH_CMN_DL_DELTA);
-#endif
-
- /* Compute the subframe for which allocation is being made.
- Essentially, we need pointer to the dl frame for this subframe */
- sf = rgSCHUtlSubFrmGet(cell, crntTimInfo);
-
- /*Check if scheduling of MIB is required */
-#ifdef EMTC_ENABLE
- /* since we are adding the MIB repetition logic for EMTC UEs, checking if
- * emtcEnabled or not, If enabled MIB would be repeted at as part of EMTC
- * feature, otherwise scheduling at (n,0) */
- if(0 == cell->emtcEnable)
- {
-#endif
- if((crntTimInfo.sfn % RGSCH_MIB_PERIODICITY == 0)
- && (RGSCH_MIB_TX_SF_NUM == crntTimInfo.slot))
- {
- MsgLen mibLen = 0;
- uint8_t sfnOctet, mibOct2 = 0;
- uint8_t mibOct1 = 0;
- /*If MIB has not been yet setup by Application, return*/
- if(NULLP == cell->siCb.crntSiInfo.mib)
- return;
-
- SFndLenMsg(cell->siCb.crntSiInfo.mib, &mibLen);
- sf->bch.tbSize = mibLen;
- /*Fill the interface information */
- rgSCHUtlFillRgInfCmnLcInfo(sf, subfrmAlloc, NULLD, NULLD);
-
- /*Set the bits of MIB to reflect SFN */
- /*First get the Most signficant 8 bits of SFN */
- sfnOctet = (uint8_t)(crntTimInfo.sfn >> 2);
- /*Get the first two octets of MIB, and then update them
- using the SFN octet value obtained above.*/
- if(ROK != SExamMsg((Data *)(&mibOct1),
- cell->siCb.crntSiInfo.mib, 0))
- return;
-
- if(ROK != SExamMsg((Data *)(&mibOct2),
- cell->siCb.crntSiInfo.mib, 1))
- return;
-
- /* ccpu00114572- Fix for improper way of MIB Octet setting for SFN */
- mibOct1 = (mibOct1 & 0xFC) | (sfnOctet >> 6);
- mibOct2 = (mibOct2 & 0x03) | (sfnOctet << 2);
- /* ccpu00114572- Fix ends*/
-
- /*Now, replace the two octets in MIB */
- if(ROK != SRepMsg((Data)(mibOct1),
- cell->siCb.crntSiInfo.mib, 0))
- return;
-
- if(ROK != SRepMsg((Data)(mibOct2),
- cell->siCb.crntSiInfo.mib, 1))
- return;
-
- /*Copy the MIB msg buff into interface buffer */
- SCpyMsgMsg(cell->siCb.crntSiInfo.mib,
- rgSchCb[cell->instIdx].rgSchInit.region,
- rgSchCb[cell->instIdx].rgSchInit.pool,
- &subfrmAlloc->cmnLcInfo.bchInfo.pdu);
- /* Added Dl TB count for MIB message transmission
- * This counter is incremented 4 times to consider
- * the retransmission at the PHY level on PBCH channel*/
-#ifdef LTE_L2_MEAS
- cell->dlUlTbCnt.tbTransDlTotalCnt += RG_SCH_MIB_CNT;
-#endif
- }
-#ifdef EMTC_ENABLE
- }
-#endif
-
- allocInfo->bcchAlloc.schdFirst = FALSE;
- /*Check if scheduling of SIB1 is required.
- Check of (crntTimInfo.sfn % RGSCH_SIB1_PERIODICITY == 0)
- is not required here since the below check takes care
- of SFNs applicable for this one too.*/
- if((crntTimInfo.sfn % RGSCH_SIB1_RPT_PERIODICITY == 0)
- && (RGSCH_SIB1_TX_SF_NUM == crntTimInfo.slot))
- {
- /*If SIB1 has not been yet setup by Application, return*/
- if(NULLP == (cell->siCb.crntSiInfo.sib1Info.sib1))
- {
- return;
- }
-
- allocInfo->bcchAlloc.schdFirst = TRUE;
- mcs = cell->siCb.crntSiInfo.sib1Info.mcs;
- nPrb = cell->siCb.crntSiInfo.sib1Info.nPrb;
- msgLen = cell->siCb.crntSiInfo.sib1Info.msgLen;
- }
- else
- {
- /*Check if scheduling of SI can be performed.*/
- Bool invalid = FALSE;
-
- if(cell->siCb.siCtx.siId == 0)
- return;
-
- /*Check if the Si-Window for the current Si-Context is completed*/
- invalid = rgSCHCmnChkPastWin(crntTimInfo, cell->siCb.siCtx.maxTimeToTx);
- if(invalid)
- {
- /* LTE_ADV_FLAG_REMOVED_START */
- if(cell->siCb.siCtx.retxCntRem)
- {
- DU_LOG("\nERROR --> SCH : rgSCHDlSiSched(): SI not scheduled and window expired");
- }
- /* LTE_ADV_FLAG_REMOVED_END */
- if(cell->siCb.siCtx.warningSiFlag == TRUE)
- {
- rgSCHUtlFreeWarningSiPdu(cell);
- cell->siCb.siCtx.warningSiFlag = FALSE;
- }
- return;
- }
-
- /*Check the timinginfo of the current SI-Context to see if its
- transmission can be scheduled. */
- if(FALSE == (rgSCHCmnChkInWin(crntTimInfo,
- cell->siCb.siCtx.timeToTx,
- cell->siCb.siCtx.maxTimeToTx)))
- {
- return;
-
- }
- /*Check if retransmission count has become 0*/
- if(0 == cell->siCb.siCtx.retxCntRem)
- {
- return;
- }
-
- /* LTE_ADV_FLAG_REMOVED_START */
- /* Check if ABS is enabled/configured */
- if(RGR_ENABLE == cell->lteAdvCb.absCfg.status)
- {
- /* The pattern type is RGR_ABS_MUTE, then eNB need to blank the subframe */
- if(cell->lteAdvCb.absCfg.absPatternType & RGR_ABS_MUTE)
- {
- /* Determine next scheduling subframe is ABS or not */
- if(RG_SCH_ABS_ENABLED_ABS_SF == (RgSchAbsSfEnum)(cell->lteAdvCb.absCfg.absPattern
- [((crntTimInfo.sfn*RGSCH_NUM_SUB_FRAMES) + crntTimInfo.slot) % RGR_ABS_PATTERN_LEN]))
- {
- /* Skip the SI scheduling to next tti */
- return;
- }
- }
- }
- /* LTE_ADV_FLAG_REMOVED_END */
-
- /*Schedule the transmission of the current SI-Context */
- /*Find out the messg length for the SI message */
- /* warningSiFlag is to differentiate between Warning SI
- * and Other SI */
- if((rgSCHUtlGetMcsAndNPrb(cell, &nPrb, &mcs, &msgLen)) != ROK)
- {
- return;
- }
-
- cell->siCb.siCtx.i = RGSCH_CALC_SF_DIFF(crntTimInfo,
- cell->siCb.siCtx.timeToTx);
- }
-
-
- /*Get the number of rb required */
- /*rgSCHCmnClcRbAllocForFxdTb(cell, msgLen, cellDl->ccchCqi, &rb);*/
- if(cellDl->bitsPerRb==0)
- {
- while ((rgTbSzTbl[0][0][rb]) < (uint32_t) (msgLen*8))
- {
- rb++;
- }
- rb = rb+1;
- }
- else
- {
- rb = RGSCH_CEIL((msgLen*8), cellDl->bitsPerRb);
- }
- /* DwPTS Scheduling Changes Start */
-#ifdef LTE_TDD
- if (sf->sfType == RG_SCH_SPL_SF_DATA)
- {
- RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, cfi);
-
- /* Calculate the less RE's because of DwPTS */
- lostRe = rb * (cellDl->noResPerRb[cfi] - cellDl->numReDwPts[cfi]);
-
- /* Increase number of RBs in Spl SF to compensate for lost REs */
- rb += RGSCH_CEIL(lostRe, cellDl->numReDwPts[cfi]);
- }
-#endif
- /* DwPTS Scheduling Changes End */
- /*ccpu00115595- end*/
- /* Additional check to see if required RBs
- * exceeds the available */
- if (rb > sf->bw - sf->bwAssigned)
- {
- DU_LOG("\nERROR --> SCH : rgSCHDlSiSched(): "
- "BW allocation failed CRNTI:%d",RGSCH_SI_RNTI);
- return;
- }
-
- /* Update the subframe Allocated BW field */
- sf->bwAssigned = sf->bwAssigned + rb;
-
- /*Fill the parameters in allocInfo */
- allocInfo->bcchAlloc.rnti = RGSCH_SI_RNTI;
- allocInfo->bcchAlloc.dlSf = sf;
- allocInfo->bcchAlloc.rbsReq = rb;
- /*ccpu00116710- MCS is not getting assigned */
- allocInfo->bcchAlloc.tbInfo[0].imcs = mcs;
-
- /* ccpu00117510 - ADD - Assignment of nPrb and other information */
- allocInfo->bcchAlloc.nPrb = nPrb;
- allocInfo->bcchAlloc.tbInfo[0].bytesReq = msgLen;
- allocInfo->bcchAlloc.tbInfo[0].noLyr = 1;
- return;
-}
-#endif /*RGR_SI_SCH*/
-
-\f
-/* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
-/**
- * @brief This function Updates the DL CQI for the UE.
- *
- * @details
- *
- * Function: rgSCHCmnUeDlPwrCtColltCqiRept
- * Purpose: Manages PUSH N CQI reporting
- * Step 1: Store the CQI in collation array
- * Step 2: Increament the tracking count
- * Step 3: Check is it time to to send the report
- * Step 4: if yes, Send StaInd to RRM
- * Step 4.1: Fill StaInd for sending collated N CQI rpeorts
- * Step 4.2: Call utility function (rgSCHUtlRgrStaInd) to send rpts to RRM
- * Step 4.2.1: If sending was not sucessful, return RFAILED
- * Step 4.2.2: If sending was sucessful, return ROK
- * Step 5: If no, return
- * Invoked by: rgSCHCmnDlCqiInd
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrUeCqiRept *ueCqiRpt
- * @return Void
- *
- **/
-static S16 rgSCHCmnUeDlPwrCtColltCqiRept
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeCqiRept *ueCqiRpt
-)
-{
- uint8_t *cqiCount = NULLP;
- S16 retVal;
- RgrStaIndInfo *staInfo = NULLP;
-
-
- /* Step 1: Store the CQI in collation array */
- /* Step 2: Increament the tracking count */
- cqiCount = &(ue->schCqiInfo.cqiCount);
- ue->schCqiInfo.cqiRept[(*cqiCount)++] =
- *ueCqiRpt;
-
-
- /* Step 3: Check is it time to to send the report */
- if(RG_SCH_CQIR_IS_TIMTOSEND_CQIREPT(ue))
- {
- /* Step 4: if yes, Send StaInd to RRM */
- retVal = rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&staInfo,
- sizeof(RgrStaIndInfo));
- if (retVal != ROK)
- {
- DU_LOG("\nERROR --> SCH : Could not "
- "allocate memory for sending StaInd CRNTI:%d",ue->ueId);
- return (retVal);
- }
-
- /* Step 4.1: Fill StaInd for sending collated N CQI rpeorts */
-#ifdef CA_DBG
- {
- uint32_t gCqiReptToAppCount;
- gCqiReptToAppCount++;
-
- }
-
-#endif
- retVal = rgSCHUtlFillSndStaInd(cell, ue, staInfo,
- ue->cqiReptCfgInfo.numColltdCqiRept);
- return (retVal);
-
- }
-
- return ROK;
-} /* End of rgSCHCmnUeDlPwrCtColltCqiRept */
-
-#endif /* End of RGR_CQI_REPT */
-
-/**
- * @brief This function checks for the retransmisson
- * for a DTX scenario.
- * @details
- *
- * Function:
- * Purpose:
- * Invoked by:
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in]
- * @return Void
- *
- **/
-Void rgSCHCmnChkRetxAllowDtx
-(
-RgSchCellCb *cell,
-RgSchUeCb *ueCb,
-RgSchDlHqProcCb *proc,
-Bool *reTxAllwd
-)
-{
-
-
- *reTxAllwd = TRUE;
- /* Fix */
- if ((proc->tbInfo[0].isAckNackDtx == TFU_HQFDB_DTX))
- {
- *reTxAllwd = FALSE;
- }
-
- return;
-}
-
-/**
- * @brief API for calculating the SI Set Id
- *
- * @details
- *
- * Function: rgSCHCmnGetSiSetId
- *
- * This API is used for calculating the SI Set Id, as shown below
- *
- * siSetId = 0 siSetId = 1
- * |******************|******************|---------------->
- * (0,0) (8,0) (16,0) (SFN, SF)
- *
- *
- * @param[in] uint16_t sfn
- * @param[in] uint8_t sf
- * @return uint16_t siSetId
- **/
-uint16_t rgSCHCmnGetSiSetId
-(
-uint16_t sfn,
-uint8_t sf,
-uint16_t minPeriodicity
-)
-{
- /* 80 is the minimum SI periodicity in sf. Also
- * all other SI periodicities are multiples of 80 */
- return (((sfn * RGSCH_NUM_SUB_FRAMES_5G) + sf) / (minPeriodicity * 10));
-}
-#ifdef LTE_TDD
-/**
- * @brief API for calculating the DwPts Rb, Itbs and tbSz
- *
- * @details
- *
- * Function: rgSCHCmnCalcDwPtsTbSz
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] uint32_t bo
- * @param[in/out] uint8_t *rb
- * @param[in/out] uint8_t *iTbs
- * @param[in] uint8_t lyr
- * @param[in] uint8_t cfi
- * @return uint32_t tbSz
- **/
-static uint32_t rgSCHCmnCalcDwPtsTbSz
-(
-RgSchCellCb *cell,
-uint32_t bo,
-uint8_t *rb,
-uint8_t *iTbs,
-uint8_t lyr,
-uint8_t cfi
-)
-{
- uint32_t tbSz;
- RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
- uint32_t numRE = *rb * cellDl->noResPerRb[cfi];
- uint32_t numDwPtsRb = RGSCH_CEIL(numRE, cellDl->numReDwPts[cfi]);
-
-
- /* DwPts Rb cannot exceed the cell Bw */
- numDwPtsRb = RGSCH_MIN(numDwPtsRb, cellDl->maxDlBwPerUe);
-
- /* Adjust the iTbs for optimum usage of the DwPts region.
- * Using the same iTbs adjustment will not work for all
- * special subframe configurations and iTbs levels. Hence use the
- * static iTbs Delta table for adjusting the iTbs */
- RG_SCH_CMN_ADJ_DWPTS_ITBS(cellDl, *iTbs);
-
- if (bo)
- {
- while(rgTbSzTbl[lyr-1][*iTbs][RGSCH_MAX(numDwPtsRb*3/4,1)-1] < bo*8 &&
- numDwPtsRb < cellDl->maxDlBwPerUe)
- {
- (numDwPtsRb)++;
- }
-
- tbSz = rgTbSzTbl[lyr-1][*iTbs][RGSCH_MAX(numDwPtsRb*3/4,1)-1];
- }
- else
- {
- tbSz = rgTbSzTbl[lyr-1][*iTbs][RGSCH_MAX(numDwPtsRb*3/4,1)-1];
- }
- *rb = numDwPtsRb;
-
- return (tbSz/8);
-}
-
-/**
- * @brief API for calculating the DwPts Rb, Itbs and tbSz
- *
- * @details
- *
- * Function: rgSCHCmnCalcDwPtsTbSz2Cw
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] uint32_t bo
- * @param[in/out] uint8_t *rb
- * @param[in] uint8_t maxRb
- * @param[in/out] uint8_t *iTbs1
- * @param[in/out] uint8_t *iTbs2
- * @param[in] uint8_t lyr1
- * @param[in] uint8_t lyr2
- * @return[in/out] uint32_t *tb1Sz
- * @return[in/out] uint32_t *tb2Sz
- * @param[in] uint8_t cfi
- **/
-static Void rgSCHCmnCalcDwPtsTbSz2Cw
-(
-RgSchCellCb *cell,
-uint32_t bo,
-uint8_t *rb,
-uint8_t maxRb,
-uint8_t *iTbs1,
-uint8_t *iTbs2,
-uint8_t lyr1,
-uint8_t lyr2,
-uint32_t *tb1Sz,
-uint32_t *tb2Sz,
-uint8_t cfi
-)
-{
- RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
- uint32_t numRE = *rb * cellDl->noResPerRb[cfi];
- uint32_t numDwPtsRb = RGSCH_CEIL(numRE, cellDl->numReDwPts[cfi]);
-
-
- /* DwPts Rb cannot exceed the cell Bw */
- numDwPtsRb = RGSCH_MIN(numDwPtsRb, maxRb);
-
- /* Adjust the iTbs for optimum usage of the DwPts region.
- * Using the same iTbs adjustment will not work for all
- * special subframe configurations and iTbs levels. Hence use the
- * static iTbs Delta table for adjusting the iTbs */
- RG_SCH_CMN_ADJ_DWPTS_ITBS(cellDl, *iTbs1);
- RG_SCH_CMN_ADJ_DWPTS_ITBS(cellDl, *iTbs2);
-
- while((rgTbSzTbl[lyr1-1][*iTbs1][RGSCH_MAX(numDwPtsRb*3/4,1)-1] +
- rgTbSzTbl[lyr2-1][*iTbs2][RGSCH_MAX(numDwPtsRb*3/4,1)-1])< bo*8 &&
- numDwPtsRb < maxRb)
- {
- (numDwPtsRb)++;
- }
-
- *tb1Sz = rgTbSzTbl[lyr1-1][*iTbs1][RGSCH_MAX(numDwPtsRb*3/4,1)-1]/8;
- *tb2Sz = rgTbSzTbl[lyr2-1][*iTbs2][RGSCH_MAX(numDwPtsRb*3/4,1)-1]/8;
-
- *rb = numDwPtsRb;
-
- return;
-}
-
-#endif
-
-/**
- * @brief Updates the GBR LCGs when datInd is received from MAC
- *
- * @details
- *
- * Function: rgSCHCmnUpdUeDataIndLcg(cell, ue, datInd)
- * Purpose: This function updates the GBR LCGs
- * when datInd is received from MAC.
- *
- * Invoked by: TOM
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgInfUeDatInd *datInd
- * @return Void
- **/
-Void rgSCHCmnUpdUeDataIndLcg
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgInfUeDatInd *datInd
-)
-{
- uint32_t idx = 0;
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-
-
- for (idx = 0; (idx < RGINF_MAX_LCG_PER_UE - 1); idx++)
- {
- if (datInd->lcgInfo[idx].bytesRcvd != 0)
- {
- uint8_t lcgId = datInd->lcgInfo[idx].lcgId;
- uint32_t bytesRcvd = datInd->lcgInfo[idx].bytesRcvd;
-
- if (RGSCH_LCG_ISCFGD(&ue->ul.lcgArr[lcgId]))
- {
- RgSchCmnLcg *cmnLcg = ((RgSchCmnLcg *)(ue->ul.lcgArr[lcgId].sch));
- if (RGSCH_IS_GBR_BEARER(cmnLcg->cfgdGbr))
- {
- if(bytesRcvd > cmnLcg->effGbr)
- {
- bytesRcvd -= cmnLcg->effGbr;
- cmnLcg->effDeltaMbr = (cmnLcg->effDeltaMbr > bytesRcvd) ? \
- (cmnLcg->effDeltaMbr - bytesRcvd) : (0);
- cmnLcg->effGbr = 0;
- }
- else
- {
- cmnLcg->effGbr -= bytesRcvd;
- }
- /* To keep BS updated with the amount of data received for the GBR */
- cmnLcg->reportedBs = (cmnLcg->reportedBs > datInd->lcgInfo[idx].bytesRcvd) ? \
- (cmnLcg->reportedBs - datInd->lcgInfo[idx].bytesRcvd) : (0);
- cmnLcg->bs = RGSCH_MIN(cmnLcg->reportedBs, cmnLcg->effGbr+cmnLcg->effDeltaMbr);
- }
- else if(lcgId != 0)
- {
- ue->ul.effAmbr = (ue->ul.effAmbr > datInd->lcgInfo[idx].bytesRcvd) ? \
- (ue->ul.effAmbr - datInd->lcgInfo[idx].bytesRcvd) : (0);
- cmnLcg->reportedBs = (cmnLcg->reportedBs > datInd->lcgInfo[idx].bytesRcvd) ? \
- (cmnLcg->reportedBs - datInd->lcgInfo[idx].bytesRcvd) : (0);
- cmnLcg->bs = RGSCH_MIN(cmnLcg->reportedBs, ue->ul.effAmbr);
- ue->ul.nonGbrLcgBs = (ue->ul.nonGbrLcgBs > datInd->lcgInfo[idx].bytesRcvd) ? \
- (ue->ul.nonGbrLcgBs - datInd->lcgInfo[idx].bytesRcvd) : (0);
- }
- ue->ul.nonLcg0Bs = (ue->ul.nonLcg0Bs > datInd->lcgInfo[idx].bytesRcvd) ? \
- (ue->ul.nonLcg0Bs - datInd->lcgInfo[idx].bytesRcvd) : (0);
- }
- }
- else
- {
- break;
- }
- }
-#ifdef EMTC_ENABLE
- if(TRUE == ue->isEmtcUe)
- {
- if (cellSch->apisEmtcUl->rgSCHRgrUlLcgUpd(cell, ue, datInd) != ROK)
- {
- DU_LOG("\nERROR --> SCH : rgSCHCmnUpdUeDataIndLcg(): rgSCHRgrUlLcgUpd returned failure");
- }
-
- }
- else
-#endif
- {
- if (cellSch->apisUl->rgSCHRgrUlLcgUpd(cell, ue, datInd) != ROK)
- {
- DU_LOG("\nERROR --> SCH : rgSCHCmnUpdUeDataIndLcg(): rgSCHRgrUlLcgUpd returned failure");
- }
- }
-}
-
-
-/** @brief This function initializes DL allocation lists and prepares
- * for scheduling
- *
- * @details
- *
- * Function: rgSCHCmnInitRbAlloc
- *
- * @param [in] RgSchCellCb *cell
- *
- * Returns: Void
- *
- */
-static Void rgSCHCmnInitRbAlloc
-(
-RgSchCellCb *cell
-)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- CmLteTimingInfo frm;
- RgSchDlSf *dlSf;
- uint8_t idx;
-
-
-/* Initializing RgSchCmnUlRbAllocInfo structure.*/
- rgSCHCmnInitDlRbAllocInfo(&cellSch->allocInfo);
-
- frm = cellSch->dl.time;
-
- dlSf = rgSCHUtlSubFrmGet(cell, frm);
-#ifdef RG_5GTF
- dlSf->numGrpPerTti = cell->cell5gtfCb.ueGrpPerTti;
- dlSf->numUePerGrp = cell->cell5gtfCb.uePerGrpPerTti;
- for(idx = 0; idx < MAX_5GTF_BEAMS; idx++)
- {
- dlSf->sfBeamInfo[idx].totVrbgAllocated = 0;
- dlSf->sfBeamInfo[idx].totVrbgRequired = 0;
- dlSf->sfBeamInfo[idx].vrbgStart = 0;
- }
-#endif
- dlSf->remUeCnt = cellSch->dl.maxUePerDlSf;
- /* Updating the Subframe information in RBAllocInfo */
- cellSch->allocInfo.dedAlloc.dedDlSf = dlSf;
- cellSch->allocInfo.msg4Alloc.msg4DlSf = dlSf;
-
- /* LTE_ADV_FLAG_REMOVED_START */
- /* Determine next scheduling subframe is ABS or not */
- if(RGR_ENABLE == cell->lteAdvCb.absCfg.status)
- {
- cell->lteAdvCb.absPatternDlIdx =
- ((frm.sfn*RGSCH_NUM_SUB_FRAMES_5G) + frm.slot) % RGR_ABS_PATTERN_LEN;
- cell->lteAdvCb.absDlSfInfo = (RgSchAbsSfEnum)(cell->lteAdvCb.absCfg.absPattern[
- cell->lteAdvCb.absPatternDlIdx]);
-
- }
- else
- {
- cell->lteAdvCb.absDlSfInfo = RG_SCH_ABS_DISABLED;
- }
- /* LTE_ADV_FLAG_REMOVED_END */
-
-#ifdef RGR_V1
- cellSch->allocInfo.ccchSduAlloc.ccchSduDlSf = dlSf;
-#endif
-#ifdef LTEMAC_SPS
- /* Update subframe-wide allocation information with SPS allocation */
- rgSCHCmnSpsDlUpdDlSfAllocWithSps(cell, frm, dlSf);
-#endif
- return;
-}
-
-
-
-#ifdef DL_LA
-/**
- * @brief Check & Updates the TM Mode chnage threashold based on cqiiTbs and
- * actual iTbs
- *
- * @details
- *
- * Function: rgSCHCmnSendTxModeInd(cell, ueUl, newTxMode)
- * Purpose: This function sends the TX mode Change
- * indication to RRM
- * change
- *
- * Invoked by: CMN
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t newTxMode
- * @return Void
- **/
-static Void rgSCHCmnSendTxModeInd
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint8_t newTxMode
-)
-{
- RgmTransModeInd *txModeChgInd;
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
-
-
- if(!(ueDl->mimoInfo.forceTD & RG_SCH_CMN_TD_TXMODE_RECFG))
- {
- /* Mem Alloc */
- SCH_ALLOC(txModeChgInd, sizeof(RgmTransModeInd));
- if(txModeChgInd == NULLP)
- {
- DU_LOG("ERROR --> SCH : rgSCHCmnSendTxModeInd(): Memory allocation failed");
- return;
- }
- RG_SCH_FILL_RGM_TRANSMODE_IND(ue->ueId, cell->cellId, newTxMode, txModeChgInd);
- RgUiRgmChangeTransModeInd(&(cell->rgmSap->sapCfg.sapPst),
- cell->rgmSap->sapCfg.suId, txModeChgInd);
- }
-
- ue->mimoInfo.txModUpChgFactor = 0;
- ue->mimoInfo.txModDownChgFactor = 0;
- ueDl->laCb[0].deltaiTbs = 0;
-
- return;
-}
-
-/**
- * @brief Check & Updates the TM Mode chnage threashold based on cqiiTbs and
- * actual iTbs
- *
- * @details
- *
- * Function: rgSchCheckAndTriggerModeChange(cell, ueUl, iTbsNew)
- * Purpose: This function update and check for threashold for TM mode
- * change
- *
- * Invoked by: CMN
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t iTbs
- * @return Void
- **/
-Void rgSchCheckAndTriggerModeChange
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint8_t reportediTbs,
-uint8_t previTbs,
-uint8_t maxiTbs
-)
-{
- RgrTxMode txMode; /*!< UE's Transmission Mode */
- RgrTxMode modTxMode; /*!< UE's Transmission Mode */
-
-
- txMode = ue->mimoInfo.txMode;
-
- /* Check for Step down */
- /* Step down only when TM4 is configured. */
- if(RGR_UE_TM_4 == txMode)
- {
- if((previTbs <= reportediTbs) && ((reportediTbs - previTbs) >= RG_SCH_MODE_CHNG_STEPDOWN_CHECK_FACTOR))
- {
- ue->mimoInfo.txModDownChgFactor += RG_SCH_MODE_CHNG_STEPUP_FACTOR;
- }
- else
- {
- ue->mimoInfo.txModDownChgFactor -= RG_SCH_MODE_CHNG_STEPDOWN_FACTOR;
- }
-
- ue->mimoInfo.txModDownChgFactor =
- RGSCH_MAX(ue->mimoInfo.txModDownChgFactor, -(RG_SCH_MODE_CHNG_STEPDOWN_THRSHD));
-
- if(ue->mimoInfo.txModDownChgFactor >= RG_SCH_MODE_CHNG_STEPDOWN_THRSHD)
- {
- /* Trigger Mode step down */
- modTxMode = RGR_UE_TM_3;
- rgSCHCmnSendTxModeInd(cell, ue, modTxMode);
- }
- }
-
- /* Check for Setup up */
- /* Step Up only when TM3 is configured, Max possible Mode is TM4*/
- if(RGR_UE_TM_3 == txMode)
- {
- if((previTbs > reportediTbs) || (maxiTbs == previTbs))
- {
- ue->mimoInfo.txModUpChgFactor += RG_SCH_MODE_CHNG_STEPUP_FACTOR;
- }
- else
- {
- ue->mimoInfo.txModUpChgFactor -= RG_SCH_MODE_CHNG_STEPDOWN_FACTOR;
- }
-
- ue->mimoInfo.txModUpChgFactor =
- RGSCH_MAX(ue->mimoInfo.txModUpChgFactor, -(RG_SCH_MODE_CHNG_STEPUP_THRSHD));
-
- /* Check if TM step up need to be triggered */
- if(ue->mimoInfo.txModUpChgFactor >= RG_SCH_MODE_CHNG_STEPUP_THRSHD)
- {
- /* Trigger mode chnage */
- modTxMode = RGR_UE_TM_4;
- rgSCHCmnSendTxModeInd(cell, ue, modTxMode);
- }
- }
-
- return;
-}
-#endif
-
-/**
-* @brief Updates the GBR LCGs when datInd is received from MAC
- *
- * @details
- *
- * Function: rgSCHCmnIsDlCsgPrio (cell)
- * Purpose: This function returns if csg UEs are
- * having priority at current time
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgInfUeDatInd *datInd
- * @return Void
- **/
-Bool rgSCHCmnIsDlCsgPrio(RgSchCellCb *cell)
-{
-
- RgSchCmnDlCell *cmnDlCell = RG_SCH_CMN_GET_DL_CELL(cell);
-
- /* Calculating the percentage resource allocated */
- if(RGR_CELL_ACCS_HYBRID != rgSchCb[cell->instIdx].rgrSchedEnbCfg.accsMode)
- {
- return (FALSE);
- }
- else
- {
- if(((cmnDlCell->ncsgPrbCnt * 100) / cmnDlCell->totPrbCnt) < cell->minDlResNonCsg)
- {
- return (FALSE);
- }
- else
- {
- return (TRUE);
- }
- }
-}
-
-/**
-* @brief Updates the GBR LCGs when datInd is received from MAC
- *
- * @details
- *
- * Function: rgSCHCmnIsUlCsgPrio (cell)
- * Purpose: This function returns if csg UEs are
- * having priority at current time
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgInfUeDatInd *datInd
- * @return Void
- **/
-Bool rgSCHCmnIsUlCsgPrio(RgSchCellCb *cell)
-{
- RgSchCmnUlCell *cmnUlCell = RG_SCH_CMN_GET_UL_CELL(cell);
-
-
- /* Calculating the percentage resource allocated */
- if(RGR_CELL_ACCS_HYBRID != rgSchCb[cell->instIdx].rgrSchedEnbCfg.accsMode)
- {
- return (FALSE);
- }
- else
- {
- if (((cmnUlCell->ncsgPrbCnt * 100) /cmnUlCell->totPrbCnt) < cell->minUlResNonCsg)
- {
- return (FALSE);
- }
- else
- {
- return (TRUE);
- }
- }
-}
-
-/** @brief DL scheduler for SPS, and all other downlink data
- *
- * @details
- *
- * Function: rgSchCmnPreDlSch
- *
- * @param [in] Inst schInst;
- * Returns: Void
- *
- */
-Void rgSchCmnPreDlSch
-(
-RgSchCellCb **cell,
-uint8_t nCell,
-RgSchCellCb **cellLst
-)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell[0]);
- RgSchDlSf *sf;
- uint8_t idx;
-
-
- if(nCell > CM_LTE_MAX_CELLS)
- {
- return;
- }
-
- if (cell[0]->isDlDataAllwd && (cell[0]->stopDlSch == FALSE))
- {
- /* Specific DL scheduler to perform UE scheduling */
- cellSch->apisDl->rgSCHDlPreSched(cell[0]);
-
- /* Rearranging the cell entries based on their remueCnt in SF.
- * cells will be processed in the order of number of ue scheduled
- * in that cell */
- for (idx = 0; idx < nCell; idx++)
- {
- uint8_t j;
- cellSch = RG_SCH_CMN_GET_CELL(cell[idx]);
- sf = cellSch->allocInfo.dedAlloc.dedDlSf;
-
- if(idx == 0)
- {
- cellLst[idx] = cell[idx];
- continue;
- }
-
- for(j = 0; j < idx; j++)
- {
- RgSchCmnCell *cmnCell = RG_SCH_CMN_GET_CELL(cellLst[j]);
- RgSchDlSf *subfrm = cmnCell->allocInfo.dedAlloc.dedDlSf;
-
- if(sf->remUeCnt < subfrm->remUeCnt)
- {
- uint8_t k;
- for(k = idx; k > j; k--)
- {
- cellLst[k] = cellLst[k-1];
- }
- break;
- }
- }
- cellLst[j] = cell[idx];
- }
- }
- else
- {
- for (idx = 0; idx < nCell; idx++)
- {
- cellLst[idx] = cell[idx];
- }
- }
- return;
-}
-
-/** @brief DL scheduler for SPS, and all other downlink data
- * @details
- *
- * Function: rgSchCmnPstDlSch
- *
- * @param [in] Inst schInst;
- * Returns: Void
- *
- */
-Void rgSchCmnPstDlSch(RgSchCellCb *cell)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-
-
- if (cell->isDlDataAllwd && (cell->stopDlSch == FALSE))
- {
- cellSch->apisDl->rgSCHDlPstSched(cell->instIdx);
- }
-}
-
-uint8_t rgSCHCmnCalcPcqiBitSz(RgSchUeCb *ueCb, uint8_t numTxAnt)
-{
- uint8_t confRepMode;
- uint8_t pcqiSz;
- uint8_t ri;
- RgSchUePCqiCb *cqiCb = ueCb->nPCqiCb;
-
-
- confRepMode = cqiCb->cqiCfg.cqiSetup.prdModeEnum;
- if((ueCb->mimoInfo.txMode != RGR_UE_TM_3) &&
- (ueCb->mimoInfo.txMode != RGR_UE_TM_4))
- {
- ri =1;
- }
- else
- {
- ri = cqiCb->perRiVal;
- }
- switch(confRepMode)
- {
- case RGR_PRD_CQI_MOD10:
- {
- pcqiSz = 4;
- }
- break;
-
- case RGR_PRD_CQI_MOD11:
- {
- if(numTxAnt == 2)
- {
- if (ri ==1)
- {
- pcqiSz = 6;
- }
- else
- {
- pcqiSz = 8;
- }
- }
- else if(numTxAnt == 4)
- {
- if (ri ==1)
- {
- pcqiSz = 8;
- }
- else
- {
- pcqiSz = 11;
- }
- }
- else
- {
- /* This is number of antenna case 1.
- * This is not applicable for Mode 1-1.
- * So setting it to invalid value */
- pcqiSz = 0;
- }
- }
- break;
-
- case RGR_PRD_CQI_MOD20:
- {
- if(cqiCb->isWb)
- {
- pcqiSz = 4;
- }
- else
- {
- pcqiSz = 4 + cqiCb->label;
- }
- }
- break;
-
- case RGR_PRD_CQI_MOD21:
- {
- if(cqiCb->isWb)
- {
- if(numTxAnt == 2)
- {
- if (ri ==1)
- {
- pcqiSz = 6;
- }
- else
- {
- pcqiSz = 8;
- }
- }
- else if(numTxAnt == 4)
- {
- if (ri ==1)
- {
- pcqiSz = 8;
- }
- else
- {
- pcqiSz = 11;
- }
- }
- else
- {
- /* This might be number of antenna case 1.
- * For mode 2-1 wideband case only antenna port 2 or 4 is supported.
- * So setting invalid value.*/
- pcqiSz = 0;
- }
- }
- else
- {
- if (ri ==1)
- {
- pcqiSz = 4 + cqiCb->label;
- }
- else
- {
- pcqiSz = 7 + cqiCb->label;
- }
- }
- }
- break;
- default:
- pcqiSz = 0;
- break;
- }
-
- return (pcqiSz);
-}
-
-/** @brief DL scheduler for SPS, and all other downlink data
- *
- * @details
- *
- * Function: rgSCHCmnDlSch
- *
- * @param [in] RgSchCellCb *cell
- *
- * Returns: Void
- *
- */
-Void rgSCHCmnDlSch(RgSchCellCb *cell)
-{
- RgSchDlSf *dlSf;
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-#ifdef RG_5GTF
- RgSchDynTddCb *rgSchDynTddInfo = &(rgSchCb[cell->instIdx].rgSchDynTdd);
- uint16_t dlCntrlSfIdx;
-#endif
-
-
- dlSf = rgSCHUtlSubFrmGet(cell, cellSch->dl.time);
-#ifdef RG_5GTF
- if (rgSchDynTddInfo->isDynTddEnbld)
- {
- RG_SCH_DYN_TDD_GET_SFIDX(dlCntrlSfIdx, rgSchDynTddInfo->crntDTddSfIdx,
- RG_SCH_CMN_DL_DELTA);
- if(RG_SCH_DYNTDD_DLC_ULD == rgSchDynTddInfo->sfInfo[dlCntrlSfIdx].sfType)
- {
- if(1 == cell->cellId)
- {
- ul5gtfsidDlAlreadyMarkUl++;
- /*
- DU_LOG("\nINFO --> SCH : ul5gtfsidDlAlreadyMarkUl: %d, [sfn:sf] [%04d:%02d]\n",
- ul5gtfsidDlAlreadyMarkUl, cellSch->dl.time.sfn,
- cellSch->dl.time.slot);
- */
- }
- return;
- }
- }
-#endif
-
- /* Specific DL scheduler to perform UE scheduling */
- cellSch->apisDl->rgSCHDlNewSched(cell, &cellSch->allocInfo);
- /* LTE_ADV_FLAG_REMOVED_END */
-
- /* call common allocator for RB Allocation */
- rgSCHCmnDlRbAlloc(cell, &cellSch->allocInfo);
-
- /* Finalize the Allocations for reqested Against alloced */
- rgSCHCmnDlAllocFnlz(cell);
-
- /* Perform Pdcch allocations for PDCCH Order Q.
- * As of now, giving this the least preference.
- * This func call could be moved above other allocations
- * as per need */
- rgSCHCmnGenPdcchOrder(cell, dlSf);
-
- /* Do group power control for PUCCH */
- rgSCHCmnGrpPwrCntrlPucch(cell, dlSf);
-
- return;
-}
-
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/**********************************************************************
- Name: LTE MAC SC1 scheduler
-
- Type: C header file
-
- Desc: Defines required by SC1 scheduler
-
- File: rg_sch_cmn.h
-
-*********************************************************************21*/
-
-\f
-#ifndef __RGSCHCMNH__
-#define __RGSCHCMNH__
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/***********************************************************************
- Macro Definitions
- ***********************************************************************/
-
-/* Scheduler1 tunable params */
-#define RG_SCH_CMN_GET_DL_SCHED_TYPE(cell) rgSchCb[cell->instIdx].rgrSchedEnbCfg.dlSchdType
-#define RG_SCH_CMN_GET_UL_SCHED_TYPE(cell) rgSchCb[cell->instIdx].rgrSchedEnbCfg.ulSchdType
-#define RG_SCH_CMN_GET_SCHED_CFG(cell) rgSchCb[cell->instIdx].rgrSchedEnbCfg
-#define RG_SCH_CMN_GET_ANT_PORTS(cell) rgSchCb[cell->instIdx].rgrSchedEnbCfg.numTxAntPorts
-#define RG_SCH_CMN_GET_CELL(cell) ((RgSchCmnCell *)((cell)->sc.sch))
-#define RG_SCH_CMN_GET_UL_CELL(cell) &(((RgSchCmnCell *)((cell)->sc.sch))->ul)
-#define RG_SCH_CMN_GET_DL_CELL(cell) &(((RgSchCmnCell *)((cell)->sc.sch))->dl)
-#define RG_SCH_CMN_GET_CMN_UE(ue) &(((RgSchCmnUe *)(((ue)->cellInfo[0])->sch))->cmn)
-#define RG_SCH_CMN_GET_UE(_ue,_cell) ((RgSchCmnUe *)((_ue->cellInfo[(_ue->cellIdToCellIdxMap\
- [RG_SCH_CELLINDEX(_cell)])])->sch))
-#define RG_SCH_CMN_GET_UL_UE(_ue,_cell) (&(((RgSchCmnUe *)((_ue->cellInfo[_ue->cellIdToCellIdxMap\
- [RG_SCH_CELLINDEX(_cell)]])->sch))->ul))
-#define RG_SCH_CMN_GET_DL_UE(_ue,_cell) (&(((RgSchCmnUe *)((_ue->cellInfo[_ue->cellIdToCellIdxMap\
- [RG_SCH_CELLINDEX(_cell)]])->sch))->dl))
-#define RG_SCH_CMN_GET_UE_HQE(_ue,_cell) (_ue->cellInfo[_ue->cellIdToCellIdxMap\
- [RG_SCH_CELLINDEX(_cell)]]->hqEnt)
-
-#define RG_SCH_CMN_GET_DL_HQP(hqP) ((RgSchCmnDlHqProc *)((hqP)->sch))
-#define RG_SCH_CMN_GET_DL_SVC(svc) ((RgSchCmnDlSvc *)((svc)->sch))
-#define RG_SCH_CMN_GET_UL_LCG(lcg) ((RgSchCmnLcg *)((lcg)->sch))
-
-/*f1b_Sprint3*/
-#define RG_SCH_IS_CELL_SEC(ue,cell) (((ue)->cellInfo[0]->sCellId != cell->cellId)? TRUE: FALSE)
-/*#define RG_SCH_IS_CELL_SEC(_ue,_cell) (((_ue)->cell != _cell)? TRUE: FALSE)*/
-/*f1b_Sprint3*/
-
-#define RG_SCH_CMN_GET_LC_SCH_SPFC(_ue,_svc,_cell) (((RgSchCmnDlSvc *)(_svc->sch))->schSpfc[\
- _ue->cellIdToCellIdxMap[RG_SCH_CELLINDEX(_cell)]])
-#define RG_SCH_CMN_GET_PA(_ue,_cell) (_ue->cellInfo[_ue->cellIdToCellIdxMap\
- [RG_SCH_CELLINDEX(_cell)]]->pA)
-/* Changing the check for retransmission - now checking if alloc
- * is non NULL instead of using the isRetx field of the harq Proc.
- */
-#define RG_SCH_CMN_IS_UL_UE_RETX(_ue, _cell) ((&RG_SCH_CMN_GET_UL_UE(_ue, _cell)->hqEnt.hqProcCb[\
- ((RgSchCmnCell *)(ue->cell->sc.sch))->ul.schdHqProcIdx])->alloc)
-
- /* Get acqiCb from appropiate ScellInfo */
-#define RG_SCH_CMN_GET_ACQICB(_ue,_cell) &(((_ue->cellInfo[_ue->cellIdToCellIdxMap\
- [RG_SCH_CELLINDEX(_cell)]])->acqiCb))
-
-#define RG_SCH_CMN_GET_SCELL_INFO(_ue,_cell) (_ue->cellInfo[_ue->cellIdToCellIdxMap\
- [RG_SCH_CELLINDEX(_cell)]])
-
-#define RG_SCH_CMN_GET_PCELL_INFO(_ue) (_ue->cellInfo[0])
-
- /* Added support for SPS*/
-#ifdef LTEMAC_SPS
-#define RGSCH_SPS_MAX_SPS_ACTVN_BO 400
-#define RGSCH_SPS_MAX_DL_HQP_TX 4
-#define RGSCH_SPS_MAX_UL_ACT_CRC_FAIL 3
-#define RGSCH_SPS_MAX_UL_SPS_OCC_CRC_FAIL 3
-#define RGSCH_SPS_MAX_UL_REL_PDCCH 2
-#define RG_SCH_CMN_GET_UL_SPS_CELL(cell) &(((RgSchCmnCell *)((cell)->sc.sch))->ul.ulSpsInfo)
-#define RG_SCH_CMN_GET_UL_SPS_UE(_ue,_cell) &(_ue->ul.ulSpsInfo)
-#define RG_SCH_CMN_SID_PACKET_SIZE 10
-#define RG_SCH_CMN_SPS_BSR_HEADROOM 6 /* PHR 2 bytes + Long BSR 4 bytes*/
-
-
-#define RGSCH_CMN_MIN_SCALABLE_CQI RGSCH_SPS_CQI_SCALE_FACTOR+1
-/* Introduced timing delta for DL control in FDD */
-#ifdef LTE_TDD
-#define RGSCH_SPS_UL_LCM 40 /* Default lcm to start the spsSfTbl with */
-#else
-#define RGSCH_SPS_UL_DELTA (TFU_DLCNTRL_DLDELTA + RGSCH_PDCCH_PUSCH_DELTA)
-#define RGSCH_SPS_UL_LCM 20 /* Default lcm to start the spsSfTbl with */
-#endif
-
-
-
-#define RG_SCH_CMN_IS_SPS_SCHD(_ue, _cell) (((((&RG_SCH_CMN_GET_UL_UE(_ue, _ue->cell)->hqEnt.hqProcCb[\
- ((RgSchCmnCell *)(_ue->cell->sc.sch))->ul.schdHqProcIdx])->alloc) &&\
-((&RG_SCH_CMN_GET_UL_UE(_ue, _ue->cell)->hqEnt.hqProcCb[\
- ((RgSchCmnCell *)(_ue->cell->sc.sch))->ul.schdHqProcIdx])->alloc->rnti == _ue->spsRnti) ? TRUE:FALSE)) || \
- (_ue->ul.relPdcchSchdTime.sfn == _cell->crntTime.sfn && _ue->ul.relPdcchSchdTime.slot == _cell->crntTime.slot))
-#endif /* LTEMAC_SPS */
-
-/* RRM_SP1_START */
-#define RG_SCH_CALC_GBR_UTILIZATION(_cell, _lcCb, _prbUsed) {\
- if(_lcCb->qciCb->qci <= RGM_MAX_QCI_REPORTS)\
- {\
- _cell->prbUsage.qciPrbRpts[_lcCb->qciCb->qci-1].dlTotPrbUsed += _prbUsed;\
- _cell->prbUsage.qciPrbRpts[_lcCb->qciCb->qci-1].qci = _lcCb->qciCb->qci;\
- }\
-}
-/* RRM_SP1_END */
-
-
- /* This is added due to the limitation in BRDCM Platform
- * BRDCM support only one Aperiodic Cqi reception in one UL Sf at lower MCS
- * Note: Should be removed once BRDCM provides support for this */
-#define RG_SCH_MAX_ACQI_PER_ULSF 1
-
-#define RG_SCH_CMN_IS_UE_SCHDLD(_ue, _cell) (((RgSchCmnUe *)((_ue->cellInfo[_ue->cellIdToCellIdxMap\
- [RG_SCH_CELLINDEX(_cell)]])->sch))->dl.proc != NULLP)
-#define RG_SCH_CMN_PROC_SLCTD_FOR_RETX(proc) ((proc->tbInfo[0].txCntr!=0) ||\
- (proc->tbInfo[1].txCntr!=0))
-#define RG_SCH_CMN_DL_IS_UE_ACTIVE(ue) (ue->dl.dlInactvMask == 0)
-#define RG_SCH_CMN_UL_IS_UE_ACTIVE(ue) (ue->ul.ulInactvMask == 0)
-/* ulInactvMask and dlInactvMask are simulataneously set/reset
- * hence check against one suffices */
-#define RG_SCH_CMN_IS_UE_PDCCHODR_INACTV(ue) (ue->ul.ulInactvMask & RG_PDCCHODR_INACTIVE)
-
-/* Adding routines to check Ue's Active state before triggering UE's Active transition */
-#define RG_SCH_CMN_DL_UPDT_INACTV_MASK( cellCb, ue, maskElmnt) \
- if(RG_SCH_CMN_DL_IS_UE_ACTIVE(ue)) \
- { \
- ue->dl.dlInactvMask &= ~maskElmnt; \
- } \
- else \
- { \
- ue->dl.dlInactvMask &= ~maskElmnt; \
- if(RG_SCH_CMN_DL_IS_UE_ACTIVE(ue)) \
- { \
- rgSCHUtlDlActvtUe(cellCb, ue); \
- } \
- }
-
-#define RG_SCH_CMN_UL_UPDT_INACTV_MASK( cellCb, ue, maskElmnt) \
- if(RG_SCH_CMN_UL_IS_UE_ACTIVE(ue)) \
- { \
- ue->ul.ulInactvMask &= ~maskElmnt; \
- } \
- else \
- { \
- ue->ul.ulInactvMask &= ~maskElmnt; \
- if(RG_SCH_CMN_UL_IS_UE_ACTIVE(ue)) \
- { \
- rgSCHUtlUlActvtUe(cellCb, ue); \
- } \
- }
-
-#define RG_SCH_CMN_CSG_REFRESH_TIME 16
-#define RG_SCH_CMN_OVRLDCTRL_REFRESH_TIME 50
-
-/* totPrbCnt is set to 1 to avoid division by zero */
-#define RG_SCH_RESET_HCSG_DL_PRB_CNTR(_cmnDlCell) \
-{ \
- (_cmnDlCell)->ncsgPrbCnt = 0; \
- (_cmnDlCell)->totPrbCnt = 1; \
-}
-
-#define RG_SCH_RESET_HCSG_UL_PRB_CNTR(_cmnUlCell) \
-{ \
- (_cmnUlCell)->ncsgPrbCnt = 0; \
- (_cmnUlCell)->totPrbCnt = 1; \
-}
-
-#define RG_SCH_CMN_DL_SVC_IS_GBR(svc) ((((RgSchCmnDlSvc*)(svc->sch))->qci >= RG_SCH_CMN_GBR_QCI_START) && \
- (((RgSchCmnDlSvc*)(svc->sch))->qci <= RG_SCH_CMN_GBR_QCI_END))
-
-/* Moved the below tables to rg_env_*.h files */
-
-
-#define RG_SCH_CMN_SET_FORCE_TD(_ue,_cell, _event)\
- {\
- RgSchCmnDlUe *_ueDl = RG_SCH_CMN_GET_DL_UE(_ue,_cell);\
- _ueDl->mimoInfo.forceTD |= (_event);\
- }
-#define RG_SCH_CMN_UNSET_FORCE_TD(_ue,_cell, _event)\
- {\
- RgSchCmnDlUe *_ueDl = RG_SCH_CMN_GET_DL_UE(_ue,_cell);\
- _ueDl->mimoInfo.forceTD &= ~(_event);\
- }
-#define RG_SCH_CMN_INIT_FORCE_TD(_ue,_cell, _val)\
- {\
- RgSchCmnDlUe *_ueDl = RG_SCH_CMN_GET_DL_UE(_ue,_cell);\
- _ueDl->mimoInfo.forceTD = (_val);\
- }
-
-#define RG_SCH_CMN_DL_TBS_TO_MCS(x, y) do {\
- if (x <= 9) y = x; \
- else if (x <= 15) y = x + 1; \
- else y = x + 2;\
-} while(0)
-
-#define RG_SCH_CMN_DL_MCS_TO_TBS(x, y) do {\
- if (x <= 9) y = x; \
- else if (x <= 16) y = x - 1; \
- else y = x - 2; \
-}while(0)
-
-#define RG_SCH_CMN_UL_TBS_TO_MCS(x, y) do {\
- if (x <= 10) y = x; \
- else if (x <= 19) y = x + 1; \
- else y = x + 2;\
-} while(0)
-
-#ifdef LTE_TDD
-#define RG_SCH_CMN_CHK_DL_DATA_ALLOWED(_cell, _idx)\
-(rgSchTddUlDlSubfrmTbl[_cell->ulDlCfgIdx][_idx] == RG_SCH_TDD_DL_SUBFRAME) ||\
-((rgSchTddUlDlSubfrmTbl[_cell->ulDlCfgIdx][_idx] == RG_SCH_TDD_SPL_SUBFRAME) &&\
- (_cell->splSubfrmCfg.isDlDataAllowed == TRUE))
-#define RG_SCH_CMN_ADJ_DWPTS_ITBS(_cellDl, _iTbs) \
-{\
- if (_iTbs > 0)\
- {\
- _iTbs += rgSchCmnSplSfDeltaItbs[_cellDl->splSfCfg];\
- if ((S8)_iTbs < 0)\
- {\
- _iTbs = 0;\
- }\
- }\
- if (_iTbs > 26)\
- {\
- _iTbs = 26;\
- }\
-}
-#endif
-
-/* RACHO start */
-/* minimum grant, in bytes, to be given to HO and pdcchOrdered UEs */
-#define RG_SCH_MIN_GRNT_HOPO 2
-/* maximum dedPrmbls */
-#define RG_SCH_MAX_DED_PRMBLS 60
-/* is PDCCH order generation supported */
-#define RG_SCH_CMN_IS_PO_SPRTD(cell) (cell->rachCfg.raOccasion.sfnEnum != RGR_SFN_NA)
-/* Min gap value between crntTime and time of PRACH Oppurtunity */
-/* RG_SCH_CMN_DL_DELTA is the number of SFs from crntTime at which
- * UE is expected to recieve PDCCH Order.
- * n+6 as per 213 6.1.1 last para */
-#define RG_SCH_CMN_MIN_PRACH_OPPR_GAP (6+RG_SCH_CMN_DL_DELTA)
-/* Idle time threshold in terms of subframes, implies
- * the max duration between a TA expiry and latest UL
- * data/Signal transmission time */
- /* Fix : syed Ignore if TaTmr is not configured */
-#define RG_SCH_CMN_UE_IDLE_THRSLD(ue) (RG_SCH_CMN_UE_IDLETIME_FCTR * ue->dl.taCb.cfgTaTmr)
-/* R8 Upgrade */
-#define RG_SCH_CMN_GET_BI_VAL(prevVal,numUe) ( prevVal + ( numUe * RG_SCH_CMN_BI_NUMUE_FACTOR ))
-#define RG_SCH_CMN_NUMUE_FACTOR 1
-#define RG_SCH_CMN_BITBL_INDEX(x) ((x/RG_SCH_CMN_NUMUE_FACTOR)>=12)? 12:(x/RG_SCH_CMN_NUMUE_FACTOR)
-#define RG_SCH_CMN_GET_BI(numUe) rgSchCmnBiTbl[RG_SCH_CMN_BITBL_INDEX((numUe))]
-/* RACHO end */
-
-#define RG_SCH_CMN_SVC_IS_GBR(svc) ((((RgSchCmnDlSvc*)(svc->sch))->qci >= RG_SCH_CMN_GBR_QCI_START) && \
- (((RgSchCmnDlSvc*)(svc->sch))->qci <= RG_SCH_CMN_GBR_QCI_END))
-
-#define RG_SCH_CMN_SVC_IS_AMBR(svc) ((((RgSchCmnDlSvc*)(svc->sch))->qci > RG_SCH_CMN_GBR_QCI_END) && \
- (((RgSchCmnDlSvc*)(svc->sch))->qci <= RG_SCH_CMN_MAX_QCI))
-
-#define RG_SCH_CMN_TBS_TO_MODODR(x, y) do {\
- if (x <= 5) y = 2; \
- else if (x <= 10) y = 4; \
- else y = 6;\
-} while(0)
-
-/* To include the length and ModOrder in DataRecp Req. */
-#define RG_SCH_UL_MCS_TO_MODODR(x, y) do {\
- RGSCH_ARRAY_BOUND_CHECK(0, rgUlIMcsTbl, x); \
- y = (TfuModScheme)rgUlIMcsTbl[x].qm;\
-} while(0)
-
-#define RG_SCH_CMN_ITBS_TO_RETX_IMCS(iTbs, iMcs) do {\
- if ((iTbs) <= 9) (iMcs) = 29; \
- else if ((iTbs) <= 15) (iMcs) = 30; \
- else (iMcs) = 31;\
-} while(0)
-
-/* Fix for ccpu00123919: In case of RETX TB scheduling avoiding recomputation of RB
- * and Tbs. Set all parameters same as Init TX except RV(only for NACKED) and
- * MCS. */
-#define RG_SCH_CMN_GET_MCS_FOR_RETX(tb, retxMcs) do {\
- if ((tb->isAckNackDtx == TFU_HQFDB_DTX)) { \
- retxMcs = tb->dlGrnt.iMcs; \
- } \
- else { \
- if (tb->dlGrnt.iMcs < 29) {\
- uint8_t _iTbs;\
- RG_SCH_CMN_DL_MCS_TO_TBS(tb->dlGrnt.iMcs, _iTbs);\
- RG_SCH_CMN_ITBS_TO_RETX_IMCS(_iTbs, retxMcs); \
- } \
- else {\
- retxMcs = tb->dlGrnt.iMcs; \
- }\
- }\
-}while(0)
-
-#define RG_SCH_CMN_DL_TBS_TO_MCS_DTX(proc, iTbs, imcs) do {\
- if ((proc->isAckNackDtx == TFU_HQFDB_DTX)) { \
- RG_SCH_CMN_DL_TBS_TO_MCS(iTbs, imcs); \
- } \
- else { \
- RG_SCH_CMN_ITBS_TO_RETX_IMCS(iTbs, imcs); \
- } \
-}while(0)
-
-#define RG_SCH_CMN_UL_IS_CQI_VALID(cqi) ((cqi) > 0 && (cqi) < RG_SCH_CMN_UL_NUM_CQI)
-
-#ifdef CCPU_OPT
-#define RG_SCH_CMN_DL_GET_HDR_EST(svc, hdrEst) do {\
- hdrEst = svc->estRlcHdrSz;\
- hdrEst += RG_SCH_CMN_DED_MAX_HDRSIZE * RG_SCH_CMN_MAX_DED_SDU;\
- if (svc->staPduPrsnt) \
- {\
- hdrEst += RG_SCH_CMN_DED_MAX_HDRSIZE;\
- }\
-} while(0)
-#else
-#define RG_SCH_CMN_DL_GET_HDR_EST(svc, hdrEst) do {\
- hdrEst = RG_SCH_CMN_DED_MAX_HDRSIZE * RG_SCH_CMN_MAX_DED_SDU;\
-} while(0)
-#endif
-
-#define RGSCH_CMN_MIN_GRNT_HDR (RG_SCH_CMN_DED_MAX_HDRSIZE * RG_SCH_CMN_MAX_DED_SDU + 1)
-
-#define RG_SCH_CMN_MAX_UL_CONTRES_GRNT 4
-#define RG_SCH_CMN_UL_PRIOS RG_SCH_CMN_MAX_PRIO + 1
-#define RG_SCH_CMN_MAX_ALLOC_TRACK 10
-/* Introduced timing delta for UL control in FDD*/
-#define RG_SCH_CMN_MIN_BSR_RECP_INTRVL (TFU_ULCNTRL_DLDELTA + RGSCH_PDCCH_PUSCH_DELTA)
-#define RG_SCH_CMN_MIN_MSG3_RECP_INTRVL RG_SCH_CMN_DL_DELTA + RGSCH_RARSP_MSG3_DELTA
-/* Introduced timing delta for DL control in FDD */
-/* This interval RG_SCH_CMN_MIN_RETXMSG3_RECP_INTRVL is used in FDD only */
-#ifndef LTE_TDD
-#define RG_SCH_CMN_MIN_RETXMSG3_RECP_INTRVL (TFU_DLCNTRL_DLDELTA + RGSCH_PDCCH_PUSCH_DELTA)
-#endif
-/* Fixing the priority table to be more in line with the spec 23.203,table
- * 6.1.7 */
-#define RG_SCH_CMN_QCI_TO_PRIO {1, 3, 2, 4, 0, 5, 6, 7, 8}
-#define RG_SCH_CMN_DCCH_PRIO 0
-
-#define RG_SCH_CMN_GBR_QCI_START 1
-#define RG_SCH_CMN_GBR_QCI_END 4
-#define RG_SCH_CMN_NGBR_QCI_START 6
-#define RG_SCH_CMN_NGBR_QCI_END 9
-
-
-#define RG_SCH_CMN_UL_GBR_PRIO_START 1
-#define RG_SCH_CMN_UL_GBR_PRIO_END 4
-/* Introduced min & max qci for validation of qci */
-#define RG_SCH_CMN_MIN_QCI 1
-#define RG_SCH_CMN_MAX_QCI 9
-#define RG_SCH_CMN_NUM_QCI 9
-#define RG_SCH_CMN_MAX_CP 2
-#define RG_SCH_CMN_NOR_CP 0
-#define RG_SCH_CMN_EXT_CP 1
-#define RG_SCH_CMN_NUM_TBS 27
-#define RG_SCH_CMN_MAX_CQI 16
-#define RG_SCH_CMN_NUM_DCI 5 /* 6-0A, 6-1A, 6-0B, 6-1B and 6-2 */
-#define RB_SCH_CMN_NUM_SCS_PER_RB 12
-#define RG_SCH_CMN_NUM_RBS 110
-#define RG_SCH_CMN_UL_NUM_SF RGSCH_NUM_UL_HQ_PROC+8
-#define RG_SCH_CMN_UL_NUM_RE_PER_RB(cell) ((cell)->ulNumRePerRb)
-#ifdef LTE_TDD
-#define RG_SCH_CMN_MAX_CMN_PDCCH 6
-#else
-#define RG_SCH_CMN_MAX_CMN_PDCCH 4
-#endif
-#define RG_SCH_CMN_UL_MAX_CQI 16
-#define RG_SCH_CMN_UL_SR_BYTES 1
-/* Refresh Timer Defines */
-/* MS_WORKAROUND : syed tuning refresh time to 100ms for PFS */
-#define RG_SCH_CMN_REFRESH_TIME 32 /* Refresh time/cycle in frames (10ms) */
-/* Fix: syed align multiple UEs to refresh at same time */
-#define RG_SCH_CMN_REFRESH_TIMERES 10
-#define RG_SCH_CMN_NUM_REFRESH_Q 16
-#define RG_SCH_CMN_EVNT_UE_REFRESH 1
-
-#define RG_SCH_CMN_TPC_ACC_DEC_THRESHOLD 1
-#define RG_SCH_CMN_TPC_ACC_INC_1DB_THRESHOLD 1
-#define RG_SCH_CMN_TPC_ACC_INC_3DB_THRESHOLD 3
-#define RG_SCH_CMN_TPC_ABS_DEC_4DB_THRESHOLD 4
-#define RG_SCH_CMN_TPC_ABS_DEC_1DB_THRESHOLD 1
-#define RG_SCH_CMN_TPC_ABS_INC_1DB_THRESHOLD 4
-#define RG_SCH_CMN_TPC_ABS_INC_4DB_THRESHOLD 4
-
-/* ccpu00117606 - ADD - Include CRS REs while calculating Efficiency */
-#define RG_SCH_CMN_MAX_ANT_CONF 3
-#define RG_SCH_CMN_NUM_SLOTS_PER_SF 2
-/* ccpu00117606 - ADD - Defines for Effective Cell RS for different Tx Ant Ports */
-#define RG_SCH_CMN_EFF_CRS_ONE_ANT_PORT 6
-#define RG_SCH_CMN_EFF_CRS_TWO_ANT_PORT 12
-#define RG_SCH_CMN_EFF_CRS_FOUR_ANT_PORT 16
-
-/* ADD-new defines for Min & Max RI values */
-#define RG_SCH_CMN_MIN_RI 1
-#define RG_SCH_CMN_MAX_RI 4
-
-#define RG_SCH_CMN_MAX_CW_PER_UE 2
-
-#define RG_SCH_CMN_IS_RI_VALID(ri) \
- (ri >= RG_SCH_CMN_MIN_RI && ri <= RG_SCH_CMN_MAX_RI)
-
-#define RGSCHCMNADDTOCRNTTIME(crntTime, toFill, incr) \
-{\
- uint32_t absoluteTime;\
- absoluteTime = crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G + crntTime.slot;\
- absoluteTime += incr;\
- toFill.sfn = (absoluteTime /RGSCH_NUM_SUB_FRAMES_5G)% 1024;\
- toFill.slot = absoluteTime % RGSCH_NUM_SUB_FRAMES_5G;\
-}
-
-#define RG_SCH_CMN_PWR_USE_CFG_MAX_PWR (-128)
-
-#define RG_SCH_CMN_RARSP_WAIT_PRD 3
-
-#define RG_SCH_CMN_MAX_SPL_CFI 2
-#define RG_SCH_CMN_INVALID_INFO 0xff
-#define RG_SCH_CMN_NUM_SUBCAR 12
-
-#define RG_SCH_CMN_SUBFRM_0 0
-#define RG_SCH_CMN_SPL_SUBFRM_1 1
-#define RG_SCH_CMN_SUBFRM_5 5
-#define RG_SCH_CMN_SPL_SUBFRM_6 6
-
-#define RG_SCH_CMN_VALUE_ONE 1
-
-#define RG_SCH_CMN_IS_ODD(x) ((x) & 0x01)
-
-#define RG_SCH_CMN_MAX_NUM_OF_SFN 10240
-#define RG_SCH_CMN_MAX_SFN_NUM 1023
-
-#define RG_SCH_CMN_NUM_DL_AT_SWTCHPT 2
-
-#define RG_SCH_CMN_10_MS_PRD 10
-#define RG_SCH_CMN_5_MS_PRD 5
-
-#define RG_SCH_CMN_DECR_FRAME(_x, _y) {\
- S16 _tmpNo = (_x) - (_y); \
- if(_tmpNo < 0) { \
- (_x) = _tmpNo + RGSCH_MAX_SFN; \
- }\
- else {\
- (_x) = _tmpNo; \
- }\
-}
-
-#ifdef EMTC_ENABLE
-/* ADD-new hash define for max msg3 mcs val */
-#define RG_SCH_CMN_MAX_EMTC_MSG3_IMCS 7
-#endif
-
-#define RG_SCH_CMN_MAX_MSG3_IMCS 15
-
-#define RG_SCH_CMN_CALC_RARSPLST_SIZE(cell, raArrsz) {\
- S16 _sfNum=0; \
- /* Get the last UL subframe no */ \
- for(_sfNum=RGSCH_NUM_SUB_FRAMES-1; _sfNum >= 0; _sfNum--) \
- { \
- if(rgSchTddUlDlSubfrmTbl[(cell)->ulDlCfgIdx][_sfNum] == \
- RG_SCH_TDD_UL_SUBFRAME) \
- { \
- break; \
- } \
- } \
- (raArrSz) = (_sfNum + ((RgSchCmnCell *)(cell)->sc.sch)->dl.numRaSubFrms \
- + RG_SCH_CMN_RARSP_WAIT_PRD + \
- (cell)->rachCfg.raWinSize - 1) / RGSCH_NUM_SUB_FRAMES + 1; \
-}
-
-/* Resource allocation type MACROs */
-#define RG_SCH_CMN_RA_TYPE0 0
-#define RG_SCH_CMN_RA_TYPE1 1
-#define RG_SCH_CMN_RA_TYPE2 2
-/* Added support for SPS*/
-#ifdef LTEMAC_SPS
-#define RG_SCH_SPS_CONS_DYN_SCHD 5
-#define RG_SCH_SPS_CONS_RED_BO 5
-#define RG_SCH_DL_SPS_ADDTL_BO RGSCH_TA_SIZE /* 2 Bytes for TA */
-/* RBG subset MACROs for RA type 1 */
-#define RG_SCH_CMN_RBG_SUBSET0 0
-#define RG_SCH_CMN_RBG_SUBSET1 1
-#define RG_SCH_CMN_RBG_SUBSET2 2
-#define RG_SCH_CMN_RBG_SUBSET3 3
-#define RG_SCH_CMN_DL_NUM_ALLOCMASK 9
-#define RG_SCH_CMN_SPS_MAX_PRD 640
-#define RG_SCH_SPS_SID_INTERVAL 80
-#define RG_SCH_CMN_SPS_DL_ACTV (1 << 0)
-#define RG_SCH_CMN_SPS_DL_REACTV_FREQ (1 << 1)
-#define RG_SCH_CMN_SPS_DL_REACTV_TIME (1 << 2)
-#define RG_SCH_CMN_SPS_DL_REACTV \
-(RG_SCH_CMN_SPS_DL_REACTV_FREQ | RG_SCH_CMN_SPS_DL_REACTV_TIME)
-#define RG_SCH_CMN_SPS_DL_REL (1 << 3)
-#define RG_SCH_CMN_SPS_DL_MAX_N1PUCCH_IDX_PER_UE 4
-/* Number of 32 bit bitmasks for marking measurement gap for SPS */
-#define RG_SCH_CMN_SPS_DL_MEASGAP_32BITMASK_SIZE 3
-
-/* 32 Bit mask size for n1Pucch: RG_SCH_SPS_DL_MAX_N1PUCCH_PER_SF/32 */
-#define RG_SCH_CMN_SPS_DL_N1PUCCH_32BITMASK_SIZE \
- ((RG_SCH_SPS_DL_MAX_N1PUCCH_PER_SF + 31)/32)
-#define RG_SCH_CMN_SPS_DL_INVALIDCQI_VAL 20
-
-/* Maximum number of feasible periodicity values for SPS, SRS, CQI and SR */
-#define RG_SCH_CMN_SPS_MAX_NUM_PRD 21
-
-/* Maximum value of iMcs for SPS UE */
-#define RG_SCH_CMN_SPS_DL_MAX_MCS 15
-
-/* Minimum gap between SPEECH_GOOD packet and SID packet */
-#define RG_SCH_CMN_MIN_GAP_FOR_SID 60
-
-/* DL SPS function MACROs */
-
-
-#define RG_SCH_CMN_SPS_GET_DL_CELL(cell) &(((RgSchCmnCell *)((cell)->sc.sch))->dl.dlSpsInfo)
-#define RG_SCH_CMN_SPS_GET_DL_UE(_ue) &(((RgSchCmnUe *)(((_ue)->cellInfo[0])->sch))->dl.dlSpsInfo)
-#define RG_SCH_CMN_SPS_GET_DL_SVC(svc) &(((RgSchCmnDlSvc *)((svc)->sch))->dlSvcSpsInfo)
-#define RG_SCH_CMN_SPS_DL_IS_SPS_HQP(hqP) (((RgSchCmnDlHqProc *)((hqP)->sch))->isSpsSvcSchd)
-#define RG_SCH_CMN_SPS_DL_IS_SPS_TX_HQP(hqP) (((RgSchCmnDlHqProc *)((hqP)->sch))->isSpsActv)
-#define RG_SCH_CMN_IS_UE_SPS_SCHDLD(_ue, _cell, _schdTime)\
- ((((_ue)->cellInfo[(_ue->cellIdToCellIdxMap[RG_SCH_CELLINDEX(_cell)])])->dlAllocCb.spsSchdTime.sfn == _schdTime.sfn) &&\
- (((_ue)->cellInfo[(_ue->cellIdToCellIdxMap[RG_SCH_CELLINDEX(_cell)])])->dlAllocCb.spsSchdTime.slot == _schdTime.slot))
-
-#define RG_SCH_CMN_DL_COUNT_ONES(_bitMask, _size, _numOnes)\
-{\
- uint8_t _pos = 0;\
- *_numOnes = 0;\
- for (_pos = 0; _pos < _size; ++_pos)\
- {\
- *_numOnes += (_bitMask & (1 << (31 - _pos))) ? 1: 0;\
- }\
-}
-
-#define RG_SCH_CMN_DL_GET_START_POS(_allocedBitmask, _size, _startPos)\
-{\
- uint8_t _pos = 0;\
- for (_pos = 0; _pos < _size; ++_pos)\
- {\
- if ((_allocedBitmask & (1 << (31 -_pos))))\
- {\
- continue;\
- }\
- else\
- {\
- *_startPos = _pos;\
- break;\
- }\
- }\
-}
-
-/* This macros returns position of idx in a 32 bit bitmask from LSB */
-#define RG_SCH_CMN_DL_GET_POS_FRM_LSB(_idx) (31 - (_idx))
-
-#define RG_SCH_CMN_SPS_GET_PRD_IDX(_prdVal, _prdIdx)\
-{\
- switch (_prdVal)\
- {\
- case 2: *_prdIdx = RG_SCH_CMN_SPS_PRD_2SF; break;\
- case 5: *_prdIdx = RG_SCH_CMN_SPS_PRD_5SF; break;\
- case 10: *_prdIdx = RG_SCH_CMN_SPS_PRD_10SF; break;\
- case 20: *_prdIdx = RG_SCH_CMN_SPS_PRD_20SF; break;\
- case 30: *_prdIdx = RG_SCH_CMN_SPS_PRD_30SF; break;\
- case 32: *_prdIdx = RG_SCH_CMN_SPS_PRD_32SF; break;\
- case 40: *_prdIdx = RG_SCH_CMN_SPS_PRD_40SF; break;\
- case 60: *_prdIdx = RG_SCH_CMN_SPS_PRD_60SF; break;\
- case 64: *_prdIdx = RG_SCH_CMN_SPS_PRD_64SF; break;\
- case 80: *_prdIdx = RG_SCH_CMN_SPS_PRD_80SF; break;\
- case 120: *_prdIdx = RG_SCH_CMN_SPS_PRD_120SF; break;\
- case 128: *_prdIdx = RG_SCH_CMN_SPS_PRD_128SF; break;\
- case 160: *_prdIdx = RG_SCH_CMN_SPS_PRD_160SF; break;\
- case 256: *_prdIdx = RG_SCH_CMN_SPS_PRD_256SF; break;\
- case 320: *_prdIdx = RG_SCH_CMN_SPS_PRD_320SF; break;\
- case 512: *_prdIdx = RG_SCH_CMN_SPS_PRD_512SF; break;\
- case 640: *_prdIdx = RG_SCH_CMN_SPS_PRD_640SF; break;\
- case 1024: *_prdIdx = RG_SCH_CMN_SPS_PRD_1024SF; break;\
- case 1280: *_prdIdx = RG_SCH_CMN_SPS_PRD_1280SF; break;\
- case 2048: *_prdIdx = RG_SCH_CMN_SPS_PRD_2048SF; break;\
- case 2560: *_prdIdx = RG_SCH_CMN_SPS_PRD_2560SF; break;\
- default: *_prdIdx = RG_SCH_CMN_SPS_PRD_INVALID;break;\
- }\
-}
-
-/* To be part of rg_env.h */
-/* Maximum n1Pucch values per sub-frame: multiple of 32 */
-#define RG_SCH_SPS_DL_MAX_N1PUCCH_PER_SF 96
-#define RG_SCH_SPS_DFLT_PRD 20
-#define RG_SCH_SPS_CQI_DECR_VAL 2
-
-#ifdef LTE_TDD
-/* Added RgrSpsPrd casting to overcome G++ compilation warning*/
-#define RGSCH_SPS_GET_PRDCTY(_prdEnum, _prd) \
-{ \
- switch((_prdEnum)) \
- { \
- case RGR_SPS_PRD_10SF: \
- (_prd) = (RgrSpsPrd)10; \
- break; \
- case RGR_SPS_PRD_20SF: \
- (_prd) = (RgrSpsPrd)20; \
- break; \
- case RGR_SPS_PRD_32SF: \
- (_prd) = (RgrSpsPrd)30; \
- break; \
- case RGR_SPS_PRD_40SF: \
- (_prd) = (RgrSpsPrd)40; \
- break; \
- case RGR_SPS_PRD_64SF: \
- (_prd) =(RgrSpsPrd)60; \
- break; \
- case RGR_SPS_PRD_80SF: \
- (_prd) = (RgrSpsPrd)80; \
- break; \
- case RGR_SPS_PRD_128SF: \
- (_prd) = (RgrSpsPrd)120; \
- break; \
- case RGR_SPS_PRD_160SF: \
- (_prd) = (RgrSpsPrd)160; \
- break; \
- case RGR_SPS_PRD_320SF: \
- (_prd) = (RgrSpsPrd)320; \
- break; \
- case RGR_SPS_PRD_640SF: \
- (_prd) = (RgrSpsPrd)640; \
- break; \
- default:\
- (_prd) = RGR_SPS_PRD_INVALID;\
- } \
-}
-#endif /*LTE_TDD*/
-/* ADD-hash define for actual transmission time */
-/* Feedback for RelPdcch should be received at MAC by HARQ_INTERVAL+
- * RG_TFU_HQ_IND_DELTA time.*/
-#define RG_SCH_CMN_SPS_TX_TIME (RG_SCH_CMN_HARQ_INTERVAL + TFU_HQFBKIND_ULDELTA)
-#endif /* LTEMAC_SPS */
-
-/* LTE_ADV_FLAG_REMOVED_START */
-#define RG_SCH_CMN_IS_UE_CELL_EDGE(_ue) _ue->lteAdvUeCb.rgrLteAdvUeCfg.isUeCellEdge;
-#define RG_SCH_CMN_IS_SFR_ENB(_rgSchCellCb) _rgSchCellCb->lteAdvCb.sfrCfg.status;
-#define RG_SCH_CMN_SFR_POOL(_subFrm) _subFrm->sfrTotalPoolInfo;
-
-#define RG_SCH_MAX_RNTP_SAMPLES 10000
-/* LTE_ADV_FLAG_REMOVED_END */
-
-#ifdef LTE_ADV
-#define RG_SCH_CMN_IS_SCELL_ACTV(_ue,_sCellIdx) (((_ue)->cellInfo[_sCellIdx] != NULLP) && \
- ((_ue)->cellInfo[_sCellIdx]->sCellState == RG_SCH_SCELL_ACTIVE))
-
-/* As per spec 36.133 sec 7.7.3*/
-#define RG_SCH_CMN_MAX_SCELL_ACT_DELAY 24
-#ifndef TDD
-#define RG_SCH_CMN_SCELL_ACT_DELAY_TMR (RG_SCH_CMN_MAX_SCELL_ACT_DELAY - TFU_HQFBKIND_ULDELTA - RG_SCH_CMN_HARQ_INTERVAL)
-#endif
-
-/* Is this harq proc belongs to P-cell or S-cell */
-#define RG_SCH_CMN_IS_PCELL_HQP(hqP) (((hqP->hqE->ue)&&(hqP->hqE->ue->cell == hqP->hqE->cell))?TRUE:FALSE)
-#define RG_SCH_CMN_GET_CELL_IDX_FROM_HQP(hqP) hqP->hqE->ue->cellIdToCellIdxMap[hqP->hqE->cell->cellId]
-#endif
-
-/* DL allocation MACROs */
-
-#define RG_SCH_CMN_GET_ALLOCCB_FRM_UE(_ue,_cell) &(((_ue)->cellInfo[(_ue)->cellIdToCellIdxMap\
- [RG_SCH_CELLINDEX(_cell)]])->dlAllocCb);
-#define RG_SCH_CMN_GET_ALLOCCB_FRM_RACB(_raCb) &((_raCb)->rbAllocInfo);
-#define RG_SCH_CMN_INIT_SCHD_LNK(_schdLstLnk, _node)\
-{\
- (_schdLstLnk)->node = (PTR)_node;\
- (_schdLstLnk)->prev = NULLP;\
- (_schdLstLnk)->next = NULLP;\
-}
-
-/* Changes for MIMO feature addition */
-#define RG_SCH_CMN_FILL_DL_TXINFO(_allocInfo, _rb, _sFlg, _prcInf, _numLyr, _sf)\
-{\
- _allocInfo->rbsReq = _rb;\
- _allocInfo->mimoAllocInfo.swpFlg = _sFlg;\
- _allocInfo->mimoAllocInfo.precIdxInfo = _prcInf;\
- _allocInfo->mimoAllocInfo.numTxLyrs = _numLyr;\
- _allocInfo->dlSf = _sf;\
-}
-
-#define RG_SCH_CMN_FILL_DL_TBINFO(_tbInfo, _bytsReq, _iTbs, _imcs, _tbCb, _noLyr)\
-{\
- (_tbInfo)->schdlngForTb = TRUE;\
- (_tbInfo)->bytesReq = _bytsReq;\
- (_tbInfo)->iTbs = _iTbs;\
- (_tbInfo)->imcs = _imcs;\
- (_tbInfo)->tbCb = _tbCb;\
- (_tbInfo)->noLyr = _noLyr;\
-}
-
-/* Bit Masks to Force Transmit diversity scheme */
-#define RG_SCH_CMN_TD_RI_1 0x01 /* Transmit Diversity due to RI==1 in case
- of TM3 */
-#define RG_SCH_CMN_TD_NO_PMI 0x02 /* Transmit Diversity due to No PMI */
-#define RG_SCH_CMN_TD_TXMODE_RECFG 0x04 /* Transmit Diversity due to TXMODE ReCfg */
-#define RG_SCH_CMN_TD_TXSCHEME_CHNG 0x08 /* Transmit Diversity due to TX scheme
- change */
-#define RG_SCH_CMN_TD_LAA_SINGLE_TB 0x10 /* Transmit Diversity due to one LAA TB
- scheduled */
-
-#define RG_SCH_MAX_UL_TX_ANT 2
-
-/*Maximum achievable code rate for non 64QAM UEs.
- *Value should NEVER be > than 93. Refer to 36.213, Table 7.2.3-1*/
-#define RG_SCH_CMN_MAX_CODE_RATE_16QAM 85 /* 85% code rate*/
-#define RG_SCH_CMN_MAX_EFF_BITS 4096
-
-/* Refer BI table from 36.321 Table 7.2.1 */
-#define RG_SCH_CMN_NUM_BI_VAL 13
-
-/*New macro to determine UE Category. We use the stored "ueCat" to
- * index a UE category array. Therefore, the stored ueCat is 1 less
- * than actual UE cateogry.*/
-#define RG_SCH_CMN_GET_UE_CTGY(ue) ((RG_SCH_CMN_GET_CMN_UE(ue))->ueCat + 1)
-/*ccpu00117270-ADD-END*/
-
-#define RG_SCH_CMN_UPD_RBS_TO_ADD(_CELL,_DLSF,_ALLCINFO,_RBSREQ,_RBSTOADD) \
-{\
- uint8_t addtlRbsAvl;\
- addtlRbsAvl = rgSCHCmnFindNumAddtlRbsAvl(_CELL,_DLSF,_ALLCINFO);\
- if(_RBSREQ > addtlRbsAvl)\
- {\
- _RBSTOADD = addtlRbsAvl;\
- }\
- else\
- {\
- _RBSTOADD = _RBSREQ;\
- }\
-}
- /* ccpu00126002 ADD macro added to check wrap around when index is reached
- MAX_CQI_RI_RPT_BUFF*/
-#define RG_SCH_INCR_CQIRI_INDEX(idx)\
-{\
- (idx)++;\
- if(MAX_CQI_RI_RPT_BUFF == idx)\
- {\
- idx = 0;\
- }\
- if(MAX_CQI_RI_RPT_BUFF <= idx)\
- {\
- printf("\n Invalid CQI write index:%d ",idx);\
- }\
-}
-#define RG_SCH_DECR_CQIRI_INDEX(idx)\
-{\
- if(0 == idx)\
- {\
- idx = (MAX_CQI_RI_RPT_BUFF -1 );\
- }\
- else\
- (idx)--;\
- if(0 > idx)\
- {\
- printf("\n Invalid CQI write index:%d ",idx);\
- }\
-}
-
-
-#define RG_SCH_CHK_ITBS_RANGE(_iTbs, _maxiTbs) \
-{\
- if (_iTbs < 0) \
- {\
- _iTbs = 0;\
- }\
- else if (_iTbs > (_maxiTbs))\
- {\
- _iTbs = (_maxiTbs);\
- }\
-}
-
-
-/* LTE_ADV_FLAG_REMOVED_START */
-#define RG_SCH_CMN_SFR_UPD_RBS_TO_ADD_IN_POOL(_CELL,_DLSF,_POOLINFO,_ALLCINFO,_RBSREQ,_RBSTOADD) \
-{\
- uint8_t addtlRbsAvl;\
- addtlRbsAvl = rgSCHCmnSFRFindNumAddtlRbsAvl(_CELL,_DLSF,_POOLINFO,_ALLCINFO);\
- if(_RBSREQ > addtlRbsAvl)\
- {\
- _RBSTOADD = addtlRbsAvl;\
- }\
- else\
- {\
- _RBSTOADD = _RBSREQ;\
- }\
-}
-/* LTE_ADV_FLAG_REMOVED_END */
-
-/* DELTA for CFI applying */
-#define RG_SCH_CFI_APPLY_DELTA 4
-#define RG_SCH_MAX_TX_LYRS_4 4 /*CA dev*/
-
-#define RG_SCH_CFI_STEP_UP(_cell, _cellSch, _currCfi)\
-{ \
- _cellSch->dl.newCfi = ((_currCfi) < _cell->dynCfiCb.maxCfi) ? \
- (_currCfi + 1):_cell->dynCfiCb.maxCfi; \
- _cell->dynCfiCb.cfiIncr++; \
-}
-
-#define RG_SCH_CFI_STEP_DOWN(_cell, _cellSch, _currCfi)\
-{ \
- _cellSch->dl.newCfi = _currCfi-1; \
- _cell->dynCfiCb.cfiDecr++; \
-}
-
-#define RG_SCH_UPDT_CW2_CQI(_cqiCw1,_cqiCw2,_diffCqi)\
- if (_cqiCw1 > rgSchCmnDlCqiDiffOfst[_diffCqi]) \
- {\
- _cqiCw2 = _cqiCw1 - rgSchCmnDlCqiDiffOfst[_diffCqi]; \
- } \
- else \
- { \
- _cqiCw2 = 1; \
- }
-
-#ifdef DL_LA
-/* TM Mode Step Up/Down Factor macros */
-#define RG_SCH_MODE_CHNG_STEPUP_FACTOR 1
-#define RG_SCH_MODE_CHNG_STEPDOWN_FACTOR 1
-#define RG_SCH_MODE_CHNG_STEPUP_THRSHD 150
-#define RG_SCH_MODE_CHNG_STEPDOWN_CHECK_FACTOR 10
-#define RG_SCH_MODE_CHNG_STEPDOWN_THRSHD 100
-
-#define RG_SCH_TXSCHEME_CHNG_THRSHD 5
-#define RG_SCH_TXSCHEME_CHNG_ITBS_FACTOR 5
-
-#define RG_SCH_FILL_RGM_TRANSMODE_IND(_ueId, _cellId, _mode, _txModChgInd)\
-{\
- _txModChgInd->usCrnti = _ueId;\
- _txModChgInd->bCellId = _cellId;\
- _txModChgInd->eMode = _mode - 1;\
-}
-#endif
-#ifdef __cplusplus
-}
-#endif
-#endif /* __RGSCHCMNH__ */
-
-/********************************************************************30**
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/**********************************************************************
-
- Name: LTE MAC SC1 scheduler
-
- Type: C include file
-
- Desc: Defines required by SC1 scheduler
-
- File: rg_sch_cmn.x
-
-**********************************************************************/
-/** @file rg_sch_cmn.x
-@brief This file contains data structures for the common module of the scheuler.
-*/
-
-#ifndef __RGSCHCMNX__
-#define __RGSCHCMNX__
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*-------------------------------------*
- * Common Scheduler DataStructure START
- *-------------------------------------*/
-typedef struct _rgDlSchdApis RgDlSchdApis;
-typedef struct _rgUlSchdApis RgUlSchdApis;
-typedef struct _rgDlfsSchdApis RgDlfsSchdApis;
-typedef Void (*RgDlSchdInits[RGSCH_NUM_SCHEDULERS]) ARGS((RgDlSchdApis *apis));
-typedef Void (*RgUlSchdInits[RGSCH_NUM_SCHEDULERS]) ARGS((RgUlSchdApis *apis));
-typedef Void (*RgDlfsSchdInits[RGSCH_NUM_SCHEDULERS]) ARGS((RgDlfsSchdApis *apis));
-#ifdef EMTC_ENABLE
-typedef struct _rgDlEmtcSchdApis RgDlEmtcSchdApis;
-typedef Void (*RgEmtcDlSchdInits[RGSCH_NUM_EMTC_SCHEDULERS]) ARGS((RgDlEmtcSchdApis *apis));
-typedef Void (*RgEmtcUlSchdInits[RGSCH_NUM_EMTC_SCHEDULERS]) ARGS((RgUlSchdApis *apis));
-#endif
-typedef struct rgSchCmnDlRbAllocInfo RgSchCmnDlRbAllocInfo;
-typedef struct rgSchCmnUeUlAlloc RgSchCmnUeUlAlloc;
-typedef struct rgSchCmnUlRbAllocInfo RgSchCmnUlRbAllocInfo;
-
-/**
- * @brief
- * Uplink Scheduler APIs.
- */
-struct _rgUlSchdApis
-{
- S16 (*rgSCHRgrUlUeCfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgrUeCfg *cfg,
- RgSchErrInfo *err));
- S16 (*rgSCHRgrUlUeRecfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgrUeRecfg *recfg,
- RgSchErrInfo *err));
- Void (*rgSCHFreeUlUe) ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
- S16 (*rgSCHRgrUlCellCfg) ARGS((RgSchCellCb *cell, RgrCellCfg *cfg,
- RgSchErrInfo *err));
- S16 (*rgSCHRgrUlCellRecfg) ARGS((RgSchCellCb *cell, RgrCellRecfg *recfg,
- RgSchErrInfo *err));
- Void (*rgSCHFreeUlCell) ARGS((RgSchCellCb *cell));
- S16 (*rgSCHRgrUlLcgCfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgSchLcgCb *lcg, RgrLcgCfg *cfg, RgSchErrInfo *errInfo));
- S16 (*rgSCHRgrUlLcCfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgrLchCfg *cfg, RgSchErrInfo *errInfo));
- S16 (*rgSCHRgrUlLcgRecfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgSchLcgCb *lcg, RgrLcgRecfg *recfg, RgSchErrInfo *errInfo));
- S16 (*rgSCHRgrUlLcRecfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgrLchRecfg *recfg, RgSchErrInfo *errInfo));
- Void (*rgSCHFreeUlLcg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchLcgCb *lcg));
- S16 (*rgSCHRgrUlLchDel) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, CmLteLcId lcId, uint8_t lcgId));
- Void (*rgSCHUlActvtUe) ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
- Void (*rgSCHUpdBsrShort) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchLcgCb *ulLcg, uint8_t bsr));
- Void (*rgSCHUpdBsrTrunc) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchLcgCb *ulLcg, uint8_t bsr));
- Void (*rgSCHUpdBsrLong) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, uint8_t bsArr[]));
- Void (*rgSCHContResUlGrant) ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
- Void (*rgSCHSrRcvd) ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
- Void (*rgSCHUlSched) ARGS((RgSchCellCb *cell, RgSchCmnUlRbAllocInfo
- *allocInfo));
- Void (*rgSCHUlRetxSched) ARGS((RgSchCellCb *cell, RgSchCmnUlRbAllocInfo *allocInfo));
- Void (*rgSCHUlCqiInd) ARGS(( RgSchCellCb *cell, RgSchUeCb *ue, TfuUlCqiRpt *ulCqiInfo));
- S16 (*rgSCHRgrUlLcgUpd) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgInfUeDatInd *datInd));
- Void (*rgSCHUlUeRefresh) ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
- Void (*rgSCHUlUeReset) ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
- Void (*rgSCHUlAllocFnlz) ARGS((RgSchCellCb *cell, RgSchCmnUlRbAllocInfo
- *allocInfo));
- Void (*rgSCHUlInactvtUes) ARGS((RgSchCellCb *cell, CmLListCp *lst));
-#ifdef EMTC_ENABLE
- Void (*rgSCHUlProcAddToRetx) ARGS((RgSchCellCb *cell,RgSchUlHqProcCb *hqP));
- S16 (*rgSCHUlUeHqEntInit) ARGS((RgSchCellCb *cell, RgUeUlHqCb *hqE));
- S16 (*rgSCHUlUeHqEntDeInit) ARGS((RgSchCellCb *cell, RgUeUlHqCb *hqE));
-#endif
-};
-#ifdef EMTC_ENABLE
-/**
- * @brief
- * DL Scheduler APIs For EMTC.
- */
-struct _rgDlEmtcSchdApis
-{
- S16 (*rgSCHRgrDlUeCfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgrUeCfg *cfg,
- RgSchErrInfo *err));
- S16 (*rgSCHRgrDlUeRecfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgrUeRecfg *recfg,
- RgSchErrInfo *err));
- Void (*rgSCHFreeDlUe) ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
- S16 (*rgSCHRgrDlCellCfg) ARGS((RgSchCellCb *cell, RgrCellCfg *cfg,
- RgSchErrInfo *err));
- S16 (*rgSCHRgrDlCellRecfg) ARGS((RgSchCellCb *cell, RgrCellRecfg *recfg,
- RgSchErrInfo *err));
- Void (*rgSCHFreeDlCell) ARGS((RgSchCellCb *cell));
- S16 (*rgSCHRgrDlLcCfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgSchDlLcCb *dl, RgrLchCfg *cfg,
- RgSchErrInfo *errInfo));
- S16 (*rgSCHRgrDlLcRecfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgSchDlLcCb *dl, RgrLchRecfg *recfg,
- RgSchErrInfo *errInfo));
- Void (*rgSCHFreeDlLc) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchDlLcCb *dlLc));
- Void (*rgSCHDlActvtUe) ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
- Void (*rgSCHDlNewSched) ARGS((RgSchCellCb *cell, RgSchEmtcDlSf *cntrlDlsf,RgSchEmtcDlSf *datDlsf));
- Void (*rgSCHDlPreSched) ARGS((RgSchCellCb *cell));
- Void (*rgSCHDlPstSched) ARGS((Inst schInst));
- Void (*rgSCHDlRetxSched) ARGS((RgSchCellCb *cell, RgSchEmtcDlSf *cntrlDlsf, RgSchEmtcDlSf *datDlsf));
- Void (*rgSCHDlCeSched) ARGS((RgSchCellCb *cell, RgSchCmnDlRbAllocInfo *allocInfo));
- Void (*rgSCHDlDedBoUpd) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchDlLcCb *svc));
- Void (*rgSCHDlProcAddToRetx) ARGS((RgSchCellCb *cell,RgSchDlHqProcCb *hqP));
- Void (*rgSCHDlCqiInd) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, Bool isPucchInfo, Void *dlCqi));
- #ifdef TFU_UPGRADE
- Void (*rgSCHSrsInd) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, TfuSrsRpt*srsInd));
- #endif
- Void (*rgSCHDlAllocFnlz) ARGS((RgSchCellCb *cell, RgSchCmnDlRbAllocInfo
- *allocInfo));
- Void (*rgSCHDlUeRefresh) ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
- Void (*rgSCHDlUeReset) ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
- Void (*rgSCHDlInactvtUes) ARGS((RgSchCellCb *cell, CmLListCp *lst));
-
- S16 (*rgSCHDlUeHqEntInit) ARGS((RgSchCellCb *cell, RgSchDlHqEnt *hqE));
-
- S16 (*rgSCHDlUeHqEntDeInit) ARGS((RgSchCellCb *cell, RgSchDlHqEnt *hqE));
- Void (*rgSCHDlProcRmvFrmRetx) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchDlHqProcCb *hqP));
-#ifdef LTE_ADV
- S16 (*rgSCHRgrSCellDlUeCfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgSchErrInfo *err));
- S16 (*rgSCHRgrSCellDlUeDel) ARGS((RgSchUeCellInfo *sCellInfo, RgSchUeCb *ue));
- S16 (*rgSCHDlSCellDeactv) ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
- S16 (*rgSCHDlSCellActv) ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
-#endif
- Void (*rgSCHDlTickForPdbTrkng ) ARGS((RgSchCellCb *cell));
- S16 (*rgSCHDlFillFlwCtrlInfo) ARGS((RgSchCellCb *cell, RgInfSfAlloc *sfAlloc));
-};
-
-#endif
-/**
- * @brief
- * DL Scheduler APIs.
- */
-struct _rgDlSchdApis
-{
- S16 (*rgSCHRgrDlUeCfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgrUeCfg *cfg,
- RgSchErrInfo *err));
- S16 (*rgSCHRgrDlUeRecfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgrUeRecfg *recfg,
- RgSchErrInfo *err));
- Void (*rgSCHFreeDlUe) ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
- S16 (*rgSCHRgrDlCellCfg) ARGS((RgSchCellCb *cell, RgrCellCfg *cfg,
- RgSchErrInfo *err));
- S16 (*rgSCHRgrDlCellRecfg) ARGS((RgSchCellCb *cell, RgrCellRecfg *recfg,
- RgSchErrInfo *err));
- Void (*rgSCHFreeDlCell) ARGS((RgSchCellCb *cell));
- S16 (*rgSCHRgrDlLcCfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgSchDlLcCb *dl, RgrLchCfg *cfg,
- RgSchErrInfo *errInfo));
- S16 (*rgSCHRgrDlLcRecfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgSchDlLcCb *dl, RgrLchRecfg *recfg,
- RgSchErrInfo *errInfo));
- Void (*rgSCHFreeDlLc) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchDlLcCb *dlLc));
- Void (*rgSCHDlActvtUe) ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
- Void (*rgSCHDlNewSched) ARGS((RgSchCellCb *cell, RgSchCmnDlRbAllocInfo *allocInfo));
- Void (*rgSCHDlPreSched) ARGS((RgSchCellCb *cell));
- Void (*rgSCHDlPstSched) ARGS((Inst schInst));
- Void (*rgSCHDlRetxSched) ARGS((RgSchCellCb *cell, RgSchCmnDlRbAllocInfo *allocInfo));
- Void (*rgSCHDlCeSched) ARGS((RgSchCellCb *cell, RgSchCmnDlRbAllocInfo *allocInfo));
- Void (*rgSCHDlDedBoUpd) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchDlLcCb *svc));
- Void (*rgSCHDlProcAddToRetx) ARGS((RgSchCellCb *cell,RgSchDlHqProcCb *hqP));
- Void (*rgSCHDlCqiInd) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, Bool isPucchInfo, Void *dlCqi));
- #ifdef TFU_UPGRADE
- Void (*rgSCHSrsInd) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, TfuSrsRpt*srsInd));
- #endif
- Void (*rgSCHDlAllocFnlz) ARGS((RgSchCellCb *cell, RgSchCmnDlRbAllocInfo
- *allocInfo));
- Void (*rgSCHDlUeRefresh) ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
- Void (*rgSCHDlUeReset) ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
- Void (*rgSCHDlInactvtUes) ARGS((RgSchCellCb *cell, CmLListCp *lst));
-
- S16 (*rgSCHDlUeHqEntInit) ARGS((RgSchCellCb *cell, RgSchDlHqEnt *hqE));
-
- S16 (*rgSCHDlUeHqEntDeInit) ARGS((RgSchCellCb *cell, RgSchDlHqEnt *hqE));
- Void (*rgSCHDlProcRmvFrmRetx) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchDlHqProcCb *hqP));
-#ifdef LTE_ADV
- S16 (*rgSCHRgrSCellDlUeCfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgSchErrInfo *err));
- S16 (*rgSCHRgrSCellDlUeDel) ARGS((RgSchUeCellInfo *sCellInfo, RgSchUeCb *ue));
- S16 (*rgSCHDlSCellDeactv) ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
- S16 (*rgSCHDlSCellActv) ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
-#endif
- Void (*rgSCHDlTickForPdbTrkng ) ARGS((RgSchCellCb *cell));
- S16 (*rgSCHDlFillFlwCtrlInfo) ARGS((RgSchCellCb *cell, RgInfSfAlloc *sfAlloc));
-};
-
-/**
- * @brief
- * DLFS Scheduler APIs.
- */
-struct _rgDlfsSchdApis
-{
- S16 (*rgSCHDlfsCellCfg) ARGS((RgSchCellCb *cell, RgrCellCfg *cfg,
- RgSchErrInfo *err));
- S16 (*rgSCHDlfsCellRecfg) ARGS((RgSchCellCb *cell, RgrCellRecfg *recfg,
- RgSchErrInfo *err));
- Void (*rgSCHDlfsCellDel) ARGS((RgSchCellCb *cell));
- S16 (*rgSCHDlfsUeCfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgrUeCfg *cfg, RgSchErrInfo *err));
- S16 (*rgSCHDlfsUeRecfg) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgrUeRecfg *recfg, RgSchErrInfo *err));
- Void (*rgSCHDlfsUeDel) ARGS((RgSchCellCb *cell, RgSchUeCb *ue));
- Void (*rgSCHDlfsDlCqiInd) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- Bool isPucchInfo,
- Void *dlCqiRpt,
- CmLteTimingInfo timingInfo));
- Void (*rgSCHDlfsReinitSf) ARGS((RgSchCellCb *cell, RgSchDlSf *dlSf));
- Void (*rgSCHDlfsAllocRb) ARGS((RgSchCellCb *cell, RgSchCmnDlRbAllocInfo
- *dlRbAllocInfo));
- /* Added for BCCH/PCCH handling */
- Void (*rgSCHDlfsBcchPcchAllocRb) ARGS((RgSchCellCb *cell, RgSchCmnDlRbAllocInfo *dlRbAllocInfo));
- Void (*rgSCHDlfsAddUeToLst) ARGS((RgSchCellCb *cell, CmLListCp *lCp, RgSchDlHqProcCb *hqP));
-#ifdef LTE_ADV
- S16 (*rgSCHDlfsSCellUeCfg) ARGS((RgSchCellCb *sCell, RgSchUeCb *ueCb, RgrUeSecCellCfg *sCellCfg,RgSchErrInfo *err));
- S16 (*rgSCHDlfsSCellUeDel) ARGS((RgSchCellCb *sCell, RgSchUeCb *ueCb));
-#endif
-};
-
-typedef enum rgSchCmnTpcAccVal
-{
- RG_SCH_CMN_TPC_ACC_NEG_1DB = 0,
- RG_SCH_CMN_TPC_ACC_0DB = 1,
- RG_SCH_CMN_TPC_ACC_1DB = 2,
- RG_SCH_CMN_TPC_ACC_3DB = 3
-} RgSchCmnTpcAccVal;
-
-typedef enum rgSchCmnTpcAbsVal
-{
- RG_SCH_CMN_TPC_ABS_NEG_4DB = 0,
- RG_SCH_CMN_TPC_ABS_NEG_1DB = 1,
- RG_SCH_CMN_TPC_ABS_1DB = 2,
- RG_SCH_CMN_TPC_ABS_4DB = 3
-} RgSchCmnTpcAbsVal;
-/* Added changes of TFU_UPGRADE */
-#ifdef TFU_UPGRADE
-typedef enum rgSchCmnRank
-{
- RG_SCH_CMN_RANK_1 = 1,
- RG_SCH_CMN_RANK_2 = 2,
- RG_SCH_CMN_RANK_3 = 3,
- RG_SCH_CMN_RANK_4 = 4
-} RgSchCmnRank;
-#endif
-
-typedef struct rgSchCmnUlCqiInfo
-{
- uint8_t qm;
- uint16_t eff; /* Efficiency in terms of bits/RE */
-} RgSchCmnUlCqiInfo;
-
-RgSchCmnUlCqiInfo rgSchCmnUlCqiTbl[RG_SCH_CMN_UL_NUM_CQI];
-S8 rgSchCmnDlCqiDiffOfst[8];
-/* Added changes of TFU_UPGRADE */
-#ifdef TFU_UPGRADE
-S8 rgSchCmnApUeSelDiffCqi[4];
-S8 rgSchCmnApEnbConfDiffCqi[4];
-#endif
-
-
-uint8_t rgSchCmnUlCqiToTbsTbl[RG_SCH_CMN_MAX_CP][RG_SCH_CMN_UL_NUM_CQI];
-
-#if (LTEMAC_SPS & LTE_TDD)
-/* subframe offset values to be used when twoIntervalsConfig is enabled in UL
- * SPS for a UE */
-typedef S8 RgSchTddSfOffTbl[RGSCH_MAX_TDD_UL_DL_CFG][RGSCH_NUM_SUB_FRAMES];
-RgSchTddSfOffTbl rgSchTddSfOffTbl;
-
-#endif /* LTEMAC_SPS & LTE_TDD */
-
-/*--------------------------*
- * SPS specific declarations
- *---------------------------*/
-#ifdef LTEMAC_SPS
-
-/**
- * @brief
- * Downlink SPS scheduling information per UE
- */
-typedef struct rgSchCmnSpsDlUeSchdInfo
-{
- uint8_t scaledCqi; /*!< Assumed value of CQI for transmission */
- uint16_t actvSfTblIdx; /*!< Index into cell-wide DL SPS sub-frame
- table during activation */
- CmLteTimingInfo schdKey; /*!< Key into the list of DL SPS active
- UEs: next DL SPS ocassion */
- RgSchDlRbAlloc spsAllocInfo; /*!< Allocation information for an SPS active
- UE */
- uint8_t allocN1PucchIdx; /*!< Index value in UE's n1Pucch array
- of the allocated n1Pucch */
- //Bool pdcchPndng; /*!< Indicates if the activaton/
- // reactivation PDCCH needs to be sent
- // for this allocation */
-} RgSchCmnSpsDlUeSchdInfo;
-
-/**
- * @brief
- * Downlink stats information for SPS per UE
- */
-typedef struct rgSchCmnDlUeSpsStatInfo
-{
- uint32_t numSchedSPSRnti; /*!< Number of SPS occasions sched using SPS RNTI*/
- uint32_t totalSPSSchedOcc; /*!< Number of SPS occasions sched
- using SPS RNTI + CRNTI*/
- uint32_t numSpsReactv; /*!< Number of Reactivations */
- uint32_t numSpsActv; /*!< Number of activations */
- uint32_t numSpsRel; /*!< Number of Deactivations */
-}RgSchCmnDlUeSpsStatInfo;
-
-/**
- * @brief
- * Downlink information for SPS per UE
- */
-typedef struct rgSchCmnDlUeSpsInfo
-{
- CmLteTimingInfo prevDlBoUpdTm; /*!< BO updation interval*/
- CmLList zeroBOSvcUesEnt; /*!< Linked list entity for zeroBOSvcUes lst */
- CmLList actvUeLstEnt; /*!< Linked List entry for DL SPS
- active UE list*/
- CmLList pndngUeLstEnt;/*!< Linked List entry for UE list with
- pending SPS action:
- activation/reactivation/release */
- /* Added handling to retrnasmit RelPDCCH in case no
- feedback is received */
- CmLList wtngForRelFdbkUeEnt;/*!< Linked list entry for UE who
- have a feedback pending for
- Release PDCCH */
- RgSchDlLcCb *spsSvc; /*!< Pointer to the SPS service of the
- UE */
- CmLListCp *spsList; /*!< Pointer to the SPS list of which
- UE is a part */
- uint32_t measGapMask[RG_SCH_CMN_SPS_DL_MEASGAP_32BITMASK_SIZE];
- /*!< Indicates the DL sub-frames with
- ongoing measurement gap */
- uint16_t n1PucchIdx[RG_SCH_CMN_SPS_DL_MAX_N1PUCCH_IDX_PER_UE];
- /*!< N1Pucch indices configured for the UE */
- uint8_t actionPndng; /*!< Indicates the action pending on the UE
- activation/re-activation/release */
- uint8_t dlSpsStatus; /*!< Indicates the current status of DL SPS */
- uint8_t prdIdx; /*!< DL SPS periodicity index for the
- configured peridicity */
- RgSchCmnSpsDlUeSchdInfo dlSpsUeSchdInfo; /*!< Scheduled info for DL SPS
- active UE */
- Bool isRelPdcchSent; /*!< Indicates if release PDCCH is sent for
- this UE. For TDD, Used while sending DAI
- in DCI formats 0/1/1A/1B/1D/2/2A.
- For FDD, used to not repeat relPdcch
- till the feddback is recieved */
- uint8_t numRelPdcchSent; /*!< Number of times RelPdcch has been sent. */
-
- RgSchCmnDlUeSpsStatInfo statInfo; /*!< SPS Metric Info */
- uint8_t dynSchedCount; /*!< To track num of consecutive times SPS BO
- is sched dynamically */
- uint8_t reducedBoCount; /*!< To track num of consecutive times BO
- is lesser than SPS BO */
- uint32_t maxChgdBo; /* !< The Maximum of BO which is different from the
- BO for which SPS has been activated */
- uint32_t spsSchedBo; /* !< BO for which SPS is activated */
- Bool isDynSched; /* !< BO is dynamically scheduled */
-} RgSchCmnDlUeSpsInfo;
-
-/**
- * @brief
- * Downlink information for SPS per Cell
- */
-typedef struct rgSchCmnSpsDlSf
-{
- uint32_t rbsAlloc; /*!< Allocated BW for this subframe (in actual number of
- RBs) */
- RgSchDlSfAllocInfo spsAllocInfo; /*!< Allocation information for SPS BW */
- uint32_t n1PucchMask[RG_SCH_CMN_SPS_DL_N1PUCCH_32BITMASK_SIZE];
- /*!< N1Pucch allocation mask per Sub-frame */
- uint8_t numDlSpsActiveUes; /*!< number of DL SPS UEs that
- have been activated */
-} RgSchCmnSpsDlSf;
-
-/**
- * @brief
- * SPS N1Pucch Database for the cell
- */
-typedef struct rgSchCmnSpsDlN1Pucch RgSchCmnSpsDlN1Pucch;
-struct rgSchCmnSpsDlN1Pucch
-{
- uint16_t idx; /*!< Index in the n1PucchLst */
- uint16_t n1PucchVal; /*!< Pucch Value corresponding to the index */
- uint32_t numUes; /*!< Count of UEs with this N1Pucch value configured */
- uint16_t next; /*!< Next available index */
-};
-
-/**
- * @brief
- * SPS N1Pucch Database for the cell
- */
-typedef struct rgSchCmnSpsDlN1PucchDb
-{
- uint16_t numFreeN1Pucch; /*!< Number of free n1Pucch values */
- uint16_t numInUseN1Pucch; /*!< Number of inUse n1Pucch values
- */
- RgSchCmnSpsDlN1Pucch *freeN1PucchStart; /*!< Start for free n1Pucch list */
- RgSchCmnSpsDlN1Pucch *inUseN1PucchStart;/*!< Start for in-use n1Pucch list
- */
- RgSchCmnSpsDlN1Pucch n1PucchLst[RG_SCH_SPS_DL_MAX_N1PUCCH_PER_SF];
- /*!< List of cell wide n1Pucch
- values*/
-} RgSchCmnSpsDlN1PucchDb;
-
-/**
- * @brief
- * Downlink information for SPS per Cell
- */
-typedef struct rgSchCmnDlCellSpsInfo
-{
- CmLListCp zeroBOSvcUes; /*!< List of SPS services which
- are not sched at SPS Occasion due
- to zero BO*//* REVANTH_SPS_FIX */
- CmLListCp toBeSchdSvcs; /*!< List of SPS services to be scheduled */
- CmLListCp retxHqProcs; /*!< List of SPS HARQ procs for
- re-transmission: all the HARQ procs
- with isSpsSvcSchd = TRUE shall be
- part of this list */
- CmLListCp actvDlSpsUeLsts[RG_SCH_CMN_SPS_MAX_PRD];
- /*!< Array of list of UE control blocks with
- DL SPS activated: index - next time of
- transmission */
- CmLListCp toBeActvtdUes; /*!< List of DL SPS UEs with pending
- activation/re-activation */
- CmLListCp toBeRelUes; /*!< List of DL SPS enabled UEs with release
- pending */
- /* Added handling when no feedback is received
- for the Release PDCCH sent
- */
- CmLListCp wtngForRelFdbkUeLst[RGSCH_NUM_SUB_FRAMES]; /*!< List of DL SPS
- enabled UEs waiting
- for feedback for
- Release PDCCH sent
- */
- uint16_t spsPrdLcmVal; /*!< LCM value for all configured
- SPS periodicities: maxVal = 640 for FDD
- and (640 * 3) for TDD */
- uint8_t lcmIdx; /*!< Index value for computed LCM */
- RgSchCmnSpsDlSf *spsSfTbl; /*!< DL sub-frame information for the cell*/
- RgSchCmnSpsDlN1PucchDb n1PucchDb; /*!< Database of configured n1Pucch values
- */
-} RgSchCmnDlCellSpsInfo;
-
-/**
- * @brief
- * Information per uplink SPS allocation
- */
-typedef struct rgSchCmnSpsUlAlloc
-{
- uint8_t sbStart; /*!< Starting subband of the alloc */
- uint8_t numSb; /*!< Num of subbands in the alloc */
-} RgSchCmnSpsUlAlloc;
-
-/**
- * @brief
- * Uplink information for SPS per subframe
- */
-typedef struct rgSchCmnSpsUlSf
-{
- uint32_t ulBwBitMask[RGSCH_SPS_ULBW_MASK_LEN]; /*!< Bitmask indicating the alloc/hole info
- for SPS BW. Bit set at position 'x'
- indicates subband 'x' is occupied */
- uint8_t maskLen; /*!< Length of ulBwBitMask based on numSb */
- uint8_t numUlSpsActiveUes; /*!< Number of UL SPS Active UEs in this Subframe */
- RgSchCmnSpsUlAlloc allocInfo; /*!< Info per SPS Allocation - Used to mark
- previous allocations in a subframe */
-} RgSchCmnSpsUlSf;
-
-/**
- * @brief
- * Uplink information for SPS per Cell
- */
-typedef struct rgSchCmnUlCellSpsInfo
-{
- uint8_t spsSbStart; /*!< Starting subband of SPS BW */
- uint8_t numSpsSb; /*!< number of subbands for SPS */
- uint16_t spsPrdLcmVal; /*!< LCM value for all configured UL
- SPS periodicities:maxVal = 640 for FDD
- and (640 * 3) for TDD */
- RgSchCmnSpsUlSf *spsSfLst; /*!< UL subframe information for the cell*/
- CmLListCp actvUlSpsUeLsts[RG_SCH_CMN_SPS_MAX_PRD];
- /*!< Array of list of UeCbs with
- UL SPS activated: index - next time of
- transmission */
- CmLListCp toBeActvtdUeLst; /*!< List of ULSPS enabled UEs with pending
- activation */
- CmLListCp toBeRelUeLst; /*!< List of ULSPS enabled UEs with release
- pending */
-} RgSchCmnUlCellSpsInfo;
-
-
-#endif
-/*--------------------------*
- * SPS specific declarations End
- *---------------------------*/
-/**
- * @brief
- * Scheduler uplink scheduling parameters related to random access.
- */
-typedef struct rgSchCmnUlCellRa
-{
- uint8_t prmblANumSb; /*!< Number of msg3 RBs to allocate for preamble A */
- uint8_t prmblAIMcs; /*!< Imcs for msg3 when preamble A was used */
- uint8_t prmblBNumSb; /*!< Number of msg3 RBs to allocate for preamble B */
- uint8_t prmblBIMcs; /*!< Imcs for msg3 when preamble B was used */
-} RgSchCmnUlCellRa;
-
-typedef struct rgSchCmnCellClcITbs
-{
- uint8_t iTbs2Rbs; /*!< iTbs value for 2 Rbs precomputed at cell cfg */
- uint8_t iTbs3Rbs; /*!< iTbs value for 3 Rbs precomputed at cell cfg */
-}RgSchCmnCellClcITbs;
-
-typedef struct rgSchCmnDlCell
-{
- Bool isDlFreqSel; /*!< Bool indicating if cell is frequency
- selective or not */
- uint8_t maxUeNewTxPerTti; /*!< Max UEs to be considered for New Tx Alloc in DL */
- uint8_t numRaSubFrms; /*!< Number of frames of RA transmission */
- uint8_t iTbsCap; /*!< Max value DL iTbs capped to */
- uint16_t nCce; /*!< Number of CCEs computed based on CFI */
- uint8_t maxDlBwPerUe; /*!< Max DL B/W per UE */
- uint8_t maxDlRetxBw; /*!< Max DL retx B/W, as part of 256 */
- uint8_t maxUePerDlSf; /*!< Max UE to be considered for DL scheduling
- * in a TTI */
- /*[ccpu00138609]-ADD- max Msg4/ DL CCCH UE configuration */
- uint8_t maxCcchPerDlSf; /*!< Max Msg4/DL CCCH UE sched in Dlsf */
- uint8_t msg4TxDelay; /*!< Max estimated time for HARQ tx
- of msg4 based on the Harq RTT and
- max Harq retries for msg4 */
- RgSchCmnCellClcITbs cmnChITbs; /*!< iTbs value for 2 Rbs precomputed at cell cfg */
- CmLteAggrLvl cmnChAggrLvl; /*!< Precomputed aggregation level for common channel */
- uint8_t ccchCqi; /*!< Default Cqi to be used for Msg4 and UE */
- CmLListCp msg4RetxLst; /*!< Queue to hold Msg4 procs for retransmission */
- /* Changes for CR timer */
-#ifdef RGR_V1
- CmLListCp ccchSduRetxLst; /*!< Queue to hold CCCH SDU procs for retransmission */
-#endif
-#ifdef EMTC_ENABLE
- Void *emtcCqiToTbsTbl[RGSCH_MAX_NUM_LYR_PERCW][RG_SCH_CMN_MAX_CFI];
-#endif
- Void *cqiToTbsTbl[RGSCH_MAX_NUM_LYR_PERCW][RG_SCH_CMN_MAX_CFI];
- /* cqi to Tbs tables for each 1 and 2 layer TbSz table */
- /*!< CQI to efficiency translation */
- Void *cqiToEffTbl[RGSCH_MAX_NUM_LYR_PERCW][RG_SCH_CMN_MAX_CFI];
- uint8_t newCfi; /*!< New CFI value */
- uint8_t currCfi; /*!< Current CFI value */
-
- uint16_t noResPerRb[RG_SCH_CMN_MAX_CFI]; /*!< Num REs per RB */
- CmLteTimingInfo time; /*!< Timing info for current allocation */
- Void *schSpfc; /*!< Scheduler Specific Cell DL dereferencing */
- Void *dlfsCell; /*!< DLFS specific information per cell */
- CmLListCp taLst; /*!< TA queues, holds the UEs for which TA
- has to be scheduled */
-#ifdef LTEMAC_SPS
- RgSchCmnDlCellSpsInfo dlSpsInfo; /*!< DL SPS info for the cell */
-#endif
- /* Member to store no. of Bits per RB */
- uint32_t bitsPerRb; /*!< Bits per RB calculated from
- BcchPcchRaRsp Code rate configured through
- RGR */
-#ifdef LTE_TDD
- uint16_t numReDwPts[RG_SCH_CMN_MAX_CFI-1]; /*!< Num of RE in DwPTS RB */
- uint8_t splSfCfg; /*!<Stores the special subframe cfg */
-#endif
-
- /* ccpu00132314-ADD-Tx power offsets for Common PDSCH transmissions */
- uint16_t bcchTxPwrOffset; /*!< Tx Pwr Offset for BCCH tx on PDSCH.
- Offset to the reference signal
- power. Value: 0 -> 10000,
- representing -6 dB to 4 dB in 0.001
- dB steps */
- uint16_t pcchTxPwrOffset; /*!< Tx Pwr Offset for PCCH tx.
- Offset to the reference signal
- power. Value: 0 -> 10000,
- representing -6 dB to 4 dB in 0.001
- dB steps */
- uint16_t rarTxPwrOffset; /*!< Tx Pwr Offset for RAR tx.
- Offset to the reference signal
- power. Value: 0 -> 10000,
- representing -6 dB to 4 dB in 0.001
- dB steps */
- /* ccpu00138898 - Added Tx pwr offset for PHICH Tx*/
- uint16_t phichTxPwrOffset; /*!< Tx Pwr Offset for PHICH tx.
- Offset to the reference signal
- power. Value: 0 -> 10000,
- representing -6 dB to 4 dB in 0.001
- dB steps */
- uint32_t ncsgPrbCnt; /*!< Cumulative sum of PDSCH PRBs assigned to non-Csg UEs */
- uint32_t totPrbCnt; /*!< Cumulative sum of PDSCH PRBs assigned to all UEs */
- RgrUeDlPwrCntrlPaCfg msg4pAVal; /*!< Default value (Enum) of PA that is
- used by Scheduler for msg4 */
-#ifdef LTE_ADV
- CmLListCp secCellActCeLst; /*!< List for holding the UE's
- for which sec cell act CE's needs to scheduled */
-
-#endif
-#ifdef EMTC_ENABLE
- CmLListCp emtcTaLst; /*!< TA queues, holds the EMTC UEs for which TA
- has to be scheduled */
- Void *schSpfcEmtc; /*!< Scheduler Specific Cell DL dereferencing */
-#endif
-} RgSchCmnDlCell;
-
-/**
- @brief Information related to TPC-PUCCH-RNTI/TPC-PUSCH-RNTI. */
-typedef struct rgSchCmnTpcRntiCb
-{
- CmLteRnti tpcRnti; /*!< TPC-PUCCH-RNTI/TPC-PUSCH-RNTI*/
- Bool isFmt3a; /*!< DCI format type: 3/3A */
- CmLListCp toBeSchdUes; /*!< List of UEs requiring power adjustment
- for this TPC-RNTI */
- CmLListCp cfgdUes; /*!< List of UEs */
- CmLList schdLnk; /*!< Link to the list of TPC RNTIs to be
- scheduled */
-} RgSchCmnTpcRntiCb;
-
-/**
- @brief Uplink Power control related information per cell. */
-typedef struct rgSchCmnUlPwrCb
-{
- uint8_t tpcPucchRntiCnt;/*!< Count of TPC-PUCCH-RNTIs for the cell */
- RgSchCmnTpcRntiCb tpcPucchRntiLst[RG_SCH_CMN_MAX_NUM_TPC_PUCCH_RNTI];
- /*!< List of TPC-PUCCH-RNTIs */
- uint8_t tpcPuschRntiCnt;/*!< Count of TPC-PUSCH-RNTIs for the cell */
- RgSchCmnTpcRntiCb tpcPuschRntiLst[RG_SCH_CMN_MAX_NUM_TPC_PUSCH_RNTI];
- /*!< List of TPC-PUSCH-RNTIs */
- CmLListCp pucchGrpPwr; /*!< List of TPC-PUCCH-RNTIs for PUCCH group
- power control: 'RgSchCmnTpcRntiCb' */
- CmLListCp puschGrpPwr; /*!< List of TPC-PUSCH-RNTIs for PUSCH group
- power control: 'RgSchCmnTpcRntiCb' */
- S8 pMax; /*!< Max allowed uplink power in cell */
- uint8_t trgUlCqi; /*!< Default target CQI */
-} RgSchCmnUlPwrCb;
-
-/**
- * @brief
- * Cell specific uplink scheduling information for Scheduler type 1.
- */
-typedef struct rgSchCmnUlCell
-{
- uint8_t maxUeNewTxPerTti; /*!< Max UEs to be considered for New Tx Alloc in UL */
- /* Added new variable maxUlBwPerUe */
- uint8_t maxUlBwPerUe; /*!< Max UL BW per UE */
- uint8_t maxSbPerUe; /*!< Max subbands per UE */
- uint8_t dfltUlCqi; /*!< Default uplink CQI assumed intitially */
- uint8_t max16qamCqi; /*!< Highest CQI supporting 16 QAM */
- uint8_t maxUlSpsCqi; /*!< Highest CQI supporting 16 QAM */
- uint8_t iTbsCap; /*!< Max value UL iTbs capped to */
- uint8_t sbSize; /*!< Subband size */
- uint8_t dmrsArrSize; /*!< DMRS array size */
- uint8_t *dmrsArr; /*!< DMRS array */
- RgSchCmnUlCellRa ra; /*!< RA related info */
- uint8_t idx; /*!< Current subframe - maps to HARQ process ID */
- uint8_t schdIdx; /*!< Subframe to schedule for */
- uint8_t schdHqProcIdx; /*!< Proc to schedule for */
- uint8_t msg3SchdIdx; /*!< Subframe to schedule for msg3 */
-#ifdef EMTC_ENABLE
- RgSchCmnUlCellRa emtcRa; /*!< RA related info */
- uint8_t emtcMsg3SchdIdx;
- Void *schSpfcEmtc; /*!< Scheduler Specific Cell UL dereferencing */
-#endif
- uint8_t msg3SchdHqProcIdx;/*!< Proc to schedule for */
- uint8_t rcpReqIdx; /*!< Subframe to send reception req for */
- /* ccpu00130688 -MOD- for config-0 changes */
- uint8_t hqFdbkIdx[2]; /*!< In FDD only Idx 0 is used.
- In TDD n+k value is updated at idx 0.
- For TDD Cfg 0 both indices are used */
- uint8_t reTxIdx[2]; /*!< Retransmission Index corresponding to
- the hqFdbkIdx */
-#ifdef LTEMAC_SPS
- uint8_t spsUlRsrvIdx; /*!< Subframe to reserve UL SPS cfgd grant */
- uint8_t spsUlRsrvHqProcIdx;/*!< Proc for the cfgd UL SPS grant */
-#endif
- CmLteTimingInfo schdTime;
-#ifdef LTE_TDD
- uint8_t numUlSubfrms; /*!< Number of UL subframes */
- RgSchUlSf *ulSfArr; /*!< no msg3 alloc info here */
-#else
- RgSchUlSf ulSfArr[RG_SCH_CMN_UL_NUM_SF]; /*!< no msg3 alloc info here */
-#endif
- Void *schSpfc; /*!< Scheduler Specific Cell UL dereferencing */
- RgSchCmnUlPwrCb ulPwrCb; /*!< Uplink power control block */
- uint8_t ulNumRePerRb; /*!< Number of REs per RB in UL */
- /* Added support for non-adaptive retransmission in uplink */
- uint8_t maxAllocPerUlSf; /*!< Max Allocations in a given SF */
-#ifdef RGR_V1
-/* Added a param to limit msg3 allocations */
- uint8_t maxMsg3PerUlSf; /*!< Max msg3 alocs in a given SF */
-#endif
-
-#ifdef LTEMAC_SPS
- RgSchCmnUlCellSpsInfo ulSpsInfo; /*!< UL SPS info for the cell */
- uint16_t schdTti; /*< 0..1023, corresponding to scheduling time,
- * can theoretically used for non-SPS
- * purposes as well */
-#endif
- uint32_t ncsgPrbCnt; /*!< Cumulative sum of PDSCH PRBs assigned to non-Csg UEs */
- uint32_t totPrbCnt; /*!< Cumulative sum of PDSCH PRBs assigned to all UEs */
- CmLListCp reTxLst; /*!< Retransmission List*/
-} RgSchCmnUlCell;
-
-/**
- @brief ACK-NACK repetition related information per cell. */
-typedef struct rgSchCmnAckNakRepCb
-{
-#ifdef LTE_TDD
- CmLListCp ackNakRepQ[2*RGSCH_NUM_SUB_FRAMES]; /*!< ACK NACK repetition queue */
-#else
- CmLListCp ackNakRepQ[RGSCH_NUM_SUB_FRAMES]; /*!< ACK NACK repetition queue */
-#endif
-} RgSchCmnAckNakRepCb;
-
-/**
- @brief Measurement Gap related information per cell. */
-typedef struct rgSchCmnMeasGapCb
-{
- CmLListCp gapPrd40Q[RG_SCH_CMN_MEAS_GAPPRD40]; /*!< Measurement Gap queue
- for UEs with 40 ms gap period */
- CmLListCp gapPrd80Q[RG_SCH_CMN_MEAS_GAPPRD80]; /*!< Measurement Gap queue
- for UEs with 80 ms gap period */
-} RgSchCmnMeasGapCb;
-
-/**
- * @brief
- * common scheduler specific information for rapId to UE mapping. */
-typedef struct rgSchCmnRapIdMap
-{
- uint8_t rapId;
- CmLListCp assgndUes; /*!< List of UEs for which this rapId is
- assigned. */
-} RgSchCmnRapIdMap;
-
-/**
- * @brief
- * common scheduler specific information for RACH Dedicated Preambles. */
-typedef struct rgSchCmnRachCfg
-{
- uint8_t numDedPrm; /*!< number of configured dedicated prmbls */
- uint8_t dedPrmStart; /*!< starting rapId Number */
- uint8_t remDedPrm; /*!< remaining number of ded Prm available
- for the "applFrm" */
- CmLteTimingInfo applFrm; /*!< Frame under consideration for dedPrm
- distribution */
- uint8_t prachMskIndx;/*!< Prach Mask Idx corresponding to
- applFrm*/
- RgSchCmnRapIdMap rapIdMap[RG_SCH_MAX_DED_PRMBLS]; /*!< mapping of RapId
- * to assigned UEs */
- CmLListCp hoUeLst; /*!< List of UEs undergoing Handover */
- CmLListCp pdcchOdrLst; /*!< Pdcch Order Q, holds the UEs for which
- PO has to be generated. */
-} RgSchCmnRachCfg;
-
-/**
- @brief Uplink Power control related information per UE. */
-typedef struct rgSchCmnUeUlPwrCb
-{
- Bool isAccumulated; /*!< Indicates if power is accumulative or not */
- Bool deltaMcsEnbld; /*!< Indicates if coding effeciency is
- * considered or not for PUSCH power computation */
- uint8_t pucchIdx; /*!< Index for TPC-PUCCH-RNTI */
- uint8_t puschIdx; /*!< Index for TPC-PUSCH-RNTI */
- uint8_t isPhrAvail; /*!< Indicates if PHR is recieved */
- S8 phVal; /*!< Power headroom value in dB */
- S8 pwrPerRb; /*!< UL power computed per RB */
- S8 maxUePwr; /*!< Maximum power with which UE can transmit */
- uint8_t maxUlRbs; /*!< Maximum number of UL Rbs for UL scheduling */
- S8 delta; /*!< Delta corresponding to TPC, for PUSCH */
- uint8_t numRb; /*!< Number of RBs used in last allocation */
- S8 remPuschPwr; /*!< PUSCH power remaining to be adjusted
- (in db) */ /* chk if needed */
- S8 remPucchPwr; /*!< PUCCH Power remaining to be adjusted (in db) */
- uint8_t pucchTpc; /*!< TPC to be used for PUCCH power control */
- uint8_t puschTpc; /*!< TPC to be used for PUSCH power control */
- uint8_t trgCqi; /*!< Target CQI */
- RgSchCmnTpcRntiCb *tpcPucchRntiCb; /*!< Pointer to tpcPucchRntiCb for the UE */
- CmLList pucchGrpLnk; /*!< To link together UEs in
- * RgSchCmnTpcRntiCb */
- CmLList schdPucchGrpLnk; /*!< To link together scheduled
- * UEs in RgSchCmnTpcRntiCb */
- RgSchCmnTpcRntiCb *tpcPuschRntiCb; /*!< Pointer to tpcPuschRntiCb for the UE */
- CmLList puschGrpLnk; /*!< To link together UEs in
- * RgSchCmnTpcRntiCb */
- CmLList schdPuschGrpLnk; /*!< To link together scheduled
- * UEs in RgSchCmnTpcRntiCb */
- S8 p0UePusch; /*!< P_0UE_PUSCH*/
- S8 p0UePucch; /*!< P_0_PUCCH*/
- S8 maxPwrPerRb;
- S8 maxPwrDeltaByPhr;
-} RgSchCmnUeUlPwrCb;
-
-/**
- @brief Uplink RB allocation information. */
-struct rgSchCmnUeUlAlloc
-{
- /* Request */
- uint32_t reqBytes; /*!< Requested bytes */
-
- /* Allocation to be filled by UL RB allocator module */
- uint32_t allocdBytes; /*!< Allocated bytes */
- RgSchUlAlloc *alloc; /*!< Alloc assgnd by Allocator */
- CmLList reqLnk; /*!< To link UL Tx UEs */
- CmLList schdLstLnk; /*!< To link scheduled/non-scheduled UL UEs */
-};
-
-typedef struct rgSchCmnAllocRecord
-{
- uint32_t alloc; /* allocation amount */
- CmLteTimingInfo allocTime; /* Time at which allocation made */
- CmLList lnk; /* To link in ulAllocLst */
- uint8_t numRb; /* Number of RBs */
- uint8_t cqi; /* CQI assumed for allocation */
- uint8_t tpc; /* TPC */
-}RgSchCmnAllocRecord;
-
-
-/**
- * @brief
- * Uplink Bler LA information for UE
- */
-#ifdef UL_LA
-typedef struct ueUlLaCb
-{
- S32 deltaiTbs;
- uint32_t iTbsUpperCap;
- S32 cqiBasediTbs;
- Bool lastiTbsIgnored;
-} UeUlLaCb;
-#endif
-
-/**
- * @brief
- * Uplink information for scheduler per UE
- */
-typedef struct rgSchCmnUlUe
-{
- uint8_t maxUlCqi; /*!< CQI for which no better Imcs can be granted */
- uint8_t crntUlCqi[RG_SCH_MAX_UL_TX_ANT]; /*!< Current CQI */
-/* Added changes of TFU_UPGRADE */
-#ifdef TFU_UPGRADE
- uint8_t validUlCqi;
-#endif
- uint8_t lastCfi; /* last CFI, updated in case of SPS */
- CmLListCp ulAllocLst; /*!< To track the outstanding Allocations
- * node type RgSchCmnAllocRecord */
-
-
- Void *schSpfc; /*!< scheduler specific UE DL Info */
- RgSchCmnUeUlPwrCb ulPwrCb; /*!< Uplink power control block */
- RgSchCmnUeUlAlloc alloc; /*!< Allocation info */
-#ifdef SCH_STATS
- uint32_t schedOccns; /*!< Number of scheduling occassions in a refresh period */
- uint32_t schedRetxOccns;
- uint32_t avgCqi; /*!< AvgCqi in a refresh period */
- uint32_t numCqiOccns;
- uint32_t prbAlloc;
-#endif
-#ifdef UL_LA
- UeUlLaCb ulLaCb; /*!< Uplink LA structure */
-#endif
- RgUeUlHqCb hqEnt; /*!< Uplink HARQ information for the UE */
- uint8_t subbandShare; /*!< New variable added to store the number
- * of subbands alowed for this UE */
- uint32_t subbandRequired; /*!< Number of subbands required to
- * serve the total BO */
- CmLList ulSchedLnk; /*!< To link UE UL Cb to toBeSchedList */
-#ifdef EMTC_ENABLE
- RgSchUlHqProcCb *tempProc; /*!< To identify UE is serverd for Retx */
-#endif
-#ifdef RG_5GTF
- uint8_t vrbgRequired;
- uint8_t vrbgAllocated;
-#endif
-} RgSchCmnUlUe;
-
-/**
- @brief Downlink RB allocation information for Msg4. */
-typedef struct rgSchCmnMsg4RbAlloc
-{
- RgSchDlSf *msg4DlSf; /*!< DL sub-frame for which allocation is to
- be done: filled in by RR/MAX C/I/PFS */
- CmLListCp msg4TxLst; /*!< List of RgSchDlRbAllocs for Msg4 Tx */
- CmLListCp msg4RetxLst; /*!< List of RgSchDlRbAllocs for Msg4 ReTx */
- CmLListCp schdMsg4TxLst; /*!< List of Msg4 Txs scheduled per TTI */
- CmLListCp schdMsg4RetxLst; /*!< List of Msg4 ReTxs scheduled in the TTI */
- CmLListCp nonSchdMsg4TxLst; /*!< List of transmitting MSG4 not scheduled in the TTI */
- CmLListCp nonSchdMsg4RetxLst; /*!< List of re-transmitting MSG4 not
- scheduled in the TTI */
-} RgSchCmnMsg4RbAlloc;
-#ifdef RGR_V1
-/* Changes for CR timer implementation*/
-typedef struct rgSchCmnCcchSduRbAlloc
-{
- RgSchDlSf *ccchSduDlSf; /*!< DL sub-frame for which allocation is to
- be done: filled in by RR/MAX C/I/PFS */
- CmLListCp ccchSduTxLst; /*!< List of RgSchDlRbAllocs for CcchSdu Tx */
- CmLListCp ccchSduRetxLst; /*!< List of RgSchDlRbAllocs for CcchSdu ReTx */
- CmLListCp schdCcchSduTxLst; /*!< List of CcchSdu Txs scheduled per TTI */
- CmLListCp schdCcchSduRetxLst; /*!< List of CcchSdu ReTxs scheduled in the TTI */
- CmLListCp nonSchdCcchSduTxLst; /*!< List of transmitting MSG4 not scheduled in the TTI */
- CmLListCp nonSchdCcchSduRetxLst; /*!< List of re-transmitting MSG4 not
- scheduled in the TTI */
-} RgSchCmnCcchSduRbAlloc;
-#endif
-
-/**
- @brief Downlink RB allocation information for UEs. */
-typedef struct rgSchCmnUeRbAlloc
-{
- RgSchDlSf *dedDlSf; /*!< DL sub-frame for which dedicated
- allocation is to be done: filled in
- by RR/MAX C/I/PFS */
- CmLListCp txHqPLst; /*!< List of HqPs to be scheduled for Tx per
- TTI: RgSchUeCb list */
- CmLListCp retxHqPLst; /*!< List of HqPs scheduled for ReTx per
- TTI: RgSchUeCb list */
- CmLListCp errIndTxHqPLst; /*!< LAA SCELL: List of transmitting LAA Err Ind Tx HqPs scheduled per TTI */
-#ifdef LTEMAC_SPS
- CmLListCp retxSpsHqPLst; /*!< List of SPS HqPs scheduled for ReTx per
- TTI: RgSchUeCb list */
- CmLListCp txSpsHqPLst; /*!< List of SPS HqPs scheduled for Tx per
- TTI: RgSchUeCb list */
-#endif
- CmLListCp txLaaHqPLst; /*!< List of LAA HqPs scheduled on PCell for Tx per
-TTI*/
- CmLListCp schdTxHqPLst; /*!< List of transmitting HqPs scheduled per TTI */
- CmLListCp schdRetxHqPLst; /*!< List of re-transmitting HqPs scheduled per TTI */
- CmLListCp nonSchdTxHqPLst; /*!< List of transmitting HqPs not scheduled in the TTI */
- CmLListCp nonSchdRetxHqPLst;/*!< List of re-transmitting HqPs not scheduled in the TTI */
-/* Changes for MIMO feature addition */
- /* MIMO Tx+Retx hqProc scheduling handling */
- CmLListCp txRetxHqPLst; /*!< List of HqPs scheduled for tx and retx per
- TTI(MIMO case): RgSchUeCb list */
- CmLListCp schdTxRetxHqPLst; /*!< List of TX&RETXing(MIMO case) HqPs scheduled per TTI */
- CmLListCp nonSchdTxRetxHqPLst; /*!< List of TX&RETXing(MIMO case) HqPs not scheduled in the TTI */
-#ifdef LTEMAC_SPS
- CmLListCp schdRetxSpsHqPLst; /*!< List of re-transmitting SPS HqPs scheduled per TTI */
- CmLListCp nonSchdRetxSpsHqPLst;/*!< List of re-transmitting SPS HqPs
- not scheduled in the TTI */
- CmLListCp schdTxSpsHqPLst; /*!< List of transmitting SPS HqPs scheduled per TTI */
- CmLListCp nonSchdTxSpsHqPLst; /*!< List of transmitting SPS HqPs not scheduled per TTI */
-#endif
- CmLListCp schdTxLaaHqPLst; /*!< List of transmitting LAA TBs scheduled on PCell per TTI */
- CmLListCp nonSchdTxLaaHqPLst; /*!< List of transmitting LAA TBs not scheduled on PCell per TTI */
- CmLListCp schdErrIndTxHqPLst; /*!< List of transmitting LAA ErrInd TBs scheduled per TTI */
- CmLListCp nonSchdErrIndTxHqPLst; /*!< List of transmitting LAA ErrInd not scheduled per TTI */
-} RgSchCmnUeRbAlloc;
-
-/**
- @brief Downlink RB allocation information. */
-struct rgSchCmnDlRbAllocInfo
-{
- RgSchDlRbAlloc pcchAlloc; /*!< Allocation for PCCH */
- RgSchDlRbAlloc bcchAlloc; /*!< Allocation for BCCH on DLSCH */
- RgSchDlRbAlloc raRspAlloc[RG_SCH_CMN_MAX_CMN_PDCCH]; /*!< Allocation for RAR */
- RgSchCmnMsg4RbAlloc msg4Alloc; /*!< Alloction for Msg4 */
-#ifdef RGR_V1
- /* Changes for CR timer implementation*/
- RgSchCmnCcchSduRbAlloc ccchSduAlloc; /*!< Alloction for ccchSdu */
-#endif
- RgSchCmnUeRbAlloc dedAlloc; /*!< Alloction information for UEs */
-};
-
-/**
- * @brief
- * Cell specific common scheduler information for all Scheduler types.
- */
-typedef struct rgSchCmnCell
-{
- RgrCfiCfg cfiCfg; /*!< CFI for PDCCH */
- RgrUlTrgCqiCfg trgUlCqi; /*!< Target UL CQI */
- CmTqCp tmrTqCp; /*!< Refresh Timer Task Queue
- * Control Point */
- CmTqType tmrTq[RG_SCH_CMN_NUM_REFRESH_Q]; /*!< Timer Task Queue */
- RgrDlCmnCodeRateCfg dlCmnCodeRate; /*!< Coding rate for common DL channels:
- Expressed in multiples of 1024 */
- RgrPuschSubBandCfg puschSubBand; /*!< UL subband information */
- RgrUlCmnCodeRateCfg ulCmnCodeRate; /*!< Coding rate for common UL channels:
- Expressed in multiples of 1024 */
- RgSchCmnRachCfg rachCfg; /*!< Rach configuration for schCmn */
- RgSchCmnUlCell ul; /*!< Scheduler UL info */
- RgSchCmnDlCell dl; /*!< Scheduler DL info */
- RgUlSchdApis *apisUl; /*!< Specific UL Scheduler APIs */
- RgDlSchdApis *apisDl; /*!< Specific DL Scheduler APIs */
- RgDlfsSchdApis *apisDlfs; /*!< APIs specific to DLFS scheduler */
-#ifdef EMTC_ENABLE
- RgUlSchdApis *apisEmtcUl; /*!< Specific UL Scheduler APIs for EMTC*/
- RgDlEmtcSchdApis *apisEmtcDl; /*!< Specific DL Scheduler APIs for EMTC*/
-#endif
- CmLteAggrLvl dciAggrLvl[RG_SCH_CMN_MAX_CQI][10];
- /*!< Aggr Level for each CQI for
- * each DCI Format */
- RgSchCmnDlRbAllocInfo allocInfo;
-}RgSchCmnCell;
-
-
-/**
- * @brief
- * RACHO information for scheduler per UE.
- */
-typedef struct rgSchCmnDlUeRachInfo
-{
- CmLList inActUeLnk; /*!< Link UE to PO inactUeList */
- CmLList poLnk; /*!< To link UE to PDCCH Order Q */
- CmLList hoLnk; /*!< To link UE to HandOver UE lst */
- CmLList rapIdLnk; /*!< Link to the list assgndUes */
- CmLteTimingInfo asgnOppr; /*!< PRACH oppurtunity time assgined to UE */
- uint8_t hoRapId; /*!< RAPID assigned to UE for HandOver */
- uint8_t poRapId; /*!< RAPID assigned to UE for PdcchOrder */
-}RgSchCmnDlUeRachInfo;
-
-
-/**
- * @brief
- * Downlink CodeWord information for scheduler per UE.
- */
-typedef struct rgSchCmnDlUeCwInfo
-{
- uint8_t cqi; /*!< CQI reported for this CW */
- uint8_t iTbs[2]; /*!< [0]ITBS for CW for 1 Layer,
- corresponding to this CW's cqi. */
- /*!< [1]ITBS for CW for 2 Layer,
- corresponding to this CW's cqi. */
- uint32_t eff[2]; /*!< [0]eff for CW for 1 Layer,
- corresponding to this CW's cqi. */
- /*!< [1]eff for CW for 2 Layer,
- corresponding to this CW's cqi. */
- uint8_t noLyr; /*!< No. of layers this CW shall be using
- * for transmission */
- uint16_t dtxCnt;
- uint16_t ackCnt;
- uint16_t nackCnt;
-}RgSchCmnDlUeCwInfo;
-/**
- * @brief UE cmn scheduler specific MIMO Info.
- */
-typedef struct rgSchCmnUeMimoInfo
-{
- RgSchCmnDlUeCwInfo cwInfo[RG_SCH_CMN_MAX_CW_PER_UE];/*!< Codeword related feddback Information */
- uint8_t ri; /*!< Maximum allowable number of TX layers for SM */
- uint8_t pmi; /*!< Precoding matrix indicator(if any) */
- uint8_t btrCwIdx; /*!< Index of a better(efficient) CW (0 or 1) */
- uint8_t forceTD; /*!< Flag to indicate transmission scheme as TD
- * beyond any other consideration */
-}RgSchCmnUeMimoInfo;
-
-typedef struct ueLaCb {
- S32 deltaiTbs;
- uint32_t iTbsUpperCap;
- S32 cqiBasediTbs;
- Bool lastiTbsIgnored;
- uint8_t notFirstCqi;
- uint8_t numLastiTbsIgnored;
-} UeLaCb;
-
-/**
- * @brief
- * Downlink information for scheduler per UE.
- */
-typedef struct rgSchCmnDlUe
-{
- uint32_t maxSbSz; /*!< Max soft channel bits per Hq proc per TTI */
- uint32_t maxTbSz; /*!< Max DLSCH TB bits per TB per TTI */
- uint8_t maxRb; /*!< updated based on SoftBuffer Limitation and MaxDlBwPerUE */
- uint32_t maxTbBits;/*!< Max Transport Block Bits this UE can receive per TTI*/
- RgSchCmnUeMimoInfo mimoInfo; /*!< UE cmn scheduler specific MIMO Info */
- RgSchDlHqProcCb *proc; /*!< Proc which is picked for Trans for this Subfrm,"dlSf" */
- Void *schSpfc; /*!< scheduler specific UE DL Info */
- Void *dlfsUe; /*!< DLFS Specific information */
- uint32_t outStndAlloc; /*!< UEs outstanding allocation, for a given TTI.
- * valid for a single scheduling index */
- RgSchCmnDlUeRachInfo rachInfo; /*!< Ue specific RACH HO Info */
-#ifdef LTEMAC_SPS
- RgSchCmnDlUeSpsInfo dlSpsInfo;/*!< DL SPS information for the UE */
-#endif
-#if defined(SCH_STATS) || defined(TENB_STATS)
- uint32_t schedOccns;
- uint32_t currPdbLvl;
- uint32_t prevOccnLvlUpd;
- /* uint32_t schedRetxOccns;
- uint32_t prbAlloc;*/
-#endif
-#ifdef SCH_STATS
- uint32_t schedRetxOccns;
- uint32_t avgCqi;
- uint32_t numCqiOccns;
- uint32_t numRi1;
- uint32_t numRi2;
- uint32_t boReported;
- uint32_t prbAlloc;
- uint32_t remAmbrForStats;
-#endif
- UeLaCb laCb[RG_SCH_CMN_MAX_CW_PER_UE];
- uint8_t cqiFlag;
- uint8_t lastCfi;
-#ifdef RG_5GTF
- uint8_t vrbgRequired;
- uint8_t vrbgAllocated;
-#endif
-} RgSchCmnDlUe;
-
-/**
- @brief Uplink RB allocation information. */
-struct rgSchCmnUlRbAllocInfo
-{
-#ifdef EMTC_ENABLE
- RgSchEmtcUlSf *ulsf;
-#endif
- RgSchUlSf *sf; /*!< Subframe to schedule for */
- CmLListCp contResLst; /*!< UEs to schedule for cnt resn */
- CmLListCp schdContResLst; /*!< Final UEs scheduled for cnt resn */
- CmLListCp nonSchdContResLst; /*!< UEs not scheduled for cnt resn*/
- CmLListCp ueLst; /*!< UEs to schedule for data */
- CmLListCp schdUeLst; /*!< Final UEs scheduled for data */
- CmLListCp nonSchdUeLst; /*!< Final UEs not scheduled for data */
-};
-
-/**
- * @brief
- * Information common to DL and UL scheduler per UE.
- */
-typedef struct rgSchCmnUeInfo
-{
- uint8_t ueCat; /*!< UE category */
- CmTimer tmr;
-} RgSchCmnUeInfo;
-/**
- * @brief
- * Information for scheduler per UE.
- */
-typedef struct rgSchCmnUe
-{
- RgSchCmnUeInfo cmn; /*!< UE specific scheduler information common to
- uplink and downlink */
- RgSchCmnUlUe ul; /*!< UE specific UL scheduler information */
- RgSchCmnDlUe dl; /*!< UE specific DL scheduler informaion */
-} RgSchCmnUe;
-
-typedef struct rgSchCmnLcg
-{
- uint32_t bs; /*!< Effective Buffer Status */
- uint32_t cfgdGbr; /*!< Configured GBR */
- uint32_t effGbr; /*!< Effective GBR */
- uint32_t deltaMbr; /*!< Configured MBR in excess of configured GBR */
- uint32_t effDeltaMbr; /*!< Effective MBR */
- uint32_t reportedBs; /*!< Latest Buffer Status */
- Void *schSpfc;
-}RgSchCmnLcg;
-
-#ifdef LTEMAC_SPS
-/**
- * @brief
- * SPS information for DL service
- */
-typedef struct rgSchCmnDlSvcSpsInfo
-{
- CmLList toBeSchdSvcEnt; /*!< Linked list entity for toBeSchdSvcs lst */
- uint16_t zeroBoOcassionCnt; /*!< Number of contiguous SPS ocassions for
- which BO=0 */
- uint32_t effSpsBo; /*!< Effective BO of the SPS service */
- uint32_t bytesReq; /*!< Bytes Requested for this SPS service */
- uint8_t hdrEst; /*!< Header estimate for SPS service */
-
-} RgSchCmnDlSvcSpsInfo;
-#endif
-
-typedef struct rgSchCmnDlSvc {
- uint8_t qci; /*!< Prio computed against Qci */
- uint8_t prio; /*!< Prio computed against Qci */
- uint32_t gbr; /*!< scaled GBR as per Refresh time resolution */
- uint32_t mbr; /*!< scaled MBR as per Refresh time resolution */
- Void *schSpfc[CM_LTE_MAX_CELLS];/*!< Scheduler specific Info */
-#ifdef LTEMAC_SPS
- RgSchCmnDlSvcSpsInfo dlSvcSpsInfo; /*!< SPS related information for DL
- service */
-#endif
-}RgSchCmnDlSvc;
-
-typedef struct rgSchCmnDlHqProc {
- CmLList retxLnk; /*!< To link retransmitting HARQ processes in cell */
- uint32_t totBytes;/*!< This maintains total allocation */
-#ifdef LTEMAC_SPS
- Bool isSpsSvcSchd;/*!< Indicates if this HARQ process is having SPS
- service scheduled: TRUE for SPS and non-SPS
- ocassions */
- Bool isSpsActv; /*!< Indicates if this HARQ proc
- is in-use for SPS transmission: TRUE only for
- SPS ocassions */
- uint8_t spsAction; /*!< SPS action associated with this HARQ proc:
- activation/reactivation */
- CmLteTimingInfo maxRetxTime; /*!< Maximum retransmission time for SPS HARQ
- proc */
-#endif
- Void *schSpfc;/*!< Scheduler specific Info */
-}RgSchCmnDlHqProc;
-
-/*--------------------------*
- * UL specific declarations END
- *---------------------------*/
-
-/* Inappropriate name of CQI to ITbs table for DL. */
-typedef uint8_t RgSchCmnCqiToTbs[16];
-/* The following data type is used to store computed efficiency */
-/* for each MCS and consequently, will be used to derive MCS */
-/* for a CQI. The last row is used for storing the average */
-typedef uint32_t RgSchCmnTbSzEff[RG_SCH_CMN_NUM_TBS];
-
-/* Inappropriate name of CQI to ITbs table for DL. */
-/* Changes for MIMO feature addition */
-RgSchCmnTbSzEff rgSchCmnNorCfi1Eff[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnNorCfi2Eff[RGSCH_MAX_NUM_LYR_PERCW];
-RgSchCmnTbSzEff rgSchCmnNorCfi3Eff[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnNorCfi4Eff[RGSCH_MAX_NUM_LYR_PERCW];
-/* Added new variable for Ul eff */
-RgSchCmnTbSzEff rgSchCmnNorUlEff[1],rgSchCmnExtUlEff[1];
-RgSchCmnCqiToTbs rgSchCmnNorCfi1CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnNorCfi2CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW];
-RgSchCmnCqiToTbs rgSchCmnNorCfi3CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnNorCfi4CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW];
-RgSchCmnCqiToTbs *rgSchCmnCqiToTbs[RGSCH_MAX_NUM_LYR_PERCW][RG_SCH_CMN_MAX_CP][RG_SCH_CMN_MAX_CFI];
-RgSchCmnTbSzEff rgSchCmnExtCfi1Eff[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnExtCfi2Eff[RGSCH_MAX_NUM_LYR_PERCW];
-RgSchCmnTbSzEff rgSchCmnExtCfi3Eff[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnExtCfi4Eff[RGSCH_MAX_NUM_LYR_PERCW];
-RgSchCmnCqiToTbs rgSchCmnExtCfi1CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnExtCfi2CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW];
-RgSchCmnCqiToTbs rgSchCmnExtCfi3CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW], rgSchCmnExtCfi4CqiToTbs[RGSCH_MAX_NUM_LYR_PERCW];
-/* Include CRS REs while calculating Efficiency */
-RgSchCmnTbSzEff
-*rgSchCmnEffTbl[RGSCH_MAX_NUM_LYR_PERCW][RG_SCH_CMN_MAX_CP][RG_SCH_CMN_MAX_ANT_CONF][RG_SCH_CMN_MAX_CFI];
-/* Added new variable for Ul eff */
-RgSchCmnTbSzEff *rgSchCmnUlEffTbl[RG_SCH_CMN_MAX_CP];
-
-RgSchTbSzTbl rgTbSzTbl;
-
-Void rgSCHCmnInit ARGS((Void
-));
-S16 rgSCHCmnRgrCellCfg ARGS((
-RgSchCellCb *cell,
-RgrCellCfg *cellCfg,
-RgSchErrInfo *err
-));
-S16 rgSCHCmnRgrCellRecfg ARGS((
-RgSchCellCb *cell,
-RgrCellRecfg *recfg,
-RgSchErrInfo *err
-));
-Void rgSCHCmnFreeDlLc ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *svc
-));
-Void rgSCHCmnCellDel ARGS((
-RgSchCellCb *cell
-));
-Void rgSCHCmnDlRlsSubFrm ARGS((
-RgSchCellCb *cell,
-CmLteTimingInfo frm
-));
-#ifdef LTE_ADV
-S16 rgSCHCmnRgrSCellUeCfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeSecCellCfg *sCellInfoCfg,
-RgSchErrInfo *err
-));
-
-Void rgSchFreeTpcIdxForSCell ARGS((
-RgSchUeCb *ue,
-RgSchDlHqProcCb *proc,
-RgSchDlSf *dlsf
-));
-
-Bool rgSchIsN1PucchResAvail ARGS((
- CmLListCp *lst,
- RgSchUeCb *ue,
- uint8_t n1Idx,
- uint8_t resCount
-));
-Bool rgSchIsN3PucchResAvail ARGS((
- CmLListCp *lst,
- RgSchUeCb *ue,
- uint8_t n1Idx
-));
-
-S16 rgSchGetAvlTpcIdx ARGS((
- RgSchUeCb *ue,
- uint8_t *tpcIdx,
- RgSchDlSf *dlsf,
- RgSchCellCb *cell
-));
-
-Void rgSCHSCellDelUeSCell ARGS((
- RgSchCellCb *cellCb,
- RgSchUeCb *ueCb,
- uint8_t sCellIdx
-));
-
-S16 rgSCHCmnRgrSCellUeDel ARGS((
- RgSchUeCellInfo *sCellInfo,
- RgSchUeCb *ue
-));
-
-#endif /* LTE_ADV */
-S16 rgSCHCmnRgrUeCfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeCfg *ueCfg,
-RgSchErrInfo *err
-));
-S16 rgSCHCmnRgrUeRecfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeRecfg *ueRecfg,
-RgSchErrInfo *err
-));
-Void rgSCHCmnUeDel ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-Void rgSCHCmnUeReset ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-S16 rgSCHCmnRgrLcgRecfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchLcgCb *lcg,
-RgrLcgRecfg *reCfg,
-RgSchErrInfo *err
-));
-S16 rgSCHCmnRgrLcgCfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchLcgCb *lcg,
-RgrLcgCfg *lcgCfg,
-RgSchErrInfo *err
-));
-S16 rgSCHCmnRgrLchCfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *dlLc,
-RgrLchCfg *lcCfg,
-RgSchErrInfo *err
-));
-S16 rgSCHCmnRgrLchDel ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-CmLteLcId lcId,
-uint8_t lcgId
-));
-S16 rgSCHCmnRgrLchRecfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *dlLc,
-RgrLchRecfg *lcRecfg,
-RgSchErrInfo *err
-));
-Void rgSCHCmnLcgDel ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchLcgCb *lcg
-));
-S16 rgSCHCmnUpdBsrShort ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchLcgCb *ulLcg,
-uint8_t bsr,
-RgSchErrInfo *err
-));
-S16 rgSCHCmnUpdBsrTrunc ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchLcgCb *ulLcg,
-uint8_t bsr,
-RgSchErrInfo *err
-));
-S16 rgSCHCmnUpdBsrLong ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint8_t bsArr[],
-RgSchErrInfo *err
-));
-S16 rgSCHCmnDataRcvd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint8_t numLc,
-RgSchUlLcCb *lcArr[],
-uint16_t bytesArr[],
-RgSchErrInfo *err
-));
-Void rgSCHCmnUlCqiInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-TfuUlCqiRpt *ulCqiInfo
-));
-S16 rgSCHCmnUpdExtPhr ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgInfExtPhrCEInfo *extPhr,
-RgSchErrInfo *err
-));
-S16 rgSCHCmnUpdPhr ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint8_t phr,
-RgSchErrInfo *err
-));
-S16 rgSCHCmnUpdUlHqProc ARGS((
-RgSchCellCb *cell,
-RgSchUlHqProcCb *curProc,
-RgSchUlHqProcCb *oldProc
-));
-S16 rgSCHCmnContResUlGrant ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchErrInfo *err
-));
-Void rgSCHCmnActvtUlUe ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-Void rgSCHCmnActvtDlUe ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-Void rgSCHCmnHdlUlTransInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-CmLteTimingInfo timingInfo
-));
-S16 rgSCHCmnSrRcvd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-CmLteTimingInfo frm,
-RgSchErrInfo *err
-));
-Void rgSCHCmnUlRbAllocAddUeToLst ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-CmLListCp *lst
-));
-S16 rgSCHCmnTti ARGS((
-RgSchCellCb *cell,
-RgSchErrInfo *err
-));
-Void rgSCHCmnUlHqProcForUe ARGS((
-RgSchCellCb *cell,
-CmLteTimingInfo frm,
-RgSchUeCb *ue,
-RgSchUlHqProcCb **procRef
-));
-RgSchUlAlloc *rgSCHCmnFirstRcptnReq ARGS((
-RgSchCellCb *cell
-));
-RgSchUlAlloc *rgSCHCmnNextRcptnReq ARGS((
-RgSchCellCb *cell,
-RgSchUlAlloc *alloc
-));
-RgSchUlAlloc *rgSCHCmnFirstHqFdbkAlloc ARGS((
-RgSchCellCb *cell,
-uint8_t idx
-));
-RgSchUlAlloc *rgSCHCmnNextHqFdbkAlloc ARGS((
-RgSchCellCb *cell,
-RgSchUlAlloc *alloc,
-uint8_t idx
-));
-Void rgSCHCmnDlDedBoUpd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *svc
-));
-/* Fix: syed Remove the msg4Proc from cell
- * msg4Retx Queue. I have used CMN scheduler function
- * directly. Please define a new API and call this
- * function through that. */
-Void rgSCHCmnDlMsg4ProcRmvFrmRetx ARGS((
-RgSchCellCb *cell,
-RgSchDlHqProcCb *hqP
-));
-Void rgSCHCmnDlProcAddToRetx ARGS((
-RgSchCellCb *cell,
-RgSchDlHqProcCb *hqP
-));
-
-#ifdef EMTC_ENABLE
-Void rgSCHCmnEmtcUlProcAddToRetx ARGS((
-RgSchCellCb *cell,
-RgSchUlHqProcCb *hqP
-));
-#endif
-
-Void rgSCHCmnDlCqiInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-Bool isPucchInfo,
-Void *dlCqi,
-CmLteTimingInfo timingInfo
-));
-/* Added changes of TFU_UPGRADE */
-#ifdef TFU_UPGRADE
- Void rgSCHCmnRawCqiInd ARGS
-((
-RgSchCellCb *cellCb,
-RgSchUeCb *ueCb,
-TfuRawCqiRpt *rawCqiRpt,
-CmLteTimingInfo timingInfo
-));
-
- Void rgSCHCmnSrsInd ARGS
-((
-RgSchCellCb *cellCb,
-RgSchUeCb *ueCb,
-TfuSrsRpt *srsRpt,
-CmLteTimingInfo timingInfo
-));
-#endif /* TFU_UPGRADE */
-
-Void rgSCHCmnDlTARpt ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-RgSchPdcch *rgSCHCmnCmnPdcchAlloc ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm
-));
-RgSchUlAlloc *rgSCHCmnUlSbAlloc ARGS((
-RgSchUlSf *sf,
-uint8_t numSb,
-RgSchUlHole *hole
-));
-Void rgSCHCmnRlsUlSf ARGS((
-RgSchCellCb *cell,
-uint8_t idx
-));
-
-/* PHR handling for MSG3 */
-Void rgSCHCmnUlRecMsg3Alloc ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchRaCb *raCb
-));
-
-/* Added periodic BSR timer */
-
-/*ccpu00117180 - ADD - Added Prototype in .x since the function access is now */
-Void rgSCHCmnUpdVars ARGS((
-RgSchCellCb *cell
-));
-
-#ifdef LTEMAC_SPS
-Void rgSCHCmnFillHqPTb ARGS((
-RgSchCellCb *cell,
-RgSchDlRbAlloc *rbAllocInfo,
-uint8_t tbAllocIdx,
-RgSchPdcch *pdcch
-));
-
-Void rgSCHCmnDlProcAck ARGS((
-RgSchCellCb *cell,
-RgSchDlHqProcCb *hqP
-));
-Void rgSCHCmnHdlCrntiCE ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-Void rgSCHCmnDlRelPdcchFbk ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-Bool isAck
-));
-Void rgSCHCmnDlGetRbgInfo ARGS((
-uint8_t dlTotalBw,
-uint8_t dlSubsetBw,
-uint8_t maxRaType1SubsetBw,
-uint8_t rbgSize,
-RgSchBwRbgInfo *rbgInfo
-));
-uint8_t rgSCHCmnDlRaType0Alloc ARGS((
-RgSchDlSfAllocInfo *allocedInfo,
-uint8_t rbsReq,
-RgSchBwRbgInfo *rbgInfo,
-uint8_t *numAllocRbs,
-RgSchDlSfAllocInfo *resAllocInfo,
-Bool isPartialAlloc
-));
-#ifdef RGSCH_SPS_UNUSED
-uint8_t rgSCHCmnDlRaType1Alloc ARGS((
-RgSchDlSfAllocInfo *allocedInfo,
-uint8_t rbsReq,
-RgSchBwRbgInfo *rbgInfo,
-uint8_t startRbgSubset,
-uint8_t *allocRbgSubset,
-RgSchDlSfAllocInfo *resAllocInfo,
-Bool isPartialAlloc
-));
-#endif
-uint8_t rgSCHCmnDlRaType2Alloc ARGS((
-RgSchDlSfAllocInfo *allocedInfo,
-uint8_t rbsReq,
-RgSchBwRbgInfo *rbgInfo,
-uint8_t *rbStart,
-RgSchDlSfAllocInfo *resAllocInfo,
-Bool isPartialAlloc
-));
-Bool rgSCHCmnAllocUeInSpsBw ARGS((
-RgSchDlSf *dlSf,
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlRbAlloc *rbAllocInfo,
-Bool isPartialAlloc
-));
-#endif
-Void rgSCHCmnDrxStrtInActvTmrInUl ARGS((RgSchCellCb *cell));
-Void rgSCHCmnUpdUeDataIndLcg ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgInfUeDatInd *datInd));
-#ifdef LTE_TDD
-uint8_t rgSCHCmnGetPhichUlSfIdx ARGS((CmLteTimingInfo *timeInfo, RgSchCellCb *cell));
-uint8_t rgSCHCmnGetUlSfIdx ARGS((CmLteTimingInfo *timeInfo, RgSchCellCb *cell));
-uint8_t rgSCHCmnGetPValFrmCCE ARGS((RgSchCellCb *cell, uint8_t cce));
-#endif
-uint8_t rgSCHCmnGetUlHqProcIdx ARGS((CmLteTimingInfo *timeInfo, RgSchCellCb *cell));
-
-Void rgSchCmnSetCqiReqField ARGS((
- RgSchUeCellInfo *cellInfo,
- RgSchUeCb *ue,
- RgSchCqiReqField *cqiReq
-));
-
-/* APIs exposed by COMMON SCHEDULER to
- * SPECIFIC SCHEDULER */
-/* UL_ALLOC_CHANGES */
-Void rgSCHCmnUlFreeAlloc ARGS((
-RgSchCellCb *cell,
-RgSchUlAlloc *alloc
-));
-#ifndef EMTC_ENABLE
-Void rgSCHCmnUlFreeAllocation ARGS((
-RgSchCellCb *cell,
-RgSchUlSf *sf,
-RgSchUlAlloc *alloc
-));
-#else
-Void rgSCHCmnUlFreeAllocation ARGS((
-RgSchCellCb *cell,
-RgSchUlSf *sf,
-RgSchUlAlloc *alloc,
-Bool isEmtcUe
-));
-#endif
-/* APIs exposed by DL RB allocation module */
-S16 rgSCHCmnAllocDlRb ARGS((
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *dlRbAllocInfo
-));
-
-/* APIs exposed by UL RB allocation module */
-Void rgSCHCmnAllocUlRb ARGS((
-RgSchCellCb *cell,
-RgSchCmnUlRbAllocInfo *ulRbAllocInfo
-));
-
-/* APIs Exposed to Specific Scheduler */
-RgSchPdcch *rgSCHCmnPdcchAllocCrntSf ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-Void rgSCHCmnPdcchRlsCrntSf ARGS((
-RgSchCellCb *cell,
-RgSchPdcch *pdcch
-));
-Void rgSCHCmnUlFillPdcchWithAlloc ARGS((
-RgSchPdcch *pdcch,
-RgSchUlAlloc *alloc,
-RgSchUeCb *ue
-));
-Void rgSCHCmnUlAllocFillTpc ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchUlAlloc *alloc
-));
-Void rgSCHCmnUlAllocFillNdmrs ARGS((
-RgSchCmnUlCell *cellUl,
-RgSchUlAlloc *alloc
-));
-Void rgSCHCmnUlAllocLnkHqProc ARGS((
-RgSchUeCb *ue,
-RgSchUlAlloc *alloc,
-RgSchUlHqProcCb *proc,
-Bool isReTx
-));
-RgSchPdcch *rgSCHCmnPdcchAlloc ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlSf *subFrm,
-uint8_t cqi,
-TfuDciFormat dciFrmt,
-Bool isDtx
-));
-Void rgSCHCmnRdcImcsTxTb ARGS((
-RgSchDlRbAlloc *allocInfo,
-uint8_t tbInfoIdx,
-uint32_t cnsmdBytes
-));
-Void rgSCHCmnFillPdcch ARGS((
-RgSchCellCb *cell,
-RgSchPdcch *pdcch,
-RgSchDlRbAlloc *rbAllocInfo
-));
-uint8_t rgSCHCmnUpdDai ARGS((
-RgSchUeCb *ue,
-CmLteTimingInfo *fdbkTime,
-uint8_t m,
-Bool havePdcch,
-RgSchDlHqProcCb *hqP,
-uint8_t *ulDai
-
-));
-Void rgSCHCmnFillHqPPdcch ARGS((
-RgSchCellCb *cell,
-RgSchDlRbAlloc *rbAllocInfo,
-RgSchDlHqProcCb *hqP
-));
-S16 rgSCHCmnDlChkResAvl ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-RgSchDlHqProcCb *proc,
-uint32_t *bo,
-uint8_t *iTbs,
-uint32_t *maxRb
-));
-S16 rgSCHCmnDlDedAlloc ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-RgSchDlHqProcCb *proc,
-uint32_t bo,
-uint8_t iTbs,
-uint32_t maxRb,
-uint32_t *bytes
-));
-Void rgSCHCmnUlUeFillAllocInfo ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-/* Fixing incorrect Imcs derivation */
-uint8_t rgSCHCmnUlGetITbsFrmIMcs ARGS((
-uint8_t iMcs
-));
-/* Adding ueCtg to argument list */
-uint8_t rgSCHCmnUlGetIMcsFrmITbs ARGS((
-uint8_t iTbs,
-CmLteUeCategory ueCtg
-));
-uint32_t rgSCHCmnUlMinTbBitsForITbs ARGS((
-RgSchCmnUlCell *cellUl,
-uint8_t iTbs
-));
-uint8_t rgSCHCmnUlGetITbs ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-Bool isEcp
-));
-Void rgSCHCmnUlAllocFillRbInfo ARGS((
-RgSchCellCb *cell,
-RgSchUlSf *sf,
-RgSchUlAlloc *alloc
-));
-Void rgSCHCmnDlUeResetTemp ARGS((
-RgSchUeCb *ue,
-RgSchDlHqProcCb *hqP
-));
-Void rgSCHCmnUlUeResetTemp ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-/* proc is added for DTX support */
-/* DL per UE RB allocation API */
-S16 rgSCHCmnDlAllocTxRb ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-));
-Bool rgSCHCmnIsDlCsgPrio ARGS((
-RgSchCellCb *cell
-));
-Bool rgSCHCmnIsUlCsgPrio ARGS((
-RgSchCellCb *cell
-));
-S16 rgSCHCmnDlAllocRetxRb ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *subFrm,
-RgSchUeCb *ue,
-uint32_t bo,
-uint32_t *effBo,
-RgSchDlHqProcCb *proc,
-RgSchCmnDlRbAllocInfo *cellWdAllocInfo
-));
-#ifdef LTEMAC_SPS
-Void rgSCHCmnClcRbAlloc ARGS((
-RgSchCellCb *cell,
-uint32_t bo,
-uint8_t cqi,
-uint8_t *rb,
-uint32_t *tbs,
-uint8_t *mcs,
-uint8_t *iTbs,
-Bool isSpsBo,
-RgSchDlSf *sf
-));
-uint32_t rgSCHCmnCalcRiv ARGS((
-uint8_t bw,
-uint8_t rbStart,
-uint8_t numRb
-));
-#endif /* LTEMAC_SPS */
-
-/* end: Apis to add Ues in to DlRbAllocInfo Lists */
-/* start: Apis to add Ues in to UlRbAllocInfo Lists */
-Void rgSCHCmnUlAdd2UeLst ARGS((
-RgSchCellCb *cell,
-RgSchCmnUlRbAllocInfo *allocInfo,
-RgSchUeCb *ue
-));
-Void rgSCHCmnUlAdd2CntResLst ARGS((
-RgSchCmnUlRbAllocInfo *allocInfo,
-RgSchUeCb *ue
-));
-Void rgSCHCmnRmvFrmTaLst ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-/* end: Apis to add Ues in to UlRbAllocInfo Lists */
-Void rgSCHCmnUlUpdOutStndAlloc ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint32_t alloc
-));
-
-Void rgSCHCmnUlRecordUeAlloc ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-
-
-
-/* APIs exposed by common power module */
-Void rgSCHPwrInit ARGS((
- Void));
-uint8_t rgSCHPwrPuschTpcForUe ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue));
-uint8_t rgSCHPwrGetMaxUlRb ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue));
-uint8_t rgSCHPwrPucchTpcForUe ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue));
-Void rgSCHPwrGrpCntrlPucch ARGS((
- RgSchCellCb *cell,
- RgSchDlSf *dlSf));
-Void rgSCHPwrGrpCntrlPusch ARGS((
- RgSchCellCb *cell,
- RgSchDlSf *dlSf,
- RgSchUlSf *ulSf));
-Void rgSCHPwrPucchDeltaInd ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue,
- S8 pwrDelta));
-Void rgSCHPwrUpdExtPhr ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue,
- RgInfExtPhrCEInfo *extPhr,
- RgSchCmnAllocRecord *allocInfo));
-Void rgSCHPwrUpdPhr ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue,
- uint8_t phr,
- RgSchCmnAllocRecord *allocInfo,
- S8 maxUePwr));
-Void rgSCHPwrUlCqiInd ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue
- ));
-Void rgSCHPwrRecordRbAlloc ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue,
- uint8_t numRb
- ));
-S16 rgSCHPwrCellCfg ARGS((
- RgSchCellCb *cell,
- RgrCellCfg *cfg));
-S16 rgSCHPwrCellRecfg ARGS((
- RgSchCellCb *cell,
- RgrCellRecfg *recfg));
-Void rgSCHPwrCellDel ARGS((
- RgSchCellCb *cell));
-
-#ifdef LTE_ADV
-S16 rgSCHPwrUeSCellCfg ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue,
- RgrUeSecCellCfg *sCellInfoCfg));
-#endif
-
-S16 rgSCHPwrUeCfg ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue,
- RgrUeCfg *cfg));
-S16 rgSCHPwrUeRecfg ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue,
- RgrUeRecfg *recfg));
-Void rgSCHPwrUeDel ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue));
-Void rgSCHPwrUeReset ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue));
-
-#ifdef LTEMAC_SPS
-S16 rgSCHCmnSpsUlProcCrcInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-CmLteTimingInfo crcTime
-));
-Void rgSCHCmnSpsInit ARGS((Void));
-
-Void rgSCHCmnSpsRelDlSpsActHqP ARGS((
-RgSchCellCb *cell,
-RgSchDlHqProcCb *hqP));
-
-S16 rgSCHCmnSpsCellCfg ARGS((
-RgSchCellCb *cell,
-RgrCellCfg *cellCfg,
-RgSchErrInfo *err));
-Void rgSCHCmnSpsCellDel ARGS((
-RgSchCellCb *cell
-));
-S16 rgSCHCmnSpsUeCfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeCfg *ueCfg,
-RgSchErrInfo *err
-));
-S16 rgSCHCmnSpsUeRecfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeRecfg *ueRecfg,
-RgSchErrInfo *err
-));
-Void rgSCHCmnSpsUeDel ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-S16 rgSCHCmnSpsDlLcRecfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *dlLc,
-RgrLchRecfg *lcRecfg,
-RgSchErrInfo *err
-));
-S16 rgSCHCmnSpsDlLcCfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *dlLc,
-RgrLchCfg *lcCfg,
-RgSchErrInfo *err
-));
-Void rgSCHCmnSpsDlLcDel ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *dlLc
-));
-Void rgSCHCmnSpsDlCqiIndHndlr ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-CmLteTimingInfo timingInfo
-));
-Void rgSCHCmnSpsDlDedBoUpd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *dlLc
-));
-Void rgSCHCmnSpsDlUeReset ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-Void rgSCHCmnSpsDlProcAddToRetx ARGS((
-RgSchCellCb *cell,
-RgSchDlHqProcCb *hqP
-));
-Void rgSCHCmnSpsDlProcAck ARGS((
-RgSchCellCb *cell,
-RgSchDlHqProcCb *hqP
-));
-
-Void rgSCHCmnSpsDlRelPdcchFbk ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-Bool isAck
-));
-Void rgSCHCmnSpsDlSched ARGS((
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *allocInfo
-));
-#ifdef RG_UNUSED
-S16 rgSCHCmnSpsGetDlActvUe ARGS((
-RgSchCellCb *cell,
-CmLteTimingInfo *timingInfo,
-CmLListCp *dlSpsActvUeLst
-));
-#endif
-Void rgSCHCmnSpsDlAllocFnlz ARGS((
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *allocInfo
-));
-
-Void rgSCHCmnSpsDlUpdDlSfAllocWithSps ARGS((
-RgSchCellCb *cell,
-CmLteTimingInfo schdTime,
-RgSchDlSf *dlSf
-));
-
-
-/* APIs exposed by UL SPS */
-Void rgSCHCmnSpsUlLcgDel ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchLcgCb *lcg
-));
-Void rgSCHCmnSpsUlUeReset ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-Void rgSCHCmnSpsUlProcRelInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-Bool isExplRel
-));
-
-Void rgSCHCmnSpsUlProcActInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint16_t spsSduSize
-));
-Void rgSCHCmnSpsPhrInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-
-
-S16 rgSCHCmnSpsBsrRpt ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchLcgCb *ulLcg
-));
-
-
-S16 rgSCHCmnSpsUlCqiInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-S16 rgSCHCmnSpsUlProcDtxInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-CmLteTimingInfo dtxTime
-));
-S16 rgSCHCmnSpsUlTti ARGS((
-RgSchCellCb *cell,
-RgSchCmnUlRbAllocInfo *allocInfo
-));
-#ifdef RG_UNUSED
-S16 rgSCHCmnSpsUlGetActvUeLst ARGS((
-RgSchCellCb *cell,
-CmLteTimingInfo timingInfo,
-CmLListCp *ulSpsActvUeLst
-));
-#endif
-Void rgSCHCmnUlSpsRelInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-Bool isExplRel
-));
-
-
-Void rgSCHCmnUlSpsActInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint16_t spsSduSize
-));
-
-Void rgSCHCmnUlCrcFailInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-CmLteTimingInfo crcTime
-));
-Void rgSCHCmnUlCrcInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-CmLteTimingInfo crcTime
-));
-
-/* Added handling to retrnasmit RelPDCCH in case no
- feedback is received */
-Void rgSCHCmnSpsDlReTxRelPdcch ARGS((
-RgSchCellCb *cell
-));
-#endif
-
-Void rgSCHCmnChkRetxAllowDtx
-ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ueCb,
-RgSchDlHqProcCb *proc,
-Bool *reTxAllwd
-));
-
-S16 PtUiRgmBndCfm ARGS((Pst* pst, SuId suId, uint8_t status));
-
- S16 rgSCHCmnDlInitHqEnt
-ARGS((
-RgSchCellCb *cell,
-RgSchDlHqEnt *hqEnt
-));
-
-Void rgSchCmnDlSfHqDel
-ARGS((
-RgSchUeCb *ue,
-RgSchCellCb *cell
-));
-
-Void rgSCHCmnDlDeInitHqEnt
-ARGS((
-RgSchCellCb *cell,
-RgSchDlHqEnt *hqE
-));
-uint8_t rgSCHCmnUlGetCqi
-ARGS ((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-CmLteUeCategory ueCtgy
-));
-#ifdef DL_LA
-S16 rgSCHDhmUpdBlerBasediTbsEff ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ueCb,
- uint8_t tbCnt
- ));
-#endif
-
-Void rgSchCmnUpdCfiDb ARGS((
- RgSchCellCb *cell,
- uint8_t delta
- ));
-S16 RgUiRgmChangeTransModeInd ARGS((
- Pst *pst,
- SuId suId,
- RgmTransModeInd *transModeInd));
-
-Void rgSchCheckAndTriggerModeChange ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint8_t reportediTbs,
-uint8_t previTbs,
-uint8_t maxiTbs
-));
-Void rgSCHRrDlProcRmvFrmRetx ARGS((
-RgSchCellCb *cell,
-RgSchDlHqProcCb *hqP
-));
-uint8_t rgSchUtlGetServCellIdx ARGS((
- Inst inst,
- uint16_t cellId,
- RgSchUeCb *ue
- ));
-S16 rgSchUtlVldtCellId ARGS ((
- Inst inst,
- uint16_t cellId
-));
-Void rgSCHCmnInitUlRbAllocInfo ARGS((
-RgSchCmnUlRbAllocInfo *allocInfo
-));
-TfuDciFormat rgSCHCmnSlctPdcchFrmt ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint8_t *raType
-));
-
-Void rgSCHCmnNonDlfsDedRbAlloc ARGS((
-RgSchCellCb *cell,
-RgSchCmnUeRbAlloc *allocInfo,
-CmLListCp *ueLst,
-CmLListCp *schdUeLst,
-CmLListCp *nonSchdUeLst
-));
-
-Bool rgSCHCmnRetxAvoidTdd ARGS
-((
-RgSchDlSf *curSf,
-RgSchCellCb *cell,
-RgSchDlHqProcCb *proc
-));
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* __RGSCHCMNX__ */
-
-\f
-/**********************************************************************
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Entry point fucntions
-
- File: rg_sch_dbm.c
-
-**********************************************************************/
-
-/** @file rg_sch_dbm.c
-@brief This file contains the APIs exposed for the database handling of the scheduler.
-*/
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "lrg.h"
-#include "rgr.h"
-#include "tfu.h"
-#include "rg_env.h"
-#include "rg_sch_err.h"
-#include "rg_sch_inf.h"
-#include "rg_sch.h"
-#include "rg_sch_cmn.h"
-
-/* header/extern include files (.x) */
-#include "lrg.x"
-#include "rgr.x"
-#include "tfu.x"
-#include "rgm.x" /* layer management typedefs for MAC */
-#include "rg_sch_inf.x"
-#include "rg_sch.x"
-#include "rg_sch_cmn.x"
-
-
-/* local defines */
-static S16 rgSCHDbmInitUeCbLst ARGS(( RgSchCellCb *cellCb, uint16_t numBins));
-#ifdef LTE_TDD
-static S16 rgSCHDbmInitUeTfuPendLst ARGS(( RgSchCellCb *cellCb, uint16_t numBins));
-#endif
-static Void rgSCHDbmInitDedLcLst ARGS((RgSchUeCb *ueCb));
-static Void rgSCHDbmInitCmnLcLst ARGS((RgSchCellCb *cellCb));
-#ifdef LTEMAC_SPS
-static S16 rgSCHDbmInitSpsUeCbLst ARGS((RgSchCellCb *cellCb,
- uint16_t numBins));
-#endif
-static Void rgSCHDbmInitRaCbLst ARGS(( RgSchCellCb *cellCb));
-#ifndef LTE_TDD
-static Void rgSCHDbmInitRaReqLst ARGS(( RgSchCellCb *cellCb));
-#endif
-static Void rgSCHDbmInitCrntRgrCfgLst ARGS(( RgSchCellCb *cellCb));
-static Void rgSCHDbmInitPndngRgrCfgLst ARGS(( RgSchCellCb *cellCb));
-
-#ifdef EMTC_ENABLE
- S16 rgSCHDbmPutEmtcRnti ARGS((RgSchCellCb *cellCb,RgSchRntiLnk *rntiLnk));
-#endif
-
-/* local typedefs */
-
-/* local externs */
-
-/* forward references */
-
-/**
- * @brief Handler for Initializing the cell.
- *
- * @details
- *
- * Function : rgSCHDbmInitCell
- *
- * Initializes the lists belonging to the cell.
- *
- *
- * @param[in] RgSchCellCb *cellCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHDbmInitCell(RgSchCellCb *cellCb)
-{
- S16 ret;
-
- /* Initialize ue list */
- if ((ret = rgSCHDbmInitUeCbLst(cellCb, RGSCH_MAX_UE_BIN_PER_CELL)) != ROK)
- return (ret);
-#ifdef LTE_TDD
- if ((ret = rgSCHDbmInitUeTfuPendLst(cellCb,
- RGSCH_MAX_UE_BIN_PER_CELL)) != ROK)
- return (ret);
-#endif
-
-#ifdef LTEMAC_SPS
- /* Initialize SPS Ue list */
- if ((ret = rgSCHDbmInitSpsUeCbLst(cellCb, RGSCH_MAX_UE_BIN_PER_CELL)) != ROK)
- return (ret);
-#endif /* LTEMAC_SPS */
-
- /* Initialize BCCH/PCCH logical channels */
- rgSCHDbmInitCmnLcLst(cellCb);
-
- /* Initialize configuration lists */
- rgSCHDbmInitCrntRgrCfgLst(cellCb);
- rgSCHDbmInitPndngRgrCfgLst(cellCb);
-
-#ifndef LTE_TDD
- /* Initialize raReq list */
- rgSCHDbmInitRaReqLst(cellCb);
-#endif
-
- /* Initialize raCb list */
- rgSCHDbmInitRaCbLst(cellCb);
-
- /* Initialize l2mList */
-#ifdef LTE_L2_MEAS
- cmLListInit(&cellCb->l2mList);
-#endif /* LTE_L2_MEAS */
-
- return (ret);
-
-} /* rgSCHDbmInitCell */
-
-/**
- * @brief Handler for initializing the ueCbLst under the cellCb.
- *
- * @details
- *
- * Function : rgSCHDbmInitUeCbLst
- *
- *
- * @param[in] *cellCb
- * @param[in] numBins
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHDbmInitUeCbLst(RgSchCellCb *cellCb,uint16_t numBins)
-{
- RgSchUeCellInfo ueCellInfo;
-
- /* Fix: syed It is better to compute offset dynamically
- * rather than hardcoding it as 0 */
- return (cmHashListInit(&cellCb->ueLst, numBins, (uint16_t)((PTR)&(ueCellInfo.ueLstEnt) - (PTR)&ueCellInfo), FALSE,
- CM_HASH_KEYTYPE_CONID,
- rgSchCb[cellCb->instIdx].rgSchInit.region,
- rgSchCb[cellCb->instIdx].rgSchInit.pool));
-
-} /* rgSCHDbmInitUeCbLst */
-
-/**
- * @brief Handler for de-initializing the ueCbLst under the cellCb.
- *
- * @details
- *
- * Function : rgSCHDbmDeInitUeCbLst
- *
- *
- * @param[in] *cellCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHDbmDeInitUeCbLst(RgSchCellCb *cellCb)
-{
-
- return (cmHashListDeinit(&cellCb->ueLst));
-
-} /* rgSCHDbmDeInitUeCbLst */
-
-#ifdef LTEMAC_SPS
-/**
- * @brief Handler for initializing the spsUeCbLst under the cellCb.
- *
- * @details
- *
- * Function : rgSCHDbmInitSpsUeCbLst
- *
- *
- * @param[in] *cellCb
- * @param[in] numBins
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHDbmInitSpsUeCbLst(RgSchCellCb *cellCb,uint16_t numBins)
-{
- RgSchUeCb ue;
-
- return (cmHashListInit(&cellCb->spsUeLst, numBins, (uint16_t) ((PTR) &(ue.spsUeLstEnt) - (PTR) &ue), FALSE,
- CM_HASH_KEYTYPE_CONID,
- rgSchCb[cellCb->instIdx].rgSchInit.region,
- rgSchCb[cellCb->instIdx].rgSchInit.pool));
-
-} /* rgSCHDbmInitSpsUeCbLst */
-
-/**
- * @brief Handler for de-initializing the spsUeCbLst under the cellCb.
- *
- * @details
- *
- * Function : rgSCHDbmDeInitSpsUeCbLst
- *
- *
- * @param[in] *cellCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHDbmDeInitSpsUeCbLst(RgSchCellCb *cellCb)
-{
-
- return (cmHashListDeinit(&cellCb->spsUeLst));
-
-} /* rgSCHDbmDeInitSpsUeCbLst */
-
-#endif /* LTEMAC_SPS */
-
-/**
- * @brief Handler for inserting the ueCb in to the ueCbLst under the cellCb.
- *
- * @details
- *
- * Function : rgSCHDbmInsUeCb
- *
- *
- * @param[in] *cellCb
- * @param[in] *ueCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHDbmInsUeCb(RgSchCellCb *cellCb,RgSchUeCb *ueCb)
-{
- RgSchUeCellInfo *ueCellInfo = NULLP;
-
- ueCellInfo = ueCb->cellInfo[ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cellCb)]];
-
- return (cmHashListInsert(&cellCb->ueLst, (PTR)ueCellInfo,
- (uint8_t *)&ueCb->ueId, (uint16_t)sizeof(ueCb->ueId)));
-
-} /* rgSCHDbmInsUeCb */
-
-#ifdef LTEMAC_SPS
-/**
- * @brief Handler for inserting the ueCb in to the spsUeCbLst under the cellCb.
- *
- * @details
- *
- * Function : rgSCHDbmInsSpsUeCb
- *
- *
- * @param[in] *cellCb
- * @param[in] *ueCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHDbmInsSpsUeCb(RgSchCellCb *cellCb,RgSchUeCb *ueCb)
-{
- return (cmHashListInsert(&cellCb->spsUeLst, (PTR)ueCb,
- (uint8_t *)&ueCb->spsRnti, (uint16_t)sizeof(ueCb->spsRnti)));
-
-} /* end of rgSCHDbmInsSpsUeCb */
-
-#endif /* LTEMAC_SPS */
-
-/**
- * @brief Handler for accessing the existing ueCb identified by the key ueId
- * in the ueCbLst under the cellCb.
- *
- * @details
- *
- * Function : rgSCHDbmGetUeCb
- *
- *
- * @param[in] *cellCb
- * @param[in] ueId
- * @return RgSchUeCb*
- **/
-RgSchUeCb* rgSCHDbmGetUeCb(RgSchCellCb *cellCb,CmLteRnti ueId)
-{
- RgSchUeCellInfo *ueCellInfo = NULLP;
-
- cmHashListFind(&cellCb->ueLst, (uint8_t *)&ueId,
- sizeof(ueId), 0, (PTR *)&ueCellInfo);
-
- return (!ueCellInfo?NULLP:ueCellInfo->ue);
-} /* rgSCHDbmGetUeCb */
-
-#ifdef LTEMAC_SPS
-/**
- * @brief Handler for accessing the existing ueCb identified by the key
- * spsRnti in the spsUeCbLst under the cellCb.
- *
- * @details
- *
- * Function : rgSCHDbmGetSpsUeCb
- *
- *
- * @param[in] *cellCb
- * @param[in] ueId
- * @return RgSchUeCb*
- **/
-RgSchUeCb* rgSCHDbmGetSpsUeCb(RgSchCellCb *cellCb, CmLteRnti spsRnti)
-{
- RgSchUeCb *ueCb = NULLP;
-
- cmHashListFind(&cellCb->spsUeLst, (uint8_t *)&spsRnti,
- sizeof(spsRnti), 0, (PTR *)&ueCb);
- return (ueCb);
-} /* rgSCHDbmGetSpsUeCb */
-#endif
-
-/**
- * @brief Handler for accessing the existing next ueCb in the ueCbLst under the
- * cellCb.
- *
- * @details
- *
- * Function : rgSCHDbmGetNextUeCb
- *
- *
- * @param[in] *cellCb
- * @param[in] *ueCb
- * @return RgSchUeCb*
- **/
-RgSchUeCb* rgSCHDbmGetNextUeCb(RgSchCellCb *cellCb, RgSchUeCb *ueCb)
-{
- RgSchUeCellInfo *ueCellInfo = NULLP;
- RgSchUeCellInfo *nextUeCellInfo = NULLP;
-
- if (ueCb)
- {
- ueCellInfo = ueCb->cellInfo[
- ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cellCb)]];
- }
-
- cmHashListGetNext(&cellCb->ueLst, (PTR) ueCellInfo, (PTR *)&nextUeCellInfo);
- return (!nextUeCellInfo?NULLP:nextUeCellInfo->ue);
-} /* rgSCHDbmGetNextUeCb */
-
-#ifdef LTEMAC_SPS
-/**
- * @brief Handler for accessing the existing next ueCb stored in the spsUeCbLst
- * using SPS-Rnti under the cellCb.
- *
- * @details
- *
- * Function : rgSCHDbmGetNextSpsUeCb
- *
- *
- * @param[in] *cellCb
- * @param[in] *ueCb
- * @return RgSchUeCb*
- **/
-RgSchUeCb* rgSCHDbmGetNextSpsUeCb(RgSchCellCb *cellCb, RgSchUeCb *ueCb)
-{
- RgSchUeCb *nextUeCb = NULLP;
-
- cmHashListGetNext(&cellCb->spsUeLst, (PTR) ueCb, (PTR *)&nextUeCb);
- return (nextUeCb);
-} /* end of rgSCHDbmGetNextSpsUeCb */
-
-#endif /* LTEMAC_SPS */
-
-#ifdef LTE_L2_MEAS
-/**
- * @brief Handler for Cleaning up L2 Meas related Data in
- * cellCb.
- *
- * @details
- *
- * Function : rgSCHDbmDelL2MUe
- *
- *
- * @param[in] *cellCb
- * @param[in] *ueCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHDbmDelL2MUe(RgSchCellCb *cellCb,RgSchUeCb *ueCb)
-{
- uint8_t lcCnt = 0;
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ueCb, cellCb);
-
- ueUl->hqEnt.numBusyHqProcs = 0;
- /* Clean cell level UE Active Count */
- for (lcCnt =0; lcCnt < RGSCH_MAX_LC_PER_UE; lcCnt++)
- {
- if (ueCb->ul.lcCb[lcCnt].isValid)
- {
- if((ueCb->ul.lcCb[lcCnt].qciCb->ulUeCount) &&
- (ueCb->ulActiveLCs &
- (1 << (ueCb->ul.lcCb[lcCnt].qciCb->qci -1))))
- {
- ueCb->ul.lcCb[lcCnt].qciCb->ulUeCount--;
- ueCb->ulActiveLCs &= ~(1 <<
- (ueCb->ul.lcCb[lcCnt].qciCb->qci -1));
- }
- }
-
- if (ueCb->dl.lcCb[lcCnt])
- {
- if (ueCb->qciActiveLCs[ueCb->dl.lcCb[lcCnt]->qciCb->qci])
- {
- ueCb->dl.lcCb[lcCnt]->qciCb->dlUeCount--;
- ueCb->qciActiveLCs[ueCb->dl.lcCb[lcCnt]->qciCb->qci] = 0;
- }
- }
- }
-
- return ROK;
-} /* rgSCHDbmDelL2MUe */
-
-#endif
-
-/**
- * @brief Handler for deleting the existing ueCb from the ueCbLst under the
- * cellCb.
- *
- * @details
- *
- * Function : rgSCHDbmDelUeCb
- *
- *
- * @param[in] *cellCb
- * @param[in] *ueCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHDbmDelUeCb(RgSchCellCb *cellCb,RgSchUeCb *ueCb)
-{
- RgSchUeCellInfo *ueCellInfo = NULLP;
-
- ueCellInfo = ueCb->cellInfo[ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cellCb)]];
-
- return (cmHashListDelete(&cellCb->ueLst, (PTR)ueCellInfo));
-} /* rgSCHDbmDelUeCb */
-
-#ifdef LTEMAC_SPS
-/**
- * @brief Handler for deleting the existing ueCb from the spsUeCbLst under the
- * cellCb.
- *
- * @details
- *
- * Function : rgSCHDbmDelSpsUeCb
- *
- *
- * @param[in] *cellCb
- * @param[in] *ueCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHDbmDelSpsUeCb(RgSchCellCb *cellCb,RgSchUeCb *ueCb)
-{
-
- return (cmHashListDelete(&cellCb->spsUeLst, (PTR)ueCb));
-} /* end of rgSCHDbmDelSpsUeCb */
-
-#endif /* LTEMAC_SPS */
-
-/**
- * @brief Handler for Initializing the UE.
- *
- * @details
- *
- * Function : rgSCHDbmInitUe
- *
- * Initializes the lists belonging to the UE.
- *
- *
- * @param[in] RgSchUeCb *ueCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHDbmInitUe(RgSchUeCb *ueCb)
-{
- S16 ret = ROK;
-
- /* Initialize Dedicated logical channels */
- rgSCHDbmInitDedLcLst(ueCb);
-
- return (ret);
-} /* rgSCHDbmInitUe */
-
-/**
- * @brief Handler for Initializing the dedicated logical channels.
- *
- * @details
- *
- * Function : rgSCHDbmInitDedLcLst
- *
- * Initializes dedicated logical channels.
- *
- * @param[in] RgSchUeCb *ueCb
- * @return Void
- **/
-static Void rgSCHDbmInitDedLcLst(RgSchUeCb *ueCb)
-{
- uint8_t idx;
-
- for (idx = 0; idx < RGSCH_MAX_LC_PER_UE; ++idx)
- {
- /* Set Dedicated LCs as not configured */
- ueCb->ul.lcCb[idx].isValid = FALSE;
- ueCb->dl.lcCb[idx] = NULLP;
- }
-
- /* Stack Crash problems for TRACE5 Changes. Added the return below */
- return;
-
-
-} /* rgSCHDbmInitDedLcLst */
-
-/**
- * @brief Handler for Initializing the common logical channel list of the cell.
- *
- * @details
- *
- * Function : rgSCHDbmInitCmnLcLst
- *
- * Initializes following common logical channels belonging to the cell.
- * - BCCH on BCH
- * - BCCH on DLSCH
- * - PCCH
- *
- * @param[in] RgSchCellCb *cellCb
- * @return Void
- **/
-static Void rgSCHDbmInitCmnLcLst(RgSchCellCb *cellCb)
-{
- uint8_t idx;
-
- for (idx = 0; idx < RGSCH_MAX_CMN_LC_CB; idx++)
- {
- cellCb->cmnLcCb[idx].lcId = RGSCH_INVALID_LC_ID;
- }
-
- /* Stack Crash problems for TRACE5 Changes. Added the return below */
- return;
-
-} /* rgSCHDbmInitCmnLcLst */
-
-/**
- * @brief Handler for inserting dedicated DL logical channel.
- *
- * @details
- *
- * Function : rgSCHDbmInsDlDedLcCb
- *
- * @param[in] RgSchUeCb *ueCb
- * @param[in] RgSchDlLcCb* dlLcCb
- * @return Void
- **/
-Void rgSCHDbmInsDlDedLcCb(RgSchUeCb *ueCb, RgSchDlLcCb *dlLcCb )
-{
-
- ueCb->dl.lcCb[dlLcCb->lcId - 1] = dlLcCb;
-
-} /* rgSCHDbmInsDlDedLcCb */
-
-/**
- * @brief Handler for deleting dedicated DL logical channel.
- *
- * @details
- *
- * Function : rgSCHDbmDelDlDedLcCb
- *
- * @param[in] RgSchUeCb *ueCb
- * @param[in] RgSchDlLcCb* dlLcCb
- * @return Void
- **/
-Void rgSCHDbmDelDlDedLcCb(RgSchUeCb *ueCb, RgSchDlLcCb *dlLcCb )
-{
-
-#ifdef LTE_L2_MEAS
- /* Clean cell level UE Active Count */
-
- if (ueCb->dl.lcCb[dlLcCb->lcId - 1])
- {
- if ((dlLcCb->qciCb)
- && (ueCb->qciActiveLCs[dlLcCb->qciCb->qci]))
- {
- ueCb->qciActiveLCs[dlLcCb->qciCb->qci]--;
- if (!(ueCb->qciActiveLCs[dlLcCb->qciCb->qci]))
- {
- dlLcCb->qciCb->dlUeCount--;
- }
- }
- }
-#endif /* LTE_L2_MEAS */
-
- ueCb->dl.lcCb[dlLcCb->lcId - 1] = NULLP;
-
- /* Stack Crash problems for TRACE5 Changes. Added the return below */
- return;
-
-} /* rgSCHDbmDelDlDedLcCb */
-
-/**
- * @brief Handler for accessing the existing dl dedicated lcCb at idx in the
- * lcCbLst of the ueCb.
- *
- * @details
- *
- * Function : rgSCHDbmGetDlDedLcCb
- *
- * @param[in] *ueCb
- * @param[in] idx
- * @return RgSchDlLcCb*
- **/
-RgSchDlLcCb* rgSCHDbmGetDlDedLcCb(RgSchUeCb *ueCb, CmLteLcId idx)
-{
- if (idx < RGSCH_DEDLC_MIN_LCID || idx > RGSCH_DEDLC_MAX_LCID)
- {
- return (NULLP);
- }
- return (ueCb->dl.lcCb[idx-1]);
-
-} /* rgSCHDbmGetDlDedLcCb */
-
-/**
- * @brief Handler for accessing the existing first dl dedicated lcCb at idx
- * in the lcCbLst of the ueCb.
- *
- * @details
- *
- * Function : rgSCHDbmGetFirstDlDedLcCb
- *
- *
- * @param[in] *ueCb
- * @return RgSchDlLcCb*
- **/
-RgSchDlLcCb* rgSCHDbmGetFirstDlDedLcCb(RgSchUeCb *ueCb)
-{
- uint8_t idx;
-
- for(idx = 0; idx < RGSCH_DEDLC_MAX_LCID; idx++)
- {
- if(ueCb->dl.lcCb[idx])
- {
- return (ueCb->dl.lcCb[idx]);
- }
- }
- return (NULLP);
-} /* rgSCHDbmGetFirstDlDedLcCb */
-/**
- * @brief Handler for accessing the existing next dl dedicated lcCb at idx
- * in the lcCbLst of the ueCb.
- *
- * @details
- *
- * Function : rgSCHDbmGetNextDlDedLcCb
- *
- *
- * @param[in] *ueCb
- * @param[in] *lcCb
- * @return RgSchDlLcCb*
- **/
-RgSchDlLcCb* rgSCHDbmGetNextDlDedLcCb(RgSchUeCb *ueCb,RgSchDlLcCb *lcCb)
-{
- uint8_t idx;
-
- if (!lcCb)
- {
- return (rgSCHDbmGetFirstDlDedLcCb(ueCb));
- }
-
- for(idx = lcCb->lcId; idx < RGSCH_DEDLC_MAX_LCID; idx++)
- {
- if(ueCb->dl.lcCb[idx])
- {
- return (ueCb->dl.lcCb[idx]);
- }
- }
- return (NULLP);
-} /* rgSCHDbmGetNextDlDedLcCb */
-
-/**
- * @brief Handler for accessing the existing dl common lcCb identified by the key lcId
- * in the lcCbLst of the ueCb.
- *
- * @details
- *
- * Function : rgSCHDbmGetCmnLcCb
- *
- *
- * @param[in] *cellCb
- * @param[in] lcId
- * @return RgSchClcDlLcCb*
- **/
-RgSchClcDlLcCb* rgSCHDbmGetCmnLcCb(RgSchCellCb *cellCb, CmLteLcId lcId)
-{
- uint8_t idx;
-
- for(idx = 0; idx < RGSCH_MAX_CMN_LC_CB; idx++)
- {
- if(cellCb->cmnLcCb[idx].lcId == lcId)
- {
- return (&(cellCb->cmnLcCb[idx]));
- }
- }
- return (NULLP);
-} /* rgSCHDbmGetCmnLcCb */
-
-/**
- * @brief Handler for accessing the existing BCCH mapped on to BCH in the
- * lcCbLst of the ueCb.
- *
- * @details
- *
- * Function : rgSCHDbmGetBcchOnBch
- *
- *
- * @param[in] *cellCb
- * @return RgSchClcDlLcCb*
- **/
-RgSchClcDlLcCb* rgSCHDbmGetBcchOnBch(RgSchCellCb *cellCb )
-{
-
- if(cellCb->cmnLcCb[RGSCH_BCCH_BCH_IDX].lcId != RGSCH_INVALID_LC_ID)
- {
- return (&(cellCb->cmnLcCb[RGSCH_BCCH_BCH_IDX]));
- }
- return (NULLP);
-} /* rgSCHDbmGetBcchOnBch */
-
-/**
- * @brief Handler for accessing the existing BCCH mapped on to DLSCH in the
- * lcCbLst of the ueCb.
- *
- * @details
- *
- * Function : rgSCHDbmGetFirstBcchOnDlsch
- *
- *
- * @param[in] *cellCb
- * @return RgSchClcDlLcCb*
- **/
-RgSchClcDlLcCb* rgSCHDbmGetFirstBcchOnDlsch(RgSchCellCb *cellCb)
-{
-
- if(cellCb->cmnLcCb[RGSCH_BCCH_DLSCH_IDX1].lcId != RGSCH_INVALID_LC_ID)
- {
- return (&(cellCb->cmnLcCb[RGSCH_BCCH_DLSCH_IDX1]));
- }
- return (NULLP);
-} /* rgSCHDbmGetFirstBcchOnDlsch */
-
-/**
- * @brief Handler for accessing the existing BCCH mapped on to DLSCH in the
- * lcCbLst of the ueCb.
- *
- * @details
- *
- * Function : rgSCHDbmGetSecondBcchOnDlsch
- *
- *
- * @param[in] *cellCb
- * @return RgSchClcDlLcCb*
- **/
-RgSchClcDlLcCb* rgSCHDbmGetSecondBcchOnDlsch(RgSchCellCb *cellCb)
-{
-
- if(cellCb->cmnLcCb[RGSCH_BCCH_DLSCH_IDX2].lcId != RGSCH_INVALID_LC_ID)
- {
- return (&(cellCb->cmnLcCb[RGSCH_BCCH_DLSCH_IDX2]));
- }
- return (NULLP);
-} /* rgSCHDbmGetSecondBcchOnDlsch */
-
-/**
- * @brief Handler for accessing the existing PCCH in the lcCbLst of the ueCb.
- *
- * @details
- *
- * Function : rgSCHDbmGetPcch
- *
- *
- * @param[in] *cellCb
- * @return RgSchClcDlLcCb*
- **/
-RgSchClcDlLcCb* rgSCHDbmGetPcch(RgSchCellCb *cellCb)
-{
-
- if(cellCb->cmnLcCb[RGSCH_PCCH_IDX].lcId != RGSCH_INVALID_LC_ID)
- {
- return (&(cellCb->cmnLcCb[RGSCH_PCCH_IDX]));
- }
- return (NULLP);
-} /* rgSCHDbmGetPcch */
-
-/**
- * @brief Handler for inserting the BCCH mapped on to BCH in the
- * lcCbLst of the ueCb.
- *
- * @details
- *
- * Function : rgSCHDbmInsBcchOnBch
- *
- *
- * @param[in] *cellCb
- * @return Void
- **/
-Void rgSCHDbmInsBcchOnBch(RgSchCellCb *cellCb, RgSchClcDlLcCb *cmnDlLcCb)
-{
-
- cellCb->cmnLcCb[RGSCH_BCCH_BCH_IDX].lcId = cmnDlLcCb->lcId;
- cellCb->cmnLcCb[RGSCH_BCCH_BCH_IDX].boLst = cmnDlLcCb->boLst;
-
- /* Stack Crash problems for TRACE5 Changes. Added the return below */
- return;
-
-} /* rgSCHDbmInsBcchOnBch */
-
-/**
- * @brief Handler for inserting the BCCH mapped on to DLSCH in the
- * lcCbLst of the ueCb.
- *
- * @details
- *
- * Function : rgSCHDbmInsBcchOnDlsch
- *
- *
- * @param[in] *cellCb
- * @return Void
- **/
-Void rgSCHDbmInsBcchOnDlsch(RgSchCellCb *cellCb, RgSchClcDlLcCb *cmnDlLcCb)
-{
- if(cellCb->cmnLcCb[RGSCH_BCCH_DLSCH_IDX1].lcId == RGSCH_INVALID_LC_ID)
- {
- cellCb->cmnLcCb[RGSCH_BCCH_DLSCH_IDX1].lcId = cmnDlLcCb->lcId;
- cellCb->cmnLcCb[RGSCH_BCCH_DLSCH_IDX1].boLst = cmnDlLcCb->boLst;
- cellCb->cmnLcCb[RGSCH_BCCH_DLSCH_IDX1].si = FALSE;
- }
- else if(cellCb->cmnLcCb[RGSCH_BCCH_DLSCH_IDX2].lcId == RGSCH_INVALID_LC_ID)
- {
- cellCb->cmnLcCb[RGSCH_BCCH_DLSCH_IDX2].lcId = cmnDlLcCb->lcId;
- cellCb->cmnLcCb[RGSCH_BCCH_DLSCH_IDX2].boLst = cmnDlLcCb->boLst;
- cellCb->cmnLcCb[RGSCH_BCCH_DLSCH_IDX2].si = TRUE;
- }
-
- /* Stack Crash problems for TRACE5 Changes. Added the return below */
- return;
-
-} /* rgSCHDbmInsBcchOnDlsch */
-
-
-/**
- * @brief Handler for inserting the PCCH in the lcCbLst of the ueCb.
- *
- * @details
- *
- * Function : rgSCHDbmInsPcch
- *
- *
- * @param[in] *cellCb
- * @return Void
- **/
-Void rgSCHDbmInsPcch(RgSchCellCb *cellCb, RgSchClcDlLcCb *cmnDlLcCb)
-{
-
- cellCb->cmnLcCb[RGSCH_PCCH_IDX].lcId = cmnDlLcCb->lcId;
- cellCb->cmnLcCb[RGSCH_PCCH_IDX].boLst = cmnDlLcCb->boLst;
-
- /* Stack Crash problems for TRACE5 Changes. Added the return below */
- return;
-
-} /* rgSCHDbmInsPcch */
-
-/**
- * @brief Handler for initializing the boLst.
- *
- * @details
- *
- * Function : rgSCHDbmInitCmnLcBoLst
- *
- *
- * @param[in] *cmnDlLcCb
- * @return Void
- **/
-Void rgSCHDbmInitCmnLcBoLst(RgSchClcDlLcCb *cmnDlLcCb)
-{
-
- cmLListInit(&cmnDlLcCb->boLst);
- return;
-} /* rgSCHDbmInitCmnLcBoLst */
-
-/**
- * @brief Handler for inserting the bo report in to the boLst.
- *
- * @details
- *
- * Function : rgSCHDbmInsCmnLcBoRpt
- *
- *
- * @param[in] *cmnDlLcCb
- * @param[in] *boRpt
- * @return Void
- **/
-Void rgSCHDbmInsCmnLcBoRpt(RgSchClcDlLcCb *cmnDlLcCb,RgSchClcBoRpt *cmnBoRpt)
-{
- cmnBoRpt->boLstEnt.next = NULLP;
- cmnBoRpt->boLstEnt.prev = NULLP;
- cmnBoRpt->boLstEnt.node = (PTR)cmnBoRpt;
- cmLListAdd2Tail(&cmnDlLcCb->boLst, &cmnBoRpt->boLstEnt);
- return;
-} /* rgSCHDbmInsCmnLcBoRpt */
-
-
-/**
- * @brief Handler for initializing the raCbLst.
- *
- * @details
- *
- * Function : rgSCHDbmInitRaCbLst
- *
- *
- * @param[in] *cellCb
- * @return Void
- **/
-static Void rgSCHDbmInitRaCbLst(RgSchCellCb *cellCb)
-{
-
- cmLListInit(&cellCb->raInfo.raCbLst);
- return;
-} /* rgSCHDbmInitRaCbLst */
-
-
-/**
- * @brief Handler for accessing the existing raCb in the raCbLst.
- *
- * @details
- *
- * Function : rgSCHDbmGetRaCb
- *
- *
- * @param[in] *cellCb
- * @param[in] key
- * @return RgSchRaCb*
- **/
-RgSchRaCb* rgSCHDbmGetRaCb(RgSchCellCb *cellCb, CmLteRnti key)
-{
- CmLList *tmpNode;
-
- CM_LLIST_FIRST_NODE(&cellCb->raInfo.raCbLst,tmpNode);
- while(tmpNode)
- {
- if(((RgSchRaCb *)tmpNode->node)->tmpCrnti == key)
- {
- return ((RgSchRaCb *)(tmpNode->node));
- }
- CM_LLIST_NEXT_NODE(&cellCb->raInfo.raCbLst,tmpNode);
- }
- return (NULLP);
-} /* rgSCHDbmGetRaCb */
-
-#ifndef LTE_TDD
-/**
- * @brief Handler for initializing the raReqLst.
- g
- * @details
- *
- * Function : rgSCHDbmInitRaReqLst
- *
- *
- * @param[in] *cellCb
- * @return Void
- **/
-static Void rgSCHDbmInitRaReqLst(RgSchCellCb *cellCb)
-{
- uint8_t idx;
-
- /* ccpu00133557- Memory Leak Fix- initializing for the all nodes
- * in RAREQ list*/
- for(idx = 0; idx < RGSCH_RAREQ_ARRAY_SIZE; idx++)
- {
- cmLListInit(&cellCb->raInfo.raReqLst[idx]);
- }
- return;
-} /* rgSCHDbmInitRaReqLst */
-#endif
-
-/**
- * @brief Handler for initializing the crnt rgr cfgLst.
- *
- * @details
- *
- * Function : rgSCHDbmInitCrntRgrCfgLst
- *
- *
- * @param[in] *cellCb
- * @return Void
- **/
-static Void rgSCHDbmInitCrntRgrCfgLst(RgSchCellCb *cellCb)
-{
-
- cmLListInit(&cellCb->rgCfgInfo.crntRgrCfgLst);
- return;
-} /* rgSCHDbmInitCrntRgrCfgLst */
-
-/**
- * @brief Handler for initializing the pndng rgr cfgLst.
- *
- * @details
- *
- * Function : rgSCHDbmInitPndngRgrCfgLst
- *
- *
- * @param[in] *cellCb
- * @return Void
- **/
-static Void rgSCHDbmInitPndngRgrCfgLst(RgSchCellCb *cellCb)
-{
-
- cmLListInit(&cellCb->rgCfgInfo.pndngRgrCfgLst);
- return;
-} /* rgSCHDbmInitPndngRgrCfgLst */
-
-/**
- * @brief Handler for inserting the cfgElem in to the crntRgrCfgLst.
- *
- * @details
- *
- * Function : rgSCHDbmInsCrntRgrCfgElem
- *
- *
- * @param[in] *cellCb
- * @param[in] *cfgElem
- * @return Void
- **/
-Void rgSCHDbmInsCrntRgrCfgElem(RgSchCellCb *cellCb,RgSchCfgElem *cfgElem)
-{
- cfgElem->cfgReqLstEnt.next = NULLP;
- cfgElem->cfgReqLstEnt.prev = NULLP;
- cmLListAdd2Tail(&cellCb->rgCfgInfo.crntRgrCfgLst, &cfgElem->cfgReqLstEnt);
- return;
-} /* rgSCHDbmInsCrntRgrCfgElem */
-
-/**
- * @brief Handler for inserting the cfgElem in to the pndngRgrCfgLst.
- *
- * @details
- *
- * Function : rgSCHDbmInsPndngRgrCfgElem
- *
- *
- * @param[in] *cellCb
- * @param[in] *cfgElem
- * @return Void
- **/
-Void rgSCHDbmInsPndngRgrCfgElem(RgSchCellCb *cellCb,RgSchCfgElem *cfgElem)
-{
-
- cfgElem->cfgReqLstEnt.next = NULLP;
- cfgElem->cfgReqLstEnt.prev = NULLP;
- cfgElem->cfgReqLstEnt.node = (PTR)cfgElem;
- cmLListAdd2Tail(&cellCb->rgCfgInfo.pndngRgrCfgLst, &cfgElem->cfgReqLstEnt);
- return;
-} /* rgSCHDbmInsPndngRgrCfgElem */
-
-/**
- * @brief Handler for accessing the existing cfgElem in the crntRgrCfgLst.
- *
- * @details
- *
- * Function : rgSCHDbmGetNextCrntRgrCfgElem
- *
- *
- * @param[in] *cellCb
- * @param[in] *cfgElem
- * @return RgSchCfgElem*
- **/
-RgSchCfgElem* rgSCHDbmGetNextCrntRgrCfgElem(RgSchCellCb *cellCb,RgSchCfgElem *cfgElem)
-{
-
- if(!cfgElem)
- {
- return ( cellCb->rgCfgInfo.crntRgrCfgLst.first ?
- (RgSchCfgElem *)(cellCb->rgCfgInfo.crntRgrCfgLst.first->node) : NULLP );
- }
- return ( cfgElem->cfgReqLstEnt.next ?
- (RgSchCfgElem *)(cfgElem->cfgReqLstEnt.next->node) : NULLP );
-} /* rgSCHDbmGetNextCrntRgrCfgElem */
-
-/**
- * @brief Handler for accessing the existing cfgElem in the pndngRgrCfgLst.
- *
- * @details
- *
- * Function : rgSCHDbmGetNextPndngRgrCfgElem
- *
- *
- * @param[in] *cellCb
- * @param[in] *cfgElem
- * @return RgSchCfgElem*
- **/
-RgSchCfgElem* rgSCHDbmGetNextPndngRgrCfgElem(RgSchCellCb *cellCb,RgSchCfgElem *cfgElem)
-{
-
- if(!cfgElem)
- {
- return ( cellCb->rgCfgInfo.pndngRgrCfgLst.first ?
- (RgSchCfgElem *)(cellCb->rgCfgInfo.pndngRgrCfgLst.first->node) : NULLP );
- }
- return ( cfgElem->cfgReqLstEnt.next ?
- (RgSchCfgElem *)(cfgElem->cfgReqLstEnt.next->node) : NULLP );
-} /* rgSCHDbmGetNextPndngRgrCfgElem */
-
-/**
- * @brief Handler for extracting the existing cfgElem from the pndngRgrCfgLst.
- *
- * @details
- *
- * Function : rgSCHDbmGetPndngRgrCfgElemByKey
- *
- *
- * @param[in] *cellCb
- * @param[in] key
- * @return RgSchCfgElem*
- **/
-RgSchCfgElem* rgSCHDbmGetPndngRgrCfgElemByKey(RgSchCellCb *cellCb,CmLteTimingInfo key)
-{
- CmLList *tmpNode;
-
- CM_LLIST_FIRST_NODE(&cellCb->rgCfgInfo.pndngRgrCfgLst,tmpNode);
- while(tmpNode)
- {
- if((((RgSchCfgElem *)tmpNode->node)->actvTime.sfn == key.sfn) &&
- (((RgSchCfgElem *)tmpNode->node)->actvTime.slot == key.slot))
- {
- return ((RgSchCfgElem *)(tmpNode->node));
- }
- CM_LLIST_NEXT_NODE(&cellCb->rgCfgInfo.pndngRgrCfgLst,tmpNode);
- }
- return (NULLP);
-} /* rgSCHDbmGetPndngRgrCfgElemByKey */
-
-/**
- * @brief Handler for deleting the existing cfgElem from the crntRgrCfgLst.
- *
- * @details
- *
- * Function : rgSCHDbmDelCrntRgrCfgElem
- *
- *
- * @param[in] *cellCb
- * @param[in] *cfgElem
- * @return RgSchCfgElem*
- **/
-RgSchCfgElem* rgSCHDbmDelCrntRgrCfgElem(RgSchCellCb *cellCb,RgSchCfgElem *cfgElem)
-{
-
- if(cmLListDelFrm(&cellCb->rgCfgInfo.crntRgrCfgLst,&cfgElem->cfgReqLstEnt))
- {
- return ((RgSchCfgElem *)(cfgElem->cfgReqLstEnt.node));
- }
- return (NULLP);
-} /* rgSCHDbmDelCrntRgrCfgElem */
-
-/**
- * @brief Handler for deleting the existing cfgElem from the pndngRgrCfgLst.
- *
- * @details
- *
- * Function : rgSCHDbmDelPndngRgrCfgElem
- *
- *
- * @param[in] *cellCb
- * @param[in] *cfgElem
- * @return RgSchCfgElem*
- **/
-RgSchCfgElem* rgSCHDbmDelPndngRgrCfgElem(RgSchCellCb *cellCb,RgSchCfgElem *cfgElem)
-{
- if(cmLListDelFrm(&cellCb->rgCfgInfo.pndngRgrCfgLst,&cfgElem->cfgReqLstEnt))
- {
- return ((RgSchCfgElem *)(cfgElem->cfgReqLstEnt.node));
- }
- return (NULLP);
-} /* rgSCHDbmDelPndngRgrCfgElem */
-
-/**
- * @brief Handler for initializing the rntiDb.
- *
- * @details
- *
- * Function : rgSCHDbmRntiDbInit
- *
- *
- * @param[in] *cellCb
- * @param[in] rntiStart
- * @param[in] maxRntis
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHDbmRntiDbInit(RgSchCellCb *cellCb,uint16_t rntiStart,uint16_t maxRntis)
-{
- uint16_t rnti;
- RgSchRntiLnk *rntiPool;
-
- /* Fix for Change Request ccpu00099150 */
- if(rgSCHUtlAllocSBuf(cellCb->instIdx,
- (Data **)&cellCb->rntiDb.rntiPool,maxRntis*sizeof(RgSchRntiLnk)) != ROK)
- {
- return RFAILED;
- }
- cellCb->rntiDb.rntiStart = rntiStart;
- cellCb->rntiDb.maxRntis = maxRntis;
-
- cellCb->rntiDb.count = maxRntis;
-
- rnti = rntiStart;
- rntiPool = cellCb->rntiDb.rntiPool;
- if (maxRntis == 1)
- {
- rntiPool[0].rnti = rnti;
- rntiPool[0].prv = NULLP;
- rntiPool[0].nxt = NULLP;
- cellCb->rntiDb.lastRnti = &rntiPool[0];
- }
- else
- {
- uint16_t idx;
- rntiPool[0].rnti = rnti++;
- rntiPool[0].prv = NULLP;
- rntiPool[0].nxt = &rntiPool[1];
- for (idx = 1; idx < maxRntis - 1; ++idx)
- {
- rntiPool[idx].rnti = rnti++;
- rntiPool[idx].prv = &rntiPool[idx-1];
- rntiPool[idx].nxt = &rntiPool[idx+1];
- }
- rntiPool[idx].rnti = rnti++;
- rntiPool[idx].prv = &rntiPool[idx-1];
- rntiPool[idx].nxt = NULLP;
- cellCb->rntiDb.lastRnti = &rntiPool[idx];
- }
- cellCb->rntiDb.freeRnti = &rntiPool[0];
- return ROK;
-} /* rgSCHDbmRntiDbInit */
-
-/**
- * @brief Handler for de-initializing the rntiDb.
- *
- * @details
- *
- * Function : rgSCHDbmRntiDbDeInit
- *
- *
- * @param[in] *cellCb
- * @return Void
- **/
-Void rgSCHDbmRntiDbDeInit(RgSchCellCb *cellCb)
-{
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cellCb->instIdx, (Data **)(&(cellCb->rntiDb.rntiPool)),
- cellCb->rntiDb.maxRntis*sizeof(RgSchRntiLnk));
- cellCb->rntiDb.maxRntis = 0;
- cellCb->rntiDb.freeRnti = NULLP;
- cellCb->rntiDb.lastRnti = NULLP;
- cmLListInit(&cellCb->rntiDb.rntiGuardPool);
-
- /* Stack Crash problems for TRACE5 Changes. Added the return below */
- return;
-
-} /* rgSCHDbmRntiDbDeInit */
-
-/**
- * @brief Handler for accessing the free RNTI.
- *
- * @details
- *
- * Function : rgSCHDbmGetRnti
- *
- *
- * @param[in] *cellCb
- * @return RgSchRntiLnk*
- **/
-RgSchRntiLnk* rgSCHDbmGetRnti(RgSchCellCb *cellCb)
-{
- RgSchRntiLnk *rntiLnk;
-
- if (!(cellCb->rntiDb.freeRnti))
- {
- DU_LOG("\nERROR --> SCH : RNTI exhausted count:%d",
- cellCb->rntiDb.count);
- return (NULLP);
- }
-
- rntiLnk = cellCb->rntiDb.freeRnti;
- cellCb->rntiDb.freeRnti = rntiLnk->nxt;
-
- /* setting prv and nxt to NULLP may not be needed */
- rntiLnk->prv = NULLP;
- rntiLnk->nxt = NULLP;
-
- if (cellCb->rntiDb.freeRnti != NULLP)
- {
- cellCb->rntiDb.freeRnti->prv = NULLP;
- }
- else
- {
- cellCb->rntiDb.lastRnti = NULLP;
- }
-
- cellCb->rntiDb.count--;
-
- DU_LOG("\nINFO --> SCH : rgSCHDbmGetRnti::rntiLnk->rnti %u\n",rntiLnk->rnti);
- return (rntiLnk);
-} /* rgSCHDbmGetRnti */
-
-/**
- * @brief Handler for releasing the RNTI.
- *
- * @details
- *
- * Function : rgSCHDbmRlsRnti
- *
- *
- * @param[in] *cellCb
- * @param[in] rntiLnk
- * @return Void
- **/
-Void rgSCHDbmRlsRnti(RgSchCellCb *cellCb,RgSchRntiLnk *rntiLnk)
-{
-#ifdef EMTC_ENABLE
- if(ROK==rgSCHDbmPutEmtcRnti(cellCb,rntiLnk))
-{
-return;
-}
-#endif
- rntiLnk->nxt = NULLP;
- if (cellCb->rntiDb.lastRnti)
- {
- cellCb->rntiDb.lastRnti->nxt = rntiLnk;
- rntiLnk->prv = cellCb->rntiDb.lastRnti;
- }
- else
- {
- rntiLnk->prv = NULLP;
- cellCb->rntiDb.freeRnti = rntiLnk;
- }
- cellCb->rntiDb.lastRnti = rntiLnk;
-
- cellCb->rntiDb.count++;
-
- /* Stack Crash problems for TRACE5 Changes. Added the return below */
- return;
-
-} /* rgSCHDbmRlsRnti */
-
-#ifdef LTE_TDD
-/**
- * @brief Handler for initializing the ueTfuPendLst under the cellCb.
- *
- * @details
- *
- * Function : rgSCHDbmInitUeTfuPendLst
- *
- *
- * @param[in] *cellCb
- * @param[in] numBins
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHDbmInitUeTfuPendLst(RgSchCellCb *cellCb,uint16_t numBins)
-{
- RgSchUePucchRecpInfo pucchInfo;
-
- /* Fix: syed It is better to compute offset dynamically
- * rather than hardcoding it as 0 */
- if(cmHashListInit(&cellCb->ueTfuPendLst, numBins, (uint16_t)((PTR)&(pucchInfo.hashLstEnt) - (PTR)&pucchInfo), FALSE,
- CM_HASH_KEYTYPE_CONID,
- rgSchCb[cellCb->instIdx].rgSchInit.region,
- rgSchCb[cellCb->instIdx].rgSchInit.pool) != ROK)
- {
- return RFAILED;
- }
-
- return ROK;
-
-} /* rgSCHDbmInitUeTfuPendLst */
-
-/**
- * @brief Handler for de-initializing the ueTfuPendLst under the cellCb.
- *
- * @details
- *
- * Function : rgSCHDbmDeInitUeTfuPendLst
- *
- *
- * @param[in] *cellCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHDbmDeInitUeTfuPendLst(RgSchCellCb *cellCb)
-{
-
- cmHashListDeinit(&cellCb->ueTfuPendLst);
-
- return ROK;
-} /* rgSCHDbmDeInitUeTfuPendLst */
-#endif
-
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Entry point fucntions
-
- File: rg_sch_dhm.c
-
-**********************************************************************/
-
-/** @file rg_sch_dhm.c
-@brief APIs related to Downlink HARQ for the scheduler.
-*/
-
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "lrg.h"
-#include "rgr.h"
-#include "rgm.h"
-#include "tfu.h"
-#include "rg_env.h"
-#include "rg_sch_err.h"
-#include "rg_sch_inf.h" /* typedefs for Scheduler */
-#include "rg_sch.h"
-#include "rg_sch_cmn.h"
-
-/* header/extern include files (.x) */
-#include "lrg.x"
-#include "rgr.x"
-#include "rgm.x"
-#include "tfu.x"
-#include "rg_sch_inf.x" /* typedefs for Scheduler */
-#include "rg_sch.x"
-#include "rg_sch_cmn.x"
-
-#ifdef RGSCH_SPS_STATS
-uint32_t rgNumSPSSchedDropMaxRetx;
-uint32_t rgNumActDtx;
-#endif
-uint32_t nackSf[10];
-
-
-
-#ifdef MAC_SCH_STATS
-RgSchNackAckStats hqFailStats;
-RgSchHqRetxStats hqRetxStats;
-#endif /* MAC_SCH_STATS */
-//Chandan Stats Collection
-#ifdef DLHQ_STATS
-uint32_t statsCnt;
-RgSchDlHqStats dlHqStats[10000] = {{0,0,0}};
-#endif
-
-#ifdef TFU_TDD
-/* For special bundling case: convert numOfAcks to ACK/NACK
- * The below table derives the HARQ aknowledgement as ACK or NACK using the
- * number of transmission done and the feedback value received
- * The below table is based on Table 7.3-X from 36.213 and
- * table 79 from FAPIv1.1 doc
- */
-uint8_t rgSchNumOfAcksToAckNack[RG_SCH_MAX_NUM_EXPECTED_ACKS][RG_SCH_NUM_FDBK_VALUE] = {
-{TFU_HQFDB_ACK, TFU_HQFDB_NACK, TFU_HQFDB_NACK},
-{TFU_HQFDB_NACK, TFU_HQFDB_ACK, TFU_HQFDB_NACK},
-{TFU_HQFDB_NACK, TFU_HQFDB_NACK, TFU_HQFDB_ACK},
-{TFU_HQFDB_ACK, TFU_HQFDB_NACK, TFU_HQFDB_NACK},
-{TFU_HQFDB_NACK, TFU_HQFDB_ACK, TFU_HQFDB_NACK},
-{TFU_HQFDB_NACK, TFU_HQFDB_NACK, TFU_HQFDB_ACK},
-{TFU_HQFDB_ACK, TFU_HQFDB_NACK, TFU_HQFDB_NACK},
-{TFU_HQFDB_NACK, TFU_HQFDB_ACK, TFU_HQFDB_NACK},
-{TFU_HQFDB_NACK, TFU_HQFDB_NACK, TFU_HQFDB_ACK}
-};
-#endif
-
-/* local typedefs */
-
-/* local externs */
-
-static Void rgSCHDhmFdbkIndHndlTa ARGS((RgSchDlHqProcCb *hqP, uint8_t tbIdx, uint8_t fdbk,
- Bool maxHqRetxReached));
-void rgEmtcsetNullSubFrm ARGS((RgSchDlHqProcCb *hqP));
-#ifndef LTE_TDD
-static S16 rgSCHDhmProcHqFdbkAckNackRep ARGS((
-RgSchDlHqProcCb *hqP,
-RgSchDlSf *sf,
-uint8_t tbCnt,
-uint8_t *isAck
-));
-#endif
-#ifdef DL_LA
-static S16 rgSCHDhmUpdateAckNackHistory ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ueCb,
- uint8_t hqfdbk,
- uint8_t tbCnt
- ));
-#endif
-#ifdef LTE_TDD
-static Void rgSCHDhmPrcSplBundlFdbk ARGS((
- RgSchCellCb *cell,
- TfuHqInfo *fdbk,
- uint8_t hqCnt
- ));
-#ifdef LTE_ADV
-static Void rgSchGetHqFdbkPosForM1 ARGS((
- RgSchUeCb *ue,
- RgSchDlHqProcCb *hqP,
- uint8_t *isAck,
- RgTfuHqInfo *fdbk,
- uint8_t tbIdx,
- RgSchTddANInfo *anInfo
- ));
-static Void rgSchGetHqFdbkPosForM234 ARGS((
- RgSchUeCb *ue,
- RgSchDlHqProcCb *hqP,
- uint8_t *isAck,
- RgTfuHqInfo *fdbk,
- uint8_t tbIdx,
- RgSchTddANInfo *anInfo,
- uint8_t M,
- CmLteTimingInfo timeInfo
- ));
-#endif/*LTE_ADV*/
-#endif/*LTE_TDD*/
-
-/* Freeing up the HARQ proc blocked for
- * indefinite time in case of Retx */
-S16 rgSCHDhmDlRetxAllocFail ARGS((
-RgSchUeCb *ue,
-RgSchDlHqProcCb *proc
-));
-
-#ifdef EMTC_ENABLE
-S16 rgSCHDhmEmtcRgrCellCfg ARGS((
-RgSchCellCb *cell
-));
-#endif
-
-#ifdef CA_DBG
-uint32_t gPCellTb1AckCount,gPCellTb2AckCount,gPCellTb1NackCount,gPCellTb2NackCount;
-uint32_t gSCellSchedCount,gPrimarySchedCount;
-uint32_t gSCellTb1AckCount,gSCellTb2AckCount,gSCellTb1NackCount,gSCellTb2NackCount;
-uint32_t gPCellTb1DtxCount, gPCellTb2DtxCount, gSCellTb1DtxCount, gSCellTb2DtxCount;
-uint32_t gHqFdbkCount;
-
-#endif
-#ifdef EMTC_ENABLE
-Void rgSCHEmtcUtlDlHqPTbRmvFrmTx
-(
-RgSchEmtcDlSf *subFrm,
-RgSchDlHqProcCb *hqP,
-uint8_t tbIdx,
-Bool isRepeting
-);
-RgSchEmtcDlSf* rgSCHEmtcUtlSubFrmGet
-(
-RgSchCellCb *cell,
-CmLteTimingInfo frm
-);
-Void rgSCHEmtcHqInfoAlloc ARGS((RgSchCellCb *cell, RgSchDlHqProcCb *hqP));
-#endif
-/* forward references */
-
-/**
- * @brief This function initializes the DL HARQ Entity of UE.
- *
- * @details
- *
- * Function: rgSCHDhmHqEntInit
- * Purpose: This function initializes the DL HARQ entity of
- * UE control block. This is performed at the time
- * of creating UE control block.
- *
- * Invoked by: configuration module
- *
- * @param[in] RgSchCellCb* cell
- * @return RgSchDlHqEnt *
- *
- **/
-/*MS_WORKAROUND for ccpu00122893*/
-Void rgSCHDhmHqEntReset(RgSchDlHqEnt *hqE)
-{
- RgSchDlHqProcCb *hqP;
- uint8_t i;
- cmLListInit(&hqE->inUse);
- cmLListInit(&hqE->free);
- for (i=0; i < hqE->numHqPrcs; i++)
- {
- hqP = &hqE->procs[i];
- hqP->hqE = hqE;
- hqP->procId = i;
- /* Fix - reset numLch */
- hqP->tbInfo[0].numLch = 0;
- hqP->tbInfo[1].numLch = 0;
- hqP->tbInfo[0].txCntr = 0;
- hqP->tbInfo[0].ndi = 0; /* Initialize the NDI to Zero */
- hqP->tbInfo[1].txCntr = 0;
- hqP->tbInfo[1].ndi = 0; /* Initialize the NDI to Zero */
- hqP->tbInfo[0].tbIdx = 0;
- hqP->tbInfo[1].tbIdx = 1;
- hqP->tbInfo[0].hqP = hqP;
- hqP->tbInfo[1].hqP = hqP;
- hqP->tbInfo[0].state = HQ_TB_ACKED;
- hqP->tbInfo[1].state = HQ_TB_ACKED;
- hqP->tbInfo[0].contResCe = NOTPRSNT;
- hqP->tbInfo[1].contResCe = NOTPRSNT;
- hqP->lnk.node = (PTR)hqP;
- //cmLListAdd2Tail(&hqE->free, &hqP->lnk);
- hqP->hqPLst = NULLP;
- rgSCHDhmHqPAdd2FreeLst(hqP);
- hqP->tbInfo[0].lchSchdData = hqP->tbInfo[0].lchSchdDataArr;
- hqP->tbInfo[1].lchSchdData = hqP->tbInfo[1].lchSchdDataArr;
- hqP->drxCb.rttIndx = DRX_INVALID;
- hqP->drxCb.reTxIndx = DRX_INVALID;
- hqP->tbInfo[0].cntrRetxAllocFail = 0;
- hqP->tbInfo[1].cntrRetxAllocFail = 0;
- hqP->hasDcch = FALSE;
- hqP->cwSwpEnabled = FALSE;
- hqP->pdcch = NULLP;
- hqP->subFrm = NULLP;
-
-#ifdef LTE_ADV
- rgSCHLaaResetDlHqProcCb(hqP);
-#endif
- }
- return;
-} /* rgSCHDhmHqEntReset */
-
-/**
- * @brief This function assigns dlHqEnt of raCb to ueCb.
- *
- * @details
- *
- * Function: rgSCHDhmAssgnUeHqEntFrmRaCb
- * Purpose: This function assigns dlHqEnt of raCb to ueCb.
- *
- * Invoked by: configuration module
- *
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchRaCb *raCb
- * @return Void
- *
- **/
-Void rgSCHDhmAssgnUeHqEntFrmRaCb(RgSchUeCb *ue,RgSchRaCb *raCb)
-{
-
- ue->cellInfo[0]->hqEnt = raCb->dlHqE;
- ue->cellInfo[0]->hqEnt->ue = ue;
- /* Update the DL Harq related information */
- ue->cellInfo[0]->hqEnt->maxHqTx = ue->cell->dlHqCfg.maxDlHqTx;
- raCb->dlHqE = NULLP;
- /* Fix : set UE active in DL as UE initialization completed */
- ue->dl.dlInactvMask &= ~(RG_HQENT_INACTIVE);
- ue->ul.ulInactvMask &= ~(RG_HQENT_INACTIVE);
- rgSCHCmnDlInitHqEnt(ue->cell, ue->cellInfo[0]->hqEnt);
-
- return;
-}
-
-/**
- * @brief This function deletes the dlHqEnt.
- *
- * @details
- *
- * Function: rgSCHDhmDelHqEnt
- * Purpose: This function deletes the dlHqEnt.
- *
- * Invoked by: configuration module
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlHqEnt **hqE
- * @return Void
- *
- **/
-Void rgSCHDhmDelHqEnt(RgSchCellCb *cell,RgSchDlHqEnt **hqE)
-{
-
- if (!(*hqE))
- {
- return;
- }
-
- rgSCHCmnDlDeInitHqEnt(cell, *hqE);
-
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)hqE,
- sizeof(RgSchDlHqEnt));
-
- return;
-}
-
-RgSchDlHqEnt *rgSCHDhmHqEntInit(RgSchCellCb *cell)
-{
- RgSchDlHqEnt *hqE;
- Inst inst = cell->instIdx;
-
- /* Init the HARQ data structure */
- if (rgSCHUtlAllocSBuf(inst, (Data **)&hqE, sizeof(RgSchDlHqEnt)) != ROK)
- {
- DU_LOG("\nERROR --> SCH: rgSCHDhmHqEntInit hqE alloc fail");
- return (NULLP);
- }
-#ifdef LTE_TDD
- /* Init the HARQ processes */
- hqE->numHqPrcs = rgSchTddDlNumHarqProcTbl[cell->ulDlCfgIdx];
- if (rgSCHUtlAllocSBuf(inst, (Data **)&hqE->procs,
- hqE->numHqPrcs * sizeof(RgSchDlHqProcCb)) != ROK)
- {
- DU_LOG("\nERROR --> SCH: rgSCHDhmHqEntInit hqP alloc fail in hqE");
- return (NULLP);
- }
-#else
- hqE->numHqPrcs = RGSCH_NUM_DL_HQ_PROC;
-#endif
-
-#ifdef LTE_ADV
- rgSCHLaaInitDlHqProcCb (cell, hqE);
-#endif
-
- /* Initialize maximum tranmission counter */
- hqE->maxHqTx = cell->dlHqCfg.maxDlHqTx;
-
-
- /* MW_WORKAROUND for ccpu00122893 */
- rgSCHDhmHqEntReset(hqE);
- /* CA Dev Start*/
- hqE->cell = cell;
- /* CA Dev End*/
-
- return (hqE);
-} /* rgSCHDhmHqEntInit */
-
-/**
- * @brief This function gets an available HARQ process.
- *
- * @details
- *
- * Function: rgSCHDhmGetAvlHqProc
- * Purpose: This function returns an available HARQ process in
- * the DL direction. All HARQ processes are maintained
- * in queues of free and inuse.
- *
- * 1. Check if the free queue is empty. If yes, return
- * RFAILED
- * 2. If not empty, update the proc variable with the
- * first process in the queue. Return ROK.
- *
- * Invoked by: scheduler
- *
- * @param[in] RgSchUeCb *ue
- * @param[in] CmLteTimingInfo timingInfo
- * @param[out] RgSchDlHqProc **hqP
- * @return S16
- * -#ROK if successful
- * -#RFAILED otherwise
- *
- **/
-S16 rgSCHDhmGetAvlHqProc(RgSchCellCb *cell,RgSchUeCb *ue,CmLteTimingInfo timingInfo,RgSchDlHqProcCb **hqP)
-{
- RgSchDlHqEnt *hqE = NULLP;
- RgSchDlHqProcCb *tmpHqProc;
- CmLList *tmp;
-
- hqE = RG_SCH_CMN_GET_UE_HQE(ue, cell);
-
- if (hqE == NULLP)
- {
- DU_LOG("\nERROR --> SCH : rgSCHDhmGetAvlHqProc hqE NULL ue %d"
- , ue->ueId);
- return RFAILED;
- }
-
-
- CM_LLIST_FIRST_NODE(&(hqE->free), tmp);
-
- if (NULLP == tmp)
- {
- DU_LOG("\nERROR --> SCH : rgSCHDhmGetAvlHqProc free %d inUse %d ue %d"
- , hqE->free.count, hqE->inUse.count, ue->ueId);
- /* No Harq Process available in the free queue. */
- return RFAILED;
- }
-
- tmpHqProc = (RgSchDlHqProcCb *)(tmp->node);
-
-#ifdef LTEMAC_SPS
- /* If SPS HARQ procs are in use, do not use SPS harq procs for non-SPS
- * transmissions */
- if (ue->dl.isSpsHqPInUse)
- {
- while (tmpHqProc->procId < ue->dl.dlSpsCfg.numSpsHqProc)
- {
- CM_LLIST_NEXT_NODE(&(hqE->free), tmp);
- if (!tmp)
- {
- break;
- }
- tmpHqProc = (RgSchDlHqProcCb *)(tmp->node);
- }
- if (!tmp)
- {
- /* No Harq Process available in the free queue. */
- return RFAILED;
- }
- }
-#endif
-
-
- tmpHqProc->tbInfo[0].timingInfo = timingInfo;
- tmpHqProc->tbInfo[1].timingInfo = timingInfo;
- tmpHqProc->hasDcch = FALSE;
- tmpHqProc->cwSwpEnabled = FALSE;
-
- /* Remove the element from the free Queue */
- //cmLListDelFrm(&hqE->free, tmp);
- rgSCHDhmHqPDelFrmFreeLst(tmpHqProc);
-
- /* Add the element into the inUse Queue as well */
- //cmLListAdd2Tail(&hqE->inUse, &tmpHqProc->lnk);
- rgSCHDhmHqPAdd2InUseLst(tmpHqProc);
-
- *hqP = tmpHqProc;
-
-#ifdef LTE_ADV
- rgSCHLaaResetDlHqProcCb(tmpHqProc);
-#endif
-
- /* LAA DBG Only */
- tmpHqProc->tbSizeAtEstimate[0] = 0;
- tmpHqProc->tbSizeAtEstimate[1] = 0;
- tmpHqProc->tbSizeAtFnlz[0] = 0;
- tmpHqProc->tbSizeAtFnlz[1] = 0;
- tmpHqProc->tbSizeOfMvdTb[0] = 0;
- tmpHqProc->tbSizeOfMvdTb[1] = 0;
- tmpHqProc->itbsAtEstimate[0] = 0;
- tmpHqProc->itbsAtEstimate[1] = 0;
- tmpHqProc->prbAtEstimate = 0;
-
- return ROK;
-} /* rgSCHDhmGetAvlHqProc */
-
-
-/**
- * @brief This function adds HARQ process for a given TB in to
- * the inuse queue upon retx.
- *
- * @details
- *
- * Function: rgSCHDhmHqTbRetx
- * Purpose: This function handles when a HARQ process is scheduled
- * for retransmission. It adds the HARQ procss to inuse
- * queue.
- * 1. Check if this HqP is already added to the inUse
- * queue as part of this function call for other
- * TB's retransmission.
- * 2. If already present in inUse Q then do not add.
- *
- * Invoked by: scheduler
- *
- * @param[in] RgSchDlHqEnt *hqE
- * @param[in] CmLteTimingInfo timingInfo
- * @param[out] RgDlHqProc *hqP
- * @param[in] uint8_t tbIdx
- * @return Void
- *
- **/
-Void rgSCHDhmHqTbRetx(RgSchDlHqEnt *hqE,CmLteTimingInfo timingInfo,RgSchDlHqProcCb *hqP,uint8_t tbIdx)
-{
- uint8_t othrTbIdx = tbIdx ^ 1;
-
- hqP->tbInfo[tbIdx].timingInfo = timingInfo;
-
- if (hqE->msg4Proc == hqP)
- {
- return;
- }
- /* fix for ccpu00118633 No Hq proc Avl end*/
-
- /* Extra:check if Harq process is already linked to in-use
- Queue by means of other TB handling. */
- if (hqP->tbInfo[othrTbIdx].state != HQ_TB_WAITING)
- {
- /*Fix FIXME */
- if (hqE->msg4Proc != hqP)
- {
- //cmLListAdd2Tail(&hqE->inUse, &hqP->lnk);
- rgSCHDhmHqPAdd2InUseLst(hqP);
- }
- }
-
- hqP->tbInfo[tbIdx].cntrRetxAllocFail = 0;
-
- return;
-} /* rgSCHDhmHqTbRetx */
-
-/**
- * @brief This function returns last scheduled HARQ process for
- * a UE's HARQ entity.
- *
- * @details
- *
- * Function: rgSCHDhmLastSchedHqProc
- * Purpose: This function returns the last (most recent)
- * process in the inUse list, which corresponds
- * to the last scheduled process. Returns NULLP
- * if list is empty.
- * The reason for introducing this is to have
- * an ability to check if UE was scheduled
- * in the current subframe (scheduling would
- * have caused a proc to be added to the end
- * of the list, and checking time (only subframe
- * number probably works) would confirm this.
- *
- * Invoked by: scheduler
- *
- * @param[in] RgSchDlHqEnt *hqE
- * @return RgSchDlHqProcCb *
- *
- **/
-RgSchDlHqProcCb * rgSCHDhmLastSchedHqProc(RgSchDlHqEnt *hqE)
-{
- /* GRPPWR_CNTRL Fix: UE context will not hold a valid hqE,
- * until RACH procedure is completed */
- if ((hqE == NULLP) || (hqE->inUse.last == NULLP))
- {
- return (NULLP);
- }
- return ((RgSchDlHqProcCb *)hqE->inUse.last->node);
-} /* rgSCHDhmLastSchedHqProc */
-
-#ifdef RGR_V1
-/**
- * @brief This function gets an available HARQ process for MSG 4.
- *
- * @details
- *
- * Function: rgSCHDhmGetCcchSduHqProc
- * Purpose: This function returns an available HARQ process in
- * the DL direction. All HARQ processes are maintained
- * in queues of free and inuse.
- *
- * 1. Check if the free queue is empty. If yes, return
- * RFAILED.
- * 2. If not empty, update the proc variable with the
- * first process in the queue. Return ROK.
- *
- * Invoked by: scheduler
- *
- * @param[in] RgSchRaCb *raCb
- * @param[in] CmLteTimingInfo timingInfo
- * @param[out] RgSchDlHqProcCb **hqP
- * @return S16
- * -#ROK if successful
- * -#RFAILED otherwise
- *
- **/
-S16 rgSCHDhmGetCcchSduHqProc
-(
-RgSchUeCb *ueCb,
-CmLteTimingInfo timingInfo,
-RgSchDlHqProcCb **hqP
-)
-{
- RgSchDlHqProcCb *tmpHqProc;
- CmLList *tmp;
- RgSchDlHqEnt *hqE;
-
- hqE = ueCb->cellInfo[0]->hqEnt;
- CM_LLIST_FIRST_NODE(&(hqE->free), tmp);
- if (NULLP == tmp)
- {
- /* No Harq Process available in the free queue. */
- return RFAILED;
- }
-
- /* Remove the element from the free Queue and */
- /* set the MSG 4 HARQ proc pointer */
- //cmLListDelFrm(&hqE->free, tmp);
-
- tmpHqProc = (RgSchDlHqProcCb *)(tmp->node);
-
- rgSCHDhmHqPDelFrmFreeLst(tmpHqProc);
-
- tmpHqProc->tbInfo[0].timingInfo = timingInfo;
- /* Fix : syed minor code reorg */
- *hqP = tmpHqProc;
- /*Updating ccchSduProc to identify feedback for CCCH SDU sent without
- * Cont Res CE*/
- hqE->ccchSduProc = tmpHqProc;
- //cmLListAdd2Tail(&hqE->inUse, &tmpHqProc->lnk);
- rgSCHDhmHqPAdd2InUseLst(tmpHqProc);
-
- return ROK;
-} /* rgSCHDhmGetCcchSduHqProc */
-#endif
-
-/**
- * @brief This function gets an available HARQ process for MSG 4.
- *
- * @details
- *
- * Function: rgSCHDhmGetMsg4HqProc
- * Purpose: This function returns an available HARQ process in
- * the DL direction. All HARQ processes are maintained
- * in queues of free and inuse.
- *
- * 1. Check if the free queue is empty. If yes, return
- * RFAILED.
- * 2. If not empty, update the proc variable with the
- * first process in the queue. Return ROK.
- *
- * Invoked by: scheduler
- *
- * @param[in] RgSchRaCb *raCb
- * @param[in] CmLteTimingInfo timingInfo
- * @param[out] RgDlHqProc **hqP
- * @return S16
- * -#ROK if successful
- * -#RFAILED otherwise
- *
- **/
-S16 rgSCHDhmGetMsg4HqProc(RgSchRaCb *raCb,CmLteTimingInfo timingInfo)
-{
- RgSchDlHqProcCb *tmpHqProc;
- CmLList *tmp;
- RgSchDlHqEnt *hqE;
-
- hqE = raCb->dlHqE;
- CM_LLIST_FIRST_NODE(&(hqE->free), tmp);
- if (NULLP == tmp)
- {
- /* No Harq Process available in the free queue. */
- return RFAILED;
- }
-
- /* Remove the element from the free Queue and */
- /* set the MSG 4 HARQ proc pointer */
- //cmLListDelFrm(&hqE->free, tmp);
- tmpHqProc = (RgSchDlHqProcCb *)(tmp->node);
- rgSCHDhmHqPDelFrmFreeLst(tmpHqProc);
- tmpHqProc->tbInfo[0].timingInfo = timingInfo;
- hqE->msg4Proc = tmpHqProc;
-
- return ROK;
-} /* rgSCHDhmGetMsg4HqProc */
-
-/**
- * @brief This function releases a HARQ process.
- *
- * @details
- *
- * Function: rgSCHDhmRlsHqpTb
- * Purpose: This function resets the TB specific fields
- * Based on the other TBs state, this HqProcess
- * is returned to the HqEnt.
- *
- * 1. Add the HARQ process to the free queue.
- * Invoked by: scheduler and HARQ processing
- *
- * @param[in] RgDlHqProc *hqP
- * @param[in] uint8_t tbIdx
- * @param[in] Bool togNdi
- * @return Void
- *
- **/
-Void rgSCHDhmRlsHqpTb(RgSchDlHqProcCb *hqP,uint8_t tbIdx,Bool togNdi)
-{
- RgSchDlHqEnt *hqE;
- uint8_t othrTbIdx = tbIdx ^ 1;
-#ifdef LTEMAC_SPS
- RgSchCmnDlHqProc *cmnHqDl;
-#endif
- /* L2_COUNTERS */
-#ifdef LTE_L2_MEAS
- RgSchDlLcCb* lcCb = NULLP;
- uint8_t numLch = 0;
-#endif
-
- /* Reset all tbInfo values */
-
- hqE = hqP->hqE;
-
-#ifdef MAC_SCH_STATS
- if (hqP->hqE->ue != NULLP)
- {
- RgSchUeCb *ueCb = hqP->hqE->ue;
- RgSchCmnUe *cmnUe = (RgSchCmnUe*)ueCb->sch;
- RgSchCmnDlUe *dlUe = RG_SCH_CMN_GET_DL_UE(ueCb,hqE->cell);/*CA dev*/
- uint8_t cqi = dlUe->mimoInfo.cwInfo[0].cqi;
- /* to get retransmission, decreasing transmission counter */
- uint16_t numDlRetx = hqP->tbInfo[0].txCntr-1;
- uint8_t tbs = dlUe->mimoInfo.cwInfo[0].iTbs[0];
- static uint32_t retxCnt1 = 0;
-
- RG_SCH_CMN_DL_TBS_TO_MCS(tbs, \
- hqRetxStats.dlCqiStat[(cqi - 1)].mcs);
-
- switch (numDlRetx)
- {
- case 1:
- hqRetxStats.dlCqiStat[(cqi - 1)].numOfHQ_1++;
- break;
- case 2:
- hqRetxStats.dlCqiStat[(cqi - 1)].numOfHQ_2++;
- break;
- case 3:
- hqRetxStats.dlCqiStat[(cqi - 1)].numOfHQ_3++;
- break;
- case 4:
- hqRetxStats.dlCqiStat[(cqi - 1)].numOfHQ_4++;
- break;
- }
- hqRetxStats.dlCqiStat[(cqi - 1)].totalTx = \
- hqRetxStats.dlCqiStat[(cqi - 1)].numOfHQ_1 + \
- (hqRetxStats.dlCqiStat[(cqi - 1)].numOfHQ_2 * 2) + \
- (hqRetxStats.dlCqiStat[(cqi - 1)].numOfHQ_3 * 3) + \
- (hqRetxStats.dlCqiStat[(cqi - 1)].numOfHQ_4 * 4);
-
- retxCnt1 += numDlRetx;
- }
-#endif /* MAC_SCH_STATS */
- RGSCH_ARRAY_BOUND_CHECK(0, hqP->tbInfo, tbIdx);
- /* Toggle ndi */
- if(togNdi == TRUE)
- {
- hqP->tbInfo[tbIdx].ndi ^= 1;
- }
-
- /* L2_COUNTERS */
-#ifdef LTE_L2_MEAS
- for (numLch =0; numLch < hqP->tbInfo[tbIdx].numLch; numLch++)
- {
- if (NULLP != (lcCb = rgSCHDbmGetDlDedLcCb( hqP->hqE->ue,
- hqP->tbInfo[tbIdx].lchSchdDataArr[numLch].lcId)))
- {
- if (lcCb->lcType == CM_LTE_LCH_DTCH)
- {
- if (hqP->hqE->ue->qciActiveLCs[lcCb->qciCb->qci])
- {
- hqP->hqE->ue->qciActiveLCs[lcCb->qciCb->qci]--;
- }
-
- if (!(hqP->hqE->ue->qciActiveLCs[lcCb->qciCb->qci]))
- {
- lcCb->qciCb->dlUeCount--;
- }
- }
- }
- }
-#endif
-
- /* Initialization */
- hqP->tbInfo[tbIdx].tbSz = 0;
- hqP->tbInfo[tbIdx].numLch = 0;
- hqP->tbInfo[tbIdx].txCntr = 0;
- /* FOR ACK NACK REP */
- hqP->tbInfo[tbIdx].fbkRepCntr = 0;
- hqP->tbInfo[tbIdx].fbkRecpRepCntr = 0;
- hqP->tbInfo[tbIdx].ackCount = 0;
- /* pdcch is moved from TbCb to HqCb.
- This pdcch will be set to NULL when
- HqCb will be pushed to free list*/
- hqP->tbInfo[tbIdx].state = HQ_TB_ACKED;
- hqP->tbInfo[tbIdx].isAckNackDtx = 0;
- hqP->tbInfo[tbIdx].nackCount = 0;
- hqP->tbInfo[tbIdx].dtxCount = 0;
- hqP->tbInfo[tbIdx].schdTa.pres = NOTPRSNT;
- hqP->tbInfo[tbIdx].contResCe = NOTPRSNT;
-#ifdef LTE_ADV
- hqP->tbInfo[tbIdx].schdSCellActCe.pres = NOTPRSNT;
-#endif
- hqP->tbInfo[tbIdx].minRlcReordrTmr = 0;
- /* Handling msg4 hqProc */
- if (hqE->msg4Proc == hqP)
- {
- hqE->msg4Proc = NULLP;
- hqP->pdcch = NULLP;
- hqP->subFrm = NULLP;
- /* Add the proc to the free list */
- //cmLListAdd2Tail(&hqE->free, &hqP->lnk);
- rgSCHDhmHqPAdd2FreeLst(hqP);
- return;
- }
-#ifdef RGR_V1
- /* MS_WORKAROUND : syed The check (hqE->ccchSduProc != NULLP)
- * is dangerous and it expects ccchSduProc is the first
- * DL allocation for a UE, and considering a scenario
- * of multiple UEs contending and 1 UE per TTI, this
- * assumption can be wronged, leading to inUse list
- * corruption. Hence altering this check.
- * A better approach would be do avoid having this
- * special handling for ccchSduProc, streamline
- * it with the usual approach. */
- if (hqE->ccchSduProc == hqP)
- {
- hqE->ccchSduProc = NULLP;
- /* ccpu00137582- If hqP is in reTxLst then it will be no more available
- * in inUse list, Hence need not to delete from inUse list*/
- if(NULLP == hqP->tbInfo[tbIdx].ccchSchdInfo.retxLnk.node)
- {
- //cmLListDelFrm(&hqE->inUse, &hqP->lnk);
- rgSCHDhmHqPDelFrmInUseLst(hqP);
- }
- else
- {
- hqP->tbInfo[tbIdx].ccchSchdInfo.retxLnk.node = NULLP;
- }
- hqP->pdcch = NULLP;
- hqP->subFrm = NULLP;
- /* Add the proc to the free list */
- //cmLListAdd2Tail(&hqE->free, &hqP->lnk);
- rgSCHDhmHqPAdd2FreeLst(hqP);
- return;
- }
-#endif
-
- /* extra:check if other TB is also free for allocation then
- * add it to FREE List */
- switch(hqP->tbInfo[othrTbIdx].state)
- {
- case HQ_TB_ACKED:
- /* Remove the element from the inUse Queue */
- /* Freeing up the HARQ proc blocked for
- * indefinite time in case of Retx */
- if (hqP->tbInfo[tbIdx].cntrRetxAllocFail != RG_SCH_MAX_RETX_ALLOC_FAIL)
- {
- //cmLListDelFrm(&hqE->inUse, &hqP->lnk);
- rgSCHDhmHqPDelFrmInUseLst(hqP);
- }
- hqP->pdcch = NULLP;
- hqP->subFrm = NULLP;
-#ifdef EMTC_ENABLE
-rgEmtcsetNullSubFrm(hqP);
-#endif
- /* Add the proc to the free list */
- //cmLListAdd2Tail(&hqE->free, &hqP->lnk);
- rgSCHDhmHqPAdd2FreeLst(hqP);
-#ifdef LAA_DBG
- if (hqE->free.count > 8)
- {
- int *p = NULL;
- printf("\nDEBUG --> SCH: Crashing invalid hq count after free \n");
- printf("\nDEBUG --> SCH: Crashing %d \n", *p);
- *p = 10;
- }
-#endif
-#ifdef LTEMAC_SPS
- cmnHqDl = RG_SCH_CMN_GET_DL_HQP(hqP);
- if (cmnHqDl)
- {
- cmnHqDl->spsAction = 0;
- cmnHqDl->isSpsActv = FALSE;
- cmnHqDl->isSpsSvcSchd = FALSE;
- }
-#endif
- break;
- case HQ_TB_NACKED:
- /* Remove the element from the inUse Queue */
- /* Freeing up the HARQ proc blocked for
- * indefinite time in case of Retx */
- if (hqP->tbInfo[othrTbIdx].cntrRetxAllocFail == 0)
- {
- //cmLListDelFrm(&hqE->inUse, &hqP->lnk);
- rgSCHDhmHqPDelFrmInUseLst(hqP);
- }
- break;
- case HQ_TB_WAITING:
- /* Do nothing */
- break;
- }
-
- hqP->tbInfo[tbIdx].cntrRetxAllocFail = 0;
-
- return;
-} /* rgSCHDhmRlsHqpTb */
-
-/**
- * @brief This function releases a HARQ process.
- *
- * @details
- *
- * Function: rgSCHDhmRlsHqProc
- * Purpose: This function returns a HARQ process to HARQ Entity
- * in the DL direction.
- *
- * 1. Add the HARQ process to the free queue.
- * Invoked by: scheduler and HARQ processing
- *
- * @param[in] RgDlHqProc *hqP
- * @return Void
- *
- **/
-Void rgSCHDhmRlsHqProc(RgSchDlHqProcCb *hqP)
-{
-
-
-#ifdef MAC_SCH_STATS
- /* THIS FUNCTION IS NOT CALLED */
- if (hqP->hqE->ue != NULLP)
- {
- RgSchUeCb *ueCb = hqP->hqE->ue;
- RgSchCmnUe *cmnUe = (RgSchCmnUe*)ueCb->sch;
- RgSchCmnDlUe *dlUe = RG_SCH_CMN_GET_DL_UE(ueCb,hqE->cell);/*CA dev*/
- uint8_t cqi = dlUe->mimoInfo.cwInfo[0].cqi;
- /* to get retransmission, decreasing transmission counter */
- uint16_t numDlRetx = hqP->tbInfo[0].txCntr-1;
- uint8_t tbs = dlUe->mimoInfo.cwInfo[0].iTbs[0];
-
- RG_SCH_CMN_DL_TBS_TO_MCS(tbs, hqRetxStats.dlCqiStat[(cqi - 1)].mcs);
-
- switch (numDlRetx)
- {
- case 1:
- hqRetxStats.dlCqiStat[(cqi - 1)].numOfHQ_1++;
- break;
- case 2:
- hqRetxStats.dlCqiStat[(cqi - 1)].numOfHQ_2++;
- break;
- case 3:
- hqRetxStats.dlCqiStat[(cqi - 1)].numOfHQ_3++;
- break;
- case 4:
- hqRetxStats.dlCqiStat[(cqi - 1)].numOfHQ_4++;
- break;
- }
- hqRetxStats.dlCqiStat[(cqi - 1)].totalTx = \
- hqRetxStats.dlCqiStat[(cqi - 1)].numOfHQ_1 + \
- (hqRetxStats.dlCqiStat[(cqi - 1)].numOfHQ_2 * 2) + \
- (hqRetxStats.dlCqiStat[(cqi - 1)].numOfHQ_3 * 3) + \
- (hqRetxStats.dlCqiStat[(cqi - 1)].numOfHQ_4 * 4);
- }
-#endif /* MAC_SCH_STATS */
- hqP->pdcch = NULLP;
- hqP->subFrm = NULLP;
-#ifdef EMTC_ENABLE
-rgEmtcsetNullSubFrm(hqP);
-#endif
- rgSCHDhmHqPDelFrmInUseLst(hqP);
- rgSCHDhmHqPAdd2FreeLst(hqP);
-#ifdef TFU_UPGRADE
- hqP->tbCnt = 0;
-#endif
-
- return;
-} /* rgSCHDhmRlsHqProc */
-
-#ifdef LTEMAC_SPS
-/**
- * @brief This function gets HARQ process with the given ID.
- *
- * @details
- *
- * Function: rgSCHDhmGetHqProcFrmId
- * Purpose: This function returns the HARQ process with the given ID.
- * Invoked by: ROM
- *
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t idx
- * @param[in] RgDlHqProc **hqP
- * @return S16
- * -# ROK if successful
- * -# RFAILED otherwise
- *
- **/
-S16 rgSCHDhmGetHqProcFrmId(RgSchCellCb *cell,RgSchUeCb *ue,uint8_t idx,RgSchDlHqProcCb **hqP)
-{
- RgSchDlHqEnt *hqE;
-
- hqE = RG_SCH_CMN_GET_UE_HQE(ue, cell);
- /* Pick the proc based on the index provided */
- *hqP = &(hqE->procs[idx]);
-
- return ROK;
-} /* rgSCHDhmGetHqProcFrmId */
-
-/**
- * @brief This function gets SPS HARQ process from the given time
- *
- * @details
- *
- * Function: rgSCHDhmSpsDlGetHqProc
- * Purpose: This function returns the SPS HARQ process for the given time
- *
- * @param[in] RgSchUeCb *ue
- * @param[in] CmLteTimingInfo timingInfo
- * @return RgSchDlHqProcCb control block
- *
- **/
-RgSchDlHqProcCb* rgSCHDhmSpsDlGetHqProc(RgSchCellCb *cell,RgSchUeCb *ue,CmLteTimingInfo timingInfo)
-{
- RgSchDlHqEnt *hqE;
- uint8_t idx;
- RgSchDlHqProcCb *hqProc = NULLP;
- CmLList *tmp = NULLP;
-
- hqE = RG_SCH_CMN_GET_UE_HQE(ue, cell);
-
- CM_LLIST_FIRST_NODE(&(hqE->free), tmp);
-
- if (NULLP == tmp)
- {
- /* No Harq Process available in the free queue. */
- return (NULLP);
- }
-
- idx = ((timingInfo.sfn * RGSCH_NUM_SUB_FRAMES_5G + timingInfo.slot)/
- ue->dl.dlSpsCfg.dlSpsPrdctyEnum) % ue->dl.dlSpsCfg.numSpsHqProc;
-
-
- hqProc = (RgSchDlHqProcCb *)(tmp->node);
-
- /* If the HARQ process is in the free list, retrieve the process */
- while (hqProc->procId != idx)
- {
- CM_LLIST_NEXT_NODE(&(hqE->free), tmp);
- if (!tmp)
- {
- break;
- }
- hqProc = (RgSchDlHqProcCb *)(tmp->node);
- }
-
- if (!tmp)
- {
- /* No Harq Process available in the free queue. */
- return (NULLP);
- }
-
- hqProc->tbInfo[0].timingInfo = timingInfo;
- hqProc->tbInfo[1].timingInfo = timingInfo;
-
- /* Remove the element from the free Queue */
- //cmLListDelFrm(&hqE->free, tmp);
- rgSCHDhmHqPDelFrmFreeLst(hqProc);
-
- /* Add the element into the inUse Queue as well */
- //cmLListAdd2Tail(&hqE->inUse, &hqProc->lnk);
- rgSCHDhmHqPAdd2InUseLst(hqProc);
-
-#ifdef LTE_ADV
- rgSCHLaaResetDlHqProcCb(hqProc);
-#endif
-
- return (hqProc);
-} /* rgSCHDhmSpsDlGetHqProc */
-#endif /* LTEMAC_SPS */
-
-
-/** * @brief Handler for handling TA.
- *
- * @details
- *
- * Function : rgSCHDhmFdbkIndHndlTa
- *
- * This function handles the TA state and values based on the
- * feedback indication received.
- *
- * @param[in] RgSchDlHqProcCb *hqP
- * @param[in] uint8_t tbIdx
- * @param[in] uint8_t fdbk
- * @return Void
- * -# None.
- **/
-static Void rgSCHDhmFdbkIndHndlTa(RgSchDlHqProcCb *hqP,uint8_t tbIdx,uint8_t fdbk,Bool maxHqRetxReached)
-{
- RgSchUeCb *ueCb;
- RgSchCellCb *cell;
-
- ueCb = hqP->hqE->ue;
- cell = ueCb->cell;
- switch(fdbk)
- {
- case TRUE:
- /*ccpu00130018 -ADD - To prevent duplicate insert into the TA list*/
- hqP->tbInfo[tbIdx].taSnt = FALSE;
- /* To prevent duplicate inserts of ueCb into TA list */
- if (ueCb->taLnk.node == NULLP)
- {
- ueCb->taLnk.node = (PTR)ueCb;
- cmLListAdd2Tail(&cell->taUeLst, &ueCb->taLnk);
- }
- else
- {
-#ifdef DEBUGP
- DU_LOG("\nERROR --> SCH : Trying to add CRNTI:%d into TA"
- "ACK List twice", ueCb->ueId);
-#endif
- }
- break;
-
- case FALSE:
- /* If Ta was sent and its the final NACK, then reset only the
- * taState to IDLE and not the value */
- /* Changed handling in case maxhqretx is reached for TA */
- if(TRUE == maxHqRetxReached)
- {
- hqP->tbInfo[tbIdx].taSnt = FALSE;
- hqP->hqE->ue->dl.taCb.state = RGSCH_TA_IDLE;
-
- rgSCHUtlReTxTa(cell, ueCb);
- DU_LOG("\nERROR --> SCH : Nack Rcvd for TA. Max Tries Attempted");
- }
- break;
- case TFU_HQFDB_DTX:
- /* If Ta was sent and its the final NACK, then reset only the
- * taState to IDLE and not the value */
- if(TRUE == maxHqRetxReached)
- {
- hqP->tbInfo[tbIdx].taSnt = FALSE;
- hqP->hqE->ue->dl.taCb.state = RGSCH_TA_IDLE;
-
- /*ccpu00131191 and ccpu00131317 - Fix for RRC Reconfig failure
- * issue for VoLTE call */
- rgSCHUtlDlTARpt(cell, ueCb);
- }
- break;
-
- default:
- break;
- }
-
- return;
-} /* rgSCHDhmFdbkIndHndlTa */
-
-/* 3.1 MIMO: TA cmd details at TB level rather than Hq Level */
-/** * @brief Handler for scheduling TA.
- *
- * @details
- *
- * Function : rgSCHDhmShcdTa
- *
- * This function is called by scheduler when resource allocation
- * for TA transmission is done.
- *
- * @param[in] RgSchUeCb *ue
- * @param[out] RgSchDlHqTbCb *tbInfo
- * @return Void
- * -# None.
- **/
-Void rgSCHDhmSchdTa(RgSchUeCb *ueCb,RgSchDlHqTbCb *tbInfo)
-{
-
- ueCb->dl.taCb.state = RGSCH_TA_SCHEDULED;
- ueCb->dl.taCb.numRemSf = 2;
- tbInfo->schdTa.pres = PRSNT_NODEF;
- tbInfo->schdTa.val = ueCb->dl.taCb.ta;
-
- return;
-} /* rgSCHDhmSchdTa */
-
-#ifdef LTE_TDD
-/** * @brief Handler for fetching Harq Proc given the feeback information.
- *
- * @details
- *
- * Function : rgSCHDhmHqProcByFdbkTime
- *
- * This function shall fetch all the harq proc having the feedback
- * timing information.
- *
- * @param[in] RgSchDlHqEnt *hqE
- * @param[in] CmLteTimingInfo timeInfo
- * @param[in] Bool *isMsg4
- * @param[out] RgSchDlHqProcCb **hqPrcs
- * @param[out] uint8_t *numTbs
- * @param[out] S8 *tbStrtIdx
- * @param[out] uint8_t *cntHqPrcs
- * @return S16
- **/
-static S16 rgSCHDhmHqProcByFdbkTime
-(
-RgSchDlHqEnt *hqE,
-CmLteTimingInfo timeInfo,
-Bool *isMsg4,
-RgSchDlHqProcCb **hqPrcs,
-uint8_t *numTbs,
-S8 *tbStrtIdx,
-uint8_t *cntHqPrcs,
-RgSchCellCb *cell
-)
-{
- RgSchDlHqTbCb *tbCb;
- RgSchDlHqProcCb *hqP;
- CmLteTimingInfo schdSfTime;
- RgSchTddDlAscSetIdxK ascIdx;
- uint8_t noFdbks;
- uint8_t i;
- uint8_t idx;
- uint8_t dlIdx;
- CmLListCp *lnk;
- CmLList *node;
-
- *cntHqPrcs = 0;
- if (hqE->msg4Proc)
- {
- if (RGSCH_TIMEINFO_SAME(hqE->msg4Proc->tbInfo[0].fdbkTime, timeInfo))
- {
- *isMsg4 = TRUE;
- hqPrcs[*cntHqPrcs] = hqE->msg4Proc;
- tbStrtIdx[*cntHqPrcs] = 0;
- numTbs[*cntHqPrcs] = 1;
- (*cntHqPrcs)++;
- return ROK;
- }
- }
- ascIdx = rgSchTddDlAscSetIdxKTbl[cell->ulDlCfgIdx][timeInfo.slot];
- noFdbks = ascIdx.numFdbkSubfrms;
-
- for(idx=0; idx<noFdbks; idx++)
- {
- /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper output
- * if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME() as it is
- * serving the purpose */
- RGSCHDECRFRMCRNTTIME(timeInfo,schdSfTime,ascIdx.subfrmNum[idx]);
- dlIdx = rgSCHUtlGetDlSfIdx(cell, &schdSfTime);
- lnk = &hqE->ue->dl.dlSfHqInfo[dlIdx].hqPLst;
- node = lnk->first;
- while (node)
- {
- hqP = (RgSchDlHqProcCb*)node->node;
- node = node->next;
-
- numTbs[*cntHqPrcs] = 0;
- tbStrtIdx[*cntHqPrcs] = -1;
- for (i = 0; i < 2; i++)
- {
- /* Extra:check which TB is waiting for feedback */
- if (hqP->tbInfo[i].state == HQ_TB_WAITING)
- {
- if (tbStrtIdx[*cntHqPrcs] == -1)
- {
- tbStrtIdx[*cntHqPrcs] = i;
- }
- numTbs[*cntHqPrcs]++;
- }
- }
- if (numTbs[*cntHqPrcs] > 0)
- {
- hqPrcs[*cntHqPrcs] = hqP;
- (*cntHqPrcs)++;
- }
- }
-
- /* AN REP Hq Procs */
- node = cell->subFrms[dlIdx]->ackNakRepQ.first;
- while(node)
- {
- tbCb = (RgSchDlHqTbCb *)(node->node);
- hqP = tbCb->hqP;
-
- numTbs[*cntHqPrcs] = 0;
- tbStrtIdx[*cntHqPrcs] = -1;
- for (i = 0; i < 2; i++)
- {
- /* Extra:check which TB is waiting for feedback */
- if (hqP->tbInfo[i].state == HQ_TB_WAITING)
- {
- if (tbStrtIdx[*cntHqPrcs] == -1)
- {
- tbStrtIdx[*cntHqPrcs] = i;
- }
- numTbs[*cntHqPrcs]++;
- }
- }
- if (numTbs[*cntHqPrcs] == 2)
- {
- node = node->next;
- }
- if (numTbs[*cntHqPrcs] > 0)
- {
- hqPrcs[*cntHqPrcs] = hqP;
- (*cntHqPrcs)++;
- }
-
- node = node->next;
- }
- }
-
-
- return ROK;
-}
-#else /* LTE_TDD */
-/** * @brief Handler for fetching Harq Proc given the timming information.
- *
- * @details
- *
- * Function : rgSCHDhmHqProcByTime
- *
- * This function shall fetch the harq proc using the timing information.
- *
- * @param[in] RgSchDlHqEnt *hqE
- * @param[in] CmLteTimingInfo timeInfo
- * @param[in] Bool *isMsg4
- * @param[out] uint8_t *numTbs
- * @param[out] S8 *tbStrtIdx
- * @return RgSchDlHqProcCb*
- * -# RgSchDlHqProcCb*
- * -# NULLP
- **/
-RgSchDlHqProcCb *rgSCHDhmHqProcByTime(RgSchDlHqEnt *hqE,CmLteTimingInfo timeInfo,Bool *isMsg4,RgSchDlSf *sf)
-{
- if (hqE->msg4Proc)
- {
- if (RGSCH_TIMEINFO_SAME(hqE->msg4Proc->tbInfo[0].timingInfo, timeInfo))
- {
- *isMsg4 = TRUE;
- return (hqE->msg4Proc);
- }
- }
-
- return (NULLP);
-}
-#endif
-
-/** * @brief Handler for handling the harq transaction failure.
- *
- * @details
- *
- * Function : rgSCHDhmHqTbTrnsFail
- *
- * This function handled the harq TB transaction failure :
- * - If retries have not reached maximum, add to the reTx Q.
- * - else do error recovery.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlHqProcCb *hqP
- * @param[in] uint8_t tbCnt
- * @param[out] Bool *isMaxRetx
- * @return Void
- * -#None.
- *
- **/
-Void rgSCHDhmHqTbTrnsFail(RgSchCellCb *cell,RgSchDlHqProcCb *hqP,uint8_t tbCnt,Bool *isMaxRetx)
-{
- RgSchDlHqEnt *hqE;
- uint8_t maxHqTx;
-
- hqE = hqP->hqE;
-
- /* Fetch the maximum number of harq transmissions */
- if (hqE->msg4Proc == hqP)
- {
-#ifdef RGR_V1
- if(hqP->hqE->raCb->expiryTime.sfn == RGSCH_CONTRES_EXP)
- {
- DU_LOG("\nDEBUG --> SCH : rgSCHDhmHqTbTrnsFail contRes exp(): tmpCRNTI = %u",
- hqP->hqE->raCb->tmpCrnti);
- rgSCHRamMsg4Done(cell, (RgSchRaCb *)hqP->hqE->raCb);
- return;
- }
-#endif
- maxHqTx = cell->dlHqCfg.maxMsg4HqTx;
- }
- else
- {
- maxHqTx = hqE->maxHqTx;
- }
-
-#ifdef MAC_SCH_STATS
- if (hqE->ue != NULLP)
- {
- RgSchUeCb *ueCb = hqE->ue;
- RgSchCmnUe *cmnUe = (RgSchCmnUe*)ueCb->sch;
- RgSchCmnDlUe *dlUe = RG_SCH_CMN_GET_DL_UE(ueCb,hqE->cell);/*CA dev*/
- uint8_t tbs = dlUe->mimoInfo.cwInfo[0].iTbs[0];
- static uint32_t retxCnt = 0;
-
- {
- ++retxCnt;
- hqFailStats.dlCqiStat[(dlUe->mimoInfo.cwInfo[0].cqi - 1)].numOfNacks++;
- }
- RG_SCH_CMN_DL_TBS_TO_MCS(tbs,
- (hqFailStats.dlCqiStat[(dlUe->mimoInfo.cwInfo[0].cqi - 1)].mcs));
- }
-#endif /* MAC_SCH_STATS */
-
- RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, hqP->tbInfo, tbCnt);
- /* Reset the PDCCH reference */
- hqP->pdcch = NULL;
- if (hqP->tbInfo[tbCnt].txCntr < maxHqTx)
- {
- hqP->tbInfo[tbCnt].state = HQ_TB_NACKED;
-
- if((hqE->ue != NULLP) && (hqE->ue->isDrxEnabled == TRUE))
- {
-
- /*If DRX is enabled for the UE, we need to start the HARQ RTT timer
- * for the UE. Addtion to the retransmission queue will be done on
- * HARQ RTT timer expiry.--*/
- switch(hqP->tbInfo[tbCnt ^ 1].state)
- {
- case HQ_TB_ACKED:
- /*As the first TB is ACKED we have not started HARQ RTT for the
- * HqP, so start it here.*/
- //cmLListDelFrm(&hqE->inUse, &hqP->lnk);
- rgSCHDhmHqPDelFrmInUseLst(hqP);
- /* CA Dev Start */
- rgSCHDrxStartHarqRTTTmr(hqP->hqE->ue->cell, hqP, tbCnt);
- /* CA Dev End*/
-#ifdef LTEMAC_SPS
- /* Integration fix */
- /* Setting cntrRetxAllocFail to MAX value here */
- /* Since the hqP entry is already deleted from inUse list of HqEntity
- setting the value here will ensure the entry is not deleted
- again during release harq proc */
- if ( (hqP->sch != (RgSchCmnDlHqProc *)NULLP) &&
- (RG_SCH_CMN_SPS_DL_IS_SPS_HQP(hqP)))
- {
- hqP->tbInfo[0].cntrRetxAllocFail = RG_SCH_MAX_RETX_ALLOC_FAIL;
- if (hqP->tbInfo[1].txCntr)
- {
- hqP->tbInfo[1].cntrRetxAllocFail = RG_SCH_MAX_RETX_ALLOC_FAIL;
- }
- }
-#endif
- break;
- case HQ_TB_NACKED:
- /*As the first TB is NACKED we have already started HARQ RTT for the
- * HqP, so dont start it here, just delete from in use queue.*/
- //cmLListDelFrm(&hqE->inUse, &hqP->lnk);
- rgSCHDhmHqPDelFrmInUseLst(hqP);
- break;
- case HQ_TB_WAITING:
- /*As this is the first TB to be fed back and is NACKED start
- * the HARQ RTT here.*/
- /* CA Dev Start */
- rgSCHDrxStartHarqRTTTmr(hqP->hqE->ue->cell, hqP,tbCnt);
- /* CA Dev End*/
- break;
- }
- return;
- }
- /* extra:check if already removed as part of other TB processing
- * then donot remove from InUse Q */
- /* Check if other TB is not waiting for feedback.
- * Makinf sure hqP is present in inUse Queue until
- * it is fedback for all its TBs */
- switch(hqP->tbInfo[tbCnt ^ 1].state)
- {
- case HQ_TB_ACKED:
- /*Fix for ccpu00113296 - Do not delete for Msg4 Harq Entities*/
- if(hqE->msg4Proc != hqP)
- {
- //cmLListDelFrm(&hqE->inUse, &hqP->lnk);
- rgSCHDhmHqPDelFrmInUseLst(hqP);
- }
- /* Retransmission needs to be done. Add to the scheduler Q */
- rgSCHUtlDlProcAddToRetx(hqP->hqE->cell, hqP);
- break;
- case HQ_TB_NACKED:
- /*Fix for ccpu00113296 - Do not delete for Msg4 Harq Entities*/
- if(hqE->msg4Proc != hqP)
- {
- //cmLListDelFrm(&hqE->inUse, &hqP->lnk);
- rgSCHDhmHqPDelFrmInUseLst(hqP);
- }
- break;
- case HQ_TB_WAITING:
- /* Retransmission needs to be done. Add to the scheduler Q */
- /* CA Dev Start*/
- rgSCHUtlDlProcAddToRetx(hqP->hqE->cell, hqP);
- /* CA Dev End*/
- break;
- }
- *isMaxRetx = FALSE;
- }
- else
- {
- /* Failure Notification */
- if (hqE->msg4Proc == hqP)
- {
- /* SR_RACH_STATS : MSG4 Max Retx Fail*/
- rgNumMsg4FailMaxRetx++;
-#ifdef TENB_STATS
- hqE->cell->tenbStats->sch.msg4Fail ++;
-#endif
-
- /* Perform RAM MSG4 done processing */
- DU_LOG("\nDEBUG --> SCH : rgSCHDhmHqTbTrnsFail(): hq max retx fail: tmpCRNTI = %u",
- hqP->hqE->raCb->tmpCrnti);
- rgSCHRamMsg4Done(cell, (RgSchRaCb *)hqP->hqE->raCb);
- }
- else
- {
- /* Release the Harq Proc */
- rgSCHDhmRlsHqpTb(hqP, tbCnt, TRUE);
- }
- *isMaxRetx = TRUE;
- }
-
- return;
-} /* rgSCHDhmHqTbTrnsFail */
-
-uint32_t rgHqRvStats[2][4][2] = {{{0, 0}, {0, 0}, {0, 0}, {0, 0}},
- {{0, 0}, {0, 0}, {0, 0}, {0, 0}}};
-#ifdef LTE_TDD
-#ifdef LTE_ADV
-/** * @brief Function to decode the position of HarqFb for M=1.
- *
- * @details
- *
- * Function : rgSchGetHqFdbkPosForM1
- *
- * @param[in] RgSchUeCb *ue,
- * @param[in] RgSchDlHqProcCb *hqP,
- * @param[in] uint8_t *isAck,
- * @param[in] RgTfuHqInfo *fdbk,
- * @param[in] uint8_t tbIdx,
- * @param[in] RgSchTddANInfo *anInfo;
- * @return void
- **/
-static Void rgSchGetHqFdbkPosForM1
-(
-RgSchUeCb *ue,
-RgSchDlHqProcCb *hqP,
-uint8_t *isAck,
-RgTfuHqInfo *fdbk,
-uint8_t tbIdx,
-RgSchTddANInfo *anInfo
-)
-{
- if((ue != NULLP))
- {
- /* handle pusch and pucch cases */
- /* PUSCH:: Fdbks are in the increasing order
- * of servCellIdx as per 36.212 section 5.2.26*/
- switch(ue->f1bCsAVal)
- {
- case RG_SCH_A_VAL_2:
- {
- if(RG_SCH_IS_CELL_SEC(ue,hqP->hqE->cell))
- {
- *isAck = fdbk->isAck[1];/*SCell*/
- }
- else
- {
- *isAck = fdbk->isAck[0];/*PCell*/
- }
- break;
- }
- case RG_SCH_A_VAL_3:
- {
- if(RG_SCH_IS_CELL_SEC(ue,hqP->hqE->cell))
- {
- uint8_t cellIdx = rgSchUtlGetServCellIdx(hqP->hqE->cell->instIdx,
- hqP->hqE->cell->cellId,
- hqP->hqE->ue);
-
- if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[cellIdx]->txMode.txModeEnum) > 1)
- {/*SCell - mimo mode*/
- if(TRUE == fdbk->isPusch)
- {
- *isAck = fdbk->isAck[tbIdx + 1];
- }
- else
- {
- *isAck = fdbk->isAck[tbIdx];
- }
- }
- else
- {/*SCell - siso mode*/
- *isAck = fdbk->isAck[2];
- }
- }else
- {
- if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
- {/*Primary Cell - mimo mode*/
- *isAck = fdbk->isAck[tbIdx];
- }
- else
- {/*Primary Cell - siso mode*/
- if((TRUE == fdbk->isPusch) && (FALSE == anInfo->isSpsOccasion))
- {
- /* If fdbk is on PUSCH but its not an SPS occasion*/
- *isAck = fdbk->isAck[0];
- }
- else
- {
- /* If fdbk is on PUCCH or its an SPS occasion*/
- *isAck = fdbk->isAck[2];
- }
- }
- }
- break;
- }
- case RG_SCH_A_VAL_4:
- {
- if(RG_SCH_IS_CELL_SEC(ue,hqP->hqE->cell))
- {
- *isAck = fdbk->isAck[tbIdx + 2];
- }
- else
- {
- *isAck = fdbk->isAck[tbIdx];
- }
- break;
- }
- default:
- break;
- }
- }
- return;
-}/* End of rgSchGetHqFdbkPosForM1 */
-
-/** * @brief Function to decode the position of HarqFb for M>=2 cases.
- *
- * @details
- *
- * Function : rgSchGetHqFdbkPosForM234
- *
- * @param[in] RgSchUeCb *ue,
- * @param[in] RgSchDlHqProcCb *hqP,
- * @param[in] uint8_t *isAck,
- * @param[in] RgTfuHqInfo *fdbk,
- * @param[in] uint8_t tbIdx,
- * @param[in] RgSchTddANInfo *anInfo;
- * @param[in] CmLteTimingInfo timeInfo;
- * @return void
- **/
-static Void rgSchGetHqFdbkPosForM234
-(
-RgSchUeCb *ue,
-RgSchDlHqProcCb *hqP,
-uint8_t *isAck,
-RgTfuHqInfo *fdbk,
-uint8_t tbIdx,
-RgSchTddANInfo *anInfo,
-uint8_t M,
-CmLteTimingInfo timeInfo
-)
-{
- uint8_t fdbkIdx;
- Bool isSCell;
- RgSchTddANInfo *pCellAnInfo;
- uint8_t incr = 0;
-
- if(NULLP != ue)
- {
- isSCell = RG_SCH_IS_CELL_SEC(ue,hqP->hqE->cell);
- pCellAnInfo = rgSCHUtlGetUeANFdbkInfo(ue, &timeInfo, RGSCH_PCELL_INDEX);
-
- if(TRUE == fdbk->isPusch)
- {
- if(TRUE == isSCell)
- {/*SCell*/
- if (anInfo->wUlDai == 3)
- {
- incr = anInfo->wUlDai;
- }
- else
- {
- incr = M;
- }
- if(1 == anInfo->ulDai)
- {
- fdbkIdx = (hqP->tbInfo[tbIdx].dai - 1) +
- hqP->tbInfo[tbIdx].tbIdx + incr;
- }
- else
- {
- fdbkIdx = (hqP->tbInfo[tbIdx].dai - 1) + incr;
- }
- }
- else
- {/*PCell*/
- if(1 == anInfo->ulDai)
- {
- if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
- {
- fdbkIdx = (hqP->tbInfo[tbIdx].dai - 1) + (hqP->tbInfo[tbIdx].tbIdx);
- }
- else
- {
- fdbkIdx = (hqP->tbInfo[tbIdx].dai) - 1;
- }
- }
- else
- {
- fdbkIdx = (hqP->tbInfo[tbIdx].dai) - 1;
- }
- }
- }
- else
- {/*PUCCH*/
- if(TRUE == isSCell)
- {
- /* pucchFdbkIdx is set to DAI hence -1 to get index */
- fdbkIdx = ((hqP->tbInfo[tbIdx].pucchFdbkIdx) + M -1);
- }
- else
- {
- if(M > 2)
- {
- /* SPS occasion feedback in case of M > 2 will
- * be always present in the index 0*/
-#ifdef LTEMAC_SPS
- if(hqP->spsN1PucchRes.pres == TRUE)
- {/* SPS occasion hq proc */
- fdbkIdx = 0;
- }else
-#endif
- if((NULLP != pCellAnInfo) &&
- (pCellAnInfo->dlDai != pCellAnInfo->ulDai))
- {
- fdbkIdx = hqP->tbInfo[tbIdx].pucchFdbkIdx;
- }else
- {/* NO SPS occasion was present in the bundle*/
- fdbkIdx = hqP->tbInfo[tbIdx].pucchFdbkIdx - 1;
- }
- }
- else
- {
- fdbkIdx = hqP->tbInfo[tbIdx].pucchFdbkIdx - 1;
- }
- }
- }
- *isAck = fdbk->isAck[fdbkIdx];
-#ifdef DLHQ_STATS
- static RgSchDlHqProcCb *temp = NULLP;
- if (temp != hqP->tbInfo[tbIdx].hqP)
- {
- statsCnt = statsCnt % 10000;
- dlHqStats[statsCnt].cellId = hqP->hqE->cell->cellId;
- dlHqStats[statsCnt].sfn = hqP->tbInfo[tbIdx].timingInfo.sfn;
- dlHqStats[statsCnt].sf = hqP->tbInfo[tbIdx].timingInfo.slot;
- dlHqStats[statsCnt].ack = *isAck;
- dlHqStats[statsCnt].fdbkIdx = fdbkIdx;
- dlHqStats[statsCnt].ue = hqP->hqE->ue->ueId;
- if (anInfo)
- dlHqStats[statsCnt].ulDai = incr;
- if(TRUE == fdbk->isPusch)
- {
- dlHqStats[statsCnt].dlDai = hqP->tbInfo[tbIdx].dai;
- }
- else
- {
- dlHqStats[statsCnt].dlDai = hqP->tbInfo[tbIdx].pucchFdbkIdx;
- }
- if (*isAck != 1)
- {
- dlHqStats[statsCnt].ack0 = fdbk->isAck[0];
- dlHqStats[statsCnt].ack1 = fdbk->isAck[1];
- dlHqStats[statsCnt].ack2 = fdbk->isAck[2];
- dlHqStats[statsCnt].ack3 = fdbk->isAck[3];
- dlHqStats[statsCnt].ack4 = fdbk->isAck[4];
- dlHqStats[statsCnt].ack5 = fdbk->isAck[5];
- dlHqStats[statsCnt].ack6 = fdbk->isAck[6];
- dlHqStats[statsCnt].ack7 = fdbk->isAck[7];
- }
- statsCnt++;
- temp = hqP->tbInfo[tbIdx].hqP;
- }
-#endif
- }/*ue*/
- return;
-}/*rgSchGetHqFdbkPosForM234*/
-#endif/*LTE_ADV*/
-
-/*
- * @brief Handler for HARQ feedback received for DL transmission.
- *
- * @details
- *
- * Function : rgSCHDhmHqFdbkInd
- *
- * This function shall act on the feedback received from TOM for DL
- * transmission. If the feedback for msg4 is final (after max transmissions
- * or ACK) inform RAM that Msg4 transmission is done.
- *
- *
- * @param[in] Void *cb
- * @param[in] uint8_t cbType
- * @param[in] RgSchCellCb cellCb
- * @param[in] CmLteTimingInfo timeInfo
- * @param[in] TfuHqInfo *fdbk
- * @param[in] RgInfRlsHqInfo *rlsHqBufs
- * @param[in] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHDhmHqFdbkInd
-(
-Void *cb,
-uint8_t cbType,
-RgSchCellCb *cellCb,
-CmLteTimingInfo timeInfo,
-TfuHqInfo *fdbk,
-RgInfRlsHqInfo *rlsHqBufs,
-RgSchErrInfo *err
-)
-{
- RgSchCellCb *sCell = NULLP;
- RgSchDlHqEnt *hqE;
- /*ccpu00127339 - MOD - change to avoid the crash*/
- RgSchUeCb *ue = NULLP;
- RgSchDlSf *sf;
- Bool isMsg4 = FALSE;
- RgSchRaCb *raCb = NULLP;
- uint16_t rnti=0;
- /* Maximum possible HARQ processes in UL-DL configuration 5 that is
- * given feedback at a time */
- RgSchDlHqProcCb *hqPrcs[(RGSCH_NUM_SUB_FRAMES-1)*5]; /*MAX 5 Cells*/
- uint8_t numTb[(RGSCH_NUM_SUB_FRAMES-1)*5];
- S8 tbStrtIdx[(RGSCH_NUM_SUB_FRAMES-1)*5];
- uint8_t hqCnt;
- uint8_t idx;
- RgSchTddANInfo *anInfo = NULLP;
- uint8_t isAck = 0;
- uint8_t tbCnt;
- RgrTddAckNackMode ackNackMode;
- Bool hqRls = FALSE;
- RgSchDlSf *nxtDlsf = NULLP;
- /* uint8_t rcvCnt = 0; */
- CmLteTimingInfo nxtfrm = {0,0};
- Bool anUpd = FALSE;
- Bool maxHqRetxReached;
-#ifdef LTEMAC_SPS
- Bool hasRelPdcch = FALSE;
-#endif
-
-#if ((defined LTEMAC_SPS_AN_MUX) || (defined LTE_ADV))
- RgSchTddDlAscSetIdxK ascIdx;
- uint8_t noFdbks;
-#endif
-
-#ifdef LTEMAC_SPS_AN_MUX
- Bool isPusch = FALSE;
- uint8_t tmpIdx;
- uint8_t hIdx;
- /* Subframes in which transmissions are scheduled and whose feedback can come
- * in this subframe. Used only for Multiplexing mode */
- CmLteTimingInfo schdSfTime[RGSCH_TDD_MAX_FDBK];
-#ifdef RGSCH_SPS_STATS
- RgSchCmnDlHqProc *cmnHqDl;
-#endif
-#endif
-#ifdef LTE_ADV
- uint8_t sCellActCePres = 0;
-#endif
-/* LTEMAC_SPS_AN_MUX*/
- RgrSchFrmt1b3TypEnum uciFrmtTyp = RG_SCH_UCI_FORMAT1A_1B;
-
- if (cbType == RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB)
- {
- raCb = (RgSchRaCb *)(cb);
- ackNackMode = RGR_TDD_ACKNACK_MODE_BUNDL;
- hqE = raCb->dlHqE;
- /* ccpu00139061 Fix */
- rnti = raCb->tmpCrnti;
- }
- else
- {
- ue = (RgSchUeCb *)(cb);
- ackNackMode = ue->dl.ackNackMode;
- hqE = RG_SCH_CMN_GET_UE_HQE(ue, cellCb);
- rnti = ue->ueId;
-#ifdef LTEMAC_SPS_AN_MUX
- isPusch = fdbk->isPusch;
-#endif
-
-#ifdef LTEMAC_SPS
- if (RGSCH_TIMEINFO_SAME(timeInfo, ue->relPdcchFbkTiming))
- {
- hasRelPdcch = TRUE;
- }
-#endif
- }
-
-#if ((defined LTEMAC_SPS_AN_MUX) || (defined LTE_ADV))
- ascIdx = rgSchTddDlAscSetIdxKTbl[cellCb->ulDlCfgIdx][timeInfo.slot];
- noFdbks = ascIdx.numFdbkSubfrms;
-#endif
-#ifdef LTEMAC_SPS_AN_MUX
- /* Calculate the subframe time at which transmissions should have happened to
- * receive feedback in this subframe */
- if (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT)
- {
- for(idx=0; idx<noFdbks; idx++)
- {
- /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper output
- * if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME() as it is
- * serving the purpose */
- RGSCHDECRFRMCRNTTIME(timeInfo,schdSfTime[idx],ascIdx.subfrmNum[idx]);
- }
- }
-#endif
-
- rgSCHDhmHqProcByFdbkTime(hqE, timeInfo, &isMsg4, hqPrcs, numTb, \
- tbStrtIdx, &hqCnt,hqE->cell);
- /* Fetch the harqProc from the inUse list */
-#ifdef LTEMAC_SPS
- if ((FALSE == hasRelPdcch) && (hqCnt == 0))
-#endif
- if(hqCnt == 0)
- {
- err->errType = RGSCHERR_DHM_FDBK_IND;
- err->errCause = RGSCHERR_DHM_FDBK_IND_INVALID_CB;
- return RFAILED;
- }
-
- /* ccpu00147469 : This code is moved below as here this code always try to
- * get the primary cell aninfo. it is due to hqE->cell->cellId as it is
- * cellId of PCEll
- */
-
- if(fdbk->hqFdbkMode == TFU_ACK_NACK_SPECIAL_BUNDLING)
- {
- rgSCHDhmPrcSplBundlFdbk(cellCb, fdbk, hqCnt);
- }
-
-#ifdef TFU_TDD
-#endif
-
-#ifdef LTEMAC_SPS_AN_MUX
- /* Check if feedback came on configured UL SPS grant in Muxing mode */
- if((ackNackMode == RGR_TDD_ACKNACK_MODE_MULT) &&
- (isPusch == TRUE) )
- {
- hIdx = 0;
- /* Pick the valid feedbacks out of M feedbacks */
- for(idx=0; idx<noFdbks; idx++)
- {
- /* Skip the feedback if hqProc[idx] did not transmit in schdSf[idx]
- * and no release pdcch is sent in prevTime */
- /* TODO: SPS_TDD: Check this while testing */
- if ((hqPrcs[hIdx] && !RGSCH_TIMEINFO_SAME(hqPrcs[hIdx]->\
- tbInfo[(S16)(tbStrtIdx[hIdx])].timingInfo,\
- schdSfTime[idx])) &&
- !RGSCH_TIMEINFO_SAME(ue->relPdcchTxTime, schdSfTime[idx]))
- {
- /* Discard the feedback which is corresponding to a subframe in
- * which no DL transmission took place */
- tmpIdx = idx+1;
- while(tmpIdx < noFdbks)
- {
- fdbk->isAck[tmpIdx-1] = fdbk->isAck[tmpIdx];
- fdbk->isAck[tmpIdx-1] = fdbk->isAck[tmpIdx];
- tmpIdx++;
- }
- rcvCnt--;
- ++hIdx;
- }
- } /* end of for loop */
- } /* end of configured UL SPS grant check */
-#endif
-#ifdef CA_DBG
- {
- if(ue)
- {
- gHqFdbkCount++;
- }
- }
-
-#endif
-
- for(idx=0;idx < hqCnt; idx++)
- {
- /* Fix for CR ccpu00147469: Get the anInfo for each harq proc */
- if(ue)
- {
-#ifdef LTE_ADV
- uint8_t servCellIdx = rgSchUtlGetServCellIdx(hqPrcs[idx]->hqE->cell->instIdx,
- hqPrcs[idx]->hqE->cell->cellId,ue);
-
- if(ue->cellInfo[servCellIdx]->sCellState != RG_SCH_SCELL_ACTIVE)
- {
- continue;
- }
- anInfo = rgSCHUtlGetUeANFdbkInfo(ue, &timeInfo,servCellIdx);
-#else
- anInfo = rgSCHUtlGetUeANFdbkInfo(ue, &timeInfo,RGSCH_PCELL_INDEX);
-#endif
- if(anInfo == NULLP)
- {
- RGSCHDBGINFO(cellCb->instIdx,(rgSchPBuf(cellCb->instIdx),
- "Ack Rcvd. No Ack/Nack feedback available \n"));
- return RFAILED;
- }
- }
-
- sCell = hqPrcs[idx]->hqE->cell;
- rlsHqBufs = &(sCell->rlsHqArr[sCell->crntHqIdx]);
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].numOfTBs = 0;
- for (tbCnt = tbStrtIdx[idx]; (tbCnt-tbStrtIdx[idx]) < numTb[idx]; tbCnt++)
- {
- /* Fix : syed MultiUe per TTI crash in TA List. */
- hqRls = FALSE;
- maxHqRetxReached = FALSE;
- /* Remove the harq process from the subframe */
- sf = rgSCHUtlSubFrmGet(cellCb, hqPrcs[idx]->tbInfo[tbCnt].timingInfo);
-
- if(NULLP != ue)
- {
- uciFrmtTyp = ue->dl.dlSfHqInfo[cellCb->cellId][sf->dlIdx].uciFrmtTyp;
- }
-
- if(uciFrmtTyp != RG_SCH_UCI_FORMAT1B_CS)
- {
- if((fdbk->hqFdbkMode != TFU_ACK_NACK_SPECIAL_BUNDLING)&&
- (RGR_TDD_ACKNACK_MODE_MULT == ackNackMode))
- {
- isAck = fdbk->isAck[hqPrcs[idx]->tbInfo[tbCnt].m];
- }
- else
- {
- /* TODO: review for TM4 and CA interaction */
- if((TRUE == hqPrcs[idx]->cwSwpEnabled) && (1 < numTb[idx]))
- {
- isAck = fdbk->isAck[!tbCnt];
- }
- else
- {
- isAck = fdbk->isAck[tbCnt];
- }
- }
- }
-#ifdef LTE_ADV
- else
- {
- if(1 == noFdbks)
- {/* M == 1 case */
- rgSchGetHqFdbkPosForM1(ue, hqPrcs[idx], &isAck, fdbk, tbCnt, anInfo);
- }
- else
- {
- rgSchGetHqFdbkPosForM234(ue, hqPrcs[idx], &isAck, fdbk, tbCnt, anInfo, noFdbks, timeInfo);
- }
- }
-#endif
-
-#ifdef BRDCM
- /* revanth tweakin AN PUSCH to ACK always */
- if (hqPrcs[idx]->isPuschFdbk)
- {
- isAck = 1;
- }
-#endif
-
- hqPrcs[idx]->tbInfo[tbCnt].isAckNackDtx = isAck;
- if(cellCb->ulDlCfgIdx != 5)
- {
- rgSCHUtlGetNxtDlSfInfo(hqPrcs[idx]->tbInfo[tbCnt].timingInfo,\
- cellCb, sf, &nxtDlsf, &nxtfrm);
- }
- /* Keep a tab on how many ACKs or NACKs we have received */
- if (isAck == TFU_HQFDB_ACK)
- {
- hqPrcs[idx]->tbInfo[tbCnt].ackCount += 1; /* Ack counter */
- rgHqRvStats[tbCnt][hqPrcs[idx]->tbInfo[tbCnt].dlGrnt.rv][0]++;
-#ifdef TENB_STATS
- sCell->tenbStats->sch.dlAckNack[tbCnt]\
- [hqPrcs[idx]->tbInfo[tbCnt].dlGrnt.rv]++;
-#endif
- /* Do not update the Ul Trans Time in case of raCb */
- if (ue)
- {
- rgSCHUtlHdlUlTransInd(cellCb, ue, timeInfo);
-#ifdef TENB_STATS
- ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(sCell)].dlAckNackCnt[tbCnt] ++;
-#endif
- }
- }
- else if (isAck == TFU_HQFDB_NACK)
- {
- hqPrcs[idx]->tbInfo[tbCnt].nackCount += 1; /* Nack Counter */
- rgHqRvStats[tbCnt][hqPrcs[idx]->tbInfo[tbCnt].dlGrnt.rv][1]++;
-#ifdef TENB_STATS
- sCell->tenbStats->sch.dlNack[tbCnt]\
- [hqPrcs[idx]->tbInfo[tbCnt].dlGrnt.rv]++;
- sCell->tenbStats->sch.dlAckNack[tbCnt]\
- [hqPrcs[idx]->tbInfo[tbCnt].dlGrnt.rv]++;
-#endif
- /* Do not update the Ul Trans Time in case of raCb */
- if (ue)
- {
- rgSCHUtlHdlUlTransInd(cellCb, ue, timeInfo);
-#ifdef TENB_STATS
- ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(sCell)].dlNackCnt[tbCnt] ++;
- ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(sCell)].dlAckNackCnt[tbCnt] ++;
-#endif
- }
-#ifdef LTE_L2_MEAS
- if(hqPrcs[idx]->tbInfo[tbCnt].txCntr == 1)
- {
- cellCb->dlUlTbCnt.tbTransDlFaulty++;
- }
-#endif
- }
- else
- {
- hqPrcs[idx]->tbInfo[tbCnt].dtxCount += 1; /* DTX Counter*/
-#ifdef TENB_STATS
- sCell->tenbStats->sch.dlDtx[tbCnt]\
- [hqPrcs[idx]->tbInfo[tbCnt].dlGrnt.rv]++;
- if (ue)
- {
- ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(sCell)].dlDtxCnt[tbCnt] ++;
- }
-#endif
-#ifdef LTE_L2_MEAS
- if(hqPrcs[idx]->tbInfo[tbCnt].txCntr == 1)
- {
- cellCb->dlUlTbCnt.tbTransDlFaulty++;
- }
-#endif
- }
-#ifdef CA_DBG
- if(ue && RG_SCH_IS_CELL_SEC(ue,hqPrcs[idx]->hqE->cell))
- {
- if(isAck == TFU_HQFDB_ACK)
- {
- gSCellTb1AckCount++;
- gSCellTb2AckCount++;
- }else if(isAck == TFU_HQFDB_NACK)
- {
- gSCellTb1NackCount++;
- gSCellTb2NackCount++;
- }else
- {
- gSCellTb1DtxCount++;
- gSCellTb2DtxCount++;
- }
- }
- else
- {
- if(isAck == TFU_HQFDB_ACK)
- {
- gPCellTb1AckCount++;
- gPCellTb2AckCount++;
- }else if(isAck == TFU_HQFDB_NACK)
- {
- gPCellTb1NackCount++;
- gPCellTb2NackCount++;
- }else
- {
- gPCellTb1DtxCount++;
- gPCellTb2DtxCount++;
- }
- }
-#endif
- /* Check if this is repeating UE */
- if (hqPrcs[idx]->tbInfo[tbCnt].fbkRepCntr != 0)
- {
- rgSCHUtlDlHqPTbRmvFrmTx(sf, hqPrcs[idx], tbCnt, TRUE);
- /* Check if last repetition */
- if (--hqPrcs[idx]->tbInfo[tbCnt].fbkRepCntr)
- {
- RGSCH_NULL_CHECK(cellCb->instIdx, nxtDlsf);
- /* Update feedback time for this hqP TB so that
- * next subframe its picked up */
- RGSCH_UPD_HQAN_FDBKTIME(&hqPrcs[idx]->tbInfo[tbCnt],\
- nxtDlsf, nxtfrm);
- RGSCH_NULL_CHECK(cellCb->instIdx, anInfo);
- RGSCH_UPD_ANINFO_WITH_HQ(anInfo, &hqPrcs[idx]->tbInfo[tbCnt]);
- anUpd = TRUE;
- continue;
- }
- /* For a repeating UE take the decision here */
- /* For a repeating UE take the decision here */
- if (((hqPrcs[idx]->tbInfo[tbCnt].ackCount) > (hqPrcs[idx]->tbInfo[tbCnt].nackCount)) &&
- ((hqPrcs[idx]->tbInfo[tbCnt].ackCount) > (hqPrcs[idx]->tbInfo[tbCnt].dtxCount)))
- {
- isAck = TFU_HQFDB_ACK;
- }
- else if (((hqPrcs[idx]->tbInfo[tbCnt].dtxCount) > (hqPrcs[idx]->tbInfo[tbCnt].nackCount)) &&
- ((hqPrcs[idx]->tbInfo[tbCnt].dtxCount) > (hqPrcs[idx]->tbInfo[tbCnt].ackCount)))
- {
- isAck = TFU_HQFDB_DTX;
- }
- else
- {
- isAck = TFU_HQFDB_NACK;
- }
- hqPrcs[idx]->tbInfo[tbCnt].isAckNackDtx = isAck;
- }
- else
- {
- rgSCHUtlDlHqPTbRmvFrmTx(sf, hqPrcs[idx], tbCnt, FALSE);
- }
-#ifdef LTEMAC_SPS
- if (((isAck == TFU_HQ_NACK) || (isAck == TFU_HQ_ACK)) &&
- ((hqPrcs[idx]->sch != (RgSchCmnDlHqProc *)NULLP) &&
- (RG_SCH_CMN_SPS_DL_IS_SPS_TX_HQP(hqPrcs[idx])))
- )
- {
- /* ACK or NACK received for SPS ACTV PDCCH
- * Hence consider SPS ACTVN PDCCH received successfully */
- rgSCHUtlDlProcAck(cellCb, hqPrcs[idx]);
- }
-#endif
- if(TFU_HQFDB_ACK == isAck)
- {
- /* SPS_REVIEW */
- if (isMsg4 == TRUE)
- {
- if (raCb == NULLP)
- {
- raCb = rgSCHDbmGetRaCb(cellCb, rnti);
- }
- /* Inform Random Access Module regarding the ack received */
- if (raCb != NULLP)
- {
- /*RRC Connection Setup failure issue where RRC connection
- * setup was not reaching UE due to message 4 HARQ failure */
-#ifdef XEON_SPECIFIC_CHANGES
- CM_LOG_DEBUG(CM_LOG_ID_SCH, "Msg4 Harq SUCCESS for UE(%d)\n", rnti);
-#endif
- rgSCHRamMsg4Done(cellCb, raCb);
- }
- }
- else /*ccpu00114124- HARQ Release for Msg4 */
- {
-#ifdef DL_LA
- /*Update feedback history for every Tx/Retx */
- rgSCHDhmUpdateAckNackHistory(sCell, ue, isAck, tbCnt);
-#endif
- RGSCH_NULL_CHECK(cellCb->instIdx, ue);
- RG_UPD_ACQI_TRIG_WT(ue, sCell, isAck);
-#ifdef LTE_ADV
- /* Store activation CE presence as it is required later to start
- *activation delay timer */
- sCellActCePres = hqPrcs[idx]->tbInfo[tbCnt].schdSCellActCe.pres;
-#endif
- rgSCHDhmRlsHqpTb(hqPrcs[idx], tbCnt, TRUE);
- }
- hqRls = TRUE;
- }
- else
- {
- /* If this Msg4 DTX, there will be
- * no DlHqProc as it has its own HarqProc */
- /* SPS_REVIEW */
- {
- rgSCHDhmHqTbTrnsFail(cellCb, hqPrcs[idx], tbCnt, &hqRls);
- maxHqRetxReached = hqRls;
-#ifdef DL_LA
- if ((isMsg4 == FALSE))
- {
- /*Update feedback history for every Tx/Retx */
- rgSCHDhmUpdateAckNackHistory(sCell, ue, isAck, tbCnt);
- }
-#endif
- if (isMsg4 == FALSE)
- {
- RGSCH_NULL_CHECK(cellCb->instIdx, ue);
- RG_UPD_ACQI_TRIG_WT(ue, sCell, isAck);
- }
- }
- }
-
- if(TRUE == hqRls)
- {
- /* MS_WORKAROUND: to increase Harq Fail Counter .
- The status field is required for tracking the number of harq faliures at MAC*/
- if (isAck)
- {
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].status[\
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].numOfTBs] = TRUE;
- }
- else
- {
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].status[\
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].numOfTBs] = FALSE;
- }
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].tbId[\
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].numOfTBs] = tbCnt + 1;
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].numOfTBs++;
- }
-
- /* Handle the TA */
- if (hqPrcs[idx]->tbInfo[tbCnt].taSnt == TRUE)
- {
- rgSCHDhmFdbkIndHndlTa(hqPrcs[idx], tbCnt, isAck, maxHqRetxReached);
- }
-#ifdef LTE_ADV
- /* Handle Scell activation */
- if (TRUE == sCellActCePres)
- {
- /* Primary Cellcb needs to be retrived
- * if the feedback is coming on pusch of
- * sec cell. THis needs to be considered
- * while UL_CA*/
- rgSCHSCellHndlFdbkInd(hqPrcs[idx], tbCnt, isAck, maxHqRetxReached);
- }
-#endif
- }
- if (hqRls == FALSE)
- {
- hqPrcs[idx]->cwSwpEnabled = FALSE;
- }
- if(rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].numOfTBs)
- {
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].rnti = rnti;
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].hqProcId =
- hqPrcs[idx]->procId;
- rlsHqBufs->numUes++;
- }
-#ifdef BRDCM
- hqPrcs[idx]->isPuschFdbk = 0;
-#endif
- }
-
-#ifdef LTEMAC_SPS
- /*it is possible for some TDD configurations (like TDD cfg 5)
- * to have multiple feedback for 13 subframes before. It is
- * possible in such a case to have a release sent after data
- * thus running into a situation where we are receiving feedback
- * for both data and relese pdcch
- */
-/*
- if ( (hqCnt == 0) ||
- (hasRelPdcch && rcvCnt > hqCnt)
- )
- */
- if (ue && hasRelPdcch)
- {
- /* Bool found = FALSE; */
-
- sf = rgSCHUtlSubFrmGet(cellCb, ue->relPdcchTxTime);
-
- /*
- if ( !sf->relPdcch)
- {
- found = FALSE;
- }
- */
-
-
-#if ((defined LTEMAC_SPS_AN_MUX) || (defined LTE_ADV))
- if(ackNackMode == RGR_TDD_ACKNACK_MODE_MULT)
- {
- CmLteTimingInfo txTime;
- uint8_t ulDlCfgIdx = 0;
- uint8_t maxFdbks = 0;
- uint8_t itr = 0;
-
- ulDlCfgIdx = cellCb->ulDlCfgIdx;
-
- maxFdbks = rgSchTddDlAscSetIdxKTbl[ulDlCfgIdx]
- [timeInfo.slot].
- numFdbkSubfrms;
-
- for(itr=0; itr< maxFdbks; itr++)
- {
-#ifdef LTE_ADV
- /* Handling the case of only SPS release pdcch
- * and no other scheduling in both the serving cells
- * */
- if(ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS)
- {/* Using the sorted K table */
- RGSCHDECRFRMCRNTTIME (timeInfo, txTime,
- rgSchTddDlHqPucchResCalTbl[ulDlCfgIdx][timeInfo.slot].subfrmNum[itr]);
- }else
-#endif
- {
- RGSCHDECRFRMCRNTTIME (timeInfo, txTime,
- rgSchTddDlAscSetIdxKTbl[ulDlCfgIdx][timeInfo.slot].subfrmNum[itr]);
- }
-
- if (RGSCH_TIMEINFO_SAME (txTime, ue->relPdcchTxTime))
- {
-#ifdef LTE_ADV
- if((ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS)&&
- (maxFdbks == 1))
- {/* M == 1 case */
- if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
- {
- isAck = fdbk->isAck[0];
- }else
- {
- isAck = fdbk->isAck[2];
- }
- }
- else
- /* M > 1 same below logic apply.
- If SPS occasion and rel pdcch is present
- SPS occasion after SPS release cannot
- happen in a bundle
- */
-#endif
- {
- isAck = fdbk->isAck[itr];
- }
-
- rgSCHUtlDlRelPdcchFbk(cellCb, ue, isAck);
-
- RGSCH_NULL_CHECK(cellCb->instIdx, sf->relPdcch);
- /* Remove release PDCCH from the subframe */
- rgSCHUtlPdcchPut(cellCb, &sf->pdcchInfo, sf->relPdcch);
- sf->relPdcch = NULLP;
- /* found = TRUE; */
- break;
- }
-
- }
- }
- else
-#endif
- {
- RGSCH_NULL_CHECK(cellCb->instIdx, sf->relPdcch);
- /* Remove release PDCCH from the subframe */
- rgSCHUtlPdcchPut(cellCb, &sf->pdcchInfo, sf->relPdcch);
- sf->relPdcch = NULLP;
- /* found = TRUE; */
- rgSCHUtlDlRelPdcchFbk(cellCb, ue, fdbk->isAck[0]);
- }
- /*
- if ( found == FALSE )
- {
- RGSCH_NULL_CHECK(cellCb->instIdx, ue);
- DU_LOG("\nERROR --> SCH : NO HARQ proc available for feedback:timeInfo:snf %d,slot %d",
- ue->ueId,timeInfo.sfn, timeInfo.slot);
- err->errType = RGSCHERR_DHM_FDBK_IND;
- err->errCause = RGSCHERR_DHM_FDBK_IND_INVALID_CB;
- return RFAILED;
- }
- */
- }/*if(hqCnt==0)*/
-#endif /* LTEMAC_SPS */
- /* Initialise the Ack/Nack feedback */
- /* [ccpu00127651] - MOD For Msg4 Harq Proc, anInfo will not be filled while
- scheduling. So added a condition !isMsg4 to avoid calling the function
- rgSCHUtlInitUeANFdbkInfo*/
- if((ue) && (!anUpd) && (!isMsg4))
- {
-#ifdef LTE_ADV
- /* TODO:: Initi the anInfo all the serving cells */
- for(idx = 0; idx <= RG_SCH_MAX_SCELL; idx++)
- {
- if(ue->cellInfo[idx])
- {
- anInfo = rgSCHUtlGetUeANFdbkInfo(ue, &timeInfo,idx);
- /* Fix for CR ccpu00147693: If anInfo is there then initialize it
- * else don't do anything. basically continue for next serving
- * cell*/
- if(anInfo)
- {
- rgSCHUtlInitUeANFdbkInfo(anInfo);
- }
- }
- }
-#else
- rgSCHUtlInitUeANFdbkInfo(anInfo);
-#endif
- }
-
- return ROK;
-}
-//#endif /* LTEMAC_SPS */
-
-#else /* LTE_TDD */
-/** * @brief Handler for HARQ feedback received for DL transmission.
- *
- * @details
- *
- * Function : rgSCHDhmPrcFdbkForTb
- *
- * Process Hq Prc Fdbk for a TB
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgTfuHarqAckIndInfo *fdbk
- * @param[in] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHDhmPrcFdbkForTb
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlHqProcCb *hqP,
-RgSchDlSf *sf,
-Bool isMsg4,
-uint16_t rnti,
-uint8_t tbCnt,
-CmLteTimingInfo timingInfo,
-uint8_t isAck,
-RgInfRlsHqInfo *rlsHqBufs,
-RgSchErrInfo *err
-)
-{
-#ifdef DEBUGP
- Inst inst = cell->instIdx;
-#endif
-#ifdef RGSCH_SPS_STATS
- RgSchCmnDlHqProc *cmnHqDl;
-#endif
- S16 ret = ROK;
- RgSchRaCb *raCb = NULLP;
- Bool hqRls=FALSE;
- Bool hqFreed =FALSE;
- Bool maxHqRetxReached = FALSE;
- RgSchCmnDlUe *ueDl = NULLP;
- RgSchCellCb *sCell = hqP->hqE->cell;
-#ifdef EMTC_ENABLE
- RgSchEmtcDlSf *emtcSf;
- CmLteTimingInfo frm = timingInfo;
-#endif
-
- if (ue)
- {
- ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- }
- hqRls = FALSE;
- /* Fix : syed MultiUe per TTI crash in TA List. */
- maxHqRetxReached = FALSE;
-
- /* Fix : syed Consider CW to TB mapping for Hq Feedback.
- * TODO: Need to enhance this in case of TM4 testing,
- * when cwSwap flag is considered. */
-
- RGSCHDBGINFO(inst, (rgSchPBuf(inst), "rgSCHDhmHqFdbkInd():\
- tbCnt=%d , isAck=%d",tbCnt,isAck));
- if (isAck == TFU_HQFDB_ACK)
- {
- hqP->tbInfo[tbCnt].ackCount += 1; /* Ack counter */
- /*sanjay*/
- rgHqRvStats[tbCnt][hqP->tbInfo[tbCnt].dlGrnt.rv][0]++;
- /* Do not update the Ul Trans Time in case of raCb */
- if (ue)
- {
- rgSCHUtlHdlUlTransInd(cell, ue, timingInfo);
-#ifdef TENB_STATS
- ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(sCell)].dlAckNackCnt[tbCnt]++;
-#endif
-
- }
-
-#ifdef TENB_STATS
- sCell->tenbStats->sch.dlAckNack[tbCnt]\
- [hqP->tbInfo[tbCnt].dlGrnt.rv]++;
-
-#endif
-
- }
- else if (isAck == TFU_HQFDB_NACK)
- {
- hqP->tbInfo[tbCnt].nackCount += 1; /* Nack Counter */
- RGSCHDBGINFONEW(inst, (rgSchPBuf(inst), "<HARQ> HqP[%d:%d] NACKED "
- "ue(%d)\n", hqP->procId, tbCnt, hqP->hqE->ue->ueId));
- rgHqRvStats[tbCnt][hqP->tbInfo[tbCnt].dlGrnt.rv][1]++;
- /* Do not update the Ul Trans Time in case of raCb */
-
-#ifdef TENB_STATS
- sCell->tenbStats->sch.dlAckNack[tbCnt]\
- [hqP->tbInfo[tbCnt].dlGrnt.rv]++;
-
- sCell->tenbStats->sch.dlNack[tbCnt]\
- [hqP->tbInfo[tbCnt].dlGrnt.rv]++;
-
-
-#endif
-
- if (ue)
- {
- rgSCHUtlHdlUlTransInd(cell, ue, timingInfo);
-#ifdef TENB_STATS
- ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(sCell)].dlAckNackCnt[tbCnt]++;
- ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(sCell)].dlNackCnt[tbCnt] ++;
-#endif
- }
- /* Added Dl TB count for NACKED data*/
-#ifdef LTE_L2_MEAS
- if(hqP->tbInfo[tbCnt].txCntr == 1)
- {
- cell->dlUlTbCnt.tbTransDlFaulty++;
- }
-#endif
- }
- else
- {
- RGSCHDBGINFONEW(inst,(rgSchPBuf(inst),"<HARQ> HqP[%d:%d] DTXED UE(%d)\n",
- hqP->procId, tbCnt,hqP->hqE->ue->ueId));
- hqP->tbInfo[tbCnt].dtxCount += 1; /* DTX Counter*/
-
-#ifdef TENB_STATS
- sCell->tenbStats->sch.dlDtx[tbCnt]\
- [hqP->tbInfo[tbCnt].dlGrnt.rv]++;
- if (ue)
- {
- ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(sCell)].dlDtxCnt[tbCnt]++;
- }
-#endif
-
-
- /* Added Dl TB count for DTXED data*/
-#ifdef LTE_L2_MEAS
- if(hqP->tbInfo[tbCnt].txCntr == 1)
- {
- cell->dlUlTbCnt.tbTransDlFaulty++;
- }
-#endif
- }
-
- /* Check if this is repeating UE */
- if (hqP->tbInfo[tbCnt].fbkRepCntr != 0)
- {
- if((rgSCHDhmProcHqFdbkAckNackRep(hqP,sf,tbCnt,&isAck)) != ROK)
- {
- return (ret);
- }
- }
- else
- {
- /* For a Normal UE take the decision here */
- hqP->tbInfo[tbCnt].isAckNackDtx = isAck;
- {
- rgSCHUtlDlHqPTbRmvFrmTx(sf, hqP, tbCnt, FALSE);
- }
- }
- /* Process either the ACK received or max retries have occurred */
- /* Assuming for Repetition that 2 ACKs and 2 NACKs make an NACK */
- if (TFU_HQFDB_ACK == isAck)
- {
- if (isMsg4 == TRUE)
- {
- /* SR_RACH_STATS : MSG4 ACK*/
- rgNumMsg4Ack++;
-
- if (raCb == NULLP)
- {
- raCb = rgSCHDbmGetRaCb(cell, rnti);
- }
- DU_LOG("\nDEBUG --> SCH: Ack Rcvd. FdbkInd for Msg4Done\n");
- /* Inform Random Access Module regarding the ack received */
- if (raCb != NULLP)
- {
- /*RRC Connection Setup failure issue where RRC connection
- * setup was not reaching UE due to message 4 HARQ failure */
- printf("\nDEBUG --> SCH: MSG4 Ack ,calling rgSCHRamMsg4Done\n");
- ret = rgSCHRamMsg4Done(cell, raCb);
- hqFreed = TRUE;
- }
- else
- {
- printf("\nDEBUG --> SCH: raCb is NULLP\n");
- }
- }
- else /*ccpu00114124- HARQ Release for Msg4 */
- {
- RGSCH_NULL_CHECK(cell->instIdx, ueDl);
- /* Push this harq process back to the free queue */
- ueDl->mimoInfo.cwInfo[tbCnt].ackCnt++;
-#ifdef DL_LA
- if(hqP->tbInfo[tbCnt].txCntr == 1)
- {
- rgSCHDhmUpdateAckNackHistory(sCell, ue, isAck, tbCnt);
- }
-#endif
- RGSCH_NULL_CHECK(cell->instIdx, ue);
- RG_UPD_ACQI_TRIG_WT(ue, sCell,isAck);
- rgSCHDhmRlsHqpTb(hqP, tbCnt, TRUE);
- }
- hqRls = TRUE;
- }
- else
- {
- {
- if(!isMsg4)
- {
- RGSCH_NULL_CHECK(cell->instIdx, ueDl);
- ueDl->mimoInfo.cwInfo[tbCnt].nackCnt++;
-#ifdef DL_LA
- if(hqP->tbInfo[tbCnt].txCntr == 1)
- {
- rgSCHDhmUpdateAckNackHistory(sCell, ue, isAck, tbCnt);
- }
-#endif
- RGSCH_NULL_CHECK(cell->instIdx, ue);
- RG_UPD_ACQI_TRIG_WT(ue, sCell, isAck);
- }
- else
- {
-#ifdef XEON_SPECIFIC_CHANGES
- CM_LOG_DEBUG(CM_LOG_ID_SCH,"Msg4 Harq FAILURE for UE(%d)\n", rnti);
-#endif
- rgNumMsg4Nack++;
- }
- rgSCHDhmHqTbTrnsFail(cell, hqP, tbCnt, &hqRls);
- maxHqRetxReached = hqRls;
- }
- }
-
- if(hqRls == TRUE)
- {
- /* MS_WORKAROUND: to increase Harq Fail Counter .
- The status field is required for tracking the number of harq faliures at MAC*/
- if (isAck)
- {
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].status[\
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].numOfTBs] = TRUE;
- }
-#ifdef LTE_L2_MEAS
- else if(maxHqRetxReached)
- {
- /* this is to differentiat the NACK with data loss used for UU loss L2 meas */
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].status[\
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].numOfTBs] = 0xFF; /* RGU_NACK_LOSS; */
- }
-#endif
- else
- {
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].status[\
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].numOfTBs] = FALSE;
- }
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].tbId[\
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].numOfTBs] = tbCnt + 1;
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].numOfTBs++;
- }
-
- /* Handle the TA */
- if (hqFreed == FALSE && hqP->tbInfo[tbCnt].taSnt == TRUE)
- {
- rgSCHDhmFdbkIndHndlTa(hqP, tbCnt, isAck, maxHqRetxReached);
- }
- return (ret);
-} /* rgSCHDhmPrcFdbkForTb */
-/** * @brief Function to decode the position of HarqFb for eachCell.
- *
- * @details
- *
- * Function : rgSchGetHqFdbkPos
- *
- * @param[in] RgSchCellCb *cell,
- * @param[in] RgSchUeCb *ue,
- * @param[in] RgSchDlHqProcCb *hqP,
- * @param[in] RgrSchFrmt1b3TypEnum uciFrmtTyp,
- * @param[in] Bool *isAck,
- * @param[in] RgTfuHqInfo *fdbk,
- * @return void
- **/
-Void rgSchGetHqFdbkPos
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlHqProcCb *hqP,
-RgrSchFrmt1b3TypEnum uciFrmtTyp,
-uint8_t *isAck,
-RgTfuHqInfo *fdbk
-)
-{
- if(uciFrmtTyp != RG_SCH_UCI_FORMAT1B_CS)
- {
- isAck[0] = fdbk->isAck[0];
- isAck[1] = fdbk->isAck[1];
- return;
- }
-#ifdef LTE_ADV
- /* LAA Making all ack for LAA CELL */
- //if (hqP->hqE && rgSCHLaaSCellEnabled(hqP->hqE->cell))
- if (0)
- {
- isAck[0] = TRUE;
- isAck[1] = TRUE;
- return;
- }
-
- if((ue != NULLP))
- {
- /* PUSCH:: Fdbks are in the increasing order
- * of servCellIdx as per 36.212 section 5.2.26*/
- switch(ue->f1bCsAVal)
- {/* A Value */
- case RG_SCH_A_VAL_2:
- {
- if(RG_SCH_IS_CELL_SEC(ue,hqP->hqE->cell))
- {
- isAck[0] = fdbk->isAck[1];/*SCell*/
- isAck[1] = fdbk->isAck[1];/*SCell*/
- }
- else
- {
- isAck[0] = fdbk->isAck[0];/*PCell*/
- isAck[1] = fdbk->isAck[0];/*PCell*/
- }
- break;
- }
- case RG_SCH_A_VAL_3:
- {
- if(RG_SCH_IS_CELL_SEC(ue,hqP->hqE->cell))
- {
-#ifdef LTE_ADV
- uint8_t servCellIdx = rgSchUtlGetServCellIdx(hqP->hqE->cell->instIdx,
- hqP->hqE->cell->cellId,
- ue);
-
- if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1)
-#else
- if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[RGSCH_PCELL_INDEX]->txMode.txModeEnum) > 1)
-#endif
- { /* Sec cell is in mimo mode */
- /* use 0 and 1 for sec in case of pucch
- * and 1 and 2 in case of PUSCH as the primary cell is in
- * siso case as A =3 */
- if(!fdbk->isPusch)
- {
- isAck[0] = fdbk->isAck[0];
- isAck[1] = fdbk->isAck[1];
- }else
- {/* PUSCH as per 36.212 serction 5.2.26*/
- isAck[0] = fdbk->isAck[1];
- isAck[1] = fdbk->isAck[2];
- }
- }else
- {/* sec cell is in siso */
- isAck[0] = fdbk->isAck[2];
- }
- }else
- {
- if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
- {/* primay cell is in mimo
- use 0 and 1 */
- isAck[0] = fdbk->isAck[0];
- isAck[1] = fdbk->isAck[1];
- }else
- {
- if(!fdbk->isPusch)
- {
- isAck[0] = fdbk->isAck[2];
- }else
- {/* PUSCH as per 36.212 serction 5.2.26*/
- isAck[0] = fdbk->isAck[0];
- }
- }
- }
- break;
- }
- case RG_SCH_A_VAL_4:
- {
- if(RG_SCH_IS_CELL_SEC(ue,hqP->hqE->cell))
- {
- isAck[0] = fdbk->isAck[2];
- isAck[1] = fdbk->isAck[3];
-#ifdef CA_DBG
- {
- if(isAck[0] == TFU_HQFDB_ACK)
- {
- gSCellTb1AckCount++;
- }else if(isAck[0] == TFU_HQFDB_NACK)
- {
- gSCellTb1NackCount++;
- }else
- {
- gSCellTb1DtxCount++;
- }
-
- if(isAck[1] == TFU_HQFDB_ACK)
- {
- gSCellTb2AckCount++;
- }else if(isAck[1] == TFU_HQFDB_NACK)
- {
- gSCellTb2NackCount++;
- }else
- {
- gSCellTb2DtxCount++;
- }
-
- }
-#endif
- }
- else
- {
- isAck[0] = fdbk->isAck[0];
- isAck[1] = fdbk->isAck[1];
-#ifdef CA_DBG
- {
- if(isAck[0] == TFU_HQFDB_ACK)
- {
- gPCellTb1AckCount++;
- }else if(isAck[0] == TFU_HQFDB_NACK)
- {
- gPCellTb1NackCount++;
- }else
- {
- gPCellTb1DtxCount++;
- }
-
- if(isAck[1] == TFU_HQFDB_ACK)
- {
- gPCellTb2AckCount++;
- }else if(isAck[1] == TFU_HQFDB_NACK)
- {
- gPCellTb2NackCount++;
- }else
- {
- gPCellTb2DtxCount++;
- }
-
- }
-#endif
-
- }
- break;
- }
- default:
- break;
- }
- }
-#endif
- return;
-}/* End of rgSchGetHqFdbkPos */
-#ifdef LTE_ADV
-Void rgSchGetHqFdbkPosFormat3
-(
-RgSchDlHqProcCb *hqP,
-uint8_t *isAck,
-TfuHqFdbk *fdbk
-)
-{
- uint8_t cellIdx = RG_SCH_CMN_GET_CELL_IDX_FROM_HQP(hqP);
- isAck[0] = (uint8_t)fdbk[cellIdx];
- isAck[1] = (uint8_t)fdbk[cellIdx + 1];
-}
-#endif
-/** * @brief Handler for HARQ feedback received for DL transmission.
- *
- * @details
- *
- * Function : rgSCHDhm5gtfHqFdbkInd
- *
- * This function shall act on the feedback received from TOM for DL
- * transmission. If the feedback for msg4 is final (after max transmissions
- * or ACK) inform RAM that Msg4 transmission is done.
- *
- *
- * @param[in] Void *cb
- * @param[in] uint8_t cbType
- * @param[in] RgSchCellCb *cell
- * @param[in] RgTfuHarqAckIndInfo *fdbk
- * @param[in] RgInfRlsHqInfo *rlsHqBufs
- * @param[in] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHDhm5gtfHqFdbkInd
-(
-RgSchUeCb *ue,
-RgSchCellCb *cell,
-CmLteTimingInfo timingInfo,
-TfuHqFdbk fdbk,
-RgSchErrInfo *err
-)
-{
- RgSchDlHqProcCb *hqP = NULLP;
- CmLList *node = NULLP;
- CmLListCp *lnk;
- S16 ret = ROK;
- RgSchDlSf *sf;
- Bool isMsg4 = FALSE;
- uint16_t rnti=0;
- uint16_t procId=0;
- uint8_t hqPCount = 0;
- RgInfRlsHqInfo *rlsHqBufs = NULLP;
-
- RGSCHDECRFRMCRNTTIME(timingInfo, timingInfo, 4);
-
- sf = rgSCHUtlSubFrmGet(cell, timingInfo);
-
- lnk = &ue->dl.dlSfHqInfo[cell->cellId][sf->dlIdx].hqPLst;
- node = lnk->first;
- hqPCount = lnk->count;
- rnti = ue->ueId;
-
- while (hqPCount)
- {
- hqP = (RgSchDlHqProcCb *)node->node;
- node = node->next;
- rlsHqBufs = &(hqP->hqE->cell->rlsHqArr[hqP->hqE->cell->crntHqIdx]);
- procId = hqP->procId;
-
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].numOfTBs = 0;
-
- if (HQ_TB_WAITING == hqP->tbInfo[0].state)
- {
- rgSCHDhmPrcFdbkForTb(cell, ue, hqP, sf, isMsg4, rnti, 0,
- timingInfo, fdbk, rlsHqBufs, err);
- }
- if(rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].numOfTBs)
- {
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].rnti = rnti;
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].hqProcId =
- (uint8_t)procId;
- rlsHqBufs->numUes++;
- }
- hqPCount--;
- }
-
- return (ret);
-} /* rgSCHDhm5gtfHqFdbkInd */
-
-/** * @brief Handler for HARQ feedback received for DL transmission.
- *
- * @details
- *
- * Function : rgSCHDhmHqFdbkInd
- *
- * This function shall act on the feedback received from TOM for DL
- * transmission. If the feedback for msg4 is final (after max transmissions
- * or ACK) inform RAM that Msg4 transmission is done.
- *
- *
- * @param[in] Void *cb
- * @param[in] uint8_t cbType
- * @param[in] RgSchCellCb *cell
- * @param[in] RgTfuHarqAckIndInfo *fdbk
- * @param[in] RgInfRlsHqInfo *rlsHqBufs
- * @param[in] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHDhmHqFdbkInd
-(
-Void *cb,
-uint8_t cbType,
-RgSchCellCb *cell,
-CmLteTimingInfo timingInfo,
-RgTfuHqInfo *fdbk,
-RgInfRlsHqInfo *rlsHqBufs,
-RgSchErrInfo *err
-)
-{
- RgSchDlHqTbCb *tbCb;
- RgSchDlHqEnt *hqE = NULLP;
- RgSchDlHqProcCb *hqP = NULLP;
- CmLList *node = NULLP;
- CmLListCp *lnk;
- /* Create and Initialize Ue it so that Its not Deferenced Unnecessarily */
- RgSchUeCb *ue = NULLP;
-
- S16 ret = ROK;
- RgSchDlSf *sf;
- Bool isMsg4 = FALSE;
- RgSchRaCb *raCb = NULLP;
- uint16_t rnti=0;
- /* Added Insure Fixes Of UR.Initialized procId */
- uint16_t procId=0;
- /* DTX Change: Bool is converted into uint8_t*/
- uint8_t isAck[2]={0}; /*Changed to Array of 2*/
- uint8_t tbCnt;
- uint8_t hqPCount = 0;
-
-#ifdef LTEMAC_SPS
- CmLteTimingInfo fdbkRcptTime = timingInfo;
-#ifdef RGSCH_SPS_STATS
- RgSchCmnDlHqProc *cmnHqDl;
-#endif
-#endif
-#ifdef LTE_ADV
- TfuHqFdbk format3Ack[CM_LTE_MAX_CELLS *2] = {0};
-#endif
- RgrSchFrmt1b3TypEnum uciFrmtTyp = RG_SCH_UCI_FORMAT1A_1B;
-
- /* Get the subframe associated with the feedback */
- /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper output
- * if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME() as it is
- * serving the purpose */
- RGSCHDECRFRMCRNTTIME(timingInfo, timingInfo, 4);
-
- sf = rgSCHUtlSubFrmGet(cell, timingInfo);
- if (cbType == RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB)
- {
- raCb = (RgSchRaCb *)(cb);
- hqE = raCb->dlHqE;
- hqP = rgSCHDhmHqProcByTime(hqE, timingInfo, &isMsg4,\
- sf);
- if(hqP)
- {
- hqPCount = 1;
- }
- rnti = raCb->tmpCrnti;
- }
- else
- {
- ue = (RgSchUeCb *)(cb);
- hqE = RG_SCH_CMN_GET_UE_HQE(ue, cell);
- {
- lnk = &ue->dl.dlSfHqInfo[cell->cellId][sf->dlIdx].hqPLst;
- }
- node = lnk->first;
- hqPCount = lnk->count;
- rnti = ue->ueId;
-#ifdef LTE_ADV
- uciFrmtTyp = ue->dl.dlSfHqInfo[cell->cellId][sf->dlIdx].uciFrmtTyp;
-#endif
- }
- /*
- TO ADD STATS
- from Harq Proc get ueCb = hqP->hqEnt->ueCb
- from ueCb get cmnUecb = (RgSchCmnUe *)ueCb->sch;
- from ueCb get dlUe = (RgSchCmnDlUe)cmnUeCb->dl
- from get cmInfo "RgSchCmnDlUeCwInfo" dlUe->mimoInfo->cwInfo[0]
- from get CQI from cmInfo->cqi
- from cmInfo get iTbs cmInfo->iTbs[0]
- call RG_SCH_CMN_DL_TBS_TO_MCS to map iTbs=>MCS
- Update stats in cellCb
- cellCb->hqFailStats[cmInfo->cqi].mcs = RG_SCH_CMN_DL_TBS_TO_MCS(cmInfo->iTbs[0]);
- if (fdbk->isAck == TRUE)
- cellCb->hqFailStats[cmInfo->cqi].numOfNacks += 1;
- else
- cellCb->hqFailStats[cmInfo->cqi].numOfAcks += 1;
- DL Ack/Nack statistics
- */
-#ifdef MAC_SCH_STATS
- if (hqE->ue != NULLP)
- {
- RgSchUeCb *ueCb = hqE->ue;
- RgSchCmnUe *cmnUe = (RgSchCmnUe*)ueCb->sch;
- RgSchCmnDlUe *dlUe = RG_SCH_CMN_GET_DL_UE(ueCb,hqE->cell);/*CA dev*/
- uint8_t tbs = dlUe->mimoInfo.cwInfo[0].iTbs[0];
- static uint32_t retxCnt = 0;
-
- if (fdbk->isAck[0] == TFU_HQFDB_ACK)
- {
- hqFailStats.dlCqiStat[(dlUe->mimoInfo.cwInfo[0].cqi - 1)].numOfAcks++;
- }
- else
- {
- ++retxCnt;
- hqFailStats.dlCqiStat[(dlUe->mimoInfo.cwInfo[0].cqi - 1)].numOfNacks++;
- }
- RG_SCH_CMN_DL_TBS_TO_MCS(tbs,
- (hqFailStats.dlCqiStat[(dlUe->mimoInfo.cwInfo[0].cqi - 1)].mcs));
- }
-#endif /* MAC_SCH_STATS */
-
- /* Fetch the harqProc from the inUse list */
-#ifdef LTEMAC_SPS
- /* Check if the feedback timing matches with ue->relPdcchFbkTiming*/
- /* Call Common module with the feedback information */
- if (ue && (ue->relPdcchFbkTiming.sfn != (RGSCH_MAX_SFN + 1)))
- {
- if (RGSCH_TIMEINFO_SAME(fdbkRcptTime, ue->relPdcchFbkTiming))
- {
- sf = rgSCHUtlSubFrmGet(cell, timingInfo);
-
-#ifdef LTE_ADV
- if(uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS)
- {/* Feedback for SPS Release on PCell
- If Pcell is in mimo, feedback index will be 0
- else 2 */
- if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
- {
- isAck[0] = fdbk->isAck[0];
- }else
- {
- isAck[0] = fdbk->isAck[2];
- }
-
- /* Not releasing pdcch here
- * as it is already done at the time of
- * reception req */
- rgSCHUtlDlRelPdcchFbk(cell, ue, isAck[0]);
- }
- else
-#endif
- {
- if (!sf->relPdcch)
- {
- DU_LOG("\nERROR --> SCH : CRNTI:%d NO HARQ proc available for feedback: TimingInfo: "
- "sfn %d slot %d", ue->ueId, timingInfo.sfn,
- timingInfo.slot);
- return RFAILED;
- }
-
- isAck[0] = fdbk->isAck[0];
- /* Note: Since relPdcchFbkTimimg matches with the recieved
- * feedback, assumed that feedback is for release PDCCH */
- rgSCHUtlDlRelPdcchFbk(cell, ue, isAck[0]);
-
- /* Remove release PDCCH from the subframe */
- rgSCHUtlPdcchPut(cell, &sf->pdcchInfo, sf->relPdcch);
- sf->relPdcch = NULLP;
- return ROK;
- }
- }
- }
-#endif /* LTEMAC_SPS */
-
- /* Remove the harq process from the subframe */
- sf = rgSCHUtlSubFrmGet(cell, timingInfo);
- RG_SCH_ADD_TO_CRNT_TIME(timingInfo, timingInfo, 1);
-
-#ifdef CA_DBG
- {
- if(ue)
- {
- gHqFdbkCount++;
- }
- }
-
-#endif
- while (hqPCount)
- {
- if(cbType != RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB)
- {
- hqP = (RgSchDlHqProcCb *)node->node;
- node = node->next;
- rlsHqBufs = &(hqP->hqE->cell->rlsHqArr[hqP->hqE->cell->crntHqIdx]);
- }
- procId = hqP->procId;
-
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].numOfTBs = 0;
-
- /*Get the position of Ack/Nack from 2 bytes fdbkInfo.
- * On the basis of f1bCsAVal find the position of iAck or Nack*/
-#ifdef LTE_ADV
- if (uciFrmtTyp == RG_SCH_UCI_FORMAT3)
- {
- rgSchGetHqFdbkPosFormat3(hqP,isAck,format3Ack);
- }
- else
-#endif
- {
- rgSchGetHqFdbkPos(cell,ue,hqP, uciFrmtTyp, isAck,fdbk);
- }
- for (tbCnt = 0; tbCnt < 2; tbCnt++)
- {
- if (HQ_TB_WAITING == hqP->tbInfo[tbCnt].state)
- {
- rgSCHDhmPrcFdbkForTb(cell, ue, hqP, sf, isMsg4, rnti, tbCnt,
- timingInfo, isAck[tbCnt], rlsHqBufs, err);
- }
- }
- if(rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].numOfTBs)
- {
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].rnti = rnti;
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].hqProcId =
- (uint8_t)procId;
- rlsHqBufs->numUes++;
- }
- hqPCount--;
- }
-
- node = sf->ackNakRepQ.first;
- while (node)
- {
- tbCb = (RgSchDlHqTbCb *)(node->node);
- hqP = tbCb->hqP;
-
- procId = hqP->procId;
- rlsHqBufs = &(hqP->hqE->cell->rlsHqArr[hqP->hqE->cell->crntHqIdx]);
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].numOfTBs = 0;
- if (HQ_TB_WAITING == tbCb->state)
- {
- isAck[0] = fdbk->isAck[tbCb->tbIdx];
- rgSCHDhmPrcFdbkForTb(cell, ue, hqP, sf, isMsg4, rnti, tbCb->tbIdx,
- timingInfo, isAck[0], rlsHqBufs, err);
- }
- hqP->cwSwpEnabled = FALSE;
- if(rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].numOfTBs)
- {
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].rnti = rnti;
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].hqProcId =
- (uint8_t)procId;
- rlsHqBufs->numUes++;
- }
- hqPCount--;
- node = node->next;
- }
-
- return (ret);
-} /* rgSCHDhmHqFdbkInd */
-#endif /* LTE_FDD */
-
-
-/**
- * @brief Handler for Harq related UE configuration.
- *
- * @details
- *
- * Function : rgSCHDhmRgrUeCfg
- *
- * This function shall fetch the harq related information into the
- * respective ueCb from the UE configuration as provided by the
- * upper layers.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ueCb
- * @param[in] RgrUeCfg *ueCfg
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-Void rgSCHDhmRgrUeCfg(RgSchCellCb *cell,RgSchUeCb *ueCb,RgrUeCfg *ueCfg,RgSchErrInfo *err)
-{
-
- UNUSED(err);
-
- /* Initialize the TA Timer */
- cmInitTimers(&ueCb->taTmr, 1);
-
- /* Setting these values irrespective of taTmr value */
- ueCb->dl.taCb.state = RGSCH_TA_IDLE;
- /* Corrected default value of TA as per 36.213, 4.2.3 */
- ueCb->dl.taCb.ta = RGSCH_NO_TA_RQD;
-
- /*[ccpu00121813]-ADD-Initializing outstanding TA value */
- ueCb->dl.taCb.outStndngTa = FALSE;
- ueCb->dl.taCb.outStndngTaval = RGSCH_NO_TA_RQD;
-
- /* Start TA timer only if cfgd as FINITE value */
- if (ueCfg->ueTaTmrCfg.pres)
- {
- /* Configuring taTmr with 30 deficit, to enable eNodeB sending
- * TA command before the expiry of TA at UE. Also considering for
- * possible retx for this TA command */
- /*[ccpu00121813]-ADD-Added chk if tatmr val > 30 */
- if(ueCfg->ueTaTmrCfg.taTmr > 30)
- {
- ueCb->dl.taCb.cfgTaTmr = ueCfg->ueTaTmrCfg.taTmr - 30;
- }
- rgSCHTmrStartTmr (cell, ueCb, RG_SCH_TMR_TA, ueCb->dl.taCb.cfgTaTmr);
- }
- return;
-} /* rgSCHDhmRgrUeCfg */
-
-
-/**
- * @brief Handler for HARQ related UE Reconfiguration
- *
- * @details
- *
- * Function : rgSCHDhmRgrCellCfg
- *
- * This function shall fetch the HARQ related information into the
- * respective ueCb from the UE configuration as provided by the
- * upper layers.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgrCellCfg *cellCfg
- * @param[out] RgSchErrInfo *err
- *
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-Void rgSCHDhmRgrCellCfg(RgSchCellCb *cell,RgrCellCfg *cellCfg,RgSchErrInfo *err)
-{
- RgSchDlHqEnt *hqE;
- PTR pUeCb;/* previous UE Control block */
- PTR nUeCb;/* next UE control block */
- S16 ret;
- uint8_t idx;
-
- UNUSED(err);
-
- pUeCb = NULLP;
-
- cell->dlHqCfg = cellCfg->dlHqCfg;
- for (;;)
- {
- ret = cmHashListGetNext(&(cell->ueLst), pUeCb, &nUeCb);
- if (ret != ROK)
- {
- break;
- }
- else
- {
- pUeCb = nUeCb;
- /* Update the DL Harq related information */
- hqE = RG_SCH_CMN_GET_UE_HQE(((RgSchUeCb*)nUeCb), cell);
- hqE->maxHqTx = cell->dlHqCfg.maxDlHqTx;
- }
- }
- /* Initializing the list for ueCbs that would have ta */
- cmLListInit(&cell->taUeLst);
-#ifdef RGR_V1
- cmLListInit(&cell->ccchSduUeLst);
- cmLListInit(&cell->contResGrdTmrLst);
- cmLListInit(&cell->contResTmrLst);
-#ifdef EMTC_ENABLE
- if(cell->emtcEnable)
- {
- rgSCHDhmEmtcRgrCellCfg(cell);
- }
-#endif
-#endif
-
- /* Initializing the timer queue */
- cell->tqCp.nxtEnt = 0;
- cell->tqCp.tmrLen = RGSCH_UE_TQ_SIZE;
-
- for (idx = 0; idx < RGSCH_UE_TQ_SIZE; idx++)
- {
- cell->tq[idx].first = NULLP;
- cell->tq[idx].tail = NULLP;
- }
- return;
-} /* rgSCHDhmRgrCellCfg */
-
-/**
- * @brief Handler for Updating HARQ Information from Cell Reconfiguration
- *
- * @details
- *
- * Function : rgSCHDhmRgrCellRecfg
- *
- * This function shall fetch the HARQ related information into the
- * respective ueCb from the UE configuration as provided by the
- * upper layers.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgrCellRecfg *cellRecfg
- * @param[out] RgSchErrInfo *err
- *
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-Void rgSCHDhmRgrCellRecfg(RgSchCellCb *cell,RgrCellRecfg *cellRecfg,RgSchErrInfo *err)
-{
- RgSchDlHqEnt *hqE;
- PTR pUeCb;/* previous UE Control block */
- PTR nUeCb;/* next UE control block */
- S16 ret;
-
- UNUSED(err);
-
- pUeCb = NULLP;
-
- /* Update the cell with recieved configuration */
- if (cellRecfg->recfgTypes & RGR_CELL_DL_HARQ_RECFG)
- {
- cell->dlHqCfg = cellRecfg->dlHqRecfg;
-
- for (;;)
- {
- ret = cmHashListGetNext(&(cell->ueLst), pUeCb, &nUeCb);
- if (ret != ROK)
- {
- break;
- }
- else
- {
- pUeCb = nUeCb;
- /* Update the DL Harq related information */
- hqE = RG_SCH_CMN_GET_UE_HQE(((RgSchUeCb*)nUeCb), cell);
- hqE->maxHqTx = cell->dlHqCfg.maxDlHqTx;
- }
- }
- }
- return;
-} /* rgSCHDhmRgrCellRecfg */
-
-/**
- * @brief Handler for freeing up the HARQ related information from ueCb
- *
- * @details
- *
- * Function : rgSCHDhmFreeUe
- *
- * This function shall free up the HARQ specific information from ueCb.
- *
- * @param[in] RgSchUeCb *ueCb
- *
- * @return None.
- *
- **/
-Void rgSCHDhmFreeUe(RgSchUeCb *ueCb)
-{
-
- /* If TA Timer is running. Stop it */
- if (ueCb->taTmr.tmrEvnt != TMR_NONE)
- {
- rgSCHTmrStopTmr(ueCb->cell, ueCb->taTmr.tmrEvnt, ueCb);
- }
-
- /* ccpu00118357 - ADD - stop the periodic BSR timer so it
- * doesn't expire after UE is deleted */
-#ifdef RGR_V1
- if (ueCb->bsrTmr.tmrEvnt != TMR_NONE)
- {
- rgSCHTmrStopTmr(ueCb->cell, ueCb->bsrTmr.tmrEvnt, ueCb);
- }
-#endif /* ifdef RGR_V1*/
-
-
- if (RG_SCH_CMN_GET_UE_HQE(ueCb, ueCb->cell))
- {
- rgSCHDhmDelHqEnt(ueCb->cell, &(RG_SCH_CMN_GET_UE_HQE(ueCb, ueCb->cell)));
- }
-
- /* This UE needs to be removed from its entry into cell's taUeLst */
- /*Fix for ccpu00113622 - Delete Only when taLnk Node exists*/
- if(ueCb->taLnk.node)
- {
- cmLListDelFrm(&(ueCb->cell->taUeLst), &ueCb->taLnk);
- ueCb->taLnk.node = NULLP;
- }
-
- if (ueCb->dlTaLnk.node != NULLP)
- {
- /* Fix: syed Need to raise a CR for not calling CMN or specific scheduler
- * function directly from other modules. APIs should be defined and/or used
- * instead. Please check for other possible incorrect usage. */
- rgSCHCmnRmvFrmTaLst(ueCb->cell, ueCb);
- }
-
- return;
-
-} /* rgSCHDhmFreeUe */
-
-/**
- * @brief Handler for updating the TA.
- *
- * @details
- *
- * Function : rgSCHDhmUpdTa
- *
- * This function shall update the TA received.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ueCb
- * @param[in] uint8_t ta
- *
- * @return None.
- *
- **/
-Void rgSCHDhmUpdTa(RgSchCellCb *cell,RgSchUeCb *ueCb,uint8_t ta)
-{
-
- if (ueCb->dl.taCb.state == RGSCH_TA_IDLE)
- {
- ueCb->dl.taCb.state = RGSCH_TA_TOBE_SCHEDULED;
- ueCb->dl.taCb.numRemSf = 2;
- rgSCHUtlDlTARpt(cell, ueCb);
- /* If TA Timer is running. Stop it */
- if (ueCb->taTmr.tmrEvnt != TMR_NONE)
- {
- rgSCHTmrStopTmr(cell, ueCb->taTmr.tmrEvnt, ueCb);
- }
-
- /* SR_RACH_STATS : TA MODIFIED */
- if (ueCb->dl.taCb.ta != ta)
- {
- rgNumTAModified++;
- }
- ueCb->dl.taCb.ta = ta;
- }
- else
- {
- /* [ccpu00121813]-ADD-Updating outstanding values
- * TA which gets transmitted at N gets applied at UE at N+6,once TA
- * has been scheduled,further TA values get stored in outstndngTaval.
- * Once TA gets applied at UE or when NACK/DTX is rcvd for maxhqretx times
- * then schedule the outstanding TA val if present */
- ueCb->dl.taCb.outStndngTa = TRUE;
- ueCb->dl.taCb.outStndngTaval = ta;
- }
-
- return;
-} /* rgSCHDhmUpdTa */
-
- /** @brief This function handles the TA timer expiry.
- *
- * @details
- *
- * Function: This function handled the TA Expiry.
- *
- * Processing steps:
- * -
- *
- *
- * @param[in] RgSchUeCb *ueCb
- *
- * @return Void
- * -#None.
- */
-Void rgSCHDhmProcTAExp( RgSchUeCb *ueCb)
-{
- /* Ask scheduler to schedule this UE */
- ueCb->dl.taCb.state = RGSCH_TA_TOBE_SCHEDULED;
- rgSCHUtlDlTARpt(ueCb->cell, ueCb);
- return;
-} /* end of rgSCHDhmProcTAExp */
-
-/* 3.1 MIMO: LC details at TB level rather than Hq Level */
-/**
- * @brief Handler for Adding scheduled logical channel data information
- * to harqProc.
- *
- * @details
- *
- * Function : rgSCHDhmAddLcData
- *
- * This function shall add the scheduled logical channel data
- * information to the HARQ process.
- *
- * @param[in] RgSchLchAllocInfo *lchData
- * @param[in] RgSchDlHqTbCb *tbInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHDhmAddLcData(Inst inst,RgSchLchAllocInfo *lchData,RgSchDlHqTbCb *tbInfo)
-{
-
- if(tbInfo->numLch >= RGSCH_MAX_NUM_DED_LC)
- {
- return RFAILED;
- }
-
- tbInfo->lchSchdDataArr[tbInfo->numLch] = *lchData;
-
- tbInfo->numLch++;
-
- return ROK;
-
-} /* rgSCHDhmAddLcData */
-
-#ifdef LTE_TDD
-/*
- * @brief Handler for releaseing the subframe allocation.
- *
- * @details
- *
- * Function : rgSCHDhmTddRlsSubFrm
- *
- * This function shall be invoked to release the DL Sf
- * allocations for which HARQ feedback time has expired.
- *
- * @param[in] RgSchCellCb *cellCb
- * @param[in] CmLteTimingInfo uciTimingInfo;
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHDhmTddRlsSubFrm(RgSchCellCb *cellCb,CmLteTimingInfo uciTimingInfo)
-{
- CmLteTimingInfo dlSfTime;
- RgSchTddDlAscSetIdxK ascIdx;
- uint8_t noFdbks;
- uint8_t i;
-
- ascIdx =
- rgSchTddDlAscSetIdxKTbl[cellCb->ulDlCfgIdx][uciTimingInfo.slot];
- noFdbks = ascIdx.numFdbkSubfrms;
- for(i=0; i < noFdbks; i++)
- {
- /* Get the subframe and sfn for which HARQ Ack/Nack
- * has to be sent */
- /* ccpu00132341-MOD- optimized getting DLSF time using macro*/
- /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper
- * output if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME()
- * as it is serving the purpose */
- RGSCHDECRFRMCRNTTIME(uciTimingInfo, dlSfTime, ascIdx.subfrmNum[i]);
- rgSCHUtlDlRlsSubFrm(cellCb, dlSfTime);
- }
- return ROK;
-}/* rgSCHDhmTddRlsSubFrm */
-
-#ifdef TFU_TDD
-uint32_t macDtx = 0;
-#endif
-/**
- * @brief Handler for Removing the HARQ process from a dlsf.
- *
- * @details
- *
- * Function : rgSCHDhmRlsDlsfHqProc
- *
- * This function shall be invoked for every tti. It goes back to
- * to the sixth last subframe to check whether it still exists. If
- * that exists this function traverses through the entire harq
- * proc list associated and frees up all of them.
- *
- * @param[in] RgSchCellCb *cellCb
- * @param[in] CmLteTimingInfo timingInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHDhmRlsDlsfHqProc(RgSchCellCb *cellCb,CmLteTimingInfo uciTimingInfo)
-{
- RgSchDlSf *dlSf;
- CmLteTimingInfo dlSfTime;
- CmLteTimingInfo nxtfrm = {0,0};
- RgSchDlHqProcCb *tmpHqProc;
- RgSchTddDlAscSetIdxK ascIdx;
- uint8_t noFdbks;
- S16 i;
- RgSchDlSf *nxtDlsf = NULLP;
- CmLList *node;
- CmLList *hqPNode;
- uint8_t idx;
- /*ccpu00130018 -MOD -Initiatizing with FALSE*/
- uint8_t maxRetx=FALSE;
- RgSchTddANInfo *anInfo = NULLP;
- RgSchDlHqTbCb *tbCb;
- RgSchUeCb *ue = NULLP;
-
- ascIdx =
- rgSchTddDlAscSetIdxKTbl[cellCb->ulDlCfgIdx][uciTimingInfo.slot];
- noFdbks = ascIdx.numFdbkSubfrms;
- for(i=0; i < noFdbks; i++)
- {
- /* Get the subframe and sfn for which HARQ Ack/Nack
- * has to be sent */
- /* ccpu00132341-MOD- optimized getting DLSF time using macro*/
- /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper
- * output if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME()
- * as it is serving the purpose */
- RGSCHDECRFRMCRNTTIME(uciTimingInfo, dlSfTime, ascIdx.subfrmNum[i]);
-
- dlSf = rgSCHUtlSubFrmGet (cellCb, dlSfTime);
- if(cellCb->ulDlCfgIdx != 5)
- {
- rgSCHUtlGetNxtDlSfInfo(dlSfTime, cellCb, dlSf, &nxtDlsf, &nxtfrm);
- }
- /* Subframe is present. Delete all the harq associations from
- * this subframe.
- */
-
- /*Handling for Msg4*/
- node = dlSf->msg4HqPLst.first;
- while (node)
- {
- tmpHqProc = (RgSchDlHqProcCb *)(node->node);
- node = node->next;
- tmpHqProc->cwSwpEnabled = FALSE;
- if (HQ_TB_WAITING == tmpHqProc->tbInfo[0].state)
- {
- tbCb = &tmpHqProc->tbInfo[0];
-
- /* Fix : syed MultiUe per TTI crash in TA List. */
- maxRetx = FALSE;
-
- tbCb->dtxCount++;
- tbCb->isAckNackDtx = TFU_HQFDB_DTX;
-
-
- rgSCHUtlDlHqPTbRmvFrmTx(dlSf, tmpHqProc, tbCb->tbIdx, FALSE);
-
- /* Delete the Harq Association. Release the Harq Process */
- rgSCHDhmHqTbTrnsFail(cellCb, tmpHqProc, tbCb->tbIdx, &maxRetx);
-
- if (tbCb->taSnt == TRUE)
- {
- /* [ccpu00127148] Correcting the check */
- if (TRUE == maxRetx)
- {
- tbCb->taSnt = FALSE;
- RGSCH_NULL_CHECK(cellCb->instIdx, ue)
- ue->dl.taCb.state = RGSCH_TA_IDLE;
-
- rgSCHUtlReTxTa(cellCb, ue);
- }
- }
- }
- }
-
- node = dlSf->ueLst.first;
- while (node)
- {
-#ifdef TFU_TDD
- macDtx++;
-#endif
- ue = (RgSchUeCb *)(node->node);
- node = node->next;
- if (NULLP != ue)
- {
- hqPNode = ue->dl.dlSfHqInfo[cellCb->cellId][dlSf->dlIdx].hqPLst.first;
- while (hqPNode)
- {
- tmpHqProc = (RgSchDlHqProcCb *)hqPNode->node;
- hqPNode = hqPNode->next;
- for (idx = 0 ;idx < 2; idx++)
- {
- if (HQ_TB_WAITING == tmpHqProc->tbInfo[idx].state)
- {
- tbCb = &tmpHqProc->tbInfo[idx];
-
- /* Fix : syed MultiUe per TTI crash in TA List. */
- maxRetx = FALSE;
-
- tbCb->dtxCount++;
- tbCb->isAckNackDtx = TFU_HQFDB_DTX;
-
-
- /* Update feedback time for this process so that
- * next subframe its picked up */
-#ifdef LTE_ADV
- uint8_t servCellIdx = rgSchUtlGetServCellIdx(
- tmpHqProc->hqE->cell->instIdx,
- tmpHqProc->hqE->cell->cellId,
- ue);
- anInfo = rgSCHUtlGetUeANFdbkInfo(ue, &tbCb->fdbkTime,servCellIdx);
-#else
- anInfo = rgSCHUtlGetUeANFdbkInfo(ue, &tbCb->fdbkTime,RGSCH_PCELL_INDEX);
-#endif
- if(anInfo == NULLP)
- {
- RGSCHDBGERR(cellCb->instIdx, (rgSchPBuf(cellCb->instIdx),
- "Ack/Nack Info is NULL, Processing %dth feedback slot for DTX"
- "received on SFN [%d] and SF [%d]\n",i, uciTimingInfo.sfn,
- uciTimingInfo.slot));
- }
- else if (tbCb->fbkRepCntr == 0)
- {
- /* Initialise the Ack/Nack feedback */
- anInfo->dlDai--;
- if(!(anInfo->dlDai))
- {
- rgSCHUtlInitUeANFdbkInfo(anInfo);
- }
- }
- else
- {
- /* Update feedback time for this process so that
- * * next subframe its picked up */
- RGSCH_NULL_CHECK(cellCb->instIdx, nxtDlsf);
- RGSCH_UPD_HQAN_FDBKTIME(tbCb, nxtDlsf, nxtfrm);
- RGSCH_UPD_ANINFO_WITH_HQ(anInfo, tbCb);
- rgSCHUtlDlHqPTbRmvFrmTx(dlSf, tmpHqProc, tbCb->tbIdx, TRUE);
- tbCb->fbkRepCntr--;
- continue;
-
- }
- rgSCHUtlDlHqPTbRmvFrmTx(dlSf, tmpHqProc, tbCb->tbIdx, FALSE);
- /*ccpu000119494-ADD- for SPS, call SPS specific DTX handler */
-
- {
- /* Delete the Harq Association. Release the Harq Process */
- rgSCHDhmHqTbTrnsFail(cellCb, tmpHqProc, tbCb->tbIdx, &maxRetx);
- }
- if (tbCb->taSnt == TRUE)
- {
- /* [ccpu00127148] Correcting the check */
- if (TRUE == maxRetx)
- {
- tbCb->taSnt = FALSE;
- RGSCH_NULL_CHECK(cellCb->instIdx, ue)
- ue->dl.taCb.state = RGSCH_TA_IDLE;
-
- rgSCHUtlReTxTa(cellCb, ue);
-
- DU_LOG("\nDEBUG --> SCH : Nack/DTX Rcvd for TA. Max Tries Attempted");
- }
- }
- }
- }
- }
- }
- }
-
- node = dlSf->ackNakRepQ.first;
- while (node)
- {
- tbCb = (RgSchDlHqTbCb *)(node->node);
- tmpHqProc = tbCb->hqP;
- /* [ccpu00121813]-ADD-Fetch ueCb */
- ue = tmpHqProc->hqE->ue;
- /* Fix : syed MultiUe per TTI crash in TA List. */
- maxRetx = FALSE;
-
- tbCb->dtxCount++;
-#ifdef TENB_STATS
- tmpHqProc->hqE->cell->tenbStats->sch.dlDtx[tbCb->tbIdx][tbCb->dlGrnt.rv]++;
- ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(tmpHqProc->hqE->cell)].dlDtxCnt[tbCb->tbIdx] ++;
-#endif
-
- node = node->next;
- /* If This is not the last repetition */
- if (tbCb->fbkRepCntr > 1)
- {
- /* Update feedback time for this process so that
- * next subframe its picked up */
-#ifdef LTE_ADV
- uint8_t servCellIdx = rgSchUtlGetServCellIdx(
- tmpHqProc->hqE->cell->instIdx,
- tmpHqProc->hqE->cell->cellId,
- ue);
- anInfo = rgSCHUtlGetUeANFdbkInfo(ue, &tbCb->fdbkTime,servCellIdx);
-#else
- anInfo = rgSCHUtlGetUeANFdbkInfo(ue, &tbCb->fdbkTime,0);
-#endif
- if(anInfo == NULLP)
- {
- return RFAILED;
- }
- RGSCH_NULL_CHECK(cellCb->instIdx, nxtDlsf);
- RGSCH_UPD_HQAN_FDBKTIME(tbCb, nxtDlsf, nxtfrm);
- RGSCH_UPD_ANINFO_WITH_HQ(anInfo, tbCb);
- rgSCHUtlDlHqPTbRmvFrmTx(dlSf,tmpHqProc,tbCb->tbIdx, TRUE);
- tbCb->fbkRepCntr--;
- continue;
- }
- else
- {
- rgSCHUtlDlHqPTbRmvFrmTx(dlSf,tmpHqProc,tbCb->tbIdx, TRUE);
-
- if (((tbCb->nackCount + tbCb->dtxCount) >= tbCb->ackCount))
- {
- /*even if one NACK, we consider the feedback
- * on a whole as NACk */
- if ( tbCb->nackCount != 0 )
- {
- tbCb->isAckNackDtx = TFU_HQFDB_NACK;
- }
- else
- {
- tbCb->isAckNackDtx = TFU_HQFDB_DTX;
- }
-
- {
- /* Delete the Harq Association. Release the Harq Process */
- rgSCHDhmHqTbTrnsFail(cellCb, tmpHqProc, tbCb->tbIdx, &maxRetx);
- }
- }/*if(((tbCb->nackCount+....*/
- }/*else....*/
-
- if (tbCb->taSnt == TRUE)
- {
- /* [ccpu00127148] Correcting the check */
- if (TRUE == maxRetx)
- {
- tbCb->taSnt = FALSE;
- ue->dl.taCb.state = RGSCH_TA_IDLE;
-
- rgSCHUtlReTxTa(cellCb, ue);
- DU_LOG("\nDEBUG --> SCH : Nack/DTX Rcvd for TA. Max Tries Attempted");
-
- }
- }
- }
- }
- return ROK;
-}/* rgSCHDhmRlsDlsfHqProc */
-#else /* ifdef LTE_TDD */
-/**
- * @brief Handler for Removing the HARQ process from a dlsf.
- *
- * @details
- *
- * Function : rgSCHDhmRlsDlsfHqProc
- *
- * This function shall be invoked for every tti. It goes back to
- * to the sixth last subframe to check whether it still exists. If
- * that exists this function traverses through the entire harq
- * proc list associated and frees up all of them.
- *
- * @param[in] RgSchCellCb *cell
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHDhmRlsDlsfHqProc(RgSchCellCb *cell,CmLteTimingInfo timingInfo)
-{
- RgSchDlSf *sf;
- CmLteTimingInfo frm;
- RgSchDlHqProcCb *tmpHqProc;
- Bool maxRetx;
- CmLList *node;
- CmLList *hqPNode;
- uint8_t idx;
- RgSchDlHqTbCb *tbCb;
- RgSchUeCb *ue;
-
- /* Fetch the current timing info. Modify it to Last sf to be rlsd.*/
- /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper
- * output if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME()
- * as it is serving the purpose */
- RGSCHDECRFRMCRNTTIME(timingInfo, frm, RG_SCH_CMN_HARQ_INTERVAL);
-
-
- /* Get the required Last subframe */
- sf = rgSCHUtlSubFrmGet(cell, frm);
-
- /*CA Dev Start*/
- /*Handling for Msg4*/
- node = sf->msg4HqPLst.first;
- while (node)
- {
- tmpHqProc = (RgSchDlHqProcCb *)(node->node);
- if (HQ_TB_WAITING == tmpHqProc->tbInfo[0].state)
- {
- tbCb = &tmpHqProc->tbInfo[0];
- /* Fix : syed MultiUe per TTI crash in TA List. */
- maxRetx = FALSE;
-
- RGSCHDBGINFO(cell->instIdx, (rgSchPBuf(cell->instIdx),"\n rgSCHDhmRlsDlsfHqProc():\
- txCntr=%d tmpHqProc=%d",tbCb->txCntr,tmpHqProc->procId));
-
- tbCb->dtxCount++;
- if ((tmpHqProc->hqE->msg4Proc == tmpHqProc) ||
- (tmpHqProc->hqE->ccchSduProc == tmpHqProc))
- {
- tbCb->isAckNackDtx = TFU_HQFDB_NACK;
- rgNumMsg4Dtx++;
- }
-
- node = node->next;
- if (tbCb->fbkRepCntr != 0)
- {
- /* Update timingInfo for this hqP so that next subframe its picked up */
- RG_SCH_ADD_TO_CRNT_TIME(tbCb->timingInfo, tbCb->timingInfo, 1);
- rgSCHUtlDlHqPTbRmvFrmTx(sf,tmpHqProc,tbCb->tbIdx, TRUE);
- tbCb->fbkRepCntr--;
- continue;
- }
- rgSCHUtlDlHqPTbRmvFrmTx(sf,tmpHqProc,tbCb->tbIdx, FALSE);
-
- /* Delete the Harq Association. Release the Harq Process */
- rgSCHDhmHqTbTrnsFail(cell, tmpHqProc, tbCb->tbIdx, &maxRetx);
-
- }
- }
- /* Subframe is present. Delete all the harq associations from
- * this subframe.
- */
- node = sf->ueLst.first;
- while (node)
- {
- ue = (RgSchUeCb *)(node->node);
- node = node->next;
- if(ue != NULLP)
- {
- hqPNode = ue->dl.dlSfHqInfo[cell->cellId][sf->dlIdx].hqPLst.first;
-
- while (hqPNode)
- {
- tmpHqProc = (RgSchDlHqProcCb *)hqPNode->node;
- tmpHqProc->cwSwpEnabled = FALSE;
- hqPNode = hqPNode->next;
- for (idx = 0 ;idx < 2; idx++)
- {
- if (HQ_TB_WAITING == tmpHqProc->tbInfo[idx].state)
- {
- tbCb = &tmpHqProc->tbInfo[idx];
- /* Fix : syed MultiUe per TTI crash in TA List. */
- maxRetx = FALSE;
-
- RGSCHDBGINFO(cell->instIdx, (rgSchPBuf(cell->instIdx),"\n rgSCHDhmRlsDlsfHqProc():\
- txCntr=%d tmpHqProc=%d",tbCb->txCntr,tmpHqProc->procId));
-
- tbCb->dtxCount++;
- if ((tmpHqProc->hqE->msg4Proc == tmpHqProc) ||
- (tmpHqProc->hqE->ccchSduProc == tmpHqProc))
- {
- tbCb->isAckNackDtx = TFU_HQFDB_NACK;
- rgNumMsg4Dtx++;
- }
- else
- {
- tbCb->isAckNackDtx = TFU_HQFDB_DTX;
- }
-
- rgSCHUtlDlHqPTbRmvFrmTx(sf,tmpHqProc,idx, FALSE);
-
- {
- /* Delete the Harq Association. Release the Harq Process */
- rgSCHDhmHqTbTrnsFail(cell, tmpHqProc, tbCb->tbIdx, &maxRetx);
- }
- if (tbCb->taSnt == TRUE)
- {
- /* [ccpu00127148] Correcting the check */
- if (TRUE == maxRetx)
- {
- tbCb->taSnt = FALSE;
- ue->dl.taCb.state = RGSCH_TA_IDLE;
-
- rgSCHUtlReTxTa(cell, ue);
- RGSCHDBGINFO(cell->instIdx, (rgSchPBuf(cell->instIdx),
- "Nack/DTX Rcvd for TA. Max Tries Attempted\n"));
- }
- }
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- ueDl->mimoInfo.cwInfo[tbCb->tbIdx].dtxCnt++;
- }
- }
- }
- }
- }
- /*CA Dev End*/
-
- return ROK;
-} /* rgSCHDhmRlsDlsfHqProc */
-#endif
-#ifdef LTEMAC_SPS
-#ifdef RG_UNUSED
-/**
- * @brief This function marks the HARQ process with a given ID as SPS HARQ
- * proc
- *
- * @details
- *
- * Function: rgSCHDhmMarkSpsHqProc
- * Purpose: This function returns the HARQ process with the given ID.
- * Invoked by: SPS Module
- * Processing steps:
- * - Get the HARQ process by index from the UE
- * - Set isSpsHqProc = TRUE
- *
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t idx
- * @return S16
- * -# ROK if successful
- * -# RFAILED otherwise
- *
- **/
-S16 rgSCHDhmMarkSpsHqProc(RgSchUeCb *ue,uint8_t idx)
-{
- RgSchDlHqProcCb *hqP;
-
- /* Pick the proc based on the index provided */
- rgSCHDhmGetHqProcFrmId(ue->cell, ue, idx, &hqP);
-
- return ROK;
-} /* rgSCHDhmMarkSpsHqProc */
-#endif /* RG_UNUSED */
-#endif /* LTEMAC_SPS */
-
-#ifndef LTE_TDD
-/** * @brief Handler for HARQ feedback received for DL AckNack rep enabled UE
- *
- * @details
- *
- * Function : rgSCHDhmProcHqFdbkAckNackRep
- *
- * This function shall act on the feedback received from TOM for DL
- * transmission.
- *
- *
- * @param[in] RgSchDlHqProcCb *hqP
- * @param[in] RgSchDlSf *sf
- * @param[in] uint8_t tbCnt
- * @param[in] uint8_t *isAck
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHDhmProcHqFdbkAckNackRep(RgSchDlHqProcCb *hqP,RgSchDlSf *sf,uint8_t tbCnt,uint8_t *isAck)
-{
- /* Check if this is repeating UE */
- rgSCHUtlDlHqPTbRmvFrmTx(sf, hqP, tbCnt, TRUE);
- /* Check if last repetition */
- if (--hqP->tbInfo[tbCnt].fbkRepCntr)
- {
- /* Update timingInfo for this hqP so that next subframe its picked up */
- RG_SCH_ADD_TO_CRNT_TIME(hqP->tbInfo[tbCnt].timingInfo, \
- hqP->tbInfo[tbCnt].timingInfo, 1);
- return RFAILED;
- }
-
- /* Take decision here based on the number
- * of DTX's,NACK's and ACK's received
- */
- if (((hqP->tbInfo[tbCnt].ackCount) > (hqP->tbInfo[tbCnt].nackCount) +
- (hqP->tbInfo[tbCnt].dtxCount)))
- {
- *isAck = TFU_HQFDB_ACK;
- }
- /*even a single NACK indicates that UE received
- * the transmission.
- */
- else if ( hqP->tbInfo[tbCnt].nackCount != 0 )
- {
- *isAck = TFU_HQFDB_NACK;
- }
- else
- {
- *isAck = TFU_HQFDB_DTX;
- }
-
-
- hqP->tbInfo[tbCnt].isAckNackDtx = *isAck;
- return ROK;
-}
-#endif /* ifndef LTE_TDD */
-
-
-/* Freeing up the HARQ proc blocked for
- * indefinite time in case of Retx */
-/**
- * @brief This function handles the scenario in case Retx allocation is failed.
- *
- * @details
- *
- * Function: rgSCHDhmDlRetxAllocFail
- * Purpose:
- *
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchDlHqProcCb *hqP
- * @return Void
- *
- **/
-S16 rgSCHDhmDlRetxAllocFail(RgSchUeCb *ue,RgSchDlHqProcCb *hqP)
-{
- RgSchCellCb *cell;
- RgInfRlsHqInfo *rlsHqInfo;
- Pst pst;
- Bool maxRetx = FALSE;
- RgSchCmnCell *cellSch;
-
- cell = hqP->hqE->cell;
- cellSch = RG_SCH_CMN_GET_CELL(cell);
- rlsHqInfo = &(cell->rlsHqArr[cell->crntHqIdx]);
-
- /* If retx was attempted for 1st TB, increment its retx alloc fail counter */
- if (hqP->tbInfo[0].state == HQ_TB_NACKED)
- {
- hqP->tbInfo[0].cntrRetxAllocFail++;
- }
-
- /* If retx was attempted for 2nd TB, increment its retx alloc fail counter */
- if (hqP->tbInfo[1].state == HQ_TB_NACKED)
- {
- hqP->tbInfo[1].cntrRetxAllocFail++;
- }
-
- /* initialize MAC-SCH interface HARQ release info */
- rlsHqInfo->numUes = 0;
- rlsHqInfo->ueHqInfo[rlsHqInfo->numUes].numOfTBs = 0;
-
- /* Release HARQ proc for TB1 if Retx alloc failure count has reached max */
- if (hqP->tbInfo[0].cntrRetxAllocFail == RG_SCH_MAX_RETX_ALLOC_FAIL)
- {
- if (hqP->hqE->msg4Proc == hqP)
- {
- hqP->tbInfo[0].txCntr = cell->dlHqCfg.maxMsg4HqTx;
- }
- else
- {
- hqP->tbInfo[0].txCntr = hqP->hqE->maxHqTx;
- }
-
- rgSCHDhmHqTbTrnsFail(cell, hqP, hqP->tbInfo[0].tbIdx, &maxRetx);
-
-#ifdef LTE_L2_MEAS
- if (maxRetx)
- {
- rlsHqInfo->ueHqInfo[rlsHqInfo->numUes].status[\
- rlsHqInfo->ueHqInfo[rlsHqInfo->numUes].numOfTBs] = 0xFF; /* RGU_NACK_LOSS */;
- }
- else
- {
- rlsHqInfo->ueHqInfo[rlsHqInfo->numUes].status[\
- rlsHqInfo->ueHqInfo[rlsHqInfo->numUes].numOfTBs] = FALSE;
- }
-#else
- rlsHqInfo->ueHqInfo[rlsHqInfo->numUes].status[\
- rlsHqInfo->ueHqInfo[rlsHqInfo->numUes].numOfTBs] = FALSE;
-#endif
-
- rlsHqInfo->ueHqInfo[rlsHqInfo->numUes].tbId[\
- rlsHqInfo->ueHqInfo[rlsHqInfo->numUes].numOfTBs] = 1;
- rlsHqInfo->ueHqInfo[rlsHqInfo->numUes].numOfTBs++;
- }
-
- /* Release HARQ proc for TB2 if Retx alloc failure count has reached max */
- if (hqP->tbInfo[1].cntrRetxAllocFail == RG_SCH_MAX_RETX_ALLOC_FAIL)
- {
- if (hqP->hqE->msg4Proc == hqP)
- {
- hqP->tbInfo[1].txCntr = cell->dlHqCfg.maxMsg4HqTx;
- }
- else
- {
- hqP->tbInfo[1].txCntr = hqP->hqE->maxHqTx;
- }
-
- rgSCHDhmHqTbTrnsFail(cell, hqP, hqP->tbInfo[1].tbIdx, &maxRetx);
-
- rlsHqInfo->ueHqInfo[rlsHqInfo->numUes].status[\
- rlsHqInfo->ueHqInfo[rlsHqInfo->numUes].numOfTBs] = FALSE;
- rlsHqInfo->ueHqInfo[rlsHqInfo->numUes].tbId[\
- rlsHqInfo->ueHqInfo[rlsHqInfo->numUes].numOfTBs] = 2;
- rlsHqInfo->ueHqInfo[rlsHqInfo->numUes].numOfTBs++;
- }
-
- /* MS_WORKAROUND for ccpu00122892 Temp fix for erroeneous RETX Harq release by rgSCHCmnDlAllocRetxRb */
-
- if ((hqP->tbInfo[0].state != HQ_TB_NACKED) &&
- (hqP->tbInfo[1].state != HQ_TB_NACKED))
- {
- cellSch->apisDl->rgSCHDlProcRmvFrmRetx(cell, ue, hqP);
- }
-
- /* send HARQ release to MAC */
- if (rlsHqInfo->ueHqInfo[rlsHqInfo->numUes].numOfTBs > 0)
- {
- /* Fix : syed HO UE does not have a valid ue->rntiLnk */
- rlsHqInfo->ueHqInfo[rlsHqInfo->numUes].rnti = ue->ueId;
- rlsHqInfo->ueHqInfo[rlsHqInfo->numUes].hqProcId = hqP->procId;
- rlsHqInfo->numUes = 1;
-
- rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], cell->macInst);
- RgSchMacRlsHq(&pst, rlsHqInfo);
- }
-
- return ROK;
-}
-
-#ifdef DL_LA
-static S16 rgSCHDhmUpdateAckNackHistory(RgSchCellCb *cell,RgSchUeCb *ueCb,uint8_t hqfdbk,uint8_t tbCnt)
-{
- RgSchCmnDlUe *ueDl;
-
- ueDl = RG_SCH_CMN_GET_DL_UE(ueCb,cell);
-
- /*
- * If fdbk is ack update totalNoOfAck and ackNackHistory for
- * current idx
- */
- if (hqfdbk == TFU_HQFDB_ACK)
- {
- ueDl->laCb[tbCnt].deltaiTbs += DL_LA_STEPUP;
- }
- else
- {
- ueDl->laCb[tbCnt].deltaiTbs = ueDl->laCb[tbCnt].deltaiTbs - DL_LA_STEPDOWN;
- }
- /*
- printf("\nDEBUG --> SCH: deltaiTbs[%d] cqibasediTbs[%d] iTbs[%d] tbCnt[%d]\n",
- ueDl->laCb[tbCnt].deltaiTbs, ueDl->laCb[tbCnt].cqiBasediTbs,
- (ueDl->laCb[tbCnt].deltaiTbs + ueDl->laCb[tbCnt].cqiBasediTbs)/100,
- tbCnt);
- */
- rgSCHDhmUpdBlerBasediTbsEff(cell, ueCb, tbCnt);
-
- return ROK;
-}
-
-S16 rgSCHDhmUpdBlerBasediTbsEff(RgSchCellCb *cell,RgSchUeCb *ueCb,uint8_t tbCnt)
-{
- S32 iTbs;
- RgSchCmnDlUe *ueDl;
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- uint8_t cfi = cellSch->dl.currCfi;
- uint8_t maxiTbs = (*(RgSchCmnCqiToTbs *)(cellSch->dl.cqiToTbsTbl[0][cfi]))[RG_SCH_CMN_MAX_CQI - 1];
- maxiTbs = RG_SCH_DL_MAX_ITBS;
-
- ueDl = RG_SCH_CMN_GET_DL_UE(ueCb,cell);
- iTbs = (ueDl->laCb[tbCnt].deltaiTbs + ueDl->laCb[tbCnt].cqiBasediTbs)/100;
-
- if (iTbs > maxiTbs)
- {
- ueDl->laCb[tbCnt].deltaiTbs = (maxiTbs * 100) - ueDl->laCb[tbCnt].cqiBasediTbs;
- ueDl->mimoInfo.cwInfo[tbCnt].iTbs[0] = RGSCH_MIN(maxiTbs, ueCb->cell->thresholds.maxDlItbs);
- }
- else if (iTbs < 0)
- {
- ueDl->laCb[tbCnt].deltaiTbs = -(ueDl->laCb[tbCnt].cqiBasediTbs);
- ueDl->mimoInfo.cwInfo[tbCnt].iTbs[0] = 0;
- }
- else
- {
- ueDl->mimoInfo.cwInfo[tbCnt].iTbs[0] = RGSCH_MIN(((ueDl->laCb[tbCnt].cqiBasediTbs +\
- ueDl->laCb[tbCnt].deltaiTbs)/100),
- ueCb->cell->thresholds.maxDlItbs);
- }
-#ifdef RG_5GTF
- ueCb->ue5gtfCb.mcs = ueDl->mimoInfo.cwInfo[tbCnt].iTbs[0];
-#endif
- ueDl->mimoInfo.cwInfo[tbCnt].iTbs[1] = ueDl->mimoInfo.cwInfo[tbCnt].iTbs[0];
-
- /* Eff for CW for 1 Layer Tx */
- ueDl->mimoInfo.cwInfo[tbCnt].eff[0] =
- (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[0][cfi]))\
- [ueDl->mimoInfo.cwInfo[tbCnt].iTbs[0]];
-
- /* Eff for CW for 2 Layer Tx */
- ueDl->mimoInfo.cwInfo[tbCnt].eff[1] =
- (*(RgSchCmnTbSzEff *)(cellSch->dl.cqiToEffTbl[1][cfi]))\
- [ueDl->mimoInfo.cwInfo[tbCnt].iTbs[1]];
-
- return ROK;
-}
-#endif
-
-#ifdef LTE_TDD
-/**
- * @brief This function Processes the Hq Fdbk in case of
- * special Bundling in TDD (FAPIv1.1: Table 79)
- *
- * @details
- *
- * Function: rgSCHDhmPrcSplBundlFdbk
- * Purpose: To Interpret the Harq Feedback according to
- * table 7.3-1: 36.213
- *
- * 0 = 0 or None (UE detect at least one DL is missed)
- * 1 = 1 or 4 or 7 ACKs reported
- * 2 = 2 or 5 or 8 ACKs reported
- * 3 = 3 or 6 or 9 ACKs reported
- * 4 = DTX (UE did not transmit anything)
- *
- * @param[in] TfuHqInfo *fdbk
- * @param[in] uint8_t hqCnt
- * @return Void
- *
- **/
-static Void rgSCHDhmPrcSplBundlFdbk(RgSchCellCb *cell,TfuHqInfo *fdbk,uint8_t hqCnt)
-{
- uint8_t numOfAcks;
-
- /* Num of ACKs reported by UE */
- numOfAcks = fdbk->isAck[0];
-
- if(fdbk->isAck[0] == TFU_HQFDB_NACK ||
- fdbk->isAck[0] == TFU_HQFDB_DTX)
- {
- /* NACK/DTX CASE */
- }
- else
- {
- RGSCH_ARRAY_BOUND_CHECK(cell->instIdx,
- rgSchNumOfAcksToAckNack[(hqCnt-1)], (numOfAcks - 1));
-
- fdbk->isAck[0] = rgSchNumOfAcksToAckNack[(hqCnt-1)]
- [(numOfAcks-1)];
- }
- /* The Hq Fdbk is a combined Ack/Nack for multiple Codewords within
- the PDSCH trasnmission (spatial bundling). So we have
- to assume same feedback for both codewords */
-#ifdef LTE_ADV
- for(uint8_t idx = 1 ; idx < TFU_MAX_HARQ_FDBKS; idx++)
- {
- fdbk->isAck[idx] = fdbk->isAck[0];
- }
-#else
- fdbk->isAck[1] = fdbk->isAck[0];
-#endif
-
- return;
-}
-#endif
-
-/**
- * @brief This function adds HARQ process to FREE list
- *
- * @details
- *
- * Function: rgSCHDhmHqPAdd2FreeLst
- * Purpose:
- *
- * Invoked by: scheduler
- *
- * @param[out] RgDlHqProc *hqP
- * @return Void
- *
- **/
-Void rgSCHDhmHqPAdd2FreeLst(RgSchDlHqProcCb *hqP)
-{
-
-#ifdef LAA_DBG
- if (hqP->hqPLst)
- {
- int *p = NULL;
- printf("\nDEBUG --> SCH: Crashing already part of free lst\n");
- printf("\nDEBUG --> SCH: Crashing %d \n", *p);
- *p = 10;
- }
-#endif
- cmLListAdd2Tail(&hqP->hqE->free, &hqP->lnk);
- hqP->hqPLst = &hqP->hqE->free;
-
-
-#ifdef LAA_DBG
- if (hqP->hqE->free.count > 8)
- {
- int *p = NULL;
- printf("\nDEBUG --> SCH: Crashing invalid hq count\n");
- printf("\nDEBUG --> SCH: Crashing %d \n", *p);
- *p = 10;
- }
-#endif
-
-#ifdef LTE_ADV
- rgSCHLaaHndlHqProcFree(hqP);
-#endif
-
- return;
-} /* rgSCHDhmHqPAdd2FreeLst */
-
-
-/**
- * @brief This function adds HARQ process to inUse list
- *
- * @details
- *
- * Function: rgSCHDhmHqPAdd2InUseLst
- * Purpose:
- *
- * Invoked by: scheduler
- *
- * @param[out] RgDlHqProc *hqP
- * @return Void
- *
- **/
-Void rgSCHDhmHqPAdd2InUseLst(RgSchDlHqProcCb *hqP)
-{
-
-#ifdef LAA_DBG
- if (hqP->hqPLst)
- {
- int *p = NULL;
- printf("\nDEBUG --> SCH: Crashing already part of inuse lst\n");
- printf("\nDEBUG --> SCH: Crashing %d \n", *p);
- *p = 10;
- }
-#endif
- cmLListAdd2Tail(&hqP->hqE->inUse, &hqP->lnk);
- hqP->hqPLst = &hqP->hqE->inUse;
-
-
-#ifdef LAA_DBG
- if (hqP->hqE->inUse.count > 8)
- {
- int *p = NULL;
- printf("\nDEBUG --> SCH: Crashing invalid hq count \n");
- printf("\nDEBUG --> SCH: Crashing %d \n", *p);
- *p = 10;
- }
-#endif
-
- return;
-} /* rgSCHDhmHqPAdd2InUseLst */
-
-/**
- * @brief This function adds HARQ process to FREE list
- *
- * @details
- *
- * Function: rgSCHDhmHqPDelFrmFreeLst
- * Purpose:
- *
- * Invoked by: scheduler
- *
- * @param[out] RgDlHqProc *hqP
- * @return Void
- *
- **/
-Void rgSCHDhmHqPDelFrmFreeLst(RgSchDlHqProcCb *hqP)
-{
-
-#ifdef LAA_DBG
- if (!hqP->hqPLst)
- {
- int *p = NULL;
- printf("\nDEBUG --> SCH: Crashing not part of any lst\n");
- printf("\nDEBUG --> SCH: Crashing %d \n", *p);
- *p = 10;
- }
-#endif
-#ifdef LAA_DBG
- if (hqP->hqPLst != &hqP->hqE->free)
- {
- int *p = NULL;
- printf("\nDEBUG --> SCH: Crashing del from wrong lst\n");
- printf("\nDEBUG --> SCH: Crashing %d \n", *p);
- *p = 10;
- }
-#endif
-
- cmLListDelFrm(&hqP->hqE->free, &hqP->lnk);
- hqP->hqPLst = NULLP;
-
-#ifdef LAA_DBG
- if (hqP->hqE->free.count > 8)
- {
- int *p = NULL;
- printf("\nDEBUG --> SCH: Crashing invalid hq count\n");
- printf("\nDEBUG --> SCH: Crashing %d \n", *p);
- *p = 10;
- }
-#endif
-
- return;
-} /* rgSCHDhmHqPDelFrmFreeLst */
-
-
-
-/**
- * @brief This function adds HARQ process to FREE list
- *
- * @details
- *
- * Function: rgSCHDhmHqPDelFrmInUseLst
- * Purpose:
- *
- * Invoked by: scheduler
- *
- * @param[out] RgDlHqProc *hqP
- * @return Void
- *
- **/
-Void rgSCHDhmHqPDelFrmInUseLst(RgSchDlHqProcCb *hqP)
-{
-
-#ifdef LAA_DBG
- if (!hqP->hqPLst)
- {
- int *p = NULL;
- printf("\nDEBUG --> SCH: Crashing not part of any lst\n");
- printf("\nDEBUG --> SCH: Crashing %d \n", *p);
- *p = 10;
-
- }
-#endif
-#ifdef LAA_DBG
- if (hqP->hqPLst != &hqP->hqE->inUse)
- {
- int *p = NULL;
- printf("\nDEBUG --> SCH: Crashing del from wrong lst\n");
- printf("\nDEBUG --> SCH: Crashing %d \n", *p);
- *p = 10;
- }
-#endif
-
- cmLListDelFrm(&hqP->hqE->inUse, &hqP->lnk);
- hqP->hqPLst = NULLP;
-
-#ifdef LAA_DBG
- if (hqP->hqE->inUse.count > 8)
- {
- int *p = NULL;
- printf("\nDEBUG --> SCH: Crashing invalid hq count\n");
- printf("\nDEBUG --> SCH: Crashing %d \n", *p);
- *p = 10;
- }
-#endif
-
- return;
-} /* rgSCHDhmHqPDelFrmInUseLst */
-
-\f
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for DRX realted functions
-
- File: rg_sch_drx.c
-
-**********************************************************************/
-
-/** @file rg_sch_drx.c
-@brief This file implements the DRX processing .
-*/
-
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "lrg.h"
-#include "rgr.h"
-#include "rgm.h"
-#include "tfu.h"
-#include "rg_env.h"
-#include "rg_sch_inf.h"
-#ifdef LTEMAC_PH3_HDFDD
-#include "rg_sch_hdfdd.h"
-#endif /*LTEMAC_PH3_HDFDD*/
-#include "rg_sch.h"
-#include "rg_sch_err.h"
-#include "rg_sch_cmn.h"
-
-/* header/extern include files (.x) */
-#include "tfu.x" /* TFU types */
-#include "lrg.x" /* layer management typedefs for MAC */
-#include "rgr.x" /* layer management typedefs for MAC */
-#include "rgm.x" /* layer management typedefs for MAC */
-#include "rg_sch_inf.x" /* typedefs for Scheduler */
-#ifdef LTEMAC_PH3_HDFDD
-#include "rg_sch_hdfdd.x"
-#endif /*LTEMAC_PH3_HDFDD*/
-
-#include "rg_sch.x" /* typedefs for Scheduler */
-#include "rg_sch_cmn.x"
-
- /**
- * @file rg_sch_drx.c This file gives the describes the design for DRX feature.
- *
- * DRX is Discontinuous Reception i.e. the UE in order to save some battery
- * would not monitor (decode) PDCCHs at all times. Instead the UE is configured
- * with a periodically occuring duration wherein it shall monitor PDCCHs. The UE
- * can be called ACTIVE at this time, this time is a minimum of a configurable
- * value - onDuration and a maximum of Infinity.
- *
- * ACTIVE time MIN (onDuration) MAX (infinity)
- *
- * A sample configuration is periodicity of 10 subframes (ms) and an offset
- * value of 3. This can be represented as the diagram given below. The portion
- * marked as ACTIVE is the onDuration and the UE monitors PDCCHs.
- *
- * @code
- *
- * <-ACTIVE-><---IN-ACTIVE------><-ACTIVE-><---IN-ACTIVE--
- *
- * |__|__|__|--------|__|__|__|__|__|__|__|--------|__|__|__|__|__|
- * 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
- *
- * @endcode
- */
-#ifdef LTE_TDD
-/******************************************************************************
- * Structure definitions for TDD *
- ******************************************************************************/
-
-/** @brief : No of DL subframes in a particular TDD configuration
- *
- * @details : Special subframes in TDD can carry PDCCH if configured
- * for DwPTS. For normal CP with subframe configruation (0-8)
- * & extended CP with subframe configuration (0-6), Special
- * Subframes can carry PDCCH and are represented in row 0.
- * Extended CP with subframe configuraton (7-8), which do
- * not carry PDCCH are represented in row 1.
- * rgSchDrxDlSfTddCfg[1][2] represent number of DL subframes
- * in TDD config 2 where DwPTS can carry PDCCH and
- * rgSchDrxDlSfTddCfg[0][2] represent number of DL subframes
- * in TDD config 2 where no DwPTS exits.
- */
-
-static uint8_t rgSchDrxDlSfTddCfg[RGSCH_MAX_SFCFG][RGSCH_MAX_TDD_CFG] =
-{
- {2,4,6,6,7,8,3},
- {4,6,8,7,8,9,5}
-};
-
-/** @brief : No of DL subframes till next SFN from a particular subframe
- *
- * @details :For a given Special subframe config
- * (refer rgSchDrxDlSfTddCfg for an explanation) and given
- * TDD config, how many DL subframes till Next SFN from this
- * subframe onwards.
- *
- */
-
-static uint8_t rgSchDrxDLSfTillNxtSFN[RGSCH_MAX_SFCFG][RGSCH_MAX_TDD_CFG]
- [RGSCH_NUM_SUB_FRAMES]=
-{
- {
- {2,1,1,1,1,1,0,0,0,0},
- {4,3,3,3,3,2,1,1,1,1},
- {6,5,5,5,4,3,2,2,2,1},
- {6,5,5,5,5,5,4,3,2,1},
- {7,6,6,6,6,5,4,3,2,1},
- {8,7,7,7,6,5,4,3,2,1},
- {3,2,2,2,2,2,1,1,1,1}
-
- },
- {
- {4,3,2,2,2,2,1,0,0,0},
- {6,5,4,4,4,3,2,1,1,1},
- {8,7,6,6,5,4,3,2,1,1},
- {7,6,5,5,5,5,4,3,2,1},
- {8,7,6,6,6,5,4,3,2,1},
- {9,8,7,7,6,5,4,3,2,1},
- {5,4,3,3,3,3,2,1,1,1}
- }
-}; /*rgSchDrxDLSfTillNxtSFN*/
-
-
-/** @brief : Lookup table for DL subframe given the number of subframes
- *
- * @details :For a given Special subframe config
- * (refer rgSchDrxDlSfTddCfg for an explanation) and given
- * TDD config, the DL subframe index given the number of subframes
- *
- */
-
-static uint8_t rgSchDrxDLSftoDLSfIdx[RGSCH_MAX_SFCFG][RGSCH_MAX_TDD_CFG]
- [RGSCH_NUM_SUB_FRAMES]=
-{
- {
- {5,0},
- {9,0,4,5},
- {9,0,3,4,5,8},
- {9,0,5,6,7,8},
- {9,0,4,5,6,7,8},
- {9,0,3,4,5,6,7,8},
- {9,0,5}
- },
- {
- {6,0,1,5},
- {9,0,1,4,5,6},
- {9,0,1,3,4,5,6,8},
- {9,0,1,5,6,7,8},
- {9,0,1,4,5,6,7,8},
- {9,0,1,3,4,5,6,7,8},
- {9,0,1,5,6}
- }
-};/* rgSchdrxDLSftoDLSfIdx*/
-/* ccpu00134196-[Add]-DRX retx timer changes */
-/* The k+4 th subframe in TDD at which HARQ RTT expires may be an Uplink SF.
- In such case, the drx retx timer may start at the next pdcch sf instead
- of at k+4 itself */
-uint8_t rgSchDrxHarqRetxFirstPsf[RGSCH_MAX_TDD_CFG][RGSCH_NUM_SUB_FRAMES] = {
- {0, 0, 4, 0, 6, 0, 0, 4, 0, 6},
- {0, 0, 4, 6, 0, 0, 0, 4, 6, 0},
- {0, 0, 4, 0, 0, 0, 0, 4, 0, 0},
- {0, 0, 4, 4, 4, 0, 0, 0, 0, 0},
- {0, 0, 4, 4, 0, 0, 0, 0, 0, 0},
- {0, 0, 4, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 4, 6, 5, 0, 0, 4, 7, 0},
-};
-#endif /* LTE_TDD */
-
-/******************************************************************************
- * Start of Function declarations *
- ******************************************************************************/
-static Void rgSCHDrxTtiHdlOnDurUl ARGS((
-RgSchCellCb *cell,
-uint16_t ulIndex
-));
-static Void rgSCHDrxTtiHdlOnDurDl ARGS((
-RgSchCellCb *cell,
-uint16_t dlIndex
-));
-static Void rgSCHDrxTtiHdlDlHarqRTT ARGS((
-RgSchCellCb *cell,
-uint16_t dlIndex
-));
-static Void rgSCHDrxTtiHdlUlHarqRTT ARGS((
-RgSchCellCb *cell,
-uint16_t ulIndex
-));
-static S16 rgSCHDrxTtiHdlOnDur ARGS((RgSchCellCb *cellCb, uint16_t dlIndex,
- uint16_t ulIndex));
-static S16 rgSCHDrxTtiHdlInActv ARGS((RgSchCellCb *cellCb, uint16_t dlIndex,
- uint16_t ulIndex));
-static S16 rgSCHDrxTtiHdlShortCycle ARGS((RgSchCellCb *cell, uint16_t dlIndex,
- uint16_t ulIndex));
-static S16 rgSCHDrxTtiHdlDlHarq ARGS((RgSchCellCb *cellCb, uint16_t dlIndex,
- uint16_t ulIndex));
-static S16 rgSCHDrxCpyUeCfg ARGS((RgSchDrxUeCb *drxCb,
- RgrUeDrxCfg* ueDrxCfg));
-
-static S16 rgSCHDrxGetNxtOnDur ARGS((RgSchCellCb* cell,RgSchDrxUeCb* drxCb,
- CmLteTimingInfo* nxtOnDur,
- uint8_t delta));
-
-static Void rgSCHDrxMvToNxtOnDurOcc ARGS((RgSchCellCb* cell,
- RgSchUeCb* ue,
- uint16_t idx,
- Bool calcFrmOffst));
-#ifdef LTE_TDD
-static Void rgSCHDrxCalcNxtTmrExpry ARGS((RgSchCellCb *cell,
- RgSchUeCb *ue,
- uint16_t delta,
- uint32_t tmrLen,
- S16 *distance,
- uint16_t *idx
- ));
-static S16 rgSCHDrxGetNxtTmrExpry ARGS((RgSchCellCb *cell,uint16_t curTime,
- uint32_t duration,
- CmLteTimingInfo* tmrExpryIdx));
-#endif /* LTE_TDD */
-#ifdef EMTC_ENABLE
-S16 rgSCHEmtcDrxCpyUeCfg
-(
- RgSchUeCb *ueCb,
- RgrUeDrxCfg *drxCfg
-);
-S16 rgSCHDrxTtiHdlUlHarq
-(
-RgSchCellCb *cell,
-uint16_t dlIndex,
-uint16_t ulIndex
-);
-Void rgSCHDrxUeUlHqReset
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgUeUlHqCb *hqE
-);
-
-#endif
-
-/** @brief This function handles the per TTI handling of the DRX module.
- * Invoked by rgSCHTti @sa rgSCHTti.
- *
- * @details This function goes through the drxQ and marks the UE as ACTIVE or
- * INACTIVE based on the timers and thier status.
- *
- * Function: rgSCHDrxTtiInd
- *
- * Processing steps:
- * - Processing is divided into respective timer handling.
- * - Calculate the DL and UL indices as follows
- * @code
- * dlIndex = (cell->crntTime.sfn * 10 + cell->crntTime.slot +
- * RG_SCH_DRX_DL_DELTA) % RG_SCH_MAX_DRXQ_SIZE;
- *
- * ulIndex = (cell->crntTime.sfn * 10 + cell->crntTime.slot +
- * RG_SCH_DRX_UL_DELTA) % RG_SCH_MAX_DRXQ_SIZE;
- * @endcode
- * - Call rgSCHDrxTtiHdlOnDur to handle onDurationTimer handling
- * - Call rgSCHDrxTtiHdlInActv to handle drx-InactivityTimer handling
- * - Call rgSCHDrxTtiHdlShortCycle to handle Short cycle timer.
- * - Call rgSCHDrxTtiHdlDlHarq to handle HARQ RTT and drx-retransmission
- * timers.
- * - Call rgSchDrxTtiHdlUlHarq to handle Uplink HARQ processing -
- * related to ACTIVITY when a UE is expecting a grant for an uplink
- * re-transmissions.
- * - Post this processing the ueCb->dlInactvMask's DRX Bit shall be set
- * or reset to denote ACTIVITY or INACTIVITY respectively.
- * - Post this processing the ueCb->ulInactvMask's DRX Bit shall be set
- * or reset to denote ACTIVITY or INACTIVITY respectively.
- * - Add the UE to the list of Active/inactive UEs.
- *
- * @param RgSchCellCb *cell
- * @param [out] CmLListCp *dlInactvLst List to which the DL in-active UEs are
- * added*
- * @return
- */
-Void rgSCHDrxTtiInd(RgSchCellCb *cell)
-{
- uint16_t dlIndex;
- uint16_t ulIndex;
-
- dlIndex = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G + cell->crntTime.slot +
- RG_SCH_DRX_DL_DELTA) % RG_SCH_MAX_DRXQ_SIZE;
-
- ulIndex = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G + cell->crntTime.slot +
- RG_SCH_DRX_UL_DELTA) % RG_SCH_MAX_DRXQ_SIZE;
-
-#ifdef LTEMAC_R9
- rgSCHDrxTtiHdlDlHarq (cell, dlIndex, ulIndex);
- /* checks the Ul-Retransmission timer */
-#ifdef EMTC_ENABLE
- if(cell->emtcEnable)
- {
- rgSCHDrxTtiHdlUlHarq (cell, dlIndex, ulIndex);
- }
-#endif
- rgSCHDrxTtiHdlInActv(cell, dlIndex, ulIndex);
-
- /*Process Short cycle expiry before On duration timer so that long cycles
- * On Duration can be processed if timer has expired*/
- rgSCHDrxTtiHdlShortCycle (cell, dlIndex, ulIndex);
- rgSCHDrxTtiHdlOnDur(cell, dlIndex, ulIndex);
-
-#else /*LTEMAC_R9*/
- rgSCHDrxTtiHdlOnDur(cell, dlIndex, ulIndex);
- rgSCHDrxTtiHdlDlHarq (cell, dlIndex, ulIndex);
- /* checks the Ul-Retransmission timer */
-#ifdef EMTC_ENABLE
- if(cell->emtcEnable)
- {
- rgSCHDrxTtiHdlUlHarq (cell, dlIndex, ulIndex);
- }
-#endif
- rgSCHDrxTtiHdlInActv(cell, dlIndex, ulIndex);
- rgSCHDrxTtiHdlShortCycle (cell, dlIndex, ulIndex);
-
-#endif /*LTEMAC_R9*/
-
- return;
-
-}/*rgSCHDrxTtiInd*/
-
-/** @brief This function is called to handle onDurationTimer per TTI processing.
- *
- * @details
- * Invoked by - rgSCHDrxTtiInd
- *
- * Function: rgSCHDrxTtiHdlOnDur
- *
- * Processing steps:
- *
- * - OnDurationTimer is handled using the drxQ @sa RgSchDrxQ
- *
- * - For Downlink we shall look at an index that is
- * n + RG_SCH_DRX_DL_DELTA.
- *
- *
- * - For Uplink we shall look at an index that is
- * n + RG_SCH_DRX_UL_DELTA as
- * we are concerned with the PDCCH and not the actual PUSCH.
- *
- *
- * @param RgSchCellCb *cellCb
- * @param uint16_t dlIndex
- * @param uint16_t ulIndex
- * @return ROK/RFAILED
- */
-
-static S16 rgSCHDrxTtiHdlOnDur(RgSchCellCb *cell,uint16_t dlIndex,uint16_t ulIndex)
-{
-
-#if ( ERRCLASS & ERRCLS_INT_PAR )
- if ( cell == (RgSchCellCb* )NULLP )
- {
- return RFAILED;
- }
-#endif
-
- rgSCHDrxTtiHdlOnDurDl(cell,dlIndex);
-
- rgSCHDrxTtiHdlOnDurUl(cell, ulIndex);
-
- return ROK;
-
-}/*rgSCHDrxTtiHdlOnDur*/
-
-
-/** @brief This function handles the processing for drxInactityTimer per TTI
- *
- * @details
- * Invoked by - rgSCHDrxTtiInd
- *
- * Function: rgSCHDrxTtiHdlInActv
- *
- * Processing steps:
- *
- * - For Downlink we shall look at an index that is
- * n + RG_SCH_DRX_DL_DELTA of the drxQ.
- *
- * - MARK UE AS INACTIVE BASED ON DRX-INACTIVITY TIMER EXPIRY
- *
- *
- * - For Uplink we shall look at an index that is
- * n + RG_SCH_DRX_UL_DELTA as
- * we are concerned with the PDCCH and not the actual PUSCH.
- *
- *
- * @param RgSchCellCb *cellCb
- * @param uint16_t dlIndex
- * @param uint16_t ulIndex
- * @return ROK/RFAILED
- */
-
-S16 rgSCHDrxTtiHdlInActv(RgSchCellCb *cell,uint16_t dlIndex,uint16_t ulIndex)
-{
- CmLList *node;
- RgSchDRXCellCb *drxCell=NULLP;
- RgSchUeCb *ue=NULLP;
- RgSchDrxUeCb *drxUe=NULLP;
- uint16_t shrtCycleExpIndx;
- CmLListCp dlInactvLst; /* list of UE's becoming DL-inactive */
- CmLListCp ulInactvLst; /* list of UE's becoming UL-inactive */
- RgSchCmnCell *cellSch = NULLP;
- Bool delInUlScan = FALSE;
-
-#if ( ERRCLASS & ERRCLS_INT_PAR )
- if ( cell == (RgSchCellCb* )NULLP)
- {
- return RFAILED;
- }
-#endif
-
-
- drxCell = (cell->drxCb);
- delInUlScan = drxCell->delInUlScan;
-
-
- /***********************************************************
- * Scanning inActvitiyQ in DL
- ***********************************************************/
-
- /* The DL loop will scan for UE's whose inactivity timer has
- * expired. It will switch the cycle to short or long based
- * on the cycle configured.
- * Furhter,if !delInUlScan, then will remove the UE from the
- * inactivity q.
- */
-
- node = drxCell->drxQ[dlIndex].inActvTmrQ.first;
-
- /* Initialize DL inactive list */
- cmLListInit(&dlInactvLst);
-
- /* Initialize UL inactive list */
- cmLListInit(&ulInactvLst);
-
- while (node)
- {
- ue = (RgSchUeCb*)node->node;
- node = node->next;
- drxUe = RG_SCH_DRX_GET_UE(ue);
-
- if ( delInUlScan == TRUE)
- {
- drxUe->drxInactDistance--;
- }
-
- if ( drxUe->drxInactDistance != DRX_TMR_EXPRD )
- {
- continue;
- }
-
- /* UE is inactive as inactivity timer has expired */
- drxUe->drxDlInactvMask |= RG_SCH_DRX_INACTVTMR_BITMASK;
-
-
- /* update the ue mask only if no condition in drx
- * is keeping ue active
- */
- if ( !RG_SCH_DRX_DL_IS_UE_ACTIVE(drxUe))
- {
- /* set the UE has DRX inactive */
- ue->dl.dlInactvMask |= RG_DRX_INACTIVE;
-
- /* Add to DL inactive list */
- cmLListAdd2Tail(&dlInactvLst,&(ue->dlDrxInactvLnk));
- ue->dlDrxInactvLnk.node = (PTR)ue;
- }
-
- /*Remove from the queue if !delInUlScan */
- if( delInUlScan == FALSE )
- {
- cmLListDelFrm(&(drxCell->drxQ[dlIndex].inActvTmrQ),
- &(drxUe->inActvTmrEnt));
-
- drxUe->drxInactvIndx = DRX_INVALID;
-
- }/* if (delInUlScan == FALSE) */
-
- if (drxUe->isShortCycleCfgd)
- {
- /* add shorty cycle expirty */
- drxUe->isLongCycle = FALSE;
-
- shrtCycleExpIndx = (dlIndex + (drxUe->shortCycleTmrLen *
- drxUe->shortDrxCycle)) % RG_SCH_MAX_DRXQ_SIZE;
-
- drxUe->drxShortCycleDistance = (drxUe->shortCycleTmrLen *
- drxUe->shortDrxCycle) / RG_SCH_MAX_DRXQ_SIZE;
-
- /*Remove the UE from existing index*/
- if (drxUe->shortCycleIndx != DRX_INVALID)
- {
- cmLListDelFrm(&(drxCell->drxQ[drxUe->shortCycleIndx].shortCycleQ),
- &(drxUe->shortCycleEnt));
- }
-
- cmLListAdd2Tail(&(drxCell->drxQ[shrtCycleExpIndx].shortCycleQ),
- &(drxUe->shortCycleEnt));
-
- drxUe->shortCycleEnt.node = (PTR)ue;
- drxUe->shortCycleIndx = shrtCycleExpIndx;
-
- /*Calculate onDuration again & move the
- * ueCb to the next Onduration occurence
- */
-
- /*we maybe at any position in the RF timeline,
- * need to calculate onDuration from the starting
- * offset
- */
- rgSCHDrxMvToNxtOnDurOcc(cell,ue,RG_SCH_DRX_DL_DELTA,TRUE);
-
- }/*isShortCycleCfgd */
- else
- {
- /* use the long cycle */
- drxUe->isLongCycle = TRUE;
- }/*isLongCycle*/
- }/*while(node) */
-
-
-
- /***********************************************************
- * Scanning inActvitiyQ in UL
- ***********************************************************/
-
- /* The UL loop will scan for UE's whose inactivity timer has
- * expired and mark the UE's UL inactive.
- * Furhter,if delInUlScan, then will remove the UE from the
- * inactivity q.
- */
-
- /* For Uplink we shall look at an index that is n + RG_SCH_DRX_UL_DELTA as
- we are concerned with the PDCCH and not the actual PUSCH.*/
-
-
-
- node = drxCell->drxQ[ulIndex].inActvTmrQ.first;
-
-
- while (node)
- {
- ue = (RgSchUeCb*)node->node;
- node = node->next;
- drxUe = RG_SCH_DRX_GET_UE(ue);
-
- if ( delInUlScan == FALSE)
- {
- drxUe->drxInactDistance--;
- }
-
- if ( drxUe->drxInactDistance != DRX_TMR_EXPRD )
- {
- continue;
- }
-
- /* Need to mark the UE as inactive due to expiry of
- * DRX inactivity timer */
-
- /* UE is inactive as inactivity timer has expired */
- drxUe->drxUlInactvMask |= RG_SCH_DRX_INACTVTMR_BITMASK;
-
- /* update the ue mask only if no other condition in
- * drx is keeping ue active */
-
- if (!RG_SCH_DRX_UL_IS_UE_ACTIVE(drxUe))
- {
- /* set the inactivity bit */
- ue->ul.ulInactvMask |= RG_DRX_INACTIVE;
-
- /* Add to Ul inactive list */
- cmLListAdd2Tail(&ulInactvLst,&(ue->ulDrxInactvLnk));
- ue->ulDrxInactvLnk.node = (PTR)ue;
- }
-
- if ( delInUlScan == TRUE)
- {
- /* remove from queue */
- cmLListDelFrm(&(drxCell->drxQ[ulIndex].inActvTmrQ),
- &(drxUe->inActvTmrEnt));
-
- drxUe->drxInactvIndx = DRX_INVALID;
-
- }/* if ( delInUlScan == TRUE) */
- }/*while(node) for uplink */
-
-
- /* Send the list to the scheduler to mark UE as inactive in UL*/
- cellSch = RG_SCH_CMN_GET_CELL(cell);
- cellSch->apisUl->rgSCHUlInactvtUes(cell, &ulInactvLst);
-
- /* Send the DL inactive list to the scheduler to mark UE as inactive */
- cellSch = RG_SCH_CMN_GET_CELL(cell);
- cellSch->apisDl->rgSCHDlInactvtUes(cell,&dlInactvLst);
-
- return ROK;
-}/*rgSCHDrxTtiHdlInActv*/
-
- /** @brief This function handles the per TTI processing for DRX short cycle
- * timer.
- *
- * @details
- * Invoked by - rgSCHDrxTtiInd
- *
- * Function: rgSCHDrxTtiHdlShortCycle
- *
- * Processing steps:
- * - For downlink
- *
- * in addition we have to mark the ues based on drx short cycle
- * expiry
- *
- *
- * @param RgSchCellCb *cell
- * @param uint16_t dlIndex
- * @param uint16_t ulIndex
- * @return ROK/RFAILED
- */
-
-S16 rgSCHDrxTtiHdlShortCycle(RgSchCellCb *cell,uint16_t dlIndex,uint16_t ulIndex)
-{
- CmLList *node;
- RgSchDRXCellCb *drxCell=NULLP;
- RgSchUeCb *ue=NULLP;
- RgSchDrxUeCb *drxUe=NULLP;
-
-#if ( ERRCLASS & ERRCLS_INT_PAR )
- if ( cell == (RgSchCellCb* )NULLP )
- {
- return RFAILED;
- }
-#endif
-
- UNUSED(ulIndex);
-
-
- drxCell = RG_SCH_DRX_GET_CELL(cell);
-
- node = drxCell->drxQ[dlIndex].shortCycleQ.first;
-
- while (node)
- {
- ue = (RgSchUeCb*)node->node;
- node = node->next;
- drxUe = RG_SCH_DRX_GET_UE(ue);
-
- if ( --drxUe->drxShortCycleDistance != DRX_TMR_EXPRD)
- {
- continue;
- }
-
- /* mark the UE's current cycle to be long */
- drxUe->isLongCycle = TRUE;
-
- /* remove from the shortCycleQ */
-
- cmLListDelFrm(&(drxCell->drxQ[dlIndex].shortCycleQ),
- &(drxUe->shortCycleEnt));
- drxUe->shortCycleIndx = DRX_INVALID;
-
- /* Remove from onDuration queue inserted based on short cycle
- * and calculate onDuration based on long cycle.*/
- rgSCHDrxMvToNxtOnDurOcc(cell,ue,RG_SCH_DRX_DL_DELTA,TRUE);
- }/*while(node)...*/
-
- return ROK;
-}/*rgSCHDrxTtiHdlShortCycle*/
-
-
- /** @brief This function handles the HARQ timer's processing per TTI.
- *
- * @details
- * Invoked by - rgSCHDrxTtiInd
- *
- * Function: rgSCHDrxTtiHdlDlHarq
- *
- * Processing steps:
- * - In addition per TTI DRX module must look at Downlink HARQ queues
- * maintained to track HARQ RTT timer and drx-RetransmissionTimer.
- * Every TTI at the scheduling index we shall check these queues and
- * process accordingly.
- *
- *
- * - Though these timers are related to downlink HARQ processing, they
- * have an impact on uplink scheduling. The reason is that the UE,
- * if active for downlink scheduling implies that it is reading
- * PDCCHs i.e. we can still send uplink allocations to the UE. Hence
- * every TTI Uplink too would look at the harqRTTQ and harqRetxQ.
- *
- *
- *
- * @param RgSchCellCb *cellCb
- * @param uint16_t dlIndex
- * @param uint16_t ulIndex
- * @return ROK/RFAILED
- */
-
-static S16 rgSCHDrxTtiHdlDlHarq(RgSchCellCb *cell,uint16_t dlIndex,uint16_t ulIndex)
-{
-
-#if ( ERRCLASS & ERRCLS_INT_PAR)
- if ( cell == (RgSchCellCb *)NULLP )
- {
- return RFAILED;
- }
-#endif /*ERRCLASS & ERRCLS_INT_PAR*/
-
-
- rgSCHDrxTtiHdlDlHarqRTT(cell, dlIndex);
-
- rgSCHDrxTtiHdlUlHarqRTT(cell, ulIndex);
-
- return ROK;
-}
-
- /** @brief This function is called by the common scheduler as part of
- * finalization of allocations in downlink.
- *
- * @details
- * Invoked by -
- *
- * Function: rgSchDrxStrtInActvTmr
- *
- * This function is responsible to starting drx-InactivityTimer
- *
- * Processing steps:
- *
- *
- * @param RgSchCellCb *cell
- * @param CmLListCp *ueUlLst
- * @param uint8_t direction
- * @return Void
- */
-
-Void rgSCHDrxStrtInActvTmr(RgSchCellCb *cell,CmLListCp *ueLst,uint8_t direction)
-{
- CmLList *node;
- CmLList *delNode;
- RgSchUeCb *ueCb;
- RgSchDrxUeCb *ueDrxCb;
-#ifndef LTE_TDD
- uint16_t index1;
-#endif
- uint16_t inActvTmrExpIndx;
-#ifndef LTE_TDD
- uint16_t curTimeInSf; /* current time in number of subframes */
-#endif
-#ifdef LTE_TDD
- uint16_t delta;
-#endif /*LTE_TDD*/
- CmLListCp dlInactvLst; /* list of UE's becoming DL-inactive */
- CmLListCp ulInactvLst; /* list of UE's becoming UL-inactive */
- RgSchCmnCell *cellSch = NULLP;
- Bool delInUlScan = FALSE;
-
- if ( direction == RG_SCH_DRX_UL)
- {
-#ifndef LTE_TDD
- curTimeInSf = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G) +
- (cell->crntTime.slot) +RG_SCH_DRX_UL_DELTA;
-#endif
-
-#ifdef LTE_TDD
- delta = RG_SCH_DRX_UL_DELTA;
-#endif /*LTE_TDD */
- }
- else
- {
-#ifndef LTE_TDD
- curTimeInSf = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G) +
- (cell->crntTime.slot) + RG_SCH_DRX_DL_DELTA;
-#endif
-
-#ifdef LTE_TDD
- delta = RG_SCH_DRX_DL_DELTA;
-#endif /*LTE_TDD */
- }
-
-
- /* Initialize DL inactive list */
- cmLListInit(&dlInactvLst);
-
- /* Initialize UL inactive list */
- cmLListInit(&ulInactvLst);
-
- delInUlScan = cell->drxCb->delInUlScan;
-
-#ifndef LTE_TDD
- index1 = (curTimeInSf) % RG_SCH_MAX_DRXQ_SIZE;
-#endif
-
- node = ueLst->first;
-
- while(node)
- {
- ueCb = (RgSchUeCb *)node->node;
- ueDrxCb = ueCb->drxCb;
-
- /* Stop inactivity timer */
- if ( ueDrxCb->drxInactvIndx != DRX_INVALID )
- {
- cmLListDelFrm(&(cell->drxCb->drxQ[ueDrxCb->drxInactvIndx].inActvTmrQ),
- &(ueDrxCb->inActvTmrEnt));
- }
-#ifdef LTE_TDD
-
- rgSCHDrxCalcNxtTmrExpry(cell,
- ueCb,
- delta,
- ueDrxCb->inactvtyTmrLen,
- &(ueDrxCb->drxInactDistance),
- &inActvTmrExpIndx
- );
-
-#else /*LTE_TDD*/
- inActvTmrExpIndx = (index1 + ueDrxCb->inactvtyTmrLen)
- % RG_SCH_MAX_DRXQ_SIZE;
-
- ueDrxCb->drxInactDistance = ueDrxCb->inactvtyTmrLen
- / RG_SCH_MAX_DRXQ_SIZE;
-#endif /*LTE_TDD*/
-
- cmLListAdd2Tail(&(cell->drxCb->drxQ[inActvTmrExpIndx].inActvTmrQ),
- &(ueDrxCb->inActvTmrEnt));
-
- ueDrxCb->inActvTmrEnt.node = (PTR)ueCb;
-
- ueDrxCb->drxInactvIndx = inActvTmrExpIndx;
-
- /* Update DRX InActive both masks */
- ueDrxCb->drxUlInactvMask &= ~RG_SCH_DRX_INACTVTMR_BITMASK;
- ueDrxCb->drxDlInactvMask &= ~RG_SCH_DRX_INACTVTMR_BITMASK;
-
- /* Update UE's Inactive masks */
- ueCb->ul.ulInactvMask &= ~RG_DRX_INACTIVE;
- ueCb->dl.dlInactvMask &= ~RG_DRX_INACTIVE;
-
- if ( delInUlScan == TRUE)
- {
- if ( ueDrxCb->inactvtyTmrLen == RGR_DRX_PRD_1PSF)
- {
- ueDrxCb->drxInactDistance = DRX_TMR_EXPRD;
- ueDrxCb->drxDlInactvMask |= RG_SCH_DRX_INACTVTMR_BITMASK;
-
- /* if no other condition is keeping ue inactive,
- * inactivate ue
- */
- if ( !RG_SCH_DRX_DL_IS_UE_ACTIVE(ueDrxCb) )
- {
- ueCb->dl.dlInactvMask |= RG_DRX_INACTIVE;
-
- /* Add to DL inactive list */
- cmLListAdd2Tail(&dlInactvLst,&(ueCb->dlDrxInactvLnk));
- ueCb->dlDrxInactvLnk.node = (PTR)ueCb;
- }
- }/*if ( ueDrxCb->inactvyTmrLen...*/
-
- }/*delInUlScan==TRUE*/
- else
- {
- if ( ueDrxCb->inactvtyTmrLen == RGR_DRX_PRD_1PSF )
- {
- ueDrxCb->drxInactDistance = DRX_TMR_EXPRD;
- ueDrxCb->drxUlInactvMask |= RG_SCH_DRX_INACTVTMR_BITMASK;
- /* if no other condition is keeping ue inactive,
- * inactivate ue
- */
- if ( !RG_SCH_DRX_DL_IS_UE_ACTIVE(ueDrxCb) )
- {
- ueCb->ul.ulInactvMask |= RG_DRX_INACTIVE;
-
- if ( !RG_SCH_CMN_UL_IS_UE_ACTIVE(ueCb))
- {
- /* Add to UL inactive list */
- cmLListAdd2Tail(&ulInactvLst,&(ueCb->ulDrxInactvLnk));
- ueCb->ulDrxInactvLnk.node = (PTR)ueCb;
- }
- }/*if ( !RG_SCH_DRX....)*/
- }/*if (ueDrxCb->inactv...*/
- }
-
- /* move the link list forward */
- delNode = node;
- node = node->next;
-
- cmLListDelFrm(ueLst, delNode);
- delNode->node = NULLP;
-
- }/*node*/
-
- /* Send the list to the scheduler to mark UE as inactive in UL*/
- cellSch = RG_SCH_CMN_GET_CELL(cell);
- cellSch->apisUl->rgSCHUlInactvtUes(cell, &ulInactvLst);
-
- /* Send the DL inactive list to the scheduler to mark UE as inactive */
- cellSch = RG_SCH_CMN_GET_CELL(cell);
- cellSch->apisDl->rgSCHDlInactvtUes(cell,&dlInactvLst);
-
- return;
-}/*rgSCHDrxStrtInActvTmr*/
-
- /** @brief This function is called by the downlink HARQ module on receiving a
- * negative feedback from the UE for a PDSCH transmission.
- *
- * @details
- * Invoked by - rgSCHDhmHqTrnsFail
- *
- * Function: rgSCHDrxStartHarqRTTTmr
- *
- * Processing steps:
- *
- *
- * @param RgSchCellCb *cell
- * @param RgSchDlHqProcCb *dlHq
- * @param uint8_t tbCnt
- * @return Void
- */
-Void rgSCHDrxStartHarqRTTTmr(RgSchCellCb *cell,RgSchDlHqProcCb *hqP,uint8_t tbCnt)
-{
- RgSchDRXCellCb *drxCell =NULLP;
- RgSchDrxDlHqProcCb *drxHq =NULLP;
- uint16_t harqRTTExpIndx;
- uint8_t fdbkDelta;
-#ifdef LTE_TDD
- uint8_t firstDlTxOcassion;
- uint8_t drxRetxTmrStartSf;
-#endif
-
- drxCell = RG_SCH_DRX_GET_CELL(cell);
- drxHq = RG_SCH_DRX_GET_DL_HQ(hqP);
-
-#ifdef LTE_TDD
- /* ccpu00134196-[Add]-DRX retx timer changes */
- firstDlTxOcassion = rgSchDrxHarqRetxFirstPsf[cell->ulDlCfgIdx]
- [hqP->tbInfo[tbCnt].fdbkTime.subframe];
-
- harqRTTExpIndx = ((hqP->tbInfo[tbCnt].fdbkTime.sfn * 10) +
- hqP->tbInfo[tbCnt].fdbkTime.subframe + firstDlTxOcassion)
- % RG_SCH_MAX_DRXQ_SIZE;
-
- fdbkDelta = RGSCH_CALC_SF_DIFF(cell->crntTime, hqP->tbInfo[tbCnt].fdbkTime);
-#else /*LTE_TDD*/
-
- /* For FDD HARQ RTT expiry index is 8 subframes from the time
- * corresponding PDSCH was scheduled. We are adding 1 subframe
- * so that UE is scheduled for retransmission in the next subframe*/
- /* ccpu00134196-[Add]-DRX retx timer changes */
- harqRTTExpIndx = ((hqP->tbInfo[tbCnt].timingInfo.sfn * RGSCH_NUM_SUB_FRAMES_5G) +
- hqP->tbInfo[tbCnt].timingInfo.slot + RG_SCH_MIN_HARQ_RTT)
- % RG_SCH_MAX_DRXQ_SIZE;
-
- fdbkDelta = RGSCH_CALC_SF_DIFF(cell->crntTime, hqP->tbInfo[tbCnt].timingInfo);
-#endif /*LTE_TDD*/
- /* ccpu00134196-[Add]-DRX retx timer changes */
- /* ensure that the insertion into the queue happens at an index
- greater than the dl index, ie, do +1 */
- /* Instead of depending on TTI details of current time and HARQ RTT Expire
- * time, Handling this check with deltas, because with TTIs it is not possible
- * to handle wrap-around condition*/
-#ifdef LTE_TDD
- if(fdbkDelta + RG_SCH_DRX_DL_DELTA >= firstDlTxOcassion)
- {
- /* The retx timer length should be reduced.
- This means based on the platforms delta between the DL HARQ
- processing and DL scheduling, drx retx timer lengths of 1ms/2ms
- may not be possible */
- drxRetxTmrStartSf = (hqP->tbInfo[tbCnt].fdbkTime.subframe +
- firstDlTxOcassion) % RGSCH_NUM_SUB_FRAMES;
- uint8_t i;
- /* We are here because the Retx Timer start is moved by atleast one
- position. Hence the timer will be reduced by minimum one */
- drxHq->retxTmrReduction = 1;
-
- /* Now check the consecutive subframes starting from the actual
- starting position of the retx tmr till the new position. Reduce the
- timer value only if the sf is a Pdcch sf */
- for(i = 1; i <= fdbkDelta + RG_SCH_DRX_DL_DELTA-firstDlTxOcassion+ 1; i++)
- {
- if (rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
- [(drxRetxTmrStartSf+i)%RGSCH_NUM_SUB_FRAMES]
- != RG_SCH_TDD_UL_SUBFRAME)
- {
- drxHq->retxTmrReduction++;
- }
- }
-#else
- if(fdbkDelta + RG_SCH_DRX_DL_DELTA >= RG_SCH_MIN_HARQ_RTT)
- {
- drxHq->retxTmrReduction =
- fdbkDelta + RG_SCH_DRX_DL_DELTA - RG_SCH_MIN_HARQ_RTT+ 1;
-#endif
- /* KW_FIX */
- harqRTTExpIndx = (harqRTTExpIndx + drxHq->retxTmrReduction) %
- RG_SCH_MAX_DRXQ_SIZE;
- }
- else
- {
- drxHq->retxTmrReduction = 0;
- }
- cmLListAdd2Tail (&(drxCell->drxQ[harqRTTExpIndx].harqRTTQ),
- &(drxHq->harqRTTEnt));
-
- drxHq->harqRTTEnt.node = (PTR)hqP;
- drxHq->rttIndx = harqRTTExpIndx;
-
- return;
-
-}/*rgSCHDrxStartHarqRTTTmr*/
-
-
-/** @brief This function is called by the Configuration module to give a
- * trigger to DRX module for UE configuration.
- *
- * @details
- *
- * Function: rgSCHDrxUeCfg
- *
- * Processing steps:
- * - Copy configuration information into drxUe structure.
- * - Calculate the first occurance of onDuration based on values
- * provided in the configuration structure.
- * - Append the UE to the onDurationQ at that index.
- * - The UE must be appened to the list based on the timing calculated
- * above (nxtSfn, nxtSubframe).
- *
- * @param RgSchCellCb *cell Cell control block.
- * @param RgSchUeCb *ue UE control block.
- * @param RgrUeCfg *ueCfg RGR UE configuration information.
- * @return
- * -# ROK
- * -# RFAILED
- */
-S16 rgSCHDrxUeCfg(RgSchCellCb *cell,RgSchUeCb *ue,RgrUeCfg *ueCfg)
-{
- S16 ret = ROK;
- RgSchDrxUeCb *ueDrxCb;
- CmLteTimingInfo nxtOnDur;
- uint16_t onDurIndx;
- uint16_t nxtOnDurTime;
- uint16_t curTime;
- uint8_t cellIdx;
-
-
-#if ( ERRCLASS & ERRCLS_INT_PAR )
- if ( cell == (RgSchCellCb* )NULLP)
- {
- return RFAILED;
- }
-
- if ((ue == (RgSchUeCb* )NULLP)
- ||
- (ueCfg == (RgrUeCfg* )NULLP))
- {
- DU_LOG("\nERROR --> SCH : rgSCHDrxUeCfg():"
- "Invalid params.cell or ue or ueCfg is NULL ");
- return RFAILED;
- }
-#endif
-
-
- /* allocate and initialize drxCb */
- ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data**)&ue->drxCb,
- (sizeof(RgSchDrxUeCb)));
-
- if(ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED for DRX UECB CRBTI:%d",ue->ueId);
- return (ret);
- }
-
- ueDrxCb = ue->drxCb;
-
- /* initialize the masks */
- ueDrxCb->drxDlInactvMask = DRX_UE_INACTIVE;
- ueDrxCb->drxUlInactvMask = DRX_UE_INACTIVE;
- ue->dl.dlInactvMask |= RG_DRX_INACTIVE;
- ue->ul.ulInactvMask |= RG_DRX_INACTIVE;
-
- for(cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
- {
- ue->drxCb->drxDlInactvMaskPerCell[cellIdx] = DRX_UE_INACTIVE;
- ue->drxCb->drxUlInactvMaskPerCell[cellIdx] = DRX_UE_INACTIVE;
- }
-
- /* Copy the configuration values into the UE's DRX CB. */
- rgSCHDrxCpyUeCfg (ueDrxCb, &ueCfg->ueDrxCfg);
-#ifdef EMTC_ENABLE
- if(ue->isEmtcUe)
- {
- rgSCHEmtcDrxCpyUeCfg(ue ,&ueCfg->ueDrxCfg);
- }
-#endif
-
- /* set all indexes to default values */
- ueDrxCb->onDurIndx = DRX_INVALID;
- ueDrxCb->onDurExpIndx = DRX_INVALID;
- ueDrxCb->drxInactvIndx = DRX_INVALID;
- ueDrxCb->shortCycleIndx = DRX_INVALID;
-
- /* set all distances to timer expiry */
- ueDrxCb->onDurExpDistance = DRX_TMR_EXPRD;
- ueDrxCb->drxInactDistance = DRX_TMR_EXPRD;
- ueDrxCb->drxShortCycleDistance = DRX_TMR_EXPRD;
- ueDrxCb->distance = DRX_TMR_EXPRD;
-
- /* Mark the UE in long/short cycle initially as per configuration*/
- if(FALSE == ueDrxCb->isShortCycleCfgd)
- {
- ueDrxCb->isLongCycle = TRUE;
- }
- else
- {
- ueDrxCb->isLongCycle = FALSE;
- }
-
- /* Calculate the next occurance from this point */
- rgSCHDrxGetNxtOnDur (cell, ueDrxCb, &nxtOnDur,RG_SCH_NO_DELTA);
-
-
- nxtOnDurTime = ((nxtOnDur.sfn * RGSCH_NUM_SUB_FRAMES_5G) + nxtOnDur.slot);
- curTime = ((cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G) +
- cell->crntTime.slot);
-
- onDurIndx = nxtOnDurTime % RG_SCH_MAX_DRXQ_SIZE;
-
- ueDrxCb->distance = (nxtOnDurTime - curTime) / RG_SCH_MAX_DRXQ_SIZE;
- if (ueDrxCb->distance < 0)
- {
- DU_LOG("\nERROR --> SCH : DRXUE. Invalid "
- "value for distance, %d CRNTI:%d", ueDrxCb->distance,ue->ueId);
- }
- //DU_LOG("\nDEBUG --> SCH : The onduartion index is: %d\n",(int)onDurIndx);
- cmLListAdd2Tail(&(cell->drxCb->drxQ[onDurIndx].onDurationQ),
- &(ueDrxCb->onDurationEnt));
-
- ueDrxCb->onDurationEnt.node = (PTR)ue;
- ueDrxCb->onDurIndx = onDurIndx;
-
- /* Starting Short Cycle Timer */
- if(TRUE == ueDrxCb->isShortCycleCfgd)
- {
- ueDrxCb->drxShortCycleDistance = (ueDrxCb->shortCycleTmrLen *
- ueDrxCb->shortDrxCycle) / RG_SCH_MAX_DRXQ_SIZE;
- ueDrxCb->shortCycleIndx = (curTime + (ueDrxCb->shortCycleTmrLen *
- ueDrxCb->shortDrxCycle)) % RG_SCH_MAX_DRXQ_SIZE;
- cmLListAdd2Tail(&(cell->drxCb->drxQ[ueDrxCb->shortCycleIndx].shortCycleQ),
- &(ueDrxCb->shortCycleEnt));
- ueDrxCb->shortCycleEnt.node = (PTR)ue;
- }
-
- return (ret);
-} /* end of rgSCHDrxUeCfg */
-
-/** @brief This function gets the next occurance of onDurationTimer from the
- * current time.
- *
- * @details rgSCHDrxGetNxtOnDur
- *
- * Function: rgSCHDrxGetNxtOnDur
- *
- * Processing steps: -
- * Calculation of first occurance of onDuration is to be done as
- * follows.
- * Assume DRX configuration came at subframe (x, y) the periodicity is
- * offset = (perd, offset).
- * The (sfn, subframe) satisfying the following condition is the first
- * occurance from this point.
- *
- * (sfn * 10 + subframe) mod perd = offset
- *
- -
- *
- *
- * @param RgSchCellCb *cell
- * @param RgSchDrxUeCb *drxCb
- * @param CmLteTimingInfo *nxtOnDur
- * @param uint8_t delta
- * @return ROK/RFAILED
- */
-static S16 rgSCHDrxGetNxtOnDur(RgSchCellCb *cell,RgSchDrxUeCb *drxCb,CmLteTimingInfo *nxtOnDur,uint8_t delta)
-{
- uint16_t curTime;
- uint16_t curDist;
- uint16_t cycleLen;
- uint32_t numOfCycles;
- uint32_t nxtDist;
-
-
-#if ( ERRCLASS & ERRCLS_INT_PAR )
- if ( cell == (RgSchCellCb* )NULLP )
- {
- return RFAILED;
- }
-
- if( (drxCb == (RgSchDrxUeCb* )NULLP)
- ||
- (nxtOnDur == (CmLteTimingInfo* )NULLP)
- )
- {
- DU_LOG("\nERROR --> SCH : rgSCHDrxGetNxOnDur():Invalid params."
- "cell/drxCb/nxtOnDur is NULL");
- return RFAILED;
- }
-#endif
-
-
- if (TRUE == drxCb->isLongCycle)
- {
- cycleLen = drxCb->longDrxCycle;
- }
- else
- {
- cycleLen = drxCb->shortDrxCycle;
- }
-
- curTime = ((cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G) + cell->crntTime.slot);
-
- curTime += delta; /*TODO: see if we need to take care of wrap arounds */
-
- if ( curTime <= drxCb->drxStartOffset )
- {
- /* offset is the nextOnDur */
- nxtOnDur->sfn = drxCb->drxStartOffset / RGSCH_NUM_SUB_FRAMES_5G;
- nxtOnDur->slot = (uint8_t)(drxCb->drxStartOffset % RGSCH_NUM_SUB_FRAMES_5G);
- nxtDist = ((nxtOnDur->sfn * RGSCH_NUM_SUB_FRAMES_5G) + nxtOnDur->slot);
- }
- else
- {
- curDist = curTime - drxCb->drxStartOffset;
-
- numOfCycles = curDist / cycleLen;
-
- if (0 == (curDist % cycleLen))
- {
- /* Perfect match pick up the current time */
- /*nxtOnDur should be set to equal to currentTime + DELTA */
- nxtOnDur->sfn = (uint16_t)curTime / RGSCH_NUM_SUB_FRAMES_5G;
- nxtOnDur->slot = (uint16_t)curTime % RGSCH_NUM_SUB_FRAMES_5G;
- nxtDist = ((nxtOnDur->sfn * RGSCH_NUM_SUB_FRAMES_5G) + nxtOnDur->slot);
-
- }
- else
- {
- nxtDist = drxCb->drxStartOffset + (numOfCycles + 1) *
- cycleLen;
- nxtOnDur->sfn = (uint16_t)nxtDist / RGSCH_NUM_SUB_FRAMES_5G;
- nxtOnDur->slot = (uint16_t)nxtDist % RGSCH_NUM_SUB_FRAMES_5G;
-
- }
- }
-
- /*If next On Duration is less than DL DELTA ahead, we will miss it and
- * hence need to move to the On-Duration after that.*/
- if((nxtDist - (curTime - delta)) <= RG_SCH_DRX_MAX_DELTA)
- {
- nxtDist = nxtDist + cycleLen;
- nxtOnDur->sfn = (uint16_t)nxtDist / RGSCH_NUM_SUB_FRAMES_5G;
- nxtOnDur->slot = (uint16_t)nxtDist % RGSCH_NUM_SUB_FRAMES_5G;
- }
- return ROK;
-} /* end of rgSCHDrxGetNxtOnDur */
-
-/** @brief This function is a utility function to copy the UE configuration from
- * the RGR structure to the UE control block.
- *
- * @details
- * -Invoked by rgSCHDrxUeCfg
- *
- * Function: rgSCHDrxCpyUeCfg
- *
- * Processing steps:
- * - Copies configuration values
- *
- * @param RgSchDrxUeCb *ueCb
- * @param RgrUeDrxCfg *drxCfg
- * @return ROK/RFAILED
- */
-static S16 rgSCHDrxCpyUeCfg(RgSchDrxUeCb *ueCb,RgrUeDrxCfg *drxCfg)
-{
-
-#if ( ERRCLASS & ERRCLS_INT_PAR )
- if ( (ueCb == (RgSchDrxUeCb* )NULLP )
- ||
- (drxCfg == (RgrUeDrxCfg* )NULLP)
- )
- {
- return RFAILED;
- }
-#endif
-
-
- /* Copy all values to UE control block */
-#ifdef LTEMAC_R9
- ueCb->cqiMask = drxCfg->cqiMask;
-#endif /*LTEMAC_R9*/
- ueCb->onDurTmrLen = drxCfg->drxOnDurTmr;
- ueCb->inactvtyTmrLen = drxCfg->drxInactvTmr;
- ueCb->drxRetransTmrLen = drxCfg->drxRetxTmr;
- ueCb->longDrxCycle = drxCfg->drxLongCycleOffst.longDrxCycle;
- ueCb->drxStartOffset = drxCfg->drxLongCycleOffst.drxStartOffst;
- ueCb->isShortCycleCfgd = drxCfg->drxShortDrx.pres;
- ueCb->shortDrxCycle = drxCfg->drxShortDrx.shortDrxCycle;
- ueCb->shortCycleTmrLen = drxCfg->drxShortDrx.drxShortCycleTmr;
-
- return ROK;
-} /* end of rgSCHDrxCpyUeCfg */
-
-#ifdef RGR_V2
-/** @brief This function is called by the configuration module when a UE is
- * reconfigured for DRX parameters.
- *
- * @details
- * Invoked By - rgSCHCfgRgrUeCfg
- *
- * Function: rgSCHDrxUeReCfg
- * As per MAC specifications the new values of timers shall be applied only once
- * they are restarted, hence no processing is required for modified timer values.
- *
- * Processing steps:
- * - if offset and/or drxCycleLenght changes then recalculate the next
- * onDurationIndex
- * - remove the UE from current index
- * - add the UE to the new index.
- * - if short cycle is enabled
- * - set isShortCycleCfgd = TRUE
- *
- * @param RgSchCellCb *cell
- * @param RgSchUeCb *ue
- * @param RgrUeRecfg *ueReCfg
- * @return ROK/RFAILED
- */
-S16 rgSCHDrxUeReCfg(RgSchCellCb *cell,RgSchUeCb *ue,RgrUeRecfg *ueReCfg)
-{
- /* DRX_INFI_LOOP */
- RgSchCmnCell *cellSch = NULLP;
- CmLListCp dlInactvLst; /* list of UE's becoming DL-inactive */
- S16 ret = ROK;
- Inst instIdx = cell->instIdx;
- RgSchDrxUeCb *ueDrxCb;
- CmLteTimingInfo nxtOnDur;
- uint16_t nxtOnDurTime;
- uint16_t onDurIndx;
- uint16_t curTime;
- uint16_t shrtCycleExpIndx;
- uint16_t onDurExpTime;
- uint16_t cycleLen;
- uint16_t curIndx;
- uint8_t cellIdx;
-
-
- /* drx was disabled but now enabled for this ue */
- if ( (ue->isDrxEnabled == FALSE)
- &&
- (ueReCfg->ueDrxRecfg.isDrxEnabled == TRUE)
- )
- {
- /* allocated and initialize drxCb */
- ret = rgSCHUtlAllocSBuf(instIdx, (Data**)&ue->drxCb,
- (sizeof(RgSchDrxUeCb)));
-
- if ( ret != ROK )
- {
- DU_LOG("\nERROR --> SCH : rgSCHdrxUeReCfg():""Memory allocation FAILED for DRX UE Cb CRNTI:%d",
- ue->ueId);
- return (ret);
- }
-
- ue->isDrxEnabled = TRUE; /* sachin */
- /* initialize the masks */
- ue->drxCb->drxDlInactvMask = DRX_UE_INACTIVE;
- ue->drxCb->drxUlInactvMask = DRX_UE_INACTIVE;
- ue->dl.dlInactvMask |= RG_DRX_INACTIVE;
- ue->ul.ulInactvMask |= RG_DRX_INACTIVE;
-
- for(cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
- {
- ue->drxCb->drxDlInactvMaskPerCell[cellIdx] = DRX_UE_INACTIVE;
- ue->drxCb->drxUlInactvMaskPerCell[cellIdx] = DRX_UE_INACTIVE;
- }
-
- /* set all indexes to default values */
- ue->drxCb->onDurIndx = DRX_INVALID;
- ue->drxCb->onDurExpIndx = DRX_INVALID;
- ue->drxCb->drxInactvIndx = DRX_INVALID;
- ue->drxCb->shortCycleIndx = DRX_INVALID;
-
- /* set all distances to timer expiry */
- ue->drxCb->onDurExpDistance = DRX_TMR_EXPRD;
- ue->drxCb->drxInactDistance = DRX_TMR_EXPRD;
- ue->drxCb->drxShortCycleDistance = DRX_TMR_EXPRD;
- ue->drxCb->distance = DRX_TMR_EXPRD;
-
- }
- if( ue->drxCb == NULLP )
- {
- return RFAILED;
- }
- ueDrxCb = ue->drxCb;
-
- /*drx was enabled but now disabled for this UE */
- if ( (ue->isDrxEnabled == TRUE )
- &&
- (ueReCfg->ueDrxRecfg.isDrxEnabled == FALSE)
- )
- {
- /* remove UE from all DRX Queues */
- (Void)rgSCHDrxUeDel(cell,ue);
-
- /* free drxCb */
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(instIdx,(Data **)(&((ue->drxCb))),
- sizeof(RgSchDrxUeCb));
-
- /* Resetting the DRX Bit set in Inactv Mask */
- ue->dl.dlInactvMask &= ~RG_DRX_INACTIVE;
- ue->ul.ulInactvMask &= ~RG_DRX_INACTIVE;
-
- ue->isDrxEnabled = FALSE;
-
- }/*isDrxEnabled == FALSE */
- else
- {
- /* If Application is updating DRX params */
- if (ueReCfg->ueRecfgTypes & RGR_UE_DRX_RECFG )
- {
- rgSCHDrxCpyUeCfg (ueDrxCb, &ueReCfg->ueDrxRecfg);
-#ifdef EMTC_ENABLE
- if(ue->isEmtcUe)
- {
- rgSCHEmtcDrxCpyUeCfg(ue, &ueReCfg->ueDrxRecfg);
- }
-#endif
-
- }
-
- /* Removing the UE from existing index of shortcycle, if any*/
- if(ueDrxCb->shortCycleIndx != DRX_INVALID)
- {
- cmLListDelFrm(&(cell->drxCb->drxQ[ueDrxCb->shortCycleIndx].shortCycleQ),
- &(ueDrxCb->shortCycleEnt));
-
- ueDrxCb->shortCycleEnt.node = (PTR) NULLP;
- ueDrxCb->shortCycleIndx = DRX_INVALID;
- }
-
- /* Mark for intiating long/short cycle as per received config */
- if(FALSE == ue->drxCb->isShortCycleCfgd)
- {
- ue->drxCb->isLongCycle = TRUE;
- }
- else
- {
- ue->drxCb->isLongCycle = FALSE;
- }
-
- /* Calculate the next occurance from this point */
- rgSCHDrxGetNxtOnDur (cell, ueDrxCb, &nxtOnDur,RG_SCH_NO_DELTA);
-
- /* remove the UE from the current onDuration Queue */
- if ( ueDrxCb->onDurIndx != DRX_INVALID )
- {
- cmLListDelFrm(&(cell->drxCb->drxQ[ueDrxCb->onDurIndx].onDurationQ),
- &(ueDrxCb->onDurationEnt));
- }
-
-
- nxtOnDurTime = (nxtOnDur.sfn * RGSCH_NUM_SUB_FRAMES_5G) + nxtOnDur.slot;
- curTime = ((cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G) +
- cell->crntTime.slot);
-
- /* If Onduration timer of old configuration is already running then waiting till it expires */
- if((ueDrxCb->onDurExpIndx != DRX_INVALID) && (ueDrxCb->onDurExpDistance != DRX_TMR_EXPRD))
- {
- curIndx = (curTime + RG_SCH_DRX_DL_DELTA) % RG_SCH_MAX_DRXQ_SIZE;
- DU_LOG("\nDEBUG --> SCH : OLD ONDUR RUNNING-EXPIRES at %d curIdx-%d nxtOnDurTime-%d",
- ueDrxCb->onDurExpIndx,
- curIndx,
- nxtOnDurTime);
-
- /* Manipulating the time when old onDuration timer can expire */
- if(curIndx >= ueDrxCb->onDurExpIndx)
- {
- onDurExpTime = curTime + ((ueDrxCb->onDurExpDistance+1) * RG_SCH_MAX_DRXQ_SIZE)+\
- (ueDrxCb->onDurExpIndx - curIndx + RG_SCH_DRX_DL_DELTA);
- }
- else
- {
- onDurExpTime = curTime + (ueDrxCb->onDurExpDistance * RG_SCH_MAX_DRXQ_SIZE)+\
- (ueDrxCb->onDurExpIndx - curIndx + RG_SCH_DRX_DL_DELTA);
- }
-
- if(nxtOnDurTime <= onDurExpTime)
- {
- if(ueDrxCb->isLongCycle)
- {
- cycleLen = ueDrxCb->longDrxCycle;
- }
- else
- {
- cycleLen = ueDrxCb->shortDrxCycle;
- }
- /* Moving to the possible occassion of onduration after current onduration expiry:
- * If both are aligning then going for next cycle */
- nxtOnDurTime += ((onDurExpTime - nxtOnDurTime)/cycleLen + 1 ) *cycleLen ;
- }
- }
- /* Add the UE to the index which corresponds to the next onduration start*/
- onDurIndx = nxtOnDurTime % RG_SCH_MAX_DRXQ_SIZE;
-
- ueDrxCb->distance = (nxtOnDurTime - curTime) / RG_SCH_MAX_DRXQ_SIZE;
- if (ueDrxCb->distance < 0)
- {
- DU_LOG("\nERROR --> SCH : DRXUE. Invalid "
- "value for distance, %d CRNTI:%d", ueDrxCb->distance,ue->ueId);
- }
-
- cmLListAdd2Tail(&(cell->drxCb->drxQ[onDurIndx].onDurationQ),
- &(ueDrxCb->onDurationEnt));
-
- ueDrxCb->onDurationEnt.node = (PTR)ue;
- ueDrxCb->onDurIndx = onDurIndx;
-
- /* DRX_INFI_LOOP */
- cmLListInit(&dlInactvLst);
- /* Add to DL inactive list */
- cmLListAdd2Tail(&dlInactvLst,&(ue->dlDrxInactvLnk));
- ue->dlDrxInactvLnk.node = (PTR)ue;
- /* Send the list to the scheduler to mark UE as inactive */
- cellSch = RG_SCH_CMN_GET_CELL(cell);
- cellSch->apisDl->rgSCHDlInactvtUes(cell, &dlInactvLst);
- /* DRX_INFI_LOOP */
-
- /* Starting short cycle timer as per the existence of old onDuration timer */
- if(TRUE == ueDrxCb->isShortCycleCfgd)
- {
- /* Expiring short DRX cycle Tmr once the number of short DRX cycles done */
- ueDrxCb->drxShortCycleDistance = (nxtOnDurTime + ueDrxCb->onDurTmrLen + (ueDrxCb->shortCycleTmrLen -1 )*
- ueDrxCb->shortDrxCycle) / RG_SCH_MAX_DRXQ_SIZE;
- shrtCycleExpIndx = (nxtOnDurTime + ueDrxCb->onDurTmrLen + ((ueDrxCb->shortCycleTmrLen -1)*
- ueDrxCb->shortDrxCycle)) % RG_SCH_MAX_DRXQ_SIZE;
- cmLListAdd2Tail(&(cell->drxCb->drxQ[shrtCycleExpIndx].shortCycleQ),
- &(ueDrxCb->shortCycleEnt));
- ueDrxCb->shortCycleEnt.node = (PTR)ue;
- ueDrxCb->shortCycleIndx = shrtCycleExpIndx;
- }
- }
-
- return ROK;
-
-} /* end of rgSCHDrxUeReCfg */
-#endif
-
-/** @brief This function Loop through the list of HARQ processes for this
- * UE and delete from the harqRTTQ and harqRetxQ
- *
- * Function: rgSCHDrxUeHqReset
- * Invoked by rgSCHDrxUeDel
- *
- * Processing steps:
- Loop through the list of HARQ processes for this UE and delete from
- * the harqRTTQ and harqRetxQ.
- *
- * @param RgSchCellCb *cell
- * @return ROK/RFAILED
- */
-Void rgSCHDrxUeHqReset(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlHqEnt *hqE,uint8_t cellIdx)
-{
- RgSchDlHqProcCb *hqP;
- RgSchDrxDlHqProcCb *drxHq =NULLP;
- uint8_t i;
-
- for(i=0; i < hqE->numHqPrcs; i++)
- {
- hqP = &hqE->procs[i];
- drxHq = RG_SCH_DRX_GET_DL_HQ(hqP);
-
- if(drxHq->rttIndx != DRX_INVALID)
- {
- cmLListDelFrm (&(cell->drxCb->drxQ[drxHq->rttIndx].harqRTTQ),
- &(drxHq->harqRTTEnt));
-
- drxHq->rttIndx = DRX_INVALID;
- }
-
- if(drxHq->reTxIndx != DRX_INVALID)
- {
- cmLListDelFrm (&(cell->drxCb->drxQ[drxHq->reTxIndx].harqRetxQ),
- &(drxHq->harqRetxEnt));
-
- drxHq->reTxIndx = DRX_INVALID;
- }
- }
-
- ue->drxCb->drxDlInactvMaskPerCell[cellIdx] = DRX_UE_INACTIVE;
- ue->drxCb->drxUlInactvMaskPerCell[cellIdx] = DRX_UE_INACTIVE;
-}
-
-/** @brief This function Deletes DRX specific context for a UE.
- *
- * @details This funciton is invoked by the Configuration module on RGR UE Deletion.
- * This function removes the UE's context from all of the DRX Queues.
- * In addition it deletes context of UE's HARQ Processes present in the harqRTTQ
- * and harqRetxQ
- *
- *
- * Function: rgSCHDrxUeDel
- * Invoked by rgSCHCfgRgrUeDel
- *
- * Processing steps:
- * - Remove the UE from the following queues
- * - onDurationQ - using onDurIndx
- * - onDurationExpQ - using onDurExpIndx
- * - inActvTmrQ - using drxInactvIndx
- * - shortCycleQ - using shortCycleIndx
- * - Loop through the list of HARQ processes for this UE and delete from
- * the harqRTTQ and harqRetxQ.
- *
- * @param RgSchCellCb *cell
- * @param RgSchUeCb *ue
- * @return ROK/RFAILED
- */
-S16 rgSCHDrxUeDel(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchDrxUeCb *ueDrxCb;
- RgSchDlHqEnt *hqE = NULLP;
- uint8_t cellIdx;
- RgSchUeCellInfo *cellInfo = NULLP;
-#ifdef EMTC_ENABLE
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell);
-#endif
-
-
- /* ccpu00129899: Moved the drx-enabled check to the caller */
- ueDrxCb = ue->drxCb;
-
- /* Remove UE from all queues */
- if ( ueDrxCb->onDurIndx != DRX_INVALID )
- {
- cmLListDelFrm(&(cell->drxCb->drxQ[ueDrxCb->onDurIndx].onDurationQ),
- &(ueDrxCb->onDurationEnt));
-
- ueDrxCb->onDurIndx = DRX_INVALID;
- }
-
- if ( ueDrxCb->onDurExpIndx != DRX_INVALID )
- {
- cmLListDelFrm(&(cell->drxCb->drxQ[ueDrxCb->onDurExpIndx].onDurationExpQ),
- &(ueDrxCb->onDurationExpEnt));
-
- ueDrxCb->onDurExpIndx = DRX_INVALID;
- }
-
- if ( ueDrxCb->drxInactvIndx != DRX_INVALID )
- {
- cmLListDelFrm(&(cell->drxCb->drxQ[ueDrxCb->drxInactvIndx].inActvTmrQ),
- &(ueDrxCb->inActvTmrEnt));
-
- ueDrxCb->drxInactvIndx = DRX_INVALID;
- }
-
- if ( ueDrxCb->shortCycleIndx != DRX_INVALID )
- {
- cmLListDelFrm(&(cell->drxCb->drxQ[ueDrxCb->shortCycleIndx].shortCycleQ),
- &(ueDrxCb->shortCycleEnt));
-
- ueDrxCb->shortCycleIndx = DRX_INVALID;
- }
-
- for(cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
- {
- cellInfo = ue->cellInfo[cellIdx];
-
- if(cellInfo)
- {
- hqE = cellInfo->hqEnt;
- rgSCHDrxUeHqReset(cell, ue, hqE, cellIdx);
- }
- }
-#ifdef EMTC_ENABLE
- if(ue->isEmtcUe)
- {
- rgSCHDrxUeUlHqReset(cell, ue, &(ueUl->hqEnt));
- }
-#endif
- /* Resetting the DRX Bit set in Inactv Mask */
- ue->dl.dlInactvMask &= ~RG_DRX_INACTIVE;
- ue->ul.ulInactvMask &= ~RG_DRX_INACTIVE;
- ueDrxCb->drxDlInactvMask = DRX_UE_INACTIVE;
- ueDrxCb->drxUlInactvMask = DRX_UE_INACTIVE;
-
- return ROK;
-}/*rgSCHDrxUeDel*/
-
-/** @brief This function is called at the time of RGR cell configuration.
- *
- * @details
- * Invoked by - rgSCHCfgRgrCellCfg
- *
- * Function: rgSCHDrxCellCfg
- *
- * Processing steps:
- * - Initializes the following drxQ (memset would do).
- *
- *
- * @param RgSchCellCb *cell
- * @param RgrCellCfg *cellCfg
- * @return ROK/RFAILED
- */
-S16 rgSCHDrxCellCfg(RgSchCellCb *cell,RgrCellCfg *cellCfg)
-{
-
- S16 ret = ROK;
- Inst instIdx = cell->instIdx;
-
-#if ( ERRCLASS & ERRCLS_INT_PAR )
- /*KWORK_FIX :Removed check for cell being NULL*/
- if( (cellCfg == (RgrCellCfg* )NULLP))
- {
- DU_LOG("\nERROR --> SCH : rgSCHDrxCellCfg():Invalid Params. cell/cellCfg is NULL");
- return RFAILED;
- }
-#endif
-
- /* allocate and initialize drxCb */
- ret = rgSCHUtlAllocSBuf(instIdx, (Data**)&cell->drxCb,
- (sizeof(RgSchDRXCellCb)));
-
- if(ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : rgSCHDrxCellCfg():"
- "Memory allocation FAILED for DRX cell Cb");
- return (ret);
- }
-
- /* delInUlScan determines which index scans the queue last.
- * We look at onDurationQ both from ulIndex & dlIndex pov.
- * Consider, onDuration starts at index 5, and current index is 2,
- * while dlIndex is 2 & ulIndex is 3 i.e dl is looking 2 SF ahead
- * and ul is looking 3 SF ahead. In this case, dl will scan the queue
- * last and therefore DL will delete ueCb from onDuration q.
- * The reverse is true for the other case.*/
-
- if ( RG_SCH_DRX_UL_DELTA > RG_SCH_DRX_DL_DELTA )
- {
- cell->drxCb->delInUlScan = FALSE;
- }
- else
- {
- cell->drxCb->delInUlScan = TRUE;
- }
-
- return (ret);
-} /* end of rgSchDrxCellCfg */
-
-
-
-/** @brief This function to delete DRX specific context in the cell control
- * block.
- *
- * @details
- * Invoked by - rgSCHCfgRgrCellDel
- *
- * Function: rgSCHDrxCellDel
- *
- * Processing steps:
- * - De-Inits RgSchDRXCellCb (Nothing to be done)
- * - Assumption: The API is invoked after deletion of UEs from the cell.
- *
- * @param RgSchCellCb *cell
- * @return Void
- */
-Void rgSCHDrxCellDel(RgSchCellCb *cell)
-{
- Inst instIdx = cell->instIdx;
-
- if (cell->drxCb)
- {
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(instIdx, (Data **)(&(cell->drxCb)),
- sizeof(RgSchDRXCellCb));
- }
- return;
-} /* end of rgSchDrxCellDel */
-
-/** @brief This function is called when an SR is received from the UE. In this
- * case the UE should be marked as ACTIVE till we send a UL allocation to the
- * UE.
- *
- * @details
- * Invoked by - rgSCHCmnSrRcvd
- * Must be called after calling the specific scheduler.
- *
- * Function: rgSCHDrxSrInd
- *
- * Processing steps:
- * - Mark the UE as ACTIVE
- * ueCb->drxUlInactvMask |= (DRX_SR_ACTIVE);
- * - Optionally call schedulers to add this UE to their scheduling
- * queues.
- * - Set drxUe->srRcvd = TRUE
- *
- * Note : the specification state that the UE shall start be active
- * listening for UL grant, this implies we could potentially exploit
- * this to send DL transmissions as well. However we have currently
- * chosen not to do so.
- *
- * @param RgSchCellCb *cell
- * @param RgSchUeCb *ue
- * @return ROK/RFAILED
- */
-S16 rgSCHDrxSrInd(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchDrxUeCb *drxCb;
-
-#if ( ERRCLASS & ERRCLS_INT_PAR )
- if ( cell == (RgSchCellCb* )NULLP)
- {
- return ROK;
- }
-
- if( (ue == (RgSchUeCb* )NULLP))
- {
- DU_LOG("\nERROR --> SCH : rgSCHDrxSrInd():Invalid Params. cell/ue is NULL");
- return RFAILED;
- }
- #endif
- /* KWork fix - shifted this down */
-
-
- drxCb = RG_SCH_DRX_GET_UE(ue);
-
- /* Mark the UE as active for UL only */
- drxCb->drxUlInactvMask &= ~RG_SCH_DRX_SR_BITMASK;
- drxCb->srRcvd = TRUE;
- /* Update UE's inactive mask and if required move UE to ACTIVE state */
- RG_SCH_CMN_UL_UPDT_INACTV_MASK( cell, ue, RG_DRX_INACTIVE);
-
- return ROK;
-} /* rgSCHDrxSrInd */
-
-
-/** @brief This function handles ACTIVITY due to RACH using a dedicated preamble
- * (PDCCH order) OR Handover. A UE shall remain marked as active from the time
- * we successfully send out a RAR upto the time it receives a PDCCH indicating a
- * new transmission.
- *
- * @details
- * Invoked by - rgSCHCmnHdlHoPo
- *
- * Function: rgSCHDrxDedRa
- *
- * Processing steps:
- * - MARK the UE as active
- * - set the raRcvd = TRUE for this UE.
- *
- * @code
- * ueCb->drxDlInactvMask |= (DRX_RA_ACTIVE);
- * ueCb->drxUlInactvMask |= (DRX_RA_ACTIVE);
- * ueCb->raRcvd = TRUE;
- * @endcode
- *
- * @param RgSchCellCb *cellCb
- * @param RgSchUeCb *ueCb
- * @return Void
- */
-Void rgSCHDrxDedRa(RgSchCellCb *cellCb, RgSchUeCb *ueCb)
-{
- RgSchDrxUeCb *drxCb;
-
- drxCb = RG_SCH_DRX_GET_UE(ueCb);
-
- /* Mark the UE as active for UL & DL */
- drxCb->drxUlInactvMask &= ~RG_SCH_DRX_RA_BITMASK;
- /* Update UE's inactive mask and if required move UE to ACTIVE state */
- RG_SCH_CMN_UL_UPDT_INACTV_MASK(cellCb, ueCb, RG_DRX_INACTIVE);
-
- drxCb->drxDlInactvMask &= ~RG_SCH_DRX_RA_BITMASK;
- /* Update UE's inactive mask and if required move UE to ACTIVE state */
- RG_SCH_CMN_DL_UPDT_INACTV_MASK(cellCb, ueCb, RG_DRX_INACTIVE);
-
- drxCb->raRcvd = TRUE;
-
- return;
-} /* end of rgSCHDrxDedRa */
-
-
-/** @brief This function calculates the next onDuration Occurence
- * and removes & queue it again in onDurationQ
- *
- * @details
- * Invoked by -
- *
- * Function: rgSCHDrxMvToNxtOnDurOcc
- *
- * Processing steps:
- *
- *
- * @param RgSchCellCb *cell
- * @param RgSchUeCb *ueCb
- * @param uint16_t idx - if calcFrmOffst is TRUE,
- * idx is delta to be added
- * @param Bool calcFrmOffst
- * @return Void
- */
-static Void rgSCHDrxMvToNxtOnDurOcc(RgSchCellCb *cell,RgSchUeCb *ueCb,uint16_t idx,Bool calcFrmOffst)
-{
- uint16_t nxtOnDurIndex;
- uint16_t curTime;
- RgSchDrxUeCb *drxUe;
- RgSchDRXCellCb *drxCell;
- CmLteTimingInfo nxtOnDur; /* to be used when calcFrmOffset is set */
- uint16_t nxtOnDurInSf; /* next On Duration in no of subframes */
-
- drxCell = cell->drxCb;
- drxUe = ueCb->drxCb;
-
-
- if(calcFrmOffst == FALSE)
- {
- if (drxUe->isLongCycle)
- {
- nxtOnDurIndex = ((idx + drxUe->longDrxCycle)
- % RG_SCH_MAX_DRXQ_SIZE );
- drxUe->distance = drxUe->longDrxCycle/RG_SCH_MAX_DRXQ_SIZE;
- }
- else
- {
- nxtOnDurIndex = ((idx + drxUe->shortDrxCycle)% RG_SCH_MAX_DRXQ_SIZE);
-
- drxUe->distance = drxUe->shortDrxCycle / RG_SCH_MAX_DRXQ_SIZE;
- }
- }
- else
- {
- rgSCHDrxGetNxtOnDur(cell,drxUe,&nxtOnDur,(uint8_t)idx);
-
- nxtOnDurInSf = ((nxtOnDur.sfn * RGSCH_NUM_SUB_FRAMES_5G) +
- nxtOnDur.slot);
-
- curTime = ((cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G) +
- cell->crntTime.slot);
-
- nxtOnDurIndex = nxtOnDurInSf % RG_SCH_MAX_DRXQ_SIZE;
- drxUe->distance = (nxtOnDurInSf-curTime) / RG_SCH_MAX_DRXQ_SIZE;
- if (drxUe->distance < 0)
- {
- DU_LOG("\nERROR --> SCH : DRXUE. Invalid "
- "value for distance, %d CRNTI:%d", drxUe->distance,ueCb->ueId);
- }
- }
-
- /* First remove from existing location */
- if ( drxUe->onDurIndx != DRX_INVALID )
- {
- cmLListDelFrm(&(drxCell->drxQ[drxUe->onDurIndx].onDurationQ),
- &(drxUe->onDurationEnt));
- }
-
- /* Add at new location */
- cmLListAdd2Tail(&(drxCell->drxQ[nxtOnDurIndex].onDurationQ),
- &(drxUe->onDurationEnt));
-
- drxUe->onDurationEnt.node = (PTR)ueCb;
- drxUe->onDurIndx = nxtOnDurIndex;
-
- return;
-}/*rgSCHDrxMvToNxtOnDurOcc*/
-
-#ifdef LTE_TDD
-/** @brief This function calculates the next SFN,subframe a given
- * timer is going to expire. Works for all TDD configurations.
- *
- * @details
- *
- * Function: rgSCHDrxGetNxtTmrExpry
- * We need to count only PDCCH frames in a given TDD
- * configuration. This is true for onDuration, inActivity
- * & drx-retransmission timers.
- *
- * Processing steps (assume timer starts at (12,2) and duration
- * is 23 DL subframes):
- * - based on TDD configuration, move to the next SFN and
- * count the number of DL subframes consumed. In our example,
- * moving to (12,9) will consume 6 DL subframes assuming TDD
- * config of 2.
- * - From this point on, determine how many exact Radio Frames
- * will be consumed for the remaining DL subframes. In our
- * example, remaining DL subframes are (23-6) are 17.
- * For config 2, the following holds true
- * 8 DLSF are in 1 RF
- * 1 DLSF in 1/8 DLSF
- * 17 DLSF in 17/8 i.e 2 RF + 1 subframe
- * In order to consume 17 DLSF, we need to move forward
- * 2 RFs + 1 subframe. Adding 2 RF's gives us (14,9)
- * - For the remaining subframe, we need to figure out the next
- * available DL subframe. For TDD_configuration, the first DL
- * subframe is at index 0. So, the timer will run till (15,0)
- * and will expire on (15,1)
- *
- * @param RgSchUeCb *ue Ue control block.
- * @param uint16_t curTime current Time
- * @param uint32_t duration Timer duration
- * @param CmLteTimingInfo *tmrExpryIdx Timer expry (SFN,sf)
- * @return ROK/RFAILED
- */
-static S16 rgSCHDrxGetNxtTmrExpry(RgSchCellCb *cell, uint16_t curTime, uint32_t duration,CmLteTimingInfo *tmrExpryIdx)
-{
- uint32_t dlSfTillNxtSFN; /*!< DL subframes till next SFN */
- uint8_t tddCfgMode; /*!< tdd config mode */
- Bool isDwPtsCnted; /*!< is DwPts counted as PDCCH sf */
- CmLteTimingInfo crntTime; /*!< current SFN & sf */
-
-
-#if ( ERRCLASS & ERRCLS_INT_PAR )
- if ( (cell == (RgSchCellCb* )NULLP)
- ||
- (tmrExpryIdx == (CmLteTimingInfo* )NULLP)
- )
- {
- return RFAILED;
- }
-#endif
-
-
- isDwPtsCnted = cell->isDwPtsCnted ;
-
- tddCfgMode = cell->ulDlCfgIdx;
- crntTime.sfn = curTime / RGSCH_NUM_SUB_FRAMES_5G;
- crntTime.slot = curTime % RGSCH_NUM_SUB_FRAMES_5G;
-
-
-
- /* First calculate the number of DL subframes till next SFN */
-
- dlSfTillNxtSFN = rgSchDrxDLSfTillNxtSFN[isDwPtsCnted][tddCfgMode]
- [(crntTime.slot % RGSCH_NUM_SUB_FRAMES)];
-
-
- if ( dlSfTillNxtSFN >= duration )
- {
- /* the timer would expire on the same RF */
- uint32_t diff = dlSfTillNxtSFN - duration;
-
- tmrExpryIdx->sfn = crntTime.sfn;
-
- if ( diff == 0 )
- {
- tmrExpryIdx->subframe = rgSchDrxDLSftoDLSfIdx[isDwPtsCnted][tddCfgMode]
- [0];
- }
- else
- {
- uint8_t arrayIdx;
- /* to know the DL sf index based on diff */
- arrayIdx = rgSchDrxDlSfTddCfg[isDwPtsCnted][tddCfgMode];
-
- tmrExpryIdx->subframe = rgSchDrxDLSftoDLSfIdx[isDwPtsCnted][tddCfgMode]
- [arrayIdx - diff];
- }
- }/* if ( dlSfTillNxtSFN >= duration...*/
- else
- {
- uint32_t remSf; /*!< remaining subframes */
- uint32_t numRf; /*!< num of complete radio frames */
- uint32_t numRemSfs; /*!< num of remaining subframes */
-
- remSf = duration - dlSfTillNxtSFN;
-
- /* move to (currSFN,9) having consued dlSfTillNxtSFN DL subframes */
- tmrExpryIdx->sfn = crntTime.sfn;
- tmrExpryIdx->subframe = (uint8_t)9;
-
- numRf = (1 * remSf)/rgSchDrxDlSfTddCfg[isDwPtsCnted][tddCfgMode];
- numRemSfs = (1 * remSf)%rgSchDrxDlSfTddCfg[isDwPtsCnted][tddCfgMode];
-
- tmrExpryIdx->sfn = tmrExpryIdx->sfn + numRf;
-
- /* we are now at (X,9) having consumed dlSfTillNxtSFN + numRf * num of DL
- * subframes in 1 RF */
-
- if ( numRemSfs == 0 )
- {
- /* we are at subframe 9 i.e. the timer is going to expire using exact
- * radio frames. However, not all TDD_configurations have 9 as their
- * last DL subframe. We might have passed the last DL subfrme.
- * Therefore, move back */
- tmrExpryIdx->subframe = rgSchDrxDLSftoDLSfIdx[isDwPtsCnted][tddCfgMode]
- [numRemSfs];
- }
- else
- {
- /* a reminder implies we have to move past this SFN as we are at the
- * last subframe on that SFN */
- tmrExpryIdx->sfn++;
- tmrExpryIdx->subframe = rgSchDrxDLSftoDLSfIdx[isDwPtsCnted][tddCfgMode]
- [numRemSfs];
- }
- }/*else if diff > duration */
-
- /* timer will expire 1 + tmrExpryIdx */
-
- if ( ( tmrExpryIdx->subframe + 1) == 10 )
- {
- tmrExpryIdx->sfn++;
- tmrExpryIdx->subframe = 0;
- }
- else
- {
- tmrExpryIdx->subframe++;
- }
-
- /* check to see if it sfn has crossed its max */
- if ( tmrExpryIdx->sfn > RG_SCH_CMN_MAX_SFN_NUM )
- {
- tmrExpryIdx->sfn = tmrExpryIdx->sfn - (RG_SCH_CMN_MAX_SFN_NUM + 1);
- }
-
- return ROK;
-}/*rgSCHDrxGetNxtTmrExpry*/
-
-/** @brief This function calculates the next onDuration Occurence
- * for TDD
- * @details
- * Invoked by -
- *
- * Function: rgSCHDrxCalcNxtTmrExpry
- *
- * Processing steps: a wrapper function to call
- * rgSCHDrxGetNxtTmrExpry
- *
- * @param RgSchCellCb *cell
- * @param RgSchUeCb *ue
- * @param uint16_t delta
- * @param uint32_t tmrLen
- * @param uint16_t *distance
- * @param S16 *idx
- * @return ROK/RFAILED
- */
-static Void rgSCHDrxCalcNxtTmrExpry(RgSchCellCb *cell, RgSchUeCb *ue, uint16_t delta, uint32_t tmrLen, S16 *distance, uint16_t *idx)
-{
- uint16_t curTimeInSf; /*current time in no of subframes*/
- CmLteTimingInfo tmrExpry;
- uint16_t tmrExpryInSf; /*timer expry in no of subframes*/
-
- curTimeInSf = cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G +
- cell->crntTime.slot;
-
- /* add delta to curTime */
- curTimeInSf += delta;
-
- rgSCHDrxGetNxtTmrExpry(ue->cell,curTimeInSf,tmrLen,&tmrExpry);
-
- /* convert timre Expry in terms of subframes */
- tmrExpryInSf = tmrExpry.sfn * RGSCH_NUM_SUB_FRAMES_5G +
- tmrExpry.subframe;
-
-
- *idx = (tmrExpryInSf) % RG_SCH_MAX_DRXQ_SIZE;
-
- if ( distance != NULLP ) /* hqReTx don't use the concept of distance.
- They can send NULLP for distance.
- */
- {
- if ( tmrExpryInSf > curTimeInSf )
- {
- *distance = (tmrExpryInSf - curTimeInSf) /
- RG_SCH_MAX_DRXQ_SIZE;
- }
- else
- {
- /* in case the RF is at its max and wraps around */
-
- *distance = ((tmrExpryInSf + (RG_SCH_CMN_MAX_NUM_OF_SFN - 1))
- -
- curTimeInSf) / RG_SCH_MAX_DRXQ_SIZE;
- }
- if (*distance < 0)
- {
- DU_LOG("\nERROR --> SCH : DRXUE. Invalid "
- "value for distance, %d CRNTI:%d", *distance,ue->ueId);
- }
- }
-
- return;
-}/*rgSCHDrxCalcNxtTmrExpry*/
-
-/* ccpu00134670- Validating onduration timer versus DRX cycle*/
-/***********************************************************
- *
- * Func : rgSCHCfgVldtTddDrxCycCfg
- *
- *
- * Desc : Validates DRX Cycle Length configuration against received
- * onDuration timer from RRC.
- *
- * Ret : S16
- * ROK - Success
- *
- * RFAILED - Failed
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-S16 rgSCHCfgVldtTddDrxCycCfg(RgSchCellCb *cell,uint16_t drxCycle,uint8_t onDurTmr, uint16_t offSet)
-{
- uint16_t startTime;
- uint16_t endTimeInSf;
- CmLteTimingInfo endTime;
-
- startTime = offSet;
- do
- {
- rgSCHDrxGetNxtTmrExpry(cell, startTime, onDurTmr, &endTime);
-
- endTimeInSf = (endTime.sfn* RGSCH_NUM_SUB_FRAMES)+endTime.subframe;
-
- if(((RGSCH_MAX_SUBFRM_5G + endTimeInSf- startTime) % RGSCH_MAX_SUBFRM_5G) >=
- drxCycle)
- {
- return RFAILED;
- }
-
- startTime = (startTime + drxCycle);
- /* Going for next iteration if the DRX cycle is not multiple of 10. If it is
- multiple of 10(Number of Subframes in a SFN) then subframe, at which
- onduration timer can start, will be always same, Otherwise the possible
- subframe numbers, where the onDuration timer can start, is 5. Hence 4
- more iterations are required. */
- }while((drxCycle % RGSCH_NUM_SUB_FRAMES) &&
- (startTime < (drxCycle * RGSCH_NUM_SUB_FRAMES/2)));
-
- return ROK;
-}
-
-#endif /*LTE_TDD */
-
-/** @brief This function is called to handle onDurationTimer per TTI processing.
- *
- * @details
- * Invoked by - rgSCHDrxTtiInd
- *
- * Function: rgSCHDrxTtiHdlOnDurUl
- *
- * Processing steps:
- *
- * - OnDurationTimer is handled using the drxQ @sa RgSchDrxQ
- *
- * - For Uplink we shall look at an index that is
- * n + RG_SCH_DRX_UL_DELTA as
- * we are concerned with the PDCCH and not the actual PUSCH.
- *
- *
- * @param RgSchCellCb *cellCb
- * @param uint16_t ulIndex
- * @return Void
- */
-
-static Void rgSCHDrxTtiHdlOnDurUl(RgSchCellCb *cell,uint16_t ulIndex)
-{
- CmLList *node;
- RgSchDRXCellCb *drxCell = NULLP;
- RgSchUeCb *ue = NULLP;
- RgSchDrxUeCb *drxUe = NULLP;
- CmLListCp ulInactvLst; /* list of UE's becoming DL-inactive */
- RgSchCmnCell *cellSch = NULLP;
- Bool delInUlScan = FALSE;
-
- drxCell = (cell->drxCb);
- delInUlScan = drxCell->delInUlScan;
- /***********************************************************
- * Scanning OnDurationQ in UL
- ***********************************************************/
-
- /* For Uplink we shall look at an index that is n + RG_SCH_DRX_UL_DELTA as
- we are concerned with the PDCCH and not the actual PUSCH.*/
-
- node = drxCell->drxQ[ulIndex].onDurationQ.first;
-
- while (node)
- {
- ue = (RgSchUeCb*)node->node;
- node = node->next;
- drxUe = RG_SCH_DRX_GET_UE(ue);
-
-
- if ( delInUlScan == FALSE)
- {
- drxUe->distance--;
- }
-
- if ( drxUe->distance != DRX_TMR_EXPRD )
- {
- continue;
- }
-
- /* reset the bit mask to indicate that onduration has started */
- drxUe->drxUlInactvMask &= ~RG_SCH_DRX_ONDUR_BITMASK;
-
- /* if no other condition is keeping UE as inactive,
- * activate UE
- */
- RG_SCH_CMN_UL_UPDT_INACTV_MASK(cell, ue, RG_DRX_INACTIVE);
-
- if ( delInUlScan == TRUE )
- {
- /*calculate next on duration occurence
- * and it to the onDuration Queue*/
- rgSCHDrxMvToNxtOnDurOcc(cell,ue,ulIndex,FALSE);
- }/*delInUlScan == FALSE */
- }/*while(node)*/
-
- /***********************************************************
- * Scanning OnDurationExpQ in UL
- ***********************************************************/
-
- node = drxCell->drxQ[ulIndex].onDurationExpQ.first;
-
- /* Initialize UL inactive list */
- cmLListInit(&ulInactvLst);
-
- while (node)
- {
- ue = (RgSchUeCb*)node->node;
- node = node->next;
- drxUe = RG_SCH_DRX_GET_UE(ue);
-
- if ( delInUlScan == FALSE )
- {
- drxUe->onDurExpDistance--;
- }
-
- if ( drxUe->onDurExpDistance != DRX_TMR_EXPRD )
- {
- continue;
- }
-
- /*UE is inactive as onduration has expired */
- drxUe->drxUlInactvMask |= RG_SCH_DRX_ONDUR_BITMASK;
-
- if( !RG_SCH_DRX_UL_IS_UE_ACTIVE(drxUe))
- {
- /* set the inactive bit to indicate UE has now become inactive */
- ue->ul.ulInactvMask |= RG_DRX_INACTIVE;
-
- /* Add to DL inactive list */
- cmLListAdd2Tail(&ulInactvLst,&(ue->ulDrxInactvLnk));
- ue->ulDrxInactvLnk.node = (PTR)ue;
- }
-
- if ( delInUlScan == TRUE)
- {
- /*Remove from DRX queue*/
- cmLListDelFrm(&(drxCell->drxQ[ulIndex].onDurationExpQ),
- &(drxUe->onDurationExpEnt));
-
- drxUe->onDurExpIndx = DRX_INVALID;
- }
-
- }/*while(node)*/
-
- /* Send the list to the scheduler to mark UE as inactive in UL*/
- cellSch = RG_SCH_CMN_GET_CELL(cell);
- cellSch->apisUl->rgSCHUlInactvtUes(cell, &ulInactvLst);
-
- return;
-}
-
-/** @brief This function is called to handle onDurationTimer per TTI processing.
- *
- * @details
- * Invoked by - rgSCHDrxTtiInd
- *
- * Function: rgSCHDrxTtiHdlOnDurDl
- *
- * Processing steps:
- *
- * - OnDurationTimer is handled using the drxQ @sa RgSchDrxQ
- *
- * - For Downlink we shall look at an index that is
- * n + RG_SCH_DRX_DL_DELTA.
- *
- *
- * @param RgSchCellCb *cellCb
- * @param uint16_t dlIndex
- * @return Void
- */
-
-static Void rgSCHDrxTtiHdlOnDurDl(RgSchCellCb *cell,uint16_t dlIndex)
-{
- CmLList *node;
- RgSchDRXCellCb *drxCell = NULLP;
- RgSchUeCb *ue = NULLP;
- RgSchDrxUeCb *drxUe = NULLP;
- RgSchCmnCell *cellSch = NULLP;
- uint16_t expiryIndex;
- CmLListCp dlInactvLst; /* list of UE's becoming DL-inactive */
- Bool delInUlScan = FALSE;
-
- /* The DL loop, if onDurationTimer has started, will add the UeCb
- * in the onDurationTmrExprQ. If !delInUlScan, then calculate the next
- * OnDuration occurence, q it there and remove it from the current location.
- */
- /***********************************************************
- * Scanning OnDurationQ in DL
- ***********************************************************/
- drxCell = (cell->drxCb);
-
- delInUlScan = drxCell->delInUlScan;
- //DU_LOG("\nINFO --> SCH : CELL Timer [SFN : %d],[SF : %d]\n",cell->crntTime.sfn,cell->crntTime.slot);
-
- node = drxCell->drxQ[dlIndex].onDurationQ.first;
-
-
- while (node)
- {
- ue = (RgSchUeCb* )node->node;
-
- node = node->next;
-
- drxUe = RG_SCH_DRX_GET_UE(ue);
-
- if ( delInUlScan == TRUE)
- {
- drxUe->distance--;
- }
-
- if ( drxUe->distance != DRX_TMR_EXPRD )
- {
- continue;
- }
-
-
- /* UE is active as onduration is to start */
- drxUe->drxDlInactvMask &= ~RG_SCH_DRX_ONDUR_BITMASK;
-
- /* set the UE as DRX active*/
-
- /* Update UE's inactive mask and if required move UE to ACTIVE state */
- RG_SCH_CMN_DL_UPDT_INACTV_MASK(cell, ue, RG_DRX_INACTIVE);
- /*ACC-TDD */
- /* Temporary fix to delete stale entry */
- if (drxUe->onDurExpIndx != DRX_INVALID)
- {
- DU_LOG("\nDEBUG --> SCH : UEID:%d PreExisted[%d:%d]in onDurExpQ new[%d]",
- ue->ueId,
- drxUe->onDurExpIndx,
- drxUe->onDurExpDistance,
- dlIndex);
- cmLListDelFrm(&(drxCell->drxQ[drxUe->onDurExpIndx].onDurationExpQ),
- &(drxUe->onDurationExpEnt));
-
- drxUe->onDurExpIndx = DRX_INVALID;
- }
- /*start the onduration expiry timer*/
-#ifdef LTE_TDD
- rgSCHDrxCalcNxtTmrExpry(cell,
- ue,
- RG_DL_DELTA,
- drxUe->onDurTmrLen,
- &(drxUe->onDurExpDistance),
- &(expiryIndex)
- );
-#else /*LTE_TDD */
- expiryIndex = ((dlIndex + drxUe->onDurTmrLen) %
- RG_SCH_MAX_DRXQ_SIZE);
- drxUe->onDurExpDistance = (drxUe->onDurTmrLen)/
- RG_SCH_MAX_DRXQ_SIZE;
-#endif /*LTE_TDD */
-
- cmLListAdd2Tail(&(drxCell->drxQ[expiryIndex].onDurationExpQ),
- &(drxUe->onDurationExpEnt));
- //DU_LOG("\nINFO --> SCH : DRXOnDuration Timer Started at [SFN : %d],[SF : %d]\n",cell->crntTime.sfn,cell->crntTime.slot);
- drxUe->onDurationExpEnt.node = (PTR)ue;
- drxUe->onDurExpIndx = expiryIndex;
-
- //DU_LOG("\nINFO --> SCH : DRxOnDuration will Expire = [%d]\n",\
- (cell->crntTime.sfn*10+cell->crntTime.slot+drxUe->onDurTmrLen));
-
- if ( delInUlScan == FALSE )
- {
- /*calculate next on duration occurence
- * and it to the onDuration Queue*/
- rgSCHDrxMvToNxtOnDurOcc(cell,ue,dlIndex,FALSE);
- }/*delInUlScan == FALSE */
-
- }/*while(node)*/
-
- /***********************************************************
- * Scanning OnDurationExpQ in DL
- ***********************************************************/
-
- /* Mark UE as Inactive based on OnDuration Expiry */
- node = drxCell->drxQ[dlIndex].onDurationExpQ.first;
-
- /* Initialize DL inactive list */
- cmLListInit(&dlInactvLst);
-
- while (node)
- {
- ue = (RgSchUeCb*)node->node;
- node = node->next;
- drxUe = RG_SCH_DRX_GET_UE(ue);
-
- if ( delInUlScan == TRUE )
- {
- drxUe->onDurExpDistance--;
- }
-
- if ( drxUe->onDurExpDistance != DRX_TMR_EXPRD )
- {
- continue;
- }
-
-
- /* UE is inactive as onduration has expired */
- drxUe->drxDlInactvMask |= (RG_SCH_DRX_ONDUR_BITMASK);
-
- if( !RG_SCH_DRX_DL_IS_UE_ACTIVE(drxUe))
- {
- /* set the inactive bit to indicate UE has now become inactive */
- ue->dl.dlInactvMask |= RG_DRX_INACTIVE;
-
- /* Add to DL inactive list */
- cmLListAdd2Tail(&dlInactvLst,&(ue->dlDrxInactvLnk));
- ue->dlDrxInactvLnk.node = (PTR)ue;
- }
-
- if ( delInUlScan == FALSE )
- {
- /*Remove from DRX queue*/
- cmLListDelFrm(&(drxCell->drxQ[dlIndex].onDurationExpQ),
- &(drxUe->onDurationExpEnt));
-
- drxUe->onDurExpIndx = DRX_INVALID;
- }
-
- }
-
- /* Send the list to the scheduler to mark UE as inactive */
- cellSch = RG_SCH_CMN_GET_CELL(cell);
- cellSch->apisDl->rgSCHDlInactvtUes(cell, &dlInactvLst);
-
- return;
-}/*rgSCHDrxTtiHdlOnDurDl*/
-
- /** @brief This function handles the Dl HARQ timer's processing per TTI.
- *
- * @details
- * Invoked by - rgSCHDrxTtiHdlDlHarq
- *
- * Function: rgSCHDrxTtiHdlDlHarqRTT
- *
- * Processing steps:
- * - In addition per TTI DRX module must look at Downlink HARQ queues
- * maintained to track HARQ RTT timer and drx-RetransmissionTimer.
- * Every TTI at the scheduling index we shall check these queues and
- * process accordingly.
- *
- * @param RgSchCellCb *cellCb
- * @param uint16_t dlIndex
- * @return Void
- */
-
-static Void rgSCHDrxTtiHdlDlHarqRTT(RgSchCellCb *cell,uint16_t dlIndex)
-{
- CmLList *node;
- RgSchDrxDlHqProcCb *drxHq;
- RgSchDlHqProcCb *dlHq;
- RgSchDRXCellCb *drxCell;
- RgSchDrxUeCb *drxUe;
- uint16_t reTxExpIndx;
- Bool delInUlScan;
- RgSchUeCb *ue;
- CmLListCp dlInactvLst; /* list of UE's becoming DL-inactive */
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- uint8_t cellIdx;
- uint32_t dlInactvMask;
-
- drxCell = cell->drxCb;
- delInUlScan = drxCell->delInUlScan;
-
- /***********************************************************
- * Scanning harqRTTQ in DL
- ***********************************************************/
-
- cmLListInit(&dlInactvLst);
- node = drxCell->drxQ[dlIndex].harqRTTQ.first;
-
- while (node)
- {
- dlHq = (RgSchDlHqProcCb*)node->node;
- node = node->next;
- ue = dlHq->hqE->ue;
-#ifdef EMTC_ENABLE
- if(TRUE == ue->isEmtcUe)
- {
- continue;
- }
-#endif
- drxHq = RG_SCH_DRX_GET_DL_HQ(dlHq);
- drxUe = RG_SCH_DRX_GET_UE(ue);
- cellIdx = ue->cellIdToCellIdxMap[RG_SCH_CELLINDEX(dlHq->hqE->cell)];
- /* add the UE to the cell's retransmission queuee before starting
- * reTx timer, because this will not depend on retx timer trigger*/
- rgSCHUtlDlProcAddToRetx(dlHq->hqE->cell, dlHq);
-
- if ( delInUlScan == FALSE)
- {
- cmLListDelFrm (&(drxCell->drxQ[dlIndex].harqRTTQ),
- &(drxHq->harqRTTEnt));
-
- drxHq->rttIndx = DRX_INVALID;
- }
- /* ccpu00134565: Starting retransmission timer only if timerLen is
- * having non-zero value after reduction, Adding to Retx queue is
- * independent of starting retransmission timer. Hence if part will
- * take care of starting retx timer only*/
- if (drxUe->drxRetransTmrLen > drxHq->retxTmrReduction)
- {
- /* add the harq proc to the re-tx queue--*/
-#ifdef LTE_TDD
- /* ccpu00134196-[Add]-DRX retx timer changes */
- rgSCHDrxCalcNxtTmrExpry(cell,
- ue,
- RG_DL_DELTA,
- drxUe->drxRetransTmrLen-drxHq->retxTmrReduction,
- NULLP, /*retransQ does not maintain distance*/
- &reTxExpIndx
- );
-
-#else /*LTE_TDD*/
- /* ccpu00134196-[Add]-DRX retx timer changes */
- reTxExpIndx = ((dlIndex +
- drxUe->drxRetransTmrLen-drxHq->retxTmrReduction) %
- RG_SCH_MAX_DRXQ_SIZE);
-#endif /*LTE_TDD*/
- /* TODO. Workaround to avoid duplicate entry */
- if(drxHq->reTxIndx == DRX_INVALID)
- {
- cmLListAdd2Tail (&(drxCell->drxQ[reTxExpIndx].harqRetxQ),
- &(drxHq->harqRetxEnt));
-
- drxHq->harqRetxEnt.node = (PTR)dlHq;
- drxHq->reTxIndx = reTxExpIndx;
- }
- else
- {
- DU_LOG("\nERROR --> SCH : CRNTI:%d "
- "Adding Retx Node to expire at RetxIndx: %d at dlIndex %d "
- "drxHq->reTxIndx %d", ue->ueId, reTxExpIndx, dlIndex,
- drxHq->reTxIndx);
- continue;
- }
- /*mark the ue as active for downlink--*/
- drxUe->drxDlInactvMask &= ~(RG_SCH_DRX_DLHQ_BITMASK << dlHq->procId);
- drxUe->drxDlInactvMaskPerCell[cellIdx] &= ~(RG_SCH_DRX_DLHQ_BITMASK << dlHq->procId);
-
- /* Update UE's inactive mask and if required move UE to ACTIVE state */
- RG_SCH_CMN_DL_UPDT_INACTV_MASK(cell, ue, RG_DRX_INACTIVE);
- }
- }/*while(node)*/
-
- /***********************************************************
- * Scanning harqRetxQ in DL
- ***********************************************************/
-
- node = drxCell->drxQ[dlIndex].harqRetxQ.first;
- while (node)
- {
- dlHq = (RgSchDlHqProcCb*)node->node;
- ue = dlHq->hqE->ue;
- drxUe = RG_SCH_DRX_GET_UE(ue);
- node = node->next;
- drxHq = RG_SCH_DRX_GET_DL_HQ(dlHq);
- cellIdx = ue->cellIdToCellIdxMap[RG_SCH_CELLINDEX(dlHq->hqE->cell)];
-
- /*mark the ue as in-active for downlink*/
- drxUe->drxDlInactvMaskPerCell[cellIdx] |= (RG_SCH_DRX_DLHQ_BITMASK << dlHq->procId);
-
- dlInactvMask = RG_SCH_DRX_DLHQ_BITMASK << dlHq->procId;
-
- for(cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
- {
- dlInactvMask &= drxUe->drxDlInactvMaskPerCell[cellIdx];
- }
-
- drxUe->drxDlInactvMask |= dlInactvMask;
-
- /* if no other condition is keeping ue active,
- * inactivate the Ue
- */
- if ( !RG_SCH_DRX_DL_IS_UE_ACTIVE(drxUe))
- {
- ue->dl.dlInactvMask |= (RG_DRX_INACTIVE);
-
- /* Add to DL inactive list */
- cmLListAdd2Tail(&dlInactvLst,&(ue->dlDrxInactvLnk));
- ue->dlDrxInactvLnk.node = (PTR)ue;
- }
-
- /*remove the harq proc from this queue*/
- if ( delInUlScan == FALSE)
- {
- cmLListDelFrm (&(drxCell->drxQ[dlIndex].harqRetxQ),
- &(drxHq->harqRetxEnt));
- drxHq->reTxIndx = DRX_INVALID;
- }
- }
- /*Call schedulers to inactivate ue*/
- cellSch->apisDl->rgSCHDlInactvtUes(cell, &dlInactvLst);
-
- return;
-}
-
- /** @brief This function handles the Ul HARQ timer's processing per TTI.
- *
- * @details
- * Invoked by - rgSCHDrxTtiHdlDlHarq
- *
- * Function: rgSCHDrxTtiHdlUlHarqRTT
- *
- * Processing steps:
- * - In addition per TTI DRX module must look at Downlink HARQ queues
- * maintained to track HARQ RTT timer and drx-RetransmissionTimer.
- * Every TTI at the scheduling index we shall check these queues and
- * process accordingly.
- *
- * - Though these timers are related to downlink HARQ processing, they
- * have an impact on uplink scheduling. The reason is that the UE,
- * if active for downlink scheduling implies that it is reading
- * PDCCHs i.e. we can still send uplink allocations to the UE. Hence
- * every TTI Uplink too would look at the harqRTTQ and harqRetxQ.
- *
- *
- *
- * @param RgSchCellCb *cellCb
- * @param uint16_t ulIndex
- * @return Void
- */
-
-static Void rgSCHDrxTtiHdlUlHarqRTT(RgSchCellCb *cell,uint16_t ulIndex)
-{
- CmLList *node;
- RgSchDrxDlHqProcCb *drxHq;
- RgSchDlHqProcCb *dlHq;
- RgSchDRXCellCb *drxCell;
- RgSchDrxUeCb *drxUe;
- Bool delInUlScan;
- RgSchUeCb *ue;
- CmLListCp ulInactvLst; /* list of UE's becoming DL-inactive */
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- uint8_t cellIdx;
- uint32_t ulInactvMask;
-
-
- drxCell = cell->drxCb;
- delInUlScan = drxCell->delInUlScan;
-
- cmLListInit(&ulInactvLst);
-
- /***********************************************************
- * Scanning harqRTTQ in UL
- ***********************************************************/
-
- /*
- Though these timers are related to downlink HARQ processing, they
- have an impact on uplink scheduling. The reason is that the UE,
- if active for downlink scheduling implies that it is reading
- PDCCHs i.e. we can still send uplink allocations to the UE. Hence
- every TTI Uplink too would look at the harqRTTQ and harqRetxQ.
- */
-
- node = drxCell->drxQ[ulIndex].harqRTTQ.first;
- while (node)
- {
- dlHq = (RgSchDlHqProcCb*)node->node;
- ue = dlHq->hqE->ue;
- drxUe = RG_SCH_DRX_GET_UE(ue);
- node = node->next;
- drxHq = RG_SCH_DRX_GET_DL_HQ(dlHq);
- cellIdx = ue->cellIdToCellIdxMap[RG_SCH_CELLINDEX(dlHq->hqE->cell)];
-
- if ( delInUlScan == TRUE )
- {
- /* remove the harq proc from this queue--*/
- cmLListDelFrm (&(drxCell->drxQ[ulIndex].harqRTTQ),
- &(drxHq->harqRTTEnt));
-
- drxHq->rttIndx = DRX_INVALID;
- }
-
- /* mark the ue as active for uplink--*/
- drxUe->drxUlInactvMask &= ~(RG_SCH_DRX_DLHQ_BITMASK << dlHq->procId);
- drxUe->drxUlInactvMaskPerCell[cellIdx] &= ~(RG_SCH_DRX_DLHQ_BITMASK << dlHq->procId);
-
- /* Update UE's inactive mask and if required move UE to ACTIVE state */
- RG_SCH_CMN_UL_UPDT_INACTV_MASK( cell, ue, RG_DRX_INACTIVE);
- }
-
- /***********************************************************
- * Scanning harqRetxQ in UL
- ***********************************************************/
- node = drxCell->drxQ[ulIndex].harqRetxQ.first;
- while (node)
- {
- dlHq = (RgSchDlHqProcCb*)node->node;
- ue = dlHq->hqE->ue;
- drxUe = RG_SCH_DRX_GET_UE(ue);
- drxHq = RG_SCH_DRX_GET_DL_HQ(dlHq);
- cellIdx = ue->cellIdToCellIdxMap[RG_SCH_CELLINDEX(dlHq->hqE->cell)];
-
- /*mark the ue as in-active for uplink*/
-
- drxUe->drxUlInactvMaskPerCell[cellIdx] |= (RG_SCH_DRX_DLHQ_BITMASK << dlHq->procId);
-
- ulInactvMask = RG_SCH_DRX_DLHQ_BITMASK << dlHq->procId;
-
- for(cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
- {
- ulInactvMask &= drxUe->drxUlInactvMaskPerCell[cellIdx];
- }
-
- drxUe->drxUlInactvMask |= ulInactvMask;
-
- if(!RG_SCH_DRX_UL_IS_UE_ACTIVE(drxUe))
- {
- ue->ul.ulInactvMask |= (RG_DRX_INACTIVE);
-
- cmLListAdd2Tail(&ulInactvLst,&(ue->ulDrxInactvLnk));
- ue->ulDrxInactvLnk.node = (PTR)ue;
- }
-
- /* remove the harq proc from this queue*/
- if ( delInUlScan == TRUE)
- {
- cmLListDelFrm (&(drxCell->drxQ[ulIndex].harqRetxQ),
- &(drxHq->harqRetxEnt));
- drxHq->reTxIndx = DRX_INVALID;
- }
-
- node = node->next;
- }
- cellSch->apisUl->rgSCHUlInactvtUes(cell, &ulInactvLst);
-
- return;
-
-}
-
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: SCH layer
-
- Type: C source file
-
- Desc: C source code file for SPS related functions which are
- currently dummy
-
- File: rg_sch_sps.c
-
-**********************************************************************/
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "lrg.h"
-#include "rgr.h"
-#include "tfu.h"
-#include "rgm.h"
-#include "rg_env.h"
-#include "rg_sch_inf.h"
-#include "rg_sch.h"
-#include "rg_sch_err.h"
-#include "rg_sch_cmn.h"
-
-/* header/extern include files (.x) */
-#include "tfu.x" /* TFU types */
-#include "lrg.x" /* layer management typedefs for MAC */
-#include "rgr.x" /* layer management typedefs for MAC */
-#include "rgm.x" /* layer management typedefs for MAC */
-#include "rg_sch_inf.x" /* typedefs for Scheduler */
-#include "rg_sch.x" /* typedefs for Scheduler */
-#include "rg_sch_cmn.x"
-
-/**
- *@brief Initializes the SPS related global data structures
- *
- *@details
- * Function : rgSCHCmnSpsInit
- *
- * @param[in] Void
- *
- * @return Void
- **/
-Void rgSCHCmnSpsInit()
-{
-
- return;
-}
-
-/**
- *@brief Initializes UE with SPS info
- *
- *@details
- * Function : rgSCHCmnSpsUeCfg
- *
- * @param[in] Void
- *
- * @return Void
- **/
-S16 rgSCHCmnSpsUeCfg(RgSchCellCb *cell,RgSchUeCb *ue,RgrUeCfg *ueCfg,RgSchErrInfo *err)
-{
-
- return ROK;
-}
-
-/**
- *@brief Re-Initializes UE with SPS info
- *
- *@details
- * Function : rgSCHCmnSpsUeReCfg
- *
- * @param[in] Void
- *
- * @return Void
- **/
-S16 rgSCHCmnSpsUeRecfg(RgSchCellCb *cell,RgSchUeCb *ue,RgrUeRecfg *ueRecfg,RgSchErrInfo *err)
-{
-
- return ROK;
-}
-
-/**
- *@brief Clears the UE of SPS info
- *
- *@details
- * Function : rgSCHCmnSpsUeDel
- *
- * @param[in] Void
- *
- * @return Void
- **/
-Void rgSCHCmnSpsUeDel(RgSchCellCb *cell,RgSchUeCb *ue)
-{
-
- return;
-}
-
-/**
- *@brief Validates cell config for SPS
- *
- *@details
- * Function : rgSCHCmnSpsCellCfg
- *
- * @param[in] Void
- *
- * @return Void
- **/
-S16 rgSCHCmnSpsCellCfg(RgSchCellCb *cell,RgrCellCfg *cellCfg,RgSchErrInfo *err)
-{
-
- return ROK;
-}
-
-/**
- *@brief Deletes cell config for SPS
- *
- *@details
- * Function : rgSCHCmnSpsCellDel
- *
- * @param[in] Void
- *
- * @return Void
- **/
-Void rgSCHCmnSpsCellDel(RgSchCellCb *cell)
-{
-
- return;
-}
-
-/**
- *@brief Configures DL LC for SPS
- *
- *@details
- * Function :rgSCHCmnSpsDlLcCfg
- *
- * @param[in] Void
- *
- * @return Void
- **/
-S16 rgSCHCmnSpsDlLcCfg(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *dlLc,RgrLchCfg *lcCfg,RgSchErrInfo *err)
-{
-
- return ROK;
-}
-
-Void rgSchCmnDlSfHqDel
-ARGS((
-RgSchUeCb *ue,
-RgSchCellCb *cell
-))
-{
- return;
-}
-
-S16 rgSCHCmnSpsDlLcRecfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *dlLc,
-RgrLchRecfg *lcRecfg,
-RgSchErrInfo *err
-))
-{
-
- return ROK;
-}
-
-Void rgSCHCmnSpsUlLcgDel ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchLcgCb *lcg
-))
-{
- return;
-}
-
-Void rgSCHCmnSpsDlLcDel ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *dlLc
-))
-{
- return;
-}
-
-S16 rgSCHCmnSpsUlTti ARGS((
-RgSchCellCb *cell,
-RgSchCmnUlRbAllocInfo *allocInfo
-))
-{
-
- return ROK;
-}
-
-Void rgSCHCmnSpsDlDedBoUpd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *dlLc
-))
-{
-
- return;
-}
-
-Void rgSCHCmnSpsDlProcAddToRetx ARGS((
-RgSchCellCb *cell,
-RgSchDlHqProcCb *hqP
-))
-{
-
- return;
-}
-
-Void rgSCHCmnSpsDlCqiIndHndlr ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-CmLteTimingInfo timingInfo
-))
-{
-
- return;
-}
-
-S16 rgSCHCmnSpsUlCqiInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-))
-{
-
- return ROK;
-}
-
-S16 rgSCHCmnSpsBsrRpt ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchLcgCb *ulLcg
-))
-{
-
- return ROK;
-}
-
-Void rgSCHCmnSpsPhrInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-))
-{
-
- return;
-}
-
-Void rgSCHCmnSpsDlRelPdcchFbk ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-Bool isAck
-))
-{
-
- return;
-}
-
-Void rgSCHCmnSpsDlProcAck ARGS((
-RgSchCellCb *cell,
-RgSchDlHqProcCb *hqP
-))
-{
-
- return;
-}
-
-Void rgSCHCmnSpsDlUeReset ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-))
-{
-
- return;
-}
-
-Void rgSCHCmnSpsUlUeReset ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-))
-{
-
- return;
-}
-
-Void rgSCHCmnSpsUlProcRelInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-Bool isExplRel
-))
-{
-
- return;
-}
-
-Void rgSCHCmnSpsUlProcActInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint16_t spsSduSize
-))
-{
-
- return;
-}
-
-S16 rgSCHCmnSpsUlProcCrcInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-CmLteTimingInfo crcTime
-))
-{
-
- return ROK;
-}
-
-S16 rgSCHCmnSpsUlProcDtxInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-CmLteTimingInfo dtxTime
-))
-{
-
- return ROK;
-}
-
-Void rgSCHCmnSpsDlUpdDlSfAllocWithSps ARGS((
-RgSchCellCb *cell,
-CmLteTimingInfo schdTime,
-RgSchDlSf *dlSf
-))
-{
-
- return;
-}
-
-
-
-
-
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/**********************************************************************
-
- Name: LTEMAC - Error File
-
- Type: C include file
-
- Desc: Error defines required by LTEMAC layer
-
- File: rg_sch_err.h
-
-*********************************************************************21*/
-/*
-* The defines declared in this file correspond to those
-* used by LTEMAC Layer
-*
-*/
-
-#ifndef __RGSCHERRH__
-#define __RGSCHERRH__
-
-/* defines */
-
-
-/* Macro definitions */
-#define RGSCHLOGERROR(_inst, errCls, errCode, errVal, errDesc) \
- SLogError(rgSchCb[_inst].rgSchInit.ent, rgSchCb[_inst].rgSchInit.inst,\
- rgSchCb[_inst].rgSchInit.procId, \
- (Txt *) __FILE__, \
- (S32) __LINE__, \
- (ErrCls) (errCls), \
- (ErrCode) (errCode), \
- (ErrVal) (errVal), \
- (Txt *) errDesc)
-
-#ifdef LTE_L2_MEAS
-#define RGSCHFILLERR(_err, _errType, _errCause) \
- _err.errType = _errType; \
- _err.errCause = _errCause;
-#endif
-/* error codes */
-#define ERGBASE 0
-
-#define ERGXXX (ERGBASE + 0) /* reserved */
-#define ERRRG (ERGBASE + 0) /* reserved */
-
-#define RGSCHERR_NONE ERGBASE
-
-#define ERG001 (ERRRG + 1) /* gk_sch.c: 535 */
-#define ERG002 (ERRRG + 2) /* gk_sch.c: 548 */
-#define ERG003 (ERRRG + 3) /* gk_sch.c: 606 */
-#define ERG004 (ERRRG + 4) /* gk_sch.c: 616 */
-#define ERG005 (ERRRG + 5) /* gk_sch.c: 691 */
-#define ERG006 (ERRRG + 6) /* gk_sch.c: 704 */
-#define ERG007 (ERRRG + 7) /* gk_sch.c: 792 */
-#define ERG008 (ERRRG + 8) /* gk_sch.c: 805 */
-#define ERG009 (ERRRG + 9) /* gk_sch.c: 879 */
-#define ERG010 (ERRRG + 10) /* gk_sch.c: 956 */
-
-#define ERG011 (ERRRG + 11) /* gk_sch_cmn.c:24144 */
-
-#define ERG012 (ERRRG + 12) /* gk_sch_sps.c:9181 */
-
-#define ERG013 (ERRRG + 13) /* gk_sch_tom.c: 608 */
-#define ERG014 (ERRRG + 14) /* gk_sch_tom.c: 684 */
-
-#define ERG015 (ERRRG + 15) /* gk_sch_utl.c:4209 */
-#define ERG016 (ERRRG + 16) /* gk_sch_utl.c:4285 */
-#define ERG017 (ERRRG + 17) /* gk_sch_utl.c:5027 */
-#define ERG018 (ERRRG + 18) /* gk_sch_utl.c:5084 */
-#define ERG019 (ERRRG + 19) /* gk_sch_utl.c:5112 */
-#define ERG020 (ERRRG + 20) /* gk_sch_utl.c:5257 */
-#define ERG021 (ERRRG + 21) /* gk_sch_utl.c:5266 */
-#define ERG022 (ERRRG + 22) /* gk_sch_utl.c:5897 */
-#define ERG023 (ERRRG + 23) /* gk_sch.c:902 */
-#define ERG024 (ERRRG + 24) /* gk_sch.c:915 */
-#define ERG025 (ERRRG + 25) /* gk_sch.c:988 */
-#define ERG026 (ERRRG + 26) /* gk_sch.c:998 */
-
-
-/* ***********************************************************
- * Error Type
- *************************************************************/
-#define RGSCHERR_TYPE_BASE 0
-#define RGSCHERR_CAUSE_BASE 0
-
-/* ErrType defines for DHM */
-#define RG_DHM_ERRTYPE_BASE (RGSCHERR_CAUSE_BASE + 1)
-#define RGSCHERR_DHM_SND_DAT_REQ RG_DHM_ERRTYPE_BASE
-#define RGSCHERR_DHM_FDBK_IND (RG_DHM_ERRTYPE_BASE + 1)
-#define RGSCHERR_DHM_SND_STA_IND (RG_DHM_ERRTYPE_BASE + 2)
-#define RGSCHERR_DHM_FDBK_IND_INVALID_CB (RGSCHERR_DHM_SND_STA_IND + 3)
-#define RGSCHERR_DHM_SND_HQ_FDB_REQ (RG_DHM_ERRTYPE_BASE + 4)
-/* ErrType defines for TOM */
-#define RG_TOM_ERRTYPE_BASE (RGSCHERR_DHM_SND_HQ_FDB_REQ + 1)
-#define RGSCHERR_TOM_RAREQIND RG_TOM_ERRTYPE_BASE
-#define RGSCHERR_TOM_HARQACKIND (RG_TOM_ERRTYPE_BASE + 1)
-#define RGSCHERR_TOM_SRIND (RG_TOM_ERRTYPE_BASE + 2)
-#define RGSCHERR_TOM_DLCQIIND (RG_TOM_ERRTYPE_BASE + 3)
-#define RGSCHERR_TOM_DATIND (RG_TOM_ERRTYPE_BASE + 4)
-#define RGSCHERR_TOM_DECFAILIND (RG_TOM_ERRTYPE_BASE + 5)
-#define RGSCHERR_TOM_TAIND (RG_TOM_ERRTYPE_BASE + 6)
-#define RGSCHERR_TOM_TTIIND (RG_TOM_ERRTYPE_BASE + 7)
-/* Changes for MIMO feature addition */
-#define RGSCHERR_TOM_DOAIND (RG_TOM_ERRTYPE_BASE + 8)
-/* Added changes of TFU_UPGRADE */
-#ifdef TFU_UPGRADE
-#define RGSCHERR_TOM_RAWCQIIND (RG_TOM_ERRTYPE_BASE + 9)
-#define RGSCHERR_TOM_SRSIND (RG_TOM_ERRTYPE_BASE + 10)
-#endif
-/* GOM Module related error MACROs for error type */
-#define RG_GOM_ERRTYPE_BASE (RGSCHERR_TOM_TTIIND + 1)
-#define RGSCHERR_GOM_CFG_REQ (RG_GOM_ERRTYPE_BASE)
-#define RGSCHERR_GOM_RECFG_REQ (RG_GOM_ERRTYPE_BASE + 1)
-#define RGSCHERR_GOM_DEL_REQ (RG_GOM_ERRTYPE_BASE + 2)
-#define RGSCHERR_GOM_RESET_REQ (RG_GOM_ERRTYPE_BASE + 3)
-#ifdef LTE_ADV
-#define RGSCHERR_GOM_SCELL_REQ (RG_GOM_ERRTYPE_BASE + 4)
-#endif /* LTE_ADV */
-/* L2 Measurement Module related error MACROs for error type */
-#ifdef LTE_L2_MEAS
-#define RG_L2M_ERRTYPE_BASE (RGSCHERR_GOM_RESET_REQ + 1)
-#define RGSCHERR_L2M_MEASREQ (RG_L2M_ERRTYPE_BASE)
-#endif
-/* ***********************************************************
- * Error Cause
- *************************************************************/
-/* Errcause defines for DHM */
-#define RG_DHM_ERRCAUSE_BASE (RGSCHERR_GOM_DEL_REQ + 1)
-#define RG_DHM_MEM_ALLOC_FAIL (RG_DHM_ERRCAUSE_BASE )
-/* Errcause defines for RAM */
-#define RG_RAM_ERRCAUSE_BASE (RG_DHM_MEM_ALLOC_FAIL + 1)
-#define RGSCHERR_RAM_MEM_EXHAUST (RG_RAM_ERRCAUSE_BASE )
-#define RGSCHERR_RAM_NO_MSG3_RCVD (RG_RAM_ERRCAUSE_BASE + 1)
-#define RGSCHERR_RAM_RNTI_EXHAUST (RG_RAM_ERRCAUSE_BASE + 2)
-/* Errcause defines for RAM */
-#define RG_TOM_ERRCAUSE_BASE (RGSCHERR_RAM_RNTI_EXHAUST + 1)
-#define RGSCHERR_TOM_INV_CELL_ID (RG_TOM_ERRCAUSE_BASE )
-#define RGSCHERR_TOM_MEM_EXHAUST (RG_TOM_ERRCAUSE_BASE + 1)
-/* CFG Module related error MACROs for error cause */
-#define RG_CFG_ERRCAUSE_BASE (RGSCHERR_TOM_MEM_EXHAUST + 1)
-#define RGSCHERR_CFG_INVALID_RGR_CELL_CFG (RG_CFG_ERRCAUSE_BASE)
-#define RGSCHERR_CFG_INVALID_RGR_UE_CFG (RG_CFG_ERRCAUSE_BASE + 1)
-#define RGSCHERR_CFG_INVALID_RGR_DED_LC_CFG (RG_CFG_ERRCAUSE_BASE + 2)
-#define RGSCHERR_CFG_INVALID_RGR_DED_LCG_CFG (RG_CFG_ERRCAUSE_BASE + 2)
-#define RGSCHERR_CFG_INVALID_RGR_CMN_LC_CFG (RG_CFG_ERRCAUSE_BASE + 3)
-#define RGSCHERR_CFG_INVALID_RGR_CELL_RECFG (RG_CFG_ERRCAUSE_BASE + 4)
-#define RGSCHERR_CFG_INVALID_RGR_UE_RECFG (RG_CFG_ERRCAUSE_BASE + 5)
-#define RGSCHERR_CFG_INVALID_RGR_LC_RECFG (RG_CFG_ERRCAUSE_BASE + 6)
-#define RGSCHERR_CFG_INVALID_RGR_LCG_RECFG (RG_CFG_ERRCAUSE_BASE + 6)
-#define RGSCHERR_CFG_RGR_CELL_CFG (RG_CFG_ERRCAUSE_BASE + 7)
-#define RGSCHERR_CFG_RGR_UE_CFG (RG_CFG_ERRCAUSE_BASE + 8)
-#define RGSCHERR_CFG_RGR_DED_LC_CFG (RG_CFG_ERRCAUSE_BASE + 9)
-#define RGSCHERR_CFG_RGR_DED_LCG_CFG (RG_CFG_ERRCAUSE_BASE + 9)
-#define RGSCHERR_CFG_RGR_CMN_LC_CFG (RG_CFG_ERRCAUSE_BASE + 10)
-#define RGSCHERR_CFG_RGR_CELL_RECFG (RG_CFG_ERRCAUSE_BASE + 11)
-#define RGSCHERR_CFG_RGR_UE_RECFG (RG_CFG_ERRCAUSE_BASE + 12)
-#define RGSCHERR_CFG_RGR_LC_RECFG (RG_CFG_ERRCAUSE_BASE + 13)
-#define RGSCHERR_CFG_RGR_LCG_RECFG (RG_CFG_ERRCAUSE_BASE + 13)
-#define RGSCHERR_CFG_RGR_CELL_DEL (RG_CFG_ERRCAUSE_BASE + 14)
-#define RGSCHERR_CFG_RGR_UE_DEL (RG_CFG_ERRCAUSE_BASE + 15)
-#define RGSCHERR_CFG_RGR_LC_DEL (RG_CFG_ERRCAUSE_BASE + 16)
-#define RGSCHERR_CFG_RGR_LCG_DEL (RG_CFG_ERRCAUSE_BASE + 16)
-#define RGSCHERR_CFG_INVALID_RGR_UE_RESET (RG_CFG_ERRCAUSE_BASE + 17)
-#define RGSCHERR_CFG_RGR_UE_RESET (RG_CFG_ERRCAUSE_BASE + 18)
-/* Added for SI Enhancement*/
-#ifdef RGR_SI_SCH
-#define RGSCHERR_CFG_INVALID_RGR_SI_CFG (RG_CFG_ERRCAUSE_BASE + 19)
-#endif/*RGR_SI_SCH*/
-#ifdef LTEMAC_HDFDD
-#define RGSCHERR_HDFDD_SPSCFGRD (RG_CFG_ERRCAUSE_BASE + 20)
-#endif
-/* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
-#define RGSCHERR_CQIREPT (RG_CFG_ERRCAUSE_BASE + 21)
-#endif
-
-/* LTE_ADV_FLAG_REMOVED_START */
-#define RGSCHERR_CFG_INVALID_RGR_LOAD_INF (RG_CFG_ERRCAUSE_BASE + 22)
-/* LTE_ADV_FLAG_REMOVED_END */
-
-#ifdef LTE_ADV
-#define RGSCHERR_CFG_INVALID_RGR_UE_SCELL_RECFG (RG_CFG_ERRCAUSE_BASE + 23)
-#define RGSCHERR_CFG_INVALID_RGR_UE_SCELL_PUCCH_RECFG (RG_CFG_ERRCAUSE_BASE + 24)
-#endif
-#define RGSCHERR_CFG_INVALID_RGR_ENB_CFG (RG_CFG_ERRCAUSE_BASE + 25)
-
-/* Scheduler related error causes */
-#define RG_SCH_ERRCAUSE_BASE (RGSCHERR_CFG_RGR_LC_DEL + 1)
-#define RGSCHERR_SCH_CFG RG_SCH_ERRCAUSE_BASE
-#define RGSCHERR_SCH_LCG_NOT_CFGD (RG_SCH_ERRCAUSE_BASE + 1)
-#define RGSCHERR_SCH_NO_LCG_CFGD (RG_SCH_ERRCAUSE_BASE + 2)
-#ifdef LTE_L2_MEAS /* TODO: Values? */
-#define RG_L2MEAS_ERRTYPE_BASE (RGSCHERR_SCH_NO_LCG_CFGD + 1)
-#define RGSCHERR_SCH_L2MEAS (RG_L2MEAS_ERRTYPE_BASE + 2)
-#define RGSCHERR_SCH_INVALID_MEAS_TYPE (RG_L2MEAS_ERRTYPE_BASE + 3)
-#define RGSCHERR_SCH_INVALID_PARAM_RANGE (RG_L2MEAS_ERRTYPE_BASE + 4)
-#define RGSCHERR_SCH_INVALID_CELLID (RG_L2MEAS_ERRTYPE_BASE + 5)
-#define RGSCHERR_SCH_INVALID_MEASTYPE (RG_L2MEAS_ERRTYPE_BASE + 6)
-#define RGSCHERR_SCH_DUP_TRANSID (RG_L2MEAS_ERRTYPE_BASE + 7)
-#define RGSCHERR_SCH_L2MEAS_FAILED (RG_L2MEAS_ERRTYPE_BASE + 8)
-#define RGSCHERR_SCH_ALLOC_FAILED (RG_L2MEAS_ERRTYPE_BASE + 9)
-#define RGSCHERR_SCH_INVALID_QCI_VAL (RG_L2MEAS_ERRTYPE_BASE + 10)
-#endif /* LTE_L2_MEAS */
-
-
-#endif /* __RGSCHERRH__ */
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Entry point fucntions
-
- File: rg_sch_gom.c
-
-**********************************************************************/
-
-/** @file rg_sch_gom.c
-@brief This module does processing related to handling of upper interface APIs
-invoked by RRM towards MAC.
-*/
-
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "lrg.h"
-#include "rgr.h"
-#include "tfu.h"
-#include "rg_env.h"
-#include "rg_sch_inf.h"
-#include "rg_sch.h"
-#include "rg_sch_err.h"
-#include "sch_utils.h"
-
-/* header/extern include files (.x) */
-#include "lrg.x"
-#include "rgr.x"
-#include "tfu.x"
-#include "rg_sch_inf.x"
-#include "rg_sch.x"
-#include "mac_sch_interface.h"
-
-/* local defines */
-static S16 rgSCHGomHndlCfgReq ARGS((RgSchCb *instCb, SpId spId,
- RgrCfg *cfg, RgSchErrInfo *errInfo));
-static S16 rgSCHGomHndlRecfgReq ARGS((RgSchCb *instCb, SpId spId,
- RgrRecfg *recfg, RgSchErrInfo *errInfo));
-static S16 rgSCHGomHndlResetReq ARGS((RgSchCb *instCb,SpId spId,RgrRst *reset,
- RgSchErrInfo *errInfo));
-static S16 rgSCHGomGetCellIdFrmCfgReq ARGS((RgrCfgReqInfo *rgrCfgReq,
- CmLteCellId *cellId));
-static S16 rgSCHGomCfgReq ARGS((Region reg, Pool pool, RgSchCb *instCb,
- RgrCfgTransId transId, RgrCfgReqInfo *cfgReqInfo));
-static S16 rgSCHGomEnqCfgReq ARGS((Region reg, Pool pool, RgSchCellCb *cell,
- RgrCfgTransId transId, RgrCfgReqInfo *rgrCfgReq));
-static S16 rgSCHGomHndlDelReq ARGS((RgSchCb *instCb,SpId spId,
- RgrDel *del,RgSchErrInfo *errInfo));
-#ifdef LTE_ADV
-static S16 rgSCHGomHndlSCellActDeactReq ARGS((RgSchCb *instCb, SpId spId,
- RgrSCellActDeactEvnt *sCellActDeactEvnt, RgSchErrInfo *errInfo, uint8_t action));
-#endif /* LTE_ADV */
-#ifdef EMTC_ENABLE
-S16 rgSchEmtcGetSiWinPerd ARGS((
-RgSchCellCb *cell,
-uint16_t *siWinSize,
-uint16_t *minPeriod
-));
-extern S16 rgSCHEmtcUtlCalMcsAndNPrb
-(
- RgSchCellCb *cell,
- uint8_t cfgType,
- MsgLen msgLen,
- uint8_t siId
- );
-
-S32 rgSCHEmtcUtlGetAllwdCchTbSzForSI ARGS(
-(
-uint32_t bo
-));
-
-Void rgSCHEmtcWarningSiCfg ARGS(
-(
-RgSchCellCb *cell,
-RgrWarningSiCfgReqInfo *warningSiCfgReqInfo,
-uint16_t idx
-));
-#endif
-
-
-/* local typedefs */
-
-/* local externs */
-
-/* forward references */
-
-\f
-
-/**
- * @brief Handler for config request from RRM to Schedular.
- *
- * @details
- *
- * Function: rgSCHGomHndlCfg
- *
- * This API is called from schedulers UIM and it handles config request
- * from RRM to Scheduler.
- *
- * Processing Steps:
- * - If the request is for the inactive cell,
- * - Handle request.Call rgSCHGomCfgReq.
- * - Else,
- * - Enqueue the request. Call rgSCHGomEnqCfgReq.
- *
- * @param[in] Pst *pst
- * @param[in] RgSchCb *instCb
- * @param[in] RgrCfgTransId transId
- * @param[in] RgrCfgReqInfo *cfgReqInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHGomHndlCfg(Pst *pst,RgSchCb *instCb,RgrCfgTransId transId,RgrCfgReqInfo *cfgReqInfo)
-{
- S16 ret;
- SpId spId = 0;
- CmLteCellId cellId;
- RgSchCellCb *cell = NULLP;
- uint8_t cfmStatus = RGR_CFG_CFM_NOK;
-
- /* Apply the configuration for Cell Configuration or Delete */
- if (cfgReqInfo->action != RGR_RECONFIG)
- {
- ret = rgSCHGomCfgReq (pst->region, pst->pool, instCb,
- transId, cfgReqInfo);
- return (ret);
- }
-
- /* Fetch the cell Id for the recieved request */
- if((rgSCHGomGetCellIdFrmCfgReq(cfgReqInfo, &cellId)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Action.Config Type Error");
-
- SCH_FREE(cfgReqInfo,
- (Size)sizeof(*cfgReqInfo));
- cfgReqInfo = NULLP;
- schSendCfgCfm(pst->region, pst->pool, transId, cfmStatus);
- return RFAILED;
- }
- /* Extract the cell and Enquee Config Request */
- if(NULLP != instCb->rgrSap[spId].cell)
- {
- if(cellId != instCb->rgrSap[spId].cell->cellId)
- {
- DU_LOG("\nERROR --> SCH : Cell with Id %d already exists "
- "on sap %d", instCb->rgrSap[spId].cell->cellId, spId);
-
- SCH_FREE(cfgReqInfo,
- (Size)sizeof(*cfgReqInfo));
- cfgReqInfo = NULLP;
- schSendCfgCfm(pst->region, pst->pool, transId, cfmStatus);
- return RFAILED;
- }
- cell = instCb->rgrSap[spId].cell;
-
- /* Enqueue the configuration */
- ret = rgSCHGomEnqCfgReq(pst->region, pst->pool, cell, transId, cfgReqInfo);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : rgSCHGomHndlCfg: Enqueuing CfgReq "
- "Failed ");
-
- SCH_FREE(cfgReqInfo,
- (Size)sizeof(*cfgReqInfo));
- cfgReqInfo = NULLP;
- schSendCfgCfm(pst->region, pst->pool, transId, cfmStatus);
- return RFAILED;
- }
-
- return ROK;
- }
- SCH_FREE(cfgReqInfo,
- (Size)sizeof(*cfgReqInfo));
- cfgReqInfo = NULLP;
- schSendCfgCfm(pst->region, pst->pool, transId, cfmStatus);
- return RFAILED;
-
-}/* rgSCHGomHndlCfg */
-
-
-/**
- * @brief Handler to handle config request from RRM to Scheduler.
- *
- * @details
- *
- * Function: rgSCHGomCfgReq
- *
- * This API handles processing for config request from RRM to Scheduler.
- *
- * Processing Steps:
- * - If Configuration request, call rgSCHGomHndlCfgReq.
- * - Else if Reconfiguration request, call rgSCHGomHndlRecfgReq.
- * - If successful, send configuration confirm to RRM.
- * Call schSendCfgCfm else FAIL.
- *
- * @param[in] Region reg
- * @param[in] Pool pool
- * @param[in] RgSchCb *instCb
- * @param[in] RgrCfgTransId transId
- * @param[in] RgrCfgReqInfo *cfgReqInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHGomCfgReq(Region reg,Pool pool,RgSchCb *instCb,RgrCfgTransId transId,RgrCfgReqInfo *cfgReqInfo)
-{
- SpId spId = 0;
- uint8_t cfmStatus = RGR_CFG_CFM_OK;
- S16 ret;
- RgSchErrInfo errInfo;
-#ifdef EMTC_ENABLE
-printf("\nDEBUG --> SCH: AT MAC rgSCHGomCfgReq \n");
-#endif
-
- /* Process Config/Reconfig/Delete request from RRM */
- switch (cfgReqInfo->action)
- {
- case SCH_CONFIG:
- {
- ret = rgSCHGomHndlCfgReq(instCb, spId,
- &cfgReqInfo->u.cfgInfo, &errInfo);
- break;
- }
- case RGR_RECONFIG:
- {
- ret = rgSCHGomHndlRecfgReq(instCb, spId,
- &cfgReqInfo->u.recfgInfo, &errInfo);
- break;
- }
- case RGR_RESET:
- {
- ret = rgSCHGomHndlResetReq(instCb, spId,
- &cfgReqInfo->u.rstInfo, &errInfo);
- break;
- }
- case RGR_DELETE:
- {
- ret = rgSCHGomHndlDelReq(instCb, spId,
- &cfgReqInfo->u.delInfo, &errInfo);
- break;
- }
-#ifdef LTE_ADV
- case RGR_SCELL_ACT:
- case RGR_SCELL_DEACT:
- case RGR_SCELL_READY:
- {
- ret = rgSCHGomHndlSCellActDeactReq(instCb, spId,
- &cfgReqInfo->u.sCellActDeactEvnt, &errInfo, cfgReqInfo->action);
- break;
- }
-#endif /* LTE_ADV */
- default:
- {
- DU_LOG("\nERROR --> SCH : Invalid configuration "
- "action %d", cfgReqInfo->action);
- ret = RFAILED;
- }
- } /* End of switch */
-
- if (ret != ROK)
- {
- cfmStatus = RGR_CFG_CFM_NOK;
- }
-
- SCH_FREE(cfgReqInfo,
- (Size)sizeof(*cfgReqInfo));
- cfgReqInfo = NULLP;
-#ifdef EMTC_ENABLE
-printf("\nDEBUG --> SCH: AT MAC sending RGR cfg cfm \n");
-#endif
-
- /* Send back confirmation status to RRM */
- schSendCfgCfm(reg, pool, transId, cfmStatus);
-#ifdef EMTC_ENABLE
-printf("\nDEBUG --> SCH: AT MAC RGR cfg cfm sent\n");
-#endif
-
- return (ret);
-} /* rgSCHGomCfgReq */
-
-
-/**
- * @brief Handler to enqueuing config request from RRM to Scheduler.
- *
- * @details
- *
- * Function: rgSCHGomEnqCfgReq
- *
- * This API enqueues config request from RRM to MAC.
- *
- * Processing Steps:
- * - Allocate the configuration request element.
- * - Copy the contents of the recieved configuration to config request
- * element and free the recieved configuration pointer.
- * - If the configuration is without activation time,
- * - Enqueue the request in crntRgrCfgLst of the cell at the end of
- * the list.
- * - Else
- * - Enqueue the request in pndngRgrCfgLst of the cell.
- *
- * @param[in] Region reg,
- * @param[in] Pool pool
- * @param[in] RgSchCellCb *cell
- * @param[in] RgrCfgTransId transId
- * @param[in] RgrCfgReqInfo *rgrCfgReq
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHGomEnqCfgReq(Region reg,Pool pool,RgSchCellCb *cell,RgrCfgTransId transId,RgrCfgReqInfo *rgrCfgReq)
-{
- S16 ret;
- uint32_t sfDiff;
- RgSchCfgElem *rgrCfgElem = NULLP;
- CmLteTimingInfo actvTime;
- Inst inst = cell->instIdx;
-
- /* Allocate memory for config Element */
- ret = rgSCHUtlAllocSBuf(inst, (Data **)&rgrCfgElem, sizeof(RgSchCfgElem));
- if ((ret != ROK) || ((uint8_t *)rgrCfgElem == NULLP))
- {
- return RFAILED;
- }
-
- /* Initialize the configuration element */
- memcpy(rgrCfgElem->rgrCfg.transId.trans,transId.trans,
- sizeof(transId.trans));
- rgrCfgElem->rgrCfg.reg = reg;
- rgrCfgElem->rgrCfg.pool = pool;
- rgrCfgElem->rgrCfg.rgrCfgReq = rgrCfgReq;
- rgrCfgElem->cfgReqLstEnt.prev = NULLP;
- rgrCfgElem->cfgReqLstEnt.next = NULLP;
- rgrCfgElem->cfgReqLstEnt.node = (PTR )rgrCfgElem;
-
- /* Add configuration element to current/pending cfgLst */
- if (((rgrCfgReq->action == RGR_RECONFIG) &&
- (rgrCfgReq->u.recfgInfo.recfgType == RGR_CELL_CFG) &&
- (rgrCfgReq->u.recfgInfo.u.cellRecfg.recfgActvTime.pres == TRUE)))
-
- {
- actvTime =
- rgrCfgReq->u.recfgInfo.u.cellRecfg.recfgActvTime.actvTime;
-
- /* Check if the activation time is valid */
- if (actvTime.sfn >= RGSCH_MAX_SFN
- || actvTime.slot >= RGSCH_NUM_SUB_FRAMES_5G)
- {
- DU_LOG("\nERROR --> SCH : Invalid activation time for RGR "
- "config request: activation sfn %d activation slot %d current "
- "sfn %d current slot %d", actvTime.sfn, actvTime.slot,
- cell->crntTime.sfn, cell->crntTime.slot);
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(inst, (Data **)&rgrCfgElem, sizeof(*rgrCfgElem));
- return RFAILED;
- }
-
- sfDiff = RGSCH_CALC_SF_DIFF(actvTime, cell->crntTime);
-
- if (sfDiff > (RGR_ACTV_WIN_SIZE * RGSCH_NUM_SUB_FRAMES_5G))
- {
- DU_LOG("\nERROR --> SCH : Invalid activation time for RGR"
- " config request: activation sfn %d activation slot %d "
- "current sfn %d current slot %d", actvTime.sfn,
- actvTime.slot, cell->crntTime.sfn, cell->crntTime.slot);
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(inst, (Data **)&rgrCfgElem, sizeof(*rgrCfgElem));
- return RFAILED;
- }
-
- if (sfDiff)
- {
- /* Add to pending cfgReqLst */
- rgrCfgElem->actvTime = actvTime;
- rgSCHDbmInsPndngRgrCfgElem(cell, rgrCfgElem);
- /* Cfm to be sent only after applying request */
- return ROK;
- }
- }
-
- /* Add to current cfgReq list */
- rgSCHDbmInsCrntRgrCfgElem(cell, rgrCfgElem);
- /* Cfm to be sent only after applying request */
- return ROK;
-} /* rgSCHGomEnqCfgReq */
-
-
-/**
- * @brief Handler for TTI processing for configurations recieved from RRM.
- *
- * @details
- *
- * Function: rgSCHGomTtiHndlr
- *
- * This API does TTI processing for configurations recieved from RRM.
- *
- * Processing Steps:
- * - It dequeues config request from the current configuration list.
- * For each config request in the list:
- * - Processes the request. Call rgSCHGomCfgReq.
- * - It dequeues config request for the current tti from the pending
- * configuration list. For each config request in the list:
- * - Processes the request. Call rgSCHGomCfgReq.
- *
- * @param[in] RgSchCellCb *cell
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHGomTtiHndlr(RgSchCellCb *cell,SpId spId)
-{
- RgSchCfgElem *cfgElem;
- Inst inst= cell->instIdx;
-
- /* Dequeue from current config list */
- while ((cfgElem = rgSCHDbmGetNextCrntRgrCfgElem(cell, NULLP)) != NULLP)
- {
- rgSCHDbmDelCrntRgrCfgElem(cell, cfgElem);
- rgSCHGomCfgReq(cfgElem->rgrCfg.reg,cfgElem->rgrCfg.pool,
- &rgSchCb[inst], cfgElem->rgrCfg.transId,
- cfgElem->rgrCfg.rgrCfgReq);
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(inst, (Data **)&cfgElem, sizeof(*cfgElem));
- }
-
- /* Handle config requests from pending config list */
- while((cfgElem = rgSCHDbmGetPndngRgrCfgElemByKey(cell, cell->crntTime)) != NULLP)
- {
- rgSCHDbmDelPndngRgrCfgElem(cell, cfgElem);
- rgSCHGomCfgReq(cfgElem->rgrCfg.reg, cfgElem->rgrCfg.pool,
- &rgSchCb[inst], cfgElem->rgrCfg.transId,
- cfgElem->rgrCfg.rgrCfgReq);
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(inst, (Data **)&cfgElem, sizeof(*cfgElem));
- }
-
- return ROK;
-}
-
-
-/**
- * @brief Handler to handle configuration request from RRM to MAC.
- *
- * @details
- *
- * Function: rgSCHGomHndlCfgReq
- *
- * This API handles processing for configuration request from RRM to MAC.
- *
- * - Processing Steps:
- * - Validate configuration request parameters at CFG module.
- * Call rgSCHCfgVldtRgrCellCfg for cell configuration.
- * - If validated successfully, send configuration request to CFG.
- * Call rgSCHCfgRgrCellCfg else FAIL.
- *
- * @param[in] RgSchCb *instCb
- * @param[in] SpId spId
- * @param[in] RgrCfg *cfg
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHGomHndlCfgReq(RgSchCb *instCb,SpId spId,RgrCfg *cfg,RgSchErrInfo *errInfo)
-{
- S16 ret;
- RgSchCellCb *cell = instCb->rgrSap[spId].cell;
- Inst inst = (instCb->rgSchInit.inst );
- RgSchUeCb *ue;
-
- errInfo->errType = RGSCHERR_GOM_CFG_REQ;
-
- /* Validate and process the configuration request */
- switch (cfg->cfgType)
- {
- case RGR_CELL_CFG:
- {
- ret = rgSCHCfgVldtRgrCellCfg(inst, &cfg->u.cellCfg, cell, errInfo);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Rgr Cell configuration "
- "validation FAILED: Cell %d", cfg->u.cellCfg.cellId);
- return RFAILED;
- }
- ret = rgSCHCfgRgrCellCfg(instCb, spId, &cfg->u.cellCfg, errInfo);
- break;
- }
- case RGR_UE_CFG:
- case RGR_SCELL_UE_CFG:
- {
- ret = rgSCHCfgVldtRgrUeCfg(inst, &cfg->u.ueCfg, &cell, errInfo);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Ue configuration validation"
- " FAILED: CRNTI:%d", cfg->u.ueCfg.crnti);
- return RFAILED;
- }
- ret = rgSCHCfgRgrUeCfg(cell, &cfg->u.ueCfg, errInfo);
- break;
- }
- case RGR_LCH_CFG:
- {
- ret = rgSCHCfgVldtRgrLcCfg(inst, &cfg->u.lchCfg, &cell, &ue, errInfo);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : LC configuration validation "
- "FAILED: LCID:%d", cfg->u.lchCfg.lcId);
- return RFAILED;
- }
- ret = rgSCHCfgRgrLchCfg(cell, ue, &cfg->u.lchCfg, errInfo);
- break;
- }
- case RGR_LCG_CFG:
- {
- ret = rgSCHCfgVldtRgrLcgCfg(inst, &cfg->u.lcgCfg, &cell, &ue, errInfo);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : LCG configuration validation "
- "FAILED: LCGID:%d", cfg->u.lcgCfg.ulInfo.lcgId);
- return RFAILED;
- }
- ret = rgSCHCfgRgrLcgCfg(cell, ue, &cfg->u.lcgCfg, errInfo);
- break;
- }
- case MAC_GNB_CFG:
- {
- ret = rgSCHCfgVldtRgrSchedEnbCfg(inst, &cfg->u.schedEnbCfg, errInfo);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : SCH ENB configuration validation FAILED: \n");
- return RFAILED;
- }
- ret = rgSCHCfgRgrSchedEnbCfg(inst, spId, &cfg->u.schedEnbCfg, errInfo);
- break;
- }
- default:
- {
-#if(ERRCLASS & ERRCLS_INT_PAR)
- DU_LOG("\nERROR --> SCH : Should never come here: "
- "cfgType %d", cfg->cfgType);
-#endif
- return RFAILED;
- }
- }
-
- return (ret);
-} /* rgSCHGomHndlCfgReq */
-
-#ifdef LTE_ADV
-/**
- * @brief Handler to handle re-configuration request from RRM to MAC.
- *
- * @details
- *
- * Function: rgSCHGomHndlSCellActDeactReq
- *
- * This API handles processing for SCell Activation Request from RRM to SCH.
- *
- * - Processing Steps:
- * - Validate sCell Actication request parameters at CFG module.
- * - If validated successfully, send configuration request to CFG.
- * - call activation function for each SCells configured
- *
- * @param[in] RgSchCb *instCb
- * @param[in] SpId spId
- * @param[in] RgrSCellActDeactEvnt *sCellActDeactEvnt
- * @param[in] uint8_t action
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHGomHndlSCellActDeactReq(RgSchCb *instCb,SpId spId,RgrSCellActDeactEvnt *sCellActDeactEvnt,RgSchErrInf *errInfo,uint8_t action)
-{
- RgSchUeCb *ue = NULLP;
- uint16_t idx = 0;
- uint16_t sCellIdx = 0;
- RgSchCellCb *cell = instCb->rgrSap[spId].cell;
- Inst inst = (instCb->rgSchInit.inst);
-
- DU_LOG(("\nDEBUG --> SCH : Processing RGR SCell Actication request:"
- "%d\n", sCellActDeactEvnt->crnti));
-
- errInfo->errType = RGSCHERR_GOM_SCELL_REQ;
-
- /* Fetch the Ue */
- if ((ue = rgSCHDbmGetUeCb(cell, sCellActDeactEvnt->crnti)) == NULLP)
- {
- DU_LOG(("\nERROR --> SCH : [%d]UE: does not exist\n",
- sCellActDeactEvnt->crnti));
- return RFAILED;
- }
-
- for(idx = 0; idx < sCellActDeactEvnt->numOfSCells; idx++)
- {
- sCellIdx = sCellActDeactEvnt->sCellActDeactInfo[idx].sCellIdx;
-
- if (ROK != (rgSCHSCellTrigActDeact(cell, ue, sCellIdx, action)))
- {
- DU_LOG("\nERROR --> SCH : SCell Actication failed"
- "for UE [%d] with SCellIdx [%d]\n",
- sCellActDeactEvnt->crnti, idx);
- return RFAILED;
-
- }
-
- DU_LOG("\nINFO --> SCH : RGR Reconfiguration processed\n");
- return ROK;
-} /* rgSCHGomHndlSCellActDeactReq */
-
-#endif /* LTE_ADV */
-/**
- * @brief Handler to handle re-configuration request from RRM to MAC.
- *
- * @details
- *
- * Function: rgSCHGomHndlRecfgReq
- *
- * This API handles processing for re-configuration request from RRM to MAC.
- *
- * - Processing Steps:
- * - Validate re-configuration request parameters at CFG module.
- * Call rgSCHCfgVldtRgrCellRecfg for cell re-configuration.
- * - If validated successfully, send configuration request to CFG.
- * Call rgSCHCfgRgrCellRecfg else FAIL.
- *
- * @param[in] RgSchCb *instCb
- * @param[in] SpId spId
- * @param[in] RgrRecfg *recfg
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHGomHndlRecfgReq(RgSchCb *instCb,SpId spId,RgrRecfg *recfg,RgSchErrInfo *errInfo)
-{
- RgSchUeCb *ue = NULLP;
- RgSchDlLcCb *dlLc = NULLP; /* PURIFY_FIX:UMR */
- S16 ret;
- RgSchCellCb *cell = instCb->rgrSap[spId].cell;
- Inst inst = (instCb->rgSchInit.inst );
-
- errInfo->errType = RGSCHERR_GOM_RECFG_REQ;
-
- /* Validate and process the re-configuration request */
- switch (recfg->recfgType)
- {
- case RGR_CELL_CFG:
- {
- ret = rgSCHCfgVldtRgrCellRecfg(inst, &recfg->u.cellRecfg, &cell,
- errInfo);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Rgr Cell Recfg Validation "
- "FAILED");
- return RFAILED;
- }
- ret = rgSCHCfgRgrCellRecfg(cell, &recfg->u.cellRecfg, errInfo);
- break;
- }
- case RGR_UE_CFG:
- case RGR_SCELL_UE_CFG:
- {
- ret = rgSCHCfgVldtRgrUeRecfg(inst, &recfg->u.ueRecfg, &cell, &ue, errInfo);
- if ( ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Ue Recfg Validation FAILED"
- "OLD CRNTI:%d",recfg->u.ueRecfg.oldCrnti);
- return RFAILED;
- }
- ret = rgSCHCfgRgrUeRecfg(cell, ue, &recfg->u.ueRecfg, errInfo);
- break;
- }
- case RGR_LCH_CFG:
- {
- ret = rgSCHCfgVldtRgrLchRecfg(inst, &recfg->u.lchRecfg, &cell, &ue,
- &dlLc, errInfo);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Lc Recfg Validation FAILED"
- "LCID:%d",recfg->u.lchRecfg.lcId);
- return RFAILED;
- }
- ret = rgSCHCfgRgrLchRecfg(cell, ue, dlLc, &recfg->u.lchRecfg, errInfo);
- break;
- }
- case RGR_LCG_CFG:
- {
- ret = rgSCHCfgVldtRgrLcgRecfg(inst, &recfg->u.lcgRecfg, cell, &ue,
- errInfo);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Lcg Recfg Validation FAILED"
- "LCGID:%d",recfg->u.lcgRecfg.ulRecfg.lcgId);
- return RFAILED;
- }
- ret = rgSCHCfgRgrLcgRecfg(cell, ue, &recfg->u.lcgRecfg, errInfo);
- break;
- }
- default:
- {
-#if(ERRCLASS & ERRCLS_INT_PAR)
- DU_LOG("\nERROR --> SCH : Should never come here: recfgType %d", recfg->recfgType);
-#endif
- return RFAILED;
- }
- }
-
- return (ret);
-} /* rgSCHGomHndlRecfgReq */
-
-/**
- * @brief Handler to handle UE reset request from RRM to Scheduler.
- *
- * @details
- *
- * Function: rgSCHGomHndlResetReq
- *
- * This API handles processing for UE reset request from RRM to Scheduler.
- *
- * - Processing Steps:
- * - Validate UE reset request parameters at CFG module.
- * Call rgSCHCfgVldtRgrUeReset for UE reset.
- * - If validated successfully, send UE reset request to CFG.
- * Call rgSCHCfgRgrUeReset else FAIL.
- *
- * @param[in] RgrRst *rstInfo
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHGomHndlResetReq(RgSchCb *instCb,SpId spId,RgrRst *reset,RgSchErrInfo *errInfo)
-{
- S16 ret;
- RgSchCellCb *cell= instCb->rgrSap[spId].cell;
- Inst inst = (instCb->rgSchInit.inst );
- RgSchUeCb *ue = NULLP;
-
- errInfo->errType = RGSCHERR_GOM_RESET_REQ;
-
- /* Validate and process the UE reset request */
- ret = rgSCHCfgVldtRgrUeReset(inst, reset, cell, &ue, errInfo);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Rgr UE Reset Validation FAILED"
- "CRNTI:%d",reset->crnti);
- return RFAILED;
- }
-
- ret = rgSCHCfgRgrUeReset(cell, ue, reset, errInfo);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Rgr UE Reset FAILED"
- "CRNTI:%d",reset->crnti);
- return RFAILED;
- }
-
- return (ret);
-} /* rgSCHGomHndlResetReq */
-
-
-/**
- * @brief Handler for processing Cell/Ue/Logical channel delete request
- * recieved from RRM.
- *
- * @details
- *
- * Function: rgSCHGomHndlDelReq
- *
- * This API handles processing of delete request from RRM to MAC.
- *
- * Processing Steps:
- * - Fetch corresponding control block and pass it to CFG module.
- * - If control block does not exist, FAIL.
- *
- * @param[in] RgSchCb *instCb
- * @param[in] SpId spId
- * @param[in] RgrDel *del
- * @param[out] RgSchErrInfo *errInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHGomHndlDelReq(RgSchCb *instCb,SpId spId,RgrDel *del,RgSchErrInfo *errInfo)
-{
-
- S16 ret;
- volatile uint32_t startTime=0;
-
- errInfo->errType = RGSCHERR_GOM_DEL_REQ;
-
- if(instCb->rgrSap[spId].cell == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Cell doesnt exist");
- return RFAILED;
- }
-
- /* Process the delete request */
- switch (del->delType)
- {
- case RGR_CELL_CFG:
- {
- ret = rgSCHCfgRgrCellDel(instCb->rgrSap[spId].cell, del, errInfo);
- if(ret == ROK)
- {
- /* TODO::Needs to be revisited after tti flow CaDev Start */
- uint8_t idx = (uint8_t)((instCb->rgrSap[spId].cell->cellId - instCb->genCfg.startCellId)&(CM_LTE_MAX_CELLS-1));
- instCb->cells[idx] = NULLP;
- /* CaDev End */
- instCb->rgrSap[spId].cell = NULLP;
- instCb->tfuSap[spId].cell = NULLP;
- }
- break;
- }
- case RGR_UE_CFG:
- case RGR_SCELL_UE_CFG:
- {
-
- /*starting Task*/
- SStartTask(&startTime, PID_SCH_UE_DEL);
-
- ret = rgSCHCfgRgrUeDel(instCb->rgrSap[spId].cell, del, errInfo);
-
- /*stoping Task*/
- SStopTask(startTime, PID_SCH_UE_DEL);
-
- break;
- }
- case RGR_LCH_CFG:
- {
- ret = rgSCHCfgRgrLcDel(instCb->rgrSap[spId].cell, del, errInfo);
- break;
- }
- case RGR_LCG_CFG:
- {
- ret = rgSCHCfgRgrLcgDel(instCb->rgrSap[spId].cell, del, errInfo);
- break;
- }
- default:
- {
-#if(ERRCLASS & ERRCLS_INT_PAR)
- DU_LOG("\nERROR --> SCH : Should never come here: delType %d", del->delType);
-#endif
- return RFAILED;
- }
- }
-
- return (ret);
-} /* rgSCHGomHndlDelReq */
-
-
-
-
-/***********************************************************
- *
- * Func : rgSCHGomGetCellIdFrmCfgReq
- *
- *
- * Desc :
- * - Processing Steps:
- * - Retrieves the cell Id for a config request.
- *
- * @param[in] RgrCfgReqInfo *rgrCfgReq
- * @param[out] CmLteCellId *cellId
- * Ret : ROK on fetching cellId
- * RFAILED on failure
- *
- * Notes:
- *
- * File : rg_sch_gom.c
- *
- **********************************************************/
-static S16 rgSCHGomGetCellIdFrmCfgReq(RgrCfgReqInfo *rgrCfgReq,CmLteCellId *cellId)
-{
-
- /* Extract CellId depending on the action and Config Type in the Request
- * As of now this function is called for only re configuration so removed
- * othe CASES below if needed we can add them*/
- switch (rgrCfgReq->action)
- {
- case RGR_RECONFIG:
- {
- if (rgrCfgReq->u.recfgInfo.recfgType ==RGR_CELL_CFG)
- {
- *cellId = rgrCfgReq->u.recfgInfo.u.cellRecfg.cellId;
- }
- else if ((rgrCfgReq->u.recfgInfo.recfgType == RGR_SCELL_UE_CFG) ||
- (rgrCfgReq->u.recfgInfo.recfgType == RGR_UE_CFG))
- {
- *cellId = rgrCfgReq->u.recfgInfo.u.ueRecfg.cellId;
- }
- else if (rgrCfgReq->u.recfgInfo.recfgType == RGR_LCH_CFG)
- {
- *cellId = rgrCfgReq->u.recfgInfo.u.lchRecfg.cellId;
- }
- else if (rgrCfgReq->u.recfgInfo.recfgType == RGR_LCG_CFG)
- {
- *cellId = rgrCfgReq->u.recfgInfo.u.lcgRecfg.cellId;
- }
- else
- {
- return RFAILED;
- }
- break;
- }
- default:
- {
- return RFAILED;
- }
- } /* End of Switch */
-
- return ROK;
-} /* rgSCHGomGetCellIdFrmCfgReq */
-
-#ifdef RGR_SI_SCH
-/**
- * @brief Handler to handle SI configuration request from RRM to MAC.
- *
- * @details
- *
- * Function: rgSCHGomHndlSiCfg
- *
- * This API handles processing for SI configuration request from RRM to MAC.
- *
- * - Processing Steps:
- * - Validate SI configuration request parameters at CFG module.
- * Call rgSCHCfgVldtSiCfg for SI configuration.
- * - If validated successfully, send configuration request to CFG.
- * Call rgSCHCfgRgrCellCfg else FAIL.
- *
- * @param[in] Region reg
- * @param[in] Pool pool
- * @param[in] RgSchCb *instCb
- * @param[in] SpId spId
- * @param[in] RgrCfgTransId transId
- * @param[in] RgrSiCfgReqInfo *cfgReqInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHGomHndlSiCfg(Region reg,Pool pool,RgSchCb *instCb,SpId spId,RgrCfgTransId transId,RgrSiCfgReqInfo *cfgReqInfo)
-{
- S16 ret;
- RgSchCellCb *cell = instCb->rgrSap[spId].cell;
- Inst inst = (instCb->rgSchInit.inst );
- RgSchErrInfo errInfo;
- uint8_t cfmStatus = RGR_CFG_CFM_NOK;
- MsgLen msgLen = 0, pduLen;
- S32 tbSz = 0;
- uint8_t nPrb = 0;
- uint8_t mcs = 0;
-
-
- /* check if cell does not exists */
- if (((uint8_t *)cell == NULLP) || (cell->cellId != cfgReqInfo->cellId))
- {
- DU_LOG("\nERROR --> SCH : Cell Control block does not exist");
- RGSCH_FREE_MSG(cfgReqInfo->pdu);
- SCH_FREE(cfgReqInfo, (Size)sizeof(*cfgReqInfo));
- cfgReqInfo = NULLP;
- rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus);
- return RFAILED;
- }
-
- /*Validate the received SI configuration */
- ret = rgSCHCfgVldtRgrSiCfg(inst, cfgReqInfo, cell, &errInfo);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Rgr SI configuration "
- "validation FAILED");
- RGSCH_FREE_MSG(cfgReqInfo->pdu);
- SCH_FREE(cfgReqInfo, (Size)sizeof(*cfgReqInfo));
- cfgReqInfo = NULLP;
- rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus);
- return RFAILED;
- }
- /*ccpu00140789: Stopping SI scheduling*/
- if(RGR_SI_STOP == cfgReqInfo->cfgType)
- {
- if((cell->siCb.crntSiInfo.siInfo[cfgReqInfo->siId-1].si != NULLP)&&
- (cell->siCb.siArray[cfgReqInfo->siId-1].si != NULLP))
- {
- cell->siCb.crntSiInfo.siInfo[cfgReqInfo->siId-1].si = NULLP;
- RGSCH_FREE_MSG(cell->siCb.siArray[cfgReqInfo->siId-1].si);
- cell->siCb.siArray[cfgReqInfo->siId-1].si = NULLP;
- if(cell->siCb.newSiInfo.siInfo[cfgReqInfo->siId-1].si != NULLP)
- {
- RGSCH_FREE_MSG(cell->siCb.newSiInfo.siInfo[cfgReqInfo->siId-1].si);
- cell->siCb.newSiInfo.siInfo[cfgReqInfo->siId-1].si = NULLP;
- }
- SCH_FREE(cfgReqInfo, (Size)sizeof(*cfgReqInfo));
- cfgReqInfo = NULLP;
- cfmStatus = RGR_CFG_CFM_OK;
- rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus);
- return ROK;
- }
- else
- {
- SCH_FREE(cfgReqInfo, (Size)sizeof(*cfgReqInfo));
- cfgReqInfo = NULLP;
- rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus);
- return RFAILED;
- }
- }
-
- /* Check if the pdu sent from application
- * matches a transport block size. if not,
- * add padding bytes. This is usually done
- * by RRC but since we are bypassing RRC,
- * MAC is taking over that responsibility
- */
- if ( RGR_SI_CFG_TYPE_MIB != cfgReqInfo->cfgType )
- {
- SFndLenMsg(cfgReqInfo->pdu, &msgLen);
-
- /* check if the application pdu matches a tb size */
- tbSz = rgSCHUtlGetAllwdCchTbSz(msgLen*8, &nPrb, &mcs);
-
- if ( tbSz != (msgLen*8) )
- {
- MsgLen nmPadBytes = 0;
- Data* padding = NULLP;
-
- /* need to add padding bytes */
- nmPadBytes = (tbSz - (msgLen*8))/8;
-
- SCH_ALLOC(padding,nmPadBytes);
- if(padding == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Rgr SI configuration "
- " failed to allocate memory for padding");
- SCH_FREE(cfgReqInfo, (Size)sizeof(*cfgReqInfo));
- cfgReqInfo = NULLP;
- rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId,
- cfmStatus);
- return RFAILED;
- }
-
- memset(padding,0,nmPadBytes);
-
-#ifdef MS_MBUF_CORRUPTION
- MS_BUF_ADD_ALLOC_CALLER();
-#endif
- if ( SAddPstMsgMult((Data*)padding,nmPadBytes,cfgReqInfo->pdu) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Rgr SI configuration "
- "Failed to add padding bytes");
- SCH_FREE(cfgReqInfo, (Size)sizeof(*cfgReqInfo));
- cfgReqInfo = NULLP;
- SCH_FREE(padding,(Size)nmPadBytes);
- padding = NULLP;
- rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId,
- cfmStatus);
- return RFAILED;
- }
- SCH_FREE(padding,(Size)nmPadBytes);
- padding = NULLP;
- }/* if (tbSz != ...*/
- }/* if (RGR_SI_CFG_TYPE_SI...*/
-
- /*Set the received pdu at the appropriate place */
- switch(cfgReqInfo->cfgType)
- {
- case RGR_SI_CFG_TYPE_MIB: /* SI CFG Type MIB */
- RGSCHCHKNUPDSIPDU(cell->siCb.crntSiInfo.mib,
- cell->siCb.newSiInfo.mib,
- cfgReqInfo->pdu, cell->siCb.siBitMask,
- RGSCH_SI_MIB_UPD);
- break;
-
- case RGR_SI_CFG_TYPE_SIB1_PWS:
- {
- SFndLenMsg(cfgReqInfo->pdu, &pduLen);
- ret = rgSCHUtlCalMcsAndNPrb(cell, cfgReqInfo->cfgType, pduLen,0);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Failed to get MCS and NPRB"
- "value");
- RGSCH_FREE_MSG(cfgReqInfo->pdu);
- SCH_FREE(cfgReqInfo, (Size)sizeof(*cfgReqInfo));
- cfgReqInfo = NULLP;
- rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId,
- cfmStatus);
- return RFAILED;
- }
-
- RGSCHCHKNUPDSIPDU(cell->siCb.crntSiInfo.sib1Info.sib1,
- cell->siCb.newSiInfo.sib1Info.sib1,
- cfgReqInfo->pdu, cell->siCb.siBitMask,
- RGSCH_SI_SIB1_PWS_UPD);
- }
- break;
-
- case RGR_SI_CFG_TYPE_SIB1:
- SFndLenMsg(cfgReqInfo->pdu, &pduLen);
- ret = rgSCHUtlCalMcsAndNPrb(cell, cfgReqInfo->cfgType, pduLen,0);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Failed to get MCS and NPRB"
- "value");
- RGSCH_FREE_MSG(cfgReqInfo->pdu);
- SCH_FREE(cfgReqInfo, (Size)sizeof(*cfgReqInfo));
- cfgReqInfo = NULLP;
- rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId,
- cfmStatus);
- return RFAILED;
- }
- RGSCHCHKNUPDSIPDU(cell->siCb.crntSiInfo.sib1Info.sib1,
- cell->siCb.newSiInfo.sib1Info.sib1,
- cfgReqInfo->pdu, cell->siCb.siBitMask,
- RGSCH_SI_SIB1_UPD);
- break;
-
- case RGR_SI_CFG_TYPE_SI: /* SI CFG TYPE SI */
- SFndLenMsg(cfgReqInfo->pdu, &pduLen);
- ret = rgSCHUtlCalMcsAndNPrb(cell, cfgReqInfo->cfgType, pduLen,
- cfgReqInfo->siId);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Failed to get MCS and NPRB"
- "value");
- RGSCH_FREE_MSG(cfgReqInfo->pdu);
- SCH_FREE(cfgReqInfo, (Size)sizeof(*cfgReqInfo));
- cfgReqInfo = NULLP;
- rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId,
- cfmStatus);
- return RFAILED;
- }
- /* Si recfg, where numSi changes */
- if (cell->siCb.siBitMask & RGSCH_SI_SICFG_UPD)
- {
- Buffer **newSiPdu = &cell->siCb.newSiInfo.siInfo[cfgReqInfo->siId-1].si;
- if(*newSiPdu != NULLP)
- {
- RGSCH_FREE_MSG(*newSiPdu);
- }
- *newSiPdu = (Buffer *)cfgReqInfo->pdu;
- cell->siCb.siBitMask |= RGSCH_SI_SI_UPD;
- }
- else /* Initial Si cfg or si recfg where numSi did not change */
- {
- uint8_t bitMask;
- /* Initial Si cfg */
- if (cell->siCb.crntSiInfo.siInfo[cfgReqInfo->siId-1].si == NULLP)
- {
- cell->siCb.siArray[cfgReqInfo->siId-1].si = cfgReqInfo->pdu;
- cell->siCb.siArray[cfgReqInfo->siId-1].isWarningSi = FALSE;
- bitMask = RGSCH_SI_DFLT;
- }
- else
- {
- bitMask = RGSCH_SI_SI_UPD;
- }
-
- RGSCHCHKNUPDSIPDU(cell->siCb.crntSiInfo.siInfo[cfgReqInfo->siId-1].si,
- cell->siCb.newSiInfo.siInfo[cfgReqInfo->siId-1].si,
- cfgReqInfo->pdu,
- cell->siCb.siBitMask, bitMask);
- }
- break;
-
- case RGR_SI_CFG_TYPE_SIB8_CDMA: /* SI CFG TYPE SIB 8 CDMA */
- SFndLenMsg(cfgReqInfo->pdu, &pduLen);
- ret = rgSCHUtlCalMcsAndNPrb(cell, cfgReqInfo->cfgType, pduLen,
- cfgReqInfo->siId);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Failed to get MCS and NPRB"
- "value");
- RGSCH_FREE_MSG(cfgReqInfo->pdu);
- SCH_FREE(cfgReqInfo, (Size)sizeof(*cfgReqInfo));
- cfgReqInfo = NULLP;
- rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId,
- cfmStatus);
- return RFAILED;
- }
- /* No need to wait for Modification period boundary */
- cell->siCb.siArray[cfgReqInfo->siId-1].si = cfgReqInfo->pdu;
- RGSCH_SET_SI_INFO(cell->siCb.crntSiInfo.siInfo[cfgReqInfo->siId-1].si,
- cfgReqInfo->pdu);
- cell->siCb.siArray[cfgReqInfo->siId-1].isWarningSi = FALSE;
- break;
- default:
- DU_LOG("\nERROR --> SCH : Invalid cfgType "
- "parameter value");
- RGSCH_FREE_MSG(cfgReqInfo->pdu);
- SCH_FREE(cfgReqInfo,
- (Size)sizeof(*cfgReqInfo));
- cfgReqInfo = NULLP;
- rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId,
- cfmStatus);
- return RFAILED;
- }
-
- SCH_FREE(cfgReqInfo, (Size)sizeof(*cfgReqInfo));
- cfgReqInfo = NULLP;
- cfmStatus = RGR_CFG_CFM_OK;
- rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus);
-
-
- return ROK;
-} /* rgSCHGomHndlSiCfg */
-
-
-/**
- * @brief Handler to handle Warning SI configuration request from RRM to MAC.
- *
- * @details
- *
- * Function: rgSCHGomHndlWarningSiCfg
- *
- * This API handles processing for Warning SI configuration request from
- * RRM to MAC.
- *
- *
- * @param[in] Region reg
- * @param[in] Pool pool
- * @param[in] RgSchCb *instCb
- * @param[in] SpId spId
- * @param[in] RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHGomHndlWarningSiCfg
-(
-Region reg,
-Pool pool,
-RgSchCb *instCb,
-SpId spId,
-RgrCfgTransId transId,
-RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
-)
-{
- RgSchCellCb *cell = instCb->rgrSap[spId].cell;
- uint8_t cfmStatus = RGR_CFG_CFM_NOK;
- uint16_t idx;
- uint8_t siId = warningSiCfgReqInfo->siId;
- uint8_t j, mcs=0, nPrb=0;
- RgSchWarningSiSeg *warningSiMsg;
- RgSchWarningSiPdu *pduNode;
- CmLList *node;
- MsgLen msgLen = 0;
- Bool freeNodeFound = FALSE;
- uint16_t siWinSize = 0;
- uint16_t minPeriod = 0;
-#ifdef EMTC_ENABLE
- uint8_t isEmtc = warningSiCfgReqInfo->emtcEnable;
-#endif
-
-#ifdef EMTC_ENABLE
- if(TRUE == isEmtc)
- {
- rgSchEmtcGetSiWinPerd(cell, &siWinSize, &minPeriod);
- }
- else
-#endif
- {
- siWinSize = cell->siCfg.siWinSize;
- minPeriod = cell->siCfg.minPeriodicity;
- }
- /* check if cell does not exists */
- if (((uint8_t *)cell == NULLP) ||
- (cell->cellId != warningSiCfgReqInfo->cellId) ||
- (warningSiCfgReqInfo->siId >
- ((minPeriod * 10)/siWinSize)))
- {
- DU_LOG("\nERROR --> SCH : Warning SI Cfg Failed for siId = %d"
- "warning cellID:%d",warningSiCfgReqInfo->siId,warningSiCfgReqInfo->cellId);
- rgSCHUtlFreeWarningSiSeg(reg, pool, &warningSiCfgReqInfo->siPduLst);
- SCH_FREE(warningSiCfgReqInfo,
- sizeof(RgrWarningSiCfgReqInfo));
- warningSiCfgReqInfo = NULLP;
- rgSCHUtlRgrWarningSiCfgCfm(instCb->rgSchInit.inst, spId, siId, transId,
- cfmStatus);
- return RFAILED;
- }
-
- /* Search for free index in WarningSi */
- for(idx = 0; idx < RGR_MAX_NUM_WARNING_SI; idx++)
- {
- if((cell->siCb.warningSi[idx].siId == 0 ||
- cell->siCb.warningSi[idx].siId == warningSiCfgReqInfo->siId))
- {
- warningSiMsg = (RgSchWarningSiSeg *)&cell->siCb.warningSi[idx].warningSiMsg;
-
- /* Search for free SI node */
- /* ccpu00136659: CMAS ETWS design changes */
- if (warningSiMsg->segLstCp.first == NULLP) /* Free SI Node */
- {
- warningSiMsg->transId = transId;
- pduNode = (RgSchWarningSiPdu *)&cell->siCb.warningSi[idx].
- warningSiMsg.pduNode;
- CM_LLIST_FIRST_NODE(&warningSiCfgReqInfo->siPduLst, node);
- j = 0;
-
- /* Get the PDUs one by one from the received pduLst of warning
- * message and calculate the MCS and nPrb of each pdu once.
- * Store the pdu in warningSiMsg pduLst, which will be scheduled
- * later while sending warning message as part of SIB11/SIB12
- */
- while((node != NULLP) && (j < RGR_MAX_WARNING_SI_SEG))
-
- {
- pduNode[j].pdu = (Buffer *)node->node;
- if(pduNode[j].pdu != NULLP)
- {
- SFndLenMsg(pduNode[j].pdu, &msgLen);
- /*Get the nPrb and mcs parametr values */
-#ifdef EMTC_ENABLE
- if (rgSCHEmtcUtlGetAllwdCchTbSzForSI(msgLen*8) != (msgLen*8))
-#else
- if (rgSCHUtlGetAllwdCchTbSz(msgLen*8, &nPrb, &mcs) != (msgLen*8))
-#endif
-
- {
- DU_LOG("\nERROR --> SCH : rgSCHGomHndlWarningSiCfg():msgLen does not match\
- any valid TB Size.");
- DU_LOG("\nERROR --> SCH : Warning SI Cfg Failed"
- "for siId = %d", warningSiCfgReqInfo->siId);
- rgSCHUtlFreeWarningSiSeg(reg, pool,
- &warningSiCfgReqInfo->siPduLst);
- SCH_FREE(warningSiCfgReqInfo,
- sizeof(RgrWarningSiCfgReqInfo));
- warningSiCfgReqInfo = NULLP;
- rgSCHUtlRgrWarningSiCfgCfm(instCb->rgSchInit.inst, spId,
- siId, transId,cfmStatus);
- return RFAILED;
-
- }
- }
- pduNode[j].mcs = mcs;
- pduNode[j].nPrb = nPrb;
- pduNode[j].msgLen = msgLen;
- /* ccpu00136659: CMAS ETWS design changes */
- cmLListAdd2Tail(&warningSiMsg->segLstCp, &pduNode[j].lnk);
- pduNode[j].lnk.node = (PTR)&pduNode[j];
- j++;
- node = node->next;
- }
-
- /* ccpu00132385- nodes in received SI config linked list should
- * be freed after processing the config.*/
- while(warningSiCfgReqInfo->siPduLst.first != NULLP)
- {
- node = warningSiCfgReqInfo->siPduLst.first;
- cmLListDelFrm(&(warningSiCfgReqInfo->siPduLst), node);
- SCH_FREE(node,sizeof(CmLList));
- node = NULLP;
- }
-
- cell->siCb.warningSi[idx].siId = warningSiCfgReqInfo->siId;
- cell->siCb.warningSi[idx].idx = idx;
-#ifdef EMTC_ENABLE
- if(TRUE == isEmtc)
- {
- rgSCHEmtcWarningSiCfg(cell,warningSiCfgReqInfo,idx);
- }
- else
-#endif
- {
- cell->siCb.siArray[warningSiCfgReqInfo->siId-1].si =
- &cell->siCb.warningSi[idx];
- cell->siCb.siArray[warningSiCfgReqInfo->siId-1].isWarningSi =
- TRUE;
- }
- freeNodeFound = TRUE;
- break;
- }
- }
- }
-
- if (freeNodeFound == FALSE)
- {
- DU_LOG("\nDEBUG --> SCH : No SI Index is free");
- rgSCHUtlFreeWarningSiSeg(reg, pool, &warningSiCfgReqInfo->siPduLst);
- SCH_FREE(warningSiCfgReqInfo,
- sizeof(RgrWarningSiCfgReqInfo));
- warningSiCfgReqInfo = NULLP;
- rgSCHUtlRgrWarningSiCfgCfm(instCb->rgSchInit.inst, spId, siId, transId,
- cfmStatus);
- return RFAILED;
- }
-
- SCH_FREE(warningSiCfgReqInfo,
- sizeof(RgrWarningSiCfgReqInfo));
- warningSiCfgReqInfo = NULLP;
- return ROK;
-}
-
-\f
-/**
- * @brief Handler to handle SI Stop request from RRM to MAC.
- *
- * @details
- *
- * Function: rgSCHGomHndlWarningSiStopReq
- *
- * This API handles processing for SI stop request from RRM to MAC.
- *
- * @param[in] Region reg
- * @param[in] Pool pool
- * @param[in] RgSchCb *instCb
- * @param[in] SpId siId
- * @return void
- **/
-Void rgSCHGomHndlWarningSiStopReq(Region reg,Pool pool,RgSchCb *instCb,uint8_t siId,RgrCfgTransId transId,SpId spId)
-{
- RgSchCellCb *cell = instCb->rgrSap[spId].cell;
- uint16_t idx;
- CmLList *node;
- RgSchWarningSiPdu *warningSiPdu;
- Buffer *pdu;
-
- for(idx = 0; idx < RGR_MAX_NUM_WARNING_SI; idx++)
- {
- if(cell->siCb.warningSi[idx].siId == siId)
- {
- if ((cmMemcmp ((uint8_t *)&cell->siCb.warningSi[idx].warningSiMsg.transId,
- (uint8_t *)&transId, sizeof(RgrCfgTransId))) == 0)
- {
- /* ccpu00136659: CMAS ETWS design changes */
- CM_LLIST_FIRST_NODE(&cell->siCb.warningSi[idx].warningSiMsg.segLstCp, node);
- while(node != NULLP)
- {
- /* On receiving the warning stop message, remove one by one
- * each PDU from the warning SI list
- */
- /* ccpu00136659: CMAS ETWS design changes */
- node = (CmLList *)&cell->siCb.warningSi[idx].warningSiMsg.segLstCp.first;
- warningSiPdu = (RgSchWarningSiPdu *)node->node;
- pdu = warningSiPdu->pdu;
- cmLListDelFrm(&cell->siCb.warningSi[idx].warningSiMsg.segLstCp, node);
- RGSCH_FREE_MSG(pdu);
- node = node->next;
- }
- }
- }
- }
- return;
-}
-
-#endif/*RGR_SI_SCH */
-\f
-/* LTE_ADV_FLAG_REMOVED_START */
-
-/**
- * @brief This function sets the Phigh range for CC users corresponding to the CC Pool
- * @details
- *
- * Function: rgSchUpdtRNTPInfo
- *
- * Invoked by: rgSCHGomHndlLoadInf
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSubFrm* subFrm
- * @param[in] RgrLoadInfReqInfo *loadInfReq
- * @return S16
- *
- **/
-S16 rgSchUpdtRNTPInfo(RgSchCellCb *cell,RgSchDlSf *sf,RgrLoadInfReqInfo *loadInfReq)
-{
- /* Initialise the variables */
- RgSchSFRPoolInfo *sfrCCPool;
- CmLListCp *l;
- CmLList *n;
- S16 ret = RFAILED;
-
- l = &sf->sfrTotalPoolInfo.ccPool;
-
- /*Get the first node from the CC Pool*/
- n = cmLListFirst(l);
- while(n)
- {
- sfrCCPool = (RgSchSFRPoolInfo*)n->node;
- if (sfrCCPool->poolendRB == loadInfReq->rgrCcPHighEndRb)
- {
- sfrCCPool->pwrHiCCRange.endRb = loadInfReq->rgrCcPHighEndRb;
- sfrCCPool->pwrHiCCRange.startRb = loadInfReq->rgrCcPHighStartRb;
- return ROK;
- }
- else
- {
- n = cmLListNext(l);
- }
- }
- return (ret);
-}
-/**
- * @brief Handler to handle LOAD INF request from RRM to MAC.
- *
- * @details
- *
- * Function: rgSCHGomHndlLoadInf
- *
- * This API handles processing for LOAD INF request from RRM to MAC.
- *
- * - Processing Steps:
- * - Validate LOAD INF request parameters at CFG module.
- * Call rgSCHCfgVldtRgrLoadInf for SI configuration.
- * - If validated successfully, send configuration request.
- *
- * @param[in] Region reg
- * @param[in] Pool pool
- * @param[in] RgSchCb *instCb
- * @param[in] SpId spId
- * @param[in] RgrCfgTransId transId
- * @param[in] RgrLoadInfReqInfo *loadInfReq
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHGomHndlLoadInf(Region reg,Pool pool,RgSchCb *instCb,SpId spId,RgrCfgTransId transId,RgrLoadInfReqInfo *loadInfReq)
-{
- S16 ret;
- RgSchCellCb *cell = instCb->rgrSap[spId].cell;
- Inst inst = (instCb->rgSchInit.inst );
- RgSchErrInfo errInfo;
- uint16_t i;
-
- /* check if cell does not exists */
- if (((uint8_t *)cell == NULLP) || (cell->cellId != loadInfReq->cellId))
- {
- DU_LOG("\nERROR --> SCH : Cell Control block does not exist"
- "for load cellId:%d",loadInfReq->cellId);
- SCH_FREE(loadInfReq, (Size)sizeof(*loadInfReq));
- return RFAILED;
- }
-
- if (cell->lteAdvCb.dsfrCfg.status == RGR_DISABLE)
- {
- DU_LOG("\nERROR --> SCH : rgSCHGomHndlLoadInf(): DSFR Feature not enabled");
- SCH_FREE(loadInfReq, (Size)sizeof(*loadInfReq));
- return RFAILED;
- }
- /* Validate the received LOAD INF Configuration */
- ret = rgSCHCfgVldtRgrLoadInf(inst, loadInfReq, cell, &errInfo);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Rgr LOAD INF Configuration "
- "validation FAILED");
- SCH_FREE(loadInfReq, (Size)sizeof(*loadInfReq));
- return RFAILED;
- }
- /* Update the RNTP info rcvd in the respective cell centre pool so that Phigh can be
- sent for the UEs scheduled in that particular RB range*/
- for(i = 0; i < RGSCH_NUM_DL_slotS; i++)
- {
- if((rgSchUpdtRNTPInfo(cell, cell->subFrms[i], loadInfReq) != ROK))
- {
- return RFAILED;
- }
- }
-
- SCH_FREE(loadInfReq, (Size)sizeof(*loadInfReq));
-
-
- return ROK;
-} /* rgSCHGomHndlLoadInf */
-/* LTE_ADV_FLAG_REMOVED_END */
-\f
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for HD-FDD functions
-
- File: rg_sch_hdfdd.c
-
-**********************************************************************/
-
-/** @file rg_sch_hdfdd.c
-@brief This module handles the Periodic CQI/PMI/RI, SRS, SR and Half Duplex
- functionality
-*/
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "lrg.h"
-#include "rgr.h"
-#include "tfu.h"
-#include "rg_env.h"
-#include "rg_sch_inf.h"
-#include "rg_sch_err.h"
-#include "rgr.h"
-#include "rgm.h"
-#include "rg_sch.h"
-#include "rg_sch_cmn.h"
-
-/* header/extern include files (.x) */
-#include "tfu.x" /* RGU types */
-#include "lrg.x" /* layer management typedefs for MAC */
-#include "rgr.x" /* layer management typedefs for MAC */
-#include "rgm.x" /* layer management typedefs for MAC */
-#include "rg_sch_inf.x" /* typedefs for Scheduler */
-#include "rg_sch.x" /* typedefs for Scheduler */
-#include "rg_sch_cmn.x"
-
-
-#ifdef LTEMAC_HDFDD
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/* @details
- *
- * Function : rgSCHHdFddUeCfg
- *
- * Invoking Module Processing:
- * - This shall be invoked by SCH_GOM at UE Re/configuration.
- *
- * Processing Steps:
- * - For UE-specific Half Duplex
- * - Allocate the memory and place the UE in cellCb->hdUeLstCp
- * - Update subframes information state to defualt
- * - Update subframes information sfn to defualt
- * - Return ROK
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] Bool *hdFddEnbl
- *
- * @return S16
- * -# ROK
- * -# RFAILED
-*/
-
-S16 rgSCHHdFddUeCfg(RgSchCellCb *cellCb,RgSchUeCb *ueCb,Bool hdFddEnbl)
-{
- uint8_t sfi;
-
- DU_LOG("\nDEBUG --> SCH : rgSCHHdFddUeCfg(): UeId =%d hdFddEnbl=%d",
- ueCb->ueId, hdFddEnbl);
- if(ueCb->hdFddEnbld == TRUE)
- {
- if (hdFddEnbl == FALSE)
- {
- /* Do not allow switch from HD-FDD to FD-FDD configuration */
- DU_LOG("\nERROR --> SCH : rgSCHHdFddUeCfg(): HD-FDD to FD-FDD Configuration is not allowed"
- "CRNTI:%d",ueCb->ueId);
- }
- else
- {
- /* If already enabled then it can be second reconfiguration */
- DU_LOG("\nERROR --> SCH : rgSCHHdFddUeCfg(): HD-FDD already enabled for this UE"
- "CRNTI:%d",ueCb->ueId);
- }
- return RFAILED;
- }
-
-#ifdef LTEMAC_SPS
- /* Check is SPS enabled for this UE */
- if(hdFddEnbl == TRUE &&
- (ueCb->ul.ulSpsCfg.isUlSpsEnabled == TRUE ||
- ueCb->dl.dlSpsCfg.isDlSpsEnabled == TRUE))
- {
- DU_LOG("\nERROR --> SCH : rgSCHHdFddUeCfg(): Could'nt do HDFDD cfg, SPS already configured"
- "CRNTI:%d",ueCb->ueId);
- return RFAILED;
- }
-#endif
-
- ueCb->hdFddEnbld = hdFddEnbl;
- if( hdFddEnbl == TRUE)
- {
- rgSCHUtlAllocSBuf(cellCb->instIdx,(Data **) &ueCb->hdFddCb,
- sizeof(RgSchUeHdFddCb));
- if (ueCb->hdFddCb != NULLP)
- {
- for (sfi = 0; sfi < RG_SCH_HDFDD_NUMSFINFO; sfi++)
- {
- ueCb->hdFddCb->subfrm[sfi].subFrmDir = RG_SCH_HDFDD_NOSCHD;
- ueCb->hdFddCb->subfrm[sfi].sfn = RG_SCH_HDFDD_INVSFN;
- }
- /* Add this UE to list maintained in CellCb */
- /* cmLListAdd2Tail(&cellCb->hdFddLst,&ueCb->hdFddCb->hdFddLstEnt); */
- }
- else
- {
- DU_LOG("\nERROR --> SCH : rgSCHHdFddUeCfg(): Could not allocate memory for hd-fdd ueCb"
- "CRNTI:%d",ueCb->ueId);
- return RFAILED;
- }
- }
- return ROK;
-}/*rgSCHHdFddUeCfg*/
-
-
-/* @brief Frees Half Duplex related data structures
- *
- * @details
- *
- * Function : rgSCHHdFddUeDel
- *
- * Invoking Module Processing:
- * - This shall be invoked by SCH_GOM at Ue deletion.
- *
- * Processing Steps:
- * - if Half Duplex is enabled
- * - if (ueCb->hdFddCb != NULL)
- * - Remove ue from cellCb->hdUeLstCp;
- * - Dellocate memory
- * - else
- * - Nothing to do
- * - Return ROK
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- *
- * @return ( S16
- * -# ROK
-*
-*/
-S16 rgSCHHdFddUeDel(RgSchCellCb *cellCb,RgSchUeCb *ueCb)
-{
-
- DU_LOG("\nDEBUG --> SCH : rgSCHHdFddUeDel(): UeId =%d hdFdd=%x",
- ueCb->ueId, ueCb->hdFddEnbld);
-
-
- if (ueCb->hdFddCb)
- {
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cellCb->instIdx, (Data **)(&(ueCb->hdFddCb)),
- sizeof(RgSchUeHdFddCb));
- ueCb->hdFddEnbld = FALSE;
- }
-
- return ROK;
-} /* rgSCHHdFddUeDel */
-
-
-
-#ifdef TFU_UPGRADE
-/* @brief Mark the subframes as uplink for HD FDD if CQI/RI or SRS or RI is
- * expecting .
- *
- * @details
- *
- * Function: rgSCHCmnHdFddPtUlMrk
- * Purpose: Updation of Periodic CQI/PMI, SRS and SR tranmission
- * instance updates
- * for HD FDD UEs
- * @param[in] RgSchCellCb *cell
- * @return None
- */
-
-Void rgSCHCmnHdFddPtUlMrk(RgSchCellCb *cellCb)
-{
- uint16_t sfn; /* System Frame Number */
- uint32_t pti; /* Index into Periodic table */
- uint16_t sfi; /* Index into HDFDD state table */
- CmLListCp *cqiLst;
- CmLListCp *srsLst;
- CmLListCp *srLst;
- CmLListCp *riLst;
- CmLList *cqiNode;
- CmLList *srsNode;
- CmLList *srNode;
- CmLList *riNode;
- CmLteTimingInfo timeInfo;
- RgSchUePCqiCb *cqiCb = NULLP;
- RgSchUePCqiCb *riCb = NULLP;
-
-
- timeInfo = cellCb->crntTime;
-
- /* Determine indexes */
- pti = RG_SCH_HDFDD_GETPTI(timeInfo);
- RG_SCH_HDFDD_GETSFN(sfn, timeInfo, RG_SCH_HDFDD_DELTA);
- RG_SCH_HDFDD_GETSFI(sfi, timeInfo, RG_SCH_HDFDD_DELTA);
-
- /* Get PT entries for */
- cqiLst = &cellCb->pCqiSrsSrLst[pti].cqiLst;
- srsLst = &cellCb->pCqiSrsSrLst[pti].srsLst;
- srLst = &cellCb->pCqiSrsSrLst[pti].srLst;
- riLst = &cellCb->pCqiSrsSrLst[pti].riLst;
-
- /* Get first node in each list */
- CM_LLIST_FIRST_NODE(cqiLst, cqiNode);
- CM_LLIST_FIRST_NODE(srsLst, srsNode);
- CM_LLIST_FIRST_NODE(riLst, riNode);
- CM_LLIST_FIRST_NODE(srLst, srNode);
-
- /* Mark corresponding the subframe as uplink control */
- while ((NULLP != cqiNode ) &&
- (NULLP != srsNode ) &&
- (NULLP != srNode ) &&
- (NULLP != riNode ))
- {
- cqiCb = (RgSchUePCqiCb *)(cqiNode->node);
- RG_SCH_HDFDD_VLDTANDMARK((RgSchUeCb*)(cqiCb->servCellInfo->ue),
- RG_SCH_HDFDD_UL, sfn, sfi);
- /* SRS Transmission instances */
- RG_SCH_HDFDD_VLDTANDMARK((RgSchUeCb*)srsNode->node,
- RG_SCH_HDFDD_UL, sfn, sfi);
- /* SR Transmission instances */
- RG_SCH_HDFDD_VLDTANDMARK((RgSchUeCb*)srNode->node,
- RG_SCH_HDFDD_UL, sfn, sfi);
- /* RI Transmission instances */
- riCb = (RgSchUePCqiCb *)(riNode->node);
- RG_SCH_HDFDD_VLDTANDMARK((RgSchUeCb*)riCb->servCellInfo->ue,
- RG_SCH_HDFDD_UL, sfn, sfi);
-
- /* Get next UeCb for all lists */
- CM_LLIST_NEXT_NODE(cqiLst, cqiNode);
- CM_LLIST_NEXT_NODE(srsLst, srsNode);
- CM_LLIST_NEXT_NODE(srLst, srNode);
- CM_LLIST_NEXT_NODE(riLst, riNode);
- }
-
- while ( NULLP != cqiNode)
- {
- /* CQI/PMI Transmission instances */
- cqiCb = (RgSchUePCqiCb *)(cqiNode->node);
- RG_SCH_HDFDD_VLDTANDMARK((RgSchUeCb*)(cqiCb->servCellInfo->ue),
- RG_SCH_HDFDD_UL, sfn, sfi);
- CM_LLIST_NEXT_NODE(cqiLst, cqiNode);
- }
- while( NULLP != srsNode)
- {
- /* SRS Transmission instances */
- RG_SCH_HDFDD_VLDTANDMARK(((RgSchUeCb*)srsNode->node),
- RG_SCH_HDFDD_UL, sfn, sfi);
- CM_LLIST_NEXT_NODE(srsLst, srsNode);
- }
- while( NULLP != srNode)
- {
- /* SR Transmission instances */
- RG_SCH_HDFDD_VLDTANDMARK(((RgSchUeCb*)srNode->node),
- RG_SCH_HDFDD_UL, sfn, sfi);
- CM_LLIST_NEXT_NODE(srLst, srNode);
- }
- while( NULLP != riNode)
- {
- /* RI Transmission instances */
- riCb = (RgSchUePCqiCb *)(riNode->node);
- RG_SCH_HDFDD_VLDTANDMARK((RgSchUeCb*)riCb->servCellInfo->ue,
- RG_SCH_HDFDD_UL, sfn, sfi);
- CM_LLIST_NEXT_NODE(riLst, riNode);
- }
-
- return;
-} /* rgSCHCmnHdFddPtUlMrk */
-#endif /* ifdef TFU_UPGRADE */
-
-
-
-/* @brief Decides whether UE can be allowed for DL in given subframe
- *
- * @details
- *
- * Function : rgSCHCmnHdFddChkUlAllow
- *
- * Invoking Module Processing:
- * - This shall be invoked by schedulars before allocating UL grants .
- *
- * Processing Steps:
- * - if Half Duplex is enabled
- * - If ue->sf[reqsf].state is "DONWLINK"
- * set alloweUlSch=FALSE
- * - else
- * set alloweUlSch=TRUE
- * This function Marking for BCCH/PCCH occasions is also done
- * - Return ROK
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- *
- * @return None
- *
- */
-Void rgSCHCmnHdFddChkUlAllow(RgSchCellCb *cellCb,RgSchUeCb *ueCb,uint8_t *allow)
-{
- uint16_t sfn;
- uint16_t sfi;
- CmLteTimingInfo timeInfo;
- RgSchDlSf *sf = NULLP; /* Dl subframe info */
- uint8_t ulOffset
-
- DU_LOG("\nDEBUG --> SCH : rgSCHCmnHdFddChkUlAllow: ueId=%d ", ueCb->ueId);
-
- *allow = FALSE;
-
- timeInfo = cellCb->crntTime;
-
- ulOffset = RGSCH_PDCCH_PUSCH_DELTA -
- TFU_CRCIND_ULDELTA + RGSCH_PDCCH_PUSCH_DELTA;
- RG_SCH_ADD_TO_CRNT_TIME(cellCb->crntTime, timeInfo, ulOffset);
-
- /* Set default value */
- *allow = FALSE;
-
- /* Validate condition 1 */
- /* For (curretn time + DL_DELTA)th sf */
-
- /* Also get subframe pointer to fetch Common Ch allocation */
- sf = rgSCHUtlSubFrmGet(cellCb, timeInfo);
-
- sfn = timeInfo.sfn;
- RG_SCH_HDFDD_GETSFI(sfi, timeInfo, 0);
-
- /* Validate condition 2 */
- if (RG_SCH_HDFDD_ISCMN_SCHED(sf))
- {
- /* Common channel scheduled */
- /* Mark the BCCH/PCCH occasion */
- RG_SCH_HDFDD_MARKSTATE(ueCb, RG_SCH_HDFDD_DLDATA, sfn, sfi);
- DU_LOG("\nDEBUG --> SCH : rgSCHCmnHdFddChkUlAllow: Already marked for Cmn DL, ueId = %d ",
- ueCb->ueId);
- }
- if ((ueCb->hdFddCb->subfrm[sfi].sfn == sfn) &&
- (ueCb->hdFddCb->subfrm[sfi].subFrmDir == RG_SCH_HDFDD_DLDATA ||
- ueCb->hdFddCb->subfrm[sfi].subFrmDir == RG_SCH_HDFDD_DLCNTRL))
- {
- /* Downlink scheduled */
- *allow = FALSE;
- DU_LOG("\nERROR --> SCH : rgSCHCmnHdFddChkUlAllow: Already marked for DL, ueId = %d ",
- ueCb->ueId);
- return;
- }
-
- /* Validate condition 3 */
- /* For (curretn time + DL_DELTA + HRQ_DELTA)th sf
- - i.e. next HARQ Feedback occasion */
- RG_SCH_HDFDD_GETSFN(sfn, timeInfo, RG_SCH_CMN_HARQ_INTERVAL);
- RG_SCH_HDFDD_GETSFI(sfi, timeInfo, RG_SCH_CMN_HARQ_INTERVAL);
- if (ueCb->hdFddCb->subfrm[sfi].sfn == sfn &&
- ueCb->hdFddCb->subfrm[sfi].subFrmDir == RG_SCH_HDFDD_UL)
- {
- /* No place for HARQ feedback */
- *allow = FALSE;
- DU_LOG("\nERROR --> SCH : rgSCHCmnHdFddChkUlAllow: No Place for HARQ, ueId = %d ",
- ueCb->ueId);
- return;
-
- }
- /* Validate condition 4 */
- /* For (curretn time + DL_DELTA - HRQ_DELTA)th sf
- - i.e. previous HARQ Feedback occasion */
- RG_SCH_HDFDD_GETSFN(sfn, timeInfo, (-RG_SCH_CMN_HARQ_INTERVAL));
- RG_SCH_HDFDD_GETSFI(sfi, timeInfo, (-RG_SCH_CMN_HARQ_INTERVAL));
- if (ueCb->hdFddCb->subfrm[sfi].sfn == sfn &&
- ueCb->hdFddCb->subfrm[sfi].subFrmDir == RG_SCH_HDFDD_UL)
- {
- *allow = FALSE;
- DU_LOG("\nERROR --> SCH : rgSCHCmnHdFddChkUlAllow: No Place for UL grant, ueId = %d ",
- ueCb->ueId);
- return;
-
- }
- /* Validate condition 5 */
- /* For (curretn time + DL_DELTA - 1)th sf -i.e. Guard time */
- RG_SCH_HDFDD_GETSFN(sfn, timeInfo, (-RG_SCH_HDFDD_GRDTIM_DUR));
- RG_SCH_HDFDD_GETSFI(sfi, timeInfo, (-RG_SCH_HDFDD_GRDTIM_DUR));
- if (ueCb->hdFddCb->subfrm[sfi].sfn == sfn &&
- (ueCb->hdFddCb->subfrm[sfi].subFrmDir == RG_SCH_HDFDD_DLDATA))
- {
- /* This subframe may be a switching gaurd time */
- *allow = FALSE;
- DU_LOG("\nERROR --> SCH : rgSCHCmnHdFddChkUlAllow: No Place for Guard time, ueId = %d ",
- ueCb->ueId);
- return;
-
- }
- /* Adition guard time rule check: Above check is only for PDSCH, lets check
- is there is any BCCH/PCCH data scheduled */
- RG_SCH_ADD_TO_CRNT_TIME(cellCb->crntTime, timeInfo,
- (ulOffset - RG_SCH_HDFDD_GRDTIM_DUR));
- /* Also get subframe pointer to fetch Common Ch allocation */
- sf = rgSCHUtlSubFrmGet(cellCb, timeInfo);
- if (RG_SCH_HDFDD_ISCMN_SCHED(sf))
- {
- /* Common channel scheduled */
- /* Mark the BCCH/PCCH occasion */
- RG_SCH_HDFDD_MARKSTATE(ueCb, RG_SCH_HDFDD_DLDATA, timeInfo.sfn, sfi);
- *allow = FALSE;
- DU_LOG("\nERROR --> SCH : rgSCHCmnHdFddChkUlAllow: Already marked for Cmn DL, ueId = %d ",
- ueCb->ueId);
- return;
-
- }
-
- /* All validation done. Safe to for UL */
- *allow = TRUE;
- return;
-} /* rgSCHCmnHdFddChkUlAllow */
-
-
- /* @brief Decides whether UE can be allowed for UL in given subframe
- *
- * @details
- *
- * Function : rgSCHCmnHdFddChkDlAllow
- *
- * Invoking Module Processing:
- * - This shall be invoked by schedulars before allocating for DL.
- *
- * Processing Steps:
- * Condition 1: subframe n + DL_DELTA should not be uplink
- * Condition 2: subframe n+ DL_DELTA + 1 should meet guard time
- * creation rule. For more
- * information refer to section "2.25.7.1 Guard time
- * creation rule"
- * Condition 3: subframe n + DL_DELTA + HRQ_DELTA should not be
- * downlink so that downlink data (HARQ Feedback)
- * can be received in next 4 subframe. {n + 7} Above
- * conditions have to
- * be validated by taking SFN number into consideration.
- * if all conditions are met then *allow is set to TRUE or lese to
- * FALSE.
- * if hd-fdd is not anabled for this UE, then *allow is always TRUE.
- *
- * Returns None
- * @param[in] RgSchCellCb *cellCb
- * @param[in] RgSchUeCb *ueCb
- * @param[in] CmLteTimingInfo *timeInfo
- * @param[out] uint8_t *allow -- TRUE is allowed or FALSE if no allowedi.
- * Valdity of this pointer is not done in this function
- *
- */
-Void rgSCHCmnHdFddChkDlAllow
-(
-RgSchCellCb *cellCb,
-RgSchUeCb *ueCb,
-Bool *allow /* Valdity of this pointer is not done in this function */
-)
-{
- uint16_t sfn;
- uint16_t sfi;
- RgSchDlSf *sf = NULLP; /* Dl subframe info */
- CmLteTimingInfo timeInfo;
- CmLteTimingInfo tempTimeInfo;
-
- *allow = FALSE;
-
- timeInfo = cellCb->crntTime;
- RGSCH_INCR_SUB_FRAME(timeInfo, RG_SCH_CMN_DL_DELTA);
-
- DU_LOG("\nDEBUG --> SCH : rgSCHCmnHdFddDlSchAll (): ueId=%d ", ueCb->ueId);
-
- /* Also get subframe pointer to fetch Common Ch allocation */
- sf = rgSCHUtlSubFrmGet(cellCb, timeInfo);
-
- /* Validate condition 1 */
- /* For (curretn time + DL_DELTA)th sf */
- sfn = timeInfo.sfn;
- RG_SCH_HDFDD_GETSFI(sfi, timeInfo, 0);
-
- if ((ueCb->hdFddCb->subfrm[sfi].sfn == sfn) &&
- (ueCb->hdFddCb->subfrm[sfi].subFrmDir == RG_SCH_HDFDD_UL))
- {
- /* Uplink scheduled */
- DU_LOG("\nERROR --> SCH : rgSCHCmnHdFddChkDlAllow: sf is UL, ueId=%d ", ueCb->ueId);
- *allow = FALSE;
- return;
- }
-
- /* It is not validation, but BCCH/PCCH marking is done here */
- if (RG_SCH_HDFDD_ISCMN_SCHED(sf))
- {
- /* Common channel scheduled */
- RG_SCH_HDFDD_MARKSTATE(ueCb, RG_SCH_HDFDD_DLDATA, sfn, sfi); /* NOT_HIT */
- }
-
- /* Validate condition 2 */
- /* For (curretn time + DL_DELTA + 1)th sf -i.e. Guard time */
- RG_SCH_HDFDD_GETSFN(sfn, timeInfo, RG_SCH_HDFDD_GRDTIM_DUR);
- RG_SCH_HDFDD_GETSFI(sfi, timeInfo, RG_SCH_HDFDD_GRDTIM_DUR);
- if (ueCb->hdFddCb->subfrm[sfi].sfn == sfn &&
- (ueCb->hdFddCb->subfrm[sfi].subFrmDir == RG_SCH_HDFDD_UL))
- {
- /* This subframe may be a switching guard time */
- DU_LOG("\nERROR --> SCH : rgSCHCmnHdFddChkDlAllow: Guard time rule not met, ueId=%d ",
- ueCb->ueId);
- *allow = FALSE;
- return;
- }
-
- /* Validate condition 3 */
- /* For (curretn time + DL_DELTA + HRQ_DELTA)th sf - i.e. next HARQ
- Feedback occasion */
-
- RG_SCH_HDFDD_GETSFN(sfn, timeInfo, RG_SCH_CMN_HARQ_INTERVAL);
- RG_SCH_HDFDD_GETSFI(sfi, timeInfo, RG_SCH_CMN_HARQ_INTERVAL);
-
- /* First check for any Common channel info is scheduled */
- RG_SCH_ADD_TO_CRNT_TIME(timeInfo, tempTimeInfo, RG_SCH_CMN_HARQ_INTERVAL)
- /* Also get subframe pointer to fetch Common Ch allocation */
- sf = rgSCHUtlSubFrmGet(cellCb, tempTimeInfo);
- if (RG_SCH_HDFDD_ISCMN_SCHED(sf))
- {
- /* Common channel scheduled */
- /* Do the marking for this subframe */
- RG_SCH_HDFDD_MARKSTATE(ueCb, RG_SCH_HDFDD_DLDATA, tempTimeInfo.sfn, sfi);
- DU_LOG("\nDEBUG --> SCH : rgSCHCmnHdFddChkDlAllow: Possible systemInfo, ueId=%d ",
- ueCb->ueId);
- }
-
- /* Check for actual validation condition 3 */
- if (ueCb->hdFddCb->subfrm[sfi].sfn == sfn &&
- ueCb->hdFddCb->subfrm[sfi].subFrmDir != RG_SCH_HDFDD_UL)
- {
- /* No place for HARQ feedback */
- DU_LOG("\nERROR --> SCH : rgSCHCmnHdFddChkDlAllow: No place for HARQ feedback, ueId=%d ",
- ueCb->ueId);
- *allow = FALSE;
-
- /* Mark this sf as DLCNTRL */
- ueCb->hdFddCb->subfrm[sfi].subFrmDir =RG_SCH_HDFDD_DLCNTRL;
- return;
- }
-
-
- /* If we are here then, subframe at HARQth location can be UL.
- But check if Guard violation is done */
- RG_SCH_HDFDD_GETSFN(sfn, timeInfo, RG_SCH_CMN_HARQ_INTERVAL-1);
- RG_SCH_HDFDD_GETSFI(sfi, timeInfo, RG_SCH_CMN_HARQ_INTERVAL-1);
- /* check for any Common channel info is scheduled */
- RG_SCH_ADD_TO_CRNT_TIME(timeInfo, tempTimeInfo, (RG_SCH_CMN_HARQ_INTERVAL-1))
- /* Also get subframe pointer to fetch Common Ch allocation */
- sf = rgSCHUtlSubFrmGet(cellCb, tempTimeInfo);
- if (RG_SCH_HDFDD_ISCMN_SCHED(sf))
- {
- /* Common channel scheduled */
- /* Do the marking for this subframe */
- RG_SCH_HDFDD_MARKSTATE(ueCb, RG_SCH_HDFDD_DLDATA, tempTimeInfo.sfn, sfi);
- DU_LOG("\nDEBUG --> SCH : rgSCHCmnHdFddChkDlAllow: (GT) Possible systemInfo, ueId=%d ",
- ueCb->ueId);
- }
-
- if (ueCb->hdFddCb->subfrm[sfi].sfn == sfn &&
- ueCb->hdFddCb->subfrm[sfi].subFrmDir == RG_SCH_HDFDD_DLDATA)
- {
- /* No place for HARQ feedback */
- DU_LOG("\nERROR --> SCH : rgSCHCmnHdFddChkDlAllow: (GT) No place for HARQ feedback,"
- "ueId=%d ",ueCb->ueId);
-
- *allow = FALSE;
- return;
- }
- /* First check for any Common channel info is scheduled */
-
- *allow = TRUE;
- /* All validation done. Safe to for DL */
- return;
-} /* rgSCHCmnHdFddChkDlAllow */
-
-
-
-/* @brief Decides whether NACK can be sent in a given subrame
- *
- * @details
- *
- * Function : rgSCHCmnHdFddChkNackAllow
- *
- * Invoking Module Processing:
- * - This shall be invoked by schedulars.
- *
- * @param[in] RgSchUeCb *ue
- *
- * @return None
- *
- */
-
-Void rgSCHCmnHdFddChkNackAllow(RgSchCellCb *cellCb,RgSchUeCb *ueCb,CmLteTimingInfo timeInfo,Bool *sndNACK)
-{
- RgSchDlSf *sf;
- CmLteTimingInfo tempTimeInfo;
-
- /* Information in timeInfo contains (n+DL_DELTA) th subframe info*/
-
- *sndNACK = FALSE;
-
- /* Determine SFN and sf index for current subframe.
- Note: Round function used as example */
- tempTimeInfo = timeInfo;
- RGSCH_INCR_SUB_FRAME(tempTimeInfo, RG_SCH_CMN_HARQ_INTERVAL);
-
- /* Also get subframe pointer to fetch Common Ch allocation */
- sf = rgSCHUtlSubFrmGet(cellCb, tempTimeInfo);
-
- /* Check is this subframe has any Common Channel info scheduled */
- if(RG_SCH_HDFDD_ISCMN_SCHED(sf))
- {
- /* Yes, Cannot send NACK */
- DU_LOG("\nERROR --> SCH : rgSCHCmnHdFddChkNackAllow: Cannot send NACK, ueId = %d ",
- ueCb->ueId);
- *sndNACK = FALSE;
- }
- else
- {
- /* safe, Send NACK */
- DU_LOG("\nDEBUG --> SCH : rgSCHCmnHdFddChkNackAllow: NACk can be sent, ueId = %d ",
- ueCb->ueId);
- *sndNACK = TRUE;
- }
-
- return;
-} /* rgSCHCmnHdFddChkNackAllow */
-
-
-
-
- /* @brief makes final marking for HD-FDD UL allocations
- *
- * @details
- *
- * Function : rgSCHCmnHdFddUpdULMark
- *
- * Invoking Module Processing:
- * - This shall be invoked by schedulars at the time of UL allocation
- * finalization.
- *
- * Processing Steps:
- *
- * @param[in] RgSchCellCb *cellCb
- * @param[in] RgSchUeCb *ueCb
- * @param[in] CmLteTimingInfo *timeInfo
- * @param[out] uint8_t *allow -- TRUE is allowed or FALSE if no allowedi.
- * Valdity of this pointer is not done in this function.
- *
- * @return None
- */
-Void rgSCHCmnHdFddUpdULMark(RgSchCellCb *cellCb,RgSchUeCb *ueCb)
-{
-
- uint16_t sfn;
- uint16_t sfi;
- CmLteTimingInfo timeInfo;
- uint8_t ulOffset;
-
- ulOffset = RGSCH_PDCCH_PUSCH_DELTA -
- TFU_CRCIND_ULDELTA + RGSCH_PDCCH_PUSCH_DELTA;
- RG_SCH_ADD_TO_CRNT_TIME(cellCb->crntTime, timeInfo, ulOffset)
-
-
- /* Mark (n + UL_DELTA)th subframe as UL */
- sfn = timeInfo.sfn;
- RG_SCH_HDFDD_GETSFI(sfi, timeInfo, 0);
-
- RG_SCH_HDFDD_MARKSTATE(ueCb, RG_SCH_HDFDD_UL, sfn, sfi);
-
- /* Mark (n + UL_DELTA + HARQ_DELTA)th subframe as DL */
- RG_SCH_HDFDD_GETSFN(sfn, timeInfo, RG_SCH_CMN_HARQ_INTERVAL);
- RG_SCH_HDFDD_GETSFI(sfi, timeInfo, RG_SCH_CMN_HARQ_INTERVAL);
- RG_SCH_HDFDD_MARKSTATE(ueCb, RG_SCH_HDFDD_DLCNTRL, sfn, sfi);
-
- /* Mark (n + UL_DELTA - HARQ_DELTA)th subframe as DL */
- RG_SCH_HDFDD_GETSFN(sfn, timeInfo, (0-RG_SCH_CMN_HARQ_INTERVAL));
- RG_SCH_HDFDD_GETSFI(sfi, timeInfo, (0-RG_SCH_CMN_HARQ_INTERVAL));
- if (ueCb->hdFddCb->subfrm[sfi].subFrmDir != RG_SCH_HDFDD_DLDATA)
- {
- RG_SCH_HDFDD_MARKSTATE(ueCb, RG_SCH_HDFDD_DLCNTRL, sfn, sfi);
- }
-
- /* Mark (n + UL_DELTA - 1)th subframe as DL_CNTRL */
- RG_SCH_HDFDD_GETSFN(sfn, timeInfo, -RG_SCH_HDFDD_GRDTIM_DUR);
- RG_SCH_HDFDD_GETSFI(sfi, timeInfo, -RG_SCH_HDFDD_GRDTIM_DUR);
- RG_SCH_HDFDD_MARKSTATE(ueCb, RG_SCH_HDFDD_DLCNTRL, sfn, sfi);
-
- /* Remove marking for older subframes */
-
- RG_SCH_HDFDD_GETSFN(sfn, timeInfo, (S16)(ulOffset * -1));
- RG_SCH_HDFDD_GETSFI(sfi, timeInfo, (ulOffset * -1));
- RG_SCH_HDFDD_MARKSTATE(ueCb, RG_SCH_HDFDD_NOSCHD, RG_SCH_HDFDD_INVSFN, sfi);
-
- return;
-} /* rgSCHCmnHdFddUpdULMark */
-
-
-
-
- /* @brief makes final marking for HD-FDD DL allocations
- *
- * @details
- *
- * Function : rgSCHCmnHdFddUpdDLMark
- *
- * Invoking Module Processing:
- * - This shall be invoked by schedulars at the time of DL allocation
- * finalization.
- *
- * Processing Steps:
- *
- * @param[in] RgSchCellCb *cellCb
- * @param[in] RgSchUeCb *ueCb
- * @param[in] CmLteTimingInfo *timeInfo
- * @param[out] uint8_t *allow -- TRUE is allowed or FALSE if no allowed.
- * Valdity of this pointer is not done in this function
- *
- * @return None
- */
-
-Void rgSCHCmnHdFddUpdDLMark(RgSchCellCb *cellCb,RgSchUeCb *ueCb)
-{
-
- uint16_t sfn;
- uint16_t sfi;
- CmLteTimingInfo timeInfo;
-
- timeInfo = cellCb->crntTime;
- RGSCH_INCR_SUB_FRAME(timeInfo, RG_SCH_CMN_DL_DELTA);
-
- /* Mark (n + DL_DELTA)th subframe as DL */
- sfn = timeInfo.sfn;
- RG_SCH_HDFDD_GETSFI(sfi, timeInfo, 0);
-
- RG_SCH_HDFDD_MARKSTATE(ueCb, RG_SCH_HDFDD_DLDATA, sfn, sfi);
-
- /* Mark (n + 1)th subframe as DL_CNTRL */
- RG_SCH_HDFDD_GETSFN(sfn, timeInfo, RG_SCH_HDFDD_GRDTIM_DUR);
- RG_SCH_HDFDD_GETSFI(sfi, timeInfo, RG_SCH_HDFDD_GRDTIM_DUR);
- RG_SCH_HDFDD_MARKSTATE(ueCb, RG_SCH_HDFDD_DLCNTRL, sfn, sfi);
-
- /* Mark (n + DL_DELTA + HARQ_DELTA )th subframe as UL */
- RG_SCH_HDFDD_GETSFN(sfn, timeInfo, RG_SCH_CMN_HARQ_INTERVAL);
- RG_SCH_HDFDD_GETSFI(sfi, timeInfo, RG_SCH_CMN_HARQ_INTERVAL);
- RG_SCH_HDFDD_MARKSTATE(ueCb, RG_SCH_HDFDD_UL, sfn, sfi);
-
- /* Mark (n + DL_DELTA + HARQ_DELTA - 1)th subframe
- as DL control for Guard period */
- RG_SCH_HDFDD_GETSFN(sfn, timeInfo,
- (RG_SCH_CMN_HARQ_INTERVAL - RG_SCH_HDFDD_GRDTIM_DUR));
- RG_SCH_HDFDD_GETSFI(sfi, timeInfo,
- (RG_SCH_CMN_HARQ_INTERVAL - RG_SCH_HDFDD_GRDTIM_DUR));
- if (ueCb->hdFddCb->subfrm[sfi].subFrmDir != RG_SCH_HDFDD_UL)
- {
- RG_SCH_HDFDD_MARKSTATE(ueCb, RG_SCH_HDFDD_DLCNTRL, sfn, sfi);
- }
-
- return;
-} /* rgSCHCmnHdFddUpdDLMark */
-
-
- /* @brief determines effective SFN
- *
- * @details
- *
- * Function : rgSCHHdFddGetSfn
- *
- * Invoking Module Processing:
- * Any HD-FDD module can invoke this function.
- *
- * Processing Steps:
- *
- * @param[out] *sfn uint32_t
- * @param[in] timeInfo timing information subframe of interest
- * @param[in] offsest Offest with w.r.t which SFN has to be determined
- *
- * @return None
- */
-
-Void rgSCHHdFddGetSfn(uint16_t *sfn,CmLteTimingInfo timeInfo,S16 offset)
-{
- uint16_t tempSfn;
- S16 tempSfCount;
-
- if(((S16)(timeInfo.subframe) + offset) >= RGSCH_NUM_SUB_FRAMES)
- {
- /* Increament to number of times of SFNs that can be possible
- with this offset */
- tempSfn = (timeInfo.sfn +
- ((timeInfo.subframe + offset) / RGSCH_NUM_SUB_FRAMES))
- & (RGSCH_MAX_SFN -1); /* Mod with MAX SFN supported */
- }
- else
- {
- if(((S16)(timeInfo.subframe) + offset) < 0)
- {
- /* If negative, then definitely at least previous SFN */
- tempSfn = (timeInfo.sfn - 1) & (RGSCH_MAX_SFN -1);
-
- /* Now find how many more times we need to decreament */
- tempSfCount = timeInfo.subframe + offset;
- RG_SCH_HDFDD_ROLLSFN(tempSfCount, tempSfn);
- }
- else
- {
- /* No change in sfn */
- tempSfn = timeInfo.sfn;
- }
- }
- *sfn = tempSfn;
-
- return;
-} /* End of rgSCHHdFddGetSfn */
-
-
-#ifdef __cplusplus
-}
- /* extern C */
-#endif /* __cplusplus */
-
-#endif /* LTEMAC_HDFDD */
-
-
-
-
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/**********************************************************************
- Name: LTE MAC HD-FDD
-
- Type: C header file
-
- Desc: Defines required by HD-FDD
-
- File: rg_sch_hdfdd.h
-
-*********************************************************************21*/
-
-\f
-#ifndef __RGSCHHDFDDH__
-#define __RGSCHHDFDDH__
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Half Duplex Specific defines */
-/* Maximum Number of subframes information managed */
-#define RG_SCH_HDFDD_MAXSUB_INFO 20
-
-/* Subframe States */
-#define RG_SCH_SF_DFLT_STATE 0x00
-#define RG_SCH_SF_DLDATA_STATE 0x01
-#define RG_SCH_SF_DLCNTRL_STATE 0x02
-#define RG_SCH_SF_ULDATA_CNTRL_STATE 0x04
-
-/* To get the BCH is present or not at subframe */
-#define RG_SCH_BCCH_TRUE_FALSE( _time, _bchTrue)\
-{\
- _bchTrue = FALSE;\
- /* Call the API is provided by SI module */ \
-}
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __RGSCHCMNH__ */
-
-/********************************************************************30**
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/**********************************************************************
-
- Name: LTE MAC HD-FDD
-
- Type: C include file
-
- Desc: Defines required by HD-FDD
-
- File: rg_sch_hdfdd.x
-
-**********************************************************************/
-/**
- * @file rg_sch_hdfdd.x This file gives the describes the design for Half
- * Duplex FDD feature.
- *
- * Half duplex FDD operation is one in which the UE cannot receive and
- * transmit at the same time. This is more of a UE limitation, chosen to
- * reduce the complexity of the UE's hardware. In LTE the half duplex FDD
- * is implemented such that the eNodeB schedules such that the UE doesn't
- * transmit and receive in the same subframe. The UE unless informed that a
- * subframe is for Uplink transmission continues to look at the PDCCH.
-
- * Due to the delay in switching from downlink to uplink, UE is unable to
- * receive the last few symbols of the subframe preceding the subframe
- * assigned for uplink transmissions.Half duplex FDD is a UE specific
- * configuration.
-*/
-
-
-#ifndef __RGHDFDDX__
-#define __RGHDFDDX__
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-
-
-/******************************************************************************
- * Start of Data declarations *
- ******************************************************************************/
-
-/**
- @brief Half Duplex subframtion information stored per ue. */
-
-typedef struct rgSchUeHdFddSfInfo
-{
- uint16_t sfn; /*!< Store the sfn for updated state
- Default Value= 0xffff
- */
- uint8_t state;
- /*!< 0x00= DFLT
- 0x01= DL DATA +(OPT:CNTRL INFO)
- 0x02= DL CNTRL
- 0x04= UL DATA+(OPT: CTNRL INFO)
- */
-
-}RgSchUeHdFddSfInfo;
-
-/**
- @brief Half Duplex control related information per ue. */
-
-typedef struct rgSchUeHdFddCb
-{
- RgSchUeHdFddSfInfo sf[RG_SCH_HDFDD_MAXSUB_INFO];
-
- CmLList hdFddLstEnt; /*!< Linked list entity for HD-FDD List */
-
-}RgSchUeHdFddCb;
-
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* __RGHDFDD__ */
-
-\f
-/**********************************************************************
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for packing/unpacking of INF interface
- primitives.
-
- File: rg_sch_inf.c
-
-**********************************************************************/
-
-/* header include files (.h) */
-#include "common_def.h"
-#include "tfu.h" /* RGU defines */
-#ifdef LTE_L2_MEAS
-#include "lrg.h"
-#endif
-#include "rg_sch_inf.h" /* RGU Interface defines */
-
-/* header/extern include files (.x) */
-#include "tfu.x" /* RGU defines */
-#ifdef LTE_L2_MEAS
-#include "lrg.x"
-#endif
-#include "rg_sch_inf.x" /* RGU Interface includes */
-
-#ifdef LCSCH
-/*Fix: start: Inform UE delete to scheduler*/
-/**
-* @brief This primitive is used to indicate to scheduler
-* that UE has been deleted at MAC.
-*
-* @details
-*
-* Function : cmPkMacSchUeDelInd
-*
-* @param[in] Pst* pst
-* @param[in] RgInfUeDelInd* ueDelInd
-* @return S16
-* -# ROK
-**/
-S16 cmPkMacSchUeDelInd(Pst* pst,RgInfUeDelInd* ueDelInd)
-{
- Buffer *mBuf = NULLP;
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
- {
- return RFAILED;
- }
-
-#ifdef MS_MBUF_CORRUPTION
- MS_BUF_ADD_ALLOC_CALLER();
-#endif
- if(SAddPstMsgMult((Data *)ueDelInd, sizeof(RgInfUeDelInd), mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTINFUEDELIND;
- return (SPstTsk(pst,mBuf));
-}
-
-/**
-* @brief This primitive is used to indicate to scheduler
-* that UE has been deleted at MAC.
-*
-*
-* @details
-*
-* Function : cmUnpkMacSchUeDelInd
-*
-* @param[in] Pst* pst
-* @param[in] SpId spId
-* @param[in] RguDDatReqInfo * datReq
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkMacSchUeDelInd(UeDelInd func,Pst *pst,Buffer *mBuf)
-{
- RgInfUeDelInd ueDelInd;
-
- if(SRemPreMsgMult((Data *)&ueDelInd, sizeof(RgInfUeDelInd), mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- RGSCHINF_FREE_MSG(mBuf);
-
- return ((*func)(pst, &ueDelInd));
-}
-/*Fix: end: Inform UE delete to scheduler*/
-
-/**
-* @brief Request from RLC to MAC for forwarding SDUs on
- * dedicated channel for transmission.
-*
-* @details
-*
-* Function : cmPkMacSchDedBoUpdtReq
-*
-* @param[in] Pst* pst
-* @param[in] SpId spId
-* @param[in] RguDDatReqInfo * datReq
-* @return S16
-* -# ROK
-**/
-S16 cmPkMacSchDedBoUpdtReq(Pst* pst,RgInfDedBoRpt* boRpt)
-{
- Buffer *mBuf = NULLP;
-
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) {
- return RFAILED;
- }
-
-#ifdef MS_MBUF_CORRUPTION
- MS_BUF_ADD_ALLOC_CALLER();
-#endif
- if(SAddPstMsgMult((Data *)boRpt, sizeof(RgInfDedBoRpt), mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTINFDEDBOUPDTREQ;
- return (SPstTsk(pst,mBuf));
-}
-
-
-/**
-* @brief Request from RLC to MAC for forwarding SDUs on
- * dedicated channel for transmission.
-*
-* @details
-*
-* Function : cmUnpkMacSchDedBoUpdtReq
-*
-* @param[in] Pst* pst
-* @param[in] SpId spId
-* @param[in] RguDDatReqInfo * datReq
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkMacSchDedBoUpdtReq(DedBoUpdtReq func,Pst *pst,Buffer *mBuf)
-{
- RgInfDedBoRpt boRpt;
-
- if(SRemPreMsgMult((Data *)&boRpt, sizeof(RgInfDedBoRpt), mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- RGSCHINF_FREE_MSG(mBuf);
- return ((*func)(pst, &boRpt));
-}
-/**
-* @brief Request from RLC to MAC for forwarding SDUs on
- * dedicated channel for transmission.
-*
-* @details
-*
-* Function : cmPkMacSchCmnBoUpdtReq
-*
-* @param[in] Pst* pst
-* @param[in] SpId spId
-* @param[in] RguDDatReqInfo * datReq
-* @return S16
-* -# ROK
-**/
-S16 cmPkMacSchCmnBoUpdtReq(Pst* pst,RgInfCmnBoRpt* boRpt)
-{
- Buffer *mBuf = NULLP;
-
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) {
- return RFAILED;
- }
-
-#ifdef MS_MBUF_CORRUPTION
- MS_BUF_ADD_ALLOC_CALLER();
-#endif
- if(SAddPstMsgMult((Data *)boRpt, sizeof(RgInfCmnBoRpt), mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTINFCMNBOUPDTREQ;
- return (SPstTsk(pst,mBuf));
-}
-
-
-/**
-* @brief Request from RLC to MAC for forwarding SDUs on
- * dedicated channel for transmission.
-*
-* @details
-*
-* Function : cmUnpkMacSchCmnBoUpdtReq
-*
-* @param[in] Pst* pst
-* @param[in] SpId spId
-* @param[in] RguDDatReqInfo * datReq
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkMacSchCmnBoUpdtReq(CmnBoUpdtReq func,Pst *pst,Buffer *mBuf)
-{
- RgInfCmnBoRpt boRpt;
-
- if(SRemPreMsgMult((Data *)&boRpt, sizeof(RgInfCmnBoRpt), mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- RGSCHINF_FREE_MSG(mBuf);
- return ((*func)(pst, &boRpt));
-}
-/**
-* @brief Request from RLC to MAC for forwarding SDUs on
- * dedicated channel for transmission.
-*
-* @details
-*
-* Function : cmPkMacSchSfRecpInd
-*
-* @param[in] Pst* pst
-* @param[in] SpId spId
-* @param[in] RguDDatReqInfo * datReq
-* @return S16
-* -# ROK
-**/
-S16 cmPkMacSchSfRecpInd(Pst* pst,RgInfSfDatInd* datInd)
-{
- Buffer *mBuf = NULLP;
-
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) {
- return RFAILED;
- }
-
- if(oduPackPointer((PTR)datInd, mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTINFSFRECPIND;
- return (SPstTsk(pst,mBuf));
-}
-
-
-/**
-* @brief Request from RLC to MAC for forwarding SDUs on
- * dedicated channel for transmission.
-*
-* @details
-*
-* Function : cmUnpkMacSchSfRecpInd
-*
-* @param[in] Pst* pst
-* @param[in] SpId spId
-* @param[in] RguDDatReqInfo * datReq
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkMacSchSfRecpInd(SfRecpInd func,Pst *pst,Buffer *mBuf)
-{
- RgInfSfDatInd* datInd;
-
- if(oduUnpackPointer((PTR *)&datInd, mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- RGSCHINF_FREE_MSG(mBuf);
- /* Call cmFreeMem(datInd) in scheduler */
- return ((*func)(pst, datInd));
-}
-
-#ifdef LTEMAC_SPS
-/**
-* @brief Primitive from MAC to SCH to indicate release of UL SPS for a UE
-*
-* @details
-*
-* Function : cmPkMacSchSpsRelInd
-*
-* @param[in] Pst* pst
-* @param[in] RgInfSpsRelInfo* relInfo
-* @return S16
-* -# ROK
-**/
-S16 cmPkMacSchSpsRelInd(Pst* pst,RgInfSpsRelInfo* relInfo)
-{
- Buffer *mBuf = NULLP;
-
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) {
- return RFAILED;
- }
-
- if(oduPackPointer((PTR)relInfo, mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTINFSPSRELIND;
- return (SPstTsk(pst,mBuf));
-} /* end of cmPkMacSchSpsRelInd */
-
-/**
-* @brief Primitive from MAC to SCH to indicate release of UL SPS for a UE
-*
-* @details
-*
-* Function : cmUnpkMacSchSpsRelInd
-*
-* @param[in] SpsRelInd func
-* @param[in] Pst* pst
-* @param[in] Buffer *mBuf
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkMacSchSpsRelInd(SpsRelInd func,Pst *pst,Buffer *mBuf)
-{
- RgInfSpsRelInfo *relInfo;
-
- if(oduUnpackPointer((PTR *)&relInfo, mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- RGSCHINF_FREE_MSG(mBuf);
- return ((*func)(pst, relInfo));
-} /* end of cmUnpkMacSchSpsRelInd */
-#endif /* LTEMAC_SPS */
-
-#endif
-#ifdef LCRG
-/**
-* @brief Request from RLC to MAC for forwarding SDUs on
- * dedicated channel for transmission.
-*
-* @details
-*
-* Function : cmPkSchMacSfAllocReq
-*
-* @param[in] Pst* pst
-* @param[in] SpId spId
-* @param[in] RguDDatReqInfo * datReq
-* @return S16
-* -# ROK
-**/
-S16 cmPkSchMacSfAllocReq(Pst* pst,RgInfSfAlloc* resAllocReq)
-{
- Buffer *mBuf = NULLP;
-
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) {
- return RFAILED;
- }
-
- if(oduPackPointer((PTR)resAllocReq, mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTINFSFALLOCREQ;
- return (SPstTsk(pst,mBuf));
-}
-
-
-/**
-* @brief Request from RLC to MAC for forwarding SDUs on
- * dedicated channel for transmission.
-*
-* @details
-*
-* Function : cmUnpkSchMacSfAllocReq
-*
-* @param[in] Pst* pst
-* @param[in] SpId spId
-* @param[in] RguDDatReqInfo * datReq
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkSchMacSfAllocReq(SfAllocReq func,Pst *pst,Buffer *mBuf)
-{
- RgInfSfAlloc* resAllocReq;
-
- if(oduUnpackPointer((PTR *)&resAllocReq, mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- RGSCHINF_FREE_MSG(mBuf);
- return ((*func)(pst, resAllocReq));
-}
-/**
-* @brief Request from SCH To MAC for harq entity reset
-*
-* @details
-*
-* Function : cmPkSchMacRstHqEntReq
-*
-* @param[in] Pst* pst
-* @param[in] RgInfResetHqEnt *hqEntInfo
-* @return S16
-* -# ROK
-**/
-S16 cmPkSchMacRstHqEntReq(Pst* pst,RgInfResetHqEnt* hqEntInfo)
-{
- Buffer *mBuf = NULLP;
-
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) {
- return RFAILED;
- }
-
- if(oduPackPointer((PTR)hqEntInfo, mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTINFHQENTRESET;
- return (SPstTsk(pst,mBuf));
-}
-
-/**
-* @brief Request from SCH to MAC for resetting the harqentity
-*
-* @details
-*
-* Function : cmUnpkSchMacRstHqEntReq
-*
-* @param[in] Pst* pst
-* @param[in] RgInfResetHqEnt *hqEntInfo
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkSchMacRstHqEntReq(RstHqEntReq func,Pst *pst,Buffer *mBuf)
-{
- RgInfResetHqEnt* hqEntRstInfo;
-
- if(oduUnpackPointer((PTR *)&hqEntRstInfo, mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- RGSCHINF_FREE_MSG(mBuf);
- return ((*func)(pst, hqEntRstInfo));
-}
-
-/**
-* @brief Request from RLC to MAC for forwarding SDUs on
- * dedicated channel for transmission.
-*
-* @details
-*
-* Function : cmPkSchMacRlsHqReq
-*
-* @param[in] Pst* pst
-* @param[in] SpId spId
-* @param[in] RguDDatReqInfo * datReq
-* @return S16
-* -# ROK
-**/
-S16 cmPkSchMacRlsHqReq(Pst* pst,RgInfRlsHqInfo* sfHqInfo)
-{
- Buffer *mBuf = NULLP;
-
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) {
- return RFAILED;
- }
-
- if(oduPackPointer((PTR)sfHqInfo, mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTINFRLSHQREQ;
- return (SPstTsk(pst,mBuf));
-}
-
-/**
-* @brief Request from RLC to MAC for forwarding SDUs on
- * dedicated channel for transmission.
-*
-* @details
-*
-* Function : cmUnpkSchMacRlsHqReq
-*
-* @param[in] Pst* pst
-* @param[in] SpId spId
-* @param[in] RguDDatReqInfo * datReq
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkSchMacRlsHqReq(RlsHqReq func,Pst *pst,Buffer *mBuf)
-{
- RgInfRlsHqInfo* sfHqInfo;
-
- if(oduUnpackPointer((PTR *)&sfHqInfo, mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- RGSCHINF_FREE_MSG(mBuf);
- return ((*func)(pst, sfHqInfo));
-}
-/**
-* @brief Request from RLC to MAC for forwarding SDUs on
- * dedicated channel for transmission.
-*
-* @details
-*
-* Function : cmPkSchMacRlsRntiReq
-*
-* @param[in] Pst* pst
-* @param[in] SpId spId
-* @param[in] RguDDatReqInfo * datReq
-* @return S16
-* -# ROK
-**/
-S16 cmPkSchMacRlsRntiReq(Pst* pst,RgInfRlsRnti* rlsRnti)
-{
- Buffer *mBuf = NULLP;
-
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) {
- return RFAILED;
- }
-
-#ifdef MS_MBUF_CORRUPTION
- MS_BUF_ADD_ALLOC_CALLER();
-#endif
- if(SAddPstMsgMult((Data *)rlsRnti, sizeof(RgInfRlsRnti), mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTINFRLSRNTIREQ;
- return (SPstTsk(pst,mBuf));
-}
-
-/**
-* @brief Request from RLC to MAC for forwarding SDUs on
- * dedicated channel for transmission.
-*
-* @details
-*
-* Function : cmUnpkSchMacRlsRntiReq
-*
-* @param[in] Pst* pst
-* @param[in] SpId spId
-* @param[in] RguDDatReqInfo * datReq
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkSchMacRlsRntiReq(RlsRntiReq func,Pst *pst,Buffer *mBuf)
-{
- RgInfRlsRnti rlsRnti;
-
- if(SRemPreMsgMult((Data *)&rlsRnti, sizeof(RgInfRlsRnti), mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- RGSCHINF_FREE_MSG(mBuf);
- return ((*func)(pst, &rlsRnti));
-}
-
-/**
-* @brief Request from RLC to MAC for forwarding SDUs on
- * dedicated channel for transmission.
-*
-* @details
-*
-* Function : cmPkSchMacCellRegReq
-*
-* @param[in] Pst* pst
-* @param[in] SpId spId
-* @param[in] RguDDatReqInfo * datReq
-* @return S16
-* -# ROK
-**/
-S16 cmPkSchMacCellRegReq(Pst* pst,RgInfCellReg* regReq)
-{
- Buffer *mBuf = NULLP;
-
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) {
- return RFAILED;
- }
-
-#ifdef MS_MBUF_CORRUPTION
- MS_BUF_ADD_ALLOC_CALLER();
-#endif
- if(SAddPstMsgMult((Data *)regReq, sizeof(RgInfCellReg), mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTINFCELLREGREQ;
- return (SPstTsk(pst,mBuf));
-}
-
-/**
-* @brief Request from RLC to MAC for forwarding SDUs on
- * dedicated channel for transmission.
-*
-* @details
-*
-* Function : cmUnpkSchMacCellRegReq
-*
-* @param[in] Pst* pst
-* @param[in] SpId spId
-* @param[in] RguDDatReqInfo * datReq
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkSchMacCellRegReq(CellRegReq func,Pst *pst,Buffer *mBuf)
-{
- RgInfCellReg regReq;
-
- if(SRemPreMsgMult((Data *)®Req, sizeof(RgInfCellReg), mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- RGSCHINF_FREE_MSG(mBuf);
- return ((*func)(pst, ®Req));
-}
-
-/**
-* @brief Primitive from SCH to MAC to register GBR LCG per UE
-*
-* @details
-*
-* Function : cmPkSchMacLcgRegReq
-*
-* @param[in] Pst* pst
-* @param[in] RgInfLcgRegReq *lcgRegReq
-* @return S16
-* -# ROK
-**/
-S16 cmPkSchMacLcgRegReq(Pst* pst,RgInfLcgRegReq *lcgRegReq)
-{
- Buffer *mBuf = NULLP;
-
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) {
- return RFAILED;
- }
-
- if(SAddPstMsgMult((Data *)lcgRegReq, sizeof(RgInfLcgRegReq), mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTINFLCGREG;
- return (SPstTsk(pst,mBuf));
-} /* end of cmPkSchMacLcgRegReq */
-
-/**
-* @brief Primitive from SCH to MAC to register GBR LCG
-*
-* @details
-*
-* Function : cmUnpkSchMacLcgRegReq
-*
-* @param[in] LcgReg func
-* @param[in] Pst* pst
-* @param[in] Buffer *mBuf
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkSchMacLcgRegReq(LcgReg func,Pst *pst,Buffer *mBuf)
-{
- RgInfLcgRegReq *lcgRegReq;
-
- if(oduUnpackPointer((PTR *)&lcgRegReq, mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- RGSCHINF_FREE_MSG(mBuf);
- return ((*func)(pst, lcgRegReq));
-} /* end of cmUnpkSchMacLcgRegReq */
-
-#ifdef LTEMAC_SPS
-
-/**
-* @brief Primitive from SCH to MAC to register the set of SPS LCs per UE
-*
-* @details
-*
-* Function : cmPkSchMacSpsLcRegReq
-*
-* @param[in] Pst* pst
-* @param[in] RgInfSpsLcInfo *lcInfo
-* @return S16
-* -# ROK
-**/
-S16 cmPkSchMacSpsLcRegReq(Pst* pst,RgInfSpsLcInfo *lcInfo)
-{
- Buffer *mBuf = NULLP;
-
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) {
- return RFAILED;
- }
-
- if(oduPackPointer((PTR)lcInfo, mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTINFSPSLCREG;
- return (SPstTsk(pst,mBuf));
-} /* end of cmPkSchMacSpsLcRegReq */
-
-/**
-* @brief Primitive from SCH to MAC to reset SPS Params for the UE
-*
-* @details
-*
-* Function : cmPkSchMacUlSpsResetReq
-*
-* @param[in] Pst* pst
-* @param[in] RgInfUlSpsReset *ulSpsResetInfo
-* @return S16
-* -# ROK
-**/
-S16 cmPkSchMacUlSpsResetReq(Pst* pst,RgInfUlSpsReset *ulSpsResetInfo)
-{
- Buffer *mBuf = NULLP;
-
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) {
- return RFAILED;
- }
-
- if(oduPackPointer((PTR)ulSpsResetInfo, mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTINFSPSRESET;
- return (SPstTsk(pst,mBuf));
-} /* end of cmPkSchMacUlSpsResetReq */
-
-/**
-* @brief Primitive from SCH to MAC to register the set of SPS LCs per UE
-*
-* @details
-*
-* Function : cmUnpkSchMacSpsLcRegReq
-*
-* @param[in] SpsLcReg func
-* @param[in] Pst* pst
-* @param[in] Buffer *mBuf
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkSchMacSpsLcRegReq(SpsLcReg func,Pst *pst,Buffer *mBuf)
-{
- RgInfSpsLcInfo *lcInfo;
-
- if(oduUnpackPointer((PTR *)&lcInfo, mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- RGSCHINF_FREE_MSG(mBuf);
- return ((*func)(pst, lcInfo));
-} /* end of cmUnpkSchMacSpsLcRegReq */
-
-
-
-/**
-* @brief Primitive from SCH to MAC to reset UL SPS params
-*
-* @details
-*
-* Function : cmUnpkSchMacUlSpsResetReq
-*
-* @param[in] UlSpsReset func
-* @param[in] Pst* pst
-* @param[in] Buffer *mBuf
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkSchMacUlSpsResetReq(UlSpsReset func,Pst *pst,Buffer *mBuf)
-{
- RgInfUlSpsReset *ulSpsResetInfo;
-
- if(oduUnpackPointer((PTR *)&ulSpsResetInfo, mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- RGSCHINF_FREE_MSG(mBuf);
- return ((*func)(pst, ulSpsResetInfo));
-} /* end of cmUnpkSchMacUlSpsResetReq */
-
-
-
-/**
-* @brief Primitive from SCH to MAC to deregister the set of SPS LCs per UE
-*
-* @details
-*
-* Function : cmPkSchMacSpsLcDeregReq
-*
-* @param[in] Pst* pst
-* @param[in] CmLteCellId cellId,
-* @param[in] CmLteRnti crnti
-* @return S16
-* -# ROK
-**/
-S16 cmPkSchMacSpsLcDeregReq(Pst* pst,CmLteCellId cellId,CmLteRnti crnti)
-{
- Buffer *mBuf = NULLP;
-
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) {
- return RFAILED;
- }
-
- CMCHKPK(cmPkLteCellId, cellId, mBuf);
- CMCHKPK(cmPkLteRnti, crnti, mBuf);
-
- pst->event = (Event) EVTINFSPSLCDEREG;
- return (SPstTsk(pst,mBuf));
-} /* end of cmPkSchMacSpsLcDeregReq */
-
-/**
-* @brief Primitive from SCH to MAC to deregister the set of SPS LCs per UE
-*
-* @details
-*
-* Function : cmUnpkSchMacSpsLcDeregReq
-*
-* @param[in] SpsLcDereg func
-* @param[in] Pst* pst
-* @param[in] Buffer *mBuf
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkSchMacSpsLcDeregReq(SpsLcDereg func,Pst *pst, Buffer *mBuf)
-{
- CmLteCellId cellId;
- CmLteRnti crnti;
-
- CMCHKUNPK(cmUnpkLteRnti, &crnti, mBuf);
- CMCHKUNPK(cmUnpkLteCellId, &cellId, mBuf);
-
- RGSCHINF_FREE_MSG(mBuf);
- return ((*func)(pst, cellId, crnti));
-} /* end of cmUnpkSchMacSpsLcDeregReq */
-
-#endif /* LTEMAC_SPS */
-#ifdef LTE_L2_MEAS
-
-/**
-* @brief Primitive from SCH to MAC for L2 Measurement
-*
-* @details
-*
-* Function : cmPkSchMacL2MeasReq
-*
-* @param[in] Pst* pst
-* @param[in] RgInfSpsLcInfo *lcInfo
-* @return S16
-* -# ROK
-**/
-S16 cmPkSchMacL2MeasReq(Pst* pst,RgInfL2MeasReq *measInfo)
-{
- Buffer *mBuf = NULLP;
-
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) {
- return RFAILED;
- }
- if(SAddPstMsgMult((Data *)measInfo, sizeof(RgInfL2MeasReq), mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTINFL2MEASREQ;
- return (SPstTsk(pst,mBuf));
-} /* end of cmPkSchMacL2MeasReq */
-
-/**
-* @brief Primitive from SCH to MAC for L2 Stop Measurement
-*
-* @details
-*
-* Function : cmPkSchMacL2MeasStopReq
-*
-* @param[in] Pst* pst
-* @param[in] RgInfSpsLcInfo *lcInfo
-* @return S16
-* -# ROK
-**/
-S16 cmPkSchMacL2MeasStopReq(Pst* pst,RgInfL2MeasStopReq *measInfo)
-{
- Buffer *mBuf = NULLP;
-
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) {
- return RFAILED;
- }
- if(SAddPstMsgMult((Data *)measInfo, sizeof(RgInfL2MeasStopReq), mBuf) != ROK)
- {
- ODU_PUT_MSG_BUF(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTINFL2MEASSTOPREQ;
- return (SPstTsk(pst,mBuf));
-} /* end of cmPkSchMacL2MeasStopReq */
-/**
-* @brief Primitive from SCH to MAC for L2 Measurement
-* Send Request
-* @details
-*
-* Function : cmPkSchMacL2MeasSendReq
-*
-* @param[in] Pst* pst
-* @param[in] RgInfSpsLcInfo *lcInfo
-* @return S16
-* -# ROK
-**/
-S16 cmPkSchMacL2MeasSendReq(Pst* pst,RgInfL2MeasSndReq *measInfo)
-{
- Buffer *mBuf = NULLP;
-
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) {
- return RFAILED;
- }
-
- if(SAddPstMsgMult((Data *)measInfo, sizeof(RgInfL2MeasSndReq), mBuf) != ROK)
- {
- ODU_PUT_MSG_BUF(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTINFL2MEASSENDREQ;
- return (SPstTsk(pst,mBuf));
-} /* end of cmPkSchMacL2MeasSendReq */
-
-/**
-* @brief Primitive from SCH to MAC for L2 Measurement request
-*
-* @details
-*
-* Function : cmUnpkSchMacL2MeasReq
-*
-* @param[in] L2MeasReg func
-* @param[in] Pst* pst
-* @param[in] Buffer *mBuf
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkSchMacL2MeasReq(L2MeasReq func,Pst *pst,Buffer *mBuf)
-{
- RgInfL2MeasReq measInfo;
-
- if(SRemPreMsgMult((Data *)&measInfo, sizeof(RgInfL2MeasReq), mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- RGSCHINF_FREE_MSG(mBuf);
- return ((*func)(pst, &measInfo));
-} /* end of cmUnpkSchMacL2MeasReq */
-
-/**
-* @brief Primitive from SCH to MAC for L2 Measurement Stop request
-*
-* @details
-*
-* Function : cmUnpkSchMacL2MeasStopReq
-*
-* @param[in] L2MeasReg func
-* @param[in] Pst* pst
-* @param[in] Buffer *mBuf
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkSchMacL2MeasStopReq(L2MeasStopReq func,Pst *pst,Buffer *mBuf)
-{
- RgInfL2MeasStopReq measInfo;
-
- if(SRemPreMsgMult((Data *)&measInfo, sizeof(RgInfL2MeasStopReq), mBuf) != ROK)
- {
- ODU_PUT_MSG_BUF(mBuf);
- return RFAILED;
- }
-
- ODU_PUT_MSG_BUF(mBuf);
- return ((*func)(pst, &measInfo));
-} /* end of cmUnpkSchMacL2MeasReq */
-/**
-* @brief Primitive from SCH to MAC for L2 Measurement request
-*
-* @details
-*
-* Function : cmUnpkSchMacL2MeasReq
-*
-* @param[in] L2MeasReg func
-* @param[in] Pst* pst
-* @param[in] Buffer *mBuf
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkSchMacL2MeasSendReq(L2MeasSendReq func,Pst *pst,Buffer *mBuf)
-{
- RgInfL2MeasSndReq measInfo;
-
- if(SRemPreMsgMult((Data *)&measInfo, sizeof(RgInfL2MeasSndReq), mBuf) != ROK)
- {
- ODU_PUT_MSG_BUF(mBuf);
- return RFAILED;
- }
-
- ODU_PUT_MSG_BUF(mBuf);
- return ((*func)(pst, &measInfo));
-} /* end of cmUnpkSchMacL2MeasSendReq*/
-
-/**
-* @brief Primitive from MAC to SCH for L2 Measurement
-*
-* @details
-*
-* Function : cmPkMacSchL2MeasCfm
-*
-* @param[in] Pst* pst
-* @param[in] RgInfL2MeasCfm *measInfo
-* @return S16
-* -# ROK
-**/
-S16 cmPkMacSchL2MeasCfm(Pst* pst,RgInfL2MeasCfm *measCfm)
-{
- Buffer *mBuf = NULLP;
-
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) {
- return RFAILED;
- }
-
- if(SAddPstMsgMult((Data *)measCfm, sizeof(RgInfL2MeasCfm), mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTINFL2MEASCFM;
- return (SPstTsk(pst,mBuf));
-} /* end of cmPkMacSchL2MeasCfm */
-
-
-/**
-* @brief Primitive from MAC to SCH for L2 Measurement
-* stop cfm
-* @details
-*
-* Function : cmPkMacSchL2MeasStopCfm
-*
-* @param[in] Pst* pst
-* @param[in] RgInfL2MeasCfm *measInfo
-* @return S16
-* -# ROK
-**/
-S16 cmPkMacSchL2MeasStopCfm(Pst* pst,RgInfL2MeasCfm *measCfm)
-{
- Buffer *mBuf = NULLP;
-
- if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) {
- return RFAILED;
- }
-
- if(SAddPstMsgMult((Data *)measCfm, sizeof(RgInfL2MeasCfm), mBuf) != ROK)
- {
- ODU_PUT_MSG_BUF(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTINFL2MEASSTOPCFM;
- return (SPstTsk(pst,mBuf));
-}/*cmPkMacSchL2MeasStopCfm*/
-/**
-* @brief Primitive from MAC to SCH for L2 Measurement Cfm
-*
-* @details
-*
-* Function : cmUnpkSchMacL2MeasReq
-*
-* @param[in] L2MeasCfm func
-* @param[in] Pst* pst
-* @param[in] Buffer *mBuf
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkMacSchL2MeasCfm(L2MeasCfm func,Pst *pst,Buffer *mBuf)
-{
- RgInfL2MeasCfm measCfm;
-
- if(SRemPreMsgMult((Data *)&measCfm, sizeof(RgInfL2MeasCfm), mBuf) != ROK)
- {
- RGSCHINF_FREE_MSG(mBuf);
- return RFAILED;
- }
-
- RGSCHINF_FREE_MSG(mBuf);
- return ((*func)(pst, &measCfm));
-} /* end of cmUnpkMacSchL2MeasCfm */
-
-/**
-* @brief Primitive from MAC to SCH for L2 Measurement Stop Cfm
-*
-* @details
-*
-* Function : cmUnpkMacSchL2MeasStopCfm
-*
-* @param[in] L2MeasCfm func
-* @param[in] Pst* pst
-* @param[in] Buffer *mBuf
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkMacSchL2MeasStopCfm(L2MeasCfm func,Pst *pst,Buffer *mBuf)
-{
- RgInfL2MeasCfm measCfm;
-
- if(SRemPreMsgMult((Data *)&measCfm, sizeof(RgInfL2MeasCfm), mBuf) != ROK)
- {
- ODU_PUT_MSG_BUF(mBuf);
- return RFAILED;
- }
-
- ODU_PUT_MSG_BUF(mBuf);
- return ((*func)(pst, &measCfm));
-} /* end of cmUnpkMacSchL2MeasStopCfm */
-
-#endif/* LTE_L2_MEAS */
-
-#endif
-
-
-/**********************************************************************
-
- End of file
-**********************************************************************/
#define EVTINFSFRECPIND 7
/* Added support for SPS*/
#ifdef LTEMAC_SPS
-#define EVTINFSPSLCREG 8
-#define EVTINFSPSLCDEREG 9
#define EVTINFSPSRELIND 10
-#define EVTINFSPSRESET 18
#endif /* LTEMAC_SPS */
#ifdef LTE_L2_MEAS
/*Fix: Inform UE delete to scheduler*/
#define EVTINFUEDELIND 13
-#define EVTINFLCGREG 17
-
#ifdef LTE_ADV
#define EVTINFHQENTRESET 19
#endif
));
#endif /* LTE_L2_MEAS */
-typedef struct rgInfLcgRegReq
-{
- CmLteCellId cellId; /*!< Cell Identifier */
- CmLteRnti crnti; /*!< RNTI which uniquely identifies the UE
- RNTI range is specified in Section
- 7.1 in 25.321 Specification. */
- uint8_t lcgId;
- Bool isGbr; /* Indicate if the LCG is Gbr */
-} RgInfLcgRegReq;
-
/* Added support for SPS*/
#ifdef LTEMAC_SPS
uint16_t spsPrd; /*!< SPS periodicity of the UE */
} RgInfSpsLcInfo;
-/**
- * @brief This structure contains UL SPS param Reset related to
- * uplink SPS for a particular UE identified by the CRNTI.
- */
-typedef struct rgInfUlSpsReset
-{
- CmLteCellId cellId; /*!< Cell Identifier */
- CmLteRnti crnti; /*!< RNTI which uniquely identifies the UE
- RNTI range is specified in Section
- 7.1 in 25.321 Specification. */
-} RgInfUlSpsReset;
-
-
/**
* @brief This structure contains the information to release UL SPS for a UE */
typedef struct rgInfSpsRelInfo
));
/* Added support for SPS*/
-typedef S16 (*LcgReg) ARGS((
- Pst* pst,
- RgInfLcgRegReq *lcgRegReq
-));
-
-S16 cmPkSchMacLcgRegReq ARGS((
- Pst* pst,
- RgInfLcgRegReq *lcgRegReq
-));
-
-S16 RgSchMacLcgRegReq ARGS((Pst *pst, RgInfLcgRegReq *lcgRegReq));
-
-S16 cmUnpkSchMacLcgRegReq ARGS((
- LcgReg func,
- Pst *pst,
- Buffer *mBuf
-));
-
-S16 RgSchMacLcgReg ARGS((Pst* pst, RgInfLcgRegReq *lcgRegReq));
-
#ifdef LTEMAC_SPS
-/**
- * @brief Primitive from Scheduler to MAC to register the logical channels of
- * a SPS UE
- * @details This primitive is used for light-weight loose coupling.
- */
-S16 cmPkSchMacSpsLcRegReq ARGS((
- Pst* pst,
- RgInfSpsLcInfo *lcInfo
-));
-
-typedef S16 (*SpsLcReg) ARGS((
- Pst* pst,
- RgInfSpsLcInfo *lcInfo
-));
-
-/**
- * @brief Request from Scheduler to register the SPS related logical channels.
- * @details Scheduler calls this primitive to send the list of logical channels
- * that belong to the SPS logical channel group.
- */
-S16 RgSchMacSpsLcRegReq ARGS((Pst *pst, RgInfSpsLcInfo *lcInfo));
-
-S16 cmUnpkSchMacSpsLcRegReq ARGS((
- SpsLcReg func,
- Pst *pst,
- Buffer *mBuf
-));
-
-
-/**
- * @brief Primitive from Scheduler to MAC to Reset UL SPS related Params
- * @details This primitive is used for light-weight loose coupling.
- */
-S16 cmPkSchMacUlSpsResetReq ARGS((
- Pst* pst,
- RgInfUlSpsReset *ulSpsResetInfo
-));
-
-typedef S16 (*UlSpsReset) ARGS((
- Pst* pst,
- RgInfUlSpsReset *ulSpsResetInfo
-));
-
-/**
- * @brief Request from Scheduler to reset UL SPS Params
- * @details Scheduler calls this primitive to reset implicit and explicit
- * release counters for the UE
- */
-S16 RgSchMacUlSpsResetReq ARGS((Pst *pst, RgInfUlSpsReset *ulSpsResetInfo));
-
-S16 cmUnpkSchMacUlSpsResetReq ARGS((
- UlSpsReset func,
- Pst *pst,
- Buffer *mBuf
-));
-
-
-
-/**
- * @brief Primitive from Scheduler to MAC to deregister the logical channels of
- * a SPS UE
- * @details This primitive is used for light-weight loose coupling.
- */
-S16 cmPkSchMacSpsLcDeregReq ARGS((
- Pst* pst,
- CmLteCellId cellId,
- CmLteRnti crnti
-));
-
-typedef S16 (*SpsLcDereg) ARGS((
- Pst* pst,
- CmLteCellId cellId,
- CmLteRnti crnti
-));
-
-/**
- * @brief Request from Scheduler to deregister the SPS related logical channels.
- * @details Scheduler calls this primitive to send the deregistration request
- * for a UE once SPS is released for it
- */
-S16 RgSchMacSpsLcDeregReq ARGS((Pst *pst, CmLteCellId cellId, CmLteRnti
- crnti));
-
-S16 cmUnpkSchMacSpsLcDeregReq ARGS((
- SpsLcDereg func,
- Pst* pst,
- Buffer *mBuf
-));
-
/**
* @brief Primitive from MAC to Scheduler to indicate release of UL SPS for a UE
* @details This primitive is used for light-weight loose coupling.
/* Added support for SPS*/
#ifdef LTEMAC_SPS
S16 RgSchMacSpsLcReg ARGS((Pst *pst, RgInfSpsLcInfo *lcInfo));
-S16 RgSchMacUlSpsReset ARGS((Pst *pst, RgInfUlSpsReset *lcInfo));
S16 RgSchMacSpsLcDereg ARGS((Pst *pst, CmLteCellId cellId, CmLteRnti
crnti));
S16 RgMacSchSpsRel ARGS((Pst *pst, RgInfSpsRelInfo* relInfo));
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for L2 Measurement fucntions
-
- File: rg_sch_l2m.c
-
-**********************************************************************/
-
-/** @file rg_sch_l2m.c
-@brief This file implements the L2 Measurement feature code.
-*/
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "lrg.h"
-#include "rgr.h"
-#include "rgm.h"
-#include "tfu.h"
-#include "rg_env.h"
-#include "rg_sch.h"
-#include "rg_sch_cmn.h"
-#include "rg_sch_inf.h" /* typedefs for Scheduler */
-#include "rg_sch_err.h"
-
-/* header/extern include files (.x) */
-#include "tfu.x" /* TFU types */
-#include "lrg.x" /* layer management typedefs for MAC */
-#include "rgr.x" /* layer management typedefs for MAC */
-#include "rgm.x" /* layer management typedefs for MAC */
-#include "rg_sch_inf.x" /* typedefs for Scheduler */
-#include "rg_sch.x" /* typedefs for Scheduler */
-#include "rg_sch_cmn.x" /* typedefs for Scheduler */
-/* local defines */
-uint32_t dlPrbCnt;
-#ifdef LTE_L2_MEAS
-
-
-static S16 rgSchL2mInsertMeasCb ARGS((
- RgSchCellCb *cell,
- RgSchL2MeasCb *measCb,
- LrgSchMeasReqInfo *measInfo ));
-
-static RgSchL2MeasCb * rgSchL2mAllocMeasCb ARGS((
- RgSchCellCb *cell,
- LrgSchMeasReqInfo *measInfo,
- RgSchErrInfo err));
-
-/* Function definitions */
-
-/** @brief This function fills the L2 measurement confirm structure
- *
- * @details
- *
- * Function: rgSchFillL2MeasCfm
- *
- * @param [in] RgSchCellCb *cell
- * @param [in] RgSchL2MeasCb *measCb
- * @param [out] LrgSchMeasCfmInfo *measCfm
- * @param [in] measTime
- * @return Void
- */
-S16 rgSchFillL2MeasCfm
-(
-RgSchCellCb *cell,
-RgSchL2MeasCb *measCb,
-LrgSchMeasCfmInfo *cfm,
-uint32_t measTime
-)
-{
- uint8_t idx;
- LrgSchMeasReqInfo *measInfo;
- uint8_t qciVal = 0;
- uint32_t sampOc = 0;
-
- measInfo = &measCb->measReq;
-
- cfm->hdr.transId = measInfo->hdr.transId;
- cfm->measType = measInfo->measType;
- cfm->cellId = measInfo->cellId;
- cfm->cfm.status = LCM_PRIM_OK;
- if((measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_DL) &&
- (measCb->dlTotalBw))
- {
- cfm->avgPrbDl.prbPerc = ((cell->avgPrbDl.prbCount * 100) /
- measCb->dlTotalBw);
- /* Resetting the prbCount to 0, fix for ccpu00125002 */
- cell->avgPrbDl.prbCount = 0;
- }
- if((measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_UL) &&
- (measCb->ulTotalBw))
- {
- cfm->avgPrbUl.prbPerc = ((cell->avgPrbUl.prbCount * 100) /
- measCb->ulTotalBw);
- /* Resetting the prbCount to 0, fix for ccpu00125002 */
- cell->avgPrbUl.prbCount = 0;
- }
- if((measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_PER_QCI_DL) &&
- (measCb->dlTotalBw))
- {
- cfm->avgPrbQciDlCfm.numQci = measCb->measReq.avgPrbQciDl.numQci;
- for(idx = 0; idx < measCb->measReq.avgPrbQciDl.numQci; idx++)
- {
- qciVal = measCb->measReq.avgPrbQciDl.qci[idx];
- cfm->avgPrbQciDlCfm.prbPercQci[idx].prbPercQci =
- ((cell->qciArray[qciVal].dlPrbCount * 100) /
- measCb->dlTotalBw);
- cfm->avgPrbQciDlCfm.prbPercQci[idx].qciValue = qciVal;
- cell->qciArray[qciVal].dlPrbCount = 0;
- }
- }
- if((measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL) &&
- (measCb->ulTotalBw))
- {
- cfm->avgPrbQciUlCfm.numQci = measCb->measReq.avgPrbQciUl.numQci;
- for(idx = 0; idx < measCb->measReq.avgPrbQciUl.numQci; idx++)
- {
- cfm->avgPrbQciUlCfm.prbPercQci[idx].qciValue =
- measCb->avgPrbQciUl.prbUsage[idx].qciValue;
-
- if(measCb->avgPrbQciUl.prbUsage[idx].prbUsage > measCb->ulTotalBw)
- {
- measCb->avgPrbQciUl.prbUsage[idx].prbUsage = measCb->ulTotalBw;
- }
-
- cfm->avgPrbQciUlCfm.prbPercQci[idx].prbPercQci =
- ((measCb->avgPrbQciUl.prbUsage[idx].prbUsage * 100) /
- measCb->ulTotalBw);
- }
- }
- if(measCb->measReq.measType & LRG_L2MEAS_RA_PREAMBLE)
- {
- cfm->raPrmbsCfm.dedPreambles = cell->raPrmbs.dedPream;
- cfm->raPrmbsCfm.randSelPreLowRange = cell->raPrmbs.preamGrpA;
- cfm->raPrmbsCfm.randSelPreHighRange = cell->raPrmbs.preamGrpB;
- cell->raPrmbs.dedPream = 0;
- cell->raPrmbs.preamGrpA = 0;
- cell->raPrmbs.preamGrpB = 0;
- }
- if(measCb->measReq.measType & LRG_L2MEAS_NMB_ACTV_UE_PER_QCI_DL)
- {
- cfm->numUeQciDlCfm.numQci = measInfo->nmbActvUeQciDl.numQci;
- sampOc = (measTime / measInfo->nmbActvUeQciDl.sampPrd);
-
- if(sampOc)
- {
- if (measCb->measReq.nmbActvUeQciDl.numQci)
- {
- for(idx = 0; idx < measCb->measReq.nmbActvUeQciDl.numQci; idx++)
- {
- qciVal = measCb->measReq.nmbActvUeQciDl.qci[idx];
- /* L2_COUNTERS */
- cell->qciArray[qciVal].dlTotal_UeCount +=
- cell->qciArray[qciVal].dlUeCount;
- cfm->numUeQciDlCfm.numActvUeQci[idx].numActvUeQci =
- cell->qciArray[qciVal].dlTotal_UeCount / sampOc;
- cfm->numUeQciDlCfm.numActvUeQci[idx].qciValue = qciVal;
-
- DU_LOG("\nDEBUG --> SCH : L2_MEAS:CFM DL QCI %u TOTAL Count %lu Active UE %d ",
- qciVal,cell->qciArray[qciVal].dlTotal_UeCount,
- cfm->numUeQciDlCfm.numActvUeQci[idx].numActvUeQci);
-
- cell->qciArray[qciVal].dlTotal_UeCount = 0;
- }
- }
- else
- {
- idx = 0;
- for(qciVal = 1; qciVal < LRG_MAX_QCI_PER_REQ; qciVal++)
- {
- /* L2_COUNTERS */
- cell->qciArray[qciVal].dlTotal_UeCount +=
- cell->qciArray[qciVal].dlUeCount;
- if (cell->qciArray[qciVal].dlTotal_UeCount)
- {
- cfm->numUeQciDlCfm.numActvUeQci[idx].numActvUeQci =
- cell->qciArray[qciVal].dlTotal_UeCount / sampOc;
- cfm->numUeQciDlCfm.numActvUeQci[idx].qciValue = qciVal;
-
- DU_LOG("\nDEBUG --> SCH : L2_MEAS:CFM DL QCI %u TOTAL Count %lu Active UE %d ",
- qciVal,cell->qciArray[qciVal].dlTotal_UeCount,
- cfm->numUeQciDlCfm.numActvUeQci[idx].numActvUeQci);
-
- cell->qciArray[qciVal].dlTotal_UeCount = 0;
- idx++;
- }
- }
- cfm->numUeQciDlCfm.numQci = idx;
- }
- }
- }
- if(measCb->measReq.measType & LRG_L2MEAS_NMB_ACTV_UE_PER_QCI_UL)
- {
- cfm->numUeQciUlCfm.numQci = measInfo->nmbActvUeQciUl.numQci;
- sampOc = (measTime / measInfo->nmbActvUeQciUl.sampPrd);
-
-
- if(sampOc)
- {
- if (measCb->measReq.nmbActvUeQciUl.numQci)
- {
- for(idx = 0; idx < measCb->measReq.nmbActvUeQciUl.numQci; idx++)
- {
- cell->qciArray[qciVal].ulTotal_UeCount +=
- cell->qciArray[qciVal].ulUeCount;
- qciVal = measCb->measReq.nmbActvUeQciUl.qci[idx];
- cfm->numUeQciUlCfm.numActvUeQci[idx].numActvUeQci =
- cell->qciArray[qciVal].ulTotal_UeCount/ sampOc;
- cfm->numUeQciUlCfm.numActvUeQci[idx].qciValue = qciVal;
-
- DU_LOG("\nDEBUG --> SCH : L2_MEAS:CFM UL QCI %d TOTAL Count %lu Active UE %d ",
- qciVal,cell->qciArray[qciVal].ulTotal_UeCount,
- cfm->numUeQciUlCfm.numActvUeQci[idx].numActvUeQci);
-
- cell->qciArray[qciVal].ulTotal_UeCount = 0;
- }
- }
- else
- {
- idx = 0;
- for(qciVal = 1; qciVal < LRG_MAX_QCI_PER_REQ; qciVal++)
- {
- cell->qciArray[qciVal].ulTotal_UeCount +=
- cell->qciArray[qciVal].ulUeCount;
- if (cell->qciArray[qciVal].ulTotal_UeCount)
- {
- cfm->numUeQciUlCfm.numActvUeQci[idx].numActvUeQci =
- cell->qciArray[qciVal].ulTotal_UeCount/ sampOc;
- cfm->numUeQciUlCfm.numActvUeQci[idx].qciValue = qciVal;
-
- DU_LOG("\nDEBUG --> SCH : L2_MEAS:CFM UL QCI %d TOTAL Count %lu Active UE %d ",
- qciVal,cell->qciArray[qciVal].ulTotal_UeCount,
- cfm->numUeQciUlCfm.numActvUeQci[idx].numActvUeQci);
-
- cell->qciArray[qciVal].ulTotal_UeCount = 0;
- idx++;
- }
- }
- cfm->numUeQciUlCfm.numQci = idx;
- }
- }
- }
- if(measCb->measReq.measType & LRG_L2MEAS_TB_TRANS_DL_COUNT)
- {
- cfm->tbTransDlTotalCnt = cell->dlUlTbCnt.tbTransDlTotalCnt;
- cell->dlUlTbCnt.tbTransDlTotalCnt = 0;
- }
- if(measCb->measReq.measType & LRG_L2MEAS_TB_TRANS_DL_FAULTY_COUNT)
- {
- cfm->tbTransDlFaulty = cell->dlUlTbCnt.tbTransDlFaulty;
- cell->dlUlTbCnt.tbTransDlFaulty = 0;
- }
- if(measCb->measReq.measType & LRG_L2MEAS_TB_TRANS_UL_COUNT)
- {
- cfm->tbTransUlTotalCnt = cell->dlUlTbCnt.tbTransUlTotalCnt;
- cell->dlUlTbCnt.tbTransUlTotalCnt = 0;
- }
- if(measCb->measReq.measType & LRG_L2MEAS_TB_TRANS_UL_FAULTY_COUNT)
- {
- cfm->tbTransUlFaulty = cell->dlUlTbCnt.tbTransUlFaulty;
- cell->dlUlTbCnt.tbTransUlFaulty = 0;
- }
-
- measCb->dlTotalBw = 0;
- measCb->ulTotalBw = 0;
-
- return ROK;
-} /* rgSchFillL2MeasCfm */
-
-/** @brief This function sends the L2 measurement confirm to LM
- * from Shceduler
- *
- * @details
- *
- * Function: rgSchL2mSndCfm
- *
- * @param [in] Pst *pst
- * @param [in] RgSchL2MeasCb *measCb
- * @param [in] Bool isErr
- * @return Void
- */
-S16 rgSchL2mSndCfm
-(
-Pst *pst,
-RgSchL2MeasCb *measCb,
-LrgSchMeasReqInfo *measInfo,
-Bool isErr
-)
-{
- LrgSchMeasCfmInfo cfm;
-
- memset(&cfm, 0, sizeof(LrgSchMeasCfmInfo));
- cfm.hdr.transId = measInfo->hdr.transId;
- cfm.measType = measInfo->measType;
- cfm.cellId = measInfo->cellId;
- cfm.cfm.status = LCM_PRIM_OK;
- if(isErr == TRUE)
- {
- cfm.cfm.status = LCM_PRIM_NOK;
- cfm.cfm.reason = LCM_REASON_INVALID_PAR_VAL;
- RgMiLrgSchL2MeasCfm(pst, &cfm);
- return ROK;
- }
- return ROK;
-} /* rgSchL2mSndCfm */
-
-/** @brief This function fills the LM confirmation pst structure
- *
- * @details
- *
- * Function: rgSchL2mFillCfmPst
- *
- * @param [in] Pst *pst
- * @param [out] Pst *cfmPst
- * @param [in] LrgSchMeasReqInfo *measInfo
- * @return Void
- */
-Void rgSchL2mFillCfmPst
-(
-Pst *pst,
-Pst *cfmPst,
-LrgSchMeasReqInfo *measInfo
-)
-{
-
- cfmPst->srcEnt = pst->dstEnt;
- cfmPst->srcInst = pst->dstInst;
- cfmPst->srcProcId = pst->dstProcId;
- cfmPst->dstEnt = pst->srcEnt;
- cfmPst->dstInst = pst->srcInst;
- cfmPst->dstProcId = pst->srcProcId;
-
- cfmPst->selector = measInfo->hdr.response.selector;
- cfmPst->prior = measInfo->hdr.response.prior;
- cfmPst->route = measInfo->hdr.response.route;
- cfmPst->region = measInfo->hdr.response.mem.region;
- cfmPst->pool = measInfo->hdr.response.mem.pool;
-
- return;
-} /* rgSchL2mFillCfmPst */
-
-/** @brief This function inserts the MeasCb in to data base
- *
- * @details
- *
- * Function: rgSchL2mInsertMeasCb
- *
- * @param [in] RgSchCellCb *cell
- * @param [in] RgSchL2MeasCb *measCb
- * @param [in] LrgSchMeasReqInfo *measInfo
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-static S16 rgSchL2mInsertMeasCb
-(
-RgSchCellCb *cell,
-RgSchL2MeasCb *measCb,
-LrgSchMeasReqInfo *measInfo
-)
-{
- CmLList *lnk, *node;
- RgSchL2MeasCb *oldMeasCb;
- uint32_t diffTime;
-
- /*
- * 1. Check if l2mList has any entries.
- * 2. If yes
- * 1. Take the first entrie's time period and find the diff with
- * cell->crntTime.
- * 2. If the diff is > measInfo->timePeriod then insert before this
- * entry.
- * 3. Else take the next entry in list
- * 4. If reached without adding to list . Append at the end of list.
- * 3. If no entries in l2mList add at the first.
- */
- lnk = cell->l2mList.first;
- node = &measCb->measLnk;
- node->node = (PTR)measCb;
- while(lnk != NULLP )
- {
- oldMeasCb = (RgSchL2MeasCb *)lnk->node;
- diffTime = (oldMeasCb->measReq.timePrd -
- (RGSCH_CALC_SF_DIFF(cell->crntTime, oldMeasCb->startTime)));
- if (diffTime > measInfo->timePrd)
- {
- cell->l2mList.crnt = lnk;
- cmLListInsCrnt(&(cell->l2mList), node);
- return ROK;
- }
- else
- {
- lnk = lnk->next;
- }
- } /* End of While */
- cmLListAdd2Tail(&(cell->l2mList), node);
- return ROK;
-} /* rgSchL2mInsertMeasCb */
-
-/** @brief This function calculates the Down link prb count
- * for a DlSf
- *
- * @details
- *
- * Function: rgSchL2CalDlPrbCount
- *
- * @param [in] RgSchCellCb *cell
- */
-static Void rgSchL2CalDlPrbCount(RgSchCellCb *cell)
-{
- CmLteTimingInfo frm;
- RgSchDlSf *sf = NULLP;
-#ifdef LTE_TDD
- uint8_t idx;
-#endif
-
- frm = cell->crntTime;
- RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA);
- sf = rgSCHUtlSubFrmGet(cell, frm);
-#ifdef LTE_TDD
- idx = (cell->crntTime.slot + RG_SCH_CMN_DL_DELTA) %
- RGSCH_NUM_SUB_FRAMES;
- if(RG_SCH_CMN_CHK_DL_DATA_ALLOWED(cell, idx))
- {
- cell->avgPrbDl.prbCount += sf->bwAssigned;
- dlPrbCnt += sf->bwAssigned;
- }
-#else
- cell->avgPrbDl.prbCount += sf->bwAssigned;
-#endif
- return;
-}
-
-/** @brief This function calculates the up link prb count
- * for a UlSf
- *
- * @details
- *
- * Function: rgSchL2CalUlPrbCount
- *
- * @param [in] RgSchCellCb *cell
- */
-static Void rgSchL2CalUlPrbCount(RgSchCellCb *cell)
-{
- RgSchUlSf *sf = NULLP;
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
-#ifdef LTE_TDD
- uint8_t idx;
-#endif
-
-#ifdef LTE_TDD
- idx = cellUl->schdIdx;
- if(idx < cellUl->numUlSubfrms)
- {
- sf = &cellUl->ulSfArr[idx];
- cell->avgPrbUl.prbCount += sf->totPrb;
- }
-#else
- sf = &cellUl->ulSfArr[cellUl->schdIdx];
- cell->avgPrbUl.prbCount += sf->totPrb;
-#endif
- return;
-}
-/** @brief This function allocates memory from the heap
- *
- * @details
- *
- * Function: rgSchL2mAllocMeasCb
- *
- * @param [in] RgSchCellCb *cell
- * @param [in] RgSchL2MeasCb *measInfo
- * @param [out] RgSchErrInfo *err
- * @return RgSchL2MeasCb *
- */
-static RgSchL2MeasCb * rgSchL2mAllocMeasCb
-(
-RgSchCellCb *cell,
-LrgSchMeasReqInfo *measInfo,
-RgSchErrInfo err
-)
-{
- RgSchL2MeasCb *measCb = NULLP;
- Inst inst = cell->instIdx;
- UNUSED(err);
-
- if((rgSCHUtlAllocSBuf(inst, (Data **)&measCb,
- sizeof(RgSchL2MeasCb))) == RFAILED)
- {
- DU_LOG("\nERROR --> SCH : Allocation of RgSchL2MeasCb failed");
- return (NULLP);
- }
- memcpy(&measCb->measReq, measInfo, sizeof(LrgSchMeasReqInfo));
- RGSCHCPYTIMEINFO(cell->crntTime, measCb->startTime);
-
- measCb->dlTotalBw = 0;
- measCb->ulTotalBw = 0;
-
- return (measCb);
-} /* rgSchL2mAllocMeasCb */
-
-/**
- * @brief Layer Manager Measurement request handler.
- *
- * @details
- *
- * Function : rgSchL2mMeasReq
- *
- * This function handles measurement request received at scheduler instance
- * from the Layer Manager.
- * -# Measurement request will be stored in the list in ascending order of
- * their time period.
- *
- * @param[in] Pst *pst, the post structure
- * @param[in] LrgSchMeasReqInfo *measInfo, the measurement request structure
- * @param[out] RgSchErrInfo *err, error information
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSchL2mMeasReq
-(
-RgSchCellCb *cell,
-LrgSchMeasReqInfo *measInfo,
-RgSchErrInfo err
-)
-{
- RgSchL2MeasCb *measCb;
- uint8_t idx;
- uint8_t qciVal;
-
-
- qciVal = 0;
- if ((measCb = rgSchL2mAllocMeasCb(cell, measInfo, err)) == NULLP)
- {
- RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ,
- RGSCHERR_SCH_ALLOC_FAILED);
- DU_LOG("\nERROR --> SCH : Allocation of RgSchL2MeasCb failed");
- return RFAILED;
- }
- /*memcpy(&measCb->measReq, measInfo,\
- sizeof(LrgSchMeasReqInfo));*/
- rgSchL2mInsertMeasCb(cell, measCb, measInfo);
-
- if (measInfo->timePrd == 0)
- {
- cell->sndL2Meas = FALSE;
- if (measInfo->measType & LRG_L2MEAS_AVG_PRB_PER_QCI_DL)
- {
- for (idx = 0; idx < measInfo->avgPrbQciDl.numQci; idx++)
- {
- qciVal = measInfo->avgPrbQciDl.qci[idx];
- cell->qciArray[qciVal].qci = qciVal;
- }
- }
- if (measInfo->measType & LRG_L2MEAS_NMB_ACTV_UE_PER_QCI_DL)
- {
- for (idx = 0; idx < measInfo->nmbActvUeQciDl.numQci; idx++)
- {
- qciVal = measInfo->nmbActvUeQciDl.qci[idx];
- cell->qciArray[qciVal].qci = qciVal;
- }
- }
- if (measInfo->measType & LRG_L2MEAS_NMB_ACTV_UE_PER_QCI_UL)
- {
- for (idx = 0; idx < measInfo->nmbActvUeQciUl.numQci; idx++)
- {
- qciVal = measInfo->nmbActvUeQciUl.qci[idx];
- cell->qciArray[qciVal].qci = qciVal;
- }
- }
- }
- /* Here post the message to MAC */
- if(measInfo->measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL)
- {
- RgInfL2MeasReq measReq;
- Pst pst;
- memset(&measReq, 0, sizeof(RgInfL2MeasReq));
- measReq.transId = measInfo->hdr.transId;
- measReq.measType = measInfo->measType;
- measReq.timePrd = measInfo->timePrd;
- measReq.cellId = measInfo->cellId;
- measReq.t.prbReq.numQci = measInfo->avgPrbQciUl.numQci;
- for (idx = 0; idx < measInfo->avgPrbQciUl.numQci; idx++)
- {
- measReq.t.prbReq.qci[idx] = measInfo->avgPrbQciUl.qci[idx];
- }
- /* Send measReq to MAC */
- rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], cell->macInst);
- RgSchMacL2Meas(&pst, &measReq);
- }
- return ROK;
-} /* rgSchL2mMeasReq */
-
-/**
- * @brief This function calculates the measurement for differnt measurement type
- * and send the end result to the layer manager
- *
- * @details
- *
- * Function : rgSCHL2Meas
- *
- * @param[in] RgSchCellCb *cell
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHL2Meas
-(
-RgSchCellCb *cell,
-uint8_t isCalrCrcInd
-)
-{
- CmLList *node = NULLP;
- RgSchL2MeasCb *measCb = NULLP;
- uint8_t idx;
- LrgSchMeasCfmInfo measCfm;
- uint8_t qciVal = 0;
- uint32_t sfDiff;
- uint32_t meas;
-#ifdef LTE_TDD
- uint8_t sfIdx;
- Bool isDlDataAllowed;
- uint8_t rem;
- uint32_t numDlSf;
- uint32_t numUlSf;
-#endif
-
- node = cell->l2mList.first;
- memset(&measCfm, 0, sizeof(LrgSchMeasCfmInfo));
- while(node != NULLP)
- {
- measCb = (RgSchL2MeasCb *)node->node;
- node = node->next;
- if(cell->crntTime.sfn == 1023 && cell->crntTime.slot == 9)
- {
- /*calculates diff between crnt time and start time*/
- meas = RGSCH_CALC_SFN_SF_DIFF(cell->crntTime,
- measCb->sfnCycle, measCb->startTime);
- measCb->sfnCycle++;
- }
- else
- {
- /*calculates diff between crnt time and start time*/
- meas = RGSCH_CALC_SFN_SF_DIFF(cell->crntTime,
- measCb->sfnCycle, measCb->startTime);
- }
-
- if (cell->sndL2Meas || meas == measCb->measReq.timePrd)
- {
-#ifdef LTE_TDD
- rem = meas % RGSCH_NUM_SUB_FRAMES;
- /* Get the total number of DL and UL subframes within the reporting period*/
- numDlSf = (meas / RGSCH_NUM_SUB_FRAMES) * rgSchTddNumDlSubfrmTbl[cell->ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1];
- numUlSf = (meas / RGSCH_NUM_SUB_FRAMES) * rgSchTddNumUlSubfrmTbl[cell->ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1];
-
- sfIdx = (measCb->startTime.slot + 1) % RGSCH_NUM_SUB_FRAMES;
-
- while(rem)
- {
- isDlDataAllowed = RG_SCH_CMN_CHK_DL_DATA_ALLOWED(cell, sfIdx);
- if(isDlDataAllowed)
- {
- numDlSf++;
- }
- else if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx][sfIdx] ==
- RG_SCH_TDD_UL_SUBFRAME)
- {
- numUlSf++;
- }
- sfIdx = (sfIdx + 1) % RGSCH_NUM_SUB_FRAMES;
- rem--;
- }
-
- measCb->dlTotalBw = numDlSf * cell->bwCfg.dlTotalBw;
- measCb->ulTotalBw = numUlSf * cell->bwCfg.ulTotalBw;
-
-#else
- measCb->dlTotalBw = meas * cell->bwCfg.dlTotalBw;
- measCb->ulTotalBw = meas * cell->bwCfg.ulTotalBw;
-#endif
- if((measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL))
- {
- if(measCb->cfmRcvd)
- {
- rgSchFillL2MeasCfm(cell, measCb, &measCfm, meas);
- }
- else
- {
- continue;
- }
- }
- else
- {
- rgSchFillL2MeasCfm(cell, measCb, &measCfm, meas);
- }
- RgMiLrgSchL2MeasCfm(&(rgSchCb[cell->instIdx].rgSchInit.lmPst),
- &measCfm);
- memset(&measCfm, 0, sizeof(LrgSchMeasCfmInfo));
-
- /* Delete this measCb from the list */
- if(measCb->measReq.timePrd > 0)
- {
- cmLListDelFrm(&cell->l2mList, &measCb->measLnk);
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb,
- sizeof(RgSchL2MeasCb));
- }
- else/*do not delete measCb, will use for next measurement*/
- {
- measCb->startTime = cell->crntTime;
- measCb->sfnCycle = 0;
- measCb->cfmRcvd = FALSE;
- memset(&measCb->avgPrbQciUl, 0, sizeof(LrgAvgPrbQCICfm));
- cell->sndL2Meas = FALSE;
- }
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- }
- else
- {
- /* Just update the AVERAGE UL PRB counter here and return
- * if the caller is CRCIndication() and the UL scheduling happens
- * as a part of it*/
-#ifdef RG_ULSCHED_AT_CRC
- if(isCalrCrcInd)
- {
- if(measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_UL)
- {
- rgSchL2CalUlPrbCount(cell);
- }
- continue;
- }
-#else
- /* UL PRB counter gets updated as a part of CRC indication
- * if the UL scheduling happens there */
- if((measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_UL))
- {
- rgSchL2CalUlPrbCount(cell);
- }
-#endif
- if((measCb->measReq.measType & LRG_L2MEAS_AVG_PRB_DL))
- {
- rgSchL2CalDlPrbCount(cell);
- }
- if(measCb->measReq.measType & LRG_L2MEAS_NMB_ACTV_UE_PER_QCI_DL)
- {
- sfDiff = RGSCH_CALC_SF_DIFF(cell->crntTime, measCb->startTime);
-
- if((sfDiff % measCb->measReq.nmbActvUeQciDl.sampPrd) == 0)
- {
- if (measCb->measReq.nmbActvUeQciDl.numQci)
- {
- for (idx = 0; idx < measCb->measReq.nmbActvUeQciDl.numQci;
- idx++)
- {
- qciVal = measCb->measReq.nmbActvUeQciDl.qci[idx];
- cell->qciArray[qciVal].dlTotal_UeCount +=
- cell->qciArray[qciVal].dlUeCount;
- }
- }
- else
- {
- for (qciVal = 1; qciVal < LRG_MAX_QCI_PER_REQ; qciVal++)
- {
- cell->qciArray[qciVal].dlTotal_UeCount +=
- cell->qciArray[qciVal].dlUeCount;
- }
- }
- }
- }
- if(measCb->measReq.measType & LRG_L2MEAS_NMB_ACTV_UE_PER_QCI_UL)
- {
- sfDiff = RGSCH_CALC_SF_DIFF(cell->crntTime , measCb->startTime);
- if((sfDiff % measCb->measReq.nmbActvUeQciUl.sampPrd) == 0)
- {
- if (measCb->measReq.nmbActvUeQciUl.numQci)
- {
- for (idx = 0; idx < measCb->measReq.nmbActvUeQciUl.numQci;
- idx++)
- {
- qciVal = measCb->measReq.nmbActvUeQciUl.qci[idx];
- cell->qciArray[qciVal].ulTotal_UeCount +=
- cell->qciArray[qciVal].ulUeCount;
- }
- }
- else
- {
- for (qciVal = 1; qciVal < LRG_MAX_QCI_PER_REQ; qciVal++)
- {
- cell->qciArray[qciVal].ulTotal_UeCount +=
- cell->qciArray[qciVal].ulUeCount;
- }
- }
- }
- }
- }
- }/* end of while */
- return ROK;
-} /* rgSCHL2MEas */
-#endif /* LTE_L2_MEAS */
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Layer Manager Interface Module
-
- File: rg_sch_lmm.c
-
-**********************************************************************/
-
-/** @file rg_sch_lmm.c
-@brief This file contains the Layer Management interface module implementation for scheduler.
- The functions for the configuration, control, status and statistics
- request primitives are defined here.
-*/
-
-
-/* header include files (.h) */
-#include "common_def.h"
-#include "rg_env.h" /* MAC Environment Defines */
-#include "rgr.h" /* RGR Interface defines */
-#include "tfu.h" /* RGU Interface defines */
-#include "lrg.h" /* LRG Interface defines */
-#include "rgm.h" /* RGM Interface defines */
-#include "rg_sch.h" /* Scheduler defines */
-#include "rg_sch_inf.h" /* Scheduler defines */
-#include "rg_sch_err.h" /* MAC error defines */
-#ifdef LTE_L2_MEAS
-#include "rg_sch_cmn.h" /* typedefs for Scheduler */
-#endif
-#include "sch_utils.h"
-/* header/extern include files (.x) */
-#include "rgr.x" /* RGR Interface includes */
-#include "rgm.x" /* RGM Interface includes */
-#include "tfu.x" /* RGU Interface includes */
-#include "lrg.x" /* LRG Interface includes */
-#include "rg_sch_inf.x" /* Scheduler defines */
-#include "rg_sch.x" /* Scheduler includes */
-#ifdef LTE_L2_MEAS
-#include "rg_sch_cmn.x" /* typedefs for Scheduler */
-#endif
-#ifndef LTE_L2_MEAS
-Void rgSCHCmnInit ARGS((Void));
-#endif
-/* forward references */
-extern int schActvInit(Ent entity, Inst instId, Region region, Reason reason);
-#ifdef UNUSE_FUN
-static uint16_t rgSCHLmmSapCfg ARGS((
- Inst inst,
- RgCfg *cfg,
- uint8_t sapIdx,
- Elmnt sapType
-));
-#endif
-static Void rgSCHLmmShutdown ARGS((
- Inst inst
-));
-
-
-void printSchCellInfo(void)
-{
- uint8_t idx=0;
- uint8_t inst=0;
- for (idx = 0; idx < rgSchCb[inst].numSaps; idx++)
- {
- /* Unbind all the TFU SAP */
- /* Free the memory held by the cell associated
- * with this SAP */
- if (rgSchCb[inst].tfuSap[idx].cell != NULLP)
- {
- DU_LOG("\nINFO --> SCH : CELL %d\n", idx);
- DU_LOG("\nINFO --> SCH : NUM UEs :%d\n",rgSchCb[inst].tfuSap[idx].cell->ueLst.nmbEnt);
- }
- }
-}
-
-/**
- * @brief SAP Configuration Handler.
- *
- * @details
- *
- * Function : rgSCHLmmSapCfg
- *
- * This function in called by SchProcGenCfgReq(). It handles the
- * interface SAP configuration of the scheduler instance. It
- * initializes the sapState to LRG_UNBND. Returns
- * reason for success/failure of this function.
- *
- * @param[in] RgCfg *cfg, the Configuaration information
- * @return uint16_t
- * -# LCM_REASON_GENCFG_NOT_DONE
- * -# LCM_REASON_INVALID_SAP
- * -# LCM_REASON_NOT_APPL
- **/
-#ifdef UNUSE_FUN
-static uint16_t rgSCHLmmSapCfg
-(
-Inst dInst,
-RgCfg *cfg, /* Configuaration information */
-uint8_t sapIdx, /* SAP index */
-Elmnt sapType /* SAP Type */
-)
-{
- uint16_t ret = LCM_REASON_NOT_APPL;
- RgSchLowSapCfgInfo *lowSapCfg = NULLP;
- RgSchUpSapCfgInfo *upSapCfg = NULLP;
- Inst inst = (dInst - SCH_INST_START);
-
- /* Check if Gen Config has been done */
-
- switch(sapType)
- {
- case STRGRSAP:
-#ifndef CL_MAC_LWLC
- if ((cfg->s.schInstCfg.rgrSap[sapIdx].selector != ODU_SELECTOR_TC) &&
- (cfg->s.schInstCfg.rgrSap[sapIdx].selector != ODU_SELECTOR_LC))
- {
- ret = LCM_REASON_INVALID_PAR_VAL;
- DU_LOG("\nERROR --> SCH : rgSCHLmmSapCfg(): unsupported"
- " Selector value for RGR.");
- break;
- }
-#endif
- if(rgSchCb[inst].rgrSap[sapIdx].sapSta.sapState == LRG_NOT_CFG)
- {
- rgSchCb[inst].rgrSap[sapIdx].sapSta.sapState = LRG_UNBND;
- }
- upSapCfg = &rgSchCb[inst].rgrSap[sapIdx].sapCfg;
-
- upSapCfg->sapPst.dstEnt = cfg->s.schInstCfg.rgrSap[sapIdx].ent;
- upSapCfg->sapPst.dstInst = cfg->s.schInstCfg.rgrSap[sapIdx].inst;
- upSapCfg->sapPst.dstProcId = cfg->s.schInstCfg.rgrSap[sapIdx].procId;
- upSapCfg->sapPst.srcEnt = rgSchCb[inst].rgSchInit.ent;
- upSapCfg->sapPst.srcInst = rgSchCb[inst].rgSchInit.inst +
- SCH_INST_START;
- upSapCfg->sapPst.srcProcId = rgSchCb[inst].rgSchInit.procId;
- upSapCfg->sapPst.region = cfg->s.schInstCfg.rgrSap[sapIdx].mem.region;
- upSapCfg->sapPst.pool = cfg->s.schInstCfg.rgrSap[sapIdx].mem.pool;
- upSapCfg->sapPst.selector = cfg->s.schInstCfg.rgrSap[sapIdx].selector;
- upSapCfg->sapPst.route = cfg->s.schInstCfg.rgrSap[sapIdx].route;
- upSapCfg->sapPst.intfVer = 0;
- upSapCfg->sapPst.event = 0;
- upSapCfg->sapPst.prior = cfg->s.schInstCfg.rgrSap[sapIdx].prior;
- upSapCfg->suId = cfg->s.schInstCfg.rgrSap[sapIdx].suId;
- upSapCfg->spId = cfg->s.schInstCfg.rgrSap[sapIdx].spId;
- break;
- case STTFUSAP:
-#ifndef CL_MAC_LWLC
- if ((cfg->s.schInstCfg.tfuSap[sapIdx].selector != ODU_SELECTOR_TC) &&
- (cfg->s.schInstCfg.tfuSap[sapIdx].selector != ODU_SELECTOR_LC))
- {
- ret = LCM_REASON_INVALID_PAR_VAL;
- DU_LOG("\nERROR --> SCH : rgSCHLmmSapCfg(): unsupported"
- " Selector value for TFU.");
- break;
- }
-#endif
- if (rgSchCb[inst].tfuSap[sapIdx].sapSta.sapState == LRG_NOT_CFG)
- {
- rgSchCb[inst].tfuSap[sapIdx].sapSta.sapState = LRG_UNBND;
- }
- /* Initialize the sap timer */
- cmInitTimers(&(rgSchCb[inst].tfuSap[sapIdx].tmrBlk), 1);
- lowSapCfg = &rgSchCb[inst].tfuSap[sapIdx].sapCfg;
-
- lowSapCfg->sapPst.dstEnt = cfg->s.schInstCfg.tfuSap[sapIdx].ent;
- lowSapCfg->sapPst.dstInst = cfg->s.schInstCfg.tfuSap[sapIdx].inst;
- lowSapCfg->sapPst.dstProcId = cfg->s.schInstCfg.tfuSap[sapIdx].procId;
- lowSapCfg->sapPst.srcEnt = rgSchCb[inst].rgSchInit.ent;
- lowSapCfg->sapPst.srcInst = rgSchCb[inst].rgSchInit.inst +
- SCH_INST_START;
- lowSapCfg->sapPst.srcProcId = rgSchCb[inst].rgSchInit.procId;
- lowSapCfg->sapPst.region = cfg->s.schInstCfg.tfuSap[sapIdx].mem.region;
- lowSapCfg->sapPst.pool = cfg->s.schInstCfg.tfuSap[sapIdx].mem.pool;
- lowSapCfg->sapPst.selector = cfg->s.schInstCfg.tfuSap[sapIdx].selector;
- lowSapCfg->sapPst.route = cfg->s.schInstCfg.tfuSap[sapIdx].route;
- lowSapCfg->sapPst.intfVer = 0;
- lowSapCfg->sapPst.event = 0;
- lowSapCfg->sapPst.prior = cfg->s.schInstCfg.tfuSap[sapIdx].prior;
- lowSapCfg->suId = cfg->s.schInstCfg.tfuSap[sapIdx].suId;
- lowSapCfg->spId = cfg->s.schInstCfg.tfuSap[sapIdx].spId;
- memcpy(&lowSapCfg->bndTmr,
- &cfg->s.schInstCfg.tfuSap[sapIdx].bndTmr,
- sizeof(TmrCfg));
- break;
- case STRGMSAP:
-#ifndef RGM_LWLC
- if ((cfg->s.schInstCfg.rgmSap[sapIdx].selector != RGM_SEL_LWLC) &&
- (cfg->s.schInstCfg.rgmSap[sapIdx].selector != RGM_SEL_LC) &&
- (cfg->s.schInstCfg.rgmSap[sapIdx].selector != RGM_SEL_TC))
- {
- ret = LCM_REASON_INVALID_PAR_VAL;
- DU_LOG("\nERROR --> SCH : rgSCHLmmSapCfg(): unsupported"
- " Selector value for RGM.");
- break;
- }
-#endif
- if (rgSchCb[inst].rgmSap[sapIdx].sapSta.sapState == LRG_NOT_CFG)
- {
- rgSchCb[inst].rgmSap[sapIdx].sapSta.sapState = LRG_UNBND;
- }
- upSapCfg = &rgSchCb[inst].rgmSap[sapIdx].sapCfg;
- upSapCfg->sapPst.dstEnt = cfg->s.schInstCfg.rgmSap[sapIdx].ent;
- upSapCfg->sapPst.dstInst = cfg->s.schInstCfg.rgmSap[sapIdx].inst;
- upSapCfg->sapPst.dstProcId = cfg->s.schInstCfg.rgmSap[sapIdx].procId;
- upSapCfg->sapPst.srcEnt = rgSchCb[inst].rgSchInit.ent;
- upSapCfg->sapPst.srcInst = rgSchCb[inst].rgSchInit.inst +
- SCH_INST_START;
- upSapCfg->sapPst.srcProcId = rgSchCb[inst].rgSchInit.procId;
- upSapCfg->sapPst.region = cfg->s.schInstCfg.rgmSap[sapIdx].mem.region;
- upSapCfg->sapPst.pool = cfg->s.schInstCfg.rgmSap[sapIdx].mem.pool;
- upSapCfg->sapPst.selector = cfg->s.schInstCfg.rgmSap[sapIdx].selector;
- upSapCfg->sapPst.route = cfg->s.schInstCfg.rgmSap[sapIdx].route;
- upSapCfg->sapPst.intfVer = 0;
- upSapCfg->sapPst.event = 0;
- upSapCfg->sapPst.prior = cfg->s.schInstCfg.rgmSap[sapIdx].prior;
- upSapCfg->suId = cfg->s.schInstCfg.rgmSap[sapIdx].suId;
- upSapCfg->spId = cfg->s.schInstCfg.rgmSap[sapIdx].spId;
-
- break;
- default:
- /* would never reach here */
- break;
- }
- return (ret);
-}
-#endif
-\f
-/***********************************************************
- *
- * Func : rgSCHLmmShutdown
- *
- *
- * Desc : Handles the scheduler instance shutdown request. Calls
- * rgSCHCfgFreeCellCb(RgSchCellCb*) to handle each cellCb deallocation.
- *
- *
- * Ret : Void
- *
- * Notes:
- *
- * File : rg_sch_lmm.c
- *
- **********************************************************/
-static Void rgSCHLmmShutdown(Inst inst)
-{
- Inst dInst = inst + SCH_INST_START;
- uint8_t idx;
-#ifdef LTE_L2_MEAS
- CmLList *lnk = NULLP;
- RgSchCb *instCb = &rgSchCb[inst];
- RgSchCellCb *cell = NULLP;
- RgSchL2MeasCb *measCb;
- uint8_t ulAllocIdx;
- RgSchCmnUlCell *cellUl;
- RgSchClcBoRpt *bo = NULL;
-#endif
-
-#ifdef LTE_L2_MEAS
- for (idx = 0; idx < instCb->numSaps; idx++)
- {
- /* got the cell break the loop */
- cell = instCb->rgrSap[idx].cell;
- if(cell != NULLP)
- {
- /* Free the memory held up by ulAllocInfo */
- cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
-#ifdef LTE_TDD
- for(ulAllocIdx = 0; ulAllocIdx < RGSCH_SF_ALLOC_SIZE; ulAllocIdx++)
-#else
- for(ulAllocIdx = 0; ulAllocIdx < RGSCH_NUM_SUB_FRAMES; ulAllocIdx++)
-#endif
- {
- if(cell->sfAllocArr[ulAllocIdx].ulUeInfo.ulAllocInfo != NULLP)
- {
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx,
- (Data **)(&(cell->sfAllocArr[ulAllocIdx].ulUeInfo.\
- ulAllocInfo)),
- cellUl->maxAllocPerUlSf * sizeof(RgInfUeUlAlloc));
- }
- }
- /* Free the memory allocated to measCb */
- lnk = cell->l2mList.first;
- while(lnk != NULLP)
- {
- measCb = (RgSchL2MeasCb *)lnk->node;
- cmLListDelFrm(&cell->l2mList, lnk);
- lnk = lnk->next;
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb,\
- sizeof(RgSchL2MeasCb));
- }
-
- /* Free mem if any present for boLst for common channels */
- for(idx = 0; idx < RGSCH_MAX_CMN_LC_CB; idx++)
- {
- lnk = (CmLList *)cell->cmnLcCb[idx].boLst.first;
- while (lnk)
- {
- bo = (RgSchClcBoRpt *)(lnk->node);
- lnk = lnk->next;
- cmLListDelFrm(&cell->cmnLcCb[idx].boLst, &bo->boLstEnt);
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&bo, sizeof(RgSchClcBoRpt));
- }
- }
- }
- }
-#endif
-
-#ifdef LTE_ADV
- rgSCHLaaDeInitEnbCb(&rgSchCb[inst]);
-#endif
- for (idx = 0; idx < rgSchCb[inst].numSaps; idx++)
- {
- /* Unbind all the TFU SAP */
- if(rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_WAIT_BNDCFM)
- {
- //rgSCHUtlTfuUBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg, LRG_UNBND);
- if (rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.enb == TRUE)
- {
- rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR, (PTR)&rgSchCb[inst].tfuSap[idx]);
- }
- rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_UNBND;
- }
- if(rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_BND)
- {
- //rgSCHUtlTfuUBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg, LRG_UNBND);
- rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_UNBND;
- }
- /* Free the memory held by the cell associated with this SAP */
- if (rgSchCb[inst].tfuSap[idx].cell != NULLP)
- rgSCHCfgFreeCellCb(rgSchCb[inst].tfuSap[idx].cell);
- rgSchCb[inst].tfuSap[idx].cell = NULLP;
- }
- /* Free the memory held by the scheduler instance */
- /* Deallocate RGR saps */
- SCH_FREE(rgSchCb[inst].rgrSap,
- (sizeof(RgSchUpSapCb) * rgSchCb[inst].numSaps));
- rgSchCb[inst].rgrSap = NULLP;
- /* Deallocate RGM saps */
- SCH_FREE(rgSchCb[inst].rgmSap,
- (sizeof(RgSchUpSapCb) * rgSchCb[inst].numSaps));
- rgSchCb[inst].rgmSap = NULLP;
-
- /* Deallocate TFU saps */
- SCH_FREE(rgSchCb[inst].tfuSap,
- (sizeof(RgSchLowSapCb) * rgSchCb[inst].numSaps));
- rgSchCb[inst].tfuSap = NULLP;
-
- /* Deallocate bndCfmResponses */
- SCH_FREE(rgSchCb[inst].genCfg.bndCfmResp,
- (sizeof(RgSchLmResponse) * rgSchCb[inst].numSaps));
- rgSchCb[inst].genCfg.bndCfmResp = NULLP;
- /* De-register the Timer Service */
- (Void) SDeregTmrMt(rgSchCb[inst].rgSchInit.ent, dInst,
- (S16)rgSchCb[inst].genCfg.tmrRes, schActvTmr);
-
- /* call back the task initialization function to intialize
- * the global rgSchCb[inst] Struct */
- schActvInit(rgSchCb[inst].rgSchInit.ent, dInst, rgSchCb[inst].rgSchInit.region,
- rgSchCb[inst].rgSchInit.reason);
-
- /* Set Config done in TskInit */
- rgSchCb[inst].rgSchInit.cfgDone = FALSE;
-
- return;
-}
-
-\f
-/***********************************************************
- *
- * Func : rgSCHLmmGenCntrl
- *
- *
- * Desc : Processes the LM control request for STGEN elmnt.
- *
- *
- * Ret : Void
- *
- * Notes:
- *
- * File : rg_sch_lmm.c
- *
- **********************************************************/
-Void rgSCHLmmGenCntrl(RgMngmt *cntrl,RgMngmt *cfm,Pst *cfmPst)
-{
- Inst inst = (cfmPst->srcInst - SCH_INST_START); /* Scheduler instance ID */
-
- 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 SAUSTA:
- /* Enable Unsolicited Status (alarms) */
- rgSchCb[inst].rgSchInit.usta = TRUE;
- /*Store the response and TransId for sending the Alarms */
- memcpy(&rgSchCb[inst].genCfg.ustaResp.response,
- &cntrl->hdr.response, sizeof(Resp));
- rgSchCb[inst].genCfg.ustaResp.transId = cntrl->hdr.transId;
- break;
- case SADBG:
- /* Enable Debug Printing */
-#ifdef DEBUGP
- rgSchCb[inst].rgSchInit.dbgMask |= cntrl->t.cntrl.s.rgDbgCntrl.dbgMask;
-#endif
- break;
-#ifdef PHY_ERROR_LOGING
- case SAELMNT:
- {
- rgSchUlAllocCntr.mcs = cntrl->t.cntrl.s.rgSchUlAllocCntrl.mcs;
- rgSchUlAllocCntr.numOfRb = cntrl->t.cntrl.s.rgSchUlAllocCntrl.numOfRb;
- rgSchUlAllocCntr.rbStart = cntrl->t.cntrl.s.rgSchUlAllocCntrl.rbStart;
- rgSchUlAllocCntr.testStart = cntrl->t.cntrl.s.rgSchUlAllocCntrl.testStart;
- rgSchUlAllocCntr.enaLog = cntrl->t.cntrl.s.rgSchUlAllocCntrl.enaLog;
- rgSchUlAllocCntr.logTime = cntrl->t.cntrl.s.rgSchUlAllocCntrl.logTime;
- rgSchUlAllocCntr.crcOk = 0;
- rgSchUlAllocCntr.crcErr = 0;
- rgSchUlAllocCntr.numUlPackets = 0;
- rgSchUlAllocCntr.numPrach = 0;
- rgSchUlAllocCntr.taZero = 0;
-#ifdef MAC_SCH_STATS
- /* Reset
- * L2
- * statistics
- * */
- memset(&hqRetxStats, 0, sizeof(RgSchHqRetxStats));
- memset(&hqFailStats, 0, sizeof(RgSchNackAckStats));
-#endif
- break;
- }
-#endif
- default:
- cfm->cfm.status = LCM_PRIM_NOK;
- cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
- DU_LOG("\nERROR --> SCH : rgSCHLmmGenCntrl(): "
- "invalid subaction=%d", cntrl->t.cntrl.subAction);
- break;
- }
- break;
- case ADISIMM:
- /* Action is Diable immidiately */
- switch(cntrl->t.cntrl.subAction)
- {
- case SAUSTA:
- /* Disable Unsolicited Status (alarms) */
- rgSchCb[inst].rgSchInit.usta = FALSE;
- break;
- case SADBG:
- /* Disable Debug Printing */
-#ifdef DEBUGP
- rgSchCb[inst].rgSchInit.dbgMask &=\
- ~cntrl->t.cntrl.s.rgDbgCntrl.dbgMask;
-#endif
- break;
-
- default:
- cfm->cfm.status = LCM_PRIM_NOK;
- cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
- DU_LOG("\nERROR --> SCH : rgSCHLmmGenCntrl():"
- " invalid subaction=%d", cntrl->t.cntrl.subAction);
- break;
- }
- break;
- case ASHUTDOWN:
- /* Free all the memory dynamically allocated by MAC */
- rgSCHLmmShutdown(inst);
- break;
- default:
- cfm->cfm.status = LCM_PRIM_NOK;
- cfm->cfm.reason = LCM_REASON_INVALID_PAR_VAL;
- DU_LOG("\nERROR --> SCH : rgSCHLmmGenCntrl(): invalid"
- " action=%d", cntrl->t.cntrl.action);
- break;
- }
- RgMiLrgSchCntrlCfm(cfmPst, cfm);
- return;
-}
-
-\f
-/***********************************************************
- *
- * Func : rgSCHLmmSapCntrl
- *
- *
- * Desc : Processes the LM control request for STxxxSAP elmnt.
- *
- *
- * Ret : Void
- *
- * Notes:
- *
- * File : rg_sch_lmm.c
- *
- **********************************************************/
-Void rgSCHLmmSapCntrl
-(
-RgMngmt *cntrl,
-RgMngmt *cfm,
-Pst *cfmPst
-)
-{
- uint8_t idx;
-
- /* TODO Pass InstId instead of using InstId from cfmPst */
- Inst inst = (cfmPst->srcInst - SCH_INST_START); /* Scheduler instance Id */
-
- /* Only TFU SAP can be controlled by LM */
- switch(cntrl->hdr.elmId.elmnt)
- {
- case STTFUSAP:
- idx = (uint8_t)cntrl->t.cntrl.s.rgSapCntrl.suId;
- if (idx > LRG_MAX_SAPS_PER_INST)
- {
- cfm->cfm.status = LCM_PRIM_NOK;
- cfm->cfm.reason = LCM_REASON_INVALID_SAP;
- }
- switch(cntrl->t.cntrl.action)
- {
- case ABND:
- /* Bind Enable Request */
- if ((rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_NOT_CFG) ||
- (rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_BND))
- {
- cfm->cfm.status = LCM_PRIM_NOK;
- cfm->cfm.reason = LCM_REASON_INVALID_SAP;
- }
- else
- {
- if (rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.enb == TRUE)
- {
- rgSCHLmmStartTmr(inst, RGSCH_BNDREQ_TMR,
- rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.val,
- (PTR)&rgSchCb[inst].tfuSap[idx]);
- }
- /* Change SAP state */
- rgSchCb[inst].tfuSap[idx].sapSta.sapState = LRG_WAIT_BNDCFM;
- rgSchCb[inst].tfuSap[idx].numBndRetries++;
- /* Store the response and TransId for sending
- * the Control confirm */
- memcpy(&rgSchCb[inst].genCfg.bndCfmResp[idx].response,
- &cntrl->hdr.response, sizeof(Resp));
- rgSchCb[inst].genCfg.bndCfmResp[idx].transId =
- cntrl->hdr.transId;
-
- cfm->cfm.status = LCM_PRIM_OK_NDONE;
- cfm->cfm.reason = LCM_REASON_NOT_APPL;
-
- /* Sending Control Confirm before sending Bind
- * Request to TFU */
- RgMiLrgSchCntrlCfm(cfmPst, cfm);
-
- //rgSCHUtlTfuBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg.suId,
- // rgSchCb[inst].tfuSap[idx].sapCfg.spId);
- return;
- }
- break;
- case AUBND:
- /* Unbind request */
-
- /* Check if the SAP is configured */
- if( (rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_NOT_CFG) ||
- (rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_UNBND))
- {
- cfm->cfm.status = LCM_PRIM_NOK;
- cfm->cfm.reason = LCM_REASON_INVALID_MSGTYPE;
- }
- else
- {
- //rgSCHUtlTfuUBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg,
- // TFU_UBNDREQ_MNGMT);
- if (rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.enb == TRUE)
- {
- rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR,
- (PTR)&rgSchCb[inst].tfuSap[idx]);
- }
- /* Change SAP state */
- rgSchCb[inst].tfuSap[idx].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 ((rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_WAIT_BNDCFM) ||
- (rgSchCb[inst].tfuSap[idx].sapSta.sapState == LRG_BND))
- {
- //rgSCHUtlTfuUBndReq(inst, rgSchCb[inst].tfuSap[idx].sapCfg,
- // TFU_UBNDREQ_MNGMT);
- if (rgSchCb[inst].tfuSap[idx].sapCfg.bndTmr.enb == TRUE)
- {
- rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR,
- (PTR)&rgSchCb[inst].tfuSap[idx]);
- }
- }
- memset(&rgSchCb[inst].tfuSap[idx], 0, sizeof(RgSchLowSapCb));
- rgSchCb[inst].tfuSap[idx].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;
- DU_LOG("\nERROR --> SCH : rgSCHLmmSapCntrl(): "
- "invalid action=%d", cntrl->t.cntrl.action);
- break;
- }
- break;
- case STRGRSAP:
- idx = (uint8_t)cntrl->t.cntrl.s.rgSapCntrl.spId;
- if (idx > LRG_MAX_SAPS_PER_INST)
- {
- cfm->cfm.status = LCM_PRIM_NOK;
- cfm->cfm.reason = LCM_REASON_INVALID_SAP;
- }
- switch(cntrl->t.cntrl.action)
- {
- case ADEL:
- memset(&rgSchCb[inst].rgrSap[idx], 0, sizeof(RgSchUpSapCb));
- rgSchCb[inst].rgrSap[idx].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;
- DU_LOG("\nERROR --> SCH : rgSCHLmmSapCntrl(): "
- "invalid action=%d", cntrl->t.cntrl.action);
- break;
- }
- break;
- case STRGMSAP:
- idx = (uint8_t)cntrl->t.cntrl.s.rgSapCntrl.spId;
- if (idx > LRG_MAX_SAPS_PER_INST)
- {
- cfm->cfm.status = LCM_PRIM_NOK;
- cfm->cfm.reason = LCM_REASON_INVALID_SAP;
- }
- switch(cntrl->t.cntrl.action)
- {
- case ADEL:
- memset(&rgSchCb[inst].rgmSap[idx], 0, sizeof(RgSchUpSapCb));
- rgSchCb[inst].rgmSap[idx].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;
- DU_LOG("\nERROR --> SCH : rgSCHLmmSapCntrl(): "
- "invalid action=%d", cntrl->t.cntrl.action);
- break;
- }
- break;
-
- default:
- /* Would never come here. */
- return;
- }
- RgMiLrgSchCntrlCfm(cfmPst, cfm);
- return;
-}
-
-\f
-/***********************************************************
- *
- * Func : SchFillCfmPst
- *
- *
- * Desc : Fills the Confirmation Post Structure cfmPst using the reqPst
- * and the cfm->hdr.response.
- *
- *
- * Ret : Void
- *
- * Notes:
- *
- * File : rg_sch_lmm.c
- *
- **********************************************************/
-Void SchFillCfmPst
-(
-Pst *reqPst,
-Pst *cfmPst,
-RgMngmt *cfm
-)
-{
- Inst inst;
-
- inst = (reqPst->dstInst - SCH_INST_START);
-
- cfmPst->srcEnt = ENTMAC;
- cfmPst->srcInst = (Inst) 1;
- cfmPst->srcProcId = rgSchCb[inst].rgSchInit.procId;
- cfmPst->dstEnt = ENTMAC;
- cfmPst->dstInst = (Inst) 0;
- cfmPst->dstProcId = reqPst->srcProcId;
-
- cfmPst->selector = cfm->hdr.response.selector;
- cfmPst->region = cfm->hdr.response.mem.region;
- cfmPst->pool = cfm->hdr.response.mem.pool;
-
- return;
-}
-
-\f
-/**
- * @brief Timer start handler.
- *
- * @details
- *
- * Function : rgSCHLmmStartTmr
- *
- * This function based on the input parameters starts the timer for
- * "tmrVal" duration. As of now scheduler instance uses the timer
- * functionality for BndReq only. Hence there is no conditional
- * code based on "tmrEvnt".
- *
- * @param[in] S16 tmrEvnt, the Timer Event
- * @param[in] uint32_t tmrVal, the Wait Time
- * @param[in] PTR cb, Entry for which Timer expired
- * @return S16
- * -# ROK
- **/
-S16 rgSCHLmmStartTmr
-(
-Inst inst,
-S16 tmrEvnt, /* Timer Event */
-uint32_t tmrVal, /* Wait Time */
-PTR cb /* Entry for which Timer Expired */
-)
-{
- CmTmrArg arg;
-/* Inst dInst = inst + SCH_INST_START; */
-
- UNUSED(tmrEvnt);
-
- /* Initialize the arg structure */
- memset(&arg, 0, sizeof(CmTmrArg));
-
- arg.tqCp = &rgSchCb[inst].tmrTqCp;
- arg.tq = rgSchCb[inst].tmrTq;
- arg.timers = &((RgSchLowSapCb *)cb)->tmrBlk;
- arg.cb = cb;
- arg.tNum = 0;
- arg.max = RGSCH_MAX_TIMER;
- arg.evnt = RGSCH_BNDREQ_TMR;
- arg.wait = tmrVal;
- cmPlcCbTq(&arg);
-
- return ROK;
-}
-
-\f
-/**
- * @brief Timer stop handler.
- *
- * @details
- *
- * Function : rgSCHLmmStopTmr
- *
- * This function based on the input parameters stops the timer for
- * "tmrEvnt". As of now Scheduler instance uses the timer functionality for
- * BndReq only. Hence there is no conditional code based on "tmrEvnt".
- * Once the bind happens and this timer is stopped, the timer functionality
- * is deregistered with SSI. As there is no further use of timer processing.
- *
- * @param[in] S16 tmrEvnt, the Timer Event
- * @param[in] PTR cb, Entry for which Timer expired
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHLmmStopTmr
-(
-Inst inst, /* Scheduler instance */
-S16 tmrEvnt, /* Timer Event */
-PTR cb /* Entry for which Timer Expired */
-)
-{
- CmTmrArg arg;
- uint8_t i;
- S16 ret;
-
- ret = RFAILED;
-
- for(i=0;i<RGSCH_MAX_TIMER;i++)
- {
- /* Search for the Timer Blocks */
- if(((RgSchLowSapCb *)cb)->tmrBlk.tmrEvnt == tmrEvnt)
- {
- /* Initialize the arg structure */
- memset(&arg, 0, sizeof(CmTmrArg));
-
- arg.tqCp = &rgSchCb[inst].tmrTqCp;
- arg.tq = rgSchCb[inst].tmrTq;
- arg.timers = &(((RgSchLowSapCb *)cb)->tmrBlk);
- arg.cb = cb;
- arg.max = RGSCH_MAX_TIMER;
- arg.evnt = tmrEvnt;
-
- arg.tNum = i;
- cmRmvCbTq(&arg);
- ret = ROK;
- break;
- }
-
- }
-
-
- return (ret);
-}
-
-\f
-/**
- * @brief Timer Expiry handler.
- *
- * @details
- *
- * Function : rgSCHLmmTmrExpiry
- *
- * This is a callback function used as an input parameter to cmPrcTmr()
- * to check expiry of any timer. In this function, we are only concerned
- * about tmrEvnt=Bind timer.
- *
- * @param[in] PTR cb, Entry for which Timer expired
- * @param[in] S16 tmrEvnt, the Timer Event
- * @return S16
- * -# ROK
- **/
-S16 rgSCHLmmTmrExpiry
-(
-PTR cb, /* Pointer to timer control block */
-S16 tmrEvnt /* Timer Event */
-)
-{
- S16 ret = ROK;
- RgSchLowSapCb *tfuSap = (RgSchLowSapCb *)cb;
-
-
- switch(tmrEvnt)
- {
- case RGSCH_BNDREQ_TMR:
- tfuSap->numBndRetries++;
- if(tfuSap->numBndRetries > RGSCH_MAX_BNDRETRY)
- {
- rgSCHLmmStaInd((uint8_t)(tfuSap->sapCfg.sapPst.srcInst - SCH_INST_START),
- (uint16_t)LCM_CATEGORY_INTERFACE, (uint16_t)LCM_EVENT_BND_FAIL,
- (uint16_t)LCM_CAUSE_TMR_EXPIRED, (RgUstaDgn *)NULLP);
- }
- else
- {
- /* Restart the bind timer */
- if (tfuSap->sapCfg.bndTmr.enb == TRUE)
- {
- ret = rgSCHLmmStartTmr((uint8_t)(tfuSap->sapCfg.sapPst.srcInst - SCH_INST_START),
- RGSCH_BNDREQ_TMR,
- (uint32_t)tfuSap->sapCfg.bndTmr.val, cb);
- }
-
- /* Send bind request */
- //rgSCHUtlTfuBndReq((uint8_t)(tfuSap->sapCfg.sapPst.srcInst - SCH_INST_START),
- //tfuSap->sapCfg.suId, tfuSap->sapCfg.spId);
- }
- break;
- default:
- DU_LOG("\nERROR --> SCH : rgSCHLmmTmrExpiry(): Invalid"
- " tmrEvnt=%d", tmrEvnt);
- ret = RFAILED;
- break;
- }
- return (ret);
-}
-
-\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 : rgSCHLmmBndCfm
- *
- * 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] uint8_t status, Status
- * @return S16
- * -# ROK
- **/
-S16 rgSCHLmmBndCfm
-(
-Pst *pst, /* Post Structure */
-SuId suId, /* Service user ID */
-uint8_t status /* Status */
-)
-{
- S16 ret = ROK;
- RgMngmt cntrlCfm;
- Pst cfmPst;
- Inst inst = (pst->dstInst - SCH_INST_START); /* scheduler instance */
-
-
- /* check the SAP State */
- switch(rgSchCb[inst].tfuSap[suId].sapSta.sapState)
- {
- case LRG_WAIT_BNDCFM:
- break;
- case LRG_BND:
- /* SAP is already bound */
- return ROK;
- default:
- return RFAILED;
- }
-
- cfmPst = rgSchCb[inst].rgSchInit.lmPst;
- cfmPst.selector = rgSchCb[inst].genCfg.bndCfmResp[suId].response.selector;
- cfmPst.prior = rgSchCb[inst].genCfg.bndCfmResp[suId].response.prior;
- cfmPst.route = rgSchCb[inst].genCfg.bndCfmResp[suId].response.route;
- cfmPst.region = rgSchCb[inst].genCfg.bndCfmResp[suId].response.mem.region;
- cfmPst.pool = rgSchCb[inst].genCfg.bndCfmResp[suId].response.mem.pool;
-
- memset(&cntrlCfm, 0, sizeof(RgMngmt));
-
- switch(status)
- {
- case CM_BND_OK: /* status is OK */
- /* Change SAP state to Bound */
- rgSchCb[inst].tfuSap[suId].sapSta.sapState = LRG_BND;
- if (rgSchCb[inst].tfuSap[suId].sapCfg.bndTmr.enb == TRUE)
- {
- ret = rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR, (PTR)&rgSchCb[inst].tfuSap[suId]);
- }
- /* Send Control Confirm with status as OK to Layer Manager */
- cntrlCfm.cfm.status = LCM_PRIM_OK;
- cntrlCfm.cfm.reason = LCM_REASON_NOT_APPL;
- /* Sending Status Indication to Layer Manager */
- rgSCHLmmStaInd((uint8_t)(rgSchCb[inst].tfuSap->sapCfg.sapPst.srcInst - SCH_INST_START),
- LCM_CATEGORY_INTERFACE, LCM_EVENT_BND_OK,
- LCM_CAUSE_LYR_SPECIFIC, (RgUstaDgn *)NULLP);
- break;
-
- default:
- /* Change SAP state to UnBound */
- rgSchCb[inst].tfuSap[suId].sapSta.sapState = LRG_UNBND;
- if (rgSchCb[inst].tfuSap[suId].sapCfg.bndTmr.enb == TRUE)
- {
- ret = rgSCHLmmStopTmr(inst, RGSCH_BNDREQ_TMR, (PTR)&rgSchCb[inst].tfuSap[suId]);
- }
- /* Send Control Confirm with status as NOK to Layer Manager */
- cntrlCfm.cfm.status = LCM_PRIM_NOK;
- cntrlCfm.cfm.reason = LCM_REASON_NEG_CFM;
- break;
- }
- rgSchCb[inst].tfuSap[suId].numBndRetries = 0;
- cntrlCfm.hdr.elmId.elmnt = STTFUSAP;
- cntrlCfm.hdr.transId = rgSchCb[inst].genCfg.bndCfmResp[suId].transId;
-
- ret = RgMiLrgSchCntrlCfm(&cfmPst, &cntrlCfm);
-
- return (ret);
-}
-
-/**
- * @brief Layer Manager Unsolicited Status Indication generation.
- *
- * @details
- *
- * Function : rgSCHLmmStaInd
- *
- * This API is used by the other modules of MAC to send a unsolicited
- * status indication to the Layer Manager.
- *
- * @param[in] uint16_t category, the Alarm category
- * @param[in] uint16_t event, the Alarm event
- * @param[in] uint16_t cause, the cause of the Alarm
- * @param[in] RgUstaDgn *dgn, Alarm Diagonostics
- * @return S16
- * -# ROK
- **/
-S16 rgSCHLmmStaInd
-(
-Inst inst,
-uint16_t category,
-uint16_t event,
-uint16_t cause,
-RgUstaDgn *dgn
-)
-{
- RgMngmt usta;
-
- if(rgSchCb[inst].rgSchInit.usta == FALSE)
- {
- return ROK;
- }
- memset(&usta, 0, sizeof(RgMngmt));
-
- SGetDateTime(&usta.t.usta.cmAlarm.dt);
- usta.t.usta.cmAlarm.category = category;
- usta.t.usta.cmAlarm.event = event;
- usta.t.usta.cmAlarm.cause = cause;
- if (dgn != NULLP)
- {
- memcpy(&usta.t.usta.dgn, dgn, sizeof(RgUstaDgn));
- }
-
- rgSchCb[inst].rgSchInit.lmPst.selector =
- rgSchCb[inst].genCfg.ustaResp.response.selector;
- rgSchCb[inst].rgSchInit.lmPst.prior =
- rgSchCb[inst].genCfg.ustaResp.response.prior;
- rgSchCb[inst].rgSchInit.lmPst.route =
- rgSchCb[inst].genCfg.ustaResp.response.route;
- rgSchCb[inst].rgSchInit.lmPst.region =
- rgSchCb[inst].genCfg.ustaResp.response.mem.region;
- rgSchCb[inst].rgSchInit.lmPst.pool =
- rgSchCb[inst].genCfg.ustaResp.response.mem.pool;
- usta.hdr.transId = rgSchCb[inst].genCfg.ustaResp.transId;
-
- return (RgMiLrgSchStaInd(&rgSchCb[inst].rgSchInit.lmPst, &usta));
-}
-
-\f
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Scheduler common functions
-
- File: rg_sch_mga.c
-
-**********************************************************************/
-
-/** @file rg_sch_mga.c
-@brief This module handles schedulers' measurement gap and ack-nack repetiton functionality */
-
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "lrg.h"
-#include "rgr.h"
-#include "tfu.h"
-#include "rg_env.h"
-#include "rg_sch_inf.h"
-#include "rg_sch_err.h"
-#include "rg_sch.h"
-#include "rg_sch_cmn.h"
-
-/* header/extern include files (.x) */
-#include "tfu.x" /* RGU types */
-#include "lrg.x" /* layer management typedefs for MAC */
-#include "rgr.x" /* layer management typedefs for MAC */
-#include "rg_sch_inf.x" /* typedefs for Scheduler */
-#include "rg_sch.x" /* typedefs for Scheduler */
-
-/* local defines */
-static S16 rgSCHMeasGapANRepUtlAddUe ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeMeasGapCfg *cfg));
-
-static S16 rgSCHMeasGapANRepUtlRmvUe ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue));
-
-static S16 rgSchAckNackRepUtlRmvUe ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue));
-
-static Void rgSchAckNackRepUtlHdlTti ARGS((
-RgSchCellCb *cell,
-CmLListCp *ackNackRepQ));
-
-static Void rgSCHMeasGapANRepUtlHdlTti ARGS((
-RgSchCellCb *cell,
-CmLListCp *measGapQ));
-#ifdef LTE_TDD
-static uint8_t rgSCHAckNakRepFindUlDuration ARGS((
-RgSchCellCb *cell,
-RgSchDlSf *dlSf,
-CmLteTimingInfo repTime,
-uint8_t repCnt));
-static Void rgSCHAckNakRepGetUlOffsetFrmDl ARGS((
-RgSchDlSf *dlSf,
-CmLteTimingInfo crntDlTime,
-uint8_t *noSubfrms));
-#endif
-
-/**
- * @brief Handles Measurement gap and ack-nack repetition related
- * configuration for a UE.
- *
- * @details
- *
- * Function : rgSCHMeasGapANRepUeCfg
- *
- * Invoking Module Processing:
- * - This shall be invoked by SCH_GOM at UE configuration. It shall do the
- * validations for the spec-defined values.
- *
- * Processing Steps:
- * - For UE-specific measurement gap related configuration,
- * - If measurementGap is configured,
- * - Update UE with the configured values.
- * - Add Ue to cell->measGapCb->gapPrdQ depending on the gap period
- * configuration at index = the configured gap offset.
- * - measGapOffst = the configured gap offset
- * - Initialize timers.
- * - else
- * - measGapOffst = RG_INVALID_MEASGAPQ_ID
- * - For UE-specific ACK-NACK repetition related configuration,
- * - Update the configured value. Set 'cfgRepCnt' variable value.
- * - repCntr = cfgRepCnt.
- * - qOffst = RG_INVALID_ACKNACKREPQ_ID
- * - Return ROK
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrUeCfg *ueCfg
- *
- * @return S16
- * -# ROK
- **/
-
-S16 rgSCHMeasGapANRepUeCfg(RgSchCellCb *cell,RgSchUeCb *ue,RgrUeCfg *ueCfg)
-{
-
- ue->measGapCb.isMesGapEnabled = ueCfg->ueMesGapCfg.isMesGapEnabled;
-
- if (ueCfg->ueMesGapCfg.isMesGapEnabled)
- {
- ue->measGapCb.gapPrd = ueCfg->ueMesGapCfg.gapPrd;
- ue->measGapCb.gapOffst = ueCfg->ueMesGapCfg.gapOffst;
- rgSCHMeasGapANRepUtlAddUe (cell, ue, &(ueCfg->ueMesGapCfg));
- cmInitTimers (&ue->measGapCb.measGapTmr, 1);
- cmInitTimers (&ue->measGapCb.measGapUlInactvTmr, 1);
- cmInitTimers (&ue->measGapCb.measGapDlInactvTmr, 1);
- }
-
- /* ACK NACK repetition part */
- if (ueCfg->ueAckNackCfg.isAckNackEnabled)
- {
- ue->ackNakRepCb.cfgRepCnt = ueCfg->ueAckNackCfg.ackNackRepFactor;
- ue->ackNakRepCb.repCntr = ue->ackNakRepCb.cfgRepCnt;
- ue->ackNakRepCb.isAckNackEnabled = TRUE;
- ue->ackNakRepCb.pucchRes = ueCfg->ueAckNackCfg.pucchAckNackRep;
- cmInitTimers (&ue->ackNakRepCb.ackNakRepUlInactvTmr, 1);
- cmInitTimers (&ue->ackNakRepCb.ackNakRepDlInactvTmr, 1);
- cmInitTimers (&ue->ackNakRepCb.ackNakRepTmr, 1);
- }
- return ROK;
-}
-
-/**
- * @brief Handles Measurement gap and ack-nack repetition related
- * re-configuration for a UE.
- *
- * @details
- *
- * Function : rgSCHMeasGapANRepUeRecfg
- *
- * Invoking Module Processing:
- * - This shall be invoked by SCH_GOM at UE re-configuration. It shall do the
- * validations for the spec-defined values.
- *
- * Processing Steps:
- * - For measurement gap,
- * - If measurement gap period or offset is re-configured, remove UE from
- * the previous list, if any and add it to the new list.
- * - Update configured values appropriately.
- * - For ACK-NACK repetition,
- * - Update the configured value. Set 'cfgRepCnt' variable value.
- * - If (repCntr == 0)
- * - repCntr = cfgRepCnt.
- * - qOffst = RG_INVALID_ACKNACKREPQ_ID
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrUeRecfg *ueRecfg
- *
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-
-S16 rgSCHMeasGapANRepUeRecfg(RgSchCellCb *cell,RgSchUeCb *ue,RgrUeRecfg *ueRecfg)
-{
- RgrUeMeasGapCfg *reCfg;
- RgSchUeMeasGapCb *ueMeasCb;
- RgrUeAckNackRepCfg *ackNackReCfg = &(ueRecfg->ueAckNackRecfg);
- RgSchUeAckNakRepCb *ackNakRepCb = &(ue->ackNakRepCb);
-
- reCfg = &(ueRecfg->ueMeasGapRecfg);
- ueMeasCb = &(ue->measGapCb);
-
- /* Removed extra comments
- * Check this once again Check to see if anything changed or not */
- if ((reCfg->isMesGapEnabled == TRUE) &&
- (ueMeasCb->isMesGapEnabled == TRUE) &&
- (reCfg->gapPrd == ueMeasCb->gapPrd) &&
- (reCfg->gapOffst == ueMeasCb->gapOffst))
- {
- /* Nothing changed hence nothing to do */
- }
- else
- {
- if (reCfg->isMesGapEnabled)
- {
- if (ueMeasCb->isMesGapEnabled)
- {
- rgSCHMeasGapANRepUtlRmvUe (cell, ue);
- }
- else
- {
- cmInitTimers (&ueMeasCb->measGapTmr, 1);
- cmInitTimers (&ueMeasCb->measGapUlInactvTmr, 1);
- cmInitTimers (&ueMeasCb->measGapDlInactvTmr, 1);
- }
-
- /* Add to the correct Measurement gap queue */
- rgSCHMeasGapANRepUtlAddUe (cell, ue, reCfg);
-
- ueMeasCb->gapPrd = reCfg->gapPrd;
- ueMeasCb->gapOffst = reCfg->gapOffst;
- ueMeasCb->isMesGapEnabled = TRUE;
- } /* if new config has Measurement gap enabled */
- else
- {
- if (ueMeasCb->isMesGapEnabled)
- {
- /* check if return value needed or not */
- rgSCHMeasGapANRepUtlRmvUe (cell, ue);
- ueMeasCb->isMesGapEnabled = FALSE;
- }
- } /* if new config has Measurement gap disabled */
- } /* For MeasGap configuration */
-
- if (ackNackReCfg->isAckNackEnabled)
- {
- if (!ackNakRepCb->isAckNackEnabled)
- {
- ackNakRepCb->isAckNackEnabled = TRUE;
- /* Timers need to be init immediately after config*/
- cmInitTimers (&ue->ackNakRepCb.ackNakRepUlInactvTmr, 1);
- cmInitTimers (&ue->ackNakRepCb.ackNakRepDlInactvTmr, 1);
- cmInitTimers (&ue->ackNakRepCb.ackNakRepTmr, 1);
- } /* repetition was disabled */
- ackNakRepCb->pucchRes = ackNackReCfg->pucchAckNackRep;
- ackNakRepCb->cfgRepCnt = ackNackReCfg->ackNackRepFactor;
- if (ackNakRepCb->repCntr == 0)
- {
- ackNakRepCb->repCntr = ackNackReCfg->ackNackRepFactor;
- }
- } /* repetition enabled in re configuration */
- else
- {
- ackNakRepCb->isAckNackEnabled = FALSE;
- } /* repetition disabled in re configuration */
-
- return ROK;
-}
-
- /** @brief This function is a utility to add the UE to the correct Measurement
- * queue present in the cellCb.
- *
- * @details
- *
- * Function:
- *
- * Processing steps:
- * -
- *
- *
- * @param
- * @param
- * @return
- */
-static S16 rgSCHMeasGapANRepUtlAddUe(RgSchCellCb *cell,RgSchUeCb *ue,RgrUeMeasGapCfg *cfg)
-{
-
- switch (cfg->gapPrd)
- {
- case RG_MEAS_GAPPRD_40:
- /* Insert the UE into the linked list based on the gap Offset */
- ue->measGapCb.measQLnk.node = (PTR)ue;
- cmLListAdd2Tail (&(cell->measGapCb.gapPrd40Q[cfg->gapOffst]),
- &(ue->measGapCb.measQLnk));
- break;
- case RG_MEAS_GAPPRD_80:
- ue->measGapCb.measQLnk.node = (PTR)ue;
- cmLListAdd2Tail (&(cell->measGapCb.gapPrd80Q[cfg->gapOffst]),
- &(ue->measGapCb.measQLnk));
- break;
- default:
- DU_LOG("\nERROR --> SCH : rgSCHMeasGapANRepUeRecfg() Incorrect GAP Period"
- "CRNTI:%d",ue->ueId);
- return RFAILED;
- }
- return ROK;
-} /* end of rgSCHMeasGapANRepUtlAddUe */
-
-
- /** @brief This function is a utility function to remove the ue from the measQ
- * preset in tthe cell Cb.
- *
- * @details
- *
- * Function:
- *
- * Processing steps:
- * -
- *
- * @param
- * @param
- * @return
- */
-static S16 rgSCHMeasGapANRepUtlRmvUe(RgSchCellCb *cell,RgSchUeCb *ue)
-{
-
- switch (ue->measGapCb.gapPrd)
- {
- case RG_MEAS_GAPPRD_40:
- /* Remove from the existing list */
- cmLListDelFrm (&(cell->measGapCb.gapPrd40Q[ue->measGapCb.gapOffst]),
- &(ue->measGapCb.measQLnk));
- ue->measGapCb.measQLnk.node = NULLP;
- break;
- case RG_MEAS_GAPPRD_80:
- /* Remove from the existing list */
- cmLListDelFrm (&(cell->measGapCb.gapPrd80Q[ue->measGapCb.gapOffst]),
- &(ue->measGapCb.measQLnk));
- ue->measGapCb.measQLnk.node = NULLP;
- break;
- }
- return ROK;
-} /* end of rgSCHMeasGapANRepUtlRmvUe */
-
-/**
- * @brief Frees Measurement gap and ack-nack repetition related data structures in UE
- *
- * @details
- *
- * Function : rgSCHMeasGapANRepUeDel
- *
- * Invoking Module Processing:
- * - This shall be invoked by SCH_GOM at Ue deletion.
- *
- * Processing Steps:
- * - For measurement gap,
- * - if (measGapOffst != RG_INVALID_MEASGAPQ_ID)
- * - Remove from the measurement queue depending on the measGapPrd
- * value.
- * - Delete all timers
- * - For ACK-NACK repetition,
- * - if (qOffst != RG_INVALID_ACKNACKREPQ_ID)
- * - Remove from the ackNakRepQ queue
- * - Delete all timers
- * - Return ROK
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- *
- * @return S16
- * -# ROK
- **/
-
-Void rgSCHMeasGapANRepUeDel(RgSchCellCb *cell,RgSchUeCb *ue,Bool isUeDel)
-{
-
- if (ue->measGapCb.isMesGapEnabled)
- {
- rgSCHMeasGapANRepUtlRmvUe (cell, ue);
- /* Must stop the timer if its running */
- if (ue->measGapCb.isMeasuring)
- {
- rgSCHTmrStopTmr (cell, RG_SCH_TMR_MEASGAP, ue);
- }
-
- ue->measGapCb.isMesGapEnabled = FALSE;
- }
-
- /* Stop timers if running */
- if (ue->dl.dlInactvMask)
- {
- if (ue->dl.dlInactvMask & RG_MEASGAP_INACTIVE)
- {
- rgSCHTmrStopTmr (cell, RG_SCH_TMR_DL_MEASGAP, ue);
- }
- if (ue->dl.dlInactvMask & RG_ACKNAKREP_INACTIVE)
- {
- rgSCHTmrStopTmr (cell, RG_SCH_TMR_DL_ACKNACK, ue);
- }
- ue->dl.dlInactvLnk.node = NULLP;
- }
- if (ue->ul.ulInactvMask)
- {
- if (ue->ul.ulInactvMask & RG_MEASGAP_INACTIVE)
- {
- rgSCHTmrStopTmr (cell, RG_SCH_TMR_UL_MEASGAP, ue);
- }
- if (ue->ul.ulInactvMask & RG_ACKNAKREP_INACTIVE)
- {
- rgSCHTmrStopTmr (cell, RG_SCH_TMR_UL_ACKNACK, ue);
- }
- ue->ul.ulInactvLnk.node = NULLP;
- }
-
- /* ccpu00133470- Releasing ACKNACK Rep UE Deleted */
- if (isUeDel & ue->ackNakRepCb.isAckNakRep)
- {
- rgSCHTmrStopTmr (cell, RG_SCH_TMR_ACKNACK_REP, ue);
- rgSchAckNackRepUtlRmvUe (cell, ue);
- }
- return;
-}
-
- /** @brief This function deletes the UEs information related to ACK NACK
- * repetition.
- *
- * @details
- *
- * Function:
- *
- * Processing steps:
- * - Mainly we need to remove the UEs hqProcs from the ackNackQ(s)
- * present in the subframes.
- *
- *
- * @param
- * @param
- * @return
- */
-static S16 rgSchAckNackRepUtlRmvUe(RgSchCellCb *cell,RgSchUeCb *ue)
-{
-
-
- uint8_t hqIdx;
- uint8_t repIdx;
- RgSchDlHqProcCb *hqP;
- uint8_t tbCnt;
-
- RgSchDlHqEnt *hqEnt = RG_SCH_CMN_GET_UE_HQE(ue, cell);
-
- for (hqIdx = 0; hqIdx < hqEnt->numHqPrcs; hqIdx++)
- {
- hqP = &hqEnt->procs[hqIdx];
- /* Starting from index 1 as index 0 isn't used */
- for (repIdx = 1; repIdx < ue->ackNakRepCb.cfgRepCnt; repIdx++)
- {
- for (tbCnt = 0; tbCnt < 2; tbCnt++)
- {
- if ((hqP->tbInfo[tbCnt].crntSubfrm[repIdx] != NULLP) &&
- (hqP->tbInfo[tbCnt].anRepLnk[repIdx].node != NULLP))
- {
- cmLListDelFrm(&((hqP->tbInfo[tbCnt].crntSubfrm[repIdx])->\
- ackNakRepQ), &hqP->tbInfo[tbCnt].anRepLnk[repIdx]);
- hqP->tbInfo[tbCnt].anRepLnk[repIdx].node = NULLP;
- hqP->tbInfo[tbCnt].crntSubfrm[repIdx] = NULLP;
- }
- }
- }
- }
-
- return ROK;
-} /* end of */
-
-
-/**
- * @brief Per TTI processing for measurement gap and ack nack repetition
- * handling.
- *
- * @details
- *
- * Function : rgSCHMeasGapANRepTtiHndl
- *
- * Invoking Module Processing:
- * - This shall be invoked by SCH_TOM on recieving TTI indication from PHY
- * . SCH_TOM shall update the cell->crntTime before invoking this API.
- *
- * Processing Steps:
- * - Compute qOffset for 40ms queue as =
- * ((cell->crntTime->sfn * 10)+cell->crntTime->subframe)%RG_MEAS_GAPPRD_40.
- * - Mark all the UEs at computed offset for performing measurement. Set
- * isMeasuring = TRUE.
- * - Start measGapTmr for each UE:
- * - length = RG_MEAS_GAP_LEN.
- * - event = RG_MEASGAP_ON
- * - handler = rgSCHMeasGapANRepTmrExpry
- * - Reinitalize the list at the offset.
- * - Compute qOffset for 80ms queue as =
- * ((cell->crntTime->sfn * 10)+cell->crntTime->subframe)%RG_MEAS_GAPPRD_80.
- * - Mark all the UEs at computed offset for performing measurement. Set
- * isMeasuring = TRUE.
- * - Start measGapTmr for each UE:
- * - length = RG_MEAS_GAP_LEN.
- * - event = RG_MEASGAP_ON
- * - handler = rgSCHMeasGapANRepTmrExpry
- * - Reinitalize the list at the offset.
- * - Compute qOffset for ACK NACK repetition queue as =
- * ((cell->crntTime->sfn * 10)+cell->crntTime->subframe)%RG_MAX_NUM_DLSF.
- * - Mark all the UEs at computed offset for performing ack-nack repetition. Set
- * isAckNakRep = TRUE.
- * - Start ackNakRepTmr for each UE:
- * - length = repCntr.
- * - event = RG_ACKNAKREP_ON
- * - handler = rgSchAckNakRepTmrExpry
- * - Reinitalize the list at the offset.
- * - 'isMeasuring' bool value shall be cheked
- * - While sending dataRecpReq to PHY for non-adaptive uplink re-tx
- * and if 'TRUE', no dataRecpReq shall be sent.
- * - While sending NACK as feedback to UE and if 'TRUE' no PHICH shall
- * be sent and shall mark the UE for adaptive re-tx.
- * - While sending HqFbkRecpReq for a UE (applicable only if ACK NACK
- * repetition coincides) and if 'TRUE',
- * - The request shall not be sent.
- * - Decrement repCntr
- * - if (repCntr == 0)
- * - Delete UE from the list.
- * - Move the Ue to next subframe's list of ACK-NACK repeating UEs.
- * - 'isAckNakRep' bool value shall be cheked
- * - While sending dataRecpReq to PHY for non-adaptive uplink re-tx
- * and if 'TRUE', no dataRecpReq shall be sent.
- * - Check if any refresh for these cell-specific queues is needed
- * anywhere else as well.
- * - Check if TTI miss needs some trigger to the module.
- * - Return ROK
- *
- * @param[in] RgSchCellCb *cell
- *
- * @return S16
- * -# ROK
- **/
-
-S16 rgSCHMeasGapANRepTtiHndl(RgSchCellCb *cell)
-{
- uint8_t offset;
- CmLListCp *queue;
- RgSchDlSf *dlSf;
- CmLteTimingInfo repTime;
-
- /* Measurement GAP Starts at offSet - however at MAC we are concerned at
- * subframe + TFU_DELTA.
- */
- /* 40ms offset */
- /* Introduced timing delta for DL control in FDD */
-#ifdef LTE_TDD
- offset = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G + cell->crntTime.slot + TFU_DELTA) %
- RG_MEAS_GAPPRD_40;
-#else
- offset = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G + cell->crntTime.slot + TFU_DLCNTRL_DLDELTA) %
- RG_MEAS_GAPPRD_40;
-#endif
- queue = &(cell->measGapCb.gapPrd40Q[offset]);
- rgSCHMeasGapANRepUtlHdlTti (cell, queue);
- /* 80ms offset */
- /* Introduced timing delta for DL control in FDD */
-#ifdef LTE_TDD
- offset = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G + cell->crntTime.slot + TFU_DELTA) %
- RG_MEAS_GAPPRD_80;
-#else
- offset = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G + cell->crntTime.slot + TFU_DLCNTRL_DLDELTA) %
- RG_MEAS_GAPPRD_80;
-#endif
- queue = &(cell->measGapCb.gapPrd80Q[offset]);
- rgSCHMeasGapANRepUtlHdlTti (cell, queue);
-
- /* for ACK NACK repetition starts at offset - however at MAC we are
- * concerned with subframe - TFU_DELTA */
- /* offset = ((cell->crntTime.sfn * 10) + cell->crntTime.slot) %
- * RG_MAX_NUM_DLSF; */
- /* We wish to get the subframe whose HARQ Reception request would go out in
- * this subframe. HARQ_RTT - TFU_DELTA
- */
- /* Introduced timing delta for reception req */
-#ifdef LTE_TDD
- /* ACC_TDD */
- //RGSCHSUBFRMCRNTTIME(cell->crntTime, repTime, (4 - TFU_DELTA));
- RGSCHDECRFRMCRNTTIME(cell->crntTime, repTime, (RG_SCH_CMN_HARQ_INTERVAL - TFU_RECPREQ_DLDELTA));
-#else
- RGSCHDECRFRMCRNTTIME(cell->crntTime, repTime, (RG_SCH_CMN_HARQ_INTERVAL - TFU_RECPREQ_DLDELTA));
-#endif
- dlSf = rgSCHUtlSubFrmGet (cell, repTime);
- queue = &(dlSf->ueLst);
- rgSchAckNackRepUtlHdlTti (cell, queue);
-
- return ROK;
-}
-
- /** @brief This function Marks the UE as ackNakRep so that Reception request
- * isnt sent for any other thing than HARQ.
- *
- * @details
- *
- * Function:
- *
- * Processing steps:
- * - Loop through HARQ procs of the DlSf.
- * - If the UE is a repeating one
- * - Mark as ackNakRep = TRUE
- * - Start the timer
- *
- * @param RgSchCellCb *cell
- * @param CmLListCp *ackNakRepQ
- * @return Void
- */
-static Void rgSchAckNackRepUtlHdlTti(RgSchCellCb *cell,CmLListCp *ackNackRepQ)
-{
- CmLList *node;
- RgSchUeCb *ue;
-
- node = ackNackRepQ->first;
- while (node)
- {
- ue = (RgSchUeCb *)(node->node);
- if ((NULLP != ue) && (ue->ackNakRepCb.isAckNackEnabled))
- {
- ue->ackNakRepCb.isAckNakRep = TRUE;
- rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_ACKNACK_REP,
- ue->ackNakRepCb.repCntr);
- }
- node = node->next;
- } /* end of while */
- return;
-} /* end of */
-
-
- /** @brief This function
- *
- * @details
- *
- * Function:
- *
- * Processing steps:
- * -
- *
- *
- * @param
- * @param
- * @return
- */
-static Void rgSCHMeasGapANRepUtlHdlTti(RgSchCellCb *cell,CmLListCp *measGapQ)
-{
- CmLList *node;
- RgSchUeCb *ue;
-
- node = measGapQ->first;
- while (node)
- {
- ue = (RgSchUeCb*)node->node;
- ue->measGapCb.isMeasuring = TRUE;
- rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_MEASGAP, RG_SCH_MEAS_GAP_LEN);
- node = node->next;
- } /* end of while */
- return;
-} /* end of */
-
-
-/**
- * @brief Determines the list of UEs inactive for DL scheduling due to
- * measurement gap and ack nack repetitions
- *
- * @details
- *
- * Function : rgSCHMeasGapANRepGetDlInactvUe
- *
- * Invoking Module Processing:
- * - This API shall be invoked to get list of inactive UEs for downlink
- * scheduling due to measurement gaps and ACK NACK repetitions.
- *
- * Processing Steps:
- * - Compute qOffset for 40ms or 80ms queue as =
- * ((cell->crntTime->sfn * 10)+cell->crntTime->subframe + DL_DELTA +
- * RG_SCH_CMN_HARQ_INTERVAL)
- * % RG_MEAS_GAPPRD_40 or RG_MEAS_GAPPRD_80.
- * - Add all the UEs at computed offset to dlInactvUeLst since the
- * DL transmission or feedback transmission from UE for DL
- * transmissions shall collide with measurement gap.
- * - Mark each UE. Set dlInactvMask |= RG_MEASGAP_INACTIVE
- * - Start measGapDlInactvTmr timer for each UE,
- * - length = RG_MEAS_GAP_LEN + RG_SCH_CMN_HARQ_INTERVAL
- * - event = RG_MEASGAP_DLINACTV
- * - handler = rgSCHMeasGapANRepDlInactvTmrExpry
- * - Compute qOffset for ACK NACK repetition queue as =
- * ((cell->crntTime->sfn * 10)+cell->crntTime->subframe + DL_DELTA +
- * RG_SCH_CMN_HARQ_INTERVAL -1)
- * % RG_MAX_NUM_DLSF.
- * - Add all the UEs at computed offset to dlInactvUeLst since the
- * feedback transmission from UE for DL transmissions shall
- * collide with ACK NACK repetition of the UE.
- * - Mark each UE. Set dlInactvMask |= RG_ACKNAKREP_INACTIVE
- * - Start ackNakRepDlInactvTmr timer for each UE,
- * - length = repCntr - 1
- * - event = RG_ACKNAKREP_DLINACTV
- * - handler = rgSCHMeasGapANRepDlInactvTmrExpry
- * - Verify the above computations before coding
- *
- * - Return ROK
- *
- * @param[in] RgSchCellCb *cell
- * @param[out] CmLListCp *dlInactvUeLst
- * @return S16
- * -# ROK
- **/
-S16 rgSCHMeasGapANRepGetDlInactvUe(RgSchCellCb *cell,CmLListCp *dlInactvUeLst)
-{
- uint8_t offset;
- CmLList *node;
- CmLList *hqNode;
- CmLListCp *queue;
- RgSchUeCb *ue;
- RgSchDlSf *dlSf;
- CmLteTimingInfo ackNakTime;
- uint16_t schedTime;
- uint8_t harqFdbkOffset;
-#ifdef LTE_TDD
- uint8_t repCntr;
-#endif
- RgSchDlHqProcCb *hqP;
- RgSchDlHqTbCb *tbCb;
- uint32_t i;
-
- schedTime = cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G + cell->crntTime.slot + RG_DL_DELTA;
-
-#ifdef LTE_TDD
- RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, ackNakTime, RG_DL_DELTA);
- if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx][ackNakTime.subframe] !=
- RG_SCH_TDD_DL_SUBFRAME)
- {
- return ROK;
- }
-
- dlSf = rgSCHUtlSubFrmGet (cell, ackNakTime);
- if(dlSf->dlFdbkInfo.sfnOffset > 0)
- {
- harqFdbkOffset =
- (dlSf->dlFdbkInfo.sfnOffset - 1) * RGSCH_NUM_SUB_FRAMES+ \
- RGSCH_NUM_SUB_FRAMES - ackNakTime.subframe + \
- dlSf->dlFdbkInfo.subframe;
- }
- else
- {
- harqFdbkOffset = dlSf->dlFdbkInfo.subframe - ackNakTime.subframe;
- }
-#else
- harqFdbkOffset = RG_SCH_CMN_HARQ_INTERVAL;
-#endif
- /* Calc offset for Measurement gap 40 */
- offset = (schedTime + harqFdbkOffset) % RG_MEAS_GAPPRD_40;
- queue = &(cell->measGapCb.gapPrd40Q[offset]);
-
- node = queue->first;
- while (node)
- {
- ue = (RgSchUeCb*)node->node;
- ue->dl.dlInactvMask |= RG_MEASGAP_INACTIVE;
- /* Add to the inactv list */
- ue->dl.dlInactvLnk.node = (PTR)ue;
- cmLListAdd2Tail (dlInactvUeLst, &(ue->dl.dlInactvLnk));
- /* Start timer */
- rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_DL_MEASGAP,
- (RG_SCH_MEAS_GAP_LEN + harqFdbkOffset));
- node = node->next;
- }
-
- /* Calc offset for Measurement gap 80 */
- offset = (schedTime + harqFdbkOffset) % RG_MEAS_GAPPRD_80;
- queue = &(cell->measGapCb.gapPrd80Q[offset]);
-
- node = queue->first;
- while (node)
- {
- ue = (RgSchUeCb*)node->node;
- ue->dl.dlInactvMask |= RG_MEASGAP_INACTIVE;
- /* Add to the inactv list */
- ue->dl.dlInactvLnk.node = (PTR)ue;
- cmLListAdd2Tail (dlInactvUeLst, &(ue->dl.dlInactvLnk));
- /* Start timer */
- rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_DL_MEASGAP,
- (RG_SCH_MEAS_GAP_LEN + harqFdbkOffset));
- node = node->next;
- }
-
- /* Calc offset for ACK NACK repetition */
- /*offset = (cell->crntTime.sfn * 10 +
- cell->crntTime.slot + RG_DL_DELTA + RG_SCH_CMN_HARQ_INTERVAL - 1)
- % RG_MAX_NUM_DLSF;*/
- /* The ackNakRepQ resides in each dlSf corresponding to the repStart */
- /* Must pick up the subframe that was scheduled in the last TTI */
-#ifdef LTE_TDD
- if(cell->ulDlCfgIdx == 5)
- {
- return ROK;
- }
- rgSCHUtlGetPrevDlSfInfo(cell, ackNakTime, &ackNakTime, &repCntr);
- dlSf = rgSCHUtlSubFrmGet (cell, ackNakTime);
- /* crnt DL subframe */
- RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, ackNakTime, RG_DL_DELTA);
-#else
- if(0 == RG_DL_DELTA)
- {
- /* Go to the subframe being scheduled */
- RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, ackNakTime, RG_DL_DELTA);
- /* Go to the previous subframe */
- RGSCHDECRFRMCRNTTIME(ackNakTime, ackNakTime, 1);
- }
- else
- {
- RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, ackNakTime,
- (RG_DL_DELTA - 1));
- }
- dlSf = rgSCHUtlSubFrmGet (cell, ackNakTime);
-#endif
- queue = &(dlSf->ueLst);
-
- node = queue->first;
- while (node)
- {
- ue = (RgSchUeCb *)(node->node);
- node = node->next;
- hqNode = ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx].hqPLst.first;
- while (hqNode)
- {
- hqP = (RgSchDlHqProcCb *)hqNode->node;
- hqNode = hqNode->next;
- for (i = 0;(i<2) && (hqP->tbInfo[i].state == HQ_TB_WAITING);i++)
- {
- tbCb = &hqP->tbInfo[i];
- if (tbCb->fbkRepCntr > 0)
- {
- ue->dl.dlInactvMask |= RG_ACKNAKREP_INACTIVE;
- /* Check if already added to the list */
- if (!(ue->dl.dlInactvMask & RG_MEASGAP_INACTIVE))
- {
- /* Add to the inactv list */
- ue->dl.dlInactvLnk.node = (PTR)ue;
- cmLListAdd2Tail (dlInactvUeLst, &(ue->dl.dlInactvLnk));
- }
- /* Start timer */
-#ifdef LTE_TDD
- repCntr = rgSCHAckNakRepFindUlDuration(cell, dlSf, ackNakTime,
- (uint8_t)(ue->ackNakRepCb.repCntr - 1));
- rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_DL_ACKNACK, repCntr);
-#else
- rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_DL_ACKNACK,
- (ue->ackNakRepCb.repCntr - 1));
-#endif
- }
- }
- }
- }
- return ROK;
-}
-
-/**
- * @brief Determines the list of UEs inactive for UL scheduling due to
- * measurement gap and ack nack repetitions
- *
- * @details
- *
- * Function : rgSCHMeasGapANRepGetUlInactvUe
- *
- * Invoking Module Processing:
- * - This API shall be invoked to get list of inactive UEs for uplink
- * scheduling due to measurement gaps and ACK NACK repetitions.
- *
- * Processing Steps:
- * - Compute qOffset for 40ms or 80ms queue as =
- * ((cell->crntTime->sfn * 10)+cell->crntTime->subframe + TFU_DELTA +
- * RG_SCH_CMN_HARQ_INTERVAL)
- * % RG_MEAS_GAPPRD_40 or RG_MEAS_GAPPRD_80.
- * - Add all the UEs at computed offset to ulInactvUeLst since the UL
- * transmissions shall collide with measurement gap.
- * - Mark each UE. Set ulInactvMask |= RG_MEASGAP_INACTIVE
- * - Start measGapUlInactvTmr timer for each UE
- * - length = RG_MEAS_GAP_LEN
- * - event = RG_MEASGAP_ULINACTV
- * - handler = rgSCHMeasGapANRepUlInactvTmrExpry
- * - Compute qOffset for ACK NACK repetition queue as =
- * ((cell->crntTime->sfn * 10)+cell->crntTime->subframe + TFU_DELTA +
- * RG_SCH_CMN_HARQ_INTERVAL)
- * % RG_MAX_NUM_DLSF.
- * - Add all the UEs at computed offset to ulInactvUeLst since the
- * feedback transmission from UE for DL transmissions shall
- * collide with repeating ACK ACK-NACKs.
- * - Mark each UE. Set ulInactvMask |= RG_ACKNAKREP_INACTIVE
- * - Start ackNakRepUlInactv timer for each UE
- * - length = repCntr
- * - event = RG_ACKNAKREP_ULINACTV
- * - handler = rgSCHMeasGapANRepUlInactvTmrExpry
- * - Verify the above computations before coding
- * - Return ROK
- *
- * @param[in] RgSchCellCb *cell
- * @param[out] CmLListCp *ulInactvUeLst
- * @return S16
- * -# ROK
- **/
-
-S16 rgSCHMeasGapANRepGetUlInactvUe(RgSchCellCb *cell,CmLListCp *ulInactvUeLst)
-{
-
- uint8_t offset;
- CmLList *node;
- CmLList *hqNode;
- CmLListCp *queue;
- RgSchUeCb *ue;
- CmLteTimingInfo ackNakTime;
- RgSchDlSf *dlSf;
- uint16_t schedTime;
- uint8_t pdcchToPuschGap;
- uint8_t idx=0;
-#ifdef LTE_TDD
- uint8_t repCntr;
-#endif
- RgSchDlHqProcCb *hqP;
- RgSchDlHqTbCb *tbCb;
- uint32_t i;
-
- /*ccpu00139481- Meas Gap should be monitored in UL with TFU_ULCNTRL_DLDELTA*/
- schedTime = cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G + cell->crntTime.slot + \
- TFU_ULCNTRL_DLDELTA;
-#ifndef LTE_TDD
- pdcchToPuschGap = RGSCH_PDCCH_PUSCH_DELTA;
-#else
- RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, ackNakTime, TFU_ULCNTRL_DLDELTA);
- pdcchToPuschGap = rgSchTddPuschTxKTbl[cell->ulDlCfgIdx][ackNakTime.subframe];
- for(idx=0; pdcchToPuschGap && (idx< (pdcchToPuschGap+RG_SCH_MEAS_GAP_LEN)) ; idx++)
-#endif
- {
- /* Calc offset for Measurement gap 40 */
- offset = (schedTime + pdcchToPuschGap -idx + RG_MEAS_GAPPRD_40) % RG_MEAS_GAPPRD_40;
- queue = &(cell->measGapCb.gapPrd40Q[offset]);
- node = queue->first;
- while (node)
- {
- ue = (RgSchUeCb*)node->node;
- if(!(ue->ul.ulInactvMask & RG_MEASGAP_INACTIVE))
- {
- ue->ul.ulInactvMask |= RG_MEASGAP_INACTIVE;
- /* Add to the inactv list */
- ue->ul.ulInactvLnk.node = (PTR)ue;
- cmLListAdd2Tail (ulInactvUeLst, &(ue->ul.ulInactvLnk));
- /* Start timer Note the timer is started for a value GAP_LEN +
- * RG_SCH_CMN_HARQ_INTERVAL. The "4"
- * is added because for UE to transmit, the PDCCH must be sent 4 subframes
- * ahead - UE cant read PDCCH format0 if it is in measurement gap. */
- rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_UL_MEASGAP,
- (RG_SCH_MEAS_GAP_LEN + pdcchToPuschGap - idx));
- //DU_LOG("\nINFO --> SCH : Starting Meas Gap 40 @ DL TTI- (%d:%d) K-%d offset-%d Len %d \n", ackNakTime.sfn,\
- ackNakTime.subframe, harqFdbkOffset, offset, RG_SCH_MEAS_GAP_LEN + harqFdbkOffset-idx);
- }
- node = node->next;
- }
-
- /* Calc offset for Measurement gap 80 */
- offset = (schedTime + pdcchToPuschGap - idx + RG_MEAS_GAPPRD_80) % RG_MEAS_GAPPRD_80;
- queue = &(cell->measGapCb.gapPrd80Q[offset]);
-
- node = queue->first;
- while (node)
- {
- ue = (RgSchUeCb*)node->node;
- if(!(ue->ul.ulInactvMask & RG_MEASGAP_INACTIVE))
- {
- ue->ul.ulInactvMask |= RG_MEASGAP_INACTIVE;
- /* Add to the inactv list */
- ue->ul.ulInactvLnk.node = (PTR)ue;
- cmLListAdd2Tail (ulInactvUeLst, &(ue->ul.ulInactvLnk));
- /* Start timer */
- rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_UL_MEASGAP,
- (RG_SCH_MEAS_GAP_LEN + pdcchToPuschGap - idx));
- //DU_LOG("\nINFO --> SCH : Starting Meas Gap 80 @ DL TTI- (%d:%d) K-%d offset-%d Len %d \n", ackNakTime.sfn,\
- ackNakTime.subframe, harqFdbkOffset, offset, RG_SCH_MEAS_GAP_LEN + harqFdbkOffset-idx);
- }
- node = node->next;
- }
- }
- /* Calc offset for ACK NACK repetition */
- /*offset = (cell->crntTime.sfn * 10 +
- cell->crntTime.slot + RG_UL_SCHED_DELTA +
- RG_SCH_CMN_HARQ_INTERVAL ) % RG_MAX_NUM_DLSF;*/
-
- /* Must get the DLSF that is scheduled at TFU_DELTA Away */
-#ifdef LTE_TDD
- if(cell->ulDlCfgIdx == 5)
- {
- return ROK;
- }
- RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, ackNakTime, TFU_DELTA);
- if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx][ackNakTime.subframe] !=
- RG_SCH_TDD_DL_SUBFRAME)
- {
- return ROK;
- }
-#else
- /* Introduced timing delta for DL control in FDD */
- RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, ackNakTime, TFU_DLCNTRL_DLDELTA);
-#endif
- dlSf = rgSCHUtlSubFrmGet (cell, ackNakTime);
- queue = &(dlSf->ueLst);
-
- node = queue->first;
- while (node)
- {
- ue = (RgSchUeCb *)(node->node);
- node = node->next;
- hqNode = ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx].hqPLst.first;
- while (hqNode)
- {
- hqP = (RgSchDlHqProcCb *)hqNode->node;
- hqNode = hqNode->next;
- for (i = 0;(i<2) && (hqP->tbInfo[i].state == HQ_TB_WAITING);i++)
- {
- tbCb = &hqP->tbInfo[i];
- if (tbCb->fbkRepCntr > 0)
- {
- ue->ul.ulInactvMask |= RG_ACKNAKREP_INACTIVE;
- /* Check if already added to the list */
- if (!(ue->ul.ulInactvMask & RG_MEASGAP_INACTIVE))
- {
- /* Add to the inactv list */
- ue->ul.ulInactvLnk.node = (PTR)ue;
- cmLListAdd2Tail (ulInactvUeLst, &(ue->ul.ulInactvLnk));
- }
- /* Start timer */
-#ifdef LTE_TDD
- repCntr = rgSCHAckNakRepFindUlDuration(cell, dlSf, ackNakTime,
- ue->ackNakRepCb.repCntr);
- rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_UL_ACKNACK, repCntr);
-#else
- rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_UL_ACKNACK,
- (ue->ackNakRepCb.repCntr));
-#endif
- }
- }
- }
- }
- return ROK;
-}
-
-/**
- * @brief Handles processing of DL Inactive timer expiry at the end of
- * measurement gap or ack nack repetition for a UE
- *
- * @details
- *
- * Function : rgSCHMeasGapANRepDlInactvTmrExpry
- *
- * Invoking Module Processing:
- * - This API shall be invoked to process DL inactive timer expiry
- *
- * Processing Steps:
- * - If timer event is RG_MEASGAP_DLINACTV,
- * - dlInactvMask &= ~RG_MEASGAP_INACTIVE
- * - If timer event is RG_ACKNAKREP_DLINACTV,
- * - dlInactvMask &= ~RG_ACKNAKREP_INACTIVE
- * - if (!dlInactvMask)
- * - Invoke DL scheduler to put the UE back into the scheduling queues.
- * - Re-initialize timer.
- * - Return ROK
- *
- * @param[in] RgSchUeCb *ue
- * @param[in] Check if some timer related parameter needs to be passed
- * @return S16
- * -# ROK
- **/
-
-Void rgSCHMeasGapANRepDlInactvTmrExpry(RgSchUeCb *ue,uint8_t tmrEvnt)
-{
-
- RgSchCellCb *cell = ue->cell;
-
- switch (tmrEvnt)
- {
- case RG_SCH_TMR_DL_MEASGAP:
- RG_SCH_CMN_DL_UPDT_INACTV_MASK ( cell, ue, RG_MEASGAP_INACTIVE);
- break;
- case RG_SCH_TMR_DL_ACKNACK:
- RG_SCH_CMN_DL_UPDT_INACTV_MASK ( cell, ue, RG_ACKNAKREP_INACTIVE);
- break;
- }
- if (!ue->dl.dlInactvMask)
- {
- cmInitTimers (&ue->measGapCb.measGapDlInactvTmr, 1);
- cmInitTimers (&ue->ackNakRepCb.ackNakRepDlInactvTmr, 1);
- }
- return;
-}
-
-/**
- * @brief Handles processing of UL Inactive timer expiry at the end of
- * measurement gap or ack nack repetition for a UE
- *
- * @details
- *
- * Function : rgSCHMeasGapANRepUlInactvTmrExpry
- *
- * Invoking Module Processing:
- * - This API shall be invoked to process UL inactive timer expiry
- *
- * Processing Steps:
- * - If timer event is RG_MEASGAP_ULINACTV,
- * - ulInactvMask &= ~RG_MEASGAP_INACTIVE
- * - If timer event is RG_ACKNAKREP_ULINACTV,
- * - ulInactvMask &= ~RG_ACKNAKREP_INACTIVE
- * - if (!ulInactvMask)
- * - Invoke UL scheduler to put the UE back into the scheduling queues.
- * - Re-initialize timer.
- * - Return ROK
- *
- * @param[in] RgSchUeCb *ue
- * @param[in] Check if some timer related parameter needs to be passed
- * @return S16
- * -# ROK
- **/
-
-Void rgSCHMeasGapANRepUlInactvTmrExpry(RgSchUeCb *ue,uint8_t tmrEvnt)
-{
- RgSchCellCb *cell = ue->cell;
-
- switch (tmrEvnt)
- {
- case RG_SCH_TMR_UL_MEASGAP:
- RG_SCH_CMN_UL_UPDT_INACTV_MASK ( cell, ue, RG_MEASGAP_INACTIVE);
- break;
- case RG_SCH_TMR_UL_ACKNACK:
- RG_SCH_CMN_UL_UPDT_INACTV_MASK ( cell, ue, RG_ACKNAKREP_INACTIVE);
- break;
- }
- if (!ue->ul.ulInactvMask)
- {
- cmInitTimers (&ue->measGapCb.measGapUlInactvTmr, 1);
- cmInitTimers (&ue->ackNakRepCb.ackNakRepUlInactvTmr, 1);
- }
- return;
-}
-
-/**
- * @brief Handles processing of measurement gap timer expiry at the end of
- * measurement gap
- *
- * @details
- *
- * Function : rgSCHMeasGapANRepTmrExpry
- *
- * Invoking Module Processing:
- * - This API shall be invoked to process measurement gap timer expiry
- *
- * Processing Steps:
- * - Set ue->isMeasuring = FALSE
- * - Re-initialize timer.
- * - Return ROK
- *
- * @param[in] RgSchUeCb *ue
- * @param[in] Check if some timer related parameter needs to be passed
- * @return S16
- * -# ROK
- **/
-
-Void rgSCHMeasGapANRepTmrExpry(RgSchUeCb *ue)
-{
-
- ue->measGapCb.isMeasuring = FALSE;
- cmInitTimers (&ue->measGapCb.measGapTmr, 1);
-
- return;
-}
-
-/**
- * @brief Handles processing of ACK-NACK repetition timer expiry at the end of
- * ACK-NACK repetition.
- *
- * @details
- *
- * Function : rgSchAckNakRepTmrExpry
- *
- * Invoking Module Processing:
- * - This API shall be invoked to process ACK-NACK repetition timer expiry
- *
- * Processing Steps:
- * - Set ue->isAckNakRep = FALSE
- * - Re-initialize timer.
- * - Return ROK
- *
- * @param[in] RgSchUeCb *ue
- * @param[in] Check if some timer related parameter needs to be passed
- * @return S16
- * -# ROK
- **/
-
-Void rgSCHAckNakRepTmrExpry(RgSchUeCb *ue)
-{
-
- ue->ackNakRepCb.isAckNakRep = FALSE;
- cmInitTimers (&ue->ackNakRepCb.ackNakRepTmr, 1);
-
- return;
-}
-
-
-/**
- * @brief Adds ACK-NACK repeating UEs to the ackNakRepQ
- *
- * @details
- *
- * Function : rgSchAckNakRepAddToQ
- *
- * Invoking Module Processing:
- * - This API shall be invoked for adding list of UEs to the ACK-NACK
- * repeating queue at appropriate poistion. Invoking module shall invoke
- * with the list of ACK-NACK repeating UEs for a sub-frame and timing info
- * at which ACK NACK repetition shall start for the UEs.
- *
- * Processing Steps:
- * - Determine the qOffset depending on the timing info as
- * - qOffset = (repStartTime->sfn *10 + repStartTime->subframe) % RG_MAX_NUM_DLSF
- * - Initialize the list at the qOffset.
- * - For each UE in the list,
- * - Add the UE to ackNakRepQ to the list at the determined qOffset.
- * - Set ue->qOffset = qOffset
- * - Initialize timers.
- * - Return ROK
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *crntDlSf
- * @param[in] CmLteTimingInfo repStartTime
- *
- * @return S16
- * -# ROK
- **/
-
-Void rgSCHAckNakRepAddToQ(RgSchCellCb *cell,RgSchDlSf *crntDlSf)
-{
- RgSchUeCb *ue;
- CmLList *node;
- CmLList *hqNode;
- RgSchDlHqProcCb *hqP;
- RgSchDlHqTbCb *tbCb;
- uint32_t i;
-
- node = crntDlSf->ueLst.first;
- while (node)
- {
- ue = (RgSchUeCb *)(node->node);
- node = node->next;
- hqNode = ue->dl.dlSfHqInfo[cell->cellId][crntDlSf->dlIdx].hqPLst.first;
- while (hqNode)
- {
- hqP = (RgSchDlHqProcCb *)hqNode->node;
- hqNode = hqNode->next;
- for (i = 0;(i<2) && (hqP->tbInfo[i].state == HQ_TB_WAITING);i++)
- {
- tbCb = &hqP->tbInfo[i];
- /* Add UEs that have enabled ACK NACK repetition */
- if (ue->ackNakRepCb.isAckNackEnabled)
- {
- tbCb->fbkRepCntr = ue->ackNakRepCb.cfgRepCnt;
- tbCb->fbkRecpRepCntr = ue->ackNakRepCb.cfgRepCnt;
- /* Removed init of timers as the init will be happening during
- * config or timer expiry*/
- }
- }
- }
- }
- return;
-}
-
-
-#ifdef LTE_TDD
-/**
- * @brief Finds the number of subframes used for ACK-NACK cycle
- *
- * @details
- *
- * Function : rgSCHAckNakRepFindUlDuration
- *
- * This function finds the number of subframes required
- * for ACK-NACK repetition cycle based on UL subframes.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *dlSf
- * @param[in] CmLteTimingInfo repTime
- * @param[in] uint8_t repCnt
- *
- * @return uint8_t
- *
- **/
-
-static uint8_t rgSCHAckNakRepFindUlDuration(RgSchCellCb *cell,RgSchDlSf *dlSf,CmLteTimingInfo repTime,uint8_t repCnt)
-{
- CmLteTimingInfo ulfrm;
- uint8_t noSubfrms = 0;
- uint16_t ulDlCfgIdx = cell->ulDlCfgIdx;
- S16 rem = 0;
- S16 idx;
- S8 diff;
-
- rgSCHAckNakRepGetUlOffsetFrmDl(dlSf, repTime, &noSubfrms);
- RG_SCH_ADD_TO_CRNT_TIME(repTime, ulfrm, noSubfrms);
- diff = repCnt-1;
- idx = ulfrm.subframe;
- while(diff)
- {
- idx = (idx + 1) % RGSCH_NUM_SUB_FRAMES;
- if(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][idx] ==
- RG_SCH_TDD_UL_SUBFRAME)
- {
- diff--;
- }
- rem++;
- }
- noSubfrms += rem;
-
- return (noSubfrms);
- }
-
-/**
- * @brief Finds the number of subframes used for ACK-NACK cycle
- *
- * @details
- *
- * Function : rgSCHAckNakRepGetUlOffsetFrmDl
- *
- * This function finds the number of subframes after
- * which UL subframes are present for the gicen DL
- * subframe.
- *
- * @param[in] RgSchDlSf *dlSf
- * @param[in] CmLteTimingInfo crntDlTime
- * @param[in] uint8_t *noSubfrms
- *
- * @return uint8_t
- *
- **/
-
-static Void rgSCHAckNakRepGetUlOffsetFrmDl(RgSchDlSf *dlSf,CmLteTimingInfo crntDlTime,uint8_t *noSubfrms )
-{
-
- if(dlSf->dlFdbkInfo.sfnOffset != 0)
- {
- *noSubfrms = (dlSf->dlFdbkInfo.sfnOffset - 1) * RGSCH_NUM_SUB_FRAMES;
- *noSubfrms = *noSubfrms + RGSCH_NUM_SUB_FRAMES - crntDlTime.subframe;
- *noSubfrms = *noSubfrms + dlSf->dlFdbkInfo.subframe;
- }
- else
- {
- *noSubfrms = dlSf->dlFdbkInfo.subframe - crntDlTime.subframe;
- }
- return;
-}
-#endif
-\f
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for INF Interface Module
-
- File: rg_sch_pt.c
-
-**********************************************************************/
-
-/** @file rg_sch_pt.c
-@brief This file contains the definitions for Upper Interface(RGR/CRG/RGU)
- primitives that are invoked from MAC to its service users.
- Portable functions corresponding to these primitives are also defined.
-*/
-/* header include files (.h) */
-#include "common_def.h"
-#include "rg_env.h" /* MAC Environment Defines */
-#include "crg.h" /* CRG Interface defines */
-#include "rgr.h" /* RGR Interface defines */
-#include "rgu.h" /* RGU Interface defines */
-#include "cm_mblk.h" /* memory management */
-#include "cm_lte.h" /* Common LTE Defines */
-#include "tfu.h" /* RGU Interface defines */
-#ifdef LTE_L2_MEAS
-#include "lrg.h"
-#endif
-#include "rg_sch_inf.h" /* RGU Interface defines */
-
-/* header/extern include files (.x) */
-#include "crg.x" /* CRG Interface includes */
-#include "rgr.x" /* RGR Interface includes */
-#include "rgu.x" /* RGU Interface includes */
-#include "cm_mblk.x" /* memory management */
-#include "cm_lte.x" /* Common LTE Defines */
-#include "tfu.x" /* RGU Interface includes */
-#ifdef LTE_L2_MEAS
-#include "lrg.x"
-#endif
-#include "rg_sch_inf.x" /* RGU Interface includes */
-
-#define RG_MAX_SCH 1
-
-static const CellRegReq RgSchMacCellRegReqMt[RG_MAX_SCH] =
-{
-#ifdef LCSCH
- cmPkSchMacCellRegReq,
-#else
- RgSchMacCellRegReq
-#endif
-};
-
-static const DedBoUpdtReq RgMacSchDedBoUpdtReqMt[RG_MAX_SCH] =
-{
-#ifdef LCSCH
- cmPkMacSchDedBoUpdtReq,
-#else
- RgMacSchDedBoUpdtReq
-#endif
-};
-
-static const CmnBoUpdtReq RgMacSchCmnBoUpdtReqMt[RG_MAX_SCH] =
-{
-#ifdef LCSCH
- cmPkMacSchCmnBoUpdtReq,
-#else
- RgMacSchCmnBoUpdtReq
-#endif
-};
-
-static const SfRecpInd RgMacSchSfRecpIndMt[RG_MAX_SCH] =
-{
-#ifdef LCSCH
- cmPkMacSchSfRecpInd
-#else
- RgMacSchSfRecpInd,
-#endif
-};
-/*Fix: start: Inform UE delete to scheduler*/
-static const UeDelInd RgMacSchUeDelIndMt[RG_MAX_SCH] =
-{
-#ifdef LCSCH
- cmPkMacSchUeDelInd
-#else
- RgMacSchUeDelInd,
-#endif
-};
-/*Fix: end: Inform UE delete to scheduler*/
-static const SfAllocReq RgSchMacSfAllocReqMt[RG_MAX_SCH] =
-{
-#ifdef LCSCH
- cmPkSchMacSfAllocReq,
-#else
- RgSchMacSfAllocReq
-#endif
-};
-
-static const RstHqEntReq RgSchMacRstHqEntReqMt[RG_MAX_SCH] =
-{
-#ifdef LCSCH
- cmPkSchMacRstHqEntReq,
-#else
- RgSchMacRstHqEntReq
-#endif
-};
-static const RlsHqReq RgSchMacRlsHqReqMt[RG_MAX_SCH] =
-{
-#ifdef LCSCH
- cmPkSchMacRlsHqReq,
-#else
- RgSchMacRlsHqReq
-#endif
-};
-
-static const RlsRntiReq RgSchMacRlsRntiReqMt[RG_MAX_SCH] =
-{
-#ifdef LCSCH
- cmPkSchMacRlsRntiReq,
-#else
- RgSchMacRlsRntiReq
-#endif
-};
-
-static const LcgReg RgSchMacLcgRegReqMt[RG_MAX_SCH] =
-{
-#ifdef LCSCH
- cmPkSchMacLcgRegReq,
-#else
- RgSchMacLcgRegReq
-#endif
-};
-
-#ifdef LTEMAC_SPS
-static const SpsLcReg RgSchMacSpsLcRegReqMt[RG_MAX_SCH] =
-{
-#ifdef LCSCH
- cmPkSchMacSpsLcRegReq,
-#else
- RgSchMacSpsLcRegReq
-#endif
-};
-
-static const UlSpsReset RgSchMacUlSpsResetMt[RG_MAX_SCH] =
-{
-#ifdef LCSCH
- cmPkSchMacUlSpsReset,
-#else
- RgSchMacUlSpsResetReq
-#endif
-};
-
-
-
-static const SpsLcDereg RgSchMacSpsLcDeregReqMt[RG_MAX_SCH] =
-{
-#ifdef LCSCH
- cmPkSchMacSpsLcDeregReq,
-#else
- RgSchMacSpsLcDeregReq
-#endif
-};
-
-static const SpsRelInd RgMacSchSpsRelIndMt[RG_MAX_SCH] =
-{
-#ifdef LCSCH
- cmPkMacSchSpsRelInd,
-#else
- RgMacSchSpsRelInd
-#endif
-};
-
-#endif /* LTEMAC_SPS */
-
-#ifdef LTE_L2_MEAS
-static const L2MeasReq RgSchMacL2MeasReqMt[RG_MAX_SCH] =
-{
-#ifdef LCSCH
- cmPkSchMacL2MeasReq
-#else
- RgSchMacL2MeasReq
-#endif
-};
-/*Added for Rsys oam*/
-static const L2MeasStopReq RgSchMacL2MeasStopReqMt[RG_MAX_SCH] =
-{
-#ifdef LCSCH
- cmPkSchMacL2MeasStopReq
-#else
- RgSchMacL2MeasStopReq
-#endif
-};
-
-static const L2MeasSendReq RgSchMacL2MeasSendReqMt[RG_MAX_SCH] =
-{
-#ifdef LCSCH
- cmPkSchMacL2MeasSendReq
-#else
- RgSchMacL2MeasSendReq
-#endif
-};
-
-static const L2MeasCfm RgMacSchL2MeasCfmMt[RG_MAX_SCH] =
-{
-#ifdef LCSCH
- cmPkMacSchL2MeasCfm
-#else
- RgMacSchL2MeasCfm
-#endif
-};
-static const L2MeasStopCfm RgMacSchL2MeasStopCfmMt[RG_MAX_SCH] =
-{
-#ifdef LCSCH
- cmPkMacSchL2MeasStopCfm
-#else
- RgMacSchL2MeasStopCfm
-#endif
-};
-#endif/*LTE_L2_MEAS*/
-/**
-* @brief Data Indication from MAC to RLC to
- * forward the data received for dedicated channels
-*
-* @details
-*
-* Function : RgSchMacCellReg
-*
-* @param[in] Pst* pst
-* @param[in] SuId suId
-* @param[in] RguDDatIndInfo * datInd
-* @return S16
-* -# ROK
-**/
-S16 RgSchMacCellReg(Pst* pst,RgInfCellReg* regReq)
-{
-
- return ((*RgSchMacCellRegReqMt[0])(pst, regReq));
-}
-
-/**
-* @brief Data Indication from MAC to RLC to
- * forward the data received for dedicated channels
-*
-* @details
-*
-* Function : RgMacSchDedBoUpdt
-*
-* @param[in] Pst* pst
-* @param[in] SuId suId
-* @param[in] RguDDatIndInfo * datInd
-* @return S16
-* -# ROK
-**/
-S16 RgMacSchDedBoUpdt(Pst* pst,RgInfDedBoRpt* boRpt)
-{
-
- return ((*RgMacSchDedBoUpdtReqMt[0])(pst, boRpt));
-}
-
-/**
-* @brief Data Indication from MAC to RLC to
- * forward the data received for dedicated channels
-*
-* @details
-*
-* Function : RgMacSchCmnBoUpdt
-*
-* @param[in] Pst* pst
-* @param[in] SuId suId
-* @param[in] RguDDatIndInfo * datInd
-* @return S16
-* -# ROK
-**/
-S16 RgMacSchCmnBoUpdt(Pst* pst ,RgInfCmnBoRpt* boRpt)
-{
-
- return ((*RgMacSchCmnBoUpdtReqMt[0])(pst, boRpt));
-}
-
-/*Fix: start: Inform UE delete to scheduler*/
-/**
-* @brief This primitive is used to indicate deletion of UE
-* at MAC to scheduler.
-*
-* @details
-*
-* Function : RgMacSchUeDel
-*
-* @param[in] Pst* pst
-* @param[in] RgInfSfDatInd* ueDelInd
-* @return S16
-* -# ROK
-**/
-S16 RgMacSchUeDel(Pst* pst,RgInfUeDelInd* ueDelInd)
-{
-
- return ((*RgMacSchUeDelIndMt[0])(pst, ueDelInd));
-}
-/*Fix: end: Inform UE delete to scheduler*/
-/**
-* @brief Data Indication from MAC to RLC to
- * forward the data received for dedicated channels
-*
-* @details
-*
-* Function : RgMacSchSfRecp
-*
-* @param[in] Pst* pst
-* @param[in] SuId suId
-* @param[in] RguDDatIndInfo * datInd
-* @return S16
-* -# ROK
-**/
-S16 RgMacSchSfRecp(Pst* pst,RgInfSfDatInd* datInd)
-{
-
- return ((*RgMacSchSfRecpIndMt[0])(pst, datInd));
-}
-
-/**
-* @brief Data Indication from MAC to RLC to
- * forward the data received for dedicated channels
-*
-* @details
-*
-* Function : RgSchMacSfAlloc
-*
-* @param[in] Pst* pst
-* @param[in] SuId suId
-* @param[in] RguDDatIndInfo * datInd
-* @return S16
-* -# ROK
-**/
-S16 RgSchMacSfAlloc(Pst* pst,RgInfSfAlloc* resAllocReq)
-{
-
- return ((*RgSchMacSfAllocReqMt[0])(pst, resAllocReq));
-}
-
-/**
-* @brief Trigger for resetting Harq Entity at MAC
-*
-* @details
-*
-* Function : RgSchMacRstHqEnt
-*
-* @param[in] Pst* pst
-* @param[in] RgInfResetHqEnt *hqEntRstReq
-* @return S16
-* -# ROK
-**/
-S16 RgSchMacRstHqEnt(Pst* pst,RgInfResetHqEnt* hqEntInfo)
-{
-
- return ((*RgSchMacRstHqEntReqMt[0])(pst, hqEntInfo));
-}
-
-/**
-* @brief Data Indication from MAC to RLC to
- * forward the data received for dedicated channels
-*
-* @details
-*
-* Function : RgSchMacRlsHq
-*
-* @param[in] Pst* pst
-* @param[in] SuId suId
-* @param[in] RguDDatIndInfo * datInd
-* @return S16
-* -# ROK
-**/
-S16 RgSchMacRlsHq(Pst* pst,RgInfRlsHqInfo* sfHqInfo)
-{
-
- return ((*RgSchMacRlsHqReqMt[0])(pst, sfHqInfo));
-}
-
-/**
-* @brief Data Indication from MAC to RLC to
- * forward the data received for dedicated channels
-*
-* @details
-*
-* Function : RgSchMacRlsRnti
-*
-* @param[in] Pst* pst
-* @param[in] SuId suId
-* @param[in] RguDDatIndInfo * datInd
-* @return S16
-* -# ROK
-**/
-S16 RgSchMacRlsRnti(Pst* pst,RgInfRlsRnti* rlsRnti)
-{
-
- return ((*RgSchMacRlsRntiReqMt[0])(pst, rlsRnti));
-}
-
-/**
-* @brief Request from SCH to MAC to register the GBR LCG of a UE
-*
-* @details
-*
-* Function : RgSchMacLcgReg
-*
-* @param[in] Pst* pst
-* @param[in] RgInfLcgRegReq *lcgRegReq
-* @return S16
-* -# ROK
-**/
-S16 RgSchMacLcgReg(Pst* pst,RgInfLcgRegReq *lcgRegReq)
-{
-
- return ((*RgSchMacLcgRegReqMt[0])(pst, lcgRegReq));
-} /* end of RgSchMacLcgReg */
-
-#ifdef LTEMAC_SPS
-/**
-* @brief Data Indication from MAC to SCH to
- * indicate the arrival of the data on SPS logical channels
-*
-* @details
-*
-* Function : RgMacSchSpsRel
-*
-* @param[in] Pst* pst
-* @param[in] RgInfSpsRelInfo* relInfo
-* @return S16
-* -# ROK
-**/
-S16 RgMacSchSpsRel(Pst* pst,RgInfSpsRelInfo* relInfo)
-{
-
- return ((*RgMacSchSpsRelIndMt[0])(pst, relInfo));
-} /* end of RgMacSchSpsRel */
-
-/**
-* @brief Request from SCH to MAC to register the SPS logical channels of a UE
-*
-* @details
-*
-* Function : RgSchMacSpsLcReg
-*
-* @param[in] Pst* pst
-* @param[in] RgInfSpsLcInfo *lcInfo
-* @return S16
-* -# ROK
-**/
-S16 RgSchMacSpsLcReg(Pst* pst,RgInfSpsLcInfo *lcInfo)
-{
-
- return ((*RgSchMacSpsLcRegReqMt[0])(pst, lcInfo));
-} /* end of RgSchMacSpsLcReg */
-
-
-
-/**
-* @brief Request from SCH to MAC to reset UL SPS params
-*
-* @details
-*
-* Function : RgSchMacUlSpsReset
-*
-* @param[in] Pst* pst
-* @param[in] RgInfUlSpsReset *lcInfo
-* @return S16
-* -# ROK
-**/
-S16 RgSchMacUlSpsReset(Pst* pst,RgInfUlSpsReset *ulSpsResetInfo)
-{
-
- return ((*RgSchMacUlSpsResetMt[0])(pst, ulSpsResetInfo));
-} /* end of RgSchMacUlSpsReset */
-
-
-
-/**
-* @brief Request from SCH to MAC to deregister the SPS logical channels of a UE
-*
-* @details
-*
-* Function : RgSchMacSpsLcDereg
-*
-* @param[in] Pst* pst
-* @param[in] RgInfSpsLcInfo *lcInfo
-* @return S16
-* -# ROK
-**/
-S16 RgSchMacSpsLcDereg(Pst* pst,CmLteCellId cellId,CmLteRnti crnti)
-{
-
- return ((*RgSchMacSpsLcDeregReqMt[0])(pst, cellId, crnti));
-} /* end of RgSchMacSpsLcDereg */
-
-#endif /* LTEMAC_SPS */
-#ifdef LTE_L2_MEAS
-/**
-* @brief Request from SCH to MAC for L2 Measurement
-*
-* @details
-*
-* Function : RgSchMacL2Meas
-*
-* @param[in] Pst* pst
-* @param[in] RgInfL2MeasReq *measInfo
-* @return S16
-* -# ROK
-**/
-S16 RgSchMacL2Meas(Pst* pst,RgInfL2MeasReq *measInfo)
-{
-
- return ((*RgSchMacL2MeasReqMt[0])(pst, measInfo));
-} /* end of RgSchMacL2Meas */
-
-/**
-* @brief Request from SCH to MAC for Stopping L2 Measurement
-*
-* @details
-*
-* Function : RgSchMacL2MeasStop
-*
-* @param[in] Pst* pst
-* @param[in] RgInfL2MeasReq *measInfo
-* @return S16
-* -# ROK
-**/
-S16 RgSchMacL2MeasStop(Pst* pst,RgInfL2MeasStopReq *measInfo)
-{
-
- return ((*RgSchMacL2MeasStopReqMt[0])(pst, measInfo));
-} /* end of RgSchMacL2Meas */
-
-/**
-* @brief Request from SCH to MAC for Sending L2 Measurement
-*
-* @details
-*
-* Function : RgSchMacL2MeasSend
-*
-* @param[in] Pst* pst
-* @param[in] RgInfL2MeasReq *measInfo
-* @return S16
-* -# ROK
-**/
-S16 RgSchMacL2MeasSend(Pst* pst,RgInfL2MeasSndReq *measInfo)
-{
-
- return ((*RgSchMacL2MeasSendReqMt[0])(pst, measInfo));
-} /* end of RgSchMacL2MeasSend */
-
-/**
-* @brief Request from MAC to SCH for L2 Measurement
-*
-* @details
-*
-* Function : RgMacSchL2Meas
-*
-* @param[in] Pst* pst
-* @param[in] RgInfL2MeasCfm *measInfo
-* @return S16
-* -# ROK
-**/
-S16 RgMacSchL2Meas(Pst* pst,RgInfL2MeasCfm *measInfo)
-{
-
- return ((*RgMacSchL2MeasCfmMt[0])(pst, measInfo));
-} /* end of RgSchMacL2Meas */
-/**
-* @brief Request from MAC to SCH for L2 Measurement
-*
-* @details
-*
-* Function : RgMacSchL2MeasStop
-*
-* @param[in] Pst* pst
-* @param[in] RgInfL2MeasCfm *measInfo
-* @return S16
-* -# ROK
-**/
-S16 RgMacSchL2MeasStop(Pst* pst,RgInfL2MeasCfm *measInfo)
-{
-
- return ((*RgMacSchL2MeasStopCfmMt[0])(pst, measInfo));
-} /* end of RgSchMacL2MeasStop*/
-#endif/*LTE_L2_MEAS*/
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for power control functionality
-
- File: rg_sch_pwr.c
-
-**********************************************************************/
-
-/** @file rg_sch_pwr.c
-@brief This module handles schedulers' power control functionality
-*/
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "lrg.h"
-#include "rgr.h"
-#include "rgm.h"
-#include "tfu.h"
-#include "rg_env.h"
-#include "rg_sch_inf.h"
-#include "rg_sch_err.h"
-#include "rg_sch.h"
-#include "rg_sch_cmn.h"
-
-/* header/extern include files (.x) */
-#include "tfu.x" /* RGU types */
-#include "lrg.x" /* layer management typedefs for MAC */
-#include "rgr.x" /* layer management typedefs for MAC */
-#include "rgm.x" /* layer management typedefs for MAC */
-#include "rg_sch_inf.x" /* typedefs for Scheduler */
-#include "rg_sch.x" /* typedefs for Scheduler */
-#include "rg_sch_cmn.x"
-
-
-/* Current specs have 23 dBm as max tx power capability for UEs */
-#define RG_SCH_PWR_UE_MAX_PWR 23
-
-#define RG_SCH_REF_PCMAX 0xFF
-
-#define RG_SCH_CMN_GET_UL_UE(_ue,_cell) (&(((RgSchCmnUe *)((_ue->cellInfo[_ue->cellIdToCellIdxMap\
- [RG_SCH_CELLINDEX(_cell)]])->sch))->ul))
-#define RG_SCH_PWR_GETUEPWR(_ue, _cell) &(((RgSchCmnUe *)((_ue->cellInfo[_ue->cellIdToCellIdxMap\
- [RG_SCH_CELLINDEX(_cell)]])->sch))->ul.ulPwrCb)
-#define RG_SCH_PWR_GETCELLPWR(cell) &((RgSchCmnCell *)((cell)->sc.sch))->ul.ulPwrCb
-
-
-typedef S8 RgSchCmnUlPwrCqiToPwrTbl[RG_SCH_CMN_UL_NUM_CQI];
-
-static RgSchCmnUlPwrCqiToPwrTbl rgSchPwrCqiToPwrTbl;
-
-/* This table maps a given number of RBs (given by array index)
- * to the power in dB that these many RBs map to. */
-const uint8_t rgSchPwrRbToPwrTbl[111] = { 0, /* First entry is dummy */
- 0, 3, 4, 6, 7, 7, 8, 9, 9, 10,
- 10, 10, 11, 11, 11, 12, 12, 12, 12, 13,
- 13, 13, 13, 13, 14, 14, 14, 14, 14, 14,
- 15, 15, 15, 15, 15, 15, 15, 15, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 18, 18, 18, 18, 18, 18, 18, 18, 18,
- 18, 18, 18, 18, 18, 18, 18, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
-};
-
-
-/* This table maps power (in dB) to number of RBs */
-/* The array size comes from max power in rgSchPwrRbToPwrTbl */
-const uint8_t rgSchPwrToRbTbl[20+1] = {
- 1, 1, 2, 2, 3, 4, 5, 6, 7, 9, 11,
- 13, 17, 21, 26, 33, 41, 52, 65, 82, 103
-};
-
-
-
-static S8 rgSCHPwrGetCqiPwr ARGS((
- uint8_t cqi
- ));
-static S8 rgSCHPwrGetCqiPwrForUe ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue,
- uint8_t cqi
- ));
-static S8 rgSCHPwrCalcEfficncyPwr ARGS((
- uint32_t eff
- ));
-static S8 rgSCHPwrGetDelta2FrmCqi ARGS((
- uint8_t crntCqi,
- uint8_t trgCqi,
- RgSchUeCb *ue,
- RgSchCellCb *cell
- ));
-static Void rgSCHPwrGetPuschTpc ARGS((
- uint8_t isAcc,
- S8 delta,
- S8 availPwr,
- uint8_t *tpc,
- S8 *tpcDelta
- ));
-static uint8_t rgSCHPwrGetMaxRb ARGS((
- RgSchCellCb *cell,
- S8 pwr
- ));
-static uint8_t rgSCHPwrRbToPwr ARGS((
- RgSchCellCb *cell,
- uint8_t numRb
- ));
-static Void rgSCHPwrSchedPucchRnti ARGS((
- RgSchCellCb *cell,
- RgSchCmnTpcRntiCb *cb,
- RgSchPdcch *pdcch,
- RgSchDlSf *dlSf,
- Bool *sched
- ));
-static Void rgSCHPwrPuschCntrl ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue
- ));
-static Void rgSCHPwrPucchCntrl ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue
- ));
-static Void rgSCHPwrSchedPuschRnti ARGS((
- RgSchCellCb *cell,
- RgSchCmnTpcRntiCb *cb,
- RgSchPdcch *pdcch,
- RgSchUlSf *ulSf,
- Bool *sched
- ));
-static Void rgSCHPwrGetPucchFmt3TpcForUe ARGS((
- RgSchUeCb *ue,
- uint8_t *tpc,
- S8 *delta
- ));
-static Void rgSCHPwrGetPucchFmt3aTpcForUe ARGS((
- RgSchUeCb *ue,
- uint8_t *tpc,
- S8 *delta
- ));
-static Void rgSCHPwrGetPuschFmt3TpcForUe ARGS((
- RgSchUeCb *ue,
- uint8_t *tpc,
- S8 *delta
- ));
-static Void rgSCHPwrGetPuschFmt3aTpcForUe ARGS((
- RgSchUeCb *ue,
- uint8_t *tpc,
- S8 *delta
- ));
-static Void rgSCHPwrGetAcc1bitTpc ARGS((
- S8 remPwr,
- uint8_t *tpc,
- S8 *delta
- ));
-static Void rgSCHPwrGetAcc2bitTpc ARGS((
- S8 remPwr,
- uint8_t *tpc,
- S8 *delta
- ));
-static Void rgSCHPwrGetAbsTpc ARGS((
- S8 remPwr,
- uint8_t *tpc,
- S8 *delta
- ));
-static Void rgSCHPwrOnPucchGrpPwrForUe ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue,
- S8 delta
- ));
-static Void rgSCHPwrOnPuschGrpPwrForUe ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue,
- S8 delta
- ));
-static Bool rgSCHPwrIsDlUeSched ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue,
- RgSchDlSf *sf
- ));
-static Bool rgSCHPwrIsUlUeSched ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue,
- RgSchUlSf *sf
- ));
-static Void rgSCHPwrOnSchedPucchTpc ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue,
- S8 delta
- ));
-static Void rgSCHPwrOnSchedPuschTpc ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue
- ));
-static S16 rgSCHPwrApplyUePwrCfg ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue,
- RgrUeUlPwrCfg *pwrCfg
- ));
-static Void rgSCHPwrUeResetPucch ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue
- ));
-static Void rgSCHPwrUeResetPusch ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue
- ));
-static Void rgSCHPwrOnPuschPwrUpd ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ue
- ));
-static Void rgSCHPwrAddRntiToPucchRntiLst ARGS((
- RgSchCellCb *cell,
- CmLteRnti rnti,
- Bool isFmt3a
- ));
-static Void rgSCHPwrAddRntiToPuschRntiLst ARGS((
- RgSchCellCb *cell,
- CmLteRnti rnti,
- Bool isFmt3a
- ));
-static Void rgSCHPwrInitTpcRntiCb ARGS((
- RgSchCmnTpcRntiCb *cb,
- CmLteRnti rnti,
- Bool isFmt3a
- ));
-static RgSchCmnTpcRntiCb* rgSCHPwrGetPucchRntiCb ARGS((
- RgSchCellCb *cell,
- CmLteRnti tpcRnti
- ));
-static RgSchCmnTpcRntiCb* rgSCHPwrGetPuschRntiCb ARGS((
- RgSchCellCb *cell,
- CmLteRnti tpcRnti
- ));
-static Void rgSCHPwrAddUeToPucchTpcRntiCb ARGS((
- RgSchCellCb *cell,
- RgSchCmnTpcRntiCb *cb,
- RgSchUeCb *ue
- ));
-static Void rgSCHPwrDelUeFrmPucchTpcRntiCb ARGS((
- RgSchCellCb *cell,
- RgSchCmnTpcRntiCb *cb,
- RgSchUeCb *ue
- ));
-static Void rgSCHPwrRmvSchdUeFrmPucchTpcRntiCb ARGS((
- RgSchCellCb *cell,
- RgSchCmnTpcRntiCb *cb,
- RgSchUeCb *ue
- ));
-static Void rgSCHPwrRmvSchdUeOnlyFrmPucchTpcRntiCb ARGS((
- RgSchCellCb *cell,
- RgSchCmnTpcRntiCb *cb,
- RgSchUeCb *ue
- ));
-static Void rgSCHPwrRmvSchdPucchTpcRntiCb ARGS((
- RgSchCellCb *cell,
- RgSchCmnTpcRntiCb *cb
- ));
-static Void rgSCHPwrAddSchdUeToPucchTpcRntiCb ARGS((
- RgSchCellCb *cell,
- RgSchCmnTpcRntiCb *cb,
- RgSchUeCb *ue
- ));
-static Void rgSCHPwrAddSchdPucchTpcRntiCb ARGS((
- RgSchCellCb *cell,
- RgSchCmnTpcRntiCb *cb
- ));
-static Void rgSCHPwrAddUeToPuschTpcRntiCb ARGS((
- RgSchCmnTpcRntiCb *cb,
- RgSchUeCb *ue
- ));
-static Void rgSCHPwrAddSchdUeToPuschTpcRntiCb ARGS((
- RgSchCellCb *cell,
- RgSchCmnTpcRntiCb *cb,
- RgSchUeCb *ue
- ));
-static Void rgSCHPwrDelUeFrmPuschTpcRntiCb ARGS((
- RgSchCellCb *cell,
- RgSchCmnTpcRntiCb *cb,
- RgSchUeCb *ue
- ));
-static Void rgSCHPwrRmvSchdUeFrmPuschTpcRntiCb ARGS((
- RgSchCellCb *cell,
- RgSchCmnTpcRntiCb *cb,
- RgSchUeCb *ue
- ));
-static Void rgSCHPwrRmvSchdUeOnlyFrmPuschTpcRntiCb ARGS((
- RgSchCellCb *cell,
- RgSchCmnTpcRntiCb *cb,
- RgSchUeCb *ue
- ));
-static Void rgSCHPwrAddSchdPuschTpcRntiCb ARGS((
- RgSchCellCb *cell,
- RgSchCmnTpcRntiCb *cb
- ));
-static Void rgSCHPwrRmvSchdPuschTpcRntiCb ARGS((
- RgSchCellCb *cell,
- RgSchCmnTpcRntiCb *cb
- ));
-static S16 rgSCHPwrChkPucchTpcRntiIdx ARGS((
- RgSchCmnTpcRntiCb *cb,
- uint8_t idx
- ));
-static S16 rgSCHPwrChkPuschTpcRntiIdx ARGS((
- RgSchCmnTpcRntiCb *cb,
- uint8_t idx
- ));
-static S16 rgSCHPwrChkUniqPucchTpcRntiIdx ARGS((
- RgSchCmnTpcRntiCb *cb,
- uint8_t idx
- ));
-static S16 rgSCHPwrChkUniqPuschTpcRntiIdx ARGS((
- RgSchCmnTpcRntiCb *cb,
- uint8_t idx
- ));
-static S16 rgSCHPwrChkTpcRntiIdx ARGS((
- RgSchCmnTpcRntiCb *cb,
- uint8_t idx
- ));
-static S8 rgSCHPwrGetPhValFromPhr ARGS((
- uint8_t phr
- ));
-static S8 rgSCHPwrGetPCMaxValFromPCMax ARGS((
- uint8_t pCMax
- ));
-
-/* local defines */
-
-
-/**
- * @brief Does power related initialisation (not cell specific).
- *
- *
- * @details
- *
- * Function : rgSCHPwrInit
- *
- * Processing Steps:
- * - This shall precompute coding efficiency to power
- * mappings (assuming beta of 1).
- *
- * @return Void
- **/
-Void rgSCHPwrInit()
-{
- uint8_t idx;
-
- rgSchPwrCqiToPwrTbl[0] = 0; /* This should never be used anyway */
- for (idx = 1; idx < RG_SCH_CMN_UL_NUM_CQI; ++idx)
- {
- rgSchPwrCqiToPwrTbl[idx] = rgSCHPwrCalcEfficncyPwr(rgSchCmnUlCqiTbl[idx].eff);
- }
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrGetCqiPwr
- *
- * Desc : Returns power corresponding to coding efficiency
- * when beta pusch is assumed 1.
- *
- * Ret : uint8_t
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S8 rgSCHPwrGetCqiPwr(uint8_t cqi)
-{
-
- return (rgSchPwrCqiToPwrTbl[cqi]);
-} /* rgSCHPwrGetCqiPwr */
-
-/***********************************************************
- *
- * Func : rgSCHPwrGetCqiPwrForUe
- *
- * Desc : If MCS control is enabled for UE, returns
- * power corresponding to CQI, else 0.
- *
- * Ret : uint8_t
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S8 rgSCHPwrGetCqiPwrForUe(RgSchCellCb *cell,RgSchUeCb *ue,uint8_t cqi)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, cell);
-
- if (!uePwr->deltaMcsEnbld)
- {
- return (0);
- }
- return (rgSCHPwrGetCqiPwr(cqi));
-} /* rgSCHPwrGetCqiPwrForUe */
-
-/***********************************************************
- *
- * Func : rgSCHPwrCalcEfficncyPwr
- *
- * Desc : Computes power corresponding to a coding
- * efficiency.
- *
- * Ret : uint8_t
- *
- * Notes: Assumes beta pusch to be 1
- *
- * File :
- *
- **********************************************************/
-static S8 rgSCHPwrCalcEfficncyPwr(uint32_t eff)
-{
- F64 ks = 1.25; /* or F64 */
- F64 tmp = cmPow(2, ks*eff/1024) - 1;
-
- if (tmp <= 0)
- return (0);
- return ((S8)(10 * cmLog10(tmp)));
-} /* rgSCHPwrCalcEfficncyPwr */
-
-
-/**
- * @brief Returns TPC to be sent in UL allocation
- *
- * @details
- *
- * Function : rgSCHPwrPuschTpcForUe
- *
- * Invoking Module Processing:
- * - After allocation for UE, this function shall
- * be invoked to retrieve TPC.
- * - This assumes that rgSCHPwrGetMaxUlRb() was
- * invoked prior to final allocation for UE.
- *
- * Processing Steps:
- * - Just return TPC that was determined
- * earlier.
- * - After this, do necessary updates.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return uint8_t
- **/
-uint8_t rgSCHPwrPuschTpcForUe(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue,cell);
-
- UNUSED(cell);
-
- rgSCHPwrOnSchedPuschTpc(cell, ue);
- return (uePwr->puschTpc);
-}
-
-/**
- * @brief Handles Pusch power control for DCI format 0
- *
- * @details
- *
- * Function : rgSCHPwrGetMaxUlRb
- *
- * Invoking Module Processing:
- * - This shall be invoked to determine maximum
- * number of UL RBs for scheduling.
- * - This is expected to be invoked every time
- * priority to attempt at UE allocation. Later
- * TPC retrieval depends on it.
- *
- * Processing Steps:
- * - Returns maximum allowed UL RBs to be granted
- * after invoking Pusch power control.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-uint8_t rgSCHPwrGetMaxUlRb(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, cell);
-
- rgSCHPwrPuschCntrl(cell, ue); /* This stores tpc, delta and maxRb
- * in uePwr */
- return (uePwr->maxUlRbs);
-}
-
-/**
- * @brief Handles Pusch power control for DCI format 0
- *
- * @details
- *
- * Function : rgSCHPwrPuschCntrl
- *
- * Invoking Module Processing:
- * - This shall be invoked to determine TPC
- * and maximum number of UL RBs for scheduling
- * (through DCI format 0).
- *
- * Processing Steps:
- * - 'remPuschPwr' is the final delta power that the UE
- * should apply to get to target CQI.
- * - The available headroom (availPwr) is determined.
- * - Power command is given by considering remPuschPwr and
- * availPwr.
- * - After factoring in the power command into availPwr, the
- * maximum number of RBs that can be supported is determined
- * assuming that UE is going to use transmission efficiency
- * corresponding to current CQI.
- * - The results determined in this function are stored
- * in the UE power control block.
- * - [Not doing anything of power control of msg3
- * retransmissions now]
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-static Void rgSCHPwrPuschCntrl(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell);
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, cell);
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- S8 delta;
-#ifdef TFU_UPGRADE
- uint8_t cqi = ueUl->validUlCqi;
- S32 tmp;
-#else
- uint8_t cqi = ueUl->crntUlCqi[0];
-#endif
- Bool isAcc = uePwr->isAccumulated;
- uint8_t tpc;
- S8 availPwr;
- uint8_t maxRb;
-
- UNUSED(cell);
-
- if (!uePwr->isPhrAvail)
- {
- availPwr = 60; /* setting a large value so that availPwr does
- * not constrain delta */
- }
- else
- {
- availPwr = uePwr->maxUePwr - uePwr->pwrPerRb;
- availPwr -= rgSCHPwrGetCqiPwrForUe(cell, ue, cqi);
- }
- delta = uePwr->remPuschPwr;
- rgSCHPwrGetPuschTpc(isAcc, delta, availPwr, &tpc, &delta);
- availPwr -= delta;
-
- maxRb = rgSCHPwrGetMaxRb(cell,availPwr);
-
- /* Store the results in ue power control block to be used later */
- if(maxRb < cellUl->sbSize)
- {
- maxRb = cellUl->sbSize;
-#ifdef TFU_UPGRADE
- if(uePwr->maxPwrDeltaByPhr < 0)
- {
- tmp = ueUl->validUlCqi;
- tmp = tmp + uePwr->maxPwrDeltaByPhr;
- if (tmp < 1 )
- {
- ueUl->validUlCqi = 1;
- }
- else
- {
- ueUl->validUlCqi = tmp;
- }
- }
-#endif
- }
- DU_LOG("\nDEBUG --> SCH : UEID:%d Output Max Rb (%d), phVal (%d) AvailPwr (%d) ",
- ue->ueId, maxRb, uePwr->phVal, availPwr);
- DU_LOG("\nDEBUG --> SCH : UEID:%d pwrPerRb %d remPuschPwr %d",
- ue->ueId,
- uePwr->pwrPerRb,
- uePwr->remPuschPwr);
- uePwr->delta = delta;
- uePwr->maxUlRbs = maxRb;
- uePwr->puschTpc = tpc;
- return;
-}
-
-/**
- * @brief Returns TPC to be sent in DL allocation
- *
- * @details
- *
- * Function : rgSCHPwrPucchTpcForUe
- *
- * Invoking Module Processing:
- * - After DL allocation for UE, this function shall
- * be invoked to obtain TPC.
- *
- * Processing Steps:
- * - Do Pucch power control processing
- * and return TPC
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return uint8_t
- **/
-uint8_t rgSCHPwrPucchTpcForUe(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, cell);
-
- rgSCHPwrPucchCntrl(cell, ue);
- return (uePwr->pucchTpc);
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrGetDelta2FrmCqi
- *
- * Desc : Get power to be applied to achieve
- * target CQI (the power returned is
- * twice is actual power)
- *
- * Ret : S8
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S8 rgSCHPwrGetDelta2FrmCqi(uint8_t crntCqi,uint8_t trgCqi,RgSchUeCb *ue,RgSchCellCb *cell)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, cell);
-
- if (uePwr->isPhrAvail)
- {
- //uePwr->maxPwrDeltaByPhr = uePwr->maxPwrPerRb - uePwr->pwrPerRb - uePwr->remPuschPwr;
- uePwr->maxPwrDeltaByPhr = uePwr->maxPwrPerRb - uePwr->pwrPerRb;
- }
- else
- {
- uePwr->maxPwrDeltaByPhr = 0;
- }
-
- if (uePwr->maxPwrDeltaByPhr < 0 && (trgCqi - crntCqi) *
- RG_SCH_UL_CQI_DB_STEP_2 > 0)
- {
- return (0);
- }
- return (RGSCH_MIN(uePwr->maxPwrDeltaByPhr,
- (trgCqi - crntCqi) * RG_SCH_UL_CQI_DB_STEP_2));
-} /* rgSCHPwrGetDelta2FrmCqi */
-
-/***********************************************************
- *
- * Func : rgSCHPwrGetPuschTpc
- *
- * Desc : Based on whether accumulation is enabled or
- * not, this returns an applicable power delta
- * to be applied based on the input delta.
- *
- * Ret : S8
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrGetPuschTpc(uint8_t isAcc,S8 delta,S8 availPwr,uint8_t *tpc,S8 *tpcDelta)
-{
-
- delta = RGSCH_MIN(delta, availPwr);
-
- /* As of now, the functions below possibly cause delta
- * to be breached by 1 only. So calling these as is. */
- if (isAcc)
- {
- rgSCHPwrGetAcc2bitTpc(delta, tpc, tpcDelta);
- }
- else
- {
- rgSCHPwrGetAbsTpc(delta, tpc, tpcDelta);
- }
- return;
-} /* rgSCHPwrGetPuschTpc */
-
-/***********************************************************
- *
- * Func : rgSCHPwrGetMaxRb
- *
- * Desc : Get the maximum number of RBs that can be
- * expected to be supported by the passed
- * power headroom.
- *
- * Ret : uint8_t
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static uint8_t rgSCHPwrGetMaxRb(RgSchCellCb *cell,S8 pwr)
-{
- RgSchCmnUlCell *cellUl;
-
- cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- if (pwr <= 0)
- {
- /* Give 4 RBS so that UE can report changed power status*/
- /* [ccpu00119916] Mod -return 0th index of rgSchPwrToRbTbl when pwr <=0
- * Change the Macros from RGSCH_MAX_DL_BW to RGSCH_MAX_UL_BW*/
- return (rgSchPwrToRbTbl[0]);
- }
- if (pwr > rgSchPwrRbToPwrTbl[cellUl->maxUlBwPerUe])
- {
- return (cellUl->maxUlBwPerUe);
- }
- return (RGSCH_MIN(cellUl->maxUlBwPerUe,rgSchPwrToRbTbl[(uint8_t)pwr]));
-} /* rgSCHPwrGetMaxRb */
-
-/***********************************************************
- *
- * Func : rgSCHPwrRbToPwr
- *
- * Desc : Get the power corresponding to number of RBs
- *
- * Ret : uint8_t
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static uint8_t rgSCHPwrRbToPwr(RgSchCellCb *cell,uint8_t numRb)
-{
-#ifndef NO_ERRCLS
- RgSchCmnUlCell *cellUl;
-#endif
-#if (ERRCLASS & ERRCLS_DEBUG)
- cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- if (numRb > cellUl->maxUlBwPerUe)
- {
- numRb = cellUl->maxUlBwPerUe;
- }
-#endif
- return (rgSchPwrRbToPwrTbl[numRb]);
-} /* rgSCHPwrRbToPwr */
-
-
-/**
- * @brief Handles Pucch power control for DCI formats 1A/1B/1D/1/2A/2
- *
- * @details
- *
- * Function : rgSCHPwrPucchCntrl
- *
- * Processing Steps:
- * - Determine 2 bit TPC to be sent using remPucchPwr.
- * - Update remPucchPwr appropriately
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-static Void rgSCHPwrPucchCntrl(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- S8 delta;
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, cell);
-
- rgSCHPwrGetAcc2bitTpc(uePwr->remPucchPwr, &uePwr->pucchTpc, &delta);
- rgSCHPwrOnSchedPucchTpc(cell, ue, delta);
- return;
-}
-
-/**
- * @brief Handles group power control for DCI formats 3/3A for Pucch and Pusch
- *
- * @details
- *
- * Function : rgSCHPwrGrpCntrlPucch
- *
- * Invoking Module Processing:
- * - This shall be invoked to do group power control for
- * all TPC RNTIs for which it is deemed necessary to
- * do the same (group power control).
- * - This function should only be invoked after all UEs
- * have been scheduled for uplink (re)transmissions
- * requiring DL DCI format in the passed subframe.
- *
- * Processing Steps:
- * - For Pucch group power control
- * - For each TPC-Pucch-RNTI in the pucchGrpPwr List and
- * TPC-Pusch-RNTI in the puschGrpPwr List,
- * - Request for PDCCH, skip if not available
- * - Form DCI format 3/3A information depending
- * on the format type of the TPC-RNTI and add it to the sub-frame.
- * - For each Ue in ueLst of TPC RNTI Cb
- * - if (fmtType == 3A)
- * - if((Ue not scheduled DL dci formats)
- * && (remPwr >= 2 || remPwr <= -2))
- * - Determine TPC. Set puschTpc/pucchTpc.
- * - remPwr -= TPC
- * - if (remPwr >= -1 && remPwr <= 1)
- * - If already added, remove from toBeSchdLst
- * - else
- * - Toggle the remainig power value
- * - else if (fmtType == 3)
- * - if((Ue not scheduled DL dci formats)
- * && (remPwr))
- * - Determine TPC. Set puschTpc/pucchTpc.
- * - remPwr -= TPC
- * - if (!remPwr)
- * - If already added, remove from toBeSchdLst
- * - if (!toBeSchdUeCnt)
- * - Remove the tpcRntiCb frm pucchGrpPwr/puschGrpPwr List
- * - else, Move the tpcRntiCb to end of the list (not doing
- * this)
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *dlSf
- * @return Void
- **/
-Void rgSCHPwrGrpCntrlPucch(RgSchCellCb *cell,RgSchDlSf *dlSf)
-{
- RgSchCmnUlPwrCb *cellPwr = RG_SCH_PWR_GETCELLPWR(cell);
- CmLListCp *lst;
- CmLList *lnk;
- RgSchPdcch *pdcch;
-
- lst = &cellPwr->pucchGrpPwr;
- lnk = lst->first;
- while (lnk && ((pdcch = rgSCHCmnCmnPdcchAlloc(cell, dlSf)) != NULLP))
- {
- RgSchCmnTpcRntiCb *cb = (RgSchCmnTpcRntiCb *)lnk->node;
- Bool sched;
- lnk = lnk->next;
- rgSCHPwrSchedPucchRnti(cell, cb, pdcch, dlSf, &sched);
- if (!sched)
- {
- rgSCHUtlPdcchPut(cell, &dlSf->pdcchInfo, pdcch);
- }
- /* TPC RNTI would not have been removed if needs to
- * be scheduled again */
- }
-
- return;
-}
-
-/**
- * @brief Handles group power control for DCI formats 3/3A for Pusch and Pusch
- *
- * @details
- *
- * Function : rgSCHPwrGrpCntrlPusch
- *
- * Invoking Module Processing:
- * - This shall be invoked to do group power control for
- * all TPC RNTIs for which it is deemed necessary to
- * do the same (group power control).
- * - This function should only be invoked after all UEs
- * have been scheduled for uplink (re)transmissions
- * requiring DCI format 0 in the passed subframe.
- *
- * Processing Steps:
- * - For Pusch group power control
- * - For each TPC-Pusch-RNTI in the puschGrpPwr List and
- * - Request for PDCCH, skip if not available
- * - Form DCI format 3/3A information depending
- * on the format type of the TPC-RNTI and add it to the sub-frame.
- * - For each Ue in ueLst of TPC RNTI Cb
- * - if (fmtType == 3A)
- * - if (Ue not scheduled for dci format 0) and
- * (remPwr >= 2 || remPwr <= -2))
- * - Determine TPC. Set puschTpc/puschTpc.
- * - remPwr -= TPC
- * - if (remPwr >= -1 && remPwr <= 1)
- * - If already added, remove from toBeSchdLst
- * - else
- * - Toggle the remainig power value
- * - else if (fmtType == 3)
- * - if((Ue not scheduled for dci format 0) && (remPwr))
- * - Determine TPC. Set puschTpc.
- * - remPwr -= TPC
- * - if (!remPwr)
- * - If already added, remove from toBeSchdLst
- * - if (!toBeSchdUeCnt)
- * - Remove the tpcRntiCb frm puschGrpPwr/puschGrpPwr List
- * - else, Move the tpcRntiCb to end of the list (not doing
- * this now)
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *sf
- * @return Void
- **/
-Void rgSCHPwrGrpCntrlPusch(RgSchCellCb *cell,RgSchDlSf *dlSf,RgSchUlSf *ulSf)
-{
- RgSchCmnUlPwrCb *cellPwr = RG_SCH_PWR_GETCELLPWR(cell);
- CmLListCp *lst;
- CmLList *lnk;
- RgSchPdcch *pdcch;
-
- lst = &cellPwr->puschGrpPwr;
- lnk = lst->first;
- while (lnk && ((pdcch = rgSCHCmnCmnPdcchAlloc(cell, dlSf)) != NULLP))
- {
- RgSchCmnTpcRntiCb *cb = (RgSchCmnTpcRntiCb *)lnk->node;
- Bool sched;
- lnk = lnk->next;
- rgSCHPwrSchedPuschRnti(cell, cb, pdcch, ulSf, &sched);
- if (!sched)
- {
- rgSCHUtlPdcchPut(cell, &dlSf->pdcchInfo, pdcch);
- }
- /* TPC RNTI would not have been removed if needs to
- * be scheduled again */
- }
-
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrSchedPucchRnti
- *
- * Desc : Schedule TPC RNTI to be sent out
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrSchedPucchRnti(RgSchCellCb *cell,RgSchCmnTpcRntiCb *cb,RgSchPdcch *pdcch,RgSchDlSf *dlSf,Bool *sched)
-{
- CmLListCp *lst;
- CmLList *lnk;
- uint8_t *tpcCmds;
- uint8_t tpc;
- S8 delta;
- Bool atleastOne;
-
- pdcch->rnti = cb->tpcRnti;
-
- if (cb->isFmt3a)
- {
- /* Go through all UEs for format 3A case */
- lst = &cb->cfgdUes;
- pdcch->dci.dciFormat = TFU_DCI_FORMAT_3A;
- pdcch->dciNumOfBits = cell->dciSize.size[TFU_DCI_FORMAT_3A];
- pdcch->dci.u.format3AInfo.isPucch = TRUE;
-
- tpcCmds = pdcch->dci.u.format3AInfo.tpcCmd;
- /* No need to memset zero initially as every TPC is going
- * to be filled up for every configured UE */
- for (atleastOne = FALSE, lnk = lst->first; lnk; lnk = lnk->next)
- {
- RgSchUeCb *ue = (RgSchUeCb *)lnk->node;
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, cell);
-
- if ( ue->isDrxEnabled == TRUE &&
- !RG_SCH_DRX_DL_IS_UE_ACTIVE(ue->drxCb))
- {
- /* UE is in its DRX time. So we cannot give command
- * to this UE.
- */
- continue;
- }
-
- if (rgSCHPwrIsDlUeSched(cell, ue, dlSf))
- {
- /* UE already scheduled in downlink with PDCCH
- * carrying PUCCH pwr cmd. So don't care about
- * giving command to this UE. */
- continue;
- }
- rgSCHPwrGetPucchFmt3aTpcForUe(ue, &tpc, &delta);
- tpcCmds[uePwr->pucchIdx] = tpc;
- atleastOne = TRUE;
- rgSCHPwrOnPucchGrpPwrForUe(cell, ue, delta);
- }
- }
- else
- {
- /* Go through to-be-scheduled UEs for format 3 case */
- lst = &cb->toBeSchdUes;
- pdcch->dci.dciFormat = TFU_DCI_FORMAT_3;
- pdcch->dciNumOfBits = cell->dciSize.size[TFU_DCI_FORMAT_3];
- tpcCmds = pdcch->dci.u.format3Info.tpcCmd;
- pdcch->dci.u.format3Info.isPucch = TRUE;
-
- /* Fill TPC 1 (corresponding to no power change) initially */
- memset(tpcCmds, 1, sizeof(pdcch->dci.u.format3Info.tpcCmd));
-
- for (atleastOne = FALSE, lnk = lst->first; lnk; lnk = lnk->next)
- {
- RgSchUeCb *ue = (RgSchUeCb *)lnk->node;
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, cell);
-
- if ( ue->isDrxEnabled == TRUE &&
- !RG_SCH_DRX_DL_IS_UE_ACTIVE(ue->drxCb))
- {
- /* UE is in its DRX time. So we cannot give command
- * to this UE.
- */
- continue;
- }
-
- if (rgSCHPwrIsDlUeSched(cell, ue, dlSf))
- {
- /* UE already scheduled in downlink with PDCCH
- * carrying PUCCH pwr cmd. So don't care about
- * giving command to this UE. */
- continue;
- }
- rgSCHPwrGetPucchFmt3TpcForUe(ue, &tpc, &delta);
- tpcCmds[uePwr->pucchIdx] = tpc;
- atleastOne = TRUE;
- rgSCHPwrOnPucchGrpPwrForUe(cell, ue, delta);
- }
- }
-
- *sched = atleastOne;
-
- /* Check if no more UEs in TPC RNTI, and then remove
- * this TPC RNTI from scheduled list */
- if (cb->toBeSchdUes.count == 0)
- {
- rgSCHPwrRmvSchdPucchTpcRntiCb(cell, cb);
- }
-
- return;
-} /* rgSCHPwrSchedPucchRnti */
-
-/***********************************************************
- *
- * Func : rgSCHPwrSchedPuschRnti
- *
- * Desc : Schedule TPC RNTI to be sent out
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrSchedPuschRnti(RgSchCellCb *cell,RgSchCmnTpcRntiCb *cb,RgSchPdcch *pdcch,RgSchUlSf *ulSf,Bool *sched)
-{
- CmLListCp *lst;
- CmLList *lnk;
- uint8_t *tpcCmds;
- uint8_t tpc;
- S8 delta;
- Bool atleastOne;
-
- pdcch->rnti = cb->tpcRnti;
-
- if (cb->isFmt3a)
- {
- /* Go through all UEs for format 3A case */
- lst = &cb->cfgdUes;
- pdcch->dci.dciFormat = TFU_DCI_FORMAT_3A;
- pdcch->dciNumOfBits = cell->dciSize.size[TFU_DCI_FORMAT_3A];
- pdcch->dci.u.format3AInfo.isPucch = FALSE;
- tpcCmds = pdcch->dci.u.format3AInfo.tpcCmd;
- /* No need to memset zero initially as every TPC is going
- * to be filled up for every configured UE */
- for (atleastOne = FALSE, lnk = lst->first; lnk; lnk = lnk->next)
- {
- RgSchUeCb *ue = (RgSchUeCb *)lnk->node;
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, cell);
- if (rgSCHPwrIsUlUeSched(cell, ue, ulSf))
- {
- /* UE already scheduled in uplink with DCI
- * format 0. So don't care about giving
- * command to this UE. */
- continue;
- }
-
- if ( ue->isDrxEnabled == TRUE &&
- !RG_SCH_DRX_DL_IS_UE_ACTIVE(ue->drxCb))
- {
- /* UE is in its DRX time. So we cannot give command
- * to this UE.
- */
- continue;
- }
-
- rgSCHPwrGetPuschFmt3aTpcForUe(ue, &tpc, &delta);
- tpcCmds[uePwr->puschIdx] = tpc;
- atleastOne = TRUE;
- rgSCHPwrOnPuschGrpPwrForUe(cell, ue, delta);
- }
- }
- else
- {
- /* Go through to-be-scheduled UEs for format 3 case */
- lst = &cb->toBeSchdUes;
- pdcch->dci.dciFormat = TFU_DCI_FORMAT_3;
- pdcch->dciNumOfBits = cell->dciSize.size[TFU_DCI_FORMAT_3];
- pdcch->dci.u.format3Info.isPucch = FALSE;
- tpcCmds = pdcch->dci.u.format3Info.tpcCmd;
-
- /* Fill TPC 1 (corresponding to no power change) initially */
- memset(tpcCmds, 1, sizeof(pdcch->dci.u.format3Info.tpcCmd));
-
- for (atleastOne = FALSE, lnk = lst->first; lnk; lnk = lnk->next)
- {
- RgSchUeCb *ue = (RgSchUeCb *)lnk->node;
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, cell);
- if (rgSCHPwrIsUlUeSched(cell, ue, ulSf))
- {
- /* UE already scheduled in uplink with DCI
- * format 0. So don't care about giving
- * command to this UE. */
- continue;
- }
-
- if ( ue->isDrxEnabled == TRUE &&
- !RG_SCH_DRX_DL_IS_UE_ACTIVE(ue->drxCb))
- {
- /* UE is in its DRX time. So we cannot give command
- * to this UE.
- */
- continue;
- }
-
- rgSCHPwrGetPuschFmt3TpcForUe(ue, &tpc, &delta);
- tpcCmds[uePwr->puschIdx] = tpc;
- atleastOne = TRUE;
- rgSCHPwrOnPuschGrpPwrForUe(cell, ue, delta);
- }
- }
-
- *sched = atleastOne;
-
- /* Check if no more UEs in TPC RNTI, and then remove
- * this TPC RNTI from scheduled list */
- if (cb->toBeSchdUes.count == 0)
- {
- rgSCHPwrRmvSchdPuschTpcRntiCb(cell, cb);
- }
-
- return;
-} /* rgSCHPwrSchedPuschRnti */
-
-/***********************************************************
- *
- * Func : rgSCHPwrGetPucchFmt3TpcForUe
- *
- * Desc : Gets 2 bit TPC cmd for PUCCH
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrGetPucchFmt3TpcForUe(RgSchUeCb *ue,uint8_t *tpc,S8 *delta)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, ue->cell);
-
- rgSCHPwrGetAcc2bitTpc(uePwr->remPucchPwr, tpc, delta);
- return;
-} /* rgSCHPwrGetPucchFmt3TpcForUe */
-
-/***********************************************************
- *
- * Func : rgSCHPwrGetPucchFmt3aTpcForUe
- *
- * Desc : Gets 1 bit TPC cmd for PUCCH
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrGetPucchFmt3aTpcForUe(RgSchUeCb *ue,uint8_t *tpc,S8 *delta)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, ue->cell);
-
- rgSCHPwrGetAcc1bitTpc(uePwr->remPucchPwr, tpc, delta);
- return;
-} /* rgSCHPwrGetPucchFmt3aTpcForUe */
-
-/***********************************************************
- *
- * Func : rgSCHPwrGetPuschFmt3TpcForUe
- *
- * Desc : Gets 2 bit TPC cmd for PUCCH
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrGetPuschFmt3TpcForUe(RgSchUeCb *ue,uint8_t *tpc,S8 *delta)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, ue->cell);
- S8 adj = RGSCH_MIN(uePwr->remPuschPwr, uePwr->phVal);
-
- rgSCHPwrGetAcc2bitTpc(adj, tpc, delta);
- return;
-} /* rgSCHPwrGetPuschFmt3TpcForUe */
-
-/***********************************************************
- *
- * Func : rgSCHPwrGetPuschFmt3aTpcForUe
- *
- * Desc : Gets 1 bit TPC cmd for PUCCH
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrGetPuschFmt3aTpcForUe(RgSchUeCb *ue,uint8_t *tpc,S8 *delta)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, ue->cell);
-
- /* Don't attempt to look at headroom now, power
- * adjustment is small anyway */
- rgSCHPwrGetAcc1bitTpc(uePwr->remPuschPwr, tpc, delta);
- return;
-} /* rgSCHPwrGetPuschFmt3aTpcForUe */
-
-/***********************************************************
- *
- * Func : rgSCHPwrGetAcc1bitTpc
- *
- * Desc : Gets 1 bit TPC cmd
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrGetAcc1bitTpc(S8 remPwr,uint8_t *tpc,S8 *delta)
-{
- /*
- * TPC delta
- * 0 -1
- * 1 1
- */
- if (remPwr <= 0)
- {
- *delta = -1;
- *tpc = 0;
- }
- else
- {
- *delta = 1;
- *tpc = 1;
- }
- return;
-} /* rgSCHPwrGetAcc1bitTpc */
-
-/***********************************************************
- *
- * Func : rgSCHPwrGetAcc2bitTpc
- *
- * Desc : Allocate PDCCH for group power control
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrGetAcc2bitTpc(S8 remPwr,uint8_t *tpc,S8 *delta)
-{
- /*
- * TPC delta
- * 0 -1
- * 1 0
- * 2 1
- * 3 3
- */
- uint8_t tpcs[3] = {1, 2, 2};
- uint8_t deltas[3] = {0, 1, 1};
- if (remPwr <= -1)
- {
- *tpc = 0;
- *delta = -1;
- }
- else if (remPwr >= 3)
- {
- *tpc = 3;
- *delta = 3;
- }
- else
- {
- *tpc = tpcs[(uint8_t)remPwr];
- *delta = deltas[(uint8_t)remPwr];
- }
- return;
-} /* rgSCHPwrGetAcc2bitTpc */
-
-/***********************************************************
- *
- * Func : rgSCHPwrGetAbsTpc
- *
- * Desc : Allocate PDCCH for group power control
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrGetAbsTpc(S8 remPwr,uint8_t *tpc,S8 *delta)
-{
- /*
- * TPC delta
- * 0 -4
- * 1 -1
- * 2 1
- * 3 4
- */
- if (remPwr <= -3)
- {
- *tpc = 0;
- *delta = -4;
- }
- else if (remPwr < 1)
- {
- *tpc = 1;
- *delta = -1;
- }
- else if (remPwr < 4)
- {
- *tpc = 2;
- *delta = 1;
- }
- else
- {
- *tpc = 3;
- *delta = 4;
- }
- return;
-} /* rgSCHPwrGetAbsTpc */
-
-/***********************************************************
- *
- * Func : rgSCHPwrOnPucchGrpPwrForUe
- *
- * Desc : Processing on sending TPC for UE through group power
- * control. Apart from updating remPwr, this only takes
- * care of possibly removing UE from scheduled
- * list in TPC RNTI.
- * It does not take care of possibly removing TPC RNTI
- * from scheduled list in cell. This is done
- * in the caller after TPC for all UEs has been
- * determined. (This is where it differs
- * from the usual OnSendingPu[cs]ch TPC]
- *
- * Ret : ROK/RFAILED
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrOnPucchGrpPwrForUe(RgSchCellCb *cell,RgSchUeCb *ue,S8 delta)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, ue->cell);
- Bool rmvUe = FALSE;
-
- UNUSED(cell);
-
- uePwr->remPucchPwr -= delta;
-
- /* UE was already scheduled for PUCCH group power
- * control which is why we came here. Don't
- * again check for this. */
-
- /* UE was scheduled for pucch grp pwr, sent TPC may
- * possibly cause it to be removed. */
- if (!uePwr->remPucchPwr)
- {
- rmvUe = TRUE;
- }
- if (rmvUe)
- {
- rgSCHPwrRmvSchdUeOnlyFrmPucchTpcRntiCb(cell, uePwr->tpcPucchRntiCb, ue);
- /* Not removing TPC RNTI from scheduled list,
- * this will happen in the caller once this
- * function is called for every UE scheduled. */
- }
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrOnPuschGrpPwrForUe
- *
- * Desc : Processing on sending TPC for UE through group power
- * control. Apart from updating remPwr, this only takes
- * care of possibly removing UE from scheduled
- * list in TPC RNTI.
- * It does not take care of possibly removing TPC RNTI
- * from scheduled list in cell. This is done
- * in the caller after TPC for all UEs has been
- * determined. (This is where it differs
- * from the usual OnSendingPu[cs]ch TPC]
- *
- * Ret : ROK/RFAILED
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrOnPuschGrpPwrForUe(RgSchCellCb *cell,RgSchUeCb *ue,S8 delta)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, ue->cell);
- Bool rmvUe = FALSE;
-
- UNUSED(cell);
-
- uePwr->delta = delta;
- uePwr->remPuschPwr -= delta;
- if (uePwr->isPhrAvail)
- {
- uePwr->phVal -= uePwr->delta;
- uePwr->phVal = RGSCH_MAX(-23, uePwr->phVal);
- }
-
- /* UE was already scheduled for PUSCH group power
- * control which is why we came here. Don't
- * again check for this. */
-
- /* UE was scheduled for pusch grp pwr, sent TPC may
- * possibly cause it to be removed. */
-
- if (!uePwr->remPuschPwr)
- {
- rmvUe = TRUE;
- }
-
- if (rmvUe)
- {
- rgSCHPwrRmvSchdUeOnlyFrmPuschTpcRntiCb(cell, uePwr->tpcPuschRntiCb, ue);
- /* Not removing TPC RNTI from scheduled list,
- * this will happen in the caller once this
- * function is called for every UE scheduled. */
- }
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrIsDlUeSched
- *
- * Desc : Check if UE is scheduled in the passed DL SF
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Bool rgSCHPwrIsDlUeSched(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlSf *sf)
-{
- RgSchDlHqEnt *hqEnt = RG_SCH_CMN_GET_UE_HQE(ue, cell);
- RgSchDlHqProcCb *proc = rgSCHDhmLastSchedHqProc(hqEnt);
-
- if (proc == NULLP)
- {
- return (FALSE);
- }
-
- /*
- * The following subframe check is assumed enough, since
- * scheduled procs stay for a short time (until feedback
- * arrives), which typically is expected to have a
- * turnaround time of less than 8 subframes. So
- * we are probably never going to come across cases
- * where a process stays in the list for more than
- * 10 subframes, which would have otherwise caused
- * the check to succeed for a possibly older process.
- */
- if ((proc->tbInfo[0].timingInfo.slot == sf->sfNum) ||
- (proc->tbInfo[1].timingInfo.slot == sf->sfNum))
- {
- /*
- * Later, if a proc can be scheduled without having an
- * associated PDCCH, need to also check if PDCCH exists.
- * This is because for power, what matters is whether
- * TPC is going out for UE at this time or not, at least
- * that is what this function was introduced for.
- * Checking for PDCCH would have to be in common proc
- * the way things are now.
- */
- return (TRUE);
- }
- else
- {
- return (FALSE);
- }
-} /* rgSCHPwrIsDlUeSched */
-
-/***********************************************************
- *
- * Func : rgSCHPwrIsUlUeSched
- *
- * Desc : Check if UE is scheduled in the passed UL SF
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Bool rgSCHPwrIsUlUeSched(RgSchCellCb *cell,RgSchUeCb *ue,RgSchUlSf *sf)
-{
- RgSchCmnUlCell *cmnCell = RG_SCH_CMN_GET_UL_CELL(cell);
- RgSchUlHqProcCb *proc = rgSCHUhmGetUlHqProc(cell, ue, cmnCell->schdHqProcIdx);
-
- UNUSED(sf);
-
-#if (ERRCLASS & ERRCLS_DEBUG)
- if( proc == NULLP )
- {
- return (FALSE);
- }
-#endif
-
- if (proc->alloc)
- {
- return (TRUE);
- }
- else
- {
- return (FALSE);
- }
-} /* rgSCHPwrIsUlUeSched */
-
-/**
- * @brief Handles Pucch power delta indication recieved from PHY
- *
- * @details
- *
- * Function : rgSCHPwrPucchDeltaInd
- *
- * Invoking Module Processing:
- * - This shall be invoked on reception of Pucch power
- * delta indication from PHY.
- *
- * Processing Steps:
- * - Update the remPucchPwr
- * ue->remPucchPwr = pwrDelta
- * - If (ue->tpcPucchRntiCb)
- * - If (fmtType = 3A)
- * - if (remPucchPwr >= 2 || remPucchPwr <= -2 )
- * - if (tpcPucchRntiCb is not in the pucchGrpPwr List)
- * - Add tpcPucchRntiCb to the pucchGrpPwr list.
- * - If not added, add to toBeSchdLst
- * - else
- * - If already added, remove from toBeSchdLst
- * - else If (fmtType == 3)
- * - if (remPucchPwr)
- * - if (tpcPucchRntiCb is not in the pucchGrpPwr List)
- * - Add tpcPucchRntiCb to the pucchGrpPwr list.
- * - If not added, add to toBeSchdLst
- * - else
- * - If already added, remove from toBeSchdLst
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t pwrDelta
- * @return Void
- **/
-Void rgSCHPwrPucchDeltaInd(RgSchCellCb *cell,RgSchUeCb *ue,S8 pwrDelta)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, cell);
- RgSchCmnTpcRntiCb *cb;
- Bool toAdd;
-
- uePwr->remPucchPwr = pwrDelta;
-
- if ((cb = uePwr->tpcPucchRntiCb) == NULLP)
- {
- return;
- }
-
- toAdd = FALSE;
-
- if (0 != uePwr->remPucchPwr)
- {
- toAdd = TRUE;
- }
-
-
- if (toAdd)
- {
- rgSCHPwrAddSchdUeToPucchTpcRntiCb(cell, cb, ue);
- }
- else
- {
- rgSCHPwrRmvSchdUeFrmPucchTpcRntiCb(cell, cb, ue);
- }
-
- return;
-}
-
-/**
- * @brief Does processing after TPC for Pucch has been sent
- *
- * @details
- *
- * Function : rgSCHPwrOnSchedPucchTpc
- *
- * Invoking Module Processing:
- * - It shall be invoked after it is determined that PDCCH for UE
- * is finalised to go out, and thus TPC for PUCCH is being
- * sent out.
- *
- * Processing Steps:
- * - Update remPucchPwr with the delta
- * - Do group power control related processing
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] S8 delta
- * @return Void
- **/
-static Void rgSCHPwrOnSchedPucchTpc(RgSchCellCb *cell,RgSchUeCb *ue,S8 delta)
-{
- /* Similar to rgSCHPwrPucchDeltaInd.. not reusing
- * that since we use the fact that UE could only have
- * improved its remPwr as part of power control. */
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, cell);
- Bool rmvUe = FALSE;
-
- uePwr->remPucchPwr -= delta;
-
- if (uePwr->schdPucchGrpLnk.node == NULLP)
- {
- return;
- }
-
- /* UE was scheduled for TPC, sent TPC may
- * possibly cause it to be removed. */
-
- if (!uePwr->remPucchPwr)
- {
- rmvUe = TRUE;
- }
-
- if (rmvUe)
- {
- rgSCHPwrRmvSchdUeFrmPucchTpcRntiCb(cell, uePwr->tpcPucchRntiCb, ue);
- if (uePwr->tpcPucchRntiCb->toBeSchdUes.count == 0)
- {
- rgSCHPwrRmvSchdPucchTpcRntiCb(cell, uePwr->tpcPucchRntiCb);
- }
- }
- return;
-}
-
-
-/**
- * @brief Does processing after TPC for Pusch has been sent
- *
- * @details
- *
- * Function : rgSCHPwrOnSchedPuschTpc
- *
- * Processing Steps:
- * - If accumulative
- * - Update remPuschPwr with the delta
- * - Do group power related processing if applicable
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-static Void rgSCHPwrOnSchedPuschTpc(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, cell);
- Bool rmvUe = FALSE;
-
- /* Don't do anything for the case of absolute TPC commands */
- if (!uePwr->isAccumulated)
- {
- return;
- }
-
- uePwr->remPuschPwr -= uePwr->delta;
- if (uePwr->isPhrAvail)
- {
- uePwr->phVal -= uePwr->delta;
- uePwr->phVal = RGSCH_MAX(-23, uePwr->phVal);
- }
-
- if (uePwr->schdPuschGrpLnk.node == NULLP)
- {
- return;
- }
-
- /* UE was scheduled for pusch TPC, sent TPC may
- * possibly cause it to be removed. */
-
- if (!uePwr->remPuschPwr)
- {
- rmvUe = TRUE;
- }
-
- if (rmvUe)
- {
- rgSCHPwrRmvSchdUeFrmPuschTpcRntiCb(cell, uePwr->tpcPuschRntiCb, ue);
- }
-
- return;
-}
-
-/**
- * @brief Handles PHR updation for the UE
- *
- * @details
- *
- * Function : rgSCHPwrUpdExtPhr
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgInfExtPhrCEInfo *extPhr
- * @param[in] RgSchCmnAllocRecord allocInfo
- * @return Void
- **/
-Void rgSCHPwrUpdExtPhr(RgSchCellCb *cell,RgSchUeCb *ue,RgInfExtPhrCEInfo *extPhr,RgSchCmnAllocRecord *allocInfo)
-{
- uint8_t idx;
- RgInfExtPhrSCellInfo *servCellPhr;
- S8 pCMax;
-
- for (idx = 0; idx < extPhr->numServCells; idx++)
- {
- servCellPhr = &extPhr->servCellPhr[idx];
-
- if (RG_SCH_REF_PCMAX == servCellPhr->pCmax)
- {
- pCMax = RG_SCH_CMN_PWR_USE_CFG_MAX_PWR;
- }
- else
- {
- pCMax = rgSCHPwrGetPCMaxValFromPCMax(servCellPhr->pCmax);
- }
- rgSCHPwrUpdPhr(ue->cellInfo[servCellPhr->sCellIdx]->cell,
- ue, servCellPhr->phr, allocInfo, pCMax);
- }
- return;
-}
-
-/**
- * @brief Handles PHR updation for the UE
- *
- * @details
- *
- * Function : rgSCHPwrUpdPhr
- *
- * Invoking Module Processing:
- * - This shall be invoked on reception of PHR from MAC to SCH. It shall
- * pass the information of number of RBs, coding efficiency and TPC for
- * the Pusch transmission for which PHR has been reported.
- *
- * Processing Steps:
- * - Compute power per RB using the PHR report
- * - ue_transmit_pwr = ue_max_pwr - PHR
- * - if isDeltaMcs = TRUE
- * - ue_transmit_pwr -
- * [10log(phr_num_rb) + 10log(2^ (1.25 * phr_coding_effeciency) -1)
- * + phr_tpc(if absolute TPC)] = pwrPerRB
- * - else
- * - ue_transmit_pwr - [10log(phr_num_rb) + phr_tpc(if absolute TPC)]
- * = pwrPerRB
- * (Use the number of RBs and efficiency used by UE which caused the PHR
- * report to happen)
- * - Adjust PHR according to last allocation (take into account
- * number of RBs granted in the last allocation)
- * - Update the PHR report in the control block
- * - Set isPhrAvail = TRUE
- * - Do group power control related processing if applicable
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t phr
- * @param[in] RgSchCmnAllocRecord allocInfo
- * @param[in] uint8_t maxUePwr
- * @return Void
- **/
-Void rgSCHPwrUpdPhr(RgSchCellCb *cell,RgSchUeCb *ue,uint8_t phr,RgSchCmnAllocRecord *allocInfo,S8 maxUePwr )
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, cell);
- uint8_t rbPwr;
- uint8_t effPwr;
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
-
- uePwr->phVal = rgSCHPwrGetPhValFromPhr(phr);
-
- if (maxUePwr == RG_SCH_CMN_PWR_USE_CFG_MAX_PWR)
- {
- maxUePwr = uePwr->maxUePwr;
- }
- rbPwr = rgSCHPwrRbToPwr(cell,allocInfo->numRb);
- effPwr = rgSCHPwrGetCqiPwrForUe(cell, ue, allocInfo->cqi);
- uePwr->pwrPerRb = maxUePwr - uePwr->phVal - rbPwr - effPwr;
- /*if (!uePwr->isAccumulated)
- {
- uePwr->pwrPerRb -= rgSCHPwrGetDeltaFrmAbsTpc(allocInfo->tpc);
- }*/
-
- /* Let headroom reflect remaining power according to last
- * allocated number of RBs. Intermediate TPCs not yet
- * taken care of (for accumulated case, it is anyway
- * not applicable for absolute commands). */
- uePwr->phVal -= (rgSCHPwrRbToPwr(cell, cellUl->sbSize)) - rbPwr;
- uePwr->phVal = RGSCH_MAX(-23, uePwr->phVal);
- uePwr->isPhrAvail = TRUE;
-
- rgSCHPwrOnPuschPwrUpd(cell, ue);
-
- DU_LOG("\nDEBUG --> SCH : Output: Reported PHR[%d] cqi[%u] allocRb[%u] uePwr->pwrPerRb[%d]",
- uePwr->phVal,
- allocInfo->cqi,
- allocInfo->numRb,
- uePwr->pwrPerRb);
- return;
-}
-
-/**
- * @brief Handles UL CQI indication
- *
- * @details
- *
- * Function : rgSCHPwrUlCqiInd
- *
- * Invoking Module Processing:
- * - This shall be invoked when uplink CQI indication
- * is receiving from PHY for a UE.
- *
- * Processing Steps:
- * - Update remPuschPwr.
- * - Possibly schedule for group power control.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t numRb
- * @return Void
- **/
-Void rgSCHPwrUlCqiInd(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell);
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, cell);
-#ifdef TFU_UPGRADE
- S32 tmp;
-#endif
-
- /*
- * For absolute power cmd case, we could look at the time
- * at which CQI was received, determine if there was a
- * PUSCH TPC cmd for that time (this could come from
- * group power control too), and (if this
- * CQI report is indeed based on the the PUSCH tx)
- * then factor in that cmd here. Not doing
- * this as of now.
- */
-
- /* See how much power needs to be adjusted based on cqi
- * differential */
- uePwr->remPuschPwr =
-#ifdef TFU_UPGRADE
- rgSCHPwrGetDelta2FrmCqi(ueUl->validUlCqi, uePwr->trgCqi, ue, cell);
-#else
- rgSCHPwrGetDelta2FrmCqi(ueUl->crntUlCqi[0], uePwr->trgCqi, ue, cell);
-#endif
-
- rgSCHPwrOnPuschPwrUpd(cell, ue);
-#ifdef TFU_UPGRADE
- if(uePwr->maxPwrDeltaByPhr < 0)
- {
- tmp = ueUl->validUlCqi;
- tmp = tmp + uePwr->maxPwrDeltaByPhr;
- if (tmp < 1 )
- {
- ueUl->validUlCqi = 1;
- }
- else
- {
- ueUl->validUlCqi = tmp;
- }
- }
-#endif
-
- return;
-}
-
-/**
- * @brief Updates the stored last number of RBs allocated
- *
- * @details
- *
- * Function : rgSCHPwrRecordRbAlloc
- *
- * Invoking Module Processing:
- * - This shall be invoked when uplink allocation is made for
- * a UE.
- * - Note: If outstanding TPCs are considered at the time
- * of PHR report, the last numRb would also be known
- * and then this API would not be needed.
- *
- * Processing Steps:
- * - Adjust PHR according to now allocated number of RBs
- * - Store the number of RBs
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t numRb
- * @return Void
- **/
-Void rgSCHPwrRecordRbAlloc(RgSchCellCb *cell,RgSchUeCb *ue,uint8_t numRb)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, cell);
- UNUSED(cell);
- return;
-
- if (uePwr->isPhrAvail)
- {
- uePwr->phVal += rgSCHPwrRbToPwr(cell,numRb) - rgSCHPwrRbToPwr(cell,uePwr->numRb);
- uePwr->phVal = RGSCH_MIN(40, uePwr->phVal);
- }
- uePwr->numRb = numRb;
- return;
-}
-
-/**
- * @brief Handles power related configuration for a cell
- *
- * @details
- *
- * Function : rgSCHPwrCellCfg
- *
- * Invoking Module Processing:
- * - This shall be invoked during cell config
- *
- * Processing Steps:
- * - Set pMax
- * - Set target CQI
- * - Update TPC-RNTI information for the cell for Pucch and Pusch.
- * - For each TPC-Pucch-RNTI,
- * - Call rgSCHAddRntiToPucchRntiLst()
- * - For each TPC-Pusch-RNTI,
- * - Call rgSCHAddRntiToPuschRntiLst()
- * - Return ROK
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgrCellCfg *cfg
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHPwrCellCfg(RgSchCellCb *cell,RgrCellCfg *cfg)
-{
- RgSchCmnUlPwrCb *cellPwr = RG_SCH_PWR_GETCELLPWR(cell);
- CmLteRnti rnti;
- CmLteRnti startRnti;
- uint16_t size;
- Bool isFmt3a;
-
- /* Right now, all UEs have fixed maximum power capability. So
- * we store cell wide pMax as minimum of configured pMax and
- * UE's max power */
- cellPwr->pMax = RGSCH_MIN(cfg->pMax, RG_SCH_PWR_UE_MAX_PWR);
-
- /* trgUlCqi already validated by common */
- cellPwr->trgUlCqi = cfg->trgUlCqi.trgCqi;
-
- /* Validate number of TPC RNTIs */
- if ((cfg->pwrCfg.pucchPwrFmt3.size + cfg->pwrCfg.pucchPwrFmt3a.size
- > RG_SCH_CMN_MAX_NUM_TPC_PUCCH_RNTI)
- || (cfg->pwrCfg.puschPwrFmt3.size + cfg->pwrCfg.puschPwrFmt3a.size
- > RG_SCH_CMN_MAX_NUM_TPC_PUSCH_RNTI))
- {
- return RFAILED;
- }
-
- /* Now initialise TPC RNTIs */
-
- /* Format 3 Pucch TPC RNTIs */
- isFmt3a = FALSE;
- startRnti = cfg->pwrCfg.pucchPwrFmt3.startTpcRnti;
- size = cfg->pwrCfg.pucchPwrFmt3.size;
- for (rnti = startRnti; (rnti < startRnti + size); ++rnti)
- {
- rgSCHPwrAddRntiToPucchRntiLst(cell, rnti, isFmt3a);
- }
-
- /* Format 3A Pucch TPC RNTIs */
- isFmt3a = TRUE;
- startRnti = cfg->pwrCfg.pucchPwrFmt3a.startTpcRnti;
- size = cfg->pwrCfg.pucchPwrFmt3a.size;
- for (rnti = startRnti; (rnti < startRnti + size); ++rnti)
- {
- rgSCHPwrAddRntiToPucchRntiLst(cell, rnti, isFmt3a);
- }
-
- /* Format 3 Pusch TPC RNTIs */
- isFmt3a = FALSE;
- startRnti = cfg->pwrCfg.puschPwrFmt3.startTpcRnti;
- size = cfg->pwrCfg.puschPwrFmt3.size;
- for (rnti = startRnti; (rnti < startRnti + size); ++rnti)
- {
- rgSCHPwrAddRntiToPuschRntiLst(cell, rnti, isFmt3a);
- }
-
- /* Format 3A Pusch TPC RNTIs */
- isFmt3a = TRUE;
- startRnti = cfg->pwrCfg.puschPwrFmt3a.startTpcRnti;
- size = cfg->pwrCfg.puschPwrFmt3a.size;
- for (rnti = startRnti; (rnti < startRnti + size); ++rnti)
- {
- rgSCHPwrAddRntiToPuschRntiLst(cell, rnti, isFmt3a);
- }
-
- return ROK;
-}
-
-/**
- * @brief Handles power related re-configuration for a cell
- *
- * @details
- *
- * Function : rgSCHPwrCellRecfg
- *
- * Processing Steps:
- * - NONE
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgrCellRecfg *recfg
- * @return S16
- * -# ROK
- **/
-S16 rgSCHPwrCellRecfg(RgSchCellCb *cell,RgrCellRecfg *recfg)
-{
- UNUSED(cell);
- UNUSED(recfg);
-
- /* Not doing anything for power reconfig, so such structure
- * in RGR */
- return ROK;
-}
-
-/**
- * @brief Frees power related data structures in cell
- *
- * @details
- *
- * Function : rgSCHPwrCellDel
- *
- * Processing Steps:
- * - NONE
- *
- * @param[in] RgSchCellCb *cell
- * @return Void
- **/
-Void rgSCHPwrCellDel(RgSchCellCb *cell)
-{
- UNUSED(cell);
-
- /* There is no allocated memory, so do nothing */
- return;
-}
-
-
-#ifdef LTE_ADV
-/**
- * @brief Configures ULPC CB for a SCELL being added
- *
- * @details
- *
- * Function : rgSCHPwrUeSCellCfg
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrUeCfg *cfg
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHPwrUeSCellCfg(RgSchCellCb *cell,RgSchUeCb *ue,RgrUeSecCellCfg *sCellInfoCfg)
-{
- RgSchCmnUlPwrCb *cellPwr = RG_SCH_PWR_GETCELLPWR(cell);
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, cell);
- RgSchCmnUeUlPwrCb *uePwrPCell = RG_SCH_PWR_GETUEPWR(ue, ue->cell);
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell);
-
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
-
-
- uePwr->maxUePwr = cellPwr->pMax;
- uePwr->trgCqi = cellPwr->trgUlCqi; /* Overriding with UE's happens later */
- uePwr->numRb = 1;
-
- uePwr->maxPwrPerRb = uePwr->maxUePwr - rgSchPwrRbToPwrTbl[cellUl->sbSize];
-
- uePwr->isPhrAvail = FALSE;
- uePwr->phVal = 40;
- uePwr->maxUlRbs = RGSCH_MAX_DL_BW;
- uePwr->delta = 0;
- uePwr->puschTpc = 1;
- uePwr->remPuschPwr = 0;
-
- /* Rest of the vars update and group power control related
- * config happens in the function below */
- uePwr->isAccumulated = sCellInfoCfg->ueSCellUlDedPwrCfg.isAccumulated;
- uePwr->deltaMcsEnbld = sCellInfoCfg->ueSCellUlDedPwrCfg.isDeltaMCSEnabled;
-
- uePwr->trgCqi = uePwrPCell->trgCqi;
-
- if (ueUl->maxUlCqi < uePwr->trgCqi)
- {
- uePwr->trgCqi = ueUl->maxUlCqi;
- }
- uePwr->p0UePusch = sCellInfoCfg->ueSCellUlDedPwrCfg.p0UePusch;
-
- return ROK;
-}
-#endif
-
-/**
- * @brief Handles power related configuration for a UE
- *
- * @details
- *
- * Function : rgSCHPwrUeCfg
- *
- * Processing Steps:
- * - If Pusch group power configuration exists && accumulation enabled,
- * - Fetch the TPC-Pusch-RNTI control block for the configured
- * TPC-Pusch-RNTI. Call rgSCHGetRntiFrmPuschRntiLst(). If it does not
- * exist, return RFAILED.
- * - Add Ue to the ueLst of TPC-Pusch-RNTI control block.
- * - Update tpcPuschRntiCb pointer in UE.
- * - Update the puschIdx value.
- * - If Pucch group power configuration exists && accumulation enabled,
- * - Fetch the TPC-Pucch-RNTI control block for the configured
- * TPC-Pucch-RNTI. Call rgSCHGetRntiFrmPucchRntiLst(). If it does not
- * exist, return RFAILED.
- * - Add Ue to the ueLst of TPC-Pucch-RNTI control block.
- * - Update tpcPucchRntiCb pointer in UE.
- * - Update the pucchIdx value.
- * - Update isAccumulated and isDeltaMcs variables.
- * - maxUlRbs = configured maximum UL bandwidth value per UE.
- * - trgUlCqi = configured value, if any, else cell-wide default trg CQI value.
- * - If format type is format 3A, update remaining power to +1
- * - Update TPC-RNTI information for the cell for Pucch and Pusch.
- * - Return ROK
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrUeCfg *cfg
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHPwrUeCfg(RgSchCellCb *cell,RgSchUeCb *ue,RgrUeCfg *cfg)
-{
- S16 ret;
- RgSchCmnUlPwrCb *cellPwr = RG_SCH_PWR_GETCELLPWR(cell);
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, cell);
-
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
-
- uePwr->maxUePwr = cellPwr->pMax;
- uePwr->trgCqi = cellPwr->trgUlCqi; /* Overriding with UE's happens later */
- uePwr->numRb = 1;
-
- uePwr->maxPwrPerRb = uePwr->maxUePwr - rgSchPwrRbToPwrTbl[cellUl->sbSize];
-
- rgSCHPwrUeResetPucch(cell, ue);
- rgSCHPwrUeResetPusch(cell, ue);
-
- /* Rest of the vars update and group power control related
- * config happens in the function below */
- ret = rgSCHPwrApplyUePwrCfg(cell, ue, &cfg->ueUlPwrCfg);
-
- return (ret);
-}
-
-/**
- * @brief Handles power related re-configuration for a UE
- *
- * @details
- *
- * Function : rgSCHPwrUeRecfg
- *
- * Invoking Module Processing:
- * - This shall be invoked by SCH_GOM at UE re-configuration.
- *
- * Processing Steps:
- * - If change in TPC-RNTI, update the pointer and the TPC RNTI Cb appropriately.
- * - If accumulation disabled, remove the UE from TPC-RNTI lists of UE, if
- * it exists.
- * - If group power configuration disabled, remove the UE from TPC-RNTI lists of UE, if
- * it exists.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrUeRecfg *recfg
- *
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHPwrUeRecfg(RgSchCellCb *cell,RgSchUeCb *ue,RgrUeRecfg *recfg)
-{
- S16 ret;
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, cell);
- RgrUeUlPwrCfg *pwrCfg = &recfg->ueUlPwrRecfg;
-
- if (pwrCfg->p0UePucch != uePwr->p0UePucch)
- {
- rgSCHPwrUeResetPucch(cell, ue);
- }
- if ((pwrCfg->isAccumulated != uePwr->isAccumulated)
- || (pwrCfg->p0UePusch != uePwr->p0UePusch))
- {
- rgSCHPwrUeResetPusch(cell, ue);
- }
- ret = rgSCHPwrApplyUePwrCfg(cell, ue, &recfg->ueUlPwrRecfg);
-
- return (ret);
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrApplyUePwrCfg
- *
- * Desc : Applies power config for UE. Meants to be
- * used during both power config and reconfig.
- *
- * Ret : ROK/RFAILED
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHPwrApplyUePwrCfg(RgSchCellCb *cell,RgSchUeCb *ue,RgrUeUlPwrCfg *pwrCfg)
-{
- S16 ret;
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell);
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, cell);
- RgSchCmnTpcRntiCb *pucchRntiCb = NULLP;
- RgSchCmnTpcRntiCb *puschRntiCb = NULLP;
- uint8_t pucchIdx = 0;
- uint8_t puschIdx = 0;
-
- /* Validate Pucch group power control config */
- if (pwrCfg->uePucchPwr.pres)
- {
- pucchRntiCb =
- rgSCHPwrGetPucchRntiCb(cell, pwrCfg->uePucchPwr.tpcRnti);
- if (pucchRntiCb == NULLP)
- {
- return RFAILED;
- }
- pucchIdx = pwrCfg->uePucchPwr.idx;
- ret = rgSCHPwrChkPucchTpcRntiIdx(pucchRntiCb, pucchIdx);
- if (ret != ROK)
- {
- return (ret);
- }
- }
-
- /* Validate Pusch group power control config */
- if (pwrCfg->uePuschPwr.pres)
- {
- puschRntiCb =
- rgSCHPwrGetPuschRntiCb(cell, pwrCfg->uePuschPwr.tpcRnti);
- if (puschRntiCb == NULLP)
- {
- return RFAILED;
- }
- puschIdx = pwrCfg->uePuschPwr.idx;
- ret = rgSCHPwrChkPuschTpcRntiIdx(puschRntiCb, puschIdx);
- if (ret != ROK)
- {
- return (ret);
- }
- }
-
- /* Apply Pucch group power control config */
- if (pucchRntiCb)
- {
- if (uePwr->tpcPucchRntiCb != pucchRntiCb) /* This part for recfg */
- {
- if (uePwr->tpcPucchRntiCb)
- {
- rgSCHPwrDelUeFrmPucchTpcRntiCb(cell, uePwr->tpcPucchRntiCb, ue);
- }
- uePwr->tpcPucchRntiCb = pucchRntiCb;
- rgSCHPwrAddUeToPucchTpcRntiCb(cell, pucchRntiCb, ue);
- }
- uePwr->pucchIdx = pucchIdx;
-#ifndef ALIGN_64BIT
- DU_LOG("\nDEBUG --> SCH : <GRP_PWR>PucchRntiCb cfgdUes(%ld %lu %lu) UEID:%d",
- pucchRntiCb->cfgdUes.count,((uint32_t)pucchRntiCb->cfgdUes.first),
- ((uint32_t)pucchRntiCb->cfgdUes.last),ue->ueId);
- DU_LOG("\nDEBUG --> SCH : UEID:%d isFmt3a(%u) ueNode(%ld)",
- ue->ueId,pucchRntiCb->isFmt3a,
- pucchRntiCb->schdLnk.node);
- DU_LOG("\nDEBUG --> SCH : toBeSchdUes(%ld %lu %lu) tpcRnti(%u)",
- pucchRntiCb->toBeSchdUes.count,
- ((uint32_t)pucchRntiCb->toBeSchdUes.first),
- ((uint32_t)pucchRntiCb->toBeSchdUes.last),
- pucchRntiCb->tpcRnti);
-#else
- DU_LOG("\nDEBUG --> SCH : <GRP_PWR>PucchRntiCb cfgdUes(%d %lu %lu) UEID:%d",
- pucchRntiCb->cfgdUes.count,((uint64_t)pucchRntiCb->cfgdUes.first),
- ((uint64_t)pucchRntiCb->cfgdUes.last),ue->ueId);
- DU_LOG("\nDEBUG --> SCH : UEID:%d isFmt3a(%u) ueNode(%ld)",
- ue->ueId,pucchRntiCb->isFmt3a,
- pucchRntiCb->schdLnk.node);
- DU_LOG("\nDEBUG --> SCH : toBeSchdUes(%d %lu %lu) tpcRnti(%u)",
- pucchRntiCb->toBeSchdUes.count,
- ((uint64_t)pucchRntiCb->toBeSchdUes.first),
- ((uint64_t)pucchRntiCb->toBeSchdUes.last),
- pucchRntiCb->tpcRnti);
-
-#endif
- }
-
- /* Apply Pusch group power control config */
- if (puschRntiCb)
- {
- if (uePwr->tpcPuschRntiCb != puschRntiCb) /* This part for recfg */
- {
- if (uePwr->tpcPuschRntiCb)
- {
- rgSCHPwrDelUeFrmPuschTpcRntiCb(cell, uePwr->tpcPuschRntiCb, ue);
- }
- uePwr->tpcPuschRntiCb = puschRntiCb;
- rgSCHPwrAddUeToPuschTpcRntiCb(puschRntiCb, ue);
- }
- uePwr->puschIdx = puschIdx;
- }
-
- /* Update vars */
- uePwr->isAccumulated = pwrCfg->isAccumulated;
- uePwr->deltaMcsEnbld = pwrCfg->isDeltaMCSEnabled;
- if (pwrCfg->trgCqi)
- {
- uePwr->trgCqi = pwrCfg->trgCqi;
- }
- if (ueUl->maxUlCqi < uePwr->trgCqi)
- {
- uePwr->trgCqi = ueUl->maxUlCqi;
- }
- uePwr->p0UePusch = pwrCfg->p0UePusch;
- uePwr->p0UePucch = pwrCfg->p0UePucch;
-
- return ROK;
-}
-
-
-/**
- * @brief Deletes power related information for UE
- *
- * @details
- *
- * Function : rgSCHPwrUeDel
- *
- * Invoking Module Processing:
- * - This shall be invoked by at the time of UE deletion.
- *
- * Processing Steps:
- * - if (ue->tpcPucchRntiCb)
- * - delete UE from tpcPucchRntiCb->ueLst
- * - ue->tpcPucchRntiCb = NULLP
- * - If in (ue->tpcPucchRntiCb->toBeSchdLst)
- * - remove from the list.
- * - if (ue->tpcPuschRntiCb)
- * - delete UE from tpcPuschRntiCb->ueLst
- * - ue->tpcPuschRntiCb = NULLP
- * - If in (ue->tpcPuschRntiCb->toBeSchdLst)
- * - remove from the list.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-Void rgSCHPwrUeDel(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, cell);
-
- if (uePwr->tpcPucchRntiCb)
- {
- rgSCHPwrDelUeFrmPucchTpcRntiCb(cell, uePwr->tpcPucchRntiCb, ue);
- uePwr->tpcPucchRntiCb = NULLP;
- }
- if (uePwr->tpcPuschRntiCb)
- {
- rgSCHPwrDelUeFrmPuschTpcRntiCb(cell, uePwr->tpcPuschRntiCb, ue);
- uePwr->tpcPuschRntiCb = NULLP;
- }
- return;
-}
-
-/**
- * @brief Resets UE's power state
- *
- * @details
- *
- * Function : rgSCHPwrUeReset
- *
- * Invoking Module Processing:
- * - This shall be invoked by at the time PDCCH order.
- *
- * Processing Steps:
- * - Reset PUSCH power state
- * - Reset PUCCH power state
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-Void rgSCHPwrUeReset(RgSchCellCb *cell,RgSchUeCb *ue)
-{
-
- rgSCHPwrUeResetPucch(cell, ue);
- rgSCHPwrUeResetPusch(cell, ue);
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrUeResetPucch
- *
- * Desc : This function is called to reset UE
- * to initial PUCCH power state.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrUeResetPucch(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, cell);
-
- uePwr->pucchTpc = 1;
- uePwr->remPucchPwr = 0;
- if (uePwr->tpcPucchRntiCb)
- {
- rgSCHPwrRmvSchdUeFrmPucchTpcRntiCb(cell, uePwr->tpcPucchRntiCb, ue);
- }
-
- /* Stack Crash problem for TRACE5 changes. Added the line below */
- return;
-
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrUeResetPusch
- *
- * Desc : This function is called to reset UE
- * to initial PUSCH power state.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrUeResetPusch(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, cell);
-
- uePwr->isPhrAvail = FALSE;
- uePwr->phVal = 40;
- uePwr->maxUlRbs = RGSCH_MAX_DL_BW;
- uePwr->delta = 0;
- uePwr->puschTpc = 1;
- uePwr->remPuschPwr = 0;
- if (uePwr->tpcPuschRntiCb)
- {
- rgSCHPwrRmvSchdUeFrmPuschTpcRntiCb(cell, uePwr->tpcPuschRntiCb, ue);
- }
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrOnPuschPwrUpd
- *
- * Desc : This function is called whenever 'remPuschPwr'
- * is updated
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrOnPuschPwrUpd(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, cell);
- RgSchCmnTpcRntiCb *cb;
- Bool toAdd;
-
- if ((cb = uePwr->tpcPuschRntiCb) == NULLP)
- {
- return;
- }
-
- /* Not checking for uwPwr->isPhrAvail as uePwr->phVal
- * is set to a large value initially */
- toAdd = FALSE;
-
-
- if ((uePwr->phVal != 0) && (uePwr->remPuschPwr != 0))
- {
- toAdd = TRUE;
- }
-
-
- if (toAdd)
- {
- rgSCHPwrAddSchdUeToPuschTpcRntiCb(cell, cb, ue);
- }
- else
- {
- rgSCHPwrRmvSchdUeFrmPuschTpcRntiCb(cell, cb, ue);
- }
-
- return;
-}
-
-
-/***********************************************************
- *
- * Func : rgSCHPwrAddRntiToPucchRntiLst
- *
- *
- * Desc : Adds RNTI to Pucch Rnti list and updates requisite
- * information.
- *
- * Ret : Void
- *
- * Notes: Assumed that array bounds are checked
- * in caller before adding.
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrAddRntiToPucchRntiLst(RgSchCellCb *cell,CmLteRnti rnti,Bool isFmt3a)
-{
- RgSchCmnUlPwrCb *cellPwr = RG_SCH_PWR_GETCELLPWR(cell);
-
- rgSCHPwrInitTpcRntiCb(&cellPwr->tpcPucchRntiLst[cellPwr->tpcPucchRntiCnt++],
- rnti, isFmt3a);
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrAddRntiToPuschRntiLst
- *
- *
- * Desc : Adds RNTI to Pusch Rnti list and updates requisite
- * information.
- *
- * Ret : Void
- *
- * Notes: Assumed that array bounds are checked
- * in caller before adding.
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrAddRntiToPuschRntiLst(RgSchCellCb *cell,CmLteRnti rnti,Bool isFmt3a)
-{
- RgSchCmnUlPwrCb *cellPwr = RG_SCH_PWR_GETCELLPWR(cell);
-
- rgSCHPwrInitTpcRntiCb(&cellPwr->tpcPuschRntiLst[cellPwr->tpcPuschRntiCnt++],
- rnti, isFmt3a);
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrInitTpcRntiCb
- *
- *
- * Desc : Initialises a TPC RNTI CB
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrInitTpcRntiCb(RgSchCmnTpcRntiCb *cb,CmLteRnti rnti,Bool isFmt3a)
-{
-
- memset(cb, 0, sizeof(*cb));
- cb->tpcRnti = rnti;
- cb->isFmt3a = isFmt3a;
- /* Not initialising lists as memset 0 takes care of it */
- /* cb->schdLnk.node is set when this rnti is to be scheduled */
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrGetPucchRntiCb
- *
- *
- * Desc : Gets TPC RNTI control block from Pucch rnti list
- *
- * Ret : RgSchCmnTpcRntiCb * - Success
- * NULLP - Fail
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static RgSchCmnTpcRntiCb* rgSCHPwrGetPucchRntiCb(RgSchCellCb *cell,CmLteRnti tpcRnti)
-{
- RgSchCmnUlPwrCb *cellPwr = RG_SCH_PWR_GETCELLPWR(cell);
- uint16_t idx;
-
- if (!cellPwr->tpcPucchRntiCnt)
- {
- return (NULLP);
- }
- for (idx = 0; idx < cellPwr->tpcPucchRntiCnt; ++idx)
- {
- if (cellPwr->tpcPucchRntiLst[idx].tpcRnti == tpcRnti)
- {
- return (&cellPwr->tpcPucchRntiLst[idx]);
- }
- }
- return (NULLP);
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrGetPuschRntiCb
- *
- *
- * Desc : Gets TPC RNTI control block from Pusch rnti list
- *
- * Ret : RgSchCmnTpcRntiCb * - Success
- * NULLP - Fail
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static RgSchCmnTpcRntiCb* rgSCHPwrGetPuschRntiCb(RgSchCellCb *cell,CmLteRnti tpcRnti)
-{
- RgSchCmnUlPwrCb *cellPwr = RG_SCH_PWR_GETCELLPWR(cell);
- uint16_t idx;
-
- if (!cellPwr->tpcPuschRntiCnt)
- {
- return (NULLP);
- }
- for (idx = 0; idx < cellPwr->tpcPuschRntiCnt; ++idx)
- {
- if (cellPwr->tpcPuschRntiLst[idx].tpcRnti == tpcRnti)
- {
- return (&cellPwr->tpcPuschRntiLst[idx]);
- }
- }
- return (NULLP);
-}
-
-
-/***********************************************************
- *
- * Func : rgSCHPwrAddUeToPucchTpcRntiCb
- *
- *
- * Desc : Add UE to cfgd list of UEs in rnti cb
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrAddUeToPucchTpcRntiCb(RgSchCellCb *cell,RgSchCmnTpcRntiCb *cb,RgSchUeCb *ue)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, ue->cell);
- UNUSED(cell);
-
- cmLListAdd2Tail(&cb->cfgdUes, &uePwr->pucchGrpLnk);
- uePwr->pucchGrpLnk.node = (PTR)ue;
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrDelUeFrmPucchTpcRntiCb
- *
- *
- * Desc : Remove UE from Pucch TPC RNTI CB
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrDelUeFrmPucchTpcRntiCb(RgSchCellCb *cell,RgSchCmnTpcRntiCb *cb,RgSchUeCb *ue)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, ue->cell);
-
- rgSCHPwrRmvSchdUeFrmPucchTpcRntiCb(cell, cb, ue);
- cmLListDelFrm(&cb->cfgdUes, &uePwr->pucchGrpLnk);
- uePwr->pucchGrpLnk.node = NULLP;
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrRmvSchdUeFrmPucchTpcRntiCb
- *
- *
- * Desc : Remove UE from to-be-scheduled list of UEs
- * in Pusch RNTI CB
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrRmvSchdUeFrmPucchTpcRntiCb(RgSchCellCb *cell,RgSchCmnTpcRntiCb *cb,RgSchUeCb *ue)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, ue->cell);
-
- if (uePwr->schdPucchGrpLnk.node == NULLP)
- {
- return;
- }
- rgSCHPwrRmvSchdUeOnlyFrmPucchTpcRntiCb(cell, cb, ue);
- if (!cb->toBeSchdUes.count)
- {
- rgSCHPwrRmvSchdPucchTpcRntiCb(cell, cb);
- }
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrRmvSchdUeOnlyFrmPucchTpcRntiCb
- *
- * Desc : Remove UE from to-be-scheduled list of UEs
- * in Pucch RNTI CB. Do not both about
- * possibly removing Pucch RNTI CB from
- * the cell wide to-be-scheduled list.
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrRmvSchdUeOnlyFrmPucchTpcRntiCb(RgSchCellCb *cell,RgSchCmnTpcRntiCb *cb,RgSchUeCb *ue)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, ue->cell);
-
- if (uePwr->schdPucchGrpLnk.node != NULLP)
- {
- cmLListDelFrm(&cb->toBeSchdUes, &uePwr->schdPucchGrpLnk);
- uePwr->schdPucchGrpLnk.node = NULLP;
- }
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrRmvSchdPucchTpcRntiCb
- *
- * Desc : Remove Pucch TPC RNTI CB from to-be-scheduled
- * list in cell
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrRmvSchdPucchTpcRntiCb(RgSchCellCb *cell,RgSchCmnTpcRntiCb *cb)
-{
- RgSchCmnUlPwrCb *cellPwr = RG_SCH_PWR_GETCELLPWR(cell);
-
- if (cb->schdLnk.node == NULLP)
- {
- return;
- }
- cmLListDelFrm(&cellPwr->pucchGrpPwr, &cb->schdLnk);
- cb->schdLnk.node = NULLP;
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrAddSchdUeToPucchTpcRntiCb
- *
- * Desc : Add UE to to-be-scheduled list of UEs
- * in Pucch RNTI CB
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrAddSchdUeToPucchTpcRntiCb(RgSchCellCb *cell,RgSchCmnTpcRntiCb *cb,RgSchUeCb *ue)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, ue->cell);
-
- if (uePwr->schdPucchGrpLnk.node != NULLP)
- {
- /* UE is already in the list */
- return;
- }
- cmLListAdd2Tail(&cb->toBeSchdUes, &uePwr->schdPucchGrpLnk);
- uePwr->schdPucchGrpLnk.node = (PTR)ue;
- if (cb->toBeSchdUes.count == 1)
- {
- /* This is first UE, so queue up this TPC RNTI
- * for scheduling */
- rgSCHPwrAddSchdPucchTpcRntiCb(cell, cb);
- }
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrAddSchdPucchTpcRntiCb
- *
- * Desc : Add Pucch TPC RNTI CB from to-be-scheduled
- * list in cell
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrAddSchdPucchTpcRntiCb(RgSchCellCb *cell,RgSchCmnTpcRntiCb *cb)
-{
- RgSchCmnUlPwrCb *cellPwr = RG_SCH_PWR_GETCELLPWR(cell);
-
- cmLListAdd2Tail(&cellPwr->pucchGrpPwr, &cb->schdLnk);
- cb->schdLnk.node = (PTR)cb;
- return;
-}
-
-
-/***********************************************************
- *
- * Func : rgSCHPwrAddUeToPuschTpcRntiCb
- *
- *
- * Desc : Add UE to cfgd list of UEs in rnti cb
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrAddUeToPuschTpcRntiCb(RgSchCmnTpcRntiCb *cb,RgSchUeCb *ue)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, ue->cell);
-
- cmLListAdd2Tail(&cb->cfgdUes, &uePwr->puschGrpLnk);
- uePwr->puschGrpLnk.node = (PTR)ue;
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrAddSchdUeToPuschTpcRntiCb
- *
- * Desc : Add UE to to-be-scheduled list of UEs
- * in Pusch RNTI CB
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrAddSchdUeToPuschTpcRntiCb(RgSchCellCb *cell,RgSchCmnTpcRntiCb *cb,RgSchUeCb *ue)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, ue->cell);
-
- if (uePwr->schdPuschGrpLnk.node != NULLP)
- {
- /* UE is already in the list */
- return;
- }
- cmLListAdd2Tail(&cb->toBeSchdUes, &uePwr->schdPuschGrpLnk);
- uePwr->schdPuschGrpLnk.node = (PTR)ue;
- if (cb->toBeSchdUes.count == 1)
- {
- /* This is first UE, so queue up this TPC RNTI
- * for scheduling */
- rgSCHPwrAddSchdPuschTpcRntiCb(cell, cb);
- }
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrDelUeFrmPuschTpcRntiCb
- *
- *
- * Desc : Add UE to cfgd list of UEs in rnti cb
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrDelUeFrmPuschTpcRntiCb(RgSchCellCb *cell,RgSchCmnTpcRntiCb *cb,RgSchUeCb *ue)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, ue->cell);
-
- rgSCHPwrRmvSchdUeFrmPuschTpcRntiCb(cell, cb, ue);
- cmLListDelFrm(&cb->cfgdUes, &uePwr->puschGrpLnk);
- uePwr->puschGrpLnk.node = NULLP;
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrRmvSchdUeFrmPuschTpcRntiCb
- *
- * Desc : Remove UE from to-be-scheduled list of UEs
- * in Pusch RNTI CB
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrRmvSchdUeFrmPuschTpcRntiCb(RgSchCellCb *cell,RgSchCmnTpcRntiCb *cb,RgSchUeCb *ue)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, ue->cell);
-
- if (uePwr->schdPuschGrpLnk.node == NULLP)
- {
- return;
- }
- rgSCHPwrRmvSchdUeOnlyFrmPuschTpcRntiCb(cell, cb, ue);
- if (!cb->toBeSchdUes.count)
- {
- rgSCHPwrRmvSchdPuschTpcRntiCb(cell, cb);
- }
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrRmvSchdUeOnlyFrmPuschTpcRntiCb
- *
- * Desc : Remove UE from to-be-scheduled list of UEs
- * in Pusch RNTI CB. Do not both about
- * possibly removing Pusch RNTI CB from
- * the cell wide to-be-scheduled list.
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrRmvSchdUeOnlyFrmPuschTpcRntiCb(RgSchCellCb *cell,RgSchCmnTpcRntiCb *cb,RgSchUeCb *ue)
-{
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, ue->cell);
-
- if (uePwr->schdPuschGrpLnk.node != NULLP)
- {
- cmLListDelFrm(&cb->toBeSchdUes, &uePwr->schdPuschGrpLnk);
- uePwr->schdPuschGrpLnk.node = NULLP;
- }
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrAddSchdPuschTpcRntiCb
- *
- * Desc : Add Pusch TPC RNTI CB from to-be-scheduled
- * list in cell
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrAddSchdPuschTpcRntiCb(RgSchCellCb *cell,RgSchCmnTpcRntiCb *cb)
-{
- RgSchCmnUlPwrCb *cellPwr = RG_SCH_PWR_GETCELLPWR(cell);
-
- cmLListAdd2Tail(&cellPwr->puschGrpPwr, &cb->schdLnk);
- cb->schdLnk.node = (PTR)cb;
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrRmvSchdPuschTpcRntiCb
- *
- * Desc : Remove Pusch TPC RNTI CB from to-be-scheduled
- * list in cell
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHPwrRmvSchdPuschTpcRntiCb(RgSchCellCb *cell,RgSchCmnTpcRntiCb *cb)
-{
- RgSchCmnUlPwrCb *cellPwr = RG_SCH_PWR_GETCELLPWR(cell);
-
- if (cb->schdLnk.node == NULLP)
- {
- return;
- }
- cmLListDelFrm(&cellPwr->puschGrpPwr, &cb->schdLnk);
- cb->schdLnk.node = NULLP;
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrChkPucchTpcRntiIdx
- *
- * Desc : Validate that the given index is OK to
- * be assigned to a new UE for the Pucch TPC
- * RNTI
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHPwrChkPucchTpcRntiIdx(RgSchCmnTpcRntiCb *cb,uint8_t idx)
-{
-
- if (rgSCHPwrChkTpcRntiIdx(cb, idx) != ROK)
- {
- return RFAILED;
- }
- if (rgSCHPwrChkUniqPucchTpcRntiIdx(cb, idx) != ROK)
- {
- return RFAILED;
- }
- return ROK;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrChkPuschTpcRntiIdx
- *
- * Desc : Validate that the given index is OK to
- * be assigned to a new UE for the Pusch TPC
- * RNTI
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHPwrChkPuschTpcRntiIdx(RgSchCmnTpcRntiCb *cb,uint8_t idx)
-{
-
- if (rgSCHPwrChkTpcRntiIdx(cb, idx) != ROK)
- {
- return RFAILED;
- }
- if (rgSCHPwrChkUniqPuschTpcRntiIdx(cb, idx) != ROK)
- {
- return RFAILED;
- }
- return ROK;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrChkUniqPucchTpcRntiIdx
- *
- * Desc : Validate index against format type of TPC RNTI
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHPwrChkUniqPucchTpcRntiIdx(RgSchCmnTpcRntiCb *cb,uint8_t idx)
-{
- CmLList *lnk;
-
- for (lnk = cb->cfgdUes.first; lnk; lnk = lnk->next)
- {
- RgSchUeCb *ue = (RgSchUeCb *)lnk->node;
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, ue->cell);
- if (uePwr->pucchIdx == idx)
- {
- return RFAILED;
- }
- }
- return ROK;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrChkUniqPuschTpcRntiIdx
- *
- * Desc : Validate index against format type of TPC RNTI
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHPwrChkUniqPuschTpcRntiIdx(RgSchCmnTpcRntiCb *cb,uint8_t idx)
-{
- CmLList *lnk;
-
- for (lnk = cb->cfgdUes.first; lnk; lnk = lnk->next)
- {
- RgSchUeCb *ue = (RgSchUeCb *)lnk->node;
- RgSchCmnUeUlPwrCb *uePwr = RG_SCH_PWR_GETUEPWR(ue, ue->cell);
- if (uePwr->puschIdx == idx)
- {
- return RFAILED;
- }
- }
- return ROK;
-}
-
-/***********************************************************
- *
- * Func : rgSCHPwrChkTpcRntiIdx
- *
- * Desc : Validate index against format type of TPC RNTI.
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHPwrChkTpcRntiIdx(RgSchCmnTpcRntiCb *cb,uint8_t idx)
-{
- if (cb->isFmt3a)
- {
- if (idx >= TFU_MAX_1BIT_TPC)
- {
- return RFAILED;
- }
- }
- else
- {
- if (idx >= TFU_MAX_2BIT_TPC)
- {
- return RFAILED;
- }
- }
- return ROK;
-}
-/* Warning Fix: Commenting out as not used */
-
-/***********************************************************
- *
- * Func : rgSCHPwrGetPCMaxValFromPCMax
- *
- * Desc : Returns the power headroom in dB
- * corresponding to a power headroom
- * report
- *
- * Ret : S8
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S8 rgSCHPwrGetPCMaxValFromPCMax(uint8_t pCMax)
-{
- return ((pCMax & 63) - 30);
-}
-
-
-
-/***********************************************************
- *
- * Func : rgSCHPwrGetPhValFromPhr
- *
- * Desc : Returns the power headroom in dB
- * corresponding to a power headroom
- * report
- *
- * Ret : S8
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S8 rgSCHPwrGetPhValFromPhr(uint8_t phr)
-{
- return ((phr & 63) - 23);
-}
-
-
-\f
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Entry point fucntions
-
- File: rg_sch_ram.c
-
-**********************************************************************/
-
-/** @file rg_sch_ram.c
-@brief This file has APIs to handle the random access procedure functionality for the scheduler.
-*/
-
-
-/* header include files (.h) */
-#include "common_def.h"
-
-#include "rg_env.h" /* MAC Environment Defines */
-#include "rgr.h" /* RGR Interface defines */
-#include "rgm.h" /* RGR Interface defines */
-#include "tfu.h" /* TFU Interface defines */
-#include "lrg.h" /* LRG Interface defines */
-#include "rg_env.h" /* Scheduler error defines */
-#include "rg_sch_inf.h" /* Scheduler defines */
-#include "rg_sch_err.h" /* Scheduler error defines */
-#include "rg_sch.h" /* Scheduler defines */
-#include "rg_sch_cmn.h"
-
-/* header/extern include files (.x) */
-
-#include "rgr.x" /* RGR Interface includes */
-#include "rgm.x" /* RGR Interface includes */
-#include "tfu.x" /* TFU Interface includes */
-#include "lrg.x" /* LRG Interface includes */
-
-#include "rg_sch_inf.x" /* typedefs for Scheduler */
-#include "rg_sch.x" /* Scheduler includes */
-#include "rg_sch_cmn.x"
-#ifdef EMTC_ENABLE
-Bool rgSCHRamVldtRgrEmtcUeCfg ARGS((
-RgSchCellCb *cell,
-RgrUeCfg *ueCfg
-));
-
-S16 rgSCHRamRmvAllFrmEmtcRaInfoSchdLst
-(
-RgSchCellCb *cell
-);
-Void rgSCHEmtcUtlUpdCmnNb
-(
-RgSchRaCb *raCb
-);
-Void rgSCHEmtcHqPAlloc
-(
-RgSchCellCb *cell,
-RgSchDlHqEnt *hqEnt
-);
-#endif
-/* local defines */
-/* local typedefs */
-static Void rgSCHRamUlFreeAllocation ARGS((RgSchUlSf *sf,RgSchUlAlloc *alloc,
- RgSchCellCb *cell,Bool isEmtc));
-
-static S16 rgSCHRamContResCrnti ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- RgSchRaCb *raCb, RgSchErrInfo *err));
-static S16 rgSCHRamContResCcchsdu ARGS((RgSchCellCb *cell, RgSchRaCb *raCb));
-#ifdef EMTC_ENABLE
-
-S16 rgSCHEmtcRamContResCcchsdu ARGS((RgSchCellCb *cell, RgSchRaCb *raCb));
-S16 rgSCHRamEmtcContResCcchsdu ARGS((RgSchCellCb *cell, RgSchRaCb *raCb));
-Void rgSCHChkEmtcContResGrdTmrExp ARGS((RgSchCellCb *cell));
-Void rgSCHChkEmtcContResTmrExp ARGS((RgSchCellCb *cell));
-Void rgSCHEmtcRaInfoFree ARGS((RgSchCellCb *cell, RgSchRaCb *raCb));
-#endif
-#ifdef RGR_V1
-static Void rgSCHChkContResGrdTmrExp ARGS((RgSchCellCb *cell));
-static Void rgSCHChkContResTmrExp ARGS((RgSchCellCb *cell));
-static Void rgSCHRamProcContResExp ARGS((RgSchCellCb *cell,
- RgSchRaCb *raCb));
-static Void rgSCHRamProcContResGrdExp ARGS((RgSchCellCb *cell,
- RgSchRaCb *raCb));
-#ifdef EMTC_ENABLE
-Void rgSCHChkEmtcContResGrdTmrExp ARGS((RgSchCellCb *cell));
-Void rgSCHChkEmtcContResTmrExp ARGS((RgSchCellCb *cell));
-#endif
-#endif
-/* forward references */
-
-/**
- * @brief Check configured preamble id not colliding with non dedicated or PDCCH
- * order preamble sets. When valid preamble id given check that C-RNTI given
- * in configuration is not amongst the C-RNTI'smanaged by scheduler
- *
- * @details
- *
- * Function : rgSCHRamVldtUeCfg
- *
- * Processing Steps: Check configured preamble id not colliding with non dedicated or PDCCH
- * order preamble sets. When valid preamble id given check that C-RNTI given
- * in configuration is not amongst the C-RNTI'smanaged by scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgrUeCfg *ueCfg
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHRamVldtUeCfg(RgSchCellCb *cell,RgrUeCfg *ueCfg)
-{
- if (ueCfg->dedPreambleId.pres == PRSNT_NODEF)
- {
- if ((ueCfg->dedPreambleId.val < cell->rachCfg.numRaPreamble) ||
- (ueCfg->dedPreambleId.val >= RGSCH_MAX_NUM_RA_PREAMBLE) ||
- ((ueCfg->dedPreambleId.val >= cell->macPreambleSet.start) &&
- (ueCfg->dedPreambleId.val <= cell->macPreambleSet.start +
- cell->macPreambleSet.size - 1)) ||
- ((ueCfg->crnti >= cell->rntiDb.rntiStart) &&
- (ueCfg->crnti < cell->rntiDb.rntiStart + cell->rntiDb.maxRntis-1))
-#ifdef EMTC_ENABLE
- || (rgSCHRamVldtRgrEmtcUeCfg(cell,ueCfg))
-#endif
- )
- {
- return RFAILED;
- }
- }
- return ROK;
-}
-
-/**
- * @brief Handler for Random Access Request
- *
- * @details
- *
- * Function : rgSCHRamProcRaReq
- *
- * -# Create a node for each TfuRaReqInfo element received
- * -# Initialize the list with the above elements at the raRnti index
- * in the cell.
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] CmLteRnti raRnti
- * @param[in] RgTfuRaReqInd *raReqInd
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHRamProcRaReq
-(
-uint8_t raReqCnt,
-RgSchCellCb *cell,
-CmLteRnti raRnti,
-TfuRachInfo *raReqInd,
-CmLteTimingInfo timingInfo,
-RgSchUeCb *ue,
-RgSchErrInfo *err
-)
-{
- RgSchRaReqInfo *raReqInfo;
- uint16_t raIndex;
-#ifdef LTE_TDD
- uint8_t fid;
- uint8_t tid;
-#endif
-
-
-
- /* SR_RACH_STATS : RACH REQ */
- rgNumPrachRecvd += raReqInd->numRaReqInfo;
-
- /* ccpu00132523- Moved out this from for loop as updating of raIndex is
- * relates to only raRnti and all preambles having same raRnti*/
-#ifdef LTE_TDD
- /* UL subframes do not occupy all the subframes in a radio frame.
- * So RA Rnti index to be calculated based on actual UL subframe index. */
- /* Get the actual subframe number */
- tid = (raRnti-1)%RGSCH_NUM_SUB_FRAMES;
- /* Get the frequency index in the subframe */
- fid = ((raRnti-1) / RGSCH_NUM_SUB_FRAMES)* RGSCH_NUM_SUB_FRAMES;
- /* Get the index of RA RNTI in the array */
- raIndex = ((timingInfo.sfn % cell->raInfo.maxRaSize) \
- * RGSCH_MAX_RA_RNTI_PER_SUBFRM * RGSCH_NUM_SUB_FRAMES) + \
- tid + fid;
- /* Fixes for RACH handling in TDD: Removed deletion of queued RaReq */
-#else
- /* ccpu00132523- Placing the raReq into array based on RA SFN */
- raIndex = (timingInfo.sfn & 1) * RGSCH_MAX_RA_RNTI + raRnti-1;
-#endif
-
- /* allocate new raReqInfos and enqueue them */
- if (raReqInd->raReqInfoArr[raReqCnt].rapId >= RGSCH_MAX_NUM_RA_PREAMBLE)
- {
- DU_LOG("\nERROR --> SCH : RARNTI:%d rgSCHTomRaReqInd(): RAM processing failed", raReqInd->raRnti);
- return RFAILED;
- }
-
- /* SR_RACH_STATS : DED PREAMB*/
- if (RGSCH_IS_DEDPRM(cell, raReqInd->raReqInfoArr[raReqCnt].rapId))
- {
- rgNumDedPream++;
- }
-
-
-#ifdef LTE_L2_MEAS
- if (raReqInd->raReqInfoArr[raReqCnt].rapId < cell->rachCfg.sizeRaPreambleGrpA)
- {
- cell->raPrmbs.preamGrpA++;
- }
- else if (RGSCH_IS_DEDPRM(cell, raReqInd->raReqInfoArr[raReqCnt].rapId))
- {
- cell->raPrmbs.dedPream++;
- }
- else
- {
- cell->raPrmbs.preamGrpB++;
- }
-#endif
-
- if((rgSCHUtlAllocSBuf(cell->instIdx, (Data **)(&raReqInfo),
- sizeof(RgSchRaReqInfo))) == RFAILED)
- {
- DU_LOG("\nERROR --> SCH : rgSCHRamProcRaReq(): Allocation"
- " of RaReq failed RARNTI:%d",raRnti);
- err->errCause = RGSCHERR_RAM_MEM_EXHAUST;
- return RFAILED;
- }
-
- /* Insert the given raReqInfo */
- /* RACHO */
- raReqInfo->timingInfo = timingInfo;
- raReqInfo->raReq = raReqInd->raReqInfoArr[raReqCnt];
- raReqInfo->raReqLstEnt.next = NULLP;
- raReqInfo->raReqLstEnt.prev = NULLP;
- raReqInfo->raReqLstEnt.node = (PTR)raReqInfo;
- /* ccpu00133504 */
- raReqInfo->ue = ue;
-
-#ifndef LTE_TDD
- RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, cell->raInfo.raReqLst, raIndex);
-#endif
- /* RACHO: If dedicated preamble, then give preference by appending at front */
- if (RGSCH_IS_DEDPRM(cell, raReqInd->raReqInfoArr[raReqCnt].rapId))
- {
- cmLListFirst(&cell->raInfo.raReqLst[raIndex]);
- cmLListInsCrnt(&cell->raInfo.raReqLst[raIndex], &raReqInfo->raReqLstEnt);
- }
- else
- {
- cmLListAdd2Tail(&cell->raInfo.raReqLst[raIndex], &raReqInfo->raReqLstEnt);
- }
-
- return ROK;
-} /* rgSCHRamProcRaReq */
-
-/**
- * @brief Handler for Random Access control block creation
- *
- * @details
- *
- * Function : rgSCHRamCreateRaCb
- * Creates a raCb and gives the same to scheduler for its updation
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in, out] RgSchRaCb **raCb
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHRamCreateRaCb
-(
-RgSchCellCb *cell,
-RgSchRaCb **raCb,
-RgSchErrInfo *err
-)
-{
- RgSchRntiLnk *rntiLnk;
- Inst inst = cell->instIdx;
-
-
- if((rgSCHUtlAllocSBuf(inst, (Data **)(raCb),
- sizeof(RgSchRaCb))) == RFAILED)
- {
- DU_LOG("\nERROR --> SCH : rgSCHRamCreateRaCb(): Allocation of "
- "RaCb failed");
- err->errCause = RGSCHERR_RAM_MEM_EXHAUST;
- return RFAILED;
- }
-
- rntiLnk = rgSCHDbmGetRnti(cell);
- if(rntiLnk != NULLP)
- {
- (*raCb)->rntiLnk = rntiLnk;
- (*raCb)->tmpCrnti = rntiLnk->rnti;
- }
- else
- {
-
- /* SR_RACH_STATS: RNTI POOL Exhaution */
- rgNumRarFailDuetoRntiExhaustion++;
-
- /* No rnti available! */
- DU_LOG("\nERROR --> SCH : rgSCHRamCreateRaCb(): Allocation of "
- "temporary RNTI failed at MAC(CRNTI exhausted)");
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(inst, (Data **)(raCb), sizeof(RgSchRaCb));
- err->errCause = RGSCHERR_RAM_RNTI_EXHAUST;
- return RFAILED;
- }
-
- /* Allocate and initialize the DL HARQ portion of the RACB */
- (*raCb)->dlHqE = rgSCHDhmHqEntInit(cell);
- if ((*raCb)->dlHqE == NULLP)
- {
- /* No memory available! */
- DU_LOG("\nERROR --> SCH : rgSCHRamCreateRaCb(): Creation of"
- " DL HARQ failed");
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(inst, (Data **)(raCb), sizeof(RgSchRaCb));
- err->errCause = RGSCHERR_RAM_MEM_EXHAUST;
- return RFAILED;
- }
-#ifdef EMTC_ENABLE
- (*raCb)->isEmtcRaCb = FALSE;
- rgSCHEmtcHqPAlloc(cell, (*raCb)->dlHqE);
-#endif
- (*raCb)->dlHqE->raCb = (*raCb);
- /* Initialize RaCb's contents */
- (*raCb)->timingInfo = cell->crntTime;
- (*raCb)->raState = RGSCH_RA_MSG3_PENDING;
- (*raCb)->toDel = FALSE;
- (*raCb)->phr.pres = FALSE;
-
- /* Insert the created raCb into raCb list of cell */
- (*raCb)->raCbLnk.node = (PTR)(*raCb);
- cmLListAdd2Tail(&cell->raInfo.raCbLst, &(*raCb)->raCbLnk);
-
- return ROK;
-} /* rgSCHRamCreateRaCb */
-
-/**
- * @brief Handler for Ue Configuration Request
- *
- * @details
- *
- * Function : rgSCHRamRgrUeCfg
- *
- * This function handles the UE config received based on the state of the
- * raCb.
- * -# If raCb is in RGSCH_RA_MSG4_PENDING state, it shall update the harq
- * information to UeCb and update the references.
- * -# If raCb is in RGSCH_RA_MSG4_DONE, then it shall free the raCb
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in,out] RgSchUeCb *ue
- * @param[in,out] RgSchRaCb *raCb
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHRamRgrUeCfg
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchRaCb *raCb,
-RgSchErrInfo *err
-)
-{
- /* Releasing HARQ processes of old UE when ue
- * reconfig with new crnti */
- /* uint32_t cnt; */
- RgSchDlHqEnt **hqEnt = &(RG_SCH_CMN_GET_UE_HQE(ue, cell));
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell);
-
-
- /* Fix : set UE inactive in DL until UE is reinitialization completed */
- ue->dl.dlInactvMask |= RG_HQENT_INACTIVE;
- ue->ul.ulInactvMask |= RG_HQENT_INACTIVE;
-
- if(raCb->raState == RGSCH_RA_MSG4_PENDING)
- {
- raCb->ue = ue;
- ue->rntiLnk = raCb->rntiLnk;
- /* Update UL Harq process information */
- /*ccpu00128820 - MOD - Msg3 alloc double delete issue*/
- ueUl->hqEnt.hqProcCb[raCb->msg3HqProcId].ndi = raCb->msg3HqProc.ndi;
- }
- else if(raCb->raState == RGSCH_RA_MSG4_DONE)
- {
- ue->rntiLnk = raCb->rntiLnk;
- /* Update UL Harq process information */
- /*ccpu00128820 - MOD - Msg3 alloc double delete issue*/
- ueUl->hqEnt.hqProcCb[raCb->msg3HqProcId].ndi = raCb->msg3HqProc.ndi;
- /* Fix : syed Assign hqEnt to UE only if msg4 is done */
- rgSCHDhmAssgnUeHqEntFrmRaCb(ue, raCb);
- }
- else
- {
- err->errCause = RGSCHERR_RAM_NO_MSG3_RCVD;
- *hqEnt = NULLP;
- raCb->dlHqE->ue = NULLP;
- return RFAILED;
- }
-
- return ROK;
-} /* rgSCHRamRgrUeCfg */
-
-
-/**
- * @brief Handler for C-RNTI based contention resolution
- *
- * @details
- *
- * Function : rgSCHRamContResCrnti
- *
- * This function shall be invoked once Msg3 indicates C-RNTI based
- * contention resolution.This shall indicate the scheduler regarding
- * C-RNTI based uplink grant.
- *
- *
- * @param[in,out] RgSchCellCb *cell
- * @param[in,out] RgSchUeCb *ue
- * @param[in,out] RgSchRaCb *raCb
- * @return S16
- * -# ROK
- **/
-static S16 rgSCHRamContResCrnti
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchRaCb *raCb,
-RgSchErrInfo *err
-)
-{
- TfuUlCqiRpt ulCqiRpt;
- RgSchCmnCell *cellSch= (RgSchCmnCell *)(cell->sc.sch);
-
-
- /* Fix: syed It is incorrect to copy over msg3HqProc to ueCb's
- * UL harq proc. In case of Crnti based RACH, ueCb has valid context which
- * cannot be over written. It was leading to a crash. */
-
- rgSCHUtlRecMsg3Alloc(cell, ue, raCb);
-
- /* Fix for ccpu00123908: Reset the UL CQI to the cell default value here */
- ulCqiRpt.isTxPort0 = TRUE;
- ulCqiRpt.numSubband = 0;
- /* Fix : syed HO UE does not have a valid ue->rntiLnk */
- ulCqiRpt.rnti = ue->ueId;
- /* rg002.301:[ccpu00124018]-MOD- Avoiding hard coding of CQI and retriving from cell config*/
- ulCqiRpt.wideCqi = cellSch->ul.dfltUlCqi;
- rgSCHUtlUlCqiInd(cell, ue, &ulCqiRpt);
-
-
- /* Invoke scheduler to indicate UL grant req for contention resolution */
- rgSCHUtlContResUlGrant(cell, ue, err);
-
- if (raCb->phr.pres == TRUE)
- {
- rgSCHUtlUpdPhr(cell, ue, raCb->phr.val, err);
- }
- /* No need of raCb any more */
- rgSCHRamDelRaCb(cell, raCb, TRUE);
-
- return ROK;
-} /* rgSCHRamContResCrnti */
-
-
-/**
- * @brief Handler for CCCH SDU based contention resolution
- *
- * @details
- *
- * Function : rgSCHRamContResCcchsdu
- *
- * This function shall be invoked once Msg3 indicates contention resolution
- * based on CCCH sdu. This shall update the raCb state to
- * RGSCH_RA_MSG4_PENDING.
- *
- *
- * @param[in,out] RgSchRaCb *raCb
- * @return S16
- * -# ROK
- **/
-static S16 rgSCHRamContResCcchsdu
-(
-RgSchCellCb *cell,
-RgSchRaCb *raCb
-)
-{
-#ifdef RGR_V1
- CmLteTimingInfo expTime = {0};
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-#endif
- if(raCb->raState != RGSCH_RA_MSG3_PENDING)
- {
- DU_LOG("\nERROR --> SCH : RNTI:%d RaCb in wrong State %d Drop Msg 3",
- raCb->rntiLnk->rnti,
- raCb->raState);
- return ROK;
- }
-
- raCb->raState = RGSCH_RA_MSG4_PENDING;
-
-#ifdef RGR_V1
- if(cell->rachCfg.contResTmr - cellSch->dl.msg4TxDelay > 0)
- {
- /* Set the contension resolution guard timer =
- Cont Res Timer - Max msg4 Tx Delay */
- RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, expTime,
- (cell->rachCfg.contResTmr - cellSch->dl.msg4TxDelay));
- }
- else
- {
- /* Schedule the CRI CE in the next Sf itself */
- RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, expTime, 1);
- }
- raCb->expiryTime = expTime;
- raCb->contResTmrLnk.node = (PTR)(raCb);
- cmLListAdd2Tail(&(cell->contResGrdTmrLst), &(raCb->contResTmrLnk));
-#endif
- return ROK;
-} /* rgSCHRamContResCcchsdu */
-
-
-/**
- * @brief Handler for Msg3
- *
- * @details
- *
- * Function : rgSCHRamProcMsg3
- *
- * This function processes the received Msg3 and identifies the type of
- * contention resolution and act accordingly.
- *
- *
- * @param[in,out] RgSchCellCb *cell
- * @param[in,out] RgSchUeCb *ue
- * @param[in,out] RgSchRaCb *raCb
- * @return S16
- * -# ROK
- **/
-S16 rgSCHRamProcMsg3
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchRaCb *raCb,
-RgInfUeDatInd *pdu,
-RgSchErrInfo *err
-)
-{
-
-
- /* Update raCb with PHR if received along with Msg3 */
- if (pdu->ceInfo.bitMask & RGSCH_PHR_CE_PRSNT)
- {
- /* PHR present */
- raCb->phr.pres = TRUE;
- raCb->phr.val = pdu->ceInfo.ces.phr;
- }
- if (ue)
- {
- rgSCHRamContResCrnti(cell, ue, raCb, err);
- }
- else
- {
-#ifdef EMTC_ENABLE
- if(TRUE == raCb->isEmtcRaCb)
- {
- /* starting the emtc Contention resolution timer */
- rgSCHRamEmtcContResCcchsdu(cell,raCb);
- }
- else
-#endif
- {
- rgSCHRamContResCcchsdu(cell, raCb);
- }
- }
-
- return ROK;
-} /* rgSCHRamProcMsg3 */
-
-
-/**
- * @brief Handler for Updating Bo received in StaRsp
- *
- * @details
- *
- * Function : rgSCHRamUpdtBo
- *
- * This function shall be invoked by RAM once it receives staRsp on CCCH
- *
- * @param[in] RgSchCellCb *cell
- * @param[in,out] RgSchRaCb *raCb
- * @param[in] RgRguCmnStaRsp *staRsp
- * @return S16
- * -# ROK
- **/
-S16 rgSCHRamUpdtBo
-(
-RgSchCellCb *cell,
-RgSchRaCb *raCb,
-RgInfCmnBoRpt *staRsp
-)
-{
-
- /* Update Bo in RaCb */
- raCb->dlCcchInfo.bo = (uint32_t)(staRsp->bo);
- /* SR_RACH_STATS : MSG4 WITH CCCH SDU */
- rgNumMsg4WithCCCHSdu++;
-
- /* add this to the "tobeSchdLst" */
- /* MSG4 Fix Start */
- rgSCHRamAddToRaInfoSchdLst(cell, raCb);
- /* MSG4 Fix End */
-
- return ROK;
-} /* rgSCHRamUpdtBo */
-
-/**
- * @brief Handler for Msg3 Feedback indication
- *
- * @details
- *
- * Function : rgSCHRamMsg3DatInd
- *
- * This function shall be invoked by TOM once the transmission of Msg4 is
- * ACKed/NACKed.
- * This shall invoke UHM to set ACK for Msg3 reception.
- *
- * @param[in,out] RgSchRaCb *raCb
- * @return S16
- * -# ROK
- **/
-S16 rgSCHRamMsg3DatInd(RgSchRaCb *raCb)
-{
-
- /* SR_RACH_STATS : MSG3 ACK*/
- rgNumMsg3CrcPassed++;
- /*ccpu00128820 - MOD - Msg3 alloc double delete issue*/
- rgSCHUhmProcMsg3DatInd(&(raCb->msg3HqProc));
-
- return ROK;
-} /* rgSCHRamMsg3DatInd */
-
-/**
- * @brief Handler for Msg3 Feedback indication
- *
- * @details
- *
- * Function : rgSCHRamMsg3FailureInd
- *
- * This function shall be invoked by TOM once the transmission of Msg4 is
- * ACKed/NACKed.
- * This shall invoke UHM to set ACK for Msg3 reception.
- *
- * @param[in,out] RgSchRaCb *raCb
- * @return S16
- * -# ROK
- **/
-S16 rgSCHRamMsg3FailureInd(RgSchRaCb *raCb)
-{
-
- /*ccpu00128820 - MOD - Msg3 alloc double delete issue*/
- rgSCHUhmProcMsg3Failure(&(raCb->msg3HqProc));
-
- return ROK;
-} /* rgSCHRamMsg3FailureInd */
-
-/**
- * @brief Handler for Msg4 Feedback indication
- *
- * @details
- *
- * Function : rgSCHRamMsg4FdbkInd
- *
- * This function shall be invoked by TOM once the transmission of Msg4 is
- * ACKed/NACKed.
- * This shall invoke UHM to set ACK for Msg3 reception.
- *
- * @param[in,out] RgSchRaCb *raCb
- * @return S16
- * -# ROK
- **/
-S16 rgSCHRamMsg4FdbkInd(RgSchRaCb *raCb)
-{
-
- return ROK;
-} /* rgSCHRamMsg4FdbkInd */
-
-
-/**
- * @brief Handler for Msg4 state updation
- *
- * @details
- *
- * Function : rgSCHRamMsg4Done
- *
- * This function shall be invoked by DHM once the transmission of Msg4 is
- * done. This shall delete the raCb if there is a valid Ue or if this is to
- * be deleted. If not this shall update the state of the raCb.
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in,out] RgSchRaCb *raCb
- * @return S16
- * -# ROK
- **/
-S16 rgSCHRamMsg4Done(RgSchCellCb *cell,RgSchRaCb *raCb)
-{
-
- DU_LOG("\nDEBUG --> SCH : rgSCHRamMsg4Done(): tmpCRNTI = %u",
- raCb->tmpCrnti);
-
- if(raCb->ue != NULLP)
- {
- /* Fix : syed Let this funtion decide on releasing
- * hqP than the caller of this function otherwise sometimes it
- * might lead to incorrec NDI setting. */
- rgSCHDhmRlsHqpTb(raCb->dlHqE->msg4Proc, 0, TRUE);
- /* Fix : syed Assign hqEnt to UE only if msg4 is done */
- rgSCHDhmAssgnUeHqEntFrmRaCb(raCb->ue, raCb);
-#ifdef EMTC_ENABLE
- if(TRUE == raCb->isEmtcRaCb)
- {
- rgSCHEmtcUtlUpdCmnNb(raCb);
- }
-#endif
- /* MS_FIX :Proceed to CCCH scheduling irrespective of
- * MSG4 result */
- if (raCb->ue->dlCcchInfo.bo)
- {
-#ifdef EMTC_ENABLE
- /*if CR-ID Ack has been received ,Add emtc Ue to cchSduUeLst*/
- if(TRUE == raCb->isEmtcRaCb)
- {
- rgSCHUtlAddUeToEmtcCcchSduLst(cell, raCb->ue);
- }
- else
-#endif
- {
- rgSCHUtlAddUeToCcchSduLst(cell, raCb->ue);
- }
- }
- /* Rnti shall not be released as Ue exists with this rnti */
- rgSCHRamDelRaCb(cell, raCb, FALSE);
- }
- else if(raCb->toDel == TRUE)
- {
-#ifdef XEON_SPECIFIC_CHANGES
- DU_LOG("\nDEBUG --> SCH : Deleting RacB:%d\n", raCb->tmpCrnti);
-#endif
- /* Delete RACB and release RNTI */
- rgSCHRamDelRaCb(cell, raCb, TRUE);
- }
- else
- {
-#ifdef XEON_SPECIFIC_CHANGES
- DU_LOG("\nDEBUG --> SCH : Releasing Harq of RacB:%d\n", raCb->tmpCrnti);
-#endif
- raCb->raState = RGSCH_RA_MSG4_DONE;
- /* Release harq process as final feedback is received for Msg4. In other
- * cases, delRaCb will take care of releasing the harq process */
- DU_LOG("\nDEBUG --> SCH : Harq process released ");
- rgSCHDhmRlsHqpTb(raCb->dlHqE->msg4Proc, 0, TRUE);
- }
-
- return ROK;
-} /* rgSCHRamMsg4Done */
-
-
-/**
- * @brief Handler for deletion
- *
- * @details
- *
- * Function : rgSCHRamDelRaCb
- *
- * This function shall be invoked whenever a raCb needs to be deleted.
- * Invoked by both RAM and downlink scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in,out] RgSchRaCb *raCb
- * @param[in] Bool rlsRnti
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHRamDelRaCb(RgSchCellCb *cell,RgSchRaCb *raCb,Bool rlsRnti)
-{
- Inst inst = cell->instIdx;
- Bool isEmtc = FALSE;
-
- /* Delete from all the lists it is enqueued */
- cmLListDelFrm(&(cell->raInfo.raCbLst),&(raCb->raCbLnk));
-#ifdef EMTC_ENABLE
- /*ue Type is EMTC, then Delete the toBeSchedLst and stop the Guard Timer */
- if(TRUE == raCb->isEmtcRaCb)
- {
- rgSCHRamEmtcDelRaCb(cell,raCb);
- isEmtc = TRUE;
- }
- else
-#endif
- {
- if (raCb->schdLnk.node == (PTR)raCb)
- {
- rgSCHRamRmvFrmRaInfoSchdLst(cell, raCb);
- }
-#ifdef RGR_V1
- else if(raCb->contResTmrLnk.node != NULLP)
- {
- cmLListDelFrm(&cell->contResGrdTmrLst, &(raCb->contResTmrLnk));
- raCb->contResTmrLnk.node = NULLP;
- }
-#endif
- }
-
- if(rlsRnti == TRUE)
- {
- rgSCHUtlRlsRnti(cell, raCb->rntiLnk, FALSE, 0);
- }
-
- /* Check if msg4 Hq Proc has been released. If not, release it */
- if (raCb->dlHqE )
- {
- if (raCb->dlHqE->msg4Proc != NULLP)
- {
- /* Fix: syed Remove the msg4Proc if it waiting in sf->tbs list for
- * harq feedback */
- if ((raCb->dlHqE->msg4Proc->subFrm != NULLP) &&
- (raCb->dlHqE->msg4Proc->hqPSfLnk.node != NULLP))
- {
- DU_LOG("\nERROR --> SCH : TMP CRNTI:%d RACH FAILURE!! "
- "msg4proc removed from SF", raCb->tmpCrnti);
- rgSCHUtlDlHqPTbRmvFrmTx(raCb->dlHqE->msg4Proc->subFrm,
- raCb->dlHqE->msg4Proc, 0, FALSE);
- }
- /* Fix: syed Remove the msg4Proc from cell
- * msg4Retx Queue. I have used CMN scheduler function
- * directly. Please define a new API and call this
- * function through that. */
- rgSCHCmnDlMsg4ProcRmvFrmRetx(cell, raCb->dlHqE->msg4Proc);
- rgSCHDhmRlsHqpTb(raCb->dlHqE->msg4Proc, 0, TRUE);
- }
-
- /* Mark the raCb pointer in dlHqE to NULLP */
- raCb->dlHqE->raCb = NULLP;
-
- rgSCHDhmDelHqEnt(cell, &raCb->dlHqE);
- }
- /* Fix: syed Adaptive Msg3 Retx crash. Remove the harqProc
- * from adaptive retx List. Free the alloc if it exists. */
- if (raCb->msg3HqProc.reTxLnk.node)
- {
- //TODO_SID: Need to take care of retxLst
- //cmLListDelFrm(raCb->msg3HqProc.reTxAlloc.reTxLst, &raCb->msg3HqProc.reTxLnk);
- raCb->msg3HqProc.reTxLnk.node = (PTR)NULLP;
- }
-
- if (raCb->msg3HqProc.alloc)
- {
- /* Fix: syed During GPR, please write an API instead of direct
- * call to cmn scheduler function */
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- /*ccpu00130356 - MOD- To avoid segmentation problem because of double
- free due to recursive calling of rgSCHRamDelRaCb*/
- rgSCHRamUlFreeAllocation(&cellUl->ulSfArr[raCb->msg3HqProc.ulSfIdx],
- raCb->msg3HqProc.alloc,
- cell,isEmtc);
- }
-
-#ifdef EMTC_ENABLE
- if(TRUE == raCb->isEmtcRaCb)
- {
- rgSCHEmtcRaInfoFree(cell, raCb);
- }
-#endif
- rgSCHUtlFreeSBuf(inst, (Data **)&raCb, sizeof(RgSchRaCb));
-
- return ROK;
-} /* rgSCHRamDelRaCb */
-
-
-/**
- * @brief TTI Handler for RAM module
- *
- * @details
- *
- * Function : rgSCHRamTtiHndlr
- *
- * This function shall be invoked upon TtiInd by TOM
- * This shall
- * - remove RaReqs added to the queue for a raRnti for which PHY may
- * give the requests in the next subframe
- * - remove raCbs which are not yet processed once the
- * counter for raCb processing expires.
- *
- *
- * @param[in,out] RgSchCellCb *cell
- * @return S16
- * -# ROK
- **/
-S16 rgSCHRamTtiHndlr(RgSchCellCb *cell)
-{
- RgSchRaCb *raCb;
- uint16_t raSfn;
- uint16_t crntSfn;
- uint16_t dist; /* Number of frames between raCb's creation and crnt frame */
- uint8_t idx;
- uint32_t maxCnt;
-#ifndef LTE_TDD
- uint8_t winGap;
- uint8_t raIdx;
- RgSchRaReqInfo *raReqInfo;
-#else
- CmLteTimingInfo frm;
- uint8_t raIdx;
-#endif
-
-
- crntSfn = cell->crntTime.sfn;
-
-#ifdef RGR_V1
- /*Check if Contention resolution guard timer expiring in the TTI*/
- rgSCHChkContResGrdTmrExp(cell);
- /*Check if Contention resolution timer expiring in the TTI*/
- rgSCHChkContResTmrExp(cell);
-#ifdef EMTC_ENABLE
- /*Check if EMTC Contention resolution guard timer expiring in the TTI*/
- rgSCHChkEmtcContResGrdTmrExp(cell);
- /*Check if EMTC Contention resolution timer expiring in the TTI*/
- rgSCHChkEmtcContResTmrExp(cell);
-#endif
-#endif
-#ifndef LTE_TDD
-
- /* Delete the RA requests for which RAR window expired in this subframe
- * And were not considered for RAR scheduling*/
- winGap = (rgRaPrmblToRaFrmTbl[cell->rachCfg.preambleFormat]-1)+
- (cell->rachCfg.raWinSize -1 ) + RGSCH_RARSP_WAIT_PERIOD;
-
- raIdx = (((crntSfn & 1) * RGSCH_MAX_RA_RNTI+ cell->crntTime.slot
- + RG_SCH_CMN_DL_DELTA - winGap)+ RGSCH_RAREQ_ARRAY_SIZE )
- % RGSCH_RAREQ_ARRAY_SIZE;
-
- /* Flush the already existing raReqs against the given raRnti */
-
- maxCnt = cell->raInfo.raReqLst[raIdx].count;
- for (idx = 0; idx < maxCnt; idx++)
- {
- raReqInfo = (RgSchRaReqInfo *)(cell->raInfo.raReqLst[raIdx].first->node);
- cmLListDelFrm(&(cell->raInfo.raReqLst[raIdx]),&(raReqInfo->raReqLstEnt));
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&raReqInfo,
- sizeof(RgSchRaReqInfo));
- }
-#else
- /* Fixes for RACH handling: Added deletion of queued RaReq */
- frm = cell->crntTime;
- RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA);
- if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx][frm.slot] !=
- RG_SCH_TDD_UL_SUBFRAME)
- {
- raIdx = rgSchTddNumDlSubfrmTbl[cell->ulDlCfgIdx][frm.slot]-1;
- rgSCHRamDelRaReq(cell, cell->crntTime, raIdx);
- }
-#endif
-
- /* Remove the RACBs which are timed out */
- /* ccpu00132536:MOD- racb timeout will be verified in each SFN such that
- * the RACB whose processing is not completed in RG_MAX_RA_PRC_FRM
- * will be deleted*/
- if (cell->crntTime.slot == 0)
- {
- maxCnt = cell->raInfo.raCbLst.count;
- for (idx = 0; idx < maxCnt; idx++)
- {
- raCb = (RgSchRaCb *)(cell->raInfo.raCbLst.first->node);
- /* Calculate number of frames between raCb's creation and crnt frame */
- raSfn = raCb->timingInfo.sfn;
- dist = (crntSfn + (RGSCH_MAX_SFN - raSfn)) % RGSCH_MAX_SFN;
- /* Delete RaCbs whose processing is not complete within
- * "cell->t300TmrVal" frames */
- /* raCb not to be deleted if msg4 is not completed */
- /* raCb should not be deleted(RNTI should not be released) if UE is present
- * as it means the application still holds the RNTI. raCb will get deleted
- * as part of UE deletion. raCb will anyway get deleted without releasing RNTI on success/failure of MSG4*/
-
- if (dist >= cell->t300TmrVal)
- {
- if ((raCb->dlHqE->msg4Proc == NULLP) && (raCb->dlHqE->ue == NULLP))
- {
- rgSCHRamDelRaCb(cell, raCb, TRUE);
- }
- }
- else
- {
- break;
- }
- }
- }
-
- return ROK;
-} /* rgSCHRamTtiHndlr */
-
-
-/**
- * @brief Function for handling cell delete
- *
- * @details
- *
- * Function : rgSCHRamFreeCell
- *
- * This function shall be invoked whenever a cell needs to be deleted.
- * This shall remove raCbs and raReqs stored in cell.
- *
- *
- * @param[in,out] RgSchCellCb *cell
- * @return S16
- * -# ROK
- **/
-S16 rgSCHRamFreeCell(RgSchCellCb *cell)
-{
- RgSchRaReqInfo *raReqInfo;
- RgSchRaCb *raCb;
- uint8_t idx;
- uint8_t raCbCnt;
- Inst inst = cell->instIdx;
- uint8_t lstSz;
-#ifdef LTE_TDD
- uint8_t maxUlSubframes;
- uint8_t maxDlSubframes;
-#endif
-
-
-
-
-#ifdef LTE_TDD
- maxUlSubframes =
- rgSchTddNumUlSubfrmTbl[cell->ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1];
- maxDlSubframes =
- rgSchTddNumDlSubfrmTbl[cell->ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1];
- lstSz = cell->raInfo.maxRaSize * RGSCH_MAX_RA_RNTI_PER_SUBFRM * \
- maxUlSubframes;
-#else
- /* ccpu00133557- MEM LEAK FIX- Need to free all the nodes in RA Array list */
- lstSz = RGSCH_RAREQ_ARRAY_SIZE;
-#endif
-
- for (idx = 0; idx < lstSz; idx++)
- {
- /* Delete and free raReqs stored */
- /* ccpu00133557- MEM LEAK FIX- Need to be freed till the count is non-zero */
- while(cell->raInfo.raReqLst[idx].count)
- {
- raReqInfo = (RgSchRaReqInfo *)(cell->raInfo.raReqLst[idx].first->node);
- cmLListDelFrm(&(cell->raInfo.raReqLst[idx]),&(raReqInfo->raReqLstEnt));
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(inst, (Data **)&raReqInfo, sizeof(RgSchRaReqInfo));
- }
- }
-
-#ifdef LTE_TDD
- /* Delete the RACH response list*/
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(inst,
- (Data **)(&(cell->rachRspLst)), sizeof(RgSchTddRachRspLst) * \
- maxDlSubframes);
-#endif
-
- /* Delete raCbs in the "to be scheduled" list */
- /* ccpu00133557- MEM LEAK FIX- Need to be freed till the count is non-zero */
- while(cell->raInfo.toBeSchdLst.count)
- {
- raCb = (RgSchRaCb *)(cell->raInfo.toBeSchdLst.first->node);
- /* MSG4 Fix Start */
-
- rgSCHRamRmvFrmRaInfoSchdLst(cell, raCb);
- /* MSG4 Fix End */
- }
-#ifdef EMTC_ENABLE
- /* Delete raCbs in the "Emtc to be scheduled" list */
- if(cell->emtcEnable)
- {
- rgSCHRamRmvAllFrmEmtcRaInfoSchdLst(cell);
- }
-#endif
-
- raCbCnt = cell->raInfo.raCbLst.count;
-
- /* Delete and free raCbs stored */
- for (idx = 0; idx < raCbCnt; idx++)
- {
- raCb = (RgSchRaCb *)(cell->raInfo.raCbLst.first->node);
- rgSCHRamDelRaCb(cell, raCb, TRUE);
- }
-
- return ROK;
-} /* rgSCHRamFreeCell */
-#ifdef RGR_V1
-static Void rgSCHRamProcContResExp(RgSchCellCb *cell,RgSchRaCb *raCb)
-{
- raCb->expiryTime.sfn = RGSCH_CONTRES_EXP;
- /*MSG4 Fix*/
- if (raCb->ue)
- {
- /* UE exists and RNTI will be released as part of UE DEL */
- rgSCHRamDelRaCb(cell, raCb, FALSE);
- }
- else
- {
- /* Calling Release RNTI, which would perform Racb deletion
- * RNTI removal and RNTI release indication to MAC. */
- /* Delete RACB and release RNTI */
- rgSCHRamDelRaCb(cell, raCb, TRUE);
- }
- return;
-}
-
-static Void rgSCHRamProcContResGrdExp(RgSchCellCb *cell,RgSchRaCb *raCb)
-{
-
-
-/*Guard timer has expired, schedule only the contention REsolution CE with
- * zero bo*/
- raCb->dlCcchInfo.bo = 0;
- /* SR_RACH_STATS : MSG4 WO CCCH SDU */
- rgNumMsg4WoCCCHSdu++;
-
- /* add this to the "tobeSchdLst" */
- raCb->schdLnk.node = (PTR)(raCb);
-
- cmLListDelFrm(&cell->contResGrdTmrLst, &(raCb->contResTmrLnk));
- raCb->contResTmrLnk.node = NULLP;
-
- /* MSG4 Fix Start */
- DU_LOG("\nDEBUG --> SCH : Con Res Grd Tmr exp RNTI:%d",
- raCb->rntiLnk->rnti);
- rgSCHRamAddToRaInfoSchdLst(cell, raCb);
- /* MSG4 Fix End */
- return;
-
-}
-/**
- * @brief Check the Contention Resolution Guard Timer Expiry.
- *
- * @details
- *
- * Function: rgSCHChkContResTmrExp
- *
- *
- * Invoked by: Scheduler
- * @param[in] RgSchCellCb *cell
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static Void rgSCHChkContResTmrExp(RgSchCellCb *cell)
-{
- CmLList *chkLnk = NULLP;
- RgSchRaCb *raCb = NULLP;
-
-
- chkLnk = cmLListFirst(&(cell->contResTmrLst));
-
- for (; chkLnk; chkLnk = chkLnk->next)
- {
- raCb = (RgSchRaCb *)(chkLnk->node);
-
- if(RGSCH_TIMEINFO_SAME(raCb->expiryTime, cell->crntTime))
- {
- /*If timer expired, call the handler function*/
- rgSCHRamProcContResExp(cell, raCb);
- }
- /*Fix: Need to traverse till end of list as the entries may not be in ascending order*/
- /* else
- {
- break;
- }*/
- }
-}
-/**
- * @brief Check the Contention Resolution Guard Timer Expiry.
- *
- * @details
- *
- * Function: rgSCHChkContResGrdTmrExp
- *
- *
- * Invoked by: Scheduler
- * @param[in] RgSchCellCb *cell
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static Void rgSCHChkContResGrdTmrExp(RgSchCellCb *cell)
-{
- CmLList *chkLnk = NULLP;
- RgSchRaCb *raCb = NULLP;
-
-
- chkLnk = cmLListFirst(&(cell->contResGrdTmrLst));
-
- /*[ccpu00131941]-MOD-List traversal should be done using the listCp */
- for (; chkLnk; chkLnk = cmLListNext(&cell->contResGrdTmrLst))
- {
- raCb = (RgSchRaCb *)(chkLnk->node);
-
- if(RGSCH_TIMEINFO_SAME(raCb->expiryTime, cell->crntTime))
- {
- /*If timer expired, call the handler function*/
- rgSCHRamProcContResGrdExp(cell, raCb);
- }
- else
- {
- break;
- }
- }
-}
-#endif
-#ifdef LTE_TDD
-/**
- * @brief Function for handling RACH Request deletion
- *
- * @details
- *
- * Function : rgSCHRamDelRaReq
- *
- * This function shall be invoked to delete the RACH Requests
- * that is not scheduled within the RA window size.
- *
- *
- * @param[in,out] RgSchCellCb *cell
- * @param[in] CmLteTimingInfo timingInfo
- * @param[in] uint8_t raIdx
- * @return S16
- * -# ROK
- **/
-S16 rgSCHRamDelRaReq
-(
-RgSchCellCb *cell,
-CmLteTimingInfo timingInfo,
-uint8_t raIdx
-)
-{
- uint8_t subfrmIdx;
- RgSchTddRachRspLst *rachRsp;
- uint16_t sfnIdx;
- S16 calcSfn;
- uint8_t subfrm;
- RgSchRaReqInfo *raReqInfo;
- uint8_t idx;
- uint8_t i;
- uint8_t raRntiIdx;
- CmLteRnti raRnti;
-
-
-
- rachRsp = &cell->rachRspLst[raIdx];
- /* Get the SFN Index to be deleted */
- calcSfn = timingInfo.sfn - rachRsp->delInfo.sfnOffset;
- if(calcSfn < 0)
- {
- sfnIdx = (calcSfn + RGSCH_MAX_SFN) % cell->raInfo.maxRaSize;
- }
- else
- {
- sfnIdx = calcSfn;
- }
-
- /* Iterate through all the subframes to be delted in the SFN */
- for(subfrmIdx=0; subfrmIdx < rachRsp->delInfo.numSubfrms; subfrmIdx++)
- {
- subfrm = rachRsp->delInfo.subframe[subfrmIdx];
- /* Get the subframe Index to be deleted */
- /* Fixes for RACH handling in TDD:
- * Corrected the computation of raRntiIdx
- * */
- raRntiIdx = ((sfnIdx % cell->raInfo.maxRaSize) * \
- RGSCH_MAX_RA_RNTI_PER_SUBFRM * \
- RGSCH_NUM_SUB_FRAMES) + subfrm;
-
- /* Iterate through all the RNTIs in the subframe */
- for(i=0; i < RGSCH_MAX_RA_RNTI_PER_SUBFRM; i++)
- {
- raRnti = raRntiIdx + (i*RGSCH_NUM_SUB_FRAMES);
- for (idx = 0; idx < cell->raInfo.raReqLst[raRnti].count; idx++)
- {
- raReqInfo =
- (RgSchRaReqInfo *)(cell->raInfo.raReqLst[raRnti].first->node);
- cmLListDelFrm(&(cell->raInfo.raReqLst[raRnti]),
- &(raReqInfo->raReqLstEnt));
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx,
- (Data **)&raReqInfo, sizeof(RgSchRaReqInfo));
- }
- }
- }
-
- return ROK;
-}
-#endif
-
-/*MSG4 Fix Start */
-S16 rgSCHRamAddToRaInfoSchdLst(RgSchCellCb *cell,RgSchRaCb *raCb)
-{
- CmLteTimingInfo expTime ={0};
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-
-
- /*Fix: This can be called even when guard timer is not expired.
- * In this case CR timer expiry should be guard timer expiry time + Guard timer time*/
- RG_SCH_ADD_TO_CRNT_TIME(raCb->expiryTime, expTime, cellSch->dl.msg4TxDelay);
- raCb->expiryTime = expTime;
- raCb->schdLnk.node = (PTR)(raCb);
- cmLListAdd2Tail(&(cell->raInfo.toBeSchdLst), &(raCb->schdLnk));
- raCb->contResTmrLnk.node = (PTR)(raCb);
- cmLListAdd2Tail(&(cell->contResTmrLst), &(raCb->contResTmrLnk));
- return ROK;
-} /* rgSCHRamAddToRaInfoSchdLst */
-
-
-
-S16 rgSCHRamRmvFrmRaInfoSchdLst(RgSchCellCb *cell,RgSchRaCb *raCb)
-{
-
- cmLListDelFrm(&(cell->raInfo.toBeSchdLst), &(raCb->schdLnk));
- raCb->schdLnk.node = NULLP;
- cmLListDelFrm(&(cell->contResTmrLst), &(raCb->contResTmrLnk));
- raCb->contResTmrLnk.node = NULLP;
- return ROK;
-} /* rgSCHRamRmvFrmRaInfoSchdLst */
-
-/*MSG4 Fix End*/
-
-/***********************************************************
- *
- * Func : rgSCHRamUlFreeAllocation
- *
- * Desc : Free an allocation - invokes UHM and releases
- * alloc
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHRamUlFreeAllocation
-(
-RgSchUlSf *sf,
-RgSchUlAlloc *alloc,
-RgSchCellCb *cell,
-Bool isEmtc
-)
-{
-
- rgSCHUhmFreeProc(alloc->hqProc, cell);
- if(!isEmtc)
- {
- rgSCHUtlUlAllocRls(sf, alloc);
- }
- return;
-}
-
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for scheduler 1
-
- File: rg_sch_sc1.c
-
-**********************************************************************/
-
-/** @file rg_sch_sc1.c
-@brief The scheduling functionality is implemented in this file.
-*/
-
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "lrg.h"
-#include "rgr.h"
-#include "rgm.h"
-#include "tfu.h"
-#include "rg_env.h"
-#include "rg_sch_inf.h"
-#include "rg_sch_err.h"
-#include "rg_sch.h"
-#include "rg_sch_cmn.h"
-#include "rg_sch_sc1.h"
-
-/* header/extern include files (.x) */
-#include "tfu.x" /* RGU types */
-#include "lrg.x" /* layer management typedefs for MAC */
-#include "rgr.x" /* layer management typedefs for MAC */
-#include "rgm.x" /* layer management typedefs for MAC */
-#include "rg_sch_inf.x" /* typedefs for Scheduler */
-#include "rg_sch.x" /* typedefs for Scheduler */
-#include "rg_sch_cmn.x"
-#include "rg_sch_sc1.x" /* typedefs for SC1 Scheduler */
-
-
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/* Functions called from outside */
-static S16 rgSCHSc1RgrDlCellRecfg ARGS((
-RgSchCellCb *cell,
-RgrCellRecfg *recfg,
-RgSchErrInfo *err
-));
-
-/*--------------------------*
- * DL SCHED STATIC declarations START
- *---------------------------*/
-static Void rgSCHSc1DlSvcAddToSchd ARGS((
-RgSchCellCb *cell,
-RgSchDlLcCb *svc
-));
-static Void rgSCHSc1DlAdd2UeSchdSvcs ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *svc
-));
-static Void rgSCHSc1DlRmvUeFrmPrioQs ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-static Void rgSCHSc1DlSuspendUe ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-static Void rgSCHSc1DlInactvtUe ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-static Void rgSCHSc1DlProcRmvFrmCellRetx ARGS((
-RgSchCellCb *cell,
-RgSchDlHqProcCb *hqP
-));
-static Void rgSCHSc1DlProcRmvFrmUeRetx ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlHqProcCb *hqP
-));
-static Void rgSCHSc1DlMngPrio0SvcPosn ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *svc
-));
-static Void rgSCHSc1DlMngGbrSvcPosn ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *svc
-));
-static Void rgSCHSc1DlMngAmbrSvcPosn ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *svc
-));
-static Void rgSCHSc1DlMngSvcPosn ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *svc
-));
-static Void rgSCHSc1DlUeAddToSchd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-static Void rgSCHSc1DlTaCmd ARGS((
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *allocInfo
-));
-static Void rgSCHSc1DlInitQueues ARGS((
-RgSchSc1DlCell *cellDl
-));
-static Void rgSCHSc1DlDeinitQueues ARGS((
-RgSchSc1DlCell *cellDl
-));
-static Void rgSCHSc1DlAdd2UeLcsWithData ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *svc
-));
-static Void rgSCHSc1DlRmFrmUeLcsWithData ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *svc
-));
-/*--------------------------*
- * UL SCHED STATIC declarations START
- *---------------------------*/
-static Void rgSCHSc1UlPosnUeInQ ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-static Void rgSCHSc1UlSchdUeTxLst ARGS((
-RgSchCellCb *cell,
-CmLListCp *ueTxLst,
-RgSchCmnUlRbAllocInfo *allocInfo,
-uint8_t *remUe
-));
-static Void rgSCHSc1DlProcRmvFrmRetx ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlHqProcCb *hqP
-));
-Void rgSCHSc1DlScanUpdPdbPrio ARGS((
-RgSchCellCb *cell
-));
-S16 rgSCHSc1DlFillFlowCntrlInfo ARGS((
-RgSchCellCb *cell,
-RgInfSfAlloc *sfAlloc
-));
-
-static Void rgSCHSc1DlPreSchd ARGS ((
-RgSchCellCb *cell
-));
-static Void rgSCHSc1DlPstSchd ARGS ((
- Inst schInst
-));
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-
-
-/***************** SC1 DL SCHEDULER FUNCTION DEFNs START HERE ********/
-\f
-/***********************************************************
- *
- * Func : rgSCHSc1DlUeReset
- *
- * Desc : Out of Meas Gap. Reposition the UEs Retx Hq Procs,
- * and Svc in respective Prio Qs.
- *
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHSc1DlUeReset(RgSchCellCb *cell,RgSchUeCb *ue)
-{
-
- rgSCHSc1DlSuspendUe(cell, ue);
-
- return;
-}
-
-\f
-/***********************************************************
- *
- * Func : rgSCHSc1DlActvtUe
- *
- * Desc : Out of Meas Gap. Reposition the UEs Retx Hq Procs,
- * and Svc in respective Prio Qs.
- *
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHSc1DlActvtUe(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchSc1DlUe *ueDl = RG_GET_SC1_UE_DL(ue, cell);
- CmLListCp *lst;
- CmLList *node;
- RgSchDlHqProcCb *hqP;
- RgSchDlLcCb *svc;
- uint8_t idx;
-
- /* Add UE's HqProcs From UERetxLst to CellRetxLst */
- lst = &ueDl->retxHqProcs;
- node = lst->first;
- while(node)
- {
- hqP = (RgSchDlHqProcCb *)node->node;
- node = node->next;
- rgSCHSc1DlProcRmvFrmUeRetx(cell, ue, hqP);
- rgSCHSc1DlProcAddToCellRetx(cell, hqP);
- }
-
- /* Iterate over all the Services if bo != 0 then add */
- for (idx = 0; idx < RGSCH_MAX_LC_PER_UE; ++idx)
- {
- svc = ue->dl.lcCb[idx];
- if (svc == NULLP)
- {
- continue;
- }
- rgSCHSc1DlMngSvcPosn(cell, ue, svc);
- }
-
- /* Add UE to AMBR Prio Q */
- if (ueDl->ambrSvc)
- {
- rgSCHSc1DlUeAddToSchd(cell, ue);
- }
-
- return;
-}
-
-\f
-/***********************************************************
- *
- * Func : rgSCHSc1DlUeRefresh
- *
- * Desc : Handle 'refresh' for Downlink
- * (ie UE's downlink AMBR and downlink GBR LCGs are
- * refreshed at this point)
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHSc1DlUeRefresh(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchSc1DlUe *ueDl = RG_GET_SC1_UE_DL(ue, cell);
- /*cell added as part of CA dev*/
- RgSchCmnDlSvc *svcCmn;
- RgSchSc1DlSvc *svcSc1;
- CmLListCp *lst;
- CmLList *node;
- RgSchDlLcCb *svc;
-
- if (ue->dl.ambrCfgd)
- {
- ueDl->ambr = ue->dl.ambrCfgd;
- }
- else
- {
- ueDl->ambr = RG_SC1_MAX_DL_AMBR;
- }
-
- if (ueDl->ambrSvc != NULLP)
- {
- ueDl->effAmbr = RGSCH_MIN(ueDl->ambr, ueDl->ambrSvc->bo);
- /* Update UEs position in the Queue */
- rgSCHSc1DlUeAddToSchd(cell, ue);
- }
-
- lst = &ueDl->gbrSvcs;
- node = lst->first;
- while (node != NULLP)
- {
- svc = (RgSchDlLcCb *)node->node;
- svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
- svcCmn = RG_SCH_CMN_GET_DL_SVC(svc);
- node = node->next;
- svcSc1->gbr = svcCmn->gbr;
- svcSc1->mbr = svcCmn->mbr;
- /* Update the SVC's positioning in the Queue */
- rgSCHSc1DlMngGbrSvcPosn(cell, ue, svc);
- }
- return;
-}
-
-\f
-/**
- * @brief This function removes a HARQ process from the retx
- *
- * @details
- *
- * Function: rgSCHSc1DlProcRmvFrmCellRetx
- * Purpose: This function removes a HARQ process from retransmission
- * queue. This may be performed when a HARQ ack is successful
- * for a retransmission or when the scheduling determines
- * to throw out the process due to poor conditions
- *
- * Invoked by: LIM and Scheduler
- *
- * @param[in] RgSchSc1Cb* cell
- * @param[in] RgDlHqProc* hqP
- * @return Void
- *
- **/
-static Void rgSCHSc1DlProcRmvFrmCellRetx(RgSchCellCb *cell,RgSchDlHqProcCb *hqP)
-{
- RgSchSc1DlCell *cellDl = RG_GET_SC1_CELL_DL(cell);
- RgSchCmnDlHqProc *hqProcDl = RG_SCH_CMN_GET_DL_HQP(hqP);
-
- if (hqProcDl->retxLnk.node != NULLP)
- {
- cmLListDelFrm(&cellDl->retxLst[((RgSchSc1DlHqProc *)\
- (hqProcDl->schSpfc))->prio], &(hqProcDl->retxLnk));
- hqProcDl->retxLnk.node = NULLP;
- }
- return;
-}
-
-\f
-/**
- * @brief This function removes a HARQ process from the UE retx
- *
- * @details
- *
- * Function: rgSCHSc1DlProcRmvFrmUeRetx
- * Purpose: This function removes a HARQ process from UE retransmission
- * queue.
- *
- * Invoked by: LIM and Scheduler
- *
- * @param[in] RgSchUeCb* ue
- * @param[in] RgDlHqProc* hqP
- * @return Void
- *
- **/
-static Void rgSCHSc1DlProcRmvFrmUeRetx(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlHqProcCb *hqP)
-{
- RgSchSc1DlUe *sc1Ue = RG_GET_SC1_UE_DL(ue, cell);
- RgSchSc1DlHqProc *hqProcDl = RG_GET_SC1_HQP_DL(hqP);
-
- if (hqProcDl->retxLnkUe.node != NULLP)
- {
- cmLListDelFrm(&sc1Ue->retxHqProcs,
- &(hqProcDl->retxLnkUe));
- hqProcDl->retxLnkUe.node = NULLP;
- }
- return;
-}
-
-\f
-/**
- * @brief This function adds a HARQ process for UEs retxLst
- *
- * @details
- *
- * Function: rgSCHSc1DlProcAddToUeRetx
- * Purpose: This function adds a HARQ process to UE retransmission
- * queue. This is performed when UE is suspended due
- * to measurement gap.
- *
- * Invoked by: HARQ feedback processing
- *
- * @param[in] RgSchUeCb* ue
- * @param[in] RgSchDlHqProc* hqP
- * @return Void
- *
- **/
-static Void rgSCHSc1DlProcAddToUeRetx(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlHqProcCb *hqP)
-{
- RgSchSc1DlUe *sc1Ue = RG_GET_SC1_UE_DL(ue, cell);
- RgSchSc1DlHqProc *cmnHqDl = RG_GET_SC1_HQP_DL(hqP);
-
- cmLListAdd2Tail(&sc1Ue->retxHqProcs,
- &(cmnHqDl->retxLnkUe));
- cmnHqDl->retxLnkUe.node = (PTR)hqP;
- return;
-}
-
-\f
-/**
- * @brief This function adds a HARQ process for retx
- *
- * @details
- *
- * Function: rgSCHSc1DlProcAddToCellRetx
- * Purpose: This function adds a HARQ process to retransmission
- * queue. This may be performed when a HARQ ack is
- * unsuccessful.
- *
- * Invoked by: HARQ feedback processing
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchDlHqProc* hqP
- * @return Void
- *
- **/
-Void rgSCHSc1DlProcAddToCellRetx(RgSchCellCb *cell,RgSchDlHqProcCb *hqP)
-{
- RgSchSc1DlCell *sc1CellDl = RG_GET_SC1_CELL_DL(cell);
- RgSchCmnDlHqProc *cmnHqDl = RG_SCH_CMN_GET_DL_HQP(hqP);
-
-
- if (!RG_SCH_CMN_DL_IS_UE_ACTIVE(hqP->hqE->ue))
- {
- rgSCHSc1DlProcAddToUeRetx(cell, hqP->hqE->ue, hqP);
- return;
- }
- cmLListAdd2Tail(&sc1CellDl->retxLst[((RgSchSc1DlHqProc *)\
- (cmnHqDl->schSpfc))->prio], &(cmnHqDl->retxLnk));
- cmnHqDl->retxLnk.node = (PTR)hqP;
- return;
-}
-
-\f
-/**
- * @brief This function implements DL RETRANSMISSION allocation
- *
- * @details
- *
- * Function: rgSCHSc1DlRetxAlloc
- * Purpose: This function implements downlink scheduler's
- * retransmission allocation.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[out] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-static Void rgSCHSc1DlRetxAlloc(RgSchCellCb *cell,RgSchDlSf *subFrm,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- uint8_t i;
- CmLListCp *retxLst;
- CmLList *node;
- RgSchDlHqProcCb *hqP;
- RgSchSc1DlCell *sc1CellDl;
- RgSchSc1DlUe *sc1DlUe;
- RgSchCmnDlUe *cmnUeDl;
-#if (defined(LTEMAC_SPS) || (!defined(LTE_TDD)))
- CmLteTimingInfo schdTime;
-#endif
- uint32_t effBo;
- RgSchUeCb *ue = NULLP;
-#ifdef LTEMAC_HDFDD
- Bool dlAllowed = FALSE;
-#endif
- RgSchDlRbAlloc *dlAllocCb;
-
- sc1CellDl = RG_GET_SC1_CELL_DL(cell);
-#if (defined(LTEMAC_SPS) || (!defined(LTE_TDD)))
- schdTime = cell->crntTime;
-
- /* Increment by DL DELTA to determine the time for which scheduling
- * is done */
- RGSCH_INCR_SUB_FRAME(schdTime, RG_SCH_CMN_DL_DELTA);
-#endif
- for (i = 0; i < RG_SCH_SC1_DL_PRIOS; i++)
- {
- retxLst = &sc1CellDl->retxLst[i];
- /* allocate bw for the retransmission..should be same are previous */
- /* If CQI gets worse, as we cannot find same TB size for another */
- /* MCS, we just remove this from the retransmission queue */
- node = retxLst->first;
- while (node != NULLP)
- {
- hqP = (RgSchDlHqProcCb *)node->node;
- node = node->next;
- ue = hqP->hqE->ue;
-
-#ifndef LTE_TDD
- if((0 == schdTime.slot) || (5 == schdTime.slot))
- {
- Bool reTxAllw;
- rgSCHCmnChkRetxAllowDtx(cell, ue, hqP, &reTxAllw);
- if(FALSE == reTxAllw)
- {
- continue;
- }
- }
-#endif
-#ifdef LTEMAC_HDFDD
- if (ue->hdFddEnbld)
- {
- rgSCHCmnHdFddChkDlAllow ( cell, ue, &dlAllowed);
- if (dlAllowed == FALSE)
- {
- continue;
- }
- }
-#endif
- /* This UE is already scheduled for transmission */
- cmnUeDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- /*cell added as part of CA dev*/
-#ifdef LTEMAC_SPS
- if (RG_SCH_CMN_IS_UE_SPS_SCHDLD(ue, cell, schdTime))
- {
- continue;
- }
-#endif
- if (RG_SCH_CMN_IS_UE_SCHDLD(ue, cell))
- {
- continue;
- }
- effBo = 0;
- /* Extra check: indicate if there is furtherScope for NewTx
- * addition for a HqProc. This information will
- * be utilized by common scheduler, in case of SM
- * UEs with only one of the TBs retransmitting and the
- * other TB can be used for clubbing new TX. */
- sc1DlUe = RG_GET_SC1_UE_DL(ue, cell);
- dlAllocCb = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, cell);
- if (sc1DlUe->lcsWithData.first != NULLP)
- {
- dlAllocCb->mimoAllocInfo.hasNewTxData = TRUE;
- }
- /* 3.1 MIMO : last parameter changed */
- if (rgSCHCmnDlAllocRetxRb(cell, subFrm, ue, 0, &effBo, hqP, allocInfo) !=\
- ROK)
- {
- /* SF/RETX Bandwidth expired */
- return;
- }
- if (effBo == 0)
- {
- continue;
- }
-
- if ((hqP->tbInfo[0].state == HQ_TB_ACKED)
- && (hqP->tbInfo[1].state == HQ_TB_ACKED))
- {
- rgSCHSc1DlProcRmvFrmCellRetx(cell, hqP);
- return;
- }
-
- cmnUeDl->proc = hqP;
- /* 3.1 MIMO moving this call in cmn scheduler */
- /*rgSCHCmnDlRbInfoAddUeRetx(allocInfo, ue);*/
- }
- }
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHSc1RlsHqProc
- *
- * Desc : Toggles the NDI and releases the harq proc.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHSc1RlsHqProc(RgSchDlHqProcCb *hqProc)
-{
- rgSCHDhmRlsHqProc(hqProc);
- return;
-}
-\f
-/**
- * @brief This function implements dedicated logical channel data scheduling
- *
- * @details
- *
- * Function: rgSCHSc1DlDedSvcAlloc
- * Purpose: This function implements dedicated logical
- * channel data scheduling
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *subFrm
- * @param[in] RgSchDlLcCb *svc
- * @param[in] uint32_t bo
- * @param[in] RgSchCmnDlRbAllocInfo *allocInfo
- * @return S16
- *
- **/
-static S16 rgSCHSc1DlDedSvcAlloc(RgSchCellCb *cell,RgSchDlSf *subFrm,RgSchDlLcCb *svc,uint32_t bo,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- RgSchUeCb *ue;
- RgSchDlHqProcCb *proc;
- uint16_t rlcHdrEstmt;
- uint32_t effBo;
- RgSchCmnDlCell *cmnCellDl = RG_SCH_CMN_GET_DL_CELL(cell);
- RgSchCmnDlSvc *svcCmn = RG_SCH_CMN_GET_DL_SVC(svc);
- RgSchSc1DlSvc *svcSc1;
- RgSchCmnDlUe *ueDl;
- RgSchSc1DlHqProc *sc1HqDl;
- RgSchCmnDlHqProc *cmnHqDl;
-#ifdef LTEMAC_SPS
- CmLteTimingInfo schdTime;
-#endif
-#ifdef LTEMAC_HDFDD
- Bool dlAllowed = FALSE;
-#endif
- S16 ret;
-
-
- /* Get the UE to which this service belongs to */
- ue = svc->ue;
-#ifdef LTEMAC_HDFDD
- if (ue->hdFddEnbld)
- {
- rgSCHCmnHdFddChkDlAllow ( cell, ue, &dlAllowed);
- if (dlAllowed == FALSE)
- {
- return ROK;
- }
- }
-#endif
- ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- /*cell added as part of CA dev*/
-#ifdef LTEMAC_SPS
- schdTime = cell->crntTime;
-
- /* Increment by DL DELTA to determine the time for which scheduling
- * is done */
- RGSCH_INCR_SUB_FRAME(schdTime, RG_SCH_CMN_DL_DELTA);
- if (RG_SCH_CMN_IS_UE_SPS_SCHDLD(ue, cell, schdTime))
- {
- return ROK;
- }
-#endif
- if (RG_SCH_CMN_IS_UE_SCHDLD(ue, cell))
- {
- proc = (RgSchDlHqProcCb *)(ueDl->proc);
- /* This UE is selected for retransmission. Hence no further */
- /* scheduling may be done for this UE */
- if (RG_SCH_CMN_PROC_SLCTD_FOR_RETX(proc))
- {
- DU_LOG("\nERROR --> SCH : CRNTI:%d rgSCHSc1DlDedSvcAlloc():"
- "Ue retransmitting",ue->ueId);
- return ROK;
- }
- /* UE is scheduled for either other services or TA */
- sc1HqDl = RG_GET_SC1_HQP_DL(proc);
- cmnHqDl = RG_SCH_CMN_GET_DL_HQP(proc);
- if (sc1HqDl->prio > svcCmn->prio)
- {
- sc1HqDl->prio = svcCmn->prio;
- }
- }
- else /* First consideration of this UE for scheduling */
- {
- if (rgSCHDhmGetAvlHqProc(cell, ue, cmnCellDl->time, &proc) != ROK)
- {
- DU_LOG("\nERROR --> SCH : CRNTI:%d rgSCHSc1DlDedSvcAlloc():"
- " No HARQ Proc available", ue->ueId);
- return ROK;
- }
- sc1HqDl = RG_GET_SC1_HQP_DL(proc);
- cmnHqDl = RG_SCH_CMN_GET_DL_HQP(proc);
- cmnHqDl->totBytes = 0;
- /* Initialize some of the parameters of the HQ proc */
- sc1HqDl->prio = svcCmn->prio;
- }
-
- /* Including each SDU's header size */
- RG_SCH_CMN_DL_GET_HDR_EST(svc, rlcHdrEstmt);
- bo += rlcHdrEstmt;
- effBo = 0;
- ret = rgSCHCmnDlAllocTxRb(cell, subFrm, ue, bo, &effBo, proc, allocInfo);
- if ((ret != ROK) || (effBo == 0))
- {
- /* If no allocations so far, meaning proc obtained now */
- if (cmnHqDl->totBytes == 0)
- {
- rgSCHSc1RlsHqProc(proc);
- /* Added the handling for removing
- * UE from txHqPLst and resetting outStndAlloc.*/
- if(proc->reqLnk.node != (PTR)NULLP)
- {
- cmLListDelFrm(&allocInfo->dedAlloc.txHqPLst, &proc->reqLnk);
- proc->reqLnk.node = (PTR)NULLP;
- }
- /*Re-set the outstanding alloc information.*/
- ueDl->outStndAlloc = 0;
-
- /* ccpu00126519: proc should be set to NULLP in UE's DL scratch pad info as well. */
- ueDl->proc = NULLP;
- }
- return (ret);
- }
- svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
- svcSc1->hdrEstimate = rlcHdrEstmt;
- svcSc1->reqBytes = bo;
- ueDl->proc = proc;
- cmnHqDl->totBytes += effBo;
-
- rgSCHSc1DlAdd2UeSchdSvcs(cell, ue, svc);
- /* 3.1 MIMO moving this call to cmn scheduler */
- /*rgSCHCmnDlRbInfoAddUeTx(allocInfo, ue); */
- return ROK;
-}
-
-/**
- * @brief This function adds a SVC to UE's schdSvcsLst.
- *
- * @details
- *
- * Function: rgSCHSc1DlAdd2UeSchdSvcs
- * Purpose: This function adds a SVC to UE's schdSvcsLst.
- *
- * Invoked by: Specific Scheduler
- *
- * @param[out] RgSchUeCb *ue
- * @param[in] RgSchDlLcCb *svc
- * @return Void
- *
- **/
-static Void rgSCHSc1DlAdd2UeSchdSvcs(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *svc)
-{
- RgSchSc1DlSvc *svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
- RgSchSc1DlUe *ueSc1 = RG_GET_SC1_UE_DL(ue, cell);
-
- /* checking SVC's presence in this lst is unnecessary */
- cmLListAdd2Tail(&ueSc1->schdSvcs, &svcSc1->schdSvcLnk);
- svcSc1->schdSvcLnk.node = (PTR)svc;
- return;
-}
-
-\f
-/**
- * @brief This function performs new allocations for UEs
- *
- * @details
- *
- * Function: rgSCHSc1DlDedTx
- * Purpose: This function implements scheduler for DL allocation for
- * new transmissions of UEs.
- * 1. It performs across 9 priorities that it supports -
- * This is from 3GPP specifications
- * 2. There are known number of GBR/MBR queues
- * 3. The first queue is highest priority queue and is
- * satisfied completely prior to any other queues. This
- * queue is for RRC signalling.
- * 4. Futher GBR/MBR queues are satisfied for GBR and then MBR
- * 5. Subsequently all other queues are looked at for AMBR
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchDlSf *subFrm
- * @param[out] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-static Void rgSCHSc1DlDedTx(RgSchCellCb *cell,RgSchDlSf *subFrm,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- CmLListCp *lst;
- CmLList *node;
- RgSchUeCb *ue = NULLP;
- RgSchDlLcCb *svc;
- uint8_t i;
- RgSchSc1DlSvc *svcSc1;
- RgSchSc1DlUe *ueDl;
- RgSchSc1DlCell *sc1CellDl = RG_GET_SC1_CELL_DL(cell);
-
-
- /* Process the first queue that is for RRC signalling and is of */
- /* highest priority. */
- lst = &sc1CellDl->prioLst[0];
- node = lst->first;
- while(node != NULLP)
- {
- /* Getting service instead of UE */
- svc = (RgSchDlLcCb *)node->node;
- ue = svc->ue;
- svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
- node = node->next;
- if (rgSCHSc1DlDedSvcAlloc(cell, subFrm, svc, svcSc1->bo, allocInfo) != ROK)
- {
- /* sf bw expired */
- return;
- }
- }
-
- /* Perform allocation for the GBR transmissions */
- for(i = RG_SCH_SC1_DL_GBR_PRIO_START; i <= RG_SCH_SC1_DL_GBR_PRIO_END; i++)
- {
- lst = &sc1CellDl->prioLst[i];
- node = lst->first;
- while(node != NULLP)
- {
- /* Getting service instead of UE */
- svc = (RgSchDlLcCb *)node->node;
- ue = svc->ue;
- svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
- node = node->next;
- if (rgSCHSc1DlDedSvcAlloc(cell, subFrm, svc, svcSc1->effMbr, allocInfo) != ROK)
- {
- /* sf bw expired */
- return;
- }
- }
- }
-
- /* To implement AMBR svc scheduling */
- for(i = RG_SCH_SC1_DL_GBR_PRIO_END + 1; i < RG_SCH_SC1_DL_PRIOS; i++)
- {
- lst = &sc1CellDl->prioLst[i];
- node = lst->first;
- while(node != NULLP)
- {
- ue = (RgSchUeCb *)node->node;
- ueDl = RG_GET_SC1_UE_DL(ue, cell);
- node = node->next;
- /* Get the Curr ambr svc for which allocation is to be made */
- svc = ueDl->ambrSvc;
- if (rgSCHSc1DlDedSvcAlloc(cell, subFrm, svc, ueDl->effAmbr, allocInfo) != ROK)
- {
- /* sf bw expired */
- return;
- }
- }
- }
- return;
-}
-
-/**
- * @brief scheduling for a cell
- *
- * @details
- *
- * Function : rgSCHSc1DlPreSchd
- *
- * Processing Steps:
- * - Nothing to be done in case of RR
- *
- * @param[in] Inst schInst
- * @return Void
- **/
-static Void rgSCHSc1DlPreSchd( RgSchCellCb *cell)
-{
-
- return;
-}
-/**
- * @brief scheduling for a cell
- *
- * @details
- *
- * Function : rgSCHSc1DlPstSchd
- *
- * Processing Steps:
- * - Nothing to be done in case of RR
- *
- * @param[in] Inst schInst
- * @return Void
- **/
-static Void rgSCHSc1DlPstSchd(Inst schInst)
-{
-
- return;
-}
-
-\f
-/**
- * @brief This function implements scheduler DL allocation
- *
- * @details
- *
- * Function: rgSCHSc1DlDedNewTx
- * Purpose: This function implements scheduler for DL allocation for
- * UEs.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[out] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-static Void rgSCHSc1DlDedNewTx(RgSchCellCb *cell,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- RgSchDlSf *subFrm = allocInfo->dedAlloc.dedDlSf;
- DU_LOG("\nDEBUG --> SCH : rgSCHSc1DlDedNewTx\n");
-
- /* Now perform the new UE selections */
- rgSCHSc1DlDedTx(cell, subFrm, allocInfo);
-
- /* Stack Crash problem for TRACE5 changes. Added the return below */
- return;
-
-}
-/**
- * @brief This function implements scheduler DL allocation
- *
- * @details
- *
- * Function: rgSCHSc1DlDedRetx
- * Purpose: This function implements scheduler for DL allocation for
- * UEs.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[out] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-static Void rgSCHSc1DlDedRetx(RgSchCellCb *cell,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- RgSchDlSf *subFrm = allocInfo->dedAlloc.dedDlSf;
- DU_LOG("\nDEBUG --> SCH : rgSCHSc1DlDedRetx\n");
-
- rgSCHSc1DlRetxAlloc(cell, subFrm, allocInfo);
-
- return;
-
-}
-
-
-\f
-/**
- * @brief This function adds a service to scheduler
- *
- * @details
- *
- * Function: rgSCHSc1DlSvcAddToSchd
- * Purpose: This function adds a service to the list of services
- * based on the priority of the services.
- *
- * Invoked by: BO and Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @return Void
- *
- **/
-static Void rgSCHSc1DlSvcAddToSchd(RgSchCellCb *cell,RgSchDlLcCb *svc)
-{
- CmLListCp *lst;
- CmLList *node;
- RgSchDlLcCb *lSvc;
- RgSchSc1DlSvc *svcSc1;
- RgSchSc1DlSvc *lSvcSc1;
- RgSchSc1DlCell *sc1CellDl = RG_GET_SC1_CELL_DL(cell);
- RgSchCmnDlSvc *svcCmn = RG_SCH_CMN_GET_DL_SVC(svc);
-
-
- svcSc1 = RG_GET_SC1_SVC_DL(svc->ue,svc,cell);
- /* The service is already in the scheduler */
- if (svcSc1->prioLnk.node != NULLP)
- {
- return;
- }
-
- /* If the priority = 0, it is the highest priority with infinite */
- /* allowance and the priority is time bound and hence just place */
- /* it at the end of the queue */
- if (svcCmn->prio == 0)
- {
- lst = &(sc1CellDl->prioLst[0]);
- cmLListAdd2Tail(lst, &svcSc1->prioLnk);
- svcSc1->prioLnk.node = (PTR)svc;
- /* If a svc is put in to cell wide priority Qs
- * then add the same to UE's lcsWithData List */
- rgSCHSc1DlAdd2UeLcsWithData(cell, svc->ue, svc);
- return;
- }
-
- /* Handle GBR services. We have them of next importance */
- /* check changed from .._START to .._END */
- if (svcCmn->prio <= RG_SCH_SC1_DL_GBR_PRIO_END)
- {
- if (!RG_SC1_SVC_HAS_DATA(svc,cell))
- return;
- lst = &(sc1CellDl->prioLst[svcCmn->prio]);
- node = lst->first;
- while(node)
- {
- lSvc = (RgSchDlLcCb *)(node->node);
- lSvcSc1 = RG_GET_SC1_SVC_DL(lSvc->ue,lSvc,cell);
- if (((svcSc1->effGbr > 0) &&
- (lSvcSc1->effGbr <= svcSc1->effGbr)) ||
- ((lSvcSc1->effGbr == 0) && (svcSc1->effMbr > 0) &&
- (lSvcSc1->effMbr <= svcSc1->effMbr)))
- {
- break;
- }
- node = node->next;
- }
- if (node == NULLP)
- {
- /* We have come to the end of the queue. Let's place it */
- /* here irresepctive of effGbr or effMBr */
- cmLListAdd2Tail(lst, &svcSc1->prioLnk);
- svcSc1->prioLnk.node = (PTR)svc;
- }
- else
- {
- lst->crnt = node;
- cmLListInsCrnt(lst, &svcSc1->prioLnk);
- svcSc1->prioLnk.node = (PTR)svc;
- }
- /* If a svc is put in to cell wide priority Qs
- * then add the same to UE's lcsWithData List */
- rgSCHSc1DlAdd2UeLcsWithData(cell, svc->ue, svc);
- }
- return;
-}
-
-
-\f
-/**
- * @brief This function removes a UE from scheduler Queue
- *
- * @details
- *
- * Function: rgSCHSc1DlUeRmvFrmSchd
- * Purpose: This function removes a UE from the list of UEs
- * based on the priority of the UEs Current AMBR SVC.
- *
- * Invoked by: BO and Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @return Void
- *
- **/
-static Void rgSCHSc1DlUeRmvFrmSchd(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchSc1DlCell *cellDl = RG_GET_SC1_CELL_DL(cell);
- RgSchSc1DlUe *ueDl = RG_GET_SC1_UE_DL(ue, cell);
- CmLListCp *lst;
-
-
- lst = &cellDl->prioLst[ueDl->prio];
- if (ueDl->prioLnk.node != NULLP)
- {
- cmLListDelFrm(lst, &ueDl->prioLnk);
- ueDl->prioLnk.node = (PTR)NULLP;
- /* If a svc is removed from cell wide priority Qs
- * then remove the same from UE's lcsWithData List */
- rgSCHSc1DlRmFrmUeLcsWithData(cell, ue, ueDl->ambrSvc);
- }
- return;
-}
-
-\f
-/**
- * @brief This function removes a SVC from UEs AMBR LIST
- *
- * @details
- *
- * Function: rgSCHSc1DlSvcRmvFrmUeAmbrLst
- * Purpose: This function removes a SVC from UEs AMBR List.
- *
- * Invoked by: BO and Scheduler
- *
- * @param[in] RgSchUeCb* ue
- * @param[in] RgSchDlLcCb* svc
- * @return Void
- *
- **/
-static Void rgSCHSc1DlSvcRmvFrmUeAmbrLst(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *svc)
-{
- RgSchSc1DlUe *ueDl = RG_GET_SC1_UE_DL(ue, cell);
- RgSchSc1DlSvc *svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
- CmLListCp *lst;
-
- lst = &ueDl->ambrLst;
- if (svcSc1->prioLnk.node != NULLP)
- {
- cmLListDelFrm(lst, &svcSc1->prioLnk);
- svcSc1->prioLnk.node = (PTR)NULLP;
- }
- return;
-}
-
-\f
-/**
- * @brief This function adds a SVC to UEs AMBR LIST
- *
- * @details
- *
- * Function: rgSCHSc1DlSvcAddToUeAmbrLst
- * Purpose: This function adds a SVC to UEs AMBR List.
- *
- * Invoked by: BO and Scheduler
- *
- * @param[in] RgSchUeCb* ue
- * @param[in] RgSchDlLcCb* svc
- * @return Void
- *
- **/
-static Void rgSCHSc1DlSvcAddToUeAmbrLst(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *svc)
-{
- RgSchSc1DlUe *ueDl = RG_GET_SC1_UE_DL(ue, cell);
- CmLList *node;
- RgSchDlLcCb *lsvc;
- RgSchSc1DlSvc *svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
- RgSchCmnDlSvc *svcCmn = RG_SCH_CMN_GET_DL_SVC(svc);
-
-
- /* If svc already present in AMBR List return */
- if (svcSc1->prioLnk.node != NULLP)
- return;
-
- node = ueDl->ambrLst.first;
- while(node)
- {
- lsvc = (RgSchDlLcCb *)(node->node);
- if (((RgSchCmnDlSvc*)(lsvc->sch))->prio > svcCmn->prio)
- {
- break;
- }
- node = node->next;
- }
- if (node == NULLP)
- {
- cmLListAdd2Tail(&ueDl->ambrLst, &svcSc1->prioLnk);
- svcSc1->prioLnk.node = (PTR)svc;
- }
- else
- {
- ueDl->ambrLst.crnt = node;
- cmLListInsCrnt(&ueDl->ambrLst, &svcSc1->prioLnk);
- svcSc1->prioLnk.node = (PTR)svc;
- }
-
- return;
-}
-
-\f
-/**
- * @brief This function removes a service from scheduler
- *
- * @details
- *
- * Function: rgSCHSc1DlSvcRmvFrmSchd
- * Purpose: This function removes the SVC from the scheduler Qs.
- *
- * Invoked by: BO and Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @return Void
- *
- **/
-static Void rgSCHSc1DlSvcRmvFrmSchd(RgSchCellCb *cell,RgSchDlLcCb *svc)
-{
- RgSchSc1DlCell *cellDl = RG_GET_SC1_CELL_DL(cell);
- RgSchSc1DlSvc *svcDl = RG_GET_SC1_SVC_DL(svc->ue,svc,cell);
- RgSchCmnDlSvc *svcCmn = RG_SCH_CMN_GET_DL_SVC(svc);
- CmLListCp *lst;
-
-
- lst = &(cellDl->prioLst[svcCmn->prio]);
- if (svcDl->prioLnk.node != NULLP)
- {
- cmLListDelFrm(lst, &svcDl->prioLnk);
- svcDl->prioLnk.node = NULLP;
- /* If a svc is removed from cell wide priority Qs
- * then remove the same from UE's lcsWithData List */
- rgSCHSc1DlRmFrmUeLcsWithData(cell, svc->ue, svc);
- }
- return;
-}
-
-\f
-/**
- * @brief This function adds a service to scheduler for a UE
- *
- * @details
- *
- * Function: rgSCHSc1DlSvcAdd
- * Purpose: This function is made available through a FP for
- * making scheduler aware of a service added to UE
- *
- * Invoked by: BO and Scheduler
- *
- * @param[in] RgSchUeCb* ue
- * @param[in] RgSchDlLcCb* svc
- * @param[in] CrgDlLchCfg* qos
- * @return Void
- *
- **/
-static Void rgSCHSc1DlSvcAdd(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *svc,RgrDlLchCfg *cfg)
-{
- RgSchSc1DlUe *ueDl = RG_GET_SC1_UE_DL(ue, cell);
- RgSchSc1DlSvc *svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
- RgSchCmnDlSvc *svcCmn = RG_SCH_CMN_GET_DL_SVC(svc);
-
- UNUSED(cfg);
-
- if (RG_SCH_CMN_SVC_IS_GBR(svc))
- {
- svcSc1->gbr = svcCmn->gbr;
- svcSc1->mbr = svcCmn->mbr;
- cmLListAdd2Tail(&ueDl->gbrSvcs, &svcSc1->gbrLnk);
- svcSc1->gbrLnk.node = (PTR)svc;
- }
- return;
-}
-
-\f
-/**
- * @brief This function deletes a service from scheduler
- *
- * @details
- *
- * Function: rgSCHSc1DlLcRmv
- * Purpose: This function is made available through a FP for
- * making scheduler aware of a service being deleted from UE
- *
- * Invoked by: BO and Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @param[in] RgSchDlLcCb* svc
- * @return Void
- *
- **/
-Void rgSCHSc1DlLcRmv(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *svc)
-{
- RgSchSc1DlUe *ueDl;
- RgSchSc1DlSvc *svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
- RgSchCmnDlSvc *svcCmn = RG_SCH_CMN_GET_DL_SVC(svc);
-
-
- if (svcSc1 == NULLP)
- {
- return;
- }
- ueDl = RG_GET_SC1_UE_DL(ue, cell);
-
- if (svcCmn->prio == 0)
- {
- rgSCHSc1DlSvcRmvFrmSchd(cell, svc);
- }
- else if (RG_SCH_CMN_SVC_IS_GBR(svc))
- {
- if (svcSc1->gbrLnk.node != NULLP)
- {
- cmLListDelFrm(&ueDl->gbrSvcs, &svcSc1->gbrLnk);
- svcSc1->gbrLnk.node = NULLP;
- }
- rgSCHSc1DlSvcRmvFrmSchd(cell, svc);
- }
- else /* if AMBR service */
- {
- if (ueDl->ambrSvc == svc)
- {
- rgSCHSc1DlUeRmvFrmSchd(cell, ue);
- rgSCHSc1DlSvcRmvFrmUeAmbrLst(cell, ue, svc);
- ueDl->ambrSvc = NULLP;
- if (ueDl->ambrLst.first != NULLP)
- {
- ueDl->ambrSvc = (RgSchDlLcCb *)(ueDl->ambrLst.first->node);
- ueDl->effAmbr = RGSCH_MIN(ueDl->ambr, svc->bo);
- if(ueDl->effAmbr)
- {
- rgSCHSc1DlUeAddToSchd(cell, ue);
- }
- }
- }
- else
- {
- rgSCHSc1DlSvcRmvFrmUeAmbrLst(cell, ue, svc);
- }
- }
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx,
- (Data**)(&(RG_SCH_CMN_GET_LC_SCH_SPFC(ue,svc,cell))), (sizeof(RgSchSc1DlSvc)));
- return;
-}
-
-/**
- * @brief This function is invoked as part of SVC reconfig
- *
- * @details
- *
- * Function: rgSCHSc1DlSvcMod
- * Purpose: This function is made available through a FP for
- * making scheduler aware of a service reconfiguration.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchDlLcCb* svc
- * @param[in] CrgLchRecfg* recfg
- * @return Void
- *
- **/
-static Void rgSCHSc1DlSvcMod(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *svc,RgrLchRecfg *recfg)
-{
- RgSchSc1DlSvc *svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
- RgSchCmnDlSvc *svcCmn = RG_SCH_CMN_GET_DL_SVC(svc);
-
- if (RG_SCH_CMN_SVC_IS_GBR(svc))
- {
- /* Convert the QOS to handle the refresh duration */
- svcSc1->gbr = svcCmn->gbr;
- svcSc1->mbr = svcCmn->mbr;
- }
- return;
-}
-
-/**
- * @brief This function adds UE to scheduler for an AMBR service
- *
- * @details
- *
- * Function: rgSCHSc1DlUeAddToSchd
- * Purpose: This function adds a UE to scheduler for the AMBR
- * service of highest priority.
- *
- * Invoked by: BO and Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @return Void
- *
- **/
-static Void rgSCHSc1DlUeAddToSchd(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchSc1DlCell *cellDl = RG_GET_SC1_CELL_DL(cell);
- RgSchSc1DlUe *ueDl = RG_GET_SC1_UE_DL(ue, cell);
- RgSchSc1DlUe *lueDl;
- CmLList *node;
- CmLListCp *lst;
- RgSchUeCb *nodeUe = NULLP;
-
- ueDl->prio = ((RgSchCmnDlSvc *)(ueDl->ambrSvc->sch))->prio;
- lst = &cellDl->prioLst[ueDl->prio];
- /* if UE already in list, remove and
- * readjust */
- if (ueDl->prioLnk.node != NULLP)
- {
- cmLListDelFrm(lst, &ueDl->prioLnk);
- ueDl->prioLnk.node = NULLP;
- /* If a svc is removed from cell wide priority Qs
- * then remove the same from UE's lcsWithData List */
- rgSCHSc1DlRmFrmUeLcsWithData(cell, ue, ueDl->ambrSvc);
- }
- node = lst->first;
- while(node)
- {
- nodeUe = (RgSchUeCb *)(node->node);
- lueDl = RG_GET_SC1_UE_DL(nodeUe, cell);
- if (lueDl->effAmbr < ueDl->effAmbr)
- break;
- node = node->next;
- }
- if (node == NULLP)
- {
- cmLListAdd2Tail(lst, &ueDl->prioLnk);
- ueDl->prioLnk.node = (PTR)ue;
- }
- else
- {
- lst->crnt = node;
- cmLListInsCrnt(lst, &ueDl->prioLnk);
- ueDl->prioLnk.node = (PTR)ue;
- }
- /* If a svc is put in to cell wide priority Qs
- * then add the same to UE's lcsWithData List */
- rgSCHSc1DlAdd2UeLcsWithData(cell, ue, ueDl->ambrSvc);
- return;
-}
-
-\f
-/**
- * @brief This function implements managing BO for an ABMR service
- *
- * @details
- *
- * Function: rgSCHSc1DlMngAmbrSvcPosn
- * Purpose: This function should be called whenever there is a
- * change BO for a AMBR service.
- *
- * Invoked by: BO and Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @param[in] RgSchDlLcCb* svc
- * @return Void
- *
- **/
-static Void rgSCHSc1DlMngAmbrSvcPosn(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *svc)
-{
- RgSchSc1DlUe *ueDl = RG_GET_SC1_UE_DL(ue, cell);
- RgSchSc1DlSvc *svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
-
- if (svcSc1->bo == 0)
- {
- if (ueDl->ambrSvc == svc)
- {
- rgSCHSc1DlUeRmvFrmSchd(cell, ue);
- rgSCHSc1DlSvcRmvFrmUeAmbrLst(cell, ue, svc);
- ueDl->ambrSvc = NULLP;
- if (ueDl->ambrLst.first != NULLP)
- {
- ueDl->ambrSvc = (RgSchDlLcCb *)(ueDl->ambrLst.first->node);
- ueDl->effAmbr = RGSCH_MIN(ueDl->ambr, svcSc1->bo);
- if(ueDl->effAmbr)
- {
- rgSCHSc1DlUeAddToSchd(cell, ue);
- }
- }
- }
- else
- {
- rgSCHSc1DlSvcRmvFrmUeAmbrLst(cell, ue, svc);
- }
- }
- else /* svcSc1->bo != 0 */
- {
- if (svcSc1->prioLnk.node != NULLP)
- {
- if (svc == ueDl->ambrSvc)
- {
- ueDl->effAmbr = RGSCH_MIN(svcSc1->bo, ueDl->ambr);
- /* Update UE's position in the scheduler */
- if(ueDl->effAmbr)
- {
- rgSCHSc1DlUeAddToSchd(cell, ue);
- }
- else
- {
- rgSCHSc1DlUeRmvFrmSchd(cell, ue);
- }
- }
- return;
- }
- rgSCHSc1DlSvcAddToUeAmbrLst(cell, ue, svc);
- /* Current ambr svc is always the first node of ambrLst.*/
- if (ueDl->ambrLst.first->node == (PTR)svc)
- {
- if(ueDl->ambrSvc != svc)
- {
- if(ueDl->ambrSvc)
- {
- rgSCHSc1DlUeRmvFrmSchd(cell, ue);
- }
- ueDl->ambrSvc = svc;
- ueDl->effAmbr = RGSCH_MIN(ueDl->ambr, svcSc1->bo);
- if(ueDl->effAmbr)
- {
- rgSCHSc1DlUeAddToSchd(cell, ue);
- }
- }
- }
- }
- return;
-}
-
-\f
-/**
- * @brief This function updates the scheduler with service for a UE
- *
- * @details
- *
- * Function: rgSCHSc1DlLcBoUpd
- * Purpose: This function should be called whenever there is a
- * change BO for a service.
- *
- * Invoked by: BO and Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @param[in] RgSchDlLcCb* svc
- * @return Void
- *
- **/
-Void rgSCHSc1DlLcBoUpd(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *svc)
-{
- RgSchSc1DlSvc *svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
-
- if (svcSc1->bo == svc->bo)
- {
- return;
- }
- svcSc1->bo = svc->bo;
- if (!RG_SCH_CMN_DL_IS_UE_ACTIVE(ue))
- {
- return;
- }
- rgSCHSc1DlMngSvcPosn(cell, ue, svc);
-
- /* Stack Crash problem for TRACE5 changes. Added the return below */
- return;
-
-}
-
-\f
-/**
- * @brief This function updates the scheduler with Prio0 service for a UE
- *
- * @details
- *
- * Function: rgSCHSc1DlMngPrio0SvcPosn
- * Purpose: This func shall be triggered whenever there is a
- * change in the "Bo yet to be satisfied" field of the service.
- * Appropriately positions the svc in its prio Q.
- * Removes the SVC from the Q if BO is completely satisfied.
- *
- * Invoked by: BO and Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @param[in] RgSchDlLcCb* svc
- * @return Void
- *
- **/
-static Void rgSCHSc1DlMngPrio0SvcPosn(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *svc)
-{
- RgSchSc1DlSvc *svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
-
- /* In this priority, we just add or remove to the queue */
- if (svcSc1->bo > 0)
- {
- rgSCHSc1DlSvcAddToSchd(cell, svc);
- }
- else
- {
- rgSCHSc1DlSvcRmvFrmSchd(cell, svc);
- }
- return;
-}
-
-\f
-/**
- * @brief This function updates the scheduler with GBR service for a UE
- *
- * @details
- *
- * Function: rgSCHSc1DlMngGbrSvcPosn
- * Purpose: This func shall be triggered whenever there is a
- * change in the "Bo yet to be satisfied" field of the service.
- * Appropriately positions the svc in its prio Q.
- * Removes the SVC from the Q if BO is completely satisfied.
- *
- * Invoked by: BO and Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @param[in] RgSchDlLcCb* svc
- * @return Void
- *
- **/
-static Void rgSCHSc1DlMngGbrSvcPosn(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *svc)
-{
- RgSchSc1DlSvc *svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
-
- /* Handle a GBR service. */
- svcSc1->effGbr = RGSCH_MIN(svcSc1->bo, svcSc1->gbr);
- svcSc1->effMbr = RGSCH_MIN(svcSc1->bo, svcSc1->mbr);
- /* Adjust the SVC priority within the queue */
- rgSCHSc1DlSvcRmvFrmSchd(cell, svc);
- rgSCHSc1DlSvcAddToSchd(cell, svc);
- return;
-}
-
-\f
-/**
- * @brief This function updates the scheduler with service for a UE
- *
- * @details
- *
- * Function: rgSCHSc1DlMngSvcPosn
- * Purpose: This func shall be triggered whenever there is a
- * change in the "Bo yet to be satisfied" field of the service.
- * Appropriately positions the svc in its prio Q.
- * Removes the SVC from the Q if BO is completely satisfied.
- *
- * Invoked by: BO and Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @param[in] RgSchDlLcCb* svc
- * @return Void
- *
- **/
-static Void rgSCHSc1DlMngSvcPosn(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *svc)
-{
- RgSchCmnDlSvc *svcCmn = RG_SCH_CMN_GET_DL_SVC(svc);
- RgSchSc1DlCell *cellDl = RG_GET_SC1_CELL_DL(cell);
-
- (cellDl->svcMngFunc[svcCmn->prio])(cell, ue, svc);
- return;
-}
-
-/*--------------------------*
- * DL specific functions END
- *---------------------------*/
-
-
-\f
-/**
- * @brief Scheduler processing on cell configuration
- *
- * @details
- *
- * Function : rgSCHSc1RgrDlCellCfg
- *
- * This function does requisite initialisation
- * and setup for scheduler1 when a cell is
- * configured
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgrCellCfg *cellCfg
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHSc1RgrDlCellCfg(RgSchCellCb *cell,RgrCellCfg *cellCfg,RgSchErrInfo *err)
-{
- S16 ret;
- RgSchSc1DlCell *cellDl;
-
- if((ret = rgSCHUtlAllocSBuf(cell->instIdx,
- (Data**)&(((RgSchCmnCell*)((cell)->sc.sch))->dl.schSpfc), \
- (sizeof(RgSchSc1DlCell)))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED");
- err->errCause = RGSCHERR_SCH_SC1_DL_CFG;
- return (ret);
- }
-
- cellDl = RG_GET_SC1_CELL_DL(cell);
- /* Now perform downlink Queues related initializations */
- rgSCHSc1DlInitQueues(cellDl);
- return ROK;
-} /* rgSCHSc1RgrDlCellCfg */
-
-/***********************************************************
- *
- * Func : rgSCHSc1DlDeinitQueues
- *
- * Desc : De-initialise downlink scheduler queues
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHSc1DlDeinitQueues(RgSchSc1DlCell *cellDl)
-{
- uint8_t i;
-
- for (i = 0; i < RG_SC1_DL_NUM_Q; ++i)
- {
- cmLListInit(&cellDl->prioLst[i]);
- cmLListInit(&cellDl->retxLst[i]);
- }
- return;
-}
-
-
-/**
- * @brief Scheduler processing for cell delete
- *
- * @details
- *
- * Function : rgSCHSc1DlCellDel
- *
- * This functions de-initialises and frees memory
- * taken up by scheduler1 for the entire cell.
- *
- * @param[in] RgSchCellCb *cell
- * @return Void
- **/
-Void rgSCHSc1DlCellDel(RgSchCellCb *cell)
-{
-
- if (((RgSchSc1DlCell *)((RgSchCmnCell*)((cell)->sc.sch))->dl.schSpfc) \
- == NULLP)
- {
- return;
- }
-
- /* Perform the deinit for the DL scheduler */
- rgSCHSc1DlDeinitQueues(RG_GET_SC1_CELL_DL(cell));
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx,
- (Data**)(&(((RgSchCmnCell*)((cell)->sc.sch))->dl.schSpfc)),
- (sizeof(RgSchSc1DlCell)));
- return;
-} /* rgSCHSc1DlCellDel */
-
-/**
- * @brief UE initialisation for scheduler
- *
- * @details
- *
- * Function : rgSCHSc1RgrDlUeCfg
- *
- * This functions intialises UE specific scheduler
- * information
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[int] RgrUeCfg *ueCfg
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHSc1RgrDlUeCfg(RgSchCellCb *cell,RgSchUeCb *ue,RgrUeCfg *ueCfg,RgSchErrInfo *err)
-{
- RgSchCmnUe *ueSchCmn = RG_SCH_CMN_GET_UE(ue, cell);
- Inst inst = cell->instIdx;
- RgSchSc1DlUe *ueDl;
-
-
- if((rgSCHUtlAllocSBuf(inst,
- (Data**)&(ueSchCmn->dl.schSpfc), (sizeof(RgSchSc1DlUe))) != ROK))
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED"
- "CRNTI:%d",ue->ueId);
- err->errCause = RGSCHERR_SCH_SC1_DL_CFG;
- return RFAILED;
- }
- ueDl = (RgSchSc1DlUe *)ueSchCmn->dl.schSpfc;
- if (ue->dl.ambrCfgd)
- {
- ueDl->ambr = ue->dl.ambrCfgd;
- }
- else
- {
- ueDl->ambr = RG_SC1_MAX_DL_AMBR;
- }
- cmLListInit(&ueDl->lcsWithData);
- cmLListInit(&ueDl->gbrSvcs);
- cmLListInit(&ueDl->ambrLst);
- cmLListInit(&ueDl->schdSvcs);
- cmLListInit(&ueDl->retxHqProcs);
- return ROK;
-} /* rgSCHSc1RgrDlUeCfg */
-
-
-/**
- * @brief Dl Harq Entity initialization for SC1
- *
- * @details
- *
- * Function : rgSCHSc1DlUeHqEntInit
- *
- * Processing Steps:
- * - Create SC1 related information per Harq Entity
- *
- * @param[in] RgrSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHSc1DlUeHqEntInit(RgSchCellCb *cell,RgSchDlHqEnt *hqEnt)
-{
- RgSchSc1DlHqProc *hqSpcSch;
- RgSchDlHqProcCb *hqP;
- uint8_t cnt;
- /* making use of hqE->sch for one shot allocation
- * of RgSchSc1DlHqProc structures */
- if (rgSCHUtlAllocSBuf(cell->instIdx,
- (Data**)&(hqEnt->sch),
- (hqEnt->numHqPrcs * sizeof(RgSchSc1DlHqProc))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED CRNTI:%d",hqEnt->ue->ueId);
- return RFAILED;
- }
- hqSpcSch = (RgSchSc1DlHqProc *)(hqEnt->sch);
- for(cnt = 0; cnt < hqEnt->numHqPrcs; cnt++)
- {
- hqP = &hqEnt->procs[cnt];
- ((RgSchCmnDlHqProc *)((hqP)->sch))->schSpfc = \
- hqSpcSch++;
- }
- return ROK;
-}
-
-/**
- * @brief Dl Harq Entity deletion for Sc1
- *
- * @details
- *
- * Function : rgSCHSc1DlUeHqEntDeInit
- *
- * Processing Steps:
- * - Free SC1 related information per Harq Entity
- *
- * @param[in] RgrSchCellCb *cell
- * @param[in] RgSchDlHqEnt *hqE
- * @return Void
- **/
-S16 rgSCHSc1DlUeHqEntDeInit(RgSchCellCb *cell,RgSchDlHqEnt *hqE)
-{
-
- if(hqE->sch)
- {
- rgSCHUtlFreeSBuf(cell->instIdx,
- (Data**)(&(hqE->sch)),
- (hqE->numHqPrcs * sizeof(RgSchSc1DlHqProc)));
- }
- else
- {
- return RFAILED;
- }
- return ROK;
-}
-/**
- * @brief UE reconfiguration for scheduler
- *
- * @details
- *
- * Function : rgSCHSc1RgrDlUeRecfg
- *
- * This functions updates UE specific scheduler
- * information upon UE reconfiguration
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[int] RgrUeRecfg *ueRecfg
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHSc1RgrDlUeRecfg(RgSchCellCb *cell,RgSchUeCb *ue,RgrUeRecfg *ueRecfg,RgSchErrInfo *err)
-{
- RgSchSc1DlUe *ueDl = RG_GET_SC1_UE_DL(ue, cell);
- RgSchCmnDlUe *ueCmnDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- /*cell added as part of CA dev*/
- RgSchDlHqEnt *hqEnt = RG_SCH_CMN_GET_UE_HQE(ue, cell);
-
- if (ue->dl.ambrCfgd)
- {
- ueDl->ambr = ue->dl.ambrCfgd;
- }
- else
- {
- ueDl->ambr = RG_SC1_MAX_DL_AMBR;
- }
-
- /* Discarding TB2's context from scheduling Queues.
- * Since TB2 transmission needs signalling using
- * TM specific formats. And since during this transient
- * period of UE TM Recfg, SCH always uses Format 1A,
- * the TB2s are discarded. */
- if (ueCmnDl->mimoInfo.forceTD & RG_SCH_CMN_TD_TXMODE_RECFG)
- {
- /* If HqP is in retx queue only for TB2 retx scheduling
- * then remove the harp proc from retx Queue */
-
- /* If Hqp is in retx queue for retx allocation of
- * both TB1 and TB2, then reset TB2's state as ACKED */
- RgSchDlHqProcCb *hqP;
- Pst pst;
- RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
- uint8_t i;
-
- /* Prepare TB2 release information to be sent to MAC */
- rlsHqBufs->numUes = 0;
- for(i = 0; i < hqEnt->numHqPrcs; i++)
- {
- hqP = &hqEnt->procs[i];
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].rnti = ue->ueId;
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].hqProcId = hqP->procId;
- if (hqP->tbInfo[1].state == HQ_TB_NACKED)
- {
- if (hqP->tbInfo[0].state != HQ_TB_NACKED)
- {
- /* Remove the HqP from retx Queue.
- Release HqP.*/
- rgSCHSc1DlProcRmvFrmCellRetx(cell, hqP);
- rgSCHSc1DlProcRmvFrmUeRetx(cell, ue, hqP);
- }
- rgSCHDhmRlsHqpTb(hqP, 1, TRUE);
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].tbId[0] = 2;
- rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].numOfTBs = 1;
- }
- rlsHqBufs->numUes++;
- }
- /* Send the hqProc list for MAC to clear TB1 contents */
- if (rlsHqBufs->numUes)
- {
- rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], cell->macInst);
- RgSchMacRlsHq (&pst, rlsHqBufs);
- }
- }
- return ROK;
-} /* rgSCHSc1RgrDlUeRecfg */
-
-/**
- * @brief Removes UEs context from Priority Qs.
- *
- * @details
- *
- * Function : rgSCHSc1DlRmvUeFrmPrioQs
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-static Void rgSCHSc1DlRmvUeFrmPrioQs(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchSc1DlUe *sc1Ue;
- RgSchDlLcCb *svc;
- uint32_t idx;
-
-
- sc1Ue = RG_GET_SC1_UE_DL(ue, cell);
-
- /* Remove UE From DL priority queues */
- if (sc1Ue->ambrSvc != NULLP)
- {
- rgSCHSc1DlUeRmvFrmSchd(cell, ue);
- }
-
- for (idx = 0; idx < RGSCH_MAX_LC_PER_UE; ++idx)
- {
- svc = ue->dl.lcCb[idx];
- if (svc == NULLP)
- {
- continue;
- }
- rgSCHSc1DlSvcRmvFrmSchd(cell, svc);
- }
-
- return;
-} /* rgSCHSc1DlRmvUeFrmPrioQs */
-
-/**
- * @brief Inactivate UE reason : measgap, acknaprept, poInactv.
- *
- * @details
- *
- * Function : rgSCHSc1DlInactvtUe
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-static Void rgSCHSc1DlInactvtUe(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchSc1DlCell *cellDl = RG_GET_SC1_CELL_DL(cell);
- RgSchDlHqProcCb *hqP;
- RgSchCmnDlHqProc *hqProcDl;
- uint8_t i;
- RgSchDlHqEnt *hqEnt = RG_SCH_CMN_GET_UE_HQE(ue, cell);
-
-
- /* ccpu00130170: UE related HARQ Procs are cleared only
- if UE's Re-establishment procedure is not in progress*/
- if(!(ue->dl.dlInactvMask & RG_HQENT_INACTIVE))
- {
- /* remove all in use HARQ processes from the subframes.
- * Store them in UEs hqProc Lst. Add back to cell's
- * retx lst when UE is activated again. */
- for(i = 0; i < hqEnt->numHqPrcs; i++)
- {
- hqP = &hqEnt->procs[i];
- hqProcDl = RG_SCH_CMN_GET_DL_HQP(hqP);
- /* Remove retx procs from cell's list and
- * add them to UE's List */
- if(
-#ifdef LTEMAC_SPS
- !(RG_SCH_CMN_SPS_DL_IS_SPS_HQP(hqP)) &&
-#endif
- hqProcDl->retxLnk.node != NULLP)
- {
- cmLListDelFrm(&cellDl->retxLst[((RgSchSc1DlHqProc *)\
- (hqProcDl->schSpfc))->prio], &(hqProcDl->retxLnk));
- hqProcDl->retxLnk.node = NULLP;
- rgSCHSc1DlProcAddToUeRetx(cell, ue, hqP);
- }
- }
- }
-
- rgSCHSc1DlRmvUeFrmPrioQs(cell, ue);
-
- return;
-} /* rgSCHSc1DlInactvtUe */
-
-
-/**
- * @brief UE suspension.
- *
- * @details
- *
- * Function : rgSCHSc1DlSuspendUe
- *
- * Removes UE, its SVCs and its HqPs from CELL WIDE
- * PrioQs and Retx Qs Respectively.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-static Void rgSCHSc1DlSuspendUe(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchDlHqProcCb *hqP;
- uint8_t i;
- uint8_t j;
- RgSchDlHqEnt *hqEnt = RG_SCH_CMN_GET_UE_HQE(ue, cell);
-
-
- /* remove all in use HARQ processes from the subframes.
- * Store them in UEs hqProc Lst. Add back to cell's
- * retx lst when UE is activated again. */
- for(i = 0; i < hqEnt->numHqPrcs; i++)
- {
- hqP = &hqEnt->procs[i];
- rgSCHSc1DlProcRmvFrmCellRetx(cell, hqP);
- rgSCHSc1DlProcRmvFrmUeRetx(cell, ue, hqP);
- /* Removing the Harq Proc from subframes list */
- if (hqP->hqPSfLnk.node != NULLP)
- {
- if (hqP->pdcch )
- {
- cmLListDelFrm(&hqP->subFrm->pdcchInfo.pdcchs,
- &hqP->pdcch->lnk);
- cmLListAdd2Tail(&cell->pdcchLst, &hqP->pdcch->lnk);
- hqP->pdcch = NULLP;
- }
- /*CA DEV Start */
- rgSCHUtlDlHqPTbRmvFrmTx(hqP->subFrm,hqP,0,FALSE);
- /*CA DEV End*/
- for (j = 0; j < 2; j++)
- {
- if (hqP->tbInfo[j].state == HQ_TB_WAITING)
- {
- rgSCHDhmRlsHqpTb(hqP, j, TRUE);
- }
- }
- }
- }
- rgSCHSc1DlRmvUeFrmPrioQs(cell, ue);
-
- return;
-} /* rgSCHSc1DlSuspendUe */
-
-/***********************************************************
- *
- * Func : rgSCHSc1DlScanUpdPdbPrio
- *
- * Desc : Increment the pivot and reposition the LCs under the pivot to
- * new location according to thieir PDB and elapsed time.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHSc1DlScanUpdPdbPrio(RgSchCellCb *cell)
-{
-
- return;
-}
-
-/**
- * @brief Function to update Flow control information
- * to be sent to MAC.
- *
- * @details
- *
- * Function: rgSCHSc1DlFillFlowCntrlInfo
- *
- * update Flow control information
- *
- * Invoked by:
- * SCHD
- *
- * Processing Steps:
- *
- * @param[in] RgSchCellCb *cell
- RgInfSfAlloc *sfAlloc;
- * @return S16
- * -# ROK
- **/
-S16 rgSCHSc1DlFillFlowCntrlInfo(RgSchCellCb *cell,RgInfSfAlloc *sfAlloc)
-{
- return ROK;
-}
-/**
- * @brief UE deletion for scheduler
- *
- * @details
- *
- * Function : rgSCHSc1DlUeDel
- *
- * This functions deletes all scheduler information
- * pertaining to a UE
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-Void rgSCHSc1DlUeDel(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchDlHqEnt *hqEnt = RG_SCH_CMN_GET_UE_HQE(ue, cell);
- RgSchSc1DlUe *sc1DlUe = RG_GET_SC1_UE_DL(ue, cell);
-
-
- if (sc1DlUe == NULLP)
- {
- return;
- }
- if( hqEnt)
- {
- /* Remove UEs scheduler context */
- rgSCHSc1DlSuspendUe(cell, ue);
-
- /* Free all SC1 specific control blocks */
- if (hqEnt->sch != NULLP)
- {
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx,
- (Data**)(&(hqEnt->sch)),
- (hqEnt->numHqPrcs * sizeof(RgSchSc1DlHqProc)));
- }
- }
-
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx, (Data**)(&sc1DlUe), (sizeof(RgSchSc1DlUe)));
-
- return;
-} /* rgSCHSc1DlUeDel */
-
-/**
- * @brief Scheduler invocation on Downlink logical channel addition
- *
- * @details
- *
- * Function : rgSCHSc1RgrLcCfg
- *
- * This functions does required processing when a new
- * (dedicated) logical channel is added.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchDlLcCb *dlLc
- * @param[int] RgrLchCfg *lcCfg
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHSc1RgrLcCfg(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *dlLc,RgrLchCfg *lcCfg,RgSchErrInfo *err)
-{
- S16 ret;
-
- ret = rgSCHUtlAllocSBuf(cell->instIdx,
- (Data**)&(RG_SCH_CMN_GET_LC_SCH_SPFC(ue,dlLc,cell)), \
- (sizeof(RgSchSc1DlSvc)));
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : rgSCHSc1CrgLcCfg():"
- "SCH struct alloc failed CRNTI:%d LCID:%d",ue->ueId,lcCfg->lcId);
- err->errCause = RGSCHERR_SCH_SC1_DL_CFG;
- return (ret);
- }
-
- rgSCHSc1DlSvcAdd(cell, ue, dlLc, &lcCfg->dlInfo);
- return ROK;
-} /* rgSCHSc1RgrLcCfg */
-
-
-/**
- * @brief Scheduler invocation on logical channel addition
- *
- * @details
- *
- * Function : rgSCHSc1RgrLcRecfg
- *
- * This functions does required processing when an existing
- * (dedicated) logical channel is reconfigured. Assumes lcg
- * pointer in ulLc is set to the old value.
- * Independent of whether new LCG is meant to be configured,
- * the new LCG scheduler info is accessed and possibly modified.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchDlLcCb *dlLc
- * @param[int] RgrLchRecfg *lcRecfg
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHSc1RgrLcRecfg(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *dlLc,RgrLchRecfg *lcRecfg,RgSchErrInfo *err)
-{
-
- UNUSED(err);
-
- rgSCHSc1DlSvcMod(cell,ue,dlLc, lcRecfg);
-
- return ROK;
-} /* rgSCHSc1RgrLcRecfg */
-
-\f
-/**
- * @brief This function handles the reconfiguration of cell
- *
- * @details
- *
- * Function: rgSCHSc1RgrDlCellRecfg
- * Purpose: Update the reconfiguration parameters.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @return Void
- *
- **/
-static S16 rgSCHSc1RgrDlCellRecfg(RgSchCellCb *cell,RgrCellRecfg *recfg,RgSchErrInfo *err)
-{
- return ROK;
-}
-
-
-\f
-/**
- * @brief This function implements scheduler DL allocation
- *
- * @details
- *
- * Function: rgSCHSc1DlTaCmd
- * Purpose: This function implements scheduler for TA cmd alloc for
- * UEs. The hq proc availed as part of this alloc can be used
- * by the UEs Dedicated CH transmission allocation.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[out] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-static Void rgSCHSc1DlTaCmd(RgSchCellCb *cell,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- CmLListCp *lst;
- CmLList *node;
- RgSchDlHqProcCb *proc;
- RgSchUeCb *ue;
- uint32_t effBo;
- RgSchCmnDlCell *cellCmnDl = RG_SCH_CMN_GET_DL_CELL(cell);
- RgSchCmnDlUe *cmnUeDl;
- RgSchSc1DlUe *ueDl;
- RgSchCmnDlHqProc *cmnHqDl;
- RgSchDlSf *subFrm = allocInfo->dedAlloc.dedDlSf;
-#ifdef LTEMAC_HDFDD
- Bool dlAllowed = FALSE;
-#endif
-
- lst = &cellCmnDl->taLst;
- node = lst->first;
- while(node)
- {
- ue = (RgSchUeCb *)node->node;
- node = node->next;
-#ifdef LTEMAC_HDFDD
- if (ue->hdFddEnbld)
- {
- rgSCHCmnHdFddChkDlAllow ( cell, ue, &dlAllowed);
- if (dlAllowed == FALSE)
- {
- continue;
- }
- }
-#endif
- /* If Ue is inactive in DL then ignore */
- if (ue->dl.dlInactvMask)
- {
- continue;
- }
- cmnUeDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- /*cell added as part of CA dev*/
- ueDl = RG_GET_SC1_UE_DL(ue, cell);
-
- if (rgSCHDhmGetAvlHqProc(cell, ue, cellCmnDl->time, &proc) != ROK)
- {
- continue;
- }
- /* Initialize some of the parameters of the HQ proc */
- cmnHqDl = RG_SCH_CMN_GET_DL_HQP(proc);
-
- effBo = 0;
- /* 3.1 MIMO */
- cmnHqDl->totBytes = 0;
- rgSCHCmnDlAllocTxRb(cell, subFrm, ue, RGSCH_TA_SIZE, &effBo, proc, allocInfo);
- if (effBo == 0)
- {
- /* If no allocations so far, meaning proc obtained now */
- if (cmnHqDl->totBytes == 0)
- {
- rgSCHSc1RlsHqProc(proc);
- /* Added the handling for removing
- * UE from txHqPLst and resetting outStndalloc.*/
- if(proc->reqLnk.node != (PTR)NULLP)
- {
- cmLListDelFrm(&allocInfo->dedAlloc.txHqPLst, &proc->reqLnk);
- proc->reqLnk.node = (PTR)NULLP;
- }
- /*Re-set the outstanding alloc information.*/
- cmnUeDl->outStndAlloc = 0;
- }
- /* Avl BW could not satisfy even TA so break */
- break;
- }
- ueDl->taReqBytes = RGSCH_TA_SIZE;
- cmnUeDl->proc = proc;
- cmnHqDl->totBytes += effBo;
- /* 3.1 MIMO moving this call to cmn scheduler */
- /*rgSCHCmnDlRbInfoAddUeTx(allocInfo, ue);*/
- }
- return;
-}
-
-/**
- * @brief Scheduler invocation
- *
- * @details
- *
- * Function: rgSCHSc1DlHndlInActUes
- * Purpose: The list of inactive UEs present in inactvLst should
- * be removed from the scheduling Qs.
- *
- * Invoked by: Common Scheduler (TTI processing)
- *
- * @param[in] RgSchCellCb *cell
- * @param[out] CmLListCp *inactvLst
- * @return Void
- **/
-Void rgSCHSc1DlHndlInActUes(RgSchCellCb *cell,CmLListCp *inactvLst)
-{
- CmLList *node;
- RgSchUeCb *ue;
-
- node = inactvLst->first;
- while(node)
- {
- ue = (RgSchUeCb *)node->node;
- node = node->next;
- /* Suspend this UE from further scheduling
- * till it is activated again. */
- rgSCHSc1DlInactvtUe(cell, ue);
- }
- return;
-}
-\f
-/**
- * @brief This function initializes all the data for the scheduler
- *
- * @details
- *
- * Function: rgSCHSc1DlInit
- * Purpose: This function initializes the following information
- * 1. Efficiency table
- * 2. CQI to table index - It is one row for upto 3 RBs
- * and another row for greater than 3 RBs
- *
- * currently extended prefix is compiled out.
- * Invoked by: MAC intialization code..may be ActvInit
- *
- * @return Void
- *
- **/
-Void rgSCHSc1DlInit(RgDlSchdApis *rgSchDlApis)
-{
- /* Init the function pointers */
- rgSchDlApis->rgSCHRgrDlUeCfg = rgSCHSc1RgrDlUeCfg;
- rgSchDlApis->rgSCHRgrDlUeRecfg = rgSCHSc1RgrDlUeRecfg;
- rgSchDlApis->rgSCHFreeDlUe = rgSCHSc1DlUeDel;
- rgSchDlApis->rgSCHRgrDlCellCfg = rgSCHSc1RgrDlCellCfg;
- rgSchDlApis->rgSCHRgrDlCellRecfg = rgSCHSc1RgrDlCellRecfg;
- rgSchDlApis->rgSCHFreeDlCell = rgSCHSc1DlCellDel;
- rgSchDlApis->rgSCHRgrDlLcCfg = rgSCHSc1RgrLcCfg;
- rgSchDlApis->rgSCHRgrDlLcRecfg = rgSCHSc1RgrLcRecfg;
- rgSchDlApis->rgSCHFreeDlLc = rgSCHSc1DlLcRmv;
- rgSchDlApis->rgSCHDlNewSched = rgSCHSc1DlDedNewTx;
- rgSchDlApis->rgSCHDlPreSched = rgSCHSc1DlPreSchd;
- rgSchDlApis->rgSCHDlPstSched = rgSCHSc1DlPstSchd;
- rgSchDlApis->rgSCHDlRetxSched = rgSCHSc1DlDedRetx;
- rgSchDlApis->rgSCHDlCeSched = rgSCHSc1DlTaCmd;
- rgSchDlApis->rgSCHDlDedBoUpd = rgSCHSc1DlLcBoUpd;
- rgSchDlApis->rgSCHDlProcAddToRetx = rgSCHSc1DlProcAddToCellRetx;
- rgSchDlApis->rgSCHDlAllocFnlz = rgSCHSc1DlAllocFnlz;
- rgSchDlApis->rgSCHDlCqiInd = rgSCHSc1DlCqiInd;
- rgSchDlApis->rgSCHDlUeRefresh = rgSCHSc1DlUeRefresh;
- rgSchDlApis->rgSCHDlUeReset = rgSCHSc1DlUeReset;
- rgSchDlApis->rgSCHDlActvtUe = rgSCHSc1DlActvtUe;
- rgSchDlApis->rgSCHDlInactvtUes = rgSCHSc1DlHndlInActUes;
- rgSchDlApis->rgSCHDlUeHqEntInit = rgSCHSc1DlUeHqEntInit;
- rgSchDlApis->rgSCHDlUeHqEntDeInit = rgSCHSc1DlUeHqEntDeInit;
- rgSchDlApis->rgSCHDlProcRmvFrmRetx = rgSCHSc1DlProcRmvFrmRetx;
- rgSchDlApis->rgSCHDlTickForPdbTrkng = rgSCHSc1DlScanUpdPdbPrio;
- rgSchDlApis->rgSCHDlFillFlwCtrlInfo = rgSCHSc1DlFillFlowCntrlInfo;
-
- return;
-}
-
-
-
-
-/***********************************************************
- *
- * Func : rgSCHSc1DlInitQueues
- *
- * Desc : Initial downlink scheduler queues
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHSc1DlInitQueues(RgSchSc1DlCell *cellDl)
-{
- uint8_t i;
-
- for (i = 0; i < RG_SC1_DL_NUM_Q; ++i)
- {
- cmLListInit(&cellDl->prioLst[i]);
- cmLListInit(&cellDl->retxLst[i]);
- }
- /* Set appropriate "manage svc positioning" function based on
- * svc priority as array index */
- /* for DCCH svcs */
- for (i = 0; i < RG_SCH_SC1_DL_GBR_PRIO_START; i++)
- {
- cellDl->svcMngFunc[i] = rgSCHSc1DlMngPrio0SvcPosn;
- }
- /* for GBR svcs */
- for (i = RG_SCH_SC1_DL_GBR_PRIO_START; i <= RG_SCH_SC1_DL_GBR_PRIO_END; i++)
- {
- cellDl->svcMngFunc[i] = rgSCHSc1DlMngGbrSvcPosn;
- }
- /* for Non-GBR svcs */
- for (i = RG_SCH_SC1_DL_GBR_PRIO_END+1; i <= RG_SCH_CMN_MAX_PRIO; i++)
- {
- cellDl->svcMngFunc[i] = rgSCHSc1DlMngAmbrSvcPosn;
- }
- return;
-}
-
-
-
-\f
-/**
- * @brief This function Processes the Final Allocations
- * made by the RB Allocator against the requested
- * RETX allocations.
- *
- * @details
- *
- * Function: rgSCHSc1DlRetxAllocFnlz
- * Purpose : Remove the Retx Hq Proc from the Cell's
- * Retx list, if allocation is successful.
- * Fill the HqProc and PDCCH and append it to the SubFrm.
- *
- *
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-static Void rgSCHSc1DlRetxAllocFnlz(RgSchCellCb *cell,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- CmLList *node;
- RgSchUeCb *ue;
- RgSchDlHqProcCb *hqP;
- RgSchDlRbAlloc *dlAllocCb = NULLP;
-
- node = allocInfo->dedAlloc.schdRetxHqPLst.first;
- while(node)
- {
- hqP = (RgSchDlHqProcCb *)node->node;
- ue = hqP->hqE->ue;
- node = node->next;
- /* Fill PDCCH and assign it to HqP */
- dlAllocCb = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, cell);
-
- rgSCHCmnFillHqPPdcch(cell, dlAllocCb, hqP);
-#ifdef LTEMAC_HDFDD
- if (ue->hdFddEnbld)
- {
- rgSCHCmnHdFddUpdDLMark(cell, ue);
- }
-#endif
- /* Extra Check: Retain the hqProc in the RETX Queue if one/more
- * TBs of the HqProc are yet to be scheduled for RETX.
- * Note: Here we are not tracking at TB Level, the priority Q
- * to which it belongs to. The retx prio of transmission is still
- * being maintained at hqProc level, rather than at TB level */
- if ((hqP->tbInfo[0].state != HQ_TB_NACKED) &&
- (hqP->tbInfo[1].state != HQ_TB_NACKED)) {
- rgSCHSc1DlProcRmvFrmCellRetx(cell, hqP);
- }
- /* reset the UE allocation Information */
- rgSCHCmnDlUeResetTemp(ue, hqP);
- }
-
- /* Traverse the nonSchdTxUeLst and reset the UE allocation Info */
- node = allocInfo->dedAlloc.nonSchdRetxHqPLst.first;
- while(node)
- {
- hqP = (RgSchDlHqProcCb *)node->node;
- ue = hqP->hqE->ue;
- node = node->next;
- /* reset the UE allocation Information */
- rgSCHCmnDlUeResetTemp(ue, hqP);
- }
- return;
-}
-
-/* 3.1 MIMO Alloc distribution functions being performed
- * TB wise */
-
-\f
-/***********************************************************
- *
- * Func : rgSCHSc1DlSprTxTbDstn
- *
- * Desc : Perform Actual allocation distribution among
- * UEs schd svcs and TA for a given spare TB "tbInfo" allocation.
- * spare TB allocation is as a result of 1 RETX TB allocation, when
- * conditions are favourable for 2 TB spatial multiplexing.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHSc1DlSprTxTbDstn(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlHqTbCb *tbInfo,uint32_t *effAlloc,CmLList **node)
-{
- RgSchDlLcCb *svc;
- RgSchSc1DlSvc *svcSc1;
- RgSchSc1DlUe *ueDl = RG_GET_SC1_UE_DL(ue, cell);
- uint32_t bytes;
- RgSchLchAllocInfo lchSchdData;
- uint32_t effBo;
- uint32_t rlcHdrEstmt;
-
-
- while((*node) && (*effAlloc > 0))
- {
- svc = (RgSchDlLcCb *)(*node)->node;
- *node = (*node)->next;
- svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
-
- RG_SCH_CMN_DL_GET_HDR_EST(svc, rlcHdrEstmt);
- /* Update the SVC QOS Param */
- if (RG_SCH_CMN_SVC_IS_GBR(svc))
- {
- effBo = svcSc1->effMbr + rlcHdrEstmt;
- bytes = RGSCH_MIN(*effAlloc, effBo);
- /* Determine How much BO is satisfied */
- if (bytes <= rlcHdrEstmt)
- {
- break;
- }
- (svcSc1->bo <= bytes-rlcHdrEstmt)?\
- (svcSc1->bo = 0):\
- (svcSc1->bo -= bytes-rlcHdrEstmt);
- svc->bo = svcSc1->bo;
-
- /* L2_COUNTERS */
-#ifdef LTE_L2_MEAS
- /* Increment qciActiveLCs once since this LCs buffer will be present
- in Harq process */
- if (svc->lcType == CM_LTE_LCH_DTCH)
- {
- ue->qciActiveLCs[svc->qciCb->qci]++;
- }
-
- if ((svc->bo == 0) && (svc->lcType == CM_LTE_LCH_DTCH))
- {
- if (ue->qciActiveLCs[svc->qciCb->qci])
- {
- ue->qciActiveLCs[svc->qciCb->qci]--;
- }
- if (!(ue->qciActiveLCs[svc->qciCb->qci]))
- {
- svc->qciCb->dlUeCount--;
- }
- }
-#endif
- (svcSc1->gbr <= bytes)? (svcSc1->gbr = 0):
- (svcSc1->gbr -= bytes);
- (svcSc1->mbr <= bytes)? (svcSc1->mbr = 0):
- (svcSc1->mbr -= bytes);
- }
- else if(RG_SCH_CMN_SVC_IS_AMBR(svc))
- {
- effBo = ueDl->effAmbr + rlcHdrEstmt;
- bytes = RGSCH_MIN(*effAlloc, effBo);
- /* Determine How much BO is satisfied */
- if (bytes <= rlcHdrEstmt)
- {
- break;
- }
- (svcSc1->bo <= bytes-rlcHdrEstmt)?\
- (svcSc1->bo = 0):\
- (svcSc1->bo -= bytes-rlcHdrEstmt);
-
- (ueDl->ambr <= bytes)? (ueDl->ambr = 0):
- (ueDl->ambr -= bytes);
- }
- else /* Prio 0 SVC */
- {
- effBo = svcSc1->bo + rlcHdrEstmt;
- bytes = RGSCH_MIN(*effAlloc, effBo);
- /* Determine How much BO is satisfied */
- if (bytes <= rlcHdrEstmt)
- {
- break;
- }
- (svcSc1->bo <= bytes-rlcHdrEstmt)?\
- (svcSc1->bo = 0):\
- (svcSc1->bo -= bytes-rlcHdrEstmt);
- }
- /* Position the service accordingly */
- rgSCHSc1DlMngSvcPosn(cell, svc->ue, svc);
- /* Update effAlloc */
- *effAlloc -= bytes;
-
- /* Update DHM for this SVC */
- lchSchdData.lcId = svc->lcId;
- lchSchdData.schdData = bytes;
- rgSCHDhmAddLcData(cell->instIdx, &lchSchdData, tbInfo);
- }
- return;
-}
-
-\f
-/***********************************************************
- *
- * Func : rgSCHSc1DlNewTxTbDstn
- *
- * Desc : Perform Actual allocation distribution among
- * UEs schd svcs and TA for a given TB "tbInfo" allocation.
- * Assumption: TA is given higher priority in Alloc Distribution.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHSc1DlNewTxTbDstn(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlHqTbCb *tbInfo,uint32_t *effAlloc,CmLList **node)
-{
- RgSchDlLcCb *svc;
- RgSchSc1DlSvc *svcSc1 = NULLP;
- RgSchSc1DlUe *ueDl = RG_GET_SC1_UE_DL(ue, cell);
- uint32_t bytes;
- RgSchLchAllocInfo lchSchdData;
- CmLList *prev = NULLP;
-
-
- if (ueDl->taReqBytes)
- {
- if (ueDl->taReqBytes < *effAlloc)
- {
- /*TA satisfied, hence remove from TA Lst */
- rgSCHCmnRmvFrmTaLst(cell, ue);
- /* Indicate to DHM that TA has been scheduled */
- rgSCHDhmSchdTa(ue, tbInfo);
- *effAlloc -= ueDl->taReqBytes;
- }
- /* Reset the TA Req Bytes Field */
- ueDl->taReqBytes = 0;
- }
- while((*node) && (*effAlloc > 0))
- {
- svc = (RgSchDlLcCb *)(*node)->node;
- prev = *node;
- *node = (*node)->next;
- svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
- if (*effAlloc > svcSc1->reqBytes)
- {
- bytes = svcSc1->reqBytes;
- if (bytes <= svcSc1->hdrEstimate)
- {
- break;
- }
- /* 3.1 MIMO updating the reqBytes field */
- svcSc1->reqBytes = 0;
- svcSc1->bo = 0;
- }
- else
- {
- bytes = *effAlloc;
- if (bytes <= svcSc1->hdrEstimate)
- {
- break;
- }
- /* 3.1 MIMO updating the reqBytes field */
- svcSc1->reqBytes -= bytes;
- (svcSc1->bo <= bytes-svcSc1->hdrEstimate)?\
- (svcSc1->bo = 0):\
- (svcSc1->bo -= bytes-svcSc1->hdrEstimate);
- }
- svc->bo = svcSc1->bo;
-
- /* L2_COUNTERS */
-#ifdef LTE_L2_MEAS
-
- /* Increment qciActiveLCs once since this LCs buffer will be present
- in Harq process */
- if (svc->lcType == CM_LTE_LCH_DTCH)
- {
- ue->qciActiveLCs[svc->qciCb->qci]++;
- }
-
- if ((svc->bo == 0) && (svc->lcType == CM_LTE_LCH_DTCH))
- {
- if (ue->qciActiveLCs[svc->qciCb->qci])
- {
- ue->qciActiveLCs[svc->qciCb->qci]--;
- }
- if (!(ue->qciActiveLCs[svc->qciCb->qci]))
- {
- svc->qciCb->dlUeCount--;
- }
- }
-#endif
-
- /* Update the SVC QOS Param */
- if (RG_SCH_CMN_SVC_IS_GBR(svc))
- {
- (svcSc1->gbr <= bytes)? (svcSc1->gbr = 0):
- (svcSc1->gbr -= bytes);
- (svcSc1->mbr <= bytes)? (svcSc1->mbr = 0):
- (svcSc1->mbr -= bytes);
- }
- else if(RG_SCH_CMN_SVC_IS_AMBR(svc))
- {
- (ueDl->ambr <= bytes)? (ueDl->ambr = 0):
- (ueDl->ambr -= bytes);
- }
- /* Position the service accordingly */
- rgSCHSc1DlMngSvcPosn(cell, svc->ue, svc);
- /* Update effAlloc */
- *effAlloc -= bytes;
-
- /* Update DHM for this SVC */
- lchSchdData.lcId = svc->lcId;
- lchSchdData.schdData = bytes;
- rgSCHDhmAddLcData(cell->instIdx, &lchSchdData, tbInfo);
- }
- /* If no more scheduled LCs for TB data distribution
- * then distribute the spare TB data among the LCs
- * of the UE with non-zero BO. This is effective for
- * schedulers work on LC level priorities rather than
- * UE level. */
- if ((*node == NULLP) && (svcSc1) && (svcSc1->reqBytes == 0))
- {
- rgSCHSc1DlSprTxTbDstn(cell, ue, tbInfo, effAlloc,
- &ueDl->lcsWithData.first);
- *node = NULLP;
- return;
- }
- /* make sure node points to the svc not completely
- * satisfied.
- * make sure if not served completely then
- * the other TB allocation accomodates the same */
- *node = prev;
- return;
-}
-
-
-\f
-/***********************************************************
- *
- * Func : rgSCHSc1DlNewTxUeFnlz
- *
- * Desc : Perform allocation Distribution from scheduled TB
- * among the list of services considered for scheduling.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHSc1DlNewTxUeFnlz (RgSchCellCb *cell,RgSchCmnDlRbAllocInfo *allocInfo,RgSchUeCb *ue)
-{
- CmLList *node;
- RgSchSc1DlUe *ueDl = RG_GET_SC1_UE_DL(ue, cell);
- RgSchCmnDlUe *cmnUeDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- /*cell added as part of CA dev*/
- /* 3.1 MIMO Distribute data of each TB across services */
- RgSchDlRbAlloc *dlAllocCb = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, cell);
- uint32_t remTb1Bytes = dlAllocCb->tbInfo[0].bytesAlloc;
- uint32_t remTb2Bytes = dlAllocCb->tbInfo[1].bytesAlloc;
- uint32_t effAlloc = 0;
- /*ccpu00120365-ADD-added to code to check if second TB is utilized */
- uint32_t tb2Bytes = 0;
-
-
-
- /* 3.1 MIMO Consider the allocation of New TX TB for distribution */
- /* Handle schd services */
- node = ueDl->schdSvcs.first;
- if (remTb1Bytes){
- effAlloc += remTb1Bytes;
- rgSCHSc1DlNewTxTbDstn(cell, ue, &cmnUeDl->proc->tbInfo[0],\
- &remTb1Bytes, &node);
- /* In the event that TB1 is not completely filled by the DL LCs
- * BO, consider the reducing the iMcs for increasing redundancy
- * and hence reception quality at UE */
- rgSCHCmnRdcImcsTxTb(dlAllocCb, 0,
- dlAllocCb->tbInfo[0].bytesAlloc - remTb1Bytes);
- }
-
- /*ccpu00120365-ADD-assigning value of remTb2Bytes before utilization */
- tb2Bytes = remTb2Bytes;
-
- /* Extra check for a non SM UE allocation */
- if (remTb2Bytes){
- effAlloc += remTb2Bytes;
- rgSCHSc1DlNewTxTbDstn(cell, ue, &cmnUeDl->proc->tbInfo[1],\
- &remTb2Bytes, &node);
- /* In the event that TB2 is not completely filled by the DL LCs
- * BO, consider the reducing the iMcs for increasing redundancy
- * and hence reception quality at UE */
- rgSCHCmnRdcImcsTxTb(dlAllocCb, 1,
- dlAllocCb->tbInfo[1].bytesAlloc - remTb2Bytes);
- }
-
- /* ccpu00120365-ADD-Disable the second TB as the second TB is not
- * utilized */
- if ( remTb2Bytes && ( tb2Bytes == remTb2Bytes) )
- {
- dlAllocCb->mimoAllocInfo.precIdxInfo = 0;
- dlAllocCb->mimoAllocInfo.numTxLyrs = 1;
- dlAllocCb->tbInfo[1].schdlngForTb = FALSE;
- dlAllocCb->tbInfo[1].isDisabled = TRUE;
- }
-
- if (effAlloc == (remTb1Bytes + remTb2Bytes))
- {
- /* Allocation such that Nothing could be satisfied */
- /* Return the grabbed PDCCH */
- rgSCHUtlPdcchPut(cell, &dlAllocCb->dlSf->pdcchInfo,
- dlAllocCb->pdcch);
- rgSCHSc1RlsHqProc(cmnUeDl->proc);
- return;
- }
-
- /* Fill PDCCH and assign it to HqP */
- rgSCHCmnFillHqPPdcch(cell, dlAllocCb, cmnUeDl->proc);
-
- return;
-}
-
-\f
-/**
- * @brief This function Processes the Final Allocations
- * made by the RB Allocator against the requested
- * New TX allocations.
- *
- * @details
- *
- * Function: rgSCHSc1DlNewTxAllocFnlz
- * Purpose : Distribute the allocation among the Scheduled SVCs.
- * Fill pdcch and HqP for UEs will allocations.
- * Release HqP for UE with no allocation.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-static Void rgSCHSc1DlNewTxAllocFnlz (RgSchCellCb *cell,RgSchCmnDlRbAllocInfo *allocInfo)
-{
- CmLList *node;
- RgSchUeCb *ue;
- RgSchCmnDlUe *cmnUeDl;
- RgSchDlHqProcCb *hqP;
-
- node = allocInfo->dedAlloc.schdTxHqPLst.first;
- while(node)
- {
- hqP = (RgSchDlHqProcCb *)node->node;
- ue = hqP->hqE->ue;
- node = node->next;
- cmnUeDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- /*cell added as part of CA dev*/
-
- rgSCHSc1DlNewTxUeFnlz(cell, allocInfo, ue);
-#ifdef LTEMAC_HDFDD
- if (ue->hdFddEnbld)
- {
- rgSCHCmnHdFddUpdDLMark(cell, ue);
- }
-#endif
- /* reset the UE allocation Information */
- cmLListInit(&((RgSchSc1DlUe *)(cmnUeDl->schSpfc))->schdSvcs);
- rgSCHCmnDlUeResetTemp(ue, hqP);
- }
-
- /* Traverse the nonSchdTxUeLst and reset the UE allocation Info */
- node = allocInfo->dedAlloc.nonSchdTxHqPLst.first;
- while(node)
- {
- hqP = (RgSchDlHqProcCb *)node->node;
- ue = hqP->hqE->ue;
- node = node->next;
- cmnUeDl = RG_SCH_CMN_GET_DL_UE(ue, cell);
-
- /* Release HqProc */
- rgSCHSc1RlsHqProc(hqP);
- /* reset the UE allocation Information */
- cmLListInit(&((RgSchSc1DlUe *)(cmnUeDl->schSpfc))->schdSvcs);
- rgSCHCmnDlUeResetTemp(ue, hqP);
- }
- return;
-}
-
-/* 3.1 Added new function to handle TX+RETX alloc fnlz'n */
-\f
-/**
- * @brief This function Processes the Final Allocations
- * made by the RB Allocator against the requested
- * RETX+New TX allocations. The NewTx TB allocation
- * is considered for distribution among LCs.
- *
- * @details
- *
- * Function: rgSCHSc1DlRetxNewTxAllocFnlz
- * Purpose : 1. Reached here due to 1 RETX TB allocation for a
- * SM UE, which is capable to accomodate a newTX
- * in the other TB.
- * 2. Distribute NewTX TB allocation among the
- * SVCs present in lcsWithData list of UE.
- *
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchCmnDlRbAllocInfo *cellAllocInfo
- * @return Void
- *
- **/
-static Void rgSCHSc1DlRetxNewTxAllocFnlz(RgSchCellCb *cell,RgSchCmnDlRbAllocInfo *cellAllocInfo)
-{
- CmLList *node;
- RgSchUeCb *ue;
- RgSchSc1DlUe *sc1DlUe;
- RgSchDlHqProcCb *hqP;
- RgSchDlHqTbCb *newTxTbInfo;
- uint32_t effAlloc;
- uint32_t remTbBytes;
- RgSchDlRbAlloc *ueAllocInfo;
- RgSchDlRbAlloc *dlAllocCb;
-
-
- node = cellAllocInfo->dedAlloc.schdTxRetxHqPLst.first;
- while(node)
- {
- hqP = (RgSchDlHqProcCb *)node->node;
- ue = hqP->hqE->ue;
- node = node->next;
- sc1DlUe = RG_GET_SC1_UE_DL(ue, cell);
- ueAllocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, cell);
- dlAllocCb = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, cell);
- /* Index 0 of ueAllocInfo->tbInfo will always hold the
- * RETX TB and index 1 will hold the NewTX TB in case of
- * RETX+TX allocation. */
- newTxTbInfo = ueAllocInfo->tbInfo[1].tbCb;
- effAlloc = remTbBytes = ueAllocInfo->tbInfo[1].bytesAlloc;
- rgSCHSc1DlSprTxTbDstn(cell, ue, newTxTbInfo,\
- &remTbBytes, &(sc1DlUe->lcsWithData.first));
- /* Trying to reduce mcs of TX TB to increase reception quality at UE.
- * In case of RETX+TX allocation, TX TB allocation was irrespective
- * of actual requirement by UE, hence in case if consumption is
- * less than allocation, consider reducing the iMcs of this TX TB. */
- rgSCHCmnRdcImcsTxTb(dlAllocCb, 1, effAlloc - remTbBytes);
- /* 3.1 MIMO Remove/Retain from/in cell RETX List */
- rgSCHSc1DlProcRmvFrmCellRetx(cell, hqP);
- /* Fill PDCCH and assign it to HqP */
- rgSCHCmnFillHqPPdcch(cell, dlAllocCb, hqP);
-#ifdef LTEMAC_HDFDD
- if (ue->hdFddEnbld)
- {
- rgSCHCmnHdFddUpdDLMark(cell, ue);
- }
-#endif
- /* reset the UE allocation Information */
- rgSCHCmnDlUeResetTemp(ue, hqP);
- }
-
- /* Traverse the nonSchdTxRetxHqPLst and reset the UE allocation Info */
- node = cellAllocInfo->dedAlloc.nonSchdTxRetxHqPLst.first;
- while(node)
- {
- hqP = (RgSchDlHqProcCb *)node->node;
- ue = hqP->hqE->ue;
- node = node->next;
- /* reset the UE allocation Information */
- rgSCHCmnDlUeResetTemp(ue, hqP);
- }
-}
-
-\f
-/**
- * @brief This function Processes the Final Allocations
- * made by the RB Allocator against the requested.
- *
- * @details
- *
- * Function: rgSCHSc1DlAllocFnlz
- * Purpose: This function Processes the Final Allocations
- * made by the RB Allocator against the requested.
- * 1. Loop through scheduled TX and RETX lists.
- * Fill in the corresponding PDCCH and HqProcs.
- * In case of TX If actual Alloc < requested, then perform
- * an appropriate distribution among the schdSvcs.
- * If TA is satisfied, then remove UE from TA Lst.
- * 2. Loop through UnScheduled TX and RETX Lists.
- * Release grabbed HqProcs.
- * Put back SVCs from schdSvcsLst to their corresponding Qs.
- *
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-Void rgSCHSc1DlAllocFnlz(RgSchCellCb *cell,RgSchCmnDlRbAllocInfo *allocInfo)
-{
-
- rgSCHSc1DlRetxAllocFnlz(cell, allocInfo);
-
- rgSCHSc1DlNewTxAllocFnlz(cell, allocInfo);
-
- /*3.1 MIMO new Function added to handle TX+RETX
- * harq process scheduling finalization */
- rgSCHSc1DlRetxNewTxAllocFnlz(cell, allocInfo);
- return;
-}
-
-
-\f
-/**
- * @brief This function Updates the DL CQI for the UE.
- *
- * @details
- *
- * Function: rgSCHSc1DlCqiInd
- * Purpose: Updates the DL CQI for the UE
- *
- * Invoked by: Common Scheduler. SC1 does nothing.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] TfuDlCqiRpt *dlCqiRpt
- * @return Void
- *
- **/
-Void rgSCHSc1DlCqiInd(RgSchCellCb *cell,RgSchUeCb *ue,Bool isPucchInfo,Void *dlCqi)
-{
- return;
-}
-
-\f
-/**
- * @brief This function adds a service to UE's list of lcsWithData.
- *
- * @details
- *
- * Function: rgSCHSc1DlAdd2UeLcsWithData
- * Purpose: 1. This is to maintain a snapshot view of the
- * DL SVCs distributions among the cellwide priority
- * queues.
- * 2. This snapshot view is maintained in the order
- * of priority of the SVCs with in UE.
- * 3. Addition of SVC to a cellwide priority Queue
- * triggers this function.
- *
- * Invoked by: Functions of DL SC1 which add SVC or UE(for ambr svc)
- * to cellwide priority Queues.
- *
- * @param[in] RgSchUeCb* ue
- * @param[in] RgSchDlLcCb* svc
- * @return Void
- *
- **/
-static Void rgSCHSc1DlAdd2UeLcsWithData(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *svc)
-{
- CmLListCp *lst;
- CmLList *node;
- RgSchCmnDlSvc *cmnDlSvc = RG_SCH_CMN_GET_DL_SVC(svc);
- RgSchSc1DlSvc *sc1DlSvc = RG_GET_SC1_SVC_DL(ue,svc,cell);
- RgSchSc1DlUe *sc1DlUe = RG_GET_SC1_UE_DL(ue, cell);
- RgSchCmnDlSvc *cmnDlLstSvc;
-
-
- lst = &(sc1DlUe->lcsWithData);
- node = lst->first;
- while(node)
- {
- cmnDlLstSvc = RG_SCH_CMN_GET_DL_SVC(((RgSchDlLcCb *)(node->node)));
- if (cmnDlSvc->prio <= cmnDlLstSvc->prio)
- {
- break;
- }
- node = node->next;
- }
- if (node == NULLP)
- {
- cmLListAdd2Tail(lst, &sc1DlSvc->lcWithDataLnk);
- sc1DlSvc->lcWithDataLnk.node = (PTR)svc;
- }
- else
- {
- lst->crnt = node;
- cmLListInsCrnt(lst, &sc1DlSvc->lcWithDataLnk);
- sc1DlSvc->lcWithDataLnk.node = (PTR)svc;
- }
- return;
-}
-
-\f
-/**
- * @brief This function adds a service to UE's list of lcsWithData.
- *
- * @details
- *
- * Function: rgSCHSc1DlRmFrmUeLcsWithData
- * Purpose: 1. This is to maintain a snapshot view of the
- * DL SVCs distributions among the cellwide priority
- * queues.
- * 2. This snapshot view is maintained in the order
- * of priority of the SVCs with in UE.
- * 3. Addition of SVC to a cellwide priority Queue
- * triggers this function.
- *
- * Invoked by: Functions of DL SC1 which add SVC or UE(for ambr svc)
- * to cellwide priority Queues.
- *
- * @param[in] RgSchUeCb* ue
- * @param[in] RgSchDlLcCb* svc
- * @return Void
- *
- **/
-static Void rgSCHSc1DlRmFrmUeLcsWithData(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *svc)
-{
- RgSchSc1DlSvc *sc1DlSvc = RG_GET_SC1_SVC_DL(ue,svc,cell);
- RgSchSc1DlUe *sc1DlUe = RG_GET_SC1_UE_DL(ue, cell);
-
-
- cmLListDelFrm(&(sc1DlUe->lcsWithData), &sc1DlSvc->lcWithDataLnk);
- sc1DlSvc->lcWithDataLnk.node = NULLP;
- return;
-}
-/***************** SC1 DL SCHEDULER FUNCTION DEFNs END HERE ****************/
-
-/***************************************************************************/
-
-/***************** SC1 UL SCHEDULER FUNCTION DEFNs START HERE **************/
-
-/*--------------------------*
- * UL specific functions START
- *---------------------------*/
-
-/**
- * @brief UE Lc Config for RR
- *
- * @details
- *
- * Function : rgSCHSc1UlLchCfg
- *
- * Processing Steps: Dummy function
- *
- * @param[in] RgrSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrLchCfg *cfg
- * @param[in] RgSchErrInfo *err
- * @return S16
- * -# ROK
- **/
-S16 rgSCHSc1UlLchCfg
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrLchCfg *cfg,
-RgSchErrInfo *err
-)
-{
- return ROK;
-}
-/**
- * @brief UE Lc Reconfig for RR
- *
- * @details
- *
- * Function : rgSCHSc1UlLchRecfg
- *
- * Processing Steps: Dummy function
- *
- * @param[in] RgrSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrLchRecfg *recfg
- * @param[in] RgSchErrInfo *err
- * @return S16
- * -# ROK
- **/
-S16 rgSCHSc1UlLchRecfg
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrLchRecfg *recfg,
-RgSchErrInfo *err
-)
-{
- return ROK;
-}
-/**
- * @brief LC deletion for PFS
- *
- * @details
- *
- * Function : rgSCHSc1UlLchDel
- *
- * Processing Steps: Dummy function
- *
- * @param[in] RgrSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] CmLteLcId lcId
- * @return S16
- * -# ROK
- **/
-S16 rgSCHSc1UlLchDel(RgSchCellCb *cell,RgSchUeCb *ue,CmLteLcId lcId,uint8_t lcgId)
-{
- return (ROK);
-}
-\f
-/**
- * @brief This function initializes all the data for the scheduler
- *
- * @details
- *
- * Function: rgSCHSc1UlInit
- * Purpose: This function initializes the following information
- * 1. Efficiency table
- * 2. CQI to table index - It is one row for upto 3 RBs
- * and another row for greater than 3 RBs
- *
- * currently extended prefix is compiled out.
- * Invoked by: MAC intialization code..may be ActvInit
- *
- * @return Void
- *
- **/
-Void rgSCHSc1UlInit(RgUlSchdApis *rgSchUlApis)
-{
- /* Init the function pointers */
- rgSchUlApis->rgSCHRgrUlUeCfg = rgSCHSc1RgrUlUeCfg;
- rgSchUlApis->rgSCHRgrUlUeRecfg = rgSCHSc1RgrUlUeRecfg;
- rgSchUlApis->rgSCHFreeUlUe = rgSCHSc1UlUeDel;
- rgSchUlApis->rgSCHRgrUlCellCfg = rgSCHSc1RgrUlCellCfg;
- rgSchUlApis->rgSCHRgrUlCellRecfg = rgSCHSc1RgrUlCellRecfg;
- rgSchUlApis->rgSCHFreeUlCell = rgSCHSc1UlCellDel;
- rgSchUlApis->rgSCHRgrUlLcCfg = rgSCHSc1UlLchCfg;
- rgSchUlApis->rgSCHRgrUlLcRecfg = rgSCHSc1UlLchRecfg;
- rgSchUlApis->rgSCHRgrUlLcgCfg = rgSCHSc1RgrLcgCfg;
- rgSchUlApis->rgSCHRgrUlLcgRecfg = rgSCHSc1RgrLcgRecfg;
- rgSchUlApis->rgSCHFreeUlLcg = rgSCHSc1LcgDel;
- rgSchUlApis->rgSCHRgrUlLchDel = rgSCHSc1UlLchDel;
- rgSchUlApis->rgSCHUlSched = rgSCHSc1UlSched;
- rgSchUlApis->rgSCHUpdBsrShort = rgSCHSc1UpdBsrShort;
- rgSchUlApis->rgSCHUpdBsrTrunc = rgSCHSc1UpdBsrTrunc;
- rgSchUlApis->rgSCHUpdBsrLong = rgSCHSc1UpdBsrLong;
- rgSchUlApis->rgSCHContResUlGrant = rgSCHSc1ContResUlGrant;
- rgSchUlApis->rgSCHSrRcvd = rgSCHSc1SrRcvd;
- rgSchUlApis->rgSCHUlCqiInd = rgSCHSc1UlCqiInd;
- rgSchUlApis->rgSCHUlUeRefresh = rgSCHSc1UlUeRefresh;
- rgSchUlApis->rgSCHUlAllocFnlz = rgSCHSc1UlAllocFnlz;
- rgSchUlApis->rgSCHUlInactvtUes = rgSCHSc1UlHndlInActUes;
- rgSchUlApis->rgSCHUlActvtUe = rgSCHSc1UlActvtUe;
- rgSchUlApis->rgSCHUlUeReset = rgSCHSc1UlUeReset;
- rgSchUlApis->rgSCHRgrUlLcgUpd = rgSCHSc1UlLcgUpd;
- return;
-}
-
-/**
- * @brief UE initialisation for scheduler
- *
- * @details
- *
- * Function : rgSCHSc1RgrUlUeCfg
- *
- * This functions intialises UE specific scheduler
- * information
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[int] RgrUeCfg *ueCfg
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHSc1RgrUlUeCfg(RgSchCellCb *cell,RgSchUeCb *ue,RgrUeCfg *ueCfg,RgSchErrInfo *err)
-{
-
- RgSchCmnUe *ueSchCmn = RG_SCH_CMN_GET_UE(ue, cell);
-
- if(rgSCHUtlAllocSBuf(cell->instIdx,
- (Data**)&(ueSchCmn->ul.schSpfc), (sizeof(RgSchSc1UlUe))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED CRNTI:%d",ue->ueId);
- err->errCause = RGSCHERR_SCH_SC1_UL_CFG;
- return RFAILED;
- }
-
- return ROK;
-} /* rgSCHSc1RgrUlUeCfg */
-
-/**
- * @brief UE reconfiguration for scheduler
- *
- * @details
- *
- * Function : rgSCHSc1RgrUlUeRecfg
- *
- * This functions updates UE specific scheduler
- * information upon UE reconfiguration
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[int] RgrUeRecfg *ueRecfg
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHSc1RgrUlUeRecfg(RgSchCellCb *cell,RgSchUeCb *ue,RgrUeRecfg *ueRecfg,RgSchErrInfo *err)
-{
- return ROK;
-} /* rgSCHSc1RgrUeRecfg */
-
-/**
- * @brief UE deletion for scheduler
- *
- * @details
- *
- * Function : rgSCHSc1UlUeDel
- *
- * This functions deletes all scheduler information
- * pertaining to a UE
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-Void rgSCHSc1UlUeDel(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchSc1UlCell *cellUl = RG_GET_SC1_CELL_UL(cell);
- RgSchSc1UlUe *ueUl = RG_GET_SC1_UE_UL(ue, cell);
-
-
- if (ueUl == NULLP)
- {
- return;
- }
- if(ueUl->txLnk.node)
- {
- cmLListDelFrm(&(cellUl->ueTxLst[ueUl->qId]), &(ueUl->txLnk));
- ueUl->txLnk.node = NULLP;
- }
- if(ueUl->contResLnk.node)
- {
- cmLListDelFrm(&(cellUl->contResLst), &(ueUl->contResLnk));
- ueUl->contResLnk.node = NULLP;
- }
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx,
- (Data**)(&(ueUl)), (sizeof(RgSchSc1UlUe)));
-
- return;
-} /* rgSCHSc1UlUeDel */
-
-/**
- * @brief UE Reset for scheduler
- *
- * @details
- *
- * Function : rgSCHSc1UlUeReset
- *
- * Remove this UE from all Scheduling Priority Qs
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-Void rgSCHSc1UlUeReset(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchSc1UlCell *cellUl = RG_GET_SC1_CELL_UL(cell);
- RgSchSc1UlUe *ueUl = RG_GET_SC1_UE_UL(ue, cell);
-
-
- ueUl->srRcvd = FALSE;
-
- if(ueUl->txLnk.node)
- {
- cmLListDelFrm(&(cellUl->ueTxLst[ueUl->qId]), &(ueUl->txLnk));
- ueUl->txLnk.node = NULLP;
- }
- if(ueUl->contResLnk.node)
- {
- cmLListDelFrm(&(cellUl->contResLst), &(ueUl->contResLnk));
- ueUl->contResLnk.node = NULLP;
- }
- return;
-} /* rgSCHSc1UlUeReset */
-
-\f
-/**
- * @brief Scheduler processing on cell configuration
- *
- * @details
- *
- * Function : rgSCHSc1RgrUlCellCfg
- *
- * This function does requisite initialisation
- * and setup for scheduler1 when a cell is
- * configured
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgrCellCfg *cellCfg
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHSc1RgrUlCellCfg(RgSchCellCb *cell,RgrCellCfg *cellCfg,RgSchErrInfo *err)
-{
- RgSchSc1UlCell *cellUl;
-
- if((rgSCHUtlAllocSBuf(cell->instIdx,
- (Data**)&(((RgSchCmnCell*)((cell)->sc.sch))->ul.schSpfc), \
- (sizeof(RgSchSc1UlCell))) != ROK))
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED");
- err->errCause = RGSCHERR_SCH_SC1_UL_CFG;
- return RFAILED;
- }
- cellUl = RG_GET_SC1_CELL_UL(cell);
- cmLListInit(&cellUl->contResLst);
- cmLListInit(&cellUl->ueTxLst[0]);
- cmLListInit(&cellUl->ueTxLst[1]);
-
- return ROK;
-} /* rgSCHSc1RgrUlCellCfg */
-
-\f
-/**
- * @brief This function handles the reconfiguration of cell
- *
- * @details
- *
- * Function: rgSCHSc1RgrUlCellRecfg
- * Purpose: Update the reconfiguration parameters.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @return Void
- *
- **/
-S16 rgSCHSc1RgrUlCellRecfg(RgSchCellCb *cell,RgrCellRecfg *recfg,RgSchErrInfo *err)
-{
- return ROK;
-}
-
-/**
- * @brief Scheduler processing for cell delete
- *
- * @details
- *
- * Function : rgSCHSc1UlCellDel
- *
- * This functions de-initialises and frees memory
- * taken up by scheduler1 for the entire cell.
- *
- * @param[in] RgSchCellCb *cell
- * @return Void
- **/
-Void rgSCHSc1UlCellDel(RgSchCellCb *cell)
-{
- RgSchSc1UlCell *cellUl = RG_GET_SC1_CELL_UL(cell);
-
-
- if (cellUl == NULLP)
- {
- return;
- }
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx,
- (Data**)(&(cellUl)), (sizeof(RgSchSc1UlCell)));
-
- return;
-} /* rgSCHSc1UlCellDel */
-
-/**
- * @brief Scheduler invocation on logical channel Group addition
- *
- * @details
- *
- * Function : rgSCHSc1RgrLcgCfg
- *
- * This functions does required processing when a new
- * (dedicated) logical channel is added. Assumes lcg
- * pointer in ulLc is set.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchLcgCb *lcg
- * @param[int] RgrLcgCfg *lcgCfg
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHSc1RgrLcgCfg(RgSchCellCb *cell,RgSchUeCb *ue,RgSchLcgCb *lcg,RgrLcgCfg *lcgCfg,RgSchErrInfo *err)
-{
- return ROK;
-} /* rgSCHSc1RgrLcgCfg */
-
-/**
- * @brief Scheduler invocation on logical channel addition
- *
- * @details
- *
- * Function : rgSCHSc1RgrLcgRecfg
- *
- * This functions does required processing when an existing
- * (dedicated) logical channel is reconfigured. Assumes lcg
- * pointer in ulLc is set to the old value.
- * Independent of whether new LCG is meant to be configured,
- * the new LCG scheduler info is accessed and possibly modified.
- *
- * @param[in] RgSchCellCb *cell,
- * @param[in] RgSchUeCb *ue,
- * @param[in] RgSchLcgCb *lcg,
- * @param[in] RgrLcgRecfg *reCfg,
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHSc1RgrLcgRecfg(RgSchCellCb *cell,RgSchUeCb *ue,RgSchLcgCb *lcg,RgrLcgRecfg *reCfg,RgSchErrInfo *err)
-{
- return ROK;
-} /* rgSCHSc1RgrLcgRecfg */
-
-/***********************************************************
- *
- * Func : rgSCHSc1LcgDel
- *
- * Desc : Scheduler handling for a (dedicated)
- * uplink lcg being deleted
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHSc1LcgDel(RgSchCellCb *cell,RgSchUeCb *ue,RgSchLcgCb *lcg)
-{
- rgSCHSc1UlPosnUeInQ(cell, ue);
- return;
-}
-
-/**
- * @brief Perform alloction for this UE
- *
- * @details
- *
- * Function : rgSCHSc1UlSchdUe
- *
- * Processing Steps: cater to as much as UE needs, with
- * a limitation on maxBits per scheduling instance(per TTI)
- * per UE. Return failure, if UE is not considered
- * for scheduling (case, where it is already selected for a
- * retransmission).
- *
- *
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-static Void rgSCHSc1UlSchdUe(RgSchUeCb *ue,RgSchCellCb *cell)
-{
- RgSchCmnUlUe *cmnUlUe = RG_SCH_CMN_GET_UL_UE(ue, cell);
- /*cell added as part of CA dev*/
- RgSchSc1UlUe *ulUe = RG_GET_SC1_UE_UL(ue, cell);
-
-
- if(ulUe->srRcvd == TRUE)
- {
- cmnUlUe->alloc.reqBytes = RGSCH_MAX(RG_SCH_CMN_UL_SR_BYTES, \
- ue->ul.effBsr);
- return;
- }
-
- cmnUlUe->alloc.reqBytes = ue->ul.effBsr;
-
- return;
-}
-
-/**
- * @brief Scheduler invocation
- *
- * @details
- *
- * Function: rgSCHSc1UlSchdForDataTrans
- * Purpose: Uplink Scheduling for UE data Transmission.
- *
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[out] RgSchCmnUlRbAllocInfo *allocInfo
- * @param[in] uint8_t remUe
- * @return Void
- **/
-static Void rgSCHSc1UlSchdForDataTrans(RgSchCellCb *cell,RgSchCmnUlRbAllocInfo *allocInfo,uint8_t remUe)
-{
- RgSchSc1UlCell *sc1UlCell = RG_GET_SC1_CELL_UL(cell);
-
- if (remUe == 0)
- {
- return;
- }
- /* Allocate UEs with LCG0 data pending */
- rgSCHSc1UlSchdUeTxLst(cell, &sc1UlCell->ueTxLst[0], allocInfo, &remUe);
-
- if (remUe == 0)
- {
- return;
- }
- /* Allocate UEs with other LCGs data pending */
- rgSCHSc1UlSchdUeTxLst(cell, &sc1UlCell->ueTxLst[1], allocInfo, &remUe);
-
- return;
-}
-
-/**
- * @brief Scheduler invocation
- *
- * @details
- *
- * Function: rgSCHSc1UlSchdUeTxLst
- * Purpose: Uplink Scheduling for UE data Transmission.
- *
- *
- * Invoked by: Scheduler
- *
- * @param[in] CmLListCp *ueTxLst
- * @param[out] RgSchCmnUlRbAllocInfo *allocInfo
- * @param[in] uint8_t *remUe
- * @return Void
- **/
-static Void rgSCHSc1UlSchdUeTxLst(RgSchCellCb *cell,CmLListCp *ueTxLst,RgSchCmnUlRbAllocInfo *allocInfo,uint8_t *remUe)
-{
- RgSchUeCb *ue;
- CmLList *node;
-#ifdef LTEMAC_HDFDD
- Bool ulAllowed = FALSE;
-#endif
-
-
- node = ueTxLst->first;
- while ((node) && (*remUe))
- {
- ue = (RgSchUeCb *)node->node;
- node = node->next;
-#ifdef LTEMAC_HDFDD
- if (ue->hdFddEnbld)
- {
- rgSCHCmnHdFddChkUlAllow (cell, ue, &ulAllowed);
- if (ulAllowed == FALSE)
- {
- continue;
- }
- }
-#endif
-
- if (RG_SCH_CMN_IS_UL_UE_RETX(ue, cell))
- {
- /* UE already scheduled in this subframe (for retx)
- * OR is inactive for UL Transmission.*/
- continue;
- }
- /* Added support for SPS*/
-#ifdef LTEMAC_SPS
- else if (RG_SCH_CMN_IS_SPS_SCHD(ue, cell))
- {
- /*-- Already Scheduled by SPS --*/
- continue;
- }
-#endif
-
- rgSCHSc1UlSchdUe(ue,cell);/*cell added as part of CA dev*/
-
- rgSCHCmnUlAdd2UeLst(cell, allocInfo, ue);
-
- --(*remUe);
- }
-
- return;
-}
-
-/**
- * @brief Scheduler invocation
- *
- * @details
- *
- * Function: rgSCHSc1UlSchdForContRes
- * Purpose: Uplink Scheduling for Contention Resolution.
- *
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[out] RgSchCmnUlRbAllocInfo *allocInfo
- * @param[out] uint8_t *remUe
- * @return Void
- **/
-static Void rgSCHSc1UlSchdForContRes(RgSchCellCb *cell,RgSchCmnUlRbAllocInfo *allocInfo,uint8_t *remUe)
-{
- RgSchSc1UlCell *sc1UlCell = RG_GET_SC1_CELL_UL(cell);
- RgSchUeCb *ue;
- CmLList *node;
- RgSchCmnUlUe *cmnUlUe;
-#ifdef LTEMAC_HDFDD
- Bool ulAllowed = FALSE;
-#endif
-
-
- node = sc1UlCell->contResLst.first;
- while ((node) && (*remUe))
- {
- ue = (RgSchUeCb *)node->node;
- cmnUlUe = RG_SCH_CMN_GET_UL_UE(ue, cell);
- /*cell added as part of CA dev*/
- node = node->next;
-#ifdef LTEMAC_HDFDD
- if (ue->hdFddEnbld)
- {
- rgSCHCmnHdFddChkUlAllow (cell, ue, &ulAllowed);
- if (ulAllowed == FALSE)
- {
- continue;
- }
- }
-#endif
- if (RG_SCH_CMN_IS_UL_UE_RETX(ue, cell))
- {
- /* UE already scheduled in this subframe (for retx)
- * OR is inactive for UL Transmission.*/
- continue;
- }
- cmnUlUe->alloc.reqBytes = RG_SCH_CMN_MAX_UL_CONTRES_GRNT;
- rgSCHCmnUlAdd2CntResLst(allocInfo, ue);
- --(*remUe);
- /* Node removal deferred to ULAllocFinalization */
- }
-
- return;
-}
-
-/**
- * @brief Scheduler invocation
- *
- * @details
- *
- * Function: rgSCHSc1UlNewTx
- * Purpose: Uplink Scheduling for New Transmissions.
- *
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[out] RgSchCmnUlRbAllocInfo *allocInfo
- * @return Void
- **/
-static Void rgSCHSc1UlNewTx(RgSchCellCb *cell,RgSchCmnUlRbAllocInfo *allocInfo)
-{
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- uint8_t remUe = cellUl->maxUeNewTxPerTti;
-
-
- rgSCHSc1UlSchdForContRes(cell, allocInfo, &remUe);
- rgSCHSc1UlSchdForDataTrans(cell, allocInfo, remUe);
- return;
-}
-
-/**
- * @brief Scheduler invocation
- *
- * @details
- *
- * Function: rgSCHSc1UlSched
- * Purpose: This function implements an UL scheduler for LTE. This is
- * made available as a function pointer to be called
- * at the time of TTI processing by the MAC.
- *
- * Invoked by: Common Scheduler (TTI processing)
- *
- * @param[in] RgSchCellCb *cell
- * @param[out] RgSchCmnUlRbAllocInfo *allocInfo
- * @return Void
- **/
-Void rgSCHSc1UlSched(RgSchCellCb *cell,RgSchCmnUlRbAllocInfo *allocInfo)
-{
- rgSCHSc1UlNewTx(cell, allocInfo);
- return;
-}
-
-/**
- * @brief UEs Buffer Status Has changed so reposition it.
- *
- * @details
- *
- * Function : rgSCHSc1UlInsUeInQ
- *
- * In UE in the list in Descending order of effBsr.
- *
- *
- * @param[in] CmLListCp *lst
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-static Void rgSCHSc1UlInsUeInQ(CmLListCp *lst,RgSchUeCb *ue,RgSchCellCb *cell)
-{
- /*cell added as part of CA dev*/
- RgSchSc1UlUe *ueUl = RG_GET_SC1_UE_UL(ue, cell);
- RgSchUeCb *lUe;
- CmLList *node;
-
-
- node = lst->first;
- while(node)
- {
- lUe = (RgSchUeCb *)(node->node);
- if (lUe->ul.effBsr <= ue->ul.effBsr)
- {
- break;
- }
- node = node->next;
- }
- if (node == NULLP)
- {
- /* We have come to the end of the queue, so Append */
- cmLListAdd2Tail(lst, &ueUl->txLnk);
- ueUl->txLnk.node = (PTR)ue;
- }
- else
- {
- lst->crnt = node;
- cmLListInsCrnt(lst, &ueUl->txLnk);
- ueUl->txLnk.node = (PTR)ue;
- }
-
- return;
-}
-/**
- * @brief UEs Buffer Status Has changed so reposition it.
- *
- * @details
- *
- * Function : rgSCHSc1UlPosnUeInQ
- *
- * -Ues bs value for its LCG has changed, due to either
- * allocation or BSR report OR the effUeBR, i.e the byteRate
- * has changed due to some allocation, so add/reposition/remove
- * it from Qs based on this new bs and/or effUeBR value.
- * -If UE has non-zero lcg0 bs value, but the byteRate is
- * consumed totally, UE is still schedulable for this control data.
- * -If UE's LCG0 has pending bs then position this UE in
- * ueTxLst[0].
- * -If Ue has pending BSR to be satisfied, but lcg0's BS
- * is 0, then position it in ueTxLst[1].
- * -In any of these 2 Qs, insertion is such that UEs are
- * positioned in Descending order of their Pending BS.
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-static Void rgSCHSc1UlPosnUeInQ(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchSc1UlUe *ueUl = RG_GET_SC1_UE_UL(ue, cell);
- /*cell added as part of CA dev*/
- RgSchSc1UlCell *cellUl = RG_GET_SC1_CELL_UL(cell);
- RgSchCmnLcg *cmnLcg0 = RG_SCH_CMN_GET_UL_LCG(&ue->ul.lcgArr[0]);
- CmLListCp *lst;
-
-
- if (!RG_SCH_CMN_UL_IS_UE_ACTIVE(ue))
- {
- return;
- }
-
- /* Remove the UE from its existing position */
- if (ueUl->txLnk.node)
- {
- cmLListDelFrm(&(cellUl->ueTxLst[ueUl->qId]), &(ueUl->txLnk));
- ueUl->txLnk.node = (PTR)NULLP;
- }
- /* If UE has still bs left for scheduling
- * then reposition it */
- if ((ue->ul.effBsr > 0) || (ueUl->srRcvd == TRUE))
- {
- /* Select the Queue where UE would be Placed */
- if (cmnLcg0->bs > 0)
- {
- lst = &cellUl->ueTxLst[0];
- ueUl->qId = 0;
- }
- else
- {
- lst = &cellUl->ueTxLst[1];
- ueUl->qId = 1;
- }
- /* Insert the UE in the Q */
- rgSCHSc1UlInsUeInQ(lst, ue, cell);/*cell added as part of CA dev*/
- }
-#ifdef RGR_V1
- else if(ue->ul.totalBsr != 0)
- {
- if (ue->bsrTmr.tmrEvnt != TMR_NONE)
- {
- rgSCHTmrStopTmr(cell, ue->bsrTmr.tmrEvnt, ue);
- }
- if (ue->ul.bsrTmrCfg.isPrdBsrTmrPres)
- {
- rgSCHTmrStartTmr(cell, ue, RG_SCH_TMR_BSR,
- ue->ul.bsrTmrCfg.prdBsrTmr);
- }
- }
-#endif
-
- return;
-}
-
-/**
- * @brief Short BSR update
- *
- * @details
- *
- * Function : rgSCHSc1UpdBsrShort
- *
- * This functions does requisite updates to handle short BSR reporting
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchLcgCb *lcg
- * @param[in] uint8_t bsr
- * @return Void
- **/
-Void rgSCHSc1UpdBsrShort(RgSchCellCb *cell,RgSchUeCb *ue,RgSchLcgCb *lcg,uint8_t bsr)
-{
- rgSCHSc1UlPosnUeInQ(cell, ue);
- return;
-} /* rgSCHSc1UpdBsrShort */
-
-/**
- * @brief Truncated BSR update
- *
- * @details
- *
- * Function : rgSCHSc1UpdBsrTrunc
- *
- * This functions does required updates to handle truncated BSR report
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchLcgCb *lcg
- * @param[in] uint8_t bsr
- * @return Void
- **/
-Void rgSCHSc1UpdBsrTrunc(RgSchCellCb *cell,RgSchUeCb *ue,RgSchLcgCb *lcg,uint8_t bsr)
-{
- rgSCHSc1UlPosnUeInQ(cell, ue);
- return;
-} /* rgSCHSc1UpdBsrTrunc */
-
-/**
- * @brief Long BSR update
- *
- * @details
- *
- * Function : rgSCHSc1UpdBsrLong
- *
- * - Update UE's position within/across uplink scheduling queues
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t bsArr[]
- * @return Void
- **/
-Void rgSCHSc1UpdBsrLong(RgSchCellCb *cell,RgSchUeCb *ue,uint8_t *bsArr)
-{
- rgSCHSc1UlPosnUeInQ(cell, ue);
- return;
-} /* rgSCHSc1UpdBsrLong */
-
-/**
- * @brief UL grant for contention resolution
- *
- * @details
- *
- * Function : rgSCHSc1ContResUlGrant
- *
- * Add UE to another queue specifically for CRNTI based contention
- * resolution
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-Void rgSCHSc1ContResUlGrant(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchSc1UlUe *ueUl = RG_GET_SC1_UE_UL(ue, cell);
- RgSchSc1UlCell *cellUl = RG_GET_SC1_CELL_UL(cell);
-
-
- if (ueUl->contResLnk.node)
- {
- return;
- }
-
- /* Remove the UE from other Qs */
- if(ueUl->txLnk.node)
- {
- cmLListDelFrm(&(cellUl->ueTxLst[ueUl->qId]), &(ueUl->txLnk));
- ueUl->txLnk.node = NULLP;
- }
-
- cmLListAdd2Tail(&cellUl->contResLst, &ueUl->contResLnk);
- ueUl->contResLnk.node = (PTR)ue;
- return;
-} /* rgSCHSc1ContResUlGrant */
-
-/**
- * @brief SR reception handling
- *
- * @details
- *
- * Function : rgSCHSc1SrRcvd
- * Shift the UE with SrInd in to the lcgO queue.
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-Void rgSCHSc1SrRcvd(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchSc1UlUe *ulUe = RG_GET_SC1_UE_UL(ue, cell);
- RgSchSc1UlCell *ulCell = RG_GET_SC1_CELL_UL(cell);
-
-
- ulUe->srRcvd = TRUE;
-
- if (ulUe->txLnk.node != NULLP)
- {
- if (ulUe->qId == 0)
- {
- /* Already present in lcg0 Q */
- return;
- }
- cmLListDelFrm(&(ulCell->ueTxLst[ulUe->qId]), &(ulUe->txLnk));
- }
- /* Adding the UE to the LCG0 list for SR IND */
- cmLListAdd2Tail(&ulCell->ueTxLst[0], &ulUe->txLnk);
- ulUe->txLnk.node = (PTR)ue;
- ulUe->qId = 0;
-
- return;
-} /* rgSCHSc1SrRcvd */
-
-/**
- * @brief Indication of UL CQI
- *
- * @details
- *
- * Function : rgSCHSc1UlCqiInd
- *
- * - Common Scheduler. SC1 does nothing.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] TfuUlCqiRpt *ulCqiInfo
- * @return Void
- **/
-Void rgSCHSc1UlCqiInd(RgSchCellCb *cell,RgSchUeCb *ue,TfuUlCqiRpt *ulCqiInfo)
-{
-
- /* Stack Crash problem for TRACE5 changes. Added the return below */
- return;
-
-}
-
-/**
- * @brief UL Lcg received data updation
- *
- * @details
- *
- * Function : rgSCHSc1UlLcgUpd
- *
- * Processing Steps:Sc1 Does nothing
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgInfUeDatInd *datInd
- * @return S16
- **/
-S16 rgSCHSc1UlLcgUpd(RgSchCellCb *cell,RgSchUeCb *ue,RgInfUeDatInd *datInd)
-{
-
- return ROK;
-}
-
-\f
-/***********************************************************
- *
- * Func : rgSCHSc1UlUeRefresh
- *
- * Desc : Handle 'refresh' for uplink part of a UE
- * (ie UE's uplink AMBR and uplink GBR LCGs are
- * refreshed at this point)
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHSc1UlUeRefresh(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- rgSCHSc1UlPosnUeInQ(cell, ue);
- return;
-}
-
-/**
- * @brief This function Processes the Final Allocations
- * made by the RB Allocator against the requested
- * UE data Trans Allocations.
- *
- * @details
- *
- * Function: rgSCHSc1UlDatTransAllocFnlz
- * Purpose: This function Processes the Final Allocations
- * made by the RB Allocator against the requested
- * UE data Trans Allocations .
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-static Void rgSCHSc1UlDatTransAllocFnlz(RgSchCellCb *cell,RgSchCmnUlRbAllocInfo *allocInfo)
-{
- RgSchSc1UlUe *ueUl;
- RgSchUeCb *ue;
- CmLList *node;
- RgSchDrxUeCb *drxUe = NULLP;
- CmLListCp ulInactvLst; /* list of UE's becoming UL-inactive */
-
- cmLListInit(&ulInactvLst);
- node = allocInfo->schdUeLst.first;
- while(node)
- {
- ue = (RgSchUeCb *)node->node;
- node = node->next;
- ueUl = RG_GET_SC1_UE_UL(ue, cell);
-
- if (ue->isDrxEnabled)
- {
- if(ueUl->srRcvd == TRUE)
- {
- drxUe = RG_SCH_DRX_GET_UE(ue);
- drxUe->drxUlInactvMask |= RG_SCH_DRX_SR_BITMASK;
-
- if(!RG_SCH_DRX_UL_IS_UE_ACTIVE(drxUe))
- {
- ue->ul.ulInactvMask |= RG_DRX_INACTIVE;
- /* Add to Ul inactive List */
- ue->ulDrxInactvLnk.node = (PTR)ue;
- cmLListAdd2Tail(&ulInactvLst,&(ue->ulDrxInactvLnk));
- }
- drxUe->srRcvd = FALSE;
- }
- }
- /* Reset no matter */
- ueUl->srRcvd = FALSE;
- /* Reposition UE in Qs */
- rgSCHSc1UlPosnUeInQ(cell, ue);
-#ifdef LTEMAC_HDFDD
- if (ue->hdFddEnbld)
- {
- rgSCHCmnHdFddUpdULMark (cell,ue);
- }
-#endif
- /* reset the UE UL allocation Information */
- rgSCHCmnUlUeResetTemp(cell, ue);
- }
- rgSCHSc1UlHndlInActUes(cell, &ulInactvLst);
- node = allocInfo->nonSchdUeLst.first;
- while(node)
- {
- ue = (RgSchUeCb *)node->node;
- node = node->next;
- /* reset the UE UL allocation Information */
- rgSCHCmnUlUeResetTemp(cell, ue);
- }
-
- return;
-}
-
-/**
- * @brief This function Processes the Final Allocations
- * made by the RB Allocator against the requested
- * cont res Allocations.
- *
- * @details
- *
- * Function: rgSCHSc1UlContResAllocFnlz
- * Purpose: This function Processes the Final Allocations
- * made by the RB Allocator against the requested
- * cont res Allocations .
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-static Void rgSCHSc1UlContResAllocFnlz(RgSchCellCb *cell,RgSchCmnUlRbAllocInfo *allocInfo)
-{
- RgSchSc1UlCell *sc1UlCell = RG_GET_SC1_CELL_UL(cell);
- RgSchSc1UlUe *ueUl;
- RgSchUeCb *ue;
- CmLList *node;
-
- node = allocInfo->schdContResLst.first;
- while(node)
- {
- ue = (RgSchUeCb *)node->node;
- node = node->next;
-#ifdef LTEMAC_HDFDD
- if (ue->hdFddEnbld)
- {
- rgSCHCmnHdFddUpdULMark (cell,ue);
- }
-#endif
- ueUl = RG_GET_SC1_UE_UL(ue, cell);
-
- /* Remove UE from Cont Res Q */
- cmLListDelFrm(&sc1UlCell->contResLst,
- &ueUl->contResLnk);
- ueUl->contResLnk.node = NULLP;
- /* reset the UE UL allocation Information */
- rgSCHCmnUlUeResetTemp(cell, ue);
- }
-
- node = allocInfo->nonSchdContResLst.first;
- while(node)
- {
- ue = (RgSchUeCb *)node->node;
- node = node->next;
- /* reset the UE UL allocation Information */
- rgSCHCmnUlUeResetTemp(cell, ue);
- }
-
- return;
-}
-
-/**
- * @brief This function Processes the Final Allocations
- * made by the RB Allocator against the requested.
- *
- * @details
- *
- * Function: rgSCHSc1UlAllocFnlz
- * Purpose: This function Processes the Final Allocations
- * made by the RB Allocator against the requested.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchCmnDlRbAllocInfo *allocInfo
- * @return Void
- *
- **/
-Void rgSCHSc1UlAllocFnlz(RgSchCellCb *cell,RgSchCmnUlRbAllocInfo *allocInfo)
-{
-
- rgSCHSc1UlContResAllocFnlz(cell, allocInfo);
- rgSCHSc1UlDatTransAllocFnlz(cell, allocInfo);
-
- return;
-}
-
-\f
-/**
- * @brief Scheduler invocation
- *
- * @details
- *
- * Function: rgSCHSc1UlActvtUe
- * Purpose: Put back the UE in to appropriate Qs.
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-Void rgSCHSc1UlActvtUe(RgSchCellCb *cell,RgSchUeCb *ue)
-{
-
- rgSCHSc1UlPosnUeInQ(cell, ue);
- return;
-}
-
-/**
- * @brief Scheduler invocation
- *
- * @details
- *
- * Function: rgSCHSc1UlHndlInActUes
- * Purpose: The list of inactive UEs present in inactvLst should
- * be removed from the scheduling Qs.
- * But store the information pertaining to which Qs,
- * were they belonging to. This information shall be used
- * to put them back in appropriate Qs when their Activation
- * is initiated.
- *
- * Invoked by: Common Scheduler (TTI processing)
- *
- * @param[in] RgSchCellCb *cell
- * @param[out] CmLListCp *inactvLst
- * @return Void
- **/
-Void rgSCHSc1UlHndlInActUes(RgSchCellCb *cell,CmLListCp *inactvLst)
-{
- RgSchUeCb *ue;
- RgSchSc1UlUe *ulUe;
- RgSchSc1UlCell *cellUl = RG_GET_SC1_CELL_UL(cell);
- CmLList *node = inactvLst->first;
-
- while (node)
- {
- ue = (RgSchUeCb *)node->node;
- node = node->next;
- ulUe = RG_GET_SC1_UE_UL(ue, cell);
- if(ulUe->txLnk.node)
- {
- cmLListDelFrm(&(cellUl->ueTxLst[ulUe->qId]), &(ulUe->txLnk));
- /* This is required as lcg bs might change during
- * inactivity to activity. So we need to recompute
- * its position. */
- ulUe->txLnk.node = NULLP;
- }
- /* Do not remove UE from contResLst */
- }
- return;
-}
-/**
- * @brief Scheduler invocation
- *
- * @details
- *
- * Function: rgSCHSc1DlProcRmvFrmRetx
- * Purpose: To remove the Harq process from the cell and from the UE
- * retransmission list
- *
- * Invoked by: Common Scheduler (TTI processing)
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue;
- * @param[in] RgSchDlHqProcCb *hqP
- * @return Void
- **/
-
-Void rgSCHSc1DlProcRmvFrmRetx(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlHqProcCb *hqP
-)
-{
-
- /* Remove the HqP from retx Queue.
- Release HqP.*/
- rgSCHSc1DlProcRmvFrmCellRetx(cell, hqP);
- rgSCHSc1DlProcRmvFrmUeRetx(cell, ue, hqP);
- return;
-}
-
-
-
-\f
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/**********************************************************************
- Name: LTE MAC SC1 scheduler
-
- Type: C header file
-
- Desc: Defines required by SC1 scheduler
-
- File: rg_sch_sc1.h
-
-*********************************************************************21*/
-
-\f
-#ifndef __RGSCHSC1H__
-#define __RGSCHSC1H__
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/***********************************************************************
- Macro Definitions
- ***********************************************************************/
-
-/* Scheduler1 tunable params */
-
-#define RG_GET_SC1_CELL_UL(cell) \
- ((RgSchSc1UlCell *)((RgSchCmnCell*)((cell)->sc.sch))->ul.schSpfc)
-#define RG_GET_SC1_CELL_DL(cell) \
- ((RgSchSc1DlCell *)((RgSchCmnCell*)((cell)->sc.sch))->dl.schSpfc)
-
-#define RG_GET_SC1_UE_DL(ue, cell) \
- ((RgSchSc1DlUe *)((RgSchCmnUe *)((ue->cellInfo[ue->cellIdToCellIdxMap\
- [RG_SCH_CELLINDEX(cell)]])->sch))->dl.schSpfc)
-#define RG_GET_SC1_UE_UL(ue, cell) \
- ((RgSchSc1UlUe *)((RgSchCmnUe *)((ue->cellInfo[ue->cellIdToCellIdxMap\
- [RG_SCH_CELLINDEX(cell)]])->sch))->ul.schSpfc)
-
-#define RG_GET_SC1_SVC_DL(_ue,_svc,_cell) RG_SCH_CMN_GET_LC_SCH_SPFC(_ue,_svc,_cell)
-
-#define RG_GET_SC1_HQP_DL(hqP) \
- ((RgSchSc1DlHqProc *)((RgSchCmnDlHqProc *)((hqP)->sch))->schSpfc)
-
-#define RG_SC1_SVC_HAS_DATA(_svc,_cell) \
- (((RgSchSc1DlSvc *)(((RgSchCmnDlSvc *)(_svc->sch))->schSpfc[\
- svc->ue->cellIdToCellIdxMap[RG_SCH_CELLINDEX(_cell)]]))->effMbr != 0)
-
-
-#define RG_SC1_ISGBRPRIO(qciPrio) ((qciPrio) >=2 && (qciPrio) <= 5)
-
-/* SC1 configuration error types */
-#define RGSCHERR_SCH_SC1_DL_CFG (RGSCHERR_SCH_CFG + 10)
-#define RGSCHERR_SCH_SC1_UL_CFG (RGSCHERR_SCH_CFG + 11)
-
-/* Scheduler1 fixed params */
-#define RG_SC1_UL_INVALID_QID 255
-#define RG_SC1_QCIPRIOVAL_MAX 9
-#define RG_SC1_QCIPRIOVAL_MIN 1
-#define RG_SC1_UL_CONT_RES_QID 0
-#define RG_SC1_MAX_DL_AMBR 0xffffffff
-#define RG_SC1_UL_NUM_Q (RG_SCH_CMN_NUM_QCI + 1)
-#define RG_SC1_DL_NUM_Q (RG_SCH_CMN_MAX_PRIO + 1)
-#ifdef RG_UNUSED
-#define RG_SC1_UL_INVALID_BETA8 0xffff
-#endif
-#define RG_SCH_SC1_DL_GBR_PRIO_START 1
-#define RG_SCH_SC1_DL_GBR_PRIO_END 4
-#define RG_SCH_SC1_DL_PRIOS RG_SCH_CMN_MAX_PRIO + 1
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __RGSCHSC1H__ */
-
-/********************************************************************30**
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/**********************************************************************
-
- Name: LTE MAC SC1 scheduler
-
- Type: C include file
-
- Desc: Defines required by SC1 scheduler
-
- File: rg_sch_sc1.x
-
-**********************************************************************/
-/** @file rg_sch_sc1.x
-@brief This file contains data structures for the SC1 scheduler.
-*/
-
-#ifndef __RGSCHSC1X__
-#define __RGSCHSC1X__
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-typedef Void (*RgSchSc1SvcMngFunc) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchDlLcCb *svc));
-
-/**
- * @brief
- * Cell specific downlink scheduling information for Scheduler type 1.
- */
-typedef struct rgSc1DlCell
-{
- CmLListCp prioLst[RG_SC1_DL_NUM_Q]; /*!< Priority queues */
- CmLListCp retxLst[RG_SC1_DL_NUM_Q]; /*!< Retransmission queues */
- RgSchSc1SvcMngFunc svcMngFunc[RG_SC1_DL_NUM_Q]; /*!< Function for managing
- services */
-} RgSchSc1DlCell;
-
-/**
- * @brief
- * Cell specific uplink scheduling information for Scheduler type 1.
- */
-typedef struct rgSc1UlCell
-{
- CmLListCp contResLst;/*!< UEs with pending UL alloc for msg4 */
- CmLListCp ueTxLst[2];/*!< Queue for UEs Ded Data Trans
- * ueTxLst[0] for signalling and
- * ueTxLst[1] for other data */
-} RgSchSc1UlCell;
-
-/**
- * @brief
- * Uplink information for scheduler per UE.
- */
-typedef struct rgSc1UlUe
-{
- CmLList txLnk; /* Lnk to one of Transmission Queues */
- CmLList contResLnk; /* Lnk to one of Cont Res Queue */
- Bool srRcvd; /* TRUE if SR reported is yet to be satisfied */
- uint8_t qId; /* Id of the Tx Q to which this UE belongs */
-} RgSchSc1UlUe;
-
-/**
- * @brief
- * Downlink information for scheduler per UE.
- */
-typedef struct rgSc1DlUe
-{
- CmLList prioLnk; /*!< To link UE into priority queues */
- CmLListCp gbrSvcs; /*!< List of GBR services */
- uint8_t prio; /*!< Current priority of UE for DL */
- CmLListCp ambrLst; /*!< To maintain services per priority for a UE */
- RgSchDlLcCb *ambrSvc;/*!< Points to the current AMBR service */
- uint32_t ambr; /*!< UE's Remaining AMBR */
- uint32_t effAmbr; /*!< min(svc->bo, ambr)*/
- CmLListCp schdSvcs; /*!< List of services for which
- allocation requested */
- uint8_t taReqBytes;/*!< Set to the Number of bytes Requested for TA
- allocation */
- CmLListCp retxHqProcs; /*!< List of RETX Hq Procs in suspension */
- CmLListCp lcsWithData; /*!< List of services with non-zero effBo */
-} RgSchSc1DlUe;
-
-/**
- * @brief
- * Downlink HARQ information for SC1 scheduler per UE.
- */
-typedef struct rgSc1DlHqProc {
- CmLList retxLnkUe; /*!< To link retransmitting HARQ processes in ue */
- uint8_t cqi; /*!< CQI at which the allocation was made */
- uint8_t prio; /*!< Priority of the allocation */
-}RgSchSc1DlHqProc;
-
-/**
- * @brief
- * Downlink service information for SC1 scheduler per UE.
- */
-typedef struct rgSc1DlSvc {
- uint32_t gbr; /*!< Pending GBR to be satisfied */
- uint32_t mbr; /*!< Pending MBR to be satisfied */
- uint32_t bo; /*!< BO yet to be satisfied */
- uint32_t effGbr; /*!< GBR/BO, lower of the two */
- uint32_t effMbr; /*!< MBR/BO, lower of the two */
- CmLList gbrLnk; /*!< used to maintain svcs to be refreshed */
- CmLList prioLnk; /*!< Used to queue up services on UE */
- CmLList schdSvcLnk; /*!< Used to queue up services on UE
- * scheduled svcs list */
- uint32_t reqBytes; /*!< Set to number of bytes Req for Allocation */
- uint16_t hdrEstimate; /*!< RLC Hdr est computed during SVC allocn */
- CmLList lcWithDataLnk;/*!< Used to maintain svc in ue's
- * lcsWithData List */
-} RgSchSc1DlSvc;
-
-
-Void rgSCHSc1DlLcRmv ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *svc
-));
-Void rgSCHSc1DlLcBoUpd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *svc
-));
-Void rgSCHSc1DlProcAddToCellRetx ARGS((
-RgSchCellCb *cell,
-RgSchDlHqProcCb *hqP
-));
-Void rgSCHSc1DlAllocFnlz ARGS((
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *allocInfo
-));
-Void rgSCHSc1UlAllocFnlz ARGS((
-RgSchCellCb *cell,
-RgSchCmnUlRbAllocInfo *allocInfo
-));
-Void rgSCHSc1UlCqiInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-TfuUlCqiRpt *ulCqiInfo
-));
-S16 rgSCHSc1UlLcgUpd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgInfUeDatInd *datInd
-));
-
-Void rgSCHSc1DlCqiInd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-Bool isPucchInfo,
-Void *dlCqi
-));
-Void rgSCHSc1UlUeRefresh ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-Void rgSCHSc1UlUeReset ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-Void rgSCHSc1DlUeRefresh ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-Void rgSCHSc1DlHndlInActUes ARGS((
-RgSchCellCb *cell,
-CmLListCp *inactvLst
-));
-Void rgSCHSc1UlHndlInActUes ARGS((
-RgSchCellCb *cell,
-CmLListCp *inactvLst
-));
-Void rgSCHSc1UlActvtUe ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-Void rgSCHSc1DlActvtUe ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-Void rgSCHSc1DlInit ARGS((
-RgDlSchdApis *apis
-));
-Void rgSCHSc1UlInit ARGS((
-RgUlSchdApis *apis
-));
-S16 rgSCHSc1RgrUlCellCfg ARGS((
-RgSchCellCb *cell,
-RgrCellCfg *cellCfg,
-RgSchErrInfo *err
-));
-S16 rgSCHSc1RgrDlCellCfg ARGS((
-RgSchCellCb *cell,
-RgrCellCfg *cellCfg,
-RgSchErrInfo *err
-));
-Void rgSCHSc1UlCellDel ARGS((
-RgSchCellCb *cell
-));
-Void rgSCHSc1DlCellDel ARGS((
-RgSchCellCb *cell
-));
-S16 rgSCHSc1RgrUlUeCfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeCfg *ueCfg,
-RgSchErrInfo *err
-));
-S16 rgSCHSc1RgrDlUeCfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeCfg *ueCfg,
-RgSchErrInfo *err
-));
-S16 rgSCHSc1RgrUlUeRecfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeRecfg *ueRecfg,
-RgSchErrInfo *err
-));
-S16 rgSCHSc1RgrDlUeRecfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrUeRecfg *ueRecfg,
-RgSchErrInfo *err
-));
-Void rgSCHSc1UlUeDel ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-Void rgSCHSc1DlUeDel ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-S16 rgSCHSc1RgrLcCfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *dlLc,
-RgrLchCfg *lcCfg,
-RgSchErrInfo *err
-));
-S16 rgSCHSc1RgrLcgCfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchLcgCb *lcg,
-RgrLcgCfg *lcgCfg,
-RgSchErrInfo *err
-));
-S16 rgSCHSc1RgrLcRecfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchDlLcCb *dlLc,
-RgrLchRecfg *lcRecfg,
-RgSchErrInfo *err
-));
-S16 rgSCHSc1RgrLcgRecfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchLcgCb *lcg,
-RgrLcgRecfg *reCfg,
-RgSchErrInfo *err
-));
-Void rgSCHSc1LcgDel ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchLcgCb *lcg
-));
-Void rgSCHSc1UpdBsrShort ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchLcgCb *lcg,
-uint8_t bsr
-));
-Void rgSCHSc1UpdBsrTrunc ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchLcgCb *lcg,
-uint8_t bsr
-));
-Void rgSCHSc1UpdBsrLong ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint8_t bsArr[]
-));
-Void rgSCHSc1ContResUlGrant ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-Void rgSCHSc1SrRcvd ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-Void rgSCHSc1UlSched ARGS((
-RgSchCellCb *cell,
-RgSchCmnUlRbAllocInfo *allocInfo
-));
-Void rgSCHSc1DlSched ARGS((
-RgSchCellCb *cell,
-RgSchCmnDlRbAllocInfo *allocInfo
-));
-S16 rgSCHSc1RgrUlCellRecfg ARGS((
-RgSchCellCb *cell,
-RgrCellRecfg *recfg,
-RgSchErrInfo *err
-));
-Void rgSCHSc1DlUeReset ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-
-S16 rgSCHSc1DlUeHqEntInit ARGS((
-RgSchCellCb *cell,
-RgSchDlHqEnt *hqEnt
-));
-
-S16 rgSCHSc1DlUeHqEntDeInit ARGS((
-RgSchCellCb *cell,
-RgSchDlHqEnt *hqE
-));
-
-S16 rgSCHSc1UlLchCfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrLchCfg *cfg,
-RgSchErrInfo *err
-));
-
-S16 rgSCHSc1UlLchRecfg ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgrLchRecfg *recfg,
-RgSchErrInfo *err
-));
-
-S16 rgSCHSc1UlLchDel ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-CmLteLcId lcId,
-uint8_t lcgId
-));
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* __RGSCHSC1X__ */
-
-\f
-/**********************************************************************
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Round Robin functions
-
- File: rg_sch_scell.c
-
-**********************************************************************/
-
-/** @file rg_sch_rr.c
-@brief This module handles the round robin scheduler functionality
-*/
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "lrg.h"
-#include "rgr.h"
-#include "rgm.h"
-#include "tfu.h"
-#include "rg_env.h"
-#include "rg_sch_inf.h"
-#include "rg_sch_err.h"
-#include "rg_sch.h"
-#include "rg_sch_cmn.h"
-
-/* header/extern include files (.x) */
-#include "tfu.x" /* RGU types */
-#include "lrg.x" /* layer management typedefs for MAC */
-#include "rgr.x" /* layer management typedefs for MAC */
-#include "rgm.x" /* layer management typedefs for MAC */
-#include "rg_sch_inf.x" /* typedefs for Scheduler */
-#include "rg_sch.x" /* typedefs for Scheduler */
-#include "rg_sch_cmn.x"
-
-#ifdef LTE_ADV
-
-Void rgSCHSCellActivation ARGS((
-RgSchUeCellInfo *sCell
-));
-
-Void rgSCHSCellSchdActDeactCe ARGS((
-RgSchUeCb *ueCb,
-RgSchDlHqTbCb *tbInfo
-));
-Void rgSCHSCellAddToActDeactLst ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-
-Void rgSCHSCellRmvFrmActLst ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-S16 rgSCHSCellIsActive ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-
-Void rgSCHSCellHndlFdbkInd ARGS((
-RgSchDlHqProcCb *hqP,
-uint8_t tbIdx,
-uint8_t fdbk,
-Bool maxHqRetxReached
-));
-
-#ifdef LTE_ADV
-Void rgSCHSCellDeactTmrExpry ARGS((
-RgSchUeCellInfo *sCell
-));
-#endif
-
-Void rgSCHSCellDelUeSCell ARGS((
-RgSchCellCb *cellCb,
-RgSchUeCb *ueCb,
-uint8_t sCellIdx
-));
-
-S16 rgSCHSCellDelUe ARGS((
-RgSchCellCb *cellCb,
-RgSchUeCb *ueCb
-));
-#ifdef TFU_UPGRADE
-S16 rgSCHSCellPCqiCfg ARGS((
-RgSchCellCb *priCellCb,
-RgSchCellCb *secCellCb,
-RgSchUeCb *ueCb,
-RgrUePrdDlCqiCfg *cqiCfg,
-CmLteUeCategory ueCat,
-uint8_t sCellIdx
-));
-#endif
-static S16 rgSCHSCellTrgMacHqEReset ARGS((
-Inst inst,
-uint16_t secCellId,
-uint16_t rnti
-));
-
-
-
-/** * @brief Handler for scheduling Scell Activation CE.
- *
- * @details
- *
- * Function : rgSCHDhmShcdSCellActCe
- *
- * This function is called by scheduler when resource allocation
- * for SCell Activation CE transmission is done.
- *
- * @param[in] RgSchUeCb *ue
- * @param[out] RgSchDlHqTbCb *tbInfo
- * @return Void
- * -# None.
- **/
-Void rgSCHSCellSchdActDeactCe(RgSchUeCb *ueCb,RgSchDlHqTbCb *tbInfo)
-{
-
- uint8_t bitVal = 0;
- uint8_t sCellActDeactBitMask = 0;
-
- /* Change the state of all Scells waiting for
- * activation */
-
- /* -------------------------
- * | C7|C6|C5|C4|C3|C2|C1|R|
- * -------------------------*/
- /* 1 for activation
- * 0 for deactivation
- * */
-
- for(uint8_t idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
- {
- if(ueCb->cellInfo[idx] != NULLP)
- {
- switch(ueCb->cellInfo[idx]->sCellState)
- {
- case RG_SCH_SCELL_TOBE_ACTIVATED:
- case RG_SCH_SCELL_ACTVTN_IN_PROG:
- {
- ueCb->cellInfo[idx]->sCellState = RG_SCH_SCELL_ACTVTN_IN_PROG;
- bitVal = 1;
- }
- break;
- case RG_SCH_SCELL_ACTIVE:
- {
- bitVal = 1;
- }
- break;
- case RG_SCH_SCELL_TOBE_DEACTIVATED:
- case RG_SCH_SCELL_DEACTVTN_IN_PROG:
- {
- ueCb->cellInfo[idx]->sCellState = RG_SCH_SCELL_DEACTVTN_IN_PROG;
- bitVal = 0;
- }
- break;
- case RG_SCH_SCELL_INACTIVE:
- case RG_SCH_SCELL_READY:
- {
- bitVal = 0;
- }
- break;
- }
- }
- if(1 == bitVal)
- {
- sCellActDeactBitMask |= 1 << (idx);/* servCellIdx = idx + 1 */
- bitVal = 0;
- }
- }
- tbInfo->schdSCellActCe.pres = PRSNT_NODEF;
- tbInfo->schdSCellActCe.val = sCellActDeactBitMask;
-
- return;
-} /* rgSCHSCellSchdActDeactCe */
-
-\f
-/**
- * @brief Adds an UE to the Cell's SCell Activation list
- *
- * @details
- *
- * Function: rgSCHSCellAddToActDeactLst
- * Purpose: Adds an UE to Cell's SCEll Act list
- *
- * Invoked by: Common Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @return Void
- *
- **/
-Void rgSCHSCellAddToActDeactLst(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnDlCell *cellCmnDl = RG_SCH_CMN_GET_DL_CELL(cell);
-
- if(NULLP == ue->sCellActLnk.node)
- {/* Ue is not present in the list */
- cmLListAdd2Tail(&cellCmnDl->secCellActCeLst, &ue->sCellActLnk);
- ue->sCellActLnk.node = (PTR)ue;
- }
- else
- {
- DU_LOG("\nINFO --> SCH : SCell is already added in the Act List: ueId(%u)\n", ue->ueId);
- }
-
- return;
-}
-
-\f
-/**
- * @brief Removes an UE from Cell's SCell Activation list
- *
- * @details
- *
- * Function: rgSCHSCellRmvFrmActLst
- * Purpose: Removes an UE from Cell's SCEll Act list
- *
- * Invoked by: Specific Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @return Void
- *
- **/
-Void rgSCHSCellRmvFrmActLst(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnDlCell *cellCmnDl = RG_SCH_CMN_GET_DL_CELL(cell);
- if (NULLP != ue->sCellActLnk.node)
- {
- cmLListDelFrm(&cellCmnDl->secCellActCeLst, &ue->sCellActLnk);
- }
- ue->sCellActLnk.node = (PTR)NULLP;
-
- return;
-}
-\f
-/**
- * @brief Handling of SCell Activation
- *
- * @details
- *
- * Function: rgSCHSCellActivation
- * Purpose : Perform Activation of secondary cell
- * : Move the state to ACTIVE
- * : Start the procedure for PCQI/SRS for this scell
- *
- * Invoked by:Cfg/Commn Scheduler
- *
- * @param[in] RgSchUeCellInfo *sCellInfo
- *
- * @return ROK/RFAILED
- *
- **/
-Void rgSCHSCellActivation(RgSchUeCellInfo *sCellInfo)
-{
- RgSchCellCb *sCell = sCellInfo->cell;
- RgSchUeCb *ueCb = sCellInfo->ue;
- RgSchCmnCell *cellSch;
-#ifdef TFU_UPGRADE
-#ifdef DEBUGP
- Inst inst = ueCb->cell->instIdx;
-#endif
- uint16_t tempIdx;
- RgrUePrdDlCqiCfg *cqiCfg;
- uint8_t j; /*Bandwidth Parts*/
- uint16_t riTrInsTime;
- uint16_t periodicity;
- uint16_t cqiTrInstTime;
- RgSchUePCqiCb *cqiCb = NULLP;
- CmLteTimingInfo timingInfo;
- uint16_t crntTime;
-#endif
-
-
- sCellInfo->sCellState = RG_SCH_SCELL_ACTIVE;
-#ifdef TENB_STATS
- ueCb->tenbStats->stats.persistent.numActivation++;
-#endif
-
-#ifdef CA_DBG
- DU_LOG("\nDEBUG --> SCH : ueId is SCELL_ACTIVE\n ueCb->ueId = %d sCell->sCellIdx =%d,\
- sCell->sCellId=%d, sCell->sCellState=%d \n", ueCb->ueId, sCellInfo->sCellIdx, sCellInfo->sCellId, sCellInfo->sCellState);
-#endif
- /* Start the sCellDeactivation timer if cfgd */
- if(PRSNT_NODEF == ueCb->sCellDeactTmrVal.pres)
- {
- //rgSCHTmrStartTmr (sCell,sCellInfo ,RG_SCH_TMR_SCELL_DEACT,
- // ueCb->sCellDeactTmrVal.val);
- }
-
-#ifdef TFU_UPGRADE
- /* Start receiving CQI for this SCell for this UE */
- crntTime = (ueCb->cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)+
- (ueCb->cell->crntTime.slot);
-
- cqiCb = &sCellInfo->cqiCb;
- cqiCfg = &cqiCb->cqiCfg;
- if (cqiCfg->type == RGR_SCH_PCQI_SETUP)
- {
- cqiTrInstTime = ((cqiCb->cqiPeri+crntTime) - cqiCb->cqiOffset)
- %cqiCb->cqiPeri;
- cqiCb->nCqiTrIdx = (crntTime +
- (cqiCb->cqiPeri - cqiTrInstTime));
- /* Introduced timing delta for reception req
- * in FDD*/
- if(cqiCb->nCqiTrIdx <= (crntTime + TFU_RECPREQ_DLDELTA))
- {
- cqiCb->nCqiTrIdx = cqiCb->nCqiTrIdx + cqiCb->cqiPeri;
- }
-
- timingInfo.sfn = cqiCb->nCqiTrIdx/RGSCH_NUM_SUB_FRAMES_5G;
- timingInfo.slot = cqiCb->nCqiTrIdx%RGSCH_NUM_SUB_FRAMES_5G;
- if(cqiCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_SB_REP)
- {
- rgSCHTomUtlPcqiSbCalcBpIdx(timingInfo,ueCb,cqiCb);
- }
-
- cqiCb->nCqiTrIdx = cqiCb->nCqiTrIdx
- %RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
- DU_LOG("\nINFO --> SCH : CQI Config: idx(%u) Periodicity %u"
- "Offset %u uePosInQ (%u)\n", cqiCfg->cqiSetup.cqiPCfgIdx,
- cqiCb->cqiPeri, cqiCb->cqiOffset,cqiCb->nCqiTrIdx);
-
- cmLListAdd2Tail(&ueCb->cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst,
- &cqiCb->cqiLstEnt);
-
- rgSCHUtlSCellHndlCqiCollsn(cqiCb);
-
- DU_LOG("\nINFO --> SCH : rgSCHCfgPCqiUeCfg():"
- " CrntTime=%d Next CqiTrInstTime=%d Index Stored at=%d ",
- crntTime, cqiTrInstTime, cqiCb->nCqiTrIdx);
-
- if(cqiCfg->cqiSetup.riEna)
- {
- cqiCb->perRiVal = 1;
- cqiCb->invalidateCqi = FALSE;
-
- if(RGR_UE_PCQI_WB_REP == cqiCfg->cqiSetup.cqiRepType)
- {
- /*
- 1. wideband RI reporting is configured
- (Mode 1-0 or 1-1)
- (10*sfn+floor(subframe)-Noffsetcqi-NoffsetRI )Mod(NCqiperiod
- *MriPeriod)=0
- */
- periodicity = cqiCb->cqiPeri * cqiCb->riPeri;
- }
- else
- {
- /*
- * Where Widesband and Subband RI reporting is configured
- * (Mode 2-0 or 2-1 )
- * (10*sfn+floor(subframe)-Noffsetcqi-NoffsetRI )
- * Mod(H. NCqiperiod *MriPeriod )=0
- * where H= J * K +1; J=Number of bandwidth parts(BW/subsize).
- * K is RGR interf input
- */
-
- RG_SCH_GET_CQI_J_VAL(sCell->bwCfg.dlTotalBw, j);
- cqiCb->h = (cqiCb->cqiCfg.cqiSetup.k *j )+1;
- periodicity = cqiCb->h * cqiCb->cqiPeri *
- cqiCb->riPeri;
-
- }
-
- /* In case of SFN wraparound, the SB CQI reporting cycle breaks
- * and RI->WB CQI->SBCQI.. should resume. RI is repositioned
- * accordingly. WBCQI handling is naturally accomplished */
- if (periodicity >= RGSCH_MAX_SUBFRM_5G)
- {
- periodicity = cqiCb->cqiOffset - cqiCb->riOffset +
- RGSCH_MAX_SUBFRM_5G - (crntTime);
- tempIdx = crntTime + periodicity;
- }
- else
- {
- riTrInsTime = ((periodicity +crntTime )- \
- cqiCb->cqiOffset + cqiCb->riOffset)\
- % periodicity;
- tempIdx = (crntTime + (periodicity -riTrInsTime));
- }
- if (tempIdx <= (crntTime + TFU_RECPREQ_DLDELTA))
- {
- tempIdx = tempIdx + periodicity;
- }
- cqiCb->nRiTrIdx = tempIdx
- % RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
- if(periodicity >= RG_SCH_PCQI_SRS_SR_TRINS_SIZE)
- {
- cqiCb->riDist = rgSCHUtlFindDist((uint16_t)(crntTime + TFU_RECPREQ_DLDELTA),
- (uint16_t) tempIdx);
- }
- else
- {
- cqiCb->riDist =0;
- }
-
-
- /* Start receiving RI for this SCell for this UE */
- cmLListAdd2Tail(&ueCb->cell->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst,
- &cqiCb->riLstEnt);
- RG_SCH_RECORD(&cqiCb->histElem,RGSCH_ACTION_ADD,
- &ueCb->cell->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst);
-
- rgSCHUtlSCellHndlRiCollsn(cqiCb);
- /*werror*/
-#ifndef BIT_64
- DU_LOG("\nINFO --> SCH : SCel RI cfg:"
- "idx %u period %u Offset %u posInQ(%u) riDist(%u)lst count"
- "%lu\n", cqiCfg->cqiSetup.riCfgIdx, cqiCb->riPeri,
- cqiCb->riOffset, cqiCb->nRiTrIdx, cqiCb->riDist,
- ueCb->cell->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst.count);
-#else
- DU_LOG("\nINFO --> SCH : SCel RI cfg:"
- "idx %u period %u Offset %u posInQ(%u) riDist(%u)lst count"
- "%u\n", cqiCfg->cqiSetup.riCfgIdx, cqiCb->riPeri,
- cqiCb->riOffset, cqiCb->nRiTrIdx, cqiCb->riDist,
- ueCb->cell->pCqiSrsSrLst[cqiCb->nRiTrIdx].riLst.count);
-
-
-#endif
-
- DU_LOG("\nINFO --> SCH : \n rgSCHSCellActivation(): CrntTime=%d Next RiTrInstTime=%d"
- "Index Stored at=%d riDis=%d ",
- crntTime, riTrInsTime, cqiCb->nRiTrIdx, cqiCb->riDist);
- }
- }
-#endif
-
- cellSch = RG_SCH_CMN_GET_CELL(sCellInfo->cell);
- cellSch->apisDl->rgSCHDlSCellActv(sCellInfo->cell, sCellInfo->ue);
-
- return;
-}
-
-#ifdef TFU_UPGRADE
-\f
-/**
- * @brief Remove CQI from Scell Lst
- *
- * @details
- *
- * Function: rgSCHCellClearScellLstOfCQI
- * Purpose : Remove CQI from Scell Lst
- *
- *
- * Invoked by: Timer
- *
- * @param[in] RgSchUeCellInfo *sCellInfo
- * @return Void
- *
- **/
-static Void rgSCHCellClearScellLstOfCQI(RgSchUeCellInfo *sCellInfo)
-{
-
- RgSchUePCqiCb *cqiRiCb = NULLP;
- RgSchUeCb *ueCb;
- ueCb = sCellInfo->ue;
- /* Clear CQI/RI entry for this SCELL */
- cqiRiCb = &sCellInfo->cqiCb;
- /* Delete Periodic CQI/PMI Transmission Instance */
- if (cqiRiCb->nCqiTrIdx != RG_SCH_INVALID_IDX)
- {
- cmLListDelFrm(&ueCb->cell->pCqiSrsSrLst[cqiRiCb->nCqiTrIdx].cqiLst,
- &cqiRiCb->cqiLstEnt);
- cqiRiCb->nCqiTrIdx = RG_SCH_INVALID_IDX;
-
- if (ueCb->nPCqiCb == cqiRiCb)
- {
- rgSCHUtlSCellHndlCqiCollsn(&ueCb->cellInfo[RGSCH_PCELL_INDEX]->cqiCb);
- }
- /* Delete Periodic RI Transmission Instance */
-
- if (cqiRiCb->nRiTrIdx != RG_SCH_INVALID_IDX)
- {
- cmLListDelFrm(&ueCb->cell->pCqiSrsSrLst[cqiRiCb->nRiTrIdx].riLst,
- &cqiRiCb->riLstEnt);
- RG_SCH_RECORD(&cqiRiCb->histElem,RGSCH_ACTION_DEL,
- &ueCb->cell->pCqiSrsSrLst[cqiRiCb->nRiTrIdx].riLst);
- cqiRiCb->nRiTrIdx = RG_SCH_INVALID_IDX;
- if (ueCb->nPRiCb == cqiRiCb)
- {
- rgSCHUtlSCellHndlRiCollsn(&ueCb->cellInfo[RGSCH_PCELL_INDEX]->cqiCb);
- }
- }
- }
-
- return;
-}
-#endif/*TFU_UPGRADE*/
-\f
-/**
- * @brief Handling of SCell DeActivation
- *
- * @details
- *
- * Function: rgSCHSCellDeActivation
- * Purpose : Perform Deactivation of secondary cell
- * : Move the state to IN_ACTIVE
- * : Flush the harqEntity
- * : Trigger harqEntity flushing to MAC
- * : Remove PCQI/SRS for this scell
- * : Stop Deactivation timer if running
- *
- * Invoked by:Cfg/Commn Scheduler
- *
- * @param[in] RgSchUeCellInfo *sCellInfo
- *
- * @return ROK/RFAILED
- *
- **/
-static S16 rgSCHSCellDeActivation(RgSchUeCellInfo *sCellInfo)
-{
- return ROK;
- RgSchCmnCell *cellSch;
- Inst inst = sCellInfo->cell->instIdx;
-
- /* Stop the timer if running */
-
- if(sCellInfo->deactTmr.tmrEvnt != TMR_NONE)
- {
- rgSCHTmrStopTmr(sCellInfo->cell, RG_SCH_TMR_SCELL_DEACT, sCellInfo);
- }
-
- if (sCellInfo->actDelayTmr.tmrEvnt != TMR_NONE)
- {
- rgSCHTmrStopTmr(sCellInfo->cell, RG_SCH_TMR_SCELL_ACT_DELAY, sCellInfo);
- }
-
- cellSch = RG_SCH_CMN_GET_CELL(sCellInfo->cell);
- cellSch->apisDl->rgSCHDlUeReset(sCellInfo->cell, sCellInfo->ue);
-
- if(sCellInfo->ue->isDrxEnabled)
- {
- rgSCHDrxUeHqReset(sCellInfo->ue->cell, sCellInfo->ue,
- sCellInfo->hqEnt, sCellInfo->sCellIdx);
- }
-
- /* Flush the harqEntity at scheduler */
- if(sCellInfo->hqEnt != NULLP)
- {
- rgSCHDhmHqEntReset(sCellInfo->hqEnt);
- }
- /* Trigger harq flush req to MAC */
-
-
- rgSCHSCellTrgMacHqEReset(inst,sCellInfo->sCellId,sCellInfo->ue->ueId);
-
- sCellInfo->sCellState = RG_SCH_SCELL_READY;
-#ifdef TFU_UPGRADE
- rgSCHCellClearScellLstOfCQI(sCellInfo);
-#endif
-
-#ifdef TENB_STATS
- sCellInfo->ue->tenbStats->stats.persistent.numDeactivation++;
-#endif
-
- cellSch->apisDl->rgSCHDlSCellDeactv(sCellInfo->cell, sCellInfo->ue);
-
-#ifdef CA_DBG
- DU_LOG("\nDEBUG --> SCH : SCELL DEATIVATED sCellInfo->ue->ueId =%d, sCellInfo->sCellId =%d\n",\
- sCellInfo->ue->ueId, sCellInfo->sCellId);
- //MSPD_DBG("SCELL DEATIVATED sCellInfo->ue->ueId =%d, sCellInfo->sCellId =%d\n", sCellInfo->ue->ueId, sCellInfo->sCellId);
-#endif
- return ROK;
-}
-
-\f
-/**
- * @brief Triggering hqEntity reset to mac
- *
- * @details
- *
- * Function: rgSCHSCellTrgMacHqEReset
- * Purpose: Frame the interface for mac to reset
- * the mac
- * Derive the macInstance corresponding
- * to the secondary cell going to be deactivated.
- * Triiger the msg to that macInstance
- *
- * Invoked by: CommonScheduler
- *
- * @param[in] uint16_t sCellId
- * @param[in] uint16_t rnti
- * @return Void
- *
- **/
-static S16 rgSCHSCellTrgMacHqEReset(Inst inst,uint16_t secCellId,uint16_ rnti)
-{
- Pst pst;
- RgSchCellCb *secCellCb = NULLP;
- RgInfResetHqEnt hqEntRstInfo;
-
- if((secCellCb = (RgSchCellCb *)rgSchUtlGetCellCb(inst, secCellId)) == NULLP)
- {
- DU_LOG("\nERROR --> SCH : SCell doesnt exists");
- return RFAILED;
- }
-
- hqEntRstInfo.cellId = secCellId;
- hqEntRstInfo.crnti = rnti;
-
- rgSCHUtlGetPstToLyr(&pst, &rgSchCb[inst], secCellCb->macInst);
-
- RgSchMacRstHqEnt(&pst, &hqEntRstInfo);
-
- return ROK;
-}
-/*removed endif*/
-
-
-\f
-/**
- * @brief Handling of harq feeback for SCell act CE txion
- *
- * @details
- *
- * Function: rgSCHSCellHndlFdbkInd
- * Purpose: Handling the harq feedback for SCell ACT ce txion
- * ACK:: Set the state as active for the Scells for which
- * CE was sent
- * HQ FAILURE/DTX/NACK:: Perform retxion. Add to Act CE list
- * Set the state to TOBE_SCHEDULED
- *
- *
- * Invoked by: CommonScheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @return Void
- *
- **/
-Void rgSCHSCellHndlFdbkInd(RgSchDlHqProcCb *hqP,uint8_t tbIdx,uint8_t fdbk,Bool maxHqRetxReached)
-{
-
- RgSchUeCb *ueCb;
- RgSchCellCb *cell;
- RgSchUeCellInfo *sCellInfo;
-
-
- ueCb = hqP->hqE->ue;
- cell = ueCb->cell;
- switch(fdbk)
- {
- case TFU_HQFDB_ACK:
- {
- hqP->tbInfo[tbIdx].schdSCellActCe.pres = FALSE;
-
- for(uint8_t idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
- {
- if(ueCb->cellInfo[idx] != NULLP)
- {
- if(ueCb->cellInfo[idx]->sCellState == RG_SCH_SCELL_ACTVTN_IN_PROG)
- {
-#ifdef CA_DBG
- DU_LOG("\nINFO --> SCH : starting delay timer...\n");
-#endif
- rgSCHTmrStartTmr (cell,ueCb->cellInfo[idx] ,RG_SCH_TMR_SCELL_ACT_DELAY,
- RG_SCH_CMN_SCELL_ACT_DELAY_TMR);
- }
- else
- {
- if(ueCb->cellInfo[idx]->sCellState == RG_SCH_SCELL_DEACTVTN_IN_PROG)
- {
- sCellInfo = ueCb->cellInfo[idx];
- rgSCHSCellDeActivation(sCellInfo);
- }
- }
- }
- }
- }
- break;
- case TFU_HQFDB_NACK:
- case TFU_HQFDB_DTX:
- {
- if(TRUE == maxHqRetxReached)
- {
- hqP->tbInfo[tbIdx].schdSCellActCe.pres = FALSE;
- for(uint8_t idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
- {
- if(ueCb->cellInfo[idx] != NULLP)
- {
- if(ueCb->cellInfo[idx]->sCellState == RG_SCH_SCELL_ACTVTN_IN_PROG)
- {
- ueCb->cellInfo[idx]->sCellState = RG_SCH_SCELL_TOBE_ACTIVATED;
- }
- else
- {
- if(ueCb->cellInfo[idx]->sCellState == RG_SCH_SCELL_DEACTVTN_IN_PROG)
- {
- ueCb->cellInfo[idx]->sCellState = RG_SCH_SCELL_TOBE_DEACTIVATED;
- }
- }
- }
- /* Add to actDeactCe lst */
- rgSCHSCellAddToActDeactLst(cell,ueCb);
- }
- }
- }
- break;
- default:
- break;
- }
- return;
-}
-
-#ifdef LTE_ADV
-/**
- * @brief Handling of SCell Deactivation Tmr Expiry
- *
- * @details
- *
- * Function: rgSCHSCellDeactTmrExpry
- * Purpose : Deactivating the SCell. a
- * Clear all the Harq Procs associated with this
- * scell.
- * Trigger Harq Reset to the respective MAC
- * Set the state of the cell to Inactive
- *
- *
- * Invoked by: Timer
- *
- * @param[in] RgSchUeCellInfo *sCellInfo
- * @return Void
- *
- **/
-Void rgSCHSCellDeactTmrExpry(RgSchUeCellInfo *sCellInfo)
-{
-
- if (sCellInfo->ue->isScellExplicitDeAct == TRUE)
- {
- /* Deactivation Timer is not configured (infinity), thus send deactivation CE explicitly */
- /* No doing Deactivaiton of LAA Cell */
- if (FALSE == rgSCHLaaSCellEnabled(sCellInfo->cell))
- {
- rgSCHSCellTrigActDeact(sCellInfo->ue->cell, sCellInfo->ue, sCellInfo->sCellIdx, RGR_SCELL_DEACT);
- }
- else
- {
- DU_LOG("\nERROR --> SCH : !!!!!! Avoiding DEACT for UE %d because of LAA Cell !!!!!!!!!!!!! \n",
- sCellInfo->ue->ueId);
- }
-
- }
- else
- {
- /* Deactivation Timer is configured, thus assume that UE has deactivated */
- rgSCHSCellDeActivation(sCellInfo);
- }
- return;
-}
-#endif
-\f
-/**
- * @brief This function handles the action of the SCell
- *
- * @details
- *
- * Function: rgSCHSCellTrigActDeact
- * Purpose :
- * 1) Prepares SCELL ready for activation OR
- * 2) Initiates activation of SCELL OR
- * 3) Initiate deactivation of SCELL OR
- *
- * Invoked by:Cfg/Commn Scheduler
- *
- * @param[in] RgSchCellCb *cellCb
- * @param[in] RgSchUeCb *ueCb
- * @param[in] uint8_t sCellIdx
- * @param[in] uint8_t action
- *
- * @return ROK/RFAILED
- *
- **/
-S16 rgSCHSCellTrigActDeact(RgSchCellCb *cell,RgSchUeCb *ueCb,uint8_t sCellIdx,uint8_t action)
-{
- Inst inst = cell->instIdx;
- S16 ret = ROK;
-
- if((sCellIdx < 1) ||
- (sCellIdx > RGR_MAX_SCELL_PER_UE))
- {
- DU_LOG("\nERROR --> SCH : Invalid Serv Cell Idx %d\n", sCellIdx);
- return RFAILED;
- }
-
- if(ueCb->cellInfo[sCellIdx] == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Serv Cell not added to this Ue Scell Idx %d ueId %d\n", \
- sCellIdx,ueCb->ueId);
- return RFAILED;
- }
-
- switch (action)
- {
- case RGR_SCELL_READY:
- {
- if(ueCb->cellInfo[sCellIdx]->sCellState != RG_SCH_SCELL_INACTIVE)
- {
- DU_LOG("\nERROR --> SCH : Invalid state %u for preparing SCell Idx %u for UE %u\n", \
- ueCb->cellInfo[sCellIdx]->sCellState, sCellIdx, ueCb->ueId);
- ret = RFAILED;
- }
- else
- {
- ueCb->cellInfo[sCellIdx]->sCellState = RG_SCH_SCELL_READY;
- //TODO_SID Activating the cell directly. Ignoring the ActCe procedure.
- rgSCHSCellActivation(ueCb->cellInfo[sCellIdx]);
- /* Setting allocCmnUlPdcch flag to FALSE, So that PDCCH allocation will be done
- from UE Searchspace */
- ueCb->allocCmnUlPdcch = FALSE;
- DU_LOG("\nINFO --> SCH : ***** SCellIdx=%d state Changed to %d State \n",sCellIdx,\
- ueCb->cellInfo[sCellIdx]->sCellState);
- DU_LOG("\nINFO --> SCH : ***** SCellInfo Addr=%p state Changed to RG_SCH_SCELL_READY\n",\
- (void*)ueCb->cellInfo[sCellIdx]);
- }
- break;
- }
- case RGR_SCELL_ACT:
- {
- if(ueCb->cellInfo[sCellIdx]->sCellState != RG_SCH_SCELL_READY)
- {
- DU_LOG("\nERROR --> SCH : Invalid state %u for activating SCell Idx %u for UE %u\n", \
- ueCb->cellInfo[sCellIdx]->sCellState, sCellIdx, ueCb->ueId);
- ret = RFAILED;
- }
- else
- {
- ueCb->cellInfo[sCellIdx]->sCellState = RG_SCH_SCELL_TOBE_ACTIVATED;
- if (NULLP == ueCb->sCellActLnk.node)
- {
- /* Add only if UE is not already present in the activation/deactivation list */
- rgSCHSCellAddToActDeactLst(cell,ueCb);
- }
- }
- break;
- }
- case RGR_SCELL_DEACT:
- {
- if(ueCb->cellInfo[sCellIdx]->sCellState != RG_SCH_SCELL_ACTIVE)
- {
- DU_LOG("\nERROR --> SCH : Invalid state %u for deactivating SCell Idx %u for UE %u\n", \
- ueCb->cellInfo[sCellIdx]->sCellState, sCellIdx, ueCb->ueId);
- ret = RFAILED;
- }
- else
- {
- ueCb->cellInfo[sCellIdx]->sCellState = RG_SCH_SCELL_TOBE_DEACTIVATED;
- if (NULLP == ueCb->sCellActLnk.node)
- {
- /* Add only if UE is not already present in the activation/deactivation list */
- rgSCHSCellAddToActDeactLst(cell,ueCb);
- }
- }
- break;
- }
- default:
- {
- DU_LOG("\nERROR --> SCH : Invalid action received for SCell Idx %u for UE %u\n", \
- sCellIdx, ueCb->ueId);
- ret = RFAILED;
- break;
- }
- }
- return (ret);
-}
-
- \f
-/**
- * @brief SCell Activation of selected cell
- *
- * @details
- *
- * Function: rgSCHSCellSelectForAct
- * Purpose : Perform Selection of secondary cell for activation
- *
- * Invoked by:Cfg/Commn Scheduler
- *
- * @param[in] RgSchCellCb *cellCb
- * @param[in] RgSchUeCb *ueCb
- *
- * @return ROK/RFAILED
- *
- **/
-static S16 rgSCHSCellSelectForAct(RgSchCellCb *cell,RgSchUeCb *ueCb,uint8_t *sCellIdx)
-{
-
- for((*sCellIdx) = 1; (*sCellIdx) <= RG_SCH_MAX_SCELL; (*sCellIdx)++)
- {
- if((ueCb->cellInfo[(*sCellIdx)] != NULLP) &&
- (ueCb->cellInfo[(*sCellIdx)]->sCellState == RG_SCH_SCELL_READY))
- {
- return ROK;
- }
- }
- return RFAILED;
-}
-
-/**
- * @brief SCell Activation of selected cell
- *
- * @details
- *
- * Function: rgSCHSCellSelectAndActDeAct
- * Purpose : Perform Selection and Activation/Deactivation of secondary cell
- *
- * Invoked by:Cfg/Commn Scheduler
- *
- * @param[in] RgSchCellCb *cellCb
- * @param[in] RgSchUeCb *ueCb
- * @param[in] uint8_t action
- *
- * @return Void
- *
- **/
-Void rgSCHSCellSelectAndActDeAct(RgSchCellCb *pCell,RgSchUeCb *ueCb,uint8_t action)
-{
- uint8_t sCellIdx = 0;
- S16 ret = ROK;
-
- switch (action)
- {
- case RGR_SCELL_ACT:
- {
-
- if(((ret = rgSCHSCellSelectForAct(pCell, ueCb, &sCellIdx)) == ROK)
- && (sCellIdx == 0))
- return;
- break;
- }
- default:
- return;
- }
- if ((ret != ROK) ||
- (ROK != (rgSCHSCellTrigActDeact(pCell, ueCb, sCellIdx, action))))
- {
- DU_LOG("\nERROR --> SCH : SCell Actication failed"
- "for UE [%d] with SCellIdx [%d]\n", ueCb->ueId, sCellIdx);
- }
- return;
-}
-
- \f
-/**
- * @brief Handling of Scell Deletion
- *
- * @details
- *
- * Function: rgSCHSCellDelUeSCell
- * Purpose : Perform Scell Deletion for an UE
- * : flush harqEnttiy of the given scell associated
- * with this UE
- *
- *
- * Invoked by:Cfg module
- *
- * @param[in] RgSchCellCb *cellCb
- * @param[in] RgSchUeCb *ueCb
- * @param[in] uint8_t idx
- * @return ROK/RFAILED
- *
- **/
-Void rgSCHSCellDelUeSCell(RgSchCellCb *cellCb,RgSchUeCb *ueCb,uint8_t sCellIdx)
-{
- RgUeUlHqCb *ulHqEnt;
- Inst inst = cellCb->instIdx;
- RgSchUeCellInfo *sCellInfo;
- RgSchCmnUlUe *ueUl;
-
- sCellInfo = ueCb->cellInfo[sCellIdx];
-
-
- if(sCellInfo == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Serv Cell not added to this Ue Scell Idx %d\
- ueId %d\n",
- sCellIdx,ueCb->ueId);
- return;
- }
-
- rgSCHDbmDelUeCb(sCellInfo->cell, ueCb);
- ueUl = RG_SCH_CMN_GET_UL_UE(ueCb, sCellInfo->cell);
-
- if (NULLP != sCellInfo->sCellLnk.node)
- {
- cmLListDelFrm(&sCellInfo->cell->sCellUeLst, &sCellInfo->sCellLnk);
- }
-
- /* Clear Scheduler specific list for this UE from the
- * corresponding CELL */
-
- /*Updating 1BCS Value*/
- ueCb->f1bCsAVal = (ueCb->f1bCsAVal -
- rgSCHUtlGetMaxTbSupp(sCellInfo->txMode.txModeEnum));
-
-#ifdef LTE_TDD
- rgSCHUtlDelUeANFdbkInfo(ueCb,sCellIdx);
-#endif
-
- rgSCHSCellDeActivation(sCellInfo);
- /* Release hqEnt mem */
- rgSCHDhmDelHqEnt(cellCb, &sCellInfo->hqEnt);
-
- ulHqEnt = &(ueUl->hqEnt);
-
- cellCb->sc.apis->rgSCHRgrSCellUeDel(sCellInfo, sCellInfo->ue);
-
- rgSCHUhmFreeUe(sCellInfo->cell, ulHqEnt);
-
- rgSCHUtlFreeSBuf(cellCb->instIdx,
- (Data**)(&(sCellInfo)), (sizeof(RgSchUeCellInfo)));
-
- ueCb->cellInfo[sCellIdx] = NULLP;
-
- return;
-}
-\f
-/**
- * @brief Handling of UE Deletion
- *
- * @details
- *
- * Function: rgSCHSCellDelUe
- * Purpose : Perform UE Deletion
- * : Delete all the SCells added for this UE
- * : flush harqEnttiy of all scells associated
- * with this UE
- *
- *
- * Invoked by:Cfg module
- *
- * @param[in] RgSchCellCb *cellCb
- * @param[in] RgSchUeCb *ueCb
- * @return ROK/RFAILED
- *
- **/
-S16 rgSCHSCellDelUe(RgSchCellCb *cellCb,RgSchUeCb *ueCb)
-{
-
-
- for(uint8_t idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
- {
- rgSCHSCellDelUeSCell(cellCb,ueCb,idx);
- }
-
- return ROK;
-}
-
-#ifdef TFU_UPGRADE
-\f
-/**
- * @brief Handling of PCqi cfg fro a scell
- *
- * @details
- *
- * Function: rgSCHSCellPCqiCfg
- * Purpose :
- * : Delete all the SCells added for this UE
- * : flush harqEnttiy of all scells associated
- * with this UE
- * Processing Steps:
- * - For SCell-specific Periodic CQI related configuration,
- * - If Periodic CQI/PMI is configured,
- * - Update SCell with the configured values.
- * - Update the CQI offset and CQI perodicity information
- *
- *
- * - For SCell-specific Periodic RI related configuration,
- * - If Periodic RI is configured,
- * - Update SCell with the configured values.
- * - Update the RI offset and RI perodicity information
- *
- *
- * Invoked by:Cfg module
- *
- * @param[in] RgSchCellCb *cellCb
- * @param[in] RgSchUeCb *ueCb
- * @return ROK/RFAILED
- *
- **/
-S16 rgSCHSCellPCqiCfg
-(
-RgSchCellCb *priCellCb,
-RgSchCellCb *secCellCb,
-RgSchUeCb *ueCb,
-RgrUePrdDlCqiCfg *cqiCfg,
-CmLteUeCategory ueCat,
-uint8_t sCellIdx
-)
-{
- uint8_t j; /*Bandwidth Parts*/
- uint8_t temp;
-#ifdef DEBUGP
- Inst inst = priCellCb->instIdx;
-#endif
- RgSchUeCellInfo *sCellInfo;
- RgSchUePCqiCb *cqiCb = NULLP;
-
- DU_LOG("\nINFO --> SCH : rgSCHSCellPCqiCfg cellId =%d, ueId = %d, CfgType =%d\n",
- secCellCb->cellId, ueCb->ueId, cqiCfg->type);
-
- if((sCellIdx < 1) ||
- (sCellIdx > RGR_MAX_SCELL_PER_UE))
- {
- DU_LOG("\nERROR --> SCH : Invalid Serv Cell Idx %d\n",
- sCellIdx);
- return RFAILED;
- }
-
- sCellInfo = ueCb->cellInfo[sCellIdx];
-
- cqiCb = &ueCb->cellInfo[sCellIdx]->cqiCb;
- cqiCb->servCellInfo = sCellInfo;
-
- /* Periodic CQI is setup */
- if (cqiCfg->type == RGR_SCH_PCQI_SETUP)
- {
- /* 1. Copy the Received CQI Cfg parameters to ueCb */
- memcpy(&cqiCb->cqiCfg, cqiCfg,
- sizeof(RgrUePrdDlCqiCfg));
-
- /* 2. Compute Periodic CQI Periodicity and subframe offset */
-#ifndef LTE_TDD
- rgSCHUtlGetCfgPerOff(RG_SCH_FDD_PCQI_TBL, cqiCfg->cqiSetup.cqiPCfgIdx,
- &cqiCb->cqiPeri, &cqiCb->cqiOffset);
-#else
- rgSCHUtlGetCfgPerOff( RG_SCH_TDD_PCQI_TBL,
- cqiCfg->cqiSetup.cqiPCfgIdx,
- &cqiCb->cqiPeri, &cqiCb->cqiOffset);
-#endif
-
-
- DU_LOG("\nDEBUG --> SCH : rgSCHSCellPCqiCfg(): CQI Peri=%d, CQI Offset=%d",
- cqiCb->cqiPeri,cqiCb->cqiOffset);
-
- if(RGR_UE_PCQI_SB_REP == cqiCfg->cqiSetup.cqiRepType)
- {
- uint8_t k; /*SubBand Size (RB) */
- RG_SCH_GET_CQI_J_VAL(secCellCb->bwCfg.dlTotalBw, j);
- RG_SCH_GET_CQI_K_VAL(secCellCb->bwCfg.dlTotalBw, k);
- cqiCb->J = j; /*Number of Bandwidth Parts*/
- /*h: reporting instances required for a complete CQI/PMI report */
- /*j:Number of bandwidth parts; k: Subband Size*/
- cqiCb->h = (cqiCb->cqiCfg.cqiSetup.k *j )+1;
- /* ccpu00140905- L-size is coming as 3 for 100Rbs where it should be 2*/
- temp = RGSCH_CEIL(secCellCb->bwCfg.dlTotalBw, (j*k));
- cqiCb->label = (temp & (temp-1)) ?
- (1+ rgSCHUtlLog32bitNbase2(temp)) : rgSCHUtlLog32bitNbase2(temp);
- }
- else
- {
- /* Wideband Cqi Rep Type */
- cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_1;
- }
- cqiCb->cqiLstEnt.node=(PTR)cqiCb;
- cqiCb->isCqiIgnoByCollsn = FALSE;
-
-
- /* 4. Rank Indicator Cfg handler */
- /* 1. Rank Indicator is enabled */
- if(cqiCfg->cqiSetup.riEna)
- {
- rgSCHUtlGetCfgPerOff(RG_SCH_RI_TBL,
- cqiCfg->cqiSetup.riCfgIdx,
- &cqiCb->riPeri, &cqiCb->riOffset);
-
- DU_LOG("\nDEBUG --> SCH : rgSCHSCellPCqiCfg(): RI Peri=%d, RI Offset=%d",
- cqiCb->riPeri,cqiCb->riOffset);
-
- if(ueCb->cellInfo[sCellIdx]->txMode.txModeEnum == RGR_UE_TM_3
- || ueCb->cellInfo[sCellIdx]->txMode.txModeEnum == RGR_UE_TM_4)
- {
- if (secCellCb->numTxAntPorts ==2)
- {
- cqiCb->riNumBits = 1;
- }
- else if(secCellCb->numTxAntPorts ==4)
- {
- if(ueCat == CM_LTE_UE_CAT_8)
- {
- cqiCb->riNumBits = 3;
- }
- else if((ueCat == CM_LTE_UE_CAT_5) ||
- (ueCat == CM_LTE_UE_CAT_6) || CM_LTE_UE_CAT_7)
- {
- cqiCb->riNumBits = 2;
- }
- else
- {
- cqiCb->riNumBits = 1;
- }
- }
- }
- cqiCb->riLstEnt.node=(PTR) cqiCb;
- cqiCb->isRiIgnoByCollsn = FALSE;
-
- }
- }
- else
- {
- sCellInfo->cqiCb.cqiCfg.type = RGR_SCH_PCQI_REL;
- }
- /* Setting the indices to invalid during
- scell addition. These indices will be set during
- activation */
- cqiCb->nRiTrIdx = RG_SCH_INVALID_IDX;
- cqiCb->riDist = RG_SCH_INVALID_IDX;
- cqiCb->nCqiTrIdx = RG_SCH_INVALID_IDX;
-
- return ROK;
-}
-#endif
-
-/**
- * @brief Handling of Ue Reset from common scheduler
- *
- * @details
- *
- * Function: rgSCHSCellDlUeReset
- * Purpose: Call scheudler type spcefic UE RESET
- * for all the secondary cells
- *
- * Invoked by: CommonScheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @return Void
- *
- **/
-Void rgSCHSCellDlUeReset(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- RgSchCmnCell *cellSch;
-
- for(uint8_t idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
- {
- if(ue->cellInfo[idx] != NULLP)
- {
- cellSch = RG_SCH_CMN_GET_CELL(ue->cellInfo[idx]->cell);
- cellSch->apisDl->rgSCHDlUeReset(ue->cellInfo[idx]->cell, ue);
- rgSCHSCellDeActivation(ue->cellInfo[idx]);
- ue->cellInfo[idx]->sCellState = RG_SCH_SCELL_INACTIVE;
- }
- }
- return;
-}
-
-
-/**
- * @brief Handling of LC Cfg from common scheduler
- *
- * @details
- *
- * Function: rgSCHSCellDlLcCfg
- * Purpose: Call scheudler type spcefic LC config
- * for all the secondary cells
- *
- * Invoked by: CommonScheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @return Void
- *
- **/
-Void rgSCHSCellDlLcCfg(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *svc)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- for(uint8_t idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
- {
- if(ue->cellInfo[idx] != NULLP)
- {
- cellSch->apisDl->rgSCHRgrDlLcCfg(ue->cellInfo[idx]->cell, ue, svc,NULLP,NULLP);
- }
- }
- return;
-}
-
-/**
- * @brief Handling of LC Delete from common scheduler
- *
- * @details
- *
- * Function: rgSCHSCellDlLcDel
- * Purpose: Call scheudler type spcefic bo update handler
- * for all the secondary cells
- *
- * Invoked by: CommonScheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @return Void
- *
- **/
-Void rgSCHSCellDlLcDel(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *svc)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- for(uint8_t idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
- {
- if(ue->cellInfo[idx] != NULLP)
- {
- cellSch->apisDl->rgSCHFreeDlLc(ue->cellInfo[idx]->cell, ue, svc);
- }
- }
- return;
-}
-
-/**
- * @brief Handling of Bo update from common scheduler
- *
- * @details
- *
- * Function: rgSCHSCellDlDedBoUpd
- * Purpose: Call scheudler type spcefic bo update handler
- * for all the secondary cells
- *
- * Invoked by: CommonScheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @return Void
- *
- **/
-Void rgSCHSCellDlDedBoUpd(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *svc)
-{
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-
- /* If this is not invoked by PCell, then
- invoke the call to PCell handler
- This happens during finalization if LC Bo becomes zero*/
- if (ue->cell != cell)
- {
- cellSch->apisDl->rgSCHDlDedBoUpd(ue->cell, ue, svc);
- }
- for(uint8_t idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
- {
- if((ue->cellInfo[idx] != NULLP) &&
- (ue->cellInfo[idx]->sCellState == RG_SCH_SCELL_ACTIVE) &&
- (ue->cellInfo[idx]->cell != cell))
- {
- cellSch->apisDl->rgSCHDlDedBoUpd(ue->cellInfo[idx]->cell, ue, svc);
- }
- }
- return;
-}
-#ifdef TFU_UPGRADE
-/**
- * @brief Compare two CQI CB configs are return the result
- *
- * @details
- *
- * Function: rgSCHUtlSCellCmpCqiCfg
- * Purpose : Compare priority levels of cqiCb1 and cqiCb2
- * and set the isCqiIgnoByCollsn to TRUE for the
- * cqiCb which has lower priority
- * Invoked by:scell module
- *
- * @param[in] RgSchUePCqiCb *cqiCb1
- * @param[in] RgSchUePCqiCb *cqiCb2
- * @return uint8_t cqiCb cell idx which has the higher priority
- *
- **/
-static uint8_t rgSCHUtlSCellCmpCqiCfg(RgSchUePCqiCb *cqiCb1,RgSchUePCqiCb *cqiCb2)
-{
- RgSchUePCqiCb *retCqiCb;
- /* Collision rules are defined in TS 36.213,7.2.2 */
- /* RI, WB first PMI > WB CQI > SB CQI */
- /* As of now only taking care of RI > WB CQI > SB CQI */
-
- if (cqiCb1->prioLvl > cqiCb2->prioLvl)
- {
- cqiCb2->isCqiIgnoByCollsn = TRUE;
- cqiCb1->isCqiIgnoByCollsn = FALSE;
- retCqiCb = cqiCb1;
- }
- else if (cqiCb2->prioLvl > cqiCb1->prioLvl)
- {
- cqiCb1->isCqiIgnoByCollsn = TRUE;
- cqiCb2->isCqiIgnoByCollsn = FALSE;
- retCqiCb = cqiCb2;
- }
- else
- {
- if (cqiCb1->servCellInfo->sCellIdx > cqiCb2->servCellInfo->sCellIdx)
- {
- cqiCb1->isCqiIgnoByCollsn = TRUE;
- cqiCb2->isCqiIgnoByCollsn = FALSE;
- retCqiCb = cqiCb2;
- }
- else
- {
- cqiCb2->isCqiIgnoByCollsn = TRUE;
- cqiCb1->isCqiIgnoByCollsn = FALSE;
- retCqiCb = cqiCb1;
- }
- }
-
- return (retCqiCb->servCellInfo->sCellIdx);
-}
-
-/**
- * @brief Handling of collision of CQI types between serving cells
- *
- * @details
- *
- * Function: rgSCHUtlSCellHndlCqiCollsn
- * Purpose : Takes care of collision clauses specified in 36.213 7.2.2 Rel 10
- * and selects next nearest cqiCb
- * Invoked by:Cfg module
- *
- * @param[in] RgSchCellCb *cellCb
- * @param[in] RgSchUeCb *ueCb
- * @return ROK/RFAILED
- *
- **/
-S16 rgSCHUtlSCellHndlCqiCollsn(RgSchUePCqiCb *cqiCb)
-{
- uint32_t nPCqiServCellIdx;
- uint32_t minPCqiTrIdx;
- uint32_t scellPCqiTrIdx;
- uint32_t pCqiTrIdx;
- RgSchCellCb *priCellCb = cqiCb->servCellInfo->ue->cell;
- RgSchUeCb *ueCb = cqiCb->servCellInfo->ue;
- uint16_t crntSfIdx;
- uint32_t cellIdx;
- uint32_t sCellCnt = 0;
- CmLteTimingInfo timingInfo;
- uint8_t idx = 0;
-
-#ifdef xLTE_TDD
- RG_SCH_ADD_TO_CRNT_TIME(priCellCb->crntTime, timingInfo, TFU_DELTA);
-#else
- RG_SCH_ADD_TO_CRNT_TIME(priCellCb->crntTime, timingInfo,
- TFU_RECPREQ_DLDELTA);
-#endif
-
- RG_SCH_GET_IDX_PCQISRSSR(timingInfo, crntSfIdx);
-
- cqiCb->isCqiIgnoByCollsn = FALSE;
-
- pCqiTrIdx = cqiCb->nCqiTrIdx;
- nPCqiServCellIdx = cqiCb->servCellInfo->sCellIdx;
- /* Handle wrap around case */
- if (pCqiTrIdx < crntSfIdx)
- {
- pCqiTrIdx += RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
- }
- minPCqiTrIdx = pCqiTrIdx;
-
- for (cellIdx =0; cellIdx <= RG_SCH_MAX_SCELL; cellIdx++)
- {
- /* If a serving cell is configured */
- if(ueCb->cellInfo[cellIdx] != NULLP)
- {
- /* If the serving cell is in ACTIVE state and
- If it is not the same serving cell as cqiCb for which
- collision is being checked */
- if ((ueCb->cellInfo[cellIdx]->sCellState == RG_SCH_SCELL_ACTIVE)&&
- (cellIdx != cqiCb->servCellInfo->sCellIdx))
- {
- scellPCqiTrIdx = ueCb->cellInfo[cellIdx]->cqiCb.nCqiTrIdx;
-
- /* Handle wrap around case */
- if (scellPCqiTrIdx < crntSfIdx)
- {
- scellPCqiTrIdx += RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
- }
-
- /* If cqiCb->isCqiIgnoByCollsn is TRUE then a higher prio cqiCb
- is already found so need to compare */
- if ((FALSE == ueCb->cellInfo[cellIdx]->cqiCb.isCqiIgnoByCollsn) &&
- (FALSE == cqiCb->isCqiIgnoByCollsn) &&
- (scellPCqiTrIdx == pCqiTrIdx))
- {
- /* Handle Collision */
- /* set isCqiIgnoByCollsn to TRUE for low prio CQI Rep type */
- nPCqiServCellIdx = rgSCHUtlSCellCmpCqiCfg(&ueCb->cellInfo[cellIdx]->cqiCb,cqiCb);
- }
- else if (scellPCqiTrIdx < minPCqiTrIdx)
- {
- minPCqiTrIdx = scellPCqiTrIdx;
- nPCqiServCellIdx = cellIdx;
- }
- }
-
- /* If all of the num of configured scells are checked then break */
- if (sCellCnt == ueCb->numSCells)
- {
- break;
- }
- sCellCnt++;
- }
- }
-
- /* Set the next expected Cqi into nPCqiCb */
- idx = ((nPCqiServCellIdx)& (CM_LTE_MAX_CELLS -1));
- ueCb->nPCqiCb = &ueCb->cellInfo[idx]->cqiCb;
-
- return ROK;
-}
-
-
-/**
- * @brief Handling of collision of RI types between serving cells
- *
- * @details
- *
- * Function: rgSCHUtlSCellHndlRiCollsn
- * Purpose : Takes care of collision clauses specified in 36.213 7.2.2 Rel 10
- * and selects next nearest cqiCb
- * Invoked by:Cfg module
- *
- * @param[in] RgSchCellCb *cellCb
- * @param[in] RgSchUeCb *ueCb
- * @return ROK/RFAILED
- *
- **/
-S16 rgSCHUtlSCellHndlRiCollsn(RgSchUePCqiCb *cqiCb)
-{
- uint32_t nPRiServCellIdx;
- uint32_t minPRiTrIdx;
- uint32_t scellPRiTrIdx;
- uint32_t pRiTrIdx;
- RgSchCellCb *priCellCb = cqiCb->servCellInfo->ue->cell;
- RgSchUeCb *ueCb = cqiCb->servCellInfo->ue;
- uint16_t crntSfIdx;
- uint32_t cellIdx;
- uint32_t sCellCnt = 0;
- CmLteTimingInfo timingInfo;
-
-#ifdef xLTE_TDD
- RG_SCH_ADD_TO_CRNT_TIME(priCellCb->crntTime, timingInfo, TFU_DELTA);
-#else
- RG_SCH_ADD_TO_CRNT_TIME(priCellCb->crntTime, timingInfo,
- TFU_RECPREQ_DLDELTA);
-#endif
-
- RG_SCH_GET_IDX_PCQISRSSR(timingInfo, crntSfIdx);
-
- pRiTrIdx = cqiCb->nRiTrIdx + cqiCb->riDist * RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
-
- /* Handle wrap around case */
- if (pRiTrIdx < crntSfIdx)
- {
- pRiTrIdx += RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
- }
-
- cqiCb->isRiIgnoByCollsn = FALSE;
- nPRiServCellIdx = cqiCb->servCellInfo->sCellIdx;
- minPRiTrIdx = pRiTrIdx;
-
- for (cellIdx =0; cellIdx <= RG_SCH_MAX_SCELL; cellIdx++)
- {
- /* If a serving cell is configured */
- if(ueCb->cellInfo[cellIdx] != NULLP)
- {
- /* If the serving cell is in ACTIVE state and
- If it is not the same serving cell as cqiCb for which
- collision is being checked */
- if ((ueCb->cellInfo[cellIdx]->sCellState == RG_SCH_SCELL_ACTIVE)&&
- (cellIdx != cqiCb->servCellInfo->sCellIdx))
- {
- scellPRiTrIdx = ueCb->cellInfo[cellIdx]->cqiCb.nRiTrIdx +
- ueCb->cellInfo[cellIdx]->cqiCb.riDist * RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
-
- /* Handle wrap around case */
- if (scellPRiTrIdx < crntSfIdx)
- {
- scellPRiTrIdx += RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
- }
-
- /* If cqiCb->isRiIgnoByCollsn is TRUE then a higher prio cqiCb
- is already found so need to compare */
- if ((FALSE == ueCb->cellInfo[cellIdx]->cqiCb.isRiIgnoByCollsn) &&
- (FALSE == cqiCb->isRiIgnoByCollsn) &&
- (scellPRiTrIdx == pRiTrIdx))
- {
- /* Handle Collision */
- /* set isRiIgnoByCollsn to TRUE for low prio CQI Rep type */
- if (cqiCb->servCellInfo->sCellIdx < (ueCb->cellInfo[cellIdx]->sCellIdx))
- {
- ueCb->cellInfo[cellIdx]->cqiCb.isRiIgnoByCollsn = TRUE;
- }
- else
- {
- cqiCb->isRiIgnoByCollsn = TRUE;
- }
- }
- else if (scellPRiTrIdx < minPRiTrIdx)
- {
- minPRiTrIdx = scellPRiTrIdx;
- nPRiServCellIdx = cellIdx;
- }
- }
-
- /* If all of the num of configured scells are checked then break */
- if (sCellCnt == ueCb->numSCells)
- {
- break;
- }
- sCellCnt++;
- }
- }
-
- /* Set the next expected Cqi into nPCqiCb */
- ueCb->nPRiCb = &ueCb->cellInfo[nPRiServCellIdx]->cqiCb;
-
- return ROK;
-}
-#endif/*TFU_UPGRADE*/
-
-/**
- * @brief Checking whethter the scell is active or not
- *
- * @details
- *
- * Function: rgSCHSCellIsActive
- * Purpose: Check the Scell is in active state or not
- *
- *
- * Invoked by: SpecificScheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @return Void
- *
- **/
-S16 rgSCHSCellIsActive(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- S16 retVal = RFAILED;
-
- for(uint8_t idx = 1; idx <= RG_SCH_MAX_SCELL ; idx++)
- {
- if((ue->cellInfo[idx] != NULLP) &&
- (ue->cellInfo[idx]->cell->cellId == cell->cellId)&&
- (ue->cellInfo[idx]->sCellState == RG_SCH_SCELL_ACTIVE))
- {
- retVal = ROK;
- break;
- }
- }
- return (retVal);
-}
-
-/**
- * @brief Function to check for Acell Activation Trigered.
- *
- * @details
- *
- * Function : rgSCHIsActvReqd
- * This function will check for Secondary cell activation criteria
- * If met this will return TRUE else FALSE
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return BOOL
- * -# TRUE
- **/
-Bool rgSCHIsActvReqd(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- /* Check if remBoCnt in this UE is greater than ZERO for sufficient number of
- * Scheduling TTIs. If yes then We should activate a secondary cell to handle
- * outstanding BO */
- if(ue->remBoCnt == RG_SCH_ACTIVATION_COUNT)
- {
- return (TRUE);
- }
- return (FALSE);
-}
-#endif/*LTE_ADV*/
-
-
-
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Entry point fucntions
-
- File: rg_sch_tmr.c
-
-**********************************************************************/
-
-/** @file rg_sch_tmr.c
-@brief This module does processing related to timers for the scheduler.
-*/
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "tfu.h" /* RGU defines */
-#include "lrg.h" /* layer management defines for LTE-MAC */
-#include "rgr.h" /* layer management defines for LTE-MAC */
-#include "rg_env.h" /* defines and macros for MAC */
-#include "rg_sch_err.h" /* defines and macros for MAC */
-#include "rg_sch_inf.h" /* defines and macros for MAC */
-#include "rg_sch.h" /* defines and macros for MAC */
-
-
-/* header/extern include files (.x) */
-#include "tfu.x" /* RGU types */
-#include "lrg.x" /* layer management typedefs for MAC */
-#include "rgr.x" /* layer management typedefs for MAC */
-#include "rg_sch_inf.x" /* typedefs for MAC */
-#include "rg_sch.x" /* typedefs for MAC */
-
-#ifdef LTE_ADV
-Void rgSCHSCellActivation ARGS((
-RgSchUeCellInfo *sCell
-));
-#endif
- /** @brief This function is a utility function to start timers, it is a
- * generic function.
- *
- * @details
- *
- * Function: rgSCHTmrStartTmr
- *
- * Processing steps:
- * - Starts timer at scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] Ptr cb
- * @param[in] S16 tmrEvnt
- * @param[in] uint32_t tmrVal
- * @return Void
- */
-Void rgSCHTmrStartTmr(RgSchCellCb *cell,Ptr cb,S16 tmrEvnt,uint32_t tmrVal)
-{
- CmTmrArg arg;
- RgSchUeCb *ue;
-#ifdef LTE_ADV
- RgSchUeCellInfo *sCellCb = NULLP;
-#endif
-
-#ifndef LTE_ADV
- ue = (RgSchUeCb*)cb;
-#else
- if(tmrEvnt == RG_SCH_TMR_SCELL_DEACT)
- {
- sCellCb = (RgSchUeCellInfo *)cb;
- }
- else
- {
- ue = (RgSchUeCb*)cb;
- }
-#endif
-
- switch (tmrEvnt)
- {
- case RG_SCH_TMR_ACKNACK_REP:
- arg.timers = &(ue->ackNakRepCb.ackNakRepTmr);
- DU_LOG("\nINFO --> SCH : Hit AckNackRep timer");
- break;
- case RG_SCH_TMR_MEASGAP:
- arg.timers = &(ue->measGapCb.measGapTmr);
- break;
- case RG_SCH_TMR_UL_ACKNACK:
- arg.timers = &(ue->ackNakRepCb.ackNakRepUlInactvTmr);
- break;
- case RG_SCH_TMR_DL_ACKNACK:
- arg.timers = &(ue->ackNakRepCb.ackNakRepDlInactvTmr);
- break;
- case RG_SCH_TMR_UL_MEASGAP:
- arg.timers = &(ue->measGapCb.measGapUlInactvTmr);
- break;
- case RG_SCH_TMR_DL_MEASGAP:
- arg.timers = &(ue->measGapCb.measGapDlInactvTmr);
- break;
- case RG_SCH_TMR_TA:
- arg.timers = &(ue->taTmr);
- break;
- /*MS_WORKAROUND for CR FIXME */
-#ifndef RGR_V1
- case RG_SCH_TMR_BSR:
- {
- arg.timers = &(ue->bsrTmr);
- break;
- }
-#else
- case RG_SCH_TMR_BSR:
- {
-#ifdef NO_BSR_SR_5GTF
- return;
-#endif
- arg.timers = &(ue->bsrTmr);
- break;
- }
-#endif
- case RG_SCH_TMR_TXMODE_TRNSTN:
- {
- arg.timers = &(ue->txModeTransTmr);
- break;
- }
-#ifdef LTE_ADV
- case RG_SCH_TMR_SCELL_DEACT:
- {
- arg.timers = &(sCellCb->deactTmr);
- break;
- }
- case RG_SCH_TMR_SCELL_ACT_DELAY:
- {
- sCellCb = (RgSchUeCellInfo *)cb;
- arg.timers = &(sCellCb->actDelayTmr);
- break;
- }
-#endif
- default:
- DU_LOG("\nERROR --> SCH : rgSCHTmrStartTmr() Incorrect Timer event");
- return;
- }
-
- arg.tqCp = &(cell->tqCp);
- arg.tq = cell->tq;
- arg.cb = (PTR)cb;
- arg.evnt = tmrEvnt;
- arg.wait = tmrVal;
- arg.max = 1;
- arg.tNum = NOTUSED;
- cmPlcCbTq(&arg);
- return;
-
-} /* end of */
-
- /** @brief This function stops the timer.
- *
- * @details
- *
- * Function: rgSCHTmrStopTmr
- *
- * Processing steps:
- * - Stops timer at scheduler.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] S16 tmrEvnt
- * @param[in] Ptr cb
- * @return Void
- */
-Void rgSCHTmrStopTmr(RgSchCellCb *cell,S16 tmrEvnt,Ptr cb)
-{
- CmTmrArg arg;
- RgSchUeCb *ue;
-#ifdef LTE_ADV
- RgSchUeCellInfo *sCellCb = NULLP;
-#endif
-
-#ifndef LTE_ADV
- ue = (RgSchUeCb*)cb;
-#else
- if(tmrEvnt == RG_SCH_TMR_SCELL_DEACT)
- {
- sCellCb = (RgSchUeCellInfo *)cb;
- }
- else
- {
- ue = (RgSchUeCb*)cb;
- }
-#endif
-
- switch (tmrEvnt)
- {
- case RG_SCH_TMR_ACKNACK_REP:
- arg.timers = &(ue->ackNakRepCb.ackNakRepTmr);
- break;
- case RG_SCH_TMR_MEASGAP:
- arg.timers = &(ue->measGapCb.measGapTmr);
- break;
- case RG_SCH_TMR_UL_ACKNACK:
- arg.timers = &(ue->ackNakRepCb.ackNakRepUlInactvTmr);
- break;
- case RG_SCH_TMR_DL_ACKNACK:
- arg.timers = &(ue->ackNakRepCb.ackNakRepDlInactvTmr);
- break;
- case RG_SCH_TMR_UL_MEASGAP:
- arg.timers = &(ue->measGapCb.measGapUlInactvTmr);
- break;
- case RG_SCH_TMR_DL_MEASGAP:
- arg.timers = &(ue->measGapCb.measGapDlInactvTmr);
- break;
- case RG_SCH_TMR_TA:
- arg.timers = &(ue->taTmr);
- break;
- /*MS_WORKAROUND for CR FIXME */
-#ifndef RGR_V1
- case RG_SCH_TMR_BSR:
-
- {
- arg.timers = &(ue->bsrTmr);
- break;
- }
-#else
- case RG_SCH_TMR_BSR:
- {
-#ifdef NO_BSR_SR_5GTF
- return;
-#endif
- arg.timers = &(ue->bsrTmr);
- break;
- }
-
-#endif
- case RG_SCH_TMR_TXMODE_TRNSTN:
- {
- arg.timers = &(ue->txModeTransTmr);
- break;
- }
-#ifdef LTE_ADV
- case RG_SCH_TMR_SCELL_DEACT:
- {
- arg.timers = &(sCellCb->deactTmr);
- break;
- }
- case RG_SCH_TMR_SCELL_ACT_DELAY:
- {
- sCellCb = (RgSchUeCellInfo *)cb;
- arg.timers = &(sCellCb->actDelayTmr);
- break;
- }
-#endif
-
- default:
- DU_LOG("\nERROR --> SCH : rgSCHTmrStopTmr() Incorrect Timer event");
- return;
- }
-
- arg.tqCp = &(cell->tqCp);
- arg.tq = cell->tq;
- arg.cb = (PTR)cb;
- arg.evnt = tmrEvnt;
- arg.wait = NOTUSED;
- arg.max = 0;
- arg.tNum = NOTUSED;
- cmRmvCbTq(&arg);
- return;
-} /* end of */
-
- /** @brief This function handles timer expiry.
- *
- * @details
- *
- * Function: rgSCHTmrProcTmr
- *
- * Processing steps:
- * - Handles processing on timer expiry at scheduler.
- *
- * @param[in] Ptr cb
- * @param[in] S16 tmrEvnt
- * @return Void
- */
-Void rgSCHTmrProcTmr(Ptr cb,S16 tmrEvnt)
-{
- RgSchUeCb *ue = NULLP;
-#ifdef LTE_ADV
- RgSchUeCellInfo *sCellCb = NULLP;
-#endif
-
-#ifndef LTE_ADV
- ue = (RgSchUeCb*)cb;
-#else
- if(tmrEvnt == RG_SCH_TMR_SCELL_DEACT)
- {
- sCellCb = (RgSchUeCellInfo *)cb;
- }
- else
- {
- ue = (RgSchUeCb*)cb;
- }
-#endif
-
-
- switch (tmrEvnt)
- {
- case RG_SCH_TMR_ACKNACK_REP:
- rgSCHAckNakRepTmrExpry (ue);
- break;
- case RG_SCH_TMR_MEASGAP:
- rgSCHMeasGapANRepTmrExpry (ue);
- break;
- case RG_SCH_TMR_UL_MEASGAP:
- case RG_SCH_TMR_UL_ACKNACK:
- rgSCHMeasGapANRepUlInactvTmrExpry (ue, (uint8_t)tmrEvnt);
- break;
- case RG_SCH_TMR_DL_ACKNACK:
- case RG_SCH_TMR_DL_MEASGAP:
- rgSCHMeasGapANRepDlInactvTmrExpry (ue, (uint8_t)tmrEvnt);
- break;
- case RG_SCH_TMR_TA:
-#ifdef EMTC_ENABLE
- /*TODO Needto handle TA Timer expiry for EMTC UE*/
- if(TRUE == ue->isEmtcUe)
- {
- DU_LOG("\nINFO --> SCH : TA Timer Expiry is not handled for EMTC UE\n");
- break;
- }
-#endif
- rgSCHDhmProcTAExp (ue);
- break;
- /*MS_WORKAROUND for CR FIXME */
-#ifndef RGR_V1
- case RG_SCH_TMR_BSR:
- {
- rgSCHCmnBsrTmrExpry(ue);
- }
- break;
-#else
- case RG_SCH_TMR_BSR:
- {
- rgSCHCmnBsrTmrExpry(ue);
- }
- break;
-
-#endif
- case RG_SCH_TMR_TXMODE_TRNSTN:
- {
- ue->txModeTransCmplt = TRUE;
- break;
- }
-#ifdef LTE_ADV
- case RG_SCH_TMR_SCELL_DEACT:
- {
- rgSCHSCellDeactTmrExpry(sCellCb);
- break;
- }
- case RG_SCH_TMR_SCELL_ACT_DELAY:
- {
- sCellCb = (RgSchUeCellInfo *)cb;
- rgSCHSCellActivation(sCellCb);
- break;
- }
-#endif
- default:
- if(ue)
- {
- DU_LOG("\nERROR --> SCH : rgSCHTmrProcTmr() Incorrect Timer event");
- }
- return;
- }
- return;
-} /* end of */
-
-\f
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Entry point fucntions
-
- File: rg_sch_tom.c
-
-**********************************************************************/
-
-/** @file rg_sch_tom.c
-@brief This module does processing related to handling of lower interface APIs
-invoked by PHY towards scheduler.
-*/
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "tfu.h" /* RGU defines */
-#include "lrg.h" /* layer management defines for LTE-MAC */
-#include "rgr.h" /* layer management defines for LTE-MAC */
-#include "rgm.h" /* layer management defines for LTE-MAC */
-#include "rg_env.h" /* defines and macros for MAC */
-#include "rg_sch_err.h" /* defines and macros for MAC */
-#include "rg_sch_inf.h" /* defines and macros for MAC */
-#include "rg_sch.h" /* defines and macros for MAC */
-#include "rg_sch_cmn.h" /* typedefs for MAC */
-
-
-/* header/extern include files (.x) */
-#include "tfu.x" /* RGU types */
-#include "lrg.x" /* layer management typedefs for MAC */
-#include "rgr.x" /* layer management typedefs for MAC */
-#include "rgm.x" /* layer management typedefs for MAC */
-#include "rg_sch_inf.x" /* typedefs for Scheduler */
-#include "rg_sch.x" /* typedefs for MAC */
-#include "rg_sch_cmn.x" /* typedefs for MAC */
-#ifdef EMTC_ENABLE
-#include "rg_sch_emtc_ext.x"
-#endif
-uint8_t rgSCHCmnCalcPcqiBitSz(RgSchUeCb *ueCb,uint8_t numTxAnt);
-S16 rgSCHDhm5gtfHqFdbkInd(RgSchUeCb *ue,RgSchCellCb *cell,CmLteTimingInfo timingInfo,TfuHqFdbk fdbk,RgSchErrInfo *err);
-/* local defines */
-#ifdef EMTC_ENABLE
-Bool rgSCHEmtcChkEmtcUe ARGS(
-(
-RgSchCellCb *cell,
-uint16_t rapId
-));
-Void rgSchTomTtiEmtcSched ARGS(
-(
-RgSchCellCb *cell
-));
-
-S16 rgSCHEmtcRamVldtProcRaReq
-(
-uint8_t raRntiCnt,
-uint8_t raReqCnt,
-RgSchCellCb *cell,
-TfuRaReqIndInfo *raReqInd,
-RgSchUeCb *ue,
-Bool *isEmtcUe,
-RgSchErrInfo *err
-);
-Void rgSCHEmtcUpdCqiInfo
-(
-RgSchUeCb *ue,
-RgSchUePCqiCb *cqiCb,
-uint16_t *cqiIdx
-);
-Void rgSCHEmtcUpdSRInfo
-(
-RgSchUeCb *ue,
-uint16_t *srIdx
-);
-Void rgSCHCmnEmtcHdlCrcFailInd
-(
-RgSchCellCb *cell,
-RgSchRaCb *raCb
-);
-S16 rgSCHEmtcTomUtlProcAtCrc
-(
-RgSchCellCb *cell,
-CmLteTimingInfo crntHiDci0Frm,
-TfuCntrlReqInfo *cntrlInfo,
-RgSchErrInfo *err
-);
-Void rgSCHEmtcInitUeRecpReqLst
-(
-TfuRecpReqInfo *recpReqInfo
-);
-Void rgSCHEmtcFillPucchRecpInfo
-(
-RgSchCellCb *cell,
-RgSchDlHqProcCb *hqCb,
-uint16_t *hqRes
-);
-Bool rgSCHEmtcAddRecpInfoToLst
-(
-RgSchDlHqProcCb *hqCb,
-TfuRecpReqInfo *recpReqInfo,
-TfuUeRecpReqInfo *pucchRecpInfo,
-Bool isEmtcUe
-);
-Void rgSCHEmtcWillUeRptCqi
-(
-RgSchUeCb *ue,
-Bool *willUeRprtCqi
-);
-Void rgSchEmtcTomTtiCnsldtSfAlloc
-(
-RgSchCellCb *cell
-);
-
-S16 rgSchEmtcTomTtiL1DlAndUlCfg
-(
-RgSchCellCb *cell,
-RgTfuCntrlReqInfo *cntrlInfo
-);
-
-S16 rgSCHTomEmtcUtlFillDatRecpReq
-(
-TfuRecpReqInfo *recpReqInfo,
-RgSchCellCb *cell,
-uint16_t validIdx,
-RgSchErrInfo *err
-);
-
-S16 rgSCHEmtcTomUtlFillHqFdbkRecpReq
-(
-TfuRecpReqInfo *recpReqInfo,
-RgSchCellCb *cell,
-uint16_t validIdx,
-RgSchErrInfo *err
-);
-
-S16 rgSCHEmtcDhmRlsDlsfHqProc
-(
-RgSchCellCb *cell,
-CmLteTimingInfo timingInfo
-);
-
-Void rgSCHEmtcCmnUlSch
-(
-RgSchCellCb *cell
-);
-
-#ifdef RG_ULSCHED_AT_CRC
-S16 rgSCHEmtcTomUtlProcDlSfAtCrc
-(
-RgSchEmtcDlSf *ulSf,
-CmLteTimingInfo crntUlFrm,
-RgSchCellCb *cell,
-TfuCntrlReqInfo *cntrlInfo,
-RgSchErrInfo *err
-);
-
-RgSchEmtcDlSf* rgSCHEmtcUtlSubFrmGet
-(
-RgSchCellCb *cell,
-CmLteTimingInfo frm
-);
-#endif
-
-uint32_t gDlMpdcchBlank;
-uint32_t gUlMpdcchBlank;
-S16 rgSCHUtlIotResPrcTti
-(
-RgSchCellCb *cell
-);
-
-#endif
-
-RgSchUeCb* rgSCHCmnGetHoUe
-(
-RgSchCellCb *cell,
-uint16_t rapId
-);
-RgSchUeCb* rgSCHCmnGetPoUe
-(
-RgSchCellCb *cell,
-uint16_t rapId,
-CmLteTimingInfo timingInfo
-);
-S16 rgSCHTomUtlFillDatAperRecpReq ARGS(
-(
-RgSchCellCb *cell,
-uint8_t cqiReq,
-RgSchUlAlloc *alloc,
-TfuUeRecpReqInfo *datRecpInfo,
-CmLteTimingInfo *timeInfo,
-Bool hqPres,
-uint16_t validIdx
-));
-
-S16 rgSCHTomUtlFillDatPriRecpReq ARGS(
-(
-RgSchCellCb *cell,
-RgSchUlAlloc *alloc,
-TfuUeRecpReqInfo *datRecpInfo,
-CmLteTimingInfo *timeInfo,
-Bool hqPres,
-uint16_t validIdx
-));
-
-S16 rgSCHTomUtlFillDatPCqiRecpReq ARGS(
-(
-RgSchCellCb *cell,
-RgSchUlAlloc *alloc,
-TfuUeRecpReqInfo *datRecpInfo,
-CmLteTimingInfo *timeInfo,
-Bool hqPres,
-uint16_t validIdx
-));
-
-S16 rgSCHTomUtlFillDatSrsRecpReq ARGS(
-(
-RgSchCellCb *cell,
-RgSchUlAlloc *alloc,
-TfuUeRecpReqInfo *datRecpInfo,
-CmLteTimingInfo *timeInfo,
-Bool hqPres
-));
-
-void schFillCrntTime( SlotTimingInfo slotInd,Inst schInst);
-
-#ifdef CA_DBG
-uint32_t delayedApiCnt;
-uint32_t gPCellTb1AckCount=0,gPCellTb2AckCount=0,gPCellTb1NackCount=0,gPCellTb2NackCount=0;
-uint32_t gSCellSchedCount=0,gPrimarySchedCount=0;
-uint32_t gSCellTb1AckCount=0,gSCellTb2AckCount=0,gSCellTb1NackCount=0,gSCellTb2NackCount=0;
-uint32_t gPCellTb1DtxCount = 0, gPCellTb2DtxCount = 0, gSCellTb1DtxCount = 0, gSCellTb2DtxCount = 0;
-uint32_t gHqFdbkCount = 0;
-
-
-
-uint32_t gCqiRecpCount = 0;
-uint32_t gCqiRecpPuschCount = 0;
-uint32_t gCqiRcvdCount = 0;
-Bool gF1bCsPres = FALSE;
-uint32_t gRiReqCount = 0;
-uint32_t gCqiReqCount = 0;
-uint32_t gF1bCsCount = 0;
-uint32_t gACqiRcvdCount = 0;
-uint32_t gCqiReptToAppCount = 0;
-uint32_t gRawACqiCount= 0;
-uint32_t gCqiDropCount,gPucchDropCount;
-uint32_t gCqiPucchLowSnrDropCount,gCqiPucchConfMaskDropCount,gCqiPuschConfMaskDropCount;
-uint32_t gDci0Count = 0;
-uint32_t gUlCrcFailCount = 0;
-uint32_t gUlCrcPassCount = 0;
-uint32_t gPuschCqiDropCount = 0;
-uint32_t gCaDbgCaFrmt = 0;
-uint32_t gCaDbgNonCaFrmt = 0;
-uint32_t gPcellZeroBoOcc=0,gScellZeroBoOcc=0, dbgDelayedDatReqInMac=0,gDropDatReqCnt=0, gIccPktRcvrMemDropCnt=0;
-#endif
-
-#ifdef EMTC_ENABLE
-uint32_t gUlCrcFailCounter = 0;
-uint32_t gUlCrcPassCounter = 0;
-#endif
-
-#ifdef RG_5GTF
-uint32_t gUl5gtfPdcchSend;
-#endif
-
-#ifdef UNUSED_FUNC
-#ifdef TFU_UPGRADE
-static S16 rgSCHTomUtlFillCqiSrsWithSr ARGS
-((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-TfuRecpReqInfo *recpReqInfo,
-TfuUeRecpReqInfo *pucchRecpInfo,
-uint16_t validIdx
-));
-static Bool rgSCHTomUtlFillDatHarqRecpReq ARGS
-((
-RgSchCellCb *cell,
-RgSchUlAlloc *alloc,
-TfuUeRecpReqInfo *datRecpInfo,
-TfuRecpReqInfo *recpReqInfo
-));
-static S16 rgSCHTomUtlFillSrRecpReq ARGS((
-TfuRecpReqInfo *recpReq,
-RgSchCellCb *cell,
-uint16_t validIdx,
-RgSchErrInfo *err));
-static S16 rgSCHTomUtlFillRiRecpReq ARGS((
-TfuRecpReqInfo *recpReq,
-RgSchCellCb *cell,
-uint16_t validIdx,
-RgSchErrInfo *err));
-static S16 rgSCHTomUtlFillPcqiRecpReq ARGS((
-TfuRecpReqInfo *recpReq,
-RgSchCellCb *cell,
-uint16_t validIdx,
-RgSchErrInfo *err));
-static S16 rgSCHTomUtlFillSrsRecpReq ARGS((
-TfuRecpReqInfo *recpReq,
-RgSchCellCb *cell,
-uint16_t validIdx,
-RgSchErrInfo *err));
-static S16 rgSCHTomUtlGenIndices ARGS((
-uint32_t label,
-uint8_t posM,
-uint8_t valN,
-uint8_t valK,
-TfuSubbandInfo* sbInfo));
-#endif
-static S16 rgSCHTomUtlFillCqiRiRecpReq ARGS(
-(
-TfuRecpReqInfo *recpReqInfo,
-RgSchCellCb *cell,
-uint16_t validIdx,
-RgSchErrInfo *err
-));
-static Void rgSchTomFillCellTtiInfo ARGS
-((
-TfuTtiIndInfo *ttiInd,
-Inst schInst,
-uint8_t *nCell,
-RgSchCellCb *cells[]
-));
-#endif
-
-/* local typedefs */
-uint32_t rgBwAlloInfo[RGSCH_NUM_SUB_FRAMES]; /* Num of Rbs Allocated in each SF */
-uint32_t rgBwAlcnt[RGSCH_NUM_SUB_FRAMES]; /*Num of times Allocation done in each Subframe */
-
-/* local externs */
-/* rg006.201: [ccpu000111706, ccpu00112394]: Separated UL and DL TTI
- * processing */
-#ifdef LTE_L2_MEAS
- uint64_t glblTtiCnt = 0;
-#endif
-uint32_t ri1Cnt ;
-uint32_t ri2Cnt ;
-uint32_t gDlNumUePerTti[20] = {0};
-uint32_t gUlNumUePerTti[20] = {0};
-static S16 rgSCHTomUtlProcDlSf ARGS((
- RgSchDlSf *dlSf,
- RgSchDlSf *ulSf,
- RgSchCellCb *cell,
- RgTfuCntrlReqInfo *cntrlInfo,
- RgSchErrInfo *err));
-#ifdef RG_ULSCHED_AT_CRC
-static S16 rgSCHTomUtlProcDlSfAtCrc ARGS((
- RgSchDlSf *ulSf,
- CmLteTimingInfo crntUlFrm,
- RgSchCellCb *cell,
- TfuCntrlReqInfo *cntrlInfo,
- RgSchErrInfo *err));
-#endif /* RG_ULSCHED_AT_CRC */
-#ifdef LTE_TDD
-#ifdef TFU_UPGRADE
-static S16 rgSCHTomUtlPrcUlTddSpclSf ARGS((
- RgSchCellCb *cell,
- RgSchErrInfo *err));
-#endif /* TFU_UPGRADE */
-#endif
-static S16 rgSCHTomUtlFillPhich ARGS((
- RgSchCellCb *cell,
- TfuCntrlReqInfo *cntrlInfo,
- RgSchDlSf *dlSf,
- RgSchErrInfo *err));
-
-static S16 rgSCHTomUtlFillDlPdcch ARGS((
- RgSchCellCb *cell,
- TfuCntrlReqInfo *cntrlInfo,
- RgSchDlSf *dlSf,
- RgSchErrInfo *err));
-static S16 rgSCHTomUtlFillUlPdcch ARGS((
- RgSchCellCb *cell,
- TfuCntrlReqInfo *cntrlInfo,
- RgSchDlSf *ulSf,
- RgSchErrInfo *err));
-
-static S16 rgSCHTomUtlProcTA ARGS((
- RgSchCellCb *cell));
-#ifdef TFU_UPGRADE
-static S16 rgSCHTomUtlFillHqFdbkRecpReq ARGS((
- TfuRecpReqInfo *recpReq,
- RgSchCellCb *cell,
- uint16_t validIdx,
- RgSchErrInfo *err));
-#else
-static S16 rgSCHTomUtlFillHqFdbkRecpReq ARGS((
- TfuRecpReqInfo *recpReq,
- RgSchCellCb *cell,
- RgSchErrInfo *err));
-#endif
-#ifdef TFU_UPGRADE
-
-S16 rgSCHTomFillOnlySrsRecpReq ARGS
-((
-RgSchCellCb *cell,
-RgSchUlAlloc *alloc,
-TfuUeRecpReqInfo *datRecpInfo
-));
-static S16 rgSCHTomUtlFillCqiSrSrsWithHq ARGS
-((
-RgSchCellCb *cell,
-TfuRecpReqInfo *recpReqInfo,
-RgSchUeCb *ue,
-TfuUeRecpReqInfo *pucchRecpInfo,
-uint16_t validIdx,
-Bool isDatPresOnSecCell
-));
-
-S16 rgSCHTomUtlFillRiBitWidthInfo ARGS
-((
-RgSchUeCb *ueCb
-));
-
-uint8_t rgSCHTomUtlFetchPcqiBitSz ARGS
-((
-RgSchUeCb *ueCb,
-uint8_t numTxAnt,
-uint8_t *ri
-));
-
-uint8_t rgSCHTomUtlFetchPcqiBitSzPucchMode21 ARGS
-((
-RgSchUeCb *ueCb,
-TfuCqiPucchMode21 *mode21Info,
-uint8_t numTxAnt,
-uint8_t *ri
-));
-
-S16 rgSCHTomUtlMoveNxtOccasion ARGS
-((
-RgSchCellCb *cell,
-RgSchUeCb *ueCb,
-uint16_t validIdx
-));
-
-static S16 rgSCHTomUtlMovePcqiNxtOccasion ARGS
-((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchUePCqiCb *cqiCb
-));
-
-static S16 rgSCHTomUtlMovePriNxtOccasion ARGS
-((
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchUePCqiCb *riCb
-));
-
-static S16 rgSCHTomUtlMoveSrNxtOccasion ARGS
-((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-
-static S16 rgSCHTomUtlMoveSrsNxtOccasion ARGS
-((
-RgSchCellCb *cell,
-RgSchUeCb *ue
-));
-static S16 rgSCHTomUtlWillUeRprtCqiRi ARGS((
- RgSchUeCb *ue,
- Bool *willueRprtCqiRii));
-#endif
-#ifdef TFU_UPGRADE
-static S16 rgSCHTomUtlFillDatRecpReq ARGS((
- TfuRecpReqInfo *recpReq,
- RgSchCellCb *cell,
- uint16_t validIdx,
- RgSchErrInfo *err));
-#else
-static S16 rgSCHTomUtlFillDatRecpReq ARGS((
- TfuRecpReqInfo *recpReq,
- RgSchCellCb *cell,
- RgSchErrInfo *err));
-#endif
-
-#ifdef LTE_TDD
-#ifdef TFU_UPGRADE
-static S16 rgSCHTomUtlFillSfRepHqFdbk ARGS((
- TfuRecpReqInfo *recpReqInfo,
- RgSchCellCb *cell,
- RgSchErrInfo *err,
- RgSchDlSf *dlSf,
- uint8_t noFdbks,
- CmMemListCp *memCp,
- uint8_t elemIdx,
- RgSchDlSf *nxtDlsf,
- uint16_t validIdx
- ));
-#else
-static S16 rgSCHTomUtlFillSfRepHqFdbk ARGS((
- TfuRecpReqInfo *recpReqInfo,
- RgSchCellCb *cell,
- RgSchErrInfo *err,
- RgSchDlSf *dlSf,
- uint8_t noFdbks,
- CmMemListCp *memCp,
- uint8_t elemIdx,
- RgSchDlSf *nxtDlsf
- ));
-#endif
-#ifdef TFU_UPGRADE
-static S16 rgSCHTomUtlFillSfHqFdbk ARGS((
- TfuRecpReqInfo *recpReqInfo,
- RgSchCellCb *cell,
- RgSchErrInfo *err,
- RgSchDlSf *dlSf,
- uint8_t noFdbks,
- CmMemListCp *memCp,
- uint8_t elemIdx,
- RgSchDlSf *nxtDlsf,
- uint16_t validIdx
- ));
-#else
-static S16 rgSCHTomUtlFillSfHqFdbk ARGS((
- TfuRecpReqInfo *recpReqInfo,
- RgSchCellCb *cell,
- RgSchErrInfo *err,
- RgSchDlSf *dlSf,
- uint8_t noFdbks,
- CmMemListCp *memCp,
- uint8_t elemIdx,
- RgSchDlSf *nxtDlsf
- ));
-#endif
-
-static S16 rgSCHTomUtlFillSfHqFdbkForOneUe ARGS((
- RgSchDlHqProcCb *hqCb,
- TfuRecpReqInfo *recpReqInfo,
- RgSchCellCb *cellCb,
- RgSchErrInfo *err,
- RgSchDlSf *dlSf,
- uint8_t noFdbks,
- CmMemListCp *memCp,
- uint8_t elemIdx,
- RgSchDlSf *nxtDlsf,
- CmLteRnti rnti,
- RgrTddAckNackMode ackNackMode,
- RgSchUePucchRecpInfo **pucchInfoRef,
- RgSchPdcch *pdcch,
- TknUInt16 n1PucchTkn,
- Bool *allocRef,
- uint8_t hqSz
- ));
-#endif
-#ifdef LTEMAC_SPS
-Void rgSCHCmnDlSpsSch (RgSchCellCb *cell);
-#ifndef LTE_TDD
-#ifdef UNUSED_FUNC
-#ifdef TFU_UPGRADE
-static S16 rgSCHTomCnsdrRelPdcch ARGS
-((
-RgSchCellCb *cell,
-RgSchDlSf *dlSf,
-TfuRecpReqInfo *recpReqInfo,
-uint16_t validIdx,
-RgSchErrInfo *err
-));
-#else
-static S16 rgSCHTomCnsdrRelPdcch ARGS
-((
- RgSchCellCb *cell,
- RgSchDlSf *dlSf,
- TfuRecpReqInfo *recpReqInfo,
- RgSchErrInfo *err
- ));
-#endif
-#endif
-#endif
-#endif
-
-static Void rgSchTomTtiMiscFunctions ARGS
-((
-RgSchCellCb *cell
-));
-
-static Void rgSchTomTtiUlAndDlCmnChSch ARGS
-((
-RgSchCellCb *cell
-));
-
-static Void rgSchTomTtiDlSch ARGS
-((
-RgSchCellCb *cell
-));
-
-static Void rgSchTomTtiCnsldtSfAlloc ARGS
-((
-RgSchCellCb *cell
-));
-
-static Void rgSchTomTtiL1DlAndUlCfg ARGS
-((
-RgSchCellCb *cell,
-RgTfuCntrlReqInfo *cntrlInfo
-));
-
-#ifdef RGR_RRM_TICK
-static Void rgSCHTomUtlSendSfnTick ARGS
-((
-RgSchCellCb *cell
-));
-#endif
-#ifdef LTE_TDD
-static Void rgSchTomUtlTddRlsSfAndHarq ARGS
-((
-RgSchCellCb *cell
-));
-static Void rgSCHTomUtlProcTddUlSf ARGS
-((
-RgSchCellCb *cell
-));
-#ifdef LTE_ADV
-static Void rgSCHTomUtlGethqRes ARGS
-((
-uint8_t noFdbks,
-RgSchDlSf *dlSf,
-RgSchPdcch *pdcch,
-RgSchCellCb *cellCb,
-uint16_t *hqRes
-));
-static Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1 ARGS
-((
-RgSchDlHqProcCb *hqCb,
-TfuUePucchRecpReq *hqRecpReq,
-uint8_t noFdbks,
-RgSchDlSf *dlSf,
-RgSchPdcch *pdcch,
-RgSchCellCb *cellCb
-));
-static Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234 ARGS
-((
-RgSchDlHqProcCb *hqCb,
-TfuUePucchRecpReq *hqRecpReq,
-uint8_t noFdbks,
-RgSchDlSf *dlSf,
-RgSchPdcch *pdcch,
-RgSchCellCb *cellCb,
-uint8_t elemIdx
-));
-#endif/*LTE_ADV*/
-#endif/*LTE_TDD*/
-
-uint32_t rgDlCqiRptCnt[16], rgTotDlCqiRpt;
-
-#ifdef RG_5GTF
-uint32_t rgSch5gtfCqi2Mcs[15] =
- {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14};
-#endif
-/* forward references */
-#ifdef TFU_UPGRADE
-/*HARQ Feedback interpretation in accordance with Femto Forum.
-Note: There is no value as '0' in Femto Forum Spec but in order to retain
-the existing usage in MAC (and its Acceptance), its being considered*/
-//const static uint8_t rgSchTomHqFbkMap[8] = {0,1,0,0,4,4,4,4};
-/*added #defines instead of magic numbers*/
-/*const static uint32_t rgSCHTomBinCoe[RG_SCH_MAX_NUM_UE_SEL_SUBBANDS][RG_SCH_MAX_TOT_NUM_SUBBANDS]={
-{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28},
-{0,1,3,6,10,15,21,28,36,45,55,66,78,91,105,120,136,153,171,190,210,231,253,276,300,325,351,378},
-{0,0,1,4,10,20,35,56,84,120,165,220,286,364,455,560,680,816,969,1140,1330,1540,1771,2024,2300,2600,2925,3276},
-{0,0,0,1,5,15,35,70,126,210,330,495,715,1001,1365,1820,2380,3060,3876,4845,5985,7315,8855,10626,12650,14950,17550,20475},
-{0,0,0,0,1,6,21,56,126,252,462,792,1287,2002,3003,4368,6188,8568,11628,15504,20349,26334,33649,42504,53130,65780,80730,98280},
-{0,0,0,0,0,1,7,28,84,210,462,924,1716,3003,5005,8008,12376,18564,27132,38760,54264,74613,100947,134596,177100,230230,296010,376740}
-};
-*/
-
-/*ccpu00116923 - ADD - SRS present support*/
-/*Tables Derived from 3GPP TS 36.211 Section 5.5.3.3 */
-/* Table 5.5.3.3-1 */
-#ifndef LTE_TDD
-const RgSchFddCellSpSrsSubfrmTbl rgSchFddCellSpSrsSubfrmTbl = {
- {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE},
- {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE},
- {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE},
- {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE},
- {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
- {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE},
- {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE},
- {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE},
- {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE},
- {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
- {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
- {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
- {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
- {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE},
- {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE},
- {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}
-};
-#else
-/* Table 5.5.3.3-2 */
-const RgSchTddCellSpSrsSubfrmTbl rgSchTddCellSpSrsSubfrmTbl = {
- {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
- {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE},
- {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE},
- {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE},
- {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE},
- {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE},
- {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE},
- {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE},
- {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
- {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
- {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE},
- {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE},
- {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE},
- {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE},
- {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
- {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}
-};
-#endif
-S8 rgSchCmnAper20n22DiffCqi[4] = {1, 2, 3, 4};
-S8 rgSchCmnAper30n31DiffCqi[4] = {0, 1, 2, -1};
-#endif
-
-/**
- * @brief get Ue for dedicated preamble rach
- *
- * @details
- *
- * Function: rgSCHGetDedPrmUe
- *
- * Invoked by: rgSCHTomRaReqInd
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] TfuRaReqIndInfo *raReqInd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHGetDedPrmUe
-(
-RgSchCellCb *cell,
-uint16_t rapId,
-CmLteTimingInfo timingInfo,
-RgSchUeCb **ue
-)
-{
- RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch);
-
- DU_LOG("\nINFO --> SCH : rapId[%d] cellSch->rachCfg.dedPrmStart[%d] cellSch->rachCfg.numDedPrm[%d]\n",\
- rapId,cellSch->rachCfg.dedPrmStart,cellSch->rachCfg.numDedPrm);
- /* Finding UE in handOver List */
- if ((rapId < cellSch->rachCfg.dedPrmStart) ||
- (rapId > cellSch->rachCfg.dedPrmStart +
- cellSch->rachCfg.numDedPrm - 1))
- {
- /* This ded Preamble corresponds to handover */
- *ue = rgSCHCmnGetHoUe(cell, rapId);
- DU_LOG("\nDEBUG --> SCH : ded Preamble corresponds to handover\n");
- }
- else/* Finding UE from PDCCH Order Mappings */
- {
- /* Get the UE which has transmitted this RaReq */
- *ue = rgSCHCmnGetPoUe(cell, rapId, timingInfo);
- DU_LOG("\nDEBUG --> SCH : UE from PDCCH Order Mapping\n");
- }
- return ROK;
-}
-/**
- * @brief Handler for processing Random Access request indication
- * recieved from PHY.
- *
- * @details
- *
- * Function: rgSCHTomRaReqInd
- *
- * Handler for processing Random Access request indication recieved from
- * PHY.
- *
- * Invoked by: RgLiTfuRaReqInd of LIM
- *
- * Processing Steps:
- * - Validate the information received: cellId value and raRnti values
- * - Process the request: Call rgSCHRamProcRaReq (cell, raRnti, raReqInd)
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] TfuRaReqIndInfo *raReqInd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHTomRaReqInd
-(
-RgSchCellCb *cell,
-TfuRaReqIndInfo *raReqInd
-)
-{
- S16 ret;
- uint8_t raRntiCnt;
- uint8_t raReqCnt;
- RgSchErrInfo err;
- Bool isEmtcUe = FALSE;
- uint16_t rapId;
- RgSchUeCb *ue = NULLP;
-
- if(cell->cellId != raReqInd->cellId)
- {
- err.errType = RGSCHERR_TOM_RAREQIND;
- err.errCause = RGSCHERR_TOM_INV_CELL_ID;
- DU_LOG("\nERROR --> SCH : rgSCHTomRaReqInd(): No cell found with raReq cellId = (%d) errorType (%d)"
- " errorCause(%d)",raReqInd->cellId, err.errType, err.errCause);
- return RFAILED;
- }
-
- for (raRntiCnt = 0; raRntiCnt < raReqInd->nmbOfRaRnti; raRntiCnt++)
- {
- for (raReqCnt = 0; raReqCnt < raReqInd->rachInfoArr->numRaReqInfo; raReqCnt++)
- {
- rapId = raReqInd->rachInfoArr[raRntiCnt].raReqInfoArr[raReqCnt].rapId;
-
- if(RGSCH_IS_DEDPRM(cell, rapId))
- {
- rgSCHGetDedPrmUe(cell, rapId, raReqInd->timingInfo, &ue);
- if(NULLP == ue)
- {
- /* Since rapId is within dedicated range and No ue context
- * is found means it is a spurious rach. So ignore it.*/
- continue;
- }
- }
-
- if(FALSE == isEmtcUe)
- {
-#if (ERRCLASS & ERRCLS_DEBUG)
- if(raReqInd->rachInfoArr[raRntiCnt].raRnti > RGSCH_MAX_RA_RNTI)
- {
- DU_LOG("\nERROR --> SCH : rgSCHTomRaReqInd(): raRnti is out of range\n");
- continue;
- }
-#endif
- ret = rgSCHRamProcRaReq(raReqCnt, cell, raReqInd->rachInfoArr[raRntiCnt].raRnti,
- (TfuRachInfo *)&raReqInd->rachInfoArr[raRntiCnt],
- raReqInd->timingInfo, ue, &err);
- if(ret == RFAILED)
- {
- err.errType = RGSCHERR_TOM_RAREQIND;
- DU_LOG("\nERROR --> SCH : RARNTI:%d rgSCHTomRaReqInd(): RAM processing failed errType(%d) "
- "errCause(%d)", raReqInd->rachInfoArr[raRntiCnt].raRnti,
- err.errType, err.errCause);
- continue;
- }
- }
- }
- }
- return ROK;
-} /* rgSCHTomRaReqInd */
-
-
-/**
- * @brief Handler for processing uplink CQI indication recieved from PHY.
- *
- * @details
- *
- * Function: rgSCHTomUlCqiInd
- *
- * Handler for processing uplink CQI indication recieved from PHY.
- *
- * Invoked by: RgLiTfuUlCqiInd
- *
- * Processing Steps:
- * - Gets UE
- * - Invoke scheduler to push reported CQI info rgSCHUtlUlCqiInd
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] TfuUlCqiIndInfo *ulCqiInd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHTomUlCqiInd
-(
-RgSchCellCb *cell,
-TfuUlCqiIndInfo *ulCqiInd
-)
-{
- RgSchUeCb *ue;
- CmLList *node;
- TfuUlCqiRpt *ulCqiInfo;
-
- node = ulCqiInd->ulCqiRpt.first;
- if(cell->cellId != ulCqiInd->cellId)
- {
- DU_LOG("\nERROR --> SCH : rgSCHTomUlCqiInd() Unable to get the ulCqiInd cell with id(%d)",
- ulCqiInd->cellId);
- return RFAILED;
- }
-
- for (;node; node=node->next)
- {
- ulCqiInfo = (TfuUlCqiRpt *)node->node;
-#if (ERRCLASS & ERRCLS_DEBUG)
- if(ulCqiInfo->numSubband == 0)
- {
- DU_LOG("\nERROR --> SCH : Num Subband is"
- "out of range RNTI:%d",ulCqiInfo->rnti);
- continue;
- }
-#endif
- if((ue = rgSCHDbmGetUeCb(cell, ulCqiInfo->rnti)) == NULLP)
- {
-#ifdef LTEMAC_SPS
- if((ue = rgSCHDbmGetSpsUeCb(cell, ulCqiInfo->rnti)) == NULLP)
-#endif
- {
- DU_LOG("\nERROR --> SCH : Unable to get the ue for RNTI:%d", ulCqiInfo->rnti);
- continue;
- }
- }
- /* wideband cqi is directly reported now. and also isTxPort0 */
- rgSCHUtlUlCqiInd(cell, ue, ulCqiInfo);
- }
- return ROK;
-} /* rgSCHTomUlCqiInd */
-
-/**
- * @brief Handler for processing PUCCH power adjustment indication
- *
- * @details
- *
- * Function: rgSCHTomPucchDeltaPwrInd
- *
- * Handler for processing PUCCH power adjustment indication
- * received from PHY.
- *
- * Invoked by: RgLiTfuPucchDeltaPwrInd
- *
- * Processing Steps:
- * - Gets UE
- * - Invoke scheduler to push reported CQI info rgSCHUtlPucchDeltaPwrInd
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHTomPucchDeltaPwrInd
-(
-RgSchCellCb *cell,
-TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
-)
-{
- RgSchUeCb *ue;
- CmLList *node;
- TfuPucchDeltaPwr *ueElem;
-
- if(cell->cellId != pucchDeltaPwr->cellId)
- {
- DU_LOG("\nERROR --> SCH : rgSCHTomPucchDeltaPwrInd() Unable to get the pucchDeltaPwr cell with id(%d)",
- pucchDeltaPwr->cellId);
- return RFAILED;
- }
-
- node = pucchDeltaPwr->pucchDeltaPwrLst.first;
- for (;node; node=node->next)
- {
- ueElem = (TfuPucchDeltaPwr *)node->node;
- if((ue = rgSCHDbmGetUeCb(cell, ueElem->rnti)) == NULLP)
- {
-#ifdef LTEMAC_SPS
- if((ue = rgSCHDbmGetSpsUeCb(cell, ueElem->rnti)) == NULLP)
-#endif
- {
- DU_LOG("\nERROR --> SCH : RNTI:%d "
- "rgSCHTomPucchDeltaPwrInd() Unable to get the ue ",
- ueElem->rnti);
- continue;
- }
- }
- rgSCHUtlPucchDeltaPwrInd(cell, ue, ueElem->pucchDeltaPwr);
- }
- return ROK;
-} /* rgSCHTomPucchDeltaPwrInd */
-
-/**
- * @brief Handler for processing harq ACK/NACK indication recieved from PHY.
- *
- * @details
- *
- * Function: rgSCHTomHarqAckInd
- *
- * Handler for processing harq ACK/NACK indication recieved from PHY.
- *
- * Invoked by: RgLiTfuHqInd
- *
- * Processing Steps:
- * For each HqAckInfo received
- * - Get UE
- * - If UE doesnt exist look for a RaCb and invoke rgSCHRamMsg4FdbkInd
- * - Invoke HARQ module to pass HARQ-ACK info rgSCHDhmHqFdbkInd
- *
- * @param[in] TfuHqIndInfo *harqAckInd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHTomHarqAckInd
-(
-RgSchCellCb *cell,
-TfuHqIndInfo *harqAckInd
-)
-{
- RgSchErrInfo err;
- RgSchUeCb *ue;
- RgSchRaCb *raCb;
- CmLList *node;
- TfuHqInfo *hqInfo;
- Pst pst;
- // uint8_t tbCnt;
-
- RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
- uint32_t cellIdx;
- RgSchCellCb *iterCellP;
-
- if(cell->cellId != harqAckInd->cellId)
- {
- DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() Unable to get"
- " the cell for cellId (%d)", harqAckInd->cellId);
- err.errType = RGSCHERR_TOM_HARQACKIND;
- err.errCause = RGSCHERR_TOM_INV_CELL_ID;
- return RFAILED;
- }
-#ifdef RG_5GTF
- node = harqAckInd->hqIndLst.first;
- for (;node; node=node->next)
- {
- hqInfo = (TfuHqInfo *)node->node;
- {
- rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
- TfuHqFdbk fdbk = hqInfo->isAck[0];
- raCb = rgSCHDbmGetRaCb (cell, hqInfo->rnti);
- ue = rgSCHDbmGetUeCb (cell, hqInfo->rnti);
- if (ue != NULLP && raCb == NULLP)
- {
- if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, harqAckInd->timingInfo, fdbk, &err)) != ROK)
- {
- err.errType = RGSCHERR_TOM_HARQACKIND;
- DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() "
- "HARQ feedback processing failed errType(%d)errCause(%d)n",
- err.errType, err.errCause);
- continue;
- }
- }
- }
-
- }
-
- if ((rgSCHDhmRlsDlsfHqProc (cell, harqAckInd->timingInfo)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to Release Downlink "
- "subframe for cellId (%d) ", cell->cellId);
- err.errType = RGSCHERR_TOM_HARQACKIND;
- }
-
- for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
- {
- if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
- {
- iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
-
- rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
- if(rlsHqBufs->numUes)
- {
- rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
- RgSchMacRlsHq (&pst, rlsHqBufs);
- }
- rlsHqBufs->numUes = 0;
- }
- }
-#else
- rlsHqBufs->numUes = 0;
- node = harqAckInd->hqIndLst.first;
- for (;node; node=node->next)
- {
- hqInfo = (TfuHqInfo *)node->node;
- for(tbCnt=0; tbCnt<TFU_MAX_HARQ_FDBKS; tbCnt++)
- {
- hqInfo->isAck[tbCnt]=(TfuHqFdbk)rgSchTomHqFbkMap[hqInfo->isAck[tbCnt]];
- }
- raCb = rgSCHDbmGetRaCb (cell, hqInfo->rnti);
- ue = rgSCHDbmGetUeCb (cell, hqInfo->rnti);
- if (ue == NULLP && raCb != NULLP)
- {
-#ifdef RG_UNUSED
- rgSCHRamMsg4FdbkInd (raCb);
-#endif
- if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
- cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
- {
- err.errType = RGSCHERR_TOM_HARQACKIND;
- DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() HARQ"
- " feedback processing failed errType(%d) errCause(%d)",
- err.errType, err.errCause);
- continue;
- }
- continue;
- }
- else if (ue != NULLP && raCb == NULLP)
- {
- /* Get the Downlink HARQ entity from ue */
- if ((rgSCHDhmHqFdbkInd (ue, RGSCH_HQ_FDB_IND_CB_TYPE_HQ_ENT,
- cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
- {
- err.errType = RGSCHERR_TOM_HARQACKIND;
- DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() "
- "HARQ feedback processing failed errType(%d)errCause(%d)n",
- err.errType, err.errCause);
- continue;
- }
- }
- else if (ue != NULLP && raCb != NULLP)
- {
- if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
- cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
- {
- err.errType = RGSCHERR_TOM_HARQACKIND;
- DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() HARQ"
- " feedback processing failed errType(%d) errCause(%d).",
- err.errType, err.errCause);
- continue;
- }
- }
- else
- {
- DU_LOG("\nERROR --> SCH : RNTI:%d Unable to get the "
- "UE CB or RA CB ", hqInfo->rnti);
- err.errType = RGSCHERR_TOM_HARQACKIND;
- continue;
- }
- }
-
- /* Check with TDD call DHM*/
- if ((rgSCHDhmRlsDlsfHqProc (cell, harqAckInd->timingInfo)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to Release Downlink "
- "subframe for cellId (%d) ", harqAckInd->cellId);
- err.errType = RGSCHERR_TOM_HARQACKIND;
- }
-
- for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
- {
- if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
- {
- iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
-
- rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
- if(rlsHqBufs->numUes)
- {
- rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
- RgSchMacRlsHq (&pst, rlsHqBufs);
- }
- rlsHqBufs->numUes = 0;
- }
- }
-#endif
- return ROK;
-} /* rgSCHTomHarqAckInd */
-
-
-/**
- * @brief Handler for processing Scheduling Request indication
- * recieved from PHY for a list of UEs.
- *
- * @details
- *
- * Function: rgSCHTomSrInd
- *
- * Handler for processing Scheduling Request indication recieved from PHY
- * for UEs.
- *
- * Invoked by: RgLiTfuSrInd
- *
- * Processing Steps:
- * - Get UE
- * - Invoke scheduler to indicate SR rgSCHUtlSrRcvd
- *
- * @param[in] TfuSrIndInfo *srInd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHTomSrInd
-(
-RgSchCellCb *cell,
-TfuSrIndInfo *srInd
-)
-{
- S16 ret = RFAILED;
- RgSchErrInfo err;
- RgSchUeCb *ue;
- CmLList *node;
- TfuSrInfo *srInfo;
-
- if(cell->cellId != srInd->cellId)
- {
- DU_LOG("\nERROR --> SCH : Unable to get the cell for srcInd cellId"
- ":%d ", srInd->cellId);
- err.errType = RGSCHERR_TOM_SRIND;
- err.errCause = RGSCHERR_TOM_INV_CELL_ID;
- return RFAILED;
- }
-
-
- node = srInd->srLst.first;
- for (;node; node=node->next)
- {
- rgNumSrRecvd++;
-
- srInfo = (TfuSrInfo *)node->node;
- ue = rgSCHDbmGetUeCb (cell, srInfo->rnti);
- if (ue == NULLP)
- {
- DU_LOG("\nERROR --> SCH : RNTI:%d Unable to get the UE CB",
- srInfo->rnti);
- continue;
- }
- rgSCHUtlHdlUlTransInd(cell, ue, srInd->timingInfo);
- /*Need to activate UE as SR received*/
- if (ue->isDrxEnabled)
- {
- rgSCHDrxSrInd(cell, ue);
- }
- ret = rgSCHUtlSrRcvd (cell, ue, srInd->timingInfo, &err);
- if (ret != ROK)
- {
- err.errType = RGSCHERR_TOM_SRIND;
- DU_LOG("\nERROR --> SCH : Scheduler processing failed "
- "errType(%d) errCause(%d) RNTI:%d", err.errType, err.errCause,srInfo->rnti);
- continue;
- }
- }
- return ROK;
-} /* end of rgSCHTomSrInd */
-
-/**
- * @brief Handler for processing downlink CQI indication recieved from
- * PHY for a UE.
- *
- * @details
- *
- * Function: rgSCHTomDoaInd
- *
- * Handler for processing DOA recieved from PHY
- * for a set of UEs.
- *
- * Invoked by: RgLiTfuDoaInd
- *
- * Processing Steps:
- * - Get UE
- * - Invoke scheduler to indicate DOA rgSCHUtlDoaInd
- *
- * @param[in] TfuDoaIndInfo *doaInd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHTomDoaInd
-(
-RgSchCellCb *cell,
-TfuDoaIndInfo *doaInd
-)
-{
- RgSchUeCb *ue;
- CmLList *node;
- TfuDoaRpt *doaInfo;
-
- if(cell->cellId != doaInd->cellId)
- {
- DU_LOG("\nERROR --> SCH : Unable to get the cell for doaInd cellId"
- ":%d", doaInd->cellId);
- return RFAILED;
- }
-
-
- node = doaInd->doaRpt.first;
- for (;node; node=node->next)
- {
- doaInfo = (TfuDoaRpt *)node->node;
- ue = rgSCHDbmGetUeCb (cell, doaInfo->rnti);
- if (ue == NULLP)
- {
- DU_LOG("\nERROR --> SCH : RNTI:%d Unable to get the UE CB",
- doaInfo->rnti);
- continue;
- }
- rgSCHUtlDoaInd(cell, ue, doaInfo);
- }
- return ROK;
-} /* rgSCHTomDoaInd */
-/**
- * @brief Handler for processing downlink CQI indication recieved from
- * PHY for a UE.
- *
- * @details
- *
- * Function: rgSCHTomDlCqiInd
- *
- * Handler for processing downlink CQI indication recieved from PHY
- * for a set of UEs.
- *
- * Invoked by: RgLiTfuDlCqiInd
- *
- * Processing Steps:
- * - Get UE
- * - Invoke scheduler to indicate DL CQI rgSCHUtlDlCqiInd
- *
- * @param[in] TfuDlCqiIndInfo *dlCqiInd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHTomDlCqiInd
-(
-RgSchCellCb *cell,
-TfuDlCqiIndInfo *dlCqiInd
-)
-{
- RgSchUeCb *ue;
- CmLList *node;
- TfuDlCqiRpt *dlCqiInfo;
-
- if(cell->cellId != dlCqiInd->cellId)
- {
- DU_LOG("\nERROR --> SCH : Unable to get the cell for cellId"
- ":%d", dlCqiInd->cellId);
- return RFAILED;
- }
-
-
- node = dlCqiInd->dlCqiRptsLst.first;
- for (;node; node=node->next)
- {
- dlCqiInfo = (TfuDlCqiRpt *)node->node;
- ue = rgSCHDbmGetUeCb (cell, dlCqiInfo->rnti);
- if (ue == NULLP)
- {
- DU_LOG("\nERROR --> SCH : RNTI:%dUnable to get the UE CB",
- dlCqiInfo->rnti);
- continue;
- }
- rgSCHUtlDlCqiInd(cell, ue, dlCqiInfo, dlCqiInd->timingInfo);
- rgSCHUtlHdlUlTransInd(cell, ue, dlCqiInd->timingInfo);
- }
- return ROK;
-} /* rgSCHTomDlCqiInd */
-
-/**
- * @brief Handler for moving PCQI instance for the next periodic occasion
- *
- * @details
- *
- * Function: rgSCHTomUtlMovePcqiNxtOccasion
- *
- * Handler for moving PCQI instance for the next periodic occasion
- *
- * Invoked by: rgSCHTomUtlFill*
- *
- * Processing Steps:
- * - For a UE move its occurence instance to next occasion
- * depending on its periodicity
- * - Remove it from the current list and insert it to the list
- * having the index matching with the derived number.
- *
- * @param[in] RgSchCellCb *cell,
- * [in] RgSchUeCb *ue
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHTomUtlMovePcqiNxtOccasion
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchUePCqiCb *cqiCb
-)
-{
- uint16_t cqiIdx = 0;
-
- CmLteTimingInfo timingInfo;
-
- if(cqiCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_SB_REP)
- {
-#ifdef xLTE_TDD
- RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timingInfo, TFU_DELTA);
-#else
- RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timingInfo,
- TFU_RECPREQ_DLDELTA);
-#endif
- RG_SCH_ADD_TO_CRNT_TIME(timingInfo,timingInfo,cqiCb->cqiPeri);
- rgSCHTomUtlPcqiSbCalcBpIdx(timingInfo,ue,cqiCb);
- }
- /* Compute Next Transmission Instance */
- cqiIdx = cqiCb->cqiPeri + cqiCb->nCqiTrIdx;
- cqiIdx = cqiIdx%RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
- /* Delete from current List and move to new list */
- if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst,
- &cqiCb->cqiLstEnt))
- {
- DU_LOG("\nERROR --> SCH : RNTI:%d Unable to remove node",
- ue->ueId);
- }
- cqiCb->nCqiTrIdx = cqiIdx;
- cmLListAdd2Tail(&(cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst),
- &(cqiCb->cqiLstEnt));
-#ifdef LTE_ADV
- rgSCHUtlSCellHndlCqiCollsn(cqiCb);
-#endif
-
- return ROK;
-} /* rgSCHTomUtlMovePcqiNxtOccasion */
-
-/**
- * @brief Handler for moving RI instance for the next periodic occasion
- *
- * @details
- *
- * Function: rgSCHTomUtlMovePriNxtOccasion
- *
- * Handler for moving PCQI instance for the next periodic occasion
- *
- * Invoked by: rgSCHTomUtlFill*
- *
- * Processing Steps:
- * - For a UE move its occurence instance to next occasion
- * depending on its periodicity
- * - Remove it from the current list and insert it to the list
- * having the index matching with the derived number.
- *
- * @param[in] RgSchCellCb *cell,
- * [in] RgSchUeCb *ue
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHTomUtlMovePriNxtOccasion
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchUePCqiCb *riCb
-)
-{
- uint16_t riIdx;
- uint16_t riDist=0;
- uint16_t effPeriodicity;
- uint16_t riTrInsTime;
- uint16_t crntTime;
- uint16_t tempIdx;
-
- crntTime = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)
- +(cell->crntTime.slot);
-#ifdef XEON_SPECIFIC_CHANGES
- RGSCHCPYTIMEINFO(cell->crntTime, ue->riRecpTime);
-#endif
- /* Compute Next Transmission Instance */
- if (riCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_WB_REP)
- {
- effPeriodicity = riCb->cqiPeri * riCb->riPeri;
- tempIdx = effPeriodicity + riCb->nRiTrIdx;
- }
- else
- {
- effPeriodicity = (riCb->h * riCb->cqiPeri * riCb->riPeri);
- /* In case of SFN wraparound, the SB CQI reporting cycle breaks
- * and RI->WB CQI->SBCQI.. should resume. RI is repositioned
- * accordingly. WBCQI handling is naturally accomplished */
- if ((crntTime + TFU_RECPREQ_DLDELTA + effPeriodicity) >
- (RGSCH_MAX_SUBFRM_5G - 1))
- {
- riTrInsTime = (effPeriodicity - riCb->cqiOffset + riCb->riOffset) % effPeriodicity;
- tempIdx = RGSCH_MAX_SUBFRM_5G + (effPeriodicity - riTrInsTime);
- /* In case of SFN wraparound, riDist should be distance from crntTime
- * + TFU_RECPREQ_DLDELTA to tempIdx. Updating effPeriodicity
- * to make riDist calculation consistent for both SFN wraparound
- * case and normal case */
- effPeriodicity = tempIdx - TFU_RECPREQ_DLDELTA - crntTime;
- }
- else
- {
- tempIdx = effPeriodicity + riCb->nRiTrIdx;
- }
- }
- riIdx = tempIdx % RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
- if (effPeriodicity >= RG_SCH_PCQI_SRS_SR_TRINS_SIZE)
- {
- riDist = rgSCHUtlFindDist((uint16_t)(crntTime + TFU_RECPREQ_DLDELTA),
- (uint16_t)(crntTime + TFU_RECPREQ_DLDELTA + effPeriodicity));
- }
- else
- {
- riDist = 0;
- }
-
- /* ccpu00138306- If Periodicity is equal to Queue Size or multiple of it
- * then the next occasion idx will be same as current Idx, Hence need not
- * to delete and add
- */
- if((effPeriodicity%RG_SCH_PCQI_SRS_SR_TRINS_SIZE) != 0)
- {
- /* Delete from current List and move to new list */
- if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[riCb->nRiTrIdx].riLst,
- &riCb->riLstEnt))
- {
- DU_LOG("\nERROR --> SCH : [%d]UEID:Unable to remove node",
- ue->ueId);
- }
- RG_SCH_RECORD(&riCb->histElem,RGSCH_ACTION_DEL, &cell->pCqiSrsSrLst[riCb->nRiTrIdx].riLst);
- cmLListAdd2Tail(&cell->pCqiSrsSrLst[riIdx].riLst,
- &riCb->riLstEnt);
- RG_SCH_RECORD(&riCb->histElem,RGSCH_ACTION_ADD, &cell->pCqiSrsSrLst[riIdx].riLst);
- }
- else
- {
- if(riDist > 0)
- {
- riDist--;
- }
- }
- riCb->nRiTrIdx = riIdx;
- riCb->riDist = riDist;
-
-#ifdef LTE_ADV
- rgSCHUtlSCellHndlRiCollsn(riCb);
-#endif
- return ROK;
-} /* rgSCHTomUtlMovePriNxtOccasion */
-
-/**
- * @brief Handler for moving SR instance for the next periodic occasion
- *
- * @details
- *
- * Function: rgSCHTomUtlMoveSrNxtOccasion
- *
- * Handler for moving SR instance for the next periodic occasion
- *
- * Invoked by: rgSCHTomUtlFill*
- *
- * Processing Steps:
- * - For a UE move its occurence instance to next occasion
- * depending on its periodicity
- * - Remove it from the current list and insert it to the list
- * having the index matching with the derived number.
- *
- * @param[in] RgSchCellCb *cell,
- * [in] RgSchUeCb *ue
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHTomUtlMoveSrNxtOccasion
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue
-)
-{
- uint16_t srIdx = 0;
-
- /* Compute Next Transmission Instance */
- srIdx = ue->srCb.peri + ue->srCb.nSrTrIdx;
- srIdx = srIdx%RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
- /* Delete from current List and move to new list */
- if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[ue->srCb.nSrTrIdx].srLst,
- &ue->srCb.srLstEnt))
- {
- DU_LOG("\nERROR --> SCH : RNTI:%d Unable to remove node",
- ue->ueId);
- }
- ue->srCb.nSrTrIdx = srIdx;
- cmLListAdd2Tail(&cell->pCqiSrsSrLst[ue->srCb.nSrTrIdx].srLst,
- &ue->srCb.srLstEnt);
-
- return ROK;
-} /* rgSCHTomUtlMoveSrNxtOccasion */
-
-/**
- * @brief Handler for moving SRS instance for the next periodic occasion
- *
- * @details
- *
- * Function: rgSCHTomUtlMoveSrsNxtOccasion
- *
- * Handler for moving SRS instance for the next periodic occasion
- *
- * Invoked by: rgSCHTomUtlFill*
- *
- * Processing Steps:
- * - For a UE move its occurence instance to next occasion
- * depending on its periodicity
- * - Remove it from the current list and insert it to the list
- * having the index matching with the derived number.
- *
- * @param[in] RgSchCellCb *cell,
- * [in] RgSchUeCb *ue
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHTomUtlMoveSrsNxtOccasion
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue
-)
-{
- uint16_t srsIdx;
- uint16_t srsDist;
- uint16_t tempIdx;
- uint16_t crntTime;
-
-
- crntTime = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)
- +(cell->crntTime.slot);
-
- /* Compute Next Transmission Instance */
- tempIdx = ue->srsCb.peri + ue->srsCb.nSrsTrIdx;
- srsIdx = tempIdx %RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
- if (ue->srsCb.peri > RG_SCH_PCQI_SRS_SR_TRINS_SIZE)
- {
- srsDist = rgSCHUtlFindDist((uint16_t)(crntTime + TFU_RECPREQ_DLDELTA),
- (uint16_t)(crntTime + TFU_RECPREQ_DLDELTA + ue->srsCb.peri));
- }
- else
- {
- srsDist =0;
- }
-
- /* ccpu00138306- If Periodicity is equal to Queue Size or multiple of it
- * then the next occasion idx will be same as current Idx, Hence need not
- * to delete and add
- */
- if((ue->srsCb.peri%RG_SCH_PCQI_SRS_SR_TRINS_SIZE) != 0)
- {
- /* Delete from current List and move to new list */
- if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[ue->srsCb.nSrsTrIdx].srsLst,
- &ue->srsCb.srsLstEnt))
- {
- DU_LOG("\nERROR --> SCH : RNTI:%d Unable to remove node",
- ue->ueId);
- }
- cmLListAdd2Tail(&cell->pCqiSrsSrLst[srsIdx].srsLst,
- &ue->srsCb.srsLstEnt);
- }
- else
- {
- if(srsDist > 0)
- {
- srsDist--;
- }
- }
- ue->srsCb.nSrsTrIdx = srsIdx;
- ue->srsCb.srsDist = srsDist;
- return ROK;
-} /* rgSCHTomUtlMoveSrsNxtOccasion */
-
-
-/**
- * @brief Handler for processing RAW CQI indication recieved from
- * PHY for a UE.
- *
- * @details
- *
- * Function: rgSCHTomRawCqiInd
- *
- * Handler for processing RAW CQI indication recieved from PHY
- * for a set of UEs.
- *
- * Invoked by: RgLiTfuRawCqiInd
- *
- * Processing Steps:
- * - Get UE
- * - Invoke scheduler to indicate Raw CQI rgSCHUtlRawCqiInd
- *
- * @param[in] TfuRawCqiIndInfo *rawCqiInd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHTomRawCqiInd
-(
-RgSchCellCb *cell,
-TfuRawCqiIndInfo *rawCqiInd
-)
-{
- RgSchUeCb *ue;
- CmLList *node;
- TfuRawCqiRpt* rawCqiInfo;
-
- RgSchErrInfo err;
- uint32_t cellIdx;
- RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
- RgSchCellCb *iterCellP;
-#if DL_LA
- RgSchCmnDlUe *ueDl;
-#endif
- uint8_t cqi;
- uint8_t ri;
- uint8_t hqAck;
- Pst pst;
- RgSchRaCb *raCb;
- TfuHqInfo hqInfo;
-
- if(cell->cellId != rawCqiInd->cellId)
- {
- DU_LOG("\nERROR --> SCH : Unable to get the cell for cellId"
- ":%d", rawCqiInd->cellId);
- return RFAILED;
- }
-
-
- node = rawCqiInd->rawCqiRpt.first;
- for (;node; node=node->next)
- {
- rawCqiInfo = (TfuRawCqiRpt *)node->node;
- ue = rgSCHDbmGetUeCb (cell, rawCqiInfo->crnti);
- raCb = rgSCHDbmGetRaCb (cell, rawCqiInfo->crnti);
- /*
- if (ue == NULLP)
- {
- DU_LOG("\nERROR --> SCH : CRNTI:%d Unable to get the UECB",
- rawCqiInfo->crnti);
- continue;
- }
- */
-#ifdef RG_5GTF
- /*
- if (rawCqiInfo->numBits >= 5)
- DU_LOG("\nINFO --> SCH : cellId [%d] crnti [%d] numBits [%d] uciPayload [0x%08x] sfn/sf [%d:%d]\n",
- cell->cellId, rawCqiInfo->crnti, rawCqiInfo->numBits, rawCqiInfo->uciPayload,
- rawCqiInd->timingInfo.sfn, rawCqiInd->timingInfo.slot);
- */
- if (rawCqiInfo->numBits == 1)
- {
- rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
- uint8_t fdbk = TFU_HQFDB_NACK;
- /* Process HARQ FdbkInd */
- hqAck = (rawCqiInfo->uciPayload >> 31) & 0x1;
- if (hqAck)
- {
- fdbk = TFU_HQFDB_ACK;
- hqInfo.isAck[0] = fdbk;
- }
- if (ue != NULLP && raCb == NULLP)
- {
- if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, rawCqiInd->timingInfo, fdbk, &err)) != ROK)
- {
- err.errType = RGSCHERR_TOM_HARQACKIND;
- DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() "
- "HARQ feedback processing failed errType(%d)errCause(%d)n",
- err.errType, err.errCause);
- continue;
- }
- }
- else if (ue == NULLP && raCb != NULLP)
- {
- if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
- cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
- {
- err.errType = RGSCHERR_TOM_HARQACKIND;
- DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() HARQ"
- " feedback processing failed errType(%d) errCause(%d)",
- err.errType, err.errCause);
- continue;
- }
- continue;
- }
- else if (ue != NULLP && raCb != NULLP)
- {
- if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
- cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
- {
- err.errType = RGSCHERR_TOM_HARQACKIND;
- DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() HARQ"
- " feedback processing failed errType(%d) errCause(%d).",
- err.errType, err.errCause);
- continue;
- }
- }
- else
- {
- DU_LOG("\nERROR --> SCH : RNTI:%d Unable to get the "
- "UE CB or RA CB ", rawCqiInfo->crnti);
- err.errType = RGSCHERR_TOM_HARQACKIND;
- continue;
- }
- /*
- DU_LOG("rawCqiInfo->numBits [%d] uciPayload [0x%08x] sfn/sf [%d:%d]\n", rawCqiInfo->numBits,
- rawCqiInfo->uciPayload, rawCqiInd->timingInfo.sfn, rawCqiInd->timingInfo.slot);
- */
- }
- else if (rawCqiInfo->numBits == 5)
- {
- /* Process CQI-RI Ind*/
- ri = (rawCqiInfo->uciPayload >> 27) & 0x1;
- cqi = (rawCqiInfo->uciPayload >> 28) & 0xF;
- if(ue) {
- if (cqi == 0)
- {
- DU_LOG("\nERROR --> SCH : UE[%d] CQI[%d] Invalid\n", ue->ueId, cqi);
- cqi = 15;
- }
- ue->ue5gtfCb.mcs = rgSch5gtfCqi2Mcs[cqi - 1];
- ue->ue5gtfCb.rank = ri + 1;
-#ifdef DL_LA
- if (rawCqiInfo->numBits > 1)
- {
- ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- ueDl->mimoInfo.cwInfo[0].cqi = cqi;
- ueDl->cqiFlag = TRUE;
- rgSCHCmnDlSetUeAllocLmtLa(cell, ue);
- // rgSCHCheckAndSetTxScheme(cell, ue);
- }
-#endif
- }
- /*
- DU_LOG("\nERROR --> SCH : UE[%d] CQI[%d] MCS[%d] RI[%d]\n", ue->ueId, cqi, ue->ue5gtfCb.mcs, ri);
- */
- }
- else if (rawCqiInfo->numBits == 6)
- {
- rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
- TfuHqFdbk fdbk = TFU_HQFDB_NACK;
- /* Process both HARQ and CQI-RI Ind*/
- ri = (rawCqiInfo->uciPayload >> 26) & 0x1;
- cqi = (rawCqiInfo->uciPayload >> 27) & 0xF;
- hqAck = (rawCqiInfo->uciPayload >> 31) & 0x1;
- if (cqi == 0)
- {
- DU_LOG("\nERROR --> SCH : UE[%d] CQI[%d] Invalid\n", ue->ueId, cqi);
- cqi = 13;
- }
- ue->ue5gtfCb.mcs = rgSch5gtfCqi2Mcs[cqi - 1];
- ue->ue5gtfCb.rank = ri + 1;
-#ifdef DL_LA
- if (rawCqiInfo->numBits > 1)
- {
- ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
- ueDl->mimoInfo.cwInfo[0].cqi = cqi;
- ueDl->cqiFlag = TRUE;
- rgSCHCmnDlSetUeAllocLmtLa(cell, ue);
- // rgSCHCheckAndSetTxScheme(cell, ue);
- }
-#endif
- if (hqAck)
- {
- fdbk = TFU_HQFDB_ACK;
- hqInfo.isAck[0] = fdbk;
- }
- if (ue != NULLP && raCb == NULLP)
- {
- if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, rawCqiInd->timingInfo, fdbk, &err)) != ROK)
- {
- err.errType = RGSCHERR_TOM_HARQACKIND;
- DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() "
- "HARQ feedback processing failed errType(%d)errCause(%d)n",
- err.errType, err.errCause);
- continue;
- }
- }
- else if (ue == NULLP && raCb != NULLP)
- {
- if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
- cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
- {
- err.errType = RGSCHERR_TOM_HARQACKIND;
- DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() HARQ"
- " feedback processing failed errType(%d) errCause(%d)",
- err.errType, err.errCause);
- continue;
- }
- continue;
- }
- else if (ue != NULLP && raCb != NULLP)
- {
- if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
- cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
- {
- err.errType = RGSCHERR_TOM_HARQACKIND;
- DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() HARQ"
- " feedback processing failed errType(%d) errCause(%d).",
- err.errType, err.errCause);
- continue;
- }
- }
- else
- {
- DU_LOG("\nERROR --> SCH : RNTI:%d Unable to get the "
- "UE CB or RA CB ", rawCqiInfo->crnti);
- err.errType = RGSCHERR_TOM_HARQACKIND;
- continue;
- }
-
- /*
- DU_LOG("\nERROR --> SCH : UE[%u] CQI[%u] MCS[%u] RI[%u] HQ[%u]\n", ue->ueId, cqi, ue->ue5gtfCb.mcs, ri, hqAck);
- */
- }
- }
-
- if ((rgSCHDhmRlsDlsfHqProc (cell, rawCqiInd->timingInfo)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to Release Downlink "
- "subframe for cellId (%d) ", cell->cellId);
- err.errType = RGSCHERR_TOM_HARQACKIND;
- }
-
- for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
- {
- if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
- {
- iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
-
- rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
- if(rlsHqBufs->numUes)
- {
- rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
- RgSchMacRlsHq (&pst, rlsHqBufs);
- }
- rlsHqBufs->numUes = 0;
- }
- }
- return ROK;
-} /* rgSCHTomRawCqiInd */
-
-/**
- * @brief Handler for processing SRS indication recieved from
- * PHY for a UE.
- *
- * @details
- *
- * Function: rgSCHTomSrsInd
- *
- * Handler for SRS indication recieved from PHY
- * for a set of UEs.
- *
- * Invoked by: RgLiTfuSrsInd
- *
- * Processing Steps:
- * - Get UE
- * - Invoke scheduler to indicate UL SRS rgSCHUtlSrsInd
- *
- * @param[in] TfuSrsIndInfo *srsInd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHTomSrsInd
-(
-RgSchCellCb *cell,
-TfuSrsIndInfo *srsInd
-)
-{
- RgSchUeCb *ue;
- CmLList *node;
- TfuSrsRpt* srsInfo;
-
- if(cell->cellId != srsInd->cellId)
- {
- DU_LOG("\nERROR --> SCH : Unable to get the cell for cellId"
- ":%d", srsInd->cellId);
- return RFAILED;
- }
-
- node = srsInd->srsRpt.first;
- for (;node; node=node->next)
- {
- srsInfo = (TfuSrsRpt *)node->node;
- ue = rgSCHDbmGetUeCb (cell, srsInfo->ueId);
- if (ue == NULLP)
- {
- DU_LOG("\nERROR --> SCH : RNTI:%d Unable to get the "
- "UE CB", srsInfo->ueId);
- continue;
- }
- rgSCHUtlSrsInd(cell, ue, srsInfo, srsInd->timingInfo);
- rgSCHUtlHdlUlTransInd(cell, ue, srsInd->timingInfo);
- }
- return ROK;
-} /* rgSCHTomSrsInd */
-
-/*
-*
-* Fun: rgSCHTomUtlGenIndices
-*
-* Desc: This function reconstructs the Subband Indices for
-* of M selected Subbands conveyed by the UE for APeriodic Modes
-* 2-0 and 2-2. It decodes the Label which uniquely encodes M out
-* of N subbands.
-*
-*
-* Ret: ROK
-*
-* Notes: None
-*
-* File: rg_sch_utl.c
-*
-*/
-#ifdef UNUSED_FUNC
-static S16 rgSCHTomUtlGenIndices
-(
-uint32_t label,
-uint8_t posM,
-uint8_t valN,
-uint8_t valK,
-TfuSubbandInfo* sbInfo
-)
-{
- uint8_t idx, kval, xval, xmin;
- uint32_t binCoe;
- xmin =1;
- for(kval=0; kval<posM;kval++)
- {
- xval = xmin;
- RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe, (posM-kval-1));
- RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe[posM-kval-1], (valN-xval-1));
- binCoe = rgSCHTomBinCoe[posM-kval-1][valN-xval-1];
- while(binCoe>label)
- {
- xval = xval+1;
- RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe[posM-kval-1], (valN-xval-1));
- binCoe = rgSCHTomBinCoe[posM-kval-1][valN-xval-1];
- }
- idx = xval;
- sbInfo[kval].numRb = valK;
- sbInfo[kval].rbStart = idx*valK;
- xmin = idx+1;
- label = label-binCoe;
- }
- return ROK;
-} /* end of rgSCHTomUtlGenIndices*/
-#endif
-#endif
-/**
- * @brief Handler for processing decode failure indication recieved from
- * PHY for a UE.
- *
- * @details
- *
- * Function: rgSCHTomCrcInd
- *
- * Handler for processing decode failure indication recieved from
- * PHY for a set of UEs.
- *
- * Invoked by: RgLiTfuCrcInd of rg_sch.x
- *
- * Processing Steps:
- * - Validate the information received and retrieve cell and ue.
- * - Process Decode failure Indication: Call rgSCHUhmProcHqFailure().
- *
- * @param[in] TfuCrcIndInfo *crcInd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHTomCrcInd
-(
-RgSchCellCb *cell,
-TfuCrcIndInfo *crcInd
-)
-{
- RgSchUeCb *ue = NULLP;
- RgSchRaCb *raCb = NULLP;
- CmLList *node;
- TfuCrcInfo *crcInfo;
-#ifdef RG_ULSCHED_AT_CRC
- RgSchErrInfo err;
- RgSchDlSf *ulSf;
- CmLteTimingInfo crntHiDci0Frm;
- //RgSchCmnUlCell *cellUl;
- Inst inst = cell->instIdx;
- TfuCntrlReqInfo *cntrlInfo;
- uint32_t ret;
-#ifdef LTE_TDD
- uint8_t Mval;
- uint8_t idx;
-#endif
-#endif
-#ifdef LTE_TDD
- RgSchUlHqProcCb *hqProc;
-#endif
-
-#ifdef LTE_L2_MEAS
- RgSchUlHqProcCb *ulHqProc;
-#endif
-
- if(cell->cellId != crcInd->cellId)
- {
- DU_LOG("\nERROR --> SCH : Unable to get the cell for cellId"
- ":%d", crcInd->cellId);
- return RFAILED;
- }
-#ifdef RG_ULSCHED_AT_CRC
-#ifndef LTE_ADV
- {
- static CmLteTimingInfo lastCrc = {2000,0};
- CmLteTimingInfo crntCrc = cell->crntTime;
- if (RGSCH_TIMEINFO_SAME(lastCrc, crntCrc))
- {
- /*Removed the WA to drop 2nd CRC*/
- DU_LOG("\nINFO --> SCH : Recieved CRC "
- "twice per TTI @(%u,%u)", cell->crntTime.sfn,
- cell->crntTime.slot);
- }
- lastCrc = crntCrc;
- }
-#endif
-#endif
- node = crcInd->crcLst.first;
- for (;node; node=node->next)
- {
- crcInfo = (TfuCrcInfo*)node->node;
- ue = rgSCHDbmGetUeCb (cell, crcInfo->rnti);
- if (ue == NULLP)
- {
-#ifdef LTEMAC_SPS
- /* Fetch from SPS List */
- ue = rgSCHDbmGetSpsUeCb(cell, crcInfo->rnti);
- if (ue == NULLP)
-#endif
- {
- raCb = rgSCHDbmGetRaCb (cell, crcInfo->rnti);
- if (raCb == NULLP)
- {
- continue;
- }
- }
- }
- /* Added Ul TB count for Uplink data scheduled*/
-#ifdef LTE_L2_MEAS
- if(raCb)
- {
- ulHqProc = &(raCb->msg3HqProc);
- if(ulHqProc->remTx == (cell->rachCfg.maxMsg3Tx -1))
- {
- cell->dlUlTbCnt.tbTransUlTotalCnt++;
- }
- }
- else
- {
- rgSCHUtlUlHqProcForUe(cell, crcInd->timingInfo, ue, &ulHqProc);
- if(ulHqProc->remTx == ((RgUeUlHqCb*)ulHqProc->hqEnt)->maxHqRetx)
- {
- cell->dlUlTbCnt.tbTransUlTotalCnt++;
- }
- }
-#endif
-
- if (crcInfo->isFailure == FALSE)
- {
- if(raCb)
- {
- rgSCHRamMsg3DatInd(raCb);
-#ifdef LTE_TDD
- /*ccpu00128820 - MOD - Msg3 alloc double delete issue*/
- hqProc = &(raCb->msg3HqProc);
- RGSCH_UPD_PHICH(cell->ulDlCfgIdx, crcInd->timingInfo.slot,
- hqProc);
-#endif
- raCb = NULLP;
- }
- else
- {
-#ifdef EMTC_ENABLE
- gUlCrcPassCounter++;
-#endif
-#ifdef CA_DBG
- gUlCrcPassCount++;
-#endif
- RGSCHCPYTIMEINFO(crcInd->timingInfo, ue->datIndTime);
-#ifndef MAC_SCH_STATS
- rgSCHUhmProcDatInd(cell, ue, crcInd->timingInfo);
-
-#else
- /** Stats update over here
- */
- {
- RgSchCmnUe *cmnUe = RG_SCH_CMN_GET_UE(ue,cell);
-
- rgSCHUhmProcDatInd(cell, ue, crcInd->timingInfo, cmnUe->ul.crntUlCqi[0]);
- }
-#endif /* MAC_SCH_STATS */
-
- rgSCHUtlHdlUlTransInd(cell, ue, crcInd->timingInfo);
-#ifdef LTEMAC_SPS
- rgSCHUtlHdlCrcInd(cell, ue, crcInd->timingInfo);
-#endif
- }
- }
- else
- {
- if(raCb)
- {
- /* SR_RACH_STATS : MSG3 Nack / DTX*/
- if (crcInfo->isDtx == TRUE)
- {
- rgNumMsg3DtxRcvd++;
- }
- else
- {
- rgNumMsg3CrcFailed++;
- }
- rgSCHRamMsg3FailureInd(raCb);
-#ifdef EMTC_ENABLE
- rgSCHCmnEmtcHdlCrcFailInd(cell, raCb);
-#endif
- /* Added Ul TB count for CRC Failure of MSG3 */
-#ifdef LTE_L2_MEAS
- ulHqProc = &(raCb->msg3HqProc);
- if(ulHqProc->remTx == (cell->rachCfg.maxMsg3Tx -1))
- {
- cell->dlUlTbCnt.tbTransUlFaulty++;
- }
-#endif
- raCb = NULLP;
- }
- else
- {
-#ifdef EMTC_ENABLE
- gUlCrcFailCounter++;
-#endif
-#ifdef CA_DBG
- gUlCrcFailCount++;
-#endif
-#ifndef MAC_SCH_STATS
- rgSCHUhmProcHqFailure (cell, ue, crcInd->timingInfo, crcInfo->rv);
-#else
- {
- RgSchCmnUe *cmnUe = RG_SCH_CMN_GET_UE(ue,cell);
-
- rgSCHUhmProcHqFailure (cell, ue, crcInd->timingInfo, crcInfo->rv, cmnUe->ul.crntUlCqi[0]);
- }
-#endif /* MAC_SCH_STATS */
- rgSCHUtlHdlUlTransInd(cell, ue, crcInd->timingInfo);
-#ifdef LTEMAC_SPS
- rgSCHUtlHdlCrcFailInd(cell, ue, crcInd->timingInfo);
-#endif
- /* Added Ul TB count for CRC Failure of Uplink data */
-#ifdef LTE_L2_MEAS
- rgSCHUtlUlHqProcForUe(cell, crcInd->timingInfo, ue, &ulHqProc);
- if(ulHqProc->remTx == ((RgUeUlHqCb*)ulHqProc->hqEnt)->maxHqRetx)
- {
- cell->dlUlTbCnt.tbTransUlFaulty++;
- }
-#endif
- }
- }
- }
-
-/* ccpu00132653-ADD Added Sched_At_Crc Changes for TDD and optimized here
- the codebase across TDD and FDD*/
-#ifdef RG_ULSCHED_AT_CRC
- /* Changes to do uplink scheduling at CRC Indication */
- //cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, crntHiDci0Frm, TFU_ULCNTRL_DLDELTA);
-
-
- rgSCHCmnRlsUlSf(cell,0);
-
-
- /* Allocating memory for CntrlReq as it required for both EMTC and
- * Normal UEs */
- if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&cntrlInfo,
- sizeof(TfuCntrlReqInfo))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to Allocate TfuCntrlReqInfo "
- "for cell");
- return ret;
- }
- rgSCHCmnUlSch(cell);
-#ifdef LTE_L2_MEAS
- rgSCHL2Meas(cell,TRUE);
-#endif
- /* Also, sending UL DCI and PHICH for just scheduled subframe */
- ulSf = rgSCHUtlSubFrmGet (cell, crntHiDci0Frm);
-
- if ((rgSCHTomUtlProcDlSfAtCrc (ulSf, crntHiDci0Frm, cell, cntrlInfo, &err)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : rgSCHTomCrcInd() Unable to process"
- " downlink subframe for cellId %d", crcInd->cellId);
- err.errType = RGSCHERR_TOM_TTIIND;
- return RFAILED;
- }
-#endif /* RG_ULSCHED_AT_CRC */
- return ROK;
-} /* rgSCHTomCrcInd */
-
-/**
- * @brief Handler for processing timing Advance indication recieved from
- * PHY for a UE.
- *
- * @details
- *
- * Function: rgSCHTomTimingAdvInd
- *
- * Handler for processing timing advance indication recieved from PHY
- * for a set of UEs.
- *
- * Invoked by: RgLiTfuTimingAdvInd
- *
- * Processing Steps:
- * - Get UE.
- * - Call DHM to update value of Timing Advance rgSCHDhmUpdTa.
- *
- * @param[in] TfuTimingAdvIndInfo *timingAdvInd
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHTomTimingAdvInd
-(
-RgSchCellCb *cell,
-TfuTimingAdvIndInfo *timingAdvInd
-)
-{
- RgSchUeCb *ue;
- CmLList *node;
- TfuTimingAdvInfo *timingAdvInfo;
-
- if(cell->cellId != timingAdvInd->cellId)
- {
- DU_LOG("\nERROR --> SCH : Unable to get the cell for cellId"
- "=(%d)", timingAdvInd->cellId);
- return RFAILED;
- }
-
-
- node = timingAdvInd->timingAdvLst.first;
- for (;node; node=node->next)
- {
- timingAdvInfo = (TfuTimingAdvInfo *)node->node;
- ue = rgSCHDbmGetUeCb (cell, timingAdvInfo->rnti);
- if (ue == NULLP)
- {
- DU_LOG("\nERROR --> SCH : RNTI:%d Unable to get the UE CB",
- timingAdvInfo->rnti);
- continue;
- }
- rgSCHDhmUpdTa (cell, ue, timingAdvInfo->timingAdv);
- }
- return ROK;
-} /* rgSCHTomTimingAdvInd */
-
-/**
- * @brief Handler for processing TTI indication recieved from
- * PHY for 'n' cells.
- *
- * @details
- *
- * Function: rgSCHTomTtiInd
- *
- * Handler for processing slot indication recieved from MAC
- * for a cell. This is split into the below Steps.
- *
- * 1: Complete the Uplink and Common Channel Scheduling for each Cell
- * 2: Complete the UE specific Scheduling for each Cell / across Cells.
- * 3: Consolidate the subframe allocations and send to each MAC instance
- * 4: Fill the Tfu structures for DL and UL Config requests
- * 5: Handle the RGR Config messages per Cell
- *
- * @param[in] SlotTimingInfo *slotInd
- * @param[in] Inst schInst
- * @return Void
- **/
-Void rgSCHTomTtiInd
-(
-SlotTimingInfo *slotInd,
-Inst schInst
-)
-{
- RgInfSfAlloc *subfrmAlloc;
- RgTfuCntrlReqInfo *cntrlInfo = NULLP;
- S16 ret = ROK;
- uint8_t i;
- uint8_t nCell = 0;
- RgSchCellCb *cell[CM_LTE_MAX_CELLS];
- RgSchCellCb *cellLst[CM_LTE_MAX_CELLS];
-
-#ifdef LTE_L2_MEAS
- glblTtiCnt++;
-#endif
-
- //rgSchTomFillCellTtiInfo(slotInd, schInst, &nCell, &cell[0]);
-
- schFillCrntTime(*slotInd,schInst);
- for (i = 0; i < nCell; i++)
- {
- /* Perform UL and DL Common Channel scheduling */
- rgSchTomTtiUlAndDlCmnChSch (cell[i]);
- }
-
- /* Perform scheduling in Order of
- * 1. SPS
- * 2. CEs
- * 3. Retx */
- for (i = 0; i < nCell; i++)
- {
-
- if (cell[i]->isDlDataAllwd && (cell[i]->stopDlSch == FALSE))
- {
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell[i]);
- /* Perform DL Retx scheduling */
- cellSch->apisDl->rgSCHDlRetxSched(cell[i], &cellSch->allocInfo);
- }
- }
-
- rgSchCmnPreDlSch(cell, nCell, cellLst);
- for (i = 0; i < nCell; i++)
- {
- /* Perform DL scheduling */
- rgSchTomTtiDlSch (cellLst[i]);
- }
- rgSchCmnPstDlSch(cell[0]);
-
- for (i = 0; i < nCell; i++)
- {
-#ifdef LTE_TDD
-#ifndef RG_ULSCHED_AT_CRC
- /* Perform UL scheduling for TDD */
- rgSCHCmnUlSch (cell[i]);
-#endif
-#endif
- }
- /* Init SF Alloc info per Cell */
- for (i = 0; i < nCell; i++)
- {
- subfrmAlloc = &(cell[i]->sfAllocArr[cell[i]->crntSfIdx]);
- rgSCHUtlResetSfAlloc(subfrmAlloc,FALSE,TRUE);
- }
- for (i = 0; i < nCell; i++)
- {
- if (cell[i]->isDlDataAllwd && (cell[i]->stopSiSch == FALSE))
- {
- subfrmAlloc = &(cell[i]->sfAllocArr[cell[i]->crntSfIdx]);
- /*
- * TFU_DLDATA_DLDELTA is used in this calculation because the subfrmAlloc
- * timingInfo which is being calculated here will be used by MAC
- */
- RG_SCH_ADD_TO_CRNT_TIME(cell[i]->crntTime, subfrmAlloc->timingInfo,
- RG_DL_DELTA - TFU_DLDATA_DLDELTA);
- /* Consolidate the Allocations and send response to MAC instances */
- rgSchTomTtiCnsldtSfAlloc (cell[i]);
- }
- }
-
- for (i = 0; i < nCell; i++)
- {
- if (cell[i]->isDlDataAllwd && (cell[i]->stopSiSch == FALSE))
- {
- /* Send the consolidated Alloc Info to MAC instances */
- rgSCHCmnSndCnsldtInfo (cell[i]);
- }
- }
-
- for (i = 0; i < nCell; i++)
- {
- /* Fill control data from scheduler to PHY */
- if ((ret = rgSCHUtlAllocEventMem((cell[i]->instIdx), (Ptr *)&cntrlInfo,
- sizeof(RgTfuCntrlReqInfo))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to Allocate TfuCntrlReqInfo"
- " for cell");
- return;
- }
-
-#ifdef EMTC_ENABLE
- /* Fill the TFU structures and send to CL */
- if(TRUE == cell[i]->emtcEnable)
- {
- ret = rgSchEmtcTomTtiL1DlAndUlCfg (cell[i], cntrlInfo);
- }
-#endif
- if((ROK == ret)
- && (NULLP != cntrlInfo))
- {
- /* Fill the TFU structures and send to CL */
- rgSchTomTtiL1DlAndUlCfg (cell[i], cntrlInfo);
- }
- }
-#ifdef RGR_RRM_TICK
- rgSCHTomUtlSendSfnTick(cell[0]);
-#endif
-
- for (i = 0; i < nCell; i++)
- {
- /* Invoke non critical functions like measurements, etc */
- rgSchTomTtiMiscFunctions (cell[i]);
- }
-
-#ifdef CA_DBG
- {
- uint32_t dbgUeIdChngAndDatReqInClCnt = 0;
- static uint32_t gTtiCount = 0;
- gTtiCount++;
-
- if(gTtiCount == 3000)
- {
-#ifdef XEON_SPECIFIC_CHANGES
- DU_LOG("\nINFO --> SCH : SChed:: (P/S)::(%u/%u) \n",
- gPrimarySchedCount,gSCellSchedCount);
-
- DU_LOG("\nINFO --> SCH : HQFDBK :: %u\n",gHqFdbkCount);
-
- long int total;
- long int total2 ;
-
- total = gPCellTb1AckCount + gPCellTb1NackCount + gPCellTb1DtxCount;
- total2 = gPCellTb2AckCount + gPCellTb2NackCount + gPCellTb2DtxCount;
-
- DU_LOG("\nINFO --> SCH : PCell:: TB1:: (A/N/D)::(%u/%u/%u) TB2:: (A/N/D)::(%u/%u/%u)\n",
- gPCellTb1AckCount,gPCellTb1NackCount,gPCellTb1DtxCount,
- gPCellTb2AckCount,gPCellTb2NackCount,gPCellTb2DtxCount);
- if ((total != 0 ) && total2 != 0)
- {
- DU_LOG("\nINFO --> SCH : PCell:: TB1:: (AP/NP/DP)::(%.2f/%.2f/%.2f) TB2:: (AP/NP/DP)::(%.2f/%.2f/%.2f)\n",
- (float)gPCellTb1AckCount/total * 100,(float)gPCellTb1NackCount/total * 100,(float)gPCellTb1DtxCount/total * 100,
- (float)gPCellTb2AckCount/total2 *100 ,(float)gPCellTb2NackCount/total2 *100 ,(float)gPCellTb2DtxCount/total2 *2);
- }
-
- total = gSCellTb1AckCount + gSCellTb1NackCount + gSCellTb1DtxCount;
- total2 = gSCellTb2AckCount + gSCellTb2NackCount + gSCellTb2DtxCount;
-
-
- DU_LOG("\nINFO --> SCH : SCell:: TB1:: (A/N/D)::(%u/%u/%u) TB2:: (A/N/D)::(%u/%u/%u)\n",
- gSCellTb1AckCount,gSCellTb1NackCount,gSCellTb1DtxCount,
- gSCellTb2AckCount,gSCellTb2NackCount,gSCellTb2DtxCount);
- if ((total != 0 ) && total2 != 0)
- {
- DU_LOG("\nINFO --> SCH : SCell:: TB1:: (AP/NP/DP)::(%.2f/%.2f/%.2f) TB2:: (AP/NP/DP)::(%.2f/%.2f/%.2f)\n",
- (float)gSCellTb1AckCount/total * 100,(float)gSCellTb1NackCount/total * 100,(float)gSCellTb1DtxCount/total * 100,
- (float)gSCellTb2AckCount/total2 *100 ,(float)gSCellTb2NackCount/total2 *100 ,(float)gSCellTb2DtxCount/total2 *2);
- }
-
-
- DU_LOG("\nINFO --> SCH : CQI:: Recp(Pucch/Pusch):Rcvd(pcqi/rawacqireport/apcqi/AppReprt)::(%u/%u):(%u/%u/%u/%u)\n",
- gCqiRecpCount,gCqiRecpPuschCount,gCqiRcvdCount,gRawACqiCount,
- gACqiRcvdCount,gCqiReptToAppCount);
-
- DU_LOG("\nINFO --> SCH : (F1BCS Count/Cqi/Ri/CqiDrop/PucchDrop/PuschCqiDrop)::(%u/%u/%u/%u/%u/%u)\n",
- gF1bCsCount,gCqiReqCount,gRiReqCount,gCqiDropCount,gPucchDropCount,gPuschCqiDropCount);
-
- DU_LOG("\nINFO --> SCH : UL::(DCI0/CrcPass/CrcFail)::(%u/%u/%u)\n"
- "gPcellZeroBoOcc:%u\t gScellZeroBoOcc:%u dbgUeIdChngAndDatReqInClCnt: %u\n"
- "DelayedDatReqInMac: %u DelayedDatReqInCl : %u gIccPktRcvrMemDropCnt :%u\n",
- gDci0Count,
- gUlCrcPassCount,
- gUlCrcFailCount,
- gPcellZeroBoOcc,
- gScellZeroBoOcc,
- dbgUeIdChngAndDatReqInClCnt,
- dbgDelayedDatReqInMac,
- gDropDatReqCnt, gIccPktRcvrMemDropCnt);
-#else
- DU_LOG("\nINFO --> SCH : SChed:: (P/S)::(%ld/%ld) \n",
- gPrimarySchedCount,gSCellSchedCount);
-
- DU_LOG("\nINFO --> SCH : HQFDBK :: %ld\n",gHqFdbkCount);
-
-
- DU_LOG("\nINFO --> SCH : PCell:: TB1:: (A/N/D)::(%ld/%ld/%ld) TB2:: (A/N/D)::(%ld/%ld/%ld)\n",
- gPCellTb1AckCount,gPCellTb1NackCount,gPCellTb1DtxCount,
- gPCellTb2AckCount,gPCellTb2NackCount,gPCellTb2DtxCount);
-
- DU_LOG("\nINFO --> SCH : SCell:: TB1:: (A/N/D)::(%ld/%ld/%ld) TB2:: (A/N/D)::(%ld/%ld/%ld)\n",
- gSCellTb1AckCount,gSCellTb1NackCount,gSCellTb1DtxCount,
- gSCellTb2AckCount,gSCellTb2NackCount,gSCellTb2DtxCount);
-
- DU_LOG("\nINFO --> SCH : CQI:: Recp(Pucch/Pusch):Rcvd(pcqi/rawacqireport/apcqi/AppReprt)::\
- (%ld/%ld):(%ld/%ld/%ld/%ld)\n",
- gCqiRecpCount,gCqiRecpPuschCount,gCqiRcvdCount,gRawACqiCount,
- gACqiRcvdCount,gCqiReptToAppCount);
- DU_LOG("\nINFO --> SCH : CQI:: PucchCqiSnrDropCnt/PucchCqiConfBitMaskDropCnt/PuschCqiConfMaskDropCount\
- :: (%ld/%ld/%ld) \n",gCqiPucchLowSnrDropCount,gCqiPucchConfMaskDropCount,gCqiPuschConfMaskDropCount);
-
- DU_LOG("\nINFO --> SCH : (F1BCS Count/Cqi/Ri/CqiDrop/PucchDrop/PuschCqiDrop)::(%ld/%ld/%ld/%ld/%ld/%ld)\n",
- gF1bCsCount,gCqiReqCount,gRiReqCount,gCqiDropCount,gPucchDropCount,gPuschCqiDropCount);
-
- DU_LOG("\nINFO --> SCH : UL::(DCI0/CrcPass/CrcFail)::(%ld/%ld/%ld)\n"
- "gPcellZeroBoOcc:%ld\t gScellZeroBoOcc:%ld dbgUeIdChngAndDatReqInClCnt: %ld\n"
- "DelayedDatReqInMac: %ld DelayedDatReqInCl : %ld gIccPktRcvrMemDropCnt :%ld\n",
- gDci0Count,
- gUlCrcPassCount,
- gUlCrcFailCount,
- gPcellZeroBoOcc,
- gScellZeroBoOcc,
- dbgUeIdChngAndDatReqInClCnt,
- dbgDelayedDatReqInMac,
- gDropDatReqCnt, gIccPktRcvrMemDropCnt);
- //DU_LOG("\nINFO --> SCH : delayedApiCnt:%ld",delayedApiCnt);
-#endif
-
- /*LAA STATS*/
- rgSCHLaaPrintStats();
-
- gCaDbgNonCaFrmt = gIccPktRcvrMemDropCnt = 0;
-
- gCaDbgCaFrmt = 0;
-
- gF1bCsCount = 0;
- gCqiReqCount = 0;
- gACqiRcvdCount = 0;
- gRawACqiCount= 0;
- gRiReqCount = 0;
- gCqiDropCount = 0;
- gPucchDropCount= 0;
-
- gCqiPucchLowSnrDropCount = 0;
- gCqiPucchConfMaskDropCount = 0;
- gCqiPuschConfMaskDropCount = 0;
- gPuschCqiDropCount = 0;
-
- gDci0Count = 0;
- gUlCrcPassCount = 0;
- gUlCrcFailCount = 0;
-
- gCqiRecpCount = 0;
- gCqiRecpPuschCount = 0;
- gCqiRcvdCount = 0;
-
- gCqiReptToAppCount = 0;
-
- gTtiCount = 0;
-
- gHqFdbkCount = 0;
- gPrimarySchedCount = 0;
- gSCellSchedCount = 0;
- gSCellTb1AckCount = 0;
- gSCellTb2AckCount = 0;
- gSCellTb2AckCount = 0;
- gSCellTb2NackCount = 0;
- gPCellTb1AckCount = 0;
- gPCellTb1NackCount = 0;
- gPCellTb2AckCount = 0;
- gPCellTb2NackCount = 0;
- gSCellTb1NackCount=0;
-
- gPCellTb1DtxCount = 0;
- gPCellTb2DtxCount = 0;
- gSCellTb1DtxCount = 0;
- gSCellTb2DtxCount = 0;
- gPcellZeroBoOcc = 0;
- gScellZeroBoOcc = 0;
-
- }
-
- }
-
-#endif
- return;
-} /* rgSCHTomTtiInd */
-
-/** @brief This function does the TTI processin for the uplink subframe,
- * already populated by the scheduler.
- *
- * @details
- *
- * Function: rgSCHTomUtlProcUlSf
- *
- * Processing steps:
- * - Loop through the Uplink allocations present in the uplink subframe.
- * - For each allocation Fill a data reception request to be sent to PHY
- * - Also fills the harq reception requests for the expected HQ feedbacks.
- *
- *
- * @param [in] RgSchCellCb *cell
- * @param [out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-
-static S16 rgSCHTomUtlProcUlSf
-(
-RgSchCellCb *cell,
-RgSchErrInfo *err
-)
-{
- S16 ret;
- TfuRecpReqInfo *recpReqInfo;
-#ifdef TFU_UPGRADE
- uint16_t validIdx = 0; /* Index computed from recreq's timing info*/
-#endif
- Inst inst = cell->instIdx;
-
- if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&recpReqInfo,
- sizeof(TfuRecpReqInfo))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to Allocate TfuRecpReqInfo "
- "for cell");
- err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
- return ret;
- }
- recpReqInfo->cellId = cell->cellId;
- cmLListInit(&recpReqInfo->ueRecpReqLst);
-
- RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, recpReqInfo->timingInfo,
- TFU_RECPREQ_DLDELTA);
-
- /* Filling data Reception requests */
- ret = rgSCHTomUtlFillDatRecpReq(recpReqInfo, cell,
- validIdx,
- err);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to fill Data recption "
- "requests for cell");
- RGSCH_FREE_MEM(recpReqInfo);
- return ret;
- }
- /* Filling HARQ Reception requests */
- ret = rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, validIdx,err);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to fill Harq Feedback "
- "reception requests for cell");
- RGSCH_FREE_MEM(recpReqInfo);
- return ret;
- }
- /* sending the RecpReq to Phy */
- //if (rgSCHUtlTfuRecpReq(inst, cell->tfuSap->sapCfg.suId, recpReqInfo) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to send Cntrl info for cell");
- }
- return ROK;
-} /* end of rgSCHTomUtlProcUlSf */
-
-#ifdef LTE_TDD
-#ifdef TFU_UPGRADE
-/** @brief This function does the TTI processin for the uplink subframe,
- * already populated by the scheduler.
- *
- * @details
- *
- * Function: rgSCHTomUtlPrcUlTddSpclSf
- *
- * Processing steps:
- * - Fill the SRS Info for the Special Subframe in Reception Req.
- * - Send the Reception Req to TFU
- *
- *
- * @param [in] RgSchCellCb *cell
- * @param [out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-static S16 rgSCHTomUtlPrcUlTddSpclSf
-(
-RgSchCellCb *cell,
-RgSchErrInfo *err
-)
-{
- S16 ret;
- TfuRecpReqInfo *recpReqInfo;
- uint16_t validIdx; /* Index computed from recreq's timing info*/
- Inst inst = cell->instIdx;
-
- if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&recpReqInfo,
- sizeof(TfuRecpReqInfo))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : rgSCHTomUtlPrcUlTddSpclSf() Unable to "
- "Allocate TfuRecpReqInfo for cell");
- err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
- return ret;
- }
- recpReqInfo->cellId = cell->cellId;
- cmLListInit(&recpReqInfo->ueRecpReqLst);
-
- RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, recpReqInfo->timingInfo, TFU_RECPREQ_DLDELTA);
-
- RG_SCH_GET_IDX_PCQISRSSR(recpReqInfo->timingInfo, validIdx);
-
- /*ccpu00130768 */
- if(cell->srsCfg.isSrsCfgPres &&
- rgSchTddCellSpSrsSubfrmTbl[cell->srsCfg.srsSubFrameCfg][recpReqInfo->timingInfo.slot])
- {
- recpReqInfo->srsPres = TRUE;
- }
- else
- {
- recpReqInfo->srsPres = FALSE;
- }
-
- /* Filling SRS Reception requests */
- ret = rgSCHTomUtlFillSrsRecpReq (recpReqInfo, cell, validIdx, err);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : rgSCHTomUtlPrcUlTddSpclSf() Unable to fill"
- " SRS recption requests for cell");
- RGSCH_FREE_MEM(recpReqInfo);
- return ret;
- }
- /* sending the RecpReq to Phy */
- //if (rgSCHUtlTfuRecpReq(inst, cell->tfuSap->sapCfg.suId, recpReqInfo) != ROK)
- {
- DU_LOG("\nERROR --> SCH : rgSCHTomUtlPrcUlTddSpclSf() Unable to send "
- "Cntrl info for cell");
- }
- return ROK;
-} /* end of rgSCHTomUtlPrcUlTddSpclSf */
-#endif
-#endif
-/** @brief This function does all the processing related to a single downlink
- * subframe.
- *
- * @details
- *
- * Function: rgSCHTomUtlProcDlSf
- *
- * Processing steps:
- * - collate control data for all UEs and send to PHY
- * - collate data buffers for all UEs and send to PHY
- *
- * @param [in] RgSchDlSf *dlSf
- * @param [in] RgSchDlSf *ulSf
- * @param [in] RgSchCellCb *cell
- * @param [out] RgSchErrInfo *err
- * @return S16
- */
-static S16 rgSCHTomUtlProcDlSf
-(
-RgSchDlSf *dlSf,
-RgSchDlSf *ulSf,
-RgSchCellCb *cell,
-RgTfuCntrlReqInfo *cntrlInfo,
-RgSchErrInfo *err
-)
-{
- S16 ret;
- uint8_t sfTyp = 1; /* Dl Subframe */
-
- cmLListInit(&cntrlInfo->phichLst);
- cmLListInit(&cntrlInfo->dlPdcchLst);
- cmLListInit(&cntrlInfo->ulPdcchLst);
-
-#ifdef TFU_ALLOC_EVENT_NO_INIT
- cntrlInfo->ulTiming.sfn = cntrlInfo->ulTiming.subframe = 0;
-#endif
- cntrlInfo->dlTiming = cell->dlDciTime;
- cntrlInfo->cellId = cell->cellId;
- cntrlInfo->ulTiming = cell->hiDci0Time;
- if((0 == (cntrlInfo->dlTiming.sfn % 30)) && (0 == cntrlInfo->dlTiming.slot))
- {
- //DU_LOG("\nERROR --> SCH : 5GTF_CHECK rgSCHTomUtlProcDlSf Cntrl dl (%d : %d) ul (%d : %d)\n", \
- cntrlInfo->dlTiming.sfn, cntrlInfo->dlTiming.subframe, cntrlInfo->ulTiming.sfn, cntrlInfo->ulTiming.subframe);
- }
- /* Fill PCFICH info */
- /* Fix for DCFI FLE issue: when DL delta is 1 and UL delta is 0 and CFI
- *change happens in that SF then UL PDCCH allocation happens with old CFI
- *but CFI in control Req goes updated one since it was stored in the CELL
- */
- cntrlInfo->cfi = dlSf->pdcchInfo.currCfi;
-#ifndef RG_ULSCHED_AT_CRC
- uint8_t Mval = 1;
-#ifdef LTE_TDD
- Mval = rgSchTddPhichMValTbl[cell->ulDlCfgIdx]
- [cell->hiDci0Time.subframe];
- if(dlSf->sfType == RG_SCH_SPL_SF_DATA)
- {
- RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, cntrlInfo->cfi);
- }
-#endif
- if(Mval)
- {
- /* Fill PHICH info */
- if ((ret = rgSCHTomUtlFillPhich (cell, cntrlInfo, ulSf, err)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to send PHICH info "
- "for cellId (%d)\n", cell->cellId);
- RGSCH_FREE_MEM(cntrlInfo);
- return ret;
- }
- if ((ret = rgSCHTomUtlFillUlPdcch (cell, cntrlInfo, ulSf, err)) !=
- ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to send PDCCH info "
- "for cellId (%d)\n", cell->cellId);
- RGSCH_FREE_MEM(cntrlInfo);
- return ret;
- }
- }
-#ifdef EMTC_ENABLE
- if(0 == cntrlInfo->ulMpdcchLst.count)
- {
- gUlMpdcchBlank++;
- }
-#endif
-#endif
-#ifdef LTE_TDD
- sfTyp = rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
- [cell->dlDciTime.subframe];
-#endif
- if (sfTyp != 2) /* Uplink subframe */
- {
- /* Fill PDCCH info */
- if ((ret = rgSCHTomUtlFillDlPdcch(cell,cntrlInfo, dlSf, err)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to send PDCCH info "
- "for cellId (%d)\n", cell->cellId);
- RGSCH_FREE_MEM(cntrlInfo);
- return ret;
- }
- rgBwAlloInfo[dlSf->sfNum] += dlSf->bwAssigned;
- rgBwAlcnt[dlSf->sfNum] ++;
-
- }
-#ifdef LTEMAC_SPS /* SPS_NEW_CHGS */
- cntrlInfo->isSPSOcc = dlSf->isSPSOcc;
-#endif
- cntrlInfo->numDlActvUes += dlSf->numDlActvUes; /* 4UE_TTI_DELTA */
- dlSf->numDlActvUes = 0;
-#ifdef EMTC_ENABLE
-if(0 == cntrlInfo->dlMpdcchLst.count)
-{
- gDlMpdcchBlank++;
-}
-#endif
- /* Now always sending down a cntrl req */
- /* sending the cntrl data to Phy */
- //if (rgSCHUtlTfuCntrlReq(inst, cell->tfuSap->sapCfg.suId, cntrlInfo)
- //!= ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to send Cntrl info for cell");
- }
- return ROK;
-
-}
-
-
-/** @brief This function handles sending of the PHICH information for the
- * downlink subframe to be sent in the next TTI.
- *
- * @details
- *
- * Function:
- *
- * Processing steps:
- * - Loop through the PHICH information present in the downlink
- * subframe and fill the information in cntrlInfo.
- *
- * @param [out] TfuCntrlReqInfo *cntrlInfo
- * @param [in] RgSchDlSf *dlSf
- * @param [out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-static S16 rgSCHTomUtlFillPhich
-(
-RgSchCellCb *cell,
-TfuCntrlReqInfo *cntrlInfo,
-RgSchDlSf *dlSf,
-RgSchErrInfo *err
-)
-{
- S16 ret;
- CmLList *node;
- RgSchPhich *phich;
- TfuPhichInfo *harqAck;
-#ifdef TFU_UPGRADE
- RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
-#endif
-
- ret = ROK;
- /* Traversing the list of Phichs */
- node = dlSf->phichInfo.phichs.first;
- while (node)
- {
- phich = (RgSchPhich*)node->node;
- if ((ret = rgSCHUtlGetEventMem((Ptr *)&harqAck, sizeof(TfuPhichInfo),
- &(cntrlInfo->memCp))) != ROK)
- {
- err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
- return ret;
- }
-#ifdef TFU_ALLOC_EVENT_NO_INIT
- harqAck->txPower = 0;
-#endif
- /* fill in the tfu structure from the information present in the
- * phich node */
- harqAck->rbStart = phich->rbStart;
- harqAck->nDmrs = phich->nDmrs;
- harqAck->isAck = phich->hqFeedBack;
- harqAck->isForMsg3 = phich->isForMsg3; /*SR_RACH_STATS : PHICH ACK/NACK for MSG3 */
-#ifdef LTE_TDD
- /* Changes for passing iPhich at TFU interface*/
- harqAck->iPhich = phich->iPhich;
-#endif
- /* ccpu00138898 - Added Tx pwr offset for PHICH Tx*/
-#ifdef TFU_UPGRADE
- harqAck->txPower = cellDl->phichTxPwrOffset;
-#endif
- cmLListAdd2Tail(&cntrlInfo->phichLst, &(harqAck->lnk));
- harqAck->lnk.node = (PTR)harqAck;
- node = node->next;
- } /* end of while */
- return ret;
-} /* end of */
-
-
-#ifdef LTE_ADV
-/** @brief This function is a utility function to restart
- * deactivation timer.
- *
- * @details
- *
- * Function: rgSCHTmrRestartScellDeactTmr
- *
- * Processing steps:
- * - Starts timer at scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] CmLteRnti rnti
- * @return Void
- */
-static Void rgSCHTmrRestartScellDeactTmr
-(
-RgSchCellCb *cell,
-RgSchUeCb *ueCb
-)
-{
- RgSchUeCellInfo *sCellInfo = NULLP;
-
- if(NULLP != ueCb)
- {
- if(RG_SCH_IS_CELL_SEC(ueCb, cell))
- {
- sCellInfo = ueCb->cellInfo[(ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)])];
-
- if(sCellInfo->deactTmr.tmrEvnt != TMR_NONE)
- {
- rgSCHTmrStopTmr(cell, RG_SCH_TMR_SCELL_DEACT, sCellInfo);
- }
- if(PRSNT_NODEF == ueCb->sCellDeactTmrVal.pres)
- {
- /*
- rgSCHTmrStartTmr(cell,sCellInfo,RG_SCH_TMR_SCELL_DEACT,
- ueCb->sCellDeactTmrVal.val);
- */
- }
- }
- }
-}/*end of rgSCHTmrRestartScellDeactTmr*/
-#endif
-
-/** @brief This function will send all the PDCCH's for the given downlink
- * subframe.
- *
- * @details
- *
- * Function:
- *
- * Processing steps:
- * - Loop through all the scheduled HARQ processes and fill
- * the PDCCH information in cntrlInfo.
- *
- * @param [out] TfuCntrlReqInfo *cntrlInfo
- * @param [in] RgSchDlSf *dlSf
- * @param [out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-uint32_t numdlSpsRelSentToTf;
-static S16 rgSCHTomUtlFillDlPdcch
-(
-RgSchCellCb *cell,
-TfuCntrlReqInfo *cntrlInfo,
-RgSchDlSf *dlSf,
-RgSchErrInfo *err
-)
-{
- S16 ret;
- CmLList *node;
- RgSchPdcch *pdcch;
- TfuPdcchInfo *tfuPdcch;
- uint8_t isDcivld = FALSE;
- uint8_t numUePerTti = 0;
-
- ret = ROK;
- /* Traversing the scheduled Harq processes */
- node = dlSf->pdcchInfo.pdcchs.first;
- while (node)
- {
- pdcch = (RgSchPdcch*)node->node;
- switch(pdcch->dci.dciFormat)
- {
- case TFU_DCI_FORMAT_3:
- isDcivld = (pdcch->dci.u.format3Info.isPucch) ? TRUE : FALSE;
- break;
-
- case TFU_DCI_FORMAT_3A:
- isDcivld = (pdcch->dci.u.format3AInfo.isPucch) ? TRUE : FALSE;
- break;
-
- default:
- isDcivld = TRUE;
- break;
- }
- if(!isDcivld)
- {
- node = node->next;
- continue;
- }
-
- /*ccpu00117179 - ADD - Build only non DCI format-0 messages */
- if((pdcch->dci.dciFormat == TFU_DCI_FORMAT_0) ||
- (pdcch->dci.dciFormat == TFU_DCI_FORMAT_A1) ||
- (pdcch->dci.dciFormat == TFU_DCI_FORMAT_A2))
- {
- node = node->next;
- continue;
- }
-
-
-#ifdef RGSCH_SPS_STATS
- if((pdcch->dci.dciFormat == TFU_DCI_FORMAT_1A) &&
- (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.mcs == 0x1F) &&
- (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.type == TFU_ALLOC_TYPE_RIV) &&
- (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.u.riv == 0xFFFFFFFF))
- {
- numdlSpsRelSentToTf++;
- }
-#endif
-
- if ((ret = rgSCHUtlGetEventMem((Ptr *)&tfuPdcch, sizeof(TfuPdcchInfo),
- &(cntrlInfo->memCp))) != ROK)
- {
- err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
- return ret;
- }
-#ifdef LTEMAC_SPS
- tfuPdcch->crnti = pdcch->crnti;
- tfuPdcch->isSpsRnti = pdcch->isSpsRnti;
-#endif
- tfuPdcch->rnti = pdcch->rnti;
-
-#ifdef LTE_ADV
- rgSCHTmrRestartScellDeactTmr(cell,pdcch->ue);
-#endif
- tfuPdcch->dciNumOfBits = pdcch->dciNumOfBits;
-
- tfuPdcch->nCce = pdcch->nCce;
- tfuPdcch->aggrLvl = pdcch->aggrLvl;
- tfuPdcch->dci = pdcch->dci;
-#ifdef RG_5GTF
- //TODO_SID: Need to check these values during INT
- tfuPdcch->sectorId = 0;
- tfuPdcch->sccIdx = 0;
- tfuPdcch->grpId =
-#endif
- /* SR_RACH_STATS : Reset isTBMsg4 */
- pdcch->dci.u.format1aInfo.t.pdschInfo.isTBMsg4 = FALSE;
- /* To be enhanced later for 2.1 */
- cmLListAdd2Tail(&cntrlInfo->dlPdcchLst, &(tfuPdcch->lnk));
- tfuPdcch->lnk.node = (PTR)tfuPdcch;
- node = node->next;
- if((pdcch->rnti > 60) && (pdcch->rnti < 5000))
- {
-#if defined (TENB_STATS) && defined (RG_5GTF)
- cell->tenbStats->sch.dl5gtfPdcchSend++;
-#endif
- numUePerTti++;
- }
- } /* end of while */
-
- if((numUePerTti) && (numUePerTti < RG_MAX_NUM_UE_PER_TTI ))
- {
- cell->dlNumUeSchedPerTti[numUePerTti-1]++;
- {
- gDlNumUePerTti[numUePerTti-1]++;
- }
- }
- return ret;
-} /* end of rgSCHTomUtlFillDlPdcch*/
-
-#ifdef RGSCH_SPS_STATS
-uint32_t rgSchSpsRelSentToTf;
-uint32_t rgSchSpsRelPdcchAllocd;
-#endif
-/** @brief This function will send all the UL PDCCH's for the given
- * subframe.
- *
- * @details
- *
- * Function:
- *
- * Processing steps:
- * - Loop through all the scheduled HARQ processes and fill
- * the PDCCH information in cntrlInfo.
- *
- * @param [out] TfuCntrlReqInfo *cntrlInfo
- * @param [in] RgSchDlSf *dlSf
- * @param [out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-static S16 rgSCHTomUtlFillUlPdcch
-(
-RgSchCellCb *cell,
-TfuCntrlReqInfo *cntrlInfo,
-RgSchDlSf *dlSf,
-RgSchErrInfo *err
-)
-{
- S16 ret;
- CmLList *node;
- RgSchPdcch *pdcch;
- TfuPdcchInfo *tfuPdcch;
- uint8_t isDcivld = FALSE;
-
- ret = ROK;
- /* Traversing the scheduled Harq processes */
- node = dlSf->pdcchInfo.pdcchs.first;
- while (node)
- {
- pdcch = (RgSchPdcch*)node->node;
- node = node->next;
- /*ccpu00116712- Function should pick only UL allocation related control
- * info- start */
- switch(pdcch->dci.dciFormat)
- {
- case TFU_DCI_FORMAT_A1:
- isDcivld = TRUE;
- break;
-
- case TFU_DCI_FORMAT_A2:
- isDcivld = TRUE;
- break;
-
- case TFU_DCI_FORMAT_3:
- isDcivld = (pdcch->dci.u.format3Info.isPucch) ? FALSE : TRUE;
- break;
-
- case TFU_DCI_FORMAT_3A:
- isDcivld = (pdcch->dci.u.format3AInfo.isPucch) ? FALSE : TRUE;
- break;
-
- default:
- isDcivld = FALSE;
- break;
- }
- if(!isDcivld)
- {
- continue;
- }
-#ifdef CA_DBG
- gDci0Count++;
-#endif
-
- /*ccpu00116712- Function should pick only UL allocation related control
- * info- end */
- if ((ret = rgSCHUtlGetEventMem((Ptr *)&tfuPdcch, sizeof(TfuPdcchInfo),
- &(cntrlInfo->memCp))) != ROK)
- {
- err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
- return ret;
- }
- tfuPdcch->rnti = pdcch->rnti;
-#ifdef LTE_ADV
- rgSCHTmrRestartScellDeactTmr(cell,pdcch->ue);
-#endif
- tfuPdcch->dciNumOfBits = pdcch->dciNumOfBits;
-
- tfuPdcch->nCce = pdcch->nCce;
- tfuPdcch->aggrLvl = pdcch->aggrLvl;
- tfuPdcch->dci = pdcch->dci;
-#ifdef RG_5GTF
- //TODO_SID: Need to check these values during INT
- tfuPdcch->sectorId = 0;
- tfuPdcch->sccIdx = 0;
- tfuPdcch->grpId =
-#endif
- /* To be enhanced later for 2.1 */
- gUl5gtfPdcchSend++;
-#if defined (TENB_STATS) && defined (RG_5GTF)
- cell->tenbStats->sch.ul5gtfPdcchSend++;
-#endif
- cmLListAdd2Tail(&cntrlInfo->ulPdcchLst, &(tfuPdcch->lnk));
- tfuPdcch->lnk.node = (PTR)tfuPdcch;
- } /* end of while */
-
-#ifdef RGSCH_SPS_STATS
- if (rgSchSpsRelSentToTf != rgSchSpsRelPdcchAllocd)
- {
- // abort();
- }
-#endif
- return ret;
-} /* end of rgSCHTomUtlFillUlPdcch*/
-
-/** @brief This function does the processing for Timing adjustment.
- *
- * @details
- *
- * Function:
- *
- * Processing steps:
- * - Loop through the ue present ueTimeLst, decrement the remaining
- * frames left.
- *
- *
- * @param [in] RgSchCellCb *cell
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-static S16 rgSCHTomUtlProcTA(RgSchCellCb *cell)
-{
- CmLList *node;
- RgSchUeCb *ue;
-
- node = cell->taUeLst.first;
- while (node)
- {
- ue = (RgSchUeCb *)node->node;
- node = node->next;
- if (ue->dl.taCb.numRemSf == 0)
- {
- ue->dl.taCb.state = RGSCH_TA_IDLE;
- /* If Outstanding Ta is present, schedule it */
- if(ue->dl.taCb.outStndngTa == TRUE)
- {
- rgSCHUtlReTxTa(cell, ue);
- }
- else
- {
- /* We need to reset state and also value of TA,
- * then we start the timer */
- ue->dl.taCb.ta = RGSCH_NO_TA_RQD;
- /* Start the timer only if TA is cfgd as FINITE value */
- if (ue->dl.taCb.cfgTaTmr)
- {
- rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_TA, ue->dl.taCb.cfgTaTmr);
- }
- }
- /* need to delete from the link list */
- cmLListDelFrm(&(cell->taUeLst), &(ue->taLnk));
- ue->taLnk.node = NULLP;
- }
- else
- {
- ue->dl.taCb.numRemSf--;
- }
- } /* end of taUeLst */
- return ROK;
-} /* end of rgSCHTomUtlProcTA */
-
-/** @brief This function handles filling of Hq reception request to
- * Per Hq Proc.
- *
- * @details
- *
- * Function:
- *
- * Processing steps:
- *
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-#ifdef TFU_UPGRADE
-S16 rgSCHTomUtlFillHqFdbkInfo
-(
-TfuRecpReqInfo *recpReqInfo,
-RgSchCellCb *cell,
-uint16_t validIdx,
-RgSchDlHqProcCb *hqCb,
-RgSchDlSf *nxtDlsf,
-TfuUeRecpReqInfo *pucchRecpInfo,
-RgSchDlHqProcCb *prvHqCb,
-RgSchErrInfo *err
-)
-#else
-S16 rgSCHTomUtlFillHqFdbkInfo
-(
-TfuRecpReqInfo *recpReqInfo,
-RgSchCellCb *cell,
-RgSchDlHqProcCb *hqCb,
-RgSchDlSf *nxtDlsf,
-TfuUeRecpReqInfo *pucchRecpInfo,
-RgSchDlHqProcCb *prvHqCb,
-RgSchErrInfo *err
-)
-#endif
-{
- S16 ret;
- RgSchDlHqTbCb *tbCb;
- uint32_t idx;
- Bool isAddToLst = FALSE;
-
- for (idx = 0 ;idx < 2; idx++)
- {
- if (HQ_TB_WAITING == hqCb->tbInfo[idx].state)
- {
- tbCb = &hqCb->tbInfo[idx];
-
- /* FOR ACK NAK REP */
- if ((hqCb->hqE->ue != NULLP) &&
- (hqCb->hqE->ue->measGapCb.isMeasuring == TRUE))
- {
- if ((tbCb->fbkRecpRepCntr) &&
- (--tbCb->fbkRecpRepCntr))
- {
- /* Add to next subfarme */
- /* Add this hqCb to the next dlSf's ackNakRepQ */
- cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
- &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
- tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
- tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
- }
-#ifdef TFU_UPGRADE
- rgSCHTomUtlMoveNxtOccasion(cell, hqCb->hqE->ue, validIdx);
-#endif
- continue;
- }
-#ifdef TFU_UPGRADE
- if (hqCb->tbCnt)
- {
- hqCb->tbCnt--;
- /* Go to the next node */
- continue;
- }
-#endif
-
-
- //if (hqCb != prvHqCb)
- {
- ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
- sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to Allocate TfuUeRecpReqInfo for cell");
- err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
- return ret;
- }
- pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
- if ((hqCb->hqE->ue != NULLP) /*&&
- ((tbCb->lchSchdData[0].lcId != 0) || (tbCb->taSnt ==
- TRUE))*/
- )
- {
- pucchRecpInfo->rnti = hqCb->hqE->ue->ueId;
- }
- else
- {
- if (hqCb->hqE->raCb)
- {
- pucchRecpInfo->rnti = hqCb->hqE->raCb->tmpCrnti;
- }
- }
-#ifndef TFU_UPGRADE
-#ifndef TFU_TDD
-#ifdef LTEMAC_SPS
- if (!hqCb->spsN1PucchRes.pres)
-#endif
- {
- pucchRecpInfo->t.pucchRecpReq.hqType =
- TFU_HQ_RECP_REQ_NORMAL;
- pucchRecpInfo->t.pucchRecpReq.t.nCce =
- hqCb->pdcch->nCce;
- }
-#ifdef LTEMAC_SPS
- else
- {
- pucchRecpInfo->t.pucchRecpReq.hqType =
- TFU_HQ_RECP_REQ_N1PUCCH;
- pucchRecpInfo->t.pucchRecpReq.t.n1Pucch =
- hqCb->spsN1PucchRes.val;
- }
-#endif
-#endif
- /* Handling of other types */
- pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
-#else /* TFU_UPGRADE */
- pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
- if ((hqCb->tbInfo[0].state == HQ_TB_WAITING) &&
- (hqCb->tbInfo[1].state == HQ_TB_WAITING))
- {
- pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz = 2; /* MIMO */
- }
- else
- {
- pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz = 1; /* NON-MIMO */
- }
- {
-#ifdef LTEMAC_SPS
- /* PucchRecpReq needs to be filled up for n1Pucch resource for SPS
- * ocassions */
- if (hqCb->spsN1PucchRes.pres)
- {
- pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
- }
- else
-#endif /* LTEMAC_SPS */
- {
- pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
- cell->pucchCfg.n1PucchAn);
- }
-#ifdef EMTC_ENABLE
- rgSCHEmtcFillPucchRecpInfo(cell, hqCb, &(pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0]));
-#endif
- }
-#endif/*TFU_UPGRADE*/
-
-#ifdef TFU_UPGRADE
- rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, hqCb->hqE->ue,
- pucchRecpInfo, validIdx,FALSE);
-#endif
-#ifdef EMTC_ENABLE
- /* Passing last parameter as FALSE in this case as it will be verified from hqCb*/
- isAddToLst = rgSCHEmtcAddRecpInfoToLst(hqCb,recpReqInfo, pucchRecpInfo,FALSE);
-#endif
- if(!isAddToLst)
- {
- cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
- }
- pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
- }
-
- if ((tbCb->fbkRecpRepCntr) &&
- (--tbCb->fbkRecpRepCntr))
- {
- /* Add to next subfarme */
- /* Add this hqCb to the next dlSf's ackNakRepQ */
- cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
- &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
- tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
- tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
- }
- break;
- }
- }
- return ROK;
-}/* end of rgSCHTomUtlFillHqFdbkInfo */
-
-#ifdef RG_5GTF
-/** @brief This function handles filling of Hq reception request to
- * Per Hq Proc.
- *
- * @details
- *
- * Function:rgSCHTomUtlFillHqFdbkFor5gtf
- *
- * Processing steps:
- *
- * @param [out] TfuRecpReqInfo *recpReqInfo
- * @param [in] RgSchCellCb *cell
- * @param [in] uint16_t validIdx,
- * @param [in] RgSchDlHqInfo *dlSfHqInfo,
- * @param [in] RgSchDlSf *dlSf,
- * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
- * @param [out] RgSchErrInfo *err
- *
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-static S16 rgSCHTomUtlFillHqFdbkFor5gtf
-(
-TfuRecpReqInfo *recpReqInfo,
-RgSchCellCb *cell,
-uint16_t validIdx,
-RgSchDlHqInfo *dlSfHqInfo,
-RgSchDlSf *dlSf,
-TfuUeRecpReqInfo *pucchRecpInfo,
-RgSchErrInfo *err
-)
-{
- S16 ret;
- RgSchUeCb *ue;
- TfuUePucchRecpReq *pucchReqInfo = NULLP;
-
- ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
-
- if (ue == NULLP)
- {
- return RFAILED;
- }
- ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
- sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to Allocate "
- "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId);
- err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
- return ret;
- }
- pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
- pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
- * instead of SPS-CRNTI */
-
- pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
-
- pucchReqInfo->uciInfo = TFU_XPUCCH_UCI_INFO;
-
- /* 5gtf TODO : Hardcoded nPUCCHIdx */
- pucchReqInfo->uciPduInfo.pucchIndex = 0;
-
- pucchReqInfo->uciPduInfo.numBits = 1;
-
- /* 5gtf TODO : CQI Periodicity Hardcoded to (n,0)*/
- if (RGSCH_TIMEINFO_SAME (recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn))
- {
- pucchReqInfo->uciPduInfo.numBits += 5;
- RG_SCH_ADD_TO_CRNT_TIME(recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn,
- ue->ue5gtfCb.cqiRiPer);
- }
-
- cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
- pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
- return ROK;
-}/* end of rgSCHTomUtlFillHqFdbkForFrmt1B */
-#endif
-
-#ifdef LTE_ADV
-/** @brief This function handles filling of Hq reception request to
- * Per Hq Proc.
- *
- * @details
- *
- * Function:rgSCHTomUtlFillHqFdbkForFrmt1B
- *
- * Processing steps:
- * Allocates the N1Pucch Resources based on teh A Value
- *
- * @param [out] TfuRecpReqInfo *recpReqInfo
- * @param [in] RgSchCellCb *cell
- * @param [in] uint16_t validIdx,
- * @param [in] RgSchDlHqInfo *dlSfHqInfo,
- * @param [in] RgSchDlSf *dlSf,
- * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
- * @param [out] RgSchErrInfo *err
- *
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-#ifdef TFU_UPGRADE
-static S16 rgSCHTomUtlFillHqFdbkForFrmt1B
-(
-TfuRecpReqInfo *recpReqInfo,
-RgSchCellCb *cell,
-uint16_t validIdx,
-RgSchDlHqInfo *dlSfHqInfo,
-RgSchDlSf *dlSf,
-TfuUeRecpReqInfo *pucchRecpInfo,
-RgSchErrInfo *err
-)
-#else
-static S16 rgSCHTomUtlFillHqFdbkForFrmt1B
-(
-TfuRecpReqInfo *recpReqInfo,
-RgSchCellCb *cell,
-RgSchDlHqInfo *dlSfHqInfo,
-RgSchDlSf *dlSf,
-TfuUeRecpReqInfo *pucchRecpInfo,
-RgSchErrInfo *err
-)
-#endif
-{
-#ifdef DEBUGP
- Inst inst = cell->instIdx;
-#endif
- S16 ret;
- CmLList *hqPNode;
- RgSchDlHqProcCb *hqCb = NULLP;
- RgSchUeCb *ue;
- TfuUePucchRecpReq *pucchReqInfo = NULLP;
- Bool isDatPresOnSecCell = FALSE;
- uint8_t primCellTbCount = 0;
-
- hqPNode = dlSfHqInfo->hqPLst.first;
- ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
-
- if (ue == NULLP)
- {
- return RFAILED;
- }
- ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
- sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to Allocate TfuUeRecpReqInfo for cellId=%d \n", cell->cellId);
- err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
- return ret;
- }
- pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
- pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
- * instead of SPS-CRNTI */
-
- pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
-
-#ifndef TFU_UPGRADE
- pucchReqInfo->hqType = TFU_HQ_RECP_REQ_NORMAL;
- /* Handling of other types */
- pucchReqInfo->type = TFU_UCI_HARQ;
-#else /* TFU_UPGRADE */
- pucchReqInfo->uciInfo = TFU_PUCCH_HARQ;
- /* Fill hqFdbkMode by using uciFrmtTyp from dlSfHqInfo */
- pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
- /* Fill HqSz by using totalTbCnt based on the TM mode and
- * the number of serv cells configured*/
-
- pucchReqInfo->hqInfo.hqSz = ue->f1bCsAVal;
- pucchReqInfo->hqInfo.pucchResCnt = ue->f1bCsAVal;
-
- memset(pucchReqInfo->hqInfo.hqRes,0xff,sizeof(uint16_t)*TFU_MAX_HQ_RES);
-#ifdef LTEMAC_SPS
- /* Two Resources needs to be configured if the
- * serving cell is in mimo mode else single
- * resource */
- if ((dlSf->relPdcch != NULLP) &&
- (RGSCH_TIMEINFO_SAME(recpReqInfo->timingInfo, ue->relPdcchFbkTiming)))
- {/* Pcell is having sps rel pdcch present */
- if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
- {/* prim cell is in mimo mode, use 0 and 1 */
- pucchReqInfo->hqInfo.hqRes[0] = (dlSf->relPdcch->nCce +
- cell->pucchCfg.n1PucchAn);
- pucchReqInfo->hqInfo.hqRes[1] = pucchReqInfo->hqInfo.hqRes[0] + 1;
-
-
- }else
- {
- pucchReqInfo->hqInfo.hqRes[2] = (dlSf->relPdcch->nCce +
- cell->pucchCfg.n1PucchAn);
- }
- /* Release the pdcch so that it will not further processed */
- rgSCHUtlPdcchPut(ue->cell,&dlSf->pdcchInfo, dlSf->relPdcch);
- dlSf->relPdcch = NULLP;/* only one UE will be scheduled for release pdcch order in one tti */
- }
-#endif/*LTEMAC_SPS*/
-#endif/*TFU_UPGRADE*/
- while(hqPNode)
- {
- hqCb = (RgSchDlHqProcCb *)hqPNode->node;
- hqPNode = hqPNode->next;
- /* In case of CSI + 1BCS , CSI will be
- * dropped if scheduling is present on
- * seconday cell.36.213 10.1.1
- * */
- if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
- {
- isDatPresOnSecCell = TRUE;
- }else
- {
- if ((hqCb->tbInfo[0].state == HQ_TB_WAITING) &&
- (hqCb->tbInfo[1].state == HQ_TB_WAITING))
- {
- primCellTbCount = 2;
- }else
- {
- primCellTbCount = 1;
- }
- }
-#ifndef TFU_UPGRADE
- pucchReqInfo->t.nCce = hqCb->pdcch->nCce;
-#else
- {
- switch(ue->f1bCsAVal)
- {/* A Value */
- case RG_SCH_A_VAL_2:
- /* harq(0) is primary harq(1) is secondary) */
- if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
- {
- pucchReqInfo->hqInfo.hqRes[1] = ue->n1PucchF1bResCb.\
- cw1N1Res[hqCb->tpc].n1PucchIdx;
- }
- else/* primary cell */
- {
-#ifdef LTEMAC_SPS
- /* Need to consider only sps occasions */
- if (hqCb->spsN1PucchRes.pres)
- {
- pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
- }
- else
-#endif /* LTEMAC_SPS */
- {
-
- pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
- cell->pucchCfg.n1PucchAn);
- }
- }
- break;
- case RG_SCH_A_VAL_3:
- /* Serving cell in mimo mode should be
- * in 0 and 1 and the serving cell in siso
- * mode should be in 2 indices */
- if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
- {
- uint8_t cellIdx = ue->cellIdToCellIdxMap[RG_SCH_CELLINDEX(hqCb->hqE->cell)];
- if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[cellIdx]->txMode.txModeEnum) > 1)
- {/* Sec cell is in mimo mode, use 0 and 1 */
- pucchReqInfo->hqInfo.hqRes[0] =
- ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
-
- pucchReqInfo->hqInfo.hqRes[1] =
- ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
- }
- else
- {/* Sec cell is in siso mode, use 2 */
- pucchReqInfo->hqInfo.hqRes[2] =
- ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
- }
- }
- else
- {/* primary cell hq */
- if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
- {/* prim cell is in mimo mode, use 0 and 1 */
-#ifdef LTEMAC_SPS
- if (hqCb->spsN1PucchRes.pres)
- {/* SPS occasions */
- pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
- pucchReqInfo->hqInfo.hqRes[1] = hqCb->spsN1PucchRes.val + 1;
- }
- else
-#endif /* LTEMAC_SPS */
- {
- pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
- cell->pucchCfg.n1PucchAn);
- pucchReqInfo->hqInfo.hqRes[1] = (hqCb->pdcch->nCce +
- cell->pucchCfg.n1PucchAn + 1);
- }
- }
- else
- {/* prim cell is in siso mode use 2 */
-#ifdef LTEMAC_SPS
- /* Need to consider only sps occasions */
- if (hqCb->spsN1PucchRes.pres)
- {
- pucchReqInfo->hqInfo.hqRes[2] = hqCb->spsN1PucchRes.val;
- }
- else
-#endif /* LTEMAC_SPS */
- {
-
- pucchReqInfo->hqInfo.hqRes[2] = (hqCb->pdcch->nCce +
- cell->pucchCfg.n1PucchAn);
-
- }
- }
- }
- break;
- case RG_SCH_A_VAL_4:
- {
- if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
- {/* 2 and 3 for sec cell */
- pucchReqInfo->hqInfo.hqRes[2] =
- ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
- pucchReqInfo->hqInfo.hqRes[3] =
- ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
- }
- else/* primary cell */
- {/* 0 and 1 are for primary cell */
-#ifdef LTEMAC_SPS
- /* Need to consider only sps occasions */
- if (hqCb->spsN1PucchRes.pres)
- {
- pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
- pucchReqInfo->hqInfo.hqRes[1] = hqCb->spsN1PucchRes.val + 1;
- }
- else
-#endif /* LTEMAC_SPS */
- {
-
- pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
- cell->pucchCfg.n1PucchAn);
- pucchReqInfo->hqInfo.hqRes[1] = (hqCb->pdcch->nCce +
- cell->pucchCfg.n1PucchAn + 1);
- }
- }
- }
-
- break;
- default:
- /* TOD:: Add error print */
- break;
- }
- }
-#endif/*TFU_UPGRADE*/
- }
-#ifdef TFU_UPGRADE
-
-#ifdef CA_DBG
- {
- gF1bCsCount++;
- gF1bCsPres = TRUE;
- }
-
-#endif
- rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, ue,
- pucchRecpInfo, validIdx,isDatPresOnSecCell);
-
- /* Channel selection wil not be used in case of
- * CQI + HARQ. if the data was present only on
- * primary cell */
- if((isDatPresOnSecCell == FALSE) &&
- (dlSfHqInfo->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS))
- {/* Data is present only on primary cell */
-
- switch(pucchReqInfo->uciInfo)
- {
- case TFU_PUCCH_HARQ_SRS:
- case TFU_PUCCH_HARQ_CQI:
- case TFU_PUCCH_HARQ_SR_SRS:
- case TFU_PUCCH_HARQ_SR_CQI:
- {
- dlSfHqInfo->uciFrmtTyp = RG_SCH_UCI_FORMAT1A_1B;
- pucchReqInfo->hqInfo.hqSz = primCellTbCount;
- pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
- }
- break;
- default:
- {
- break;
- }
- }
- }
-#endif/*TFU_UPGRADE*/
- cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
- pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
- return ROK;
-}/* end of rgSCHTomUtlFillHqFdbkForFrmt1B */
-/** @brief This function handles filling of Hq reception request to
- * Per Hq Proc.
- *
- * @details
- *
- * Function:rgSCHTomUtlFillHqFdbkForFrmt3
- *
- * Processing steps:
- * Allocates the N1Pucch Resources based on teh A Value
- *
- * @param [out] TfuRecpReqInfo *recpReqInfo
- * @param [in] RgSchCellCb *cell
- * @param [in] uint16_t validIdx,
- * @param [in] RgSchDlHqInfo *dlSfHqInfo,
- * @param [in] RgSchDlSf *dlSf,
- * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
- * @param [out] RgSchErrInfo *err
- *
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-#ifdef TFU_UPGRADE
-static S16 rgSCHTomUtlFillHqFdbkForFrmt3
-(
-TfuRecpReqInfo *recpReqInfo,
-RgSchCellCb *cell,
-uint16_t validIdx,
-RgSchDlHqInfo *dlSfHqInfo,
-RgSchDlSf *dlSf,
-TfuUeRecpReqInfo *pucchRecpInfo,
-RgSchErrInfo *err
-)
-#else
-static S16 rgSCHTomUtlFillHqFdbkForFrmt3
-(
-TfuRecpReqInfo *recpReqInfo,
-RgSchCellCb *cell,
-RgSchDlHqInfo *dlSfHqInfo,
-RgSchDlSf *dlSf,
-TfuUeRecpReqInfo *pucchRecpInfo,
-RgSchErrInfo *err
-)
-#endif
-{
-#ifdef DEBUGP
- Inst inst = cell->instIdx;
-#endif
- S16 ret;
- //CmLList *hqPNode;
- RgSchUeCb *ue;
- TfuUePucchRecpReq *pucchReqInfo = NULLP;
-
- //hqPNode = dlSfHqInfo->hqPLst.first;
- ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
-
- if (ue == NULLP)
- {
- return RFAILED;
- }
- ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
- sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to Allocate "
- "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId);
- err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
- return ret;
- }
- pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
- pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
- * instead of SPS-CRNTI */
-
- pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
-
-#ifndef TFU_UPGRADE
- pucchReqInfo->hqType = TFU_HQ_RECP_REQ_NORMAL;
- /* Handling of other types */
- pucchReqInfo->type = TFU_UCI_HARQ;
-#else /* TFU_UPGRADE */
- pucchReqInfo->uciInfo = TFU_PUCCH_HARQ;
- /* Fill hqFdbkMode by using uciFrmtTyp from dlSfHqInfo */
- pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
- /* Fill HqSz by using totalTbCnt based on the TM mode and
- * the number of serv cells configured*/
-
- pucchReqInfo->hqInfo.hqSz = ue->f1bCsAVal;
- pucchReqInfo->hqInfo.pucchResCnt = 1;
-
- memset(pucchReqInfo->hqInfo.hqRes,0xff,sizeof(uint16_t)*TFU_MAX_HQ_RES);
-#endif/*TFU_UPGRADE*/
- pucchReqInfo->hqInfo.hqRes[0] = dlSfHqInfo->n3ScellPucch.n3PucchIdx;
-#ifdef TFU_UPGRADE
- rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, ue,
- pucchRecpInfo, validIdx,TRUE);
-#endif/*TFU_UPGRADE*/
- cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
- pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
- return ROK;
-}/* end of rgSCHTomUtlFillHqFdbkForFrmt3 */
-
-#endif/*LTE_ADV*/
-
-/** @brief This function handles filling of HARQ feedback recption request to
- * PHY.
- *
- * @details
- *
- * Function:
- *
- * Processing steps:
- *
- * @param [out] TfuRecpReqInfo *recpReqInfo
- * @param [in] RgSchCellCb *cell
- * @param [out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-#ifdef TFU_UPGRADE
-static S16 rgSCHTomUtlFillHqFdbkRecpReq
-(
-TfuRecpReqInfo *recpReqInfo,
-RgSchCellCb *cell,
-uint16_t validIdx,
-RgSchErrInfo *err
-)
-#else
-static S16 rgSCHTomUtlFillHqFdbkRecpReq
-(
-TfuRecpReqInfo *recpReqInfo,
-RgSchCellCb *cell,
-RgSchErrInfo *err
-)
-#endif
-{
- CmLList *node;
- RgSchDlHqProcCb *hqCb;
- CmLteTimingInfo futTime;
- RgSchDlSf *dlSf;
- RgSchDlSf *nxtDlsf;
- TfuUeRecpReqInfo *pucchRecpInfo = NULLP;
- RgSchUeCb *ue;
- RgSchDlHqProcCb *prvHqCb=NULLP;
-
-#ifdef CA_DBG
- {
- gF1bCsPres = FALSE;
- }
-#endif
- /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper output
- * if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME() as it is
- * serving the purpose */
- RGSCHDECRFRMCRNTTIME(cell->crntTime, futTime, (RG_SCH_CMN_HARQ_INTERVAL -
- TFU_RECPREQ_DLDELTA));
- dlSf = rgSCHUtlSubFrmGet (cell, futTime);
- /* Get the next dlsf as well */
- RG_SCH_ADD_TO_CRNT_TIME(futTime, futTime, 1)
- nxtDlsf = rgSCHUtlSubFrmGet (cell, futTime);
-
- prvHqCb = NULLP;
-
- if (dlSf->ueLst.count != 0)
- {
- node = dlSf->ueLst.first;
- while (node)
- {
- ue = (RgSchUeCb *)(node->node);
- node = node->next;
-
- if(ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx].isPuschHarqRecpPres == TRUE)
- {/* This UE is already considered for PUSCH
- Ignore for PUCCH */
- continue;
- }
- rgSCHTomUtlFillHqFdbkFor5gtf(recpReqInfo, cell, validIdx,
- &ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx], dlSf, pucchRecpInfo, err);
- } /* end of while */
- } /* If hq is expected */
-
- if (dlSf->msg4HqPLst.count != 0)
- {
- prvHqCb = NULLP;
- node = dlSf->msg4HqPLst.first;
- while (node)
- {
- hqCb = (RgSchDlHqProcCb*)(node->node);
- node = node->next;
- //TODO_SID: need to check validIdx
- rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, validIdx, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err);
- prvHqCb = hqCb;
- } /* end of while */
- }
-
- /* Check with TDD Code */
- /* FOR ACK NACK REP */
- return ROK;
-} /* end of rgSCHTomUtlFillHqFdbkRecpReq */
-#ifdef TFU_UPGRADE
-/** @brief This function handles filling of SR reception request to
- * PHY.
- *
- * @details
- *
- * Function:
- *
- * Processing steps:
- *
- * @param [out] TfuRecpReqInfo *recpReqInfo
- * @param [in] RgSchCellCb *cell
- * @param [out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-#ifdef UNUSED_FUNC
-static S16 rgSCHTomUtlFillSrRecpReq
-(
-TfuRecpReqInfo *recpReqInfo,
-RgSchCellCb *cell,
-uint16_t validIdx,
-RgSchErrInfo *err
-)
-{
- CmLList *node;
- TfuUeRecpReqInfo *pucchRecpInfo;
- S16 ret;
-
- RgSchUeCb *ue;
- Bool isAddToLst;
-#ifdef LTEMAC_SPS
- RgSchCmnUlUeSpsInfo *ulSpsUe = NULL;
-#endif
-
-
- isAddToLst = FALSE;
-
- node = cell->pCqiSrsSrLst[validIdx].srLst.first;
- while(node)
- {
- ue = (RgSchUeCb *)(node->node);
- /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
- node = node->next;
- if(ue == NULLP)
- {
- continue;
- }
- if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
- sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to Allocate TfuUeRecpReqInfo for cell RNTI:%d",ue->ueId);
- err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
- return ret;
- }
-#ifdef TFU_ALLOC_EVENT_NO_INIT
- memset(&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
- pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
-#endif
- /*Fill SR params*/
-
-
-#ifdef LTEMAC_SPS
- /* Should we check for Rel8 and above???
- * Dont send SR recp req if logicalChannelSR-Mask enabled and UL SPS is
- * active*/
- ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue, cell);
- /* Avoiding check for ulSpsEnabled as isUlSpsActv FALSE if sps is not enabled*/
- if((ue->ul.ulSpsCfg.isLcSRMaskEnab) &&
- (ulSpsUe->isUlSpsActv))
- {
- rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
- continue;
- }
-#endif
-
- pucchRecpInfo->rnti = ue->ueId;
- pucchRecpInfo->t.pucchRecpReq.srInfo.n1PucchIdx =
- ue->srCb.srCfg.srSetup.srResIdx;
- pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR;
- rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
- rgSCHTomUtlFillCqiSrsWithSr(cell, ue, recpReqInfo,
- pucchRecpInfo, validIdx);
-#ifdef EMTC_ENABLE
- isAddToLst = rgSCHEmtcAddRecpInfoToLst(NULLP,recpReqInfo, pucchRecpInfo,ue->isEmtcUe);
-#endif
- if(!isAddToLst)
- {
- cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
- }
- pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
- }
- return ROK;
-}/* end of rgSCHTomUtlFillSrRecpReq */
-#endif
-#endif
-/** @brief This function tells will the UE has a periodic CQI/PMI/RI
- * reporting
- *
- * @details
- *
- * Function:
- *
- * Processing steps:
- *
- * @param [in] RgSchUeCb *ue
- * @param [out] Bool *willueRprtCqiRi
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-
-static S16 rgSCHTomUtlWillUeRprtCqiRi
-(
-RgSchUeCb *ue,
-Bool *willueRprtCqiRi
-)
-{
- /* Intialising Reporting probability as TRUE */
- *willueRprtCqiRi = TRUE;
-
- /* Checking the cases in which UE will not report CQIPMI/RI */
- if(ue->isDrxEnabled && ue->drxCb)
- {
-#ifdef LTEMAC_R9
- if(ue->drxCb->cqiMask.pres && ue->drxCb->cqiMask.val == RGR_DRX_SETUP)
- {/*cqiMask is setup by upper layers */
- if((ue->drxCb->drxUlInactvMask & RG_SCH_DRX_ONDUR_BITMASK) ==
- RG_SCH_DRX_ONDUR_BITMASK)
- {/*onDuration NOT running, do not expect cqi/pmi/ri*/
- *willueRprtCqiRi = FALSE;
- }
- return ROK;
- }
-#endif /*end of LTEMAC_R9*/
- /* ccpu00134258: Fix for CQI DRX issue*/
- if(ue->drxCb->onDurTmrLen > 2)
- {
- if ( !RG_SCH_DRX_UL_IS_UE_ACTIVE(ue->drxCb) )
- {/*UE is not active, do not expect cqi/pmi/ri*/
- *willueRprtCqiRi = FALSE;
- }
- }
- }/*ue->isDrxEnabled*/
- return ROK;
-} /*End of rgSCHTomUtlWillUeRprtCqiRi*/
-
-/** @brief This function handles filling of RI reception request to
- * PHY.
- *
- * @details
- *
- * Function:
- *
- * Processing steps:
- *
- * @param [out] TfuRecpReqInfo *recpReqInfo
- * @param [in] RgSchCellCb *cell
- * @param [in] uint16_t validIdx
- * @param [out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-#ifdef UNUSED_FUNC
-static S16 rgSCHTomUtlFillRiRecpReq
-(
-TfuRecpReqInfo *recpReqInfo,
-RgSchCellCb *cell,
-uint16_t validIdx,
-RgSchErrInfo *err
-)
-{
- CmLList *node;
- TfuUeRecpReqInfo *pucchRecpInfo;
- S16 ret;
- RgSchUeCb *ue;
- Bool willUeRprtCqi; /* Flag set due to CQI Mask
- and UE inactive state (DRX) */
- RgSchUePCqiCb *riCb = NULLP;
-
- node = cell->pCqiSrsSrLst[validIdx].riLst.first;
- while(node)
- {
- riCb = (RgSchUePCqiCb *)(node->node);
- ue = riCb->servCellInfo->ue;
- /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
- node = node->next;
- if(riCb->riRecpPrcsd)
- {
- /*ccpu00140578:: RI Proecssing is already done for this TTI
- * as part of PUSCH reception process or HARQ
- * Reception processing. Hence skipping this UE
- * */
- riCb->riRecpPrcsd = FALSE;
- continue;
- }
- if(riCb->riDist ==0)
- {
- rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
-#ifdef XEON_SPECIFIC_CHANGES
- if(RGSCH_TIMEINFO_SAME(cell->crntTime, ue->riRecpTime))
- {
- continue;
- }
-#endif
-#ifdef LTE_ADV
- if((TRUE == riCb->isRiIgnoByCollsn)
- || (willUeRprtCqi == FALSE))
-#else
- if(willUeRprtCqi == FALSE)
-#endif
- {
- rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
- continue;
- }
- if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
- sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to Allocate "
- "TfuUeRecpReqInfo for cell RNTI:%d",ue->ueId);
- err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
- return ret;
- }
-#ifdef TFU_ALLOC_EVENT_NO_INIT
- memset(&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
- pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
-#endif
- /*Fill RI params*/
- pucchRecpInfo->rnti = ue->ueId;
- pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
- riCb->cqiCfg.cqiSetup.cqiPResIdx;
- pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = riCb->riNumBits;
- pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_CQI;
- ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
-#ifdef LTE_ADV
- ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
- riCb->servCellInfo->sCellIdx;
-#endif
- rgSCHTomUtlFillRiBitWidthInfo(ue);
- rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
- if (ue->nPCqiCb->nCqiTrIdx == validIdx)
- {
- rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, ue->nPCqiCb);
- }
- if((ue->srsCb.nSrsTrIdx == validIdx) && (ue->srsCb.srsDist ==0))
- {
- rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
- }
- cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
- pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
- }
- else
- {
- riCb->riDist--;
- }
- }
- return ROK;
-}/* end of rgSCHTomUtlFillRiRecpReq */
-#endif
-#ifdef RG_5GTF
-/** @brief This function handles filling of 5GTF CQI-RI reception request to
- * PHY.
- *
- * @details
- *
- * Function:
- *
- * Processing steps:
- *
- * @param [out] TfuRecpReqInfo *recpReqInfo
- * @param [in] RgSchCellCb *cell
- * @param [in] uint16_t validIdx
- * @param [out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-
-#ifdef UNUSED_FUNC
-static S16 rgSCHTomUtlFillCqiRiRecpReq
-(
-TfuRecpReqInfo *recpReqInfo,
-RgSchCellCb *cell,
-uint16_t validIdx,
-RgSchErrInfo *err
-)
-{
- TfuUeRecpReqInfo *pucchRecpInfo;
- RgSchUeCb *ue = NULLP;
- uint16_t ret;
-
- while ((ue = rgSCHDbmGetNextUeCb(cell, ue)) != NULLP)
- {
- if (RGSCH_TIMEINFO_SAME (recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn))
- {
- if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
- sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to Allocate TfuUeRecpReqInfo for cell RNTI:%d ", ue->ueId);
- err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
- return ret;
- }
-#ifdef TFU_ALLOC_EVENT_NO_INIT
- memset(&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
- pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
-#endif
- pucchRecpInfo->rnti = ue->ueId;
- pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_XPUCCH_UCI_INFO;
- pucchRecpInfo->t.pucchRecpReq.uciPduInfo.pucchIndex = 0;
- pucchRecpInfo->t.pucchRecpReq.uciPduInfo.numBits = 5;
-
- RG_SCH_ADD_TO_CRNT_TIME(recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn,
- ue->ue5gtfCb.cqiRiPer);
- cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
- pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
- }
- }
- return ROK;
-}/* end of rgSCHTomUtlFillCqiRiRecpReq */
-#endif
-#endif
-/** @brief This function handles filling of PCQI reception request to
- * PHY.
- *
- * @details
- *
- * Function:
- *
- * Processing steps:
- *
- * @param [out] TfuRecpReqInfo *recpReqInfo
- * @param [in] RgSchCellCb *cell
- * @param [in] uint16_t validIdx
- * @param [out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-#ifdef UNUSED_FUNC
-static S16 rgSCHTomUtlFillPcqiRecpReq
-(
-TfuRecpReqInfo *recpReqInfo,
-RgSchCellCb *cell,
-uint16_t validIdx,
-RgSchErrInfo *err
-)
-{
- CmLList *node;
- TfuUeRecpReqInfo *pucchRecpInfo;
- S16 ret;
- RgSchUeCb *ue;
- uint8_t ri; /*RI value*/
- Bool willUeRprtCqi; /* Flag set due to CQI Mask and UE Inactive state (DRX)*/
- uint8_t cqiPmiSz;
- RgSchUePCqiCb *cqiCb = NULLP;
- Bool isAddToLst = FALSE;
-
- node = cell->pCqiSrsSrLst[validIdx].cqiLst.first;
- while(node)
- {
- cqiCb = (RgSchUePCqiCb*)(node->node);
- ue = cqiCb->servCellInfo->ue;
- /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
- node = node->next;
- rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
-#ifdef LTE_ADV
- if ((cqiCb->isCqiIgnoByCollsn == TRUE) ||
- (willUeRprtCqi == FALSE))
-#else
- if(willUeRprtCqi == FALSE)
-#endif
- {
- rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
- continue;
- }
-
- ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
-#ifdef LTE_ADV
- ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
- cqiCb->servCellInfo->sCellIdx;
-#endif
- cqiPmiSz = rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
- if(!cqiPmiSz)
- {
- DU_LOG("\nERROR --> SCH : RNTI:%d Unable to Fill CqiPmi size", ue->ueId);
- continue;
- }
-
- if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
- sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to Allocate TfuUeRecpReqInfo for cell RNTI:%d ", ue->ueId);
- err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
- return ret;
- }
-#ifdef TFU_ALLOC_EVENT_NO_INIT
- memset(&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
- pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
-#endif
-
- /*Fill PCQI params*/
- pucchRecpInfo->rnti = ue->ueId;
- pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
- cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
- pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = cqiPmiSz;
- pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_CQI;
- rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
- if((ue->srsCb.nSrsTrIdx == validIdx) && (ue->srsCb.srsDist ==0))
- {
- rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
- }
-#ifdef EMTC_ENABLE
- isAddToLst = rgSCHEmtcAddRecpInfoToLst(NULLP,recpReqInfo, pucchRecpInfo,ue->isEmtcUe);
-#endif
- if(!isAddToLst)
- {
- cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
- }
- pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
- }
- return ROK;
-}/* end of rgSCHTomUtlFillPcqiRecpReq */
-/** @brief This function handles filling of SRS reception request to
- * PHY.
- *
- * @details
- *
- * Function:
- *
- * Processing steps:
- *
- * @param [out] TfuRecpReqInfo *recpReqInfo
- * @param [in] RgSchCellCb *cell
- * @param [in] uint16_t validIdx
- * @param [out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-static S16 rgSCHTomUtlFillSrsRecpReq
-(
-TfuRecpReqInfo *recpReqInfo,
-RgSchCellCb *cell,
-uint16_t validIdx,
-RgSchErrInfo *err
-)
-{
- CmLList *node;
- TfuUeRecpReqInfo *pucchRecpInfo;
- S16 ret;
- RgSchUeCb *ue;
-
- node = cell->pCqiSrsSrLst[validIdx].srsLst.first;
- while(node)
- {
- ue = (RgSchUeCb *)(node->node);
- /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
- node = node->next;
- if(ue->srsCb.srsRecpPrcsd)
- {
- /* ccpu00140578::SRS Proecssing is already done for this TTI
- * as part of PUSCH or HARQ reception process and
- * hence skipping this UE */
- ue->srsCb.srsRecpPrcsd = FALSE;
- continue;
- }
-
- if(ue->srsCb.srsDist ==0)
- {
- /* We need to add the recp request to be sent on the pucchANRep value. */
- if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
- sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to Allocate TfuUeRecpReqInfo for RNTI:%d ",ue->ueId);
- err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
- return ret;
- }
-
-#ifdef TFU_ALLOC_EVENT_NO_INIT
- pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
-#endif
-
- /*Fill SRS params*/
- pucchRecpInfo->rnti = ue->ueId;
- pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
- (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
- pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
- ue->srsCb.srsCfg.srsSetup.fDomPosi;
- pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
- (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
- pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
- ue->srsCb.srsCfg.srsSetup.txComb;
- pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
- ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
- pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
- (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
-
- pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SRS;
- rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
- cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
- pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
- }
- else
- {
- ue->srsCb.srsDist--;
- }
- }
- return ROK;
-}/* end of rgSCHTomUtlFillSrsRecpReq */
-#endif
-#ifndef TFU_UPGRADE
-/** @brief This function handles filling of data reception requests for
- * PUSCH and MSG3.
- *
- * @details
- *
- * Function:
- *
- * Processing steps:
- *
- * @param [out] TfuRecpReqInfo *recpReqInfo
- * @param [in] RgSchCellCb *cell
- * @param [out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-static S16 rgSCHTomUtlFillDatRecpReq
-(
-TfuRecpReqInfo *recpReqInfo,
-RgSchCellCb *cell,
-RgSchErrInfo *err
-)
-{
- S16 ret;
- RgSchUlAlloc *alloc;
- TfuUeRecpReqInfo *datRecpInfo;
-
-
- /* processing steps are
- * - Run through the UL allocations going out in this subframe.
- * - Run through the UL receptions expected the next subframe.
- */
- alloc = rgSCHUtlFirstRcptnReq (cell);
- while(alloc)
- {
- /* FOR ACK NACK REP */
- if (NULLP != alloc->ue)
- {
- /* If measuring or ackNakRep we shall not send dat RecpReq */
- if ((alloc->ue->measGapCb.isMeasuring == TRUE) ||
- (alloc->ue->ackNakRepCb.isAckNakRep == TRUE))
- {
- alloc = rgSCHUtlNextRcptnReq (cell, alloc);
- continue;
- }
-
- }
- if ((ret = rgSCHUtlGetEventMem((Ptr *)&datRecpInfo,
- sizeof(TfuUeRecpReqInfo),
- &(recpReqInfo->memCp))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to Allocate TfuUeRecpReqInfo for RNTI:%d ", alloc->ue->ueId);
- err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
- return ret;
- }
- if (!alloc->forMsg3)
- {
- datRecpInfo->type = TFU_RECP_REQ_PUSCH;
- rgSCHUtlAllocRcptInfo (alloc,
- &datRecpInfo->rnti,
- &datRecpInfo->t.puschRecpReq.mcs,
- &datRecpInfo->t.puschRecpReq.rbStart,
- &datRecpInfo->t.puschRecpReq.numRb,
- &datRecpInfo->t.puschRecpReq.rv,
- &datRecpInfo->t.puschRecpReq.size,
- &datRecpInfo->t.puschRecpReq.modType,
- &datRecpInfo->t.puschRecpReq.isRtx,
- &datRecpInfo->t.puschRecpReq.nDmrs,
- &datRecpInfo->t.puschRecpReq.ndi,
- &datRecpInfo->t.puschRecpReq.harqProcId
- );
- }
- else
- {
- datRecpInfo->type = TFU_RECP_REQ_MSG3;
- rgSCHUtlAllocRcptInfo (alloc,
- &datRecpInfo->rnti,
- &datRecpInfo->t.msg3RecpReq.mcs,
- &datRecpInfo->t.msg3RecpReq.rbStart,
- &datRecpInfo->t.msg3RecpReq.numRb,
- /*ccpu00128993 - MOD - fix for msg3 softcombining bug*/
- &datRecpInfo->t.msg3RecpReq.rv,
- &datRecpInfo->t.msg3RecpReq.size,
- &datRecpInfo->t.msg3RecpReq.modType,
- &datRecpInfo->t.msg3RecpReq.isRtx,
- &datRecpInfo->t.msg3RecpReq.nDmrs,
- &datRecpInfo->t.msg3RecpReq.ndi,
- &datRecpInfo->t.msg3RecpReq.harqProcId
- );
-
- }
- /* Other fields of datRecpInfo shall be filled
- * here for new features */
- cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(datRecpInfo->lnk));
- datRecpInfo->lnk.node = (PTR)datRecpInfo;
-
- alloc = rgSCHUtlNextRcptnReq (cell, alloc);
- } /* end of while */
- return ROK;
-} /* end of rgSCHTomUtlFillDatRecpReq */
-
-#else
-/** @brief This function handles filling of data reception requests for
- * PUSCH and MSG3.
- *
- * @details
- *
- * Function:
- *
- * Processing steps:
- *
- * @param [out] TfuRecpReqInfo *recpReqInfo
- * @param [in] RgSchCellCb *cell
- * @param [in] uint16_t validIdx
- * @param [out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-static S16 rgSCHTomUtlFillDatRecpReq
-(
-TfuRecpReqInfo *recpReqInfo,
-RgSchCellCb *cell,
-uint16_t validIdx,
-RgSchErrInfo *err
-)
-{
- CmLteTimingInfo dci0Time;
- uint8_t idx;
- S16 ret;
- RgSchUlAlloc *alloc;
- TfuUeRecpReqInfo *datRecpInfo;
-
- Bool isAperiodic = FALSE; /*Set when Aperiodic CQI is expected */
- uint8_t numUePerTti = 0;
-
- if((0 == (recpReqInfo->timingInfo.sfn % 30)) && (0 == recpReqInfo->timingInfo.slot))
- {
- //DU_LOG("\nERROR --> SCH : 5GTF_CHECK rgSCHTomUtlFillDatRecpReq (%d : %d)\n",\
- recpReqInfo->timingInfo.sfn, recpReqInfo->timingInfo.slot);
- }
- /* processing steps are
- * - Run through the UL allocations going out in this subframe.
- * - Run through the UL receptions expected the next subframe.
- */
-
- alloc = rgSCHUtlFirstRcptnReq (cell);
- while(alloc)
- {
- isAperiodic = FALSE;
- ret = rgSCHUtlGetEventMem((Ptr *)&datRecpInfo,
- sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
- if(ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to Allocate "
- "TfuUeRecpReqInfo for RNTI:%d ", alloc->rnti);
- err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
- return ret;
- }
-#ifdef TFU_ALLOC_EVENT_NO_INIT
- datRecpInfo->t.puschRecpReq.initialNSrs.pres = FALSE;
- datRecpInfo->t.puschRecpReq.initialNumRbs.pres = FALSE;
-#endif
- datRecpInfo->type = TFU_RECP_REQ_PUSCH;
- /* Check if this if for MSG3 - no scope for feedback along with it. */
- if ((FALSE == alloc->forMsg3))
- {
- /* Check if any DL HARQ processes has a feedback coming at the time of
- * this reception request.
- */
-/* ACC-TDD */
- if(alloc->ue)
- {
- RGSCHDECRFRMCRNTTIME(cell->crntTime,dci0Time,(RGSCH_ULCTRL_RECP_DIST));
-
- idx = (dci0Time.sfn * RGSCH_NUM_SUB_FRAMES_5G + dci0Time.slot)%
- RGSCH_ULCTRL_RECP_DIST;
- UNUSED(idx);
- datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA;
- datRecpInfo->rnti = alloc->rnti;
- rgSCHUtlAllocRcptInfo (cell,alloc, &recpReqInfo->timingInfo,
- &datRecpInfo->t.puschRecpReq.ulSchInfo);
- }
- }
- else /*Enters for Msg3 == TRUE condition*/
- {
- /* ccpu00130884 - ADD - HO case when Msg3 alloc and Cqi/Ri/SRS opportunity
- * occur at same time */
- if(NULLP != alloc->ue)
- {
-
- /* Only DATA is expected */
- datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA;
- datRecpInfo->rnti = alloc->rnti;
- rgSCHUtlAllocRcptInfo (cell,alloc, &recpReqInfo->timingInfo,
- &datRecpInfo->t.puschRecpReq.ulSchInfo);
- }
- }
- if(alloc->ue)
- {
- if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA &&
- datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_SRS &&
- isAperiodic == FALSE)
- {
- datRecpInfo->t.puschRecpReq.initialNumRbs.pres = TRUE;
- datRecpInfo->t.puschRecpReq.initialNumRbs.val = alloc->ue->initNumRbs;
- }
- else
- {
- datRecpInfo->t.puschRecpReq.initialNumRbs.pres = FALSE;
- }
- }
- cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(datRecpInfo->lnk));
- datRecpInfo->lnk.node = (PTR)datRecpInfo;
- alloc = rgSCHUtlNextRcptnReq (cell, alloc);
- numUePerTti++;
- } /* end of while */
-
- if(numUePerTti && (numUePerTti < RG_MAX_NUM_UE_PER_TTI))
- {
- cell->ulNumUeSchedPerTti[numUePerTti-1]++;
- gUlNumUePerTti[numUePerTti - 1]++;
- }
- return ROK;
-} /* end of rgSCHTomUtlFillDatRecpReq */
-#endif
-/* rg009.201. Added changes of TFU_UPGRADE */
-#ifdef TFU_UPGRADE
-/***********************************************************
- *
- * Func : rgSCHTomUtlFillRiBitWidthInfo
- *
- *
- * Desc : Fills the RI BitWidth and stores it for decoding.
- *
- * Ret : S16
- * ROK - Success
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-S16 rgSCHTomUtlFillRiBitWidthInfo
-(
-RgSchUeCb *ueCb
-)
-{
- RgSchUePCqiCb *riCb = ueCb->nPRiCb;
-
- if (ueCb->mimoInfo.txMode != RGR_UE_TM_3 &&
- ueCb->mimoInfo.txMode != RGR_UE_TM_4)
- {
- return RFAILED;
- }
-
- ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUCCH;
- ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode=
- (TfuDlCqiPucchMode)riCb->cqiCfg.cqiSetup.prdModeEnum;
- switch(ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode)
- {
- case TFU_PUCCH_CQI_MODE10:
- ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info.type = TFU_RPT_RI;
- ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info.u.ri =
- riCb->riNumBits;
- break;
- case TFU_PUCCH_CQI_MODE11:
- ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info.type = TFU_RPT_RI;
- ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info.u.ri =
- riCb->riNumBits;
- break;
- case TFU_PUCCH_CQI_MODE20:
- ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info.type = TFU_RPT_RI;
- ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info.u.ri =
- riCb->riNumBits;
- break;
- case TFU_PUCCH_CQI_MODE21:
- ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info.type = TFU_RPT_RI;
- ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info.u.ri =
- riCb->riNumBits;
- break;
- default:
- break;
- }
-
- RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
- return ROK;
-}
-
-/***********************************************************
- *
- * Func : rgSCHTomUtlFetchPcqiBitSz
- *
- *
- * Desc : Fetch the CQI/PMI bits for a UE based on the mode, periodicity.
- *
- * Ret : uint8_t
- * ROK - Success
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-uint8_t rgSCHTomUtlFetchPcqiBitSz
-(
-RgSchUeCb *ueCb,
-uint8_t numTxAnt,
-uint8_t *ri
-)
-{
- uint8_t confRepMode;
- uint8_t pcqiSz;
- TfuCqiPucchMode10 *mode10Info;
- TfuCqiPucchMode11 *mode11Info;
- TfuCqiPucchMode20 *mode20Info;
- TfuCqiPucchMode21 *mode21Info;
- RgSchUePCqiCb *cqiCb = ueCb->nPCqiCb;
-
-
- confRepMode = cqiCb->cqiCfg.cqiSetup.prdModeEnum;
- if((ueCb->mimoInfo.txMode != RGR_UE_TM_3) &&
- (ueCb->mimoInfo.txMode != RGR_UE_TM_4))
- {
- *ri =1;
- }
- else
- {
- *ri = cqiCb->perRiVal;
- }
- ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUCCH;
- ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode=
- (TfuDlCqiPucchMode)confRepMode;
- switch(confRepMode)
- {
- case RGR_PRD_CQI_MOD10:
- {
- mode10Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info;
- pcqiSz = 4;
- mode10Info->type = TFU_RPT_CQI;
- mode10Info->u.cqi = 4;
- }
- break;
-
- case RGR_PRD_CQI_MOD11:
- {
- mode11Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info;
- mode11Info->type = TFU_RPT_CQI;
- if(numTxAnt == 2)
- {
- if (*ri ==1)
- {
- pcqiSz = 6;
- mode11Info->u.cqi.cqi = 4;
- mode11Info->u.cqi.wideDiffCqi.pres = FALSE;
- mode11Info->u.cqi.pmi = 2;
- }
- else
- {
- pcqiSz = 8;
- mode11Info->u.cqi.cqi = 4;
- mode11Info->u.cqi.wideDiffCqi.pres = TRUE;
- mode11Info->u.cqi.wideDiffCqi.val = 3;
- mode11Info->u.cqi.pmi = 1;
- }
- }
- else if(numTxAnt == 4)
- {
- if (*ri ==1)
- {
- pcqiSz = 8;
- mode11Info->u.cqi.cqi = 4;
- mode11Info->u.cqi.wideDiffCqi.pres = FALSE;
- mode11Info->u.cqi.pmi = 4;
- }
- else
- {
- pcqiSz = 11;
- mode11Info->u.cqi.cqi = 4;
- mode11Info->u.cqi.wideDiffCqi.pres = TRUE;
- mode11Info->u.cqi.wideDiffCqi.val = 3;
- mode11Info->u.cqi.pmi = 4;
- }
- }
- else
- {
- /* This is number of antenna case 1.
- * This is not applicable for Mode 1-1.
- * So setting it to invalid value */
- pcqiSz = 0;
- }
- }
- break;
-
- case RGR_PRD_CQI_MOD20:
- {
- mode20Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info;
- mode20Info->type = TFU_RPT_CQI;
- if(cqiCb->isWb)
- {
- pcqiSz = 4;
- mode20Info->u.cqi.isWideband = TRUE;
- mode20Info->u.cqi.u.wideCqi = 4;
- }
- else
- {
- pcqiSz = 4 + cqiCb->label;
- mode20Info->u.cqi.isWideband = FALSE;
- mode20Info->u.cqi.u.subCqi.cqi = 4;
- mode20Info->u.cqi.u.subCqi.l = cqiCb->label;
- }
- }
- break;
-
- case RGR_PRD_CQI_MOD21:
- {
- mode21Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info;
- mode21Info->type = TFU_RPT_CQI;
- //pcqiSz = rgSCHTomUtlFetchPcqiBitSzPucchMode21(ueCb,
- // mode21Info, numTxAnt, ri);
- }
- break;
- default:
- pcqiSz = 0;
- break;
- }
-
- RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
- return pcqiSz;
-}
-
-
-/***********************************************************
- *
- * Func : rgSCHTomUtlPcqiSbCalcBpIdx
- *
- *
- * Desc : Determines the BP index from the timing info
- *
- * Ret : S16
- * ROK - Success
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-S16 rgSCHTomUtlPcqiSbCalcBpIdx
-(
-CmLteTimingInfo crntTimInfo,
-RgSchUeCb *ueCb,
-RgSchUePCqiCb *cqiCb
-)
-{
- uint16_t tti = (crntTimInfo.sfn * RGSCH_NUM_SUB_FRAMES_5G + crntTimInfo.slot);
- uint16_t prdNum = tti/cqiCb->cqiPeri;
-
- if((prdNum % cqiCb->h) == 0)
- {
- cqiCb->isWb = TRUE;
-#ifdef LTE_ADV
- cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_1;
-#endif
- }
- else
- {
- cqiCb->isWb = FALSE;
- cqiCb->bpIdx = ((prdNum % cqiCb->h) - 1) % cqiCb->J;
-#ifdef LTE_ADV
- cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_0;
-#endif
- }
- return ROK;
-}
-
-
-/**
- * @brief Function which moves PCQI, RI, SR and SRS to next periodicity
- * Occasions as that needs to be done in case of Ack/Nack repetition
- * reception request occasions or during Measurement Gap occasions.
- *
- * @details
- *
- * Function: rgSCHTomUtlMoveNxtOccasion
- *
- * Function which moves PCQI, RI, SR and SRS to next perodicity
- * Occasions as that needs to be done in case of Ack/Nack repetition
- * reception request occasions or during Measurement Gap occasions.
- *
- * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
- *
- * Processing Steps:
- * - Check whether the current Tx Instance matches with the rec req time
- * - If true, then move them to their next Tx Instance
- *
- * @param[in] RgSchCellCb *cell,
- * RgSchUeCb *ue,
- * uint16_t validIdx
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHTomUtlMoveNxtOccasion
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-uint16_t validIdx
-)
-{
- RgSchUePCqiCb *cqiCb = ue->nPCqiCb;
- RgSchUePCqiCb *riCb = ue->nPRiCb;
-
- /* ccpu00140578::Skip the UE if already RI recpetion
- * is processed in the same subframe */
- if ((riCb->nRiTrIdx == validIdx) &&
- (riCb->riRecpPrcsd == FALSE))
- {
- if(riCb->riDist ==0)
- {
- rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
- }
- else
- {
- riCb->riDist--;
- }
- /* ccpu00140578:: As this UE is considered for this TTI
- * Same UE should not get processed for RI reception
- * or for updating th RI distance.*/
- if(riCb->nRiTrIdx == validIdx)
- {
- riCb->riRecpPrcsd = TRUE;
- }
- }
- if (cqiCb->nCqiTrIdx == validIdx)
- {
- rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
- }
-
- /* ccpu00140578::Skip the UE if SRS recpetion
- * is already processed in the same subframe */
- if ((ue->srsCb.nSrsTrIdx == validIdx) &&
- (ue->srsCb.srsRecpPrcsd == FALSE))
- {
- if(ue->srsCb.srsDist ==0)
- {
- rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
- }
- else
- {
- ue->srsCb.srsDist--;
- }
- /* ccpu00140578:: As this UE is considered for this TTI
- * Same UE should not get processed for SRS reception
- * or for updating th SRS distance.*/
- if(ue->srsCb.nSrsTrIdx == validIdx)
- {
- ue->srsCb.srsRecpPrcsd = TRUE;
- }
- }
- if (ue->srCb.nSrTrIdx == validIdx)
- {
- rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
- }
- return ROK;
-} /* rgSCHTomUtlMoveNxtOccasion */
-
-
-/***********************************************************
- *
- * Func : rgSCHTomPrepareAcqiRecp
- *
- *
- * Desc : Fetch the CQI/PMI bits for a UE based on the mode and store them
- * for decoding. Fill RECP request and prepare the scartchpad
- * to aid decoding of Aperiodic CQI.
- *
- * Ret : Void
- * ROK - void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHTomPrepareAcqiRecp
-(
-RgSchUeCb *ueCb,
-RgSchCellCb *cell,
-TfuUePuschCqiRecpInfo *cqiRecpReqInfo,
-uint8_t ccIdx
-)
-{
- uint8_t confRepMode;
- RgSchCqiRawPuschMode12 *mode12Info;
- RgSchCqiRawPuschMode20 *mode20Info;
- RgSchCqiRawPuschMode22 *mode22Info;
- RgSchCqiRawPuschMode30 *mode30Info;
- RgSchCqiRawPuschMode31 *mode31Info;
- uint8_t numTxAnt = cell->numTxAntPorts;
- uint8_t sCellIdx = ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)];
- uint8_t numOfCells = 0;
- RgSchUeACqiCb *acqiCb = &ueCb->cellInfo[sCellIdx]->acqiCb;
-
- /* Fill TFU Recp */
- cqiRecpReqInfo->reportType = TFU_APERIODIC_CQI_TYPE; /* Aperiodic */
- if (ueCb->mimoInfo.txMode == RGR_UE_TM_3 ||
- ueCb->mimoInfo.txMode == RGR_UE_TM_4)
- {
- cqiRecpReqInfo->riSz[ccIdx].pres = TRUE;
- cqiRecpReqInfo->riSz[ccIdx].val = acqiCb->riNumBits;
- }
- /* This flag will be rmeoved after making changes in BRDCM CL
- * Sachin is doing the change
- * */
-#if (defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
- //LTE_ADV_ACQI_SUPP
- cqiRecpReqInfo->cqiPmiSzR1[ccIdx] = acqiCb->cqiPmiSzR1;
- cqiRecpReqInfo->cqiPmiSzRn1[ccIdx] = acqiCb->cqiPmiSzRn1;
-#else
- if(ueCb->nPCqiCb->perRiVal == 1)
- {
- cqiRecpReqInfo->cqiPmiSzR1[ccIdx] = acqiCb->cqiPmiSzR1;
- }
- else
- {
- cqiRecpReqInfo->cqiPmiSzRn1[ccIdx] = acqiCb->cqiPmiSzRn1;
- }
-#endif
- /* Fill scratchpad to aid decoding of aper CQI upon
- * reception */
- confRepMode = acqiCb->aCqiCfg.aprdModeEnum;
- ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUSCH;
-
- numOfCells = ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells;
-
- ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
- puschRawCqiInfo.mode = (TfuDlCqiPuschMode)confRepMode;
-
- ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
- puschRawCqiInfo.ri.pres = cqiRecpReqInfo->riSz[ccIdx].pres;
-
- ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
- puschRawCqiInfo.ri.val = cqiRecpReqInfo->riSz[ccIdx].val;
-
- /* Setting the sCellIdx */
- ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
- sCellIdx = sCellIdx;
-
- switch(confRepMode)
- {
- case RGR_APRD_CQI_MOD12:
- {
- mode12Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
- cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode12Info;
- mode12Info->wideBCqiCw0 = 4;
- mode12Info->r1WideBCqiCw1 = 0;
- mode12Info->rg1WideBCqiCw1 = 4;
- if(numTxAnt == 2)
- {
- mode12Info->r1TotalPmiBitLen = 2*acqiCb->N;
- mode12Info->rg1TotalPmiBitLen = acqiCb->N;
- }
- else if(numTxAnt == 4)
- {
- mode12Info->r1TotalPmiBitLen = 4*acqiCb->N;
- mode12Info->rg1TotalPmiBitLen = 4*acqiCb->N;
- }
- }
- break;
-
- case RGR_APRD_CQI_MOD20:
- {
- mode20Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
- cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode20Info;
- mode20Info->wideBCqiCw = 4;
- mode20Info->subBandDiffCqi = 2;
- mode20Info->posOfM = acqiCb->L;
- }
- break;
-
- case RGR_APRD_CQI_MOD22:
- {
- mode22Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
- cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode22Info;
- mode22Info->wideBCqiCw0 = 4;
- mode22Info->sBDiffCqiCw0 = 2;
- mode22Info->r1WideBCqiCw1 = 0;
- mode22Info->r1SbDiffCqiCw1 = 0;
- mode22Info->rg1WideBCqiCw1 = 4;
- mode22Info->rg1SbDiffCqiCw1 = 2;
- mode22Info->posOfM = acqiCb->L;
- if(numTxAnt == 2)
- {
- mode22Info->r1PmiBitLen = 4;
- mode22Info->rg1PmiBitLen = 2;
- }
- else if(numTxAnt == 4)
- {
- mode22Info->r1PmiBitLen = 8;
- mode22Info->rg1PmiBitLen = 8;
- }
- }
- break;
-
- case RGR_APRD_CQI_MOD30:
- {
- mode30Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
- cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode30Info;
- mode30Info->wideBCqiCw = 4;
- mode30Info->totLenSbDiffCqi = 2*acqiCb->N;
- }
- break;
-
- case RGR_APRD_CQI_MOD31:
- {
- mode31Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
- cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode31Info;
- mode31Info->wideBCqiCw0 = 4;
- mode31Info->totLenSbDiffCqiCw0 = 2*acqiCb->N;
- mode31Info->r1WideBCqiCw1 = 0;
- mode31Info->r1TotLenSbDiffCqiCw1 =0;
- mode31Info->rg1WideBCqiCw1 = 4;
- mode31Info->rg1TotLenSbDiffCqiCw1 = 2*acqiCb->N;
- if(numTxAnt == 2)
- {
- mode31Info->r1PmiBitLen = 2;
- mode31Info->rg1PmiBitLen = 1;
- }
- else if(numTxAnt == 4)
- {
- mode31Info->r1PmiBitLen = 4;
- mode31Info->rg1PmiBitLen = 4;
- }
- }
- break;
- default:
- break;
- }
- return;
-}
-
-/**
- * @brief Function which handles the filling of Aperiodic CQI/RI reception
- * request values
- *
- * @details
- *
- * Function: rgSCHTomUtlFillDatAperRecpReq
- *
- * Function which handles the filling of Aperiodic CQI/RI reception
- * request values
- *
- * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
- *
- * Processing Steps:
- * - Fill the reception request for the data arriving on the ULSCH
- * - Fill the reception request information for the Aperiodic CQI/PMI/RI
- *
- * @param[in] RgSchCellCb *cell,
- * RgSchUlAlloc *alloc,
- * TfuUeRecpReqInfo *datRecpInfo,
- * CmLteTimingInfo *timeInfo,
- * Bool hqPres
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHTomUtlFillDatAperRecpReq
-(
-RgSchCellCb *cell,
-uint8_t cqiReq,
-RgSchUlAlloc *alloc,
-TfuUeRecpReqInfo *datRecpInfo,
-CmLteTimingInfo *timeInfo,
-Bool hqPres,
-uint16_t validIdx
-)
-{
- TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
- RgSchUeCb *ueCb = alloc->ue;
-#ifdef LTE_ADV
- uint8_t triggerSet = 0;
- uint8_t sIdx = 0;
-#endif
-
- /*Fill RI Reception Params*/
- cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
- cqiRecpReqInfo->riBetaOff = alloc->ue->ul.betaRiOffst;
- cqiRecpReqInfo->cqiBetaOff = alloc->ue->ul.betaCqiOffst;
-
-
- cqiRecpReqInfo->cCNum = 0;
- ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells = 0;
-
-#ifdef LTE_ADV
- rgSCHTomUtlGetTrigSet(cell, ueCb, cqiReq, &triggerSet);
- for (sIdx = 0; sIdx < CM_LTE_MAX_CELLS; sIdx++)
- {
- /* The Aperiodic request for SCell index sIdx */
- if ((triggerSet >> (7 - sIdx)) & 0x01)
- {
- /* The Aperiodic request for SCell index sIdx */
- rgSCHTomPrepareAcqiRecp(ueCb, ueCb->cellInfo[sIdx]->cell, cqiRecpReqInfo, cqiRecpReqInfo->cCNum);
- cqiRecpReqInfo->cCNum++;
- ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells++;
- }
- }
-#else
- rgSCHTomPrepareAcqiRecp(ueCb, ueCb->cellInfo[0]->cell, cqiRecpReqInfo, cqiRecpReqInfo->cCNum);
- ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells++;
-#endif
-
- RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
-
- if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
- {
- rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
- datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
-
- }
- if(hqPres &&
- (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
- {
- datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
- }
- else if (hqPres)
- {
- datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
- }
- else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
- {
- datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
- }
- datRecpInfo->rnti = alloc->rnti;
- rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
- &datRecpInfo->t.puschRecpReq.ulSchInfo);
- return ROK;
-} /* rgSCHTomUtlFillDatAperRecpReq */
-
-
-
-/**
- * @brief Function which handles the filling of Periodic RI reception
- * request values which arrives along with UL Data on ULSCH
- *
- * @details
- *
- * Function: rgSCHTomUtlFillDatPriRecpReq
- *
- * Function which handles the filling of Periodic RI reception
- * request values which arrives along with UL Data on ULSCH
- *
- * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
- *
- * Processing Steps:
- * - Fill the reception request for the data arriving on the ULSCH
- * - Fill the reception request information for the Periodic RI
- *
- * @param[in] RgSchCellCb *cell,
- * RgSchUlAlloc *alloc,
- * TfuUeRecpReqInfo *datRecpInfo,
- * CmLteTimingInfo *timeInfo,
- * Bool hqPres
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHTomUtlFillDatPriRecpReq
-(
-RgSchCellCb *cell,
-RgSchUlAlloc *alloc,
-TfuUeRecpReqInfo *datRecpInfo,
-CmLteTimingInfo *timeInfo,
-Bool hqPres,
-uint16_t validIdx
-)
-{
- TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
-
- /*Fill RI Reception Params*/
- cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
-#ifdef TFU_ALLOC_EVENT_NO_INIT
- cqiRecpReqInfo->cqiBetaOff = 0;
- /* Fill only the first RI index since Periodic can come
- * only for 1 CC */
- cqiRecpReqInfo->cqiPmiSzR1[0] = 0;
- cqiRecpReqInfo->cqiPmiSzRn1[0] = 0;
-#endif
- cqiRecpReqInfo->reportType = TFU_PERIODIC_CQI_TYPE; /* periodic */
- cqiRecpReqInfo->riBetaOff = alloc->ue->ul.betaRiOffst;
-
- /* Fill only the first RI index since Periodic can come
- * only for 1 CC */
- cqiRecpReqInfo->cCNum = 1;
- cqiRecpReqInfo->riSz[0].pres = TRUE;
- cqiRecpReqInfo->riSz[0].val = alloc->ue->nPRiCb->riNumBits;
- /*Other params*/
- rgSCHTomUtlFillRiBitWidthInfo(alloc->ue);
- if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
- {
- rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
- datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
-
- }
- if(hqPres &&
- (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
- {
- datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
- }
- else if (hqPres)
- {
- datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
- }
- else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
- {
- datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
- }
- datRecpInfo->rnti = alloc->rnti;
- rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
- &datRecpInfo->t.puschRecpReq.ulSchInfo);
- return ROK;
-} /* rgSCHTomUtlFillDatPriRecpReq */
-
-
-/**
- * @brief Function which handles the filling of Periodic CQI/PMI reception
- * request values which arrives along with UL Data on ULSCH
- *
- * @details
- *
- * Function: rgSCHTomUtlFillDatPCqiRecpReq
- *
- * Function which handles the filling of Periodic CQI/PMI reception
- * request values which arrives along with UL Data on ULSCH
- *
- * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
- *
- * Processing Steps:
- * - Fill the reception request for the data arriving on the ULSCH
- * - Fill the reception request information for the Periodic CQI/PMI
- *
- * @param[in] RgSchCellCb *cell,
- * RgSchUlAlloc *alloc,
- * TfuUeRecpReqInfo *datRecpInfo,
- * CmLteTimingInfo *timeInfo,
- * Bool hqPres
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-
-S16 rgSCHTomUtlFillDatPCqiRecpReq
-(
-RgSchCellCb *cell,
-RgSchUlAlloc *alloc,
-TfuUeRecpReqInfo *datRecpInfo,
-CmLteTimingInfo *timeInfo,
-Bool hqPres,
-uint16_t validIdx
-)
-{
- TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
- uint8_t cqiPmiSz; /*Raw CQI/PMI Size*/
- uint8_t ri;
-
- /*Fill CQI Reception Params*/
- cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
-#ifdef TFU_ALLOC_EVENT_NO_INIT
- cqiRecpReqInfo->riBetaOff = 0;
-#endif
- cqiRecpReqInfo->cqiBetaOff = alloc->ue->ul.betaCqiOffst;
- cqiPmiSz = rgSCHTomUtlFetchPcqiBitSz(alloc->ue, cell->numTxAntPorts, &ri);
- if(0 == cqiPmiSz)
- {
- DU_LOG("\nERROR --> SCH : Unable to Fill "
- "CqiPmi size RNTI:%d",alloc->rnti);
- return RFAILED;
- }
-
- /* Fill only the first RI index since Periodic can come
- * only for 1 CC */
- cqiRecpReqInfo->cCNum = 1;
- cqiRecpReqInfo->reportType = TFU_PERIODIC_CQI_TYPE; /* Periodic */
- /* This flags will be removed once Sachin does changes
- * in BRDCM CL */
-#if (defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
- cqiRecpReqInfo->cqiPmiSzR1[0] = cqiPmiSz;
- cqiRecpReqInfo->cqiPmiSzRn1[0] = cqiPmiSz;
-#else
- if (ri ==1)
- {
- cqiRecpReqInfo->cqiPmiSzR1[0] = cqiPmiSz;
- cqiRecpReqInfo->cqiPmiSzRn1[0] = 0;
- }
- else
- {
- cqiRecpReqInfo->cqiPmiSzRn1[0] = cqiPmiSz;
- cqiRecpReqInfo->cqiPmiSzR1[0] = 0;
- }
-#endif
- cqiRecpReqInfo->riSz[0].pres = FALSE;
-
- if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
- {
- rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
- datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
- }
- if(hqPres &&
- (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
- {
- datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
- }
- else if (hqPres)
- {
- datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
- }
- else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
- {
- datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
- }
- datRecpInfo->rnti = alloc->rnti;
- rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
- &datRecpInfo->t.puschRecpReq.ulSchInfo);
- return ROK;
-} /* rgSCHTomUtlFillDatPCqiRecpReq */
-
-/**
- * @brief Function which handles the filling of SRS reception
- * request values which arrives along with UL Data on ULSCH
- *
- * @details
- *
- * Function: rgSCHTomUtlFillDatSrsRecpReq
- *
- * Function which handles the filling of SRS reception
- * request values which arrives along with UL Data on ULSCH
- *
- * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
- *
- * Processing Steps:
- * - Fill the reception request for the data arriving on the ULSCH
- * - Fill the reception request information for the SRS
- *
- * @param[in] RgSchCellCb *cell,
- * RgSchUlAlloc *alloc,
- * TfuUeRecpReqInfo *datRecpInfo,
- * CmLteTimingInfo *timeInfo,
- * Bool hqPres
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHTomUtlFillDatSrsRecpReq
-(
-RgSchCellCb *cell,
-RgSchUlAlloc *alloc,
-TfuUeRecpReqInfo *datRecpInfo,
-CmLteTimingInfo *timeInfo,
-Bool hqPres
-)
-{
- datRecpInfo->rnti = alloc->rnti;
- rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
- if(hqPres)
- {
- datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_HARQ_SRS;
- }
- else
- {
- datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_SRS;
- }
- datRecpInfo->rnti = alloc->rnti;
- rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
- &datRecpInfo->t.puschRecpReq.ulSchInfo);
- return ROK;
-} /* rgSCHTomUtlFillDatSrsRecpReq */
-
-/**
- * @brief Function which handles the filling of only SRS reception
- * request values on ULSCH
- *
- * @details
- *
- * Function: rgSCHTomFillOnlySrsRecpReq
- *
- * Function which handles the filling of SRS reception
- * request values which arrives along with UL Data on ULSCH
- *
- * Invoked by: rgSCHTomUtlFillDatSrsRecpReq of rg_sch_tom.c
- *
- * Processing Steps:
- * - Fill the reception request for the data arriving on the ULSCH
- * - Fill the reception request information for the SRS
- *
- * @param[in] RgSchCellCb *cell,
- * RgSchUlAlloc *alloc,
- * TfuUeRecpReqInfo *datRecpInfo,
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHTomFillOnlySrsRecpReq
-(
-RgSchCellCb *cell,
-RgSchUlAlloc *alloc,
-TfuUeRecpReqInfo *datRecpInfo
-)
-{
- TfuUePuschSrsRecpInfo *srsRecpReqInfo;
-
- srsRecpReqInfo = &datRecpInfo->t.puschRecpReq.srsInfo;
- srsRecpReqInfo->srsBw = (TfuUlSrsBwInfo)alloc->ue->srsCb.srsCfg.srsSetup.srsBw;
- srsRecpReqInfo->nRrc = alloc->ue->srsCb.srsCfg.srsSetup.fDomPosi;
- srsRecpReqInfo->srsHopBw = (TfuUlSrsHoBwInfo)alloc->ue->srsCb.srsCfg.srsSetup.srsHopBw;
- srsRecpReqInfo->transComb = alloc->ue->srsCb.srsCfg.srsSetup.txComb;
- srsRecpReqInfo->srsCfgIdx = alloc->ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
- srsRecpReqInfo->srsCyclicShft = (TfuUlSrsCycShiftInfo)alloc->ue->srsCb.srsCfg.srsSetup.cycShift;
-
- /* ccpu00117050 - ADD - nSrs setting
- * Refer Section 5.2.2.6 of TS 36.212 V8.5.0*/
- datRecpInfo->t.puschRecpReq.ulSchInfo.nSrs = 1;
-
- return ROK;
-} /* rgSCHTomFillOnlySrsRecpReq */
-
-/**
- * @brief Function which handles the filling of PCQI/RI, SRS and SR
- * Reception Request Information along
- * with the HARQ reception Request
- *
- * @details
- *
- * Function: rgSCHTomUtlFillCqiSrSrsWithHq
- *
- * Function which handles the filling of PCQI/RI, SRS ans SR
- * Reception Request Information along
- * with the HARQ reception Request
- *
- *
- * Invoked by: rgSCHTomUtlFillHqFdbkRecpReq &
- * rgSCHTomUtlFillSfHqFdbk of rg_sch_tom.c
- *
- * Processing Steps:
- * - Fill the reception request for the Control Info arriving on the PUCCH
- * - Fill the reception request information for the SR, RI, CQI, SRS
- *
- * @param[in] RgSchCellCb *cell,
- * TfuRecpReqInfo *recpReqInfo,
- * RgSchDlHqProcCb *hqCb,
- * @param[out] TfuUeRecpReqInfo *pucchRecpInfo
- * @param[in] uint16_t validIdx
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHTomUtlFillCqiSrSrsWithHq
-(
-RgSchCellCb *cell,
-TfuRecpReqInfo *recpReqInfo,
-RgSchUeCb *ue,
-TfuUeRecpReqInfo *pucchRecpInfo,
-uint16_t validIdx,
-Bool isDatPresOnSecCell
-)
-{
- RgSchUePCqiCb *cqiCb;
- RgSchUePCqiCb *riCb;
- uint8_t ri; /*To fetch RI value*/
- Bool willUeRprtCqi; /* Flag set due to CQI Mask and UE Inactive state (DRX)*/
- Bool willUeRprtSr = TRUE;
- TfuAckNackMode hqFdbkMode;
- uint8_t numCqiBit;
- uint8_t totalPucchBits;
- Bool dropCqi = FALSE;
-#ifdef LTEMAC_SPS
- RgSchCmnUlUeSpsInfo *ulSpsUe = NULL;
-#endif
-#ifdef EMTC_ENABLE
- RgSchEmtcUeInfo *emtcUe = NULLP;
-#endif
-
- if(ue)
- {
- /*Changes for PUCCH Format3 */
- hqFdbkMode = pucchRecpInfo->t.pucchRecpReq.hqInfo.hqFdbkMode;
- numCqiBit = rgSCHCmnCalcPcqiBitSz (ue,cell->numTxAntPorts);
- totalPucchBits = pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz + numCqiBit;
-
-#ifdef EMTC_ENABLE
- emtcUe = RG_GET_EMTC_UE_CB(ue);
-#endif
- rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
-#ifdef EMTC_ENABLE /*VINU*/
- if (ue->isEmtcUe)
- {
- if((emtcUe->pucchRepNumFr1 > 1) || (emtcUe->pucchRepNumFr2 > 1))
- {
- willUeRprtCqi = FALSE;
- willUeRprtSr = FALSE;
- }
- }
-#endif
- if(ue->srCb.nSrTrIdx == validIdx)
- {
-
-#ifdef LTEMAC_SPS
- /* Should we check for Rel8 and above???
- * Dont send SR recp req if logicalChannelSR-Mask enabled and UL SPS is
- * active*/
- ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue, cell);
- /* Avoiding check for ulSpsEnabled as isUlSpsActv FALSE if sps is not enabled*/
- if(!((ue->ul.ulSpsCfg.isLcSRMaskEnab) &&
- (ulSpsUe->isUlSpsActv)))
- {
-#endif
-
- if(willUeRprtSr)
- {
- /*Fill SR params*/
- pucchRecpInfo->t.pucchRecpReq.srInfo.n1PucchIdx =
- ue->srCb.srCfg.srSetup.srResIdx;
- pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
- /* FORMAT3: If SR is present it will be appended after HARQ */
- totalPucchBits = totalPucchBits + 1;
- }
-
-#ifdef LTEMAC_SPS
- }
-#endif
-
- rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
- }
- /* LTE_ADV:: UE will drop CSI during CSI+1BCS if data is present
- * on sec cell(isDatPresOnSecCell)*/
-#ifdef LTE_TDD
- if (hqFdbkMode == TFU_ACK_NACK_CHANNEL_SELECTION)
-#else
- if (hqFdbkMode == TFU_UCI_FORMAT_1B_CS)
-#endif
- {
- if (isDatPresOnSecCell == TRUE)
- {
- dropCqi = TRUE;
- }
- }
-#ifdef LTE_ADV
-#ifndef LTE_TDD
- /* Format 3 Changes : If Hq + SR + CQI bits < 22 and simultaneousAckNackAndCQI-Format3
- is enabled then CQI will be multiplexed with HQ otherwise CQI will be dropped
- Spec 36.213 Sec 10.1.1 */
- else if (hqFdbkMode == TFU_UCI_FORMAT_3)
- {
- if ((isDatPresOnSecCell == TRUE) &&
- ((!ue->simulAckNackCQIFormat3) || (totalPucchBits > 22)))
- {
- dropCqi = TRUE;
- }
- }
-#endif
-#endif
- riCb = ue->nPRiCb;
- cqiCb = ue->nPCqiCb;
- if(riCb->nRiTrIdx == validIdx)
- {
- /*ccpu00140578:: Skip the UE if the RI is already processed
- * for PUSCH */
- if(riCb->riRecpPrcsd == FALSE)
- {
- if(riCb->riDist == 0)
- {
- if((riCb->cqiCfg.cqiSetup.sANCQI == TRUE) && (willUeRprtCqi == TRUE)&&
- (isDatPresOnSecCell == FALSE))
- {
- /*Fill RI params*/
- pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
- riCb->cqiCfg.cqiSetup.cqiPResIdx;
- pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
- riCb->riNumBits;
- if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_HARQ_SR)
- {
- pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI;
- }
- else
- {
- pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_CQI;
- }
- ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
-#ifdef LTE_ADV
- ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
- ue->nPRiCb->servCellInfo->sCellIdx;
-#endif
- rgSCHTomUtlFillRiBitWidthInfo(ue);
- if (ue->nPCqiCb->nCqiTrIdx == validIdx)
- {
- rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, ue->nPCqiCb);
- }
-#ifdef CA_DBG
- {
- if(gF1bCsPres)
- {
- gRiReqCount++;
- }
- }
-
-#endif
-
-
-
- }
- rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
- }
- else
- {
- riCb->riDist--;
- }
- /* Skip the UE for RI processing on PUCCH
- * in the same subframe as it already processed */
- if(riCb->nRiTrIdx == validIdx)
- {
- /* As the new idx is same is current idx
- * then PUCCH reception processing will consider
- * RI also in the same subframe. To block this
- * below flag is used*/
- riCb->riRecpPrcsd = TRUE;
- }
- }
- }
- else if(cqiCb->nCqiTrIdx == validIdx)
- {
- if((cqiCb->cqiCfg.cqiSetup.sANCQI == TRUE) && (willUeRprtCqi == TRUE)&&
- (isDatPresOnSecCell == FALSE))
- {
- /*Fill CQI Params*/
- pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
- cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
-
- ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
-#ifdef LTE_ADV
- ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
- cqiCb->servCellInfo->sCellIdx;
-#endif
- pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
- rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
- if(0 == pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz)
- {
- DU_LOG("\nERROR --> SCH : RNTI:%d Unable to Fill CqiPmi size", ue->ueId);
- return RFAILED;
- }
- if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_HARQ_SR)
- {
- pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI;
- }
- else
- {
- pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_CQI;
- }
- }
-#ifdef CA_DBG
- {
- if(gF1bCsPres)
- {
- gCqiReqCount++;
- }
- }
-
-#endif
-
- rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
- }
- if(ue->srsCb.nSrsTrIdx == validIdx)
- {
- /* ccpu00140578::Skip the UE for SRS reception processing
- * if already done as part of PUSCH recpetion
- * process*/
- if(ue->srsCb.srsRecpPrcsd == FALSE)
- {
- if(ue->srsCb.srsDist ==0 )
- {
- if((pucchRecpInfo->t.pucchRecpReq.uciInfo != TFU_PUCCH_HARQ_CQI)
- && (ue->srsCb.srsCfg.srsSetup.sANSrs)
- && (isDatPresOnSecCell == FALSE))
- {
- /*Fill SRS params*/
- pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
- (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
- pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
- ue->srsCb.srsCfg.srsSetup.fDomPosi;
- pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
- (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
- pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
- ue->srsCb.srsCfg.srsSetup.txComb;
- pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
- ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
- pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
- (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
- /* ccpu00116923 - ADD - New Reception Request types for CQI and SRS with SR */
- switch(pucchRecpInfo->t.pucchRecpReq.uciInfo)
- {
- case TFU_PUCCH_HARQ_SR:
- pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_SRS;
- break;
- case TFU_PUCCH_HARQ_SR_CQI:
- pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI_SRS;
- break;
- default:
- pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SRS;
- break;
- }
- }
- rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
- }
- else
- {
- ue->srsCb.srsDist--;
- }
- /* Skip the UE for SRS processing on PUCCH
- * in the same subframe as it already processed */
- if(ue->srsCb.nSrsTrIdx == validIdx)
- {
- /* As the new idx is same is current idx
- * then PUCCH reception processing will consider
- * SRS also in the same subframe. To block this
- * below flag is used*/
- ue->srsCb.srsRecpPrcsd = TRUE;
- }
-
- }
- }
- }
- UNUSED(dropCqi);
- return ROK;
-} /* rgSCHTomUtlFillCqiSrSrsWithHq */
-
-/**
- * @brief Function which handles the filling of PCQI/RI, SRS
- * Reception Request Information along with SR reception
- * Request
- *
- * @details
- *
- * Function: rgSCHTomUtlFillCqiSrsWithSr
- *
- * Function which handles the filling of PCQI/RI, SRS
- * Reception Request Information along
- * with the SR reception Request
- *
- *
- * Invoked by: rgSCHTomUtlFillSrRecpReq of rg_sch_tom.c
- *
- * Processing Steps:
- * - Fill the reception request for CQI/RI, SRS if they occur
- * in the same instance as of SR.
- *
- * @param[in] RgSchCellCb *cell,
- * RgSchUeCb *ue
- * TfuRecpReqInfo *recpReqInfo,
- * @param[out] TfuUeRecpReqInfo *pucchRecpInfo
- * @param[in] uint16_t validIdx
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-#ifdef UNUSED_FUNC
-static S16 rgSCHTomUtlFillCqiSrsWithSr
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-TfuRecpReqInfo *recpReqInfo,
-TfuUeRecpReqInfo *pucchRecpInfo,
-uint16_t validIdx
-)
-{
- RgSchUePCqiCb *cqiCb;
- RgSchUePCqiCb *riCb;
- uint8_t ri; /*To fetch RI value*/
- Bool willUeRprtCqi; /* Flag set due to CQI Mask and
- UE Inactive state (DRX)*/
- riCb = ue->nPRiCb;
- cqiCb = ue->nPCqiCb;
- rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
-#ifdef EMTC_ENABLE
- rgSCHEmtcWillUeRptCqi(ue, &willUeRprtCqi);
-#endif
- if(riCb->nRiTrIdx == validIdx)
- {
- /*ccpu00140578:: Skip the UE if the RI is already processed
- * for PUSCH */
- if(riCb->riRecpPrcsd == FALSE)
- {
- if(riCb->riDist == 0)
- {
- if(willUeRprtCqi == TRUE)
- {
- /*Fill RI params*/
- pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
- riCb->cqiCfg.cqiSetup.cqiPResIdx;
- pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
- riCb->riNumBits;
-
- pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI;
- ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
-#ifdef LTE_ADV
- ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
- ue->nPRiCb->servCellInfo->sCellIdx;
-#endif
- rgSCHTomUtlFillRiBitWidthInfo(ue);
- /* TODO:: syed Shouldn't this be done outside this if condition */
- if (cqiCb->nCqiTrIdx == validIdx)
- {
- rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
- }
- }
- rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
- }
- else
- {
- riCb->riDist--;
- }
- if(riCb->nRiTrIdx == validIdx)
- {/* Need to skip this UE during PUCCH RI recpetion process
- in the current subframe */
- riCb->riRecpPrcsd = TRUE;
- }
- }
- }
- else if(cqiCb->nCqiTrIdx == validIdx)
- {
- if(willUeRprtCqi == TRUE)
- {
- /*Fill CQI Params*/
- pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
- cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
-
- ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
-
-#ifdef LTE_ADV
- ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
- cqiCb->servCellInfo->sCellIdx;
-#endif
- pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
- rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
- if(0 == pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz)
- {
- DU_LOG("\nERROR --> SCH : RNTI:%d Unable to Fill CqiPmi size", ue->ueId);
- return RFAILED;
- }
-
- pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI;
- }
- rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
- }
- if(ue->srsCb.nSrsTrIdx == validIdx)
- {
- /* ccpu00140578:: Cnsider the SRS processing
- * only if not done in the same TTI
- * as part of PUSCH or HARQ reception process*/
- if(ue->srsCb.srsRecpPrcsd == FALSE)
- {
- if(ue->srsCb.srsDist ==0 )
- {
- if(ue->srsCb.srsCfg.srsSetup.sANSrs)
- {
- /*Fill SRS params*/
- pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
- (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
- pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
- ue->srsCb.srsCfg.srsSetup.fDomPosi;
- pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
- (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
- pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
- ue->srsCb.srsCfg.srsSetup.txComb;
- pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
- ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
- pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
- (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
- /* ccpu00116923 - ADD - New Reception Request types for CQI and
- * SRS with SR */
- if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_SR_CQI)
- {
- pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI_SRS;
- }
- else
- {
- pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_SRS;
- }
-
- }
- rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
- }
- else
- {
- ue->srsCb.srsDist--;
- }
- /* Skip the UE for SRS processing on PUCCH
- * in the same subframe as it already processed */
- if(ue->srsCb.nSrsTrIdx == validIdx)
- {
- /* As the new idx is same is current idx
- * then PUCCH reception processing will consider
- * SRS also in the same subframe. To block this
- * below flag is used*/
- ue->srsCb.srsRecpPrcsd = TRUE;
- }
-
- }
- }
- return ROK;
-} /* rgSCHTomUtlFillCqiSrsWithSr */
-
-#endif
-#endif
-
-#ifdef LTE_TDD
-/** @brief This function handles filling of HARQ feedback repetition
- * recption request for each subframe
- *
- * @details
- *
- * Function: rgSCHTomUtlFillSfRepHqFdbk
- *
- * Processing steps:
- *
- * @param [out] TfuRecpReqInfo *recpReqInfo
- * @param [in] RgSchCellCb *cell
- * @param [out] RgSchErrInfo *err
- * @param [in] RgSchDlSf *dlSf
- * @param [in] uint8_t noFdbks
- * @param [in] CmMemListCp *memCp
- * @param [in] uint8_t elemIdx
- * @param [in] RgSchDlSf *nxtDlsf
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-#ifdef TFU_UPGRADE
-static S16 rgSCHTomUtlFillSfRepHqFdbk
-(
-TfuRecpReqInfo *recpReqInfo,
-RgSchCellCb *cellCb,
-RgSchErrInfo *err,
-RgSchDlSf *dlSf,
-uint8_t noFdbks,
-CmMemListCp *memCp,
-uint8_t elemIdx,
-RgSchDlSf *nxtDlsf,
-uint16_t validIdx
-)
-#else
-static S16 rgSCHTomUtlFillSfRepHqFdbk
-(
-TfuRecpReqInfo *recpReqInfo,
-RgSchCellCb *cellCb,
-RgSchErrInfo *err,
-RgSchDlSf *dlSf,
-uint8_t noFdbks,
-CmMemListCp *memCp,
-uint8_t elemIdx,
-RgSchDlSf *nxtDlsf
-)
-#endif
-{
- RgSchDlHqProcCb *hqCb;
- CmLList *node;
- S16 ret;
- RgSchUeCb *ueCb;
- TfuUeRecpReqInfo *pucchRecpInfo;
-#ifdef TFU_UPGRADE
- TfuUePucchHqRecpInfo *hqRecpReq;
-#endif
- RgSchDlHqTbCb *tbCb;
- RgSchDlHqProcCb *prvHqCb = NULLP;
-
- node = dlSf->ackNakRepQ.first;
- while (node)
- {
- tbCb = (RgSchDlHqTbCb *)(node->node);
- hqCb = tbCb->hqP;
- ueCb = hqCb->hqE->ue;
-
- if (--tbCb->fbkRecpRepCntr)
- {
- /* Add to next subfarme */
- /* Add this hqCb to the next dlSf's ackNakRepQ */
- cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
- &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
- tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
- tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
- }
-
-#ifdef TFU_UPGRADE
- if (hqCb->tbCnt)
- {
- hqCb->tbCnt--;
- /* Go to the next node */
- node = node->next;
- continue;
- }
-#endif
- if ((hqCb->hqE->ue != NULLP) &&
- (hqCb->hqE->ue->measGapCb.isMeasuring != TRUE)
- && (hqCb != prvHqCb)
- )
- {
- /* We need to add the recp request to be sent on the pucchANRep
- * value.
- */
- ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
- sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to"
- "Allocate TfuUeRecpReqInfo for RNTI:%d ", ueCb->ueId);
- err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
- return ret;
- }
- pucchRecpInfo->rnti = ueCb->ueId;
-#ifndef TFU_UPGRADE
- pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
-#else
- pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
-#endif
-
- /* FOR repetition Feedback shall come on n1PucchAnRep Configured per
- * UE.
- */
-#ifndef TFU_UPGRADE
- pucchRecpInfo->t.pucchRecpReq.hqType = TFU_HQ_RECP_REQ_N1PUCCH;
- pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = ueCb->ackNakRepCb.pucchRes;
-#else
- pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
- hqRecpReq = &(pucchRecpInfo->t.pucchRecpReq.hqInfo);
- /* ACK NACK rep works only in bundling mode . */
- hqRecpReq->hqFdbkMode = (TfuAckNackMode)RGR_TDD_ACKNACK_MODE_BUNDL;
- if ((hqCb->hqPSfLnk.node != NULLP) &&
- (hqCb->hqPSfLnk.node != NULLP))
- {
-
- hqRecpReq->hqSz = 2;
- }
- else
- {
- hqRecpReq->hqSz = 1;
- }
- hqRecpReq->pucchResCnt = 1;
- hqRecpReq->hqRes[0] = ueCb->ackNakRepCb.pucchRes;
-#endif
- cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
- pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
- }
- /* In a given dlSf, if there is 2 TBs context
- * stored for a given harq, then they are added
- * adjacent to each other in the subframe. To avoid
- * adding duplicate recpnInfo for each TB, store this
- * hqCb in prvHqCb. If nextHqCb is same as prvHqCb then
- * do not add reception req info.*/
- prvHqCb = hqCb;
-#ifdef TFU_UPGRADE
- RGSCH_NULL_CHECK(cellCb->instIdx, hqCb->hqE->ue);
- rgSCHTomUtlMoveNxtOccasion(cellCb, hqCb->hqE->ue, validIdx);
-#endif
- /* Go to the next node */
- node = node->next;
- }
- return ROK;
-}
-
-/** @brief This function handles filling of HARQ feedback recption request
- * for each subframe
- *
- * @details
- *
- * Function: rgSCHTomUtlFillSfHqFdbkInfo
- *
- * Processing steps:
- *
- * @param [out] TfuRecpReqInfo *recpReqInfo
- * @param [in] RgSchCellCb *cell
- * @param [out] RgSchErrInfo *err
- * @param [in] RgSchDlSf *dlSf
- * @param [in] uint8_t noFdbks
- * @param [in] CmMemListCp *memCp
- * @param [in] uint8_t elemIdx
- * @param [in] RgSchDlSf *nxtDlsf
-* @param [in] uint16_t validIdx;
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-#ifdef TFU_UPGRADE
-static S16 rgSCHTomUtlFillSfHqFdbkInfo
-(
-TfuRecpReqInfo *recpReqInfo,
-RgSchCellCb *cellCb,
-RgSchErrInfo *err,
-RgSchDlSf *dlSf,
-uint8_t noFdbks,
-CmMemListCp *memCp,
-uint8_t elemIdx,
-RgSchDlSf *nxtDlsf,
-uint16_t validIdx,
-RgSchDlHqProcCb *hqCb,
-RgSchUePucchRecpInfo *pucchInfo,
-Bool alloc,
-RgSchDlHqProcCb *prvHqCb
-)
-#else
-static S16 rgSCHTomUtlFillSfHqFdbkInfo
-(
-TfuRecpReqInfo *recpReqInfo,
-RgSchCellCb *cellCb,
-RgSchErrInfo *err,
-RgSchDlSf *dlSf,
-uint8_t noFdbks,
-CmMemListCp *memCp,
-uint8_t elemIdx,
-RgSchDlSf *nxtDlsf,
-RgSchDlHqProcCb *hqCb,
-RgSchUePucchRecpInfo *pucchInfo,
-Bool alloc,
-RgSchDlHqProcCb *prvHqCb
-)
-#endif
-{
- S16 ret;
- RgSchUeCb *ueCb = hqCb->hqE->ue;
-#ifndef TFU_UPGRADE
- CmLteTimingInfo futTime;
- RgSchTddANInfo *anInfo;
-#else
-#endif
- RgrTddAckNackMode ackNackMode;
- RgSchDlHqTbCb *tbCb;
- CmLteRnti rnti;
- uint8_t hqSz = 0;
- uint32_t idx = 0;
-
-#ifndef TFU_UPGRADE
- RG_SCH_ADD_TO_CRNT_TIME(cellCb->crntTime, futTime, TFU_RECPREQ_DLDELTA);
-#endif
-
-
- for (idx = 0 ;idx < 2; idx++)
- {
- if (HQ_TB_WAITING == hqCb->tbInfo[idx].state)
- {
-
- tbCb = &hqCb->tbInfo[idx];
- if (ueCb)
- {
- rnti = ueCb->ueId;
- ackNackMode = ueCb->dl.ackNackMode;
-#ifndef TFU_UPGRADE
- if(ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL)
- {
- anInfo = rgSCHUtlGetUeANFdbkInfo(ueCb, &futTime);
- /* Only the last scheduled TB for the UE is for HARQ
- * ACK/NACK reception in Bundling case */
- if((anInfo == NULLP) ||
- (anInfo->latestMIdx != dlSf->dlFdbkInfo.m))
- {
- return ROK;
- }
- }
- else
- {
- /* Get the TFU reception request pointer, if present */
- cmHashListFind(&cellCb->ueTfuPendLst, (uint8_t*) &ueCb->ueId,
- sizeof(ueCb->ueId), 0, (PTR *) &pucchInfo);
- }
-#else
- /* For upgrade we shall use the existing logic of pending list. */
- cmHashListFind(&cellCb->ueTfuPendLst, (uint8_t*) &ueCb->ueId,
- sizeof(ueCb->ueId), 0, (PTR *) &pucchInfo);
-#endif
- }
- else if(hqCb->hqE->raCb != NULLP)
- {
- /* For RACH it is set to Bundling */
- ackNackMode = RGR_TDD_ACKNACK_MODE_BUNDL;
- rnti = hqCb->hqE->raCb->tmpCrnti;
- }
- else
- {
- return ROK;
- }
-
- /* Do not proceed if PUSCH
- reception req is already filled*/
-#ifdef TFU_UPGRADE
- if (hqCb->tbCnt)
- {
- hqCb->tbCnt--;
- /* Go to the next node */
- continue;
- }
-#endif
- if(((ueCb == NULLP) || (ueCb->measGapCb.isMeasuring != TRUE))
- &&(hqCb != prvHqCb)
- )
- {
- TknUInt16 n1PucchTkn = {FALSE, 0};
- RgSchPdcch *pdcch;
- uint8_t tbIndx;
- pdcch = tbCb->hqP->pdcch;
-#ifdef LTEMAC_SPS
- n1PucchTkn = hqCb->spsN1PucchRes;
-#endif
- for (tbIndx = 0; tbIndx < TFU_MAX_TB; tbIndx++)
- {
- if (hqCb->tbInfo[tbIndx].state == HQ_TB_WAITING &&
- (RGSCH_TIMEINFO_SAME(hqCb->tbInfo[tbIndx].fdbkTime,
- recpReqInfo->timingInfo)))
- {
- hqSz++;
- hqCb->tbInfo[tbIndx].pucchFdbkIdx = hqCb->ulDai;
- }
- }
- ret = rgSCHTomUtlFillSfHqFdbkForOneUe(hqCb,recpReqInfo, cellCb, err, dlSf, noFdbks,
- memCp, elemIdx, nxtDlsf, rnti, ackNackMode, &pucchInfo, pdcch,
- n1PucchTkn, &alloc, hqSz);
- if (ret != ROK)
- {
- return ret;
- }
- /* TODO:: In case of F1BCS and CSI in same subframe
- * UE shall drop the CSI if there was at least one
- * PDSCH transmission in any of the DL subframe
- * mapping to this UL subframe
- * */
-#ifdef TFU_UPGRADE
- rgSCHTomUtlFillCqiSrSrsWithHq(cellCb,recpReqInfo, hqCb->hqE->ue,
- pucchInfo->pucchRecpInfo, validIdx,FALSE);
-#ifdef LTE_ADV
- if((hqCb->hqE->ue) &&
- (hqCb->hqE->ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS))
- {
-
- if(RG_SCH_IS_CELL_SEC(hqCb->hqE->ue,hqCb->hqE->cell))
- {
- switch(pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo)
- {
- case TFU_PUCCH_HARQ_SR_CQI:
- pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
- RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
- break;
- case TFU_PUCCH_HARQ_CQI:
- pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
- RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
- break;
- case TFU_PUCCH_HARQ_SR_CQI_SRS:
- pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_SRS;
- RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
- break;
- case TFU_PUCCH_HARQ_SR_SRS:
- pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
- break;
- case TFU_PUCCH_HARQ_SRS:
- pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
- break;
- default:
- break;
- }
- }
- }
-#endif
-
-#endif
-
- /* TODO antz - pushing the following code (under TFU_UPGRADE)
- * into the above function (...ForOneUe) did not work (caused
- * two additional TCs to fail). Don't know why. If this
- * is done later, make sure that the code branch
- * for relPdcch (later in this func) is also modified appropriately.
- */
- /* Now add to the recp request or pending list */
- //if((elemIdx != (noFdbks - 1)))
- {
- cmHashListInsert(&cellCb->ueTfuPendLst, (PTR) pucchInfo,
- (uint8_t *)&rnti ,(uint16_t) sizeof(CmLteRnti));
- alloc = FALSE;
- }
-
- } /* If measuring */
- /* Go to the next node */
- if ((tbCb->fbkRecpRepCntr) && (--tbCb->fbkRecpRepCntr))
- {
- /* Add to next subfarme */
- /* Add this hqCb to the next dlSf's ackNakRepQ */
- cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
- &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
- tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
- tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
- }
- /* In a given dlSf, if there is 2 TBs context
- * stored for a given harq, then they are added
- * adjacent to each other in the subframe. To avoid
- * adding duplicate recpnInfo for each TB, store this
- * hqCb in prvHqCb. If nextHqCb is same as prvHqCb then
- * do not add reception req info.*/
- prvHqCb = hqCb;
- }
- }
- return ROK;
-}
-
-#ifdef LTE_ADV
-/** @brief This function calculates the pucch resource idx
- * that is to be filled in harq reception request
- *
- * @details
- *
- * Function: rgSCHTomUtlGethqRes
- *
- * Processing steps:
- * -Calculate the pucch resource idx
- * Harq Reception Request for Format 1B with
- * Channel Selection
- *
- * @param [in] uint8_t noFdbks
- * @param [in] RgSchDlSf *dlSf
- * @param [in] RgSchPdcch *pdcch
- * @param [in] RgSchCellCb *cellCb
- * @param [out]uint16_t *hqRes
- * @return void
- */
-static Void rgSCHTomUtlGethqRes
-(
-uint8_t noFdbks,
-RgSchDlSf *dlSf,
-RgSchPdcch *pdcch,
-RgSchCellCb *cellCb,
-uint16_t *hqRes
-)
-{
- uint8_t M;
- uint8_t P;
- uint8_t m;
- uint8_t nP;
- uint8_t nPlusOne;
- uint8_t nCce;
-
- M = noFdbks;
- m = dlSf->dlFdbkInfo.m;
- nCce = pdcch->nCce;
- P = rgSCHCmnGetPValFrmCCE(cellCb, nCce);
- nP = cellCb->rgSchTddNpValTbl[P];
- nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
- *hqRes = (M - m - 1)* nP + (m * nPlusOne) + pdcch->nCce +
- cellCb->pucchCfg.n1PucchAn;
-
- return;
-}
-
-/** @brief This function fills the harq reception request for
- * TDD in case of Fomat 1B with CS for M=1
- *
- * @details
- *
- * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1
- *
- * Processing steps:
- * -Fill Harq Reception Request for Format 1B with
- * Channel Selection
- *
- * @param [in] RgSchDlHqProcCb *hqCb
- * @param [in] TfuUePucchRecpReq *hqRecpReq
- * @param [in] uint8_t noFdbks
- * @param [in] RgSchDlSf *dlSf
- * @param [in] RgSchPdcch *pdcch
- * @param [in] RgSchCellCb *cellCb
- * @return void
- */
-static Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1
-(
-RgSchDlHqProcCb *hqCb,
-TfuUePucchRecpReq *hqRecpReq,
-uint8_t noFdbks,
-RgSchDlSf *dlSf,
-RgSchPdcch *pdcch,
-RgSchCellCb *cellCb
-)
-{
- RgSchUeCb *ue = NULLP;
- Bool isCellSec = FALSE;
- uint16_t hqRes;
-
- /*ccpu00147920: UeCb is NULL for SPS activation*/
- if(pdcch && pdcch->ue)
- {/* SPS Release pdcch or dynamic data */
- ue = pdcch->ue;
- }else
- {/* SPS occasion */
-#ifdef ERRCLS_KW
- if(hqCb == NULLP)
- {
- /* This is not supposed to happen
- * Error case. hqCB has to be ter
- * when pdcch is present . Adding
- * if check bcs of kwork*/
- return;
- }
-#endif
- ue = hqCb->hqE->ue;
- }
-
- if((hqCb != NULLP) &&
- (RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
- {
- isCellSec = TRUE;
- }
-
- switch(ue->f1bCsAVal)
- {
- case RG_SCH_A_VAL_2:
- /* harq(0) is primary harq(1) is secondary) */
- if(isCellSec)
- {
- hqRecpReq->hqInfo.hqRes[1] = ue->n1PucchF1bResCb.
- cw1N1Res[hqCb->tpc].n1PucchIdx;
- }
- else/* primary cell */
- {
-#ifdef LTEMAC_SPS
- /* hqCb will be null in case of sps rel pdcch */
- if ((hqCb) && hqCb->spsN1PucchRes.pres)
- {/* SPS occasion or dyn sched*/
- hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
- }
- else
-#endif /* LTEMAC_SPS */
- {/* dyn data or sps release */
-#ifdef ERRCLS_KW
- if(pdcch == NULLP)
- {
- /* This is not supposed to happen
- * Error case. hqCB has to be ter
- * when pdcch is present . Adding
- * if check bcs of kwork*/
- return;
- }
-#endif
-
- rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
- hqRecpReq->hqInfo.hqRes[0] = hqRes;
- }
- }
- break;
- case RG_SCH_A_VAL_3:
- {
- /* Serving cell in mimo mode should be
- * in 0 and 1 and the serving cell in siso
- * mode should be in 2 indices */
- if(isCellSec)
- {
- uint8_t servCellIdx = rgSchUtlGetServCellIdx(hqCb->hqE->cell->instIdx,
- hqCb->hqE->cell->cellId,
- hqCb->hqE->ue);
-
- if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1)
- {/* Sec cell is in mimo mode, use 0 and 1 */
- hqRecpReq->hqInfo.hqRes[0] =
- ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
- hqRecpReq->hqInfo.hqRes[1] =
- ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
- }
- else
- {/* Sec cell is in siso mode, use 2 */
- hqRecpReq->hqInfo.hqRes[2] =
- ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
- }
- }
- else
- {/* primary cell hq */
-
- if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
- {/* prim cell is in mimo mode, use 0 and 1 */
-#ifdef LTEMAC_SPS
- if (hqCb && hqCb->spsN1PucchRes.pres)
- {/* Not sps release */
- hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
- }
- else
-#endif /* LTEMAC_SPS */
- {/* sps rel or dyn */
-#ifdef ERRCLS_KW
- if(pdcch == NULLP)
- {
- /* This is not supposed to happen
- * Error case. hqCB has to be ter
- * when pdcch is present . Adding
- * if check bcs of kwork*/
- return;
- }
-#endif
-
- rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
- hqRecpReq->hqInfo.hqRes[0] = hqRes;
- hqRecpReq->hqInfo.hqRes[1] = hqRes + 1;
- }
- }
- else
- {/* prim cell is in siso mode use 2 */
-#ifdef LTEMAC_SPS
- /* Consider sps occasions */
- if (hqCb && hqCb->spsN1PucchRes.pres)
- {/* Not sps release */
- hqRecpReq->hqInfo.hqRes[2] = hqCb->spsN1PucchRes.val;
- }
- else
-#endif /* LTEMAC_SPS */
- {
-#ifdef ERRCLS_KW
- if(pdcch == NULLP)
- {
- /* This is not supposed to happen
- * Error case. hqCB has to be ter
- * when pdcch is present . Adding
- * if check bcs of kwork*/
- return;
- }
-#endif
-
- rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
- hqRecpReq->hqInfo.hqRes[2] = hqRes;
- }
- }
- }
- }
- break;
- case RG_SCH_A_VAL_4:
- {/* Both the serv cells are in mimo mode */
- if(isCellSec)
- {/* 2 and 3 for sec cell */
- hqRecpReq->hqInfo.hqRes[2] =
- ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
- hqRecpReq->hqInfo.hqRes[3] =
- ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
- }
- else/* primary cell */
- {/* 0 and 1 are for primary cell */
-#ifdef LTEMAC_SPS
- if (hqCb && hqCb->spsN1PucchRes.pres)
- {/* Not sps release */
- hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
- }
- else
-#endif /* LTEMAC_SPS */
- {
-#ifdef ERRCLS_KW
- if(pdcch == NULLP)
- {
- /* This is not supposed to happen
- * Error case. hqCB has to be ter
- * when pdcch is present . Adding
- * if check bcs of kwork*/
- return;
- }
-#endif
-
- rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
- hqRecpReq->hqInfo.hqRes[0] = hqRes;
- hqRecpReq->hqInfo.hqRes[1] = hqRes + 1;
- }
- }
- }
- break;
- default:
- break;
- }
- return;
-}
-
-/** @brief This function fills the harq reception request for
- * TDD in case of Fomat 1B with CS for M>=2
- *
- * @details
- *
- * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234
- *
- * Processing steps:
- * -Fill Harq Reception Request for Format 1B with
- * Channel Selection
- *
- * @param [in] RgSchDlHqProcCb *hqCb
- * @param [in] TfuUePucchRecpReq *hqRecpReq
- * @param [in] uint8_t noFdbks
- * @param [in] RgSchDlSf *dlSf
- * @param [in] RgSchPdcch *pdcch
- * @param [in] RgSchCellCb *cellCb
- * @param [in] uint8_t elemIdx
- * @return void
- */
-static Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234
-(
-RgSchDlHqProcCb *hqCb,
-TfuUePucchRecpReq *hqRecpReq,
-uint8_t noFdbks,
-RgSchDlSf *dlSf,
-RgSchPdcch *pdcch,
-RgSchCellCb *cellCb,
-uint8_t elemIdx
-)
-{
- RgSchUeCb *ue;
- Bool isCellSec = FALSE;
- uint16_t hqRes = 0;
- uint8_t servCellIdx;
-
- if(pdcch)
- {/* SPS Release pdcch or dynamic data */
- ue = pdcch->ue;
- }else
- {/* SPS occasion */
-#ifdef ERRCLS_KW
- if(hqCb == NULLP)
- {
- /* This is not supposed to happen
- * Error case. hqCB has to be ter
- * when pdcch is present . Adding
- * if check bcs of kwork*/
- return;
- }
-#endif
- ue = hqCb->hqE->ue;
- }
-
- if((hqCb != NULLP) && (ue != NULLP) &&
- (RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
- {
- isCellSec = TRUE;
- }
-
- if(isCellSec)
- {/* Sec Cell indices are 2 and 3*/
- servCellIdx = rgSchUtlGetServCellIdx(hqCb->hqE->cell->instIdx,
- hqCb->hqE->cell->cellId,
- hqCb->hqE->ue);
-
- hqRecpReq->hqInfo.hqRes[2] =
- ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
-
- if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1)
- {
- hqRecpReq->hqInfo.hqRes[3] =
- ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
- }
- }
- else
- {/* Primary cell indices are 0 and 1 */
- /* SPS occasions
- * M > 2 if SPS occasion is present in any of the
- * DL subframe in the bundle, the n1Pucch(0) is
- * the SPS resource and n1Pucch(1) is the resource
- * derived from pdcch with DAI = 1
- * If No SPS Occasion
- * Then n1Pucch(0) is from pdcch with DAI =1
- * and n1Pucch(1) is from pdcch with DAI = 2
- * */
-
- if(hqCb != NULLP)
- {/* this is not sps release pdcch */
- if(hqCb->spsN1PucchRes.pres == TRUE)
- {/* SPS occasion*/
- hqRes = hqCb->spsN1PucchRes.val;
- }
- }
-
- if(pdcch)
- {/*Dynamic scheduling or SPS Release
- Derive from pdcch */
- if(pdcch->dlDai < 3)
- {/* No need to calcualte from DAI > 2 */
- rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
- }
- }
-
- if(2 == noFdbks)
- {/* M == 2 case */
- hqRecpReq->hqInfo.hqRes[elemIdx] = hqRes;
- }
- else
- {/* Pdcch with DAI = 1 and 2 needs to be used
- for resource calculation*/
- if(hqCb && hqCb->spsN1PucchRes.pres == TRUE)
- {/* dyn or sps occasion */
- /* Shift the hqRes[0] if it was filled
- * if there was a pdcch with DAI 1 before to this
- * subframe*/
- if(hqCb->ulDai > 1)
- {/* SPS occasion happened in the middle
- of the bundle */
- /* shifting the non SPS resource to n1Pucch(1) */
- hqRecpReq->hqInfo.hqRes[1] = hqRecpReq->hqInfo.hqRes[0];
- }
-
- hqRecpReq->hqInfo.hqRes[0] = hqRes;
- }
-#ifdef ERRCLS_KW
- else if(pdcch && pdcch->dlDai < 3)
-#else
- else if(pdcch->dlDai < 3)
-#endif
- {/* sps rel or dyn sched */
- /* hqCb wil not be present for sps release pdcch */
- if(hqCb && (pdcch->dlDai != hqCb->ulDai))
- {/* there was a SPS occasion before to this */
- if(pdcch->dlDai == 1)
- {
- hqRecpReq->hqInfo.hqRes[1] = hqRes;
- }/* ignore the DAI 2 in this case */
- }else
- {/* There was no SPS occasion before to this */
-#ifdef ERRCLS_KW
- if(pdcch->dlDai)
-#endif
- {/* Added check to ignore kwork warning */
- hqRecpReq->hqInfo.hqRes[(pdcch->dlDai)-1] = hqRes;
- }
- }
- }
- }
- }
- return;
-}
-
-/** @brief This function fills the harq reception request for
- * TDD in case of Fomat 1B with CS
- *
- * @details
- *
- * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCS
- *
- * Processing steps:
- * -Fill Harq Reception Request for Format 1B with
- * Channel Selection
- *
- * @param [in] RgSchDlSf *ulSf
- * @param [in] RgSchCellCb *cell
- * @param [out]TfuUePucchRecpReq *hqRecpReq
- * @return S16
- */
-static S16 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS
-(
-RgSchDlHqProcCb *hqCb,
-TfuUePucchRecpReq *hqRecpReq,
-uint8_t noFdbks,
-RgSchDlSf *dlSf,
-RgSchPdcch *pdcch,
-uint8_t elemIdx,
-RgSchCellCb *cellCb
-)
-{
- /* Update teh fdbk mode if something different is present
- * in L1 API file for F1BS *//* 1 --> F1BCS */
- hqRecpReq->hqInfo.hqFdbkMode = TFU_ACK_NACK_CHANNEL_SELECTION;
-
- switch(noFdbks)
- {/* M Value */
- case RG_SCH_M_VAL_1:
- {
-
- rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1(hqCb,hqRecpReq,
- noFdbks,dlSf,pdcch,cellCb);
- break;
- }
- case RG_SCH_M_VAL_2:
- case RG_SCH_M_VAL_3:
- case RG_SCH_M_VAL_4:
- {
- /* Spatial bundling will be applied */
- rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234(hqCb,hqRecpReq,
- noFdbks,dlSf,pdcch,cellCb,elemIdx);
- break;
- }
- default:
- break;
- }
- return ROK;
-}
-#endif
-
-/***********************************************************
- *
- * Func : rgSCHTomUtlFillSfHqFdbkForOneUe
- *
- * Desc : Fill HARQ feedback info for one UE/entry
- *
- * Ret : ROK/RFAILED
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHTomUtlFillSfHqFdbkForOneUe
-(
-RgSchDlHqProcCb *hqCb,
-TfuRecpReqInfo *recpReqInfo,
-RgSchCellCb *cellCb,
-RgSchErrInfo *err,
-RgSchDlSf *dlSf,
-uint8_t noFdbks,
-CmMemListCp *memCp,
-uint8_t elemIdx,
-RgSchDlSf *nxtDlsf,
-CmLteRnti rnti,
-RgrTddAckNackMode ackNackMode,
-RgSchUePucchRecpInfo **pucchInfoRef,
-RgSchPdcch *pdcch,
-TknUInt16 n1PucchTkn,
-Bool *allocRef,
-uint8_t hqSz
-)
-{
- RgSchUePucchRecpInfo *pucchInfo = *pucchInfoRef;
- Bool alloc = FALSE;
- S16 ret;
- TfuUePucchRecpReq *hqRecpReq;
-#ifdef TFU_UPGRADE
- uint8_t M;
- uint8_t P;
- uint8_t m;
- uint8_t nP;
- uint8_t nPlusOne;
- uint16_t pucchRes;
- uint8_t resIdx;
- uint8_t nCce;
- uint8_t prevHqSize;
-#else
- uint8_t multCnt;
-#endif
-#ifdef LTEMAC_SPS
- Bool isFirstFdbk = FALSE;
-#endif
- if(pucchInfo == NULLP)
- {
- if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchInfo,
- sizeof(RgSchUePucchRecpInfo), memCp)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to "
- "Allocate TfuUeRecpReqInfo for cell RNTI:%d",rnti);
- err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
- return ret;
- }
- alloc = TRUE;
-#ifdef TFU_ALLOC_EVENT_NO_INIT
- pucchInfo->hashLstEnt.hashVal = 0;
- pucchInfo->hashLstEnt.keyLen = 0;
- pucchInfo->hashLstEnt.key = 0;
- pucchInfo->hashLstEnt.list.prev = pucchInfo->hashLstEnt.list.next = 0;
-#endif
- if ((ret = rgSCHUtlGetEventMem((Ptr *)&(pucchInfo->pucchRecpInfo),
- sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to "
- "Allocate TfuUeRecpReqInfo for cell RNTI:%d",rnti);
- err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
- return ret;
- }
- memset(pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes,0xff,sizeof(uint16_t)*TFU_MAX_HQ_RES);
-#ifdef TFU_ALLOC_EVENT_NO_INIT
- memset(&pucchInfo->pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
-#endif
- pucchInfo->pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
- pucchInfo->pucchRecpInfo->rnti = rnti;
-#ifdef TFU_UPGRADE
- pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo=TFU_PUCCH_HARQ;
-#endif
-#ifdef LTEMAC_SPS
- isFirstFdbk = TRUE;
-#endif
- }
- /* Fill m, M, P */
- /* Calculation of resources same for both bundling and muxing for M = 1
- * */
-#ifdef LTE_ADV
- RgSchUeCb *ue = rgSCHDbmGetUeCb (cellCb, rnti);
- if((ue) && (1 == ue->numSCells))
- {
- if(ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS)
- {
- hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
- rgSCHTomUtlFillSfHqFdbkForFrmt1BCS(hqCb,hqRecpReq,
- noFdbks,dlSf,pdcch,elemIdx,cellCb);
-
- if(noFdbks == 1)
- {/* M = 1 case . size is same as A Value*/
- hqRecpReq->hqInfo.hqSz = ue->f1bCsAVal;
- hqRecpReq->hqInfo.pucchResCnt = hqRecpReq->hqInfo.hqSz;
- }else
- {/* M > 1 case */
- hqRecpReq->hqInfo.hqSz = (noFdbks * 2); /* M for 2 cells */
- hqRecpReq->hqInfo.pucchResCnt = 4;
- }
- hqRecpReq->hqInfo.a = ue->f1bCsAVal;
- /* handling for SPS occasions*/
- if(elemIdx == 0)
- {
- /* set the datPresinFirstSUbframe to TRUE if this
- * is for pcell txion*/
-#ifdef ERRCLS_KW
- RgSchTddANInfo *anInfo = NULLP;
-#endif
- /* if this txion is on pcell
- * sps occaion, dyn sched or sps release pdcch
- * set the sched present in first
- * dl subframe of the bundle to TRUE. This
- * is required for mapping the feedbak when SPS occasion
- * is present in any of the DL subframe in the bundle in
- * case of M > 2*/
-
- /* SPS will happen only on pcell */
- if((hqCb == NULLP) || (!RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
- {
-#ifdef ERRCLS_KW
- anInfo = rgSCHUtlGetUeANFdbkInfo(ue,
- &recpReqInfo->timingInfo,RGSCH_PCELL_INDEX);
- if(anInfo == NULL)
- {/* ANInfo must be there. adding block
- because of kworks*/
- DU_LOG("\nERROR --> SCH : ANInfo should not be NULL for cellId=%d \n", cellCb->cellId);
- return RFAILED;
- }
-#endif
- }
- }
- }else
- {/* This needs to be revisited while
- adding support for PUCCH format 3 */
- DU_LOG("\nERROR --> SCH : Invalid Pucch format configured..");
- return RFAILED;
- }
- }
- else
-#endif
- {
- if((ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) ||
- ((noFdbks == 1) && (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT)))
- {
- hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
-#ifdef TFU_UPGRADE
- prevHqSize = hqRecpReq->hqInfo.hqSz;
-#endif
-#ifndef TFU_UPGRADE
- /* Only one index for bundling case */
- hqRecpReq->M = noFdbks;
- hqRecpReq->hqType =
- TFU_HQ_RECP_REQ_NORMAL;
- hqRecpReq->multCnt = 1;
- hqRecpReq->t.nCce[0] =
- pdcch->nCce;
- hqRecpReq->m[0] =
- dlSf->dlFdbkInfo.m;
- hqRecpReq->p[0] =
- rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
-
- hqRecpReq->type = TFU_UCI_HARQ;
-
-#else /* TFU_UPGRADE */
-
-#ifdef LTEMAC_SPS
- if ((TRUE == isFirstFdbk) && (TRUE == n1PucchTkn.pres))
- {
- hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)ackNackMode;
- hqRecpReq->hqInfo.pucchResCnt=1;
- hqRecpReq->hqInfo.hqRes[0] = n1PucchTkn.val;
- hqRecpReq->hqInfo.hqSz = hqSz;
- }
- /* ccpu00139413 */
- else if (FALSE == n1PucchTkn.pres)
-#endif
- {
- hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)ackNackMode;
- M = noFdbks;
- P = rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
- nP = cellCb->rgSchTddNpValTbl[P];
- nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
- m = dlSf->dlFdbkInfo.m;
- /* In case of no UE */
- pucchRes = (M - m - 1)* nP + (m * nPlusOne) + pdcch->nCce +
- cellCb->pucchCfg.n1PucchAn;
- /*ccpu00130164:MOD-Changed to maitain value of
- hqRecpReq->hqInfo.pucchResCnt=1 in case of bundling*/
- /*ccpu00132284 -MOD- hqRes need to be updated after pucchReCnt set to 1
- * and resource should be update at index-0*/
- hqRecpReq->hqInfo.pucchResCnt=1;
- hqRecpReq->hqInfo.hqRes[hqRecpReq->hqInfo.pucchResCnt-1] = pucchRes;
-
- if((ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) && (hqSz > prevHqSize))
- hqRecpReq->hqInfo.hqSz = hqSz;
- else if (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT)
- hqRecpReq->hqInfo.hqSz = hqSz;
- else
- hqRecpReq->hqInfo.hqSz = prevHqSize;
- }
-#endif /* TFU_UPGRADE */
-#ifndef TFU_UPGRADE
- cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst,
- &(pucchInfo->pucchRecpInfo->lnk));
- pucchInfo->pucchRecpInfo->lnk.node =
- (PTR)pucchInfo->pucchRecpInfo;
-#endif
- }
- else /* Multiplexing */
- {
-#ifndef TFU_UPGRADE
- pucchInfo->pucchRecpInfo->t.pucchRecpReq.M = noFdbks;
-#ifdef LTEMAC_SPS
- if (n1PucchTkn.pres == TRUE)
- {
- pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqType =
- TFU_HQ_RECP_REQ_N1PUCCH;
- pucchInfo->pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = n1PucchTkn.val;
- }
- else
-#endif
- {
- pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqType =
- TFU_HQ_RECP_REQ_NORMAL;
- multCnt = pucchInfo->pucchRecpInfo->t.pucchRecpReq.multCnt;
- pucchInfo->pucchRecpInfo->t.pucchRecpReq.t.nCce[multCnt] =
- pdcch->nCce;
- pucchInfo->pucchRecpInfo->t.pucchRecpReq.m[multCnt] =
- dlSf->dlFdbkInfo.m;
- pucchInfo->pucchRecpInfo->t.pucchRecpReq.p[multCnt] =
- rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
-
- pucchInfo->pucchRecpInfo->t.pucchRecpReq.multCnt++;
- }
-#else /* TFU_UPGRADE */
-
- hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
- hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)RGR_TDD_ACKNACK_MODE_MULT;
- hqRecpReq->hqInfo.hqSz = noFdbks;
-
- resIdx = hqRecpReq->hqInfo.pucchResCnt;
- hqRecpReq->hqInfo.pucchResCnt++;
-
-#ifdef LTEMAC_SPS
- if (n1PucchTkn.pres == TRUE)
- {
- hqRecpReq->hqInfo.hqRes[resIdx] = n1PucchTkn.val;
- }
- else
-#endif
- {
- M = noFdbks;
- m = dlSf->dlFdbkInfo.m;
- nCce = pdcch->nCce;
- P = rgSCHCmnGetPValFrmCCE(cellCb, nCce);
- nP = cellCb->rgSchTddNpValTbl[P];
- nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
- hqRecpReq->hqInfo.hqRes[resIdx] = (M - m - 1)* nP +
- (m * nPlusOne) + pdcch->nCce +
- cellCb->pucchCfg.n1PucchAn;
- }
-#endif /* TFU_UPGRADE */
- /* If all the DL subframes are scanned, then
- * send TFU request*/
-#ifndef TFU_UPGRADE
- if((elemIdx != noFdbks) && alloc)
- {
- cmHashListInsert(&cellCb->ueTfuPendLst, (PTR) pucchInfo,
- (uint8_t *)&rnti, (uint16_t) sizeof(rnti));
- alloc = FALSE;
- }
- else
- {
- pucchInfo->pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
- cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst,
- &(pucchInfo->pucchRecpInfo->lnk));
- pucchInfo->pucchRecpInfo->lnk.node =
- (PTR)pucchInfo->pucchRecpInfo;
- /* Delete the entry after addition to the list */
- cmHashListDelete(&cellCb->ueTfuPendLst, (PTR) pucchInfo);
- }
-#endif
- }
- }
-
- *pucchInfoRef = pucchInfo;
- *allocRef = alloc;
- return ROK;
-}
-#endif
-
-#ifdef RG_ULSCHED_AT_CRC
-/** @brief This function does all the processing related to a single downlink
- * subframe.
- *
- * @details
- *
- * Function: rgSCHTomUtlProcDlSfAtCrc
- *
- * Processing steps:
- * - collate control data for all UEs and send to PHY
- * - collate data buffers for all UEs and send to PHY
- *
- * @param [in] RgSchDlSf *ulSf
- * @param [in] RgSchCellCb *cell
- * @param [in] TfuCntrlReqInfo *cntrlInfo
- * @param [out] RgSchErrInfo *err
- * @return S16
- */
-static S16 rgSCHTomUtlProcDlSfAtCrc
-(
-RgSchDlSf *ulSf,
-CmLteTimingInfo crntUlFrm,
-RgSchCellCb *cell,
-TfuCntrlReqInfo *cntrlInfo,
-RgSchErrInfo *err
-)
-{
- Inst inst = cell->instIdx;
- S16 ret;
-
- cntrlInfo->numDlActvUes = 0;
- cmLListInit(&cntrlInfo->phichLst);
- cmLListInit(&cntrlInfo->dlPdcchLst);
- cmLListInit(&cntrlInfo->ulPdcchLst);
-#ifdef TFU_ALLOC_EVENT_NO_INIT
- cntrlInfo->dlTiming.sfn = cntrlInfo->dlTiming.subframe = 0;
- cntrlInfo->cfi = 0;
-#endif
-
- cntrlInfo->ulTiming = crntUlFrm;
- RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cntrlInfo->ulTiming, TFU_ULCNTRL_DLDELTA);
-
- cntrlInfo->cellId = cell->cellId;
- /* Fill PHICH info */
- if ((ret = rgSCHTomUtlFillPhich (cell, cntrlInfo, ulSf, err)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to send PHICH info for cell");
- RGSCH_FREE_MEM(cntrlInfo);
- return ret;
- }
-
- /* Fill UL Pdcch */
- if ((ret = rgSCHTomUtlFillUlPdcch (cell, cntrlInfo, ulSf, err)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to send PDCCH info for cell");
- RGSCH_FREE_MEM(cntrlInfo);
- return ret;
- }
-
-#ifdef EMTC_ENABLE
- if(0 == cntrlInfo->ulMpdcchLst.count)
- {
- gUlMpdcchBlank++;
- }
-#endif
-
-#ifdef EMTC_ENABLE
- if ((cntrlInfo->ulPdcchLst.count || cntrlInfo->phichLst.count) || RG_SCH_EMTC_GET_PDCCHLST_CNT(cntrlInfo))
-#else
- if (cntrlInfo->ulPdcchLst.count || cntrlInfo->phichLst.count)
-#endif
- {
- //if (rgSCHUtlTfuCntrlReq(inst, cell->tfuSap->sapCfg.suId, cntrlInfo) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Unable to send Cntrl info for cell");
- }
- }
- else
- {
- RGSCH_FREE_MEM(cntrlInfo);
- }
- return ROK;
-} /* end of */
-#endif /* #ifdef RG_ULSCHED_AT_CRC*/
-
-#ifdef RGR_RRM_TICK
-/** @brief This function sends the SFN Tick to L3
- * subframe.
- *
- * @details
- *
- * Function: rgSCHTomUtlSendSfnTick
- *
- * @param [in] RgSchCellCb *cell
- */
-static Void rgSCHTomUtlSendSfnTick
-(
-RgSchCellCb *cell
-)
-{
- RgrTtiIndInfo *rgrTtiInd;
-
- /* TTI to be sent to RRM only once per system frame */
- /* Added support for period = 0 to disable tick to RRM */
- if ((cell->rrmTtiIndPrd != 0) &&
- ((cell->crntTime.sfn % cell->rrmTtiIndPrd) == 0) &&
- (cell->crntTime.slot == 0))
- {
- /* Allocate a TTI indication structure and send to RRM over RGR interface */
- if (rgSCHUtlAllocSBuf (cell->instIdx,
- (Data**)&rgrTtiInd, sizeof(RgrTtiIndInfo)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Mem alloc failed for RGR TTI ind, cellId (%d))\n",
- cell->cellId);
- return;
- }
- rgrTtiInd->cellId = cell->cellId;
- //rgrTtiInd->hSfn = cell->crntTime.hSfn;
- rgrTtiInd->sfn = cell->crntTime.sfn;
-
- if (rgSCHUtlRgrTtiInd (cell, rgrTtiInd) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Failed to send RGR TTI ind, cellId (%d))\n",
- cell->cellId);
- rgSCHUtlFreeSBuf(cell->instIdx, (Data**)&rgrTtiInd,
- sizeof(RgrTtiIndInfo));
- return;
- }
- }
- return;
-}
-#endif
-
-#ifdef RG_5GTF
-
-/* @brief Mark Dyn TDD CrntSfIdx.
- *
- * @details
- *
- * Function: rgSCHDynTDDMrkCrntSfIdx
- * Purpose: update the dyn tdd sunframe index
- * @param[in] Inst schInst
- * @return None
- */
-#ifdef UNUSED_FUNC
-static Void rgSCHDynTDDMrkCrntSfIdx(Inst schInst)
-{
- RgSchDynTddCb *rgSchDynTddInfo = &(rgSchCb[schInst].rgSchDynTdd);
-
-
- RG_SCH_DYN_TDD_MARKTYPE(rgSchDynTddInfo, rgSchDynTddInfo->crntDTddSfIdx,
- RG_SCH_DYNTDD_NOTDEF);
- rgSchDynTddInfo->crntDTddSfIdx = (rgSchDynTddInfo->crntDTddSfIdx + 1) %
- RG_SCH_DYNTDD_MAX_SFINFO;
-
- //DU_LOG("\nERROR --> SCH : Initializing Index %d \n", rgSchDynTddInfo->crntDTddSfIdx);
-
- return;
-}
-#endif
-#endif
-/** @brief This function fills the TTI timinig info for each cell
- *
- * @details
- *
- * Function: rgSchTomFillCellTtiInfo
- *
- * @param [in] TfuTtiIndInfo *ttiInd
- * @param [in] Inst schInst
- * @param [out] uint8_t *nCell
- * @param [out] RgSchCellCb *cell[]
- *
- * Returns: Void
- *
- */
-#ifdef UNUSED_FUNC
-static Void rgSchTomFillCellTtiInfo
-(
-TfuTtiIndInfo *ttiInd,
-Inst schInst,
-uint8_t *nCell,
-RgSchCellCb *cells[]
-)
-{
- uint8_t i = 0;
- uint8_t strtCellId;
- TfuTtiCellInfo *cellInfo;
- RgSchCellCb *cell;
- uint32_t Idx1;
-
- CmLteTimingInfo frm;
-
- if (CM_LTE_MAX_CELLS < ttiInd->numCells)
- {
- return;
- }
-
-#ifdef RG_5GTF
- rgSCHDynTDDMrkCrntSfIdx(schInst);
-#endif
-
- for (i = 0; i < ttiInd->numCells; i++)
- {
- cellInfo = &ttiInd->cells[i];
- strtCellId = rgSchCb[schInst].genCfg.startCellId;
- Idx1 = (uint8_t)((cellInfo->cellId - strtCellId)&(CM_LTE_MAX_CELLS-1));
- cell = rgSchCb[schInst].cells[Idx1];
- /* Validate the cell */
- if (cell == NULLP)
- {
- /* Use SCH inst 0 print buff */
- DU_LOG("\nERROR --> SCH : RgLiTfuTtiInd()No cell exists for cellId %d\n",
- cellInfo->cellId));
- continue;
- }
- *nCell = *nCell + 1;
- cells[i] = (RgSchCellCb *)cell;
-
- /* 4UE_TTI_DELTA */
- if(cell->schTickDelta != cellInfo->schTickDelta)
- {
- DU_LOG("\nERROR --> SCH : Delta changed for cellId=%d: curr delta=%d new delta=%d\n"
- "dlblankSf=%d ulblankSf=%d dummyTti=%d \n",
- cell->cellId, cell->schTickDelta, cellInfo->schTickDelta, cellInfo->dlBlankSf,cellInfo->ulBlankSf,
- cellInfo->isDummyTti);
- }
- RGSCH_UPDATE_DELTA(schInst, cellInfo->schTickDelta);
- cell->schTickDelta = cellInfo->schTickDelta;
- /* 4UE_TTI_DELTA */
-
- cell->stopSiSch = cellInfo->dlBlankSf;
- cell->stopDlSch = cellInfo->dlBlankSf;
- cell->stopUlSch = cellInfo->ulBlankSf;
- if (cellInfo->isDummyTti)
- {
- cell->stopDlSch = TRUE;
- }
- if((0 == (cellInfo->timingInfo.sfn % 30)) && (0 == cellInfo->timingInfo.slot))
- {
- //DU_LOG("5GTF_CHECK rgSCHTOMTtiInd (%d : %d)\n", cellInfo->timingInfo.sfn, cellInfo->timingInfo.slot);
- }
-#ifndef EMTC_ENABLE
- RGSCHCPYTIMEINFO(cellInfo->timingInfo, cell->crntTime);
- RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->hiDci0Time,
- TFU_ULCNTRL_DLDELTA);
- RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->dlDciTime,
- TFU_DLCNTRL_DLDELTA);
- RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->rcpReqTime,
- TFU_RECPREQ_DLDELTA);
- RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->hqRlsTime,
- TFU_HQFBKIND_ULDELTA);
- RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->dlSfRlsTime,
- RGSCH_RLS_SF_IDX);
-#else
- RGSCHCPYTIMEINFO_EMTC(cellInfo->timingInfo, cell->crntTime);
- RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->hiDci0Time,
- TFU_ULCNTRL_DLDELTA);
- RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->dlDciTime,
- TFU_DLCNTRL_DLDELTA);
- RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->rcpReqTime,
- TFU_RECPREQ_DLDELTA);
- RGSCHDECRFRMCRNTTIME_EMTC(cell->crntTime, cell->hqRlsTime,
- TFU_HQFBKIND_ULDELTA);
- RGSCHDECRFRMCRNTTIME_EMTC(cell->crntTime, cell->dlSfRlsTime,
- RGSCH_RLS_SF_IDX);
-#endif
- rgSCHCmnUpdVars(cell);
- cell->isDlDataAllwd = TRUE;
-/* Get DownLink SubFrame */
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- frm = cell->crntTime;
-#ifndef EMTC_ENABLE
- RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA);
-#else
- RGSCH_INCR_SUB_FRAME_EMTC(frm, RG_SCH_CMN_DL_DELTA);
-#endif
- cellSch->dl.time = frm;
-
-#ifdef RG_PFS_STATS
- cell->totalTime++;
-#endif
-#ifdef LTE_TDD
- uint8_t idx = (cell->crntTime.slot + RG_SCH_CMN_DL_DELTA) %
- RGSCH_NUM_SUB_FRAMES_5G;
-
- cell->isDlDataAllwd = RG_SCH_CMN_CHK_DL_DATA_ALLOWED(cell, idx);
-
- /*ccpu00130639 -ADD - used in UL HARQ proc id calculation*/
- if((cell->crntTime.sfn == 0) && (cell->crntTime.slot == 0))
- {
- /* sfn Cycle used for Tdd UL Harq Proc Determination.
- This sfn Cycle will have values from 0 to numUl Harq-1. */
- cell->tddHqSfnCycle = (cell->tddHqSfnCycle + 1 ) %
- (rgSchTddUlNumHarqProcTbl[cell->ulDlCfgIdx]);
- }
-#endif
-#ifdef EMTC_ENABLE
- if(cell->emtcEnable)
- {
- rgSCHUtlEmtcResPrcTti(cell);
- }
-#endif
- }
-}
-#endif
-void schFillCrntTime(
- SlotTimingInfo slotInd,
- Inst schInst)
-{
- uint8_t cellCount = 0;
- for(cellCount = 0; cellCount < CM_LTE_MAX_CELLS; cellCount++)
- {
- RgSchCellCb *cell;
- cell = rgSchCb[schInst].cells[cellCount];
-
- RGSCHCPYTIMEINFO(slotInd, cell->crntTime);
-
- RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->hiDci0Time,
- TFU_ULCNTRL_DLDELTA);
- RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->dlDciTime,
- TFU_DLCNTRL_DLDELTA);
- RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->rcpReqTime,
- TFU_RECPREQ_DLDELTA);
- RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->hqRlsTime,
- TFU_HQFBKIND_ULDELTA);
- RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->dlSfRlsTime,
- RGSCH_RLS_SF_IDX);
-
- RGSCH_INCR_SUB_FRAME(cell->crntTime, RG_SCH_CMN_DL_DELTA);
-
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
- cellSch->dl.time = cell->crntTime;
- }
-}
-
-/** @brief This function prepares the TTI for scheduling and
- * invokes the Common channel scheduler. Uplink scheduler
- * is invoked first if UL Scheduling at CRC is not enabled
- *
- * @details
- *
- * Function: rgSchTomTtiUlAndDlCmnChSch
- *
- * @param [out] RgSchCellCb *cell
- *
- * Returns: Void
- *
- */
-static Void rgSchTomTtiUlAndDlCmnChSch
-(
-RgSchCellCb *cell
-)
-{
-
- cell->rlsHqArr[cell->crntHqIdx].numUes = 0;
- cell->crntHqIdx++;
- cell->crntHqIdx = cell->crntHqIdx % RGSCH_NUM_SUB_FRAMES;
-
- cmPrcTmr(&cell->tqCp, cell->tq, (PFV)rgSCHTmrProcTmr);
- rgSCHMeasGapANRepTtiHndl (cell);
- /* We need to fill the PHICH for the UL Data, first we need to get the UL
- * SF from Scheduler, next we fill the dlSf that goes out this TTI.
- * This must be performed prior to any other processing of the TTI
- * so that we do not wrap around and generate feedback prior to
- * reception of UL data.
- */
-#ifndef RG_ULSCHED_AT_CRC
- {
- uint8_t Mval = 1;
- uint8_t idx; /* Index into Uplink Sf array */
-#ifdef LTE_TDD
- Mval = rgSchTddPhichMValTbl[cell->ulDlCfgIdx]
- [cell->hiDci0Time.subframe];
-#endif
- if(Mval)
- {
- for(idx=0; idx < Mval; idx++)
- {
- rgSCHCmnRlsUlSf(cell, idx);
- }
- }
- }
-#endif
-
- /* DTX processing for those Harq's which did not get feedback from L1 */
- rgSCHDhmRlsDlsfHqProc (cell, cell->hqRlsTime);
- /* Re-Init the Downlink subframe */
- rgSCHUtlDlRlsSubFrm(cell, cell->dlSfRlsTime);
- /* Added handling to retransmit
- * release PDCCH in case of DTX
- */
-
- /*Check for DRX every TTI*/
- rgSCHDrxTtiInd(cell);
-
- /* For TDD, UL scheduling should happen after DL scheduling */
-#ifndef LTE_TDD
-#ifndef RG_ULSCHED_AT_CRC
- /* Perform UL scheduling */
- rgSCHCmnUlSch(cell);
-#endif
-#endif
- /* Perform DL scheduling for Common channels */
- rgSCHCmnDlCommonChSch(cell);
-
- return;
-}
-
-/** @brief This function invokes the Non critical procedures like measurements,
- * and RGR configurations.
- *
- * @details
- *
- * Function: rgSchTomTtiMiscFunctions
- *
- * @param [in] RgSchCellCb *cell
- *
- * Returns: Void
- *
- */
-static Void rgSchTomTtiMiscFunctions
-(
-RgSchCellCb *cell
-)
-{
- uint8_t suId = cell->tfuSap->sapCfg.suId;
-
- /* Invoke RAM Tti Handler */
- rgSCHRamTtiHndlr(cell);
-
- /* Handle RGR configurations */
- rgSCHGomTtiHndlr(cell, suId);
-#ifdef LTE_L2_MEAS
- if((RGM_PRB_REPORT_START == cell->prbUsage.prbRprtEnabld)
- && (!(cell->prbUsage.rprtPeriod) || ((glblTtiCnt % cell->prbUsage.rprtPeriod) == 0)))
- {
- rgSCHUtlUpdAvgPrbUsage(cell);
- }
- rgSCHL2Meas(cell,FALSE);
-#endif
-
- /* LTE_ADV_FLAG_REMOVED_START */
- /* Report ABS Load information to application periodically */
- if((RGR_ENABLE == cell->lteAdvCb.absCfg.status) &&
- (cell->lteAdvCb.absCfg.absLoadPeriodicity))
- {
- RgrLoadInfIndInfo *rgrLoadInf;
- uint8_t idx;
-
- cell->lteAdvCb.absLoadTtiCnt++;
- if(cell->lteAdvCb.absLoadTtiCnt >= cell->lteAdvCb.absCfg.absLoadPeriodicity)
- {
- /* ccpu00134492 */
- if(rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&rgrLoadInf,
- sizeof(RgrLoadInfIndInfo)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Could not "\
- "allocate memory for sending LoadInfo\n");
- return;
- }
- cell->lteAdvCb.absLoadTtiCnt = 0;
- rgrLoadInf->cellId = cell->cellId;
- rgrLoadInf->bw = cell->bwCfg.dlTotalBw;
- rgrLoadInf->type = RGR_ABS;
- for(idx= 0; idx<RGR_ABS_PATTERN_LEN; idx++)
- {
- rgrLoadInf->u.absLoadInfo[idx] = cell->lteAdvCb.absLoadInfo[idx];
- cell->lteAdvCb.absLoadInfo[idx] = 0;
- }
- rgSCHUtlRgrLoadInfInd(cell, rgrLoadInf);
- }
- }
-
-#ifdef LTE_TDD
- if(cell->isDlDataAllwd)
- {
- /* Calling function to update CFI parameters*/
- rgSchCmnUpdCfiDb(cell, RG_SCH_CMN_DL_DELTA);
- }
- else
- {
- /* Incrementing the ttiCnt in case of UL subframe */
- if(!cell->dynCfiCb.switchOvrInProgress)
- {
- cell->dynCfiCb.ttiCnt++;
- }
- }
-#else
- rgSchCmnUpdCfiDb(cell, RG_SCH_CMN_DL_DELTA);
-#endif
-
- /* LTE_ADV_FLAG_REMOVED_END */
- return;
-}
-
-
-/** @brief This function invokes the Downlink scheduler
- *
- * @details
- *
- * Function: rgSchTomTtiDlSch
- *
- * @param [in] RgSchCellCb *cell
- *
- * Returns: Void
- *
- */
-static Void rgSchTomTtiDlSch
-(
-RgSchCellCb *cell
-)
-{
-
- if (cell->isDlDataAllwd && (cell->stopDlSch == FALSE))
- {
- rgSCHCmnDlSch(cell);
- }
-
- return;
-}
-
-/** @brief This function invokes Consolidates the allocations
- * send the Subframe allocation info to MAC
- *
- * @details
- *
- * Function: rgSchTomTtiCnsldtSfAlloc
- *
- * @param [in] RgSchCellCb *cell
- *
- * Returns: Void
- *
- */
-static Void rgSchTomTtiCnsldtSfAlloc
-(
-RgSchCellCb *cell
-)
-{
- RgSchDlSf *dlSf;
- RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
-
- dlSf = rgSCHUtlSubFrmGet(cell, cellSch->dl.time);
-
- /* Prepare Subframe allocation info and send to MAC */
- rgSCHCmnCnsldtSfAlloc(cell);
-
- /* Call ACK NACK module to add to dlsf Queue */
- rgSCHAckNakRepAddToQ(cell, dlSf);
-
- rgSCHTomUtlProcTA(cell);
-
- return;
-}
-
-/** @brief This function prepares the DL and UL Config requests
- * and sends to CL
- *
- * @details
- *
- * Function: rgSchTomTtiL1DlAndUlCfg
- *
- * @param [in] RgSchCellCb *cell
- *
- * Returns: Void
- *
- */
-static Void rgSchTomTtiL1DlAndUlCfg
-(
-RgSchCellCb *cell,
-RgTfuCntrlReqInfo *cntrlInfo
-)
-{
- RgSchDlSf *dlSf = rgSCHUtlSubFrmGet (cell, cell->dlDciTime);
- RgSchDlSf *ulSf = rgSCHUtlSubFrmGet (cell, cell->hiDci0Time);
- RgSchErrInfo err;
-
- rgSCHTomUtlProcDlSf (dlSf, ulSf, cell, cntrlInfo, &err);
- /* Mark this frame as sent */
- dlSf->txDone = TRUE;
-
- rgBwAlloInfo[dlSf->sfNum] += dlSf->bwAssigned;
- rgBwAlcnt[dlSf->sfNum] ++;
-
-
-#ifdef LTE_TDD
- rgSCHTomUtlProcTddUlSf(cell);
-#else
- rgSCHTomUtlProcUlSf (cell, &err);
-#endif
-
- return;
-}
-#ifdef LTE_TDD
-/** @brief This function prepares does the Downlink subframe re-init and
- * Harq DTX processing
- *
- * @details
- *
- * Function: rgSchTomUtlTddRlsSfAndHarq
- *
- * @param [in] RgSchCellCb *cell
- *
- * Returns: Void
- *
- */
-static Void rgSchTomUtlTddRlsSfAndHarq
-(
-RgSchCellCb *cell
-)
-{
-
- /* ccpu00132341-MOD- rgSchTddRlsDlSubfrmTbl is dependent on DELTA(=2).
- * Instead rgSchTddDlAscSetIdxKTbl can be used as the K set gives proper
- * UL subframes*/
- /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper
- * output if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME()
- * as it is serving the purpose */
- if(rgSchTddDlAscSetIdxKTbl[cell->ulDlCfgIdx][cell->hqRlsTime.subframe].
- numFdbkSubfrms)
- {
- /* ccpu00132341-MOD- Providing the UL SF timing for avoiding
- * calculation inside the function */
- rgSCHDhmTddRlsSubFrm(cell, cell->hqRlsTime);
- rgSCHDhmRlsDlsfHqProc(cell, cell->hqRlsTime);
- }
- return;
-}
-
-/** @brief This function processes the UL subframe and fills TFU reception
- * request
- *
- * @details
- *
- * Function: rgSCHTomUtlProcTddUlSf
- *
- * @param [in] RgSchCellCb *cell
- *
- * Returns: Void
- *
- */
-static Void rgSCHTomUtlProcTddUlSf(RgSchCellCb *cell)
-{
- RgSchErrInfo err;
-
- if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
- [cell->rcpReqTime.subframe] == RG_SCH_TDD_UL_SUBFRAME)
- {
- if (rgSCHTomUtlProcUlSf (cell, &err) != ROK)
- {
- /* fill in err type and call sta ind */
- DU_LOG("\nERROR --> SCH : Unable to process Uplink subframe for cellId (%d))\n", cell->cellId);
- }
- }
- /* TDD Fix , to allow Special SF SRS CFg */
- else if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
- [cell->rcpReqTime.subframe] == RG_SCH_TDD_SPL_SUBFRAME)
- {
- if (rgSCHTomUtlPrcUlTddSpclSf(cell, &err) != ROK)
- {
- /* fill in err type and call sta ind */
- DU_LOG("\nERROR --> SCH : Unable to process Sipceial subframe for cellId (%d))\n", cell->cellId);
- }
- }
-
- return;
-}
-#endif
-
-
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Entry point fucntions
-
- File: rg_sch_uhm.c
-
-**********************************************************************/
-
-/** @file rg_sch_uhm.c
-@brief This module handles uplink harq related functionality in MAC.
-*/
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "rg_env.h" /* MAC Environment Defines */
-#include "tfu.h" /* TFU Interface defines */
-#include "rgr.h" /* RGR Interface defines */
-#include "lrg.h" /* LRG Interface defines */
-
-#include "rg_sch.h" /* Scheduler defines */
-#include "rg_sch_inf.h" /* Scheduler defines */
-#include "rg_sch_err.h" /* MAC error defines */
-
-/* header/extern include files (.x) */
-
-#include "tfu.x" /* TFU Interface defines */
-#include "rgr.x" /* RGR Interface includes */
-#include "lrg.x" /* LRG Interface includes */
-#include "rgm.x"
-#include "rg_sch_inf.x" /* Scheduler defines */
-#include "rg_sch.x" /* Scheduler includes */
-#include "rg_sch_cmn.h"
-#include "rg_sch_cmn.x"
-
-/* local defines */
-
-/* local typedefs */
-
-/* local externs */
-
-/* forward references */
-
-#ifdef EMTC_ENABLE
- uint32_t gUlRetxPassCntr = 0;
- /*uint32_t gUlRetxFailCntr;
- uint32_t gUlCrcPassCounter;
- uint32_t gUlCrcFailCounter;*/
-#endif
-uint8_t rgRvIdxTable[] = {0, 3, 1, 2}; /* This gives rvIdx for a given rv */
-uint8_t rgRvTable[] = {0, 2, 3 ,1}; /* This gives rv for a given rvIdx */
-
-#ifdef EMTC_ENABLE
-Void rgSCHCmnEmtcHdlHarqProcFail
-(
-RgSchCellCb *cell,
-RgSchUeCb *ue,
-RgSchUlHqProcCb *hqProc,
-CmLteTimingInfo frm
-);
-Void rgSCHEmtcInitUlUeHqEnt
-(
-RgSchCellCb *cell,
-RgrUeCfg *ueCfg,
-RgSchUeCb *ueCb
-);
-
-#endif
-
-/**
- * @brief Handler for HARQ processing on recieving Data indication from PHY.
- *
- * @details
- *
- * Function: rgSCHUhmProcDatInd
- *
- * Invoked by: rgSCHTomTfuDatInd of TOM
- *
- * Processing Steps:
- * - Set rcvdCrcInd variable to TRUE
- *
- * @param[in] *cell
- * @param[in] *ue
- * @param[in] frm
- * @return Void
- **/
-#ifndef MAC_SCH_STATS
-Void rgSCHUhmProcDatInd(RgSchCellCb *cell,RgSchUeCb *ue,CmLteTimingInfo frm)
-#else /* MAC_SCH_STATS */
-Void rgSCHUhmProcDatInd(RgSchCellCb *cell,RgSchUeCb *ue,CmLteTimingInfo frm,uint8_t cqi)
-#endif /* MAC_SCH_STATS */
-{
- RgSchUlHqProcCb *hqProc;
-#ifdef UL_LA
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell);
- S32 iTbs;
- uint8_t maxiTbs = rgSchCmnUlCqiToTbsTbl[cell->isCpUlExtend]
- [ueUl->maxUlCqi];
-#endif
-
- rgSCHUtlUlHqProcForUe(cell, frm, ue, &hqProc);
- if (hqProc == NULLP)
- {
- DU_LOG("\nERROR --> SCH : UE[%d] failed to find UL HqProc for [%d:%d]\n",
- ue->ueId, frm.sfn, frm.slot);
- return;
- }
- hqProc->rcvdCrcInd = TRUE;
-
-#ifdef UL_LA
- {
- ueUl->ulLaCb.deltaiTbs += UL_LA_STEPUP;
- iTbs = (ueUl->ulLaCb.cqiBasediTbs + ueUl->ulLaCb.deltaiTbs)/100;
-
- if (iTbs > maxiTbs)
- {
- ueUl->ulLaCb.deltaiTbs = (maxiTbs * 100) - ueUl->ulLaCb.cqiBasediTbs;
- }
-
- }
-#endif
-#ifdef MAC_SCH_STATS
- /** Stats update over here
- */
- {
- hqFailStats.ulCqiStat[cqi - 1].numOfAcks++;
- }
-#endif
-
-#ifdef TENB_STATS
- /* UL stats are filled in primary index as of now */
- cell->tenbStats->sch.ulAckNack[rgRvTable[hqProc->rvIdx]]++;
- ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].ulAckNackCnt++;
- if(hqProc->alloc)
- {
- ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].ulTpt += (hqProc->alloc->grnt.datSz << 3);
- cell->tenbStats->sch.ulTtlTpt +=(hqProc->alloc->grnt.datSz << 3);//pverma
- }
-#endif
-
- return;
-} /* rgSCHUhmProcDatInd */
-
-/**
- * @brief Handler for HARQ processing on recieving Data indication from PHY.
- *
- * @details
- *
- * Function: rgSCHUhmProcMsg3DatInd
- *
- * Invoked by: rgSCHTomTfuDatInd of TOM
- *
- * Processing Steps:
- * - Set rcvdCrcInd variable to TRUE
- *
- * @param[in,out] *hqProc
- * @return Void
- **/
-Void rgSCHUhmProcMsg3DatInd(RgSchUlHqProcCb *hqProc)
-{
- hqProc->rcvdCrcInd = TRUE;
- hqProc->remTx = 0; /*Reseting the value of rem Tx*/
- DU_LOG("\nINFO --> SCH : rgSCHUhmProcMsg3DatInd,id:%u\n",hqProc->procId);
- return;
-} /* rgSCHUhmProcMsg3DatInd */
-
-/**
- * @brief Handler for HARQ processing on recieving Data indication from PHY.
- *
- * @details
- *
- * Function: rgSCHUhmProcMsg3Failure
- *
- * Invoked by: rgSCHTomTfuDatInd of TOM
- *
- * Processing Steps:
- * - Set rcvdCrcInd variable to TRUE
- *
- * @param[in,out] *hqProc
- * @return Void
- **/
-Void rgSCHUhmProcMsg3Failure(RgSchUlHqProcCb *hqProc)
-{
-#ifdef EMTC_ENABLE
- RG_SCH_EMTC_IS_CRCIND_RCVD_CHK_RACB(hqProc);
-#endif
- if(hqProc->rcvdCrcInd != TRUE)
- {
- hqProc->rcvdCrcInd = FALSE;
- }
-
- return;
-} /* rgSCHUhmProcMsg3Failure */
-
-/**
- * @brief Handler for HARQ processing on recieving Decode failure from PHY.
- *
- * @details
- *
- * Function: rgSCHUhmProcHqFailure
- *
- * Invoked by: rgSCHTomTfuDecFailInd of TOM
- *
- * Processing Steps:
- * - Update NACK information in harq info.
- * - Update RV index of received RV from PHY in harq info.
- * - Set PhichInfo in DlSf
- *
- * @param[in] *cell
- * @param[in] *ue
- * @param[in] frm
- * @param[in] rv
- * @return Void
- **/
-#ifndef MAC_SCH_STATS
-Void rgSCHUhmProcHqFailure(RgSchCellCb *cell,RgSchUeCb *ue,CmLteTimingInfo frm,TknUInt8 rv)
-#else /* MAC_SCH_STATS */
-Void rgSCHUhmProcHqFailure(RgSchCellCb *cell,RgSchUeCb *ue,CmLteTimingInfo frm,TknUInt8 rv,uint8_t cqi)
-#endif /* MAC_SCH_STATS */
-{
- RgSchUlHqProcCb *hqProc;
-#ifdef UL_LA
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue,cell);
- S32 iTbs;
-#endif
-
- rgSCHUtlUlHqProcForUe(cell, frm, ue, &hqProc);
- if (hqProc == NULLP)
- {
- DU_LOG("\nERROR --> SCH : UE[%d] failed to find UL HqProc for [%d:%d]\n",
- ue->ueId, frm.sfn, frm.slot);
- return;
- }
-#ifdef UL_LA
- {
- ueUl->ulLaCb.deltaiTbs -= UL_LA_STEPDOWN;
- iTbs = (ueUl->ulLaCb.cqiBasediTbs + ueUl->ulLaCb.deltaiTbs)/100;
-
- if (iTbs < 0)
- {
- ueUl->ulLaCb.deltaiTbs = -(ueUl->ulLaCb.cqiBasediTbs);
- }
-
- }
-#endif
-#ifdef MAC_SCH_STATS
- /** Stats update over here */
- {
- static uint32_t retxCnt = 0;
- ++retxCnt;
- hqFailStats.ulCqiStat[cqi - 1].numOfNacks++;
- }
-#endif /* MAC_SCH_STATS */
- if(hqProc->rcvdCrcInd != TRUE)
- {
- hqProc->rcvdCrcInd = FALSE;
- }
-#ifdef TENB_STATS
- /* UL stats are filled in primary index as of now */
- cell->tenbStats->sch.ulAckNack[rgRvTable[hqProc->rvIdx]]++;
- ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].ulAckNackCnt++;
- cell->tenbStats->sch.ulNack[rgRvTable[hqProc->rvIdx]]++;
- ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].ulNackCnt++;
-#endif
- hqProc->rvIdxPhy.pres = rv.pres;
- if(rv.pres)
- {
- hqProc->rvIdxPhy.val = rgRvIdxTable[rv.val];
- }
- return;
-} /* rgSCHUhmProcHqFailure */
-
-/**
- * @brief Handler for identifying the HARQ process cb associated with the
- * index.
- *
- * @details
- *
- * Function: rgSCHUhmGetUlHqProc
- *
- * Processing Steps:
- * - Return pointer to uplink harq process corresponding to the timing
- * information passed.
- *
- * @param[in] *ue
- * @param[in] idx
- * @return RgSchUlHqProcCb*
- * -# Pointer to harq process corresponding to index
- * -# NULL
- **/
-RgSchUlHqProcCb* rgSCHUhmGetUlHqProc(RgSchCellCb *cell,RgSchUeCb *ue, uint8_t idx)
-{
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell);
-
-#if (ERRCLASS & ERRCLS_DEBUG)
- if(idx >= ueUl->hqEnt.numHqPrcs)
- {
- return (NULLP);
- }
-#endif
- return (&(ueUl->hqEnt.hqProcCb[idx]));
-} /* rgSCHUhmGetUlHqProc */
-
-/**
- * @brief Handler for HARQ processing on recieving new trasmission indication
- * from USM.
- *
- * @details
- *
- * Function: rgSCHUhmNewTx
- *
- * Invoked by: USM
- *
- * Processing Steps:
- * - Update harq info with values indicating new HARQ transmission.
- *
- * @param[in,out] *hqProc
- * @param[in] *alloc
- * @return Void
- **/
-Void rgSCHUhmNewTx(RgSchUlHqProcCb *hqProc,uint8_t maxHqRetx,RgSchUlAlloc *alloc)
-{
-
- hqProc->ndi ^= 1;
- hqProc->alloc = alloc;
- hqProc->remTx = maxHqRetx;
- hqProc->rcvdCrcInd = FALSE;
- hqProc->rvIdx = 0;
- hqProc->rvIdxPhy.pres = FALSE;
-#ifdef LTE_L2_MEAS
- if (hqProc->alloc->ue)
- {
- ((RgUeUlHqCb*)hqProc->hqEnt)->numBusyHqProcs++;
- }
-#endif
- return;
-} /* rgSCHUhmNewTx */
-
-/**
- * @brief Free an uplink HARQ process.
- *
- * @details
- *
- * Function: rgSCHUhmFreeProc
- *
- * Invoked by: USM
- *
- * Processing Steps:
- * - Set alloc pointer to NULLP
- *
- * @param[in] RgSchUlHqProcCb *hqProc
- * @param[in] RgSchCellCb *cell
- * @return Void
- **/
-Void rgSCHUhmFreeProc(RgSchUlHqProcCb *hqProc,RgSchCellCb *cell)
-{
-#ifdef LTE_L2_MEAS
- RgSchUeCb *ueCb;
- uint8_t qci = 1;
-#endif
-
-#ifdef LTE_L2_MEAS
- if (hqProc->alloc && hqProc->alloc->ue)
- {
- ueCb = hqProc->alloc->ue;
- if (ueCb && cell)
- {
- uint32_t nonLcg0ReportedBs = ((RgSchCmnLcg *)(ueCb->ul.lcgArr[1].sch))->reportedBs + \
- ((RgSchCmnLcg *)(ueCb->ul.lcgArr[2].sch))->reportedBs + \
- ((RgSchCmnLcg *)(ueCb->ul.lcgArr[3].sch))->reportedBs;
- ((RgUeUlHqCb*)hqProc->hqEnt)->numBusyHqProcs--;
- if (! ((RgUeUlHqCb*)hqProc->hqEnt)->numBusyHqProcs && !(nonLcg0ReportedBs))
- {
- while (ueCb->ulActiveLCs)
- {
- if (ueCb->ulActiveLCs & 0x1)
- {
- cell->qciArray[qci].ulUeCount--;
- }
- qci++;
- ueCb->ulActiveLCs >>= 1;
- }
- }
- }
- }
-#endif
-
-
- if(hqProc && (RgUeUlHqCb*)hqProc->hqEnt)
- {
-
-#ifdef UL_ADPT_DBG
- DU_LOG("\nDEBUG --> SCH : ########HARQ FREED HARQPROC ID (%d )after rgSCHUhmFreeProc inuse %ld free %ld \n",hqProc->alloc->grnt.hqProcId, (CmLListCp *)(&((RgUeUlHqCb*)hqProc->hqEnt)->inUse)->count,(CmLListCp *) (&((RgUeUlHqCb*)hqProc->hqEnt)->free)->count);
-#endif
- hqProc->alloc = NULLP;
- hqProc->ulSfIdx = RGSCH_INVALID_INFO;
- /*ccpu00116293 - Correcting relation between UL slot and DL slot based on RG_UL_DELTA*/
- hqProc->isRetx = FALSE;
- hqProc->remTx = 0; /*Reseting the remTx value to 0*/
-#ifdef EMTC_ENABLE
- RG_SCH_EMTC_SET_ISDTX_TO_FALSE(hqProc);
-#endif
- cmLListDelFrm(&((RgUeUlHqCb*)hqProc->hqEnt)->inUse,&hqProc->lnk);
- cmLListAdd2Tail(&((RgUeUlHqCb*)hqProc->hqEnt)->free, &hqProc->lnk);
-
- /*
- DU_LOG("\nINFO --> SCH : after rgSCHUhmFreeProc inuse %ld free %ld \n",
- (CmLListCp *)(&((RgUeUlHqCb*)hqProc->hqEnt)->inUse)->count,
- (CmLListCp *) (&((RgUeUlHqCb*)hqProc->hqEnt)->free)->count);
- */
- }
- else
- {
- DU_LOG("\nERROR --> SCH : hqEnt is NULL\n");
- }
- return;
-} /* rgSCHUhmFreeProc */
-
-/**
- * @brief Handler for HARQ processing on recieving re-trasmission
- * indication from USM.
- *
- * @details
- *
- * Function: rgSCHUhmRetx
- *
- * Invoked by: USM
- *
- * Processing Steps:
- * - Update harq info with values corresponding to
- * re-transmission.
- *
- * @param[in,out] *hqProc
- * @return Void
- **/
-Void rgSCHUhmRetx(RgSchUlHqProcCb *hqProc,RgSchUlAlloc *alloc)
-{
-
- hqProc->alloc = alloc;
- --hqProc->remTx;
- hqProc->rvIdx = (hqProc->rvIdx + 1) % 4;
- hqProc->rvIdxPhy.pres = FALSE;
- return;
-} /* rgSCHUhmRetx */
-
-
-/**
- * @brief Handler for initializing the HARQ entity.
- *
- * @details
- *
- * Function: rgSCHUhmRgrUeCfg
- *
- * Invoked by: RGR
- *
- * Processing Steps:
- * - Initialize maxHqRetx
- *
- * @param[in] *cellCb
- * @param[in,out] *ueCb
- * @param[in] *ueCfg
- * @param[out] *err
- * @return Void
- **/
-Void rgSCHUhmRgrUeCfg(RgSchCellCb *cellCb,RgSchUeCb *ueCb,RgrUeCfg *ueCfg)
-{
- uint8_t i;
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ueCb, cellCb);
-
- ueUl->hqEnt.maxHqRetx = ((ueCfg->ueUlHqCfg.maxUlHqTx) - 1);
-#ifdef TFU_UPGRADE
- /* Storing the delta HARQ offset for HARQ + PUSCH */
- ueCb->ul.betaHqOffst = ueCfg->puschDedCfg.bACKIdx;
-#endif
- cmLListInit(&ueUl->hqEnt.free);
- cmLListInit(&ueUl->hqEnt.inUse);
- for(i=0; i < ueUl->hqEnt.numHqPrcs; i++)
- {
- ueUl->hqEnt.hqProcCb[i].hqEnt = (void*)(&ueUl->hqEnt);
- ueUl->hqEnt.hqProcCb[i].procId = i;
- ueUl->hqEnt.hqProcCb[i].remTx = 0;
- ueUl->hqEnt.hqProcCb[i].ulSfIdx = RGSCH_INVALID_INFO;
- ueUl->hqEnt.hqProcCb[i].alloc = NULLP;
-#ifdef LTEMAC_SPS
- /* ccpu00139513- Initializing SPS flags*/
- ueUl->hqEnt.hqProcCb[i].isSpsActvnHqP = FALSE;
- ueUl->hqEnt.hqProcCb[i].isSpsOccnHqP = FALSE;
-#endif
- cmLListAdd2Tail(&ueUl->hqEnt.free, &ueUl->hqEnt.hqProcCb[i].lnk);
- ueUl->hqEnt.hqProcCb[i].lnk.node = (PTR)&ueUl->hqEnt.hqProcCb[i];
- }
-
-#ifdef EMTC_ENABLE
- rgSCHEmtcInitUlUeHqEnt(cellCb, ueCfg, ueCb);
-#endif
- return;
-} /* rgSCHUhmRgrUeCfg */
-
-/**
- * @brief Handler for re-initializing the HARQ entity.
- *
- * @details
- *
- * Function: rgSCHUhmRgrUeRecfg
- *
- * Invoked by: RGR
- *
- * Processing Steps:
- * - Re-initialize maxHqRetx
- *
- * @param[in] *cellCb
- * @param[in,out] *ueCb
- * @param[in] *ueCfg
- * @param[out] *err
- * @return Void
- **/
-Void rgSCHUhmRgrUeRecfg(RgSchCellCb *cellCb,RgSchUeCb *ueCb,RgrUeRecfg *ueRecfg)
-{
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ueCb, cellCb);
-
- /* [ccpu00123958]-ADD- Check for HARQ Reconfig from the bit mask */
- if(RGR_UE_ULHARQ_RECFG & ueRecfg->ueRecfgTypes)
- {
- ueUl->hqEnt.maxHqRetx = (ueRecfg->ueUlHqRecfg.maxUlHqTx - 1);
- }
-
- return;
-} /* rgSCHUhmRgrUeRecfg */
-
-/**
- * @brief Handler for de-initializing the HARQ entity.
- *
- * @details
- *
- * Function: rgSCHUhmFreeUe
- *
- * Invoked by: RGR
- *
- * Processing Steps:
- * -
- *
- * @param[in,out] *ueCb
- * @return Void
- **/
-Void rgSCHUhmFreeUe(RgSchCellCb *cellCb,RgUeUlHqCb *hqEnt)
-{
-#ifdef LTE_TDD
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cellCb->instIdx,
- (Data **)(&(hqEnt->hqProcCb)),
- hqEnt->numHqPrcs * sizeof(RgSchUlHqProcCb));
-#endif
-
- return;
-} /* rgSCHUhmFreeUe */
-
-
-/**
-* @brief Handler for appending the PHICH information in to the dlSf.
-*
-* @details
-*
-* Function: rgSCHUhmAppendPhich
-*
-* Invoked by: TOM
-*
-* Processing Steps:
-* - Set PhichInfo in DlSf for each Hq
-*
-* @param[in] *RgSchCellCb
-* @param[in] CmLteTimingInfo
-* @param[in] idx
-* @return Void
-*/
-S16 rgSCHUhmAppendPhich(RgSchCellCb *cellCb,CmLteTimingInfo frm,uint8_t idx)
-{
- uint8_t nDmrs;
- uint8_t rbStart;
-#ifdef LTE_TDD
- uint8_t iPhich;
-#endif
- RgSchUlAlloc *ulAlloc;
-#ifdef LTEMAC_HDFDD
- Bool allwNack = TRUE;
-#endif /* LTEMAC_HDFDD */
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cellCb);
-
-#ifdef RG_5GTF
- return ROK;
-#endif
- if(cellUl->hqFdbkIdx[idx] != RGSCH_INVALID_INFO)
- {
- ulAlloc = rgSCHUtlFirstHqFdbkAlloc (cellCb, idx);
- while (ulAlloc)
- {
- /*ccpu00106104 MOD added check for ACKNACK rep*/
- /*added check for acknack so that adaptive retx considers ue
- inactivity due to ack nack repetition*/
- if((ulAlloc->ue != NULLP) && ((TRUE != ulAlloc->forMsg3) &&
- ((ulAlloc->ue->measGapCb.isMeasuring == TRUE) ||
- (ulAlloc->ue->ackNakRepCb.isAckNakRep == TRUE))))
- {
- /* Mark the UE for retransmission */
- /* If UE is measuring then we should not be sending PHICH unless msg3 */
- /*UE assumes ack, if nack then do adaptive re-transmission*/
- /*ulAlloc->hqProc->rcvdCrcInd = FALSE;--*/
- ulAlloc = rgSCHUtlNextHqFdbkAlloc (cellCb, ulAlloc, idx);
- continue;
- }
-#ifdef LTE_TDD
- if (rgSCHUtlGetPhichInfo (ulAlloc->hqProc, &rbStart, &nDmrs, &iPhich) != ROK)
-#else
- if (rgSCHUtlGetPhichInfo (ulAlloc->hqProc, &rbStart, &nDmrs) != ROK)
-#endif
- {
- return (RFAILED);
- }
- if(nDmrs != RGSCH_INVALID_NDMRS)
- {
- if(cellCb->dynCfiCb.switchOvrInProgress)
- {
- ulAlloc->hqProc->rcvdCrcInd = TRUE;
- }
-
- if(ulAlloc->hqProc->rcvdCrcInd)
- {
-#ifdef LTE_TDD
- rgSCHUtlAddPhich (cellCb, frm, TRUE, nDmrs, rbStart, iPhich);
-#else
- rgSCHUtlAddPhich (cellCb, frm, TRUE, nDmrs, rbStart, ulAlloc->forMsg3);
-#endif
- }
- /* Sending NACK in PHICH for failed UL TX */
- else
- {
-#ifdef LTE_TDD
- rgSCHUtlAddPhich (cellCb, frm, FALSE, nDmrs, rbStart, iPhich);
-#else
-#ifdef LTEMAC_HDFDD
- if (ulAlloc->ue != NULLP && ulAlloc->ue->hdFddEnbld)
- {
- rgSCHCmnHdFddChkNackAllow( cellCb, ulAlloc->ue, frm, &allwNack);
- /* Present implementaion of non-HDFDD does not send phich req
- incase of NACK. So commented this part to maintain same right
- now.*/
-
- if (allwNack)
- {
- rgSCHUtlAddPhich (cellCb, frm, FALSE, nDmrs, rbStart, ulAlloc->forMsg3);
- }
- else
- {
- rgSCHUtlAddPhich (cellCb, frm, TRUE, nDmrs, rbStart, ulAlloc->forMsg3);
- }
- }
- else
- {
- rgSCHUtlAddPhich (cellCb, frm, FALSE, nDmrs, rbStart, ulAlloc->forMsg3);
- }
-#else
- rgSCHUtlAddPhich (cellCb, frm, FALSE, nDmrs, rbStart, ulAlloc->forMsg3);
-#endif/* LTEMAC_HDFDD */
-#endif
- }
- }
- ulAlloc = rgSCHUtlNextHqFdbkAlloc (cellCb, ulAlloc, idx);
- }
- }
- return ROK;
-} /* rgSCHUhmAppendPhich */
-
-/**
- * @brief This function initializes the DL HARQ Entity of UE.
- *
- * @details
- *
- * Function: rgSCHUhmHqEntInit
- * Purpose: This function initializes the UL HARQ Processes of
- * UE control block. This is performed at the time
- * of creating UE control block.
- *
- * Invoked by: configuration module
- *
- * @param[in] RgSchUeCb* ueCb
- * @return S16
- * -# ROK
- * -# RFAILED
- *
- **/
-S16 rgSCHUhmHqEntInit(RgSchCellCb *cellCb,RgSchUeCb *ueCb)
-{
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ueCb, cellCb);
-#ifdef LTE_TDD
- Inst inst = ueCb->cell->instIdx;
-#endif
-
-#ifndef LTE_TDD
- /* Init the HARQ processes */
- ueUl->hqEnt.numHqPrcs = RGSCH_NUM_UL_HQ_PROC;
-#else
- /* Init the HARQ processes */
- ueUl->hqEnt.numHqPrcs =
- rgSchTddUlNumHarqProcTbl[ueCb->cell->ulDlCfgIdx];
- if (rgSCHUtlAllocSBuf(inst, (Data **)&ueUl->hqEnt.hqProcCb,
- ueUl->hqEnt.numHqPrcs * \
- sizeof(RgSchUlHqProcCb)) != ROK)
- {
- return RFAILED;
- }
-#endif
-
- return ROK;
-} /* rgSCHUhmHqEntInit */
-
-#ifdef RG_5GTF
-/**
- * @brief This function gets an available HARQ process.
- *
- * @details
- *
- * Function: rgSCHUhmGetAvlHqProc
- * Purpose: This function returns an available HARQ process in
- * the UL direction. All HARQ processes are maintained
- * in queues of free and inuse.
- *
- * 1. Check if the free queue is empty. If yes, return
- * RFAILED
- * 2. If not empty, update the proc variable with the
- * first process in the queue. Return ROK.
- *
- * Invoked by: scheduler
- *
- * @param[in] RgSchUeCb *ue
- * @param[in] CmLteTimingInfo timingInfo
- * @param[out] RgSchDlHqProc **hqP
- * @return S16
- * -#ROK if successful
- * -#RFAILED otherwise
- *
- **/
-S16 rgSCHUhmGetAvlHqProc(RgSchCellCb *cell,RgSchUeCb *ue,RgSchUlHqProcCb **hqP)
-{
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell);
- RgSchUlHqProcCb *tmpHqProc;
- CmLList *tmp;
- RgUeUlHqCb *hqE;
-
- hqE = &ueUl->hqEnt;
-
- CM_LLIST_FIRST_NODE(&(hqE->free), tmp);
-
- if (NULLP == tmp)
- {
- //DU_LOG("rgSCHUhmGetAvlHqProc free %ld inUse %ld ue %d"
- // , hqE->free.count, hqE->inUse.count, ue->ueId);
- //DU_LOG("5GTF_ERROR rgSCHUhmGetAvlHqProc cellId %d %ld inUse %ld ue %d"
- //, cell->cellId, hqE->free.count, hqE->inUse.count, ue->ueId);
- /* No Harq Process available in the free queue. */
- return RFAILED;
- }
-
- tmpHqProc = (RgSchUlHqProcCb *)(tmp->node);
-
- /* Remove the element from the free Queue */
- cmLListDelFrm(&hqE->free, tmp);
-
- /* Add the element into the inUse Queue as well */
- cmLListAdd2Tail(&hqE->inUse, &tmpHqProc->lnk);
-
-#ifdef UL_ADPT_DBG
- DU_LOG("\nDEBUG --> SCH : rgSCHUhmGetAvlHqProc cellId %d free %ld inUse %ld UE %d time (%d %d)\n",cell->cellId, hqE->free.count, hqE->inUse.count, ue->ueId,cellUl->schdTime.sfn,cellUl->schdTime.slot);
-#endif
- tmpHqProc->schdTime = cellUl->schdTime;
-
- *hqP = tmpHqProc;
-
- return ROK;
-} /* rgSCHUhmGetAvlHqProc */
-
-/**
- * @brief Handler for identifying the HARQ process cb associated with the
- * TX Time.
- *
- * @details
- *
- * Function: rgSCHUhmGetUlProcByTime
- *
- * Processing Steps:
- * - Return pointer to uplink harq process corresponding to the timing
- * information passed.
- *
- * @param[in] *ue
- * @param[in] idx
- * @return RgSchUlHqProcCb*
- * -# Pointer to harq process corresponding to index
- * -# NULL
- **/
-RgSchUlHqProcCb* rgSCHUhmGetUlProcByTime(RgSchCellCb *cell,RgSchUeCb *ue, CmLteTimingInfo frm)
-{
- RgSchCmnUlUe *ueUl = RG_SCH_CMN_GET_UL_UE(ue, cell);
- CmLListCp *lst = &ueUl->hqEnt.inUse;
- CmLList *lnk = lst->first;
- RgSchUlHqProcCb *proc;
-
- while (lnk)
- {
- proc = (RgSchUlHqProcCb *)(lnk->node);
- lnk = lnk->next;
- // DU_LOG("\nINFO --> SCH : compare rgSCHUhmGetUlProcByTime time (%d %d) CRC time (%d %d) proc->procId %d
- // \n",\proc->schdTime.sfn,proc->schdTime.slot,frm.sfn,frm.slot ,proc->procId);
- if (RGSCH_TIMEINFO_SAME(proc->schdTime, frm))
- {
- // DU_LOG("\nINFO --> SCH : Harq timing Matched rgSCHUhmGetUlProcByTime time (%d %d) proc->procId %d \n",\
- proc->schdTime.sfn,proc->schdTime.slot, proc->procId);
- return (proc);
- }
- }
-
- return (NULLP);
-} /* rgSCHUhmGetUlProcByTime */
-#endif
-
-
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/************************************************************************
-
- Name: LTE-MAC layer
-
- Type: C source file
-
- Desc: C source code for Entry point fucntions
-
- File: rg_sch_utl.c
-
-**********************************************************************/
-
-/** @file rg_sch_utl.c
-@brief This file implements the schedulers main access to MAC layer code.
-*/
-
-
-/* header include files -- defines (.h) */
-#include "common_def.h"
-#include "lrg.h"
-#include "rgr.h"
-#include "tfu.h"
-#include "sch_utils.h"
-#include "rg_env.h"
-#include "rg_sch_err.h"
-#include "rg_sch_inf.h"
-#include "rg_sch.h"
-#include "rg_sch_cmn.h"
-#include "rgm.h"
-
-/* header/extern include files (.x) */
-#include "tfu.x" /* TFU types */
-#include "lrg.x" /* layer management typedefs for MAC */
-#include "rgr.x" /* layer management typedefs for MAC */
-#include "rgm.x"
-#include "rg_sch_inf.x" /* typedefs for Scheduler */
-#include "rg_sch.x" /* typedefs for Scheduler */
-#include "rg_sch_cmn.x" /* typedefs for Scheduler */
-#ifdef EMTC_ENABLE
-#include "rg_sch_emtc_ext.x"
-#endif
-
-
-/* SR_RACH_STATS */
-uint32_t rgNumPrachRecvd =0; /* Num of Rach Req received including dedicated preambles */
-uint32_t rgNumRarSched =0; /* Num of RARs sent */
-uint32_t rgNumBI =0; /* Num of BackOff Ind sent */
-uint32_t rgNumMsg3CrcPassed =0; /* Num of CRC success for Msg3 */
-uint32_t rgNumMsg3CrcFailed =0; /* Num of CRC fail for Msg 3 */
-uint32_t rgNumMsg3FailMaxRetx =0; /* Num of Msg3 fail after Max Retx attempts */
-uint32_t rgNumMsg4Ack =0; /* Num of Acks for Msg4 Tx */
-uint32_t rgNumMsg4Nack =0;
- /* Num of Nacks for Msg4 Tx */
-uint32_t rgNumMsg4FailMaxRetx =0; /* Num of Msg4 Tx failed after Max Retx attempts */
-uint32_t rgNumSrRecvd =0; /* Num of Sched Req received */
-uint32_t rgNumSrGrant =0; /* Num of Sched Req Grants sent */
-uint32_t rgNumMsg3CrntiCE =0; /* Num of Msg 3 CRNTI CE received */
-uint32_t rgNumDedPream =0; /* Num of Dedicated Preambles recvd */
-uint32_t rgNumMsg3CCCHSdu =0; /* Num of Msg 3 CCCH Sdus recvd */
-uint32_t rgNumCCCHSduCrntiNotFound =0; /*UE Ctx not found for CCCH SDU Msg 3 */
-uint32_t rgNumCrntiCeCrntiNotFound =0; /*UE Ctx not found for CRNTI CE Msg 3 */
-uint32_t rgNumMsg4WithCCCHSdu =0; /* Num of Msg4 with CCCH Sdu */
-uint32_t rgNumMsg4WoCCCHSdu =0; /* Num of Msg4 without CCCH Sdu */
-uint32_t rgNumMsg4Dtx =0; /* Num of DTX received for Msg 4 */
-uint32_t rgNumMsg3AckSent =0; /* Num of PHICH Ack sent for Msg 3 */
-uint32_t rgNumMsg3NackSent =0; /* Num of PHICH Nack sent for Msg 3 */
-uint32_t rgNumMsg4PdcchWithCrnti =0; /* Num of PDCCH for CRNTI based contention resolution */
-uint32_t rgNumRarFailDuetoRntiExhaustion =0; /* Num of RACH Failures due to RNTI pool exhaution */
-uint32_t rgNumTAModified =0; /* Num of times TA received is different from prev value */
-uint32_t rgNumTASent =0; /* Num of TA Command sent */
-uint32_t rgNumMsg4ToBeTx =0; /* Num of times MSG4 that should be sent */
-uint32_t rgNumMsg4Txed =0; /* Num of MSG4 actually sent *//* ysNumMsg4ToBeTx -ysNumMsg4Txed == Failed MSG4 TX */
-uint32_t rgNumMsg3DtxRcvd =0; /* CRC Fail with SINR < 0 */
-
-uint32_t rgNumDedPreamUECtxtFound =0; /* Num of Dedicated Preambles recvd */
-
-static uint8_t rgSchDciAmbigSizeTbl[61] = {0,0,0,0,0,0,0,0,0,0,0,
- 0,1,0,1,0,1,0,0,0,1,
- 0,0,0,1,0,1,0,0,0,0,
- 0,1,0,0,0,0,0,0,0,1,
- 0,0,0,1,0,0,0,0,0,0,
- 0,0,0,0,0,1,0,0,0,0};
-
-/* local defines */
-
-uint32_t rgSchCmnBetaCqiOffstTbl[16];
-uint32_t rgSchCmnBetaRiOffstTbl[16];
-RgSchdApis rgSchCmnApis;
-S16 RgUiRgmSendPrbRprtInd ARGS((
-Pst* pst,
-SuId suId,
-RgmPrbRprtInd *prbRprtInd
-));
-
-S16 RgUiRgmSendTmModeChangeInd ARGS((
-Pst* pst,
-SuId suId,
-RgmTransModeInd *txModeChngInd
-));
-#ifdef EMTC_ENABLE
-S16 rgSCHEmtcUtlGetSfAlloc ARGS((
-RgSchCellCb *cell
-));
-S16 rgSCHEmtcUtlPutSfAlloc ARGS((
-RgSchCellCb *cell
-));
-Void rgSCHEmtcUtlUpdUeDciSize ARGS((
-RgSchCellCb *cell,
-RgSchUeCb *ueCb
-));
-Void rgSCHEmtcGetDciFrmt61ASize ARGS((
-RgSchCellCb *cell
-));
-Void rgSCHEmtcGetDciFrmt60ASize ARGS((
-RgSchCellCb *cell
-));
-S16 rgSCHEmtcUtlFillPdschDciInfo ARGS((
-TfuPdschDciInfo *pdsch,
-TfuDciInfo *pdcchDci
-));
-Void rgSCHEmtcUtlRlsRnti ARGS((
-RgSchCellCb *cell,
-RgSchRntiLnk *rntiLnk,
-uint8_t *isLegacy
-));
-S16 rgSCHEmtcPdcchAlloc ARGS((
-RgSchCellCb *cell,
-RgSchPdcch *pdcch
-));
-Void rgSCHEmtcPdcchFree ARGS((
-RgSchCellCb *cell,
-RgSchPdcch *pdcch
-));
-#endif
-/* Functions specific to TM1/TM2/TM6/TM7 for PRB calculation*/
-Void rgSchUtlDlCalc1CwPrb ARGS(( RgSchCellCb *cell,
- RgSchUeCb *ue,
- uint32_t bo,
- uint32_t *prbReqrd));
-
-/* Functions specific to TM3/TM4 for PRB calculation*/
-Void rgSchUtlDlCalc2CwPrb ARGS(( RgSchCellCb *cell,
- RgSchUeCb *ue,
- uint32_t bo,
- uint32_t *prbReqrd));
-
-#ifdef LTE_ADV
-RgSchCellCb* rgSchUtlGetCellCb ARGS(( Inst inst,
- uint16_t cellId
-));
-#endif
-
-typedef Void (*RgSchUtlDlCalcPrbFunc) ARGS((RgSchCellCb *cell, RgSchUeCb *ue,
- uint32_t bo, uint32_t *prbRequrd));
-#ifndef LTE_ADV
-/* Functions specific to each transmission mode for PRB calculation*/
-RgSchUtlDlCalcPrbFunc dlCalcPrbFunc[7] = {rgSchUtlDlCalc1CwPrb,
-rgSchUtlDlCalc1CwPrb, rgSchUtlDlCalc2CwPrb, rgSchUtlDlCalc2CwPrb,
-NULLP, rgSchUtlDlCalc1CwPrb, rgSchUtlDlCalc1CwPrb};
-
-#else
-/* Functions specific to each transmission mode for PRB calculation*/
-RgSchUtlDlCalcPrbFunc dlCalcPrbFunc[9] = {rgSchUtlDlCalc1CwPrb,
-rgSchUtlDlCalc1CwPrb, rgSchUtlDlCalc2CwPrb, rgSchUtlDlCalc2CwPrb,
-NULLP, rgSchUtlDlCalc1CwPrb, rgSchUtlDlCalc1CwPrb, NULLP, NULLP};
-
-#endif
-
-#ifdef LTE_TDD
-/* The below table will be used to map the UL SF number in a TDD Cfg 0
- frame to the ul Sf array maintained in cellCb */
-static uint8_t rgSchTddCfg0UlSfTbl[] = {2, 3, 4, 7, 8, 9};
-#endif
-
-static S16 rgSCHUtlUlAllocDbInit ARGS((
- RgSchCellCb *cell,
- RgSchUlAllocDb *db,
- uint8_t maxAllocs
- ));
-static Void rgSCHUtlUlAllocDbDeinit ARGS((
- RgSchCellCb *cell,
- RgSchUlAllocDb *db
- ));
-static S16 rgSCHUtlUlHoleDbInit ARGS((
- RgSchCellCb *cell,
- RgSchUlHoleDb *db,
- uint8_t maxHoles,
- uint8_t start,
- uint8_t num
- ));
-static Void rgSCHUtlUlHoleDbDeinit ARGS((
- RgSchCellCb *cell,
- RgSchUlHoleDb *db
- ));
-
-static S16 rgSCHChkBoUpdate ARGS((
- RgSchCellCb *cell,
- RgInfCmnBoRpt *boUpdt
- ));
-#ifdef UNUSE_FUN
-#ifdef TFU_UPGRADE
-static uint8_t rgSCHUtlFetchPcqiBitSz ARGS((
- RgSchCellCb *cell,
- RgSchUeCb *ueCb,
- uint8_t numTxAnt
- ));
-#endif
-#endif
-/* sorted in ascending order of tbSz */
-const struct rgSchUtlBcchPcchTbSz
-{
- uint8_t rbIndex; /* RB index {2,3} */
- uint16_t tbSz; /* one of the Transport block size in bits of
- * rbIndex 2 or 3 */
- /* Corrected allocation for common channels */
- uint8_t mcs; /* imcs */
-} rgSchUtlBcchPcchTbSzTbl[44] = {
- { 2, 32, 0 }, { 2, 56, 1 }, { 2, 72, 2 }, { 3, 88, 1 },
- { 2, 104, 3 }, { 2, 120, 4 }, { 2, 144, 5 }, { 2, 176, 6 },
- { 3, 208, 4 }, { 2, 224, 7 }, { 2, 256, 8 }, { 2, 296, 9 },
- { 2, 328, 10 }, { 2, 376, 11 }, { 3, 392, 8 }, { 2, 440, 12 },
- { 3, 456, 9 }, { 2, 488, 13 }, { 3, 504, 10 }, { 2, 552, 14 },
- { 3, 584, 11 }, { 2, 600, 15 }, { 2, 632, 16 }, { 3, 680, 12 },
- { 2, 696, 17 }, { 3, 744, 13 }, { 2, 776, 18 }, { 2, 840, 19 },
- { 2, 904, 20 }, { 3, 968, 16 }, { 2, 1000, 21 }, { 2, 1064, 22 },
- { 2, 1128, 23 }, { 3, 1160, 18 }, { 2, 1192, 24 }, { 2, 1256, 25 },
- { 3, 1288, 19 }, { 3, 1384, 20 }, { 2, 1480, 26 }, { 3, 1608, 22 },
- { 3, 1736, 23 }, { 3, 1800, 24 }, { 3, 1864, 25 }, { 3, 2216, 26 }
-};
-
-/* local typedefs */
-
-/* local externs */
-
-/* forward references */
-#ifdef LTE_TDD
-static Void rgSCHUtlUpdPrachOcc ARGS((
-RgSchCellCb *cell,
-RgrTddPrachInfo *cellCfg));
-#endif
-
-#define RGSCH_NUM_PCFICH_REG 4
-#define RGSCH_NUM_REG_PER_CCE 9
-#define RGSCH_NUM_REG_PER_PHICH_GRP 3
-
-#ifdef LTE_TDD
-#define RGSCH_INITPHICH(_phich, _hqFeedBack, _nDmrs, _rbStart, _iPhich) {\
- (_phich)->hqFeedBack = _hqFeedBack; \
- (_phich)->rbStart = _rbStart; \
- (_phich)->nDmrs = _nDmrs; \
- (_phich)->iPhich = _iPhich; \
- (_phich)->lnk.next = NULLP; \
- (_phich)->lnk.prev = NULLP; \
- (_phich)->lnk.node = (PTR)(_phich); \
-}
-#else
-#define RGSCH_INITPHICH(_phich, _hqFeedBack, _nDmrs, _rbStart, _isForMsg3) {\
- (_phich)->hqFeedBack = _hqFeedBack; \
- (_phich)->rbStart = _rbStart; \
- (_phich)->nDmrs = _nDmrs; \
- (_phich)->isForMsg3 = _isForMsg3; \
- (_phich)->lnk.next = NULLP; \
- (_phich)->lnk.prev = NULLP; \
- (_phich)->lnk.node = (PTR)(_phich); \
-}
-#endif
-
-#define RGSCH_PHICH_ALLOC(_inst,_dataPtr, _size, _ret) {\
- _ret = rgSCHUtlAllocSBuf(_inst, (Data **)&_dataPtr, _size); \
-}
-
-/* ccpu00117052 - MOD - Passing double pointer
-for proper NULLP assignment*/
-#define RGSCH_PHICH_FREE(_inst, _dataPtr, _size) {\
- rgSCHUtlFreeSBuf(_inst, (Data **)(&(_dataPtr)), _size); \
-}
-
-#ifdef TFU_UPGRADE
-#define RGSCH_GETBIT(a, b) ((((uint8_t*)a)[(b)>>3] >> ((7-((b)&7)))) & 1)
-
-/*
-*
-* Fun: rgSCHUtlPower
-*
-* Desc: This function finds of the Power of x raised to n
-*
-* Ret: value of x raised to n
-*
-* Notes: None
-*
-* File: rg_sch_utl.c
-*
-*/
-F64 rgSCHUtlPower(F64 x,F64 n)
-{
- if( n==0 )
- {
- return ( 1 );
- }
- else if ( n>0 )
- {
- return ( x * rgSCHUtlPower( x, n-1 ) );
- }
- else
- {
- return ( (1/x) * rgSCHUtlPower( x, n+1 ) );
- }
-} /* end of rgSCHUtlPower*/
-
-/*
-*
-* Fun: rgSCHUtlParse
-*
-* Desc: This function parses bits x to y of an array and
-* returns the integer value out of it.
-*
-* Ret: integer value of z bits
-*
-* Notes: None
-*
-* File: rg_sch_utl.c
-*
-*/
-uint32_t rgSCHUtlParse(uint8_t *buff,uint8_t startPos,uint8_t endPos,uint8_t buffSize)
-{
- uint8_t pointToChar,pointToEnd, loop;
- uint8_t size = endPos - startPos;
- F64 result = 0;
- pointToEnd = (startPos)%8;
- for ( loop=0; loop<size; loop++)
- {
- pointToChar = (((startPos)+loop)/8);
- if (RGSCH_GETBIT(buff+pointToChar,pointToEnd%8)==1)
- {
- result=result+(rgSCHUtlPower(2,(size-loop-1)));
- }
- pointToEnd++;
- }
- return ((uint32_t)result);
-} /* end of rgSCHUtlParse*/
-
-/*
-*
-* Fun: rgSCHUtlFindDist
-*
-* Desc: This function calculates the iterations need to cover
-* before the valid Index can be used for next possible Reception
-*
-* Ret: integer value of z bits
-*
-* Notes: None
-*
-* File: rg_sch_utl.c
-*
-*/
-uint8_t rgSCHUtlFindDist(uint16_t crntTime,uint16_t tempIdx)
-{
- uint8_t dist =0;
- /* ccpu00137113- Distance is not estimated properly if the periodicity is
- * equal to RG_SCH_PCQI_SRS_SR_TRINS_SIZE.
- */
- while(crntTime<=tempIdx)
- {
- crntTime += RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
- dist+=1;
- }
- return (dist-1);
-} /* end of rgSCHUtlFindDist*/
-#endif
-
-\f
-/**
- * @brief This function checks availability of a PDCCH
- *
- * @details
- *
- * Function: rgSCHUtlPdcchAvail
- * Purpose: This function checks if a particular PDCCH is in use.
- * map field of PDCCH is used to track the CCEs arleady
- * allocated. Each bit of map represents one CCE and the
- * LSBit of first byte represents CCE 0.
- * steps:
- * 1. Locate the set of bits that represent the PDCCH for
- * the provided location.
- * 2. If the value of the bits is non-zero one or many CCEs
- * for the PDCCH are in use and hence the PDCCH is not available.
- * 3. If pdcch is available, assign it to [out]pdcch.
- * 4. Set all of the bits to one. There is no check performed
- * to see if the PDCCH is available.
- *
- * Invoked by: scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchPdcchInfo* pdcchInfo
- * @param[in] uint8_t loc
- * @param[in] uint8_t aggrLvl
- * @param[out] RgSchPdcch** pdcch
- * @return Boolean
- * -# TRUE if available
- * -# FALSE otherwise
- *
- **/
-Bool rgSCHUtlPdcchAvail
-(
-RgSchCellCb *cell,
-RgSchPdcchInfo *pdcchInfo,
-CmLteAggrLvl aggrLvl,
-RgSchPdcch **pdcch
-)
-{
- uint8_t *byte;
- uint16_t offset;
- uint16_t initMask;
- uint16_t currMask;
- Inst inst = cell->instIdx;
- S16 ret;
- uint16_t offsetStepMask;
-
- /* V5G_213 : 10.1 */
- offset = 0;
- byte = &pdcchInfo->map[0];
- initMask = (0xffff >> (16 - aggrLvl));
- currMask = initMask;
- /* if N(symbol, xPDCCH) =2, then xPDCCH will be candidates in
- * search space of index {0,1,2,3} and {8,9,..14}
- */
- if ((cell->cell5gtfCb.cfi == 2) && (aggrLvl == CM_LTE_AGGR_LVL2))
- {
- offsetStepMask = 0xc;
- }
- else
- {
- offsetStepMask = 0xc0;
- }
-
- /* Loop till the number of bytes available in the CCE map */
- while (offset < ((pdcchInfo->nCce+ 7) >> 3))
- {
- byte = &pdcchInfo->map[offset];
- /* Checking for available CCE */
- if ((*byte & currMask) == 0)
- {
- break;
- }
- /* if the number of CCEs required are not available, move to next offset */
- if (currMask & offsetStepMask)
- {
- offset++;
- currMask = initMask;
- }
- else
- {
- /* Move to the next available CCE index in the current byte(cce map) */
- currMask = currMask << aggrLvl;
- }
- }
-
- if ((offset >= ((pdcchInfo->nCce + 7) >> 3)) ||
- ((aggrLvl == CM_LTE_AGGR_LVL16) && (offset > 0)))
- {
- return (FALSE);
- }
-
- byte = &pdcchInfo->map[offset];
-
- if (cell->pdcchLst.first != NULLP)
- {
- *pdcch = (RgSchPdcch *)(cell->pdcchLst.first->node);
- cmLListDelFrm(&cell->pdcchLst, cell->pdcchLst.first);
- }
- else
- {
- ret = rgSCHUtlAllocSBuf(inst, (Data **)pdcch, sizeof(RgSchPdcch));
- if(ROK != ret)
- {
- return (FALSE);
- }
- }
-
- if (*pdcch)
- {
- (*byte) |= currMask;
- /* ALL CCEs will be used in case of level 16 */
- if (aggrLvl == CM_LTE_AGGR_LVL16)
- {
- *(byte+1) |= currMask;
- }
- (*pdcch)->aggrLvl = aggrLvl;
- cmLListAdd2Tail(&pdcchInfo->pdcchs, &((*pdcch)->lnk));
- (*pdcch)->lnk.node = (PTR)*pdcch;
- (*pdcch)->nCce = aggrLvl;
- (*pdcch)->ue = NULLP;
- }
- return (TRUE);
-}
-
-
-\f
-/**
- * @brief This function releases a PDCCH
- *
- * @details
- *
- * Function: rgSCHUtlPdcchPut
- * Purpose: This function releases a PDCCH.
- * steps:
- * 1. Locate the set of bits that represent the PDCCH for
- * the provided location.
- * 2. Set all of the bits to zero.
- * 3. Release the memory of PDCCH to the cell free Q
- *
- * Invoked by: scheduler
- *
- * @param[in] RgSchPdcchInfo* pdcchInfo
- * @param[in] uint8_t loc
- * @param[in] uint8_t aggrLvl
- * @return Void
- *
- **/
-Void rgSCHUtlPdcchPut(RgSchCellCb *cell,RgSchPdcchInfo *pdcchInfo,RgSchPdcch *pdcch)
-{
- uint8_t *byte;
- uint8_t offset;
- uint16_t mask;
-
- switch(pdcch->aggrLvl)
- {
- case CM_LTE_AGGR_LVL2:
- offset = (pdcch->nCce >> 1) & 3;
- mask = 0x3 << (offset * 2); /*ccpu00128826 - Offset Correction */
- break;
- case CM_LTE_AGGR_LVL4:
- offset = (pdcch->nCce >> 2) & 1;
- mask = 0xf << (offset * 4);/*ccpu00128826 - Offset Correction */
- break;
- case CM_LTE_AGGR_LVL8:
- mask = 0xff;
- break;
- case CM_LTE_AGGR_LVL16:
- mask = 0xffff;
- break;
- default:
- return;
- }
- /* Placing common computation of byte from all the cases above here
- for optimization */
- byte = &pdcchInfo->map[pdcch->nCce >> 3];
-
- cmLListDelFrm(&pdcchInfo->pdcchs, &pdcch->lnk);
- cmLListAdd2Tail(&cell->pdcchLst, &pdcch->lnk);
- pdcch->lnk.node = (PTR)pdcch;
- pdcch->ue = NULLP;
- (*byte) &= ~mask;
-
- return;
-}
-
-\f
-/**
- * @brief This function initializes PDCCH information for frame
- *
- * @details
- *
- * Function: rgSCHUtlPdcchInit
- * Purpose: This function initializes PDCCH information for
- * a slot. It removes the list of PDCCHs allocated
- * in the prior use of this slot structure.
- *
- * Invoked by: rgSCHUtlSubFrmPut
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSubFrm* subFrm
- * @return Void
- *
- **/
-Void rgSCHUtlPdcchInit(RgSchCellCb *cell,RgSchDlSf *subFrm,uint16_t nCce)
-{
- RgSchPdcchInfo *pdcchInfo;
- RgSchPdcch *pdcch;
- Inst inst = cell->instIdx;
- uint8_t extraBits;
- uint32_t cceMapSz;
-
- pdcchInfo = &subFrm->pdcchInfo;
- while(pdcchInfo->pdcchs.first != NULLP)
- {
- pdcch = (RgSchPdcch *)pdcchInfo->pdcchs.first->node;
- cmLListDelFrm(&pdcchInfo->pdcchs, pdcchInfo->pdcchs.first);
- cmLListAdd2Tail(&cell->pdcchLst, &pdcch->lnk);
- pdcch->ue = NULLP;
- }
- cmLListInit(&pdcchInfo->pdcchs);
-
-#ifdef LTEMAC_SPS
- subFrm->relPdcch = NULLP;
-#endif
-
- cceMapSz = ((pdcchInfo->nCce + 7) >> 3);
-
- /* The bitMap array size is the number of ceiling(CCEs/8) */
- /* If nCce received is not the same as the one stored in
- * pdcchInfo, free the pdcchInfo map */
-
- if(pdcchInfo->nCce != nCce)
- {
- if(pdcchInfo->nCce)
- {
- rgSCHUtlFreeSBuf(inst, (Data **)(&(pdcchInfo->map)), cceMapSz);
- }
- pdcchInfo->nCce = nCce;
- cceMapSz = ((pdcchInfo->nCce + 7) >> 3);
- rgSCHUtlAllocSBuf(inst, (Data **)&pdcchInfo->map,
- cceMapSz);
- if (pdcchInfo->map == NULLP)
- {
- /* Generate log error here */
- return;
- }
- }
-
- memset(subFrm->pdcchInfo.map, 0, cceMapSz);
- /* If nCce is not exactly same as the bitMap size(no of bits allocated
- * to represent the Cce's, then mark the extra bits as unavailable
- extra bits = (((pdcchInfo->nCce + 7) >> 3)*8) - pdcchInfo->nCce
- The last byte of bit map = subFrm->pdcchInfo.map[((pdcchInfo->nCce + 7) >> 3) - 1]
- NOTE : extra bits are most significant of the last byte eg. */
- extraBits = (cceMapSz)*8 - pdcchInfo->nCce;
- subFrm->pdcchInfo.map[cceMapSz - 1] |=
- ((1 << extraBits) - 1) << (8 - extraBits);
- return;
-}
-
-/* LTE_ADV_FLAG_REMOVED_START */
-/**
- * @brief This function frees Pool
- * @details
- *
- * Function: rgSchSFRTotalPoolFree
- *
- * Invoked by: rgSchSFRTotalPoolInit
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSubFrm* subFrm
- * @return Void
- *
- **/
-Void rgSchSFRTotalPoolFree(RgSchSFRTotalPoolInfo *sfrTotalPoolInfo,RgSchCellCb *cell)
-{
- CmLListCp *l;
- CmLList *n;
-
- /*Deinitialise if these cc pools and ce pools are already existent*/
- l = &sfrTotalPoolInfo->ccPool;
- n = cmLListFirst(l);
- while (n != NULL)
- {
- /*REMOVING Cell Centred POOLS IF ANY*/
- n = cmLListDelFrm(l, n);
-
- /* Deallocate buffer */
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(n->node)), sizeof(RgSchSFRPoolInfo));
-
- /* Deallocate buffer */
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(n)), sizeof(CmLList));
- n = cmLListNext(l);
- }
-
- /*REMOVING Cell Edged POOLS IF ANY*/
- l = &sfrTotalPoolInfo->cePool;
- n = cmLListFirst(l);
- while (n != NULL)
- {
- n = cmLListDelFrm(l, n);
-
- /* Deallocate buffer */
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(n->node)), sizeof(RgSchSFRPoolInfo));
-
- /* Deallocate buffer */
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(n)), sizeof(CmLList));
- n = cmLListNext(l);
- }
-
-}
-
-/**
- * @brief This function resets temporary variables in Pool
- * @details
- *
- * Function: rgSchSFRResetPoolVariables
- *
- * Invoked by: rgSCHSFRUtlTotalPoolInit
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSubFrm* subFrm
- * @return Void
- *
- **/
-S16 rgSchSFRTotalPoolInit(RgSchCellCb *cell,RgSchDlSf *sf)
-{
- /* Initialise the variables */
- RgSchSFRPoolInfo *sfrCCPool;
- RgSchSFRPoolInfo *sfrCEPool;
- CmLListCp *l;
- CmLList *n;
- CmLList *temp = NULLP;
- S16 ret = 0;
-
- rgSchSFRTotalPoolFree(&sf->sfrTotalPoolInfo, cell);
- sf->sfrTotalPoolInfo.CCPool1BwAvlbl = 0;
- sf->sfrTotalPoolInfo.CCPool2BwAvlbl = 0;
- sf->sfrTotalPoolInfo.CEPoolBwAvlbl = 0;
- sf->sfrTotalPoolInfo.CC1 = FALSE;
- sf->sfrTotalPoolInfo.CC2 = FALSE;
- /*Initialise the CE Pools*/
- cmLListInit (&(sf->sfrTotalPoolInfo.cePool));
-
- ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&temp, sizeof(CmLList));
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : CE Pool memory allocation FAILED for cell");
- rgSchSFRTotalPoolFree(&sf->sfrTotalPoolInfo, cell);
- return RFAILED;
- }
-
- ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&temp->node, sizeof(RgSchSFRPoolInfo));
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : CE Pool memory allocation FAILED for cell ");
- rgSchSFRTotalPoolFree(&sf->sfrTotalPoolInfo,cell);
- return RFAILED;
- }
-
- l = &sf->sfrTotalPoolInfo.cePool;
- cmLListAdd2Tail(l, temp);
-
- /*Initialise Bandwidth and startRB and endRB for each pool*/
- n = cmLListFirst(l);
-
- /* Initialise the CE Pools */
- sfrCEPool = (RgSchSFRPoolInfo*)n->node;
-
- sfrCEPool->poolstartRB = cell->lteAdvCb.sfrCfg.cellEdgeRbRange.startRb;
- sfrCEPool->poolendRB = cell->lteAdvCb.sfrCfg.cellEdgeRbRange.endRb;
- sfrCEPool->bw = sfrCEPool->poolendRB - sfrCEPool->poolstartRB + 1;
- sf->sfrTotalPoolInfo.CEPoolBwAvlbl = sfrCEPool->bw;
-
- sfrCEPool->bwAlloced = 0;
- sfrCEPool->type2Start = sfrCEPool->poolstartRB;
- sfrCEPool->type2End = RGSCH_CEIL(sfrCEPool->poolstartRB, cell->rbgSize);
- sfrCEPool->type0End = ((sfrCEPool->poolendRB + 1) / cell->rbgSize) - 1;
- sfrCEPool->pwrHiCCRange.startRb = 0;
- sfrCEPool->pwrHiCCRange.endRb = 0;
-
- /*Initialise CC Pool*/
- cmLListInit (&(sf->sfrTotalPoolInfo.ccPool));
-
- /*Add memory and Update CCPool*/
- ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&temp, sizeof(CmLList));
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : CC Pool memory allocation FAILED for cell ");
- rgSchSFRTotalPoolFree(&sf->sfrTotalPoolInfo,cell);
- return RFAILED;
- }
-
- ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&temp->node, sizeof(RgSchSFRPoolInfo));
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : CC Pool memory allocation FAILED for cell ");
- rgSchSFRTotalPoolFree(&sf->sfrTotalPoolInfo,cell);
- return RFAILED;
- }
-
- l = &sf->sfrTotalPoolInfo.ccPool;
- cmLListAdd2Tail(l, temp);
-
- /*Initialise Bandwidth and startRB and endRB for each pool*/
- if(sfrCEPool->poolstartRB)
- {
- n = cmLListFirst(l);
- sfrCCPool = (RgSchSFRPoolInfo*)n->node;
-
- sfrCCPool->poolstartRB = 0;
- sfrCCPool->poolendRB = sfrCEPool->poolstartRB - 1;
- sfrCCPool->bw = sfrCCPool->poolendRB - sfrCCPool->poolstartRB + 1;
- sf->sfrTotalPoolInfo.CCPool1BwAvlbl = sfrCCPool->bw;
- sfrCCPool->bwAlloced = 0;
- sfrCCPool->type2Start = 0;
- sfrCCPool->type2End = 0;
- sfrCCPool->type0End = ((sfrCCPool->poolendRB + 1) / cell->rbgSize) - 1;
- sf->sfrTotalPoolInfo.CC1 = TRUE;
- sfrCCPool->pwrHiCCRange.startRb = 0;
- sfrCCPool->pwrHiCCRange.endRb = 0;
- }
- else
- {
- n = cmLListFirst(l);
- sfrCCPool = (RgSchSFRPoolInfo*)n->node;
-
- sfrCCPool->poolstartRB = sfrCEPool->poolendRB + 1;
- sfrCCPool->poolendRB = sf->bw - 1;
- sfrCCPool->bw = sfrCCPool->poolendRB - sfrCCPool->poolstartRB + 1;
- sf->sfrTotalPoolInfo.CCPool2BwAvlbl = sfrCCPool->bw;
- sfrCCPool->CCPool2Exists = TRUE;
- sfrCCPool->bwAlloced = 0;
- sfrCCPool->type2Start = sfrCCPool->poolstartRB;
- sfrCCPool->type2End = RGSCH_CEIL(sfrCCPool->poolstartRB, cell->rbgSize);
- sfrCCPool->type0End = ((sfrCCPool->poolendRB + 1) / cell->rbgSize) - 1;
- sf->sfrTotalPoolInfo.CC2 = TRUE;
- sfrCEPool->adjCCPool = sfrCCPool; /* SFR_FIX */
- sfrCCPool->pwrHiCCRange.startRb = 0;
- sfrCCPool->pwrHiCCRange.endRb = 0;
- }
-
- if((sfrCEPool->poolendRB != sf->bw - 1) && (!sfrCCPool->poolstartRB))
- {
- /*Add memory and Update CCPool*/
- ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&temp, sizeof(CmLList));
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : CC Pool memory allocation FAILED for cell ");
- rgSchSFRTotalPoolFree(&sf->sfrTotalPoolInfo,cell);
- return RFAILED;
- }
-
- ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&temp->node, sizeof(RgSchSFRPoolInfo));
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : CC Pool memory allocation FAILED for cell ");
- rgSchSFRTotalPoolFree(&sf->sfrTotalPoolInfo,cell);
- return RFAILED;
- }
-
- cmLListAdd2Tail(l, temp);
-
- n = cmLListCrnt(l);
- sfrCCPool = (RgSchSFRPoolInfo*)n->node;
-
- sfrCCPool->poolstartRB = sfrCEPool->poolendRB + 1;
- sfrCCPool->poolendRB = sf->bw - 1;
- sfrCCPool->bw = sfrCCPool->poolendRB - sfrCCPool->poolstartRB + 1;
- sf->sfrTotalPoolInfo.CCPool2BwAvlbl = sfrCCPool->bw;
- sfrCCPool->CCPool2Exists = TRUE;
- sfrCCPool->bwAlloced = 0;
- sfrCCPool->type2Start = sfrCCPool->poolstartRB;
- sfrCCPool->type2End = RGSCH_CEIL(sfrCCPool->poolstartRB, cell->rbgSize);
- sfrCCPool->type0End = ((sfrCCPool->poolendRB + 1) / cell->rbgSize) - 1;
- sf->sfrTotalPoolInfo.CC2 = TRUE;
- sfrCEPool->adjCCPool = sfrCCPool; /* SFR_FIX */
- sfrCCPool->pwrHiCCRange.startRb = 0;
- sfrCCPool->pwrHiCCRange.endRb = 0;
- }
-
- sf->sfrTotalPoolInfo.CCRetx = FALSE;
- sf->sfrTotalPoolInfo.CERetx = FALSE;
-
- sf->sfrTotalPoolInfo.ccBwFull = FALSE;
- sf->sfrTotalPoolInfo.ceBwFull = FALSE;
- sf->sfrTotalPoolInfo.isUeCellEdge = FALSE;
- return ROK;
-}
-/**
- * @brief This function resets temporary variables in RNTP Prepration
- * @details
- *
- * Function: rgSchDSFRRntpInfoInit
- *
- * Invoked by: rgSCHSFRUtlTotalPoolInit
- *
- * @param[in] TknStrOSXL* rntpPtr
- * @param[in] RgSubFrm* subFrm
- * @return S16
- *
- **/
-S16 rgSchDSFRRntpInfoInit(TknStrOSXL *rntpPtr,RgSchCellCb *cell,uint16_t bw)
-{
- Inst inst = cell->instIdx;
- uint16_t len;
-
- rntpPtr->pres = PRSNT_NODEF;
-
- len = (bw % 8 == 0) ? (bw/8) : (bw/8 + 1);
-
- rntpPtr->len = len;
-
- /* Allocate memory for "scheduled UE" Info */
- if((rgSCHUtlAllocSBuf(inst, (Data**)&(rntpPtr->val),
- (len * sizeof(uint8_t)))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED for RNTP Alloc");
- return RFAILED;
- }
-
- return ROK;
-}
-
-/**
- * @brief This function release RNTP pattern from slot and Cell
- * @details
- *
- * Function: rgSchDSFRRntpInfoFree
- *
- * Invoked by: rgSCHSFRUtlTotalPoolInit
- *
- * @param[in] TknStrOSXL* rntpPtr
- * @param[in] RgSubFrm* subFrm
- * @return S16
- *
- **/
-S16 rgSchDSFRRntpInfoFree(TknStrOSXL *rntpPtr,RgSchCellCb *cell,uint16_t bw)
-{
- Inst inst = cell->instIdx;
- uint16_t len;
-
- len = (bw % 8 == 0) ? (bw/8) : (bw/8 + 1);
-
- if(rntpPtr->pres == PRSNT_NODEF)
- {
- rgSCHUtlFreeSBuf(inst, (Data **)(&(rntpPtr->val)),(len * sizeof(uint8_t)));
- rntpPtr->pres = NOTPRSNT;
- rntpPtr->len = 0;
- }
-
- return ROK;
-}
-
-/**
- * @brief This function resets temporary variables in Pool
- * @details
- *
- * Function: rgSchSFRResetPoolVariables
- * Purpose: Initialise the dynamic variables in each pool.
- * Reset bwAlloced, bwAssigned, type2End, type0End, type2Start
- * Invoked by: rgSCHSFRUtlTotalPoolReset
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchSFRPoolInfo *pool
- * @return Void
- *
- **/
-static Void rgSchSFRResetPoolVariables(RgSchCellCb *cell,RgSchSFRPoolInfo *pool)
-{
-
- pool->bwAlloced = 0;
-
- /*type0end will be the last RBG in pool with all available RBs*/
- pool->type0End = (((pool->poolendRB + 1)/cell->rbgSize) - 1);
-
- /*type2end will be the first RBG in pool with all available RBs*/
- pool->type2End = RGSCH_CEIL(pool->poolstartRB, cell->rbgSize);
- pool->type2Start = pool->poolstartRB;
- pool->bw = pool->poolendRB - pool->poolstartRB + 1;
-
- return;
-}
-/**
- * @brief This function resets SFR Pool information for frame
- *
- * @details
- *
- * Function: rgSCHSFRUtlTotalPooReset
- * Purpose: Update the dynamic variables in each pool as they will be modified in each slot.
- * Dont modify the static variables like startRB, endRB, BW
- * Invoked by: rgSCHUtlSubFrmPut
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchDlSf* subFrm
- * @return Void
- *
- **/
-static Void rgSCHSFRUtlTotalPoolReset(RgSchCellCb *cell,RgSchDlSf *subFrm)
-{
- RgSchSFRTotalPoolInfo *totalPoolInfo = &subFrm->sfrTotalPoolInfo;
- CmLListCp *ccPool = &totalPoolInfo->ccPool;
- CmLListCp *cePool = &totalPoolInfo->cePool;
- CmLList *node = NULLP;
- RgSchSFRPoolInfo *tempPool = NULLP;
-
- totalPoolInfo->ccBwFull = FALSE;
- totalPoolInfo->ceBwFull = FALSE;
- totalPoolInfo->isUeCellEdge = FALSE;
- totalPoolInfo->CCPool1BwAvlbl = 0;
- totalPoolInfo->CCPool2BwAvlbl = 0;
- totalPoolInfo->CEPoolBwAvlbl = 0;
- totalPoolInfo->CCRetx = FALSE;
- totalPoolInfo->CERetx = FALSE;
-
- node = ccPool->first;
- while(node)
- {
- tempPool = (RgSchSFRPoolInfo *)(node->node);
- node = node->next;
- rgSchSFRResetPoolVariables(cell, tempPool);
- if(tempPool->poolstartRB == 0)
- totalPoolInfo->CCPool1BwAvlbl = tempPool->bw;
- else
- totalPoolInfo->CCPool2BwAvlbl = tempPool->bw;
- }
-
- node = cePool->first;
- while(node)
- {
- tempPool = (RgSchSFRPoolInfo *)(node->node);
- node = node->next;
- rgSchSFRResetPoolVariables(cell, tempPool);
- totalPoolInfo->CEPoolBwAvlbl = tempPool->bw;
- }
-
- return;
-}
-/* LTE_ADV_FLAG_REMOVED_END */
-/**
- * @brief This function appends PHICH information for frame
- *
- * @details
- *
- * Function: rgSCHUtlAddPhich
- * Purpose: This function appends PHICH information for
- * a slot.
- *
- * Invoked by: TOM
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSubFrm* subFrm
- * @param[in] uint8_t hqFeedBack
- * @param[in] uint8_t nDmrs
- * @param[in] uint8_t rbStart
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-#ifdef LTE_TDD
-S16 rgSCHUtlAddPhich
-(
-RgSchCellCb *cell,
-CmLteTimingInfo frm,
-uint8_t hqFeedBack,
-uint8_t nDmrs,
-uint8_t rbStart,
-uint8_t iPhich
-)
-#else
-S16 rgSCHUtlAddPhich
-(
-RgSchCellCb *cell,
-CmLteTimingInfo frm,
-uint8_t hqFeedBack,
-uint8_t nDmrs,
-uint8_t rbStart,
-Bool isForMsg3
-)
-#endif
-{
- S16 ret;
- RgSchPhich *phich;
- RgSchDlSf *dlSf;
- Inst inst = cell->instIdx;
-
- dlSf = rgSCHUtlSubFrmGet(cell, frm);
- RGSCH_PHICH_ALLOC(inst, phich,sizeof(RgSchPhich), ret);
-
- if(ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : rgSCHUtlAddPhich(): "
- "Allocation of RgSchPhich failed");
- return RFAILED;
- }
-#ifdef LTE_TDD
- RGSCH_INITPHICH(phich, hqFeedBack, nDmrs, rbStart, iPhich);
-#else
- RGSCH_INITPHICH(phich, hqFeedBack, nDmrs, rbStart, isForMsg3); /*SR_RACH_STATS */
-#endif
- cmLListAdd2Tail(&dlSf->phichInfo.phichs, &phich->lnk);
- return ROK;
-} /* rgSCHUtlAddPhich */
-
-/**
- * @brief This function resets PHICH information for frame
- *
- * @details
- *
- * Function: rgSCHUtlPhichReset
- * Purpose: This function initializes PHICH information for
- * a slot. It removes the list of PHICHs allocated
- * in the prior use of this slot structure.
- *
- * Invoked by: rgSCHUtlSubFrmPut
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSubFrm* subFrm
- * @return Void
- *
- **/
-static Void rgSCHUtlPhichReset(RgSchCellCb *cell,RgSchDlSf *subFrm)
-{
- RgSchPhichInfo *phichInfo;
- RgSchPhich *phich;
-
- UNUSED(cell);
-
- phichInfo = &subFrm->phichInfo;
- while(phichInfo->phichs.first != NULLP)
- {
- phich = (RgSchPhich *)phichInfo->phichs.first->node;
- cmLListDelFrm(&phichInfo->phichs, phichInfo->phichs.first);
- RGSCH_PHICH_FREE(cell->instIdx, phich, sizeof(RgSchPhich));
- }
- cmLListInit(&phichInfo->phichs);
- return;
-} /* rgSCHUtlPhichReset */
-
-\f
-/**
- * @brief This function returns slot data structure for a cell
- *
- * @details
- *
- * Function: rgSCHUtlSubFrmGet
- * Purpose: This function resets the slot data structure
- * when the slot is released
- *
- * Invoked by: scheduler
- *
- * @param[in] RgSubFrm subFrm
- * @return Void
- *
- **/
-RgSchDlSf* rgSCHUtlSubFrmGet(RgSchCellCb *cell,CmLteTimingInfo frm)
-{
- RgSchDlSf *sf;
- uint8_t dlIdx;
-
-#ifdef LTE_TDD
- dlIdx = rgSCHUtlGetDlSfIdx(cell, &frm);
- //RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, cell->subFrms, dlIdx);
- sf = cell->subFrms[dlIdx];
-#else
- /* Changing the idexing
- so that proper slot is selected */
- dlIdx = (((frm.sfn & 1) * RGSCH_NUM_SUB_FRAMES) + (frm.slot % RGSCH_NUM_SUB_FRAMES));
- RGSCH_ARRAY_BOUND_CHECK(cell->instIdx, cell->subFrms, dlIdx);
- sf = cell->subFrms[dlIdx];
-#endif
- /* CA dev Start */
- sf->dlIdx = dlIdx;
- /* CA dev End */
- return (sf);
-}
-
-\f
-/**
- * @brief This function returns slot data structure for a cell
- *
- * @details
- *
- * Function: rgSCHUtlSubFrmPut
- * Purpose: This function resets the slot data structure
- * when the slot is released
- *
- * Invoked by: scheduler
- *
- * @param[in] RgSubFrm subFrm
- * @return Void
- *
- **/
-Void rgSCHUtlSubFrmPut(RgSchCellCb *cell,RgSchDlSf *sf)
-{
- uint8_t i;
- uint8_t noRaRsps;
-
-#ifdef LTE_TDD
- /* Release all the held PDCCH information */
- rgSCHUtlPdcchInit(cell, sf, sf->nCce);
-#else
- /* Release all the held PDCCH information */
- rgSCHUtlPdcchInit(cell, sf, cell->nCce);
-#endif
- rgSCHUtlPhichReset(cell, sf);
-
- /* Reset the bw allocated. */
- sf->bwAssigned = 0;
-#ifdef LTEMAC_SPS
- /* Setting allocated bandwidth to SPS bandwidth for non-SPS RB allocator */
- sf->bwAlloced = ((cell->spsCellCfg.maxSpsDlBw +
- cell->rbgSize - 1)/cell->rbgSize) * cell->rbgSize;
- if (sf->bwAlloced > sf->bw)
- {
- sf->bwAlloced = sf->bw;
- }
- sf->spsAllocdBw = 0;
- sf->type2Start = sf->bwAlloced;
- memset( &sf->dlSfAllocInfo, 0, sizeof(RgSchDlSfAllocInfo));
-#else
- sf->bwAlloced = 0;
- /* Fix for ccpu00123918*/
- sf->type2Start = 0;
- /* LTE_ADV_FLAG_REMOVED_START */
- /* dsfr_pal_fixes ** 21-March-2013 ** SKS */
- if (cell->lteAdvCb.dsfrCfg.status == RGR_ENABLE)
- {
- memset(sf->rntpInfo.val, 0, sf->rntpInfo.len);
- }
- /* LTE_ADV_FLAG_REMOVED_END */
-#endif
- sf->txDone = FALSE;
- /*[ccpu00138609]-ADD-Reset the CCCH UE counter */
- sf->schdCcchUe = 0;
-
- /* Non DLFS scheduling using Type0 RA requires the following
- * parameter's tracking */
- /* Type 2 localized allocations start from 0th RBG and onwards */
- /* Type 0 allocations start from last RBG and backwards*/
-#ifndef LTEMAC_SPS
- sf->type2End = 0;
-#else
- sf->type2End = RGSCH_CEIL(sf->bwAlloced,cell->rbgSize);
-#endif
- sf->type0End = cell->noOfRbgs - 1;
- /* If last RBG is of incomplete size then special handling */
- (sf->bw % cell->rbgSize == 0)? (sf->lstRbgDfct = 0) :
- (sf->lstRbgDfct = cell->rbgSize - (sf->bw % cell->rbgSize));
- /* This resets the allocation for BCCH and PDCCH */
-#ifdef EMTC_ENABLE
- /* TODO we need to move this reset for emtc functions */
- if(!(cell->emtcEnable))
- {
- sf->bch.tb = NULLP;
- sf->bch.tbSize = 0;
- }
-#else
- sf->bch.tb = NULLP;
- sf->bch.tbSize = 0;
-#endif
- sf->bcch.pdcch = NULLP;
- sf->pcch.pdcch = NULLP;
-#ifdef LTE_TDD
- noRaRsps = RGSCH_MAX_TDD_RA_RSP_ALLOC;
-#else
- noRaRsps = RGSCH_MAX_RA_RSP_ALLOC;
-#endif
- for (i = 0; i < noRaRsps; i++)
- {
- sf->raRsp[i].pdcch = NULLP;
- cmLListInit(&(sf->raRsp[i].raRspLst));
- }
- /* LTE_ADV_FLAG_REMOVED_START */
- if (cell->lteAdvCb.sfrCfg.status == RGR_ENABLE)
- {
- rgSCHSFRUtlTotalPoolReset(cell, sf);
- }
- /* LTE_ADV_FLAG_REMOVED_END */
-#ifdef LTE_ADV
- cmLListInit(&sf->n1PucchResLst);
-#endif
-
- sf->cceCnt = 0;
- sf->isCceFailure = FALSE;
- sf->dlUlBothCmplt = 0;
- return;
-}
-
-\f
-/**
- * @brief This function computes log N (32 bit Unsigned) to the base 2
- *
- * @details
- *
- * Function: rgSCHUtlLog32bitNbase2
- * Purpose: This function computes log N (32 bit Unsigned) to the base 2.
- * For n= 0,1 ret = 0.
- *
- * Invoked by: Scheduler
- *
- * @param[in] uint32_t n
- * @return uint8_t
- *
- **/
-uint8_t rgSCHUtlLog32bitNbase2(uint32_t n)
-{
- uint32_t b[] = {0x2, 0xc, 0xf0, 0xff00, 0xffff0000};
- uint32_t s[] = {1, 2, 4, 8, 16};
- S16 i;
- uint8_t ret = 0;
-
- for (i=4; i >= 0; i--)
- {
- if (n & b[i])
- {
- n >>= s[i];
- ret |= s[i];
- }
- }
- return (ret);
-}
-
-#ifdef LTEMAC_SPS
-
-/**
- * @brief This function is a wrapper to call scheduler specific API.
- *
- * @details
- *
- * Function: rgSCHUtlDlRelPdcchFbk
- * Purpose: Calls scheduler's handler for SPS release PDCCH feedback
- * information.
- *
- * Invoked by: DHM
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t isAck
- * @return Void
- *
- **/
-Void rgSCHUtlDlRelPdcchFbk(RgSchCellCb *cell,RgSchUeCb *ue,uint8_t isAck)
-{
- cell->sc.apis->rgSCHDlRelPdcchFbk(cell, ue, isAck);
- return;
-}
-
-
-
-/**
- * @brief This function is a wrapper to call scheduler specific API.
- *
- * @details
- *
- * Function: rgSCHUtlDlProcAck
- * Purpose: Calls scheduler's handler to process Ack
- * information.
- *
- * Invoked by: DHM
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlHqProcCb *hqP
- * @return Void
- *
- **/
-Void rgSCHUtlDlProcAck(RgSchCellCb *cell,RgSchDlHqProcCb *hqP)
-{
- cell->sc.apis->rgSCHDlProcAck(cell, hqP);
- return;
-}
-
-/**
- * @brief CRNTI CE Handler
- *
- * @details
- *
- * Function : rgSCHUtlHdlCrntiCE
- *
- * - Call scheduler common API
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[out] RgSchErrInfo *err
- * @return Void
- **/
-Void rgSCHUtlHdlCrntiCE(RgSchCellCb *cell,RgSchUeCb *ue)
-{
-
- cell->sc.apis->rgSCHHdlCrntiCE(cell, ue);
- return;
-} /* rgSCHUtlHdlCrntiCE */
-#endif /* LTEMAC_SPS */
-
-/***********************************************************
- *
- * Func : rgSCHUtlCalcTotalRegs
- *
- * Desc : Calculate total REGs, given a bandwidth, CFI
- * and number of antennas.
- *
- * Ret : Total REGs (uint16_t)
- *
- * Notes: Could optimise if bw values are limited
- * (taken from RRC spec) by indexing values from
- * a table.
- * Input values are not validated. CFI is assumed
- * to be 1/2/3/4.
- *
- * File :
- *
- **********************************************************/
-static uint16_t rgSCHUtlCalcTotalRegs(uint8_t bw,uint8_t cfi,uint8_t numAntna,Bool isEcp)
-{
- uint16_t regs = 0;
-
- /*ccpu00116757- removed check for (ERRCLASS & ERRCLS_DEBUG)*/
-
- if (bw <= 10)
- ++cfi;
- switch (cfi)
- {
- /* Refer 36.211 section 6.10.1.2
- * For symbols 2 and 4, the REGs per RB will be based on cyclic prefix
- * and number of antenna ports.
- * For symbol 1, there are 2 REGs per RB always. Similarly symbol 3
- * will have 3 REGS.
- */
- case 4:
- /*CR changes [ccpu00124416] - MOD*/
- if(isEcp)
- {
- regs = bw * RGSCH_NUM_REGS_4TH_SYM_EXT_CP;
- }
- else
- {
- regs = bw * RGSCH_NUM_REGS_4TH_SYM_NOR_CP;
- }
- case 3:
- regs += bw * RGSCH_NUM_REGS_3RD_SYM;
- case 2:
- /*CR changes [ccpu00124416] - MOD using number of antenna ports*/
- regs += (numAntna == RGSCH_NUM_ANT_PORT_FOUR) ? \
- (bw * RGSCH_NUM_REGS_2ND_SYM_FOUR_ANT_PORT) : \
- (bw * RGSCH_NUM_REGS_2ND_SYM_1OR2_ANT_PORT);
- default: /* case 1 */
- regs += bw * RGSCH_NUM_REGS_1ST_SYM;
- }
- return (regs);
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlCalcPhichRegs
- *
- * Desc : Calculates number of PHICH REGs
- *
- * Ret : Number of PHICH REGs (uint8_t)
- *
- * Notes: ng6 is Ng multiplied by 6
- *
- * File :
- *
- **********************************************************/
-static uint16_t rgSCHUtlCalcPhichRegs(uint8_t bw,uint8_t ng6)
-{
- /* ccpu00115330: Corrected the calculation for number of PHICH groups*/
- return (RGSCH_CEIL((bw * ng6) ,(8 * 6)) * RGSCH_NUM_REG_PER_PHICH_GRP);
-}
-
-#ifdef LTE_TDD
-/**
- * @brief Calculates total CCEs (N_cce)
- *
- * @details
- *
- * Function: rgSCHUtlCalcNCce
- * Purpose: This function calculates and returns total CCEs for a
- * cell, given the following: bandwidth, Ng configuration
- * (multiplied by six), cfi (actual number of control
- * symbols), m factor for PHICH and number of antennas.
- *
- * Invoked by: Scheduler
- *
- * @param[in] uint8_t bw
- * @param[in] uint8_t ng6
- * @param[in] uint8_t cfi
- * @param[in] uint8_t mPhich
- * @param[in] uint8_t numAntna
- * @param[in] Bool isEcp
- * @return N_cce (uint8_t)
- *
- **/
-uint8_t rgSCHUtlCalcNCce(uint8_t bw,RgrPhichNg ng,uint8_t cfi,uint8_t mPhich,uint8_t numAntna,Bool isEcp)
-{
- uint16_t totalRegs;
- uint16_t phichRegs;
- uint16_t cceRegs;
- uint8_t ng6;
-
- /*ccpu00116757- removed check for (ERRCLASS & ERRCLS_DEBUG)*/
-
- switch (ng)
- {
- case RGR_NG_ONESIXTH:
- ng6 = 1;
- break;
- case RGR_NG_HALF:
- ng6 = 3;
- break;
- case RGR_NG_ONE:
- ng6 = 6;
- break;
- case RGR_NG_TWO:
- default:
- ng6 = 12;
- break;
- }
-
- totalRegs = rgSCHUtlCalcTotalRegs(bw, cfi, numAntna, isEcp);
- phichRegs = rgSCHUtlCalcPhichRegs(bw, ng6);
- cceRegs = totalRegs - mPhich*phichRegs - RGSCH_NUM_PCFICH_REG;
-
- return ((uint8_t)(cceRegs/RGSCH_NUM_REG_PER_CCE));
-}
-
-#else
-/**
- * @brief Calculates total CCEs (N_cce)
- *
- * @details
- *
- * Function: rgSCHUtlCalcNCce
- * Purpose: This function calculates and returns total CCEs for a
- * cell, given the following: bandwidth, Ng configuration
- * (multiplied by six), cfi (actual number of control
- * symbols) and number of antennas.
- *
- * Invoked by: Scheduler
- *
- * @param[in] uint8_t bw
- * @param[in] uint8_t ng6
- * @param[in] uint8_t cfi
- * @param[in] uint8_t numAntna
- * @return N_cce (uint8_t)
- *
- **/
-uint8_t rgSCHUtlCalcNCce(uint8_t bw,RgrPhichNg ng,uint8_t cfi,uint8_t numAntna,Bool isEcp)
-{
- uint16_t totalRegs;
- uint16_t phichRegs;
- uint16_t cceRegs;
- uint8_t ng6;
-
- /*ccpu00116757- removed check for (ERRCLASS & ERRCLS_DEBUG)*/
-
- switch (ng)
- {
- case RGR_NG_ONESIXTH:
- ng6 = 1;
- break;
- case RGR_NG_HALF:
- ng6 = 3;
- break;
- case RGR_NG_ONE:
- ng6 = 6;
- break;
- case RGR_NG_TWO:
- default:
- ng6 = 12;
- break;
- }
-
- totalRegs = rgSCHUtlCalcTotalRegs(bw, cfi, numAntna, isEcp);
- phichRegs = rgSCHUtlCalcPhichRegs(bw, ng6);
- cceRegs = totalRegs - phichRegs - RGSCH_NUM_PCFICH_REG;
-
- return ((uint8_t)(cceRegs/RGSCH_NUM_REG_PER_CCE));
-}
-#endif
-
-/**
- * @brief Returns PHICH info associated with an uplink
- * HARQ process allocation
- *
- * @details
- *
- * Function: rgSCHUtlGetPhichInfo
- * Purpose: This function returns PHICH info associated with
- * an uplink HARQ process allocation. PHICH info
- * comprises RB start and N_dmrs.
- *
- * @param[in] RgSchUlHqProcCb *hqProc
- * @param[out] uint8_t *rbStartRef
- * @param[out] uint8_t *nDmrsRef
- * @return S16
- **/
-#ifdef LTE_TDD
-S16 rgSCHUtlGetPhichInfo(RgSchUlHqProcCb *hqProc,uint8_t *rbStartRef,uint8_t *nDmrsRef,uint8_t *iPhich)
-#else
-S16 rgSCHUtlGetPhichInfo(RgSchUlHqProcCb *hqProc,uint8_t *rbStartRef,uint8_t *nDmrsRef)
-#endif
-{
-/* ACC-TDD */
- S16 ret = RFAILED;
-
- if ((hqProc != NULLP) && (hqProc->alloc != NULLP))
- {
- *rbStartRef = hqProc->alloc->grnt.rbStart;
- *nDmrsRef = hqProc->alloc->grnt.nDmrs;
-#ifdef LTE_TDD
- *iPhich = hqProc->iPhich;
-#endif
- ret = ROK;
- }
- return (ret);
-}
-#ifndef TFU_UPGRADE
-/**
- * @brief Returns uplink grant information required to permit
- * PHY to receive data
- *
- * @details
- *
- * Function: rgSCHUtlAllocRcptInfo
- * Purpose: Given an uplink allocation, this function returns
- * uplink grant information which is needed by PHY to
- * decode data sent from UE. This information includes:
- * - RB start
- * - Number of RBs
- * - RV
- *
- * @param[in] RgSchUlAlloc *alloc
- * @param[out] uint8_t *rbStartRef
- * @param[out] uint8_t *numRbRef
- * @param[out] uint8_t *rvRef
- * @param[out] uint16_t *size
- * @param[out] TfuModScheme *modType
- * @param[out] Bool *isRtx
- * @param[out] uint8_t *nDmrs
- * @param[out] Bool *ndi
- * @param[out] uint8_t *hqPId
- * @return S16
- **/
-S16 rgSCHUtlAllocRcptInfo
-(
-RgSchUlAlloc *alloc,
-CmLteRnti *rnti,
-uint8_t *iMcsRef,
-uint8_t *rbStartRef,
-uint8_t *numRbRef,
-uint8_t *rvRef,
-uint16_t *size,
-TfuModScheme *modType,
-Bool *isRtx,
-uint8_t *nDmrs,
-Bool *ndi,
-uint8_t *hqPId
-)
-{
- /* Modulation order for 16qam UEs would be
- * min(4,modulation order in grant). Please refer to 36.213-8.6.1*/
- CmLteUeCategory ueCtgy;
-
-#if (ERRCLASS & ERRCLS_DEBUG)
- if ((alloc == NULLP) || (alloc->hqProc == NULLP))
- {
- return RFAILED;
- }
-#endif
-
- if ( !alloc->forMsg3 )
- {
- if ( ((alloc->ue) == NULLP) || (RG_SCH_CMN_GET_UE(alloc->ue, alloc->ue->cell) == NULLP))
- {
- DU_LOG("\nERROR --> SCH : Failed: ue->sch is null RNTI:%d,isRetx=%d",
- alloc->rnti, alloc->grnt.isRtx);
- return RFAILED;
- }
- ueCtgy = (RG_SCH_CMN_GET_UE_CTGY(alloc->ue));
- }
-
- *iMcsRef = alloc->grnt.iMcs;
- *rbStartRef = alloc->grnt.rbStart;
- *numRbRef = alloc->grnt.numRb;
- *rvRef = rgRvTable[alloc->hqProc->rvIdx];
- *rnti = alloc->rnti;
- *size = alloc->grnt.datSz;
- *modType = (alloc->forMsg3)? alloc->grnt.modOdr:
- ((ueCtgy == CM_LTE_UE_CAT_5)?
- alloc->grnt.modOdr:
- (RGSCH_MIN(RGSCH_QM_QPSK,alloc->grnt.modOdr)));
- *isRtx = alloc->grnt.isRtx;
- *nDmrs = alloc->grnt.nDmrs;
- *ndi = alloc->hqProc->ndi;
- *hqPId = alloc->hqProc->procId;
-
- return ROK;
-}
-#else
-/**
- * @brief Returns uplink grant information required to permit
- * PHY to receive data
- *
- * @details
- *
- * Function: rgSCHUtlAllocRcptInfo
- * Purpose: Given an uplink allocation, this function returns
- * uplink grant information which is needed by PHY to
- * decode data sent from UE. This information includes:
- * - RB start
- * - Number of RBs
- * - RV
- *
- * @param[in] RgSchUlAlloc *alloc
- * @param[out] uint8_t *rbStartRef
- * @param[out] uint8_t *numRbRef
- * @param[out] uint8_t *rvRef
- * @param[out] uint16_t *size
- * @param[out] TfuModScheme *modType
- * @return S16
- **/
-S16 rgSCHUtlAllocRcptInfo(RgSchCellCb *cell,RgSchUlAlloc *alloc,CmLteTimingInfo *timeInfo,TfuUeUlSchRecpInfo *recpReq)
-{
-#if (ERRCLASS & ERRCLS_DEBUG)
- if ((alloc == NULLP) || (alloc->hqProc == NULLP))
- {
- return RFAILED;
- }
-#endif
- recpReq->size = alloc->grnt.datSz;
- recpReq->rbStart = alloc->grnt.rbStart;
- recpReq->numRb = alloc->grnt.numRb;
- /* Modulation order min(4,mod in grant) for 16 qam UEs.
- * Please refer to 36.213-8.6.1*/
-#ifdef FOUR_TX_ANTENNA
- recpReq->modType = (TfuModScheme)((alloc->forMsg3)?alloc->grnt.modOdr:
- (/*(alloc->ue->ueCatEnum == CM_LTE_UE_CAT_5)?
- alloc->grnt.modOdr: *//* Chandra:TmpFx-TM500 Cat5 with Only16QAM */
- (RGSCH_MIN(RGSCH_QM_QPSK,alloc->grnt.modOdr))));
-#else
- recpReq->modType = (TfuModScheme)((alloc->forMsg3)?alloc->grnt.modOdr:
- ((alloc->ue->ueCatEnum == CM_LTE_UE_CAT_5)?
- alloc->grnt.modOdr:
- (RGSCH_MIN(RGSCH_QM_QPSK,alloc->grnt.modOdr))));
-#endif
- recpReq->nDmrs = alloc->grnt.nDmrs;
- recpReq->hoppingEnbld = FALSE;
- recpReq->hoppingBits = 0;
- recpReq->isRtx = alloc->grnt.isRtx;
- recpReq->ndi = alloc->hqProc->ndi;
- recpReq->rv = rgRvTable[alloc->hqProc->rvIdx];
-#ifndef LTE_TDD
- recpReq->harqProcId = alloc->hqProc->procId;
-#else
- recpReq->harqProcId = rgSCHCmnGetUlHqProcIdx(timeInfo, cell);
-#endif
- /* Transmission mode is SISO till Uplink MIMO is implemented. */
- recpReq->txMode = 0;
- /* This value needs to filled in in the case of frequency hopping. */
- recpReq->crntTxNb = 0;
-
- recpReq->mcs = alloc->grnt.iMcs;
-#ifdef RG_5GTF
- recpReq->rbgStart = alloc->grnt.vrbgStart;
- recpReq->numRbg = alloc->grnt.numVrbg;
- recpReq->xPUSCHRange = alloc->grnt.xPUSCHRange;
- //TODO_SID Need to check
- recpReq->nAntPortLayer = 0;
- recpReq->SCID = alloc->grnt.SCID;
- recpReq->PMI = alloc->grnt.PMI;
- recpReq->uciWoTBFlag = alloc->grnt.uciOnxPUSCH;
- if(alloc->ue)
- {
- recpReq->beamIndex = alloc->ue->ue5gtfCb.BeamId;
- }
-#endif
-
-#ifdef TENB_STATS
- if (!alloc->forMsg3)
- {
- if (alloc->grnt.isRtx)
- {
- alloc->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(alloc->ue->cell)].ulRetxOccns++;
- }
- else
- {
- alloc->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(alloc->ue->cell)].ulTxOccns++;
- alloc->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(alloc->ue->cell)].ulSumiTbs += \
- rgSCHCmnUlGetITbsFrmIMcs(alloc->grnt.iMcs);
- alloc->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(alloc->ue->cell)].ulNumiTbs ++;
- cell->tenbStats->sch.ulSumiTbs += \
- rgSCHCmnUlGetITbsFrmIMcs(alloc->grnt.iMcs);
- cell->tenbStats->sch.ulNumiTbs ++;
- }
- alloc->ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(alloc->ue->cell)].ulPrbUsg += alloc->grnt.numRb;
- cell->tenbStats->sch.ulPrbUsage[0] += alloc->grnt.numRb;
- }
-#endif
- /* ccpu00117050 - DEL - nSrs setting at rgSCHUtlAllocRcptInfo */
- return ROK;
-}
-#endif
-
-#ifdef LTE_TDD
-/**
- * @brief This function initialises the PRACH slot occasions
- *
- * @details
- *
- * Function: rgSCHUtlUpdPrachOcc
- * Purpose: This function updates the PRACH slots based on
- * RGR configuration.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgrTddPrachInfo *cellCfg
- * @return Void
- *
- **/
-static Void rgSCHUtlUpdPrachOcc(RgSchCellCb *cell,RgrTddPrachInfo *cellCfg)
-{
- uint8_t idx;
- uint8_t count = 0;
- uint8_t size;
- uint8_t startIdx;
- uint8_t endIdx;
-
- /* In the 1st half frame */
- if(cellCfg->halfFrm == 0)
- {
- startIdx = 2;
- endIdx = 6;
- }
- /* In the 2nd half frame */
- else
- {
- startIdx = 6;
- endIdx = 10;
- }
- for(idx = startIdx; idx < endIdx; idx++)
- {
- if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx][idx]
- == RG_SCH_TDD_UL_slot)
- {
- if(cellCfg->ulStartSfIdx == count)
- {
- size = cell->rachCfg.raOccasion.size;
- cell->rachCfg.raOccasion.slotNum[size] = idx;
- cell->rachCfg.raOccasion.size++;
- break;
- }
- count ++;
- }
- }
- return;
-}
-
-/**
- * @brief This function initialises the PRACH occasions
- *
- * @details
- *
- * Function: rgSCHUtlPrachCfgInit
- * Purpose: This function initialises the PRACH occasions based on
- * RGR configuration.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgrCellCfg *cellCfg
- * @return Void
- *
- **/
-Void rgSCHUtlPrachCfgInit(RgSchCellCb *cell,RgrCellCfg *cellCfg)
-{
- uint8_t idx;
- uint8_t subfrmIdx;
- uint8_t splFrm;
-
- if(cellCfg->prachRscInfo.numRsc <= 0)
- {
- DU_LOG("\nERROR --> SCH : Invalid"
- "PRACH resources Configuration ");
- return;
- }
-
- /* Update SFN occasions */
- cell->rachCfg.raOccasion.sfnEnum =
- cellCfg->prachRscInfo.prachInfo[0].sfn;
-
- cell->rachCfg.raOccasion.size = 0;
-
- /* Update slot occasions */
- for(idx = 0; idx < cellCfg->prachRscInfo.numRsc; idx++)
- {
- if(cellCfg->prachRscInfo.prachInfo[idx].freqIdx == 0)
- {
- if(cellCfg->prachRscInfo.prachInfo[idx].halfFrm == 0)
- {
- splFrm = 1;
- }
- else
- {
- splFrm = 6;
- }
- if(cellCfg->prachRscInfo.prachInfo[idx].ulStartSfIdx ==
- RGR_TDD_SPL_UL_IDX)
- {
- subfrmIdx = cell->rachCfg.raOccasion.size;
- cell->rachCfg.raOccasion.slotNum[subfrmIdx] = splFrm;
- cell->rachCfg.raOccasion.size++;
- }
- else
- {
- rgSCHUtlUpdPrachOcc(cell,
- &cellCfg->prachRscInfo.prachInfo[idx]);
- }
- }
- }
- return;
-}
-
-/**
- * @brief This function performs RGR cell initialization
- *
- * @details
- *
- * Function: rgSCHUtlRgrCellCfg
- * Purpose: This function initialises the cell with RGR configuration
- * and slot related initialization.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgrCellCfg *cellCfg
- * @param[in] RgSchErrInfo *errInfo
- * @return Void
- *
- **/
-S16 rgSCHUtlRgrCellCfg(RgSchCellCb *cell,RgrCellCfg *cellCfg,RgSchErrInfo *errInfo)
-{
- uint8_t i;
- uint8_t sfn=0;
- uint8_t sfNum = 0;
- RgSchDlSf *sf;
- CmLteTimingInfo frm;
- uint8_t ulDlCfgIdx = cellCfg->ulDlCfgIdx;
- uint8_t maxslots ;
- uint8_t maxDlslots;
- S16 ret = ROK;
- uint16_t bw; /*!< Number of RBs in the cell */
-
- memset(&frm,0,sizeof(CmLteTimingInfo));
-
- /* ccpu00132657-MOD- Determining DLSF array size independent of DELTAS */
- maxDlslots = rgSchTddNumDlSubfrmTbl[ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1];
- maxslots = 2 * maxDlslots;
- cell->numDlSubfrms = maxslots;
-/* ACC-TDD <ccpu00130639> */
- cell->tddHqSfnCycle = -1;
- cell->ulDlCfgIdx = ulDlCfgIdx;
-
- /* PRACH Occasions Initialization */
- rgSCHUtlPrachCfgInit(cell, cellCfg);
-
- /* ccpu00132658- Moved out of below for loop since the updating rbgSize and
- * bw are independent of sfNum*/
- /* determine the RBG size and no of RBGs for the configured
- * DL BW */
- if (cell->bwCfg.dlTotalBw > 63)
- {
- cell->rbgSize = 4;
- }
- else if (cell->bwCfg.dlTotalBw > 26)
- {
- cell->rbgSize = 3;
- }
- else if (cell->bwCfg.dlTotalBw > 10)
- {
- cell->rbgSize = 2;
- }
- else
- {
- cell->rbgSize = 1;
- }
- cell->noOfRbgs = RGSCH_CEIL(cell->bwCfg.dlTotalBw, cell->rbgSize);
-
- bw = cell->bwCfg.dlTotalBw;
-
- rgSCHUtlAllocSBuf(cell->instIdx,
- (Data **)&cell->subFrms, sizeof(RgSchDlSf *) * maxslots);
- if (cell->subFrms == NULLP)
- {
- return RFAILED;
- }
-
- /* Create memory for each frame. */
- for(i = 0; i < maxslots; i++)
- {
- while(rgSchTddUlDlSubfrmTbl[ulDlCfgIdx][sfNum] ==
- RG_SCH_TDD_UL_slot)
- {
- sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES;
- }
-
- rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&sf, sizeof(RgSchDlSf));
- if (sf == NULLP)
- {
- break;
- }
- memset(sf, 0, sizeof(*sf));
-
-#ifdef LTE_ADV
- if (ROK != rgSCHLaaInitDlSfCb(cell, sf))
- {
- break;
- }
-#endif
- sf->sfNum = sfNum;
- sf->bw = bw;
-#ifdef LTEMAC_SPS
- /* Mark SPS bandwidth to be occupied */
- sf->bwAlloced = ((cellCfg->spsCfg.maxSpsDlBw +
- cell->rbgSize - 1)/cell->rbgSize) * cell->rbgSize;
- sf->spsAllocdBw = 0;
- sf->type2End = sf->bwAlloced/cell->rbgSize;
-#else
- sf->bwAlloced = 0;
- /* Fix for ccpu00123918*/
- sf->type2Start = 0;
-#endif /* LTEMAC_SPS */
- /* Initialize the ackNakRepQ here */
-#ifdef RG_MAC_MEASGAP
- cmLListInit (&(sf->ackNakRepQ));
-#endif
- cell->subFrms[i] = sf;
- sfNum = (sfNum+1) % RGSCH_NUM_SUB_FRAMES;
- }
- if (i != maxslots)
- {
- for (; i > 0; i--)
- {
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx,
- (Data **)(&(cell->subFrms[i-1])), sizeof(RgSchDlSf));
-#ifdef LTE_ADV
- rgSCHLaaDeInitDlSfCb(cell, sf);
-#endif
- }
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx,
- (Data **)(&(cell->subFrms)), sizeof(RgSchDlSf *) * maxslots);
-
- return RFAILED;
- }
-
- if (cell->sc.apis == NULLP)
- {
- cell->sc.apis = &rgSchCmnApis;
- }
- ret = cell->sc.apis->rgSCHRgrCellCfg(cell, cellCfg, errInfo);
-
- if (ret != ROK)
- {
- /* ccpu00132286- Removed deletion of sf nodes as the deletion will be
- * happening during CellDelete. Added return handling to provide negative
- * confirm*/
- return (ret);
- }
-
- /* Release the slots and thereby perform the initialization */
- for (i = 0; i < maxslots; i++)
- {
- if((i > 0) && (i%maxDlslots == 0))
- {
- sfn++;
- }
- frm.sfn = sfn;
- frm.slot = cell->subFrms[i]->sfNum;
- rgSCHUtlDlRlsSubFrm(cell, frm);
- }
-
- return (ret);
-}
-
-#else
-\f
-/**
- * @brief This function performs scheduler related cell creation
- *
- * @details
- *
- * Function: rgSCHUtlRgrCellCfg
- * Purpose: This function creates the slots needed for the
- * cell. It then peforms init of the scheduler by calling
- * scheduler specific cell init function.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgrCellCfg *cellCfg
- * @param[in] RgSchErrInfo *errInfo
- * @return Void
- *
- **/
-S16 rgSCHUtlRgrCellCfg(RgSchCellCb *cell,RgrCellCfg *cellCfg,RgSchErrInfo *errInfo)
-{
- uint8_t i;
- RgSchDlSf *sf;
- CmLteTimingInfo frm;
- S16 ret;
- Inst inst = cell->instIdx;
- /* LTE_ADV_FLAG_REMOVED_START */
- uint16_t len;
- len = (uint16_t)((cell->bwCfg.dlTotalBw % 8 == 0) ? (cell->bwCfg.dlTotalBw/8) : (cell->bwCfg.dlTotalBw/8 + 1)); /*KW fix for LTE_ADV */
- /* LTE_ADV_FLAG_REMOVED_END */
-
- memset(&frm,0,sizeof(CmLteTimingInfo));
-
- /* determine the RBG size and no of RBGs for the configured
- * DL BW */
- if (cell->bwCfg.dlTotalBw > 63)
- {
- cell->rbgSize = 4;
- }
- else if (cell->bwCfg.dlTotalBw > 26)
- {
- cell->rbgSize = 3;
- }
- else if (cell->bwCfg.dlTotalBw > 10)
- {
- cell->rbgSize = 2;
- }
- else
- {
- cell->rbgSize = 1;
- }
- cell->noOfRbgs = RGSCH_CEIL(cell->bwCfg.dlTotalBw, cell->rbgSize);
- /* Create memory for each frame. */
- /* Changing loop limit from
- RGSCH_NUM_SUB_FRAMES to RGSCH_NUM_DL_slotS */
- for(i = 0; i < RGSCH_NUM_DL_slotS; i++)
- {
- rgSCHUtlAllocSBuf(inst, (Data **)&sf, sizeof(RgSchDlSf));
- if (sf == NULLP)
- {
- break;
- }
- memset(sf, 0, sizeof(*sf));
-
-#ifdef LTE_ADV
- if (ROK != rgSCHLaaInitDlSfCb(cell, sf))
- {
- break;
- }
-#endif
- /* Doing MOD operation before assigning value of i */
- sf->sfNum = i % RGSCH_NUM_SUB_FRAMES;
- sf->bw = cell->bwCfg.dlTotalBw;
- /* Initialize the ackNakRepQ here */
-#ifdef RG_MAC_MEASGAP
- cmLListInit (&(sf->ackNakRepQ));
-#endif
- cell->subFrms[i] = sf;
- /* LTE_ADV_FLAG_REMOVED_START */
- if (cell->lteAdvCb.dsfrCfg.status == RGR_ENABLE)
- {
- /*initialize the RNTP Buffer*/
- if(rgSchDSFRRntpInfoInit(&sf->rntpInfo, cell, sf->bw))
- {
- return RFAILED;
- }
- }
-
- if (cell->lteAdvCb.sfrCfg.status == RGR_ENABLE)
- {
- /*initialise the pools of CC and CE*/
- if(rgSchSFRTotalPoolInit(cell, sf))
- {
- return RFAILED;
- }
- }
- /* LTE_ADV_FLAG_REMOVED_END */
- }
-
- /* LTE_ADV_FLAG_REMOVED_START */
- /* Allocate memory for "scheduled UE" Info */
- if (cell->lteAdvCb.dsfrCfg.status == RGR_ENABLE)
- {
- if((rgSCHUtlAllocSBuf(inst, (Data**)&(cell->rntpAggrInfo.val),
- (len * sizeof(uint8_t)))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED for RNTP Alloc");
- return RFAILED;
- }
- cell->rntpAggrInfo.pres = PRSNT_NODEF;
- cell->rntpAggrInfo.len = len;
- }
- /* LTE_ADV_FLAG_REMOVED_END */
-
- /* Changing loop limit from
- RGSCH_NUM_SUB_FRAMES to RGSCH_NUM_DL_slotS */
- if (i != RGSCH_NUM_DL_slotS)
- {
- for (; i > 0; i--)
- {
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(inst, (Data **)(&(cell->subFrms[i-1])),
- sizeof(RgSchDlSf));
-#ifdef LTE_ADV
- rgSCHLaaDeInitDlSfCb(cell, sf);
-#endif
- }
- return RFAILED;
- }
-
- if (cell->sc.apis == NULLP)
- {
- cell->sc.apis = &rgSchCmnApis;
- }
-
- /* Release the slots and thereby perform the initialization */
- for (i = 0; i < RGSCH_NUM_DL_slotS; i++)
- {
- if (i >= RGSCH_NUM_SUB_FRAMES)
- {
- /* [ccpu00123828]-MOD-The below statement sfn += 1incorrectly modified
- * the value of sfn for i>=10 thru 19. Correct way is to assign
- it to one */
- frm.sfn = 1;
- }
- frm.slot = i % RGSCH_NUM_SUB_FRAMES;
- rgSCHUtlDlRlsSubFrm(cell, frm);
- }
-
- ret = cell->sc.apis->rgSCHRgrCellCfg(cell, cellCfg, errInfo);
- if (ret != ROK)
- {
- errInfo->errCause = RGSCHERR_SCH_CFG;
- return RFAILED;
- }
-#ifdef EMTC_ENABLE
- if(cell->emtcEnable)
- {
- /* TODO: Repetition framework in RGR and APP */
- if (rgSCHUtlEmtcResMngmtInit(
- cell,
- RGSCH_IOT_PDSCH_POOLSZ, RGSCH_IOT_PDSCH_DELTA, cellCfg->bwCfg.dlTotalBw,
- RGSCH_IOT_PUSCH_POOLSZ, RGSCH_IOT_PUSCH_DELTA, RGSCH_IOT_PUSCH_MAXFREQSZ,
- RGSCH_IOT_PUCCH_POOLSZ, RGSCH_IOT_PUCCH_DELTA, RGSCH_IOT_PUCCH_MAXFREQSZ) != ROK)
- {
- errInfo->errCause = RGSCHERR_SCH_CFG;
- return RFAILED;
- }
- }
-#endif
-
- return (ret);
-}
-#endif
-
-\f
-/**
- * @brief This function performs the cell reconfiguration at RGR interface
- *
- * @details
- *
- * Function: rgSCHUtlRgrCellRecfg
- * Purpose: This function updates the reconfigurable parameters
- * on the cell control block for the scheduler.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgrCellCfg *cellCfg
- * @param[in] RgSchErrInfo *errInfo
- * @return Void
- *
- **/
-S16 rgSCHUtlRgrCellRecfg(RgSchCellCb *cell,RgrCellRecfg *recfg,RgSchErrInfo *err)
-{
- return (cell->sc.apis->rgSCHRgrCellRecfg(cell, recfg, err));
-}
-
-
-\f
-/**
- * @brief This function returns the Y value of UE for a sub frame
- *
- * @details
- *
- * Function: rgSCHUtlFreeCell
- * Purpose: This function updates the value of Y stored in the
- * UE control block. It uses the previously computed
- * value for computing for this slot.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @return Void
- *
- **/
-S16 rgSCHUtlFreeCell(RgSchCellCb *cell)
-{
- uint8_t i;
- CmLListCp *lst;
- RgSchPdcch *pdcch;
- RgSchPdcchInfo *pdcchInfo;
- RgSchPhichInfo *phichInfo;
- RgSchPhich *phich;
- Inst inst = cell->instIdx;
- uint8_t maxslots;
-#ifdef LTE_TDD
- RgSchRaReqInfo *raReqInfo;
- uint8_t idx;
-#endif
-
-#ifdef LTE_TDD
- maxslots = cell->numDlSubfrms;
-#else
- maxslots = RGSCH_NUM_DL_slotS;
-#endif
-
-
- /* Invoke the index for scheduler, cell deletion */
- cell->sc.apis->rgSCHFreeCell(cell);
-
- /* Release the slots allocated */
- for (i = 0; i < maxslots; i++)
- {
-#ifdef LTE_ADV
- rgSCHLaaDeInitDlSfCb(cell, cell->subFrms[i]);
-#endif
- pdcchInfo = &cell->subFrms[i]->pdcchInfo;
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(inst, (Data **)(&(pdcchInfo->map)),
- (pdcchInfo->nCce + 7) >> 3);
- while (pdcchInfo->pdcchs.first != NULLP)
- {
- pdcch = (RgSchPdcch *)pdcchInfo->pdcchs.first->node;
- cmLListDelFrm(&pdcchInfo->pdcchs, pdcchInfo->pdcchs.first);
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(inst, (Data **)&pdcch, sizeof(RgSchPdcch));
- }
-
- phichInfo = &cell->subFrms[i]->phichInfo;
- while(phichInfo->phichs.first != NULLP)
- {
- phich = (RgSchPhich *)phichInfo->phichs.first->node;
- cmLListDelFrm(&phichInfo->phichs, phichInfo->phichs.first);
- RGSCH_PHICH_FREE(inst, phich, sizeof(RgSchPhich));
- }
-
- /* LTE_ADV_FLAG_REMOVED_START */
- /*releasing SFR pool entries*/
- rgSchSFRTotalPoolFree(&cell->subFrms[i]->sfrTotalPoolInfo, cell);
-
- /*releasing dsfr rntp pattern info*/
- rgSchDSFRRntpInfoFree(&cell->subFrms[i]->rntpInfo, cell,
- cell->bwCfg.dlTotalBw);
- /* LTE_ADV_FLAG_REMOVED_END */
-
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(inst, (Data **)(&(cell->subFrms[i])), sizeof(RgSchDlSf));
- }
-#ifdef LTE_TDD
- /* Release the slot pointers */
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(inst,
- (Data **) (&(cell->subFrms)), sizeof(RgSchDlSf *) * maxslots);
-
- for(idx=0; idx < cell->raInfo.lstSize; idx++)
- {
- lst = &cell->raInfo.raReqLst[idx];
- while (lst->first != NULLP)
- {
- raReqInfo = (RgSchRaReqInfo *)lst->first->node;
- cmLListDelFrm(lst, &raReqInfo->raReqLstEnt);
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(inst,(Data **)&raReqInfo, sizeof(RgSchRaReqInfo));
- }
- }
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(inst,
- (Data **)(&(cell->raInfo.raReqLst)),
- sizeof(CmLListCp) * (cell->raInfo.lstSize));
-#endif
-
- /* Release allocated pdcchs */
- lst = &cell->pdcchLst;
- while (lst->first != NULLP)
- {
- pdcch = (RgSchPdcch *)lst->first->node;
- cmLListDelFrm(lst, &pdcch->lnk);
-#ifdef EMTC_ENABLE
- if(cell->emtcEnable)
- {
- rgSCHEmtcPdcchFree(cell, pdcch);
- rgSCHUtlEmtcResMngmtDeinit(cell);
- }
-#endif
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(inst,(Data **)&pdcch, sizeof(RgSchPdcch));
- }
-#ifdef LTE_ADV
- rgSCHLaaFreeLists(cell);
-#endif
-
- /* LTE_ADV_FLAG_REMOVED_START */
- /* releasing RNTP Aggregation Info from CellCb*/
- rgSchDSFRRntpInfoFree(&cell->rntpAggrInfo, cell, cell->bwCfg.dlTotalBw);
- /* LTE_ADV_FLAG_REMOVED_END */
-
- return ROK;
-}
-
-\f
-/**
- * @brief This function adds the UE to scheduler
- *
- * @details
- *
- * Function: rgSCHUtlRgrUeCfg
- * Purpose: This function performs addition of UE to scheduler
- * 1. First, it updates the Y table in the UE
- * 2. Then, it calls the scheduler's handler for UE addition
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrUeCfg *cfg
- * @param[in] RgSchErrInfo *err
- * @return S16
- *
- **/
-S16 rgSCHUtlRgrUeCfg(RgSchCellCb *cell,RgSchUeCb *ue,RgrUeCfg *cfg,RgSchErrInfo *err)
-{
-
- /* Assign TM 1 as UE's default TM */
- ue->mimoInfo.txMode = RGR_UE_TM_1;
- ue->txModeTransCmplt = TRUE;
- cmInitTimers(&ue->txModeTransTmr, 1);
- if (cfg->txMode.pres == PRSNT_NODEF)
- {
- /* DL MU-MIMO not supported */
- if (cfg->txMode.txModeEnum == RGR_UE_TM_5)
- {
- err->errCause = RGSCHERR_SCH_CFG;
- return RFAILED;
- }
- ue->mimoInfo.txMode = cfg->txMode.txModeEnum;
- }
- ue->ul.ulTxAntSel = cfg->ulTxAntSel;
- ue->mimoInfo.cdbkSbstRstrctn = cfg->ueCodeBookRstCfg;
-#ifdef TFU_UPGRADE
- ue->ueCatEnum = cfg->ueCatEnum;
- if ((cfg->puschDedCfg.bACKIdx > 15) ||
- (cfg->puschDedCfg.bCQIIdx > 15) ||
- (cfg->puschDedCfg.bRIIdx > 15))
- {
- err->errCause = RGSCHERR_SCH_CFG;
- return RFAILED;
- }
- ue->ul.betaHqOffst = cfg->puschDedCfg.bACKIdx;
- ue->ul.betaCqiOffst = cfg->puschDedCfg.bCQIIdx;
- ue->ul.betaRiOffst = cfg->puschDedCfg.bRIIdx;
-#endif
- ue->csgMmbrSta = cfg->csgMmbrSta;
-#ifdef RG_PFS_STATS
- memset(&ue->pfsStats, 0, sizeof(RgSchPfsStats));
-#endif
- /* Call the handler of the scheduler based on cell configuration */
- return (cell->sc.apis->rgSCHRgrUeCfg(cell, ue, cfg, err));
-}
-/* Start : LTEMAC_2.1_DEV_CFG */
-\f
-/**
- * @brief This function adds a service to scheduler
- *
- * @details
- *
- * Function: rgSCHUtlRgrLcCfg
- * Purpose: This function performs addition of service to scheduler
- * The addition is performed for each direction based
- * the direction field of the configuration
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchDlLcCb *dlLc
- * @param[in] RgrLchCfg *cfg
- * @param[in] RgSchErrInfo *err
- * @return S16
- *
- **/
-S16 rgSCHUtlRgrLcCfg(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *dlLc,RgrLchCfg *cfg,RgSchErrInfo *errInfo)
-{
- return (cell->sc.apis->rgSCHRgrLchCfg(cell, ue, dlLc, cfg, errInfo));
-}
-
-\f
-/**
- * @brief This function modifies a service to scheduler
- *
- * @details
- *
- * Function: rgSCHUtlRgrLcRecfg
- * Purpose: This function performs modification of a service in
- * scheduler. The modification is performed for each direction
- * based the direction field of the configuration
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchDlLcCb *dlLc
- * @param[in] RgrLchRecfg *recfg
- * @param[in] RgSchErrInfo *err
- * @return S16
- *
- **/
-S16 rgSCHUtlRgrLcRecfg(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *dlLc,RgrLchRecfg *recfg,RgSchErrInfo *err)
-{
- return (cell->sc.apis->rgSCHRgrLchRecfg(cell, ue, dlLc, recfg, err));
-}
-
-/**
- * @brief This function deletes a Lc in scheduler
- *
- * @details
- *
- * Function: rgSCHUtlRgrLcDel
- * Purpose: This function performs deletion of Lc in scheduler
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] CmLteLcId lcId
- * @param[in] uint8_t lcgId
- * @return S16
- *
- **/
-S16 rgSCHUtlRgrLcDel(RgSchCellCb *cell,RgSchUeCb *ue,CmLteLcId lcId,uint8_t lcgId)
-{
- cell->sc.apis->rgSCHRgrLchDel(cell, ue, lcId, lcgId);
-
- return (ROK);
-} /* rgSCHUtlRgrLcDel */
-
-/**
- * @brief This function adds a service to scheduler
- *
- * @details
- *
- * Function: rgSCHUtlRgrLcgCfg
- * Purpose: This function performs addition of service to scheduler
- * The addition is performed for each direction based
- * the direction field of the configuration
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrLchCfg *cfg
- * @param[in] RgSchErrInfo *err
- * @return S16
- *
- **/
-S16 rgSCHUtlRgrLcgCfg(RgSchCellCb *cell,RgSchUeCb *ue,RgrLcgCfg *cfg,RgSchErrInfo *errInfo)
-{
- return (cell->sc.apis->rgSCHRgrLcgCfg(cell, ue, &(ue->ul.lcgArr[cfg->ulInfo.lcgId]), cfg, errInfo));
-}
-
-\f
-/**
- * @brief This function modifies a service to scheduler
- *
- * @details
- *
- * Function: rgSCHUtlRgrLcgRecfg
- * Purpose: This function performs modification of a service in
- * scheduler. The modification is performed for each direction
- * based the direction field of the configuration
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrLcgRecfg *recfg
- * @param[in] RgSchErrInfo *err
- * @return S16
- *
- **/
-S16 rgSCHUtlRgrLcgRecfg(RgSchCellCb *cell,RgSchUeCb *ue,RgrLcgRecfg *recfg,RgSchErrInfo *err)
-{
- return (cell->sc.apis->rgSCHRgrLcgRecfg(cell, ue, &(ue->ul.lcgArr[recfg->ulRecfg.lcgId]), recfg, err));
-} /* rgSCHUtlRgrLcRecfg */
-
-/**
- * @brief This function modifies a service to scheduler
- *
- * @details
- *
- * Function: rgSCHUtlRgrLcgDel
- * Purpose: This function performs modification of a service in
- * scheduler. The modification is performed for each direction
- * based the direction field of the configuration
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgrDel *lcDelInfo
- * @return S16
- *
- **/
-Void rgSCHUtlRgrLcgDel(RgSchCellCb *cell,RgSchUeCb *ue,uint8_t lcgId)
-{
- cell->sc.apis->rgSCHFreeLcg(cell, ue, &ue->ul.lcgArr[lcgId]);
-
- /* Stack Crash problem for TRACE5 changes. added the return below . */
- return;
-
-} /* rgSCHUtlRgrLcgDel */
-
-
-/* End: LTEMAC_2.1_DEV_CFG */
-
-/**
- * @brief This function is a wrapper to call scheduler specific API.
- *
- * @details
- *
- * Function: rgSCHUtlDoaInd
- * Purpose: Updates the DOA for the UE
- *
- * Invoked by: TOM
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] TfuDoaRpt *doaRpt
- * @return Void
- *
- **/
-Void rgSCHUtlDoaInd(RgSchCellCb *cell,RgSchUeCb *ue,TfuDoaRpt *doaRpt)
-{
- ue->mimoInfo.doa.pres = PRSNT_NODEF;
- ue->mimoInfo.doa.val = doaRpt->doa;
- return;
-}
-\f
-/**
- * @brief This function is a wrapper to call scheduler specific API.
- *
- * @details
- *
- * Function: rgSCHUtlDlCqiInd
- * Purpose: Updates the DL CQI for the UE
- *
- * Invoked by: TOM
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] TfuDlCqiRpt *dlCqiRpt
- * @param[in] CmLteTimingInfo timingInfo
- * @return Void
- *
- **/
-Void rgSCHUtlDlCqiInd(RgSchCellCb *cell,RgSchUeCb *ue,TfuDlCqiRpt *dlCqiRpt,CmLteTimingInfo timingInfo)
-{
- RgSchCellCb *sCellCb = NULLP;
- if (dlCqiRpt->isPucchInfo)
- {
- sCellCb = ue->cellInfo[dlCqiRpt->dlCqiInfo.pucchCqi.cellIdx]->cell;
- sCellCb->sc.apis->rgSCHDlCqiInd(sCellCb, ue, dlCqiRpt->isPucchInfo, \
- (Void *)&dlCqiRpt->dlCqiInfo.pucchCqi, timingInfo);
- }
- else
- {
- uint32_t idx;
- for (idx = 0; idx < dlCqiRpt->dlCqiInfo.pusch.numOfCells; idx++)
- {
- sCellCb = ue->cellInfo[dlCqiRpt->dlCqiInfo.pusch.puschCqi[idx].cellIdx]->cell;
- sCellCb->sc.apis->rgSCHDlCqiInd(sCellCb, ue, dlCqiRpt->isPucchInfo, \
- (Void *)&dlCqiRpt->dlCqiInfo.pusch.puschCqi[idx], timingInfo);
- }
- }
- return;
-}
-
-\f
-#ifdef TFU_UPGRADE
-/**
- * @brief This function is a wrapper to call scheduler specific API.
- *
- * @details
- *
- * Function: rgSCHUtlSrsInd
- * Purpose: Updates the UL SRS for the UE
- *
- * Invoked by: TOM
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] TfuSrsRpt* srsRpt
- * @param[in] CmLteTimingInfo timingInfo
- * @return Void
- *
- **/
-Void rgSCHUtlSrsInd(RgSchCellCb *cell,RgSchUeCb *ue,TfuSrsRpt *srsRpt,CmLteTimingInfo timingInfo)
-{
- cell->sc.apis->rgSCHSrsInd(cell, ue, srsRpt, timingInfo);
- return;
-}
-#endif
-
-/**
- * @brief This function is a wrapper to call scheduler specific API.
- *
- * @details
- *
- * Function: rgSCHUtlDlTARpt
- * Purpose: Reports PHY TA for a UE.
- *
- * Invoked by: TOM
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- *
- **/
-Void rgSCHUtlDlTARpt(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- cell->sc.apis->rgSCHDlTARpt(cell, ue);
- return;
-}
-
-\f
-/**
- * @brief This function is a wrapper to call scheduler specific API.
- *
- * @details
- *
- * Function: rgSCHUtlDlRlsSubFrm
- * Purpose: Releases scheduler Information from DL SubFrm.
- *
- * Invoked by: DHM
- *
- * @param[in] RgSchCellCb *cell
- * @param[out] CmLteTimingInfo subFrm
- * @return Void
- *
- **/
-Void rgSCHUtlDlRlsSubFrm(RgSchCellCb *cell,CmLteTimingInfo subFrm)
-{
- cell->sc.apis->rgSCHDlRlsSubFrm(cell, subFrm);
- return;
-}
-
-#ifdef TFU_UPGRADE
-/**
- * @brief This API is invoked to update the AperCQI trigger
- * weight.
- *
- * @details
- *
- * Function : rgSCHUtlUpdACqiTrigWt
- * - If HqFdbk is ACK then add up weight corresponding
- * to ACK to the AcqiTrigWt.
- * - If HqFdbk is NACK then add up weight corresponding
- * to NACK to the AcqiTrigWt.
- * - If AcqiTrigWt crosses threshold then trigger
- * grant req for APERCQI to SCH.
- *
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t isAck
- *
- * @return Void
- **/
-Void rgSCHUtlUpdACqiTrigWt(RgSchUeCb *ue,RgSchUeCellInfo *cellInfo,uint8_t isAck )
-{
-#ifdef LTE_ADV
- uint8_t triggerSet = 0;
- uint8_t sIdx = 0;
-#endif
-
- if (isAck == TFU_HQFDB_ACK)
- {
- cellInfo->acqiCb.aCqiTrigWt += RG_APER_CQI_ACK_WGT;
- }
- else
- {
- cellInfo->acqiCb.aCqiTrigWt += RG_APER_CQI_NACK_WGT;
- }
-
- if (cellInfo->acqiCb.aCqiTrigWt > RG_APER_CQI_THRESHOLD_WGT)
- {
- RgSchCellCb *cell = ue->cell;
- RgSchErrInfo unUsed;
-
- if(ue->dl.reqForCqi)
- {
- /* Already one ACQI trigger procedure is going on
- * which is not yet satisfied. Delaying this request till
- * the previous is getting satisfied*/
- return;
- }
-
- ue->dl.reqForCqi = TRUE;
-#ifdef LTE_ADV
- rgSchCmnSetCqiReqField(cellInfo,ue,&ue->dl.reqForCqi);
- //Reset aCqiTrigWt for all the serving cells for which we have triggered ACQI
- rgSCHTomUtlGetTrigSet(cell, ue, ue->dl.reqForCqi, &triggerSet);
- for (sIdx = 0; sIdx < CM_LTE_MAX_CELLS; sIdx++)
- {
- /* The Aperiodic requested for SCell index sIdx */
- if ((triggerSet >> (7 - sIdx)) & 0x01)
- {
- /* The Aperiodic request for SCell index sIdx */
- ue->cellInfo[sIdx]->acqiCb.aCqiTrigWt = 0;
- }
- }
-
-#endif
- /* Force SCH to send UL grant by indicating fake SR.
- * If this UE already in UL SCH Qs this SR Ind will
- * be ignored */
- rgSCHUtlSrRcvd(cell, ue, cell->crntTime, &unUsed);
- }
-
- return;
-}
-#endif
-
-/**
- * @brief This API is invoked to indicate scheduler of a CRC indication.
- *
- * @details
- *
- * Function : rgSCHUtlHdlUlTransInd
- * This API is invoked to indicate scheduler of a CRC indication.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] CmLteTimingInfo timingInfo
- *
- * @return Void
- **/
-Void rgSCHUtlHdlUlTransInd(RgSchCellCb *cell,RgSchUeCb *ue,CmLteTimingInfo timingInfo)
-{
- cell->sc.apis->rgSCHHdlUlTransInd(cell, ue, timingInfo);
- return;
-}
-#ifdef LTEMAC_SPS
-/**
- * @brief This API is invoked to indicate scheduler of a CRC failure.
- *
- * @details
- *
- * Function : rgSCHUtlHdlCrcInd
- * This API is invoked to indicate CRC to scheduler.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] CmLteTimingInfo timingInfo
- *
- * @return Void
- **/
-Void rgSCHUtlHdlCrcInd(RgSchCellCb *cell,RgSchUeCb *ue,CmLteTimingInfo timingInfo)
-{
- cell->sc.apis->rgSCHUlCrcInd(cell, ue, timingInfo);
- return;
-} /* end of rgSCHUtlHdlCrcFailInd */
-
-/**
- * @brief This API is invoked to indicate scheduler of a CRC failure.
- *
- * @details
- *
- * Function : rgSCHUtlHdlCrcFailInd
- * This API is invoked to indicate CRC failure to scheduler.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] CmLteTimingInfo timingInfo
- *
- * @return Void
- **/
-Void rgSCHUtlHdlCrcFailInd(RgSchCellCb *cell,RgSchUeCb *ue,CmLteTimingInfo timingInfo)
-{
- cell->sc.apis->rgSCHUlCrcFailInd(cell, ue, timingInfo);
- return;
-} /* end of rgSCHUtlHdlCrcFailInd */
-#endif /* LTEMAC_SPS */
-
-\f
-/**
- * @brief This function is a wrapper to call scheduler specific API.
- *
- * @details
- *
- * Function: rgSCHUtlDlProcAddToRetx
- * Purpose: This function adds a HARQ process to retransmission
- * queue. This may be performed when a HARQ ack is
- * unsuccessful.
- *
- * Invoked by: HARQ feedback processing
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchDlHqProc* hqP
- * @return Void
- *
- **/
-Void rgSCHUtlDlProcAddToRetx(RgSchCellCb *cell,RgSchDlHqProcCb *hqP)
-{
- cell->sc.apis->rgSCHDlProcAddToRetx(cell, hqP);
- return;
-}
-
-\f
-/**
- * @brief This function adds a HARQ process TB to transmission
- *
- * @details
- *
- * Function: rgSCHUtlDlHqPTbAddToTx
- * Purpose: This function a HarqProcess TB to the slot
- * list.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSubFrm* subFrm
- * @param[in] RgDlHqProc* hqP
- * @param[in] uint8_t tbIdx
- * @return Void
- *
- **/
-Void rgSCHUtlDlHqPTbAddToTx(RgSchDlSf *subFrm,RgSchDlHqProcCb *hqP,uint8_t tbIdx)
-{
- RgSchUeCb *ue = NULLP;
- RgSchCellCb *cell = hqP->hqE->cell;
- /* CA Dev Start */
- /* Addition of UE to dlSf->ueLst shall be done only to UE's PCell */
- /* ue->cell will always hold PCell information */
- if (NULLP == hqP->hqPSfLnk.node)
- {
- if (hqP->hqE->ue)
- {
- ue = hqP->hqE->ue;
- if(NULLP == ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].dlSfUeLnk.node)
- {
- ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].dlSfUeLnk.node = (PTR)ue;
- cmLListAdd2Tail(&cell->subFrms[subFrm->dlIdx]->ueLst,
- &ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].dlSfUeLnk);
-
- ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].isPuschHarqRecpPres = FALSE;
-
- }
-
- /* Add Hq proc in particular dlIdx List for this UE
- This list will be used while processing feedback*/
- hqP->hqPSfLnk.node = (PTR)hqP;
- cmLListAdd2Tail(&ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].hqPLst,&hqP->hqPSfLnk);
-#ifdef CA_DBG
- {
- uint32_t gSCellSchedCount,gPrimarySchedCount;
- if(RG_SCH_IS_CELL_SEC(hqP->hqE->ue,hqP->hqE->cell))
- {
- gSCellSchedCount++;
- }else
- gPrimarySchedCount++;
- }
-#endif
- }
- else if (hqP->hqE->msg4Proc == hqP)
- {
- /* Msg4 will be scheduled on PCELL only hence add directly to subFrm msg4HqpList */
- hqP->hqPSfLnk.node = (PTR)hqP;
- cmLListAdd2Tail(&subFrm->msg4HqPLst, &hqP->hqPSfLnk);
- }
- }
- else
- {
- ue = hqP->hqE->ue;
- }
- if((ue) && (HQ_TB_WAITING == hqP->tbInfo[tbIdx].state))
-
- {
- ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].totalTbCnt++;
- }
- /*totalTbCnt will hold the total number of TBs across all harq Proc from all
- * cells*/
-
- hqP->subFrm = subFrm;
-
- /* CA Dev End */
- return;
-}
-
-
-\f
-/**
- * @brief This function removes a HARQ process TB from transmission
- *
- * @details
- *
- * Function: rgSCHUtlDlHqPTbRmvFrmTx
- * Purpose: This function removes a HarqProcess TB to the slot
- * list.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSubFrm* subFrm
- * @param[in] RgDlHqProc* hqP
- * @param[in] uint8_t tbIdx
- * @param[in] Bool isRepeting
- * @return Void
- *
- **/
-Void rgSCHUtlDlHqPTbRmvFrmTx(RgSchDlSf *subFrm,RgSchDlHqProcCb *hqP,uint8_t tbIdx,Bool isRepeting)
-{
- RgSchCellCb *cell = NULLP;
- /* Check with TDD */
- if ((isRepeting) &&
- (hqP->hqE->ue->ackNakRepCb.cfgRepCnt !=
- hqP->tbInfo[tbIdx].fbkRepCntr))
- {
- cmLListDelFrm(&subFrm->ackNakRepQ,
- &hqP->tbInfo[tbIdx].anRepLnk[hqP->tbInfo[tbIdx].fbkRepCntr]);
- }
- else
- {
- if (NULLP != hqP->hqPSfLnk.node)
- {
- /* CA dev Start */
- if (hqP->hqE->msg4Proc == hqP)
- {
- /* Msg4 will be scheduled on PCELL only hence delete directly from subFrm msg4HqpList */
- cmLListDelFrm(&subFrm->msg4HqPLst, &hqP->hqPSfLnk);
- }
- else
- {
- cell = hqP->hqE->cell;
- /* Addition of UE to dlSf->ueLst shall be done only to UE's PCell */
- /* ue->cell will always hold PCell information */
- cmLListDelFrm(&hqP->hqE->ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].hqPLst,&hqP->hqPSfLnk);
- if (0 == hqP->hqE->ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].hqPLst.count)
- {
-
- cmLListDelFrm(&cell->subFrms[subFrm->dlIdx]->ueLst,
- &hqP->hqE->ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].dlSfUeLnk);
- hqP->hqE->ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].dlSfUeLnk.node = (PTR)NULLP;
- hqP->hqE->ue->dl.dlSfHqInfo[cell->cellId][subFrm->dlIdx].totalTbCnt = 0;
- }
- }
- hqP->hqPSfLnk.node = NULLP;
- }
- hqP->subFrm = NULLP;
- }
- return;
-}
-
-#ifdef LTE_ADV
-/**
- * @brief Handler for accessing the existing SCellCb identified by the key
- * SCellId under the CellCb.
- *
- * @details
- *
- * Function : rgSchUtlGetCellCb
- *
- *
- * @param[in] *cellCb
- * @param[in] ueId
- * @return RgSchUeCb*
- **/
-RgSchCellCb* rgSchUtlGetCellCb(Inst inst,uint16_t cellId)
-{
- RgSchCellCb *cellCb = NULLP;
- uint8_t strtCellId;
- strtCellId = rgSchCb[inst].genCfg.startCellId;
- cellCb = rgSchCb[inst].cells[cellId - strtCellId];
-
- return (cellCb);
-
-} /* rgSchUtlGetCellCb */
-
-/**
- * @brief Handler for deriving the servCellidx
- *
- * @details
- *
- * Function : rgSchUtlGetServCellIdx
- *
- *
- * @param[in] *cellId
- * @param[in] RgSchUeCb *ue
- * @return uint8_t servCellIdx
- **/
-uint8_t rgSchUtlGetServCellIdx(Inst inst, uint16_t cellId, RgSchUeCb *ue)
-{
- uint8_t servCellIdx;
- uint16_t strtCellId;
-
- strtCellId = rgSchCb[inst].genCfg.startCellId;
- servCellIdx = ue->cellIdToCellIdxMap[cellId - strtCellId];
- return (servCellIdx);
-
-} /* rgSchUtlGetCellCb */
-
-/**
- * @brief Handler for validating the Cell Id received secondary Cell Addition
- *
- * @details
- *
- * Function : rgSchUtlGetCellId
- *
- *
- * @param[in] *cellCb
- * @param[in] ueId
- * @return RgSchUeCb*
- **/
-S16 rgSchUtlVldtCellId(Inst inst,uint16_t cellId)
-{
- uint8_t strtCellId;
-
- strtCellId = rgSchCb[inst].genCfg.startCellId;
- if((cellId >= strtCellId) && ((cellId - strtCellId) < CM_LTE_MAX_CELLS))
- {
- return ROK;
- }
- return RFAILED;
-} /* rgSchUtlVldtCellId */
-
-#endif /* LTE_ADV*/
-/**
- * @brief UE reconfiguration for scheduler
- *
- * @details
- *
- * Function : rgSCHUtlRgrUeRecfg
- *
- * This functions updates UE specific scheduler
- * information upon UE reconfiguration
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[int] RgrUeRecfg *ueRecfg
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHUtlRgrUeRecfg(RgSchCellCb *cell,RgSchUeCb *ue,RgrUeRecfg *ueRecfg,RgSchErrInfo *err)
-{
-/* Changes for UE Category Reconfiguration feature addition */
- RgSchCmnUe *ueSch = RG_SCH_CMN_GET_UE(ue, cell);
-
- /* Changes for UE Category Reconfiguration feature addition */
- if (ueRecfg->ueRecfgTypes & RGR_UE_UECAT_RECFG)
- {
- ueSch->cmn.ueCat = ueRecfg->ueCatEnum-1;
-#ifdef TFU_UPGRADE
- ue->ueCatEnum = ueRecfg->ueCatEnum;
-#endif
- }
-
- /* DL MU-MIMO not supported */
- if (ueRecfg->ueRecfgTypes & RGR_UE_TXMODE_RECFG)
- {
-
- if (ueRecfg->txMode.pres == PRSNT_NODEF)
- {
- if (ueRecfg->txMode.txModeEnum == RGR_UE_TM_5)
- {
- err->errCause = RGSCHERR_SCH_CFG;
- return RFAILED;
- }
-#ifdef LTE_ADV
- if(ue->mimoInfo.txMode != ueRecfg->txMode.txModeEnum)
- {
- /* Decremnt the previos A value for this cell */
- ue->f1bCsAVal -= rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode);
- /* Update A value with the new TM Mode */
- ue->f1bCsAVal += rgSCHUtlGetMaxTbSupp(ueRecfg->txMode.txModeEnum);
-
-
- DU_LOG("\nINFO --> SCH : UeReCfg A valie is %d\n",ue->f1bCsAVal);
- }
-#endif
- ue->mimoInfo.txMode = ueRecfg->txMode.txModeEnum;
- }
- }
-#ifdef TFU_UPGRADE
- /* [ccpu00123958]-ADD- Check for PUSCH related Reconfig from the bit mask */
- if(ueRecfg->ueRecfgTypes & RGR_UE_PUSCH_RECFG)
- {
- /* Fix: ccpu00124012 */
- /* TODO:: Need to check if this is
- mandatory to be re-configured on UE category re-configuration */
- /* ue->ul.betaHqOffst = ueRecfg->puschDedCfg.bACKIdx;
- ue->ul.betaCqiOffst = ueRecfg->puschDedCfg.bCQIIdx;
- ue->ul.betaRiOffst = ueRecfg->puschDedCfg.bRIIdx;*/
- }
-#endif
- if (ueRecfg->ueRecfgTypes & RGR_UE_ULTXANTSEL_RECFG)
- {
- ue->ul.ulTxAntSel = ueRecfg->ulTxAntSel;
- }
- if (ueRecfg->ueRecfgTypes & RGR_UE_CDBKSBST_RECFG)
- {
- ue->mimoInfo.cdbkSbstRstrctn = ueRecfg->ueCodeBookRstRecfg;
- }
-
- /* Commenting here to assign garbage value when it is not set in APP. */
- //ue->accessStratumRls = ueRecfg->accessStratumRls;
- return (cell->sc.apis->rgSCHRgrUeRecfg(cell, ue, ueRecfg, err));
-} /* rgSCHUtlRgrUeRecfg */
-
-/**
- * @brief This function deletes a service from scheduler
- *
- * @details
- *
- * Function: rgSCHUtlFreeDlLc
- * Purpose: This function is made available through a FP for
- * making scheduler aware of a service being deleted from UE
- *
- * Invoked by: BO and Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @param[in] RgSchDlLcCb* svc
- * @return Void
- **/
-Void rgSCHUtlFreeDlLc(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *svc)
-{
- cell->sc.apis->rgSCHFreeDlLc(cell, ue, svc);
-
- /* Stack Crash problem for TRACE5 changes. added the return below . */
- return;
-
-}
-
-/**
- * @brief UE deletion for scheduler
- *
- * @details
- *
- * Function : rgSCHUtlFreeUe
- *
- * This functions deletes all scheduler information
- * pertaining to a UE
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-Void rgSCHUtlFreeUe(RgSchCellCb *cell,RgSchUeCb *ue)
-{
-#ifdef LTE_TDD
- rgSCHUtlDelUeANFdbkInfo(ue,RGSCH_PCELL_INDEX);
-#endif
- cell->sc.apis->rgSCHFreeUe(cell, ue);
-
- /* Stack Crash problem for TRACE5 changes. added the return below . */
- return;
-
-} /* rgSCHUtlFreeUe */
-
-/**
- * @brief This function updates the scheduler with service for a UE
- *
- * @details
- *
- * Function: rgSCHUtlDlDedBoUpd
- * Purpose: This function should be called whenever there is a
- * change BO for a service.
- *
- * Invoked by: BO and Scheduler
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSchUeCb* ue
- * @param[in] RgSchDlLcCb* lc
- * @return Void
- **/
-Void rgSCHUtlDlDedBoUpd(RgSchCellCb *cell,RgSchUeCb *ue,RgSchDlLcCb *lc)
-{
- cell->sc.apis->rgSCHDlDedBoUpd(cell, ue, lc);
- return;
-}
-/**
- * @brief Record MSG3 allocation into the UE
- *
- * @details
- *
- * Function : rgSCHUtlRecMsg3Alloc
- *
- * This function is invoked to update record msg3 allocation information
- * in the UE when UE is detected for RaCb
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] RgSchRaCb *raCb
- *
- **/
-Void rgSCHUtlRecMsg3Alloc(RgSchCellCb *cell,RgSchUeCb *ue,RgSchRaCb *raCb)
-{
- cell->sc.apis->rgSCHUlRecMsg3Alloc(cell, ue, raCb);
- return;
-
-} /* rgSCHRecMsg3Alloc */
-
-#ifdef RG_UNUSED
-/**
- * @brief Update harq process for allocation
- *
- * @details
- *
- * Function : rgSCHUtlUpdUlHqProc
- *
- * This function is invoked when harq process
- * control block is now in a new memory location
- * thus requiring a pointer/reference update.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUlHqProcCb *curProc
- * @param[in] RgSchUlHqProcCb *oldProc
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHUtlUpdUlHqProc(RgSchCellCb *cell,RgSchUlHqProcCb *curProc,RgSchUlHqProcCb *oldProc)
-{
- return (cell->sc.apis->rgSCHUpdUlHqProc(cell, curProc, oldProc));
-} /* rgSCHUtlUpdUlHqProc */
-#endif
-/**
- * @brief UL grant for contention resolution
- *
- * @details
- *
- * Function : rgSCHUtlContResUlGrant
- *
- * Add UE to another queue specifically for CRNTI based contention
- * resolution
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHUtlContResUlGrant(RgSchCellCb *cell,RgSchUeCb *ue,RgSchErrInfo *err)
-{
-
- ue->isMsg4PdcchWithCrnti = TRUE;
- return (cell->sc.apis->rgSCHContResUlGrant(cell, ue, err));
-} /* rgSCHUtlContResUlGrant */
-
-/**
- * @brief SR reception handling
- *
- * @details
- *
- * Function : rgSCHUtlSrRcvd
- *
- * - Handles SR reception for UE
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHUtlSrRcvd(RgSchCellCb *cell,RgSchUeCb *ue,CmLteTimingInfo frm,RgSchErrInfo *err)
-{
- return (cell->sc.apis->rgSCHSrRcvd(cell, ue, frm, err));
-} /* rgSCHUtlSrRcvd */
-
-/**
- * @brief Short BSR update
- *
- * @details
- *
- * Function : rgSCHUtlUpdBsrShort
- *
- * This functions does requisite updates to handle short BSR reporting
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t lcgId
- * @param[in] uint8_t bsr
- * @param[out] RgSchErrInfo *err
- * @return Void
- * -# ROK
- * -# RFAILED
- **/
-Void rgSCHUtlUpdBsrShort(RgSchCellCb *cell,RgSchUeCb *ue,uint8_t lcgId,uint8_t bsr,RgSchErrInfo *err)
-{
- cell->sc.apis->rgSCHUpdBsrShort(cell, ue, &ue->ul.lcgArr[lcgId], bsr, err);
- return;
-} /* rgSCHUtlUpdBsrShort */
-
-
-/**
- * @brief Truncated BSR update
- *
- * @details
- *
- * Function : rgSCHUtlUpdBsrTrunc
- *
- * This functions does required updates to handle truncated BSR report
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t lcgId
- * @param[in] uint8_t bsr
- * @param[out] RgSchErrInfo *err
- * @return Void
- * -# ROK
- * -# RFAILED
- **/
-Void rgSCHUtlUpdBsrTrunc(RgSchCellCb *cell,RgSchUeCb *ue,uint8_t lcgId,uint8_t bsr,RgSchErrInfo *err)
-{
- cell->sc.apis->rgSCHUpdBsrTrunc(cell, ue, &ue->ul.lcgArr[lcgId], bsr, err);
- return;
-} /* rgSCHUtlUpdBsrTrunc */
-
-
-/**
- * @brief Long BSR update
- *
- * @details
- *
- * Function : rgSCHUtlUpdBsrLong
- *
- * - Update BSRs for all configured LCGs
- * - Update priority of LCGs if needed
- * - Update UE's position within/across uplink scheduling queues
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t bsr0
- * @param[in] uint8_t bsr1
- * @param[in] uint8_t bsr2
- * @param[in] uint8_t bsr3
- * @param[out] RgSchErrInfo *err
- * @return Void
- * -# ROK
- * -# RFAILED
- **/
-Void rgSCHUtlUpdBsrLong(RgSchCellCb *cell,RgSchUeCb *ue,uint8_t bsr0,uint8_t bsr1,uint8_t bsr2,uint8_t bsr3,RgSchErrInfo *err)
-{
- uint8_t bsArr[4];
- bsArr[0] = bsr0;
- bsArr[1] = bsr1;
- bsArr[2] = bsr2;
- bsArr[3] = bsr3;
- cell->sc.apis->rgSCHUpdBsrLong(cell, ue, bsArr, err);
- return;
-} /* rgSCHUtlUpdBsrLong */
-
-/**
- * @brief EXT PHR update
- *
- * @details
- *
- * Function : rgSCHUtlUpdExtPhr
- *
- * Updates extended power headroom info for a UE
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t phr
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHUtlUpdExtPhr(RgSchCellCb *cell,RgSchUeCb *ue,RgInfExtPhrCEInfo *extPhr,RgSchErrInfo *err)
-{
- return (cell->sc.apis->rgSCHUpdExtPhr(cell, ue, extPhr, err));
-} /* rgSCHUtlUpdExtPhr */
-
-
-
-/**
- * @brief PHR update
- *
- * @details
- *
- * Function : rgSCHUtlUpdPhr
- *
- * Updates power headroom info for a UE
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t phr
- * @param[out] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHUtlUpdPhr(RgSchCellCb *cell,RgSchUeCb *ue,uint8_t phr,RgSchErrInfo *err)
-{
- return (cell->sc.apis->rgSCHUpdPhr(cell, ue, phr, err));
-} /* rgSCHUtlUpdPhr */
-
-
-/**
- * @brief Indication of UL CQI
- *
- * @details
- *
- * Function : rgSCHUtlUlCqiInd
- *
- * - Updates uplink CQI information for the UE. Computes and
- * stores the lowest CQI of CQIs reported in all subbands
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] TfuUlCqiRpt *ulCqiInfo
- * @return Void
- **/
-Void rgSCHUtlUlCqiInd(RgSchCellCb *cell,RgSchUeCb *ue,TfuUlCqiRpt *ulCqiInfo)
-{
- cell->sc.apis->rgSCHUlCqiInd(cell, ue, ulCqiInfo);
- return;
-} /* rgSCHUtlUlCqiInd */
-
-/**
- * @brief Indication of PUCCH power adjustment
- *
- * @details
- *
- * Function : rgSCHUtlPucchDeltaPwrInd
- *
- * - Updates uplink CQI information for the UE. Computes and
- * stores the lowest CQI of CQIs reported in all subbands
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint8_t delta
- * @return Void
- **/
-Void rgSCHUtlPucchDeltaPwrInd(RgSchCellCb *cell,RgSchUeCb *ue,S8 delta)
-{
- cell->sc.apis->rgSCHPucchDeltaPwrInd(cell, ue, delta);
- return;
-} /* rgSCHUtlPucchDeltaPwrInd */
-
-/* Start: LTEMAC_2.1_DEV_CFG */
-/**
- * @brief Ue Reset Request
- *
- * @details
- *
- * Function : rgSCHUtlUeReset
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return S16
- **/
-Void rgSCHUtlUeReset(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- ue->remBoCnt = 0;
- cell->sc.apis->rgSCHUeReset(cell, ue);
- return;
-} /* rgSCHUtlUeReset */
-/* End: LTEMAC_2.1_DEV_CFG */
-
-/**
- * @brief Returns HARQ proc for which data expected now
- *
- * @details
- *
- * Function: rgSCHUtlUlHqProcForUe
- * Purpose: This function returns the harq process for
- * which data is expected in the current slot.
- * It does not validate if the HARQ process
- * has an allocation.
- *
- * Invoked by: TOM
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] CmLteTimingInfo frm
- * @param[in] RgSchUeCb *ue
- * @param[out] RgSchUlHqProcCb **procRef
- * @return Void
- **/
-Void rgSCHUtlUlHqProcForUe(RgSchCellCb *cell,CmLteTimingInfo frm,RgSchUeCb *ue,RgSchUlHqProcCb **procRef)
-{
- cell->sc.apis->rgSCHUlHqProcForUe(cell, frm, ue, procRef);
-
- /* Stack Crash problems for TRACE5 changes. added the return below */
- return;
-
-}
-
-/**
- * @brief Returns first uplink allocation to send reception
- * request to PHY
- *
- * @details
- *
- * Function: rgSCHUtlFirstRcptnReq(cell)
- * Purpose: This function returns the first uplink allocation
- * (or NULLP if there is none) in the slot
- * in which is expected to prepare and send reception
- * request to PHY.
- *
- * Invoked by: TOM
- *
- * @param[in] RgSchCellCb *cell
- * @return RgSchUlAlloc*
- **/
-RgSchUlAlloc *rgSCHUtlFirstRcptnReq(RgSchCellCb *cell)
-{
- return (cell->sc.apis->rgSCHFirstRcptnReq(cell));
-}
-
-/**
- * @brief Returns first uplink allocation to send reception
- * request to PHY
- *
- * @details
- *
- * Function: rgSCHUtlNextRcptnReq(cell)
- * Purpose: This function returns the next uplink allocation
- * (or NULLP if there is none) in the slot
- * in which is expected to prepare and send reception
- * request to PHY.
- *
- * Invoked by: TOM
- *
- * @param[in] RgSchCellCb *cell
- * @return RgSchUlAlloc*
- **/
-RgSchUlAlloc *rgSCHUtlNextRcptnReq(RgSchCellCb *cell,RgSchUlAlloc *alloc)
-{
- return (cell->sc.apis->rgSCHNextRcptnReq(cell, alloc));
-}
-
-/**
- * @brief Returns first uplink allocation to send HARQ feedback
- * request to PHY
- *
- * @details
- *
- * Function: rgSCHUtlFirstHqFdbkAlloc
- * Purpose: This function returns the first uplink allocation
- * (or NULLP if there is none) in the slot
- * in which it is expected to prepare and send HARQ
- * feedback to PHY.
- *
- * Invoked by: TOM
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] uint8_t idx
- * @return RgSchUlAlloc*
- **/
-RgSchUlAlloc *rgSCHUtlFirstHqFdbkAlloc(RgSchCellCb *cell,uint8_t idx)
-{
- return (cell->sc.apis->rgSCHFirstHqFdbkAlloc(cell, idx));
-}
-
-\f
-/**
- * @brief Returns next allocation to send HARQ feedback for
- *
- * @details
- *
- * Function: rgSCHUtlNextHqFdbkAlloc(cell)
- * Purpose: This function returns the next uplink allocation
- * (or NULLP if there is none) in the slot
- * for which HARQ feedback needs to be sent.
- *
- * Invoked by: TOM
- *
- * @param[in] RgSchCellCb *cell
- * @return RgSchUlAlloc*
- **/
-RgSchUlAlloc *rgSCHUtlNextHqFdbkAlloc(RgSchCellCb *cell,RgSchUlAlloc *alloc,uint8_t idx)
-{
- return (cell->sc.apis->rgSCHNextHqFdbkAlloc(cell, alloc, idx));
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlResetSfAlloc
- *
- * Desc : Utility Function to Reset slot allocation information.
- *
- *
- * Ret : ROK
- * RFAILED
- *
- *
- * File : rg_utl.c
- *
- **********************************************************/
-S16 rgSCHUtlResetSfAlloc(RgInfSfAlloc *sfAlloc,Bool resetCmnLcInfo,Bool restAlloc)
-{
- if(TRUE == restAlloc)
- {
- if(sfAlloc->ueInfo.numUes)
- {
- memset(sfAlloc->ueInfo.allocInfo,0x00,
- (sizeof(RgInfUeAlloc)*sfAlloc->ueInfo.numUes));
- }
- sfAlloc->ueInfo.numUes = 0;
- sfAlloc->rarInfo.numRaRntis = 0;
- sfAlloc->flowCntrlInfo.numUes = 0;
- }
- if(TRUE == resetCmnLcInfo)
- {
- sfAlloc->cmnLcInfo.bitMask = 0;
- }
- return ROK;
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlGetRlsHqAlloc
- *
- * Desc : Utility Function to Allocate slot allocation information.
- *
- *
- * Ret : ROK
- * RFAILED
- *
- *
- * File : rg_utl.c
- *
- **********************************************************/
-S16 rgSCHUtlGetRlsHqAlloc(RgSchCellCb *cell)
-{
- uint8_t idx = 0;
- Inst inst = cell->instIdx;
- for(idx=0; idx < RGSCH_NUM_SUB_FRAMES; idx++)
- {
- cell->rlsHqArr[idx].cellId = cell->cellId;
-
- /* Allocating with additional location, to accommodate
- TA scheduling along with maximum no of UEs per SF */
-
- /* Allocate memory for "scheduled UE" Info */
- if((rgSCHUtlAllocSBuf(inst,
- (Data**)&(cell->rlsHqArr[idx].ueHqInfo),
- (sizeof(RgInfUeHqInfo)*RGSCH_MAX_UE_PER_DL_SF))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED for "
- "UE Alloc");
- return RFAILED;
- }
- }
-
- return ROK;
-
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlPutRlsHqAlloc
- *
- * Desc : Utility Function to deallocate slot allocation information.
- *
- *
- * Ret : ROK
- * RFAILED
- *
- *
- * File : rg_utl.c
- *
- **********************************************************/
-S16 rgSCHUtlPutRlsHqAlloc(RgSchCellCb *cell)
-{
- uint8_t idx = 0;
- Inst inst = cell->instIdx;
-
- for(idx=0; idx < RGSCH_NUM_SUB_FRAMES; idx++)
- {
- /* Deallocate memory for "scheduled UE" Info */
- if (cell->rlsHqArr[idx].ueHqInfo != NULLP)
- {
- /* Freeing with additional location, to accommodate TA
- scheduling along with maximum no of UEs per SF */
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(inst,
- (Data **)(&(cell->rlsHqArr[idx].ueHqInfo)),
- (sizeof(RgInfUeHqInfo)*RGSCH_MAX_UE_PER_DL_SF));
- }
- }
-
- return ROK;
-
-}
-
-
-/***********************************************************
- *
- * Func : rgSCHUtlGetSfAlloc
- *
- * Desc : Utility Function to Allocate slot allocation information.
- *
- *
- * Ret : ROK
- * RFAILED
- *
- *
- * File : rg_utl.c
- *
- **********************************************************/
-S16 rgSCHUtlGetSfAlloc(RgSchCellCb *cell)
-{
- uint8_t idx;
- uint8_t indx;
- Inst inst = cell->instIdx;
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
-
-#ifdef LTE_TDD
- for(idx=0; idx < RGSCH_SF_ALLOC_SIZE; idx++)
-#else
- for(idx=0; idx < RGSCH_NUM_SUB_FRAMES; idx++)
-#endif
- {
- cell->sfAllocArr[idx].cellId = cell->cellId;
-
- /* Allocating with additional location, to accommodate
- TA scheduling along with maximum no of UEs per SF */
-
- /* Allocate memory for "scheduled UE" Info */
- if((rgSCHUtlAllocSBuf(inst,
- (Data**)&(cell->sfAllocArr[idx].ueInfo.allocInfo),
- (sizeof(RgInfUeAlloc)*RGSCH_MAX_UE_PER_DL_SF))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED for "
- "UE Alloc");
- return RFAILED;
- }
-
- /* Allocate memory for "scheduled RAR" Info */
- if((rgSCHUtlAllocSBuf(inst,
- (Data**)&(cell->sfAllocArr[idx].rarInfo.raRntiInfo),
- (sizeof(RgInfRaRntiInfo)*RGSCH_MAX_RARNTI_PER_DL_SF))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED for "
- "RARNTI");
- return RFAILED;
- }
- for(indx = 0; indx < RGSCH_MAX_RARNTI_PER_DL_SF; indx++)
- {
- if((rgSCHUtlAllocSBuf(inst,
- (Data**)&(cell->sfAllocArr[idx].rarInfo.raRntiInfo[indx].crntiInfo),
- (sizeof(RgInfCrntiInfo)* (cellUl->maxMsg3PerUlSf)))) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Memory allocation FAILED for "
- "RNTI");
- return RFAILED;
- }
- }
-
- }
-
-#ifdef EMTC_ENABLE
- rgSCHEmtcUtlGetSfAlloc(cell);
-#endif
-
- return ROK;
-
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlPutSfAlloc
- *
- * Desc : Utility Function to deallocate slot allocation information.
- *
- *
- * Ret : ROK
- * RFAILED
- *
- *
- * File : rg_utl.c
- *
- **********************************************************/
-S16 rgSCHUtlPutSfAlloc(RgSchCellCb *cell)
-{
- uint8_t idx;
- uint8_t indx;
- Inst inst = cell->instIdx;
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
-
-#ifdef LTE_TDD
- for(idx=0; idx < RGSCH_SF_ALLOC_SIZE; idx++)
-#else
- for(idx=0; idx < RGSCH_NUM_SUB_FRAMES; idx++)
-#endif
- {
- if (cell->sfAllocArr[idx].rarInfo.raRntiInfo != NULLP)
- {
- for(indx = 0; indx < RGSCH_MAX_RARNTI_PER_DL_SF; indx++)
- {
- if (cell->sfAllocArr[idx].rarInfo.raRntiInfo[indx].crntiInfo != NULLP)
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(inst,
- (Data**)(&(cell->sfAllocArr[idx].rarInfo.raRntiInfo[indx].\
- crntiInfo)),
- (sizeof(RgInfCrntiInfo)* (cellUl->maxMsg3PerUlSf)));
- }
- /* Deallocate memory for "scheduled RAR" Info */
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(inst,
- (Data**)(&(cell->sfAllocArr[idx].rarInfo.raRntiInfo)),
- (sizeof(RgInfRaRntiInfo)*RGSCH_MAX_RARNTI_PER_DL_SF));
- }
- /* Deallocate memory for "scheduled UE" Info */
- if (cell->sfAllocArr[idx].ueInfo.allocInfo != NULLP)
- {
- /* Freeing with additional location, to accommodate TA
- scheduling along with maximum no of UEs per SF */
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(inst,
- (Data**)(&(cell->sfAllocArr[idx].ueInfo.allocInfo)),
- (sizeof(RgInfUeAlloc)*RGSCH_MAX_UE_PER_DL_SF));
- }
- }
-
-#ifdef EMTC_ENABLE
- rgSCHEmtcUtlPutSfAlloc(cell);
-#endif
- return ROK;
-
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlAllocSBuf
- *
- * Desc : Utility Function to Allocate static buffer.
- * Memory allocated is assumed contiguous.
- *
- *
- * Ret : ROK
- * RFAILED
- *
- * Notes: Caller doesnt need to raise the alarm in case of memory
- * allocation gets failed.
- *
- * File : rg_utl.c
- *
- **********************************************************/
-S16 rgSCHUtlAllocSBuf
-(
-Inst inst, /* Instance of the invoking scheduler */
-Data **pData, /* Pointer of the data to be returned */
-Size size /* size */
-)
-{
- /* Moving alarm diagnostics to available scope */
-
- /* Initialize the param to NULLP */
- *pData = NULLP;
-
- /* May not be necessary for data performance path */
-#ifndef NO_ERRCLS
- if (size == 0)
- {
- return RFAILED;
- }
-#endif
-
- /* allocate buffer */
-#ifdef MS_MBUF_CORRUPTION /* Should be enabled when debugging mbuf corruption */
- MS_BUF_ADD_ALLOC_CALLER();
-#endif /* */
- SCH_ALLOC(pData, size);
- if(pData == NULLP)
- {
- RgUstaDgn dgn; /* Alarm diagnostics structure */
- dgn.type = LRG_USTA_DGNVAL_MEM;
- dgn.u.mem.region = rgSchCb[inst].rgSchInit.region;
- dgn.u.mem.pool = rgSchCb[inst].rgSchInit.pool;
- /* Send an alarm to Layer Manager */
- rgSCHLmmStaInd(inst, LCM_CATEGORY_RESOURCE, LCM_EVENT_SMEM_ALLOC_FAIL,
- LCM_CAUSE_MEM_ALLOC_FAIL, &dgn);
- DU_LOG("\nERROR --> SCH : Unable to Allocate the Buffer");
- return RFAILED;
- }
-
-
- /* zero out the allocated memory */
- memset(*pData, 0x00, size);
-
- return ROK;
-
-} /* end of rgSCHUtlAllocSBuf */
-
-\f
-/*
-*
-* Fun: rgSCHUtlFreeSBuf
-*
-* Desc: The argument to rgSCHUtlFreeSBuf() is a pointer to a block
-* previously allocated by rgSCHUtlAllocSBuf() and size. It
-* deallocates the memory.
-*
-* Ret: void
-*
-* Notes: None
-* File: rg_utl.c
-*/
-Void rgSCHUtlFreeSBuf
-(
-Inst inst, /* Instance of the invoking scheduler */
-Data **data, /* pointer to data */
-Size size /* size */
-)
-{
-
- if ((data == NULLP) || (*data == NULLP) || (size == 0))
- {
- return;
- }
-
-
-#ifdef MS_MBUF_CORRUPTION /* Should be enabled when debugging mbuf corruption */
- MS_BUF_ADD_CALLER();
-#endif /* */
- /* Deallocate buffer */
- SCH_FREE((*data), size);
-
- if (data ==NULLP)
- {
- DU_LOG("\nERROR --> SCH : rgSCHUtlFreeSBuf failed");
- return;
- }
-
- /* ccpu00117052 - ADD - Assigning the pointer to NULLP */
- *data = NULLP;
-
- return;
-} /* end of rgSCHUtlFreeSBuf */
-
-\f
-#ifdef RGR_SI_SCH
-/*
-*
-* Fun: rgSCHUtlFreeWarningSiSeg
-*
-* Desc: This is used to deallocate Warning SI Seg.
-*
-* Ret: void
-*
-* Notes: None
-*
-* File: rg_utl.c
-*/
-Void rgSCHUtlFreeWarningSiSeg(Region reg,Pool pool,CmLListCp *siPduLst)
-{
- CmLList *node;
- Buffer *pdu;
-
- while (siPduLst->first != NULLP)
- {
- node = siPduLst->first;
- pdu = (Buffer *)node->node;
- cmLListDelFrm(siPduLst, node);
- RGSCH_FREE_MSG(pdu);
- SCH_FREE(node,sizeof(CmLList));
- node = NULLP;
- }
-
- return;
-} /* end of rgSCHUtlFreeWarningSiSeg */
-
-\f
-/*
-*
-* Fun: rgSCHUtlFreeWarningSiPdu
-*
-* Desc: This is used to deallocate Warning SI PDU.
-*
-* Ret: void
-*
-* Notes: None
-*
-* File: rg_utl.c
-*/
-Void rgSCHUtlFreeWarningSiPdu(RgSchCellCb *cell)
-{
- CmLList *node;
- Buffer *pdu;
- RgSchWarningSiInfo *warningSi;
- RgSchWarningSiPdu *warningSiPdu;
-
- warningSi = (RgSchWarningSiInfo *) cell->siCb.\
- siArray[cell->siCb.siCtx.siId-1].si;
- /* ccpu00136659: CMAS ETWS design changes */
- CM_LLIST_FIRST_NODE(&warningSi->warningSiMsg.segLstCp, node);
- if (node == NULLP)
- {
- return;
- }
-
- warningSiPdu = (RgSchWarningSiPdu *)node->node;
- pdu = warningSiPdu->pdu;
- /* ccpu00136659: CMAS ETWS design changes */
- cmLListDelFrm(&warningSi->warningSiMsg.segLstCp, node);
- RGSCH_FREE_MSG(pdu);
- if(warningSi->warningSiMsg.segLstCp.count == 0)
- {
- /* ccpu00136659: CMAS ETWS design changes */
- cell->siCb.siArray[cell->siCb.siCtx.siId-1].si = NULLP;
- rgSCHUtlRgrWarningSiCfgCfm(cell->instIdx,
- rgSchCb[cell->instIdx].rgrSap->sapCfg.spId,
- cell->siCb.warningSi[warningSi->idx].siId,
- warningSi->warningSiMsg.transId, RGR_CFG_CFM_TX_COMPLETE);
- }
-
- return;
-
-} /* end of rgSCHUtlFreeWarningSiPdu */
-
-\f
-/*
-*
-* Fun: rgSCHUtlGetWarningSiPdu
-*
-* Desc: This is used to get Warning SI PDU for Scheduling.
-*
-* Ret:
-*
-* Notes: None
-*
-* File: rg_utl.c
-*/
-Buffer *rgSCHUtlGetWarningSiPdu(RgSchCellCb *cell)
-{
- RgSchWarningSiInfo *warningSi;
- RgSchWarningSiPdu *warningSiPdu;
- Buffer *pdu;
- CmLList *node;
-
- warningSi = (RgSchWarningSiInfo *) cell->siCb.
- siArray[cell->siCb.siCtx.siId-1].si;
- /* ccpu00136659: CMAS ETWS design changes */
- CM_LLIST_FIRST_NODE(&warningSi->warningSiMsg.segLstCp, node);
- if (node != NULLP)
- {
- warningSiPdu = (RgSchWarningSiPdu *)node->node;
- pdu = warningSiPdu->pdu;
- return (pdu);
- }
- else
- {
- return (NULLP);
- }
-} /* rgSCHUtlGetWarningSiPdu */
-
-\f
-/*
-*
-* Fun: rgSCHUtlGetMcsAndNPrb
-*
-* Desc: This is used to get mcs and nPrb value.
-*
-* Ret:
-*
-* Notes: None
-*
-* File: rg_utl.c
-*/
-S16 rgSCHUtlGetMcsAndNPrb(RgSchCellCb *cell,uint8_t *nPrb,uint8_t *mcs,MsgLen *msgLen)
-{
- RgSchWarningSiInfo *warningSi;
- RgSchWarningSiPdu *warningSiPdu;
- CmLList *node;
-
- if(cell->siCb.siCtx.warningSiFlag == FALSE)
- {
- *mcs = cell->siCb.crntSiInfo.siInfo[cell->siCb.siCtx.siId-1].mcs;
- *nPrb = cell->siCb.crntSiInfo.siInfo[cell->siCb.siCtx.siId-1].nPrb;
- *msgLen = cell->siCb.crntSiInfo.siInfo[cell->siCb.siCtx.siId-1].msgLen;
- }
- else
- {
- warningSi = (RgSchWarningSiInfo *) cell->siCb.
- siArray[cell->siCb.siCtx.siId-1].si;
- /* ccpu00136659: CMAS ETWS design changes */
- CM_LLIST_FIRST_NODE(&warningSi->warningSiMsg.segLstCp, node);
- if (node == NULLP)
- {
- return RFAILED;
- }
-
- warningSiPdu = (RgSchWarningSiPdu *)node->node;
- *mcs = warningSiPdu->mcs;
- *nPrb = warningSiPdu->nPrb;
- *msgLen = warningSiPdu->msgLen;
- return ROK;
-
- }
- return ROK;
-} /* rgSCHUtlGetMcsAndNPrb */
-
-/*
-*
-* Fun: rgSCHUtlCalMacAndPrb
-*
-* Desc: This is used to Calculate mcs and nPrb value for SIB1 and SIs.
-*
-* Ret:
-*
-* Notes: None
-*
-* File: rg_utl.c
-*/
-S16 rgSCHUtlCalMcsAndNPrb(RgSchCellCb *cell,uint8_t cfgType,MsgLen msgLen,uint8_t siId)
-{
- uint8_t mcs = 0;
- uint8_t nPrb = 0;
-
- /*Get the nPrb and mcs parametr values */
- if (rgSCHUtlGetAllwdCchTbSz(msgLen*8, &nPrb, &mcs) != (msgLen*8))
- {
- DU_LOG("\nERROR --> SCH : msgLen does "
- "not match any valid TB Size");
- return RFAILED;
- }
-
-
- if(cfgType == RGR_SI_CFG_TYPE_SIB1 || cfgType == RGR_SI_CFG_TYPE_SIB1_PWS)
- {
-
- if(cell->siCb.crntSiInfo.sib1Info.sib1 == NULLP)
- {
- cell->siCb.crntSiInfo.sib1Info.mcs = mcs;
- cell->siCb.crntSiInfo.sib1Info.nPrb = nPrb;
- cell->siCb.crntSiInfo.sib1Info.msgLen = msgLen;
- }
- else
- {
- cell->siCb.newSiInfo.sib1Info.mcs = mcs;
- cell->siCb.newSiInfo.sib1Info.nPrb= nPrb;
- cell->siCb.newSiInfo.sib1Info.msgLen = msgLen;
- }
- }
-
-
- if(cfgType == RGR_SI_CFG_TYPE_SI)
- {
- if(cell->siCb.crntSiInfo.siInfo[siId-1].si == NULLP &&
- !(cell->siCb.siBitMask & RGSCH_SI_SICFG_UPD))
- {
- cell->siCb.crntSiInfo.siInfo[siId-1].mcs = mcs;
- cell->siCb.crntSiInfo.siInfo[siId-1].nPrb = nPrb;
- cell->siCb.crntSiInfo.siInfo[siId-1].msgLen = msgLen;
- }
- else
- {
- cell->siCb.newSiInfo.siInfo[siId-1].mcs = mcs;
- cell->siCb.newSiInfo.siInfo[siId-1].nPrb= nPrb;
- cell->siCb.newSiInfo.siInfo[siId-1].msgLen = msgLen;
- }
- }
-
- if(cfgType == RGR_SI_CFG_TYPE_SIB8_CDMA)
- {
- cell->siCb.crntSiInfo.siInfo[siId-1].mcs = mcs;
- cell->siCb.crntSiInfo.siInfo[siId-1].nPrb = nPrb;
- cell->siCb.crntSiInfo.siInfo[siId-1].msgLen = msgLen;
- }
-
- return ROK;
-}
-#endif
-
-/***********************************************************
- *
- * Func : rgSCHUtlFillDgnParams
- *
- * Desc : Utility Function to Fill Diagonostic params.
- *
- * Ret : None.
- *
- * Notes: None.
- *
- * File : rg_utl.c
- *
- **********************************************************/
-Void rgSCHUtlFillDgnParams(Inst inst,RgUstaDgn *dgn,uint8_t dgnType)
-{
-
- switch(dgnType)
- {
- case LRG_USTA_DGNVAL_MEM:
- dgn->type = (uint8_t) LRG_USTA_DGNVAL_MEM;
- dgn->u.mem.region = rgSchCb[inst].rgSchInit.region;
- dgn->u.mem.pool = rgSchCb[inst].rgSchInit.pool;
- break;
-
- default:
- break;
- }
-
- return;
-} /* end of rgSCHUtlFillDgnParams */
-
-/***********************************************************
- *
- * Func : rgSCHUtlGetPstToLyr
- *
- * Desc : Utility Function to get the pst structure to post a message to MAC
- *
- *
- * Ret : ROK
- * RFAILED
- *
- * Notes: This function should be called while sending a msg from
- * scheduler instance to MAC
- *
- * File : rg_utl.c
- *
- **********************************************************/
-Void rgSCHUtlGetPstToLyr(Pst *pst,RgSchCb *schCb,Inst macInst)
-{
-
- /* Only the needed params are filled */
- pst->region = schCb->rgSchInit.region;
- pst->pool = schCb->rgSchInit.pool;
- pst->srcInst = schCb->rgSchInit.inst+SCH_INST_START;
- pst->srcProcId = schCb->rgSchInit.procId;
- pst->dstProcId = schCb->rgSchInit.procId;
-
- pst->dstInst = macInst;
- pst->dstEnt = ENTMAC;
- pst->srcEnt = ENTMAC;
- pst->selector = 0;
- pst->prior = PRIOR0;
- pst->intfVer = 0;
- pst->route = RTESPEC;
-
- return;
-} /* end of rgSCHUtlGetPstToLyr */
-
-/** @brief This function fills in the common lc information to be sent to MAC
- *
- * @details
- *
- * Function: rgSCHUtlFillRgInfCmnLcInfo
- * @param RgSchDlSf *sf,
- * @param RgInfSfAlloc *sfAlloc,
- * @param CmLteLcId lcId,
- * @param Bool sendInd
- *
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-S16 rgSCHUtlFillRgInfCmnLcInfo(RgSchDlSf *sf,RgInfSfAlloc *sfAlloc,CmLteLcId lcId,Bool sendInd)
-{
-
- if((sf->bch.tbSize)&&
- !(sfAlloc->cmnLcInfo.bitMask & RGINF_BCH_INFO))
- {
-#ifndef RGR_SI_SCH
- sfAlloc->cmnLcInfo.bchInfo.lcId = lcId;
-#endif
- sfAlloc->cmnLcInfo.bitMask |= RGINF_BCH_INFO;
- }
- else if((sf->bcch.pdcch != NULLP)&&
- !(sfAlloc->cmnLcInfo.bitMask & RGINF_BCCH_INFO))
- {
- sfAlloc->cmnLcInfo.bcchInfo.rnti = RGSCH_SI_RNTI;
- rgSCHUtlFillPdschDciInfo(&(sfAlloc->cmnLcInfo.bcchInfo.dciInfo),
- &(sf->bcch.pdcch->dci));
-#ifndef RGR_SI_SCH
- sfAlloc->cmnLcInfo.bcchInfo.lcId = lcId;
- sfAlloc->cmnLcInfo.bcchInfo.sndStatInd = sendInd;
-#endif
- sfAlloc->cmnLcInfo.bitMask |= RGINF_BCCH_INFO;
- }
- else if((sf->pcch.pdcch != NULLP) &&
- !(sfAlloc->cmnLcInfo.bitMask & RGINF_PCCH_INFO))
- {
- sfAlloc->cmnLcInfo.pcchInfo.rnti = RGSCH_P_RNTI;
- rgSCHUtlFillPdschDciInfo(&(sfAlloc->cmnLcInfo.pcchInfo.dciInfo),
- &(sf->pcch.pdcch->dci));
- sfAlloc->cmnLcInfo.pcchInfo.lcId = lcId;
- sfAlloc->cmnLcInfo.bitMask |= RGINF_PCCH_INFO;
- }
- return ROK;
-}
-
-/** @brief This function fills in the RAR information to be sent to MAC
- *
- * @details
- *
- * Function: rgSCHUtlFillRgInfRarInfo
- *
- * @param RgSchCellCb *cell
- * @param RgSchDlSf *sf
- * @param RgInfSfAlloc *sfAlloc
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-S16 rgSCHUtlFillRgInfRarInfo(RgSchDlSf *sf,RgInfSfAlloc *sfAlloc,RgSchCellCb *cell)
-{
- uint8_t idx;
- CmLListCp *lnkLst;
- CmLList *tmp;
- RgSchRaCb *raCb;
- RgSchUeCb *ue;
- RgInfRaRntiInfo *raRntiAlloc;
- uint8_t noRaRsps;
- RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
-
-#ifdef LTE_TDD
- noRaRsps = RGSCH_MAX_TDD_RA_RSP_ALLOC;
-#else
- noRaRsps = RGSCH_MAX_RA_RSP_ALLOC;
-#endif
-
- for(idx =0; idx < noRaRsps; idx++)
- {
- if (sf->raRsp[idx].pdcch == NULLP)
- {
- /* No further raResp Allocations. */
- break;
- }
- /* Added Dl TB count for RACH Response transmission*/
-#ifdef LTE_L2_MEAS
- cell->dlUlTbCnt.tbTransDlTotalCnt++;
-#endif
- raRntiAlloc = &(sfAlloc->rarInfo.raRntiInfo[idx]);
- raRntiAlloc->raRnti = sf->raRsp[idx].raRnti;
- raRntiAlloc->schdTbSz = sf->raRsp[idx].tbSz;
- raRntiAlloc->numCrnti = 0;
- rgSCHUtlFillPdschDciInfo(&(raRntiAlloc->dciInfo),
- &(sf->raRsp[idx].pdcch->dci));
- /* RACHO : fill backoff indicator information */
- raRntiAlloc->backOffInd = sf->raRsp[idx].backOffInd;
-
- /* Fill for contention free UEs*/
- lnkLst = &(sf->raRsp[idx].contFreeUeLst);
- CM_LLIST_FIRST_NODE(lnkLst, tmp);
- while (tmp)
- {
- ue = (RgSchUeCb *)tmp->node;
- tmp = tmp->next;
- raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].tmpCrnti = ue->ueId;
- raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].isContFree = TRUE;
- raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].rapId = ue->ul.rarGrnt.rapId;
-#ifndef MAC_5GTF_UPDATE
- raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.hop =
- ue->ul.rarGrnt.hop;
- raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.cqiBit =
- ue->ul.rarGrnt.cqiReqBit;
-#endif
- /* SHASHAHNK ADD RIV CALC */
- raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.rbStart =
- ue->ul.rarGrnt.rbStart;
- raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.numRb =
- ue->ul.rarGrnt.numRb;
- raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.tpc =
- ue->ul.rarGrnt.tpc;
- raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.iMcsCrnt =
- ue->ul.rarGrnt.iMcsCrnt;
- raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].ta = ue->ul.rarGrnt.ta;
- raRntiAlloc->numCrnti++;
- cmLListDelFrm(lnkLst, &ue->ul.rarGrnt.raRspLnk);
- ue->ul.rarGrnt.raRspLnk.node = (PTR)NULLP;
- }
- /* Fill for contention based UEs*/
- lnkLst = &(sf->raRsp[idx].raRspLst);
-
- CM_LLIST_FIRST_NODE(lnkLst, tmp);
-
- while((NULLP != tmp) && ((RgSchRaCb *)tmp->node != NULLP))
- {
- raCb = (RgSchRaCb *)tmp->node;
-
- raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].tmpCrnti = raCb->tmpCrnti;
- raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].isContFree = FALSE;
- raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].rapId = raCb->rapId;
- raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].ta.pres = TRUE;
- raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].ta.val = raCb->ta.val;
-#ifndef MAC_5GTF_UPDATE
- raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.hop =
- raCb->msg3Grnt.hop;
- raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.cqiBit = FALSE;
-#endif
- raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.rbStart =
- raCb->msg3Grnt.rbStart;
- raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.numRb =
- raCb->msg3Grnt.numRb;
- raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.tpc =
- raCb->msg3Grnt.tpc;
- raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.iMcsCrnt =
- raCb->msg3Grnt.iMcsCrnt;
- raRntiAlloc->crntiInfo[raRntiAlloc->numCrnti].grnt.delayBit =
- raCb->msg3Grnt.delayBit;
- /* For initial attaching UEs Aperiodic CQI need not be triggered */
- raRntiAlloc->numCrnti++;
- /* Search the next node */
- CM_LLIST_NEXT_NODE(lnkLst, tmp);
- }
- }
- sfAlloc->rarInfo.numRaRntis = idx;
- /* ccpu00132314-ADD-Update the tx power allocation info
- TODO-Need to add a check for max tx power per symbol */
- sfAlloc->rarInfo.txPwrOffset = cellDl->rarTxPwrOffset;
-
- return ROK;
-} /* end of rgSCHUtlFillRgInfRarInfo */
-
-/** @brief This function fills in the pdsch data related allocation Info
- * from the pdcch DCI info.
- * slot
- *
- * @details
- *
- * Function: rgSCHUtlFillPdschDciInfo
- *
- * Processing steps:
- * - Depending upon the DCI Format, fill the appropriate fields.
- *
- * @param [out] TfuPdschDciInfo *pdschDci
- * @param [in] TfuDciInfo *pdcchDci
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-S16 rgSCHUtlFillPdschDciInfo(TfuPdschDciInfo *pdsch,TfuDciInfo *pdcchDci)
-{
-
-#ifdef EMTC_ENABLE
- S16 ret = ROK;
-#endif
- pdsch->format = pdcchDci->dciFormat;
- switch(pdcchDci->dciFormat)
- {
- case TFU_DCI_FORMAT_1:
- pdsch->u.format1AllocInfo = pdcchDci->u.format1Info.allocInfo;
- break;
- case TFU_DCI_FORMAT_1A:
- if (pdcchDci->u.format1aInfo.isPdcchOrder == FALSE)
- {
- pdsch->u.format1aAllocInfo = pdcchDci->u.format1aInfo.t.pdschInfo.allocInfo;
- }
- break;
- case TFU_DCI_FORMAT_1B:
- pdsch->u.format1bAllocInfo = pdcchDci->u.format1bInfo.allocInfo;
- break;
- case TFU_DCI_FORMAT_1C:
- pdsch->u.format1cAllocInfo = pdcchDci->u.format1cInfo;
- break;
- case TFU_DCI_FORMAT_1D:
- pdsch->u.format1dAllocInfo = pdcchDci->u.format1dInfo.allocInfo;
- break;
- case TFU_DCI_FORMAT_2:
- pdsch->u.format2AllocInfo = pdcchDci->u.format2Info.allocInfo;
- break;
- case TFU_DCI_FORMAT_2A:
- pdsch->u.format2AAllocInfo = pdcchDci->u.format2AInfo.allocInfo;
- break;
-#ifdef RG_5GTF
- case TFU_DCI_FORMAT_B1:
- pdsch->u.formatB1Info = pdcchDci->u.formatB1Info;
- break;
- case TFU_DCI_FORMAT_B2:
- pdsch->u.formatB2Info = pdcchDci->u.formatB2Info;
- break;
-#endif
- default:
-#ifdef EMTC_ENABLE
- ret = rgSCHEmtcUtlFillPdschDciInfo(pdsch, pdcchDci);
- if(RFAILED == ret)
- {
- return RFAILED;
- }
-#else
- return RFAILED;
-#endif
- }
- return ROK;
-}
-
-/* LTE_ADV_FLAG_REMOVED_START */
-/**
- * @brief This function resets temporary variables in Pool
- * @details
- *
- * Function: rgSchSFRResetPoolVariables
- *
- * Invoked by: rgSCHSFRUtlTotalPoolInit
- *
- * @param[in] RgSchCellCb* cell
- * @param[in] RgSubFrm* subFrm
- * @return Void
- *
- **/
-Void rgSchDSFRPwrCheck(RgSchDlSf *sf,Bool *isAllUePwrHigh)
-{
- RgSchSFRPoolInfo *sfrCCPool;
-
- CmLListCp *l;
- CmLList *n;
-
- l = &sf->sfrTotalPoolInfo.ccPool;
- n = cmLListFirst(l);
- while(n)
- {
- sfrCCPool = (RgSchSFRPoolInfo*)n->node;
- if((sfrCCPool->poolstartRB == sfrCCPool->pwrHiCCRange.startRb) &&
- (sfrCCPool->poolendRB == sfrCCPool->pwrHiCCRange.endRb))
- {
- n = cmLListNext(l);
- if(n)
- {
- continue;
- }
- *isAllUePwrHigh = TRUE;
- break;
- }
- else
- break;
- }
-}
-/* LTE_ADV_FLAG_REMOVED_END */
-/***********************************************************
- *
- * Func : rgSCHUtlFillRgInfTbInfo
- *
- * Desc : Utility Function to fill the allocation info of each Tb
- *
- *
- * Ret : void
- *
- *
- * Notes: This function should be called while sending a msg from
- * scheduler instance to MAC
- *
- * File : rg_utl.c
- *
- **********************************************************/
-static Void rgSCHUtlFillRgInfTbInfo(RgSchDlHqProcCb *hqP,RgInfUeAlloc *allocInfo,RgSchCellCb *cell)
-{
- RgSchDlSf *sf;
- uint8_t idx;
- RgInfUeTbInfo *tbInfo;
- uint8_t tbCnt;
- /* LTE_ADV_FLAG_REMOVED_START */
-#ifdef TFU_UPGRADE
- static uint32_t tmpCnt = 0;
- Bool isAllUePwrHigh = FALSE;
-#endif
- /* LTE_ADV_FLAG_REMOVED_END */
- RgSchDlLcCb *dlLcCb = NULLP;
- uint16_t rlcHdrEstmt;
- uint8_t lcId;
- /* RRM_RBC_X */
-#ifdef LTE_L2_MEAS
- uint8_t prbUsed = 0;
-#endif
- /* RRM_RBC_Y */
-
- CmLteTimingInfo frm;
-
- /* Get Downlink slot */
- frm = cell->crntTime;
- RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA);
- sf = rgSCHUtlSubFrmGet(cell, frm);
- /* Setting of fillCtrlPdu flag
- If both P-cell and S-cell are present,
- make TRUE for P-cell and FALSE for all s-cells
- For all other cases set TRUE */
-#ifdef LTE_ADV
- if ((rgSchCb[cell->instIdx].genCfg.forceCntrlSrbBoOnPCel) &&
- !RG_SCH_CMN_IS_PCELL_HQP(hqP))
- {
- allocInfo->fillCtrlPdu = FALSE;
- }
- else
- {
- allocInfo->fillCtrlPdu = TRUE;
- }
-#endif
-
- allocInfo->tbStrtIdx = -1;
-
-
-#ifdef LTE_ADV
- allocInfo->tbReqInfo.sCellHqPId = 0xff;
- rgSCHLaaHndlFillRgInfTbInfo(cell, hqP, allocInfo);
-#endif
-
- /*TODO:REEMA: Check and fill the isRetx */
- for(tbCnt = 0; tbCnt < 2; tbCnt++)
- {
- RgSchUeCb *ue = NULLP;
- /*Changed as a result of CR timer*/
- if ((hqP->hqE->ue != NULLP)/* &&
- ((hqP->tbInfo[tbCnt].lchSchdData[0].lcId != 0) || \
- (hqP->tbInfo[tbCnt].schdTa.pres == PRSNT_NODEF))*/)
- {
- ue = hqP->hqE->ue;
- allocInfo->rnti = ue->ueId;
- allocInfo->doa = hqP->hqE->ue->mimoInfo.doa;
- allocInfo->txMode = (TfuTxMode)(hqP->hqE->ue->mimoInfo.txMode);
- allocInfo->puschRptUsd = hqP->hqE->ue->mimoInfo.puschFdbkVld;
- allocInfo->puschPmiInfo = hqP->hqE->ue->mimoInfo.puschPmiInfo;
- if(hqP->tbInfo[tbCnt].schdTa.pres == PRSNT_NODEF)
- {
- hqP->tbInfo[tbCnt].taSnt = TRUE;
- }
-#ifdef TFU_UPGRADE
- if (RG_SCH_IS_PAPRSNT(ue,hqP->hqE->cell))
- {
- /*update pA value */
- allocInfo->pa = (RG_SCH_CMN_GET_PA(ue,hqP->hqE->cell)).val;
- }
-#endif
-
- /* LTE_ADV_FLAG_REMOVED_START */
- /* If ABS is enabled, calculate resource used */
- if((0 == tbCnt) && (RGR_ENABLE == ue->cell->lteAdvCb.absCfg.status))
- {
- /* For Macro count number resource used in Non-ABS SF */
- if(RGR_ABS_MUTE == ue->cell->lteAdvCb.absCfg.absPatternType)
- {
- if(RG_SCH_ABS_ENABLED_NONABS_SF == ue->cell->lteAdvCb.absDlSfInfo)
- {
- ue->cell->lteAdvCb.absLoadInfo[ue->cell->lteAdvCb.absPatternDlIdx]+=
- hqP->tbInfo[tbCnt].dlGrnt.numRb;
- }
- }
- /* For pico count number resource used in ABS SF for ABS UE */
- else if(RGR_ABS_TRANSMIT == ue->cell->lteAdvCb.absCfg.absPatternType)
- {
- if(RG_SCH_ABS_ENABLED_ABS_SF == ue->cell->lteAdvCb.absDlSfInfo)
- {
- if(TRUE == ue->lteAdvUeCb.rgrLteAdvUeCfg.isAbsUe)
- {
- ue->cell->lteAdvCb.absLoadInfo[ue->cell->lteAdvCb.absPatternDlIdx]+=
- hqP->tbInfo[tbCnt].dlGrnt.numRb;
- }
- }
- }
- }
-
-#ifdef TFU_UPGRADE
- /*if SFR is enabled*/
- allocInfo->isEnbSFR = (uint8_t)RG_SCH_CMN_IS_SFR_ENB(ue->cell); /* KW fix for LTE_ADV */
- if((ue->cell->lteAdvCb.dsfrCfg.status == RGR_ENABLE) &&
- (ue->lteAdvUeCb.rgrLteAdvUeCfg.isUeCellEdge == FALSE))
- {
- rgSchDSFRPwrCheck(sf, &isAllUePwrHigh);
- }
- if(isAllUePwrHigh)
- {
- allocInfo->pa = (uint8_t)ue->cell->lteAdvCb.sfrCfg.pwrThreshold.pHigh; /* KW fix for LTE_ADV */
- if(tmpCnt++ == 100000)
- {
- DU_LOG("\nDEBUG --> SCH : DSFR::ll UEs can go HIGH, PHigh(%d) for UE(%d)",allocInfo->pa, ue->ueId);
- tmpCnt = 0;
- }
- }
- else
- {
- if (allocInfo->isEnbSFR)
- {
- /*Update pA to Plow if it is cell-centred ,else pA will be pHigh*/
- if (ue->lteAdvUeCb.rgrLteAdvUeCfg.isUeCellEdge == TRUE)
- {
- allocInfo->pa = ue->cell->lteAdvCb.sfrCfg.pwrThreshold.pHigh;
- if(tmpCnt++ == 100000)
- {
- DU_LOG("\nDEBUG --> SCH : SFR::UE is CELL EDGE, PHigh(%d) for UE(%d)",allocInfo->pa, ue->ueId);
- tmpCnt = 0;
- }
-
- }
- else
- {
- if(TRUE == ue->lteAdvUeCb.isCCUePHigh)
- {
- allocInfo->pa = ue->cell->lteAdvCb.sfrCfg.pwrThreshold.pHigh;
- ue->lteAdvUeCb.isCCUePHigh = FALSE;
- }
- else
- {
- allocInfo->pa = ue->cell->lteAdvCb.sfrCfg.pwrThreshold.pLow;
- if(tmpCnt++ == 100000)
- {
- DU_LOG("\nDEBUG --> SCH : SFR::UE is CELL CENTRE, PLow(%d) for UE(%d)\n",allocInfo->pa, ue->ueId);
- tmpCnt = 0;
- }
- }
- }
- }
- }
- /* LTE_ADV_FLAG_REMOVED_END */
-#endif
- }
- else
- {
- if (hqP->hqE->raCb)
- {
-#ifdef TFU_UPGRADE
- RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
-#endif
-#ifdef LTEMAC_SPS
- allocInfo->pdcchRnti = hqP->hqE->raCb->tmpCrnti;
-#endif
- allocInfo->rnti = hqP->hqE->raCb->tmpCrnti;
-#ifdef TFU_UPGRADE
- /*ccpu00132314-ADD-Use a default pA value
- for msg4 */
- allocInfo->pa = cellDl->msg4pAVal;
-#endif
- }
- }
- /* If TB Is scheduled for this SF */
- if(hqP->tbInfo[tbCnt].state == HQ_TB_WAITING)
- {
- if (allocInfo->tbStrtIdx == -1){
- allocInfo->tbStrtIdx = tbCnt;
-#ifndef LTEMAC_SPS
- rgSCHUtlFillPdschDciInfo(&(allocInfo->dciInfo),
- &(hqP->pdcch->dci));
-#else
- if (hqP->pdcch)
- {
- rgSCHUtlFillPdschDciInfo(&(allocInfo->dciInfo),
- &(hqP->pdcch->dci));
- }
- else if ((ue) && (ue->dl.spsOccPdcch.rnti == ue->spsRnti))
- {
- rgSCHUtlFillPdschDciInfo(&(allocInfo->dciInfo),
- &(ue->dl.spsOccPdcch.dci));
- }
-#endif /* ifndef LTEMAC_SPS */
- }
-#ifdef LTEMAC_SPS
- if (hqP->pdcch)
- {
- allocInfo->pdcchRnti = hqP->pdcch->rnti;
- }
- else if (ue)
- {
- allocInfo->pdcchRnti = ue->spsRnti;
- }
-#endif
- tbInfo = &(allocInfo->tbInfo[tbCnt]);
- allocInfo->nmbOfTBs++;
- allocInfo->hqProcId = hqP->procId;
- allocInfo->tbInfo[tbCnt].schdTbSz = hqP->tbInfo[tbCnt].tbSz;
-
- tbInfo->disTb = FALSE;
- if(!(hqP->tbInfo[tbCnt].txCntr))
- {
-#ifdef LTE_ADV
- if(!((rgSCHLaaCheckIfLAAProc(hqP)) && (TRUE ==
- rgSCHLaaSCellEnabled(cell))))
-#endif
- {
- hqP->tbInfo[tbCnt].txCntr++;
- }
- for(idx = 0; idx < hqP->tbInfo[tbCnt].numLch; idx++)
- {
- tbInfo->schdDat[idx].lcId =\
- hqP->tbInfo[tbCnt].lchSchdData[idx].lcId;
- tbInfo->schdDat[idx].numBytes =\
- hqP->tbInfo[tbCnt].lchSchdData[idx].schdData;
- if(hqP->hqE->ue)
- {
- lcId = hqP->tbInfo[tbCnt].lchSchdData[idx].lcId;
- if(lcId != 0)
- {
- dlLcCb = hqP->hqE->ue->dl.lcCb[lcId-1];
- if(dlLcCb != NULLP)
- {
- RG_SCH_CMN_DL_GET_HDR_EST(dlLcCb, rlcHdrEstmt);
- /* Update the totalBo with the scheduled bo */
- (hqP->hqE->ue->totalBo <= tbInfo->schdDat[idx].numBytes - rlcHdrEstmt)?\
- (hqP->hqE->ue->totalBo = 0):\
- (hqP->hqE->ue->totalBo -= tbInfo->schdDat[idx].numBytes-rlcHdrEstmt);
-
- /* RRM_RBC_X */
-#ifdef LTE_L2_MEAS
- prbUsed = ((hqP->tbInfo[tbCnt].\
- lchSchdData[idx].schdData *
- hqP->tbInfo[tbCnt].dlGrnt.numRb) /
- (hqP->tbInfo[0].tbSz + hqP->tbInfo[1].tbSz));
- dlLcCb->qciCb->dlPrbCount += prbUsed;
- if(dlLcCb->qciCb->qci > 0)
- {
- RG_SCH_CALC_GBR_UTILIZATION(cell, dlLcCb, prbUsed);
- }
-#endif /* RRM_RBC_Y */
-
-#ifdef RG_PFS_STATS
- //if(!(hqP->hqE->ue->pfsStats.lcStats[lcId-1].isLcCntSet))
- if(tbCnt == 0)
- {
- uint8_t idx = 0;
- if (hqP->hqE->ue->cell == hqP->hqE->cell)
- {
- idx = RGSCH_PCELL_INDEX;
- }
- else
- {
- idx = RG_SCH_GET_SCELL_INDEX((hqP->hqE->ue), (hqP->hqE->cell));
- }
- hqP->hqE->ue->pfsStats.lcStats[lcId-1].ueSchdOcc[idx]++;
- hqP->hqE->ue->pfsStats.lcStats[lcId-1].perRefresh[ue->pfsStats.lcStats[lcId-1].lastIdx].lcSchdOcc++;
- }
-#endif
- }
- }
- }
- }
- /* Added Dl TB count for SRB/DRB data transmission*/
-#ifdef LTE_L2_MEAS
- cell->dlUlTbCnt.tbTransDlTotalCnt++;
-#endif
- tbInfo->ta.pres = hqP->tbInfo[tbCnt].schdTa.pres;
- tbInfo->ta.val = hqP->tbInfo[tbCnt].schdTa.val;
-#ifdef LTE_ADV
- tbInfo->sCellActCe = hqP->tbInfo[tbCnt].schdSCellActCe;
-#endif
- tbInfo->numSchLch = hqP->tbInfo[tbCnt].numLch;
- if(!(hqP->tbInfo[tbCnt].numLch))
- {
- tbInfo->schdDat[tbInfo->numSchLch].numBytes= hqP->tbInfo[tbCnt].tbSz;
- /* Fix: If only TA is scheduled, use some dummy LCID */
- if (tbInfo->ta.pres)
- tbInfo->schdDat[tbInfo->numSchLch].lcId = RG_TA_LCID;
- }
-
- tbInfo->contResCe = hqP->tbInfo[tbCnt].contResCe;
- tbInfo->isReTx = FALSE;
- }
- else
- {
-#ifdef LTE_ADV
- if(!((rgSCHLaaCheckIfLAAProc(hqP)) && (TRUE ==
- rgSCHLaaSCellEnabled(cell))))
-#endif
- {
- hqP->tbInfo[tbCnt].txCntr++;
- }
- tbInfo->isReTx = TRUE;
- /* RRM_RBC_X */
- /* As per 36.314, harq retransmission also considered for
- * prb utilization calculation*/
- for(idx = 0; idx < hqP->tbInfo[tbCnt].numLch; idx++)
- {
-#ifdef LTE_L2_MEAS
- if(hqP->hqE->ue)
- {
- lcId = hqP->tbInfo[tbCnt].lchSchdData[idx].lcId;
- if(lcId != 0)
- {
- dlLcCb = hqP->hqE->ue->dl.lcCb[lcId-1];
- if(dlLcCb != NULLP)
- {
- prbUsed = ((hqP->tbInfo[tbCnt].\
- lchSchdData[idx].schdData *
- hqP->tbInfo[tbCnt].dlGrnt.numRb) /
- (hqP->tbInfo[0].tbSz + hqP->tbInfo[1].tbSz));
- if(dlLcCb->qciCb->qci > 0)
- {
- RG_SCH_CALC_GBR_UTILIZATION(cell, dlLcCb, prbUsed);
- }
- }
- }
- }
-#endif
- }
- /* RRM_RBC_Y */
- }
- }
- }
-#ifdef LTE_ADV
- rgSCHLaaResetDlHqProcCb(hqP);
-#endif
-
- return;
-}
-/***********************************************************
- *
- * Func : rgSCHUtlFillRgInfUeInfo
- *
- * Desc : Utility Function to fill the allocation info of Ue
- * : MIMO : Filling 2TB's of each UE
- *
- * Ret : ROK
- * RFAILED
- *
- * Notes: This function should be called while sending a msg from
- * scheduler instance to MAC
- *
- * File : rg_utl.c
- *
- **********************************************************/
- /* CA dev Start */
-Void rgSCHUtlFillRgInfUeInfo(RgSchDlSf *sf,RgSchCellCb *cell,CmLListCp *dlDrxInactvTmrLst,CmLListCp *dlInActvLst,CmLListCp *ulInActvLst)
-{
- RgInfSfAlloc *sfAlloc;
- CmLListCp *lnkLst; /* lnkLst assignment */
- CmLList *tmp;
- CmLList *hqPNode;
- RgSchUeCb *ue = NULLP;
- RgInfUeInfo *ueInfo = NULLP;
- RgInfUeAlloc *ueAlloc = NULLP;
- RgSchDlHqProcCb *hqCb = NULLP;
-
- /* Since Msg4 is sched only on PCELL, use cell arg's sfAllocArr */
- sfAlloc = &(cell->sfAllocArr[cell->crntSfIdx]);
- ueInfo = &(sfAlloc->ueInfo);
- ueAlloc = sfAlloc->ueInfo.allocInfo;
-
- lnkLst = &(sf->msg4HqPLst);
- CM_LLIST_FIRST_NODE(lnkLst, tmp);
- while(NULLP != tmp)
- {
- DU_LOG("\nINFO --> SCH : 5GTF_ERROR MSG4 Consolidation\n");
- hqCb = (RgSchDlHqProcCb *)(tmp->node);
- CM_LLIST_NEXT_NODE(lnkLst, tmp);
-
- rgSCHUtlFillRgInfTbInfo(hqCb, &ueAlloc[ueInfo->numUes], cell);
-
- ue = hqCb->hqE->ue;
-
- if(ue != NULLP)
- {
- if((!(ue->dl.dlInactvMask & RG_HQENT_INACTIVE)) && (ue->isDrxEnabled))
- {
- rgSCHUtlGetDrxSchdUesInDl(cell, ue, hqCb, &ueAlloc[ueInfo->numUes],
- dlDrxInactvTmrLst, dlInActvLst, ulInActvLst);
- }
- }
- ueInfo->numUes++;
- }
-
- lnkLst = &(sf->ueLst);
- CM_LLIST_FIRST_NODE(lnkLst, tmp);
- while(NULLP != tmp)
- {
-#if defined (TENB_STATS) && defined (RG_5GTF)
- cell->tenbStats->sch.dl5gtfPdschCons++;
-#endif
- ue = (RgSchUeCb *)(tmp->node);
- CM_LLIST_NEXT_NODE(lnkLst, tmp);
-
- hqPNode = ue->dl.dlSfHqInfo[cell->cellId][sf->dlIdx].hqPLst.first;
- while (hqPNode)
- {
- hqCb = (RgSchDlHqProcCb *)hqPNode->node;
- hqPNode = hqPNode->next;
-
- sfAlloc = &(hqCb->hqE->cell->sfAllocArr[hqCb->hqE->cell->crntSfIdx]);
- ueInfo = &(sfAlloc->ueInfo);
- ueAlloc = sfAlloc->ueInfo.allocInfo;
-
- rgSCHUtlFillRgInfTbInfo(hqCb, &ueAlloc[ueInfo->numUes],
- hqCb->hqE->cell);
-
- if(ue->isDrxEnabled)
- {
- rgSCHUtlGetDrxSchdUesInDl(cell, ue, hqCb, &ueAlloc[ueInfo->numUes],
- dlDrxInactvTmrLst, dlInActvLst, ulInActvLst);
- }
- ueInfo->numUes++;
- }
-#ifdef LTE_ADV
- if (rgSchCb[cell->instIdx].genCfg.isSCellActDeactAlgoEnable == TRUE)
- {
- /*If remaining BO is left then increment the count*/
- if(ue->totalBo > 0)
- {
- ue->remBoCnt++;
- /* Check if trigger for Activation is met or not */
- if(rgSCHIsActvReqd(cell, ue))
- {
- ue->remBoCnt = 0;
- /*Passing primary cell*/
- rgSCHSCellSelectAndActDeAct(ue->cell, ue, RGR_SCELL_ACT);
- }
- }
- else
- {
- /*If remaining BO is 0 then reset the count*/
- ue->remBoCnt = 0;
- }
- }
-#endif
- }
-
- return;
-} /* end of rgSCHUtlFillRgInfUeInfo */
- /* CA dev End */
-
-
-/** @brief This function shall update the scheduler with the CEs and data rcvd
- *
- * @details
- *
- * Function: rgSCHUtlUpdSch
- *
- * Processing steps:
- * - Collate the information of all the SDUs received and inform the
- * scheduler rgSCHDataRcvd
- * - Send Data indication to the higher layer with the dedicated data
- * (rgUIMSndDedDatInd)
- * - Inform scheduler with any MAC CEs if present.
- *
- * @param [in] RgCellCb *cellCb
- * @param [in] RgUeCb *ueCb
- * @param [in] RgMacPdu *pdu
- * @param [in] RgSchErrInfo *err
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-S16 rgSCHUtlUpdSch(RgInfSfDatInd *subfrmInfo,RgSchCellCb *cellCb,RgSchUeCb *ueCb,RgInfUeDatInd *pdu,RgSchErrInfo *err)
-{
-
- S16 ret;
-#ifdef LTEMAC_SPS
- if (RGSCH_UL_SPS_ACT_PRSENT & pdu->ceInfo.bitMask)
- {
- /* SPS to be activated due to data on SPS LCG ID*/
- rgSCHUtlSpsActInd(cellCb, ueCb, pdu->ceInfo.spsSduSize);
- }
-#endif
- /* TODO : Temp Fix for crash due to UL SDU corruption*/
- if (RGSCH_PHR_CE_PRSNT & pdu->ceInfo.bitMask)
- {
- /* PHR present */
- RGSCHCPYTIMEINFO(subfrmInfo->timingInfo, ueCb->macCeRptTime);
- if ((ret = rgSCHUtlUpdPhr(cellCb, ueCb, pdu->ceInfo.ces.phr, err)) != ROK)
- return (ret);
- }
- /* Note: Order of indication to Sch now is
- * 1st Indicate the DataInd info for each LCG's
- * 2nd Update the BSR reports received along with data
- * this is to make sure the effBsr is updated to the latest BSR
- * received.
- */
- cellCb->sc.apis->rgSCHUpdUeDataIndLcg(cellCb, ueCb, pdu);
-
-#ifndef MAC_5GTF_UPDATE
- if (RGSCH_TRUNC_BSR_CE_PRSNT & pdu->ceInfo.bitMask)
- {
- RGSCHCPYTIMEINFO(subfrmInfo->timingInfo, ueCb->macCeRptTime);
- /*ccpu00129922 - MOD - Deleted return value
- * checking since it returns void*/
- rgSCHUtlUpdBsrTrunc (cellCb, ueCb,
- (uint8_t)(pdu->ceInfo.ces.bsr.truncBsr >> 6),
- (uint8_t)(pdu->ceInfo.ces.bsr.truncBsr & 0x3F), err);
- }
- else
- {
- if (RGSCH_SHORT_BSR_CE_PRSNT & pdu->ceInfo.bitMask)
- {
- RGSCHCPYTIMEINFO(subfrmInfo->timingInfo, ueCb->macCeRptTime);
- /*ccpu00129922 - MOD - Deleted return value
- checking since it returns void*/
- rgSCHUtlUpdBsrShort (cellCb, ueCb,
- (uint8_t)(pdu->ceInfo.ces.bsr.shortBsr >> 6),
- (uint8_t)(pdu->ceInfo.ces.bsr.shortBsr & 0x3F), err);
- }
- else
- {
- if (RGSCH_LONG_BSR_CE_PRSNT & pdu->ceInfo.bitMask)
-#else
- if (RGSCH_BSR_CE_PRSNT & pdu->ceInfo.bitMask)
-#endif
- {
- RGSCHCPYTIMEINFO(subfrmInfo->timingInfo, ueCb->macCeRptTime);
- /*ccpu00129922 - MOD - Deleted return value
- checking since it returns void*/
- rgSCHUtlUpdBsrLong (cellCb, ueCb,
- pdu->ceInfo.ces.bsr.longBsr.bs1,
- pdu->ceInfo.ces.bsr.longBsr.bs2,
- pdu->ceInfo.ces.bsr.longBsr.bs3,
- pdu->ceInfo.ces.bsr.longBsr.bs4,
- err);
- }
-#ifndef MAC_5GTF_UPDATE
- }
-
- }
-#endif
-
- return ROK;
-} /* end of rgSCHUtlUpdSch */
-#ifdef RGR_V1
-/**
- * @brief Handler for Updating Bo received in StaRsp
- *
- * @details
- *
- * Function : rgSCHUtlAddUeToCcchSduLst
- *
- * This function shall be invoked once it receives staRsp on CCCH
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ueCb
- * @return S16
- * -# ROK
- **/
-S16 rgSCHUtlAddUeToCcchSduLst(RgSchCellCb *cell,RgSchUeCb *ueCb)
-{
- RgSchCmnDlUe *ueDl = RG_SCH_CMN_GET_DL_UE(ueCb, cell);
- RgSchDlHqProcCb *hqP = (RgSchDlHqProcCb *)ueDl->proc;
-
- /* Temp Guard: For back to back CCCH SDU BO
- * twice. Hence an extra guard. If already added to scheduling
- * queue or if scheduled and waiting for HQ FDBK, ignore */
- if ((ueCb->ccchSduLnk.node) ||
- ((!(ueCb->dl.dlInactvMask & RG_HQENT_INACTIVE)) &&
- ((hqP != NULLP) && (hqP->hqE->ccchSduProc))))
- {
- DU_LOG("\nINFO --> SCH : RNTI:%d Unexpected CCCH SDU BO",
- ueCb->ueId);
- return ROK;
- }
-
- ueCb->ccchSduLnk.node = (PTR)(ueCb);
- cmLListAdd2Tail(&(cell->ccchSduUeLst), &(ueCb->ccchSduLnk));
-
- return ROK;
-}
-/**
- *
- * @details
- *
- * Function : rgSCHUtlUpdtBo
- *
- * This function shall be invoked once it receives staRsp on CCCH
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgRguCmnStaRsp *staRsp
- * @return S16
- * -# ROK
- **/
-S16 rgSCHUtlUpdtBo(RgSchCellCb *cell,RgInfCmnBoRpt *staRsp)
-{
- RgSchUeCb *ueCb;
-
- if ((ueCb = rgSCHDbmGetUeCb(cell, staRsp->u.rnti)) == NULLP)
- {
- /* Handle Ue fetch failure */
- DU_LOG("\nERROR --> SCH : Invalid UEID:%d",staRsp->u.rnti);
- return RFAILED;
- }
- /* Update Bo in ueCb */
- ueCb->dlCcchInfo.bo = (uint32_t)(staRsp->bo);
-#ifdef EMTC_ENABLE
- if(ueCb->isEmtcUe)
- {
- rgSCHUtlAddUeToEmtcCcchSduLst(cell,ueCb);
- }
- else
-#endif
- {
- rgSCHUtlAddUeToCcchSduLst(cell, ueCb);
- }
-
- return ROK;
-} /* rgSCHUtlUpdtBo */
-
-#endif
-/**
- *
- * @details
- * Function : rgSCHUtlHndlCcchBoUpdt
- *
- * This function shall fetch the raCb with the given rnti and ask RAM to
- * update BO
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgInfCmnBoRpt *boRpt
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHUtlHndlCcchBoUpdt(RgSchCellCb *cell,RgInfCmnBoRpt *boRpt)
-{
- RgSchRaCb *raCb;
- RgSchUeCb *ueCb;
-
- if ((raCb = rgSCHDbmGetRaCb(cell, boRpt->u.rnti)) == NULLP)
- {
-#ifdef RGR_V1
- /* CR timer implementation changes*/
- /*If no raCb, schedule ueCb, ueCb is extracted in rgSCHUtlUpdtBo*/
- return (rgSCHUtlUpdtBo(cell, boRpt));
-#else
- /* Handle RaCb fetch failure */
- DU_LOG("\nERROR --> SCH : Invalid RNTI:%d to fetch raCb",boRpt->u.rnti);
- return RFAILED;
-#endif
- }
-
-#ifdef RGR_V1
-
- /*Fix: If RaCb exists, then MSG4 is not completed yet*/
- /*Check if guard timer has expired, if not CR CE + CCCH SDU will be scheduled*/
- if((raCb->contResTmrLnk.node != NULLP) && \
- (raCb->schdLnk.node == NULLP) && (raCb->dlHqE->msg4Proc == NULLP))
- {
-#ifdef EMTC_ENABLE
- /*if contention resolution timer left ,Stop the Contention Resolution Guard Timer ,
- add in toBeSchduled list and update the Bo */
- if(TRUE == raCb->isEmtcRaCb)
- {
- rgSCHRamEmtcUpdtBo(cell, raCb, boRpt);
- }
- else
-#endif
- {
- cmLListDelFrm(&cell->contResGrdTmrLst, &(raCb->contResTmrLnk));
- raCb->contResTmrLnk.node=NULLP;
- rgSCHRamUpdtBo(cell, raCb, boRpt);
- }
- }
- else
- {
- /*Fix:Guard timer has expired */
- /*Update the BO in UE CB but dont add it to the scheduling list.
- *Should be added to the list after MSG4 completion*/
- if ((ueCb = rgSCHDbmGetUeCb(cell, boRpt->u.rnti)) == NULLP)
- {
- /* Handle Ue fetch failure */
- DU_LOG("\nERROR --> SCH : Invalid RNTI:%d",boRpt->u.rnti);
- return RFAILED;
- }
- /* Update Bo in ueCb */
- ueCb->dlCcchInfo.bo = (uint32_t)(boRpt->bo);
- }
-
-#else
- rgSCHRamUpdtBo(cell, raCb, boRpt);
-#endif
-
- return ROK;
-} /* rgSCHUtlHndlCcchBoUpdt */
-
-/**
- * @brief Validates BO received for BCCH or PCCH.
- *
- * @details
- *
- * Function : rgSCHUtlGetAllwdCchTbSz
- *
- * This function shall return the tbSz equal to or
- * the nearest greater value for a given bo.
- * If no such value found return -1. The nPrb value is
- * accordingly set.
- *
- *
- * @param[in] uint32_t bo
- * @param[out] uint8_t *nPrb
- * @return S32
- * -# ROK
- * -# RFAILED
- **/
-S32 rgSCHUtlGetAllwdCchTbSz(uint32_t bo,uint8_t *nPrb,uint8_t *mcs)
-{
- S32 lt;
- S32 cn;
- S32 rt;
-
- for (lt = 0, rt = 43; lt <= rt;)
- {
- cn = (lt + rt)/2;
- if (rgSchUtlBcchPcchTbSzTbl[cn].tbSz == bo)
- {
- *nPrb = rgSchUtlBcchPcchTbSzTbl[cn].rbIndex;
- *mcs = rgSchUtlBcchPcchTbSzTbl[cn].mcs;
- return (rgSchUtlBcchPcchTbSzTbl[cn].tbSz);
- }
- else if (rgSchUtlBcchPcchTbSzTbl[cn].tbSz < bo)
- lt = cn + 1;
- else
- rt = cn - 1;
- }
- if (lt == 44)
- {
- return RFAILED;
- }
- *nPrb = rgSchUtlBcchPcchTbSzTbl[lt].rbIndex;
- *mcs = rgSchUtlBcchPcchTbSzTbl[lt].mcs;
- return (rgSchUtlBcchPcchTbSzTbl[lt].tbSz);
-}
-
-/**
- * @brief Handler for BO Updt received for BCCH or PCCH.
- *
- * @details
- *
- * Function : rgSCHUtlHndlBcchPcchBoUpdt
- *
- * This function shall store the buffer and time to transmit in lcCb
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgInfCmnBoRpt *boRpt
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHUtlHndlBcchPcchBoUpdt(RgSchCellCb *cell,RgInfCmnBoRpt *boUpdt)
-{
- RgSchClcDlLcCb *dlLc;
- RgSchClcBoRpt *boRpt;
- Inst inst = cell->instIdx;
- uint8_t nPrb=0;
- uint8_t mcs=0;
-
- dlLc = rgSCHDbmGetBcchOnBch(cell);
- if (dlLc == NULLP)
- {
- DU_LOG("\nERROR --> SCH : No Logical Channel dlLc is NULLP for RNTI:%d LCID:%d",boUpdt->u.rnti,boUpdt->lcId);
- return RFAILED;
- }
- if (boUpdt->lcId != dlLc->lcId)
- {
- /* Added for dropping paging Message*/
- /*suman*/
- if ((rgSCHChkBoUpdate(cell,boUpdt))== ROK) /* Checking if received BO falls within the window of 5120 slots*/
- {
- if (rgSCHUtlGetAllwdCchTbSz(boUpdt->bo*8, &nPrb, &mcs)
- != (boUpdt->bo*8))
- {
- DU_LOG("\nERROR --> SCH : [%d]BO: does not match any "
- "valid TB Size RNTI:%d LCID:%d", boUpdt->bo,boUpdt->u.rnti,boUpdt->lcId);
- return RFAILED;
- }
- }/*end of rgSCHChkBoUpdate*/
- else
- {
- return ROK;
- }
- }
- if ((dlLc = rgSCHDbmGetCmnLcCb(cell, boUpdt->lcId)) == NULLP)
- {
- /* Handle lcCb fetch failure */
- DU_LOG("\nERROR --> SCH : LCID:%d Invalid for RNTI:%d",boUpdt->lcId,boUpdt->u.rnti);
- }
-
- if (((rgSCHUtlAllocSBuf(inst, (Data **)(&boRpt), sizeof(RgSchClcBoRpt))) ==RFAILED) ||
- (!boRpt))
- {
- DU_LOG("\nERROR --> SCH : Allocation of common bo %dreport "
- "failed RNTI:%d LCID:%d", boUpdt->bo,boUpdt->u.rnti,boUpdt->lcId);
- return RFAILED;
- }
-
- boRpt->bo = boUpdt->bo;
- boRpt->mcs = mcs;
- boRpt->timeToTx = boUpdt->u.timeToTx;
- boRpt->nPrb = nPrb;
-#ifdef EMTC_ENABLE
- if(cell->emtcEnable)
- {
- boRpt->emtcDIReason = boUpdt->emtcDIReason;
- boRpt->pnb = boUpdt->pnb;
- }
-#endif
- RG_SCH_ADD_TO_CRNT_TIME(boRpt->timeToTx,
- boRpt->maxTimeToTx, cell->siCfg.siWinSize)
- if((NULLP != dlLc) && (dlLc->si))
- {
- boRpt->retxCnt = cell->siCfg.retxCnt;
- }
- else
- {
- boRpt->retxCnt = 0;
- }
- rgSCHDbmInsCmnLcBoRpt(dlLc, boRpt);
-
- return ROK;
-} /* rgSCHUtlHndlBcchPcchBoUpdt */
-
-/**
- * @brief API for sending bind confirm from Scheduler instance to RRM
- *
- * @details
- *
- * Function: rgSCHUtlRgrBndCfm
- *
- * This API is invoked to send bind confirm from Scheduler instance to RRM.
- * This API fills in Pst structure and SAP Ids and invokes
- * bind confirm API towards RRM.
- *
- * @param[in] SuId suId
- * @param[in] uint8_t status
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHUtlRgrBndCfm(Inst instId,SuId suId,uint8_t status)
-{
- S16 ret = ROK;
-
- ret = RgUiRgrBndCfm(&rgSchCb[instId].rgrSap[suId].sapCfg.sapPst, rgSchCb[instId].rgrSap[suId].sapCfg.suId, status);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : rgSCHUtlRgrBndCfm: RgUiRgrBndCfm Failed ");
- return (ret);
- }
- return (ret);
-} /* rgSCHUtlRgrBndCfm*/
-
-/**
- * @brief API for sending bind confirm from Scheduler instance to RRM via RGM
- * interface
- *
- * @details
- *
- * Function: rgSCHUtlRgmBndCfm
- *
- * This API is invoked to send bind confirm from Scheduler instance to RRM.
- * This API fills in Pst structure and SAP Ids and invokes
- *
- * @param[in] SuId suId
- * @param[in] uint8_t status
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHUtlRgmBndCfm(Inst instId,SuId suId,uint8_t status)
-{
- S16 ret = ROK;
-
- ret = RgUiRgmBndCfm(&rgSchCb[instId].rgmSap[suId].sapCfg.sapPst, rgSchCb[instId].rgmSap[suId].sapCfg.suId, status);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : rgSCHUtlRgmBndCfm: RgUiRgrBndCfm Failed ");
- return (ret);
- }
- return (ret);
-} /* rgSCHUtlRgmBndCfm*/
-
-
-
-/**
- * @brief API for sending configuration confirm from Scheduler to DU APP
- *
- * @details
- *
- * Function: schSendCfgCfm
- *
- * This API is invoked to send configuration confirm from Scheduler to DU
- * APP.
- *
- * @param[in] Pst pst
- * @param[in] RgrCfgTransId transId
- * @param[in] uint8_t status
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 schSendCfgCfm(Region reg,Pool pool,RgrCfgTransId transId,uint8_t status)
-{
- Pst cfmPst;
-
- memset((&cfmPst), 0, sizeof(Pst));
-
- cfmPst.srcEnt = (Ent)ENTDUAPP;
- cfmPst.srcInst = (Inst) 0;
- cfmPst.srcProcId = SFndProcId();
- cfmPst.dstEnt = (Ent)ENTMAC;
- cfmPst.dstInst = (Inst) 0;
- cfmPst.dstProcId = SFndProcId();
- cfmPst.selector = ODU_SELECTOR_LC;
- cfmPst.region = reg;
- cfmPst.pool = pool;
-
- if(RgUiRgrCfgCfm(&cfmPst,transId, status) != ROK)
- {
- DU_LOG("\nERROR --> SCH : schSendCfgCfm: RgUiRgrCfgCfm Failed ");
- return RFAILED;
- }
- return ROK;
-} /* schSendCfgCfm*/
-#ifdef RGR_RRM_TICK
-/**
- * @brief API for sending TTI indication from Scheduler to RRM.
- *
- * @details
- *
- * Function: rgSCHUtlRgrTtiInd
- *
- * This API is invoked to send TTI indication from Scheduler instance to RRM.
- * This API fills in Pst structure and RgrTtiIndInfo
- *
- * @param[in] cell RgSchCellCb
- * @param[in] CmLteTimingInfo status
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHUtlRgrTtiInd(RgSchCellCb *cell,RgrTtiIndInfo *rgrTti)
-{
- S16 ret = ROK;
- RgSchUpSapCb *rgrSap; /*!< RGR SAP Control Block */
-#ifdef L2_L3_SPLIT
- Bool g_usettitmr;
- Void mtTmrHdlrPublic(void);
-#endif
-
- rgrSap = cell->rgrSap;
- if (rgrSap->sapSta.sapState != LRG_BND)
- {
- DU_LOG("\nERROR --> SCH : rgSCHUtlRgrTtiInd() Upper SAP not bound (%d) ",
- rgrSap->sapSta.sapState);
- return RFAILED;
- }
- RgUiRgrTtiInd(&(cell->rgrSap->sapCfg.sapPst),
- cell->rgrSap->sapCfg.suId, rgrTti);
-#ifdef L2_L3_SPLIT
- {
- g_usettitmr = TRUE;
- mtTmrHdlrPublic();
- }
-#endif
- return (ret);
-} /* rgSCHUtlRgrTtiInd*/
-#endif
-/** @brief This function is called by rgMacSchSfRecpInd. This function invokes the
- * scheduler with the information of the received Data and any Control Elements
- * if present.
- *
- * @details
- *
- * Function:
- *
- * Processing steps:
- * - Retrieves the RaCb with the rnti provided, if it doesnt exist
- * return failure.
- * - If UE exists then update the Schduler with any MAC CEs if present.
- * - Invoke RAM module to do Msg3 related processing rgSCHRamProcMsg3
- *
- * @param [in] RgSchCellCb *cellCb
- * @param [in] RgSchUeCb *ueCb
- * @param [in] CmLteRnti rnti
- * @param [in] RgMacPdu *pdu
- * @param [in] RgSchErrInfo *err
- * @param
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-S16 rgSCHUtlProcMsg3
-(
-RgInfSfDatInd *subfrmInfo,
-RgSchCellCb *cellCb,
-RgSchUeCb *ueCb,
-CmLteRnti rnti,
-RgInfUeDatInd *pdu,
-RgSchErrInfo *err
-)
-{
- S16 ret;
- RgSchRaCb *raCb;
-
- /* must have an raCb for this case */
- raCb = rgSCHDbmGetRaCb (cellCb, rnti);
- if (raCb == NULLP)
- {
- DU_LOG("\nERROR --> SCH : RNTI:%d Received MSG3, unable to "
- "find raCb",rnti);
- return RFAILED;
- }
-
- /* ccpu00130982: Processing CRNTI MAC CE before Short BSR, if any, such that
- * effBsr of current case only will be considered in scheduling of ContResLst*/
- ret = rgSCHRamProcMsg3 (cellCb, ueCb, raCb, pdu, err);
- if (ret != ROK)
- {
- DU_LOG("\nERROR --> SCH : Processing failed in the RAM "
- "RNTI:%d ",rnti);
- return (ret);
- }
- /* if ueCb is present */
- if (ueCb != NULLP)
- {
- rgSCHUtlUpdSch (subfrmInfo, cellCb, ueCb, pdu, err);
- }
-
- return ROK;
-}
-#ifdef LTEMAC_SPS
-/** @brief This function is called by RgMacSchSpsRelInd. This function invokes the
- * scheduler with the information of the received Data.
- *
- * @details
- *
- * Function: rgSCHUtlSpsRelInd
- *
- * Processing steps:
- * TODO
- *
- * @param [in] RgSchCellCb *cellCb
- * @param [in] RgSchUeCb *ueCb
- * @param [in] Bool *isExplRel
- * @param
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-S16 rgSCHUtlSpsRelInd(RgSchCellCb *cellCb,RgSchUeCb *ueCb,Bool isExplRel)
-{
- cellCb->sc.apis->rgSCHUlSpsRelInd(cellCb, ueCb, isExplRel);
- return ROK;
-} /* end of rgSCHUtlSpsRelInd */
-
-
-/** @brief This function is called by RgMacSchSpsRelInd. This function invokes the
- * scheduler with the information of the received Data.
- *
- * @details
- *
- * Function: rgSCHUtlSpsActInd
- *
- * Processing steps:
- * TODO
- *
- * @param [in] RgSchCellCb *cellCb
- * @param [in] RgSchUeCb *ueCb
- * @param [in] uint16_t spsSduSize
- * @param
- * @return S16
- * -# ROK
- * -# RFAILED
- */
-S16 rgSCHUtlSpsActInd(RgSchCellCb *cellCb,RgSchUeCb *ueCb,uint16_t spsSduSize)
-{
- cellCb->sc.apis->rgSCHUlSpsActInd(cellCb, ueCb, spsSduSize);
- return ROK;
-} /* end of rgSCHUtlSpsActInd */
-
-
-#endif /* LTEMAC_SPS */
-
-#ifdef RG_PHASE_2
-/**
- * @brief This API is invoked to send uplink group power control request to PHY.
- *
- * @details
- *
- * Function : rgSCHUtlTfuGrpPwrCntrlReq
- *
- * This API is invoked to send uplink group power control request to PHY.
- * It fills in the Pst structure, spId value and invokes group power
- * control request primitive at TFU.
- *
- * @param[in] TfuGrpPwrCntrlReqInfo *grpPwrCntrlReq
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHUtlTfuGrpPwrCntrlReq(Inst inst,S16 sapId,TfuGrpPwrCntrlReqInfo *grpPwrCntrlReq)
-{
- S16 ret;
- RgSchLowSapCb *tfuSap;
- Pst pst;
-
- /* Get the lower SAP control block from the layer control block. */
- tfuSap = &(rgSchCb[inst].tfuSap[sapId]);
- if (tfuSap->sapSta.sapState != LRG_BND)
- {
- DU_LOG("\nERROR --> SCH : rgSCHUtlTfuGrpPwrCntrlReq() Lower SAP not bound (%d) ",tfuSap->sapSta.sapState);
- return RFAILED;
- }
- memcpy (&pst, &(tfuSap->sapCfg.sapPst), sizeof(Pst));
- if((ret = RgLiTfuGrpPwrCntrlReq (&pst, tfuSap->sapCfg.spId, grpPwrCntrlReq)) != ROK)
- {
- DU_LOG("\nERROR --> SCH : rgSCHUtlTfuGrpPwrCntrlReq() Call to RgLiTfuGrpPwrCntrlReq() failed");
- }
- return (ret);
-} /* rgSCHUtlTfuGrpPwrCntrlReq */
-#endif
-
-/* FOR ACK NACK REP */
-
-/**
- * @brief This API is invoked to tell the DL Scheduler to add the UE back into
- * its scheduling queues.
- *
- * @details
- *
- * Function : rgSCHUtlDlActvtUe
- *
- * This API is invoked from Measurement gap moduled.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ueCb
- *
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHUtlDlActvtUe(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- cell->sc.apis->rgSCHActvtDlUe(cell, ue);
- return ROK;
-}
-
-/**
- * @brief This API is invoked to tell the UL Scheduler to add the UE back into
- * its scheduling queues.
- *
- * @details
- *
- * Function : rgSCHUtlUlActvtUe
- *
- * This API is invoked from Measurement gap moduled.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ueCb
- *
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHUtlUlActvtUe(RgSchCellCb *cell,RgSchUeCb *ue)
-{
- cell->sc.apis->rgSCHActvtUlUe(cell, ue);
- return ROK;
-}
-
- /** @brief This function Validates the SAP information received along with the
- * primitive from the lower layer.
- *
- * Function: rgSCHUtlValidateTfuSap
- *
- * Validates SAP information.
- * @param suId The SAP Id
- * @return
- * -# ROK
- * -# RFAILED
- */
-S16 rgSCHUtlValidateTfuSap(Inst inst,SuId suId)
-{
- RgSchLowSapCb *tfuSap;
-
- if(suId >= rgSchCb[inst].numSaps)
- {
- DU_LOG("\nERROR --> SCH : Incorrect SuId");
- return RFAILED;
- }
- tfuSap = &(rgSchCb[inst].tfuSap[suId]);
-
- /* First lets check the suId */
- if( suId != tfuSap->sapCfg.suId)
- {
- DU_LOG("\nERROR --> SCH : Incorrect SuId. Configured (%d) Recieved (%d)",
- tfuSap->sapCfg.suId, suId);
- return RFAILED;
- }
- if (tfuSap->sapSta.sapState != LRG_BND)
- {
- DU_LOG("\nERROR --> SCH : Lower SAP not enabled SuId (%d)",
- tfuSap->sapCfg.suId);
- return RFAILED;
- }
- return ROK;
-} /* end of rgSCHUtlValidateTfuSap */
-
-/*
-*
-* Fun: rgSCHUtlAllocEventMem
-*
-* Desc: This function allocates event memory
-*
-* Ret: ROK - on success
-* RFAILED - on failure
-*
-* Notes: None
-*
-* File: rg_utl.c
-*
-*/
-S16 rgSCHUtlAllocEventMem(Inst inst,Ptr *memPtr,Size memSize)
-{
- Mem sMem;
- volatile uint32_t startTime=0;
-
-
- sMem.region = rgSchCb[inst].rgSchInit.region;
- sMem.pool = rgSchCb[inst].rgSchInit.pool;
-
-#if (ERRCLASS & ERRCLS_DEBUG)
- if (memSize<= 0)
- {
- DU_LOG("\nERROR --> SCH : rgAllocEventMem(): memSize invalid\n");
- return (RFAILED);
- }
-#endif /* ERRCLASS & ERRCLS_DEBUG */
- /*starting Task*/
- SStartTask(&startTime, PID_SCHUTL_CMALLCEVT);
-
-#ifdef MS_MBUF_CORRUPTION /* Should be enabled when debugging mbuf corruption */
- MS_BUF_ADD_ALLOC_CALLER();
-#endif /* */
-#ifdef TFU_ALLOC_EVENT_NO_INIT
- if(ROK != cmAllocEvntNoInit(memSize, TFU_MAX_MEMBLK_SIZE, &sMem, memPtr))
-#else
- if(ROK != cmAllocEvnt(memSize, TFU_MAX_MEMBLK_SIZE, &sMem, memPtr))
-#endif /* */
- {
- DU_LOG("\nERROR --> SCH : cmAllocEvnt Failed.");
- return RFAILED;
- }
- /*stoping Task*/
- SStopTask(startTime, PID_SCHUTL_CMALLCEVT);
- return ROK;
-} /* end of rgSCHUtlAllocEventMem*/
-
-/*
-*
-* Fun: rgGetEventMem
-*
-* Desc: This function allocates event memory
-*
-* Ret: ROK - on success
-* RFAILED - on failure
-*
-* Notes: None
-*
-* File: rg_utl.c
-*
-*/
-S16 rgSCHUtlGetEventMem(Ptr *ptr,Size len,Ptr memCp)
-{
- S16 ret;
-
-#ifdef TFU_ALLOC_EVENT_NO_INIT
- ret = cmGetMemNoInit(memCp, len, (Ptr *)ptr);
-#else
- ret = cmGetMem(memCp, len, (Ptr *)ptr);
-#endif
- return (ret);
-} /* end of rgSCHUtlGetEventMem*/
-
-#ifdef LTE_TDD
-
-
-/**
- * @brief Handler to allocate memory for ACK/NACk feedback information
- *
- * @details
- *
- * Function : rgSCHUtlAllocUeANFdbkInfo
- *
- * It allocates memory for the UE related ACK NACK information.
- *
- * @param[in] RgSchUeCb *ue
- * @return S16
- **/
-S16 rgSCHUtlAllocUeANFdbkInfo(RgSchUeCb *ue,uint8_t servCellIdx)
-{
- uint8_t idx;
-
- if (rgSCHUtlAllocSBuf(ue->cell->instIdx,
- (Data **) &(ue->cellInfo[servCellIdx]->anInfo), sizeof(RgSchTddANInfo) * \
- ue->cell->ackNackFdbkArrSize) != ROK)
- {
- return RFAILED;
- }
-
- for(idx=0; idx < ue->cell->ackNackFdbkArrSize; idx++)
- {
- rgSCHUtlInitUeANFdbkInfo(&ue->cellInfo[servCellIdx]->anInfo[idx]);
- }
-
- /* Set it to the first index */
- ue->cellInfo[servCellIdx]->nextFreeANIdx = 0;
- return ROK;
-} /* rgSCHUtlAllocUeANFdbkInfo */
-
-/**
- * @brief Handler to release memory for ACK/NACk feedback information
- *
- * @details
- *
- * Function : rgSCHUtlDelUeANFdbkInfo
- *
- * It releases memory for the UE related ACK NACK information.
- *
- * @param[in] RgSchUeCb *ue
- * @return Void
- **/
-Void rgSCHUtlDelUeANFdbkInfo(RgSchUeCb *ue,uint8_t servCellIdx)
-{
-
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(ue->cell->instIdx,
- (Data **)(&( ue->cellInfo[servCellIdx]->anInfo)), sizeof(RgSchTddANInfo) * \
- ue->cell->ackNackFdbkArrSize);
-
- return;
-} /* rgSCHUtlDelUeANFdbkInfo */
-
-/**
- * @brief Handler to initialise UE ACK/NACk feedback information
- *
- * @details
- *
- * Function : rgSCHUtlInitUeANFdbkInfo
- *
- * It initialises UE related ACK NACK information.
- *
- * @param[in] RgSchTddANInfo *anFdInfo
- * @return S16
- **/
-S16 rgSCHUtlInitUeANFdbkInfo(RgSchTddANInfo *anFdInfo)
-{
-
- anFdInfo->sfn = RGSCH_MAX_SFN+1; /* defensively setting invalid sfn */
- anFdInfo->slot = 0;
- anFdInfo->ulDai = RG_SCH_INVALID_DAI_VAL;
- anFdInfo->dlDai = RG_SCH_INVALID_DAI_VAL;
- anFdInfo->latestMIdx = RG_SCH_INVALID_M_VAL;
-
- return ROK;
-} /* rgSCHUtlInitUeANFdbkInfo */
-
-/**
- * @brief Handler to get UE related ACK NACK feedback information
- *
- * @details
- *
- * Function : rgSCHUtlGetUeANFdbkInfo
- *
- * It gets the UE related ACK NACK information based on
- * SFN and slot number.
- *
- * @param[in] RgSchUeCb *ueCb
- * @param[in] CmLteTimingInfo *time
- * @return RgSchTddANInfo*
- **/
-RgSchTddANInfo* rgSCHUtlGetUeANFdbkInfo(RgSchUeCb *ueCb,CmLteTimingInfo *timeInfo,uint8_t servCellIdx)
-{
- uint8_t idx;
-
- for (idx = 0; idx < ueCb->cell->ackNackFdbkArrSize; ++idx)
- {
- if( (timeInfo->sfn == ueCb->cellInfo[servCellIdx]->anInfo[idx].sfn) &&
- (timeInfo->slot == ueCb->cellInfo[servCellIdx]->anInfo[idx].slot))
- {
- return (&ueCb->cellInfo[servCellIdx]->anInfo[idx]);
- }
- }
-
- return (NULLP);
-} /* rgSCHUtlGetUeANFdbkInfo */
-
-/**
- * @brief To get downlink slot index
- *
- * @details
- *
- * Function: rgSCHUtlGetDlSfIdx
- * Purpose: Gets downlink slot index based on SFN and slot no
- *
- * @param[in] CmLteTimingInfo *timeInfo
- * @param[in] RgSchCellCb *cell
- * @return uint8_t
- *
- **/
-uint8_t rgSCHUtlGetDlSfIdx(RgSchCellCb *cell,CmLteTimingInfo *timeInfo)
-{
- uint16_t idx = 0;
-
- idx = RGSCH_NUM_SUB_FRAMES - \
- rgSchTddNumUlSubfrmTbl[cell->ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1];
- idx = ((idx * timeInfo->sfn) + \
- rgSchTddNumDlSubfrmTbl[cell->ulDlCfgIdx][timeInfo->slot]) - 1;
- idx = idx % cell->numDlSubfrms;
-
- return ((uint8_t)idx);
-}
-
-/**
- * @brief To get the next downlink slot
- *
- * @details
- *
- * Function: rgSCHUtlGetNxtDlSfInfo
- * Purpose: Gets next downlink slot based on current DL slot
- *
- * @param[in] CmLteTimingInfo curDlTime
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchDlSf *dlSf
- * @param[in] RgSchDlSf **nxtDlsf
- * @param[in] CmLteTimingInfo *nxtDlTime
- * @return uint8_t
- *
- **/
-Void rgSCHUtlGetNxtDlSfInfo(CmLteTimingInfo curDlTime,RgSchCellCb *cell,RgSchDlSf *dlSf,RgSchDlSf **nxtDlsf,CmLteTimingInfo *nxtDlTime)
-{
- uint16_t idx = curDlTime.slot;
- uint8_t count = 0;
-
- while(TRUE)
- {
- do
- {
- idx = (idx + 1) % RGSCH_NUM_SUB_FRAMES;
- count++;
- }while(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx][idx]
- != RG_SCH_TDD_DL_slot);
- RG_SCH_ADD_TO_CRNT_TIME(curDlTime, (*nxtDlTime), count);
- *nxtDlsf = rgSCHUtlSubFrmGet(cell, *nxtDlTime);
- if(dlSf->dlFdbkInfo.slot != (*nxtDlsf)->dlFdbkInfo.slot)
- {
- break;
- }
- }
- return;
-}
-
-/**
- * @brief To get the previous downlink slot
- *
- * @details
- *
- * Function: rgSCHUtlGetPrevDlSfInfo
- * Purpose: Gets previous downlink slot based on current DL slot
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] CmLteTimingInfo curDlTime
- * @param[in] CmLteTimingInfo *prevDlTime
- * @param[in] uint8_t *numSubfrm
- * @return uint8_t
- *
- **/
-Void rgSCHUtlGetPrevDlSfInfo(RgSchCellCb *cell,CmLteTimingInfo curDlTime,CmLteTimingInfo *prevDlTime,uint8_t *numSubfrm)
-{
- S16 idx = curDlTime.slot;
- uint8_t count = 0;
-
- do
- {
- idx--;
- if(idx < 0)
- {
- idx = RGSCH_NUM_SUB_FRAMES-1;
- }
- count++;
- }while(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx][idx]
- != RG_SCH_TDD_DL_slot);
- *numSubfrm = count;
- RGSCHDECRFRMCRNTTIME(curDlTime, (*prevDlTime), count);
- return;
-}
-
-#endif
-/* Added Holes Management functions for Adaptive Re transmission */
-/******* </AllocHolesMemMgmnt>: START *****/
-/***********************************************************
- *
- * Func : rgSCHUtlUlSfInit
- *
- * Desc : UL slot init.
- *
- * Ret : S16
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-S16 rgSCHUtlUlSfInit(RgSchCellCb *cell,RgSchUlSf *sf,uint8_t idx,uint8_t maxUePerSf)
-{
- S16 ret=ROK;
-
- sf->idx = idx;
-#ifdef RG_5GTF
- uint8_t index;
-#endif
-
-#ifdef LTE_TDD
- if(cell->ulDlCfgIdx == 0)
- {
- /* Store the Uplink slot number corresponding to the idx */
- sf->ulSfIdx = rgSchTddCfg0UlSfTbl[idx%6];
- }
-#endif
- ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&sf->allocDb,
- sizeof(RgSchUlAllocDb));
- if (ret != ROK)
- {
- return (ret);
- }
- ret = rgSCHUtlUlAllocDbInit(cell, sf->allocDb, maxUePerSf);
- if (ret != ROK)
- {
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(sf->allocDb)),
- sizeof(RgSchUlAllocDb));
- return (ret);
- }
- ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&sf->holeDb,
- sizeof(RgSchUlHoleDb));
- if (ret != ROK)
- {
- rgSCHUtlUlAllocDbDeinit(cell, sf->allocDb);
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(sf->allocDb)),
- sizeof(RgSchUlAllocDb));
- return (ret);
- }
- /* Initialize the hole with CFI 1 Pusch Bw Info */
- ret = rgSCHUtlUlHoleDbInit(cell, sf->holeDb, (uint8_t)(maxUePerSf + 2), \
- 0, cell->dynCfiCb.bwInfo[1].numSb);
-
- if (ret != ROK)
- {
- rgSCHUtlUlAllocDbDeinit(cell, sf->allocDb);
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(sf->allocDb)),
- sizeof(RgSchUlAllocDb));
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(sf->holeDb)),
- sizeof(RgSchUlHoleDb));
- return (ret);
- }
- cmLListInit(&sf->reTxLst);
-
- /* Fix ccpu00120610*/
- sf->allocCountRef = &sf->allocDb->count;
-
- /* initialize UL available subbands for current sub-frame */
- sf->availSubbands = cell->dynCfiCb.bwInfo[1].numSb;
-#ifdef RG_5GTF
- sf->numGrpPerTti = cell->cell5gtfCb.ueGrpPerTti;
- sf->numUePerGrp = cell->cell5gtfCb.uePerGrpPerTti;
- for(index = 0; index < MAX_5GTF_BEAMS; index++)
- {
- sf->sfBeamInfo[index].totVrbgAllocated = 0;
- sf->sfBeamInfo[index].totVrbgRequired = 0;
- sf->sfBeamInfo[index].vrbgStart = 0;
- }
-#endif
-
- return (ret);
-}
-
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlSfDeinit
- *
- * Desc : Deinitialises a slot
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHUtlUlSfDeinit(RgSchCellCb *cell,RgSchUlSf *sf)
-{
- if (sf->allocDb)
- {
- rgSCHUtlUlAllocDbDeinit(cell, sf->allocDb);
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(sf->allocDb)),
- sizeof(RgSchUlAllocDb));
- }
- if (sf->holeDb)
- {
- rgSCHUtlUlHoleDbDeinit(cell, sf->holeDb);
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(sf->holeDb)),
- sizeof(RgSchUlHoleDb));
- }
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlAllocDbInit
- *
- * Desc : Initialise allocation DB
- *
- * Ret : S16 (ROK/RFAILED)
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHUtlUlAllocDbInit(RgSchCellCb *cell,RgSchUlAllocDb *allocDb,uint8_t maxAllocs)
-{
- S16 ret = rgSCHUtlUlAllocMemInit(cell, &allocDb->mem, maxAllocs);
- if (ret != ROK)
- {
- return (ret);
- }
- allocDb->count = 0;
- allocDb->first = NULLP;
- return ROK;
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlAllocDbDeinit
- *
- * Desc : Deinitialises allocation DB
- * sent to UE, for a UE with accumulation disabled
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHUtlUlAllocDbDeinit(RgSchCellCb *cell,RgSchUlAllocDb *allocDb)
-{
- rgSCHUtlUlAllocMemDeinit(cell, &allocDb->mem);
- allocDb->count = 0;
- allocDb->first = NULLP;
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlHoleDbInit
- *
- * Desc : Initialise hole DB
- *
- * Ret : S16 (ROK/RFAILED)
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static S16 rgSCHUtlUlHoleDbInit(RgSchCellCb *cell,RgSchUlHoleDb *holeDb,uint8_t maxHoles,uint8_t start,uint8_t num)
-{
- S16 ret;
- RgSchUlHole *hole = NULLP;
-
- ret = rgSCHUtlUlHoleMemInit(cell, &holeDb->mem, maxHoles, &hole);
- if (ret != ROK)
- {
- return (ret);
- }
- holeDb->count = 1;
- holeDb->first = hole;
- hole->start = start;
- hole->num = num;
- hole->prv = hole->nxt = NULLP;
- return ROK;
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlHoleDbDeinit
- *
- * Desc : Deinitialises hole DB
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static Void rgSCHUtlUlHoleDbDeinit(RgSchCellCb *cell,RgSchUlHoleDb *holeDb)
-{
- rgSCHUtlUlHoleMemDeinit(cell, &holeDb->mem);
- holeDb->count = 0;
- holeDb->first = NULLP;
- return;
-}
-
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlAllocGetHole
- *
- * Desc : Get allocation from hole
- *
- * Ret : RgSchUlAlloc *
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-RgSchUlAlloc *rgSCHUtlUlAllocGetHole(RgSchUlSf *sf,uint8_t numSb,RgSchUlHole *hole)
-{
- if (numSb < hole->num)
- {
- return (rgSCHUtlUlAllocGetPartHole(sf, numSb, hole));
- }
- else
- {
- return (rgSCHUtlUlAllocGetCompHole(sf, hole));
- }
-}
-
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlAllocGetCompHole
- *
- * Desc : Get an allocation corresponding to an entire hole
- *
- * Ret : RgSchUlAlloc *
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-RgSchUlAlloc *rgSCHUtlUlAllocGetCompHole(RgSchUlSf *sf,RgSchUlHole *hole)
-{
- RgSchUlAlloc *alloc;
- /* alloc = rgSCHUtlUlAllocGetAndIns(sf->allocDb, hole->prvAlloc, hole->nxtAlloc); */
- /* Calling rgSchCmnUlAllocGetAndIns is ok, but prv alloc needs to have nxtHole
- * updated, causing another check for prv */
- RgSchUlAlloc *prv = hole->prvAlloc;
- RgSchUlAlloc *nxt = hole->nxtAlloc;
-
- if (prv)
- {
- if (hole->start == prv->nxtHole->start)
- {
- prv->nxtHole = NULLP;
- }
- alloc = rgSCHUtlUlAllocGetAdjNxt(sf->allocDb, prv);
- }
- else
- {
- alloc = rgSCHUtlUlAllocGetFirst(sf->allocDb);
- }
-
- RGSCH_NULL_CHECK( 0, alloc);
- alloc->prvHole = NULLP;
- alloc->nxtHole = NULLP;
-
- alloc->sbStart = hole->start;
- alloc->numSb = hole->num;
-
- if (nxt)
- {
- nxt->prvHole = NULLP;
- }
-
- rgSCHUtlUlHoleRls(sf->holeDb, hole);
-
- /* UL_ALLOC_CHANGES*/
- alloc->allocDbRef = (void*)sf->allocDb;
- alloc->holeDbRef = (void*)sf->holeDb;
- return (alloc);
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlAllocGetPartHole
- *
- * Desc : Get an allocation corresponding to a part of a hole.
- * The initial 'numSb' part of the hole shall be taken
- * away for this alloc.
- *
- * Ret : RgSchUlAlloc *
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-RgSchUlAlloc *rgSCHUtlUlAllocGetPartHole(RgSchUlSf *sf,uint8_t numSb,RgSchUlHole *hole)
-{
- RgSchUlAlloc *alloc;
- /* alloc = rgSCHUtlUlAllocGetAndIns(sf->allocDb, hole->prvAlloc, hole->nxtAlloc); */
- /* Calling rgSchCmnUlAllocGetAndIns is ok, but prv alloc needs to have nxtHole
- * updated, causing another check for prv */
- RgSchUlAlloc *prv = hole->prvAlloc;
-
- if (prv)
- {
- if (hole->start == prv->nxtHole->start)
- {
- prv->nxtHole = NULLP;
- }
- alloc = rgSCHUtlUlAllocGetAdjNxt(sf->allocDb, prv);
- }
- else
- {
- alloc = rgSCHUtlUlAllocGetFirst(sf->allocDb);
- }
-
- RGSCH_NULL_CHECK( 0, alloc);
- alloc->prvHole = NULLP;
- alloc->nxtHole = hole;
- hole->prvAlloc = alloc;
-
- alloc->sbStart = hole->start;
- alloc->numSb = numSb;
- hole->start += numSb;
- hole->num -= numSb;
-
- rgSCHUtlUlHoleDecr(sf->holeDb, hole);
-
- /* UL_ALLOC_CHANGES*/
- alloc->allocDbRef = (void*)sf->allocDb;
- alloc->holeDbRef = (void*)sf->holeDb;
-
- return (alloc);
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlAllocFirst
- *
- * Desc : Get first alloc in slot
- *
- * Ret : RgSchUlAlloc *
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-RgSchUlAlloc *rgSCHUtlUlAllocFirst(RgSchUlSf *sf)
-{
- return (sf->allocDb->first);
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlAllocNxt
- *
- * Desc : Get next alloc
- *
- * Ret : RgSchUlAlloc *
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-RgSchUlAlloc *rgSCHUtlUlAllocNxt(RgSchUlSf *sf,RgSchUlAlloc *alloc)
-{
- UNUSED(sf);
- return (alloc->nxt);
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlAllocGetAdjNxt
- *
- * Desc : Get alloc which is immediately after the passed one.
- * 1. Gets alloc from mem.
- * 2. Inserts alloc into list (between prv and
- * prv->nxt, prv is not NULLP).
- * 3. Increments alloc count.
- * Note 1: Holes are not dealt with here.
- * Note 2: Assumes prv to be NULL.
- *
- * Ret : RgSchUlAlloc *
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-RgSchUlAlloc *rgSCHUtlUlAllocGetAdjNxt(RgSchUlAllocDb *db,RgSchUlAlloc *prv)
-{
- RgSchUlAlloc *alloc = rgSCHUtlUlAllocMemGet(&db->mem);
- RgSchUlAlloc *nxt = prv->nxt;
-
-#if (ERRCLASS & ERRCLS_DEBUG)
- if ( alloc == NULLP )
- {
- return ( NULLP );
- }
-#endif
- alloc->prv = prv;
- alloc->nxt = nxt;
- prv->nxt = alloc;
- if (nxt)
- {
- nxt->prv = alloc;
- }
-
- ++db->count;
-
- return (alloc);
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlAllocGetFirst
- *
- * Desc : Get alloc which is to be the first one in the alloc list
- * 1. Gets alloc from mem.
- * 2. Inserts alloc as first element into list.
- * 3. Increments alloc count.
- * Note 1: Holes are not dealt with here.
- * Note 2: prv to necessarily NULLP.
- *
- * Ret : RgSchUlAlloc *
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-RgSchUlAlloc *rgSCHUtlUlAllocGetFirst(RgSchUlAllocDb *db)
-{
- RgSchUlAlloc *alloc = rgSCHUtlUlAllocMemGet(&db->mem);
- RgSchUlAlloc *nxt = db->first;
-
-#if (ERRCLASS & ERRCLS_DEBUG)
- if ( alloc == NULLP )
- {
- return ( NULLP );
- }
-#endif
-
- alloc->prv = NULLP;
- alloc->nxt = nxt;
- if (nxt)
- {
- nxt->prv = alloc;
- }
- db->first = alloc;
-
- ++db->count;
-
- return (alloc);
-}
-
-/* UL_ALLOC_ENHANCEMENT */
-/***********************************************************
- *
- * Func : rgSCHUtlUlHoleAddAllocation
- *
- * Desc : On freeing an alloc, add to hole
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHUtlUlHoleAddAllocation(RgSchUlAlloc *alloc)
-{
- /* Note: rgSchCmnUlHoleUpdAllocLnks function that is used should not exist as
- * one, if such excessive branching is done (AllocNone, AllocNoPrv etc).
- * The excessive branching is meant to utilise the knowledge of whether prv
- * and nxt allocs exist or not. Hence for each kind (none, noprv, nonxt,
- * both), there should be a rgSchCmnUlHoleUpdAllocLnks... function (such as
- * rgSchCmnUlHoleUpdAllocLnksNone/NoPrv etc. */
- RgSchUlHoleDb *db = alloc->holeDbRef;
- RgSchUlHole *prv = alloc->prvHole;
- RgSchUlHole *nxt = alloc->nxtHole;
-
- if (prv)
- {
- if (nxt)
- {
- rgSCHUtlUlHoleJoin(db, prv, nxt, alloc);
- }
- else
- rgSCHUtlUlHoleExtndRight(db, prv, alloc);
- }
- else
- {
- if (nxt)
- {
- rgSCHUtlUlHoleExtndLeft(db, nxt, alloc);
- }
- else
- rgSCHUtlUlHoleNew(db, alloc);
- }
- return;
-}
-
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlAllocRelease
- *
- * Desc : Releases an uplink allocation, only take alloc ptr
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHUtlUlAllocRelease(RgSchUlAlloc *alloc)
-{
- RgSchUlAllocDb *allocDb = alloc->allocDbRef;
- RgSchUlAlloc *prv = alloc->prv;
- RgSchUlAlloc *nxt = alloc->nxt;
-
- alloc->ue = NULLP;
- alloc->raCb = NULLP;
- alloc->isAdaptive = FALSE;
-
- if (prv)
- {
- prv->nxt = nxt;
- if (nxt) /* general case: this allocation lies btw two */
- {
- nxt->prv = prv;
- }
- }
- else
- {
- allocDb->first = nxt;
- if (nxt)
- {
- nxt->prv = NULLP;
- }
- }
- --allocDb->count;
- rgSCHUtlUlHoleAddAllocation(alloc);
- rgSCHUtlUlAllocMemRls(&allocDb->mem, alloc);
-
- return;
-}
-
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlAllocRls
- *
- * Desc : Releases an uplink allocation
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHUtlUlAllocRls(RgSchUlSf *sf,RgSchUlAlloc *alloc)
-{
- RgSchUlAllocDb *allocDb = sf->allocDb;
- RgSchUlAlloc *prv = alloc->prv;
- RgSchUlAlloc *nxt = alloc->nxt;
-
- alloc->ue = NULLP;
- alloc->raCb = NULLP;
- alloc->isAdaptive = FALSE;
-
- if(allocDb->count)
- {
- if (prv)
- {
- prv->nxt = nxt;
- if (nxt) /* general case: this allocation lies btw two */
- {
- nxt->prv = prv;
- }
- }
- else
- {
- allocDb->first = nxt;
- if (nxt)
- {
- nxt->prv = NULLP;
- }
- }
- --allocDb->count;
- rgSCHUtlUlHoleAddAlloc(sf, alloc);
- rgSCHUtlUlAllocMemRls(&allocDb->mem, alloc);
- }
- else
- {
-
- DU_LOG("\nERROR --> SCH : allocDb->count is ZERO ");
- }
-
- //DU_LOG("\nallocDb->count:%u\n",allocDb->count);
-
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlHoleFirst
- *
- * Desc : Get first (largest) hole
- *
- * Ret : RgSchUlHole *
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-RgSchUlHole *rgSCHUtlUlHoleFirst(RgSchUlSf *sf)
-{
- return (sf->holeDb->first);
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlHoleNxt
- *
- * Desc : Get next largest hole
- *
- * Ret : RgSchUlHole *
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-RgSchUlHole *rgSCHUtlUlHoleNxt(RgSchUlSf *sf,RgSchUlHole *hole)
-{
- UNUSED(sf);
- return (hole->nxt);
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlHoleAddAlloc
- *
- * Desc : On freeing an alloc, add to hole
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHUtlUlHoleAddAlloc(RgSchUlSf *sf,RgSchUlAlloc *alloc)
-{
- /* Note: rgSchCmnUlHoleUpdAllocLnks function that is used should not exist as
- * one, if such excessive branching is done (AllocNone, AllocNoPrv etc).
- * The excessive branching is meant to utilise the knowledge of whether prv
- * and nxt allocs exist or not. Hence for each kind (none, noprv, nonxt,
- * both), there should be a rgSchCmnUlHoleUpdAllocLnks... function (such as
- * rgSchCmnUlHoleUpdAllocLnksNone/NoPrv etc. */
- RgSchUlHoleDb *db = sf->holeDb;
- RgSchUlHole *prv = alloc->prvHole;
- RgSchUlHole *nxt = alloc->nxtHole;
-
- if (prv)
- {
- if (nxt)
- {
- rgSCHUtlUlHoleJoin(db, prv, nxt, alloc);
- }
- else
- rgSCHUtlUlHoleExtndRight(db, prv, alloc);
- }
- else
- {
- if (nxt)
- {
- rgSCHUtlUlHoleExtndLeft(db, nxt, alloc);
- }
- else
- rgSCHUtlUlHoleNew(db, alloc);
- }
-
- /* increment the number of subbands getting freed to total available list */
- sf->availSubbands += alloc->numSb;
-
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlHoleJoin
- *
- * Desc : Join two holes (due to alloc being deleted)
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHUtlUlHoleJoin(RgSchUlHoleDb *db,RgSchUlHole *prv,RgSchUlHole *nxt,RgSchUlAlloc *alloc)
-{
- prv->num += alloc->numSb + nxt->num;
- rgSCHUtlUlHoleRls(db, nxt);
- rgSCHUtlUlHoleIncr(db, prv);
- rgSCHUtlUlHoleUpdAllocLnks(prv, alloc->prv, alloc->nxt);
-
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlHoleExtndRight
- *
- * Desc : Extend hole due to alloc coming 'after' the hole
- * being deleted
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHUtlUlHoleExtndRight(RgSchUlHoleDb *db,RgSchUlHole *prv,RgSchUlAlloc *alloc)
-{
- prv->num += alloc->numSb;
- rgSCHUtlUlHoleIncr(db, prv);
- rgSCHUtlUlHoleUpdAllocLnks(prv, alloc->prv, alloc->nxt);
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlHoleExtndLeft
- *
- * Desc : Extend hole due to alloc coming 'before' the hole
- * being deleted
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHUtlUlHoleExtndLeft(RgSchUlHoleDb *db,RgSchUlHole *nxt,RgSchUlAlloc *alloc)
-{
- nxt->num += alloc->numSb;
- nxt->start = alloc->sbStart;
- rgSCHUtlUlHoleIncr(db, nxt);
- rgSCHUtlUlHoleUpdAllocLnks(nxt, alloc->prv, alloc->nxt);
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlHoleNew
- *
- * Desc : Create new hole due to alloc being deleted
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHUtlUlHoleNew(RgSchUlHoleDb *db,RgSchUlAlloc *alloc)
-{
- RgSchUlHole *hole = rgSCHUtlUlHoleMemGet(&db->mem);
-#if (ERRCLASS & ERRCLS_DEBUG)
- if ( hole == NULLP )
- {
- return;
- }
-#endif
- hole->start = alloc->sbStart;
- hole->num = alloc->numSb;
- ++db->count;
- rgSCHUtlUlHoleIns(db, hole);
- rgSCHUtlUlHoleUpdAllocLnks(hole, alloc->prv, alloc->nxt);
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlHoleUpdAllocLnks
- *
- * Desc : Update alloc links in hole
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHUtlUlHoleUpdAllocLnks(RgSchUlHole *hole,RgSchUlAlloc *prvAlloc,RgSchUlAlloc *nxtAlloc)
-{
- if (prvAlloc)
- {
- prvAlloc->nxtHole = hole;
- }
- if (nxtAlloc)
- {
- nxtAlloc->prvHole = hole;
- }
- hole->prvAlloc = prvAlloc;
- hole->nxtAlloc = nxtAlloc;
- return;
-}
-
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlHoleIns
- *
- * Desc : Insert (newly created) hole in sorted list of holes.
- * Searches linearly, beginning with the largest hole.
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHUtlUlHoleIns(RgSchUlHoleDb *db,RgSchUlHole *hole)
-{
- RgSchUlHole *cur;
-
- if ((cur = db->first) != NULLP)
- {
- RgSchUlHole *nxt;
- if (cur->num < hole->num)
- {
- /* Add at front */
- hole->nxt = cur;
- cur->prv = hole;
- db->first = hole;
- hole->prv = NULLP;
- return;
- }
-
- for (nxt = cur->nxt; nxt; cur = nxt, nxt = nxt->nxt)
- {
- if (nxt->num < hole->num)
- {
- /* Insert hole: cur <-> hole <-> nxt */
- cur->nxt = hole;
- hole->prv = cur;
- hole->nxt = nxt;
- nxt->prv = hole;
- return;
- }
- }
-
- /* Add at end */
- cur->nxt = hole;
- hole->prv = cur;
- hole->nxt = NULLP;
- return;
- }
-
- /* This is the first hole */
- db->first = hole;
- hole->prv = NULLP; /* may not be needed */
- hole->nxt = NULLP;
- return;
-}
-
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlHoleIncr
- *
- * Desc : hole->num has increeased, reposition in sorted
- * list if needed
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHUtlUlHoleIncr(RgSchUlHoleDb *db,RgSchUlHole *hole)
-{
- RgSchUlHole *cur;
-
- if ((cur = hole->prv) != NULLP)
- {
- RgSchUlHole *prv;
-
- if (cur->num > hole->num)
- {
- return;
- }
-
- /* Remove hole from current position */
- cur->nxt = hole->nxt;
- if (hole->nxt)
- {
- hole->nxt->prv = cur;
- }
-
- for (prv = cur->prv; prv; cur = prv, prv = prv->prv)
- {
- if (prv->num > hole->num)
- {
- /* Insert hole: prv <-> hole <-> cur */
- prv->nxt = hole;
- hole->prv = prv;
- hole->nxt = cur;
- cur->prv = hole;
- return;
- }
- }
-
- /* Add at front */
- hole->nxt = cur;
- cur->prv = hole;
- db->first = hole;
- hole->prv = NULLP;
- return;
- }
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlHoleDecr
- *
- * Desc : hole->num has decreeased, reposition in sorted
- * list if needed
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHUtlUlHoleDecr(RgSchUlHoleDb *db,RgSchUlHole *hole)
-{
- RgSchUlHole *cur;
-
- if ((cur = hole->nxt) != NULLP)
- {
- RgSchUlHole *nxt;
-
- if (cur->num < hole->num)
- {
- return;
- }
-
- /* Remove hole from current position */
- cur->prv = hole->prv;
- if (hole->prv)
- {
- hole->prv->nxt = cur;
- }
- else /* no prv, so cur to replace hole as first in list */
- {
- db->first = cur;
- }
-
- for (nxt = cur->nxt; nxt; cur = nxt, nxt = nxt->nxt)
- {
- if (nxt->num < hole->num)
- {
- /* Insert hole: cur <-> hole <-> nxt */
- cur->nxt = hole;
- hole->prv = cur;
- hole->nxt = nxt;
- nxt->prv = hole;
- return;
- }
- }
-
- /* Add at end */
- cur->nxt = hole;
- hole->prv = cur;
- hole->nxt = NULLP;
- return;
- }
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlHoleRls
- *
- * Desc : Releases hole.
- * 1. Decrements hole count.
- * 2. Deletes hole from list.
- * 3. Frees hole (hole memory release).
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHUtlUlHoleRls(RgSchUlHoleDb *db,RgSchUlHole *hole)
-{
- RgSchUlHole *prv = hole->prv;
- RgSchUlHole *nxt = hole->nxt;
-
- --db->count;
- if (prv)
- {
- prv->nxt = nxt;
- if (nxt)
- {
- nxt->prv = prv;
- }
- }
- else
- {
- db->first = nxt;
- if (nxt)
- {
- nxt->prv = NULLP;
- }
- }
-
- rgSCHUtlUlHoleMemRls(&db->mem, hole);
- return;
-}
-
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlAllocMemInit
- *
- * Desc : Initialises alloc free pool
- *
- * Ret : S16 (ROK/RFAILED)
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-S16 rgSCHUtlUlAllocMemInit(RgSchCellCb *cell,RgSchUlAllocMem *mem,uint8_t maxAllocs)
-{
- S16 ret;
- RgSchUlAlloc *allocs;
-
- ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&allocs,
- maxAllocs * sizeof(*allocs));
- if (ret != ROK)
- {
- return (ret);
- }
- mem->allocs = allocs;
- mem->maxAllocs = maxAllocs;
- if (mem->maxAllocs == 1)
- {
- allocs[0].prv = NULLP;
- allocs[0].nxt = NULLP;
- }
- else
- {
- uint8_t i;
- allocs[0].prv = NULLP;
- allocs[0].nxt = &allocs[1];
- for (i = 1; i < mem->maxAllocs - 1; ++i)
- {
- allocs[i].prv = &allocs[i-1];
- allocs[i].nxt = &allocs[i+1];
- }
- allocs[i].prv = &allocs[i-1];
- allocs[i].nxt = NULLP;
- }
- mem->firstFree = &allocs[0];
- return ROK;
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlAllocMemDeinit
- *
- * Desc : Deinitialises alloc free pool
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHUtlUlAllocMemDeinit(RgSchCellCb *cell,RgSchUlAllocMem *mem)
-{
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(mem->allocs)),
- mem->maxAllocs * sizeof(*mem->allocs));
- mem->maxAllocs = 0;
- mem->firstFree = NULLP;
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlHoleMemInit
- *
- * Desc : Initialises hole free pool. Assumes maxHoles
- * to be at least 2.
- *
- * Ret : S16 (ROK/RFAILED)
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-S16 rgSCHUtlUlHoleMemInit(RgSchCellCb *cell,RgSchUlHoleMem *mem,uint8_t maxHoles,RgSchUlHole **holeRef)
-{
- S16 ret;
- RgSchUlHole *holes;
-
- ret = rgSCHUtlAllocSBuf(cell->instIdx, (Data **)&holes,
- maxHoles * sizeof(*holes));
- if (ret != ROK)
- {
- return (ret);
- }
-
- mem->holes = holes;
- mem->maxHoles = maxHoles;
-
- /* first hole is taken up */
- holes[0].prv = NULLP; /* not needed */
- holes[0].nxt = NULLP; /* not needed */
- *holeRef = &holes[0];
-
- if (mem->maxHoles == 2)
- {
- holes[1].prv = NULLP; /* may not be needed */
- holes[1].nxt = NULLP; /* may not be needed */
- }
- else
- {
- uint8_t i;
- holes[1].prv = NULLP;
- holes[0].nxt = &holes[1];
- for (i = 1; i < mem->maxHoles - 1; ++i)
- {
- holes[i].prv = &holes[i-1];
- holes[i].nxt = &holes[i+1];
- }
- holes[i].prv = &holes[i-1];
- holes[i].nxt = NULLP;
- }
- mem->firstFree = &holes[1];
-
- return ROK;
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlHoleMemDeinit
- *
- * Desc : Deinitialises hole free pool
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHUtlUlHoleMemDeinit(RgSchCellCb *cell,RgSchUlHoleMem *mem)
-{
- /* ccpu00117052 - MOD - Passing double pointer
- for proper NULLP assignment*/
- rgSCHUtlFreeSBuf(cell->instIdx, (Data **)(&(mem->holes)),
- mem->maxHoles * sizeof(*mem->holes));
- mem->maxHoles = 0;
- mem->firstFree = NULLP;
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlAllocMemGet
- *
- * Desc : Gets an 'alloc' from the free pool
- *
- * Ret : RgSchUlAlloc *
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-RgSchUlAlloc *rgSCHUtlUlAllocMemGet(RgSchUlAllocMem *mem)
-{
- RgSchUlAlloc *alloc;
-
-#if (ERRCLASS & ERRCLS_DEBUG)
- if (mem->firstFree == NULLP)
- {
- return (NULLP);
- }
-#endif
-
- alloc = mem->firstFree;
- mem->firstFree = alloc->nxt;
- alloc->nxt = NULLP; /* probably not needed */
- /* alloc->prv might already be NULLP, in case was needed to set it to NULLP */
-
- return (alloc);
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlAllocMemRls
- *
- * Desc : Returns an 'alloc' to the free pool
- *
- * Ret :
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHUtlUlAllocMemRls(RgSchUlAllocMem *mem,RgSchUlAlloc *alloc)
-{
- alloc->prv = NULLP;
-
- alloc->nxt = mem->firstFree;
- if (mem->firstFree != NULLP)
- {
- mem->firstFree->prv = alloc;
- }
- mem->firstFree = alloc;
- return;
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlHoleMemGet
- *
- * Desc : Gets a 'hole' from the free pool
- *
- * Ret : RgSchUlHole *
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-RgSchUlHole *rgSCHUtlUlHoleMemGet(RgSchUlHoleMem *mem)
-{
- RgSchUlHole *hole;
-
-#if (ERRCLASS & ERRCLS_DEBUG)
- if (mem->firstFree == NULLP)
- {
- return (NULLP);
- }
-#endif
-
- hole = mem->firstFree;
- mem->firstFree = hole->nxt;
- mem->firstFree->prv = NULLP; /* may not be needed, under error class */
- hole->nxt = NULLP; /* probably not needed */
- /* hole->prv is might already be NULLP, in case was needed to set it to NULLP */
-
- return (hole);
-}
-
-/***********************************************************
- *
- * Func : rgSCHUtlUlHoleMemRls
- *
- * Desc : Returns a 'hole' to the free pool
- *
- * Ret : Void
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-Void rgSCHUtlUlHoleMemRls(RgSchUlHoleMem *mem,RgSchUlHole *hole)
-{
- hole->prv = NULLP;
-
- hole->nxt = mem->firstFree;
- if (mem->firstFree != NULLP)
- {
- mem->firstFree->prv = hole;
- }
- mem->firstFree = hole;
- return;
-}
-
-/**
- * @brief Get an alloc from the specified position in the BW.
- *
- * @details
- *
- * Function : rgSCHUtlUlGetSpfcAlloc
- *
- * - Return an alloc from the specified position in the BW.
- * Note: This function assumes there is always a hole
- * Existing which completely has the specified
- * allocation. The reason for such an assumption is
- * the function's usage as of now guarantees that there
- * will always be such hole. And also for efficiency.
- *
- * @param[in] RgSchUlSf *sf
- * @param[in] uint8_t startSb
- * @param[in] uint8_t numSb
- * @return RgSchUlAlloc*
- **/
-RgSchUlAlloc *rgSCHUtlUlGetSpfcAlloc(RgSchUlSf *sf,uint8_t startSb,uint8_t numSb)
-{
- RgSchUlHole *hole, *nxtHole;
- RgSchUlAlloc *alloc = NULLP;
-
- if ((hole = rgSCHUtlUlHoleFirst(sf)) == NULLP)
- {
- return (NULLP);
- }
- do
- {
- nxtHole = rgSCHUtlUlHoleNxt(sf, hole);
- if ((startSb >= hole->start) &&
- (startSb+numSb <= hole->start+hole->num))
- {
- if (startSb != hole->start)
- {
- /* Create a new hole to accomodate Subbands between
- * hole start and req alloc start */
- RgSchUlHole *newHole = rgSCHUtlUlHoleMemGet(&(sf->holeDb->mem));
-
-#if (ERRCLASS & ERRCLS_DEBUG)
- if ( newHole == NULLP )
- {
- return ( NULLP );
- }
-#endif
- newHole->start = hole->start;
- newHole->num = startSb - hole->start;
- hole->start = startSb;
- /* [ccpu00122847]-MOD- Correctly updating the hole->num */
- hole->num -= newHole->num;
- ++(sf->holeDb->count);
- rgSCHUtlUlHoleIns(sf->holeDb, newHole);
- newHole->prvAlloc = hole->prvAlloc;
- if (newHole->prvAlloc)
- {
- newHole->prvAlloc->nxtHole = newHole;
- }
- if (numSb == hole->num)
- {
- alloc = rgSCHUtlUlAllocGetCompHole(sf, hole);
- }
- else
- {
- alloc = rgSCHUtlUlAllocGetPartHole(sf, numSb, hole);
- }
- alloc->prvHole = newHole;
- newHole->nxtAlloc = alloc;
- }
- else /* Hole start and req alloc start are same */
- {
- if (numSb == hole->num)
- {
- alloc = rgSCHUtlUlAllocGetCompHole(sf, hole);
- }
- else
- {
- alloc = rgSCHUtlUlAllocGetPartHole(sf, numSb, hole);
- }
- }
- break;
- }
- } while ((hole = nxtHole) != NULLP);
- return (alloc);
-}
-#ifdef LTE_L2_MEAS
-/**
- * @brief Validates the qci values
- *
- * @details
- *
- * Function :rgSCHUtlValidateQci
- *
- * @param[in] RgSchCellCb *cellCb
- * @param[in] uint8_t numQci
- * @param[out] uint8_t *qci
- * @return S16
- * ROK
- * RFAILED
- **/
-static S16 rgSCHUtlValidateQci(RgSchCellCb *cellCb,uint8_t numQci,uint8_t *qci)
-{
- uint8_t qciIdx;
- uint8_t qciVal;
-
- for(qciIdx = 0; qciIdx < numQci; qciIdx++)
- {
- qciVal = qci[qciIdx];
- if(qciVal == 0 || qciVal > 9)
- {
- return RFAILED;
- }
- if(qciVal != cellCb->qciArray[qciVal].qci)
- {
- return RFAILED;
- }
- }
-
- return ROK;
-}/* rgSCHUtlValidateQci */
-/**
- * @brief Validates the measurement request parameters.
- *
- * @details
- *
- * Function :rgSCHUtlValidateMeasReq
- *
- * @param[in] RgSchCellCb *cellCb
- * @param[in] LrgSchMeasReqInfo *schL2MeasInfo
- * @param[out] RgSchErrInfo *err
- * @return RgSchUlAlloc*
- **/
-S16 rgSCHUtlValidateMeasReq(RgSchCellCb *cellCb, LrgSchMeasReqInfo *schL2MeasInfo,RgSchErrInfo *err)
-{
- uint16_t measType;
- S16 ret;
-
- measType = schL2MeasInfo->measType;
- if((measType == 0) ||
- measType > 2047)
- {
- err->errType = RGSCHERR_SCH_INVALID_MEAS_TYPE;
- err->errCause = RGSCHERR_SCH_L2MEAS;
- return RFAILED;
- }
- if((schL2MeasInfo->timePrd !=0) &&
- (measType & LRG_L2MEAS_AVG_PRB_PER_QCI_DL) &&
- ((schL2MeasInfo->avgPrbQciDl.numQci > LRG_MAX_QCI_PER_REQ)||
- (schL2MeasInfo->avgPrbQciDl.numQci == 0)))
- {
- err->errType = RGSCHERR_SCH_INVALID_PARAM_RANGE;
- err->errCause = RGSCHERR_SCH_L2MEAS;
- return RFAILED;
- }
- if((schL2MeasInfo->timePrd !=0) &&
- (measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL) &&
- (schL2MeasInfo->avgPrbQciUl.numQci > LRG_MAX_QCI_PER_REQ))
- {
- err->errType = RGSCHERR_SCH_INVALID_PARAM_RANGE;
- err->errCause = RGSCHERR_SCH_L2MEAS;
- return RFAILED;
- }
- if((measType & LRG_L2MEAS_NMB_ACTV_UE_PER_QCI_DL) &&
- ((schL2MeasInfo->nmbActvUeQciDl.numQci > LRG_MAX_QCI_PER_REQ) ||
- (schL2MeasInfo->nmbActvUeQciDl.sampPrd == 0)||
- ((schL2MeasInfo->timePrd !=0)&&
- (schL2MeasInfo->timePrd < schL2MeasInfo->nmbActvUeQciDl.sampPrd)) ||
- (schL2MeasInfo->nmbActvUeQciDl.sampPrd > LRG_MAX_SAMP_PRD)))
- {
- err->errType = RGSCHERR_SCH_INVALID_PARAM_RANGE;
- err->errCause = RGSCHERR_SCH_L2MEAS;
- return RFAILED;
- }
- if((measType & LRG_L2MEAS_NMB_ACTV_UE_PER_QCI_UL) &&
- ((schL2MeasInfo->nmbActvUeQciUl.numQci > LRG_MAX_QCI_PER_REQ) ||
- (schL2MeasInfo->nmbActvUeQciUl.sampPrd == 0)||
- ((schL2MeasInfo->timePrd !=0) &&
- (schL2MeasInfo->timePrd < schL2MeasInfo->nmbActvUeQciUl.sampPrd)) ||
- (schL2MeasInfo->nmbActvUeQciUl.sampPrd > LRG_MAX_SAMP_PRD)))
- {
- err->errType = RGSCHERR_SCH_INVALID_PARAM_RANGE;
- err->errCause = RGSCHERR_SCH_L2MEAS;
- return RFAILED;
- }
- if((schL2MeasInfo->timePrd !=0) &&
- (measType & LRG_L2MEAS_AVG_PRB_PER_QCI_DL))
- {
- RGSCH_ARRAY_BOUND_CHECK(cellCb->instIdx, schL2MeasInfo->avgPrbQciDl.qci, \
- (schL2MeasInfo->avgPrbQciDl.numQci));
- ret = rgSCHUtlValidateQci(cellCb, schL2MeasInfo->avgPrbQciDl.numQci,
- schL2MeasInfo->avgPrbQciDl.qci);
- if(ret != ROK)
- {
- err->errType = RGSCHERR_SCH_INVALID_QCI_VAL;
- err->errCause = RGSCHERR_SCH_L2MEAS;
- return RFAILED;
- }
- }
- return ROK;
-}/* rgSCHUtlValidateMeasReq */
-#endif /* LTE_L2_MEAS */
-/******* </AllocHolesMemMgmnt>: END *****/
-#ifdef RGR_SI_SCH
-/**
- * @brief API for sending SI configuration confirm from Scheduler to RRM
- *
- * @details
- *
- * Function: rgSCHUtlRgrSiCfgCfm
- *
- * This API is invoked to send SI configuration confirm from Scheduler
- * to RRM.
- * This API fills in Pst structure and SAP Ids and invokes
- * config confirm API towards RRM.
- *
- * @param[in] RgrCfgTransId transId
- * @param[in] uint8_t status
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHUtlRgrSiCfgCfm(Inst instId,SpId spId,RgrCfgTransId transId,uint8_t status)
-{
- uint8_t prntTrans[RGR_CFG_TRANSID_SIZE+1];
-
- memcpy(prntTrans, transId.trans, RGR_CFG_TRANSID_SIZE);
- prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
- if(RgUiRgrSiCfgCfm(&rgSchCb[instId].rgrSap[spId].sapCfg.sapPst,
- rgSchCb[instId].rgrSap[spId].sapCfg.suId,
- transId, status) != ROK)
- {
- DU_LOG("\nERROR --> SCH : rgSCHUtlRgrSiCfgCfm: "
- "RgUiRgrSiCfgCfm Failed ");
- return RFAILED;
- }
-
- return ROK;
-} /* rgSCHUtlRgrSiCfgCfm */
-
-\f
-/**
- * @brief API for sending Warning SI configuration confirm from
- * Scheduler to RRM
- *
- * @details
- *
- *
- * This API is invoked to send Warning SI configuration confirm
- * from Scheduler to RRM.
- * This API fills in Pst structure and SAP Ids and invokes
- * config confirm API towards RRM.
- *
- * @param[in] RgrCfgTransId transId
- * @param[in] uint8_t status
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHUtlRgrWarningSiCfgCfm(Inst instId,SpId spId,uint8_t siId,RgrCfgTransId transId,uint8_t status)
-{
- uint8_t prntTrans[RGR_CFG_TRANSID_SIZE+1];
-
- memcpy(prntTrans, transId.trans, RGR_CFG_TRANSID_SIZE);
- prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
-
- if(RgUiRgrWarningSiCfgCfm(&rgSchCb[instId].rgrSap[spId].sapCfg.sapPst,
- rgSchCb[instId].rgrSap[spId].sapCfg.suId,
- transId, siId, status) != ROK)
- {
- DU_LOG("\nERROR --> SCH : rgSCHUtlRgrSiCfgCfm: "
- "RgUiRgrSiCfgCfm Failed ");
- return RFAILED;
- }
-
- return ROK;
-} /* rgSCHUtlRgrWarningSiCfgCfm */
-
-/***********************************************************
- *
- * Func : rgSCHUtlPutSiInfo
- *
- * Desc : Utility Function to deallocate SI information
- *
- *
- * RFAILED
- *
- *
- * File : rg_utl.c
- *
- **********************************************************/
-Void rgSCHUtlPutSiInfo(RgSchCellCb *cell)
-{
- uint8_t idx = 0;
- uint32_t sizeOfSiInfo = 0;
- /*Free the buffers in crntSiInfo*/
- RGSCH_FREE_MSG(cell->siCb.crntSiInfo.mib)
- RGSCH_FREE_MSG(cell->siCb.crntSiInfo.sib1Info.sib1)
-
- sizeOfSiInfo = sizeof(cell->siCb.crntSiInfo.siInfo)/sizeof(cell->siCb.crntSiInfo.siInfo[0]);
-
- for(idx=0; idx < sizeOfSiInfo; idx++)
- {
- RGSCH_FREE_MSG(cell->siCb.crntSiInfo.siInfo[idx].si)
- }
-
- /*Free the buffers in newSiInfo */
- RGSCH_FREE_MSG(cell->siCb.newSiInfo.mib)
- RGSCH_FREE_MSG(cell->siCb.newSiInfo.sib1Info.sib1)
-
- sizeOfSiInfo = sizeof(cell->siCb.newSiInfo.siInfo)/sizeof(cell->siCb.newSiInfo.siInfo[0]);
-
- for(idx=0; idx < sizeOfSiInfo; idx++)
- {
- RGSCH_FREE_MSG(cell->siCb.newSiInfo.siInfo[idx].si)
- }
-
- return;
-}
-#endif /*RGR_SI_SCH */
-
-
-
-/***********************************************************
- *
- * Func : rgSCHUtlGetDrxSchdUesInDl
- *
- * Desc : Utility Function to fill the get the list of
- * scheduled UEs. On these UE's, drx-inactivity
- * timer will be started/restarted.
- *
- * Ret : ROK
- * RFAILED
- *
- * Notes:
- *
- * File : rg_utl.c
- *
- **********************************************************/
-S16 rgSCHUtlGetDrxSchdUesInDl
-(
-RgSchCellCb *cellCb,
-RgSchUeCb *ueCb,
-RgSchDlHqProcCb *dlHq,
-RgInfUeAlloc *allocInfo,
-CmLListCp *dlDrxInactvTmrLst,
-CmLListCp *dlInActvLst,
-CmLListCp *ulInActvLst
-)
-{
- Bool isNewTx = FALSE;
- uint8_t idx;
- RgSchDrxDlHqProcCb *drxHq;
- RgSchDRXCellCb *drxCell = cellCb->drxCb;
- RgSchDrxUeCb *drxUe;
- uint8_t cellIdx = ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(dlHq->hqE->cell)];
- uint32_t dlInactvMask;
- uint32_t ulInactvMask;
-
- for(idx = 0; idx < allocInfo->nmbOfTBs; idx++)
- {
- if(allocInfo->tbInfo[idx].isReTx == FALSE)
- {
- isNewTx = TRUE;
- /* Removing break here, since in 2 TB case if 2nd TB is proceeding with
- retx then drxretx timer should be stopped.*/
- }
- else
- {
- /*Stop the DRX retransmission timer as UE scheduled for retx. Here
- * we stop the timer and inactivate the UE for both UL and DL.
- * This may result in loss of one slot for UL but this trade
- * off is taken to avoid the overhead of maintaining a list of UEs
- * to be inactivated in the next slot.*/
- drxHq = RG_SCH_DRX_GET_DL_HQ(dlHq);
- drxUe = RG_SCH_DRX_GET_UE(ueCb);
- if(drxHq->reTxIndx != DRX_INVALID)
- {
- /* This condition should never occur */
- if(drxHq->reTxIndx >= RG_SCH_MAX_DRXQ_SIZE)
- {
- DU_LOG("\nERROR --> SCH : [%d]UE:DRXUE RETX IDX[%d]"
- "is out of bound,dlInactvMask %d,procId %d\n", ueCb->ueId,
- drxHq->reTxIndx,ueCb->dl.dlInactvMask, dlHq->procId);
- }
-
- drxUe->drxDlInactvMaskPerCell[cellIdx] |= (RG_SCH_DRX_DLHQ_BITMASK << dlHq->procId);
- drxUe->drxUlInactvMaskPerCell[cellIdx] |= (RG_SCH_DRX_DLHQ_BITMASK << dlHq->procId);
-
- dlInactvMask = RG_SCH_DRX_DLHQ_BITMASK << dlHq->procId;
- ulInactvMask = RG_SCH_DRX_DLHQ_BITMASK << dlHq->procId;
-
- for(cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
- {
- dlInactvMask &= drxUe->drxDlInactvMaskPerCell[cellIdx];
- ulInactvMask &= drxUe->drxUlInactvMaskPerCell[cellIdx];
- }
-
- drxUe->drxDlInactvMask |= dlInactvMask;
- drxUe->drxUlInactvMask |= ulInactvMask;
-
- /* if no other condition is keeping ue active,
- * inactivate the Ue
- */
- if(!RG_SCH_DRX_DL_IS_UE_ACTIVE(drxUe))
- {
- /* BUG 2 : HARQ_RTT, changed for consistency */
- ueCb->dl.dlInactvMask |= (RG_DRX_INACTIVE);
-
- /* Add to DL inactive list */
- cmLListAdd2Tail(dlInActvLst,&(ueCb->dlDrxInactvLnk));
- ueCb->dlDrxInactvLnk.node = (PTR)ueCb;
- }
-
- if(!RG_SCH_DRX_UL_IS_UE_ACTIVE(drxUe))
- {
- /*BUG 2: HARQ_RTT changed for consistency */
- ueCb->ul.ulInactvMask |= (RG_DRX_INACTIVE);
-
- cmLListAdd2Tail(ulInActvLst,&(ueCb->ulDrxInactvLnk));
- ueCb->ulDrxInactvLnk.node = (PTR)ueCb;
- }
-
- /* Deleting entry from HARQ RTT queue for the same HARQ proc,
- * if exist. This is the special case which can happen iF UL
- * scheduling is done later. */
- if(drxHq->rttIndx != DRX_INVALID)
- {
- cmLListDelFrm (&(cellCb->drxCb->drxQ[drxHq->rttIndx].harqRTTQ),
- &(drxHq->harqRTTEnt));
-
- drxHq->rttIndx = DRX_INVALID;
- }
-
- cmLListDelFrm (&(drxCell->drxQ[drxHq->reTxIndx].harqRetxQ),
- &(drxHq->harqRetxEnt));
- drxHq->reTxIndx = DRX_INVALID;
- }
- }
- }
-
- if(isNewTx == TRUE)
- {
- if(ueCb->drxCb->raRcvd == TRUE)
- {
- ueCb->drxCb->raRcvd = FALSE;
-
- /* mark the ra bit */
- ueCb->drxCb->drxUlInactvMask |= RG_SCH_DRX_RA_BITMASK;
- ueCb->drxCb->drxDlInactvMask |= RG_SCH_DRX_RA_BITMASK;
-
- }/*if(ra->rcvd) == TRUE */
-
- if(ueCb->dlDrxInactvTmrLnk.node == NULLP)
- {
- cmLListAdd2Tail(dlDrxInactvTmrLst,&(ueCb->dlDrxInactvTmrLnk));
- ueCb->dlDrxInactvTmrLnk.node = (PTR)ueCb;
- }
- }/*if(isNewTx == TRUE) */
-
- return ROK;
-}/* rgSCHUtlGetSchdUes*/
-\f
-/* ccpu00117452 - MOD - Changed macro name from
- RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
-#ifdef RGR_CQI_REPT
-/**
- * @brief This function fills StaInd struct
- *
- * @details
- *
- * Function: rgSCHUtlFillSndStaInd
- * Purpose: Fills StaInd struct and sends the
- * StaInd to RRM
- *
- * @param[in] RgSchCellCb *cell pointer to Cell Control block
- * @param[in] RgSchUeCb *ue pointer to Ue Control block
- * @param[in] RgrStaIndInfo *staInfo Sta Ind struct to be filled
- * @param[in] uint8_t numCqiRept NUmber of reports to be filled
- * @return Void
- *
- **/
-S16 rgSCHUtlFillSndStaInd(RgSchCellCb *cell,RgSchUeCb *ue,RgrStaIndInfo *staInfo,uint8_t numCqiRept)
-{
- uint8_t idxStart;
-
- /* Fill StaInd for sending collated Latest N CQI rpeorts */
- /* Find index in the array from where Latest N
- reports needs to be fetched. Use this value to index in the array
- and copy the reports into staInfo */
-
- /* Fill the Cell Id of PCC of the UE */
- staInfo->cellId = ue->cell->cellId;
- staInfo->crnti = ue->ueId;
-
- idxStart = ue->schCqiInfo.cqiCount - numCqiRept;
-
- memcpy (&(staInfo->ueCqiInfo.cqiRept),
- &(ue->schCqiInfo.cqiRept[idxStart]),
- numCqiRept * sizeof(RgrUeCqiRept));
-
- staInfo->ueCqiInfo.numCqiRept = numCqiRept;
-
- ue->schCqiInfo.cqiCount = 0;
-
- /* Call utility function (rgSCHUtlRgrStaInd) to send rpts to RRM */
- if(rgSCHUtlRgrStaInd(cell, staInfo) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Could not send "
- "CQI reports for RNTI:%d",ue->ueId);
- return RFAILED;
- }
-
- return ROK;
-
-}/* End of rgSCHUtlFillSndStaInd */
-
-
-\f
-/**
- * @brief API for sending STA indication from Scheduler to RRM.
- *
- * @details
- *
- * Function: rgSCHUtlRgrStaInd
- *
- * This API is invoked to send STA indication from Scheduler instance to RRM.
- * This API fills in Pst structure and RgrStaIndInfo
- * and calls the Sta primitive API towards RRM.
- *
- * @param[in] cell RgSchCellCb
- * @param[in] RgrStsIndInfo *rgrSta
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHUtlRgrStaInd(RgSchCellCb *cell,RgrStaIndInfo *rgrSta)
-{
- S16 ret = ROK;
- RgSchUpSapCb *rgrSap; /*!< RGR SAP Control Block */
-
- rgrSap = cell->rgrSap;
- if (rgrSap->sapSta.sapState != LRG_BND)
- {
- DU_LOG("\nERROR --> SCH : rgSCHUtlRgrStaInd() Upper SAP not bound (%d) ",
- rgrSap->sapSta.sapState);
- return RFAILED;
- }
- RgUiRgrStaInd(&(cell->rgrSap->sapCfg.sapPst),
- cell->rgrSap->sapCfg.suId, rgrSta);
- return (ret);
-} /* rgSCHUtlRgrStaInd*/
-#endif /* End of RGR_CQI_REPT */
-
-/* Fix : syed HO UE does not have a valid ue->rntiLnk */
-/**
- * @brief Indicates MAC to release any rnti context it has.
- *
- * @details
- * Function : rgSCHUtlIndRntiRls2Mac
- * This function indicates MAC for this rnti release.
- * In case of ueId change it will indicate MAC
- * about the new rnti to be updated.
- * It will post a release RNTI indication to MAC.
- *
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] CmLteRnti rnti
- * @param[in] Bool ueIdChng
- * @param[in] CmLteRnti newRnti
- * @return Void
- * -# ROK
- **/
-Void rgSCHUtlIndRntiRls2Mac(RgSchCellCb *cell,CmLteRnti rnti,Bool ueIdChng,CmLteRnti newRnti)
-{
- Pst pst;
- Inst inst = cell->instIdx;
- RgInfRlsRnti rntiInfo;
-
-
- /* Copy the info to rntiInfo */
- rntiInfo.cellId = cell->cellId;
- rntiInfo.rnti = rnti;
- /* Fix : syed ueId change as part of reestablishment.
- * Now SCH to trigger this. CRG ueRecfg for ueId change
- * is dummy */
- rntiInfo.ueIdChng = ueIdChng;
- rntiInfo.newRnti = newRnti;
-#ifdef LTE_ADV
- rntiInfo.isUeSCellDel = FALSE;
-#endif
- /* Invoke MAC to release the rnti */
- rgSCHUtlGetPstToLyr(&pst, &rgSchCb[inst], cell->macInst);
- RgSchMacRlsRnti(&pst, &rntiInfo);
- return;
-}
-
-/* LTE_ADV_FLAG_REMOVED_START */
-/**
- * @brief API for sending LOAD INF indication from Scheduler to RRM.
- * @details
- *
- * Function: rgSCHUtlRgrLoadInfInd
- *
- * This API is invoked to send LOAD INF indication from Scheduler instance to RRM.
- * This API fills in Pst structure and RgrLoadInfIndInfo
- * and calls the Sta primitive API towards RRM.
- *
- * @param[in] cell RgSchCellCb
- * @param[in] RgrLoadInfIndInfo *rgrLoadInf
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHUtlRgrLoadInfInd(RgSchCellCb *cell,RgrLoadInfIndInfo *rgrLoadInf)
-{
- S16 ret = ROK;
- RgSchUpSapCb *rgrSap; /*!< RGR SAP Control Block */
-
- rgrSap = cell->rgrSap;
- if (rgrSap->sapSta.sapState != LRG_BND)
- {
- DU_LOG("\nERROR --> SCH : rgSCHUtlRgrLoadInfInd() Upper SAP not bound (%d) ",
- rgrSap->sapSta.sapState);
- return RFAILED;
- }
- RgUiRgrLoadInfInd(&(cell->rgrSap->sapCfg.sapPst),
- cell->rgrSap->sapCfg.suId, rgrLoadInf);
- return (ret);
-} /* rgSCHUtlRgrLoadInfInd*/
-/* LTE_ADV_FLAG_REMOVED_END */
-
-/* MS_FIX : syed SCH to act as MASTER in maintaining
- * rnti related context. Trigger to rnti del/Chng at SCH
- * will result in a Indication to MAC to release its
- * RNTI context. MAC inturn indicates the context cleared
- * indication to SCH, upon which SCH would set this
-/**
- * @brief API for sending STA indication from Scheduler to RRM.
- *
- * @details
- *
- * Function: rgSCHUtlRlsRnti
- *
- * This API is invoked to indicate MAC to release rnti
- *
- * @param[in] RgSchCellCb *cellCb
- * @param[in] RgSchRntiLnk *rntiLnk,
- * @param[in] Bool ueIdChngd,
- * @param[in] CmLteRnti newRnti
- * @return Void
- **/
-
-Void rgSCHUtlRlsRnti(RgSchCellCb *cell,RgSchRntiLnk *rntiLnk,Bool ueIdChngd,CmLteRnti newRnti)
-{
-
- uint8_t isLegacy = 0;
-#ifdef EMTC_ENABLE
- if(cell->emtcEnable)
- {
- rgSCHEmtcUtlRlsRnti(cell, rntiLnk, &isLegacy);
- }
-#endif
- if(!isLegacy)
- {
- /*Add to Guard Pool*/
- cmLListAdd2Tail(&cell->rntiDb.rntiGuardPool, &rntiLnk->rntiGrdPoolLnk);
- rntiLnk->rntiGrdPoolLnk.node = (PTR)rntiLnk;
- }
- /* Fix: syed Explicitly Inidcate MAC to release RNTI */
- rgSCHUtlIndRntiRls2Mac(cell, rntiLnk->rnti, ueIdChngd, newRnti);
-
- return;
-}
-
-
-/**
- * @brief This function fills StaInd struct
- *
- * @details
- *
- * Function: rgSCHUtlFillSndUeStaInd
- * Purpose: Fills StaInd struct and sends the
- * StaInd to RRM
- *
- * @param[in] RgSchCellCb *cell pointer to Cell Control block
- * @param[in] RgSchUeCb *ue pointer to Ue Control block
- * @param[in] uint8_t numCqiRept NUmber of reports to be filled
- * @return Void
- *
- **/
-S16 rgSCHUtlFillSndUeStaInd(RgSchCellCb *cell,RgSchUeCb *ue,RgrUeStaIndInfo *ueStaInfo)
-{
-
- ueStaInfo->cellId = cell->cellId;
- ueStaInfo->crnti = ue->ueId;
-
- /* Call utility function (rgSCHUtlRgrUeStaInd) to send rpts to RRM */
- if(rgSCHUtlRgrUeStaInd(cell, ueStaInfo) != ROK)
- {
- DU_LOG("\nERROR --> SCH : Could not send "
- "UE Sta reports CRNTI:%d",ue->ueId);
- return RFAILED;
- }
-
- return ROK;
-
-}/* End of rgSCHUtlFillSndStaInd */
-
-
-\f
-/**
- * @brief API for sending STA indication from Scheduler to RRM.
- *
- * @details
- *
- * Function: rgSCHUtlRgrStaInd
- *
- * This API is invoked to send STA indication from Scheduler instance to RRM.
- * This API fills in Pst structure and RgrStaIndInfo
- * and calls the Sta primitive API towards RRM.
- *
- * @param[in] cell RgSchCellCb
- * @param[in] RgrStsIndInfo *rgrSta
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHUtlRgrUeStaInd(RgSchCellCb *cell,RgrUeStaIndInfo *rgrUeSta)
-{
- S16 ret = ROK;
- RgSchUpSapCb *rgrSap; /*!< RGR SAP Control Block */
-
- rgrSap = cell->rgrSap;
- if (rgrSap->sapSta.sapState != LRG_BND)
- {
- DU_LOG("\nERROR --> SCH : rgSCHUtlRgrUeStaInd() Upper SAP not bound (%d) ",
- rgrSap->sapSta.sapState);
- return RFAILED;
- }
- RgUiRgrUeStaInd(&(cell->rgrSap->sapCfg.sapPst),
- cell->rgrSap->sapCfg.suId, rgrUeSta);
- return (ret);
-} /* rgSCHUtlRgrStaInd*/
-
-/* RRM_RBC_X */
-/**
- * @brief function to report DL and UL PRB usage to RRM.
- *
- *
- * Function: rgSCHUtlUpdAvgPrbUsage
- * This function sends the PRB usage report to
- * RRM with the interval configured by RRM.
- *
- * @param[in] cell *RgSchCellCb
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHUtlUpdAvgPrbUsage(RgSchCellCb *cell)
-{
- CmLteTimingInfo frm;
- RgmPrbRprtInd *prbRprtInd;
- S16 ret = ROK;
- uint32_t idx;
-#ifdef DBG_MAC_RRM_PRB_PRINT
- static uint32_t count = 0;
- const uint32_t reprotForEvery20Sec = 20000/cell->prbUsage.rprtPeriod;
-
- count++;
-#endif
-
- frm = cell->crntTime;
- RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA);
-
- uint16_t numDlSf;
- uint16_t numUlSf;
-#ifdef LTE_TDD
-
- if(cell->prbUsage.rprtPeriod >= RGSCH_NUM_SUB_FRAMES)
- {
- /* Get the total number of DL and UL slots within the reporting period*/
- numDlSf = (cell->prbUsage.rprtPeriod *
- rgSchTddNumDlSubfrmTbl[cell->ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1])
- / RGSCH_NUM_SUB_FRAMES;
- numUlSf = (cell->prbUsage.rprtPeriod *
- rgSchTddNumUlSubfrmTbl[cell->ulDlCfgIdx][RGSCH_NUM_SUB_FRAMES-1])
- / RGSCH_NUM_SUB_FRAMES;
- }
- else
- {
- /* Get the total number of DL and UL slots < 10 ms interval */
- numDlSf = rgSchTddNumDlSubfrmTbl[cell->ulDlCfgIdx][frm.slot];
- numUlSf = rgSchTddNumUlSubfrmTbl[cell->ulDlCfgIdx][frm.slot];
- }
-#else
- numDlSf = cell->prbUsage.rprtPeriod;
- numUlSf = cell->prbUsage.rprtPeriod;
-#endif
-
- SCH_ALLOC(prbRprtInd, sizeof(RgmPrbRprtInd));
- if(prbRprtInd == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Failed to allocate memory for prbRprtInd");
- return RFAILED;
- }
-
- memset(&prbRprtInd->stQciPrbRpts[0],
- 0,
- (RGM_MAX_QCI_REPORTS * sizeof(RgmPrbRptPerQci)));
-
- prbRprtInd->bCellId = cell->cellId;
-
- if(numDlSf > 0)
- {
- prbRprtInd->bPrbUsageMask |= RGM_PRB_USAGE_DL;
- for (idx = 0; idx < RGM_MAX_QCI_REPORTS; idx++ )
- {
- prbRprtInd->stQciPrbRpts[idx].bAvgPrbDlUsage =
- RGSCH_DIV_ROUND((cell->prbUsage.qciPrbRpts[idx].dlTotPrbUsed*100),
- (numDlSf * cell->bwCfg.dlTotalBw));
- prbRprtInd->stQciPrbRpts[idx].bQci = cell->prbUsage.qciPrbRpts[idx].qci;
- cell->prbUsage.qciPrbRpts[idx].dlTotPrbUsed = 0;
- }
- }
-
- if(numUlSf > 0)
- {
- prbRprtInd->bPrbUsageMask |= RGM_PRB_USAGE_UL;
- for (idx = 0; idx < RGM_MAX_QCI_REPORTS; idx++ )
- {
- prbRprtInd->stQciPrbRpts[idx].bAvgPrbUlUsage =
- RGSCH_DIV_ROUND((cell->prbUsage.qciPrbRpts[idx].ulTotPrbUsed*100),
- (numUlSf * cell->ulAvailBw));
- prbRprtInd->stQciPrbRpts[idx].bQci = cell->prbUsage.qciPrbRpts[idx].qci;
- cell->prbUsage.qciPrbRpts[idx].ulTotPrbUsed = 0;
- }
- }
-
-#ifdef DBG_MAC_RRM_PRB_PRINT
- if((count % reprotForEvery20Sec) == 0 )
- {
- DU_LOG("\n====================================================================");
- DU_LOG("\nINFO --> SCH : QCI-1[DL:UL] | QCI-2[DL:UL] | QCI-3[DL:UL] | QCI-4[DL:UL] \n");
- DU_LOG("======================================================================\n");
- DU_LOG(" [%d: %d]\t | [%d: %d]\t | [%d: %d]\t| [%d: %d]\t\n",
- prbRprtInd->stQciPrbRpts[0].bAvgPrbDlUsage,
- prbRprtInd->stQciPrbRpts[0].bAvgPrbUlUsage,
- prbRprtInd->stQciPrbRpts[1].bAvgPrbDlUsage,
- prbRprtInd->stQciPrbRpts[1].bAvgPrbUlUsage,
- prbRprtInd->stQciPrbRpts[2].bAvgPrbDlUsage,
- prbRprtInd->stQciPrbRpts[2].bAvgPrbUlUsage,
- prbRprtInd->stQciPrbRpts[3].bAvgPrbDlUsage,
- prbRprtInd->stQciPrbRpts[3].bAvgPrbUlUsage);
- }
-#endif
- RgUiRgmSendPrbRprtInd(&(cell->rgmSap->sapCfg.sapPst),
- cell->rgmSap->sapCfg.suId, prbRprtInd);
-
-
- return (ret);
-}
-/* RRM_RBC_Y */
-
-/**
- * @brief This function resends the Ta in case of
- * max retx failure or DTX for the Ta transmitted
- *
- * @details
- *
- * Function: rgSCHUtlReTxTa
- * Purpose:
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return Void
- *
- **/
-Void rgSCHUtlReTxTa(RgSchCellCb *cellCb,RgSchUeCb *ueCb)
-{
-
- /* If TA Timer is running. Stop it */
- if (ueCb->taTmr.tmrEvnt != TMR_NONE)
- {
- rgSCHTmrStopTmr(cellCb, ueCb->taTmr.tmrEvnt, ueCb);
- }
- /*[ccpu00121813]-ADD-If maxretx is reached then
- * use outstanding TA val for scheduling again */
- if(ueCb->dl.taCb.outStndngTa == TRUE)
- {
- ueCb->dl.taCb.ta = ueCb->dl.taCb.outStndngTaval;
- ueCb->dl.taCb.outStndngTaval = RGSCH_NO_TA_RQD;
- ueCb->dl.taCb.outStndngTa = FALSE;
-
- }
- /* Fix : syed TA state updation missing */
- ueCb->dl.taCb.state = RGSCH_TA_TOBE_SCHEDULED;
- rgSCHUtlDlTARpt(cellCb, ueCb);
-
- return;
-}
-
-/* Added function for dropping Paging Message*/
-/**
- * @brief Handler for BO Updt received for BCCH or PCCH.
- *
- * @details
- *
- * Function : rgSCHChkBoUpdate
- *
- * This function shall check for BO received falls within the scheduling window or not
- *
- *
- * @param[in] RgSchCellCb *cell
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-static S16 rgSCHChkBoUpdate(RgSchCellCb *cell,RgInfCmnBoRpt *boUpdt)
-{
-
- uint32_t crntTimeInSubFrms = 0;
- uint32_t boUpdTimeInSubFrms = 0;
- uint32_t distance = 0;
-
- crntTimeInSubFrms = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G) + cell->crntTime.slot +
- RG_SCH_CMN_DL_DELTA + 2; /* As bo received will scheduled in next TTI
- so incrementing with +1 more */
- boUpdTimeInSubFrms = (boUpdt->u.timeToTx.sfn * RGSCH_NUM_SUB_FRAMES_5G)+ boUpdt->u.timeToTx.slot;
-
-
- distance = boUpdTimeInSubFrms > crntTimeInSubFrms ? \
- boUpdTimeInSubFrms - crntTimeInSubFrms : \
- (RGSCH_MAX_SUBFRM_5G - crntTimeInSubFrms + boUpdTimeInSubFrms);
-
- if (distance > RGSCH_PCCHBCCH_WIN)
- {
- return RFAILED;
- }
- return ROK;
-
-}/*rgSCHChkBoUpdate*/
-
-
-#ifdef LTE_TDD
-/**
- * @brief Utility function to calculate the UL reTxIdx in TDD cfg0
- *
- * @details
- *
- * Function : rgSchUtlCfg0ReTxIdx
- *
- * Update the reTxIdx according to the rules mentioned
- * in 3GPP TS 36.213 section 8 for TDD Cfg0
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] CmLteTimingInfo phichTime
- * @param[in] uint8_t hqFdbkIdx
- * @return uint8_t
- **/
-uint8_t rgSchUtlCfg0ReTxIdx(RgSchCellCb *cell,CmLteTimingInfo phichTime,uint8_t hqFdbkIdx)
-{
- uint8_t reTxIdx = RGSCH_INVALID_INFO;
- uint8_t iPhich = 0;
- RgSchCmnUlCell *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
- RgSchUlSf *ulSf;
- uint8_t ulSF; /* UL SF in the TDD frame */
-
- ulSf = &cellUl->ulSfArr[hqFdbkIdx];
- ulSF = ulSf->ulSfIdx;
-
- /* Check for the UL SF 4 or 9 */
- if(ulSF == 9 || ulSF == 4)
- {
- iPhich = 1;
- }
- if(phichTime.slot == 0 || phichTime.slot == 5)
- {
- if(iPhich == 0)
- {
- /* Retx will happen according to the Pusch k table */
- reTxIdx = cellUl->schdIdx;
- }
- if(iPhich == 1)
- {
- /* Retx will happen at n+7 */
- RGSCHCMNADDTOCRNTTIME(phichTime, phichTime, 7);
- /* Fetch the corresponding UL slot Idx in UL sf array */
- reTxIdx = rgSCHCmnGetUlSfIdx(&phichTime, cell);
- }
- }
- else if(phichTime.slot == 1 || phichTime.slot == 6)
- {
- /* Retx will happen at n+7 */
- RGSCHCMNADDTOCRNTTIME(phichTime, phichTime, 7);
- /* Fetch the corresponding UL slot Idx in UL sf array */
- reTxIdx = rgSCHCmnGetUlSfIdx(&phichTime, cell);
- }
- return (reTxIdx);
-}
-#endif
-
-/**
- * @brief Utility function to calculate total num of PRBs required to
- * satisfy DL BO for TM1/TM2/TM6/TM7
- *
- * @details
- *
- * Function : rgSchUtlDlCalc1CwPrb
- *
- * Calculate PRBs required for UE to satisfy BO in DL
- *
- * Note : Total calculated PRBs will be assigned to *prbReqrd
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *prbReqrd
- * @return Void
- **/
-Void rgSchUtlDlCalc1CwPrb(RgSchCellCb *cell,RgSchUeCb *ue,uint32_t bo,uint32_t *prbReqrd)
-{
- RgSchCmnDlCell *dlCell = RG_SCH_CMN_GET_DL_CELL(cell);
- RgSchCmnDlUe *dlUe = RG_SCH_CMN_GET_DL_UE(ue, cell);
- uint32_t eff;
- uint32_t noRes;
- uint8_t iTbs;
- uint8_t cfi = dlCell->currCfi;
-
- iTbs = dlUe->mimoInfo.cwInfo[0].iTbs[0];
- eff = (*(RgSchCmnTbSzEff *)(dlCell->cqiToEffTbl[0][cfi]))[iTbs];
-
- /* Optimization to convert totalBo (which is in-terms of bytes) to bits
- * i.e, << 3 and multiply with 1024 i.e, << 10 */
- noRes = ((uint64_t)((bo << 3) << 10)) / (eff);
- /* Get the number of RBs needed for this transmission */
- /* Number of RBs = No of REs / No of REs per RB */
- *prbReqrd = RGSCH_CEIL(noRes, dlCell->noResPerRb[cfi]);
-
- return;
-} /* rgSchUtlDlCalc1CwPrb*/
-
-/**
- * @brief Utility function to calculate total num of PRBs required to
- * satisfy DL BO(BO sum of all logical channels for that UE or an LC BO)
- * for TM3/TM4
- *
- * @details
- *
- * Function : rgSchUtlDlCalc2CwPrb
- *
- * Calculate PRBs required for UE to satisfy BO in DL
- *
- * Note : Total calculated PRBs will be assigned to *prbReqrd
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *prbReqrd
- * @return Void
- **/
-Void rgSchUtlDlCalc2CwPrb(RgSchCellCb *cell,RgSchUeCb *ue,uint32_t bo,uint32_t *prbReqrd)
-{
- RgSchCmnDlCell *dlCell = RG_SCH_CMN_GET_DL_CELL(cell);
- RgSchCmnDlUe *dlUe = RG_SCH_CMN_GET_DL_UE(ue, cell);
- uint32_t eff1, eff2;
- uint32_t noRes;
- uint8_t noLyr1, noLyr2;
- uint8_t iTbs1, iTbs2;
- uint8_t cfi = dlCell->currCfi;
-
- if ((dlUe->mimoInfo.forceTD) ||/* Transmit Diversity (TD) */
- (dlUe->mimoInfo.ri < 2))/* 1 layer precoding */
- {
- iTbs1 = dlUe->mimoInfo.cwInfo[0].iTbs[0];
- eff1 = (*(RgSchCmnTbSzEff *)(dlCell->cqiToEffTbl[0][cfi]))[iTbs1];
-
- /* Optimization to convert totalBo (which is in-terms of bytes) to bits
- * i.e, << 3 and multiply with 1024 i.e, << 10 */
- noRes = ((uint64_t)((bo << 3) << 10)) / (eff1);
- /* Get the number of RBs needed for this transmission */
- /* Number of RBs = No of REs / No of REs per RB */
- *prbReqrd = RGSCH_CEIL(noRes, dlCell->noResPerRb[cfi]);
- }
- else
- {
- noLyr1 = dlUe->mimoInfo.cwInfo[0].noLyr;
- noLyr2 = dlUe->mimoInfo.cwInfo[1].noLyr;
- iTbs1 = dlUe->mimoInfo.cwInfo[0].iTbs[noLyr1 - 1];
- iTbs2 = dlUe->mimoInfo.cwInfo[1].iTbs[noLyr2 - 1];
- eff1 = (*(RgSchCmnTbSzEff *)(dlCell->cqiToEffTbl[noLyr1 - 1][cfi]))[iTbs1];
- eff2 = (*(RgSchCmnTbSzEff *)(dlCell->cqiToEffTbl[noLyr2 - 1][cfi]))[iTbs2];
-
- /* Optimization to convert totalBo (which is in-terms of bytes) to bits
- * i.e, << 3 and multiply with 1024 i.e, << 10 */
- noRes = ((uint64_t)((bo << 3) << 10)) / (eff1 + eff2);
- /* Get the number of RBs needed for this transmission */
- /* Number of RBs = No of REs / No of REs per RB */
- *prbReqrd = RGSCH_CEIL(noRes, dlCell->noResPerRb[cfi]);
- }
- return;
-} /* rgSchUtlDlCalc2CwPrb */
-
-/**
- * @brief Utility function to calculate total num of PRBs required to
- * satisfy DL BO(BO sum of all logical channels for that UE or an LC BO)
- *
- * @details
- *
- * Function : rgSchUtlCalcTotalPrbReq
- *
- * This function calls TM specific routine to calculate PRB
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t bo
- * @param[out] uint32_t *prbReqrd
- * @return Void
- **/
-Void rgSchUtlCalcTotalPrbReq(RgSchCellCb *cell,RgSchUeCb *ue,uint32_t bo,uint32_t *prbReqrd)
-{
- /* Call TM specific Prb calculation routine */
- (dlCalcPrbFunc[ue->mimoInfo.txMode - 1])(cell, ue, bo, prbReqrd);
-
- return;
-} /* rgSchUtlCalcTotalPrbReq */
-#ifdef UNUSE_FUN
-#ifdef TFU_UPGRADE
-/***********************************************************
- *
- * Func : rgSCHUtlFetchPcqiBitSz
- *
- *
- * Desc : Fetch the CQI/PMI bits for a UE based on the mode, periodicity.
- *
- * Ret : uint8_t
- * ROK - Success
- *
- * Notes:
- *
- * File :
- *
- **********************************************************/
-static uint8_t rgSCHUtlFetchPcqiBitSz(RgSchCellCb *cell, RgSchUeCb *ueCb,uint8_t numTxAnt)
-{
- uint8_t confRepMode;
- uint8_t pcqiSz;
- uint8_t ri;
- RgSchUePCqiCb *cqiCb = RG_SCH_GET_UE_CELL_CQI_CB(ueCb,cell);
-
- confRepMode = cqiCb->cqiCfg.cqiSetup.prdModeEnum;
- if((ueCb->mimoInfo.txMode != RGR_UE_TM_3) &&
- (ueCb->mimoInfo.txMode != RGR_UE_TM_4))
- {
- ri =1;
- }
- else
- {
- ri = cqiCb->perRiVal;
- }
- switch(confRepMode)
- {
- case RGR_PRD_CQI_MOD10:
- {
- pcqiSz = 4;
- }
- break;
-
- case RGR_PRD_CQI_MOD11:
- {
- if(numTxAnt == 2)
- {
- if (ri ==1)
- {
- pcqiSz = 6;
- }
- else
- {
- pcqiSz = 8;
- }
- }
- else if(numTxAnt == 4)
- {
- if (ri ==1)
- {
- pcqiSz = 8;
- }
- else
- {
- pcqiSz = 11;
- }
- }
- else
- {
- /* This is number of antenna case 1.
- * This is not applicable for Mode 1-1.
- * So setting it to invalid value */
- pcqiSz = 0;
- }
- }
- break;
-
- case RGR_PRD_CQI_MOD20:
- {
- if(cqiCb->isWb)
- {
- pcqiSz = 4;
- }
- else
- {
- pcqiSz = 4 + cqiCb->label;
- }
- }
- break;
-
- case RGR_PRD_CQI_MOD21:
- {
- if(cqiCb->isWb)
- {
- if(numTxAnt == 2)
- {
- if (ri ==1)
- {
- pcqiSz = 6;
- }
- else
- {
- pcqiSz = 8;
- }
- }
- else if(numTxAnt == 4)
- {
- if (ri ==1)
- {
- pcqiSz = 8;
- }
- else
- {
- pcqiSz = 11;
- }
- }
- else
- {
- /* This might be number of antenna case 1.
- * For mode 2-1 wideband case only antenna port 2 or 4 is supported.
- * So setting invalid value.*/
- pcqiSz = 0;
- }
- }
- else
- {
- if (ri ==1)
- {
- pcqiSz = 4 + cqiCb->label;
- }
- else
- {
- pcqiSz = 7 + cqiCb->label;
- }
- }
- }
- break;
-
- default:
- pcqiSz = 0;
- break;
- }
-
- return (pcqiSz);
-}
-#endif
-#endif
-/**
- * @brief Utility function to returns the number of subbands based on the
- * requested bytes.
- *
- * @details
- *
- * Function : rgSchUtlGetNumSbs
- *
- * Calculate the number of PRBs
- * Update the subbandRequired based on the nPrbs and subband size
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @param[in] uint32_t *numSbs
- * @return uint8_t
- **/
-uint8_t rgSchUtlGetNumSbs(RgSchCellCb *cell,RgSchUeCb *ue,uint32_t *numSbs)
-{
- uint32_t nPrb;
- //Currently hardcoding MAX prb for each UE
- nPrb = ue->ue5gtfCb.maxPrb;
- (*numSbs) = RGSCH_CEIL(nPrb, MAX_5GTF_VRBG_SIZE);
- return ROK;
-}
-
-/**
- * @brief Utility function to insert the UE node into UE Lst based on the
- * number of subbands allocated for the UE for the current TTI.
- *
- * @details
- *
- * Function : rgSchUtlSortInsUeLst
- *
- * If subbandRequired < Min, then insert at head
- * Else If subbandRequired > Max, then insert at tail
- * Else, traverse the list and place the node at the appropriate place
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ue
- * @return uint8_t
- **/
-uint8_t rgSchUtlSortInsUeLst(RgSchCellCb *cell,CmLListCp *ueLst,CmLList *node,uint8_t vrbgRequired)
-{
- CmLList *ueInLst;
- CmLList *firstUeInLst;
- CmLList *lastUeInLst;
- RgSchUeCb *tempUe;
- RgSchCmnUlUe *ueUl;
-
- //firstUeInLst = cmLListFirst(ueLst);
- CM_LLIST_FIRST_NODE(ueLst,firstUeInLst);
- if(NULLP == firstUeInLst)
- {
- /* first node to be added to the list */
- cmLListAdd2Tail(ueLst, node);
- }
- else
- {
- /* Sb Required for the UE is less than the first node in the list */
- tempUe = (RgSchUeCb *)(firstUeInLst->node);
- ueUl = RG_SCH_CMN_GET_UL_UE(tempUe, cell);
-
- if(vrbgRequired <= ueUl->vrbgRequired)
- {
- cmLListInsCrnt(ueLst, (node));
- }
- else
- {
- /* Sb Required for this UE is higher than the UEs in the list */
- lastUeInLst = cmLListLast(ueLst);
- tempUe = (RgSchUeCb *)(lastUeInLst->node);
- if(vrbgRequired >= ueUl->vrbgRequired)
- {
- cmLListAdd2Tail(ueLst, (node));
- }
- else
- {
- /* This UE needs to be in the middle. Search and insert the UE */
- ueInLst = cmLListFirst(ueLst);
- do
- {
- tempUe = (RgSchUeCb *)(ueInLst->node);
-
- if(vrbgRequired <= ueUl->vrbgRequired)
- {
- cmLListInsCrnt(ueLst, (node));
- break;
- }
-
- ueInLst = cmLListNext(ueLst);
-
- } while(NULLP != ueInLst && ueInLst != firstUeInLst);
- }
- }
- }
-
- return ROK;
-}
-
-/**
- * @brief Function to Send LCG GBR register to MAC
- *
- * @details
- *
- * Function: rgSCHUtlBuildNSendLcgReg
- *
- * Handler for sending LCG GBR registration
- *
- * Invoked by:
- * SCHD
- *
- * Processing Steps:
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] CmLteRnti crnti
- * @param[in] uint8_t lcgId
- * @param[in] Bool isGbr
- * @return S16
- * -# ROK
- **/
-S16 rgSCHUtlBuildNSendLcgReg(RgSchCellCb *cell,CmLteRnti crnti,uint8_t lcgId,Bool isGbr)
-{
- Pst pst;
- RgInfLcgRegReq lcgRegReq;
-
- memset(&pst, 0, sizeof(Pst));
- lcgRegReq.isGbr = isGbr;
- lcgRegReq.cellId = cell->cellId;
- lcgRegReq.crnti = crnti;
- lcgRegReq.lcgId = lcgId;
- rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], cell->macInst);
- /* code Coverage portion of the test case */
- RgSchMacLcgReg(&pst, &lcgRegReq);
-
- return ROK;
-}
-
-#ifdef TFU_UPGRADE
-#ifdef LTE_ADV
-#ifndef TFU_TDD
-/**
- * @brief Function to map RGR pucch type to TFU type
- *
- * @details
- *
- * Function: rgSchUtlGetFdbkMode
- *
- *
- * Invoked by:
- * SCHD
- *
- * Processing Steps:
- *
- * @param[in] RgrSchFrmt1b3TypEnum
- * @return TfuAckNackMode
- * -# ROK
- **/
-TfuAckNackMode rgSchUtlGetFdbkMode(RgrSchFrmt1b3TypEnum fdbkType)
-{
-
- TfuAckNackMode mode = TFU_UCI_FORMAT_1A_1B;
-
- switch(fdbkType)
- {
- case RG_SCH_UCI_FORMAT_NON_CA:
- case RG_SCH_UCI_FORMAT1A_1B:
- {
- mode = TFU_UCI_FORMAT_1A_1B;
- }
- break;
- case RG_SCH_UCI_FORMAT1B_CS:
- {
- mode = TFU_UCI_FORMAT_1B_CS;
- }
- break;
- case RG_SCH_UCI_FORMAT3:
- {
- mode = TFU_UCI_FORMAT_3;
- }
- break;
- }
- return (mode);
-}
-#endif /* TFU_TDD */
-#endif /* LTE_ADV */
-#endif /*TFU_UPGRADE */
-
-#ifdef LTE_ADV
-/**
- * @brief Send Ue SCell delete to SMAC.
- *
- * @details
- *
- * Function : rgSCHUtlSndUeSCellDel2Mac
- * This function populates the struct RgInfRlsRnti and
- * get the pst for SMac and mark field isUeSCellDel to TRUE which
- * indicates that it is a Ue SCell delete.
- *
- *
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] CmLteRnti rnti
- * @return Void
- * -# ROK
- **/
-Void rgSCHUtlSndUeSCellDel2Mac(RgSchCellCb *cell,CmLteRnti rnti)
-{
- Pst pst;
- Inst inst = cell->instIdx;
- RgInfRlsRnti rntiInfo;
-
- DU_LOG("\nINFO --> SCH : RNTI Release IND for UE(%d)\n", rnti);
- /* Copy the info to rntiInfo */
- rntiInfo.cellId = cell->cellId;
- rntiInfo.rnti = rnti;
- /* Fix : syed ueId change as part of reestablishment.
- * Now SCH to trigger this. CRG ueRecfg for ueId change
- * is dummy */
- rntiInfo.ueIdChng = FALSE;
- rntiInfo.newRnti = rnti;
- rntiInfo.isUeSCellDel = TRUE;
- /* Invoke MAC to release the rnti */
- rgSCHUtlGetPstToLyr(&pst, &rgSchCb[inst], cell->macInst);
- RgSchMacRlsRnti(&pst, &rntiInfo);
- return;
-}
-
-/**
- * @brief Returns max TB supported by a given txMode
- *
- * @details
- *
- * Function : rgSCHUtlGetMaxTbSupp
- * Max TB supported for TM Modes (1,2,5,6 and 7) is 1
- * and 2 for others
- *
- *
- * @param[in] RgrTxMode txMode
- * @return uint8_t maxTbCount;
- * -# ROK
- **/
-uint8_t rgSCHUtlGetMaxTbSupp(RgrTxMode txMode)
-{
- uint8_t maxTbCount;
-
- /* Primary Cell */
-
- switch(txMode)
- {
- case RGR_UE_TM_1:
- case RGR_UE_TM_2:
- case RGR_UE_TM_5:
- case RGR_UE_TM_6:
- case RGR_UE_TM_7:
- maxTbCount = 1;
- break;
- case RGR_UE_TM_3:
- case RGR_UE_TM_4:
- case RGR_UE_TM_8:
- case RGR_UE_TM_9:
- maxTbCount = 2;
- break;
- default:
- maxTbCount = 0;
- break;
- }
-
- return (maxTbCount);
-}
-
-/**
- * @brief Send Ue SCell delete to SMAC.
- *
- * @details
- *
- * Function : rgSCHTomUtlGetTrigSet
- * This function gets the triggerset based on cqiReq
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb ueCb
- * @param[in] uint8_t cqiReq,
- * @param[out] uint8_t *triggerSet
- *
- * @return Void
- * -# ROK
- **/
-Void rgSCHTomUtlGetTrigSet(RgSchCellCb *cell,RgSchUeCb *ueCb,uint8_t cqiReq,uint8_t *triggerSet)
-{
- RgSchUeCellInfo *pCellInfo = RG_SCH_CMN_GET_PCELL_INFO(ueCb);
- switch(cqiReq)
- {
- case RG_SCH_APCQI_SERVING_CC:
- {
- /* APeriodic CQI request for Current Carrier.*/
- uint8_t sCellIdx = ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)];
- *triggerSet = 1 << (7 - sCellIdx);
- break;
- }
- case RG_SCH_APCQI_1ST_SERVING_CCS_SET:
- {
- *triggerSet = pCellInfo->acqiCb.aCqiCfg.triggerSet1;
- break;
- }
- case RG_SCH_APCQI_2ND_SERVING_CCS_SET:
- {
- *triggerSet = pCellInfo->acqiCb.aCqiCfg.triggerSet2;
- break;
- }
- default:
- {
- /* BUG */
- break;
- }
- }
- return;
-}
-#endif
-/**
- * @brief This function updates the value of UE specific DCI sizes
- *
- * @details
- *
- * Function: rgSCHUtlUpdUeDciSize
- * Purpose: This function calculates and updates DCI Sizes in bits.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] RgSchUeCb *ueCb
- * @param[in] isCsi2Bit *isCsi2Bit: is 1 bit or 2 bit CSI
- * @return Void
- *
- **/
-Void rgSCHUtlUpdUeDciSize(RgSchCellCb *cell,RgSchUeCb *ueCb,Bool isCsi2Bit)
-{
- uint8_t dci01aCmnSize = cell->dciSize.baseSize[TFU_DCI_FORMAT_0];
- uint8_t dci01aDedSize = cell->dciSize.baseSize[TFU_DCI_FORMAT_0];
- if ((ueCb->accessStratumRls >= RGR_REL_10) && (cell->bwCfg.dlTotalBw >= cell->bwCfg.ulTotalBw))
- {
- dci01aCmnSize += 1; /* Resource Allocation Type DCI 0 */
- dci01aDedSize += 1; /* Resource Allocation Type DCI 0 */
- }
- if (isCsi2Bit == TRUE)
- {
- dci01aDedSize += 2; /* 2 bit CSI DCI 0 */
- }
- else
- {
- dci01aDedSize += 1; /* 1 bit CSI DCI 0 */
- }
-
- /* Common CSI is always 1 bit DCI 0 */
- dci01aCmnSize += 1; /* 1 bit CSI DCI 0 */
-
- /* Compare the sizes of DCI 0 with DCI 1A and consider the greater */
- if (dci01aCmnSize < cell->dciSize.baseSize[TFU_DCI_FORMAT_1A])
- {
- dci01aCmnSize = cell->dciSize.baseSize[TFU_DCI_FORMAT_1A];
- }
- if (dci01aDedSize < cell->dciSize.baseSize[TFU_DCI_FORMAT_1A])
- {
- dci01aDedSize = cell->dciSize.baseSize[TFU_DCI_FORMAT_1A];
- }
-
- /* Remove the Ambiguous Sizes as mentioned in table Table 5.3.3.1.2-1 Spec 36.212-a80 Sec 5.3.3.1.3 */
- dci01aCmnSize += rgSchDciAmbigSizeTbl[dci01aCmnSize];
- dci01aDedSize += rgSchDciAmbigSizeTbl[dci01aDedSize];
-
- ueCb->dciSize.cmnSize[TFU_DCI_FORMAT_0] = dci01aCmnSize;
- ueCb->dciSize.cmnSize[TFU_DCI_FORMAT_1A] = dci01aCmnSize;
-
- ueCb->dciSize.dedSize[TFU_DCI_FORMAT_0] = dci01aDedSize;
- ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1A] = dci01aDedSize;
-
- ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1] = cell->dciSize.baseSize[TFU_DCI_FORMAT_1];
- do {
- /* Spec 36.212-a80 Sec 5.3.3.1.2: If the UE is configured to decode PDCCH with CRC scrambled
- * by the C-RNTI and the number of information bits in format 1 is equal to that for format 0/1A
- * for scheduling the same serving cell and mapped onto the UE specific search space given by the
- * C-RNTI as defined in [3], one bit of value zero shall be appended to format 1. */
- if (ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1] == ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1A])
- {
- ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1] += 1;
- }
-
- /* Spec 36.212-a80 Sec 5.3.3.1.2: If the number of information bits in format 1 belongs
- * to one of the sizes in Table 5.3.3.1.2-1, one or more zero bit(s) shall be appended
- * to format 1 until the payload size of format 1 does not belong to one of the sizes in
- * Table 5.3.3.1.2-1 and is not equal to that of format 0/1A mapped onto the same search space. */
- ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1] += rgSchDciAmbigSizeTbl[ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1]];
- } while (ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1] == ueCb->dciSize.dedSize[TFU_DCI_FORMAT_1A]);
-
- /* Just copying the value of 2/2A to avoid multiple checks at PDCCH allocations. This values never change.*/
- ueCb->dciSize.dedSize[TFU_DCI_FORMAT_2] = cell->dciSize.size[TFU_DCI_FORMAT_2];
- ueCb->dciSize.dedSize[TFU_DCI_FORMAT_2A] = cell->dciSize.size[TFU_DCI_FORMAT_2A];
- ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_2] = cell->dciSize.size[TFU_DCI_FORMAT_2];
- ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_2A] = cell->dciSize.size[TFU_DCI_FORMAT_2A];
-
- /* Spec 36.212-a80 Sec 5.3.3.1.3: except when format 1A assigns downlink resource
- * on a secondary cell without an uplink configuration associated with the secondary cell */
- ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1A] = cell->dciSize.baseSize[TFU_DCI_FORMAT_1A];
- ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1A] += rgSchDciAmbigSizeTbl[ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1A]];
- ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1] = cell->dciSize.baseSize[TFU_DCI_FORMAT_1];
- do {
- /* Spec 36.212-a80 Sec 5.3.3.1.2: If the UE is configured to decode PDCCH with CRC scrambled
- * by the C-RNTI and the number of information bits in format 1 is equal to that for format 0/1A
- * for scheduling the same serving cell and mapped onto the UE specific search space given by the
- * C-RNTI as defined in [3], one bit of value zero shall be appended to format 1. */
- if (ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1] == ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1A])
- {
- ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1] += 1;
- }
-
- /* Spec 36.212-a80 Sec 5.3.3.1.2: If the number of information bits in format 1 belongs
- * to one of the sizes in Table 5.3.3.1.2-1, one or more zero bit(s) shall be appended
- * to format 1 until the payload size of format 1 does not belong to one of the sizes in
- * Table 5.3.3.1.2-1 and is not equal to that of format 0/1A mapped onto the same search space. */
- ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1] += rgSchDciAmbigSizeTbl[ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1]];
- } while (ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1] == ueCb->dciSize.noUlCcSize[TFU_DCI_FORMAT_1A]);
-#ifdef EMTC_ENABLE
- rgSCHEmtcUtlUpdUeDciSize(cell, ueCb);
-#endif
-}
-
-/**
- * @brief This function initialises the DCI Size table
- *
- * @details
- *
- * Function: rgSCHUtlCalcDciSizes
- * Purpose: This function calculates and initialises DCI Sizes in bits.
- *
- * Invoked by: Scheduler
- *
- * @param[in] RgSchCellCb *cell
- * @return Void
- *
- **/
-Void rgSCHUtlCalcDciSizes(RgSchCellCb *cell)
-{
- uint8_t dciSize = 0;
- uint8_t dci01aSize = 0;
- uint32_t bits = 0, idx = 0;
-
- switch(TFU_DCI_FORMAT_0) /* Switch case for the purpose of readability */
- {
- case TFU_DCI_FORMAT_0:
- {
- /* DCI 0: Spec 36.212 Section 5.3.3.1.1 */
- dciSize = 0;
- /*-- Calculate resource block assignment bits need to be set
- Which is ln(N(N+1)/2) 36.212 5.3.3.1 --*/
- bits = (cell->bwCfg.ulTotalBw * (cell->bwCfg.ulTotalBw + 1) / 2);
- while ((bits & 0x8000) == 0)
- {
- bits <<= 1;
- idx++;
- }
- bits = 16 - idx;
-
- dciSize = 1 /* DCI 0 bit indicator */ + \
- 1 /* Frequency hoping enable bit field */ + \
- (uint8_t)bits /* For frequency Hopping */ + \
- 5 /* MCS */ + \
- 1 /* NDI */ + \
- 2 /* TPC */ + \
- 3 /* DMRS */
-#ifdef TFU_TDD
- + \
- 2 /* UL Index Config 0 or DAI Config 1-6 */
-#endif
- ;
-
- cell->dciSize.baseSize[TFU_DCI_FORMAT_0] = dciSize;
-
- /* If hoping flag is enabled */
- if (cell->bwCfg.ulTotalBw <= 49) /* Spec 36.213 Table 8.4-1, N UL_hop, if hopping is enabled */
- {
- cell->dciSize.dci0HopSize = 1;
- }
- else
- {
- cell->dciSize.dci0HopSize = 2;
- }
-
- /* Update common non-CRNTI scrambled DCI 0/1A flag */
- dci01aSize = cell->dciSize.baseSize[TFU_DCI_FORMAT_0] + 1; /* 1 bit CSI */
- }
- case TFU_DCI_FORMAT_1A:
- {
- /* DCI 1A: Spec 36.212 Section 5.3.3.1.3 */
- dciSize = 0;
- idx = 0;
- /* Calculate resource block assignment bits need to be set
- Which is ln(N(N+1)/2) */
- bits = (cell->bwCfg.dlTotalBw * (cell->bwCfg.dlTotalBw + 1) / 2);
- while ((bits & 0x8000) == 0)
- {
- bits <<= 1;
- idx++;
- }
- bits = 16 - idx;
-
- dciSize += 1 /* Format 1A */ + \
- 1 /* Local or Distributed */ + \
- (uint8_t)bits /* Resource block Assignment */ + \
- 5 /* MCS */ +
-#ifdef TFU_TDD
- 4 /* HARQ Proc Id */ +
-#else
- 3 /* HARQ Proc Id */ +
-#endif
- 1 /* NDI */ + \
- 2 /* RV */ + \
- 2 /* TPC CMD */
-#ifdef TFU_TDD
- + \
- 2 /* DAI */
-#endif
- ;
- cell->dciSize.baseSize[TFU_DCI_FORMAT_1A] = dciSize;
-
- /* If the UE is not configured to decode PDCCH with CRC scrambled by the C-RNTI,
- * and the number of information bits in format 1A is less than that of format 0,
- * zeros shall be appended to format 1A until the payload size equals that of format 0. */
- /* Compare the size with DCI 1A and DCI 0 and consider the greater one */
- if (dci01aSize < cell->dciSize.baseSize[TFU_DCI_FORMAT_1A])
- {
- dci01aSize = cell->dciSize.baseSize[TFU_DCI_FORMAT_1A];
- }
- /* If the number of information bits in format 1A belongs to one of the sizes in
- * Table 5.3.3.1.2-1, one zero bit shall be appended to format 1A. */
- dci01aSize += rgSchDciAmbigSizeTbl[dci01aSize];
- cell->dciSize.size[TFU_DCI_FORMAT_1A] = cell->dciSize.size[TFU_DCI_FORMAT_0] = dci01aSize;
- }
- case TFU_DCI_FORMAT_1:
- {
- /* DCI 1: Spec 36.212 Section 5.3.3.1.2 */
- dciSize = 0;
- if (cell->bwCfg.dlTotalBw > 10)
- {
- dciSize = 1; /* Resource Allocation header bit */
- }
-
- /* Resouce allocation bits Type 0 and Type 1 */
- bits = (cell->bwCfg.dlTotalBw/cell->rbgSize);
- if ((cell->bwCfg.dlTotalBw % cell->rbgSize) != 0)
- {
- bits++;
- }
-
- dciSize += (uint8_t)bits /* Resource Allocation bits */ + \
- 5 /* MCS */ +
-#ifdef TFU_TDD
- 4 /* HARQ TDD */ +
-#else
- 3 /* HARQ FDD */ +
-#endif
- 1 /* NDI */ + \
- 2 /* Redunancy Version */ + \
- 2 /* TPC Cmd */
-#ifdef TFU_TDD
- + \
- 2 /* DAI */
-#endif
- ;
-
-
- cell->dciSize.baseSize[TFU_DCI_FORMAT_1] = dciSize;
-
- cell->dciSize.size[TFU_DCI_FORMAT_1] = dciSize;
-
- do {
- /* If the UE is not configured to decode PDCCH with CRC
- * scrambled by the C-RNTI and the number of information bits in format 1
- * is equal to that for format 0/1A, one bit of value zero shall be appended
- * to format 1. */
- if (dci01aSize == cell->dciSize.size[TFU_DCI_FORMAT_1])
- {
- cell->dciSize.size[TFU_DCI_FORMAT_1] += 1;
- }
-
- /* If the number of information bits in format 1 belongs to one of the sizes in
- * Table 5.3.3.1.2-1, one or more zero bit(s) shall be appended to format 1 until
- * the payload size of format 1 does not belong to one of the sizes in Table 5.3.3.1.2-1
- * and is not equal to that of format 0/1A mapped onto the same search space. */
- cell->dciSize.size[TFU_DCI_FORMAT_1] += rgSchDciAmbigSizeTbl[cell->dciSize.size[TFU_DCI_FORMAT_1]];
- } while (cell->dciSize.size[TFU_DCI_FORMAT_1] == dci01aSize);
- }
- case TFU_DCI_FORMAT_2:
- {
- /* DCI 2: Spec 36.212 Section 5.3.3.1.5 */
- dciSize = 0;
- if (cell->bwCfg.dlTotalBw > 10)
- {
- dciSize = 1; /* Resource Allocation bit */
- }
-
- dciSize += (uint8_t)bits /* Resource Allocation bits */ + \
- 2 /* TPC */ +
-#ifdef TFU_TDD
- 2 /* DAI */ + \
- 4 /* HARQ */ +
-#else
- 3 /* HARQ */ +
-#endif
- 1 /* CW Swap Flag */ + \
- 5 /* MCS for TB1 */+ \
- 1 /* NDI for TB1 */+ \
- 2 /* RV for TB1 */ + \
- 5 /* MCS for TB2 */+ \
- 1 /* NDI for TB2 */+ \
- 2 /* RV for TB2 */;
- if (cell->numTxAntPorts == 2)
- {
- dciSize += 3;
- }
- else if (cell->numTxAntPorts == 4)
- {
- dciSize += 6;
- }
- cell->dciSize.size[TFU_DCI_FORMAT_2] = dciSize;
- cell->dciSize.size[TFU_DCI_FORMAT_2] += rgSchDciAmbigSizeTbl[cell->dciSize.size[TFU_DCI_FORMAT_2]];
- }
- case TFU_DCI_FORMAT_2A:
- {
- /* DCI 2A: Spec 36.212 Section 5.3.3.1.5A */
- dciSize = 0;
- if (cell->bwCfg.dlTotalBw > 10)
- {
- dciSize = 1; /* Resource Allocation bit */
- }
-
- dciSize += (uint8_t)bits /* Resource Allocation bits */ + \
- 2 /* TPC */ +
-#ifdef TFU_TDD
- 2 /* DAI */ + \
- 4 /* HARQ */ +
-#else
- 3 /* HARQ */ +
-#endif
- 1 /* CW Swap Flag */ + \
- 5 /* MCS for TB1 */+ \
- 1 /* NDI for TB1 */+ \
- 2 /* RV for TB1 */ + \
- 5 /* MCS for TB2 */+ \
- 1 /* NDI for TB2 */+ \
- 2 /* RV for TB2 */;
- if (cell->numTxAntPorts == 4)
- {
- dciSize += 2;
- }
- cell->dciSize.size[TFU_DCI_FORMAT_2A] = dciSize;
- cell->dciSize.size[TFU_DCI_FORMAT_2A] += \
- rgSchDciAmbigSizeTbl[cell->dciSize.size[TFU_DCI_FORMAT_2A]]; /* Spec 39.212 Table 5.3.3.1.2-1 */
- }
- case TFU_DCI_FORMAT_3:
- {
- /* DCI 3: Spec 36.212 Section 5.3.3.1.6 */
- cell->dciSize.size[TFU_DCI_FORMAT_3] = cell->dciSize.size[TFU_DCI_FORMAT_1A] / 2;
- if (cell->dciSize.size[TFU_DCI_FORMAT_3] % 2)
- {
- cell->dciSize.size[TFU_DCI_FORMAT_3]++;
- }
- }
- case TFU_DCI_FORMAT_3A:
- {
- /* DCI 3A: Spec 36.212 Section 5.3.3.1.7 */
- cell->dciSize.size[TFU_DCI_FORMAT_3A] = cell->dciSize.size[TFU_DCI_FORMAT_1A];
- }
-#ifdef EMTC_ENABLE
- case TFU_DCI_FORMAT_6_0A:
- {
- rgSCHEmtcGetDciFrmt60ASize(cell);
- }
- case TFU_DCI_FORMAT_6_1A:
- {
- rgSCHEmtcGetDciFrmt61ASize(cell);
- }
-#endif
- default:
- {
- /* DCI format not supported */
- break;
- }
- }
-}
-
-/**
- * @brief Handler for the CPU OvrLd related state adjustment.
- *
- * @details
- *
- * Function : rgSCHUtlCpuOvrLdAdjItbsCap
- *
- * Processing Steps:
- * - Record dl/ulTpts
- * - Adjust maxItbs to acheive target throughputs
- *
- * @param[in] RgSchCellCb *cell
- * @return Void
- **/
-Void rgSCHUtlCpuOvrLdAdjItbsCap( RgSchCellCb *cell)
-{
- uint32_t tptDelta;
-
- if ((cell->cpuOvrLdCntrl.cpuOvrLdIns) & (RGR_CPU_OVRLD_DL_TPT_UP |
- RGR_CPU_OVRLD_DL_TPT_DOWN))
- {
- /* Regulate DL Tpt for CPU overload */
- if (cell->measurements.dlTpt > cell->cpuOvrLdCntrl.tgtDlTpt)
- {
- tptDelta = cell->measurements.dlTpt - cell->cpuOvrLdCntrl.tgtDlTpt;
- /* Upto 0.5% drift in measured vs target tpt is ignored */
- if (((tptDelta*1000)/cell->cpuOvrLdCntrl.tgtDlTpt) > 5)
- {
- cell->thresholds.maxDlItbs = RGSCH_MAX((cell->thresholds.maxDlItbs-1), 1);
- }
- }
- else
- {
- tptDelta = cell->cpuOvrLdCntrl.tgtDlTpt - cell->measurements.dlTpt;
- /* Upto 0.5% drift in measured vs target tpt is ignored */
- if (((tptDelta*1000)/cell->cpuOvrLdCntrl.tgtDlTpt) > 5)
- {
- cell->thresholds.maxDlItbs = RGSCH_MIN((cell->thresholds.maxDlItbs+1), RG_SCH_DL_MAX_ITBS);
- }
- }
-#ifdef CPU_OL_DBG_PRINTS
- DU_LOG("\nINFO --> SCH : DL CPU OL ADJ = %lu, %lu, %d\n", cell->measurements.dlTpt, cell->cpuOvrLdCntrl.tgtDlTpt,
- cell->thresholds.maxDlItbs);
-#endif
- }
-
- if ((cell->cpuOvrLdCntrl.cpuOvrLdIns) & (RGR_CPU_OVRLD_UL_TPT_UP |
- RGR_CPU_OVRLD_UL_TPT_DOWN))
- {
- /* Regualte DL Tpt for CPU overload */
- if (cell->measurements.ulTpt > cell->cpuOvrLdCntrl.tgtUlTpt)
- {
- tptDelta = cell->measurements.ulTpt - cell->cpuOvrLdCntrl.tgtUlTpt;
- /* Upto 1% drift in measured vs target tpt is ignored */
- if (((tptDelta*1000)/cell->cpuOvrLdCntrl.tgtUlTpt) > 10)
- {
- cell->thresholds.maxUlItbs = RGSCH_MAX((cell->thresholds.maxUlItbs-1), 1);
- }
- }
- else
- {
- tptDelta = cell->cpuOvrLdCntrl.tgtUlTpt - cell->measurements.ulTpt;
- /* Upto 1% drift in measured vs target tpt is ignored */
- if (((tptDelta*1000)/cell->cpuOvrLdCntrl.tgtUlTpt) > 10)
- {
- cell->thresholds.maxUlItbs = RGSCH_MIN((cell->thresholds.maxUlItbs+1), RG_SCH_UL_MAX_ITBS);
- }
- }
-#ifdef CPU_OL_DBG_PRINTS
- DU_LOG("\nDEBUG --> SCH : UL CPU OL ADJ = %lu, %lu, %d\n", cell->measurements.ulTpt, cell->cpuOvrLdCntrl.tgtUlTpt,
- cell->thresholds.maxUlItbs);
-#endif
- }
-
- return;
-}
-/**
- * @brief Handler for the num UE per TTI based CPU OvrLd instr updating
- *
- * @details
- *
- * Function : rgSCHUtlChkAndUpdNumUePerTtiCpuOvInstr
- *
- * Processing Steps:
- * - Validate the config params.
- * - Update numUEperTTi CPU OL related information.
- * - If successful, return ROK else RFAILED.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] uint8_t cnrtCpuOvrLdIns
- * @return Void
- **/
-static Void rgSCHUtlChkAndUpdNumUePerTtiCpuOvInstr(RgSchCellCb *cell,uint8_t crntCpuOvrLdIns)
-{
- RgSchCpuOvrLdCntrlCb *cpuInstr = &(cell->cpuOvrLdCntrl);
- RgSchCmnCell *cellSch;
- uint8_t maxUeNewDlTxPerTti;
- uint8_t maxUeNewUlTxPerTti;
- uint8_t tmpslot = 0;
-#ifdef CPU_OL_DBG_PRINTS
- uint8_t idx = 0;
-#endif
- uint8_t maxDlDecCnt;
- uint8_t maxUlDecCnt;
-
- cellSch = RG_SCH_CMN_GET_CELL(cell);
-
- maxUeNewDlTxPerTti = cellSch->dl.maxUeNewTxPerTti;
- maxUeNewUlTxPerTti = cellSch->ul.maxUeNewTxPerTti;
-
- /* Calculate Maximum Decremen */
- maxDlDecCnt = (10*(maxUeNewDlTxPerTti - 1))-(10-RGR_MAX_PERC_NUM_UE_PER_TTI_RED);
- maxUlDecCnt = (10*(maxUeNewUlTxPerTti - 1))-(10-RGR_MAX_PERC_NUM_UE_PER_TTI_RED);
-
- /* Check for DL CPU Commands */
- if ( crntCpuOvrLdIns & RGR_CPU_OVRLD_DL_DEC_NUM_UE_PER_TTI )
- {
- /* Decrement till 90% of maxUeNewDlTxPerTti */
- if ( cpuInstr->dlNxtIndxDecNumUeTti < maxDlDecCnt )
- {
- tmpslot = (cpuInstr->dlNxtIndxDecNumUeTti) % 10;
- cpuInstr->dlNxtIndxDecNumUeTti++;
- if ( cpuInstr->maxUeNewTxPerTti[tmpslot] > 1 )
- {
- cpuInstr->maxUeNewTxPerTti[tmpslot]--;
- }
- else
- {
-#ifdef CPU_OL_DBG_PRINTS
- DU_LOG("\nERROR --> SCH : CPU_OL_TTI__ERROR\n");
-#endif
- DU_LOG("\nERROR --> SCH : Invalid CPU OL");
- }
- }
-#ifdef CPU_OL_DBG_PRINTS
- DU_LOG("\nDEBUG --> SCH : dlNxtIndxDecNumUeTti = %d\n", cpuInstr->dlNxtIndxDecNumUeTti);
-#endif
- DU_LOG("\nDEBUG --> SCH : dlNxtIndxDecNumUeTti = %d",
- cpuInstr->dlNxtIndxDecNumUeTti);
- }
- else if ( crntCpuOvrLdIns & RGR_CPU_OVRLD_DL_INC_NUM_UE_PER_TTI )
- {
- if ( cpuInstr->dlNxtIndxDecNumUeTti > 0)
- {
- cpuInstr->dlNxtIndxDecNumUeTti--;
- tmpslot = (cpuInstr->dlNxtIndxDecNumUeTti) % 10;
- if ( cpuInstr->maxUeNewTxPerTti[tmpslot] < maxUeNewDlTxPerTti )
- {
- cpuInstr->maxUeNewTxPerTti[tmpslot]++;
- }
- else
- {
-#ifdef CPU_OL_DBG_PRINTS
- DU_LOG("\nERROR --> SCH : CPU_OL_TTI__ERROR\n");
-#endif
- DU_LOG("\nERROR --> SCH : Invalid CPU OL");
- }
- }
-#ifdef CPU_OL_DBG_PRINTS
- DU_LOG("\nDEBUG --> SCH : dlNxtIndxDecNumUeTti = %d\n", cpuInstr->dlNxtIndxDecNumUeTti);
-#endif
- DU_LOG("\nERROR --> SCH : dlNxtIndxDecNumUeTti = %d",
- cpuInstr->dlNxtIndxDecNumUeTti);
- }
- /* Check for UL CPU commands */
- if ( crntCpuOvrLdIns & RGR_CPU_OVRLD_UL_DEC_NUM_UE_PER_TTI )
- {
- /* Decrement till 90% of maxUeNewDlTxPerTti */
- if ( cpuInstr->ulNxtIndxDecNumUeTti < maxUlDecCnt )
- {
- tmpslot = (cpuInstr->ulNxtIndxDecNumUeTti) % 10;
- cpuInstr->ulNxtIndxDecNumUeTti++;
- if ( cpuInstr->maxUeNewRxPerTti[tmpslot] > 1 )
- {
- cpuInstr->maxUeNewRxPerTti[tmpslot]--;
- }
- else
- {
-#ifdef CPU_OL_DBG_PRINTS
- DU_LOG("\nERROR --> SCH : CPU_OL_TTI__ERROR\n");
-#endif
- DU_LOG("\nERROR --> SCH : Invalid CPU OL");
- }
- }
-#ifdef CPU_OL_DBG_PRINTS
- DU_LOG("\nDEBUG --> SCH : ulNxtIndxDecNumUeTti = %d\n", cpuInstr->ulNxtIndxDecNumUeTti);
-#endif
- DU_LOG("\nDEBUG --> SCH : dlNxtIndxDecNumUeTti = %d",
- cpuInstr->dlNxtIndxDecNumUeTti);
- }
- else if ( crntCpuOvrLdIns & RGR_CPU_OVRLD_UL_INC_NUM_UE_PER_TTI )
- {
- if ( cpuInstr->ulNxtIndxDecNumUeTti > 0)
- {
- cpuInstr->ulNxtIndxDecNumUeTti--;
- tmpslot = (cpuInstr->ulNxtIndxDecNumUeTti) % 10;
- if ( cpuInstr->maxUeNewRxPerTti[tmpslot] < maxUeNewUlTxPerTti )
- {
- cpuInstr->maxUeNewRxPerTti[tmpslot]++;
- }
- else
- {
-#ifdef CPU_OL_DBG_PRINTS
- DU_LOG("\nERROR --> SCH : CPU_OL_TTI__ERROR\n");
-#endif
- DU_LOG("\nERROR --> SCH : Invalid CPU OL");
- }
- }
-#ifdef CPU_OL_DBG_PRINTS
- DU_LOG("\nDEBUG --> SCH : ulNxtIndxDecNumUeTti = %d\n", cpuInstr->ulNxtIndxDecNumUeTti);
-#endif
- DU_LOG("\nDEBUG --> SCH : dlNxtIndxDecNumUeTti = %d",
- cpuInstr->dlNxtIndxDecNumUeTti);
- }
-#ifdef CPU_OL_DBG_PRINTS
- /* TODO: Debug Information - Shall be moved under CPU_OL_DBG_PRINTS */
- DU_LOG("\nDEBUG --> SCH : maxUeNewDlTxPerTti = %d, maxUeNewUlTxPerTti = %d\n", maxUeNewDlTxPerTti, maxUeNewUlTxPerTti);
- DU_LOG("\nINFO --> SCH : DL Sf numUePerTti:");
- for ( idx = 0; idx < 10 ; idx ++ )
- {
- DU_LOG(" %d", cpuInstr->maxUeNewTxPerTti[idx]);
- }
- DU_LOG("\nINFO --> SCH : UL Sf numUePerTti:");
- for ( idx = 0; idx < 10 ; idx ++ )
- {
- DU_LOG(" %d", cpuInstr->maxUeNewRxPerTti[idx]);
- }
- DU_LOG("\n");
-#endif
-
- return;
-} /* rgSCHUtlChkAndUpdNumUePerTtiCpuOvInstr */
-
-/**
- * @brief Handler for the CPU OvrLd related cell Recfg.
- *
- * @details
- *
- * Function : rgSCHUtlResetCpuOvrLdState
- *
- * Processing Steps:
- * - Validate the config params.
- * - Update CPU OL related state information.
- * - If successful, return ROK else RFAILED.
- *
- * @param[in] RgSchCellCb *cell
- * @param[in] uint8_t cnrtCpuOvrLdIns
- * @return S16
- * -# ROK
- * -# RFAILED
- **/
-S16 rgSCHUtlResetCpuOvrLdState(RgSchCellCb *cell,uint8_t crntCpuOvrLdIns)
-{
- uint8_t crntDlCpuOL=0;
- uint8_t crntUlCpuOL=0;
- RgSchCmnCell *schCmnCell = (RgSchCmnCell *)(cell->sc.sch);
- uint8_t idx;
-
-#ifdef CPU_OL_DBG_PRINTS
- DU_LOG("\nDEBUG --> SCH : CPU OVR LD Ins Rcvd = %d\n", (int)crntCpuOvrLdIns);
-#endif
- DU_LOG("\nINFO --> SCH : CPU OVR LD Ins Rcvd");
-
- if ( RGR_CPU_OVRLD_RESET == crntCpuOvrLdIns )
- {
- /* The CPU OL instruction received with RESET (0), hence reset it */
-#ifdef CPU_OL_DBG_PRINTS
- DU_LOG("\nDEBUG --> SCH : rgSCHUtlResetCpuOvrLdState: RESET CPU OL instr\n");
-#endif
- DU_LOG("\nINFO --> SCH : RESET CPU OVR LD");
- cell->cpuOvrLdCntrl.cpuOvrLdIns = 0;
- /* Reset the max UL and DL itbs to 26 */
- cell->thresholds.maxUlItbs = RG_SCH_UL_MAX_ITBS;
- cell->thresholds.maxDlItbs = RG_SCH_DL_MAX_ITBS;
- /* Reset the num UE per TTI intructions */
- cell->cpuOvrLdCntrl.dlNxtIndxDecNumUeTti = 0;
- cell->cpuOvrLdCntrl.ulNxtIndxDecNumUeTti = 0;
- for ( idx = 0; idx < 10; idx++ )
- {
- cell->cpuOvrLdCntrl.maxUeNewTxPerTti[idx] =
- schCmnCell->dl.maxUeNewTxPerTti;
- cell->cpuOvrLdCntrl.maxUeNewRxPerTti[idx] =
- schCmnCell->ul.maxUeNewTxPerTti;
- }
-
- return ROK;
- }
- /* Check and Update numUEPer TTI based CPU overload instruction before
- * going for TP based CPU OL
- * TTI based intrcuctions shall be > 0xF */
- if ( crntCpuOvrLdIns > 0xF )
- {
- rgSCHUtlChkAndUpdNumUePerTtiCpuOvInstr(cell, crntCpuOvrLdIns);
- /* If need to have both TP and numUePerTti instrcution together in
- * one command then dont return from here */
- return ROK;
- }
-
- crntDlCpuOL = (crntCpuOvrLdIns & RGR_CPU_OVRLD_DL_TPT_UP) +\
- (crntCpuOvrLdIns & RGR_CPU_OVRLD_DL_TPT_DOWN);
- if ((crntDlCpuOL) && (crntDlCpuOL != RGR_CPU_OVRLD_DL_TPT_UP) &&
- (crntDlCpuOL != RGR_CPU_OVRLD_DL_TPT_DOWN))
- {
- /* Cfg validation failed. Invalid Command. Either UP/DOWN is allowed */
- return RFAILED;
- }
- crntUlCpuOL = (crntCpuOvrLdIns & RGR_CPU_OVRLD_UL_TPT_UP) +\
- (crntCpuOvrLdIns & RGR_CPU_OVRLD_UL_TPT_DOWN);
- if ((crntUlCpuOL) && (crntUlCpuOL != RGR_CPU_OVRLD_UL_TPT_UP) &&
- (crntUlCpuOL != RGR_CPU_OVRLD_UL_TPT_DOWN))
- {
- /* Cfg validation failed. Invalid Command. Either UP/DOWN is allowed */
- return RFAILED;
- }
- if ((crntDlCpuOL == 0) && (crntUlCpuOL == 0))
- {
- /* Cfg validation failed. Invalid Command. Either UP/DOWN is allowed */
- return RFAILED;
- }
-
- cell->cpuOvrLdCntrl.cpuOvrLdIns = crntCpuOvrLdIns;
-
- if (crntUlCpuOL)
- {
- if (crntUlCpuOL == RGR_CPU_OVRLD_UL_TPT_DOWN)
- {
- cell->cpuOvrLdCntrl.tgtUlTpt = cell->measurements.ulTpt - \
- (cell->measurements.ulTpt * 3 )/100;
- }
- else
- {
- cell->cpuOvrLdCntrl.tgtUlTpt = cell->measurements.ulTpt + \
- (cell->measurements.ulTpt * 2 )/100;
- }
- DU_LOG("\nDEBUG --> SCH : CPU OVR LD UL Reset to "
- "%d, %u, %u", (int)crntUlCpuOL, cell->cpuOvrLdCntrl.tgtUlTpt,cell->measurements.ulTpt);
-#ifdef CPU_OL_DBG_PRINTS
- DU_LOG("\nDEBUG --> SCH : CPU OVR LD UL Reset to= %d, %u, %u\n", (int)crntUlCpuOL, cell->cpuOvrLdCntrl.tgtUlTpt,
- cell->measurements.ulTpt);
-#endif
- }
-
- if (crntDlCpuOL)
- {
- if (crntDlCpuOL == RGR_CPU_OVRLD_DL_TPT_DOWN)
- {
- cell->cpuOvrLdCntrl.tgtDlTpt = cell->measurements.dlTpt - \
- (cell->measurements.dlTpt * 1 )/100;
- }
- else
- {
- cell->cpuOvrLdCntrl.tgtDlTpt = cell->measurements.dlTpt + \
- (cell->measurements.dlTpt * 1 )/100;
- }
- DU_LOG("\nDEBUG --> SCH : CPU OVR LD DL Reset to "
- "%d, %u, %u", (int)crntDlCpuOL, cell->cpuOvrLdCntrl.tgtDlTpt,cell->measurements.dlTpt);
-
-#ifdef CPU_OL_DBG_PRINTS
- DU_LOG("\nDEBUG --> SCH : CPU OVR LD DL Reset to= %d, %lu, %lu\n", (int)crntDlCpuOL, cell->cpuOvrLdCntrl.tgtDlTpt,
- cell->measurements.dlTpt);
-#endif
- }
- rgSCHUtlCpuOvrLdAdjItbsCap(cell);
- return ROK;
-}
-#ifdef EMTC_ENABLE
-S16 rgSCHUtlAddToResLst
-(
- CmLListCp *cp,
- RgSchIotRes *iotRes
- )
-{
- cmLListAdd2Tail(cp, &iotRes->resLnk);
- iotRes->resLnk.node = (PTR)iotRes;
- return ROK;
-}
-S16 rgSCHUtlDelFrmResLst
-(
-RgSchUeCb *ue,
-RgSchIotRes *iotRes
-)
-{
- CmLListCp *cp = NULLP;
- RgSchEmtcUeInfo *emtcUe = NULLP;
- emtcUe = RG_GET_EMTC_UE_CB(ue);
- if(iotRes->resType == RG_SCH_EMTC_PUCCH_RES)
- {
- cp = &emtcUe->ulResLst;
- }else if(iotRes->resType == RG_SCH_EMTC_PDSCH_RES)
- {
- cp = &emtcUe->dlResLst;
- }else
- {
- DU_LOG("\nINFO --> SCH : *****restype mismatch");
- }
- if(cp != NULLP )
- {
- if(cp->count == 0)
- {
- DU_LOG("\nINFO --> SCH : ****error count*****\n");
- return ROK;
- }
- }
- cmLListDelFrm(cp, &iotRes->resLnk);
- iotRes->resLnk.node = NULLP;
- return ROK;
-}
-#endif
-/**********************************************************************
-
- End of file
-**********************************************************************/
+++ /dev/null
-/*******************************************************************************
-################################################################################
-# Copyright (c) [2017-2019] [Radisys] #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-################################################################################
-*******************************************************************************/
-
-/********************************************************************20**
-
- Name: common functions - linked list management
-
- Type: C source file
-
- Desc: common functions for linked lists
-
- File: rg_sch_utl_clist.c
-
-*********************************************************************21*/
-
-/* header include files (.h) */
-#include "common_def.h"
-
-/* header/extern include files (.x) */
-#include "rg_sch_clist.x" /* common functions */
-
-
-/* Linked List functions */
-
-
-/*
-*
-* Fun: rgSCHRrCListInit
-*
-* Desc: initializes a linked list control pointer.
-*
-* Ret: ROK - ok
-*
-* Notes: None
-*
-* File: rr_clist.c
-*
-*/
-Void rgSCHRrCListInit
-(
-RgSchRrCListCp *lCp /* list control point */
-)
-{
-
- lCp->first = (RgSchRrCList *)NULLP;
- lCp->crnt = (RgSchRrCList *)NULLP;
- lCp->count = 0;
-
- return;
-} /* end of rgSCHRrCListInit */
-
-/* LTE_ADV_FLAG_REMOVED_START */
-/*
- * Fun: rgSCHRrCListAdd2Crnt
- *
- * Desc: adds node to linked list behind crnt.
- *
- * Ret: ROK - ok
- *
- * Notes: None
- *
- * File: rr_clist.c
- */
-Void rgSCHRrCListAdd2Crnt
-(
-RgSchRrCListCp *lCp, /* list control point */
-RgSchRrCList *node /* node to be added */
-)
-{
-#ifdef ERRCHK
- if (lCp == (RgSchRrCListCp *)NULLP)
- return;
-#endif
-
- lCp->count++;
-
- if(!lCp->first)
- {
- node->prev = node;
- node->next = node;
- lCp->first = node;
-
- lCp->crnt = lCp->first;
-
- return;
- }
-
- node->next = lCp->crnt;
- node->prev = lCp->crnt->prev;
- lCp->crnt->prev->next = node;
- lCp->crnt->prev = node;
-
- return;
-}
-/* LTE_ADV_FLAG_REMOVED_END */
-
-/*
-*
-* Fun: rgSCHRrCListAdd2Tail
-*
-* Desc: adds node to linked list after last.
-*
-* Ret: ROK - ok
-*
-* Notes: None
-*
-* File: rr_clist.c
-*
-*/
-Void rgSCHRrCListAdd2Tail
-(
-RgSchRrCListCp *lCp, /* list control point */
-RgSchRrCList *node /* node to be added */
-)
-{
-
-#ifdef ERRCHK
- if (lCp == (RgSchRrCListCp *)NULLP)
- return;
-#endif
-
- lCp->count++;
-
- if(!lCp->first)
- {
- node->prev = node;
- node->next = node;
- lCp->first = node;
-
- lCp->crnt = lCp->first;
-
- return;
- }
-
- node->next = lCp->first;
- node->prev = lCp->first->prev;
- lCp->first->prev->next = node;
- lCp->first->prev = node;
-
- return;
-} /* end of rgSCHRrCListAdd2Tail */
-
-/*
-*
-* Fun: rgSCHRrCListDelFrm
-*
-* Desc: remove node pointed to by nodePtr from list and return node.
-* nodePtr could be anywhere in the list.
-* - resets crnt to NULLP.
-*
-* Ret: pointer
-*
-* Notes: None
-*
-* File: rr_clist.c
-*
-*/
-RgSchRrCList *rgSCHRrCListDelFrm
-(
-RgSchRrCListCp *lCp, /* list control pointer */
-RgSchRrCList *node /* node to be removed */
-)
-{
-
-#ifdef ERRCHK
- if (lCp == (RgSchRrCListCp *)NULLP)
- return (NULLP);
-#endif
-
- if(lCp->count == 0)
- {
- return (NULLP);
- }
- if (lCp->count == 1)
- {
- if(lCp->first == node)
- {
- lCp->first = lCp->crnt = (RgSchRrCList *)NULLP;
- lCp->count = 0;
- node->next = node->prev = (RgSchRrCList *)NULLP;
- return (node);
- }
- return (NULLP);
- }
-
- if (lCp->first == node)
- {
- lCp->first->prev->next = node->next;
- node->next->prev = lCp->first->prev;
- lCp->first = node->next;
- if(lCp->crnt == node)
- {
- lCp->crnt = node->next;
- }
- node->next = node->prev = (RgSchRrCList *)NULLP;
- /* Adding this check and guarding the decrement of counter when
- node is deleted with reshuffling */
- lCp->count--;
- return (node);
- }
-
- if(node->prev && node->next)
- {
- node->prev->next = node->next;
- node->next->prev = node->prev;
- lCp->count--;
- }
- if(lCp->crnt == node)
- {
- lCp->crnt = node->next;
- }
- node->next = node->prev = (RgSchRrCList *)NULLP;
- return (node);
-} /* end of rgSCHRrCListDelFrm */
-
-/*
-*
-* Fun: rgSCHRrCListInsrtAtCrnt
-*
-* Desc: Inserting the given node at CuRRENT and Moving present CURRENT
-* node to next.
-*
-* Ret: None
-*
-* Notes: None
-*
-* File: rr_clist.c
-*
-*/
-Void rgSCHRrCListInsrtAtCrnt
-(
-RgSchRrCListCp *lCp, /* list control pointer */
-RgSchRrCList *node /* node to be removed */
-)
-{
- RgSchRrCList *crnt;
-
-#ifdef ERRCHK
- if (lCp == (RgSchRrCListCp *)NULLP)
- return;
-#endif
-
- crnt = lCp->crnt;
- lCp->crnt = node;
-
- node->prev = crnt->prev;
- crnt->prev->next = node;
- node->next = crnt;
- crnt->prev = node;
-
- lCp->count++;
-
- return;
-}
-
-/********************************************************************30**
-
- End of file
-**********************************************************************/
#include "sch.h"
#include "sch_utils.h"
-void SchFillCfmPst(Pst *reqPst,Pst *cfmPst,RgMngmt *cfm);
/* local defines */
SchCellCfgCfmFunc SchCellCfgCfmOpts[] =
}
return ret;
}
+
+\f
+/***********************************************************
+ *
+ * Func : SchFillCfmPst
+ *
+ *
+ * Desc : Fills the Confirmation Post Structure cfmPst using the reqPst
+ * and the cfm->hdr.response.
+ *
+ *
+ * Ret : Void
+ *
+ * Notes:
+ *
+ * File : rg_sch_lmm.c
+ *
+ **********************************************************/
+Void SchFillCfmPst
+(
+Pst *reqPst,
+Pst *cfmPst,
+RgMngmt *cfm
+)
+{
+ Inst inst;
+
+ inst = (reqPst->dstInst - SCH_INST_START);
+
+ cfmPst->srcEnt = ENTMAC;
+ cfmPst->srcInst = (Inst) 1;
+ cfmPst->srcProcId = schCb[inst].schInit.procId;
+ cfmPst->dstEnt = ENTMAC;
+ cfmPst->dstInst = (Inst) 0;
+ cfmPst->dstProcId = reqPst->srcProcId;
+
+ cfmPst->selector = cfm->hdr.response.selector;
+ cfmPst->region = cfm->hdr.response.mem.region;
+ cfmPst->pool = cfm->hdr.response.mem.pool;
+
+ return;
+}
+
/**********************************************************************
End of file
**********************************************************************/
/* function declarations */
short int schActvTmr(Ent ent,Inst inst);
+void SchFillCfmPst(Pst *reqPst,Pst *cfmPst,RgMngmt *cfm);
/* Configuration related function declarations */
void schInitUlSlot(SchUlSlotInfo *schUlSlotInfo);
**********************************************************************/
+#if 0 /*MAC-SCH Interface working as Tightly Coupled thus Commenting*/
+
/** @file sch_msg_router.c
@brief This file contains the implementation of callback functions
registered with SSI during the LTE MAC Task initialization.
#include "rg_sch.x" /* typedefs for Scheduler */
#include "mac_sch_interface.h"
+#ifdef CALL_FLOW_DEBUG_LOG
/*
* @brief
*
}
DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);
}
+#endif
/**
* @brief Task Activation callback function.
/* Process a config. request */
cmUnpkLrgSchCfgReq(SchProcGenCfgReq, pst, mBuf);
break;
- case EVTLRGSCHCNTRLREQ:
- /* Process a control request */
- cmUnpkLrgSchCntrlReq(RgMiLrgSchCntrlReq, pst, mBuf);
- break;
case EVTLRGSCHSTAIND:
/* Process a control request */
cmUnpkLrgSchStaInd(RgMiLrgSchStaInd, pst, mBuf);
break;
}
break;
- case ENTNX:
- switch(pst->event)
- {
-#ifdef LCRGUIRGR
- case EVTRGRBNDREQ:
- cmUnpkRgrBndReq(RgUiRgrBndReq, pst, mBuf);
- break;
- case EVTRGRUBNDREQ:
- cmUnpkRgrUbndReq(RgUiRgrUbndReq, pst, mBuf);
- break;
-#ifdef RGR_SI_SCH
- case EVTRGRSICFGREQ:
- cmUnpkRgrSiCfgReq(RgUiRgrSiCfgReq, pst, mBuf);
- break;
- case EVTRGRWARNINGSICFGREQ:
- cmUnpkRgrWarningSiCfgReq(RgUiRgrWarningSiCfgReq, pst, mBuf);
- break;
-
- case EVTRGRWARNINGSISTOPREQ:
- cmUnpkRgrWarningSiStopReq(RgUiRgrWarningSiStopReq, pst, mBuf);
- break;
-#endif/*RGR_SI_SCH */
- /* LTE_ADV_FLAG_REMOVED_START */
- case EVTRGRLOADINFREQ:
- cmUnpkRgrLoadInfReq(RgUiRgrLoadInfReq, pst, mBuf);
- break;
- /* LTE_ADV_FLAG_REMOVED_END */
-#endif
- default:
- RGSCH_FREE_MSG(mBuf);
- break;
- }
- break;
case ENTMAC: /* When MAC sends a msg to Scheduler instance */
switch(pst->event)
{
break;
}
break;
- case ENTRM: /* When RRM sends msg to scheduler */
- switch(pst->event)
- {
- case EVTRGMBNDREQ:
- cmUnpkRgmBndReq(RgUiRgmBndReq, pst, mBuf);
- break;
- case EVTRGMUBNDREQ:
- cmUnpkRgmUbndReq(RgUiRgmUbndReq, pst, mBuf);
- break;
- case EVTRGMCFGPRBRPRT:
- cmUnpkRgmCfgPrbRprt(RgUiRgmCfgPrbRprt, pst, mBuf);
- break;
- default:
- RGSCH_FREE_MSG(mBuf);
- break;
- }
- break;
default:
RGSCH_FREE_MSG(mBuf);
break;
return ROK;
}/* end of schActvTsk */
+#endif
\f
/**********************************************************************
}
\f
-/**
-* @brief Configuration Request from RRC to MAC for
- * configuring Cell/Ue/Lc
-*
-* @details
-*
-* Function : cmPkCrgCfgReq
-*
-* @param[in] Pst* pst
-* @param[in] SpId spId
-* @param[in] CrgCfgTransId transId
-* @param[in] CrgCfgReqInfo * cfgReqInfo
-* @return S16
-* -# ROK
-**/
-S16 cmPkCrgCfgReq
-(
-Pst* pst,
-SpId spId,
-CrgCfgTransId transId,
-CrgCfgReqInfo * cfgReqInfo
-)
-{
- Buffer *mBuf = NULLP;
-
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ECRG016, (ErrVal)0, "Packing failed");
-#endif
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)cfgReqInfo, sizeof(CrgCfgReqInfo));
- return RFAILED;
- }
- if (cmPkCrgCfgReqInfo(cfgReqInfo, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ECRG017, (ErrVal)0, "Packing failed");
-#endif
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)cfgReqInfo, sizeof(CrgCfgReqInfo));
- SPutMsg(mBuf);
- return RFAILED;
- }
-/* crg_c_001.main_5: MOD - Updating ERR code */
- if (cmPkCrgCfgTransId(&transId, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ECRG018, (ErrVal)0, "Packing failed");
-#endif
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)cfgReqInfo, sizeof(CrgCfgReqInfo));
- SPutMsg(mBuf);
- return RFAILED;
- }
- if (SPkS16(spId, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ECRG019, (ErrVal)0, "Packing failed");
-#endif
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)cfgReqInfo, sizeof(CrgCfgReqInfo));
- SPutMsg(mBuf);
- return RFAILED;
- }
- if (SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)cfgReqInfo, sizeof(CrgCfgReqInfo)) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ECRG020, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
- pst->event = (Event) EVTCRGCFGREQ;
- return (SPstTsk(pst,mBuf));
-}
-
-\f
-/**
-* @brief Configuration Request from RRC to MAC for
- * configuring Cell/Ue/Lc
-*
-* @details
-*
-* Function : cmUnpkCrgCfgReq
-*
-* @param[in] Pst* pst
-* @param[in] SpId spId
-* @param[in] CrgCfgTransId transId
-* @param[in] CrgCfgReqInfo * cfgReqInfo
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkCrgCfgReq
-(
-CrgCfgReq func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- SpId spId;
- CrgCfgTransId transId;
- CrgCfgReqInfo *cfgReqInfo;
-
-
- if (SUnpkS16(&spId, mBuf) != ROK) {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ECRG021, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- if (cmUnpkCrgCfgTransId(&transId, mBuf) != ROK) {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ECRG022, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- if ((SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data **)&cfgReqInfo, sizeof(CrgCfgReqInfo))) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ECRG023, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- if (cmUnpkCrgCfgReqInfo(cfgReqInfo, mBuf) != ROK) {
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)cfgReqInfo, sizeof(CrgCfgReqInfo));
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ECRG024, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- SPutMsg(mBuf);
- return ((*func)(pst, spId, transId, cfgReqInfo));
-}
-
-\f
/**
* @brief Configuration Confirm from MAC to RRC
*
\f
/***********************************************************
*
-* Func : cmPkCrgBwCfg
+* Func : cmPkCrgUeUlHqCfg
*
*
-* Desc : Bandwidth configuration per cell
+* Desc : Uplink HARQ configuration per UE
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkCrgBwCfg
+S16 cmPkCrgUeUlHqCfg
(
-CrgBwCfg *param,
+CrgUeUlHqCfg *param,
Buffer *mBuf
)
{
- CMCHKPK(oduUnpackUInt8, param->ulTotalBw, mBuf);
- CMCHKPK(oduUnpackUInt8, param->dlTotalBw, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->maxUlHqTx, mBuf);
return ROK;
}
-
-\f
+#ifdef LTE_ADV
/***********************************************************
*
-* Func : cmUnpkCrgBwCfg
+* Func : cmPkCrgUeSCellCfg
*
*
-* Desc : Bandwidth configuration per cell
+* Desc : Secondary Cell information of the UE
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkCrgBwCfg
+static S16 cmPkCrgUeSCellCfg
(
-CrgBwCfg *param,
+CrgUeSCellInfo *param,
Buffer *mBuf
)
{
+ CMCHKPK(SPkS16, param->rguDlSapId, mBuf);
+ CMCHKPK(SPkS16, param->rguUlSapId, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->macInst, mBuf);
+ CMCHKPK(oduUnpackUInt16, param->sCellId, mBuf);
-
- CMCHKUNPK(oduPackUInt8, ¶m->dlTotalBw, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->ulTotalBw, mBuf);
return ROK;
}
-
-
-\f
/***********************************************************
*
-* Func : cmPkCrgRachCfg
+* Func : cmUnpkCrgUeSCellCfg
*
*
-* Desc : RACH configuration per cell
+* Desc : Secondary Cell information of the UE
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkCrgRachCfg
+static S16 cmUnpkCrgUeSCellCfg
(
-CrgRachCfg *param,
+CrgUeSCellInfo *param,
Buffer *mBuf
)
{
-
-
- CMCHKPK(oduUnpackUInt8, param->maxMsg3Tx, mBuf);
+ CMCHKUNPK(oduPackUInt16, ¶m->sCellId, mBuf);
+ CMCHKUNPK(oduPackUInt8, ¶m->macInst, mBuf);
+ CMCHKUNPK(SUnpkS16, ¶m->rguUlSapId, mBuf);
+ CMCHKUNPK(SUnpkS16, ¶m->rguDlSapId, mBuf);
return ROK;
}
-
-
-\f
/***********************************************************
*
-* Func : cmUnpkCrgRachCfg
+* Func : cmPkCrgUeSecCellInfo
*
*
-* Desc : RACH configuration per cell
+* Desc : Secondary Cell information of the UE
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkCrgRachCfg
+S16 cmPkCrgUeSecCellInfo
(
-CrgRachCfg *param,
+CrgUeSecCellInfo *param,
Buffer *mBuf
)
{
+ S8 idx;
+ for(idx = param->numSCells - 1; idx >= 0; idx--)
+ {
+ CMCHKPK(cmPkCrgUeSCellCfg, ¶m->ueSCellCfg[(uint8_t)idx], mBuf);
+ }
+ CMCHKPK(oduUnpackUInt8, param->numSCells, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->isSCellCfgPres, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->maxMsg3Tx, mBuf);
return ROK;
}
-
-\f
/***********************************************************
*
-* Func : cmPkCrgCellCfg
+* Func : cmUnpkCrgUeSecCellInfo
*
*
-* Desc : Cell configuration
+* Desc : Secondary Cell information of the UE
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkCrgCellCfg
+S16 cmUnpkCrgUeSecCellInfo
(
-CrgCellCfg *param,
+CrgUeSecCellInfo *param,
Buffer *mBuf
)
{
+ uint8_t idx;
-#ifdef EMTC_ENABLE
- CMCHKPK(oduUnpackUInt8, param->emtcEnable, mBuf);
-#endif
-#ifdef TENB_MULT_CELL_SUPPRT
- CMCHKPK(SPkS16, param->rguDlSapId, mBuf);
- CMCHKPK(SPkS16, param->rguUlSapId, mBuf);
-#endif
- CMCHKPK(cmPkCrgBwCfg, ¶m->bwCfg, mBuf);
- CMCHKPK(cmPkCrgRachCfg, ¶m->rachCfg, mBuf);
- CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkCrgCellCfg
-*
-*
-* Desc : Cell configuration
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkCrgCellCfg
-(
-CrgCellCfg *param,
-Buffer *mBuf
-)
-{
+ CMCHKUNPK(oduPackUInt8, ¶m->isSCellCfgPres, mBuf);
+ if(TRUE == param->isSCellCfgPres)
+ {
+ CMCHKUNPK(oduPackUInt8, ¶m->numSCells, mBuf);
+ for(idx = 0; idx < param->numSCells; idx++)
+ {
+ CMCHKUNPK(cmUnpkCrgUeSCellCfg, ¶m->ueSCellCfg[idx],mBuf);
+ }
+ }
- CMCHKUNPK(cmUnpkLteCellId, ¶m->cellId, mBuf);
- CMCHKUNPK(cmUnpkCrgRachCfg, ¶m->rachCfg, mBuf);
- CMCHKUNPK(cmUnpkCrgBwCfg, ¶m->bwCfg, mBuf);
-#ifdef TENB_MULT_CELL_SUPPRT
- CMCHKUNPK(SUnpkS16, ¶m->rguUlSapId, mBuf);
- CMCHKUNPK(SUnpkS16, ¶m->rguDlSapId, mBuf);
-#endif
-#ifdef EMTC_ENABLE
- CMCHKUNPK(oduPackUInt8, ¶m->emtcEnable, mBuf);
-#endif
return ROK;
}
+#endif /* LTE_ADV */
-\f
-/***********************************************************
-*
-* Func : cmPkCrgUeUlHqCfg
-*
-*
-* Desc : Uplink HARQ configuration per UE
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkCrgUeUlHqCfg
-(
-CrgUeUlHqCfg *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKPK(oduUnpackUInt8, param->maxUlHqTx, mBuf);
- return ROK;
-}
-
-#ifdef LTE_ADV
-/***********************************************************
-*
-* Func : cmPkCrgUeSCellCfg
-*
-*
-* Desc : Secondary Cell information of the UE
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-static S16 cmPkCrgUeSCellCfg
-(
-CrgUeSCellInfo *param,
-Buffer *mBuf
-)
-{
- CMCHKPK(SPkS16, param->rguDlSapId, mBuf);
- CMCHKPK(SPkS16, param->rguUlSapId, mBuf);
- CMCHKPK(oduUnpackUInt8, param->macInst, mBuf);
- CMCHKPK(oduUnpackUInt16, param->sCellId, mBuf);
-
- return ROK;
-}
-/***********************************************************
-*
-* Func : cmUnpkCrgUeSCellCfg
-*
-*
-* Desc : Secondary Cell information of the UE
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-static S16 cmUnpkCrgUeSCellCfg
-(
-CrgUeSCellInfo *param,
-Buffer *mBuf
-)
-{
- CMCHKUNPK(oduPackUInt16, ¶m->sCellId, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->macInst, mBuf);
- CMCHKUNPK(SUnpkS16, ¶m->rguUlSapId, mBuf);
- CMCHKUNPK(SUnpkS16, ¶m->rguDlSapId, mBuf);
- return ROK;
-}
-/***********************************************************
-*
-* Func : cmPkCrgUeSecCellInfo
-*
-*
-* Desc : Secondary Cell information of the UE
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkCrgUeSecCellInfo
-(
-CrgUeSecCellInfo *param,
-Buffer *mBuf
-)
-{
- S8 idx;
- for(idx = param->numSCells - 1; idx >= 0; idx--)
- {
- CMCHKPK(cmPkCrgUeSCellCfg, ¶m->ueSCellCfg[(uint8_t)idx], mBuf);
- }
-
- CMCHKPK(oduUnpackUInt8, param->numSCells, mBuf);
- CMCHKPK(oduUnpackUInt8, param->isSCellCfgPres, mBuf);
-
- return ROK;
-}
-
-/***********************************************************
-*
-* Func : cmUnpkCrgUeSecCellInfo
-*
-*
-* Desc : Secondary Cell information of the UE
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkCrgUeSecCellInfo
-(
-CrgUeSecCellInfo *param,
-Buffer *mBuf
-)
-{
- uint8_t idx;
-
- CMCHKUNPK(oduPackUInt8, ¶m->isSCellCfgPres, mBuf);
- if(TRUE == param->isSCellCfgPres)
- {
- CMCHKUNPK(oduPackUInt8, ¶m->numSCells, mBuf);
-
- for(idx = 0; idx < param->numSCells; idx++)
- {
- CMCHKUNPK(cmUnpkCrgUeSCellCfg, ¶m->ueSCellCfg[idx],mBuf);
- }
- }
-
- return ROK;
-}
-
-#endif /* LTE_ADV */
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkCrgUeUlHqCfg
-*
-*
-* Desc : Uplink HARQ configuration per UE
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkCrgUeUlHqCfg
-(
-CrgUeUlHqCfg *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKUNPK(oduPackUInt8, ¶m->maxUlHqTx, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmPkCrgUeCfg
-*
-*
-* Desc : UE configuration
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkCrgUeCfg
-(
-CrgUeCfg *param,
-Buffer *mBuf
-)
-{
-
-#ifdef TENB_MULT_CELL_SUPPRT
- CMCHKPK(SPkS16, param->rguDlSapId, mBuf);
- CMCHKPK(SPkS16, param->rguUlSapId, mBuf);
-#endif
- CMCHKPK(oduUnpackUInt32, param->txMode.tm, mBuf);
- CMCHKPK(oduUnpackUInt8, param->txMode.pres, mBuf);
- CMCHKPK(cmPkCrgUeUlHqCfg, ¶m->ueUlHqCfg, mBuf);
- CMCHKPK(cmPkLteRnti, param->crnti, mBuf);
- CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkCrgUeCfg
-*
-*
-* Desc : UE configuration
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkCrgUeCfg
-(
-CrgUeCfg *param,
-Buffer *mBuf
-)
-{
- uint32_t tmpEnum;
-
-
- CMCHKUNPK(cmUnpkLteCellId, ¶m->cellId, mBuf);
- CMCHKUNPK(cmUnpkLteRnti, ¶m->crnti, mBuf);
- CMCHKUNPK(cmUnpkCrgUeUlHqCfg, ¶m->ueUlHqCfg, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->txMode.pres, mBuf);
- CMCHKUNPK(oduPackUInt32, (uint32_t *)&tmpEnum, mBuf);
- param->txMode.tm = (CrgTxMode) tmpEnum;
-#ifdef TENB_MULT_CELL_SUPPRT
- CMCHKUNPK(SUnpkS16, ¶m->rguUlSapId, mBuf);
- CMCHKUNPK(SUnpkS16, ¶m->rguDlSapId, mBuf);
-#endif
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmPkCrgDlLchCfg
-*
-*
-* Desc : Logical channel configuration info for downlink logical channels
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkCrgDlLchCfg
-(
-CrgDlLchCfg *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKPK(oduUnpackUInt8, param->dlTrchType, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkCrgDlLchCfg
-*
-*
-* Desc : Logical channel configuration info for downlink logical channels
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkCrgDlLchCfg
-(
-CrgDlLchCfg *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKUNPK(oduPackUInt8, ¶m->dlTrchType, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmPkCrgUlLchCfg
-*
-*
-* Desc : Logical channel configuration info for uplink logical channels
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkCrgUlLchCfg
-(
-CrgUlLchCfg *param,
-Buffer *mBuf
-)
-{
-
- CMCHKPK(oduUnpackUInt8, param->lcgId, mBuf);
- CMCHKPK(oduUnpackUInt8, param->ulTrchType, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkCrgUlLchCfg
-*
-*
-* Desc : Logical channel configuration info for uplink logical channels
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkCrgUlLchCfg
-(
-CrgUlLchCfg *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKUNPK(oduPackUInt8, ¶m->ulTrchType, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->lcgId, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmPkCrgLchCfg
-*
-*
-* Desc : Logical channel configuration info for common and dedicated channels
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkCrgLchCfg
-(
-CrgLchCfg *param,
-Buffer *mBuf
-)
-{
-
-/* crg_c_001.main_5 - ADD - Added the packing for LTE_L2_MEAS. */
-#ifdef LTE_L2_MEAS
- CMCHKPK(oduUnpackUInt8, param->qci, mBuf);
-#endif
- CMCHKPK(cmPkCrgUlLchCfg, ¶m->ulInfo, mBuf);
- CMCHKPK(cmPkCrgDlLchCfg, ¶m->dlInfo, mBuf);
- CMCHKPK(oduUnpackUInt8, param->dir, mBuf);
- CMCHKPK(cmPkLteLcType, param->lcType, mBuf);
- CMCHKPK(cmPkLteLcId, param->lcId, mBuf);
- CMCHKPK(cmPkLteRnti, param->crnti, mBuf);
- CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkCrgLchCfg
-*
-*
-* Desc : Logical channel configuration info for common and dedicated channels
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkCrgLchCfg
-(
-CrgLchCfg *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKUNPK(cmUnpkLteCellId, ¶m->cellId, mBuf);
- CMCHKUNPK(cmUnpkLteRnti, ¶m->crnti, mBuf);
- CMCHKUNPK(cmUnpkLteLcId, ¶m->lcId, mBuf);
- CMCHKUNPK(cmUnpkLteLcType, ¶m->lcType, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->dir, mBuf);
- CMCHKUNPK(cmUnpkCrgDlLchCfg, ¶m->dlInfo, mBuf);
- CMCHKUNPK(cmUnpkCrgUlLchCfg, ¶m->ulInfo, mBuf);
-/* crg_c_001.main_5 - ADD - Added the unpacking for LTE_L2_MEAS. */
-#ifdef LTE_L2_MEAS
- CMCHKUNPK(oduPackUInt8, ¶m->qci, mBuf);
-#endif
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmPkCrgCfg
-*
-*
-* Desc : Basic configuration info for MAC
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkCrgCfg
-(
-CrgCfg *param,
-Buffer *mBuf
-)
-{
-
-
- switch(param->cfgType) {
- case CRG_LCH_CFG:
- CMCHKPK(cmPkCrgLchCfg, ¶m->u.lchCfg, mBuf);
- break;
- case CRG_UE_CFG:
- CMCHKPK(cmPkCrgUeCfg, ¶m->u.ueCfg, mBuf);
- break;
- case CRG_CELL_CFG:
- CMCHKPK(cmPkCrgCellCfg, ¶m->u.cellCfg, mBuf);
- break;
- default :
- return RFAILED;
- }
- CMCHKPK(oduUnpackUInt8, param->cfgType, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkCrgCfg
-*
-*
-* Desc : Basic configuration info for MAC
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkCrgCfg
-(
-CrgCfg *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKUNPK(oduPackUInt8, ¶m->cfgType, mBuf);
- switch(param->cfgType) {
- case CRG_CELL_CFG:
- CMCHKUNPK(cmUnpkCrgCellCfg, ¶m->u.cellCfg, mBuf);
- break;
- case CRG_UE_CFG:
- CMCHKUNPK(cmUnpkCrgUeCfg, ¶m->u.ueCfg, mBuf);
- break;
- case CRG_LCH_CFG:
- CMCHKUNPK(cmUnpkCrgLchCfg, ¶m->u.lchCfg, mBuf);
- break;
- default :
- return RFAILED;
- }
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmPkCrgCellRecfg
-*
-*
-* Desc : Cell reconfiguration info
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkCrgCellRecfg
-(
-CrgCellRecfg *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKPK(cmPkCrgRachCfg, ¶m->rachRecfg, mBuf);
- CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkCrgCellRecfg
-*
-*
-* Desc : Cell reconfiguration info
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkCrgCellRecfg
-(
-CrgCellRecfg *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKUNPK(cmUnpkLteCellId, ¶m->cellId, mBuf);
- CMCHKUNPK(cmUnpkCrgRachCfg, ¶m->rachRecfg, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmPkCrgUeRecfg
-*
-*
-* Desc : UE reconfiguration info
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkCrgUeRecfg
-(
-CrgUeRecfg *param,
-Buffer *mBuf
-)
-{
-
-#ifdef LTE_ADV
- if(TRUE == param->crgSCellCfg.isSCellCfgPres)
- {
- CMCHKPK(cmPkCrgUeSecCellInfo, ¶m->crgSCellCfg, mBuf);
- }
- else
- {
- CMCHKPK(oduUnpackUInt8, param->crgSCellCfg.isSCellCfgPres, mBuf);
- }
-#endif /* LTE_ADV */
- CMCHKPK(oduUnpackUInt32, param->txMode.tm, mBuf);
- CMCHKPK(oduUnpackUInt8, param->txMode.pres, mBuf);
- CMCHKPK(cmPkCrgUeUlHqCfg, ¶m->ueUlHqRecfg, mBuf);
- CMCHKPK(cmPkLteRnti, param->newCrnti, mBuf);
- CMCHKPK(cmPkLteRnti, param->oldCrnti, mBuf);
- CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkCrgUeRecfg
-*
-*
-* Desc : UE reconfiguration info
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkCrgUeRecfg
-(
-CrgUeRecfg *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKUNPK(cmUnpkLteCellId, ¶m->cellId, mBuf);
- CMCHKUNPK(cmUnpkLteRnti, ¶m->oldCrnti, mBuf);
- CMCHKUNPK(cmUnpkLteRnti, ¶m->newCrnti, mBuf);
- CMCHKUNPK(cmUnpkCrgUeUlHqCfg, ¶m->ueUlHqRecfg, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->txMode.pres, mBuf);
- CMCHKUNPK(oduPackUInt32, (uint32_t *)¶m->txMode.tm, mBuf);
-#ifdef LTE_ADV
- CMCHKUNPK(cmUnpkCrgUeSecCellInfo, ¶m->crgSCellCfg, mBuf);
-#endif /* LTE_ADV */
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmPkCrgLchRecfg
-*
-*
-* Desc : Logical channel reconfiguration info for dedicated channels only
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkCrgLchRecfg
-(
-CrgLchRecfg *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKPK(oduUnpackUInt8, param->ulRecfg.lcgId, mBuf);
- CMCHKPK(cmPkLteLcId, param->lcId, mBuf);
- CMCHKPK(cmPkLteRnti, param->crnti, mBuf);
- CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkCrgLchRecfg
-*
-*
-* Desc : Logical channel reconfiguration info for dedicated channels only
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkCrgLchRecfg
-(
-CrgLchRecfg *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKUNPK(cmUnpkLteCellId, ¶m->cellId, mBuf);
- CMCHKUNPK(cmUnpkLteRnti, ¶m->crnti, mBuf);
- CMCHKUNPK(cmUnpkLteLcId, ¶m->lcId, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->ulRecfg.lcgId, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmPkCrgRecfg
-*
-*
-* Desc : Basic reconfiguration info for MAC
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkCrgRecfg
-(
-CrgRecfg *param,
-Buffer *mBuf
-)
-{
-
-
- switch(param->recfgType) {
- case CRG_LCH_CFG:
- CMCHKPK(cmPkCrgLchRecfg, ¶m->u.lchRecfg, mBuf);
- break;
- case CRG_UE_CFG:
- CMCHKPK(cmPkCrgUeRecfg, ¶m->u.ueRecfg, mBuf);
- break;
- case CRG_CELL_CFG:
- CMCHKPK(cmPkCrgCellRecfg, ¶m->u.cellRecfg, mBuf);
- break;
- default :
- return RFAILED;
- }
- CMCHKPK(oduUnpackUInt8, param->recfgType, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkCrgRecfg
-*
-*
-* Desc : Basic reconfiguration info for MAC
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkCrgRecfg
-(
-CrgRecfg *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKUNPK(oduPackUInt8, ¶m->recfgType, mBuf);
- switch(param->recfgType) {
- case CRG_CELL_CFG:
- CMCHKUNPK(cmUnpkCrgCellRecfg, ¶m->u.cellRecfg, mBuf);
- break;
- case CRG_UE_CFG:
- CMCHKUNPK(cmUnpkCrgUeRecfg, ¶m->u.ueRecfg, mBuf);
- break;
- case CRG_LCH_CFG:
- CMCHKUNPK(cmUnpkCrgLchRecfg, ¶m->u.lchRecfg, mBuf);
- break;
- default :
- return RFAILED;
- }
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmPkCrgDel
-*
-*
-* Desc : Basic Delete info for MAC
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkCrgDel
-(
-CrgDel *param,
-Buffer *mBuf
-)
-{
-
-
- switch(param->delType) {
- case CRG_LCH_CFG:
- CMCHKPK(oduUnpackUInt8, param->u.lchDel.dir, mBuf);
- CMCHKPK(cmPkLteLcId, param->u.lchDel.lcId, mBuf);
- CMCHKPK(cmPkLteRnti, param->u.lchDel.crnti, mBuf);
- CMCHKPK(cmPkLteCellId, param->u.lchDel.cellId, mBuf);
- break;
- case CRG_UE_CFG:
- CMCHKPK(cmPkLteRnti, param->u.ueDel.crnti, mBuf);
- CMCHKPK(cmPkLteCellId, param->u.ueDel.cellId, mBuf);
- break;
- case CRG_CELL_CFG:
- CMCHKPK(cmPkLteCellId, param->u.cellDel.cellId, mBuf);
- break;
- default :
- return RFAILED;
- }
- CMCHKPK(oduUnpackUInt8, param->delType, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkCrgDel
-*
-*
-* Desc : Basic Delete info for MAC
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkCrgDel
-(
-CrgDel *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKUNPK(oduPackUInt8, ¶m->delType, mBuf);
- switch(param->delType) {
- case CRG_CELL_CFG:
- CMCHKUNPK(cmUnpkLteCellId, ¶m->u.cellDel.cellId, mBuf);
- break;
- case CRG_UE_CFG:
- CMCHKUNPK(cmUnpkLteCellId, ¶m->u.ueDel.cellId, mBuf);
- CMCHKUNPK(cmUnpkLteRnti, ¶m->u.ueDel.crnti, mBuf);
- break;
- case CRG_LCH_CFG:
- CMCHKUNPK(cmUnpkLteCellId, ¶m->u.lchDel.cellId, mBuf);
- CMCHKUNPK(cmUnpkLteRnti, ¶m->u.lchDel.crnti, mBuf);
- CMCHKUNPK(cmUnpkLteLcId, ¶m->u.lchDel.lcId, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->u.lchDel.dir, mBuf);
- break;
- default :
- return RFAILED;
- }
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmPkCrgRst
-*
-*
-* Desc : UE RESET info for MAC
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkCrgRst
-(
-CrgRst *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKPK(cmPkLteRnti, param->crnti, mBuf);
- CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkCrgRst
-*
-*
-* Desc : UE RESET info for MAC
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkCrgRst
-(
-CrgRst *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKUNPK(cmUnpkLteCellId, ¶m->cellId, mBuf);
- CMCHKUNPK(cmUnpkLteRnti, ¶m->crnti, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmPkCrgCfgReqInfo
-*
-*
-* Desc : Config/Reconfig/Delete info for MAC
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkCrgCfgReqInfo
-(
-CrgCfgReqInfo *param,
-Buffer *mBuf
-)
-{
-
-
- switch(param->action) {
- case CRG_RESET:
- CMCHKPK(cmPkCrgRst, ¶m->u.rstInfo, mBuf);
- break;
- case CRG_DELETE:
- CMCHKPK(cmPkCrgDel, ¶m->u.delInfo, mBuf);
- break;
- case CRG_RECONFIG:
- CMCHKPK(cmPkCrgRecfg, ¶m->u.recfgInfo, mBuf);
- break;
- case CRG_CONFIG:
- CMCHKPK(cmPkCrgCfg, ¶m->u.cfgInfo, mBuf);
- break;
- default :
- return RFAILED;
- }
- CMCHKPK(oduUnpackUInt8, param->action, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkCrgCfgReqInfo
-*
-*
-* Desc : Config/Reconfig/Delete info for MAC
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkCrgCfgReqInfo
-(
-CrgCfgReqInfo *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKUNPK(oduPackUInt8, ¶m->action, mBuf);
- switch(param->action) {
- case CRG_CONFIG:
- CMCHKUNPK(cmUnpkCrgCfg, ¶m->u.cfgInfo, mBuf);
- break;
- case CRG_RECONFIG:
- CMCHKUNPK(cmUnpkCrgRecfg, ¶m->u.recfgInfo, mBuf);
- break;
- case CRG_DELETE:
- CMCHKUNPK(cmUnpkCrgDel, ¶m->u.delInfo, mBuf);
- break;
- case CRG_RESET:
- CMCHKUNPK(cmUnpkCrgRst, ¶m->u.rstInfo, mBuf);
- break;
- default :
- return RFAILED;
- }
- return ROK;
-}
#endif
-
/**********************************************************************
End of file
**********************************************************************/
@brief Defines for CRG interface.
*/
-/* Config/Reconfig/Delete MACROs */
-#define CRG_CONFIG 1 /*!< Macro for action type Configuration */
-#define CRG_RECONFIG 2 /*!< Macro for action type Re-Configuration */
-#define CRG_DELETE 3 /*!< Macro for action type Delete */
-#define CRG_RESET 4 /*!< Macro for action type Reset. Applicable
- * only for UE. */
-
/* Cell/Ue/Logical channel MACROs */
/* crg_h_001.main_6: Removed transport channel types from CRG. */
#define CRG_CELL_CFG 1 /*!< Macro for Cell Configuration type*/
#define EVTCRGBNDREQ 1 /*!< Macro for Bind Request */
#define EVTCRGBNDCFM 2 /*!< Macro for Bind Confirm */
#define EVTCRGUBNDREQ 3 /*!< Macro for Un-Bind Request */
-#define EVTCRGCFGREQ 4 /*!< Macro for Configuration Request */
-#define EVTCRGCFGCFM 5 /*!< Macro for Configuration Confirm */
+#define EVTCRGCFGCFM 4 /*!< Macro for Configuration Confirm */
/* Activation time limit in terms of number of frames */
#define CRG_ACTV_WIN_SIZE 20 /*!< Macro for Size of activation time window
#endif /* LTE_L2_MEAS */
} CrgLchCfg;
-/**
- @brief Basic configuration information for MAC. */
-typedef struct crgCfg
-{
- uint8_t cfgType; /*!< Indicates configuration type */
- union crgCfgU
- {
- CrgCellCfg cellCfg; /*!< Cell configuration */
- CrgUeCfg ueCfg; /*!< UE configuration */
- CrgLchCfg lchCfg; /*!< Logical channel configuration */
- } u; /*!< Union of Cell/UE/Lch configuration */
-} CrgCfg;
-
-
/**
@brief Activation time information. */
typedef struct crgActvTime
CmLteCellId cellId; /*!< Cell ID */
CmLteRnti crnti; /*!< UE ID: CRNTI tobe RESET */
} CrgRst;
-/**
- @brief Config/Reconfig/Delete information for MAC. */
-typedef struct crgCfgReqInfo
-{
- uint8_t action; /*!< Determines cfg/recfg/del/reset */
- union cfgReqInfoU
- {
- CrgCfg cfgInfo; /*!< Configuration related infomation */
- CrgRecfg recfgInfo; /*!< Reconfiguration related information */
- CrgDel delInfo; /*!< Deletion related information */
- CrgRst rstInfo; /*!< Reset related information */
- } u; /*!< Union of config/re-config/delete information */
-} CrgCfgReqInfo;
/*
Function Prototypes
Pst* pst,
SpId spId,
Reason reason));
-/** @brief Configuration Request from RRC to MAC for
- * configuring Cell/Ue/Lch. */
-typedef S16 (*CrgCfgReq) ARGS((
- Pst* pst,
- SpId spId,
- CrgCfgTransId transId,
- CrgCfgReqInfo * cfgReqInfo));
/** @brief Configuration Confirm from MAC to RRC. */
typedef S16 (*CrgCfgCfm) ARGS((
Pst* pst,
SpId spId,
Reason reason
));
-/** @brief Configuration Request from RRC to MAC for
- * configuring Cell/Ue/Lch. */
-S16 RgUiCrgCfgReq ARGS((
- Pst* pst,
- SpId spId,
- CrgCfgTransId transId,
- CrgCfgReqInfo * cfgReqInfo
-));
/** @brief Configuration Confirm from MAC to RRC. */
S16 RgUiCrgCfgCfm ARGS((
Pst* pst,
SpId spId,
Reason reason
));
-/** @brief Configuration Request from RRC to MAC for
- * configuring Cell/Ue/Lch. */
-S16 NhLiCrgCfgReq ARGS((
- Pst* pst,
- SpId spId,
- CrgCfgTransId transId,
- CrgCfgReqInfo * cfgReqInfo
-));
/** @brief Configuration Confirm from MAC to RRC. */
S16 NhLiCrgCfgCfm ARGS((
Pst* pst,
Pst* pst,
Buffer *mBuf
));
-/** @brief Configuration Request from RRC to MAC for
- * configuring Cell/Ue/Lch. */
-S16 cmPkCrgCfgReq ARGS((
- Pst* pst,
- SpId spId,
- CrgCfgTransId transId,
- CrgCfgReqInfo * cfgReqInfo
-));
-/** @brief Configuration Request from RRC to MAC for
- * configuring Cell/Ue/Lch. */
-S16 cmUnpkCrgCfgReq ARGS((
- CrgCfgReq func,
- Pst* pst,
- Buffer *mBuf
-));
/** @brief Configuration Confirm from MAC to RRC. */
S16 cmPkCrgCfgCfm ARGS((
Pst* pst,
CrgRachCfg *param,
Buffer *mBuf
));
-S16 cmPkCrgCellCfg ARGS((
- CrgCellCfg *param,
- Buffer *mBuf
-));
-S16 cmUnpkCrgCellCfg ARGS((
- CrgCellCfg *param,
- Buffer *mBuf
-));
S16 cmPkCrgUeUlHqCfg ARGS((
CrgUeUlHqCfg *param,
Buffer *mBuf
CrgUeUlHqCfg *param,
Buffer *mBuf
));
-S16 cmPkCrgUeCfg ARGS((
- CrgUeCfg *param,
- Buffer *mBuf
-));
-S16 cmUnpkCrgUeCfg ARGS((
- CrgUeCfg *param,
- Buffer *mBuf
-));
#ifdef LTE_ADV
S16 cmPkCrgUeSecCellInfo ARGS((
));
#endif /* LTE_ADV */
-S16 cmPkCrgDlLchCfg ARGS((
- CrgDlLchCfg *param,
- Buffer *mBuf
-));
-S16 cmUnpkCrgDlLchCfg ARGS((
- CrgDlLchCfg *param,
- Buffer *mBuf
-));
-S16 cmPkCrgUlLchCfg ARGS((
- CrgUlLchCfg *param,
- Buffer *mBuf
-));
-S16 cmUnpkCrgUlLchCfg ARGS((
- CrgUlLchCfg *param,
- Buffer *mBuf
-));
-S16 cmPkCrgLchCfg ARGS((
- CrgLchCfg *param,
- Buffer *mBuf
-));
-S16 cmUnpkCrgLchCfg ARGS((
- CrgLchCfg *param,
- Buffer *mBuf
-));
-S16 cmPkCrgCfg ARGS((
- CrgCfg *param,
- Buffer *mBuf
-));
-S16 cmUnpkCrgCfg ARGS((
- CrgCfg *param,
- Buffer *mBuf
-));
S16 cmPkCrgActvTime ARGS((
CrgActvTime *param,
Buffer *mBuf
CrgActvTime *param,
Buffer *mBuf
));
-S16 cmPkCrgCellRecfg ARGS((
- CrgCellRecfg *param,
- Buffer *mBuf
-));
-S16 cmUnpkCrgCellRecfg ARGS((
- CrgCellRecfg *param,
- Buffer *mBuf
-));
-S16 cmPkCrgUeRecfg ARGS((
- CrgUeRecfg *param,
- Buffer *mBuf
-));
-S16 cmUnpkCrgUeRecfg ARGS((
- CrgUeRecfg *param,
- Buffer *mBuf
-));
-S16 cmPkCrgLchRecfg ARGS((
- CrgLchRecfg *param,
- Buffer *mBuf
-));
-S16 cmUnpkCrgLchRecfg ARGS((
- CrgLchRecfg *param,
- Buffer *mBuf
-));
-S16 cmPkCrgRecfg ARGS((
- CrgRecfg *param,
- Buffer *mBuf
-));
-S16 cmUnpkCrgRecfg ARGS((
- CrgRecfg *param,
- Buffer *mBuf
-));
-S16 cmPkCrgDel ARGS((
- CrgDel *param,
- Buffer *mBuf
-));
-S16 cmUnpkCrgDel ARGS((
- CrgDel *param,
- Buffer *mBuf
-));
-S16 cmPkCrgRst ARGS((
- CrgRst *param,
- Buffer *mBuf
-));
-S16 cmUnpkCrgRst ARGS((
- CrgRst *param,
- Buffer *mBuf
-));
-S16 cmPkCrgCfgReqInfo ARGS((
- CrgCfgReqInfo *param,
- Buffer *mBuf
-));
-S16 cmUnpkCrgCfgReqInfo ARGS((
- CrgCfgReqInfo *param,
- Buffer *mBuf
-));
#endif
#ifdef DM
SpId spId,
Reason reason
));
-/** @brief Configuration Request from RRC to MAC for
- * configuring Cell/Ue/Lch. */
-S16 DmUiCrgCfgReq ARGS((
- Pst* pst,
- SpId spId,
- CrgCfgTransId transId,
- CrgCfgReqInfo * cfgReqInfo
-));
-/** @brief Configuration Confirm from MAC to RRC. */
-S16 DmUiCrgCfgCfm ARGS((
- Pst* pst,
- SuId suId,
- CrgCfgTransId transId,
- uint8_t status
-));
#endif
#ifdef __cplusplus
\f
/**
-* @brief This API is used to send a
-Statistics Confirm from MAC to LM.
-*
-* @details
-*
-* Function: cmUnpkLrgStsCfm
-*
-* @param[in] Pst * pst
-* @param[in] RgMngmt * cfm
-* @return S16
-* -# ROK
-**/
+ * * @brief This API is used to send a
+ * Statistics Confirm from MAC to LM.
+ * *
+ * * @details
+ * *
+ * * Function: cmUnpkLrgStsCfm
+ * *
+ * * @param[in] Pst * pst
+ * * @param[in] RgMngmt * cfm
+ * * @return S16
+ * * -# ROK
+ * **/
S16 cmUnpkLrgStsCfm
(
LrgStsCfm func,
)
{
RgMngmt cfm;
-
+
if (cmUnpkRgMngmt(pst, &cfm, EVTLRGSTSCFM, mBuf) != ROK) {
SPutMsg(mBuf);
}
\f
-/**
-* @brief This API is used to send a
-Status Request from LM to MAC.
-*
-* @details
-*
-* Function: cmPkLrgStaReq
-*
-* @param[in] Pst * pst
-* @param[in] RgMngmt * sta
-* @return S16
-* -# ROK
-**/
-S16 cmPkLrgStaReq
-(
-Pst * pst,
-RgMngmt * sta
-)
-{
- Buffer *mBuf = NULLP;
-
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ELRG019, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- if (cmPkRgMngmt(pst, sta, EVTLRGSSTAREQ, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ELRG020, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTLRGSSTAREQ;
- return (SPstTsk(pst,mBuf));
-}
-
-\f
-/**
-* @brief This API is used to send a
-Status Request from LM to MAC.
-*
-* @details
-*
-* Function: cmUnpkLrgStaReq
-*
-* @param[in] Pst * pst
-* @param[in] RgMngmt * sta
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkLrgStaReq
-(
-LrgStaReq func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- RgMngmt sta;
-
-
- memset(&sta, 0, sizeof(RgMngmt));
- if (cmUnpkRgMngmt(pst, &sta, EVTLRGSSTAREQ, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ELRG021, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
- SPutMsg(mBuf);
- return ((*func)(pst, &sta));
-}
-
-\f
-/**
-* @brief This API is used to send a
-Status Confirm from MAC to LM.
-*
-* @details
-*
-* Function: cmPkLrgStaCfm
-*
-* @param[in] Pst * pst
-* @param[in] RgMngmt * cfm
-* @return S16
-* -# ROK
-**/
-S16 cmPkLrgStaCfm
-(
-Pst * pst,
-RgMngmt * cfm
-)
-{
- Buffer *mBuf = NULLP;
-
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ELRG022, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- if (cmPkRgMngmt(pst, cfm, EVTLRGSSTACFM, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ELRG023, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTLRGSSTACFM;
- return (SPstTsk(pst,mBuf));
-}
-
-\f
-/**
-* @brief This API is used to send a
-Status Confirm from MAC to LM.
-*
-* @details
-*
-* Function: cmUnpkLrgStaCfm
-*
-* @param[in] Pst * pst
-* @param[in] RgMngmt * cfm
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkLrgStaCfm
-(
-LrgStaCfm func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- RgMngmt cfm;
-
-
- memset(&cfm, 0, sizeof(RgMngmt));
- if (cmUnpkRgMngmt(pst, &cfm, EVTLRGSSTACFM, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ELRG024, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
- SPutMsg(mBuf);
- return ((*func)(pst, &cfm));
-}
-
-\f
/**
* @brief This API is used to send a
Status Indication from MAC to LM.
}
\f
-/**
-* @brief This API is used to send a
-Control Request from LM to MAC.
+/***********************************************************
*
-* @details
+* Func : cmPkRgGenCfg
*
-* Function: cmPkLrgCntrlReq
*
-* @param[in] Pst * pst
-* @param[in] RgMngmt * cntrl
-* @return S16
-* -# ROK
-**/
-S16 cmPkLrgCntrlReq
+* Desc : This structure holds configuration parameters for MAC General Configuration.
+*
+*
+* Ret : S16
+*
+* Notes:
+*
+* File :
+*
+**********************************************************/
+S16 cmPkRgGenCfg
(
-Pst * pst,
-RgMngmt * cntrl
+RgGenCfg *param,
+Buffer *mBuf
)
{
- Buffer *mBuf = NULLP;
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ELRG031, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- if (pst->selector == ODU_SELECTOR_LC) {
- if (cmPkRgMngmt(pst, cntrl, EVTLRGCNTRLREQ, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ELRG032, (ErrVal)0, "Packing failed");
+
+#ifdef LTE_ADV
+ CMCHKPK(oduUnpackUInt8, param->isSCellActDeactAlgoEnable, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->forceCntrlSrbBoOnPCel, mBuf);
#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
- }
-
- pst->event = (Event) EVTLRGCNTRLREQ;
- return (SPstTsk(pst,mBuf));
+ CMCHKPK(oduUnpackUInt8, param->startCellId, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->numRguSaps, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->tmrRes, mBuf);
+ CMCHKPK(cmPkMemoryId, ¶m->mem, mBuf);
+ CMCHKPK(cmPkPst, ¶m->lmPst, mBuf);
+ return ROK;
}
+
\f
-/**
-* @brief This API is used to send a
-Control Request from LM to MAC.
+/***********************************************************
*
-* @details
+* Func : cmUnpkRgGenCfg
*
-* Function: cmUnpkLrgCntrlReq
*
-* @param[in] Pst * pst
-* @param[in] RgMngmt * cntrl
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkLrgCntrlReq
+* Desc : This structure holds configuration parameters for MAC General Configuration.
+*
+*
+* Ret : S16
+*
+* Notes:
+*
+* File :
+*
+**********************************************************/
+S16 cmUnpkRgGenCfg
(
-LrgCntrlReq func,
-Pst *pst,
+RgGenCfg *param,
Buffer *mBuf
)
{
- RgMngmt cntrl;
-
- if (cmUnpkRgMngmt(pst, &cntrl, EVTLRGCNTRLREQ, mBuf) != ROK) {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ELRG033, (ErrVal)0, "Packing failed");
+
+ CMCHKUNPK(cmUnpkPst, ¶m->lmPst, mBuf);
+ CMCHKUNPK(cmUnpkMemoryId, ¶m->mem, mBuf);
+ CMCHKUNPK(oduPackUInt8, ¶m->tmrRes, mBuf);
+ CMCHKUNPK(oduPackUInt8, ¶m->numRguSaps, mBuf);
+ CMCHKUNPK(oduPackUInt8, ¶m->startCellId, mBuf);
+#ifdef LTE_ADV
+ CMCHKUNPK(oduPackUInt8, ¶m->forceCntrlSrbBoOnPCel, mBuf);
+ CMCHKUNPK(oduPackUInt8, ¶m->isSCellActDeactAlgoEnable, mBuf);
#endif
- return RFAILED;
- }
- SPutMsg(mBuf);
- return ((*func)(pst, &cntrl));
+ return ROK;
}
+
\f
-/**
-* @brief This API is used to send a
-Control Request from LM to SCH.
+/***********************************************************
*
-* @details
+* Func : cmPkRgUpSapCfg
*
-* Function: cmPkLrgSchCntrlReq
*
-* @param[in] Pst * pst
-* @param[in] RgMngmt * cntrl
-* @return S16
-* -# ROK
-**/
-S16 cmPkLrgSchCntrlReq
-(
-Pst * pst,
-RgMngmt * cntrl
-)
-{
- Buffer *mBuf = NULLP;
-
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ELRG034, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- if (pst->selector == ODU_SELECTOR_LC) {
- if (cmPkRgMngmt(pst, cntrl, EVTLRGSCHCNTRLREQ, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ELRG035, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
- }
-
- pst->event = (Event) EVTLRGSCHCNTRLREQ;
- return (SPstTsk(pst,mBuf));
-}
-
-\f
-/**
-* @brief This API is used to send a
-Control Request from LM to SCH.
-*
-* @details
-*
-* Function: cmUnpkLrgSchCntrlReq
-*
-* @param[in] Pst * pst
-* @param[in] RgMngmt * cntrl
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkLrgSchCntrlReq
-(
-LrgSchCntrlReq func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- RgMngmt cntrl;
-
-
- if (cmUnpkRgMngmt(pst, &cntrl, EVTLRGSCHCNTRLREQ, mBuf) != ROK) {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ELRG036, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- SPutMsg(mBuf);
- return ((*func)(pst, &cntrl));
-}
-
-\f
-/**
-* @brief This API is used to send a
-Control Confirm from MAC to LM.
-*
-* @details
-*
-* Function: cmPkLrgCntrlCfm
-*
-* @param[in] Pst * pst
-* @param[in] RgMngmt * cfm
-* @return S16
-* -# ROK
-**/
-S16 cmPkLrgCntrlCfm
-(
-Pst * pst,
-RgMngmt * cfm
-)
-{
- Buffer *mBuf = NULLP;
-
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ELRG037, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- if (pst->selector == ODU_SELECTOR_LC) {
- if (cmPkRgMngmt(pst, cfm, EVTLRGCNTRLCFM, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ELRG038, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
- }
-
- pst->event = (Event) EVTLRGCNTRLCFM;
- return (SPstTsk(pst,mBuf));
-}
-
-\f
-/**
-* @brief This API is used to send a
-Control Confirm from MAC to LM.
-*
-* @details
-*
-* Function: cmUnpkLrgCntrlCfm
-*
-* @param[in] Pst * pst
-* @param[in] RgMngmt * cfm
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkLrgCntrlCfm
-(
-LrgCntrlCfm func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- RgMngmt cfm;
-
-
- if (cmUnpkRgMngmt(pst, &cfm, EVTLRGCNTRLCFM, mBuf) != ROK) {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ELRG039, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- SPutMsg(mBuf);
- return ((*func)(pst, &cfm));
-}
-
-\f
-/**
-* @brief This API is used to send a
-Control Confirm from SCH to LM.
-*
-* @details
-*
-* Function: cmPkLrgSchCntrlCfm
-*
-* @param[in] Pst * pst
-* @param[in] RgMngmt * cntrl
-* @return S16
-* -# ROK
-**/
-S16 cmPkLrgSchCntrlCfm
-(
-Pst * pst,
-RgMngmt * cntrl
-)
-{
- Buffer *mBuf = NULLP;
-
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ELRG040, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- if (pst->selector == ODU_SELECTOR_LC) {
- if (cmPkRgMngmt(pst, cntrl, EVTLRGSCHCNTRLCFM, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ELRG041, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
- }
-
- pst->event = (Event) EVTLRGSCHCNTRLCFM;
- return (SPstTsk(pst,mBuf));
-}
-
-\f
-/**
-* @brief This API is used to send a
-Control Confirm from SCH to LM.
-*
-* @details
-*
-* Function: cmUnpkLrgSchCntrlCfm
-*
-* @param[in] Pst * pst
-* @param[in] RgMngmt * cntrl
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkLrgSchCntrlCfm
-(
-LrgSchCntrlCfm func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- RgMngmt cntrl;
-
-
- if (cmUnpkRgMngmt(pst, &cntrl, EVTLRGSCHCNTRLCFM, mBuf) != ROK) {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ELRG042, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- SPutMsg(mBuf);
- return ((*func)(pst, &cntrl));
-}
-
-\f
-/**
-* @brief This API is used to send a
-Trace Indication from MAC to LM.
-*
-* @details
-*
-* Function: cmPkLrgTrcInd
-*
-* @param[in] Pst * pst
-* @param[in] RgMngmt * trc
-* @param[in] Buffer * trcBuf
-* @return S16
-* -# ROK
-**/
-S16 cmPkLrgTrcInd
-(
-Pst * pst,
-RgMngmt * trc,
-Buffer * trcBuf
-)
-{
- Buffer *mBuf = NULLP;
-
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ELRG043, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(trcBuf);
- return RFAILED;
- }
- if (pst->selector == ODU_SELECTOR_LC) {
- MsgLen msgLen;
- if (SFndLenMsg(trcBuf, &msgLen) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ELRG044, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(trcBuf);
- return RFAILED;
- }
- if (SCatMsg(mBuf, trcBuf, M1M2) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ELRG045, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(trcBuf);
- return RFAILED;
- }
- SPutMsg(trcBuf);
- CMCHKPK(cmPkMsgLen, msgLen, mBuf);
- }
- if (cmPkRgMngmt(pst, trc, EVTLRGTRCIND, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ELRG046, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(trcBuf);
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTLRGTRCIND;
- return (SPstTsk(pst,mBuf));
-}
-
-\f
-/**
-* @brief This API is used to send a
-Trace Indication from MAC to LM.
-*
-* @details
-*
-* Function: cmUnpkLrgTrcInd
-*
-* @param[in] Pst * pst
-* @param[in] RgMngmt * trc
-* @param[in] Buffer * trcBuf
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkLrgTrcInd
-(
-LrgTrcInd func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- RgMngmt trc;
- /* lrg_c_001.main_3 - MODIFY - Modified trcBuf to have it initialized to NULLP */
- Buffer *trcBuf = NULLP;
-
-
- if (cmUnpkRgMngmt(pst, &trc, EVTLRGTRCIND, mBuf) != ROK) {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ELRG047, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- if (pst->selector == ODU_SELECTOR_LC) {
- MsgLen msgLen, totalMsgLen;
- CMCHKUNPK(cmUnpkMsgLen, &msgLen, mBuf);
- if (SFndLenMsg(mBuf, &totalMsgLen) != ROK)
- return RFAILED;
- if (SSegMsg(mBuf, totalMsgLen-msgLen, &trcBuf) != ROK)
- return RFAILED;
- }
- SPutMsg(mBuf);
- return ((*func)(pst, &trc, trcBuf));
-}
-
-\f
-/***********************************************************
-*
-* Func : cmPkRgGenCfg
-*
-*
-* Desc : This structure holds configuration parameters for MAC General Configuration.
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkRgGenCfg
-(
-RgGenCfg *param,
-Buffer *mBuf
-)
-{
-
-
-#ifdef LTE_ADV
- CMCHKPK(oduUnpackUInt8, param->isSCellActDeactAlgoEnable, mBuf);
- CMCHKPK(oduUnpackUInt8, param->forceCntrlSrbBoOnPCel, mBuf);
-#endif
- CMCHKPK(oduUnpackUInt8, param->startCellId, mBuf);
- CMCHKPK(oduUnpackUInt8, param->numRguSaps, mBuf);
- CMCHKPK(oduUnpackUInt8, param->tmrRes, mBuf);
- CMCHKPK(cmPkMemoryId, ¶m->mem, mBuf);
- CMCHKPK(cmPkPst, ¶m->lmPst, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkRgGenCfg
-*
-*
-* Desc : This structure holds configuration parameters for MAC General Configuration.
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkRgGenCfg
-(
-RgGenCfg *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKUNPK(cmUnpkPst, ¶m->lmPst, mBuf);
- CMCHKUNPK(cmUnpkMemoryId, ¶m->mem, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->tmrRes, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->numRguSaps, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->startCellId, mBuf);
-#ifdef LTE_ADV
- CMCHKUNPK(oduPackUInt8, ¶m->forceCntrlSrbBoOnPCel, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->isSCellActDeactAlgoEnable, mBuf);
-#endif
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmPkRgUpSapCfg
-*
-*
-* Desc : This structure holds configuration parameters for MAC Upper SAP Configuration.
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkRgUpSapCfg
-(
-RgUpSapCfg *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKPK(SPkS16, param->suId, mBuf);
- CMCHKPK(SPkS16, param->spId, mBuf);
- CMCHKPK(oduUnpackUInt8, param->route, mBuf);
- CMCHKPK(oduUnpackUInt8, param->inst, mBuf);
- CMCHKPK(oduUnpackUInt8, param->ent, mBuf);
- CMCHKPK(oduUnpackUInt16, param->procId, mBuf);
- CMCHKPK(oduUnpackUInt8, param->prior, mBuf);
- CMCHKPK(cmPkMemoryId, ¶m->mem, mBuf);
- CMCHKPK(oduUnpackUInt8, param->selector, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkRgUpSapCfg
-*
-*
-* Desc : This structure holds configuration parameters for MAC Upper SAP Configuration.
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkRgUpSapCfg
-(
-RgUpSapCfg *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKUNPK(oduPackUInt8, ¶m->selector, mBuf);
- CMCHKUNPK(cmUnpkMemoryId, ¶m->mem, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->prior, mBuf);
- CMCHKUNPK(oduPackUInt16, ¶m->procId, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->ent, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->inst, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->route, mBuf);
- CMCHKUNPK(SUnpkS16, ¶m->spId, mBuf);
- CMCHKUNPK(SUnpkS16, ¶m->suId, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmPkRgLowSapCfg
-*
-*
-* Desc : This structure holds configuration parameters for MAC Lower SAP Configuration.
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkRgLowSapCfg
-(
-RgLowSapCfg *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKPK(cmPkTmrCfg, ¶m->bndTmr, mBuf);
- CMCHKPK(SPkS16, param->suId, mBuf);
- CMCHKPK(SPkS16, param->spId, mBuf);
- CMCHKPK(oduUnpackUInt8, param->route, mBuf);
- CMCHKPK(oduUnpackUInt8, param->inst, mBuf);
- CMCHKPK(oduUnpackUInt8, param->ent, mBuf);
- CMCHKPK(oduUnpackUInt16, param->procId, mBuf);
- CMCHKPK(oduUnpackUInt8, param->prior, mBuf);
- CMCHKPK(cmPkMemoryId, ¶m->mem, mBuf);
- CMCHKPK(oduUnpackUInt8, param->selector, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkRgLowSapCfg
-*
-*
-* Desc : This structure holds configuration parameters for MAC Lower SAP Configuration.
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkRgLowSapCfg
-(
-RgLowSapCfg *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKUNPK(oduPackUInt8, ¶m->selector, mBuf);
- CMCHKUNPK(cmUnpkMemoryId, ¶m->mem, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->prior, mBuf);
- CMCHKUNPK(oduPackUInt16, ¶m->procId, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->ent, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->inst, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->route, mBuf);
- CMCHKUNPK(SUnpkS16, ¶m->spId, mBuf);
- CMCHKUNPK(SUnpkS16, ¶m->suId, mBuf);
- CMCHKUNPK(cmUnpkTmrCfg, ¶m->bndTmr, mBuf);
- return ROK;
-}
-
-#ifdef MAC_SCH_STATS
-
-\f
-/***********************************************************
-*
-* Func : cmPkRgAckNack
-*
-*
-* Desc : Ack and Nack statistics
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkRgAckNack
-(
-RgAckNack *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKPK(oduUnpackUInt16, param->numOfAcks, mBuf);
- CMCHKPK(oduUnpackUInt16, param->numOfNacks, mBuf);
- CMCHKPK(oduUnpackUInt8, param->mcs, mBuf);
-
- return ROK;
-} /* cmPkRgAckNack */
-
-\f
-/***********************************************************
-*
-* Func : cmPkRgSchNackAckStats
-*
-*
-* Desc :
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkRgSchNackAckStats
-(
-RgSchNackAckStats *param,
-Buffer *mBuf
-)
-{
-
- S32 i;
-
- for (i=14; i >= 0; i--) {
- CMCHKPK(cmPkRgAckNack, ¶m->ulCqiStat[i], mBuf);
- }
-
- for (i=14; i >= 0; i--) {
- CMCHKPK(cmPkRgAckNack, ¶m->dlCqiStat[i], mBuf);
- }
-
- return ROK;
-}
-
-\f
-/***********************************************************
-*
-* Func : cmPkRgHqNumRetx
-*
-*
-* Desc : Harq Retransmission statistics
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkRgHqNumRetx
-(
-RgSchHqNumRetx *param,
-Buffer *mBuf
-)
-{
-
- CMCHKPK(oduUnpackUInt32, param->totalTx, mBuf);
- CMCHKPK(oduUnpackUInt16, param->numOfHQ_4, mBuf);
- CMCHKPK(oduUnpackUInt16, param->numOfHQ_3, mBuf);
- CMCHKPK(oduUnpackUInt16, param->numOfHQ_2, mBuf);
- CMCHKPK(oduUnpackUInt16, param->numOfHQ_1, mBuf);
- CMCHKPK(oduUnpackUInt8, param->mcs, mBuf);
-
- return ROK;
-} /* cmPkRgHqNumRetx */
-
-\f
-/***********************************************************
-*
-* Func : cmPkRgSchHqRetxStats
-*
-*
-* Desc :
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkRgSchHqRetxStats
-(
-RgSchHqRetxStats *param,
-Buffer *mBuf
-)
-{
-
- S32 i;
-
- for (i=14; i >= 0; i--) {
- CMCHKPK(cmPkRgHqNumRetx, ¶m->ulCqiStat[i], mBuf);
- }
-
- for (i=14; i >= 0; i--) {
- CMCHKPK(cmPkRgHqNumRetx, ¶m->dlCqiStat[i], mBuf);
- }
-
- return ROK;
-} /* cmPkRgSchHqRetxStats */
-
-/* unpcaking functions */
-\f
-/***********************************************************
-*
-* Func : cmUnpkRgAckNack
-*
-*
-* Desc : Ack and Nack statistics
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkRgAckNack
-(
-RgAckNack *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKUNPK(oduPackUInt8, ¶m->mcs, mBuf);
- CMCHKUNPK(oduPackUInt16, ¶m->numOfNacks, mBuf);
- CMCHKUNPK(oduPackUInt16, ¶m->numOfAcks, mBuf);
-
- return ROK;
-} /* cmUnkRgAckNack */
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkRgSchNackAckStats
-*
-*
-* Desc :
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkRgSchNackAckStats
-(
-RgSchNackAckStats *param,
-Buffer *mBuf
-)
-{
- S32 i;
-
- for (i=0; i <= 14; i++) {
- CMCHKUNPK(cmUnpkRgAckNack, ¶m->dlCqiStat[i], mBuf);
- }
-
- for (i=0; i <= 14; i++) {
- CMCHKUNPK(cmUnpkRgAckNack, ¶m->ulCqiStat[i], mBuf);
- }
-
- return ROK;
-} /* cmUnpkRgSchNackAckStats */
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkRgHqNumRetx
-*
-*
-* Desc : Harq Retransmission statistics
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkRgHqNumRetx
-(
-RgSchHqNumRetx *param,
-Buffer *mBuf
-)
-{
-
- CMCHKUNPK(oduPackUInt8, ¶m->mcs, mBuf);
- CMCHKUNPK(oduPackUInt16, ¶m->numOfHQ_1, mBuf);
- CMCHKUNPK(oduPackUInt16, ¶m->numOfHQ_2, mBuf);
- CMCHKUNPK(oduPackUInt16, ¶m->numOfHQ_3, mBuf);
- CMCHKUNPK(oduPackUInt16, ¶m->numOfHQ_4, mBuf);
- CMCHKUNPK(oduPackUInt32, ¶m->totalTx, mBuf);
-
- return ROK;
-} /* cmUnpkRgHqNumRetx */
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkRgSchHqRetxStats
-*
-*
-* Desc :
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkRgSchHqRetxStats
-(
-RgSchHqRetxStats *param,
-Buffer *mBuf
-)
-{
- S32 i;
-
- for (i=0; i <= 14; i++) {
- CMCHKUNPK(cmUnpkRgHqNumRetx, ¶m->dlCqiStat[i], mBuf);
- }
-
- for (i=0; i <= 14; i++) {
- CMCHKUNPK(cmUnpkRgHqNumRetx, ¶m->ulCqiStat[i], mBuf);
- }
-
- return ROK;
-} /* cmUnpkRgSchHqRetxStats */
-
-#endif /* MAC_SCH_STATS */
-
-\f
-/***********************************************************
-*
-* Func : cmPkRgGenSts
-*
-*
-* Desc : This structure holds General Statistical information of MAC.
+* Desc : This structure holds configuration parameters for MAC Upper SAP Configuration.
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgGenSts
+S16 cmPkRgUpSapCfg
(
-RgGenSts *param,
+RgUpSapCfg *param,
Buffer *mBuf
)
{
-#ifdef MAC_SCH_STATS
- CMCHKPK(cmPkRgSchHqRetxStats, ¶m->hqRetxStats, mBuf);
- CMCHKPK(cmPkRgSchNackAckStats, ¶m->nackAckStats, mBuf);
-#endif /* MAC_SCH_STATS */
- CMCHKPK(oduUnpackUInt16, param->numCellCfg, mBuf);
- CMCHKPK(oduUnpackUInt32, param->numUeCfg, mBuf);
- CMCHKPK(oduUnpackUInt32, param->numHarqFail, mBuf);
+
+ CMCHKPK(SPkS16, param->suId, mBuf);
+ CMCHKPK(SPkS16, param->spId, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->route, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->inst, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->ent, mBuf);
+ CMCHKPK(oduUnpackUInt16, param->procId, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->prior, mBuf);
+ CMCHKPK(cmPkMemoryId, ¶m->mem, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->selector, mBuf);
return ROK;
}
\f
/***********************************************************
*
-* Func : cmUnpkRgGenSts
+* Func : cmUnpkRgUpSapCfg
*
*
-* Desc : This structure holds General Statistical information of MAC.
+* Desc : This structure holds configuration parameters for MAC Upper SAP Configuration.
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgGenSts
+S16 cmUnpkRgUpSapCfg
(
-RgGenSts *param,
+RgUpSapCfg *param,
Buffer *mBuf
)
{
- CMCHKUNPK(oduPackUInt32, ¶m->numHarqFail, mBuf);
- CMCHKUNPK(oduPackUInt32, ¶m->numUeCfg, mBuf);
- CMCHKUNPK(oduPackUInt16, ¶m->numCellCfg, mBuf);
-#ifdef MAC_SCH_STATS
- CMCHKUNPK(cmUnpkRgSchNackAckStats, ¶m->nackAckStats, mBuf);
- CMCHKUNPK(cmUnpkRgSchHqRetxStats, ¶m->hqRetxStats, mBuf);
-#endif /* MAC_SCH_STATS */
+
+ CMCHKUNPK(oduPackUInt8, ¶m->selector, mBuf);
+ CMCHKUNPK(cmUnpkMemoryId, ¶m->mem, mBuf);
+ CMCHKUNPK(oduPackUInt8, ¶m->prior, mBuf);
+ CMCHKUNPK(oduPackUInt16, ¶m->procId, mBuf);
+ CMCHKUNPK(oduPackUInt8, ¶m->ent, mBuf);
+ CMCHKUNPK(oduPackUInt8, ¶m->inst, mBuf);
+ CMCHKUNPK(oduPackUInt8, ¶m->route, mBuf);
+ CMCHKUNPK(SUnpkS16, ¶m->spId, mBuf);
+ CMCHKUNPK(SUnpkS16, ¶m->suId, mBuf);
return ROK;
}
\f
/***********************************************************
*
-* Func : cmPkRgSapSts
+* Func : cmPkRgLowSapCfg
*
*
-* Desc : This structure holds Statistical information of a SAP in MAC.
+* Desc : This structure holds configuration parameters for MAC Lower SAP Configuration.
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgSapSts
+S16 cmPkRgLowSapCfg
(
-RgSapSts *param,
+RgLowSapCfg *param,
Buffer *mBuf
)
{
- CMCHKPK(oduUnpackUInt32, param->numPduDrop, mBuf);
- CMCHKPK(oduUnpackUInt32, param->numPduTxmit, mBuf);
- CMCHKPK(oduUnpackUInt32, param->numPduRcvd, mBuf);
+
+ CMCHKPK(cmPkTmrCfg, ¶m->bndTmr, mBuf);
+ CMCHKPK(SPkS16, param->suId, mBuf);
+ CMCHKPK(SPkS16, param->spId, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->route, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->inst, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->ent, mBuf);
+ CMCHKPK(oduUnpackUInt16, param->procId, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->prior, mBuf);
+ CMCHKPK(cmPkMemoryId, ¶m->mem, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->selector, mBuf);
return ROK;
}
\f
/***********************************************************
*
-* Func : cmUnpkRgSapSts
+* Func : cmUnpkRgLowSapCfg
*
*
-* Desc : This structure holds Statistical information of a SAP in MAC.
+* Desc : This structure holds configuration parameters for MAC Lower SAP Configuration.
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgSapSts
+S16 cmUnpkRgLowSapCfg
(
-RgSapSts *param,
+RgLowSapCfg *param,
Buffer *mBuf
)
{
- CMCHKUNPK(oduPackUInt32, ¶m->numPduRcvd, mBuf);
- CMCHKUNPK(oduPackUInt32, ¶m->numPduTxmit, mBuf);
- CMCHKUNPK(oduPackUInt32, ¶m->numPduDrop, mBuf);
+
+ CMCHKUNPK(oduPackUInt8, ¶m->selector, mBuf);
+ CMCHKUNPK(cmUnpkMemoryId, ¶m->mem, mBuf);
+ CMCHKUNPK(oduPackUInt8, ¶m->prior, mBuf);
+ CMCHKUNPK(oduPackUInt16, ¶m->procId, mBuf);
+ CMCHKUNPK(oduPackUInt8, ¶m->ent, mBuf);
+ CMCHKUNPK(oduPackUInt8, ¶m->inst, mBuf);
+ CMCHKUNPK(oduPackUInt8, ¶m->route, mBuf);
+ CMCHKUNPK(SUnpkS16, ¶m->spId, mBuf);
+ CMCHKUNPK(SUnpkS16, ¶m->suId, mBuf);
+ CMCHKUNPK(cmUnpkTmrCfg, ¶m->bndTmr, mBuf);
return ROK;
}
+#ifdef MAC_SCH_STATS
\f
/***********************************************************
*
-* Func : cmPkRgSchInstCfg
+* Func : cmPkRgAckNack
*
*
-* Desc : Scheduler Configuration
+* Desc : Ack and Nack statistics
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgSchInstCfg
+S16 cmPkRgAckNack
(
-RgSchInstCfg *param,
+RgAckNack *param,
Buffer *mBuf
)
{
- S32 i;
- for (i=param->numSaps-1; i >= 0; i--) {
- CMCHKPK(cmPkRgLowSapCfg, ¶m->tfuSap[i], mBuf);
- }
- for (i=param->numSaps-1; i >= 0; i--) {
- CMCHKPK(cmPkRgUpSapCfg, ¶m->rgrSap[i], mBuf);
- }
- for (i=param->numSaps-1; i >= 0; i--) {
- CMCHKPK(cmPkRgUpSapCfg, ¶m->rgmSap[i], mBuf);
- }
- CMCHKPK(oduUnpackUInt8, param->numSaps, mBuf);
- CMCHKPK(cmPkRgGenCfg, ¶m->genCfg, mBuf);
- CMCHKPK(oduUnpackUInt8, param->instId, mBuf);
- return ROK;
-}
+ CMCHKPK(oduUnpackUInt16, param->numOfAcks, mBuf);
+ CMCHKPK(oduUnpackUInt16, param->numOfNacks, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->mcs, mBuf);
+ return ROK;
+} /* cmPkRgAckNack */
\f
/***********************************************************
*
-* Func : cmUnpkRgSchInstCfg
+* Func : cmPkRgSchNackAckStats
*
*
-* Desc : Scheduler Configuration
+* Desc :
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgSchInstCfg
+S16 cmPkRgSchNackAckStats
(
-RgSchInstCfg *param,
+RgSchNackAckStats *param,
Buffer *mBuf
)
{
S32 i;
- CMCHKUNPK(oduPackUInt8, ¶m->instId, mBuf);
- CMCHKUNPK(cmUnpkRgGenCfg, ¶m->genCfg, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->numSaps, mBuf);
- for (i=0; i<param->numSaps; i++) {
- CMCHKUNPK(cmUnpkRgUpSapCfg, ¶m->rgmSap[i], mBuf);
- }
- for (i=0; i<param->numSaps; i++) {
- CMCHKUNPK(cmUnpkRgUpSapCfg, ¶m->rgrSap[i], mBuf);
- }
- for (i=0; i<param->numSaps; i++) {
- CMCHKUNPK(cmUnpkRgLowSapCfg, ¶m->tfuSap[i], mBuf);
+ for (i=14; i >= 0; i--) {
+ CMCHKPK(cmPkRgAckNack, ¶m->ulCqiStat[i], mBuf);
}
- return ROK;
-}
-
-\f
-/***********************************************************
-*
-* Func : cmPkRgCfg
-*
-*
-* Desc : This structure holds Configuration parameters for MAC.
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkRgCfg
-(
-RgCfg *param,
-S16 elmnt,
-Buffer *mBuf
-)
-{
+ for (i=14; i >= 0; i--) {
+ CMCHKPK(cmPkRgAckNack, ¶m->dlCqiStat[i], mBuf);
+ }
- switch(elmnt) {
- case STSCHINST:
- CMCHKPK(cmPkRgSchInstCfg, ¶m->s.schInstCfg, mBuf);
- break;
- case STTFUSAP:
- CMCHKPK(cmPkRgLowSapCfg, ¶m->s.tfuSap, mBuf);
- break;
- case STCRGSAP:
- CMCHKPK(cmPkRgUpSapCfg, ¶m->s.crgSap, mBuf);
- break;
- case STRGUSAP:
- CMCHKPK(cmPkRgUpSapCfg, ¶m->s.rguSap, mBuf);
- break;
- case STGEN:
- CMCHKPK(cmPkRgGenCfg, ¶m->s.genCfg, mBuf);
- break;
- default :
- return RFAILED;
- }
return ROK;
}
-
\f
/***********************************************************
*
-* Func : cmUnpkRgCfg
+* Func : cmPkRgHqNumRetx
*
*
-* Desc : This structure holds Configuration parameters for MAC.
+* Desc : Harq Retransmission statistics
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgCfg
+S16 cmPkRgHqNumRetx
(
-RgCfg *param,
-S16 elmnt,
+RgSchHqNumRetx *param,
Buffer *mBuf
)
{
- switch(elmnt) {
- case STGEN:
- CMCHKUNPK(cmUnpkRgGenCfg, ¶m->s.genCfg, mBuf);
- break;
- case STRGUSAP:
- CMCHKUNPK(cmUnpkRgUpSapCfg, ¶m->s.rguSap, mBuf);
- break;
- case STCRGSAP:
- CMCHKUNPK(cmUnpkRgUpSapCfg, ¶m->s.crgSap, mBuf);
- break;
- case STTFUSAP:
- CMCHKUNPK(cmUnpkRgLowSapCfg, ¶m->s.tfuSap, mBuf);
- break;
- case STSCHINST:
- CMCHKUNPK(cmUnpkRgSchInstCfg, ¶m->s.schInstCfg, mBuf);
- break;
- default :
- return RFAILED;
- }
- return ROK;
-}
+ CMCHKPK(oduUnpackUInt32, param->totalTx, mBuf);
+ CMCHKPK(oduUnpackUInt16, param->numOfHQ_4, mBuf);
+ CMCHKPK(oduUnpackUInt16, param->numOfHQ_3, mBuf);
+ CMCHKPK(oduUnpackUInt16, param->numOfHQ_2, mBuf);
+ CMCHKPK(oduUnpackUInt16, param->numOfHQ_1, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->mcs, mBuf);
+ return ROK;
+} /* cmPkRgHqNumRetx */
\f
/***********************************************************
*
-* Func : cmPkRgSapSta
+* Func : cmPkRgSchHqRetxStats
*
*
-* Desc : This structure holds a SAP's status information.
+* Desc :
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgSapSta
+S16 cmPkRgSchHqRetxStats
(
-RgSapSta *param,
+RgSchHqRetxStats *param,
Buffer *mBuf
)
{
- CMCHKPK(oduUnpackUInt8, param->sapState, mBuf);
- return ROK;
-}
+ S32 i;
+
+ for (i=14; i >= 0; i--) {
+ CMCHKPK(cmPkRgHqNumRetx, ¶m->ulCqiStat[i], mBuf);
+ }
+ for (i=14; i >= 0; i--) {
+ CMCHKPK(cmPkRgHqNumRetx, ¶m->dlCqiStat[i], mBuf);
+ }
+
+ return ROK;
+} /* cmPkRgSchHqRetxStats */
+/* unpcaking functions */
\f
/***********************************************************
*
-* Func : cmUnpkRgSapSta
+* Func : cmUnpkRgAckNack
*
*
-* Desc : This structure holds a SAP's status information.
+* Desc : Ack and Nack statistics
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgSapSta
+S16 cmUnpkRgAckNack
(
-RgSapSta *param,
+RgAckNack *param,
Buffer *mBuf
)
{
- CMCHKUNPK(oduPackUInt8, ¶m->sapState, mBuf);
- return ROK;
-}
+ CMCHKUNPK(oduPackUInt8, ¶m->mcs, mBuf);
+ CMCHKUNPK(oduPackUInt16, ¶m->numOfNacks, mBuf);
+ CMCHKUNPK(oduPackUInt16, ¶m->numOfAcks, mBuf);
+
+ return ROK;
+} /* cmUnkRgAckNack */
\f
/***********************************************************
*
-* Func : cmPkRgSts
+* Func : cmUnpkRgSchNackAckStats
*
*
-* Desc : This structure holds MAC's Statistical information.
+* Desc :
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgSts
+S16 cmUnpkRgSchNackAckStats
(
-RgSts *param,
-S16 elmnt,
+RgSchNackAckStats *param,
Buffer *mBuf
)
{
+ S32 i;
- switch(elmnt) {
- case STTFUSAP:
- CMCHKPK(cmPkRgSapSts, ¶m->s.tfuSts, mBuf);
- break;
- case STRGRSAP:
- CMCHKPK(cmPkRgSapSts, ¶m->s.rgrSts, mBuf);
- break;
- case STCRGSAP:
- CMCHKPK(cmPkRgSapSts, ¶m->s.crgSts, mBuf);
- break;
- case STRGUSAP:
- CMCHKPK(cmPkRgSapSts, ¶m->s.rguSts, mBuf);
- break;
- case STGEN:
- CMCHKPK(cmPkRgGenSts, ¶m->s.genSts, mBuf);
- break;
- default :
- break;
- }
- CMCHKPK(cmPkAction, param->action, mBuf);
- CMCHKPK(oduUnpackUInt8, param->sapInst, mBuf);
- CMCHKPK(cmPkDateTime, ¶m->dt, mBuf);
- return ROK;
-}
+ for (i=0; i <= 14; i++) {
+ CMCHKUNPK(cmUnpkRgAckNack, ¶m->dlCqiStat[i], mBuf);
+ }
+
+ for (i=0; i <= 14; i++) {
+ CMCHKUNPK(cmUnpkRgAckNack, ¶m->ulCqiStat[i], mBuf);
+ }
+ return ROK;
+} /* cmUnpkRgSchNackAckStats */
\f
/***********************************************************
*
-* Func : cmUnpkRgSts
+* Func : cmUnpkRgHqNumRetx
*
*
-* Desc : This structure holds MAC's Statistical information.
+* Desc : Harq Retransmission statistics
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgSts
+S16 cmUnpkRgHqNumRetx
(
-RgSts *param,
-S16 elmnt,
+RgSchHqNumRetx *param,
Buffer *mBuf
)
{
- CMCHKUNPK(cmUnpkDateTime, ¶m->dt, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->sapInst, mBuf);
- CMCHKUNPK(cmUnpkAction, ¶m->action, mBuf);
- switch(elmnt) {
- case STGEN:
- CMCHKUNPK(cmUnpkRgGenSts, ¶m->s.genSts, mBuf);
- break;
- case STRGUSAP:
- CMCHKUNPK(cmUnpkRgSapSts, ¶m->s.rguSts, mBuf);
- break;
- case STCRGSAP:
- CMCHKUNPK(cmUnpkRgSapSts, ¶m->s.crgSts, mBuf);
- break;
- case STRGRSAP:
- CMCHKUNPK(cmUnpkRgSapSts, ¶m->s.rgrSts, mBuf);
- break;
- case STTFUSAP:
- CMCHKUNPK(cmUnpkRgSapSts, ¶m->s.tfuSts, mBuf);
- break;
- default :
- break;
- }
- return ROK;
-}
+ CMCHKUNPK(oduPackUInt8, ¶m->mcs, mBuf);
+ CMCHKUNPK(oduPackUInt16, ¶m->numOfHQ_1, mBuf);
+ CMCHKUNPK(oduPackUInt16, ¶m->numOfHQ_2, mBuf);
+ CMCHKUNPK(oduPackUInt16, ¶m->numOfHQ_3, mBuf);
+ CMCHKUNPK(oduPackUInt16, ¶m->numOfHQ_4, mBuf);
+ CMCHKUNPK(oduPackUInt32, ¶m->totalTx, mBuf);
+ return ROK;
+} /* cmUnpkRgHqNumRetx */
\f
/***********************************************************
*
-* Func : cmPkRgSsta
+* Func : cmUnpkRgSchHqRetxStats
*
*
-* Desc : This structure holds MAC's Solicited Status information.
+* Desc :
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgSsta
+S16 cmUnpkRgSchHqRetxStats
(
-Pst *pst,
-RgSsta *param,
-S16 elmnt,
-#ifdef LRG_V1
-uint8_t eventType,
-#endif
+RgSchHqRetxStats *param,
Buffer *mBuf
)
{
+ S32 i;
+
+ for (i=0; i <= 14; i++) {
+ CMCHKUNPK(cmUnpkRgHqNumRetx, ¶m->dlCqiStat[i], mBuf);
+ }
+
+ for (i=0; i <= 14; i++) {
+ CMCHKUNPK(cmUnpkRgHqNumRetx, ¶m->ulCqiStat[i], mBuf);
+ }
- switch(elmnt) {
- case STTFUSAP:
- CMCHKPK(cmPkRgSapSta, ¶m->s.tfuSapSta, mBuf);
- break;
- case STRGRSAP:
- CMCHKPK(cmPkRgSapSta, ¶m->s.rgrSapSta, mBuf);
- break;
- case STCRGSAP:
- CMCHKPK(cmPkRgSapSta, ¶m->s.crgSapSta, mBuf);
- break;
- case STRGUSAP:
- CMCHKPK(cmPkRgSapSta, ¶m->s.rguSapSta, mBuf);
- break;
- /*ccpu00118255 - ADD - Check for eventType before Pack */
- case STGEN:
-#ifdef LRG_V1
- if (eventType == EVTLRGSSTACFM)
- {
- CMCHKPK(cmPkSystemId, ¶m->s.sysId, mBuf);
- if (param->s.sysId.ptNmb != NULLP)
- {
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool,
- (Data *)param->s.sysId.ptNmb, LRG_MAX_PT_NUM_SIZE);
- }
- }
-#else /*LRG_V1 not defined */
- if (param->s.sysId.ptNmb != NULLP)
- {
- CMCHKPK(cmPkSystemId, ¶m->s.sysId, mBuf);
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)param->s.sysId.ptNmb, LRG_MAX_PT_NUM_SIZE);
- }
-
-#endif /*end of LRG_V1 */
- break;
- default :
- break;
- }
- CMCHKPK(oduUnpackUInt8, param->sapInst, mBuf);
- CMCHKPK(cmPkDateTime, ¶m->dt, mBuf);
return ROK;
-}
+} /* cmUnpkRgSchHqRetxStats */
+#endif /* MAC_SCH_STATS */
\f
/***********************************************************
*
-* Func : cmUnpkRgSsta
+* Func : cmPkRgGenSts
*
*
-* Desc : This structure holds MAC's Solicited Status information.
+* Desc : This structure holds General Statistical information of MAC.
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgSsta
+S16 cmPkRgGenSts
(
-Pst *pst,
-RgSsta *param,
-S16 elmnt,
+RgGenSts *param,
Buffer *mBuf
)
{
-
- CMCHKUNPK(cmUnpkDateTime, ¶m->dt, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->sapInst, mBuf);
- switch(elmnt) {
- case STGEN:
- /*ccpu00118255 - ADD - Check for eventType before Unpack */
- if (pst->event == EVTLRGSSTACFM)
- {
- /* After Merging */
- if((SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data **)¶m->s.sysId.ptNmb,
- LRG_MAX_PT_NUM_SIZE)) != ROK){
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ELRG048, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
- /* KWORK_FIX: Moved the memset under the NULL check */
- if (param->s.sysId.ptNmb != NULLP)
- {
- memset(param->s.sysId.ptNmb, 0, LRG_MAX_PT_NUM_SIZE);
- CMCHKUNPK(cmUnpkSystemId, ¶m->s.sysId, mBuf);
- }
- }
- break;
- case STRGUSAP:
- CMCHKUNPK(cmUnpkRgSapSta, ¶m->s.rguSapSta, mBuf);
- break;
- case STCRGSAP:
- CMCHKUNPK(cmUnpkRgSapSta, ¶m->s.crgSapSta, mBuf);
- break;
- case STRGRSAP:
- CMCHKUNPK(cmUnpkRgSapSta, ¶m->s.rgrSapSta, mBuf);
- break;
- case STTFUSAP:
- CMCHKUNPK(cmUnpkRgSapSta, ¶m->s.tfuSapSta, mBuf);
- break;
- default :
- break;
- }
+#ifdef MAC_SCH_STATS
+ CMCHKPK(cmPkRgSchHqRetxStats, ¶m->hqRetxStats, mBuf);
+ CMCHKPK(cmPkRgSchNackAckStats, ¶m->nackAckStats, mBuf);
+#endif /* MAC_SCH_STATS */
+ CMCHKPK(oduUnpackUInt16, param->numCellCfg, mBuf);
+ CMCHKPK(oduUnpackUInt32, param->numUeCfg, mBuf);
+ CMCHKPK(oduUnpackUInt32, param->numHarqFail, mBuf);
return ROK;
}
\f
/***********************************************************
*
-* Func : cmPkRgUstaDgn
+* Func : cmUnpkRgGenSts
*
*
-* Desc : Alarm diagnostics structure.
+* Desc : This structure holds General Statistical information of MAC.
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgUstaDgn
+S16 cmUnpkRgGenSts
(
-RgUstaDgn *param,
+RgGenSts *param,
Buffer *mBuf
)
{
- switch(param->type) {
- case LRG_USTA_DGNVAL_MEM:
- CMCHKPK(cmPkMemoryId, ¶m->u.mem, mBuf);
- break;
- default :
- break;
- }
- CMCHKPK(oduUnpackUInt8, param->type, mBuf);
+ CMCHKUNPK(oduPackUInt32, ¶m->numHarqFail, mBuf);
+ CMCHKUNPK(oduPackUInt32, ¶m->numUeCfg, mBuf);
+ CMCHKUNPK(oduPackUInt16, ¶m->numCellCfg, mBuf);
+#ifdef MAC_SCH_STATS
+ CMCHKUNPK(cmUnpkRgSchNackAckStats, ¶m->nackAckStats, mBuf);
+ CMCHKUNPK(cmUnpkRgSchHqRetxStats, ¶m->hqRetxStats, mBuf);
+#endif /* MAC_SCH_STATS */
return ROK;
}
\f
/***********************************************************
*
-* Func : cmUnpkRgUstaDgn
+* Func : cmPkRgSapSts
*
*
-* Desc : Alarm diagnostics structure.
+* Desc : This structure holds Statistical information of a SAP in MAC.
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgUstaDgn
+S16 cmPkRgSapSts
(
-RgUstaDgn *param,
+RgSapSts *param,
Buffer *mBuf
)
{
+ CMCHKPK(oduUnpackUInt32, param->numPduDrop, mBuf);
+ CMCHKPK(oduUnpackUInt32, param->numPduTxmit, mBuf);
+ CMCHKPK(oduUnpackUInt32, param->numPduRcvd, mBuf);
+ return ROK;
+}
+
- CMCHKUNPK(oduPackUInt8, ¶m->type, mBuf);
- switch(param->type)
- {
- case LRG_USTA_DGNVAL_MEM:
- CMCHKUNPK(cmUnpkMemoryId, ¶m->u.mem, mBuf);
- break;
- default :
- break;
- }
+\f
+/***********************************************************
+*
+* Func : cmUnpkRgSapSts
+*
+*
+* Desc : This structure holds Statistical information of a SAP in MAC.
+*
+*
+* Ret : S16
+*
+* Notes:
+*
+* File :
+*
+**********************************************************/
+S16 cmUnpkRgSapSts
+(
+RgSapSts *param,
+Buffer *mBuf
+)
+{
+
+ CMCHKUNPK(oduPackUInt32, ¶m->numPduRcvd, mBuf);
+ CMCHKUNPK(oduPackUInt32, ¶m->numPduTxmit, mBuf);
+ CMCHKUNPK(oduPackUInt32, ¶m->numPduDrop, mBuf);
return ROK;
}
\f
/***********************************************************
*
-* Func : cmPkRgUsta
+* Func : cmPkRgSchInstCfg
*
*
-* Desc : This structure holds MAC's Unsolicited Status information.
+* Desc : Scheduler Configuration
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgUsta
+S16 cmPkRgSchInstCfg
(
-RgUsta *param,
+RgSchInstCfg *param,
Buffer *mBuf
)
{
- CMCHKPK(cmPkRgUstaDgn, ¶m->dgn, mBuf);
- CMCHKPK(cmPkCmAlarm, ¶m->cmAlarm, mBuf);
+ S32 i;
+
+ for (i=param->numSaps-1; i >= 0; i--) {
+ CMCHKPK(cmPkRgLowSapCfg, ¶m->tfuSap[i], mBuf);
+ }
+ for (i=param->numSaps-1; i >= 0; i--) {
+ CMCHKPK(cmPkRgUpSapCfg, ¶m->rgrSap[i], mBuf);
+ }
+ for (i=param->numSaps-1; i >= 0; i--) {
+ CMCHKPK(cmPkRgUpSapCfg, ¶m->rgmSap[i], mBuf);
+ }
+ CMCHKPK(oduUnpackUInt8, param->numSaps, mBuf);
+ CMCHKPK(cmPkRgGenCfg, ¶m->genCfg, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->instId, mBuf);
return ROK;
}
\f
/***********************************************************
*
-* Func : cmUnpkRgUsta
+* Func : cmUnpkRgSchInstCfg
*
*
-* Desc : This structure holds MAC's Unsolicited Status information.
+* Desc : Scheduler Configuration
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgUsta
+S16 cmUnpkRgSchInstCfg
(
-RgUsta *param,
+RgSchInstCfg *param,
Buffer *mBuf
)
{
- CMCHKUNPK(cmUnpkCmAlarm, ¶m->cmAlarm, mBuf);
- CMCHKUNPK(cmUnpkRgUstaDgn, ¶m->dgn, mBuf);
+ S32 i;
+
+ CMCHKUNPK(oduPackUInt8, ¶m->instId, mBuf);
+ CMCHKUNPK(cmUnpkRgGenCfg, ¶m->genCfg, mBuf);
+ CMCHKUNPK(oduPackUInt8, ¶m->numSaps, mBuf);
+ for (i=0; i<param->numSaps; i++) {
+ CMCHKUNPK(cmUnpkRgUpSapCfg, ¶m->rgmSap[i], mBuf);
+ }
+ for (i=0; i<param->numSaps; i++) {
+ CMCHKUNPK(cmUnpkRgUpSapCfg, ¶m->rgrSap[i], mBuf);
+ }
+ for (i=0; i<param->numSaps; i++) {
+ CMCHKUNPK(cmUnpkRgLowSapCfg, ¶m->tfuSap[i], mBuf);
+ }
return ROK;
}
\f
/***********************************************************
*
-* Func : cmPkRgTrc
+* Func : cmPkRgCfg
*
*
-* Desc : This structure holds MAC's Trace Indication information.
+* Desc : This structure holds Configuration parameters for MAC.
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgTrc
+S16 cmPkRgCfg
(
-RgTrc *param,
+RgCfg *param,
+S16 elmnt,
Buffer *mBuf
)
{
- CMCHKPK(oduUnpackUInt8, param->evnt, mBuf);
- CMCHKPK(cmPkDateTime, ¶m->dt, mBuf);
+ switch(elmnt) {
+ case STSCHINST:
+ CMCHKPK(cmPkRgSchInstCfg, ¶m->s.schInstCfg, mBuf);
+ break;
+ case STTFUSAP:
+ CMCHKPK(cmPkRgLowSapCfg, ¶m->s.tfuSap, mBuf);
+ break;
+ case STCRGSAP:
+ CMCHKPK(cmPkRgUpSapCfg, ¶m->s.crgSap, mBuf);
+ break;
+ case STRGUSAP:
+ CMCHKPK(cmPkRgUpSapCfg, ¶m->s.rguSap, mBuf);
+ break;
+ case STGEN:
+ CMCHKPK(cmPkRgGenCfg, ¶m->s.genCfg, mBuf);
+ break;
+ default :
+ return RFAILED;
+ }
return ROK;
}
\f
/***********************************************************
*
-* Func : cmUnpkRgTrc
+* Func : cmUnpkRgCfg
*
*
-* Desc : This structure holds MAC's Trace Indication information.
+* Desc : This structure holds Configuration parameters for MAC.
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgTrc
+S16 cmUnpkRgCfg
(
-RgTrc *param,
+RgCfg *param,
+S16 elmnt,
Buffer *mBuf
)
{
- CMCHKUNPK(cmUnpkDateTime, ¶m->dt, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->evnt, mBuf);
+ switch(elmnt) {
+ case STGEN:
+ CMCHKUNPK(cmUnpkRgGenCfg, ¶m->s.genCfg, mBuf);
+ break;
+ case STRGUSAP:
+ CMCHKUNPK(cmUnpkRgUpSapCfg, ¶m->s.rguSap, mBuf);
+ break;
+ case STCRGSAP:
+ CMCHKUNPK(cmUnpkRgUpSapCfg, ¶m->s.crgSap, mBuf);
+ break;
+ case STTFUSAP:
+ CMCHKUNPK(cmUnpkRgLowSapCfg, ¶m->s.tfuSap, mBuf);
+ break;
+ case STSCHINST:
+ CMCHKUNPK(cmUnpkRgSchInstCfg, ¶m->s.schInstCfg, mBuf);
+ break;
+ default :
+ return RFAILED;
+ }
return ROK;
}
\f
/***********************************************************
*
-* Func : cmPkRgDbgCntrl
+* Func : cmPkRgSapSta
*
*
-* Desc : This structure holds MAC's Debug Control information.
+* Desc : This structure holds a SAP's status information.
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgDbgCntrl
+S16 cmPkRgSapSta
(
-RgDbgCntrl *param,
+RgSapSta *param,
Buffer *mBuf
)
{
- CMCHKPK(oduUnpackUInt32, param->dbgMask, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->sapState, mBuf);
return ROK;
}
-#ifdef PHY_ERROR_LOGING
+
+\f
/***********************************************************
*
-* Func : cmPkRgSchUlAllocCntrl
+* Func : cmUnpkRgSapSta
*
*
-* Desc : This structure holds MAC's Debug Control information.
+* Desc : This structure holds a SAP's status information.
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgSchUlAllocCntrl
+S16 cmUnpkRgSapSta
(
-RgSchUlAllocCntrl *param,
+RgSapSta *param,
Buffer *mBuf
)
{
- CMCHKPK(oduUnpackUInt8, param->mcs, mBuf);
- CMCHKPK(oduUnpackUInt16, param->numOfRb, mBuf);
- CMCHKPK(oduUnpackUInt16, param->rbStart, mBuf);
- CMCHKPK(oduUnpackUInt8, param->testStart, mBuf);
- CMCHKPK(oduUnpackUInt8, param->enaLog, mBuf);
- CMCHKPK(oduUnpackUInt16, param->logTime, mBuf);
-
+ CMCHKUNPK(oduPackUInt8, ¶m->sapState, mBuf);
return ROK;
}
+
+\f
/***********************************************************
*
-* Func : cmUnpkRgSchUlAllocCntrl
+* Func : cmPkRgSts
*
*
-* Desc : This structure holds MAC's Scheduler Configuration for Ul Allocation.
+* Desc : This structure holds MAC's Statistical information.
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgSchUlAllocCntrl
+S16 cmPkRgSts
(
-RgSchUlAllocCntrl *param,
+RgSts *param,
+S16 elmnt,
Buffer *mBuf
)
{
- CMCHKUNPK(oduPackUInt16, ¶m->logTime, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->enaLog, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->testStart, mBuf);
- CMCHKUNPK(oduPackUInt16, ¶m->rbStart, mBuf);
- CMCHKUNPK(oduPackUInt16, ¶m->numOfRb, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->mcs, mBuf);
-
+ switch(elmnt) {
+ case STTFUSAP:
+ CMCHKPK(cmPkRgSapSts, ¶m->s.tfuSts, mBuf);
+ break;
+ case STRGRSAP:
+ CMCHKPK(cmPkRgSapSts, ¶m->s.rgrSts, mBuf);
+ break;
+ case STCRGSAP:
+ CMCHKPK(cmPkRgSapSts, ¶m->s.crgSts, mBuf);
+ break;
+ case STRGUSAP:
+ CMCHKPK(cmPkRgSapSts, ¶m->s.rguSts, mBuf);
+ break;
+ case STGEN:
+ CMCHKPK(cmPkRgGenSts, ¶m->s.genSts, mBuf);
+ break;
+ default :
+ break;
+ }
+ CMCHKPK(cmPkAction, param->action, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->sapInst, mBuf);
+ CMCHKPK(cmPkDateTime, ¶m->dt, mBuf);
return ROK;
}
-#endif
\f
/***********************************************************
*
-* Func : cmUnpkRgDbgCntrl
+* Func : cmUnpkRgSts
*
*
-* Desc : This structure holds MAC's Debug Control information.
+* Desc : This structure holds MAC's Statistical information.
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgDbgCntrl
+S16 cmUnpkRgSts
(
-RgDbgCntrl *param,
+RgSts *param,
+S16 elmnt,
Buffer *mBuf
)
{
- CMCHKUNPK(oduPackUInt32, ¶m->dbgMask, mBuf);
+ CMCHKUNPK(cmUnpkDateTime, ¶m->dt, mBuf);
+ CMCHKUNPK(oduPackUInt8, ¶m->sapInst, mBuf);
+ CMCHKUNPK(cmUnpkAction, ¶m->action, mBuf);
+ switch(elmnt) {
+ case STGEN:
+ CMCHKUNPK(cmUnpkRgGenSts, ¶m->s.genSts, mBuf);
+ break;
+ case STRGUSAP:
+ CMCHKUNPK(cmUnpkRgSapSts, ¶m->s.rguSts, mBuf);
+ break;
+ case STCRGSAP:
+ CMCHKUNPK(cmUnpkRgSapSts, ¶m->s.crgSts, mBuf);
+ break;
+ case STRGRSAP:
+ CMCHKUNPK(cmUnpkRgSapSts, ¶m->s.rgrSts, mBuf);
+ break;
+ case STTFUSAP:
+ CMCHKUNPK(cmUnpkRgSapSts, ¶m->s.tfuSts, mBuf);
+ break;
+ default :
+ break;
+ }
return ROK;
}
-
\f
/***********************************************************
*
-* Func : cmPkRgSapCntrl
+* Func : cmPkRgUstaDgn
*
*
-* Desc : This structure holds MAC's SAP Control information.
+* Desc : Alarm diagnostics structure.
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgSapCntrl
+S16 cmPkRgUstaDgn
(
-RgSapCntrl *param,
+RgUstaDgn *param,
Buffer *mBuf
)
{
- CMCHKPK(SPkS16, param->spId, mBuf);
- CMCHKPK(SPkS16, param->suId, mBuf);
+ switch(param->type) {
+ case LRG_USTA_DGNVAL_MEM:
+ CMCHKPK(cmPkMemoryId, ¶m->u.mem, mBuf);
+ break;
+ default :
+ break;
+ }
+ CMCHKPK(oduUnpackUInt8, param->type, mBuf);
return ROK;
}
\f
/***********************************************************
*
-* Func : cmUnpkRgSapCntrl
+* Func : cmUnpkRgUstaDgn
*
*
-* Desc : This structure holds MAC's SAP Control information.
+* Desc : Alarm diagnostics structure.
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgSapCntrl
+S16 cmUnpkRgUstaDgn
(
-RgSapCntrl *param,
+RgUstaDgn *param,
Buffer *mBuf
)
{
- CMCHKUNPK(SUnpkS16, ¶m->suId, mBuf);
- CMCHKUNPK(SUnpkS16, ¶m->spId, mBuf);
+
+ CMCHKUNPK(oduPackUInt8, ¶m->type, mBuf);
+ switch(param->type)
+ {
+ case LRG_USTA_DGNVAL_MEM:
+ CMCHKUNPK(cmUnpkMemoryId, ¶m->u.mem, mBuf);
+ break;
+ default :
+ break;
+ }
return ROK;
}
\f
/***********************************************************
*
-* Func : cmPkRgCntrl
+* Func : cmPkRgUsta
*
*
-* Desc : This structure holds MAC's Control information.
+* Desc : This structure holds MAC's Unsolicited Status information.
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgCntrl
+S16 cmPkRgUsta
(
-RgCntrl *param,
-S16 elmnt,
+RgUsta *param,
Buffer *mBuf
)
{
-
- switch(elmnt) {
- case STTFUSAP:
- case STRGUSAP:
- case STRGRSAP:
- case STCRGSAP:
- switch(param->subAction) {
- default :
- CMCHKPK(cmPkRgSapCntrl, ¶m->s.rgSapCntrl, mBuf);
- break;
- }
- break;
- case STGEN:
- switch(param->subAction) {
- case SATRC:
- CMCHKPK(SPkS16, param->s.trcLen, mBuf);
- break;
- case SADBG:
- CMCHKPK(cmPkRgDbgCntrl, ¶m->s.rgDbgCntrl, mBuf);
- break;
- case SAUSTA:
- break;
-#ifdef SS_DIAG
- case SALOG:
- CMCHKPK(oduUnpackUInt32, param->s.logMask, mBuf);
- break;
-#endif
-#ifdef PHY_ERROR_LOGING
- case SAELMNT:
- CMCHKPK(cmPkRgSchUlAllocCntrl, ¶m->s.rgSchUlAllocCntrl, mBuf);
- break;
-#endif
- default :
- break;
- }
- break;
- default :
- break;
- }
- CMCHKPK(oduUnpackUInt8, param->subAction, mBuf);
- CMCHKPK(oduUnpackUInt8, param->action, mBuf);
- CMCHKPK(cmPkDateTime, ¶m->dt, mBuf);
+ CMCHKPK(cmPkRgUstaDgn, ¶m->dgn, mBuf);
+ CMCHKPK(cmPkCmAlarm, ¶m->cmAlarm, mBuf);
return ROK;
}
\f
/***********************************************************
*
-* Func : cmUnpkRgCntrl
+* Func : cmUnpkRgUsta
*
*
-* Desc : This structure holds MAC's Control information.
+* Desc : This structure holds MAC's Unsolicited Status information.
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgCntrl
+S16 cmUnpkRgUsta
(
-RgCntrl *param,
-S16 elmnt,
+RgUsta *param,
Buffer *mBuf
)
{
-
- CMCHKUNPK(cmUnpkDateTime, ¶m->dt, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->action, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->subAction, mBuf);
- switch(elmnt) {
- case STGEN:
- switch(param->subAction) {
- case SADBG:
- CMCHKUNPK(cmUnpkRgDbgCntrl, ¶m->s.rgDbgCntrl, mBuf);
- break;
- case SATRC:
- CMCHKUNPK(SUnpkS16, ¶m->s.trcLen, mBuf);
- break;
- case SAUSTA:
- break;
-#ifdef SS_DIAG
- case SALOG:
- CMCHKUNPK(oduPackUInt32, ¶m->s.logMask, mBuf);
- break;
-#endif
-#ifdef PHY_ERROR_LOGING
- case SAELMNT:
- CMCHKUNPK(cmUnpkRgSchUlAllocCntrl, ¶m->s.rgSchUlAllocCntrl, mBuf);
- break;
-#endif
- default :
- break;
- }
- break;
- case STTFUSAP:
- case STRGUSAP:
- case STRGRSAP:
- case STCRGSAP:
- switch(param->subAction) {
- default :
- CMCHKUNPK(cmUnpkRgSapCntrl, ¶m->s.rgSapCntrl, mBuf);
- break;
- }
- break;
- default :
- break;
- }
+ CMCHKUNPK(cmUnpkCmAlarm, ¶m->cmAlarm, mBuf);
+ CMCHKUNPK(cmUnpkRgUstaDgn, ¶m->dgn, mBuf);
return ROK;
}
-
\f
/***********************************************************
*
switch(eventType) {
- case EVTLRGCNTRLREQ:
- case EVTLRGCNTRLCFM:
- case EVTLRGSCHCNTRLREQ:
- case EVTLRGSCHCNTRLCFM:
- if(cmPkRgCntrl(¶m->t.cntrl, param->hdr.elmId.elmnt, mBuf) != ROK)
- return RFAILED;
- break;
- case EVTLRGTRCIND:
- CMCHKPK(cmPkRgTrc, ¶m->t.trc, mBuf);
- break;
case EVTLRGUSTAIND:
case EVTLRGSCHSTAIND:
CMCHKPK(cmPkRgUsta, ¶m->t.usta, mBuf);
break;
- case EVTLRGSSTAREQ:
- case EVTLRGSSTACFM:
- /*ccpu00118255 - ADD - eventType param */
-#ifdef LRG_V1
- if(cmPkRgSsta(pst, ¶m->t.ssta, param->hdr.elmId.elmnt,
- eventType, mBuf) != ROK)
- return RFAILED;
-#else /* LRG_V1 is not defined */
- if(cmPkRgSsta(pst, ¶m->t.ssta, param->hdr.elmId.elmnt, mBuf) != ROK)
- return RFAILED;
-#endif /* end of LRG_V1*/
- break;
case EVTLRGSTSREQ:
case EVTLRGSTSCFM:
if(cmPkRgSts(¶m->t.sts, param->hdr.elmId.elmnt, mBuf)!= ROK)
if(cmUnpkRgSts(¶m->t.sts, param->hdr.elmId.elmnt, mBuf) != ROK)
return RFAILED;
break;
- case EVTLRGSSTAREQ:
- case EVTLRGSSTACFM:
- if(cmUnpkRgSsta(pst, ¶m->t.ssta, param->hdr.elmId.elmnt, mBuf) != ROK)
- return RFAILED;
- break;
case EVTLRGUSTAIND:
case EVTLRGSCHSTAIND:
CMCHKUNPK(cmUnpkRgUsta, ¶m->t.usta, mBuf);
break;
- case EVTLRGTRCIND:
- CMCHKUNPK(cmUnpkRgTrc, ¶m->t.trc, mBuf);
- break;
- case EVTLRGCNTRLREQ:
- case EVTLRGCNTRLCFM:
- case EVTLRGSCHCNTRLREQ:
- case EVTLRGSCHCNTRLCFM:
- if(cmUnpkRgCntrl(¶m->t.cntrl, param->hdr.elmId.elmnt, mBuf) != ROK)
- return RFAILED;
- break;
default :
return RFAILED;
}
#define EVTLRGCFGREQ 0 /* Config Request */
#define EVTLRGCFGCFM 1 /* Config Confirm */
-#define EVTLRGCNTRLREQ 2 /* Control Request */
-#define EVTLRGCNTRLCFM 3 /* Control Confirm */
#define EVTLRGSTSREQ 44 /* Statistics Request */
#define EVTLRGSTSCFM 5 /* Statistics Confirm */
-#define EVTLRGSSTAREQ 6 /* Solicited Status Request */
-#define EVTLRGSSTACFM 7 /* Solicited Status Confirm */
#define EVTLRGUSTAIND 8 /* Unsolicite Status Indication */
-#define EVTLRGTRCIND 9 /* Trace Indication */
#define EVTMACSCHGENCFGREQ 10 /* Scheduler Configuration */
#define EVTMACSCHGENCFGCFM 11 /* Scheduler Config Confirm */
#define EVTLRGSCHSTAIND 12 /* Scheduler Configuration */
-#define EVTLRGSCHCNTRLREQ 13 /* Scheduler Configuration */
-#define EVTLRGSCHCNTRLCFM 14 /* Scheduler Config Confirm */
#define EVTLRGSCHUSTAIND 15 /* Unsolicite Status Indication */
/* lrg_h_001.main_3 - ADD - Event definitions for LTE_L2_MEAS */
#ifdef LTE_L2_MEAS
RgMngmt *sts /* Management Structure */
));
-typedef S16 (*LrgTrcInd) ARGS((
- Pst *pst, /* Post Structure */
- RgMngmt *trc, /* Management Structure */
- Buffer *mBuf /* Message Buffer */
- ));
-
/* lrg_x_001.main_3 - ADD - Data structures for LTE_L2_MEAS */
#ifdef LTE_L2_MEAS
typedef S16 (*LrgSchL2MeasCfm) ARGS((
*/
S16 RgMiLrgStsCfm ARGS((Pst *pst, RgMngmt *cfm));
- /** @brief This primitive carries the Status request
- * sent from the layer manager to MAC.
- * @details This primitive is used by the layer manager to request
- * status from the MAC layer.
- * @param pst Pointer to the post structure.
- * @param cfm pointer to RgMngmt
- * @return ROK/RFAILED
- */
-S16 RgMiLrgStaReq ARGS((Pst *pst, RgMngmt *sta));
-
- /** @brief This primitive carries the Confirmation for a Status Request
- * sent from the layer manager to MAC.
- * @details This primitive is used by MAC to send a response for the status
- * Request sent by the layer manager.
- * @param pst Pointer to the post structure.
- * @param cfm pointer to RgMngmt
- * @return ROK/RFAILED
- */
-S16 RgMiLrgStaCfm ARGS((Pst *pst, RgMngmt *cfm));
-
/** @brief This primitive carries the Unsolicited status indications from MAC
* to the layer manager i.e. Alarms.
* @details This primitive is used by MAC to inform Layer manager about some
*/
S16 RgMiLrgSchStaInd ARGS((Pst *pst, RgMngmt *usta));
- /** @brief This primitive carries the control request sent from the layer
- * manager to MAC layer.
- * @details This primitive is sent from the layer manager to control the MAC
- * layer. The following entities could be controlled using this primitive.
- * -# Debug printing
- * -# TRACE functionality
- * -# Binding of lower SAPs
- * @param pst Pointer to the post structure.
- * @param cfm pointer to RgMngmt
- * @return ROK/RFAILED
- */
-S16 RgMiLrgCntrlReq ARGS((Pst *pst, RgMngmt *cntrl));
- /** @brief This primitive carries the Confirmation for a Control Request
- * sent from the layer manager to MAC.
- * @details This primitive is used by MAC to inform Layer manager about the
- * status of a Control Request.
- * @param pst Pointer to the post structure.
- * @param cfm pointer to RgMngmt
- * @return ROK/RFAILED
- */
-S16 RgMiLrgCntrlCfm ARGS(( Pst *pst, RgMngmt *cfm));
- /** @brief This primitive carries the control request sent from the layer
- * manager to MAC layer.
- * @details This primitive is sent from the layer manager to control the MAC
- * layer. The following entities could be controlled using this primitive.
- * -# Debug printing
- * -# TRACE functionality
- * -# Binding of lower SAPs
- * @param pst Pointer to the post structure.
- * @param cfm pointer to RgMngmt
- * @return ROK/RFAILED
- */
-S16 RgMiLrgSchCntrlReq ARGS((Pst *pst, RgMngmt *cntrl));
- /** @brief This primitive carries the Confirmation for a Control Request
- * sent from the layer manager to MAC.
- * @details This primitive is used by MAC to inform Layer manager about the
- * status of a Control Request.
- * @param pst Pointer to the post structure.
- * @param cfm pointer to RgMngmt
- * @return ROK/RFAILED
- */
-S16 RgMiLrgSchCntrlCfm ARGS(( Pst *pst, RgMngmt *cfm));
- /** @brief This primitive carries the a copy of the received buffer from MAC to
- * the layer manager. This is called the Tracing functionality of the layer.
- * @details This primitive is used by MAC to send a copy of the received buffer
- * to the layer manager, if Tracing is enabled via a control request.
- * @param pst Pointer to the post structure.
- * @param trc pointer to RgMngmt
- * @param mBuf pointer to Buffer contains the portion of the received message.
- * @return ROK/RFAILED
- */
-S16 RgMiLrgTrcInd ARGS((Pst *pst, RgMngmt *trc, Buffer *mBuf));
#ifdef LTE_L2_MEAS
/** @brief This primitive is to enable L2 (layer 2) measurements at the MAC
* layer.
S16 SmMiLrgStsReq ARGS((Pst *pst, RgMngmt *sts));
S16 SmMiLrgStsCfm ARGS((Pst *pst, RgMngmt *cfm));
S16 SmMiLrgStaReq ARGS((Pst *pst, RgMngmt *sta));
-S16 SmMiLrgStaCfm ARGS((Pst *pst, RgMngmt *cfm));
S16 SmMiLrgStaInd ARGS((Pst *pst, RgMngmt *usta));
S16 SmMiLrgCntrlReq ARGS((Pst *pst, RgMngmt *cntrl));
S16 SmMiLrgSchStaInd ARGS((Pst *pst, RgMngmt *usta));
S16 SmMiLrgCntrlCfm ARGS(( Pst *pst, RgMngmt *cfm));
S16 SmMiLrgSchCntrlReq ARGS((Pst *pst, RgMngmt *cntrl));
-S16 SmMiLrgSchCntrlCfm ARGS(( Pst *pst, RgMngmt *cfm));
-S16 SmMiLrgTrcInd ARGS((Pst *pst, RgMngmt *trc, Buffer *mBuf));
/* lrg_x_001.main_3 - ADD - Added the following functions for LTE_L2_MEAS */
#ifdef LTE_L2_MEAS
S16 SmMiLrgSchL2MeasStartReq ARGS((Pst *pst, LrgSchMeasReqInfo *schL2MeasReq));
Buffer *mBuf
));
/** @brief This API is used to send a
-Status Request from LM to MAC. */
-S16 cmPkLrgStaReq ARGS((
- Pst * pst,
- RgMngmt * sta
-));
-/** @brief This API is used to send a
-Status Request from LM to MAC. */
-S16 cmUnpkLrgStaReq ARGS((
- LrgStaReq func,
- Pst * pst,
- Buffer *mBuf
-));
-/** @brief This API is used to send a
-Status Confirm from MAC to LM. */
-S16 cmPkLrgStaCfm ARGS((
- Pst * pst,
- RgMngmt * cfm
-));
-/** @brief This API is used to send a
-Status Confirm from MAC to LM. */
-S16 cmUnpkLrgStaCfm ARGS((
- LrgStaCfm func,
- Pst * pst,
- Buffer *mBuf
-));
-/** @brief This API is used to send a
Status Indication from MAC to LM. */
S16 cmPkLrgStaInd ARGS((
Pst * pst,
Pst * pst,
Buffer *mBuf
));
-/** @brief This API is used to send a
-Control Request from LM to MAC. */
-S16 cmPkLrgCntrlReq ARGS((
- Pst * pst,
- RgMngmt * cntrl
-));
-/** @brief This API is used to send a
-Control Request from LM to MAC. */
-S16 cmUnpkLrgCntrlReq ARGS((
- LrgCntrlReq func,
- Pst * pst,
- Buffer *mBuf
-));
-/** @brief This API is used to send a
-Control Request from LM to SCH. */
-S16 cmPkLrgSchCntrlReq ARGS((
- Pst * pst,
- RgMngmt * cntrl
-));
-/** @brief This API is used to send a
-Control Request from LM to SCH. */
-S16 cmUnpkLrgSchCntrlReq ARGS((
- LrgSchCntrlReq func,
- Pst * pst,
- Buffer *mBuf
-));
-/** @brief This API is used to send a
-Control Confirm from MAC to LM.*/
-S16 cmPkLrgCntrlCfm ARGS((
- Pst * pst,
- RgMngmt * cfm
-));
-/** @brief This API is used to send a
-Control Confirm from MAC to LM. */
-S16 cmUnpkLrgCntrlCfm ARGS((
- LrgCntrlCfm func,
- Pst * pst,
- Buffer *mBuf
-));
-/** @brief This API is used to send a
-Control Confirm from SCH to LM. */
-S16 cmPkLrgSchCntrlCfm ARGS((
- Pst * pst,
- RgMngmt * cntrl
-));
-/** @brief This API is used to send a
-Control Confirm from SCH to LM. */
-S16 cmUnpkLrgSchCntrlCfm ARGS((
- LrgSchCntrlCfm func,
- Pst * pst,
- Buffer *mBuf
-));
-/** @brief This API is used to send a
-Trace Indication from MAC to LM. */
-S16 cmPkLrgTrcInd ARGS((
- Pst * pst,
- RgMngmt * trc,
- Buffer * trcBuf
-));
-/** @brief This API is used to send a
-Trace Indication from MAC to LM. */
-S16 cmUnpkLrgTrcInd ARGS((
- LrgTrcInd func,
- Pst * pst,
- Buffer *mBuf
-));
S16 cmPkRgGenCfg ARGS((
RgGenCfg *param,
Buffer *mBuf
Buffer *mBuf
));
/* lrg_x_001.main_3 - MODIFY - Modified the below function to hold the event type */
-#ifdef LRG_V1
-S16 cmPkRgSsta ARGS((
- Pst *pst,
- RgSsta *param,
- S16 elmnt,
- /*ccpu00118255 - ADD - eventType param */
- uint8_t eventType,
- Buffer *mBuf
-));
-#else /*LRG_V1 not defined */
-S16 cmPkRgSsta ARGS((
- Pst *pst,
- RgSsta *param,
- S16 elmnt,
- Buffer *mBuf
-));
-#endif /* LRG_V1 endif */
-S16 cmUnpkRgSsta ARGS((
- Pst *pst,
- RgSsta *param,
- S16 elmnt,
- Buffer *mBuf
-));
S16 cmPkRgUstaDgn ARGS((
RgUstaDgn *param,
Buffer *mBuf
RgUsta *param,
Buffer *mBuf
));
-S16 cmPkRgTrc ARGS((
- RgTrc *param,
- Buffer *mBuf
-));
-S16 cmUnpkRgTrc ARGS((
- RgTrc *param,
- Buffer *mBuf
-));
-S16 cmPkRgDbgCntrl ARGS((
- RgDbgCntrl *param,
- Buffer *mBuf
-));
-S16 cmUnpkRgDbgCntrl ARGS((
- RgDbgCntrl *param,
- Buffer *mBuf
-));
-S16 cmPkRgSapCntrl ARGS((
- RgSapCntrl *param,
- Buffer *mBuf
-));
-S16 cmUnpkRgSapCntrl ARGS((
- RgSapCntrl *param,
- Buffer *mBuf
-));
-S16 cmPkRgCntrl ARGS((
- RgCntrl *param,
- S16 elmnt,
- Buffer *mBuf
-));
-S16 cmUnpkRgCntrl ARGS((
- RgCntrl *param,
- S16 elmnt,
- Buffer *mBuf
-));
S16 cmPkRgMngmt ARGS((
Pst *pst,
RgMngmt *param,
Buffer *mBuf
));
-#ifdef PHY_ERROR_LOGING
-S16 cmPkRgSchUlAllocCntrl ARGS((
- RgSchUlAllocCntrl *param,
- Buffer *mBuf
-));
-
-S16 cmUnpkRgSchUlAllocCntrl ARGS((
- RgSchUlAllocCntrl *param,
- Buffer *mBuf
-));
-#endif
/* lrg_x_001.main_4 ccpu00117036 - C++ support */
#ifdef __cplusplus
}
/* header/extern include files (.x) */
#include "rgm.x" /* RGM Interface includes */
-#ifdef RGM_LWLC
-
-\f
-/**
-* @brief Request from RRM to MAC to bind the interface saps
-*
-* @details
-*
-* Function : cmPkLwLcRgmBndReq
-*
-* @param[in] Pst* pst
-* @param[in] SuId suId
-* @param[in] SpId spId
-* @return S16
-* -# ROK
-**/
-S16 cmPkLwLcRgmBndReq
-(
-Pst* pst,
-SuId suId,
-SpId spId
-)
-{
- Buffer *mBuf = NULLP;
-
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
- {
- return RFAILED;
- }
-
- if (SPkS16(spId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- if (SPkS16(suId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTRGMBNDREQ;
- return (SPstTsk(pst,mBuf));
-}
-
-\f
-/**
-* @brief Request from RRM to MAC to bind the interface saps
-*
-* @details
-*
-* Function : cmUnpkLwLcRgmBndReq
-*
-* @param[in] Pst* pst
-* @param[in] SuId suId
-* @param[in] SpId spId
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkLwLcRgmBndReq
-(
-RgmBndReq func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- SuId suId;
- SpId spId;
- S16 ret;
-
-
- if (SUnpkS16(&suId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- if (SUnpkS16(&spId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- ret = ((*func)(pst, suId, spId));
-
- SPutMsg(mBuf);
-
- return (ret);
-}
-
-/**
-* @brief Request from RRM to MAC to Unbind the interface saps
-*
-* @details
-*
-* Function : cmPkLwLcRgmUbndReq
-*
-* @param[in] Pst* pst
-* @param[in] SpId spId
-* @param[in] Reason reason
-* @return S16
-* -# ROK
-**/
-S16 cmPkLwLcRgmUbndReq
-(
-Pst* pst,
-SpId spId,
-Reason reason
-)
-{
- Buffer *mBuf = NULLP;
-
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
- {
- return RFAILED;
- }
- if (SPkS16(reason, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
- if (SPkS16(spId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTRGMUBNDREQ;
- return (SPstTsk(pst,mBuf));
-}
-
-/**
-* @brief Confirmation from MAC to RRM for the bind/Unbind
- * request for the interface saps
-*
-* @details
-*
-* Function : cmPkLwLcRgmBndCfm
-*
-* @param[in] Pst* pst
-* @param[in] SuId suId
-* @param[in] uint8_t status
-* @return S16
-* -# ROK
-**/
-S16 cmPkLwLcRgmBndCfm
-(
-Pst* pst,
-SuId suId,
-uint8_t status
-)
-{
- Buffer *mBuf = NULLP;
-
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
- {
- return RFAILED;
- }
-
- if (SPkS16(suId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- if (oduUnpackUInt8(status, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTRGMBNDCFM;
- return (SPstTsk(pst,mBuf));
-}
-
-\f
-/**
-* @brief Confirmation from MAC to RRM for the bind/Unbind
- * request for the interface saps
-*
-* @details
-*
-* Function : cmUnpkLwLcRgmBndCfm
-*
-* @param[in] Pst* pst
-* @param[in] SuId suId
-* @param[in] uint8_t status
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkLwLcRgmBndCfm
-(
-RgmBndCfm func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- SuId suId;
- uint8_t status;
-
-
- if (oduPackUInt8(&status, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- if (SUnpkS16(&suId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
- SPutMsg(mBuf);
- return ((*func)(pst, suId, status));
-}
-
-\f
-/**
-* @brief Configure the PRB Report Preparation Start/Stop from RRM to MAC
-*
-* @details
-*
-* Function : cmPkLwLcRgmCfgPrbRprt
-*
-* @param[in] Pst* pst
-* @param[in] SpId spId
-* @param[in] RgmPrbRprtCfg * prbRprtCfg
-* @return S16
-* -# ROK
-**/
-S16 cmPkLwLcRgmCfgPrbRprt
-(
-Pst* pst,
-SpId spId,
-RgmPrbRprtCfg * prbRprtCfg
-)
-{
- Buffer *mBuf = NULLP;
- uint32_t len = sizeof(RgmPrbRprtCfg);
-
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
- {
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)prbRprtCfg, sizeof(RgmPrbRprtCfg));
- return RFAILED;
- }
-
- if(oduPackPointer((PTR)prbRprtCfg, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data*)prbRprtCfg, len);
- return RFAILED;
- }
-
- if (SPkS16(spId, mBuf) != ROK)
- {
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)prbRprtCfg, sizeof(RgmPrbRprtCfg));
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTRGMCFGPRBRPRT;
- return (SPstTsk(pst,mBuf));
-}
-
-\f
-/**
-* @brief Configure the PRB Report Preparation Start/Stop from RRM to MAC
-*
-* @details
-*
-* Function : cmUnpkLwLcRgmCfgPrbRprt
-*
-* @param[in] Pst* pst
-* @param[in] SpId spId
-* @param[in] RgmPrbRprtCfg * prbRprtCfg
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkLwLcRgmCfgPrbRprt
-(
-RgmCfgPrbRprtFptr func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- S16 ret;
- SpId spId;
- RgmPrbRprtCfg *prbRprtCfg;
-
-
- if (SUnpkS16(&spId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- if (oduUnpackPointer((PTR *)&prbRprtCfg, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)prbRprtCfg, sizeof(RgmPrbRprtCfg));
- return RFAILED;
- }
-
- ret = ((*func)(pst, spId, prbRprtCfg));
-
- SPutMsg(mBuf);
- return (ret);
-}
-
-
-/**
-* @brief PRB Usage Report Indication from MAC to RRM
-*
-* @details
-*
-* Function : cmPkLwLcRgmPrbRprtInd
-*
-* @param[in] Pst* pst
-* @param[in] SuId suId
-* @param[in] RgmPrbRprtInd * prbRprtInd
-* @return S16
-* -# ROK
-**/
-S16 cmPkLwLcRgmPrbRprtInd
-(
-Pst* pst,
-SuId suId,
-RgmPrbRprtInd * prbRprtInd
-)
-{
- Buffer *mBuf = NULLP;
-
-
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)prbRprtInd, sizeof(RgmPrbRprtInd));
- return RFAILED;
- }
-
- if(oduPackPointer((PTR)prbRprtInd, mBuf) != ROK)
- {
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)prbRprtInd, sizeof(RgmPrbRprtInd));
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- if (SPkS16(suId, mBuf) != ROK)
- {
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)prbRprtInd, sizeof(RgmPrbRprtInd));
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTRGMCFGPRBRPRT;
- return (SPstTsk(pst,mBuf));
-}
-
-
-/**
-* @brief PRB Usage Report Indication from MAC to RRM
-*
-* @details
-*
-* Function : cmUnpkLwLcRgmPrbRprtInd
-*
-* @param[in] Pst* pst
-* @param[in] SuId suId
-* @param[in] RgmPrbRprtInd * prbRprtInd
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkLwLcRgmPrbRprtInd
-(
-RgmPrbRprtIndFptr func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- SuId suId;
- RgmPrbRprtInd *prbRprtInd;
- S16 ret;
-
-
- if (SUnpkS16(&suId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- if (oduUnpackPointer((PTR *)&prbRprtInd, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)prbRprtInd, sizeof(RgmPrbRprtInd));
- return RFAILED;
- }
-
-
- ret = ((*func)(pst, suId, prbRprtInd));
-
- SPutMsg(mBuf);
-
- return (ret);
-}
-#endif
-
-
-/**
-* @brief Request from RRM to MAC to bind the interface saps
-*
-* @details
-*
-* Function : cmPkRgmBndReq
-*
-* @param[in] Pst* pst
-* @param[in] SuId suId
-* @param[in] SpId spId
-* @return S16
-* -# ROK
-**/
-S16 cmPkRgmBndReq
-(
-Pst* pst,
-SuId suId,
-SpId spId
-)
-{
- Buffer *mBuf = NULLP;
-
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
- {
- return RFAILED;
- }
-
- if (SPkS16(spId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- if (SPkS16(suId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTRGMBNDREQ;
- return (SPstTsk(pst,mBuf));
-}
-
-\f
-/**
-* @brief Request from RRM to MAC to bind the interface saps
-*
-* @details
-*
-* Function : cmUnpkRgmBndReq
-*
-* @param[in] Pst* pst
-* @param[in] SuId suId
-* @param[in] SpId spId
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkRgmBndReq
-(
-RgmBndReq func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- SuId suId;
- SpId spId;
- S16 ret;
-
-
- if (SUnpkS16(&suId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- if (SUnpkS16(&spId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- ret = ((*func)(pst, suId, spId));
-
- SPutMsg(mBuf);
-
- return (ret);
-}
-
-/**
-* @brief Request from RRM to MAC to Unbind the interface saps
-*
-* @details
-*
-* Function : cmPkRgmUbndReq
-*
-* @param[in] Pst* pst
-* @param[in] SpId spId
-* @param[in] Reason reason
-* @return S16
-* -# ROK
-**/
-S16 cmPkRgmUbndReq
-(
-Pst* pst,
-SpId spId,
-Reason reason
-)
-{
- Buffer *mBuf = NULLP;
-
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
- {
- return RFAILED;
- }
- if (SPkS16(reason, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
- if (SPkS16(spId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTRGMUBNDREQ;
- return (SPstTsk(pst,mBuf));
-}
-
-#if 1
-\f
-/**
-* @brief Request from RRM to MAC to Unbind the interface saps
-*
-* @details
-*
-* Function : cmUnpkRgmUbndReq
-*
-* @param[in] Pst* pst
-* @param[in] SpId spId
-* @param[in] Reason reason
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkRgmUbndReq
-(
-RgmUbndReq func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- SpId spId;
- Reason reason;
-
-
- if (SUnpkS16(&spId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
- if (SUnpkS16(&reason, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
- SPutMsg(mBuf);
- return ((*func)(pst, spId, reason));
-}
-#endif
-
-/**
-* @brief Confirmation from MAC to RRM for the bind/Unbind
- * request for the interface saps
-*
-* @details
-*
-* Function : cmPkRgmBndCfm
-*
-* @param[in] Pst* pst
-* @param[in] SuId suId
-* @param[in] uint8_t status
-* @return S16
-* -# ROK
-**/
-S16 cmPkRgmBndCfm
-(
-Pst* pst,
-SuId suId,
-uint8_t status
-)
-{
- Buffer *mBuf = NULLP;
-
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
- {
- return RFAILED;
- }
-
- if (SPkS16(suId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- if (oduUnpackUInt8(status, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTRGMBNDCFM;
- return (SPstTsk(pst,mBuf));
-}
-
-\f
-/**
-* @brief Confirmation from MAC to RRM for the bind/Unbind
- * request for the interface saps
-*
-* @details
-*
-* Function : cmUnpkRgmBndCfm
-*
-* @param[in] Pst* pst
-* @param[in] SuId suId
-* @param[in] uint8_t status
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkRgmBndCfm
-(
-RgmBndCfm func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- SuId suId;
- uint8_t status;
-
-
- if (oduPackUInt8(&status, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- if (SUnpkS16(&suId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
- SPutMsg(mBuf);
- return ((*func)(pst, suId, status));
-}
-
-\f
-
-
-/**
-* @brief Configure the PRB Report Preparation Start/Stop from RRM to MAC
-*
-* @details
-*
-* Function : cmPkCfgPrbRprt
-*
-* @param[in] RgmPrbRprtCfg *prbRprtCfg
-* @param[in] Buffer *mBuf
-* @return S16
-* -# ROK
-**/
-S16 cmPkCfgPrbRprt
-(
-RgmPrbRprtCfg * prbRprtCfg,
-Buffer *mBuf
-)
-{
- CMCHKPK(oduUnpackUInt16, prbRprtCfg->usPrbAvgPeriodicty, mBuf);
- CMCHKPK(oduUnpackUInt8, prbRprtCfg->bConfigType, mBuf);
- CMCHKPK(oduUnpackUInt8, prbRprtCfg->bCellId, mBuf);
- return ROK;
-}
-/**
-* @brief Configure the PRB Report Preparation Start/Stop from RRM to MAC
-*
-* @details
-*
-* Function : cmUnPkCfgPrbRprt
-*
-* @param[in] RgmPrbRprtCfg *prbRprtCfg
-* @param[in] Buffer *mBuf
-* @return S16
-* -# ROK
-**/
-S16 cmUnPkCfgPrbRprt
-(
-RgmPrbRprtCfg * prbRprtCfg,
-Buffer *mBuf
-)
-{
- CMCHKUNPK(oduPackUInt8, &prbRprtCfg->bCellId, mBuf);
- CMCHKUNPK(oduPackUInt8, &prbRprtCfg->bConfigType, mBuf);
- CMCHKUNPK(oduPackUInt16, &prbRprtCfg->usPrbAvgPeriodicty, mBuf);
- return ROK;
-}
-
-
-
-\f
-/**
-* @brief Configure the PRB Report Preparation Start/Stop from RRM to MAC
-*
-* @details
-*
-* Function : cmPkRgmCfgPrbRprt
-*
-* @param[in] Pst* pst
-* @param[in] SpId spId
-* @param[in] RgmPrbRprtCfg *prbRprtCfg
-* @return S16
-* -# ROK
-**/
-S16 cmPkRgmCfgPrbRprt
-(
-Pst* pst,
-SpId spId,
-RgmPrbRprtCfg * prbRprtCfg
-)
-{
- Buffer *mBuf = NULLP;
- uint32_t len = sizeof(RgmPrbRprtCfg);
-
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
- {
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)prbRprtCfg, sizeof(RgmPrbRprtCfg));
- return RFAILED;
- }
-
- if(cmPkCfgPrbRprt(prbRprtCfg, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data*)prbRprtCfg, len);
- return RFAILED;
- }
-
- if (SPkS16(spId, mBuf) != ROK)
- {
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)prbRprtCfg, sizeof(RgmPrbRprtCfg));
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)prbRprtCfg, sizeof(RgmPrbRprtCfg));
-
- pst->event = (Event) EVTRGMCFGPRBRPRT;
- return (SPstTsk(pst,mBuf));
-}
-
-
-
-/**
-* @brief Configure the PRB Report Preparation Start/Stop from RRM to MAC
-*
-* @details
-*
-* Function : cmUnpkRgmCfgPrbRprt
-*
-* @param[in] Pst* pst
-* @param[in] SpId spId
-* @param[in] RgmPrbRprtCfg * prbRprtCfg
-* @return S16
-* -# ROK
-**/
-S16 cmUnpkRgmCfgPrbRprt
-(
-RgmCfgPrbRprtFptr func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- SpId spId;
- RgmPrbRprtCfg *prbRprtCfg;
-
- if ((SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data **)&prbRprtCfg, sizeof(RgmPrbRprtCfg))) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- if (SUnpkS16(&spId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- if (cmUnPkCfgPrbRprt(prbRprtCfg, mBuf) != ROK)
- {
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- SPutMsg(mBuf);
- return ((*func)(pst, spId, prbRprtCfg));
-}
-
/* RRM_SP1_START */
/**
* @brief Packing of PRB Usage Report for qci for sending
/* Event corresponding to each primitive at this interface */
#define EVTRGMBASEEVT 0 /*!< Bind Request */
-#define EVTRGMBNDREQ 1 /*!< Bind Request */
-#define EVTRGMUBNDREQ 2 /*!< Un-Bind Request */
-#define EVTRGMBNDCFM 3 /*!< Bind Confirm */
#define EVTRGMCFGPRBRPRT 4 /*!< PRB Report Configuration */
#define EVTRGMPRBRPRTIND 5 /*!< PRB report Indication */
#define EVTRGMTRANSMODEIND 6 /*!< Trans Mode Chg Indication */
#define RGM_MAX_QCI_REPORTS 4
-typedef struct rgmPrbRprtCfg
-{
- uint16_t usPrbAvgPeriodicty; /* It is in milli sec */
- uint8_t bConfigType;
- uint8_t bCellId;
-}RgmPrbRprtCfg;
-
/* RRM_SP1_START */
typedef struct rgmPrbRptPerQci
{
/***********************************************************************
type definitions for upper layer interface - RLC primitives
***********************************************************************/
-/** @brief Bind Request from RLC to MAC to bind the interface SAPs */
-typedef S16 (*RgmBndReq) ARGS((
- Pst* pst,
- SuId suId,
- SpId spId));
-/** @brief Unbind Request from RLC to MAC to unbind the interface SAPs */
-typedef S16 (*RgmUbndReq) ARGS((
- Pst* pst,
- SpId spId,
- Reason reason));
-/** @brief Bind Confirmation from MAC to RLC for the bind/unbind
- * request for the interface SAPs */
-typedef S16 (*RgmBndCfm) ARGS((
- Pst* pst,
- SuId suId,
- uint8_t status));
-/** @brief Data Request from RLC to MAC for forwarding SDUs on common
- * channel for transmission */
-typedef S16 (*RgmCfgPrbRprtFptr) ARGS((
- Pst* pst,
- SpId spId,
- RgmPrbRprtCfg * prbRprtCfg));
+ /** @brief Data Indication from MAC to RLC to
+ * * forward the data received for common channels */
+typedef S16 (*RgmPrbRprtIndFptr) ARGS((
+ Pst* pst,
+ SuId suId,
+ RgmPrbRprtInd * prbRprtInd));
/** @brief Data Indication from MAC to RLC to
* forward the data received for common channels */
-typedef S16 (*RgmPrbRprtIndFptr) ARGS((
- Pst* pst,
- SuId suId,
- RgmPrbRprtInd * prbRprtInd));
-
typedef S16 (*RgmTransModeIndFptr) ARGS((
Pst* pst,
SuId suId,
RgmTransModeInd * transModeInd));
-#ifdef RG
-/** @brief Bind Request from RLC to MAC to bind the interface SAPs
- * @param pst Pointer to the post structure.
- * @param suId SAP ID of the service user.
- * @param spId SAP ID of the service provider.
- * @return ROK/RFAILED
-*/
-S16 RgUiRgmBndReq ARGS((Pst* pst,SuId suId,SpId spId));
-/** @brief Unbind Request from RLC to MAC to unbind the interface SAPs
- * @param pst Pointer to the post structure.
- * @param spId SAP ID of the service provider.
- * @param reason Reason for unbind request.
- * @return ROK/RFAILED
-*/
-S16 RgUiRgmUbndReq ARGS((Pst* pst,SpId spId,Reason reason));
-/** @brief Bind Confirmation from MAC to RLC for the bind and unbind
- * request for the interface SAPs
- * @param pst Pointer to the post structure.
- * @param suId SAP ID of the service user.
- * @param status Status of the bind request.
- * @return ROK/RFAILED
-*/
-S16 RgUiRgmBndCfm ARGS((Pst* pst,SuId suId,uint8_t status));
-/** @brief Data Request from RLC to MAC for forwarding SDUs on common
- * channel for transmission
- * @param pst Pointer to the post structure.
- * @param spId SAP ID of the service provider.
- * @param prbRprtCfg Data request for common channels (BCCH, PCCH and CCCH).
- * @return ROK/RFAILED
-*/
-S16 RgUiRgmCfgPrbRprt ARGS((Pst* pst,SuId suId,RgmPrbRprtCfg *prbRprtCfg));
-/** @brief Data Indication from MAC to RLC to
- * forward the data received for common channels
- * @param pst Pointer to the post structure.
- * @param suId SAP ID of the service user.
- * @param prbRprtInd Data indication on CCCH.
- * @return ROK/RFAILED
-*/
-S16 RgUiRgmPrbRprtInd ARGS((Pst* pst,SuId suId,RgmPrbRprtInd *prbRprtInd));
-
-#endif
#ifdef RM_INTF
-/** @brief Request from RLC to MAC to bind the interface saps */
-S16 RmLiRgmBndReq ARGS((
- Pst* pst,
- SuId suId,
- SpId spId
-));
-/** @brief Request from RLC to MAC to Unbind the interface saps */
-S16 RmLiRgmUbndReq ARGS((
- Pst* pst,
- SpId spId,
- Reason reason
-));
-/** @brief Confirmation from MAC to RLC for the bind/Unbind
- * request for the interface saps */
-S16 RmLiRgmBndCfm ARGS((
- Pst* pst,
- SuId suId,
- uint8_t status
-));
-/** @brief Request from RLC to MAC for forwarding SDUs on common
- * channel for transmission */
-S16 RmLiRgmCfgPrbRprt ARGS((
- Pst* pst,
- SpId spId,
- RgmPrbRprtCfg* prbRprtCfg
-));
-/** @brief Data Indication from MAC to RLC to
- * forward the data received for common channels*/
-S16 RmLiRgmPrbRprtInd ARGS((
- Pst* pst,
- SuId suId,
- RgmPrbRprtInd* prbRprtInd
-));
/** @brief Data Indication from MAC to RRM to
* change the transmission mode*/
S16 RmLiRgmTransModeInd ARGS((
));
#endif
-#ifdef RGM_LWLC
-/** @brief Request from RLC to MAC to bind the interface saps */
-S16 cmPkLwLcRgmBndReq ARGS((
- Pst* pst,
- SuId suId,
- SpId spId
-));
-/** @brief Request from RLC to MAC to bind the interface saps */
-S16 cmUnpkLwLcRgmBndReq ARGS((
- RgmBndReq func,
- Pst* pst,
- Buffer *mBuf
-));
-/** @brief Request from RLC to MAC to Unbind the interface saps */
-S16 cmPkLwLcRgmUbndReq ARGS((
- Pst* pst,
- SpId spId,
- Reason reason
-));
-/** @brief Request from RLC to MAC to Unbind the interface saps */
-S16 cmUnpkLwLcRgmUbndReq ARGS((
- RgmUbndReq func,
- Pst* pst,
- Buffer *mBuf
-));
-/** @brief Confirmation from MAC to RLC for the bind/Unbind
- * request for the interface saps */
-S16 cmPkLwLcRgmBndCfm ARGS((
- Pst* pst,
- SuId suId,
- uint8_t status
-));
-/** @brief Confirmation from MAC to RLC for the bind/Unbind
- * request for the interface saps */
-S16 cmUnpkLwLcRgmBndCfm ARGS((
- RgmBndCfm func,
- Pst* pst,
- Buffer *mBuf
-));
-/** @brief Request from RLC to MAC for forwarding SDUs on common
- * channel for transmission */
-S16 cmPkLwLcRgmCfgPrbRprt ARGS((
- Pst* pst,
- SpId spId,
- RgmPrbRprtCfg * prbRprtCfg
-));
-/** @brief Request from RLC to MAC for forwarding SDUs on common
- * channel for transmission */
-S16 cmUnpkLwLcRgmCfgPrbRprt ARGS((
- RgmCfgPrbRprtFptr func,
- Pst* pst,
- Buffer *mBuf
-));
-/** @brief Data Indication from MAC to RLC to
- * forward the data received for common channels*/
-S16 cmPkLwLcRgmPrbRprtInd ARGS((
- Pst* pst,
- SuId suId,
- RgmPrbRprtInd * prbRprtInd
-));
-/** @brief Data Indication from MAC to RLC to
- * forward the data received for common channels*/
-S16 cmUnpkLwLcRgmPrbRprtInd ARGS((
- RgmPrbRprtIndFptr func,
- Pst* pst,
- Buffer *mBuf
-));
-#endif
-
-
-/** @brief Request from RLC to MAC to bind the interface saps */
-S16 cmPkRgmBndReq ARGS((
- Pst* pst,
- SuId suId,
- SpId spId
-));
-/** @brief Request from RLC to MAC to bind the interface saps */
-S16 cmUnpkRgmBndReq ARGS((
- RgmBndReq func,
- Pst* pst,
- Buffer *mBuf
-));
-/** @brief Request from RLC to MAC to Unbind the interface saps */
-S16 cmPkRgmUbndReq ARGS((
- Pst* pst,
- SpId spId,
- Reason reason
-));
-/** @brief Request from RLC to MAC to Unbind the interface saps */
-S16 cmUnpkRgmUbndReq ARGS((
- RgmUbndReq func,
- Pst* pst,
- Buffer *mBuf
-));
-/** @brief Confirmation from MAC to RLC for the bind/Unbind
- * request for the interface saps */
-S16 cmPkRgmBndCfm ARGS((
- Pst* pst,
- SuId suId,
- uint8_t status
-));
-/** @brief Confirmation from MAC to RLC for the bind/Unbind
- * request for the interface saps */
-S16 cmUnpkRgmBndCfm ARGS((
- RgmBndCfm func,
- Pst* pst,
- Buffer *mBuf
-));
-/** @brief Request from RLC to MAC for forwarding SDUs on common
- * channel for transmission */
-S16 cmPkRgmCfgPrbRprt ARGS((
- Pst* pst,
- SpId spId,
- RgmPrbRprtCfg * prbRprtCfg
-));
-
-
-S16 cmPkCfgPrbRprt ARGS((
-RgmPrbRprtCfg * prbRprtCfg,
-Buffer *mBuf
-));
-
-S16 cmPkPrbRprtInd ARGS((
-RgmPrbRprtInd * prbRprtInd,
-Buffer *mBuf
-));
-
-/** @brief Request from RLC to MAC for forwarding SDUs on common
- * channel for transmission */
-S16 cmUnpkRgmCfgPrbRprt ARGS((
- RgmCfgPrbRprtFptr func,
- Pst* pst,
- Buffer *mBuf
-));
-
-S16 cmUnPkCfgPrbRprt ARGS((
-RgmPrbRprtCfg * prbRprtCfg,
-Buffer *mBuf
-));
-
/** @brief Data Indication from MAC to RLC to
- * forward the data received for common channels*/
+ * * forward the data received for common channels*/
S16 cmPkRgmPrbRprtInd ARGS((
- Pst* pst,
- SuId suId,
- RgmPrbRprtInd * prbRprtInd
-));
+ Pst* pst,
+ SuId suId,
+ RgmPrbRprtInd * prbRprtInd
+ ));
S16 cmUnpkPrbRprtInd ARGS((
-RgmPrbRprtInd * prbRprtInd,
-Buffer *mBuf
-));
+ RgmPrbRprtInd * prbRprtInd,
+ Buffer *mBuf
+ ));
S16 cmPkTransModeInd ARGS((
RgmTransModeInd *transModeInd,
\f
/***********************************************************
*
-* Func : cmPkRgrBndReq
+* Func : cmUnpkRgrCfgReq
*
*
-* Desc : Request from RRM to MAC to bind the interface saps
+* Desc : Configuration Request from RRM to MAC for
+ * configuring Cell/Ue/Lc
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgrBndReq
+S16 cmUnpkRgrCfgReq
(
-Pst* pst,
-SuId suId,
-SpId spId
+RgrCfgReq func,
+Pst *pst,
+Buffer *mBuf
)
{
- Buffer *mBuf = NULLP;
-
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
+ RgrCfgTransId transId;
+ RgrCfgReqInfo *cfgReqInfo;
+
+#if 0
+ if (SUnpkS16(&spId, mBuf) != ROK) {
+ SPutMsg(mBuf);
#if (ERRCLASS & ERRCLS_ADD_RES)
SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
__FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR001, (ErrVal)0, "Packing failed");
+ (ErrVal)ERGR021, (ErrVal)0, "Packing failed");
#endif
return RFAILED;
}
- if (SPkS16(spId, mBuf) != ROK) {
+#endif
+
+ if (cmUnpkRgrCfgTransId(&transId, mBuf) != ROK) {
+ SPutMsg(mBuf);
#if (ERRCLASS & ERRCLS_ADD_RES)
SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
__FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR002, (ErrVal)0, "Packing failed");
+ (ErrVal)ERGR022, (ErrVal)0, "Packing failed");
#endif
- SPutMsg(mBuf);
return RFAILED;
}
- if (SPkS16(suId, mBuf) != ROK) {
+ if ((SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data **)&cfgReqInfo,sizeof(RgrCfgReqInfo))) != ROK) {
#if (ERRCLASS & ERRCLS_ADD_RES)
SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR003, (ErrVal)0, "Packing failed");
+ __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
+ (ErrVal)ERGR023, (ErrVal)0, "Packing failed");
#endif
SPutMsg(mBuf);
return RFAILED;
}
- pst->event = (Event) EVTRGRBNDREQ;
- return (SPstTsk(pst,mBuf));
+ memset(cfgReqInfo, 0, sizeof(RgrCfgReqInfo));
+ if (pst->selector == ODU_SELECTOR_LC)
+ if (cmUnpkRgrCfgReqInfo(cfgReqInfo, mBuf) != ROK) {
+ SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)cfgReqInfo, sizeof(RgrCfgReqInfo));
+ SPutMsg(mBuf);
+#if (ERRCLASS & ERRCLS_ADD_RES)
+ SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
+ __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
+ (ErrVal)ERGR024, (ErrVal)0, "Packing failed");
+#endif
+ return RFAILED;
+ }
+ SPutMsg(mBuf);
+ return ((*func)(pst, transId, cfgReqInfo));
}
+/* rgr_c_001.main_3: Added TTI indication from MAC to RGR user */
\f
/***********************************************************
*
-* Func : cmUnpkRgrBndReq
+* Func : cmPkRgrTtiIndInfo
*
*
-* Desc : Request from RRM to MAC to bind the interface saps
+* Desc : Packs the TTI indication information.
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgrBndReq
+S16 cmPkRgrTtiIndInfo
(
-RgrBndReq func,
-Pst *pst,
+RgrTtiIndInfo *param,
+Buffer *mBuf
+)
+{
+ CMCHKPK(oduUnpackUInt16, param->sfn, mBuf);
+ CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
+ return ROK;
+}
+\f
+/***********************************************************
+*
+* Func : cmUnpkRgrTtiIndInfo
+*
+*
+* Desc : Unpacking for RgrTtiIndInfo
+*
+* Ret : S16
+*
+* Notes:
+*
+* File :
+*
+**********************************************************/
+S16 cmUnpkRgrTtiIndInfo
+(
+RgrTtiIndInfo *param,
Buffer *mBuf
)
{
- SuId suId;
- SpId spId;
-
- if (SUnpkS16(&suId, mBuf) != ROK) {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR004, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- if (SUnpkS16(&spId, mBuf) != ROK) {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR005, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- SPutMsg(mBuf);
- return ((*func)(pst, suId, spId));
+ CMCHKUNPK(cmUnpkLteCellId, ¶m->cellId, mBuf);
+ CMCHKUNPK(oduPackUInt16, ¶m->sfn, mBuf);
+ return ROK;
}
\f
/***********************************************************
*
-* Func : cmPkRgrBndCfm
+* Func : cmPkRgrTtiInd
*
*
-* Desc : Confirmation from MAC to RRM for the bind/Unbind
- * request for the interface saps
+* Desc : TTI indication from MAC to RRM
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgrBndCfm
+S16 cmPkRgrTtiInd
(
Pst* pst,
SuId suId,
-uint8_t status
+RgrTtiIndInfo *ttiInd
)
{
Buffer *mBuf = NULLP;
#if (ERRCLASS & ERRCLS_ADD_RES)
SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
__FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR006, (ErrVal)0, "Packing failed");
+ (ErrVal)ERGR025, (ErrVal)0, "Packing failed");
#endif
return RFAILED;
}
- if (oduUnpackUInt8(status, mBuf) != ROK) {
+ if (cmPkRgrTtiIndInfo(ttiInd, mBuf) != ROK) {
#if (ERRCLASS & ERRCLS_ADD_RES)
SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
__FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR007, (ErrVal)0, "Packing failed");
+ (ErrVal)ERGR026, (ErrVal)0, "Packing failed");
#endif
+ SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)ttiInd, sizeof(RgrTtiIndInfo));
SPutMsg(mBuf);
return RFAILED;
}
#if (ERRCLASS & ERRCLS_ADD_RES)
SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
__FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR008, (ErrVal)0, "Packing failed");
+ (ErrVal)ERGR027, (ErrVal)0, "Packing failed");
#endif
+ SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)ttiInd, sizeof(RgrTtiIndInfo));
SPutMsg(mBuf);
return RFAILED;
}
- pst->event = (Event) EVTRGRBNDCFM;
+ SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)ttiInd, sizeof(RgrTtiIndInfo));
+ pst->event = (Event) EVTRGRTTIIND;
return (SPstTsk(pst,mBuf));
}
\f
/***********************************************************
*
-* Func : cmUnpkRgrBndCfm
+* Func : cmUnpkRgrTtiInd
*
*
-* Desc : Confirmation from MAC to RRM for the bind/Unbind
- * request for the interface saps
+* Desc : TTI indication from MAC to RRM
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgrBndCfm
+S16 cmUnpkRgrTtiInd
(
-RgrBndCfm func,
+RgrTtiInd func,
Pst *pst,
Buffer *mBuf
)
{
SuId suId;
- uint8_t status;
+ RgrTtiIndInfo *ttiInd;
if (SUnpkS16(&suId, mBuf) != ROK) {
#if (ERRCLASS & ERRCLS_ADD_RES)
SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
__FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR009, (ErrVal)0, "Packing failed");
+ (ErrVal)ERGR028, (ErrVal)0, "Packing failed");
#endif
return RFAILED;
}
- if (oduPackUInt8(&status, mBuf) != ROK) {
+ if ((SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data **)&ttiInd, sizeof(RgrTtiIndInfo))) != ROK)
+ {
+#if (ERRCLASS & ERRCLS_ADD_RES)
+ SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
+ __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
+ (ErrVal)ERGR029, (ErrVal)0, "UnPacking failed");
+#endif
+ SPutMsg(mBuf);
+ return RFAILED;
+ }
+
+ if (cmUnpkRgrTtiIndInfo(ttiInd, mBuf) != ROK) {
+ /*ccpu00114888- Memory Leak issue- Start*/
+ SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)ttiInd,
+ sizeof(RgrTtiIndInfo));
+ /*ccpu00114888- Memory Leak issue- End*/
SPutMsg(mBuf);
#if (ERRCLASS & ERRCLS_ADD_RES)
SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
__FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR010, (ErrVal)0, "Packing failed");
+ (ErrVal)ERGR030, (ErrVal)0, "Packing failed");
#endif
return RFAILED;
}
SPutMsg(mBuf);
- return ((*func)(pst, suId, status));
+ return ((*func)(pst, suId, ttiInd));
}
\f
/***********************************************************
*
-* Func : cmPkRgrUbndReq
+* Func : cmPkRgrCfgCfm
*
*
-* Desc : Request from RRM to MAC to Unbind the interface saps
+* Desc : Configuration Confirm from MAC to RRM
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgrUbndReq
+S16 cmPkRgrCfgCfm
(
Pst* pst,
-SpId spId,
-Reason reason
+RgrCfgTransId transId,
+uint8_t status
)
{
Buffer *mBuf = NULLP;
#if (ERRCLASS & ERRCLS_ADD_RES)
SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
__FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR011, (ErrVal)0, "Packing failed");
+ (ErrVal)ERGR031, (ErrVal)0, "Packing failed");
#endif
return RFAILED;
}
- if (SPkS16(reason, mBuf) != ROK) {
+ if (oduUnpackUInt8(status, mBuf) != ROK) {
#if (ERRCLASS & ERRCLS_ADD_RES)
SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
__FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR012, (ErrVal)0, "Packing failed");
+ (ErrVal)ERGR032, (ErrVal)0, "Packing failed");
#endif
SPutMsg(mBuf);
return RFAILED;
}
- if (SPkS16(spId, mBuf) != ROK) {
+ if (cmPkRgrCfgTransId(&transId, mBuf) != ROK) {
#if (ERRCLASS & ERRCLS_ADD_RES)
SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
__FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR013, (ErrVal)0, "Packing failed");
+ (ErrVal)ERGR033, (ErrVal)0, "Packing failed");
#endif
SPutMsg(mBuf);
return RFAILED;
}
- pst->event = (Event) EVTRGRUBNDREQ;
+ pst->event = (Event) EVTMACSCHCFGCFM;
return (SPstTsk(pst,mBuf));
}
\f
/***********************************************************
*
-* Func : cmUnpkRgrUbndReq
+* Func : cmUnpkRgrCfgCfm
*
*
-* Desc : Request from RRM to MAC to Unbind the interface saps
+* Desc : Configuration Confirm from MAC to RRM
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgrUbndReq
+S16 cmUnpkRgrCfgCfm
(
-RgrUbndReq func,
+RgrCfgCfm func,
Pst *pst,
Buffer *mBuf
)
{
- SpId spId;
- Reason reason;
+ RgrCfgTransId transId;
+ uint8_t status;
- if (SUnpkS16(&spId, mBuf) != ROK) {
+ if (cmUnpkRgrCfgTransId(&transId, mBuf) != ROK) {
SPutMsg(mBuf);
#if (ERRCLASS & ERRCLS_ADD_RES)
SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
__FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR014, (ErrVal)0, "Packing failed");
+ (ErrVal)ERGR036, (ErrVal)0, "Packing failed");
#endif
return RFAILED;
}
- if (SUnpkS16(&reason, mBuf) != ROK) {
+ if (oduPackUInt8(&status, mBuf) != ROK) {
SPutMsg(mBuf);
#if (ERRCLASS & ERRCLS_ADD_RES)
SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
__FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR015, (ErrVal)0, "Packing failed");
+ (ErrVal)ERGR037, (ErrVal)0, "Packing failed");
#endif
return RFAILED;
}
SPutMsg(mBuf);
- return ((*func)(pst, spId, reason));
+ return ((*func)(pst, transId, status));
}
\f
/***********************************************************
*
-* Func : cmUnpkRgrCfgReq
+* Func : cmPkRgrCfgTransId
*
*
-* Desc : Configuration Request from RRM to MAC for
- * configuring Cell/Ue/Lc
+* Desc : Transaction ID between MAC and RRM
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgrCfgReq
+S16 cmPkRgrCfgTransId
(
-RgrCfgReq func,
-Pst *pst,
+RgrCfgTransId *param,
Buffer *mBuf
)
{
- RgrCfgTransId transId;
- RgrCfgReqInfo *cfgReqInfo;
-
-#if 0
- if (SUnpkS16(&spId, mBuf) != ROK) {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR021, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
-#endif
- if (cmUnpkRgrCfgTransId(&transId, mBuf) != ROK) {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR022, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- if ((SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data **)&cfgReqInfo,sizeof(RgrCfgReqInfo))) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR023, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
+ S32 i;
+
+ for (i=RGR_CFG_TRANSID_SIZE-1; i >= 0; i--) {
+ CMCHKPK(oduUnpackUInt8, param->trans[i], mBuf);
}
- memset(cfgReqInfo, 0, sizeof(RgrCfgReqInfo));
- if (pst->selector == ODU_SELECTOR_LC)
- if (cmUnpkRgrCfgReqInfo(cfgReqInfo, mBuf) != ROK) {
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)cfgReqInfo, sizeof(RgrCfgReqInfo));
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR024, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- SPutMsg(mBuf);
- return ((*func)(pst, transId, cfgReqInfo));
+ return ROK;
}
-/* rgr_c_001.main_3: Added TTI indication from MAC to RGR user */
+
\f
/***********************************************************
*
-* Func : cmPkRgrTtiIndInfo
+* Func : cmUnpkRgrCfgTransId
*
*
-* Desc : Packs the TTI indication information.
+* Desc : Transaction ID between MAC and RRM
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgrTtiIndInfo
+S16 cmUnpkRgrCfgTransId
(
-RgrTtiIndInfo *param,
-Buffer *mBuf
+RgrCfgTransId *param,
+Buffer *mBuf
)
{
- CMCHKPK(oduUnpackUInt16, param->sfn, mBuf);
- CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
+
+ S32 i;
+
+ for (i=0; i<RGR_CFG_TRANSID_SIZE; i++) {
+ CMCHKUNPK(oduPackUInt8, ¶m->trans[i], mBuf);
+ }
return ROK;
}
+
+
\f
/***********************************************************
*
-* Func : cmUnpkRgrTtiIndInfo
+* Func : cmPkRgrDlHqCfg
*
*
-* Desc : Unpacking for RgrTtiIndInfo
+* Desc : Downlink HARQ configuration per Cell
+*
*
* Ret : S16
*
* File :
*
**********************************************************/
-S16 cmUnpkRgrTtiIndInfo
+S16 cmPkRgrDlHqCfg
(
-RgrTtiIndInfo *param,
+RgrDlHqCfg *param,
Buffer *mBuf
)
{
- CMCHKUNPK(cmUnpkLteCellId, ¶m->cellId, mBuf);
- CMCHKUNPK(oduPackUInt16, ¶m->sfn, mBuf);
- return ROK;
-}
+
+ CMCHKPK(oduUnpackUInt8, param->maxMsg4HqTx, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->maxDlHqTx, mBuf);
+ return ROK;
+}
+
\f
/***********************************************************
*
-* Func : cmPkRgrTtiInd
+* Func : cmUnpkRgrDlHqCfg
*
*
-* Desc : TTI indication from MAC to RRM
+* Desc : Downlink HARQ configuration per Cell
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgrTtiInd
+S16 cmUnpkRgrDlHqCfg
(
-Pst* pst,
-SuId suId,
-RgrTtiIndInfo *ttiInd
+RgrDlHqCfg *param,
+Buffer *mBuf
)
{
- Buffer *mBuf = NULLP;
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR025, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- if (cmPkRgrTtiIndInfo(ttiInd, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR026, (ErrVal)0, "Packing failed");
-#endif
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)ttiInd, sizeof(RgrTtiIndInfo));
- SPutMsg(mBuf);
- return RFAILED;
- }
- if (SPkS16(suId, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR027, (ErrVal)0, "Packing failed");
-#endif
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)ttiInd, sizeof(RgrTtiIndInfo));
- SPutMsg(mBuf);
- return RFAILED;
- }
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)ttiInd, sizeof(RgrTtiIndInfo));
- pst->event = (Event) EVTRGRTTIIND;
- return (SPstTsk(pst,mBuf));
+
+ CMCHKUNPK(oduPackUInt8, ¶m->maxDlHqTx, mBuf);
+ CMCHKUNPK(oduPackUInt8, ¶m->maxMsg4HqTx, mBuf);
+ return ROK;
}
+
\f
/***********************************************************
*
-* Func : cmUnpkRgrTtiInd
+* Func : cmPkRgrRntiCfg
*
*
-* Desc : TTI indication from MAC to RRM
+* Desc : Range of RNTIs managed by MAC
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgrTtiInd
+S16 cmPkRgrRntiCfg
(
-RgrTtiInd func,
-Pst *pst,
+RgrRntiCfg *param,
Buffer *mBuf
)
{
- SuId suId;
- RgrTtiIndInfo *ttiInd;
-
- if (SUnpkS16(&suId, mBuf) != ROK) {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR028, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- if ((SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data **)&ttiInd, sizeof(RgrTtiIndInfo))) != ROK)
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR029, (ErrVal)0, "UnPacking failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- if (cmUnpkRgrTtiIndInfo(ttiInd, mBuf) != ROK) {
- /*ccpu00114888- Memory Leak issue- Start*/
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)ttiInd,
- sizeof(RgrTtiIndInfo));
- /*ccpu00114888- Memory Leak issue- End*/
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR030, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- SPutMsg(mBuf);
- return ((*func)(pst, suId, ttiInd));
+ CMCHKPK(oduUnpackUInt16, param->size, mBuf);
+ CMCHKPK(cmPkLteRnti, param->startRnti, mBuf);
+ return ROK;
}
+
\f
/***********************************************************
*
-* Func : cmPkRgrCfgCfm
+* Func : cmUnpkRgrRntiCfg
*
*
-* Desc : Configuration Confirm from MAC to RRM
+* Desc : Range of RNTIs managed by MAC
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgrCfgCfm
+S16 cmUnpkRgrRntiCfg
(
-Pst* pst,
-RgrCfgTransId transId,
-uint8_t status
+RgrRntiCfg *param,
+Buffer *mBuf
)
{
- Buffer *mBuf = NULLP;
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR031, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- if (oduUnpackUInt8(status, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR032, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
- if (cmPkRgrCfgTransId(&transId, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR033, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
- pst->event = (Event) EVTMACSCHCFGCFM;
- return (SPstTsk(pst,mBuf));
+
+ CMCHKUNPK(cmUnpkLteRnti, ¶m->startRnti, mBuf);
+ CMCHKUNPK(oduPackUInt16, ¶m->size, mBuf);
+ return ROK;
}
-\f
+#ifdef EMTC_ENABLE
/***********************************************************
*
-* Func : cmUnpkRgrCfgCfm
+* Func : cmPkRgrEmtcRntiCfg
*
*
-* Desc : Configuration Confirm from MAC to RRM
+* Desc : Range of Emtc RNTIs managed by MAC
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgrCfgCfm
+S16 cmPkRgrEmtcRntiCfg
(
-RgrCfgCfm func,
-Pst *pst,
+RgrEmtcRntiCfg *param,
Buffer *mBuf
)
{
- RgrCfgTransId transId;
- uint8_t status;
-
- if (cmUnpkRgrCfgTransId(&transId, mBuf) != ROK) {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR036, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- if (oduPackUInt8(&status, mBuf) != ROK) {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR037, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- SPutMsg(mBuf);
- return ((*func)(pst, transId, status));
+
+ CMCHKPK(oduUnpackUInt16, param->size, mBuf);
+ CMCHKPK(cmPkLteRnti, param->rntiCeModeBRange, mBuf);
+ CMCHKPK(cmPkLteRnti, param->rntiCeModeBStart, mBuf);
+ CMCHKPK(cmPkLteRnti, param->rntiCeModeARange, mBuf);
+ CMCHKPK(cmPkLteRnti, param->rntiCeModeAStart, mBuf);
+ return ROK;
}
-/* rgr_c_001.main_4: ADD-Added for SI Enhancement. */
-#ifdef RGR_SI_SCH
+
+\f
/***********************************************************
*
-* Func : cmPkRgrSiCfgCfm
+* Func : cmUnpkRgrEmtcRntiCfg
*
*
-* Desc : SI Configuration Confirm from MAC to RRM
+* Desc : Range of Emtc RNTIs managed by MAC
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgrSiCfgCfm
+S16 cmUnpkRgrEmtcRntiCfg
(
-Pst* pst,
-SuId suId,
-RgrCfgTransId transId,
-uint8_t status
+RgrEmtcRntiCfg *param,
+Buffer *mBuf
)
{
- Buffer *mBuf = NULLP;
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR038, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- if (oduUnpackUInt8(status, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR039, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
- if (cmPkRgrCfgTransId(&transId, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR040, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
- if (SPkS16(suId, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR041, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
+ CMCHKUNPK(cmUnpkLteRnti, ¶m->rntiCeModeAStart, mBuf);
+ CMCHKUNPK(cmUnpkLteRnti, ¶m->rntiCeModeARange, mBuf);
+ CMCHKUNPK(cmUnpkLteRnti, ¶m->rntiCeModeBStart, mBuf);
+ CMCHKUNPK(cmUnpkLteRnti, ¶m->rntiCeModeBRange, mBuf);
+ CMCHKUNPK(oduPackUInt16, ¶m->size, mBuf);
- pst->event = (Event) EVTRGRSICFGCFM;
- return (SPstTsk(pst,mBuf));
+ return ROK;
}
+#endif
\f
/***********************************************************
*
-* Func : cmUnpkRgrSiCfgCfm
+* Func : cmPkRgrDlCmnCodeRateCfg
*
*
-* Desc : Configuration Confirm from MAC to RRM
+* Desc : Downlink common channel code rate configuration per cell
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgrSiCfgCfm
+S16 cmPkRgrDlCmnCodeRateCfg
(
-RgrSiCfgCfm func,
-Pst *pst,
+RgrDlCmnCodeRateCfg *param,
Buffer *mBuf
)
{
- SuId suId;
- RgrCfgTransId transId;
- uint8_t status;
-
- if (SUnpkS16(&suId, mBuf) != ROK) {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR042, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- if (cmUnpkRgrCfgTransId(&transId, mBuf) != ROK) {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR043, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- if (oduPackUInt8(&status, mBuf) != ROK) {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR044, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- SPutMsg(mBuf);
- return ((*func)(pst, suId, transId, status));
-}
-#endif/*RGR_SI_SCH*/
-
-\f
-/***********************************************************
-*
-* Func : cmPkRgrCfgTransId
-*
-*
-* Desc : Transaction ID between MAC and RRM
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkRgrCfgTransId
-(
-RgrCfgTransId *param,
-Buffer *mBuf
-)
-{
-
- S32 i;
-
- for (i=RGR_CFG_TRANSID_SIZE-1; i >= 0; i--) {
- CMCHKPK(oduUnpackUInt8, param->trans[i], mBuf);
- }
+ CMCHKPK(oduUnpackUInt8, param->ccchCqi, mBuf);
+ CMCHKPK(oduUnpackUInt16, param->pdcchCodeRate, mBuf);
+ CMCHKPK(oduUnpackUInt16, param->bcchPchRaCodeRate, mBuf);
return ROK;
}
\f
/***********************************************************
*
-* Func : cmUnpkRgrCfgTransId
+* Func : cmUnpkRgrDlCmnCodeRateCfg
*
*
-* Desc : Transaction ID between MAC and RRM
+* Desc : Downlink common channel code rate configuration per cell
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgrCfgTransId
+S16 cmUnpkRgrDlCmnCodeRateCfg
(
-RgrCfgTransId *param,
+RgrDlCmnCodeRateCfg *param,
Buffer *mBuf
)
{
- S32 i;
-
- for (i=0; i<RGR_CFG_TRANSID_SIZE; i++) {
- CMCHKUNPK(oduPackUInt8, ¶m->trans[i], mBuf);
- }
+ CMCHKUNPK(oduPackUInt16, ¶m->bcchPchRaCodeRate, mBuf);
+ CMCHKUNPK(oduPackUInt16, ¶m->pdcchCodeRate, mBuf);
+ CMCHKUNPK(oduPackUInt8, ¶m->ccchCqi, mBuf);
return ROK;
}
\f
/***********************************************************
*
-* Func : cmPkRgrDlHqCfg
+* Func : cmPkRgrCfiCfg
*
*
-* Desc : Downlink HARQ configuration per Cell
+* Desc : Control Format Indicator (CFI) configuration per cell
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgrDlHqCfg
+S16 cmPkRgrCfiCfg
(
-RgrDlHqCfg *param,
+RgrCfiCfg *param,
Buffer *mBuf
)
{
-
-
- CMCHKPK(oduUnpackUInt8, param->maxMsg4HqTx, mBuf);
- CMCHKPK(oduUnpackUInt8, param->maxDlHqTx, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->cfi, mBuf);
return ROK;
}
\f
/***********************************************************
*
-* Func : cmUnpkRgrDlHqCfg
+* Func : cmUnpkRgrCfiCfg
*
*
-* Desc : Downlink HARQ configuration per Cell
+* Desc : Control Format Indicator (CFI) configuration per cell
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgrDlHqCfg
+S16 cmUnpkRgrCfiCfg
(
-RgrDlHqCfg *param,
+RgrCfiCfg *param,
Buffer *mBuf
)
{
-
- CMCHKUNPK(oduPackUInt8, ¶m->maxDlHqTx, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->maxMsg4HqTx, mBuf);
+ CMCHKUNPK(oduPackUInt8, ¶m->cfi, mBuf);
return ROK;
}
\f
/***********************************************************
*
-* Func : cmPkRgrRntiCfg
+* Func : cmPkRgrPuschSubBandCfg
*
*
-* Desc : Range of RNTIs managed by MAC
+* Desc : PUSCH sub-band configuration per cell
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgrRntiCfg
+S16 cmPkRgrPuschSubBandCfg
(
-RgrRntiCfg *param,
+RgrPuschSubBandCfg *param,
Buffer *mBuf
)
{
- CMCHKPK(oduUnpackUInt16, param->size, mBuf);
- CMCHKPK(cmPkLteRnti, param->startRnti, mBuf);
+ S32 i;
+
+ for (i=param->numSubbands-1; i >= 0; i--) {
+ CMCHKPK(oduUnpackUInt8, param->dmrs[i], mBuf);
+ }
+ CMCHKPK(oduUnpackUInt8, param->size, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->numSubbands, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->subbandStart, mBuf);
return ROK;
}
\f
/***********************************************************
*
-* Func : cmUnpkRgrRntiCfg
-*
-*
-* Desc : Range of RNTIs managed by MAC
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkRgrRntiCfg
-(
-RgrRntiCfg *param,
-Buffer *mBuf
-)
-{
-
-
- CMCHKUNPK(cmUnpkLteRnti, ¶m->startRnti, mBuf);
- CMCHKUNPK(oduPackUInt16, ¶m->size, mBuf);
- return ROK;
-}
-
-#ifdef EMTC_ENABLE
-/***********************************************************
-*
-* Func : cmPkRgrEmtcRntiCfg
+* Func : cmUnpkRgrPuschSubBandCfg
*
*
-* Desc : Range of Emtc RNTIs managed by MAC
+* Desc : PUSCH sub-band configuration per cell
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgrEmtcRntiCfg
+S16 cmUnpkRgrPuschSubBandCfg
(
-RgrEmtcRntiCfg *param,
+RgrPuschSubBandCfg *param,
Buffer *mBuf
)
{
-
- CMCHKPK(oduUnpackUInt16, param->size, mBuf);
- CMCHKPK(cmPkLteRnti, param->rntiCeModeBRange, mBuf);
- CMCHKPK(cmPkLteRnti, param->rntiCeModeBStart, mBuf);
- CMCHKPK(cmPkLteRnti, param->rntiCeModeARange, mBuf);
- CMCHKPK(cmPkLteRnti, param->rntiCeModeAStart, mBuf);
+ S32 i;
+ CMCHKUNPK(oduPackUInt8, ¶m->subbandStart, mBuf);
+ CMCHKUNPK(oduPackUInt8, ¶m->numSubbands, mBuf);
+ CMCHKUNPK(oduPackUInt8, ¶m->size, mBuf);
+ for (i=0; i<param->numSubbands; i++) {
+ CMCHKUNPK(oduPackUInt8, ¶m->dmrs[i], mBuf);
+ }
return ROK;
}
\f
/***********************************************************
*
-* Func : cmUnpkRgrEmtcRntiCfg
+* Func : cmPkRgrUlCmnCodeRateCfg
*
*
-* Desc : Range of Emtc RNTIs managed by MAC
+* Desc : Uplink common channel code rate configuration per cell
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgrEmtcRntiCfg
+S16 cmPkRgrUlCmnCodeRateCfg
(
-RgrEmtcRntiCfg *param,
+RgrUlCmnCodeRateCfg *param,
Buffer *mBuf
)
{
-
-
- CMCHKUNPK(cmUnpkLteRnti, ¶m->rntiCeModeAStart, mBuf);
- CMCHKUNPK(cmUnpkLteRnti, ¶m->rntiCeModeARange, mBuf);
- CMCHKUNPK(cmUnpkLteRnti, ¶m->rntiCeModeBStart, mBuf);
- CMCHKUNPK(cmUnpkLteRnti, ¶m->rntiCeModeBRange, mBuf);
- CMCHKUNPK(oduPackUInt16, ¶m->size, mBuf);
-
+ CMCHKPK(oduUnpackUInt8, param->ccchCqi, mBuf);
return ROK;
}
-#endif
+
\f
/***********************************************************
*
-* Func : cmPkRgrDlCmnCodeRateCfg
+* Func : cmUnpkRgrUlCmnCodeRateCfg
*
*
-* Desc : Downlink common channel code rate configuration per cell
+* Desc : Uplink common channel code rate configuration per cell
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgrDlCmnCodeRateCfg
+S16 cmUnpkRgrUlCmnCodeRateCfg
(
-RgrDlCmnCodeRateCfg *param,
+RgrUlCmnCodeRateCfg *param,
Buffer *mBuf
)
{
- CMCHKPK(oduUnpackUInt8, param->ccchCqi, mBuf);
- CMCHKPK(oduUnpackUInt16, param->pdcchCodeRate, mBuf);
- CMCHKPK(oduUnpackUInt16, param->bcchPchRaCodeRate, mBuf);
+ CMCHKUNPK(oduPackUInt8, ¶m->ccchCqi, mBuf);
return ROK;
}
\f
/***********************************************************
*
-* Func : cmUnpkRgrDlCmnCodeRateCfg
+* Func : cmPkRgrUlTrgCqiCfg
*
*
-* Desc : Downlink common channel code rate configuration per cell
+* Desc : Target Uplink CQI to achieve through group power control configured per cell
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgrDlCmnCodeRateCfg
+S16 cmPkRgrUlTrgCqiCfg
(
-RgrDlCmnCodeRateCfg *param,
+RgrUlTrgCqiCfg *param,
Buffer *mBuf
)
{
-
- CMCHKUNPK(oduPackUInt16, ¶m->bcchPchRaCodeRate, mBuf);
- CMCHKUNPK(oduPackUInt16, ¶m->pdcchCodeRate, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->ccchCqi, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->trgCqi, mBuf);
return ROK;
}
\f
/***********************************************************
*
-* Func : cmPkRgrCfiCfg
+* Func : cmUnpkRgrUlTrgCqiCfg
*
*
-* Desc : Control Format Indicator (CFI) configuration per cell
+* Desc : Target Uplink CQI to achieve through group power control configured per cell
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmPkRgrCfiCfg
+S16 cmUnpkRgrUlTrgCqiCfg
(
-RgrCfiCfg *param,
+RgrUlTrgCqiCfg *param,
Buffer *mBuf
)
{
- CMCHKPK(oduUnpackUInt8, param->cfi, mBuf);
+
+ CMCHKUNPK(oduPackUInt8, ¶m->trgCqi, mBuf);
return ROK;
}
\f
/***********************************************************
*
-* Func : cmUnpkRgrCfiCfg
+* Func : cmPkRgrBwCfg
*
*
-* Desc : Control Format Indicator (CFI) configuration per cell
+* Desc : Bandwidth configuration per cell
*
*
* Ret : S16
* File :
*
**********************************************************/
-S16 cmUnpkRgrCfiCfg
+S16 cmPkRgrBwCfg
(
-RgrCfiCfg *param,
+RgrBwCfg *param,
Buffer *mBuf
)
{
- CMCHKUNPK(oduPackUInt8, ¶m->cfi, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->ulTotalBw, mBuf);
+ CMCHKPK(oduUnpackUInt8, param->dlTotalBw, mBuf);
return ROK;
}
-\f
-/***********************************************************
-*
-* Func : cmPkRgrPuschSubBandCfg
-*
-*
-* Desc : PUSCH sub-band configuration per cell
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkRgrPuschSubBandCfg
+#ifdef EMTC_ENABLE
+/* EMTC related pack changes start*/
+
+S16 cmPkRgrEmtcSiCfg
(
-RgrPuschSubBandCfg *param,
-Buffer *mBuf
-)
-{
-
- S32 i;
-
- for (i=param->numSubbands-1; i >= 0; i--) {
- CMCHKPK(oduUnpackUInt8, param->dmrs[i], mBuf);
- }
- CMCHKPK(oduUnpackUInt8, param->size, mBuf);
- CMCHKPK(oduUnpackUInt8, param->numSubbands, mBuf);
- CMCHKPK(oduUnpackUInt8, param->subbandStart, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkRgrPuschSubBandCfg
-*
-*
-* Desc : PUSCH sub-band configuration per cell
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkRgrPuschSubBandCfg
-(
-RgrPuschSubBandCfg *param,
-Buffer *mBuf
-)
-{
-
- S32 i;
- CMCHKUNPK(oduPackUInt8, ¶m->subbandStart, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->numSubbands, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->size, mBuf);
- for (i=0; i<param->numSubbands; i++) {
- CMCHKUNPK(oduPackUInt8, ¶m->dmrs[i], mBuf);
- }
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmPkRgrUlCmnCodeRateCfg
-*
-*
-* Desc : Uplink common channel code rate configuration per cell
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkRgrUlCmnCodeRateCfg
-(
-RgrUlCmnCodeRateCfg *param,
-Buffer *mBuf
-)
-{
- CMCHKPK(oduUnpackUInt8, param->ccchCqi, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkRgrUlCmnCodeRateCfg
-*
-*
-* Desc : Uplink common channel code rate configuration per cell
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkRgrUlCmnCodeRateCfg
-(
-RgrUlCmnCodeRateCfg *param,
-Buffer *mBuf
-)
-{
-
- CMCHKUNPK(oduPackUInt8, ¶m->ccchCqi, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmPkRgrUlTrgCqiCfg
-*
-*
-* Desc : Target Uplink CQI to achieve through group power control configured per cell
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkRgrUlTrgCqiCfg
-(
-RgrUlTrgCqiCfg *param,
-Buffer *mBuf
-)
-{
- CMCHKPK(oduUnpackUInt8, param->trgCqi, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkRgrUlTrgCqiCfg
-*
-*
-* Desc : Target Uplink CQI to achieve through group power control configured per cell
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkRgrUlTrgCqiCfg
-(
-RgrUlTrgCqiCfg *param,
-Buffer *mBuf
-)
-{
-
- CMCHKUNPK(oduPackUInt8, ¶m->trgCqi, mBuf);
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmPkRgrBwCfg
-*
-*
-* Desc : Bandwidth configuration per cell
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkRgrBwCfg
-(
-RgrBwCfg *param,
-Buffer *mBuf
-)
-{
-
- CMCHKPK(oduUnpackUInt8, param->ulTotalBw, mBuf);
- CMCHKPK(oduUnpackUInt8, param->dlTotalBw, mBuf);
- return ROK;
-}
-
-
-#ifdef EMTC_ENABLE
-/* EMTC related pack changes start*/
-
-S16 cmPkRgrEmtcSiCfg
-(
-RgrEmtcSiCfg *param,
+RgrEmtcSiCfg *param,
Buffer *mBuf
)
{
return ROK;
}
#endif /* RGR_V1 */
-/* rgr_c_001.main_4-ADD-Added for SI Enhancement. */
-#ifdef RGR_SI_SCH
-/***********************************************************
-*
-* Func : cmPkRgrSiCfgReq
-*
-*
-* Desc : SI Configuration Request from RRM to MAC for
-* configuring SI
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkRgrSiCfgReq
-(
-Pst* pst,
-SpId spId,
-RgrCfgTransId transId,
-RgrSiCfgReqInfo * cfgReqInfo
-)
-{
- Buffer *mBuf = NULLP;
-
-
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR045, (ErrVal)0, "Packing failed");
-#endif
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)cfgReqInfo,
- sizeof(RgrSiCfgReqInfo));
- return RFAILED;
- }
- if (cmPkRgrSiCfgReqInfo(cfgReqInfo, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR046, (ErrVal)0, "Packing failed");
-#endif
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)cfgReqInfo,
- sizeof(RgrSiCfgReqInfo));
- SPutMsg(mBuf);
- return RFAILED;
- }
- if (cmPkRgrCfgTransId(&transId, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR047, (ErrVal)0, "Packing failed");
-#endif
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)cfgReqInfo,
- sizeof(RgrSiCfgReqInfo));
- SPutMsg(mBuf);
- return RFAILED;
- }
- if (SPkS16(spId, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR048, (ErrVal)0, "Packing failed");
-#endif
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)cfgReqInfo,
- sizeof(RgrSiCfgReqInfo));
- SPutMsg(mBuf);
- return RFAILED;
- }
- if (SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)cfgReqInfo,
- sizeof(RgrSiCfgReqInfo)) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR049, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTRGRSICFGREQ;
- return (SPstTsk(pst,mBuf));
-}
-\f
-/***********************************************************
-*
-* Func : cmUnpkRgrSiCfgReq
-*
-*
-* Desc : SI Configuration Request from RRM to MAC for
-* configuring SI
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkRgrSiCfgReq
-(
-RgrSiCfgReq func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- SpId spId;
- RgrCfgTransId transId;
- RgrSiCfgReqInfo *cfgReqInfo;
-
-
- if (SUnpkS16(&spId, mBuf) != ROK) {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR050, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- if (cmUnpkRgrCfgTransId(&transId, mBuf) != ROK) {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR051, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- if ((SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data **)&cfgReqInfo,
- sizeof(RgrSiCfgReqInfo))) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR052, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
- memset(cfgReqInfo, 0, sizeof(RgrSiCfgReqInfo));
- if (pst->selector == ODU_SELECTOR_LC)
- if (cmUnpkRgrSiCfgReqInfo(cfgReqInfo, mBuf) != ROK) {
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)cfgReqInfo,
- sizeof(RgrSiCfgReqInfo));
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR053, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- SPutMsg(mBuf);
-
- return ((*func)(pst, spId, transId, cfgReqInfo));
-}
-
-/***********************************************************
-*
-* Func : cmPkRgrSiCfgReqInfo
-*
-*
-* Desc : Basic SI configuration/reconfiguration info at RRM
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkRgrSiCfgReqInfo
-(
-RgrSiCfgReqInfo *param,
-Buffer *mBuf
-)
-{
- /* ccpu00111328: S16 is renamed as MsgLen */
- MsgLen msgLen;
-
-
- CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
- CMCHKPK(SPkS32, param->cfgType, mBuf);
- CMCHKPK(oduUnpackUInt8, param->siId, mBuf);
-
- if(NULLP != param->pdu)
- {
- if (SFndLenMsg(param->pdu, &msgLen) != ROK)
- return RFAILED;
- if (SCatMsg(mBuf, param->pdu, M1M2) != ROK)
- return RFAILED;
- SPutMsg(param->pdu);
- CMCHKPK(cmPkMsgLen, msgLen, mBuf);
- }
- /*ccpu00140789*/
- else
- {
- CMCHKPK(cmPkMsgLen, 0, mBuf);
- }
-
- return ROK;
-}
-\f
-/***********************************************************
-*
-* Func : cmUnpkRgrSiCfgReqInfo
-*
-*
-* Desc : Basic SI configuration/reconfiguration info at RRM
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkRgrSiCfgReqInfo
-(
-RgrSiCfgReqInfo *param,
-Buffer *mBuf
-)
-{
- MsgLen msgLen, totalMsgLen;
- /*Merge from Mohit Changes*/
- S32 cfgType;
-
-
- SFndLenMsg(mBuf, &msgLen);
- if(msgLen > 0)
- {
- CMCHKUNPK(cmUnpkMsgLen, &msgLen, mBuf);
- /*ccpu00140789*/
- if(msgLen > 0)
- {
- if (SFndLenMsg(mBuf, &totalMsgLen) != ROK)
- return RFAILED;
- if (SSegMsg(mBuf, totalMsgLen-msgLen, ¶m->pdu) != ROK)
- return RFAILED;
- }
- else
- {
- param->pdu = NULLP;
- }
- }
-
- CMCHKUNPK(oduPackUInt8, ¶m->siId, mBuf);
- /*CMCHKUNPK(SUnpkS32, (S32 *)¶m->cfgType, mBuf);*/
- /*Merge from Mohit Changes*/
- CMCHKUNPK(SUnpkS32,(S32 *)&cfgType, mBuf);
- param->cfgType = (RgrSiCfgType) cfgType;
- CMCHKUNPK(cmUnpkLteCellId, ¶m->cellId, mBuf);
-
- return ROK;
-}
-
-
-\f
-/***********************************************************
-*
-* Func : cmPkRgrWarningSiCfgReq
-*
-*
-* Desc : SI Configuration Request from RRM to MAC for
-* configuring warning SI
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkRgrWarningSiCfgReq
-(
-Pst* pst,
-SpId spId,
-RgrCfgTransId transId,
-RgrWarningSiCfgReqInfo * warningSiCfgReqInfo
-)
-{
- Buffer *mBuf = NULLP;
-
-
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR061, (ErrVal)0, "Packing failed");
-#endif
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)warningSiCfgReqInfo,
- sizeof(RgrWarningSiCfgReqInfo));
- return RFAILED;
- }
-
- if (cmPkRgrWarningSiCfgReqInfo(pst, warningSiCfgReqInfo, mBuf) != ROK)
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR062, (ErrVal)0, "Packing failed");
-#endif
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)warningSiCfgReqInfo,
- sizeof(RgrWarningSiCfgReqInfo));
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- if (cmPkRgrCfgTransId(&transId, mBuf) != ROK)
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR063, (ErrVal)0, "Packing failed");
-#endif
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)warningSiCfgReqInfo,
- sizeof(RgrWarningSiCfgReqInfo));
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- if (SPkS16(spId, mBuf) != ROK)
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR064, (ErrVal)0, "Packing failed");
-#endif
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)warningSiCfgReqInfo,
- sizeof(RgrWarningSiCfgReqInfo));
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- /* if the application wants to retain this structure, the below
- * code should be removed */
- if (SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)warningSiCfgReqInfo,
- sizeof(RgrWarningSiCfgReqInfo)) != ROK)
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR065, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTRGRWARNINGSICFGREQ;
- return (SPstTsk(pst,mBuf));
-}/*cmPkRgrWarningSiCfgReq*/
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkRgrWarningSiCfgReq
-*
-*
-* Desc : SI Configuration Request from RRM to MAC for
-* configuring warning SI
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkRgrWarningSiCfgReq
-(
-RgrWarningSiCfgReq func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- SpId spId;
- RgrCfgTransId transId;
- RgrWarningSiCfgReqInfo *warningSiCfgReqInfo;
-
-
- if (SUnpkS16(&spId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR066, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
-
- if (cmUnpkRgrCfgTransId(&transId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR067, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
-
- if ((SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data **)&warningSiCfgReqInfo,
- sizeof(RgrWarningSiCfgReqInfo))) != ROK)
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR068, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
-
-
- if (pst->selector == ODU_SELECTOR_LC)
- {
- if (cmUnpkRgrWarningSiCfgReqInfo(pst, warningSiCfgReqInfo, mBuf) != ROK)
- {
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)warningSiCfgReqInfo,
- sizeof(RgrWarningSiCfgReqInfo));
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR069, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- }
- SPutMsg(mBuf);
-
- return ((*func)(pst, spId, transId, warningSiCfgReqInfo));
-} /* cmUnpkRgrWarningSiCfgReq */
-
-\f
-/***********************************************************
-*
-* Func : cmPkRgrWarningSiCfgReqInfo
-*
-*
-* Desc : Basic warning SI configuration/reconfiguration
-* info at RRM
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkRgrWarningSiCfgReqInfo
-(
-Pst *pst,
-RgrWarningSiCfgReqInfo *param,
-Buffer *mBuf
-)
-{
- MsgLen msgLen;
- uint32_t count;
- CmLList *node, *prevNode;
- RgrSegmentInfo *pdu;
-
-
- CMCHKPK(oduUnpackUInt8, param->emtcEnable, mBuf);
-
- CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
- CMCHKPK(oduUnpackUInt8, param->siId, mBuf);
-
- count = param->siPduLst.count;
- node = param->siPduLst.last;
- while (node)
- {
- pdu = (RgrSegmentInfo *)node->node;
- prevNode= node->prev;
- if(NULLP != pdu)
- {
- if (SFndLenMsg(pdu->pdu, &msgLen) != ROK)
- return RFAILED;
- if (SCatMsg(mBuf, pdu->pdu, M1M2) != ROK)
- return RFAILED;
- /* The PDU is not Released. This has to be done by
- * the caller of the packing function */
- CMCHKPK(cmPkMsgLen, msgLen, mBuf);
- SPutMsg(pdu->pdu);
- }
- cmLListDelFrm(¶m->siPduLst, node);
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)node, sizeof(RgrSegmentInfo));
- node= prevNode;
- }
- CMCHKPK(oduUnpackUInt32, count, mBuf);
- return ROK;
-}
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkRgrWarningSiCfgReqInfo
-*
-*
-* Desc : Unpack warning SI configuration info at SCH
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkRgrWarningSiCfgReqInfo
-(
-Pst *pst,
-RgrWarningSiCfgReqInfo *param,
-Buffer *mBuf
-)
-{
- MsgLen msgLen, totalMsgLen;
- uint32_t count, loopCnt;
- Buffer *pdu;
- CmLList *node;
-
-
- cmLListInit(¶m->siPduLst);
- CMCHKUNPK(oduPackUInt32, &count, mBuf);
- for (loopCnt=0; loopCnt<count; loopCnt++)
- {
- if(SFndLenMsg(mBuf, &msgLen) != ROK)
- {
- return RFAILED;
- }
-
- if(msgLen > 0)
- {
- CMCHKUNPK(cmUnpkMsgLen, &msgLen, mBuf);
- if (SFndLenMsg(mBuf, &totalMsgLen) != ROK)
- {
- return RFAILED;
- }
- if (SSegMsg(mBuf, totalMsgLen-msgLen, &pdu) != ROK)
- {
- return RFAILED;
- }
- }
- else
- {
- return RFAILED;
- }
- if ((SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data **)&node,
- sizeof(CmLList))) != ROK)
- return RFAILED;
- node->node = (PTR)pdu;
- cmLListAdd2Tail(¶m->siPduLst, node);
- }
-
- CMCHKUNPK(oduPackUInt8, ¶m->siId, mBuf);
- CMCHKUNPK(cmUnpkLteCellId, ¶m->cellId, mBuf);
- CMCHKPK(oduPackUInt8, ¶m->emtcEnable, mBuf);
-
- return ROK;
-}
-
-\f
-/***********************************************************
-*
-* Func : cmPkRgrWarningSiStopReq
-*
-* Desc : To stop the broadcast for SIB10, SIB11 and SIB12.
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-**********************************************************/
-S16 cmPkRgrWarningSiStopReq
-(
-Pst *pst,
-SpId spId,
-RgrCfgTransId transId,
-uint8_t siId
-)
-{
- Buffer *mBuf = NULLP;
-
-
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR070, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
-
- CMCHKPK(oduUnpackUInt8, siId, mBuf);
-
-
- if (cmPkRgrCfgTransId(&transId, mBuf) != ROK)
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR082, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
-
-
- if (SPkS16(spId, mBuf) != ROK)
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR071, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTRGRWARNINGSISTOPREQ;
- return (SPstTsk(pst,mBuf));
-}/*cmPkRgrWarningSiStopReq */
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkRgrWarningSiStopReq
-*
-* Desc : To stop the broadcast for SIB10, SIB11 and SIB12.
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-**********************************************************/
-S16 cmUnpkRgrWarningSiStopReq
-(
-RgrWarningSiStopReq func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- SpId spId;
- uint8_t siId;
- RgrCfgTransId transId;
-
-
- if (SUnpkS16(&spId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR072, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
-
- if (cmUnpkRgrCfgTransId(&transId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR083, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
-
- CMCHKUNPK(oduPackUInt8, &siId, mBuf);
-
- SPutMsg(mBuf);
-
- return ((*func)(pst, spId, transId, siId));
-} /*cmUnpkRgrWarningSiStopReq */
-
-\f
-/***********************************************************
-*
-* Func : cmPkRgrWarningSiCfgCfm
-*
-*
-* Desc : Warning SI Configuration Confirm from MAC to RRM
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkRgrWarningSiCfgCfm
-(
-Pst* pst,
-SuId suId,
-RgrCfgTransId transId,
-uint8_t siId,
-uint8_t status
-)
-{
- Buffer *mBuf = NULLP;
-
-
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR073, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
-
- if (oduUnpackUInt8(status, mBuf) != ROK)
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR074, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- if (oduUnpackUInt8(siId, mBuf) != ROK)
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR075, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- if (cmPkRgrCfgTransId(&transId, mBuf) != ROK)
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR076, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- if (SPkS16(suId, mBuf) != ROK)
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR077, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTRGRWARNINGSICFGCFM;
- return (SPstTsk(pst,mBuf));
-} /* cmPkRgrWarningSiCfgCfm */
-
-\f
-/***********************************************************
-*
-* Func : cmUnpkRgrwarningSiCfgCfm
-*
-*
-* Desc : Warning SI Configuration Confirm from MAC to RRM
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkRgrWarningSiCfgCfm
-(
-RgrWarningSiCfgCfm func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- SuId suId;
- uint8_t siId;
- RgrCfgTransId transId;
- uint8_t status;
-
-
- if (SUnpkS16(&suId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR078, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
-
- if (cmUnpkRgrCfgTransId(&transId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR079, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
-
- if (oduPackUInt8(&siId, mBuf) != ROK)
- {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR080, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
-
- if (oduPackUInt8(&status, mBuf) != ROK)
- {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR081, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- SPutMsg(mBuf);
- return ((*func)(pst, suId, transId, siId, status));
-}/* cmUnpkRgrwarningSiCfgCfm */
-#endif/*RGR_SI_SCH*/
-
-/* LTE_ADV_FLAG_REMOVED_START */
-/***********************************************************
-*
-* Func : cmPkRgrLoadInfReq
-*
-*
-* Desc : LOAD INF Configuration Request from RRM to MAC for
-* configuring RNTP, ABS etc
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkRgrLoadInfReq
-(
-Pst* pst,
-SpId spId,
-RgrCfgTransId transId,
-RgrLoadInfReqInfo * loadInfReq
-)
-{
- Buffer *mBuf = NULLP;
-
-
- if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
- {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR045, (ErrVal)0, "Packing failed");
-#endif
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)loadInfReq,
- sizeof(RgrLoadInfReqInfo));
- return RFAILED;
- }
- if (cmPkRgrLoadInfReqInfo(loadInfReq, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR046, (ErrVal)0, "Packing failed");
-#endif
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)loadInfReq,
- sizeof(RgrLoadInfReqInfo));
- SPutMsg(mBuf);
- return RFAILED;
- }
- if (cmPkRgrCfgTransId(&transId, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR047, (ErrVal)0, "Packing failed");
-#endif
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)loadInfReq,
- sizeof(RgrLoadInfReqInfo));
- SPutMsg(mBuf);
- return RFAILED;
- }
- if (SPkS16(spId, mBuf) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR048, (ErrVal)0, "Packing failed");
-#endif
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)loadInfReq,
- sizeof(RgrLoadInfReqInfo));
- SPutMsg(mBuf);
- return RFAILED;
- }
- if (SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)loadInfReq,
- sizeof(RgrLoadInfReqInfo)) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR049, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- pst->event = (Event) EVTRGRLOADINFREQ;
- return (SPstTsk(pst,mBuf));
-}
-\f
-/***********************************************************
-*
-* Func : cmUnpkRgrLoadInfReq
-*
-*
-* Desc : LOAD INF Configuration Request from RRM to MAC for
-* configuring RNTP, ABS etc
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkRgrLoadInfReq
-(
-RgrLoadInfReq func,
-Pst *pst,
-Buffer *mBuf
-)
-{
- SpId spId;
- RgrCfgTransId transId;
- RgrLoadInfReqInfo *loadInfReq;
-
-
- if (SUnpkS16(&spId, mBuf) != ROK) {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR050, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
-
- if (cmUnpkRgrCfgTransId(&transId, mBuf) != ROK) {
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR051, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
-
- if ((SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data **)&loadInfReq,
- sizeof(RgrLoadInfReqInfo))) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR052, (ErrVal)0, "Packing failed");
-#endif
- SPutMsg(mBuf);
- return RFAILED;
- }
-
- memset(loadInfReq, 0, sizeof(RgrLoadInfReqInfo));
-
- if (pst->selector == ODU_SELECTOR_LC)
- if (cmUnpkRgrLoadInfReqInfo(loadInfReq, mBuf) != ROK) {
- SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)loadInfReq,
- sizeof(RgrLoadInfReqInfo));
- SPutMsg(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
- SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
- __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
- (ErrVal)ERGR053, (ErrVal)0, "Packing failed");
-#endif
- return RFAILED;
- }
- SPutMsg(mBuf);
-
- return ((*func)(pst, spId, transId, loadInfReq));
-}
-
-/***********************************************************
-*
-* Func : cmPkRgrLoadInfReqInfo
-*
-*
-* Desc : Basic LOAD INF configuration/reconfiguration info at RRM
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmPkRgrLoadInfReqInfo
-(
-RgrLoadInfReqInfo *param,
-Buffer *mBuf
-)
-{
-
- CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
- CMCHKPK(oduUnpackUInt8, param->rgrCcPHighStartRb, mBuf);
- CMCHKPK(oduUnpackUInt8, param->rgrCcPHighEndRb, mBuf);
-
- return ROK;
-}
-\f
-/***********************************************************
-*
-* Func : cmUnpkRgrLoadInfReqInfo
-*
-*
-* Desc : Basic LOAD INF configuration/reconfiguration info at RRM
-*
-*
-* Ret : S16
-*
-* Notes:
-*
-* File :
-*
-**********************************************************/
-S16 cmUnpkRgrLoadInfReqInfo
-(
-RgrLoadInfReqInfo *param,
-Buffer *mBuf
-)
-{
-
- CMCHKUNPK(oduPackUInt8, ¶m->rgrCcPHighEndRb, mBuf);
- CMCHKUNPK(oduPackUInt8, ¶m->rgrCcPHighStartRb, mBuf);
- CMCHKUNPK(cmUnpkLteCellId, ¶m->cellId, mBuf);
-
- return ROK;
-}
-/* LTE_ADV_FLAG_REMOVED_END */
/*rgr_c_001.main_9 ccpu00117452 - MOD - Changed macro name from
RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
#define RGR_CFG_CFM_TX_COMPLETE 0x01 /*!< Negative confirmation: configuration failed */
/* Event corresponding to each primitive at this interface */
-#define EVTRGRBNDREQ 1 /*!< Bind Request */
-#define EVTRGRBNDCFM 2 /*!< Bind Confirm */
-#define EVTRGRUBNDREQ 3 /*!< Unbind Request */
#define EVTMACSCHCFGCFM 5 /*!< Configuration Confirm */
/* rgr_h_001.main_2: Added TTI indication from MAC to RGR user */
/** @name RGR_RRM_TICK */
/** @{ */
#define EVTRGRTTIIND 6 /*!< TTI Tick to RRM */
-/** @} */
-/* rgr_h_001.main_3-ADD-Added for SI Enhancement. */
-/** @name RGR_SI_SCH */
-/** @{ */
-#ifdef RGR_SI_SCH
-#define EVTRGRSICFGREQ 7 /*!< SI Configuration Request */
-#define EVTRGRSICFGCFM 8 /*!< SI Configuration Confirm */
-#endif /*RGR_SI_SCH*/
-/** @} */
/*rgr_h_001.main_8 ADD added changes for CQI Management*/
/** @name RGR_CQI_REPT */
/** @{ */
/** @} */
#define EVTRGRUESTAIND 10 /*!< RGR UE Status Indication */
-#ifdef RGR_SI_SCH
-#define EVTRGRWARNINGSICFGREQ 11 /*!< Warning SI Configuration Request */
-#define EVTRGRWARNINGSISTOPREQ 12 /*!< Warning SI Stop Request */
-#define EVTRGRWARNINGSICFGCFM 13 /*!< Warning SI Configuration Confirm */
-#endif /*RGR_SI_SCH*/
-/** @} */
-
/** @{ */
/* LTE_ADV_FLAG_REMOVED_START */
#define EVTRGRLOADINFIND 14 /*!< LOAD INF Indication (SCTP -> SCH -> APP) (Received at X2AP)*/
-#define EVTRGRLOADINFREQ 15 /*!< LOAD INF Request (APP -> MAC -> SCTP) (To Remote X2AP) */
/* LTE_ADV_FLAG_REMOVED_END */
/** @} */
/* Activation time limit in terms of number of frames */
} RgrTtiIndInfo;
/** @} */
-/* rgr_x_001.main_5-ADD-Added for SI Enhancement. */
-/** @name RGR_SI_SCH */
-/** @{ */
-#ifdef RGR_SI_SCH
-/** @brief This structure contains parameters used for specifying SI
- * configuration to MAC-Scheduler by RRM as a part of primitive
- * RgUiRgrSiCfgReq.
- */
-typedef struct rgrSiCfgReqInfo
-{
- CmLteCellId cellId; /*! Cell Id */
- RgrSiCfgType cfgType; /*! MIB/SIB1/SI */
- uint8_t siId; /*! SI ID, if cfgType is SI.
- SI ID starts from 1 */
- Buffer *pdu; /*! PDU, one of MIB/SIB1/SI */
-}RgrSiCfgReqInfo;
-
-/** @brief This structure contains parameters used for specifying SI
- * configuration to MAC-Scheduler by RRM as a part of primitive
- * RgUiRgrWarningSiCfgReq.
- */
-typedef struct rgrWarningSiCfgReqInfo
-{
- uint8_t emtcEnable; /*! indicates EMTC enabled or not */
- CmLteCellId cellId; /*! Cell Id */
- uint8_t siId; /*! SI ID */
- CmLListCp siPduLst; /*! list of PDUs,each corresponding to one segment*/
-}RgrWarningSiCfgReqInfo;
-
-typedef struct rgrSegmentInfo
-{
- CmLList cmasSegPduLstLnk;
- Buffer* pdu;
-}RgrSegmentInfo;
-
-
-#endif /*RGR_SI_SCH*/
-
#define RGR_UESTA_MAC_CRNTI_CE_RECVD 0x01
#define RGR_UESTA_MAC_CRNTI_CE_RECVD_IN_SPS_ACTIVE 0x02
/**
}RgrUeStaIndInfo;
/** @} */
-/** @{ */
-/* LTE_ADV_FLAG_REMOVED_START */
-/** @brief This structure contains parameters used for specifying Load Inf
- * i.e RNTP, ABS etc configuration to MAC-Scheduler by RRM as a part of primitive
- * RgUiRgrLoadInfReq.
- */
-typedef struct rgrLoadInfReqInfo
-{
- CmLteCellId cellId; /*! Cell Id */
- uint8_t rgrCcPHighStartRb; /*! Start RB for power high cell centre user */
- uint8_t rgrCcPHighEndRb; /*! End RB for power high cell centre use */
-}RgrLoadInfReqInfo;
-/* LTE_ADV_FLAG_REMOVED_END */
-/** @} */
-
/*
Function Prototypes
*/
uint8_t status));
/* rgr_x_001.main_5-ADD-Added for SI Enhancement. */
-/** @name RGR_SI_SCH */
-/** @{ */
-#ifdef RGR_SI_SCH
-/** @brief SI Configuration Request primitive for SI configuration
- *
- * @details This API is used to configure the System Information from RRM to a MAC scheduler.
- *
- * @param[in] pst Pointer to the Post Structure.
- * @param[in] spId SAP Id of the Service Provider.
- * @param[in] transId Transaction Id for the transaction between RRM and MAC.
- * @param[in] siCfgReq Parameters for the configuration.
- * @return ROK/RFAILED
- */
-typedef S16 (*RgrSiCfgReq) ARGS((
- Pst *pst,
- SpId spId,
- RgrCfgTransId transId,
- RgrSiCfgReqInfo *siCfgReq));
-
-/** @brief SI Configuration Confirm Primitive for configuring Cell/UE/LC
- *
- * @details This API confirms the SI configuration confirm in the status indication.
- *
- * @param[in] pst Pointer to a post structure.
- * @param[in] suId SAP Id of the Service User.
- * @param[in] transId Transaction Id between the MAC and The RRM.
- * @param[in] status Confirmation status information from the MAC to the user.
- * @return ROK/RFAILED.
- */
-typedef S16 (*RgrSiCfgCfm) ARGS((
- Pst* pst,
- SuId suId,
- RgrCfgTransId transId,
- uint8_t status));
-
-/** @brief SI Configuration Request primitive for warning SI configuration
- *
- * @details This API is used to configure the System Info (SIB10,SIB11,SIB12)
- * from RRM to a MAC scheduler.
- *
- * @param[in] pst Pointer to the Post Structure.
- * @param[in] spId SAP Id of the Service Provider.
- * @param[in] transId Transaction Id between the MAC and The RRM.
- * @param[in] WarningsiCfgReq Parameters for the configuration.
- * @return ROK/RFAILED
- */
-typedef S16 (*RgrWarningSiCfgReq) ARGS((
- Pst *pst,
- SpId spId,
- RgrCfgTransId transId,
- RgrWarningSiCfgReqInfo *warningSiCfgReq));
-
-
-/** @brief Warning SI Configuration Confirm Primitive
- *
- * @details This API confirms the Warning SI configuration confirm in the
- * status indication.
- *
- * @param[in] pst Pointer to a post structure.
- * @param[in] suId SAP Id of the Service User.
- * @param[in] transId Transaction Id between the MAC and The RRM.
- * @param[in] siId SI ID
- * @param[in] status Confirmation status information from the MAC to the user.
- * @return ROK/RFAILED.
- */
-typedef S16 (*RgrWarningSiCfgCfm) ARGS((
- Pst* pst,
- SuId suId,
- RgrCfgTransId transId,
- uint8_t siId,
- uint8_t status));
-
-/** @brief SI Configuration stop Request primitive for warning SI configuration
- *
- * @details Used to stop the System Information(SIB10, SIB11, SIB12) from RRM
- * to a MAC schedule
- *
- * @param[in] pst Pointer to the Post Structure.
- * @param[in] spId SAP Id of the Service Provider.
- * @param[in] siId siId to be stopped.
- * @return ROK/RFAILED
- */
-typedef S16 (*RgrWarningSiStopReq) ARGS((
- Pst *pst,
- SpId spId,
- RgrCfgTransId transId,
- uint8_t siId ));
-
-#endif /*RGR_SI_SCH*/
-
-/** @{ */
-/* LTE_ADV_FLAG_REMOVED_START */
-/** @brief LOAD INF Configuration Request primitive for RNTP, ABS etc Configuration
- *
- * @details This API is used to configure the LOAD INF parameters from RRM to a MAC scheduler.
- *
- * @param[in] pst Pointer to the Post Structure.
- * @param[in] spId SAP Id of the Service Provider.
- * @param[in] transId Transaction Id for the transaction between RRM and MAC.
- * @param[in] loadInfReq Parameters for the configuration.
- * @return ROK/RFAILED
- */
-typedef S16 (*RgrLoadInfReq) ARGS((
- Pst *pst,
- SpId spId,
- RgrCfgTransId transId,
- RgrLoadInfReqInfo *loadInfReq));
-/* LTE_ADV_FLAG_REMOVED_END */
-/** @} */
-
/* rgr_x_001.main_11 ccpu00117452 - MOD - Changed macro name from
RGR_RRM_DLPWR_CNTRL to RGR_CQI_REPT */
#ifdef RGR_CQI_REPT
RgrUeStaIndInfo *staInd));
#ifdef RG
-/** @brief Request from RRM to MAC to bind the interface SAPs.
- *
- * @details This API is invoked by RRM towards MAC to bind RGR SAP.
- * This API validates the Pst, spId, suId and sends the bind confirm to
- * RRM.
- *
- *@param[in] pst Pointer to a post structure.
- *@param[in] suId SAP Id of the Service User.
- *@param[in] spId SAP Id of the Service Provider.
- *@return ROK/RFAILED
-*/
-S16 RgUiRgrBndReq ARGS((
- Pst* pst,
- SuId suId,
- SpId spId
-));
/* rgr_x_001.main_3: Added TTI indication from MAC to RGR user */
/** @name RGR_RRM_TICK */
/** @{ */
));
#endif /* LTE_ADV */
#ifdef RG
-/** @brief Confirmation from MAC to RRM for the bind request.
-*
-* @details Confirmation from MAC to RRM for the bind
-* request for the interface saps. This function indicates it through the status To the User.
-*
-* @param[in] pst Pointer to a post structure.
-* @param[in] suId SAP Id of the Service User.
-* @param[in] status Confirmation status for the RGR User.
-* @return ROK/RFAILED
-*/
-S16 RgUiRgrBndCfm ARGS((
- Pst* pst,
- SuId suId,
- uint8_t status
-));
-
-/** @brief Request from RRM to MAC to unbind the interface SAPs.
- *
- * @details This API is invoked by RRM towards MAC to unbind RGR SAP.
- * This API validates the Pst, spId, suId and sends the unbdind confirm to
- *
- * @param[in] pst Pointer To a post structure.
- * @param[in] spId Service provider SAP Id.
- * @param[in] reason Cause for the Unbinding.
- * @return ROK/RFAILED.
- */
-S16 RgUiRgrUbndReq ARGS((
- Pst* pst,
- SpId spId,
- Reason reason
-));
/** @brief Configuration Confirm from MAC to RRM.
*
RgrCfgTransId transId,
uint8_t status
));
-/* rgr_x_001.main_5-ADD-Added for SI Enhancement. */
-/** @name RGR_SI_SCH */
-/** @{ */
-#ifdef RGR_SI_SCH
-/** @brief SI Configuration Request primitive used for SI configuration
- * from RRM to MAC-Scheduler.
- *
- * @details This primitive specifies the PDU
- * (MIB/SIB1/SIs) and the associated parameters in the structure
- * RgrSiCfgReqInfo.
- *
- * @param[in] pst Pointer to a post Structure.
- * @param[in] spId SAP Id of the Service provider.
- * @param[in] transId RRM to MAC transaction Id.
- * @param[in] siCfgReq Parameters used for specifying SI.
- * @return ROK/RFAILED
- */
-S16 RgUiRgrSiCfgReq ARGS((
- Pst *pst,
- SpId spId,
- RgrCfgTransId transId,
- RgrSiCfgReqInfo *siCfgReq
-));
-
-/** @brief SI Configuration Confirm from MAC to RRM.
- *
- * @details This primitive is used to confirm the SI configuration to RRM from MAC.
- *
- * @param[in] pst Pointer to a post structure
- * @param[in] suId Service User SAP Id
- * @param[in] transId Transaction id between RRM and MAC
- * @param[in] status Confirmation status .
- * @return ROK/RFAILED
- */
-S16 RgUiRgrSiCfgCfm ARGS((
- Pst* pst,
- SuId suId,
- RgrCfgTransId transId,
- uint8_t status
-));
-
-/** @brief SI Configuration Confirm from MAC to RRM.
- *
- * @details This primitive is used to confirm the SI configuration to RRM
- * from MAC.
- *
- * @param[in] pst Pointer to a post structure
- * @param[in] suId Service User SAP Id
- * @param[in] transId Transaction id between RRM and MAC
- * @param[in] status Confirmation status .
- * @return ROK/RFAILED
- */
-S16 RgUiRgrWarningSiCfgReq ARGS((
- Pst *pst,
- SpId spId,
- RgrCfgTransId transId,
- RgrWarningSiCfgReqInfo *WarningSiCfgReqInfo
-));
-
-
-/** @brief Warning SI Configuration Confirm from MAC to RRM.
- *
- * @details This primitive is used to confirm the Warning SI configuration
- * to RRM from MAC.
- *
- * @param[in] pst Pointer to a post structure
- * @param[in] suId Service User SAP Id
- * @param[in] transId Transaction id between RRM and MAC
- * @param[in] siId SI ID.
- * @param[in] status Confirmation status .
- * @return ROK/RFAILED
- */
-S16 RgUiRgrWarningSiCfgCfm ARGS((
- Pst* pst,
- SuId suId,
- RgrCfgTransId transId,
- uint8_t siId,
- uint8_t status
-));
-
-/** @brief SI Configuration Confirm from MAC to RRM.
- *
- * @details This primitive is used to confirm the SI configuration to RRM
- * from MAC.
- *
- * @param[in] pst Pointer to a post structure
- * @param[in] spId Service Provider SAP Id
- * @param[in] siId SI Index
- * @return ROK/RFAILED
- */
-S16 RgUiRgrWarningSiStopReq ARGS((
- Pst *pst,
- SpId spId,
- RgrCfgTransId transId,
- uint8_t siId
-));
-
-#endif /*RGR_SI_SCH*/
-/** @} */
-
-/** @{ */
-/* LTE_ADV_FLAG_REMOVED_START */
-/** @brief LOAD INF Configuration Request primitive used for RNTP, ABS configuration
- * from RRM to MAC-Scheduler.
- *
- * @details This primitive specifies the startRb and endRb of CC sub-band for which
- * we have to increase power at schedular
- *
- *
- * @param[in] pst Pointer to a post Structure.
- * @param[in] spId SAP Id of the Service provider.
- * @param[in] transId RRM to MAC transaction Id.
- * @param[in] loadInfReq Parameters used for specifying LOAD INF.
- * @return ROK/RFAILED
- */
-S16 RgUiRgrLoadInfReq ARGS((
- Pst *pst,
- SpId spId,
- RgrCfgTransId transId,
- RgrLoadInfReqInfo *loadInfReq
-));
-/* LTE_ADV_FLAG_REMOVED_END */
-/** @} */
/** @name RGR_CQI_REPT */
/** @{ */
RgrCfgTransId transId,
uint8_t status
));
-/* rgr_x_001.main_5-ADD-Added for SI Enhancement. */
-/** @name RGR_SI_SCH */
-/* @{ */
-#ifdef RGR_SI_SCH
-
-/** @brief SI Configuration confirm from MAC to RRM
-*
-* @details This primitive confirms the SI configuration to the RRM.
-*
-* @param[in] Pst* pst A pointer to post structure.
-* @param[in] SuId suId Service User SAP Id.
-* @param[in] RgrCfgTransId transId RRM to MAC transaction Id
-* @param[in] uint8_t status An information on confirmation status.
-* @return S16
-*/
-S16 NxLiRgrSiCfgCfm ARGS((
- Pst* pst,
- SuId suId,
- RgrCfgTransId transId,
- uint8_t status
-));
-
-
-/* PH04_CMAS */
-S16 NxLiRgrWrngSiCfgCfm ARGS((
-Pst* pst,
-SuId suId,
-RgrCfgTransId transId,
-uint8_t siId,
-uint8_t status
-));
-
-
-
-S16 NxLiRgrStopWrngSiCfgCfm ARGS((
- Pst* pst,
- SuId suId,
- RgrCfgTransId transId,
- uint8_t status
-));
-
-/* PH04_CMAS : end */
-
-
-/** @brief Warning SI Configuration confirm from MAC to RRM
-*
-* @details This primitive confirms the Warning SI configuration to the RRM.
-*
-* @param[in] Pst* pst A pointer to post structure.
-* @param[in] SuId suId Service User SAP Id.
-* @param[in] uint8_t siId SI Index
-* @param[in] RgrCfgTransId transId RRM to MAC transaction Id
-* @param[in] uint8_t status An information on confirmation status.
-* @return S16
-*/
-S16 NxLiRgrWarningSiCfgCfm ARGS((
- Pst* pst,
- SuId suId,
- RgrCfgTransId transId,
- uint8_t siId,
- uint8_t status
-));
-
-/** @brief SI Configuration request from RRM to MAC for
- * configuring SI
- *
- * @details This primitive is used for the configuration of the SI information in the MAC scheduler.
- *
- * @param[in] Pst* pst A pointer to post structure.
- * @param[in] SpId spId Service Provider SAP Id.
- * @param[in] RgrCfgTransId transId, RRM to MAC transaction Id
- * @param[in] RgrSiCfgReqInfo* cfgReqInfo Parameters corresponding to the SI Configuration .
- * @return S16
- */
-S16 NxLiRgrSiCfgReq ARGS((
- Pst* pst,
- SpId spId,
- RgrCfgTransId transId,
- RgrSiCfgReqInfo * cfgReqInfo
-));
-
-
-/** @brief Warning SI Configuration request from RRM to MAC for
- * configuring SI
- *
- * @details This primitive is used for the configuration of the SI
- * information in the MAC scheduler.
- *
- * @param[in] Pst* pst A pointer to post structure.
- * @param[in] SpId spId Service Provider SAP Id.
- * @param[in] RgrCfgTransId transId, RRM to MAC transaction Id
- * @param[in] RgrWarningSiCfgReqInfo *warningSiCfgReq SI Configuration
- * @return S16
- */
-S16 NxLiRgrWarningSiCfgReq ARGS((
- Pst* pst,
- SpId spId,
- RgrCfgTransId transId,
- RgrWarningSiCfgReqInfo *warningSiCfgReq
-));
-
-
-/** @brief Warning SI Stop request from RRM to MAC for
- * configuring SI
- *
- * @details This primitive is used to stop the SI for a
- * perticular siId.
- *
- * @param[in] Pst* pst A pointer to post structure.
- * @param[in] SpId spId Service Provider SAP Id.
- * @param[in] uint8_t siId SI Index
- */
-S16 NxLiRgrWarningSiStopReq ARGS((
- Pst* pst,
- SpId spId,
- RgrCfgTransId transId,
- uint8_t siId
-));
-
-#endif/*RGR_SI_SCH */
-/** @} */
-
-/** @{ */
-/* LTE_ADV_FLAG_REMOVED_START */
-/** @brief LOAD INF Configuration request from RRM to MAC for
- * configuring rntp, abs etc
- *
- * @details This primitive is used for the configuration of the LOAD INF parameters
- * in the MAC scheduler.
- *
- * @param[in] Pst* pst A pointer to post structure.
- * @param[in] SpId spId Service Provider SAP Id.
- * @param[in] RgrCfgTransId transId, RRM to MAC transaction Id
- * @param[in] RgrLoadInfReqInfo* loadInfReq Parameters corresponding to the LOAD INF Config.
- * @return S16
- */
-S16 NxLiRgrLoadInfReq ARGS((
- Pst* pst,
- SpId spId,
- RgrCfgTransId transId,
- RgrLoadInfReqInfo* loadInfReq
-));
-/* LTE_ADV_FLAG_REMOVED_END */
-/** @} */
/** @name RGR_CQI_REPT */
/** @{ */
#endif
#if defined(LCRGR)
-/** @brief Request from RRM to MAC to bind the interface SAPs */
-S16 cmPkRgrBndReq ARGS((
- Pst* pst,
- SuId suId,
- SpId spId
-));
-/** @brief Request from RRM to MAC to bind the interface SAPs */
-S16 cmUnpkRgrBndReq ARGS((
- RgrBndReq func,
- Pst* pst,
- Buffer *mBuf
-));
/* rgr_x_001.main_3: Added TTI indication from MAC to RGR user */
/** @name RGR_RRM_TICK */
/** @{ */
Buffer *mBuf
));
/** @} */
-S16 cmPkRgrBndCfm ARGS((
- Pst* pst,
- SuId suId,
- uint8_t status
-));
-
-S16 cmUnpkRgrBndCfm ARGS((
- RgrBndCfm func,
- Pst* pst,
- Buffer *mBuf
-));
-
-S16 cmPkRgrUbndReq ARGS((
- Pst* pst,
- SpId spId,
- Reason reason
-));
-
-S16 cmUnpkRgrUbndReq ARGS((
- RgrUbndReq func,
- Pst* pst,
- Buffer *mBuf
-));
-
S16 cmPkRgrCfgReq ARGS((
Pst* pst,
RgrCfgTransId transId,
Buffer *mBuf
));
-/* rgr_x_001.main_5-ADD-Added for SI Enhancement. */
-/** @name RGR_SI_SCH */
-/** @{ */
-#ifdef RGR_SI_SCH
-S16 cmPkRgrWarningSiCfgReq ARGS((
- Pst* pst,
- SpId spId,
- RgrCfgTransId transId,
- RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
-));
-
-S16 cmUnpkRgrWarningSiCfgReq ARGS((
- RgrWarningSiCfgReq func,
- Pst *pst,
- Buffer *mBuf
-));
-
-S16 cmPkRgrWarningSiCfgReqInfo ARGS((
- Pst *pst,
- RgrWarningSiCfgReqInfo *param,
- Buffer *mBuf
-));
-
-S16 cmUnpkRgrWarningSiCfgReqInfo ARGS((
- Pst *pst,
- RgrWarningSiCfgReqInfo *param,
- Buffer *mBuf
-));
-
-S16 cmPkRgrWarningSiStopReq ARGS((
- Pst *pst,
- SpId spId,
- RgrCfgTransId transId,
- uint8_t siId
-));
-
-S16 cmUnpkRgrWarningSiStopReq ARGS((
- RgrWarningSiStopReq func,
- Pst *pst,
- Buffer *mBuf
-));
-
-
-S16 cmPkRgrWarningSiCfgCfm ARGS((
- Pst* pst,
- SuId suId,
- RgrCfgTransId transId,
- uint8_t siId,
- uint8_t status
-));
-
-S16 cmUnpkRgrWarningSiCfgCfm ARGS((
- RgrWarningSiCfgCfm func,
- Pst* pst,
- Buffer *mBuf
-));
-
-
-S16 cmPkRgrSiCfgReq ARGS((
- Pst* pst,
- SpId spId,
- RgrCfgTransId transId,
- RgrSiCfgReqInfo * cfgReqInfo
-));
-
-S16 cmUnpkRgrSiCfgReq ARGS((
- RgrSiCfgReq func,
- Pst* pst,
- Buffer *mBuf
-));
-
-S16 cmPkRgrSiCfgReqInfo ARGS((
- RgrSiCfgReqInfo *param,
- Buffer *mBuf
-));
-
-S16 cmUnpkRgrSiCfgReqInfo ARGS((
- RgrSiCfgReqInfo *param,
- Buffer *mBuf
-));
-
-S16 cmPkRgrSiCfgCfm ARGS((
- Pst* pst,
- SuId suId,
- RgrCfgTransId transId,
- uint8_t status
-));
-
-S16 cmUnpkRgrSiCfgCfm ARGS((
- RgrSiCfgCfm func,
- Pst* pst,
- Buffer *mBuf
-));
-#endif /*RGR_SI_SCH*/
-/** @} */
-
-/** @{ */
-/* LTE_ADV_FLAG_REMOVED_START */
-S16 cmPkRgrLoadInfReq ARGS((
- Pst* pst,
- SpId spId,
- RgrCfgTransId transId,
- RgrLoadInfReqInfo * loadInfReq
-));
-
-S16 cmUnpkRgrLoadInfReq ARGS((
- RgrLoadInfReq func,
- Pst* pst,
- Buffer *mBuf
-));
-
-S16 cmPkRgrLoadInfReqInfo ARGS((
- RgrLoadInfReqInfo *param,
- Buffer *mBuf
-));
-
-S16 cmUnpkRgrLoadInfReqInfo ARGS((
- RgrLoadInfReqInfo *param,
- Buffer *mBuf
-));
-/* LTE_ADV_FLAG_REMOVED_END */
-/** @} */
/** @name LTE_TDD */
/** @{ */
Buffer *mBuf
));
-#ifdef RLC_MAC_DAT_REQ_RBUF
-S16 rgDlDatReqBatchProc ARGS((
-Void));
-#endif
-#ifdef RLC_MAC_STA_RSP_RBUF
-S16 rgDlStaRspBatchProc ARGS((
-Void));
-#endif
#ifdef __cplusplus
}
#endif
#define EVTRGUBNDREQ 1 /*!< Bind Request */
#define EVTRGUUBNDREQ 2 /*!< Un-Bind Request */
#define EVTRGUBNDCFM 3 /*!< Bind Confirm */
-#define EVTRGUCDATREQ 4 /*!< Common Channel Data Request */
#define EVTRGUCDATIND 5 /*!< Common Channel Data Indication */
-#define EVTRGUDDATREQ 6 /*!< Dedicated Channel Data Request */
#define EVTRGUDDATIND 7 /*!< Dedicated Channel Data Indication */
#define EVTRGUCSTARSP 8 /*!< Common Channel status response */
#define EVTRGUCSTAIND 9 /*!< Common Channel status Indication */
-#define EVTRGUDSTARSP 10 /*!< Dedicated Channel status response */
#define EVTRGUDSTAIND 11 /*!< Dedicated Channel status Indication */
/*rgu_h_001.main_5 - ADD - L2M Support */
#ifdef LTE_L2_MEAS
* @return ROK/RFAILED
*/
S16 RgUiRguBndCfm ARGS((Pst* pst,SuId suId,uint8_t status));
-/** @brief Data Request from RLC to MAC for forwarding SDUs on common
- * channel for transmission
- * @param pst Pointer to the post structure.
- * @param spId SAP ID of the service provider.
- * @param datReq Data request for common channels (BCCH, PCCH and CCCH).
- * @return ROK/RFAILED
-*/
-S16 RgUiRguCDatReq ARGS((Pst* pst,SpId spId,RguCDatReqInfo *datReq));
-/** @brief Data Request from RLC to MAC for forwarding SDUs on
- * dedicated channel for transmission
- * @param pst Pointer to the post structure.
- * @param spId SAP ID of the service provider.
- * @param datReq Data request for dedicated channels (DCCH and DTCH).
- * @return ROK/RFAILED
-*/
-S16 RgUiRguDDatReq ARGS((Pst* pst,SpId spId,RguDDatReqInfo *datReq));
/** @brief Data Indication from MAC to RLC to
* forward the data received for common channels
* @return ROK/RFAILED
*/
S16 RgUiRguDDatInd ARGS((Pst* pst,SuId suId,RguDDatIndInfo *datInd));
-/** @brief Status Response from RLC to MAC to
- * inform the BO report for common channels
- * @param pst Pointer to the post structure.
- * @param spId SAP ID of the service provider.
- * @param staRsp Status response for common channels (BCCH, PCCH and CCCH).
- * @return ROK/RFAILED
-*/
-S16 RgUiRguCStaRsp ARGS((Pst* pst,SpId spId,RguCStaRspInfo *staRsp));
-/** @brief Status Response from RLC to MAC to
- * inform the BO report for dedicated channels
- * @param pst Pointer to the post structure.
- * @param spId SAP ID of the service provider.
- * @param staRsp Status response for dedicated channels (DCCH and DTCH).
- * @return ROK/RFAILED
-*/
-S16 RgUiRguDStaRsp ARGS((Pst* pst,SpId spId,RguDStaRspInfo *staRsp));
/** @brief Status Indication from MAC to RLC
* as a response to the staRsp primitive from RLC.
DU_LOG("\nERROR --> F1AP : BuildAndSendPagingMsg(): DuDb is empty");
return ret;
}
+ if(duDb->numCells == 0)
+ {
+ DU_LOG("\nERROR --> F1AP : BuildAndSendPagingMsg(): No CELL is UP!");
+ return ret;
+ }
while(true)
{
return ROK;
}
+#ifdef CALL_FLOW_DEBUG_LOG
/**************************************************************************
* @brief Function prints the src dest and msg reached to egtp.
*
}
DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);
}
+#endif
/**************************************************************************
* @brief Task Activation callback function.
}
+#ifdef CALL_FLOW_DEBUG_LOG
/**************************************************************************
* @brief Function prints the src dest and msg reached to egtp.
*
strcpy(message,"EVTLRGCFGCFM");
break;
}
- case EVTLRGCNTRLCFM:
- {
- strcpy(message,"EVTLRGCNTRLCFM");
- break;
- }
case EVTMACSCHGENCFGCFM:
{
strcpy(message,"EVTMACSCHGENCFGCFM");
}
DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);
}
+#endif
+
/**************************************************************************
* @brief Task Activation callback function.
*
ret = cmUnpkLrgCfgCfm(duHdlMacCfgComplete, pst, mBuf);
break;
}
- case EVTLRGCNTRLCFM:
- {
- break;
- }
case EVTMACSCHGENCFGCFM:
{
ret = cmUnpkLrgSchCfgCfm(duHdlSchCfgComplete, pst, mBuf);
#include <hugetlbfs.h>
#endif
-#if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_STA_RSP_RBUF)
-S16 rgBatchProc (Void);
-#endif
-#ifdef RLC_MAC_DAT_REQ_RBUF
-S16 rgDlDatReqBatchProc ARGS((
- Void));
-#endif
-#if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_STA_RSP_RBUF)
-S16 rgBatchProc ARGS((
- Void));
-#endif
-
#ifdef TENB_T2K3K_SPECIFIC_CHANGES
/* general purpose debug zone */
char my_buffer2[4096 * 4] = { 0 };
#endif
/* get a message from the demand queue */
/* RT Processing */
-#ifdef RLC_MAC_DAT_REQ_RBUF
- rgDlDatReqBatchProc();
-#endif
ret = mtTskHdlMsg(sTsk);
if (ret != ROK)
/* exit the for loop here */
break;
}
-#if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_STA_RSP_RBUF)
- rgBatchProc();
-#endif
}
return (NULLP);
return ROK;
}
+#ifdef CALL_FLOW_DEBUG_LOG
/**************************************************************************
* @brief Function prints the src dest and msg reached to egtp.
*
}
DU_LOG("\nCall Flow: %s -> %s : %s\n", sourceTask, destTask, message);
}
+#endif
+
/*******************************************************************
*
* @brief Receives messages for Phy stub slot indication generator task