1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /************************************************************************
25 Desc: C source code for Entry point fucntions
29 **********************************************************************/
31 /** @file rg_sch_tom.c
32 @brief This module does processing related to handling of lower interface APIs
33 invoked by PHY towards scheduler.
35 static const char* RLOG_MODULE_NAME="MAC";
36 static int RLOG_FILE_ID=228;
37 static int RLOG_MODULE_ID=4096;
39 /* header include files -- defines (.h) */
40 #include "common_def.h"
41 #include "tfu.h" /* RGU defines */
42 #include "lrg.h" /* layer management defines for LTE-MAC */
43 #include "rgr.h" /* layer management defines for LTE-MAC */
44 #include "rgm.h" /* layer management defines for LTE-MAC */
45 #include "rg_env.h" /* defines and macros for MAC */
46 #include "rg_sch_err.h" /* defines and macros for MAC */
47 #include "rg_sch_inf.h" /* defines and macros for MAC */
48 #include "rg_sch.h" /* defines and macros for MAC */
49 #include "rg_sch_cmn.h" /* typedefs for MAC */
50 #include "rl_interface.h"
51 #include "rl_common.h"
54 /* header/extern include files (.x) */
55 #include "tfu.x" /* RGU types */
56 #include "lrg.x" /* layer management typedefs for MAC */
57 #include "rgr.x" /* layer management typedefs for MAC */
58 #include "rgm.x" /* layer management typedefs for MAC */
59 #include "rg_sch_inf.x" /* typedefs for Scheduler */
60 #include "rg_sch.x" /* typedefs for MAC */
61 #include "rg_sch_cmn.x" /* typedefs for MAC */
63 #include "rg_sch_emtc_ext.x"
65 uint8_t rgSCHCmnCalcPcqiBitSz(RgSchUeCb *ueCb,uint8_t numTxAnt);
66 S16 rgSCHDhm5gtfHqFdbkInd(RgSchUeCb *ue,RgSchCellCb *cell,CmLteTimingInfo timingInfo,TfuHqFdbk fdbk,RgSchErrInfo *err);
69 Bool rgSCHEmtcChkEmtcUe ARGS(
74 Void rgSchTomTtiEmtcSched ARGS(
79 S16 rgSCHEmtcRamVldtProcRaReq
84 TfuRaReqIndInfo *raReqInd,
89 Void rgSCHEmtcUpdCqiInfo
95 Void rgSCHEmtcUpdSRInfo
100 Void rgSCHCmnEmtcHdlCrcFailInd
105 S16 rgSCHEmtcTomUtlProcAtCrc
108 CmLteTimingInfo crntHiDci0Frm,
109 TfuCntrlReqInfo *cntrlInfo,
112 Void rgSCHEmtcInitUeRecpReqLst
114 TfuRecpReqInfo *recpReqInfo
116 Void rgSCHEmtcFillPucchRecpInfo
119 RgSchDlHqProcCb *hqCb,
122 Bool rgSCHEmtcAddRecpInfoToLst
124 RgSchDlHqProcCb *hqCb,
125 TfuRecpReqInfo *recpReqInfo,
126 TfuUeRecpReqInfo *pucchRecpInfo,
129 Void rgSCHEmtcWillUeRptCqi
134 Void rgSchEmtcTomTtiCnsldtSfAlloc
139 S16 rgSchEmtcTomTtiL1DlAndUlCfg
142 RgTfuCntrlReqInfo *cntrlInfo
145 S16 rgSCHTomEmtcUtlFillDatRecpReq
147 TfuRecpReqInfo *recpReqInfo,
153 S16 rgSCHEmtcTomUtlFillHqFdbkRecpReq
155 TfuRecpReqInfo *recpReqInfo,
161 S16 rgSCHEmtcDhmRlsDlsfHqProc
164 CmLteTimingInfo timingInfo
167 Void rgSCHEmtcCmnUlSch
172 #ifdef RG_ULSCHED_AT_CRC
173 S16 rgSCHEmtcTomUtlProcDlSfAtCrc
176 CmLteTimingInfo crntUlFrm,
178 TfuCntrlReqInfo *cntrlInfo,
182 RgSchEmtcDlSf* rgSCHEmtcUtlSubFrmGet
189 uint32_t gDlMpdcchBlank;
190 uint32_t gUlMpdcchBlank;
191 S16 rgSCHUtlIotResPrcTti
198 RgSchUeCb* rgSCHCmnGetHoUe
203 RgSchUeCb* rgSCHCmnGetPoUe
207 CmLteTimingInfo timingInfo
209 S16 rgSCHTomUtlFillDatAperRecpReq ARGS(
214 TfuUeRecpReqInfo *datRecpInfo,
215 CmLteTimingInfo *timeInfo,
220 S16 rgSCHTomUtlFillDatPriRecpReq ARGS(
224 TfuUeRecpReqInfo *datRecpInfo,
225 CmLteTimingInfo *timeInfo,
230 S16 rgSCHTomUtlFillDatPCqiRecpReq ARGS(
234 TfuUeRecpReqInfo *datRecpInfo,
235 CmLteTimingInfo *timeInfo,
240 S16 rgSCHTomUtlFillDatSrsRecpReq ARGS(
244 TfuUeRecpReqInfo *datRecpInfo,
245 CmLteTimingInfo *timeInfo,
249 void schFillCrntTime( SlotIndInfo slotInd,Inst schInst);
252 uint32_t delayedApiCnt;
253 uint32_t gPCellTb1AckCount=0,gPCellTb2AckCount=0,gPCellTb1NackCount=0,gPCellTb2NackCount=0;
254 uint32_t gSCellSchedCount=0,gPrimarySchedCount=0;
255 uint32_t gSCellTb1AckCount=0,gSCellTb2AckCount=0,gSCellTb1NackCount=0,gSCellTb2NackCount=0;
256 uint32_t gPCellTb1DtxCount = 0, gPCellTb2DtxCount = 0, gSCellTb1DtxCount = 0, gSCellTb2DtxCount = 0;
257 uint32_t gHqFdbkCount = 0;
261 uint32_t gCqiRecpCount = 0;
262 uint32_t gCqiRecpPuschCount = 0;
263 uint32_t gCqiRcvdCount = 0;
264 Bool gF1bCsPres = FALSE;
265 uint32_t gRiReqCount = 0;
266 uint32_t gCqiReqCount = 0;
267 uint32_t gF1bCsCount = 0;
268 uint32_t gACqiRcvdCount = 0;
269 uint32_t gCqiReptToAppCount = 0;
270 uint32_t gRawACqiCount= 0;
271 uint32_t gCqiDropCount,gPucchDropCount;
272 uint32_t gCqiPucchLowSnrDropCount,gCqiPucchConfMaskDropCount,gCqiPuschConfMaskDropCount;
273 uint32_t gDci0Count = 0;
274 uint32_t gUlCrcFailCount = 0;
275 uint32_t gUlCrcPassCount = 0;
276 uint32_t gPuschCqiDropCount = 0;
277 uint32_t gCaDbgCaFrmt = 0;
278 uint32_t gCaDbgNonCaFrmt = 0;
279 uint32_t gPcellZeroBoOcc=0,gScellZeroBoOcc=0, dbgDelayedDatReqInMac=0,gDropDatReqCnt=0, gIccPktRcvrMemDropCnt=0;
283 uint32_t gUlCrcFailCounter = 0;
284 uint32_t gUlCrcPassCounter = 0;
288 uint32_t gUl5gtfPdcchSend;
293 static S16 rgSCHTomUtlFillCqiSrsWithSr ARGS
297 TfuRecpReqInfo *recpReqInfo,
298 TfuUeRecpReqInfo *pucchRecpInfo,
301 static Bool rgSCHTomUtlFillDatHarqRecpReq ARGS
305 TfuUeRecpReqInfo *datRecpInfo,
306 TfuRecpReqInfo *recpReqInfo
308 static S16 rgSCHTomUtlFillSrRecpReq ARGS((
309 TfuRecpReqInfo *recpReq,
313 static S16 rgSCHTomUtlFillRiRecpReq ARGS((
314 TfuRecpReqInfo *recpReq,
318 static S16 rgSCHTomUtlFillPcqiRecpReq ARGS((
319 TfuRecpReqInfo *recpReq,
323 static S16 rgSCHTomUtlFillSrsRecpReq ARGS((
324 TfuRecpReqInfo *recpReq,
328 static S16 rgSCHTomUtlGenIndices ARGS((
333 TfuSubbandInfo* sbInfo));
335 static S16 rgSCHTomUtlFillCqiRiRecpReq ARGS(
337 TfuRecpReqInfo *recpReqInfo,
342 static Void rgSchTomFillCellTtiInfo ARGS
344 TfuTtiIndInfo *ttiInd,
352 uint32_t rgBwAlloInfo[RGSCH_NUM_SUB_FRAMES]; /* Num of Rbs Allocated in each SF */
353 uint32_t rgBwAlcnt[RGSCH_NUM_SUB_FRAMES]; /*Num of times Allocation done in each Subframe */
356 /* rg006.201: [ccpu000111706, ccpu00112394]: Separated UL and DL TTI
359 uint64_t glblTtiCnt = 0;
363 uint32_t gDlNumUePerTti[20] = {0};
364 uint32_t gUlNumUePerTti[20] = {0};
365 static S16 rgSCHTomUtlProcDlSf ARGS((
369 RgTfuCntrlReqInfo *cntrlInfo,
371 #ifdef RG_ULSCHED_AT_CRC
372 static S16 rgSCHTomUtlProcDlSfAtCrc ARGS((
374 CmLteTimingInfo crntUlFrm,
376 TfuCntrlReqInfo *cntrlInfo,
378 #endif /* RG_ULSCHED_AT_CRC */
381 static S16 rgSCHTomUtlPrcUlTddSpclSf ARGS((
384 #endif /* TFU_UPGRADE */
386 static S16 rgSCHTomUtlFillPhich ARGS((
388 TfuCntrlReqInfo *cntrlInfo,
392 static S16 rgSCHTomUtlFillDlPdcch ARGS((
394 TfuCntrlReqInfo *cntrlInfo,
397 static S16 rgSCHTomUtlFillUlPdcch ARGS((
399 TfuCntrlReqInfo *cntrlInfo,
403 static S16 rgSCHTomUtlProcTA ARGS((
406 static S16 rgSCHTomUtlFillHqFdbkRecpReq ARGS((
407 TfuRecpReqInfo *recpReq,
412 static S16 rgSCHTomUtlFillHqFdbkRecpReq ARGS((
413 TfuRecpReqInfo *recpReq,
419 S16 rgSCHTomFillOnlySrsRecpReq ARGS
423 TfuUeRecpReqInfo *datRecpInfo
425 static S16 rgSCHTomUtlFillCqiSrSrsWithHq ARGS
428 TfuRecpReqInfo *recpReqInfo,
430 TfuUeRecpReqInfo *pucchRecpInfo,
432 Bool isDatPresOnSecCell
435 S16 rgSCHTomUtlFillRiBitWidthInfo ARGS
440 uint8_t rgSCHTomUtlFetchPcqiBitSz ARGS
447 uint8_t rgSCHTomUtlFetchPcqiBitSzPucchMode21 ARGS
450 TfuCqiPucchMode21 *mode21Info,
455 S16 rgSCHTomUtlMoveNxtOccasion ARGS
462 static S16 rgSCHTomUtlMovePcqiNxtOccasion ARGS
469 static S16 rgSCHTomUtlMovePriNxtOccasion ARGS
476 static S16 rgSCHTomUtlMoveSrNxtOccasion ARGS
482 static S16 rgSCHTomUtlMoveSrsNxtOccasion ARGS
487 static S16 rgSCHTomUtlWillUeRprtCqiRi ARGS((
489 Bool *willueRprtCqiRii));
492 static S16 rgSCHTomUtlFillDatRecpReq ARGS((
493 TfuRecpReqInfo *recpReq,
498 static S16 rgSCHTomUtlFillDatRecpReq ARGS((
499 TfuRecpReqInfo *recpReq,
506 static S16 rgSCHTomUtlFillSfRepHqFdbk ARGS((
507 TfuRecpReqInfo *recpReqInfo,
518 static S16 rgSCHTomUtlFillSfRepHqFdbk ARGS((
519 TfuRecpReqInfo *recpReqInfo,
530 static S16 rgSCHTomUtlFillSfHqFdbk ARGS((
531 TfuRecpReqInfo *recpReqInfo,
542 static S16 rgSCHTomUtlFillSfHqFdbk ARGS((
543 TfuRecpReqInfo *recpReqInfo,
554 static S16 rgSCHTomUtlFillSfHqFdbkForOneUe ARGS((
555 RgSchDlHqProcCb *hqCb,
556 TfuRecpReqInfo *recpReqInfo,
565 RgrTddAckNackMode ackNackMode,
566 RgSchUePucchRecpInfo **pucchInfoRef,
568 TknUInt16 n1PucchTkn,
574 Void rgSCHCmnDlSpsSch (RgSchCellCb *cell);
578 static S16 rgSCHTomCnsdrRelPdcch ARGS
582 TfuRecpReqInfo *recpReqInfo,
587 static S16 rgSCHTomCnsdrRelPdcch ARGS
591 TfuRecpReqInfo *recpReqInfo,
599 static Void rgSchTomTtiMiscFunctions ARGS
604 static Void rgSchTomTtiUlAndDlCmnChSch ARGS
609 static Void rgSchTomTtiDlSch ARGS
614 static Void rgSchTomTtiCnsldtSfAlloc ARGS
619 static Void rgSchTomTtiL1DlAndUlCfg ARGS
622 RgTfuCntrlReqInfo *cntrlInfo
626 static Void rgSCHTomUtlSendSfnTick ARGS
632 static Void rgSchTomUtlTddRlsSfAndHarq ARGS
636 static Void rgSCHTomUtlProcTddUlSf ARGS
641 static Void rgSCHTomUtlGethqRes ARGS
649 static Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1 ARGS
651 RgSchDlHqProcCb *hqCb,
652 TfuUePucchRecpReq *hqRecpReq,
658 static Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234 ARGS
660 RgSchDlHqProcCb *hqCb,
661 TfuUePucchRecpReq *hqRecpReq,
671 uint32_t rgDlCqiRptCnt[16], rgTotDlCqiRpt;
674 uint32_t rgSch5gtfCqi2Mcs[15] =
675 {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14};
677 /* forward references */
679 /*HARQ Feedback interpretation in accordance with Femto Forum.
680 Note: There is no value as '0' in Femto Forum Spec but in order to retain
681 the existing usage in MAC (and its Acceptance), its being considered*/
682 //const static uint8_t rgSchTomHqFbkMap[8] = {0,1,0,0,4,4,4,4};
683 /*added #defines instead of magic numbers*/
684 /*const static uint32_t rgSCHTomBinCoe[RG_SCH_MAX_NUM_UE_SEL_SUBBANDS][RG_SCH_MAX_TOT_NUM_SUBBANDS]={
685 {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},
686 {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},
687 {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},
688 {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},
689 {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},
690 {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}
694 /*ccpu00116923 - ADD - SRS present support*/
695 /*Tables Derived from 3GPP TS 36.211 Section 5.5.3.3 */
696 /* Table 5.5.3.3-1 */
698 const RgSchFddCellSpSrsSubfrmTbl rgSchFddCellSpSrsSubfrmTbl = {
699 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE},
700 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE},
701 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE},
702 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE},
703 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
704 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE},
705 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE},
706 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE},
707 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE},
708 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
709 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
710 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
711 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
712 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE},
713 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE},
714 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}
717 /* Table 5.5.3.3-2 */
718 const RgSchTddCellSpSrsSubfrmTbl rgSchTddCellSpSrsSubfrmTbl = {
719 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
720 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE},
721 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE},
722 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE},
723 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE},
724 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE},
725 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE},
726 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE},
727 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
728 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
729 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE},
730 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE},
731 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE},
732 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE},
733 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
734 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}
737 S8 rgSchCmnAper20n22DiffCqi[4] = {1, 2, 3, 4};
738 S8 rgSchCmnAper30n31DiffCqi[4] = {0, 1, 2, -1};
742 * @brief get Ue for dedicated preamble rach
746 * Function: rgSCHGetDedPrmUe
748 * Invoked by: rgSCHTomRaReqInd
750 * @param[in] RgSchCellCb *cell
751 * @param[in] TfuRaReqIndInfo *raReqInd
761 CmLteTimingInfo timingInfo,
765 S16 rgSCHGetDedPrmUe(cell, rapId, timingInfo, ue)
768 CmLteTimingInfo timingInfo;
772 RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch);
774 printf("rapId[%d] cellSch->rachCfg.dedPrmStart[%d] cellSch->rachCfg.numDedPrm[%d]\n",rapId,cellSch->rachCfg.dedPrmStart,cellSch->rachCfg.numDedPrm);
775 /* Finding UE in handOver List */
776 if ((rapId < cellSch->rachCfg.dedPrmStart) ||
777 (rapId > cellSch->rachCfg.dedPrmStart +
778 cellSch->rachCfg.numDedPrm - 1))
780 /* This ded Preamble corresponds to handover */
781 *ue = rgSCHCmnGetHoUe(cell, rapId);
782 printf(" his ded Preamble corresponds to hando\n");
784 else/* Finding UE from PDCCH Order Mappings */
786 /* Get the UE which has transmitted this RaReq */
787 *ue = rgSCHCmnGetPoUe(cell, rapId, timingInfo);
788 printf(" ==== inding UE from PDCCH Order Mapping\n");
793 * @brief Handler for processing Random Access request indication
798 * Function: rgSCHTomRaReqInd
800 * Handler for processing Random Access request indication recieved from
803 * Invoked by: RgLiTfuRaReqInd of LIM
806 * - Validate the information received: cellId value and raRnti values
807 * - Process the request: Call rgSCHRamProcRaReq (cell, raRnti, raReqInd)
809 * @param[in] RgSchCellCb *cell
810 * @param[in] TfuRaReqIndInfo *raReqInd
819 TfuRaReqIndInfo *raReqInd
822 S16 rgSCHTomRaReqInd(cell, raReqInd)
824 TfuRaReqIndInfo *raReqInd;
831 Bool isEmtcUe = FALSE;
833 RgSchUeCb *ue = NULLP;
835 if(cell->cellId != raReqInd->cellId)
837 err.errType = RGSCHERR_TOM_RAREQIND;
838 err.errCause = RGSCHERR_TOM_INV_CELL_ID;
839 RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,
840 "rgSCHTomRaReqInd(): No cell found with raReq cellId = (%d) errorType (%d)"
841 " errorCause(%d)",raReqInd->cellId, err.errType, err.errCause);
845 for (raRntiCnt = 0; raRntiCnt < raReqInd->nmbOfRaRnti; raRntiCnt++)
847 for (raReqCnt = 0; raReqCnt < raReqInd->rachInfoArr->numRaReqInfo; raReqCnt++)
849 rapId = raReqInd->rachInfoArr[raRntiCnt].raReqInfoArr[raReqCnt].rapId;
851 if(RGSCH_IS_DEDPRM(cell, rapId))
853 rgSCHGetDedPrmUe(cell, rapId, raReqInd->timingInfo, &ue);
856 /* Since rapId is within dedicated range and No ue context
857 * is found means it is a spurious rach. So ignore it.*/
862 if(FALSE == isEmtcUe)
864 #if (ERRCLASS & ERRCLS_DEBUG)
865 if(raReqInd->rachInfoArr[raRntiCnt].raRnti > RGSCH_MAX_RA_RNTI)
867 RGSCHLOGERROR(cell->instIdx, ERRCLS_INT_PAR, ERG013,
868 (ErrVal)raReqInd->rachInfoArr[raRntiCnt].raRnti,
869 ("rgSCHTomRaReqInd(): raRnti is out of range\n"));
873 ret = rgSCHRamProcRaReq(raReqCnt, cell, raReqInd->rachInfoArr[raRntiCnt].raRnti,
874 (TfuRachInfo *)&raReqInd->rachInfoArr[raRntiCnt],
875 raReqInd->timingInfo, ue, &err);
878 err.errType = RGSCHERR_TOM_RAREQIND;
879 RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,
880 "RARNTI:%d rgSCHTomRaReqInd(): RAM processing failed errType(%d) "
881 "errCause(%d)", raReqInd->rachInfoArr[raRntiCnt].raRnti,
882 err.errType, err.errCause);
889 } /* rgSCHTomRaReqInd */
893 * @brief Handler for processing uplink CQI indication recieved from PHY.
897 * Function: rgSCHTomUlCqiInd
899 * Handler for processing uplink CQI indication recieved from PHY.
901 * Invoked by: RgLiTfuUlCqiInd
905 * - Invoke scheduler to push reported CQI info rgSCHUtlUlCqiInd
907 * @param[in] RgSchCellCb *cell
908 * @param[in] TfuUlCqiIndInfo *ulCqiInd
917 TfuUlCqiIndInfo *ulCqiInd
920 S16 rgSCHTomUlCqiInd(cell, ulCqiInd)
922 TfuUlCqiIndInfo *ulCqiInd;
927 TfuUlCqiRpt *ulCqiInfo;
929 node = ulCqiInd->ulCqiRpt.first;
930 if(cell->cellId != ulCqiInd->cellId)
932 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
933 "rgSCHTomUlCqiInd() Unable to get the ulCqiInd cell with id(%d)",
938 for (;node; node=node->next)
940 ulCqiInfo = (TfuUlCqiRpt *)node->node;
941 #if (ERRCLASS & ERRCLS_DEBUG)
942 if(ulCqiInfo->numSubband == 0)
944 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Num Subband is"
945 "out of range RNTI:%d",ulCqiInfo->rnti);
949 if((ue = rgSCHDbmGetUeCb(cell, ulCqiInfo->rnti)) == NULLP)
952 if((ue = rgSCHDbmGetSpsUeCb(cell, ulCqiInfo->rnti)) == NULLP)
955 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get "
956 "the ue for RNTI:%d", ulCqiInfo->rnti);
960 /* wideband cqi is directly reported now. and also isTxPort0 */
961 rgSCHUtlUlCqiInd(cell, ue, ulCqiInfo);
964 } /* rgSCHTomUlCqiInd */
967 * @brief Handler for processing PUCCH power adjustment indication
971 * Function: rgSCHTomPucchDeltaPwrInd
973 * Handler for processing PUCCH power adjustment indication
976 * Invoked by: RgLiTfuPucchDeltaPwrInd
980 * - Invoke scheduler to push reported CQI info rgSCHUtlPucchDeltaPwrInd
982 * @param[in] RgSchCellCb *cell
983 * @param[in] TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
989 S16 rgSCHTomPucchDeltaPwrInd
992 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
995 S16 rgSCHTomPucchDeltaPwrInd(cell, pucchDeltaPwr)
997 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr;
1002 TfuPucchDeltaPwr *ueElem;
1004 if(cell->cellId != pucchDeltaPwr->cellId)
1006 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1007 "rgSCHTomPucchDeltaPwrInd() Unable to get the pucchDeltaPwr cell with id(%d)",
1008 pucchDeltaPwr->cellId);
1012 node = pucchDeltaPwr->pucchDeltaPwrLst.first;
1013 for (;node; node=node->next)
1015 ueElem = (TfuPucchDeltaPwr *)node->node;
1016 if((ue = rgSCHDbmGetUeCb(cell, ueElem->rnti)) == NULLP)
1019 if((ue = rgSCHDbmGetSpsUeCb(cell, ueElem->rnti)) == NULLP)
1022 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d "
1023 "rgSCHTomPucchDeltaPwrInd() Unable to get the ue ",
1028 rgSCHUtlPucchDeltaPwrInd(cell, ue, ueElem->pucchDeltaPwr);
1031 } /* rgSCHTomPucchDeltaPwrInd */
1034 * @brief Handler for processing harq ACK/NACK indication recieved from PHY.
1038 * Function: rgSCHTomHarqAckInd
1040 * Handler for processing harq ACK/NACK indication recieved from PHY.
1042 * Invoked by: RgLiTfuHqInd
1045 * For each HqAckInfo received
1047 * - If UE doesnt exist look for a RaCb and invoke rgSCHRamMsg4FdbkInd
1048 * - Invoke HARQ module to pass HARQ-ACK info rgSCHDhmHqFdbkInd
1050 * @param[in] TfuHqIndInfo *harqAckInd
1056 S16 rgSCHTomHarqAckInd
1059 TfuHqIndInfo *harqAckInd
1062 S16 rgSCHTomHarqAckInd(cell, harqAckInd)
1064 TfuHqIndInfo *harqAckInd;
1075 RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1077 RgSchCellCb *iterCellP;
1079 if(cell->cellId != harqAckInd->cellId)
1081 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() Unable to get"
1082 " the cell for cellId (%d)", harqAckInd->cellId);
1083 err.errType = RGSCHERR_TOM_HARQACKIND;
1084 err.errCause = RGSCHERR_TOM_INV_CELL_ID;
1088 node = harqAckInd->hqIndLst.first;
1089 for (;node; node=node->next)
1091 hqInfo = (TfuHqInfo *)node->node;
1093 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1094 TfuHqFdbk fdbk = hqInfo->isAck[0];
1095 raCb = rgSCHDbmGetRaCb (cell, hqInfo->rnti);
1096 ue = rgSCHDbmGetUeCb (cell, hqInfo->rnti);
1097 if (ue != NULLP && raCb == NULLP)
1099 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, harqAckInd->timingInfo, fdbk, &err)) != ROK)
1101 err.errType = RGSCHERR_TOM_HARQACKIND;
1102 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
1103 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1104 err.errType, err.errCause);
1112 if ((rgSCHDhmRlsDlsfHqProc (cell, harqAckInd->timingInfo)) != ROK)
1114 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink "
1115 "subframe for cellId (%d) ", cell->cellId);
1116 err.errType = RGSCHERR_TOM_HARQACKIND;
1119 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
1121 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
1123 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
1125 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
1126 if(rlsHqBufs->numUes)
1128 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
1129 RgSchMacRlsHq (&pst, rlsHqBufs);
1131 rlsHqBufs->numUes = 0;
1135 rlsHqBufs->numUes = 0;
1136 node = harqAckInd->hqIndLst.first;
1137 for (;node; node=node->next)
1139 hqInfo = (TfuHqInfo *)node->node;
1140 for(tbCnt=0; tbCnt<TFU_MAX_HARQ_FDBKS; tbCnt++)
1142 hqInfo->isAck[tbCnt]=(TfuHqFdbk)rgSchTomHqFbkMap[hqInfo->isAck[tbCnt]];
1144 raCb = rgSCHDbmGetRaCb (cell, hqInfo->rnti);
1145 ue = rgSCHDbmGetUeCb (cell, hqInfo->rnti);
1146 if (ue == NULLP && raCb != NULLP)
1149 rgSCHRamMsg4FdbkInd (raCb);
1151 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1152 cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
1154 err.errType = RGSCHERR_TOM_HARQACKIND;
1155 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1156 " feedback processing failed errType(%d) errCause(%d)",
1157 err.errType, err.errCause);
1162 else if (ue != NULLP && raCb == NULLP)
1164 /* Get the Downlink HARQ entity from ue */
1165 if ((rgSCHDhmHqFdbkInd (ue, RGSCH_HQ_FDB_IND_CB_TYPE_HQ_ENT,
1166 cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
1168 err.errType = RGSCHERR_TOM_HARQACKIND;
1169 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
1170 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1171 err.errType, err.errCause);
1175 else if (ue != NULLP && raCb != NULLP)
1177 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1178 cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
1180 err.errType = RGSCHERR_TOM_HARQACKIND;
1181 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1182 " feedback processing failed errType(%d) errCause(%d).",
1183 err.errType, err.errCause);
1189 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
1190 "UE CB or RA CB ", hqInfo->rnti);
1191 err.errType = RGSCHERR_TOM_HARQACKIND;
1196 /* Check with TDD call DHM*/
1197 if ((rgSCHDhmRlsDlsfHqProc (cell, harqAckInd->timingInfo)) != ROK)
1199 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink "
1200 "subframe for cellId (%d) ", harqAckInd->cellId);
1201 err.errType = RGSCHERR_TOM_HARQACKIND;
1204 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
1206 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
1208 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
1210 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
1211 if(rlsHqBufs->numUes)
1213 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
1214 RgSchMacRlsHq (&pst, rlsHqBufs);
1216 rlsHqBufs->numUes = 0;
1221 } /* rgSCHTomHarqAckInd */
1225 * @brief Handler for processing Scheduling Request indication
1226 * recieved from PHY for a list of UEs.
1230 * Function: rgSCHTomSrInd
1232 * Handler for processing Scheduling Request indication recieved from PHY
1235 * Invoked by: RgLiTfuSrInd
1239 * - Invoke scheduler to indicate SR rgSCHUtlSrRcvd
1241 * @param[in] TfuSrIndInfo *srInd
1253 S16 rgSCHTomSrInd(cell, srInd)
1255 TfuSrIndInfo *srInd;
1264 if(cell->cellId != srInd->cellId)
1266 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for srcInd cellId"
1267 ":%d ", srInd->cellId);
1268 err.errType = RGSCHERR_TOM_SRIND;
1269 err.errCause = RGSCHERR_TOM_INV_CELL_ID;
1274 node = srInd->srLst.first;
1275 for (;node; node=node->next)
1279 srInfo = (TfuSrInfo *)node->node;
1280 ue = rgSCHDbmGetUeCb (cell, srInfo->rnti);
1283 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB",
1287 rgSCHUtlHdlUlTransInd(cell, ue, srInd->timingInfo);
1288 /*Need to activate UE as SR received*/
1289 if (ue->isDrxEnabled)
1291 rgSCHDrxSrInd(cell, ue);
1293 ret = rgSCHUtlSrRcvd (cell, ue, srInd->timingInfo, &err);
1296 err.errType = RGSCHERR_TOM_SRIND;
1297 RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,"Scheduler processing failed "
1298 "errType(%d) errCause(%d) RNTI:%d", err.errType, err.errCause,srInfo->rnti);
1303 } /* end of rgSCHTomSrInd */
1306 * @brief Handler for processing downlink CQI indication recieved from
1311 * Function: rgSCHTomDoaInd
1313 * Handler for processing DOA recieved from PHY
1316 * Invoked by: RgLiTfuDoaInd
1320 * - Invoke scheduler to indicate DOA rgSCHUtlDoaInd
1322 * @param[in] TfuDoaIndInfo *doaInd
1331 TfuDoaIndInfo *doaInd
1334 S16 rgSCHTomDoaInd(cell, doaInd )
1336 TfuDoaIndInfo *doaInd;
1343 if(cell->cellId != doaInd->cellId)
1345 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for doaInd cellId"
1346 ":%d", doaInd->cellId);
1351 node = doaInd->doaRpt.first;
1352 for (;node; node=node->next)
1354 doaInfo = (TfuDoaRpt *)node->node;
1355 ue = rgSCHDbmGetUeCb (cell, doaInfo->rnti);
1358 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB",
1362 rgSCHUtlDoaInd(cell, ue, doaInfo);
1365 } /* rgSCHTomDoaInd */
1367 * @brief Handler for processing downlink CQI indication recieved from
1372 * Function: rgSCHTomDlCqiInd
1374 * Handler for processing downlink CQI indication recieved from PHY
1377 * Invoked by: RgLiTfuDlCqiInd
1381 * - Invoke scheduler to indicate DL CQI rgSCHUtlDlCqiInd
1383 * @param[in] TfuDlCqiIndInfo *dlCqiInd
1389 S16 rgSCHTomDlCqiInd
1392 TfuDlCqiIndInfo *dlCqiInd
1395 S16 rgSCHTomDlCqiInd(cell, dlCqiInd)
1397 TfuDlCqiIndInfo *dlCqiInd;
1402 TfuDlCqiRpt *dlCqiInfo;
1404 if(cell->cellId != dlCqiInd->cellId)
1406 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
1407 ":%d", dlCqiInd->cellId);
1412 node = dlCqiInd->dlCqiRptsLst.first;
1413 for (;node; node=node->next)
1415 dlCqiInfo = (TfuDlCqiRpt *)node->node;
1416 ue = rgSCHDbmGetUeCb (cell, dlCqiInfo->rnti);
1419 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%dUnable to get the UE CB",
1423 rgSCHUtlDlCqiInd(cell, ue, dlCqiInfo, dlCqiInd->timingInfo);
1424 rgSCHUtlHdlUlTransInd(cell, ue, dlCqiInd->timingInfo);
1427 } /* rgSCHTomDlCqiInd */
1430 * @brief Handler for moving PCQI instance for the next periodic occasion
1434 * Function: rgSCHTomUtlMovePcqiNxtOccasion
1436 * Handler for moving PCQI instance for the next periodic occasion
1438 * Invoked by: rgSCHTomUtlFill*
1441 * - For a UE move its occurence instance to next occasion
1442 * depending on its periodicity
1443 * - Remove it from the current list and insert it to the list
1444 * having the index matching with the derived number.
1446 * @param[in] RgSchCellCb *cell,
1447 * [in] RgSchUeCb *ue
1453 static S16 rgSCHTomUtlMovePcqiNxtOccasion
1457 RgSchUePCqiCb *cqiCb
1460 static S16 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb)
1463 RgSchUePCqiCb *cqiCb;
1466 uint16_t cqiIdx = 0;
1468 CmLteTimingInfo timingInfo;
1470 if(cqiCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_SB_REP)
1473 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timingInfo, TFU_DELTA);
1475 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timingInfo,
1476 TFU_RECPREQ_DLDELTA);
1478 RG_SCH_ADD_TO_CRNT_TIME(timingInfo,timingInfo,cqiCb->cqiPeri);
1479 rgSCHTomUtlPcqiSbCalcBpIdx(timingInfo,ue,cqiCb);
1481 /* Compute Next Transmission Instance */
1482 cqiIdx = cqiCb->cqiPeri + cqiCb->nCqiTrIdx;
1483 cqiIdx = cqiIdx%RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1484 /* Delete from current List and move to new list */
1485 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst,
1488 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to remove node",
1491 cqiCb->nCqiTrIdx = cqiIdx;
1492 cmLListAdd2Tail(&(cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst),
1493 &(cqiCb->cqiLstEnt));
1495 rgSCHUtlSCellHndlCqiCollsn(cqiCb);
1499 } /* rgSCHTomUtlMovePcqiNxtOccasion */
1502 * @brief Handler for moving RI instance for the next periodic occasion
1506 * Function: rgSCHTomUtlMovePriNxtOccasion
1508 * Handler for moving PCQI instance for the next periodic occasion
1510 * Invoked by: rgSCHTomUtlFill*
1513 * - For a UE move its occurence instance to next occasion
1514 * depending on its periodicity
1515 * - Remove it from the current list and insert it to the list
1516 * having the index matching with the derived number.
1518 * @param[in] RgSchCellCb *cell,
1519 * [in] RgSchUeCb *ue
1525 static S16 rgSCHTomUtlMovePriNxtOccasion
1532 static S16 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb)
1535 RgSchUePCqiCb *riCb;
1540 uint16_t effPeriodicity;
1541 uint16_t riTrInsTime;
1545 crntTime = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)
1546 +(cell->crntTime.slot);
1547 #ifdef XEON_SPECIFIC_CHANGES
1548 RGSCHCPYTIMEINFO(cell->crntTime, ue->riRecpTime);
1550 /* Compute Next Transmission Instance */
1551 if (riCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_WB_REP)
1553 effPeriodicity = riCb->cqiPeri * riCb->riPeri;
1554 tempIdx = effPeriodicity + riCb->nRiTrIdx;
1558 effPeriodicity = (riCb->h * riCb->cqiPeri * riCb->riPeri);
1559 /* In case of SFN wraparound, the SB CQI reporting cycle breaks
1560 * and RI->WB CQI->SBCQI.. should resume. RI is repositioned
1561 * accordingly. WBCQI handling is naturally accomplished */
1562 if ((crntTime + TFU_RECPREQ_DLDELTA + effPeriodicity) >
1563 (RGSCH_MAX_SUBFRM_5G - 1))
1565 riTrInsTime = (effPeriodicity - riCb->cqiOffset + riCb->riOffset) % effPeriodicity;
1566 tempIdx = RGSCH_MAX_SUBFRM_5G + (effPeriodicity - riTrInsTime);
1567 /* In case of SFN wraparound, riDist should be distance from crntTime
1568 * + TFU_RECPREQ_DLDELTA to tempIdx. Updating effPeriodicity
1569 * to make riDist calculation consistent for both SFN wraparound
1570 * case and normal case */
1571 effPeriodicity = tempIdx - TFU_RECPREQ_DLDELTA - crntTime;
1575 tempIdx = effPeriodicity + riCb->nRiTrIdx;
1578 riIdx = tempIdx % RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1579 if (effPeriodicity >= RG_SCH_PCQI_SRS_SR_TRINS_SIZE)
1581 riDist = rgSCHUtlFindDist((uint16_t)(crntTime + TFU_RECPREQ_DLDELTA),
1582 (uint16_t)(crntTime + TFU_RECPREQ_DLDELTA + effPeriodicity));
1589 /* ccpu00138306- If Periodicity is equal to Queue Size or multiple of it
1590 * then the next occasion idx will be same as current Idx, Hence need not
1593 if((effPeriodicity%RG_SCH_PCQI_SRS_SR_TRINS_SIZE) != 0)
1595 /* Delete from current List and move to new list */
1596 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[riCb->nRiTrIdx].riLst,
1599 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"[%d]UEID:Unable to remove node",
1602 RG_SCH_RECORD(&riCb->histElem,RGSCH_ACTION_DEL, &cell->pCqiSrsSrLst[riCb->nRiTrIdx].riLst);
1603 cmLListAdd2Tail(&cell->pCqiSrsSrLst[riIdx].riLst,
1605 RG_SCH_RECORD(&riCb->histElem,RGSCH_ACTION_ADD, &cell->pCqiSrsSrLst[riIdx].riLst);
1614 riCb->nRiTrIdx = riIdx;
1615 riCb->riDist = riDist;
1618 rgSCHUtlSCellHndlRiCollsn(riCb);
1621 } /* rgSCHTomUtlMovePriNxtOccasion */
1624 * @brief Handler for moving SR instance for the next periodic occasion
1628 * Function: rgSCHTomUtlMoveSrNxtOccasion
1630 * Handler for moving SR instance for the next periodic occasion
1632 * Invoked by: rgSCHTomUtlFill*
1635 * - For a UE move its occurence instance to next occasion
1636 * depending on its periodicity
1637 * - Remove it from the current list and insert it to the list
1638 * having the index matching with the derived number.
1640 * @param[in] RgSchCellCb *cell,
1641 * [in] RgSchUeCb *ue
1647 static S16 rgSCHTomUtlMoveSrNxtOccasion
1653 static S16 rgSCHTomUtlMoveSrNxtOccasion(cell, ue)
1660 /* Compute Next Transmission Instance */
1661 srIdx = ue->srCb.peri + ue->srCb.nSrTrIdx;
1662 srIdx = srIdx%RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1663 /* Delete from current List and move to new list */
1664 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[ue->srCb.nSrTrIdx].srLst,
1665 &ue->srCb.srLstEnt))
1667 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to remove node",
1670 ue->srCb.nSrTrIdx = srIdx;
1671 cmLListAdd2Tail(&cell->pCqiSrsSrLst[ue->srCb.nSrTrIdx].srLst,
1672 &ue->srCb.srLstEnt);
1675 } /* rgSCHTomUtlMoveSrNxtOccasion */
1678 * @brief Handler for moving SRS instance for the next periodic occasion
1682 * Function: rgSCHTomUtlMoveSrsNxtOccasion
1684 * Handler for moving SRS instance for the next periodic occasion
1686 * Invoked by: rgSCHTomUtlFill*
1689 * - For a UE move its occurence instance to next occasion
1690 * depending on its periodicity
1691 * - Remove it from the current list and insert it to the list
1692 * having the index matching with the derived number.
1694 * @param[in] RgSchCellCb *cell,
1695 * [in] RgSchUeCb *ue
1701 static S16 rgSCHTomUtlMoveSrsNxtOccasion
1707 static S16 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue)
1718 crntTime = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)
1719 +(cell->crntTime.slot);
1721 /* Compute Next Transmission Instance */
1722 tempIdx = ue->srsCb.peri + ue->srsCb.nSrsTrIdx;
1723 srsIdx = tempIdx %RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1724 if (ue->srsCb.peri > RG_SCH_PCQI_SRS_SR_TRINS_SIZE)
1726 srsDist = rgSCHUtlFindDist((uint16_t)(crntTime + TFU_RECPREQ_DLDELTA),
1727 (uint16_t)(crntTime + TFU_RECPREQ_DLDELTA + ue->srsCb.peri));
1734 /* ccpu00138306- If Periodicity is equal to Queue Size or multiple of it
1735 * then the next occasion idx will be same as current Idx, Hence need not
1738 if((ue->srsCb.peri%RG_SCH_PCQI_SRS_SR_TRINS_SIZE) != 0)
1740 /* Delete from current List and move to new list */
1741 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[ue->srsCb.nSrsTrIdx].srsLst,
1742 &ue->srsCb.srsLstEnt))
1744 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to remove node",
1747 cmLListAdd2Tail(&cell->pCqiSrsSrLst[srsIdx].srsLst,
1748 &ue->srsCb.srsLstEnt);
1757 ue->srsCb.nSrsTrIdx = srsIdx;
1758 ue->srsCb.srsDist = srsDist;
1760 } /* rgSCHTomUtlMoveSrsNxtOccasion */
1764 * @brief Handler for processing RAW CQI indication recieved from
1769 * Function: rgSCHTomRawCqiInd
1771 * Handler for processing RAW CQI indication recieved from PHY
1774 * Invoked by: RgLiTfuRawCqiInd
1778 * - Invoke scheduler to indicate Raw CQI rgSCHUtlRawCqiInd
1780 * @param[in] TfuRawCqiIndInfo *rawCqiInd
1786 S16 rgSCHTomRawCqiInd
1789 TfuRawCqiIndInfo *rawCqiInd
1792 S16 rgSCHTomRawCqiInd(cell, rawCqiInd)
1794 TfuRawCqiIndInfo *rawCqiInd;
1799 TfuRawCqiRpt* rawCqiInfo;
1803 RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1804 RgSchCellCb *iterCellP;
1815 if(cell->cellId != rawCqiInd->cellId)
1817 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
1818 ":%d", rawCqiInd->cellId);
1823 node = rawCqiInd->rawCqiRpt.first;
1824 for (;node; node=node->next)
1826 rawCqiInfo = (TfuRawCqiRpt *)node->node;
1827 ue = rgSCHDbmGetUeCb (cell, rawCqiInfo->crnti);
1828 raCb = rgSCHDbmGetRaCb (cell, rawCqiInfo->crnti);
1832 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"CRNTI:%d Unable to get the UECB",
1839 if (rawCqiInfo->numBits >= 5)
1840 printf("cellId [%d] crnti [%d] numBits [%d] uciPayload [0x%08x] sfn/sf [%d:%d]\n",
1841 cell->cellId, rawCqiInfo->crnti, rawCqiInfo->numBits, rawCqiInfo->uciPayload,
1842 rawCqiInd->timingInfo.sfn, rawCqiInd->timingInfo.slot);
1844 if (rawCqiInfo->numBits == 1)
1846 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1847 uint8_t fdbk = TFU_HQFDB_NACK;
1848 /* Process HARQ FdbkInd */
1849 hqAck = (rawCqiInfo->uciPayload >> 31) & 0x1;
1852 fdbk = TFU_HQFDB_ACK;
1853 hqInfo.isAck[0] = fdbk;
1855 if (ue != NULLP && raCb == NULLP)
1857 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, rawCqiInd->timingInfo, fdbk, &err)) != ROK)
1859 err.errType = RGSCHERR_TOM_HARQACKIND;
1860 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
1861 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1862 err.errType, err.errCause);
1866 else if (ue == NULLP && raCb != NULLP)
1868 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1869 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1871 err.errType = RGSCHERR_TOM_HARQACKIND;
1872 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1873 " feedback processing failed errType(%d) errCause(%d)",
1874 err.errType, err.errCause);
1879 else if (ue != NULLP && raCb != NULLP)
1881 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1882 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1884 err.errType = RGSCHERR_TOM_HARQACKIND;
1885 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1886 " feedback processing failed errType(%d) errCause(%d).",
1887 err.errType, err.errCause);
1893 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
1894 "UE CB or RA CB ", rawCqiInfo->crnti);
1895 err.errType = RGSCHERR_TOM_HARQACKIND;
1899 printf("rawCqiInfo->numBits [%d] uciPayload [0x%08x] sfn/sf [%d:%d]\n", rawCqiInfo->numBits,
1900 rawCqiInfo->uciPayload, rawCqiInd->timingInfo.sfn, rawCqiInd->timingInfo.slot);
1903 else if (rawCqiInfo->numBits == 5)
1905 /* Process CQI-RI Ind*/
1906 ri = (rawCqiInfo->uciPayload >> 27) & 0x1;
1907 cqi = (rawCqiInfo->uciPayload >> 28) & 0xF;
1911 printf("\n UE[%d] CQI[%d] Invalid\n", ue->ueId, cqi);
1914 ue->ue5gtfCb.mcs = rgSch5gtfCqi2Mcs[cqi - 1];
1915 ue->ue5gtfCb.rank = ri + 1;
1917 if (rawCqiInfo->numBits > 1)
1919 ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
1920 ueDl->mimoInfo.cwInfo[0].cqi = cqi;
1921 ueDl->cqiFlag = TRUE;
1922 rgSCHCmnDlSetUeAllocLmtLa(cell, ue);
1923 // rgSCHCheckAndSetTxScheme(cell, ue);
1928 printf("UE[%d] CQI[%d] MCS[%d] RI[%d]\n", ue->ueId, cqi, ue->ue5gtfCb.mcs, ri);
1931 else if (rawCqiInfo->numBits == 6)
1933 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1934 TfuHqFdbk fdbk = TFU_HQFDB_NACK;
1935 /* Process both HARQ and CQI-RI Ind*/
1936 ri = (rawCqiInfo->uciPayload >> 26) & 0x1;
1937 cqi = (rawCqiInfo->uciPayload >> 27) & 0xF;
1938 hqAck = (rawCqiInfo->uciPayload >> 31) & 0x1;
1941 printf("UE[%d] CQI[%d] Invalid\n", ue->ueId, cqi);
1944 ue->ue5gtfCb.mcs = rgSch5gtfCqi2Mcs[cqi - 1];
1945 ue->ue5gtfCb.rank = ri + 1;
1947 if (rawCqiInfo->numBits > 1)
1949 ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
1950 ueDl->mimoInfo.cwInfo[0].cqi = cqi;
1951 ueDl->cqiFlag = TRUE;
1952 rgSCHCmnDlSetUeAllocLmtLa(cell, ue);
1953 // rgSCHCheckAndSetTxScheme(cell, ue);
1958 fdbk = TFU_HQFDB_ACK;
1959 hqInfo.isAck[0] = fdbk;
1961 if (ue != NULLP && raCb == NULLP)
1963 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, rawCqiInd->timingInfo, fdbk, &err)) != ROK)
1965 err.errType = RGSCHERR_TOM_HARQACKIND;
1966 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
1967 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1968 err.errType, err.errCause);
1972 else if (ue == NULLP && raCb != NULLP)
1974 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1975 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1977 err.errType = RGSCHERR_TOM_HARQACKIND;
1978 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1979 " feedback processing failed errType(%d) errCause(%d)",
1980 err.errType, err.errCause);
1985 else if (ue != NULLP && raCb != NULLP)
1987 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1988 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1990 err.errType = RGSCHERR_TOM_HARQACKIND;
1991 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1992 " feedback processing failed errType(%d) errCause(%d).",
1993 err.errType, err.errCause);
1999 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
2000 "UE CB or RA CB ", rawCqiInfo->crnti);
2001 err.errType = RGSCHERR_TOM_HARQACKIND;
2006 printf("\nUE[%u] CQI[%u] MCS[%u] RI[%u] HQ[%u]\n", ue->ueId, cqi, ue->ue5gtfCb.mcs, ri, hqAck);
2011 if ((rgSCHDhmRlsDlsfHqProc (cell, rawCqiInd->timingInfo)) != ROK)
2013 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink "
2014 "subframe for cellId (%d) ", cell->cellId);
2015 err.errType = RGSCHERR_TOM_HARQACKIND;
2018 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
2020 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
2022 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
2024 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
2025 if(rlsHqBufs->numUes)
2027 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
2028 RgSchMacRlsHq (&pst, rlsHqBufs);
2030 rlsHqBufs->numUes = 0;
2034 } /* rgSCHTomRawCqiInd */
2037 * @brief Handler for processing SRS indication recieved from
2042 * Function: rgSCHTomSrsInd
2044 * Handler for SRS indication recieved from PHY
2047 * Invoked by: RgLiTfuSrsInd
2051 * - Invoke scheduler to indicate UL SRS rgSCHUtlSrsInd
2053 * @param[in] TfuSrsIndInfo *srsInd
2062 TfuSrsIndInfo *srsInd
2065 S16 rgSCHTomSrsInd(cell, srsInd)
2067 TfuSrsIndInfo *srsInd;
2074 if(cell->cellId != srsInd->cellId)
2076 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
2077 ":%d", srsInd->cellId);
2081 node = srsInd->srsRpt.first;
2082 for (;node; node=node->next)
2084 srsInfo = (TfuSrsRpt *)node->node;
2085 ue = rgSCHDbmGetUeCb (cell, srsInfo->ueId);
2088 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
2089 "UE CB", srsInfo->ueId);
2092 rgSCHUtlSrsInd(cell, ue, srsInfo, srsInd->timingInfo);
2093 rgSCHUtlHdlUlTransInd(cell, ue, srsInd->timingInfo);
2096 } /* rgSCHTomSrsInd */
2100 * Fun: rgSCHTomUtlGenIndices
2102 * Desc: This function reconstructs the Subband Indices for
2103 * of M selected Subbands conveyed by the UE for APeriodic Modes
2104 * 2-0 and 2-2. It decodes the Label which uniquely encodes M out
2112 * File: rg_sch_utl.c
2117 static S16 rgSCHTomUtlGenIndices
2123 TfuSubbandInfo* sbInfo
2126 static S16 rgSCHTomUtlGenIndices(label, posM, valN, valK, sbInfo)
2131 TfuSubbandInfo* sbInfo;
2134 uint8_t idx, kval, xval, xmin;
2137 for(kval=0; kval<posM;kval++)
2140 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe, (posM-kval-1));
2141 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe[posM-kval-1], (valN-xval-1));
2142 binCoe = rgSCHTomBinCoe[posM-kval-1][valN-xval-1];
2146 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe[posM-kval-1], (valN-xval-1));
2147 binCoe = rgSCHTomBinCoe[posM-kval-1][valN-xval-1];
2150 sbInfo[kval].numRb = valK;
2151 sbInfo[kval].rbStart = idx*valK;
2153 label = label-binCoe;
2156 } /* end of rgSCHTomUtlGenIndices*/
2160 * @brief Handler for processing decode failure indication recieved from
2165 * Function: rgSCHTomCrcInd
2167 * Handler for processing decode failure indication recieved from
2168 * PHY for a set of UEs.
2170 * Invoked by: RgLiTfuCrcInd of rg_sch.x
2173 * - Validate the information received and retrieve cell and ue.
2174 * - Process Decode failure Indication: Call rgSCHUhmProcHqFailure().
2176 * @param[in] TfuCrcIndInfo *crcInd
2185 TfuCrcIndInfo *crcInd
2188 S16 rgSCHTomCrcInd(cell, crcInd)
2190 TfuCrcIndInfo *crcInd;
2193 RgSchUeCb *ue = NULLP;
2194 RgSchRaCb *raCb = NULLP;
2196 TfuCrcInfo *crcInfo;
2197 #ifdef RG_ULSCHED_AT_CRC
2200 CmLteTimingInfo crntHiDci0Frm;
2201 //RgSchCmnUlCell *cellUl;
2202 Inst inst = cell->instIdx;
2203 TfuCntrlReqInfo *cntrlInfo;
2211 RgSchUlHqProcCb *hqProc;
2215 RgSchUlHqProcCb *ulHqProc;
2218 if(cell->cellId != crcInd->cellId)
2220 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
2221 ":%d", crcInd->cellId);
2224 #ifdef RG_ULSCHED_AT_CRC
2227 static CmLteTimingInfo lastCrc = {2000,0};
2228 CmLteTimingInfo crntCrc = cell->crntTime;
2229 if (RGSCH_TIMEINFO_SAME(lastCrc, crntCrc))
2231 /*Removed the WA to drop 2nd CRC*/
2232 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"Recieved CRC "
2233 "twice per TTI @(%u,%u)", cell->crntTime.sfn,
2234 cell->crntTime.slot);
2240 node = crcInd->crcLst.first;
2241 for (;node; node=node->next)
2243 crcInfo = (TfuCrcInfo*)node->node;
2244 ue = rgSCHDbmGetUeCb (cell, crcInfo->rnti);
2248 /* Fetch from SPS List */
2249 ue = rgSCHDbmGetSpsUeCb(cell, crcInfo->rnti);
2253 raCb = rgSCHDbmGetRaCb (cell, crcInfo->rnti);
2260 /* Added Ul TB count for Uplink data scheduled*/
2264 ulHqProc = &(raCb->msg3HqProc);
2265 if(ulHqProc->remTx == (cell->rachCfg.maxMsg3Tx -1))
2267 cell->dlUlTbCnt.tbTransUlTotalCnt++;
2272 rgSCHUtlUlHqProcForUe(cell, crcInd->timingInfo, ue, &ulHqProc);
2273 if(ulHqProc->remTx == ((RgUeUlHqCb*)ulHqProc->hqEnt)->maxHqRetx)
2275 cell->dlUlTbCnt.tbTransUlTotalCnt++;
2280 if (crcInfo->isFailure == FALSE)
2284 rgSCHRamMsg3DatInd(raCb);
2286 /*ccpu00128820 - MOD - Msg3 alloc double delete issue*/
2287 hqProc = &(raCb->msg3HqProc);
2288 RGSCH_UPD_PHICH(cell->ulDlCfgIdx, crcInd->timingInfo.slot,
2296 gUlCrcPassCounter++;
2301 RGSCHCPYTIMEINFO(crcInd->timingInfo, ue->datIndTime);
2302 #ifndef MAC_SCH_STATS
2303 rgSCHUhmProcDatInd(cell, ue, crcInd->timingInfo);
2306 /** Stats update over here
2309 RgSchCmnUe *cmnUe = RG_SCH_CMN_GET_UE(ue,cell);
2311 rgSCHUhmProcDatInd(cell, ue, crcInd->timingInfo, cmnUe->ul.crntUlCqi[0]);
2313 #endif /* MAC_SCH_STATS */
2315 rgSCHUtlHdlUlTransInd(cell, ue, crcInd->timingInfo);
2317 rgSCHUtlHdlCrcInd(cell, ue, crcInd->timingInfo);
2325 /* SR_RACH_STATS : MSG3 Nack / DTX*/
2326 if (crcInfo->isDtx == TRUE)
2332 rgNumMsg3CrcFailed++;
2334 rgSCHRamMsg3FailureInd(raCb);
2336 rgSCHCmnEmtcHdlCrcFailInd(cell, raCb);
2338 /* Added Ul TB count for CRC Failure of MSG3 */
2340 ulHqProc = &(raCb->msg3HqProc);
2341 if(ulHqProc->remTx == (cell->rachCfg.maxMsg3Tx -1))
2343 cell->dlUlTbCnt.tbTransUlFaulty++;
2351 gUlCrcFailCounter++;
2356 #ifndef MAC_SCH_STATS
2357 rgSCHUhmProcHqFailure (cell, ue, crcInd->timingInfo, crcInfo->rv);
2360 RgSchCmnUe *cmnUe = RG_SCH_CMN_GET_UE(ue,cell);
2362 rgSCHUhmProcHqFailure (cell, ue, crcInd->timingInfo, crcInfo->rv, cmnUe->ul.crntUlCqi[0]);
2364 #endif /* MAC_SCH_STATS */
2365 rgSCHUtlHdlUlTransInd(cell, ue, crcInd->timingInfo);
2367 rgSCHUtlHdlCrcFailInd(cell, ue, crcInd->timingInfo);
2369 /* Added Ul TB count for CRC Failure of Uplink data */
2371 rgSCHUtlUlHqProcForUe(cell, crcInd->timingInfo, ue, &ulHqProc);
2372 if(ulHqProc->remTx == ((RgUeUlHqCb*)ulHqProc->hqEnt)->maxHqRetx)
2374 cell->dlUlTbCnt.tbTransUlFaulty++;
2381 /* ccpu00132653-ADD Added Sched_At_Crc Changes for TDD and optimized here
2382 the codebase across TDD and FDD*/
2383 #ifdef RG_ULSCHED_AT_CRC
2384 /* Changes to do uplink scheduling at CRC Indication */
2385 //cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
2386 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, crntHiDci0Frm, TFU_ULCNTRL_DLDELTA);
2389 rgSCHCmnRlsUlSf(cell,0);
2392 /* Allocating memory for CntrlReq as it required for both EMTC and
2394 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&cntrlInfo,
2395 sizeof(TfuCntrlReqInfo))) != ROK)
2397 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate TfuCntrlReqInfo "
2401 rgSCHCmnUlSch(cell);
2403 rgSCHL2Meas(cell,TRUE);
2405 /* Also, sending UL DCI and PHICH for just scheduled subframe */
2406 ulSf = rgSCHUtlSubFrmGet (cell, crntHiDci0Frm);
2408 if ((rgSCHTomUtlProcDlSfAtCrc (ulSf, crntHiDci0Frm, cell, cntrlInfo, &err)) != ROK)
2410 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomCrcInd() Unable to process"
2411 " downlink subframe for cellId %d", crcInd->cellId);
2412 err.errType = RGSCHERR_TOM_TTIIND;
2415 #endif /* RG_ULSCHED_AT_CRC */
2417 } /* rgSCHTomCrcInd */
2420 * @brief Handler for processing timing Advance indication recieved from
2425 * Function: rgSCHTomTimingAdvInd
2427 * Handler for processing timing advance indication recieved from PHY
2430 * Invoked by: RgLiTfuTimingAdvInd
2434 * - Call DHM to update value of Timing Advance rgSCHDhmUpdTa.
2436 * @param[in] TfuTimingAdvIndInfo *timingAdvInd
2442 S16 rgSCHTomTimingAdvInd
2445 TfuTimingAdvIndInfo *timingAdvInd
2448 S16 rgSCHTomTimingAdvInd(cell, timingAdvInd)
2450 TfuTimingAdvIndInfo *timingAdvInd;
2455 TfuTimingAdvInfo *timingAdvInfo;
2457 if(cell->cellId != timingAdvInd->cellId)
2459 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
2460 "=(%d)", timingAdvInd->cellId);
2465 node = timingAdvInd->timingAdvLst.first;
2466 for (;node; node=node->next)
2468 timingAdvInfo = (TfuTimingAdvInfo *)node->node;
2469 ue = rgSCHDbmGetUeCb (cell, timingAdvInfo->rnti);
2472 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB",
2473 timingAdvInfo->rnti);
2476 rgSCHDhmUpdTa (cell, ue, timingAdvInfo->timingAdv);
2479 } /* rgSCHTomTimingAdvInd */
2482 * @brief Handler for processing TTI indication recieved from
2483 * PHY for 'n' cells.
2487 * Function: rgSCHTomTtiInd
2489 * Handler for processing slot indication recieved from MAC
2490 * for a cell. This is split into the below Steps.
2492 * 1: Complete the Uplink and Common Channel Scheduling for each Cell
2493 * 2: Complete the UE specific Scheduling for each Cell / across Cells.
2494 * 3: Consolidate the subframe allocations and send to each MAC instance
2495 * 4: Fill the Tfu structures for DL and UL Config requests
2496 * 5: Handle the RGR Config messages per Cell
2498 * @param[in] SlotIndInfo *slotInd
2499 * @param[in] Inst schInst
2505 SlotIndInfo *slotInd,
2509 Void rgSCHTomTtiInd(slotInd, schInst)
2510 SlotIndInfo *slotInd;
2514 RgInfSfAlloc *subfrmAlloc;
2515 RgTfuCntrlReqInfo *cntrlInfo = NULLP;
2519 RgSchCellCb *cell[CM_LTE_MAX_CELLS];
2520 RgSchCellCb *cellLst[CM_LTE_MAX_CELLS];
2526 //rgSchTomFillCellTtiInfo(slotInd, schInst, &nCell, &cell[0]);
2528 schFillCrntTime(*slotInd,schInst);
2529 for (i = 0; i < nCell; i++)
2531 /* Perform UL and DL Common Channel scheduling */
2532 rgSchTomTtiUlAndDlCmnChSch (cell[i]);
2535 /* Perform scheduling in Order of
2539 for (i = 0; i < nCell; i++)
2542 if (cell[i]->isDlDataAllwd && (cell[i]->stopDlSch == FALSE))
2544 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell[i]);
2545 /* Perform DL Retx scheduling */
2546 cellSch->apisDl->rgSCHDlRetxSched(cell[i], &cellSch->allocInfo);
2550 rgSchCmnPreDlSch(cell, nCell, cellLst);
2551 for (i = 0; i < nCell; i++)
2553 /* Perform DL scheduling */
2554 rgSchTomTtiDlSch (cellLst[i]);
2556 rgSchCmnPstDlSch(cell[0]);
2558 for (i = 0; i < nCell; i++)
2561 #ifndef RG_ULSCHED_AT_CRC
2562 /* Perform UL scheduling for TDD */
2563 rgSCHCmnUlSch (cell[i]);
2567 /* Init SF Alloc info per Cell */
2568 for (i = 0; i < nCell; i++)
2570 subfrmAlloc = &(cell[i]->sfAllocArr[cell[i]->crntSfIdx]);
2571 rgSCHUtlResetSfAlloc(subfrmAlloc,FALSE,TRUE);
2573 for (i = 0; i < nCell; i++)
2575 if (cell[i]->isDlDataAllwd && (cell[i]->stopSiSch == FALSE))
2577 subfrmAlloc = &(cell[i]->sfAllocArr[cell[i]->crntSfIdx]);
2579 * TFU_DLDATA_DLDELTA is used in this calculation because the subfrmAlloc
2580 * timingInfo which is being calculated here will be used by MAC
2582 RG_SCH_ADD_TO_CRNT_TIME(cell[i]->crntTime, subfrmAlloc->timingInfo,
2583 RG_DL_DELTA - TFU_DLDATA_DLDELTA);
2584 /* Consolidate the Allocations and send response to MAC instances */
2585 rgSchTomTtiCnsldtSfAlloc (cell[i]);
2589 for (i = 0; i < nCell; i++)
2591 if (cell[i]->isDlDataAllwd && (cell[i]->stopSiSch == FALSE))
2593 /* Send the consolidated Alloc Info to MAC instances */
2594 rgSCHCmnSndCnsldtInfo (cell[i]);
2598 for (i = 0; i < nCell; i++)
2600 /* Fill control data from scheduler to PHY */
2601 if ((ret = rgSCHUtlAllocEventMem((cell[i]->instIdx), (Ptr *)&cntrlInfo,
2602 sizeof(RgTfuCntrlReqInfo))) != ROK)
2604 RLOG_ARG0(L_ERROR,DBG_CELLID,cell[i]->cellId,"Unable to Allocate TfuCntrlReqInfo"
2610 /* Fill the TFU structures and send to CL */
2611 if(TRUE == cell[i]->emtcEnable)
2613 ret = rgSchEmtcTomTtiL1DlAndUlCfg (cell[i], cntrlInfo);
2617 && (NULLP != cntrlInfo))
2619 /* Fill the TFU structures and send to CL */
2620 rgSchTomTtiL1DlAndUlCfg (cell[i], cntrlInfo);
2624 rgSCHTomUtlSendSfnTick(cell[0]);
2627 for (i = 0; i < nCell; i++)
2629 /* Invoke non critical functions like measurements, etc */
2630 rgSchTomTtiMiscFunctions (cell[i]);
2635 uint32_t dbgUeIdChngAndDatReqInClCnt = 0;
2636 static uint32_t gTtiCount = 0;
2639 if(gTtiCount == 3000)
2641 #ifdef XEON_SPECIFIC_CHANGES
2642 printf("SChed:: (P/S)::(%u/%u) \n",
2643 gPrimarySchedCount,gSCellSchedCount);
2645 printf("\n HQFDBK :: %u\n",gHqFdbkCount);
2650 total = gPCellTb1AckCount + gPCellTb1NackCount + gPCellTb1DtxCount;
2651 total2 = gPCellTb2AckCount + gPCellTb2NackCount + gPCellTb2DtxCount;
2653 printf("\n PCell:: TB1:: (A/N/D)::(%u/%u/%u) TB2:: (A/N/D)::(%u/%u/%u)\n",
2654 gPCellTb1AckCount,gPCellTb1NackCount,gPCellTb1DtxCount,
2655 gPCellTb2AckCount,gPCellTb2NackCount,gPCellTb2DtxCount);
2656 if ((total != 0 ) && total2 != 0)
2658 printf("\n PCell:: TB1:: (AP/NP/DP)::(%.2f/%.2f/%.2f) TB2:: (AP/NP/DP)::(%.2f/%.2f/%.2f)\n",
2659 (float)gPCellTb1AckCount/total * 100,(float)gPCellTb1NackCount/total * 100,(float)gPCellTb1DtxCount/total * 100,
2660 (float)gPCellTb2AckCount/total2 *100 ,(float)gPCellTb2NackCount/total2 *100 ,(float)gPCellTb2DtxCount/total2 *2);
2663 total = gSCellTb1AckCount + gSCellTb1NackCount + gSCellTb1DtxCount;
2664 total2 = gSCellTb2AckCount + gSCellTb2NackCount + gSCellTb2DtxCount;
2667 printf("\n SCell:: TB1:: (A/N/D)::(%u/%u/%u) TB2:: (A/N/D)::(%u/%u/%u)\n",
2668 gSCellTb1AckCount,gSCellTb1NackCount,gSCellTb1DtxCount,
2669 gSCellTb2AckCount,gSCellTb2NackCount,gSCellTb2DtxCount);
2670 if ((total != 0 ) && total2 != 0)
2672 printf("\n SCell:: TB1:: (AP/NP/DP)::(%.2f/%.2f/%.2f) TB2:: (AP/NP/DP)::(%.2f/%.2f/%.2f)\n",
2673 (float)gSCellTb1AckCount/total * 100,(float)gSCellTb1NackCount/total * 100,(float)gSCellTb1DtxCount/total * 100,
2674 (float)gSCellTb2AckCount/total2 *100 ,(float)gSCellTb2NackCount/total2 *100 ,(float)gSCellTb2DtxCount/total2 *2);
2678 printf("\n CQI:: Recp(Pucch/Pusch):Rcvd(pcqi/rawacqireport/apcqi/AppReprt)::(%u/%u):(%u/%u/%u/%u)\n",
2679 gCqiRecpCount,gCqiRecpPuschCount,gCqiRcvdCount,gRawACqiCount,
2680 gACqiRcvdCount,gCqiReptToAppCount);
2682 printf("\n (F1BCS Count/Cqi/Ri/CqiDrop/PucchDrop/PuschCqiDrop)::(%u/%u/%u/%u/%u/%u)\n",
2683 gF1bCsCount,gCqiReqCount,gRiReqCount,gCqiDropCount,gPucchDropCount,gPuschCqiDropCount);
2685 printf("UL::(DCI0/CrcPass/CrcFail)::(%u/%u/%u)\n"
2686 "gPcellZeroBoOcc:%u\t gScellZeroBoOcc:%u dbgUeIdChngAndDatReqInClCnt: %u\n"
2687 "DelayedDatReqInMac: %u DelayedDatReqInCl : %u gIccPktRcvrMemDropCnt :%u\n",
2693 dbgUeIdChngAndDatReqInClCnt,
2694 dbgDelayedDatReqInMac,
2695 gDropDatReqCnt, gIccPktRcvrMemDropCnt);
2697 printf("SChed:: (P/S)::(%ld/%ld) \n",
2698 gPrimarySchedCount,gSCellSchedCount);
2700 printf("\n HQFDBK :: %ld\n",gHqFdbkCount);
2702 printf("\n PCell:: TB1:: (A/N/D)::(%ld/%ld/%ld) TB2:: (A/N/D)::(%ld/%ld/%ld)\n",
2703 gPCellTb1AckCount,gPCellTb1NackCount,gPCellTb1DtxCount,
2704 gPCellTb2AckCount,gPCellTb2NackCount,gPCellTb2DtxCount);
2706 printf("\n SCell:: TB1:: (A/N/D)::(%ld/%ld/%ld) TB2:: (A/N/D)::(%ld/%ld/%ld)\n",
2707 gSCellTb1AckCount,gSCellTb1NackCount,gSCellTb1DtxCount,
2708 gSCellTb2AckCount,gSCellTb2NackCount,gSCellTb2DtxCount);
2710 printf("\n CQI:: Recp(Pucch/Pusch):Rcvd(pcqi/rawacqireport/apcqi/AppReprt)::(%ld/%ld):(%ld/%ld/%ld/%ld)\n",
2711 gCqiRecpCount,gCqiRecpPuschCount,gCqiRcvdCount,gRawACqiCount,
2712 gACqiRcvdCount,gCqiReptToAppCount);
2713 printf("\n CQI:: PucchCqiSnrDropCnt/PucchCqiConfBitMaskDropCnt/PuschCqiConfMaskDropCount :: (%ld/%ld/%ld) \n",gCqiPucchLowSnrDropCount,gCqiPucchConfMaskDropCount,gCqiPuschConfMaskDropCount);
2715 printf("\n (F1BCS Count/Cqi/Ri/CqiDrop/PucchDrop/PuschCqiDrop)::(%ld/%ld/%ld/%ld/%ld/%ld)\n",
2716 gF1bCsCount,gCqiReqCount,gRiReqCount,gCqiDropCount,gPucchDropCount,gPuschCqiDropCount);
2718 printf("UL::(DCI0/CrcPass/CrcFail)::(%ld/%ld/%ld)\n"
2719 "gPcellZeroBoOcc:%ld\t gScellZeroBoOcc:%ld dbgUeIdChngAndDatReqInClCnt: %ld\n"
2720 "DelayedDatReqInMac: %ld DelayedDatReqInCl : %ld gIccPktRcvrMemDropCnt :%ld\n",
2726 dbgUeIdChngAndDatReqInClCnt,
2727 dbgDelayedDatReqInMac,
2728 gDropDatReqCnt, gIccPktRcvrMemDropCnt);
2729 //printf ("\n delayedApiCnt:%ld",delayedApiCnt);
2733 rgSCHLaaPrintStats();
2735 gCaDbgNonCaFrmt = gIccPktRcvrMemDropCnt = 0;
2747 gCqiPucchLowSnrDropCount = 0;
2748 gCqiPucchConfMaskDropCount = 0;
2749 gCqiPuschConfMaskDropCount = 0;
2750 gPuschCqiDropCount = 0;
2753 gUlCrcPassCount = 0;
2754 gUlCrcFailCount = 0;
2757 gCqiRecpPuschCount = 0;
2760 gCqiReptToAppCount = 0;
2765 gPrimarySchedCount = 0;
2766 gSCellSchedCount = 0;
2767 gSCellTb1AckCount = 0;
2768 gSCellTb2AckCount = 0;
2769 gSCellTb2AckCount = 0;
2770 gSCellTb2NackCount = 0;
2771 gPCellTb1AckCount = 0;
2772 gPCellTb1NackCount = 0;
2773 gPCellTb2AckCount = 0;
2774 gPCellTb2NackCount = 0;
2775 gSCellTb1NackCount=0;
2777 gPCellTb1DtxCount = 0;
2778 gPCellTb2DtxCount = 0;
2779 gSCellTb1DtxCount = 0;
2780 gSCellTb2DtxCount = 0;
2781 gPcellZeroBoOcc = 0;
2782 gScellZeroBoOcc = 0;
2790 } /* rgSCHTomTtiInd */
2792 /** @brief This function does the TTI processin for the uplink subframe,
2793 * already populated by the scheduler.
2797 * Function: rgSCHTomUtlProcUlSf
2800 * - Loop through the Uplink allocations present in the uplink subframe.
2801 * - For each allocation Fill a data reception request to be sent to PHY
2802 * - Also fills the harq reception requests for the expected HQ feedbacks.
2805 * @param [in] RgSchCellCb *cell
2806 * @param [out] RgSchErrInfo *err
2813 static S16 rgSCHTomUtlProcUlSf
2819 static S16 rgSCHTomUtlProcUlSf (cell, err)
2825 TfuRecpReqInfo *recpReqInfo;
2827 uint16_t validIdx = 0; /* Index computed from recreq's timing info*/
2829 Inst inst = cell->instIdx;
2831 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&recpReqInfo,
2832 sizeof(TfuRecpReqInfo))) != ROK)
2834 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate TfuRecpReqInfo "
2836 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
2839 recpReqInfo->cellId = cell->cellId;
2840 cmLListInit(&recpReqInfo->ueRecpReqLst);
2842 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, recpReqInfo->timingInfo,
2843 TFU_RECPREQ_DLDELTA);
2845 /* Filling data Reception requests */
2846 ret = rgSCHTomUtlFillDatRecpReq(recpReqInfo, cell,
2851 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to fill Data recption "
2852 "requests for cell");
2853 RGSCH_FREE_MEM(recpReqInfo);
2856 /* Filling HARQ Reception requests */
2857 ret = rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, validIdx,err);
2860 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to fill Harq Feedback "
2861 "reception requests for cell");
2862 RGSCH_FREE_MEM(recpReqInfo);
2865 /* sending the RecpReq to Phy */
2866 //if (rgSCHUtlTfuRecpReq(inst, cell->tfuSap->sapCfg.suId, recpReqInfo) != ROK)
2868 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info for cell");
2871 } /* end of rgSCHTomUtlProcUlSf */
2875 /** @brief This function does the TTI processin for the uplink subframe,
2876 * already populated by the scheduler.
2880 * Function: rgSCHTomUtlPrcUlTddSpclSf
2883 * - Fill the SRS Info for the Special Subframe in Reception Req.
2884 * - Send the Reception Req to TFU
2887 * @param [in] RgSchCellCb *cell
2888 * @param [out] RgSchErrInfo *err
2894 static S16 rgSCHTomUtlPrcUlTddSpclSf
2900 static S16 rgSCHTomUtlPrcUlTddSpclSf (cell, err)
2906 TfuRecpReqInfo *recpReqInfo;
2907 uint16_t validIdx; /* Index computed from recreq's timing info*/
2908 Inst inst = cell->instIdx;
2910 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&recpReqInfo,
2911 sizeof(TfuRecpReqInfo))) != ROK)
2913 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to "
2914 "Allocate TfuRecpReqInfo for cell");
2915 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
2918 recpReqInfo->cellId = cell->cellId;
2919 cmLListInit(&recpReqInfo->ueRecpReqLst);
2921 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, recpReqInfo->timingInfo, TFU_RECPREQ_DLDELTA);
2923 RG_SCH_GET_IDX_PCQISRSSR(recpReqInfo->timingInfo, validIdx);
2926 if(cell->srsCfg.isSrsCfgPres &&
2927 rgSchTddCellSpSrsSubfrmTbl[cell->srsCfg.srsSubFrameCfg][recpReqInfo->timingInfo.slot])
2929 recpReqInfo->srsPres = TRUE;
2933 recpReqInfo->srsPres = FALSE;
2936 /* Filling SRS Reception requests */
2937 ret = rgSCHTomUtlFillSrsRecpReq (recpReqInfo, cell, validIdx, err);
2940 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to fill"
2941 " SRS recption requests for cell");
2942 RGSCH_FREE_MEM(recpReqInfo);
2945 /* sending the RecpReq to Phy */
2946 //if (rgSCHUtlTfuRecpReq(inst, cell->tfuSap->sapCfg.suId, recpReqInfo) != ROK)
2948 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to send "
2949 "Cntrl info for cell");
2952 } /* end of rgSCHTomUtlPrcUlTddSpclSf */
2955 /** @brief This function does all the processing related to a single downlink
2960 * Function: rgSCHTomUtlProcDlSf
2963 * - collate control data for all UEs and send to PHY
2964 * - collate data buffers for all UEs and send to PHY
2966 * @param [in] RgSchDlSf *dlSf
2967 * @param [in] RgSchDlSf *ulSf
2968 * @param [in] RgSchCellCb *cell
2969 * @param [out] RgSchErrInfo *err
2973 static S16 rgSCHTomUtlProcDlSf
2978 RgTfuCntrlReqInfo *cntrlInfo,
2982 static S16 rgSCHTomUtlProcDlSf (dlSf, ulSf, cell, cntrlInfo, err)
2986 RgTfuCntrlReqInfo *cntrlInfo;
2990 Inst inst = cell->instIdx;
2992 uint8_t sfTyp = 1; /* Dl Subframe */
2994 cmLListInit(&cntrlInfo->phichLst);
2995 cmLListInit(&cntrlInfo->dlPdcchLst);
2996 cmLListInit(&cntrlInfo->ulPdcchLst);
2998 #ifdef TFU_ALLOC_EVENT_NO_INIT
2999 cntrlInfo->ulTiming.sfn = cntrlInfo->ulTiming.subframe = 0;
3001 cntrlInfo->dlTiming = cell->dlDciTime;
3002 cntrlInfo->cellId = cell->cellId;
3003 cntrlInfo->ulTiming = cell->hiDci0Time;
3004 if((0 == (cntrlInfo->dlTiming.sfn % 30)) && (0 == cntrlInfo->dlTiming.slot))
3006 //printf("5GTF_CHECK rgSCHTomUtlProcDlSf Cntrl dl (%d : %d) ul (%d : %d)\n", cntrlInfo->dlTiming.sfn, cntrlInfo->dlTiming.subframe, cntrlInfo->ulTiming.sfn, cntrlInfo->ulTiming.subframe);
3008 /* Fill PCFICH info */
3009 /* Fix for DCFI FLE issue: when DL delta is 1 and UL delta is 0 and CFI
3010 *change happens in that SF then UL PDCCH allocation happens with old CFI
3011 *but CFI in control Req goes updated one since it was stored in the CELL
3013 cntrlInfo->cfi = dlSf->pdcchInfo.currCfi;
3014 #ifndef RG_ULSCHED_AT_CRC
3017 Mval = rgSchTddPhichMValTbl[cell->ulDlCfgIdx]
3018 [cell->hiDci0Time.subframe];
3019 if(dlSf->sfType == RG_SCH_SPL_SF_DATA)
3021 RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, cntrlInfo->cfi);
3026 /* Fill PHICH info */
3027 if ((ret = rgSCHTomUtlFillPhich (cell, cntrlInfo, ulSf, err)) != ROK)
3029 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PHICH info "
3030 "for cellId (%d)\n", cell->cellId));
3031 RGSCH_FREE_MEM(cntrlInfo);
3034 if ((ret = rgSCHTomUtlFillUlPdcch (cell, cntrlInfo, ulSf, err)) !=
3037 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PDCCH info "
3038 "for cellId (%d)\n", cell->cellId));
3039 RGSCH_FREE_MEM(cntrlInfo);
3044 if(0 == cntrlInfo->ulMpdcchLst.count)
3051 sfTyp = rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
3052 [cell->dlDciTime.subframe];
3054 if (sfTyp != 2) /* Uplink subframe */
3056 /* Fill PDCCH info */
3057 if ((ret = rgSCHTomUtlFillDlPdcch(cell,cntrlInfo, dlSf, err)) != ROK)
3059 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PDCCH info "
3060 "for cellId (%d)\n", cell->cellId));
3061 RGSCH_FREE_MEM(cntrlInfo);
3064 rgBwAlloInfo[dlSf->sfNum] += dlSf->bwAssigned;
3065 rgBwAlcnt[dlSf->sfNum] ++;
3068 #ifdef LTEMAC_SPS /* SPS_NEW_CHGS */
3069 cntrlInfo->isSPSOcc = dlSf->isSPSOcc;
3071 cntrlInfo->numDlActvUes += dlSf->numDlActvUes; /* 4UE_TTI_DELTA */
3072 dlSf->numDlActvUes = 0;
3074 if(0 == cntrlInfo->dlMpdcchLst.count)
3079 /* Now always sending down a cntrl req */
3080 /* sending the cntrl data to Phy */
3081 //if (rgSCHUtlTfuCntrlReq(inst, cell->tfuSap->sapCfg.suId, cntrlInfo)
3084 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info "
3092 /** @brief This function handles sending of the PHICH information for the
3093 * downlink subframe to be sent in the next TTI.
3100 * - Loop through the PHICH information present in the downlink
3101 * subframe and fill the information in cntrlInfo.
3103 * @param [out] TfuCntrlReqInfo *cntrlInfo
3104 * @param [in] RgSchDlSf *dlSf
3105 * @param [out] RgSchErrInfo *err
3111 static S16 rgSCHTomUtlFillPhich
3114 TfuCntrlReqInfo *cntrlInfo,
3119 static S16 rgSCHTomUtlFillPhich(cell, cntrlInfo, dlSf, err)
3121 TfuCntrlReqInfo *cntrlInfo;
3129 TfuPhichInfo *harqAck;
3131 RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
3135 /* Traversing the list of Phichs */
3136 node = dlSf->phichInfo.phichs.first;
3139 phich = (RgSchPhich*)node->node;
3140 if ((ret = rgSCHUtlGetEventMem((Ptr *)&harqAck, sizeof(TfuPhichInfo),
3141 &(cntrlInfo->memCp))) != ROK)
3143 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3146 #ifdef TFU_ALLOC_EVENT_NO_INIT
3147 harqAck->txPower = 0;
3149 /* fill in the tfu structure from the information present in the
3151 harqAck->rbStart = phich->rbStart;
3152 harqAck->nDmrs = phich->nDmrs;
3153 harqAck->isAck = phich->hqFeedBack;
3154 harqAck->isForMsg3 = phich->isForMsg3; /*SR_RACH_STATS : PHICH ACK/NACK for MSG3 */
3156 /* Changes for passing iPhich at TFU interface*/
3157 harqAck->iPhich = phich->iPhich;
3159 /* ccpu00138898 - Added Tx pwr offset for PHICH Tx*/
3161 harqAck->txPower = cellDl->phichTxPwrOffset;
3163 cmLListAdd2Tail(&cntrlInfo->phichLst, &(harqAck->lnk));
3164 harqAck->lnk.node = (PTR)harqAck;
3166 } /* end of while */
3172 /** @brief This function is a utility function to restart
3173 * deactivation timer.
3177 * Function: rgSCHTmrRestartScellDeactTmr
3180 * - Starts timer at scheduler
3182 * @param[in] RgSchCellCb *cell
3183 * @param[in] CmLteRnti rnti
3187 static Void rgSCHTmrRestartScellDeactTmr
3193 static Void rgSCHTmrRestartScellDeactTmr (cell, ueCb)
3199 RgSchUeCellInfo *sCellInfo = NULLP;
3203 if(RG_SCH_IS_CELL_SEC(ueCb, cell))
3205 sCellInfo = ueCb->cellInfo[(ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)])];
3207 if(sCellInfo->deactTmr.tmrEvnt != TMR_NONE)
3209 rgSCHTmrStopTmr(cell, RG_SCH_TMR_SCELL_DEACT, sCellInfo);
3211 if(PRSNT_NODEF == ueCb->sCellDeactTmrVal.pres)
3214 rgSCHTmrStartTmr(cell,sCellInfo,RG_SCH_TMR_SCELL_DEACT,
3215 ueCb->sCellDeactTmrVal.val);
3220 }/*end of rgSCHTmrRestartScellDeactTmr*/
3223 /** @brief This function will send all the PDCCH's for the given downlink
3231 * - Loop through all the scheduled HARQ processes and fill
3232 * the PDCCH information in cntrlInfo.
3234 * @param [out] TfuCntrlReqInfo *cntrlInfo
3235 * @param [in] RgSchDlSf *dlSf
3236 * @param [out] RgSchErrInfo *err
3241 uint32_t numdlSpsRelSentToTf;
3243 static S16 rgSCHTomUtlFillDlPdcch
3246 TfuCntrlReqInfo *cntrlInfo,
3251 static S16 rgSCHTomUtlFillDlPdcch(cell,cntrlInfo, dlSf, err)
3253 TfuCntrlReqInfo *cntrlInfo;
3261 TfuPdcchInfo *tfuPdcch;
3262 uint8_t isDcivld = FALSE;
3263 uint8_t numUePerTti = 0;
3266 /* Traversing the scheduled Harq processes */
3267 node = dlSf->pdcchInfo.pdcchs.first;
3270 pdcch = (RgSchPdcch*)node->node;
3271 switch(pdcch->dci.dciFormat)
3273 case TFU_DCI_FORMAT_3:
3274 isDcivld = (pdcch->dci.u.format3Info.isPucch) ? TRUE : FALSE;
3277 case TFU_DCI_FORMAT_3A:
3278 isDcivld = (pdcch->dci.u.format3AInfo.isPucch) ? TRUE : FALSE;
3291 /*ccpu00117179 - ADD - Build only non DCI format-0 messages */
3292 if((pdcch->dci.dciFormat == TFU_DCI_FORMAT_0) ||
3293 (pdcch->dci.dciFormat == TFU_DCI_FORMAT_A1) ||
3294 (pdcch->dci.dciFormat == TFU_DCI_FORMAT_A2))
3301 #ifdef RGSCH_SPS_STATS
3302 if((pdcch->dci.dciFormat == TFU_DCI_FORMAT_1A) &&
3303 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.mcs == 0x1F) &&
3304 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.type == TFU_ALLOC_TYPE_RIV) &&
3305 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.u.riv == 0xFFFFFFFF))
3307 numdlSpsRelSentToTf++;
3311 if ((ret = rgSCHUtlGetEventMem((Ptr *)&tfuPdcch, sizeof(TfuPdcchInfo),
3312 &(cntrlInfo->memCp))) != ROK)
3314 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3318 tfuPdcch->crnti = pdcch->crnti;
3319 tfuPdcch->isSpsRnti = pdcch->isSpsRnti;
3321 tfuPdcch->rnti = pdcch->rnti;
3324 rgSCHTmrRestartScellDeactTmr(cell,pdcch->ue);
3326 tfuPdcch->dciNumOfBits = pdcch->dciNumOfBits;
3328 tfuPdcch->nCce = pdcch->nCce;
3329 tfuPdcch->aggrLvl = pdcch->aggrLvl;
3330 tfuPdcch->dci = pdcch->dci;
3332 //TODO_SID: Need to check these values during INT
3333 tfuPdcch->sectorId = 0;
3334 tfuPdcch->sccIdx = 0;
3337 /* SR_RACH_STATS : Reset isTBMsg4 */
3338 pdcch->dci.u.format1aInfo.t.pdschInfo.isTBMsg4 = FALSE;
3339 /* To be enhanced later for 2.1 */
3340 cmLListAdd2Tail(&cntrlInfo->dlPdcchLst, &(tfuPdcch->lnk));
3341 tfuPdcch->lnk.node = (PTR)tfuPdcch;
3343 if((pdcch->rnti > 60) && (pdcch->rnti < 5000))
3345 #if defined (TENB_STATS) && defined (RG_5GTF)
3346 cell->tenbStats->sch.dl5gtfPdcchSend++;
3350 } /* end of while */
3352 if((numUePerTti) && (numUePerTti < RG_MAX_NUM_UE_PER_TTI ))
3354 cell->dlNumUeSchedPerTti[numUePerTti-1]++;
3356 gDlNumUePerTti[numUePerTti-1]++;
3360 } /* end of rgSCHTomUtlFillDlPdcch*/
3362 #ifdef RGSCH_SPS_STATS
3363 uint32_t rgSchSpsRelSentToTf;
3364 uint32_t rgSchSpsRelPdcchAllocd;
3366 /** @brief This function will send all the UL PDCCH's for the given
3374 * - Loop through all the scheduled HARQ processes and fill
3375 * the PDCCH information in cntrlInfo.
3377 * @param [out] TfuCntrlReqInfo *cntrlInfo
3378 * @param [in] RgSchDlSf *dlSf
3379 * @param [out] RgSchErrInfo *err
3385 static S16 rgSCHTomUtlFillUlPdcch
3388 TfuCntrlReqInfo *cntrlInfo,
3393 static S16 rgSCHTomUtlFillUlPdcch(cntrlInfo, dlSf, err)
3395 TfuCntrlReqInfo *cntrlInfo;
3403 TfuPdcchInfo *tfuPdcch;
3404 uint8_t isDcivld = FALSE;
3407 /* Traversing the scheduled Harq processes */
3408 node = dlSf->pdcchInfo.pdcchs.first;
3411 pdcch = (RgSchPdcch*)node->node;
3413 /*ccpu00116712- Function should pick only UL allocation related control
3415 switch(pdcch->dci.dciFormat)
3417 case TFU_DCI_FORMAT_A1:
3421 case TFU_DCI_FORMAT_A2:
3425 case TFU_DCI_FORMAT_3:
3426 isDcivld = (pdcch->dci.u.format3Info.isPucch) ? FALSE : TRUE;
3429 case TFU_DCI_FORMAT_3A:
3430 isDcivld = (pdcch->dci.u.format3AInfo.isPucch) ? FALSE : TRUE;
3445 /*ccpu00116712- Function should pick only UL allocation related control
3447 if ((ret = rgSCHUtlGetEventMem((Ptr *)&tfuPdcch, sizeof(TfuPdcchInfo),
3448 &(cntrlInfo->memCp))) != ROK)
3450 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3453 tfuPdcch->rnti = pdcch->rnti;
3455 rgSCHTmrRestartScellDeactTmr(cell,pdcch->ue);
3457 tfuPdcch->dciNumOfBits = pdcch->dciNumOfBits;
3459 tfuPdcch->nCce = pdcch->nCce;
3460 tfuPdcch->aggrLvl = pdcch->aggrLvl;
3461 tfuPdcch->dci = pdcch->dci;
3463 //TODO_SID: Need to check these values during INT
3464 tfuPdcch->sectorId = 0;
3465 tfuPdcch->sccIdx = 0;
3468 /* To be enhanced later for 2.1 */
3470 #if defined (TENB_STATS) && defined (RG_5GTF)
3471 cell->tenbStats->sch.ul5gtfPdcchSend++;
3473 cmLListAdd2Tail(&cntrlInfo->ulPdcchLst, &(tfuPdcch->lnk));
3474 tfuPdcch->lnk.node = (PTR)tfuPdcch;
3475 } /* end of while */
3477 #ifdef RGSCH_SPS_STATS
3478 if (rgSchSpsRelSentToTf != rgSchSpsRelPdcchAllocd)
3484 } /* end of rgSCHTomUtlFillUlPdcch*/
3486 /** @brief This function does the processing for Timing adjustment.
3493 * - Loop through the ue present ueTimeLst, decrement the remaining
3497 * @param [in] RgSchCellCb *cell
3503 static S16 rgSCHTomUtlProcTA
3508 static S16 rgSCHTomUtlProcTA (cell)
3515 node = cell->taUeLst.first;
3518 ue = (RgSchUeCb *)node->node;
3520 if (ue->dl.taCb.numRemSf == 0)
3522 ue->dl.taCb.state = RGSCH_TA_IDLE;
3523 /* If Outstanding Ta is present, schedule it */
3524 if(ue->dl.taCb.outStndngTa == TRUE)
3526 rgSCHUtlReTxTa(cell, ue);
3530 /* We need to reset state and also value of TA,
3531 * then we start the timer */
3532 ue->dl.taCb.ta = RGSCH_NO_TA_RQD;
3533 /* Start the timer only if TA is cfgd as FINITE value */
3534 if (ue->dl.taCb.cfgTaTmr)
3536 rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_TA, ue->dl.taCb.cfgTaTmr);
3539 /* need to delete from the link list */
3540 cmLListDelFrm(&(cell->taUeLst), &(ue->taLnk));
3541 ue->taLnk.node = NULLP;
3545 ue->dl.taCb.numRemSf--;
3547 } /* end of taUeLst */
3549 } /* end of rgSCHTomUtlProcTA */
3551 /** @brief This function handles filling of Hq reception request to
3566 S16 rgSCHTomUtlFillHqFdbkInfo
3568 TfuRecpReqInfo *recpReqInfo,
3571 RgSchDlHqProcCb *hqCb,
3573 TfuUeRecpReqInfo *pucchRecpInfo,
3574 RgSchDlHqProcCb *prvHqCb,
3578 S16 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, validIdx, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err)
3579 TfuRecpReqInfo *recpReqInfo;
3582 RgSchDlHqProcCb *hqCb;
3584 TfuUeRecpReqInfo *pucchRecpInfo;
3585 RgSchDlHqProcCb *prvHqCb;
3590 S16 rgSCHTomUtlFillHqFdbkInfo
3592 TfuRecpReqInfo *recpReqInfo,
3594 RgSchDlHqProcCb *hqCb,
3596 TfuUeRecpReqInfo *pucchRecpInfo,
3597 RgSchDlHqProcCb *prvHqCb,
3601 S16 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err)
3602 TfuRecpReqInfo *recpReqInfo;
3604 RgSchDlHqProcCb *hqCb;
3606 TfuUeRecpReqInfo *pucchRecpInfo;
3607 RgSchDlHqProcCb *prvHqCb;
3613 RgSchDlHqTbCb *tbCb;
3615 Bool isAddToLst = FALSE;
3617 for (idx = 0 ;idx < 2; idx++)
3619 if (HQ_TB_WAITING == hqCb->tbInfo[idx].state)
3621 tbCb = &hqCb->tbInfo[idx];
3623 /* FOR ACK NAK REP */
3624 if ((hqCb->hqE->ue != NULLP) &&
3625 (hqCb->hqE->ue->measGapCb.isMeasuring == TRUE))
3627 if ((tbCb->fbkRecpRepCntr) &&
3628 (--tbCb->fbkRecpRepCntr))
3630 /* Add to next subfarme */
3631 /* Add this hqCb to the next dlSf's ackNakRepQ */
3632 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
3633 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
3634 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
3635 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
3638 rgSCHTomUtlMoveNxtOccasion(cell, hqCb->hqE->ue, validIdx);
3646 /* Go to the next node */
3652 //if (hqCb != prvHqCb)
3654 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
3655 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
3658 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
3659 "TfuUeRecpReqInfo for cell");
3660 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3663 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
3664 if ((hqCb->hqE->ue != NULLP) /*&&
3665 ((tbCb->lchSchdData[0].lcId != 0) || (tbCb->taSnt ==
3669 pucchRecpInfo->rnti = hqCb->hqE->ue->ueId;
3673 if (hqCb->hqE->raCb)
3675 pucchRecpInfo->rnti = hqCb->hqE->raCb->tmpCrnti;
3681 if (!hqCb->spsN1PucchRes.pres)
3684 pucchRecpInfo->t.pucchRecpReq.hqType =
3685 TFU_HQ_RECP_REQ_NORMAL;
3686 pucchRecpInfo->t.pucchRecpReq.t.nCce =
3692 pucchRecpInfo->t.pucchRecpReq.hqType =
3693 TFU_HQ_RECP_REQ_N1PUCCH;
3694 pucchRecpInfo->t.pucchRecpReq.t.n1Pucch =
3695 hqCb->spsN1PucchRes.val;
3699 /* Handling of other types */
3700 pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
3701 #else /* TFU_UPGRADE */
3702 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
3703 if ((hqCb->tbInfo[0].state == HQ_TB_WAITING) &&
3704 (hqCb->tbInfo[1].state == HQ_TB_WAITING))
3706 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz = 2; /* MIMO */
3710 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz = 1; /* NON-MIMO */
3714 /* PucchRecpReq needs to be filled up for n1Pucch resource for SPS
3716 if (hqCb->spsN1PucchRes.pres)
3718 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
3721 #endif /* LTEMAC_SPS */
3723 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
3724 cell->pucchCfg.n1PucchAn);
3727 rgSCHEmtcFillPucchRecpInfo(cell, hqCb, &(pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0]));
3730 #endif/*TFU_UPGRADE*/
3733 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, hqCb->hqE->ue,
3734 pucchRecpInfo, validIdx,FALSE);
3737 /* Passing last parameter as FALSE in this case as it will be verified from hqCb*/
3738 isAddToLst = rgSCHEmtcAddRecpInfoToLst(hqCb,recpReqInfo, pucchRecpInfo,FALSE);
3742 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
3744 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
3747 if ((tbCb->fbkRecpRepCntr) &&
3748 (--tbCb->fbkRecpRepCntr))
3750 /* Add to next subfarme */
3751 /* Add this hqCb to the next dlSf's ackNakRepQ */
3752 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
3753 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
3754 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
3755 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
3761 }/* end of rgSCHTomUtlFillHqFdbkInfo */
3764 /** @brief This function handles filling of Hq reception request to
3769 * Function:rgSCHTomUtlFillHqFdbkFor5gtf
3773 * @param [out] TfuRecpReqInfo *recpReqInfo
3774 * @param [in] RgSchCellCb *cell
3775 * @param [in] uint16_t validIdx,
3776 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
3777 * @param [in] RgSchDlSf *dlSf,
3778 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
3779 * @param [out] RgSchErrInfo *err
3786 static S16 rgSCHTomUtlFillHqFdbkFor5gtf
3788 TfuRecpReqInfo *recpReqInfo,
3791 RgSchDlHqInfo *dlSfHqInfo,
3793 TfuUeRecpReqInfo *pucchRecpInfo,
3797 static S16 rgSCHTomUtlFillHqFdbkFor5gtf (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err)
3798 TfuRecpReqInfo *recpReqInfo;
3801 RgSchDlHqInfo *dlSfHqInfo;
3803 TfuUeRecpReqInfo *pucchRecpInfo;
3808 Inst inst = cell->instIdx;
3812 TfuUePucchRecpReq *pucchReqInfo = NULLP;
3814 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
3820 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
3821 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
3824 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate "
3825 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId));
3826 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3829 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
3830 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
3831 * instead of SPS-CRNTI */
3833 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
3835 pucchReqInfo->uciInfo = TFU_XPUCCH_UCI_INFO;
3837 /* 5gtf TODO : Hardcoded nPUCCHIdx */
3838 pucchReqInfo->uciPduInfo.pucchIndex = 0;
3840 pucchReqInfo->uciPduInfo.numBits = 1;
3842 /* 5gtf TODO : CQI Periodicity Hardcoded to (n,0)*/
3843 if (RGSCH_TIMEINFO_SAME (recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn))
3845 pucchReqInfo->uciPduInfo.numBits += 5;
3846 RG_SCH_ADD_TO_CRNT_TIME(recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn,
3847 ue->ue5gtfCb.cqiRiPer);
3850 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
3851 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
3853 }/* end of rgSCHTomUtlFillHqFdbkForFrmt1B */
3857 /** @brief This function handles filling of Hq reception request to
3862 * Function:rgSCHTomUtlFillHqFdbkForFrmt1B
3865 * Allocates the N1Pucch Resources based on teh A Value
3867 * @param [out] TfuRecpReqInfo *recpReqInfo
3868 * @param [in] RgSchCellCb *cell
3869 * @param [in] uint16_t validIdx,
3870 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
3871 * @param [in] RgSchDlSf *dlSf,
3872 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
3873 * @param [out] RgSchErrInfo *err
3881 static S16 rgSCHTomUtlFillHqFdbkForFrmt1B
3883 TfuRecpReqInfo *recpReqInfo,
3886 RgSchDlHqInfo *dlSfHqInfo,
3888 TfuUeRecpReqInfo *pucchRecpInfo,
3892 static S16 rgSCHTomUtlFillHqFdbkForFrmt1B (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err)
3893 TfuRecpReqInfo *recpReqInfo;
3896 RgSchDlHqInfo *dlSfHqInfo;
3898 TfuUeRecpReqInfo *pucchRecpInfo;
3903 static S16 rgSCHTomUtlFillHqFdbkForFrmt1B
3905 TfuRecpReqInfo *recpReqInfo,
3907 RgSchDlHqInfo *dlSfHqInfo,
3909 TfuUeRecpReqInfo *pucchRecpInfo,
3913 static S16 rgSCHTomUtlFillHqFdbkForFrmt1B (recpReqInfo, cell, hqCb, dlSf, pucchRecpInfo, err)
3914 TfuRecpReqInfo *recpReqInfo;
3916 RgSchDlHqInfo *dlSfHqInfo;
3918 TfuUeRecpReqInfo *pucchRecpInfo;
3924 Inst inst = cell->instIdx;
3928 RgSchDlHqProcCb *hqCb = NULLP;
3930 TfuUePucchRecpReq *pucchReqInfo = NULLP;
3931 Bool isDatPresOnSecCell = FALSE;
3932 uint8_t primCellTbCount = 0;
3934 hqPNode = dlSfHqInfo->hqPLst.first;
3935 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
3941 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
3942 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
3945 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate "
3946 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId));
3947 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3950 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
3951 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
3952 * instead of SPS-CRNTI */
3954 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
3957 pucchReqInfo->hqType = TFU_HQ_RECP_REQ_NORMAL;
3958 /* Handling of other types */
3959 pucchReqInfo->type = TFU_UCI_HARQ;
3960 #else /* TFU_UPGRADE */
3961 pucchReqInfo->uciInfo = TFU_PUCCH_HARQ;
3962 /* Fill hqFdbkMode by using uciFrmtTyp from dlSfHqInfo */
3963 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
3964 /* Fill HqSz by using totalTbCnt based on the TM mode and
3965 * the number of serv cells configured*/
3967 pucchReqInfo->hqInfo.hqSz = ue->f1bCsAVal;
3968 pucchReqInfo->hqInfo.pucchResCnt = ue->f1bCsAVal;
3970 memset(pucchReqInfo->hqInfo.hqRes,0xff,sizeof(uint16_t)*TFU_MAX_HQ_RES);
3972 /* Two Resources needs to be configured if the
3973 * serving cell is in mimo mode else single
3975 if ((dlSf->relPdcch != NULLP) &&
3976 (RGSCH_TIMEINFO_SAME(recpReqInfo->timingInfo, ue->relPdcchFbkTiming)))
3977 {/* Pcell is having sps rel pdcch present */
3978 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
3979 {/* prim cell is in mimo mode, use 0 and 1 */
3980 pucchReqInfo->hqInfo.hqRes[0] = (dlSf->relPdcch->nCce +
3981 cell->pucchCfg.n1PucchAn);
3982 pucchReqInfo->hqInfo.hqRes[1] = pucchReqInfo->hqInfo.hqRes[0] + 1;
3987 pucchReqInfo->hqInfo.hqRes[2] = (dlSf->relPdcch->nCce +
3988 cell->pucchCfg.n1PucchAn);
3990 /* Release the pdcch so that it will not further processed */
3991 rgSCHUtlPdcchPut(ue->cell,&dlSf->pdcchInfo, dlSf->relPdcch);
3992 dlSf->relPdcch = NULLP;/* only one UE will be scheduled for release pdcch order in one tti */
3994 #endif/*LTEMAC_SPS*/
3995 #endif/*TFU_UPGRADE*/
3998 hqCb = (RgSchDlHqProcCb *)hqPNode->node;
3999 hqPNode = hqPNode->next;
4000 /* In case of CSI + 1BCS , CSI will be
4001 * dropped if scheduling is present on
4002 * seconday cell.36.213 10.1.1
4004 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4006 isDatPresOnSecCell = TRUE;
4009 if ((hqCb->tbInfo[0].state == HQ_TB_WAITING) &&
4010 (hqCb->tbInfo[1].state == HQ_TB_WAITING))
4012 primCellTbCount = 2;
4015 primCellTbCount = 1;
4019 pucchReqInfo->t.nCce = hqCb->pdcch->nCce;
4022 switch(ue->f1bCsAVal)
4024 case RG_SCH_A_VAL_2:
4025 /* harq(0) is primary harq(1) is secondary) */
4026 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4028 pucchReqInfo->hqInfo.hqRes[1] = ue->n1PucchF1bResCb.\
4029 cw1N1Res[hqCb->tpc].n1PucchIdx;
4031 else/* primary cell */
4034 /* Need to consider only sps occasions */
4035 if (hqCb->spsN1PucchRes.pres)
4037 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
4040 #endif /* LTEMAC_SPS */
4043 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
4044 cell->pucchCfg.n1PucchAn);
4048 case RG_SCH_A_VAL_3:
4049 /* Serving cell in mimo mode should be
4050 * in 0 and 1 and the serving cell in siso
4051 * mode should be in 2 indices */
4052 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4054 uint8_t cellIdx = ue->cellIdToCellIdxMap[RG_SCH_CELLINDEX(hqCb->hqE->cell)];
4055 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[cellIdx]->txMode.txModeEnum) > 1)
4056 {/* Sec cell is in mimo mode, use 0 and 1 */
4057 pucchReqInfo->hqInfo.hqRes[0] =
4058 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
4060 pucchReqInfo->hqInfo.hqRes[1] =
4061 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
4064 {/* Sec cell is in siso mode, use 2 */
4065 pucchReqInfo->hqInfo.hqRes[2] =
4066 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
4070 {/* primary cell hq */
4071 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
4072 {/* prim cell is in mimo mode, use 0 and 1 */
4074 if (hqCb->spsN1PucchRes.pres)
4075 {/* SPS occasions */
4076 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
4077 pucchReqInfo->hqInfo.hqRes[1] = hqCb->spsN1PucchRes.val + 1;
4080 #endif /* LTEMAC_SPS */
4082 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
4083 cell->pucchCfg.n1PucchAn);
4084 pucchReqInfo->hqInfo.hqRes[1] = (hqCb->pdcch->nCce +
4085 cell->pucchCfg.n1PucchAn + 1);
4089 {/* prim cell is in siso mode use 2 */
4091 /* Need to consider only sps occasions */
4092 if (hqCb->spsN1PucchRes.pres)
4094 pucchReqInfo->hqInfo.hqRes[2] = hqCb->spsN1PucchRes.val;
4097 #endif /* LTEMAC_SPS */
4100 pucchReqInfo->hqInfo.hqRes[2] = (hqCb->pdcch->nCce +
4101 cell->pucchCfg.n1PucchAn);
4107 case RG_SCH_A_VAL_4:
4109 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4110 {/* 2 and 3 for sec cell */
4111 pucchReqInfo->hqInfo.hqRes[2] =
4112 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
4113 pucchReqInfo->hqInfo.hqRes[3] =
4114 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
4116 else/* primary cell */
4117 {/* 0 and 1 are for primary cell */
4119 /* Need to consider only sps occasions */
4120 if (hqCb->spsN1PucchRes.pres)
4122 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
4123 pucchReqInfo->hqInfo.hqRes[1] = hqCb->spsN1PucchRes.val + 1;
4126 #endif /* LTEMAC_SPS */
4129 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
4130 cell->pucchCfg.n1PucchAn);
4131 pucchReqInfo->hqInfo.hqRes[1] = (hqCb->pdcch->nCce +
4132 cell->pucchCfg.n1PucchAn + 1);
4139 /* TOD:: Add error print */
4143 #endif/*TFU_UPGRADE*/
4154 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, ue,
4155 pucchRecpInfo, validIdx,isDatPresOnSecCell);
4157 /* Channel selection wil not be used in case of
4158 * CQI + HARQ. if the data was present only on
4160 if((isDatPresOnSecCell == FALSE) &&
4161 (dlSfHqInfo->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS))
4162 {/* Data is present only on primary cell */
4164 switch(pucchReqInfo->uciInfo)
4166 case TFU_PUCCH_HARQ_SRS:
4167 case TFU_PUCCH_HARQ_CQI:
4168 case TFU_PUCCH_HARQ_SR_SRS:
4169 case TFU_PUCCH_HARQ_SR_CQI:
4171 dlSfHqInfo->uciFrmtTyp = RG_SCH_UCI_FORMAT1A_1B;
4172 pucchReqInfo->hqInfo.hqSz = primCellTbCount;
4173 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
4182 #endif/*TFU_UPGRADE*/
4183 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4184 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4186 }/* end of rgSCHTomUtlFillHqFdbkForFrmt1B */
4187 /** @brief This function handles filling of Hq reception request to
4192 * Function:rgSCHTomUtlFillHqFdbkForFrmt3
4195 * Allocates the N1Pucch Resources based on teh A Value
4197 * @param [out] TfuRecpReqInfo *recpReqInfo
4198 * @param [in] RgSchCellCb *cell
4199 * @param [in] uint16_t validIdx,
4200 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
4201 * @param [in] RgSchDlSf *dlSf,
4202 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
4203 * @param [out] RgSchErrInfo *err
4211 static S16 rgSCHTomUtlFillHqFdbkForFrmt3
4213 TfuRecpReqInfo *recpReqInfo,
4216 RgSchDlHqInfo *dlSfHqInfo,
4218 TfuUeRecpReqInfo *pucchRecpInfo,
4222 static S16 rgSCHTomUtlFillHqFdbkForFrmt3 (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err)
4223 TfuRecpReqInfo *recpReqInfo;
4226 RgSchDlHqInfo *dlSfHqInfo;
4228 TfuUeRecpReqInfo *pucchRecpInfo;
4233 static S16 rgSCHTomUtlFillHqFdbkForFrmt3
4235 TfuRecpReqInfo *recpReqInfo,
4237 RgSchDlHqInfo *dlSfHqInfo,
4239 TfuUeRecpReqInfo *pucchRecpInfo,
4243 static S16 rgSCHTomUtlFillHqFdbkForFrmt3 (recpReqInfo, cell, hqCb, dlSf, pucchRecpInfo, err)
4244 TfuRecpReqInfo *recpReqInfo;
4246 RgSchDlHqInfo *dlSfHqInfo;
4248 TfuUeRecpReqInfo *pucchRecpInfo;
4254 Inst inst = cell->instIdx;
4259 TfuUePucchRecpReq *pucchReqInfo = NULLP;
4261 //hqPNode = dlSfHqInfo->hqPLst.first;
4262 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
4268 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4269 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
4272 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate "
4273 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId));
4274 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4277 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4278 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
4279 * instead of SPS-CRNTI */
4281 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
4284 pucchReqInfo->hqType = TFU_HQ_RECP_REQ_NORMAL;
4285 /* Handling of other types */
4286 pucchReqInfo->type = TFU_UCI_HARQ;
4287 #else /* TFU_UPGRADE */
4288 pucchReqInfo->uciInfo = TFU_PUCCH_HARQ;
4289 /* Fill hqFdbkMode by using uciFrmtTyp from dlSfHqInfo */
4290 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
4291 /* Fill HqSz by using totalTbCnt based on the TM mode and
4292 * the number of serv cells configured*/
4294 pucchReqInfo->hqInfo.hqSz = ue->f1bCsAVal;
4295 pucchReqInfo->hqInfo.pucchResCnt = 1;
4297 memset(pucchReqInfo->hqInfo.hqRes,0xff,sizeof(uint16_t)*TFU_MAX_HQ_RES);
4298 #endif/*TFU_UPGRADE*/
4299 pucchReqInfo->hqInfo.hqRes[0] = dlSfHqInfo->n3ScellPucch.n3PucchIdx;
4301 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, ue,
4302 pucchRecpInfo, validIdx,TRUE);
4303 #endif/*TFU_UPGRADE*/
4304 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4305 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4307 }/* end of rgSCHTomUtlFillHqFdbkForFrmt3 */
4311 /** @brief This function handles filling of HARQ feedback recption request to
4320 * @param [out] TfuRecpReqInfo *recpReqInfo
4321 * @param [in] RgSchCellCb *cell
4322 * @param [out] RgSchErrInfo *err
4329 static S16 rgSCHTomUtlFillHqFdbkRecpReq
4331 TfuRecpReqInfo *recpReqInfo,
4337 static S16 rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, validIdx, err)
4338 TfuRecpReqInfo *recpReqInfo;
4345 static S16 rgSCHTomUtlFillHqFdbkRecpReq
4347 TfuRecpReqInfo *recpReqInfo,
4352 static S16 rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, err)
4353 TfuRecpReqInfo *recpReqInfo;
4360 RgSchDlHqProcCb *hqCb;
4361 CmLteTimingInfo futTime;
4364 TfuUeRecpReqInfo *pucchRecpInfo = NULLP;
4366 RgSchDlHqProcCb *prvHqCb=NULLP;
4373 /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper output
4374 * if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME() as it is
4375 * serving the purpose */
4376 RGSCHDECRFRMCRNTTIME(cell->crntTime, futTime, (RG_SCH_CMN_HARQ_INTERVAL -
4377 TFU_RECPREQ_DLDELTA));
4378 dlSf = rgSCHUtlSubFrmGet (cell, futTime);
4379 /* Get the next dlsf as well */
4380 RG_SCH_ADD_TO_CRNT_TIME(futTime, futTime, 1)
4381 nxtDlsf = rgSCHUtlSubFrmGet (cell, futTime);
4385 if (dlSf->ueLst.count != 0)
4387 node = dlSf->ueLst.first;
4390 ue = (RgSchUeCb *)(node->node);
4393 if(ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx].isPuschHarqRecpPres == TRUE)
4394 {/* This UE is already considered for PUSCH
4398 rgSCHTomUtlFillHqFdbkFor5gtf(recpReqInfo, cell, validIdx,
4399 &ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx], dlSf, pucchRecpInfo, err);
4400 } /* end of while */
4401 } /* If hq is expected */
4403 if (dlSf->msg4HqPLst.count != 0)
4406 node = dlSf->msg4HqPLst.first;
4409 hqCb = (RgSchDlHqProcCb*)(node->node);
4411 //TODO_SID: need to check validIdx
4412 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, validIdx, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err);
4414 } /* end of while */
4417 /* Check with TDD Code */
4418 /* FOR ACK NACK REP */
4420 } /* end of rgSCHTomUtlFillHqFdbkRecpReq */
4422 /** @brief This function handles filling of SR reception request to
4431 * @param [out] TfuRecpReqInfo *recpReqInfo
4432 * @param [in] RgSchCellCb *cell
4433 * @param [out] RgSchErrInfo *err
4440 static S16 rgSCHTomUtlFillSrRecpReq
4442 TfuRecpReqInfo *recpReqInfo,
4448 static S16 rgSCHTomUtlFillSrRecpReq (recpReqInfo, cell, validIdx, err)
4449 TfuRecpReqInfo *recpReqInfo;
4456 TfuUeRecpReqInfo *pucchRecpInfo;
4462 RgSchCmnUlUeSpsInfo *ulSpsUe = NULL;
4468 node = cell->pCqiSrsSrLst[validIdx].srLst.first;
4471 ue = (RgSchUeCb *)(node->node);
4472 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4478 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4479 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4481 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4482 "TfuUeRecpReqInfo for cell RNTI:%d",ue->ueId);
4483 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4486 #ifdef TFU_ALLOC_EVENT_NO_INIT
4487 memset(&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4488 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4494 /* Should we check for Rel8 and above???
4495 * Dont send SR recp req if logicalChannelSR-Mask enabled and UL SPS is
4497 ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue, cell);
4498 /* Avoiding check for ulSpsEnabled as isUlSpsActv FALSE if sps is not enabled*/
4499 if((ue->ul.ulSpsCfg.isLcSRMaskEnab) &&
4500 (ulSpsUe->isUlSpsActv))
4502 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
4507 pucchRecpInfo->rnti = ue->ueId;
4508 pucchRecpInfo->t.pucchRecpReq.srInfo.n1PucchIdx =
4509 ue->srCb.srCfg.srSetup.srResIdx;
4510 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR;
4511 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
4512 rgSCHTomUtlFillCqiSrsWithSr(cell, ue, recpReqInfo,
4513 pucchRecpInfo, validIdx);
4515 isAddToLst = rgSCHEmtcAddRecpInfoToLst(NULLP,recpReqInfo, pucchRecpInfo,ue->isEmtcUe);
4519 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4521 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4524 }/* end of rgSCHTomUtlFillSrRecpReq */
4527 /** @brief This function tells will the UE has a periodic CQI/PMI/RI
4536 * @param [in] RgSchUeCb *ue
4537 * @param [out] Bool *willueRprtCqiRi
4544 static S16 rgSCHTomUtlWillUeRprtCqiRi
4547 Bool *willueRprtCqiRi
4550 static S16 rgSCHTomUtlWillUeRprtCqiRi ( ue, willueRprtCqiRi)
4552 Bool *willueRprtCqiRi;
4555 /* Intialising Reporting probability as TRUE */
4556 *willueRprtCqiRi = TRUE;
4558 /* Checking the cases in which UE will not report CQIPMI/RI */
4559 if(ue->isDrxEnabled && ue->drxCb)
4562 if(ue->drxCb->cqiMask.pres && ue->drxCb->cqiMask.val == RGR_DRX_SETUP)
4563 {/*cqiMask is setup by upper layers */
4564 if((ue->drxCb->drxUlInactvMask & RG_SCH_DRX_ONDUR_BITMASK) ==
4565 RG_SCH_DRX_ONDUR_BITMASK)
4566 {/*onDuration NOT running, do not expect cqi/pmi/ri*/
4567 *willueRprtCqiRi = FALSE;
4571 #endif /*end of LTEMAC_R9*/
4572 /* ccpu00134258: Fix for CQI DRX issue*/
4573 if(ue->drxCb->onDurTmrLen > 2)
4575 if ( !RG_SCH_DRX_UL_IS_UE_ACTIVE(ue->drxCb) )
4576 {/*UE is not active, do not expect cqi/pmi/ri*/
4577 *willueRprtCqiRi = FALSE;
4580 }/*ue->isDrxEnabled*/
4582 } /*End of rgSCHTomUtlWillUeRprtCqiRi*/
4584 /** @brief This function handles filling of RI reception request to
4593 * @param [out] TfuRecpReqInfo *recpReqInfo
4594 * @param [in] RgSchCellCb *cell
4595 * @param [in] uint16_t validIdx
4596 * @param [out] RgSchErrInfo *err
4603 static S16 rgSCHTomUtlFillRiRecpReq
4605 TfuRecpReqInfo *recpReqInfo,
4611 static S16 rgSCHTomUtlFillRiRecpReq (recpReqInfo, cell, validIdx, err)
4612 TfuRecpReqInfo *recpReqInfo;
4619 TfuUeRecpReqInfo *pucchRecpInfo;
4622 Bool willUeRprtCqi; /* Flag set due to CQI Mask
4623 and UE inactive state (DRX) */
4624 RgSchUePCqiCb *riCb = NULLP;
4626 node = cell->pCqiSrsSrLst[validIdx].riLst.first;
4629 riCb = (RgSchUePCqiCb *)(node->node);
4630 ue = riCb->servCellInfo->ue;
4631 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4633 if(riCb->riRecpPrcsd)
4635 /*ccpu00140578:: RI Proecssing is already done for this TTI
4636 * as part of PUSCH reception process or HARQ
4637 * Reception processing. Hence skipping this UE
4639 riCb->riRecpPrcsd = FALSE;
4642 if(riCb->riDist ==0)
4644 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
4645 #ifdef XEON_SPECIFIC_CHANGES
4646 if(RGSCH_TIMEINFO_SAME(cell->crntTime, ue->riRecpTime))
4652 if((TRUE == riCb->isRiIgnoByCollsn)
4653 || (willUeRprtCqi == FALSE))
4655 if(willUeRprtCqi == FALSE)
4658 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
4661 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4662 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4664 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4665 "TfuUeRecpReqInfo for cell RNTI:%d",ue->ueId);
4666 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4669 #ifdef TFU_ALLOC_EVENT_NO_INIT
4670 memset(&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4671 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4674 pucchRecpInfo->rnti = ue->ueId;
4675 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
4676 riCb->cqiCfg.cqiSetup.cqiPResIdx;
4677 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = riCb->riNumBits;
4678 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_CQI;
4679 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
4681 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
4682 riCb->servCellInfo->sCellIdx;
4684 rgSCHTomUtlFillRiBitWidthInfo(ue);
4685 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
4686 if (ue->nPCqiCb->nCqiTrIdx == validIdx)
4688 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, ue->nPCqiCb);
4690 if((ue->srsCb.nSrsTrIdx == validIdx) && (ue->srsCb.srsDist ==0))
4692 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
4694 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4695 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4703 }/* end of rgSCHTomUtlFillRiRecpReq */
4706 /** @brief This function handles filling of 5GTF CQI-RI reception request to
4715 * @param [out] TfuRecpReqInfo *recpReqInfo
4716 * @param [in] RgSchCellCb *cell
4717 * @param [in] uint16_t validIdx
4718 * @param [out] RgSchErrInfo *err
4726 static S16 rgSCHTomUtlFillCqiRiRecpReq
4728 TfuRecpReqInfo *recpReqInfo,
4734 static S16 rgSCHTomUtlFillCqiRiRecpReq (recpReqInfo, cell, validIdx, err)
4735 TfuRecpReqInfo *recpReqInfo;
4741 TfuUeRecpReqInfo *pucchRecpInfo;
4742 RgSchUeCb *ue = NULLP;
4745 while ((ue = rgSCHDbmGetNextUeCb(cell, ue)) != NULLP)
4747 if (RGSCH_TIMEINFO_SAME (recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn))
4749 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4750 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4752 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4753 "TfuUeRecpReqInfo for cell RNTI:%d ", ue->ueId);
4754 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4757 #ifdef TFU_ALLOC_EVENT_NO_INIT
4758 memset(&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4759 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4761 pucchRecpInfo->rnti = ue->ueId;
4762 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_XPUCCH_UCI_INFO;
4763 pucchRecpInfo->t.pucchRecpReq.uciPduInfo.pucchIndex = 0;
4764 pucchRecpInfo->t.pucchRecpReq.uciPduInfo.numBits = 5;
4766 RG_SCH_ADD_TO_CRNT_TIME(recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn,
4767 ue->ue5gtfCb.cqiRiPer);
4768 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4769 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4773 }/* end of rgSCHTomUtlFillCqiRiRecpReq */
4776 /** @brief This function handles filling of PCQI reception request to
4785 * @param [out] TfuRecpReqInfo *recpReqInfo
4786 * @param [in] RgSchCellCb *cell
4787 * @param [in] uint16_t validIdx
4788 * @param [out] RgSchErrInfo *err
4795 static S16 rgSCHTomUtlFillPcqiRecpReq
4797 TfuRecpReqInfo *recpReqInfo,
4803 static S16 rgSCHTomUtlFillPcqiRecpReq (recpReqInfo, cell, validIdx, err)
4804 TfuRecpReqInfo *recpReqInfo;
4811 TfuUeRecpReqInfo *pucchRecpInfo;
4815 uint8_t ri; /*RI value*/
4816 Bool willUeRprtCqi; /* Flag set due to CQI Mask
4817 and UE Inactive state (DRX)*/
4819 RgSchUePCqiCb *cqiCb = NULLP;
4820 Bool isAddToLst = FALSE;
4822 node = cell->pCqiSrsSrLst[validIdx].cqiLst.first;
4825 cqiCb = (RgSchUePCqiCb*)(node->node);
4826 ue = cqiCb->servCellInfo->ue;
4827 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4829 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
4831 if ((cqiCb->isCqiIgnoByCollsn == TRUE) ||
4832 (willUeRprtCqi == FALSE))
4834 if(willUeRprtCqi == FALSE)
4837 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
4841 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
4843 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
4844 cqiCb->servCellInfo->sCellIdx;
4846 cqiPmiSz = rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
4849 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to Fill CqiPmi "
4854 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4855 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4857 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4858 "TfuUeRecpReqInfo for cell RNTI:%d ", ue->ueId);
4859 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4862 #ifdef TFU_ALLOC_EVENT_NO_INIT
4863 memset(&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4864 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4867 /*Fill PCQI params*/
4868 pucchRecpInfo->rnti = ue->ueId;
4869 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
4870 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
4871 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = cqiPmiSz;
4872 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_CQI;
4873 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
4874 if((ue->srsCb.nSrsTrIdx == validIdx) && (ue->srsCb.srsDist ==0))
4876 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
4879 isAddToLst = rgSCHEmtcAddRecpInfoToLst(NULLP,recpReqInfo, pucchRecpInfo,ue->isEmtcUe);
4883 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4885 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4888 }/* end of rgSCHTomUtlFillPcqiRecpReq */
4889 /** @brief This function handles filling of SRS reception request to
4898 * @param [out] TfuRecpReqInfo *recpReqInfo
4899 * @param [in] RgSchCellCb *cell
4900 * @param [in] uint16_t validIdx
4901 * @param [out] RgSchErrInfo *err
4907 static S16 rgSCHTomUtlFillSrsRecpReq
4909 TfuRecpReqInfo *recpReqInfo,
4915 static S16 rgSCHTomUtlFillSrsRecpReq (recpReqInfo, cell, validIdx, err)
4916 TfuRecpReqInfo *recpReqInfo;
4923 TfuUeRecpReqInfo *pucchRecpInfo;
4927 node = cell->pCqiSrsSrLst[validIdx].srsLst.first;
4930 ue = (RgSchUeCb *)(node->node);
4931 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4933 if(ue->srsCb.srsRecpPrcsd)
4935 /* ccpu00140578::SRS Proecssing is already done for this TTI
4936 * as part of PUSCH or HARQ reception process and
4937 * hence skipping this UE */
4938 ue->srsCb.srsRecpPrcsd = FALSE;
4942 if(ue->srsCb.srsDist ==0)
4944 /* We need to add the recp request to be sent on the pucchANRep value. */
4945 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4946 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4948 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4949 "TfuUeRecpReqInfo for RNTI:%d ",ue->ueId);
4950 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4954 #ifdef TFU_ALLOC_EVENT_NO_INIT
4955 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4959 pucchRecpInfo->rnti = ue->ueId;
4960 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
4961 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
4962 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
4963 ue->srsCb.srsCfg.srsSetup.fDomPosi;
4964 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
4965 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
4966 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
4967 ue->srsCb.srsCfg.srsSetup.txComb;
4968 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
4969 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
4970 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
4971 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
4973 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SRS;
4974 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
4975 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4976 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4980 ue->srsCb.srsDist--;
4984 }/* end of rgSCHTomUtlFillSrsRecpReq */
4987 /** @brief This function handles filling of data reception requests for
4996 * @param [out] TfuRecpReqInfo *recpReqInfo
4997 * @param [in] RgSchCellCb *cell
4998 * @param [out] RgSchErrInfo *err
5004 static S16 rgSCHTomUtlFillDatRecpReq
5006 TfuRecpReqInfo *recpReqInfo,
5011 static S16 rgSCHTomUtlFillDatRecpReq (recpReqInfo, cell, err)
5012 TfuRecpReqInfo *recpReqInfo;
5018 RgSchUlAlloc *alloc;
5019 TfuUeRecpReqInfo *datRecpInfo;
5022 /* processing steps are
5023 * - Run through the UL allocations going out in this subframe.
5024 * - Run through the UL receptions expected the next subframe.
5026 alloc = rgSCHUtlFirstRcptnReq (cell);
5029 /* FOR ACK NACK REP */
5030 if (NULLP != alloc->ue)
5032 /* If measuring or ackNakRep we shall not send dat RecpReq */
5033 if ((alloc->ue->measGapCb.isMeasuring == TRUE) ||
5034 (alloc->ue->ackNakRepCb.isAckNakRep == TRUE))
5036 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
5041 if ((ret = rgSCHUtlGetEventMem((Ptr *)&datRecpInfo,
5042 sizeof(TfuUeRecpReqInfo),
5043 &(recpReqInfo->memCp))) != ROK)
5045 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
5046 "TfuUeRecpReqInfo for RNTI:%d ", alloc->ue->ueId);
5047 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
5050 if (!alloc->forMsg3)
5052 datRecpInfo->type = TFU_RECP_REQ_PUSCH;
5053 rgSCHUtlAllocRcptInfo (alloc,
5055 &datRecpInfo->t.puschRecpReq.mcs,
5056 &datRecpInfo->t.puschRecpReq.rbStart,
5057 &datRecpInfo->t.puschRecpReq.numRb,
5058 &datRecpInfo->t.puschRecpReq.rv,
5059 &datRecpInfo->t.puschRecpReq.size,
5060 &datRecpInfo->t.puschRecpReq.modType,
5061 &datRecpInfo->t.puschRecpReq.isRtx,
5062 &datRecpInfo->t.puschRecpReq.nDmrs,
5063 &datRecpInfo->t.puschRecpReq.ndi,
5064 &datRecpInfo->t.puschRecpReq.harqProcId
5069 datRecpInfo->type = TFU_RECP_REQ_MSG3;
5070 rgSCHUtlAllocRcptInfo (alloc,
5072 &datRecpInfo->t.msg3RecpReq.mcs,
5073 &datRecpInfo->t.msg3RecpReq.rbStart,
5074 &datRecpInfo->t.msg3RecpReq.numRb,
5075 /*ccpu00128993 - MOD - fix for msg3 softcombining bug*/
5076 &datRecpInfo->t.msg3RecpReq.rv,
5077 &datRecpInfo->t.msg3RecpReq.size,
5078 &datRecpInfo->t.msg3RecpReq.modType,
5079 &datRecpInfo->t.msg3RecpReq.isRtx,
5080 &datRecpInfo->t.msg3RecpReq.nDmrs,
5081 &datRecpInfo->t.msg3RecpReq.ndi,
5082 &datRecpInfo->t.msg3RecpReq.harqProcId
5086 /* Other fields of datRecpInfo shall be filled
5087 * here for new features */
5088 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(datRecpInfo->lnk));
5089 datRecpInfo->lnk.node = (PTR)datRecpInfo;
5091 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
5092 } /* end of while */
5094 } /* end of rgSCHTomUtlFillDatRecpReq */
5097 /** @brief This function handles filling of data reception requests for
5106 * @param [out] TfuRecpReqInfo *recpReqInfo
5107 * @param [in] RgSchCellCb *cell
5108 * @param [in] uint16_t validIdx
5109 * @param [out] RgSchErrInfo *err
5115 static S16 rgSCHTomUtlFillDatRecpReq
5117 TfuRecpReqInfo *recpReqInfo,
5123 static S16 rgSCHTomUtlFillDatRecpReq (recpReqInfo, cell, validIdx, err)
5124 TfuRecpReqInfo *recpReqInfo;
5130 CmLteTimingInfo dci0Time;
5133 RgSchUlAlloc *alloc;
5134 TfuUeRecpReqInfo *datRecpInfo;
5136 Bool isAperiodic = FALSE; /*Set when Aperiodic CQI is expected */
5137 uint8_t numUePerTti = 0;
5139 if((0 == (recpReqInfo->timingInfo.sfn % 30)) && (0 == recpReqInfo->timingInfo.slot))
5141 //printf("5GTF_CHECK rgSCHTomUtlFillDatRecpReq (%d : %d)\n", recpReqInfo->timingInfo.sfn, recpReqInfo->timingInfo.slot);
5143 /* processing steps are
5144 * - Run through the UL allocations going out in this subframe.
5145 * - Run through the UL receptions expected the next subframe.
5148 alloc = rgSCHUtlFirstRcptnReq (cell);
5151 isAperiodic = FALSE;
5152 ret = rgSCHUtlGetEventMem((Ptr *)&datRecpInfo,
5153 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
5156 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
5157 "TfuUeRecpReqInfo for RNTI:%d ", alloc->rnti);
5158 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
5161 #ifdef TFU_ALLOC_EVENT_NO_INIT
5162 datRecpInfo->t.puschRecpReq.initialNSrs.pres = FALSE;
5163 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = FALSE;
5165 datRecpInfo->type = TFU_RECP_REQ_PUSCH;
5166 /* Check if this if for MSG3 - no scope for feedback along with it. */
5167 if ((FALSE == alloc->forMsg3))
5169 /* Check if any DL HARQ processes has a feedback coming at the time of
5170 * this reception request.
5175 RGSCHDECRFRMCRNTTIME(cell->crntTime,dci0Time,(RGSCH_ULCTRL_RECP_DIST));
5177 idx = (dci0Time.sfn * RGSCH_NUM_SUB_FRAMES_5G + dci0Time.slot)%
5178 RGSCH_ULCTRL_RECP_DIST;
5180 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA;
5181 datRecpInfo->rnti = alloc->rnti;
5182 rgSCHUtlAllocRcptInfo (cell,alloc, &recpReqInfo->timingInfo,
5183 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5186 else /*Enters for Msg3 == TRUE condition*/
5188 /* ccpu00130884 - ADD - HO case when Msg3 alloc and Cqi/Ri/SRS opportunity
5189 * occur at same time */
5190 if(NULLP != alloc->ue)
5193 /* Only DATA is expected */
5194 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA;
5195 datRecpInfo->rnti = alloc->rnti;
5196 rgSCHUtlAllocRcptInfo (cell,alloc, &recpReqInfo->timingInfo,
5197 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5202 if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA &&
5203 datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_SRS &&
5204 isAperiodic == FALSE)
5206 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = TRUE;
5207 datRecpInfo->t.puschRecpReq.initialNumRbs.val = alloc->ue->initNumRbs;
5211 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = FALSE;
5214 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(datRecpInfo->lnk));
5215 datRecpInfo->lnk.node = (PTR)datRecpInfo;
5216 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
5218 } /* end of while */
5220 if(numUePerTti && (numUePerTti < RG_MAX_NUM_UE_PER_TTI))
5222 cell->ulNumUeSchedPerTti[numUePerTti-1]++;
5223 gUlNumUePerTti[numUePerTti - 1]++;
5226 } /* end of rgSCHTomUtlFillDatRecpReq */
5228 /* rg009.201. Added changes of TFU_UPGRADE */
5230 /***********************************************************
5232 * Func : rgSCHTomUtlFillRiBitWidthInfo
5235 * Desc : Fills the RI BitWidth and stores it for decoding.
5244 **********************************************************/
5246 S16 rgSCHTomUtlFillRiBitWidthInfo
5251 S16 rgSCHTomUtlFillRiBitWidthInfo(ueCb)
5255 RgSchUePCqiCb *riCb = ueCb->nPRiCb;
5257 if (ueCb->mimoInfo.txMode != RGR_UE_TM_3 &&
5258 ueCb->mimoInfo.txMode != RGR_UE_TM_4)
5263 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUCCH;
5264 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode=
5265 (TfuDlCqiPucchMode)riCb->cqiCfg.cqiSetup.prdModeEnum;
5266 switch(ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode)
5268 case TFU_PUCCH_CQI_MODE10:
5269 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info.type = TFU_RPT_RI;
5270 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info.u.ri =
5273 case TFU_PUCCH_CQI_MODE11:
5274 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info.type = TFU_RPT_RI;
5275 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info.u.ri =
5278 case TFU_PUCCH_CQI_MODE20:
5279 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info.type = TFU_RPT_RI;
5280 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info.u.ri =
5283 case TFU_PUCCH_CQI_MODE21:
5284 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info.type = TFU_RPT_RI;
5285 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info.u.ri =
5292 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5296 /***********************************************************
5298 * Func : rgSCHTomUtlFetchPcqiBitSz
5301 * Desc : Fetch the CQI/PMI bits for a UE based on the mode, periodicity.
5310 **********************************************************/
5312 uint8_t rgSCHTomUtlFetchPcqiBitSz
5319 uint8_t rgSCHTomUtlFetchPcqiBitSz(ueCb, numTxAnt, ri)
5325 uint8_t confRepMode;
5327 TfuCqiPucchMode10 *mode10Info;
5328 TfuCqiPucchMode11 *mode11Info;
5329 TfuCqiPucchMode20 *mode20Info;
5330 TfuCqiPucchMode21 *mode21Info;
5331 RgSchUePCqiCb *cqiCb = ueCb->nPCqiCb;
5334 confRepMode = cqiCb->cqiCfg.cqiSetup.prdModeEnum;
5335 if((ueCb->mimoInfo.txMode != RGR_UE_TM_3) &&
5336 (ueCb->mimoInfo.txMode != RGR_UE_TM_4))
5342 *ri = cqiCb->perRiVal;
5344 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUCCH;
5345 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode=
5346 (TfuDlCqiPucchMode)confRepMode;
5349 case RGR_PRD_CQI_MOD10:
5351 mode10Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info;
5353 mode10Info->type = TFU_RPT_CQI;
5354 mode10Info->u.cqi = 4;
5358 case RGR_PRD_CQI_MOD11:
5360 mode11Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info;
5361 mode11Info->type = TFU_RPT_CQI;
5367 mode11Info->u.cqi.cqi = 4;
5368 mode11Info->u.cqi.wideDiffCqi.pres = FALSE;
5369 mode11Info->u.cqi.pmi = 2;
5374 mode11Info->u.cqi.cqi = 4;
5375 mode11Info->u.cqi.wideDiffCqi.pres = TRUE;
5376 mode11Info->u.cqi.wideDiffCqi.val = 3;
5377 mode11Info->u.cqi.pmi = 1;
5380 else if(numTxAnt == 4)
5385 mode11Info->u.cqi.cqi = 4;
5386 mode11Info->u.cqi.wideDiffCqi.pres = FALSE;
5387 mode11Info->u.cqi.pmi = 4;
5392 mode11Info->u.cqi.cqi = 4;
5393 mode11Info->u.cqi.wideDiffCqi.pres = TRUE;
5394 mode11Info->u.cqi.wideDiffCqi.val = 3;
5395 mode11Info->u.cqi.pmi = 4;
5400 /* This is number of antenna case 1.
5401 * This is not applicable for Mode 1-1.
5402 * So setting it to invalid value */
5408 case RGR_PRD_CQI_MOD20:
5410 mode20Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info;
5411 mode20Info->type = TFU_RPT_CQI;
5415 mode20Info->u.cqi.isWideband = TRUE;
5416 mode20Info->u.cqi.u.wideCqi = 4;
5420 pcqiSz = 4 + cqiCb->label;
5421 mode20Info->u.cqi.isWideband = FALSE;
5422 mode20Info->u.cqi.u.subCqi.cqi = 4;
5423 mode20Info->u.cqi.u.subCqi.l = cqiCb->label;
5428 case RGR_PRD_CQI_MOD21:
5430 mode21Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info;
5431 mode21Info->type = TFU_RPT_CQI;
5432 //pcqiSz = rgSCHTomUtlFetchPcqiBitSzPucchMode21(ueCb,
5433 // mode21Info, numTxAnt, ri);
5441 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5446 /***********************************************************
5448 * Func : rgSCHTomUtlPcqiSbCalcBpIdx
5451 * Desc : Determines the BP index from the timing info
5460 **********************************************************/
5462 S16 rgSCHTomUtlPcqiSbCalcBpIdx
5464 CmLteTimingInfo crntTimInfo,
5466 RgSchUePCqiCb *cqiCb
5469 S16 rgSCHTomUtlPcqiSbCalcBpIdx(crntTimInfo, ueCb, cqiCb)
5470 CmLteTimingInfo crntTimInfo;
5472 RgSchUePCqiCb *cqiCb;
5475 uint16_t tti = (crntTimInfo.sfn * RGSCH_NUM_SUB_FRAMES_5G + crntTimInfo.slot);
5476 uint16_t prdNum = tti/cqiCb->cqiPeri;
5478 if((prdNum % cqiCb->h) == 0)
5482 cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_1;
5487 cqiCb->isWb = FALSE;
5488 cqiCb->bpIdx = ((prdNum % cqiCb->h) - 1) % cqiCb->J;
5490 cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_0;
5498 * @brief Function which moves PCQI, RI, SR and SRS to next periodicity
5499 * Occasions as that needs to be done in case of Ack/Nack repetition
5500 * reception request occasions or during Measurement Gap occasions.
5504 * Function: rgSCHTomUtlMoveNxtOccasion
5506 * Function which moves PCQI, RI, SR and SRS to next perodicity
5507 * Occasions as that needs to be done in case of Ack/Nack repetition
5508 * reception request occasions or during Measurement Gap occasions.
5510 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5513 * - Check whether the current Tx Instance matches with the rec req time
5514 * - If true, then move them to their next Tx Instance
5516 * @param[in] RgSchCellCb *cell,
5524 S16 rgSCHTomUtlMoveNxtOccasion
5531 S16 rgSCHTomUtlMoveNxtOccasion(cell, ue, validIdx)
5537 RgSchUePCqiCb *cqiCb = ue->nPCqiCb;
5538 RgSchUePCqiCb *riCb = ue->nPRiCb;
5540 /* ccpu00140578::Skip the UE if already RI recpetion
5541 * is processed in the same subframe */
5542 if ((riCb->nRiTrIdx == validIdx) &&
5543 (riCb->riRecpPrcsd == FALSE))
5545 if(riCb->riDist ==0)
5547 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
5553 /* ccpu00140578:: As this UE is considered for this TTI
5554 * Same UE should not get processed for RI reception
5555 * or for updating th RI distance.*/
5556 if(riCb->nRiTrIdx == validIdx)
5558 riCb->riRecpPrcsd = TRUE;
5561 if (cqiCb->nCqiTrIdx == validIdx)
5563 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
5566 /* ccpu00140578::Skip the UE if SRS recpetion
5567 * is already processed in the same subframe */
5568 if ((ue->srsCb.nSrsTrIdx == validIdx) &&
5569 (ue->srsCb.srsRecpPrcsd == FALSE))
5571 if(ue->srsCb.srsDist ==0)
5573 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
5577 ue->srsCb.srsDist--;
5579 /* ccpu00140578:: As this UE is considered for this TTI
5580 * Same UE should not get processed for SRS reception
5581 * or for updating th SRS distance.*/
5582 if(ue->srsCb.nSrsTrIdx == validIdx)
5584 ue->srsCb.srsRecpPrcsd = TRUE;
5587 if (ue->srCb.nSrTrIdx == validIdx)
5589 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
5592 } /* rgSCHTomUtlMoveNxtOccasion */
5595 /***********************************************************
5597 * Func : rgSCHTomPrepareAcqiRecp
5600 * Desc : Fetch the CQI/PMI bits for a UE based on the mode and store them
5601 * for decoding. Fill RECP request and prepare the scartchpad
5602 * to aid decoding of Aperiodic CQI.
5611 **********************************************************/
5613 Void rgSCHTomPrepareAcqiRecp
5617 TfuUePuschCqiRecpInfo *cqiRecpReqInfo,
5621 Void rgSCHTomPrepareAcqiRecp(ueCb, cell, cqiRecpReqInfo, ccIdx)
5624 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
5628 uint8_t confRepMode;
5629 RgSchCqiRawPuschMode12 *mode12Info;
5630 RgSchCqiRawPuschMode20 *mode20Info;
5631 RgSchCqiRawPuschMode22 *mode22Info;
5632 RgSchCqiRawPuschMode30 *mode30Info;
5633 RgSchCqiRawPuschMode31 *mode31Info;
5634 uint8_t numTxAnt = cell->numTxAntPorts;
5635 uint8_t sCellIdx = ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)];
5636 uint8_t numOfCells = 0;
5637 RgSchUeACqiCb *acqiCb = &ueCb->cellInfo[sCellIdx]->acqiCb;
5640 cqiRecpReqInfo->reportType = TFU_APERIODIC_CQI_TYPE; /* Aperiodic */
5641 if (ueCb->mimoInfo.txMode == RGR_UE_TM_3 ||
5642 ueCb->mimoInfo.txMode == RGR_UE_TM_4)
5644 cqiRecpReqInfo->riSz[ccIdx].pres = TRUE;
5645 cqiRecpReqInfo->riSz[ccIdx].val = acqiCb->riNumBits;
5647 /* This flag will be rmeoved after making changes in BRDCM CL
5648 * Sachin is doing the change
5650 #if (defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
5652 cqiRecpReqInfo->cqiPmiSzR1[ccIdx] = acqiCb->cqiPmiSzR1;
5653 cqiRecpReqInfo->cqiPmiSzRn1[ccIdx] = acqiCb->cqiPmiSzRn1;
5655 if(ueCb->nPCqiCb->perRiVal == 1)
5657 cqiRecpReqInfo->cqiPmiSzR1[ccIdx] = acqiCb->cqiPmiSzR1;
5661 cqiRecpReqInfo->cqiPmiSzRn1[ccIdx] = acqiCb->cqiPmiSzRn1;
5664 /* Fill scratchpad to aid decoding of aper CQI upon
5666 confRepMode = acqiCb->aCqiCfg.aprdModeEnum;
5667 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUSCH;
5669 numOfCells = ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells;
5671 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5672 puschRawCqiInfo.mode = (TfuDlCqiPuschMode)confRepMode;
5674 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5675 puschRawCqiInfo.ri.pres = cqiRecpReqInfo->riSz[ccIdx].pres;
5677 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5678 puschRawCqiInfo.ri.val = cqiRecpReqInfo->riSz[ccIdx].val;
5680 /* Setting the sCellIdx */
5681 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5682 sCellIdx = sCellIdx;
5686 case RGR_APRD_CQI_MOD12:
5688 mode12Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5689 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode12Info;
5690 mode12Info->wideBCqiCw0 = 4;
5691 mode12Info->r1WideBCqiCw1 = 0;
5692 mode12Info->rg1WideBCqiCw1 = 4;
5695 mode12Info->r1TotalPmiBitLen = 2*acqiCb->N;
5696 mode12Info->rg1TotalPmiBitLen = acqiCb->N;
5698 else if(numTxAnt == 4)
5700 mode12Info->r1TotalPmiBitLen = 4*acqiCb->N;
5701 mode12Info->rg1TotalPmiBitLen = 4*acqiCb->N;
5706 case RGR_APRD_CQI_MOD20:
5708 mode20Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5709 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode20Info;
5710 mode20Info->wideBCqiCw = 4;
5711 mode20Info->subBandDiffCqi = 2;
5712 mode20Info->posOfM = acqiCb->L;
5716 case RGR_APRD_CQI_MOD22:
5718 mode22Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5719 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode22Info;
5720 mode22Info->wideBCqiCw0 = 4;
5721 mode22Info->sBDiffCqiCw0 = 2;
5722 mode22Info->r1WideBCqiCw1 = 0;
5723 mode22Info->r1SbDiffCqiCw1 = 0;
5724 mode22Info->rg1WideBCqiCw1 = 4;
5725 mode22Info->rg1SbDiffCqiCw1 = 2;
5726 mode22Info->posOfM = acqiCb->L;
5729 mode22Info->r1PmiBitLen = 4;
5730 mode22Info->rg1PmiBitLen = 2;
5732 else if(numTxAnt == 4)
5734 mode22Info->r1PmiBitLen = 8;
5735 mode22Info->rg1PmiBitLen = 8;
5740 case RGR_APRD_CQI_MOD30:
5742 mode30Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5743 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode30Info;
5744 mode30Info->wideBCqiCw = 4;
5745 mode30Info->totLenSbDiffCqi = 2*acqiCb->N;
5749 case RGR_APRD_CQI_MOD31:
5751 mode31Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5752 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode31Info;
5753 mode31Info->wideBCqiCw0 = 4;
5754 mode31Info->totLenSbDiffCqiCw0 = 2*acqiCb->N;
5755 mode31Info->r1WideBCqiCw1 = 0;
5756 mode31Info->r1TotLenSbDiffCqiCw1 =0;
5757 mode31Info->rg1WideBCqiCw1 = 4;
5758 mode31Info->rg1TotLenSbDiffCqiCw1 = 2*acqiCb->N;
5761 mode31Info->r1PmiBitLen = 2;
5762 mode31Info->rg1PmiBitLen = 1;
5764 else if(numTxAnt == 4)
5766 mode31Info->r1PmiBitLen = 4;
5767 mode31Info->rg1PmiBitLen = 4;
5778 * @brief Function which handles the filling of Aperiodic CQI/RI reception
5783 * Function: rgSCHTomUtlFillDatAperRecpReq
5785 * Function which handles the filling of Aperiodic CQI/RI reception
5788 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5791 * - Fill the reception request for the data arriving on the ULSCH
5792 * - Fill the reception request information for the Aperiodic CQI/PMI/RI
5794 * @param[in] RgSchCellCb *cell,
5795 * RgSchUlAlloc *alloc,
5796 * TfuUeRecpReqInfo *datRecpInfo,
5797 * CmLteTimingInfo *timeInfo,
5804 S16 rgSCHTomUtlFillDatAperRecpReq
5808 RgSchUlAlloc *alloc,
5809 TfuUeRecpReqInfo *datRecpInfo,
5810 CmLteTimingInfo *timeInfo,
5815 S16 rgSCHTomUtlFillDatAperRecpReq(cell, cqiReq, alloc, datRecpInfo, timeInfo, hqPres, validIdx)
5818 RgSchUlAlloc *alloc;
5819 TfuUeRecpReqInfo *datRecpInfo;
5820 CmLteTimingInfo *timeInfo;
5825 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
5826 RgSchUeCb *ueCb = alloc->ue;
5828 uint8_t triggerSet = 0;
5832 /*Fill RI Reception Params*/
5833 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
5834 cqiRecpReqInfo->riBetaOff = alloc->ue->ul.betaRiOffst;
5835 cqiRecpReqInfo->cqiBetaOff = alloc->ue->ul.betaCqiOffst;
5838 cqiRecpReqInfo->cCNum = 0;
5839 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells = 0;
5842 rgSCHTomUtlGetTrigSet(cell, ueCb, cqiReq, &triggerSet);
5843 for (sIdx = 0; sIdx < CM_LTE_MAX_CELLS; sIdx++)
5845 /* The Aperiodic request for SCell index sIdx */
5846 if ((triggerSet >> (7 - sIdx)) & 0x01)
5848 /* The Aperiodic request for SCell index sIdx */
5849 rgSCHTomPrepareAcqiRecp(ueCb, ueCb->cellInfo[sIdx]->cell, cqiRecpReqInfo, cqiRecpReqInfo->cCNum);
5850 cqiRecpReqInfo->cCNum++;
5851 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells++;
5855 rgSCHTomPrepareAcqiRecp(ueCb, ueCb->cellInfo[0]->cell, cqiRecpReqInfo, cqiRecpReqInfo->cCNum);
5856 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells++;
5859 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5861 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
5863 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
5864 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
5868 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
5870 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
5874 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
5876 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
5878 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
5880 datRecpInfo->rnti = alloc->rnti;
5881 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
5882 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5884 } /* rgSCHTomUtlFillDatAperRecpReq */
5889 * @brief Function which handles the filling of Periodic RI reception
5890 * request values which arrives along with UL Data on ULSCH
5894 * Function: rgSCHTomUtlFillDatPriRecpReq
5896 * Function which handles the filling of Periodic RI reception
5897 * request values which arrives along with UL Data on ULSCH
5899 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5902 * - Fill the reception request for the data arriving on the ULSCH
5903 * - Fill the reception request information for the Periodic RI
5905 * @param[in] RgSchCellCb *cell,
5906 * RgSchUlAlloc *alloc,
5907 * TfuUeRecpReqInfo *datRecpInfo,
5908 * CmLteTimingInfo *timeInfo,
5915 S16 rgSCHTomUtlFillDatPriRecpReq
5918 RgSchUlAlloc *alloc,
5919 TfuUeRecpReqInfo *datRecpInfo,
5920 CmLteTimingInfo *timeInfo,
5925 S16 rgSCHTomUtlFillDatPriRecpReq(cell, alloc, datRecpInfo, timeInfo,
5928 RgSchUlAlloc *alloc;
5929 TfuUeRecpReqInfo *datRecpInfo;
5930 CmLteTimingInfo *timeInfo;
5935 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
5937 /*Fill RI Reception Params*/
5938 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
5939 #ifdef TFU_ALLOC_EVENT_NO_INIT
5940 cqiRecpReqInfo->cqiBetaOff = 0;
5941 /* Fill only the first RI index since Periodic can come
5943 cqiRecpReqInfo->cqiPmiSzR1[0] = 0;
5944 cqiRecpReqInfo->cqiPmiSzRn1[0] = 0;
5946 cqiRecpReqInfo->reportType = TFU_PERIODIC_CQI_TYPE; /* periodic */
5947 cqiRecpReqInfo->riBetaOff = alloc->ue->ul.betaRiOffst;
5949 /* Fill only the first RI index since Periodic can come
5951 cqiRecpReqInfo->cCNum = 1;
5952 cqiRecpReqInfo->riSz[0].pres = TRUE;
5953 cqiRecpReqInfo->riSz[0].val = alloc->ue->nPRiCb->riNumBits;
5955 rgSCHTomUtlFillRiBitWidthInfo(alloc->ue);
5956 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
5958 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
5959 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
5963 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
5965 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
5969 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
5971 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
5973 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
5975 datRecpInfo->rnti = alloc->rnti;
5976 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
5977 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5979 } /* rgSCHTomUtlFillDatPriRecpReq */
5983 * @brief Function which handles the filling of Periodic CQI/PMI reception
5984 * request values which arrives along with UL Data on ULSCH
5988 * Function: rgSCHTomUtlFillDatPCqiRecpReq
5990 * Function which handles the filling of Periodic CQI/PMI reception
5991 * request values which arrives along with UL Data on ULSCH
5993 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5996 * - Fill the reception request for the data arriving on the ULSCH
5997 * - Fill the reception request information for the Periodic CQI/PMI
5999 * @param[in] RgSchCellCb *cell,
6000 * RgSchUlAlloc *alloc,
6001 * TfuUeRecpReqInfo *datRecpInfo,
6002 * CmLteTimingInfo *timeInfo,
6010 S16 rgSCHTomUtlFillDatPCqiRecpReq
6013 RgSchUlAlloc *alloc,
6014 TfuUeRecpReqInfo *datRecpInfo,
6015 CmLteTimingInfo *timeInfo,
6020 S16 rgSCHTomUtlFillDatPCqiRecpReq(cell, alloc, datRecpInfo,
6021 timeInfo, hqPres, validIdx)
6023 RgSchUlAlloc *alloc;
6024 TfuUeRecpReqInfo *datRecpInfo;
6025 CmLteTimingInfo *timeInfo;
6030 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
6031 uint8_t cqiPmiSz; /*Raw CQI/PMI Size*/
6034 /*Fill CQI Reception Params*/
6035 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
6036 #ifdef TFU_ALLOC_EVENT_NO_INIT
6037 cqiRecpReqInfo->riBetaOff = 0;
6039 cqiRecpReqInfo->cqiBetaOff = alloc->ue->ul.betaCqiOffst;
6040 cqiPmiSz = rgSCHTomUtlFetchPcqiBitSz(alloc->ue, cell->numTxAntPorts, &ri);
6043 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Fill "
6044 "CqiPmi size RNTI:%d",alloc->rnti);
6048 /* Fill only the first RI index since Periodic can come
6050 cqiRecpReqInfo->cCNum = 1;
6051 cqiRecpReqInfo->reportType = TFU_PERIODIC_CQI_TYPE; /* Periodic */
6052 /* This flags will be removed once Sachin does changes
6054 #if (defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
6055 cqiRecpReqInfo->cqiPmiSzR1[0] = cqiPmiSz;
6056 cqiRecpReqInfo->cqiPmiSzRn1[0] = cqiPmiSz;
6060 cqiRecpReqInfo->cqiPmiSzR1[0] = cqiPmiSz;
6061 cqiRecpReqInfo->cqiPmiSzRn1[0] = 0;
6065 cqiRecpReqInfo->cqiPmiSzRn1[0] = cqiPmiSz;
6066 cqiRecpReqInfo->cqiPmiSzR1[0] = 0;
6069 cqiRecpReqInfo->riSz[0].pres = FALSE;
6071 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
6073 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
6074 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
6077 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
6079 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
6083 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
6085 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
6087 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
6089 datRecpInfo->rnti = alloc->rnti;
6090 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
6091 &datRecpInfo->t.puschRecpReq.ulSchInfo);
6093 } /* rgSCHTomUtlFillDatPCqiRecpReq */
6096 * @brief Function which handles the filling of SRS reception
6097 * request values which arrives along with UL Data on ULSCH
6101 * Function: rgSCHTomUtlFillDatSrsRecpReq
6103 * Function which handles the filling of SRS reception
6104 * request values which arrives along with UL Data on ULSCH
6106 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
6109 * - Fill the reception request for the data arriving on the ULSCH
6110 * - Fill the reception request information for the SRS
6112 * @param[in] RgSchCellCb *cell,
6113 * RgSchUlAlloc *alloc,
6114 * TfuUeRecpReqInfo *datRecpInfo,
6115 * CmLteTimingInfo *timeInfo,
6122 S16 rgSCHTomUtlFillDatSrsRecpReq
6125 RgSchUlAlloc *alloc,
6126 TfuUeRecpReqInfo *datRecpInfo,
6127 CmLteTimingInfo *timeInfo,
6131 S16 rgSCHTomUtlFillDatSrsRecpReq(cell, alloc, datRecpInfo, timeInfo,
6134 RgSchUlAlloc *alloc;
6135 TfuUeRecpReqInfo *datRecpInfo;
6136 CmLteTimingInfo *timeInfo;
6140 datRecpInfo->rnti = alloc->rnti;
6141 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
6144 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_HARQ_SRS;
6148 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_SRS;
6150 datRecpInfo->rnti = alloc->rnti;
6151 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
6152 &datRecpInfo->t.puschRecpReq.ulSchInfo);
6154 } /* rgSCHTomUtlFillDatSrsRecpReq */
6157 * @brief Function which handles the filling of only SRS reception
6158 * request values on ULSCH
6162 * Function: rgSCHTomFillOnlySrsRecpReq
6164 * Function which handles the filling of SRS reception
6165 * request values which arrives along with UL Data on ULSCH
6167 * Invoked by: rgSCHTomUtlFillDatSrsRecpReq of rg_sch_tom.c
6170 * - Fill the reception request for the data arriving on the ULSCH
6171 * - Fill the reception request information for the SRS
6173 * @param[in] RgSchCellCb *cell,
6174 * RgSchUlAlloc *alloc,
6175 * TfuUeRecpReqInfo *datRecpInfo,
6181 S16 rgSCHTomFillOnlySrsRecpReq
6184 RgSchUlAlloc *alloc,
6185 TfuUeRecpReqInfo *datRecpInfo
6188 S16 rgSCHTomFillOnlySrsRecpReq(cell, alloc, datRecpInfo)
6190 RgSchUlAlloc *alloc;
6191 TfuUeRecpReqInfo *datRecpInfo;
6194 TfuUePuschSrsRecpInfo *srsRecpReqInfo;
6196 srsRecpReqInfo = &datRecpInfo->t.puschRecpReq.srsInfo;
6197 srsRecpReqInfo->srsBw = (TfuUlSrsBwInfo)alloc->ue->srsCb.srsCfg.srsSetup.srsBw;
6198 srsRecpReqInfo->nRrc = alloc->ue->srsCb.srsCfg.srsSetup.fDomPosi;
6199 srsRecpReqInfo->srsHopBw = (TfuUlSrsHoBwInfo)alloc->ue->srsCb.srsCfg.srsSetup.srsHopBw;
6200 srsRecpReqInfo->transComb = alloc->ue->srsCb.srsCfg.srsSetup.txComb;
6201 srsRecpReqInfo->srsCfgIdx = alloc->ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6202 srsRecpReqInfo->srsCyclicShft = (TfuUlSrsCycShiftInfo)alloc->ue->srsCb.srsCfg.srsSetup.cycShift;
6204 /* ccpu00117050 - ADD - nSrs setting
6205 * Refer Section 5.2.2.6 of TS 36.212 V8.5.0*/
6206 datRecpInfo->t.puschRecpReq.ulSchInfo.nSrs = 1;
6209 } /* rgSCHTomFillOnlySrsRecpReq */
6212 * @brief Function which handles the filling of PCQI/RI, SRS and SR
6213 * Reception Request Information along
6214 * with the HARQ reception Request
6218 * Function: rgSCHTomUtlFillCqiSrSrsWithHq
6220 * Function which handles the filling of PCQI/RI, SRS ans SR
6221 * Reception Request Information along
6222 * with the HARQ reception Request
6225 * Invoked by: rgSCHTomUtlFillHqFdbkRecpReq &
6226 * rgSCHTomUtlFillSfHqFdbk of rg_sch_tom.c
6229 * - Fill the reception request for the Control Info arriving on the PUCCH
6230 * - Fill the reception request information for the SR, RI, CQI, SRS
6232 * @param[in] RgSchCellCb *cell,
6233 * TfuRecpReqInfo *recpReqInfo,
6234 * RgSchDlHqProcCb *hqCb,
6235 * @param[out] TfuUeRecpReqInfo *pucchRecpInfo
6236 * @param[in] uint16_t validIdx
6242 static S16 rgSCHTomUtlFillCqiSrSrsWithHq
6245 TfuRecpReqInfo *recpReqInfo,
6247 TfuUeRecpReqInfo *pucchRecpInfo,
6249 Bool isDatPresOnSecCell
6252 static S16 rgSCHTomUtlFillCqiSrSrsWithHq(cell, recpReqInfo, ue,
6253 pucchRecpInfo, validIdx,isDatPresOnSecCell)
6255 TfuRecpReqInfo *recpReqInfo;
6257 TfuUeRecpReqInfo *pucchRecpInfo;
6259 Bool isDatPresOnSecCell;
6262 RgSchUePCqiCb *cqiCb;
6263 RgSchUePCqiCb *riCb;
6264 uint8_t ri; /*To fetch RI value*/
6265 Bool willUeRprtCqi; /* Flag set due to CQI Mask and
6266 UE Inactive state (DRX)*/
6267 Bool willUeRprtSr = TRUE;
6268 TfuAckNackMode hqFdbkMode;
6270 uint8_t totalPucchBits;
6271 Bool dropCqi = FALSE;
6273 RgSchCmnUlUeSpsInfo *ulSpsUe = NULL;
6276 RgSchEmtcUeInfo *emtcUe = NULLP;
6281 /*Changes for PUCCH Format3 */
6282 hqFdbkMode = pucchRecpInfo->t.pucchRecpReq.hqInfo.hqFdbkMode;
6283 numCqiBit = rgSCHCmnCalcPcqiBitSz (ue,cell->numTxAntPorts);
6284 totalPucchBits = pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz + numCqiBit;
6287 emtcUe = RG_GET_EMTC_UE_CB(ue);
6289 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
6290 #ifdef EMTC_ENABLE /*VINU*/
6293 if((emtcUe->pucchRepNumFr1 > 1) || (emtcUe->pucchRepNumFr2 > 1))
6295 willUeRprtCqi = FALSE;
6296 willUeRprtSr = FALSE;
6300 if(ue->srCb.nSrTrIdx == validIdx)
6304 /* Should we check for Rel8 and above???
6305 * Dont send SR recp req if logicalChannelSR-Mask enabled and UL SPS is
6307 ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue, cell);
6308 /* Avoiding check for ulSpsEnabled as isUlSpsActv FALSE if sps is not enabled*/
6309 if(!((ue->ul.ulSpsCfg.isLcSRMaskEnab) &&
6310 (ulSpsUe->isUlSpsActv)))
6317 pucchRecpInfo->t.pucchRecpReq.srInfo.n1PucchIdx =
6318 ue->srCb.srCfg.srSetup.srResIdx;
6319 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
6320 /* FORMAT3: If SR is present it will be appended after HARQ */
6321 totalPucchBits = totalPucchBits + 1;
6328 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
6330 /* LTE_ADV:: UE will drop CSI during CSI+1BCS if data is present
6331 * on sec cell(isDatPresOnSecCell)*/
6333 if (hqFdbkMode == TFU_ACK_NACK_CHANNEL_SELECTION)
6335 if (hqFdbkMode == TFU_UCI_FORMAT_1B_CS)
6338 if (isDatPresOnSecCell == TRUE)
6345 /* Format 3 Changes : If Hq + SR + CQI bits < 22 and simultaneousAckNackAndCQI-Format3
6346 is enabled then CQI will be multiplexed with HQ otherwise CQI will be dropped
6347 Spec 36.213 Sec 10.1.1 */
6348 else if (hqFdbkMode == TFU_UCI_FORMAT_3)
6350 if ((isDatPresOnSecCell == TRUE) &&
6351 ((!ue->simulAckNackCQIFormat3) || (totalPucchBits > 22)))
6359 cqiCb = ue->nPCqiCb;
6360 if(riCb->nRiTrIdx == validIdx)
6362 /*ccpu00140578:: Skip the UE if the RI is already processed
6364 if(riCb->riRecpPrcsd == FALSE)
6366 if(riCb->riDist == 0)
6368 if((riCb->cqiCfg.cqiSetup.sANCQI == TRUE) && (willUeRprtCqi == TRUE)&&
6369 (isDatPresOnSecCell == FALSE))
6372 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6373 riCb->cqiCfg.cqiSetup.cqiPResIdx;
6374 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6376 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_HARQ_SR)
6378 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI;
6382 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_CQI;
6384 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6386 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6387 ue->nPRiCb->servCellInfo->sCellIdx;
6389 rgSCHTomUtlFillRiBitWidthInfo(ue);
6390 if (ue->nPCqiCb->nCqiTrIdx == validIdx)
6392 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, ue->nPCqiCb);
6407 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
6413 /* Skip the UE for RI processing on PUCCH
6414 * in the same subframe as it already processed */
6415 if(riCb->nRiTrIdx == validIdx)
6417 /* As the new idx is same is current idx
6418 * then PUCCH reception processing will consider
6419 * RI also in the same subframe. To block this
6420 * below flag is used*/
6421 riCb->riRecpPrcsd = TRUE;
6425 else if(cqiCb->nCqiTrIdx == validIdx)
6427 if((cqiCb->cqiCfg.cqiSetup.sANCQI == TRUE) && (willUeRprtCqi == TRUE)&&
6428 (isDatPresOnSecCell == FALSE))
6431 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6432 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
6434 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6436 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6437 cqiCb->servCellInfo->sCellIdx;
6439 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6440 rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
6441 if(0 == pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz)
6443 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d "
6444 "Unable to Fill CqiPmi size", ue->ueId);
6447 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_HARQ_SR)
6449 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI;
6453 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_CQI;
6466 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6468 if(ue->srsCb.nSrsTrIdx == validIdx)
6470 /* ccpu00140578::Skip the UE for SRS reception processing
6471 * if already done as part of PUSCH recpetion
6473 if(ue->srsCb.srsRecpPrcsd == FALSE)
6475 if(ue->srsCb.srsDist ==0 )
6477 if((pucchRecpInfo->t.pucchRecpReq.uciInfo != TFU_PUCCH_HARQ_CQI)
6478 && (ue->srsCb.srsCfg.srsSetup.sANSrs)
6479 && (isDatPresOnSecCell == FALSE))
6482 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
6483 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
6484 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
6485 ue->srsCb.srsCfg.srsSetup.fDomPosi;
6486 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
6487 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
6488 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
6489 ue->srsCb.srsCfg.srsSetup.txComb;
6490 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
6491 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6492 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
6493 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
6494 /* ccpu00116923 - ADD - New Reception Request types for CQI and SRS with SR */
6495 switch(pucchRecpInfo->t.pucchRecpReq.uciInfo)
6497 case TFU_PUCCH_HARQ_SR:
6498 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_SRS;
6500 case TFU_PUCCH_HARQ_SR_CQI:
6501 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI_SRS;
6504 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SRS;
6508 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
6512 ue->srsCb.srsDist--;
6514 /* Skip the UE for SRS processing on PUCCH
6515 * in the same subframe as it already processed */
6516 if(ue->srsCb.nSrsTrIdx == validIdx)
6518 /* As the new idx is same is current idx
6519 * then PUCCH reception processing will consider
6520 * SRS also in the same subframe. To block this
6521 * below flag is used*/
6522 ue->srsCb.srsRecpPrcsd = TRUE;
6530 } /* rgSCHTomUtlFillCqiSrSrsWithHq */
6533 * @brief Function which handles the filling of PCQI/RI, SRS
6534 * Reception Request Information along with SR reception
6539 * Function: rgSCHTomUtlFillCqiSrsWithSr
6541 * Function which handles the filling of PCQI/RI, SRS
6542 * Reception Request Information along
6543 * with the SR reception Request
6546 * Invoked by: rgSCHTomUtlFillSrRecpReq of rg_sch_tom.c
6549 * - Fill the reception request for CQI/RI, SRS if they occur
6550 * in the same instance as of SR.
6552 * @param[in] RgSchCellCb *cell,
6554 * TfuRecpReqInfo *recpReqInfo,
6555 * @param[out] TfuUeRecpReqInfo *pucchRecpInfo
6556 * @param[in] uint16_t validIdx
6563 static S16 rgSCHTomUtlFillCqiSrsWithSr
6567 TfuRecpReqInfo *recpReqInfo,
6568 TfuUeRecpReqInfo *pucchRecpInfo,
6572 static S16 rgSCHTomUtlFillCqiSrsWithSr(cell, ue, recpReqInfo,
6573 pucchRecpInfo, validIdx)
6576 TfuRecpReqInfo *recpReqInfo;
6577 TfuUeRecpReqInfo *pucchRecpInfo;
6581 RgSchUePCqiCb *cqiCb;
6582 RgSchUePCqiCb *riCb;
6583 uint8_t ri; /*To fetch RI value*/
6584 Bool willUeRprtCqi; /* Flag set due to CQI Mask and
6585 UE Inactive state (DRX)*/
6587 cqiCb = ue->nPCqiCb;
6588 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
6590 rgSCHEmtcWillUeRptCqi(ue, &willUeRprtCqi);
6592 if(riCb->nRiTrIdx == validIdx)
6594 /*ccpu00140578:: Skip the UE if the RI is already processed
6596 if(riCb->riRecpPrcsd == FALSE)
6598 if(riCb->riDist == 0)
6600 if(willUeRprtCqi == TRUE)
6603 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6604 riCb->cqiCfg.cqiSetup.cqiPResIdx;
6605 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6608 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI;
6609 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6611 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6612 ue->nPRiCb->servCellInfo->sCellIdx;
6614 rgSCHTomUtlFillRiBitWidthInfo(ue);
6615 /* TODO:: syed Shouldn't this be done outside this if condition */
6616 if (cqiCb->nCqiTrIdx == validIdx)
6618 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6621 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
6627 if(riCb->nRiTrIdx == validIdx)
6628 {/* Need to skip this UE during PUCCH RI recpetion process
6629 in the current subframe */
6630 riCb->riRecpPrcsd = TRUE;
6634 else if(cqiCb->nCqiTrIdx == validIdx)
6636 if(willUeRprtCqi == TRUE)
6639 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6640 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
6642 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6645 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6646 cqiCb->servCellInfo->sCellIdx;
6648 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6649 rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
6650 if(0 == pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz)
6652 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d"
6653 " Unable to Fill CqiPmi size", ue->ueId);
6657 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI;
6659 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6661 if(ue->srsCb.nSrsTrIdx == validIdx)
6663 /* ccpu00140578:: Cnsider the SRS processing
6664 * only if not done in the same TTI
6665 * as part of PUSCH or HARQ reception process*/
6666 if(ue->srsCb.srsRecpPrcsd == FALSE)
6668 if(ue->srsCb.srsDist ==0 )
6670 if(ue->srsCb.srsCfg.srsSetup.sANSrs)
6673 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
6674 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
6675 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
6676 ue->srsCb.srsCfg.srsSetup.fDomPosi;
6677 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
6678 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
6679 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
6680 ue->srsCb.srsCfg.srsSetup.txComb;
6681 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
6682 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6683 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
6684 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
6685 /* ccpu00116923 - ADD - New Reception Request types for CQI and
6687 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_SR_CQI)
6689 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI_SRS;
6693 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_SRS;
6697 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
6701 ue->srsCb.srsDist--;
6703 /* Skip the UE for SRS processing on PUCCH
6704 * in the same subframe as it already processed */
6705 if(ue->srsCb.nSrsTrIdx == validIdx)
6707 /* As the new idx is same is current idx
6708 * then PUCCH reception processing will consider
6709 * SRS also in the same subframe. To block this
6710 * below flag is used*/
6711 ue->srsCb.srsRecpPrcsd = TRUE;
6717 } /* rgSCHTomUtlFillCqiSrsWithSr */
6723 /** @brief This function handles filling of HARQ feedback repetition
6724 * recption request for each subframe
6728 * Function: rgSCHTomUtlFillSfRepHqFdbk
6732 * @param [out] TfuRecpReqInfo *recpReqInfo
6733 * @param [in] RgSchCellCb *cell
6734 * @param [out] RgSchErrInfo *err
6735 * @param [in] RgSchDlSf *dlSf
6736 * @param [in] uint8_t noFdbks
6737 * @param [in] CmMemListCp *memCp
6738 * @param [in] uint8_t elemIdx
6739 * @param [in] RgSchDlSf *nxtDlsf
6746 static S16 rgSCHTomUtlFillSfRepHqFdbk
6748 TfuRecpReqInfo *recpReqInfo,
6749 RgSchCellCb *cellCb,
6759 static S16 rgSCHTomUtlFillSfRepHqFdbk (recpReqInfo, cellCb, err, dlSf,
6760 noFdbks, memCp, elemIdx, nxtDlsf, validIdx)
6761 TfuRecpReqInfo *recpReqInfo;
6762 RgSchCellCb *cellCb;
6773 static S16 rgSCHTomUtlFillSfRepHqFdbk
6775 TfuRecpReqInfo *recpReqInfo,
6776 RgSchCellCb *cellCb,
6785 static S16 rgSCHTomUtlFillSfRepHqFdbk (recpReqInfo, cellCb, err, dlSf,
6786 noFdbks, memCp, elemIdx, nxtDlsf)
6787 TfuRecpReqInfo *recpReqInfo;
6788 RgSchCellCb *cellCb;
6798 RgSchDlHqProcCb *hqCb;
6802 TfuUeRecpReqInfo *pucchRecpInfo;
6804 TfuUePucchHqRecpInfo *hqRecpReq;
6806 RgSchDlHqTbCb *tbCb;
6807 RgSchDlHqProcCb *prvHqCb = NULLP;
6809 node = dlSf->ackNakRepQ.first;
6812 tbCb = (RgSchDlHqTbCb *)(node->node);
6814 ueCb = hqCb->hqE->ue;
6816 if (--tbCb->fbkRecpRepCntr)
6818 /* Add to next subfarme */
6819 /* Add this hqCb to the next dlSf's ackNakRepQ */
6820 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
6821 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
6822 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
6823 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
6830 /* Go to the next node */
6835 if ((hqCb->hqE->ue != NULLP) &&
6836 (hqCb->hqE->ue->measGapCb.isMeasuring != TRUE)
6837 && (hqCb != prvHqCb)
6840 /* We need to add the recp request to be sent on the pucchANRep
6843 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
6844 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
6847 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to"
6848 "Allocate TfuUeRecpReqInfo for RNTI:%d ", ueCb->ueId);
6849 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
6852 pucchRecpInfo->rnti = ueCb->ueId;
6854 pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
6856 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
6859 /* FOR repetition Feedback shall come on n1PucchAnRep Configured per
6863 pucchRecpInfo->t.pucchRecpReq.hqType = TFU_HQ_RECP_REQ_N1PUCCH;
6864 pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = ueCb->ackNakRepCb.pucchRes;
6866 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
6867 hqRecpReq = &(pucchRecpInfo->t.pucchRecpReq.hqInfo);
6868 /* ACK NACK rep works only in bundling mode . */
6869 hqRecpReq->hqFdbkMode = (TfuAckNackMode)RGR_TDD_ACKNACK_MODE_BUNDL;
6870 if ((hqCb->hqPSfLnk.node != NULLP) &&
6871 (hqCb->hqPSfLnk.node != NULLP))
6874 hqRecpReq->hqSz = 2;
6878 hqRecpReq->hqSz = 1;
6880 hqRecpReq->pucchResCnt = 1;
6881 hqRecpReq->hqRes[0] = ueCb->ackNakRepCb.pucchRes;
6883 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
6884 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
6886 /* In a given dlSf, if there is 2 TBs context
6887 * stored for a given harq, then they are added
6888 * adjacent to each other in the subframe. To avoid
6889 * adding duplicate recpnInfo for each TB, store this
6890 * hqCb in prvHqCb. If nextHqCb is same as prvHqCb then
6891 * do not add reception req info.*/
6894 RGSCH_NULL_CHECK(cellCb->instIdx, hqCb->hqE->ue);
6895 rgSCHTomUtlMoveNxtOccasion(cellCb, hqCb->hqE->ue, validIdx);
6897 /* Go to the next node */
6903 /** @brief This function handles filling of HARQ feedback recption request
6908 * Function: rgSCHTomUtlFillSfHqFdbkInfo
6912 * @param [out] TfuRecpReqInfo *recpReqInfo
6913 * @param [in] RgSchCellCb *cell
6914 * @param [out] RgSchErrInfo *err
6915 * @param [in] RgSchDlSf *dlSf
6916 * @param [in] uint8_t noFdbks
6917 * @param [in] CmMemListCp *memCp
6918 * @param [in] uint8_t elemIdx
6919 * @param [in] RgSchDlSf *nxtDlsf
6920 * @param [in] uint16_t validIdx;
6927 static S16 rgSCHTomUtlFillSfHqFdbkInfo
6929 TfuRecpReqInfo *recpReqInfo,
6930 RgSchCellCb *cellCb,
6938 RgSchDlHqProcCb *hqCb,
6939 RgSchUePucchRecpInfo *pucchInfo,
6941 RgSchDlHqProcCb *prvHqCb
6944 static S16 rgSCHTomUtlFillSfHqFdbkInfo (recpReqInfo, cellCb, err, dlSf,
6945 noFdbks, memCp, elemIdx, nxtDlsf, validIdx, hqCb, pucchInfo, alloc, prvHqCb)
6946 TfuRecpReqInfo *recpReqInfo;
6947 RgSchCellCb *cellCb;
6955 RgSchDlHqProcCb *hqCb;
6956 RgSchUePucchRecpInfo *pucchInfo;
6958 RgSchDlHqProcCb *prvHqCb;
6962 static S16 rgSCHTomUtlFillSfHqFdbkInfo
6964 TfuRecpReqInfo *recpReqInfo,
6965 RgSchCellCb *cellCb,
6972 RgSchDlHqProcCb *hqCb,
6973 RgSchUePucchRecpInfo *pucchInfo,
6975 RgSchDlHqProcCb *prvHqCb
6978 static S16 rgSCHTomUtlFillSfHqFdbkInfo (recpReqInfo, cellCb, err, dlSf,
6979 noFdbks, memCp, elemIdx, nxtDlsf, hqCb, pucchInfo, alloc, prvHqCb)
6980 TfuRecpReqInfo *recpReqInfo;
6981 RgSchCellCb *cellCb;
6988 RgSchDlHqProcCb *hqCb;
6989 RgSchUePucchRecpInfo *pucchInfo;
6991 RgSchDlHqProcCb *prvHqCb;
6996 RgSchUeCb *ueCb = hqCb->hqE->ue;
6998 CmLteTimingInfo futTime;
6999 RgSchTddANInfo *anInfo;
7002 RgrTddAckNackMode ackNackMode;
7003 RgSchDlHqTbCb *tbCb;
7009 RG_SCH_ADD_TO_CRNT_TIME(cellCb->crntTime, futTime, TFU_RECPREQ_DLDELTA);
7013 for (idx = 0 ;idx < 2; idx++)
7015 if (HQ_TB_WAITING == hqCb->tbInfo[idx].state)
7018 tbCb = &hqCb->tbInfo[idx];
7022 ackNackMode = ueCb->dl.ackNackMode;
7024 if(ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL)
7026 anInfo = rgSCHUtlGetUeANFdbkInfo(ueCb, &futTime);
7027 /* Only the last scheduled TB for the UE is for HARQ
7028 * ACK/NACK reception in Bundling case */
7029 if((anInfo == NULLP) ||
7030 (anInfo->latestMIdx != dlSf->dlFdbkInfo.m))
7037 /* Get the TFU reception request pointer, if present */
7038 cmHashListFind(&cellCb->ueTfuPendLst, (uint8_t*) &ueCb->ueId,
7039 sizeof(ueCb->ueId), 0, (PTR *) &pucchInfo);
7042 /* For upgrade we shall use the existing logic of pending list. */
7043 cmHashListFind(&cellCb->ueTfuPendLst, (uint8_t*) &ueCb->ueId,
7044 sizeof(ueCb->ueId), 0, (PTR *) &pucchInfo);
7047 else if(hqCb->hqE->raCb != NULLP)
7049 /* For RACH it is set to Bundling */
7050 ackNackMode = RGR_TDD_ACKNACK_MODE_BUNDL;
7051 rnti = hqCb->hqE->raCb->tmpCrnti;
7058 /* Do not proceed if PUSCH
7059 reception req is already filled*/
7064 /* Go to the next node */
7068 if(((ueCb == NULLP) || (ueCb->measGapCb.isMeasuring != TRUE))
7072 TknUInt16 n1PucchTkn = {FALSE, 0};
7075 pdcch = tbCb->hqP->pdcch;
7077 n1PucchTkn = hqCb->spsN1PucchRes;
7079 for (tbIndx = 0; tbIndx < TFU_MAX_TB; tbIndx++)
7081 if (hqCb->tbInfo[tbIndx].state == HQ_TB_WAITING &&
7082 (RGSCH_TIMEINFO_SAME(hqCb->tbInfo[tbIndx].fdbkTime,
7083 recpReqInfo->timingInfo)))
7086 hqCb->tbInfo[tbIndx].pucchFdbkIdx = hqCb->ulDai;
7089 ret = rgSCHTomUtlFillSfHqFdbkForOneUe(hqCb,recpReqInfo, cellCb, err, dlSf, noFdbks,
7090 memCp, elemIdx, nxtDlsf, rnti, ackNackMode, &pucchInfo, pdcch,
7091 n1PucchTkn, &alloc, hqSz);
7096 /* TODO:: In case of F1BCS and CSI in same subframe
7097 * UE shall drop the CSI if there was at least one
7098 * PDSCH transmission in any of the DL subframe
7099 * mapping to this UL subframe
7102 rgSCHTomUtlFillCqiSrSrsWithHq(cellCb,recpReqInfo, hqCb->hqE->ue,
7103 pucchInfo->pucchRecpInfo, validIdx,FALSE);
7105 if((hqCb->hqE->ue) &&
7106 (hqCb->hqE->ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS))
7109 if(RG_SCH_IS_CELL_SEC(hqCb->hqE->ue,hqCb->hqE->cell))
7111 switch(pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo)
7113 case TFU_PUCCH_HARQ_SR_CQI:
7114 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
7115 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
7117 case TFU_PUCCH_HARQ_CQI:
7118 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
7119 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
7121 case TFU_PUCCH_HARQ_SR_CQI_SRS:
7122 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_SRS;
7123 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
7125 case TFU_PUCCH_HARQ_SR_SRS:
7126 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
7128 case TFU_PUCCH_HARQ_SRS:
7129 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
7140 /* TODO antz - pushing the following code (under TFU_UPGRADE)
7141 * into the above function (...ForOneUe) did not work (caused
7142 * two additional TCs to fail). Don't know why. If this
7143 * is done later, make sure that the code branch
7144 * for relPdcch (later in this func) is also modified appropriately.
7146 /* Now add to the recp request or pending list */
7147 //if((elemIdx != (noFdbks - 1)))
7149 cmHashListInsert(&cellCb->ueTfuPendLst, (PTR) pucchInfo,
7150 (uint8_t *)&rnti ,(uint16_t) sizeof(CmLteRnti));
7154 } /* If measuring */
7155 /* Go to the next node */
7156 if ((tbCb->fbkRecpRepCntr) && (--tbCb->fbkRecpRepCntr))
7158 /* Add to next subfarme */
7159 /* Add this hqCb to the next dlSf's ackNakRepQ */
7160 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
7161 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
7162 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
7163 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
7165 /* In a given dlSf, if there is 2 TBs context
7166 * stored for a given harq, then they are added
7167 * adjacent to each other in the subframe. To avoid
7168 * adding duplicate recpnInfo for each TB, store this
7169 * hqCb in prvHqCb. If nextHqCb is same as prvHqCb then
7170 * do not add reception req info.*/
7178 /** @brief This function calculates the pucch resource idx
7179 * that is to be filled in harq reception request
7183 * Function: rgSCHTomUtlGethqRes
7186 * -Calculate the pucch resource idx
7187 * Harq Reception Request for Format 1B with
7190 * @param [in] uint8_t noFdbks
7191 * @param [in] RgSchDlSf *dlSf
7192 * @param [in] RgSchPdcch *pdcch
7193 * @param [in] RgSchCellCb *cellCb
7194 * @param [out]uint16_t *hqRes
7198 static Void rgSCHTomUtlGethqRes
7203 RgSchCellCb *cellCb,
7207 static Void rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,hqRes)
7211 RgSchCellCb *cellCb;
7223 m = dlSf->dlFdbkInfo.m;
7225 P = rgSCHCmnGetPValFrmCCE(cellCb, nCce);
7226 nP = cellCb->rgSchTddNpValTbl[P];
7227 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
7228 *hqRes = (M - m - 1)* nP + (m * nPlusOne) + pdcch->nCce +
7229 cellCb->pucchCfg.n1PucchAn;
7234 /** @brief This function fills the harq reception request for
7235 * TDD in case of Fomat 1B with CS for M=1
7239 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1
7242 * -Fill Harq Reception Request for Format 1B with
7245 * @param [in] RgSchDlHqProcCb *hqCb
7246 * @param [in] TfuUePucchRecpReq *hqRecpReq
7247 * @param [in] uint8_t noFdbks
7248 * @param [in] RgSchDlSf *dlSf
7249 * @param [in] RgSchPdcch *pdcch
7250 * @param [in] RgSchCellCb *cellCb
7254 static Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1
7256 RgSchDlHqProcCb *hqCb,
7257 TfuUePucchRecpReq *hqRecpReq,
7264 static Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1(hqCb, hqRecpReq,
7265 noFdbks,dlSf,pdcch,cellCb)
7266 RgSchDlHqProcCb *hqCb;
7267 TfuUePucchRecpReq *hqRecpReq;
7271 RgSchCellCb *cellCb;
7274 RgSchUeCb *ue = NULLP;
7275 Bool isCellSec = FALSE;
7278 /*ccpu00147920: UeCb is NULL for SPS activation*/
7279 if(pdcch && pdcch->ue)
7280 {/* SPS Release pdcch or dynamic data */
7287 /* This is not supposed to happen
7288 * Error case. hqCB has to be ter
7289 * when pdcch is present . Adding
7290 * if check bcs of kwork*/
7297 if((hqCb != NULLP) &&
7298 (RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
7303 switch(ue->f1bCsAVal)
7305 case RG_SCH_A_VAL_2:
7306 /* harq(0) is primary harq(1) is secondary) */
7309 hqRecpReq->hqInfo.hqRes[1] = ue->n1PucchF1bResCb.
7310 cw1N1Res[hqCb->tpc].n1PucchIdx;
7312 else/* primary cell */
7315 /* hqCb will be null in case of sps rel pdcch */
7316 if ((hqCb) && hqCb->spsN1PucchRes.pres)
7317 {/* SPS occasion or dyn sched*/
7318 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
7321 #endif /* LTEMAC_SPS */
7322 {/* dyn data or sps release */
7326 /* This is not supposed to happen
7327 * Error case. hqCB has to be ter
7328 * when pdcch is present . Adding
7329 * if check bcs of kwork*/
7334 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7335 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7339 case RG_SCH_A_VAL_3:
7341 /* Serving cell in mimo mode should be
7342 * in 0 and 1 and the serving cell in siso
7343 * mode should be in 2 indices */
7346 uint8_t servCellIdx = rgSchUtlGetServCellIdx(hqCb->hqE->cell->instIdx,
7347 hqCb->hqE->cell->cellId,
7350 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1)
7351 {/* Sec cell is in mimo mode, use 0 and 1 */
7352 hqRecpReq->hqInfo.hqRes[0] =
7353 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7354 hqRecpReq->hqInfo.hqRes[1] =
7355 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
7358 {/* Sec cell is in siso mode, use 2 */
7359 hqRecpReq->hqInfo.hqRes[2] =
7360 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7364 {/* primary cell hq */
7366 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
7367 {/* prim cell is in mimo mode, use 0 and 1 */
7369 if (hqCb && hqCb->spsN1PucchRes.pres)
7370 {/* Not sps release */
7371 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
7374 #endif /* LTEMAC_SPS */
7375 {/* sps rel or dyn */
7379 /* This is not supposed to happen
7380 * Error case. hqCB has to be ter
7381 * when pdcch is present . Adding
7382 * if check bcs of kwork*/
7387 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7388 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7389 hqRecpReq->hqInfo.hqRes[1] = hqRes + 1;
7393 {/* prim cell is in siso mode use 2 */
7395 /* Consider sps occasions */
7396 if (hqCb && hqCb->spsN1PucchRes.pres)
7397 {/* Not sps release */
7398 hqRecpReq->hqInfo.hqRes[2] = hqCb->spsN1PucchRes.val;
7401 #endif /* LTEMAC_SPS */
7406 /* This is not supposed to happen
7407 * Error case. hqCB has to be ter
7408 * when pdcch is present . Adding
7409 * if check bcs of kwork*/
7414 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7415 hqRecpReq->hqInfo.hqRes[2] = hqRes;
7421 case RG_SCH_A_VAL_4:
7422 {/* Both the serv cells are in mimo mode */
7424 {/* 2 and 3 for sec cell */
7425 hqRecpReq->hqInfo.hqRes[2] =
7426 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7427 hqRecpReq->hqInfo.hqRes[3] =
7428 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
7430 else/* primary cell */
7431 {/* 0 and 1 are for primary cell */
7433 if (hqCb && hqCb->spsN1PucchRes.pres)
7434 {/* Not sps release */
7435 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
7438 #endif /* LTEMAC_SPS */
7443 /* This is not supposed to happen
7444 * Error case. hqCB has to be ter
7445 * when pdcch is present . Adding
7446 * if check bcs of kwork*/
7451 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7452 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7453 hqRecpReq->hqInfo.hqRes[1] = hqRes + 1;
7464 /** @brief This function fills the harq reception request for
7465 * TDD in case of Fomat 1B with CS for M>=2
7469 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234
7472 * -Fill Harq Reception Request for Format 1B with
7475 * @param [in] RgSchDlHqProcCb *hqCb
7476 * @param [in] TfuUePucchRecpReq *hqRecpReq
7477 * @param [in] uint8_t noFdbks
7478 * @param [in] RgSchDlSf *dlSf
7479 * @param [in] RgSchPdcch *pdcch
7480 * @param [in] RgSchCellCb *cellCb
7481 * @param [in] uint8_t elemIdx
7485 static Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234
7487 RgSchDlHqProcCb *hqCb,
7488 TfuUePucchRecpReq *hqRecpReq,
7492 RgSchCellCb *cellCb,
7496 static Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234(
7497 hqCb,hqRecpReq,noFdbks,dlSf,pdcch,cellCb,elemIdx)
7498 RgSchDlHqProcCb *hqCb;
7499 TfuUePucchRecpReq *hqRecpReq;
7503 RgSchCellCb *cellCb;
7508 Bool isCellSec = FALSE;
7510 uint8_t servCellIdx;
7513 {/* SPS Release pdcch or dynamic data */
7520 /* This is not supposed to happen
7521 * Error case. hqCB has to be ter
7522 * when pdcch is present . Adding
7523 * if check bcs of kwork*/
7530 if((hqCb != NULLP) && (ue != NULLP) &&
7531 (RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
7537 {/* Sec Cell indices are 2 and 3*/
7538 servCellIdx = rgSchUtlGetServCellIdx(hqCb->hqE->cell->instIdx,
7539 hqCb->hqE->cell->cellId,
7542 hqRecpReq->hqInfo.hqRes[2] =
7543 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7545 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1)
7547 hqRecpReq->hqInfo.hqRes[3] =
7548 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
7552 {/* Primary cell indices are 0 and 1 */
7554 * M > 2 if SPS occasion is present in any of the
7555 * DL subframe in the bundle, the n1Pucch(0) is
7556 * the SPS resource and n1Pucch(1) is the resource
7557 * derived from pdcch with DAI = 1
7558 * If No SPS Occasion
7559 * Then n1Pucch(0) is from pdcch with DAI =1
7560 * and n1Pucch(1) is from pdcch with DAI = 2
7564 {/* this is not sps release pdcch */
7565 if(hqCb->spsN1PucchRes.pres == TRUE)
7567 hqRes = hqCb->spsN1PucchRes.val;
7572 {/*Dynamic scheduling or SPS Release
7573 Derive from pdcch */
7574 if(pdcch->dlDai < 3)
7575 {/* No need to calcualte from DAI > 2 */
7576 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7582 hqRecpReq->hqInfo.hqRes[elemIdx] = hqRes;
7585 {/* Pdcch with DAI = 1 and 2 needs to be used
7586 for resource calculation*/
7587 if(hqCb && hqCb->spsN1PucchRes.pres == TRUE)
7588 {/* dyn or sps occasion */
7589 /* Shift the hqRes[0] if it was filled
7590 * if there was a pdcch with DAI 1 before to this
7593 {/* SPS occasion happened in the middle
7595 /* shifting the non SPS resource to n1Pucch(1) */
7596 hqRecpReq->hqInfo.hqRes[1] = hqRecpReq->hqInfo.hqRes[0];
7599 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7602 else if(pdcch && pdcch->dlDai < 3)
7604 else if(pdcch->dlDai < 3)
7606 {/* sps rel or dyn sched */
7607 /* hqCb wil not be present for sps release pdcch */
7608 if(hqCb && (pdcch->dlDai != hqCb->ulDai))
7609 {/* there was a SPS occasion before to this */
7610 if(pdcch->dlDai == 1)
7612 hqRecpReq->hqInfo.hqRes[1] = hqRes;
7613 }/* ignore the DAI 2 in this case */
7615 {/* There was no SPS occasion before to this */
7619 {/* Added check to ignore kwork warning */
7620 hqRecpReq->hqInfo.hqRes[(pdcch->dlDai)-1] = hqRes;
7629 /** @brief This function fills the harq reception request for
7630 * TDD in case of Fomat 1B with CS
7634 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCS
7637 * -Fill Harq Reception Request for Format 1B with
7640 * @param [in] RgSchDlSf *ulSf
7641 * @param [in] RgSchCellCb *cell
7642 * @param [out]TfuUePucchRecpReq *hqRecpReq
7646 static S16 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS
7648 RgSchDlHqProcCb *hqCb,
7649 TfuUePucchRecpReq *hqRecpReq,
7657 static S16 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS(hqCb,hqRecpReq,noFdbks,dlSf,pdcch,
7658 n1PucchTkn,elemIdx,cellCb)
7659 RgSchDlHqProcCb *hqCb;
7660 TfuUePucchRecpReq *hqRecpReq;
7665 RgSchCellCb *cellCb;
7668 /* Update teh fdbk mode if something different is present
7669 * in L1 API file for F1BS *//* 1 --> F1BCS */
7670 hqRecpReq->hqInfo.hqFdbkMode = TFU_ACK_NACK_CHANNEL_SELECTION;
7674 case RG_SCH_M_VAL_1:
7677 rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1(hqCb,hqRecpReq,
7678 noFdbks,dlSf,pdcch,cellCb);
7681 case RG_SCH_M_VAL_2:
7682 case RG_SCH_M_VAL_3:
7683 case RG_SCH_M_VAL_4:
7685 /* Spatial bundling will be applied */
7686 rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234(hqCb,hqRecpReq,
7687 noFdbks,dlSf,pdcch,cellCb,elemIdx);
7697 /***********************************************************
7699 * Func : rgSCHTomUtlFillSfHqFdbkForOneUe
7701 * Desc : Fill HARQ feedback info for one UE/entry
7709 **********************************************************/
7711 static S16 rgSCHTomUtlFillSfHqFdbkForOneUe
7713 RgSchDlHqProcCb *hqCb,
7714 TfuRecpReqInfo *recpReqInfo,
7715 RgSchCellCb *cellCb,
7723 RgrTddAckNackMode ackNackMode,
7724 RgSchUePucchRecpInfo **pucchInfoRef,
7726 TknUInt16 n1PucchTkn,
7731 static S16 rgSCHTomUtlFillSfHqFdbkForOneUe(hqCb,recpReqInfo, cellCb, err, dlSf,
7732 noFdbks, memCp, elemIdx, nxtDlsf, rnti, ackNackMode, pucchInfoRef,
7733 pdcch, n1PucchTkn, allocRef, hqSz)
7734 RgSchDlHqProcCb *hqCb;
7735 TfuRecpReqInfo *recpReqInfo;
7736 RgSchCellCb *cellCb;
7744 RgrTddAckNackMode ackNackMode;
7745 RgSchUePucchRecpInfo **pucchInfoRef;
7747 TknUInt16 n1PucchTkn;
7752 RgSchUePucchRecpInfo *pucchInfo = *pucchInfoRef;
7755 TfuUePucchRecpReq *hqRecpReq;
7770 Bool isFirstFdbk = FALSE;
7772 if(pucchInfo == NULLP)
7774 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchInfo,
7775 sizeof(RgSchUePucchRecpInfo), memCp)) != ROK)
7777 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to "
7778 "Allocate TfuUeRecpReqInfo for cell RNTI:%d",rnti);
7779 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
7783 #ifdef TFU_ALLOC_EVENT_NO_INIT
7784 pucchInfo->hashLstEnt.hashVal = 0;
7785 pucchInfo->hashLstEnt.keyLen = 0;
7786 pucchInfo->hashLstEnt.key = 0;
7787 pucchInfo->hashLstEnt.list.prev = pucchInfo->hashLstEnt.list.next = 0;
7789 if ((ret = rgSCHUtlGetEventMem((Ptr *)&(pucchInfo->pucchRecpInfo),
7790 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp))) != ROK)
7792 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to "
7793 "Allocate TfuUeRecpReqInfo for cell RNTI:%d",rnti);
7794 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
7797 memset(pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes,0xff,sizeof(uint16_t)*TFU_MAX_HQ_RES);
7798 #ifdef TFU_ALLOC_EVENT_NO_INIT
7799 memset(&pucchInfo->pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
7801 pucchInfo->pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
7802 pucchInfo->pucchRecpInfo->rnti = rnti;
7804 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo=TFU_PUCCH_HARQ;
7811 /* Calculation of resources same for both bundling and muxing for M = 1
7814 RgSchUeCb *ue = rgSCHDbmGetUeCb (cellCb, rnti);
7815 if((ue) && (1 == ue->numSCells))
7817 if(ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS)
7819 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
7820 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS(hqCb,hqRecpReq,
7821 noFdbks,dlSf,pdcch,elemIdx,cellCb);
7824 {/* M = 1 case . size is same as A Value*/
7825 hqRecpReq->hqInfo.hqSz = ue->f1bCsAVal;
7826 hqRecpReq->hqInfo.pucchResCnt = hqRecpReq->hqInfo.hqSz;
7829 hqRecpReq->hqInfo.hqSz = (noFdbks * 2); /* M for 2 cells */
7830 hqRecpReq->hqInfo.pucchResCnt = 4;
7832 hqRecpReq->hqInfo.a = ue->f1bCsAVal;
7833 /* handling for SPS occasions*/
7836 /* set the datPresinFirstSUbframe to TRUE if this
7837 * is for pcell txion*/
7839 RgSchTddANInfo *anInfo = NULLP;
7841 /* if this txion is on pcell
7842 * sps occaion, dyn sched or sps release pdcch
7843 * set the sched present in first
7844 * dl subframe of the bundle to TRUE. This
7845 * is required for mapping the feedbak when SPS occasion
7846 * is present in any of the DL subframe in the bundle in
7849 /* SPS will happen only on pcell */
7850 if((hqCb == NULLP) || (!RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
7853 anInfo = rgSCHUtlGetUeANFdbkInfo(ue,
7854 &recpReqInfo->timingInfo,RGSCH_PCELL_INDEX);
7856 {/* ANInfo must be there. adding block
7858 RGSCHDBGERRNEW(cellCb->instIdx,(rgSchPBuf(cellCb->instIdx),
7859 "ANInfo should not be NULL for cellId=%d \n", cellCb->cellId));
7866 {/* This needs to be revisited while
7867 adding support for PUCCH format 3 */
7868 RGSCHDBGERRNEW(cellCb->instIdx,(rgSchPBuf(cellCb->instIdx),"Invalid Pucch format configured.."));
7875 if((ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) ||
7876 ((noFdbks == 1) && (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT)))
7878 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
7880 prevHqSize = hqRecpReq->hqInfo.hqSz;
7883 /* Only one index for bundling case */
7884 hqRecpReq->M = noFdbks;
7886 TFU_HQ_RECP_REQ_NORMAL;
7887 hqRecpReq->multCnt = 1;
7888 hqRecpReq->t.nCce[0] =
7893 rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
7895 hqRecpReq->type = TFU_UCI_HARQ;
7897 #else /* TFU_UPGRADE */
7900 if ((TRUE == isFirstFdbk) && (TRUE == n1PucchTkn.pres))
7902 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)ackNackMode;
7903 hqRecpReq->hqInfo.pucchResCnt=1;
7904 hqRecpReq->hqInfo.hqRes[0] = n1PucchTkn.val;
7905 hqRecpReq->hqInfo.hqSz = hqSz;
7908 else if (FALSE == n1PucchTkn.pres)
7911 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)ackNackMode;
7913 P = rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
7914 nP = cellCb->rgSchTddNpValTbl[P];
7915 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
7916 m = dlSf->dlFdbkInfo.m;
7917 /* In case of no UE */
7918 pucchRes = (M - m - 1)* nP + (m * nPlusOne) + pdcch->nCce +
7919 cellCb->pucchCfg.n1PucchAn;
7920 /*ccpu00130164:MOD-Changed to maitain value of
7921 hqRecpReq->hqInfo.pucchResCnt=1 in case of bundling*/
7922 /*ccpu00132284 -MOD- hqRes need to be updated after pucchReCnt set to 1
7923 * and resource should be update at index-0*/
7924 hqRecpReq->hqInfo.pucchResCnt=1;
7925 hqRecpReq->hqInfo.hqRes[hqRecpReq->hqInfo.pucchResCnt-1] = pucchRes;
7927 if((ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) && (hqSz > prevHqSize))
7928 hqRecpReq->hqInfo.hqSz = hqSz;
7929 else if (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT)
7930 hqRecpReq->hqInfo.hqSz = hqSz;
7932 hqRecpReq->hqInfo.hqSz = prevHqSize;
7934 #endif /* TFU_UPGRADE */
7936 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst,
7937 &(pucchInfo->pucchRecpInfo->lnk));
7938 pucchInfo->pucchRecpInfo->lnk.node =
7939 (PTR)pucchInfo->pucchRecpInfo;
7942 else /* Multiplexing */
7945 pucchInfo->pucchRecpInfo->t.pucchRecpReq.M = noFdbks;
7947 if (n1PucchTkn.pres == TRUE)
7949 pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqType =
7950 TFU_HQ_RECP_REQ_N1PUCCH;
7951 pucchInfo->pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = n1PucchTkn.val;
7956 pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqType =
7957 TFU_HQ_RECP_REQ_NORMAL;
7958 multCnt = pucchInfo->pucchRecpInfo->t.pucchRecpReq.multCnt;
7959 pucchInfo->pucchRecpInfo->t.pucchRecpReq.t.nCce[multCnt] =
7961 pucchInfo->pucchRecpInfo->t.pucchRecpReq.m[multCnt] =
7963 pucchInfo->pucchRecpInfo->t.pucchRecpReq.p[multCnt] =
7964 rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
7966 pucchInfo->pucchRecpInfo->t.pucchRecpReq.multCnt++;
7968 #else /* TFU_UPGRADE */
7970 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
7971 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)RGR_TDD_ACKNACK_MODE_MULT;
7972 hqRecpReq->hqInfo.hqSz = noFdbks;
7974 resIdx = hqRecpReq->hqInfo.pucchResCnt;
7975 hqRecpReq->hqInfo.pucchResCnt++;
7978 if (n1PucchTkn.pres == TRUE)
7980 hqRecpReq->hqInfo.hqRes[resIdx] = n1PucchTkn.val;
7986 m = dlSf->dlFdbkInfo.m;
7988 P = rgSCHCmnGetPValFrmCCE(cellCb, nCce);
7989 nP = cellCb->rgSchTddNpValTbl[P];
7990 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
7991 hqRecpReq->hqInfo.hqRes[resIdx] = (M - m - 1)* nP +
7992 (m * nPlusOne) + pdcch->nCce +
7993 cellCb->pucchCfg.n1PucchAn;
7995 #endif /* TFU_UPGRADE */
7996 /* If all the DL subframes are scanned, then
7997 * send TFU request*/
7999 if((elemIdx != noFdbks) && alloc)
8001 cmHashListInsert(&cellCb->ueTfuPendLst, (PTR) pucchInfo,
8002 (uint8_t *)&rnti, (uint16_t) sizeof(rnti));
8007 pucchInfo->pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
8008 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst,
8009 &(pucchInfo->pucchRecpInfo->lnk));
8010 pucchInfo->pucchRecpInfo->lnk.node =
8011 (PTR)pucchInfo->pucchRecpInfo;
8012 /* Delete the entry after addition to the list */
8013 cmHashListDelete(&cellCb->ueTfuPendLst, (PTR) pucchInfo);
8019 *pucchInfoRef = pucchInfo;
8025 #ifdef RG_ULSCHED_AT_CRC
8026 /** @brief This function does all the processing related to a single downlink
8031 * Function: rgSCHTomUtlProcDlSfAtCrc
8034 * - collate control data for all UEs and send to PHY
8035 * - collate data buffers for all UEs and send to PHY
8037 * @param [in] RgSchDlSf *ulSf
8038 * @param [in] RgSchCellCb *cell
8039 * @param [in] TfuCntrlReqInfo *cntrlInfo
8040 * @param [out] RgSchErrInfo *err
8044 static S16 rgSCHTomUtlProcDlSfAtCrc
8047 CmLteTimingInfo crntUlFrm,
8049 TfuCntrlReqInfo *cntrlInfo,
8053 static S16 rgSCHTomUtlProcDlSfAtCrc (ulSf, crntUlFrm, cell, cntrlInfo, err)
8055 CmLteTimingInfo crntUlFrm;
8057 TfuCntrlReqInfo *cntrlInfo;
8061 Inst inst = cell->instIdx;
8064 cntrlInfo->numDlActvUes = 0;
8065 cmLListInit(&cntrlInfo->phichLst);
8066 cmLListInit(&cntrlInfo->dlPdcchLst);
8067 cmLListInit(&cntrlInfo->ulPdcchLst);
8068 #ifdef TFU_ALLOC_EVENT_NO_INIT
8069 cntrlInfo->dlTiming.sfn = cntrlInfo->dlTiming.subframe = 0;
8073 cntrlInfo->ulTiming = crntUlFrm;
8074 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cntrlInfo->ulTiming, TFU_ULCNTRL_DLDELTA);
8076 cntrlInfo->cellId = cell->cellId;
8077 /* Fill PHICH info */
8078 if ((ret = rgSCHTomUtlFillPhich (cell, cntrlInfo, ulSf, err)) != ROK)
8080 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send PHICH info for "
8082 RGSCH_FREE_MEM(cntrlInfo);
8087 if ((ret = rgSCHTomUtlFillUlPdcch (cell, cntrlInfo, ulSf, err)) != ROK)
8089 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send PDCCH info for "
8091 RGSCH_FREE_MEM(cntrlInfo);
8096 if(0 == cntrlInfo->ulMpdcchLst.count)
8103 if ((cntrlInfo->ulPdcchLst.count || cntrlInfo->phichLst.count) || RG_SCH_EMTC_GET_PDCCHLST_CNT(cntrlInfo))
8105 if (cntrlInfo->ulPdcchLst.count || cntrlInfo->phichLst.count)
8108 //if (rgSCHUtlTfuCntrlReq(inst, cell->tfuSap->sapCfg.suId, cntrlInfo)
8111 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info for"
8117 RGSCH_FREE_MEM(cntrlInfo);
8121 #endif /* #ifdef RG_ULSCHED_AT_CRC*/
8124 /** @brief This function sends the SFN Tick to L3
8129 * Function: rgSCHTomUtlSendSfnTick
8131 * @param [in] RgSchCellCb *cell
8134 static Void rgSCHTomUtlSendSfnTick
8139 static Void rgSCHTomUtlSendSfnTick (cell)
8143 RgrTtiIndInfo *rgrTtiInd;
8145 /* TTI to be sent to RRM only once per system frame */
8146 /* Added support for period = 0 to disable tick to RRM */
8147 if ((cell->rrmTtiIndPrd != 0) &&
8148 ((cell->crntTime.sfn % cell->rrmTtiIndPrd) == 0) &&
8149 (cell->crntTime.slot == 0))
8151 /* Allocate a TTI indication structure and send to RRM over RGR interface */
8152 if (rgSCHUtlAllocSBuf (cell->instIdx,
8153 (Data**)&rgrTtiInd, sizeof(RgrTtiIndInfo)) != ROK)
8155 RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),
8156 "Mem alloc failed for RGR TTI ind, cellId (%d))\n",
8160 rgrTtiInd->cellId = cell->cellId;
8161 //rgrTtiInd->hSfn = cell->crntTime.hSfn;
8162 rgrTtiInd->sfn = cell->crntTime.sfn;
8164 if (rgSCHUtlRgrTtiInd (cell, rgrTtiInd) != ROK)
8166 RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),
8167 "Failed to send RGR TTI ind, cellId (%d))\n",
8169 rgSCHUtlFreeSBuf(cell->instIdx, (Data**)&rgrTtiInd,
8170 sizeof(RgrTtiIndInfo));
8180 /* @brief Mark Dyn TDD CrntSfIdx.
8184 * Function: rgSCHDynTDDMrkCrntSfIdx
8185 * Purpose: update the dyn tdd sunframe index
8186 * @param[in] Inst schInst
8191 static Void rgSCHDynTDDMrkCrntSfIdx
8196 static Void rgSCHDynTDDMrkCrntSfIdx(schInst)
8200 RgSchDynTddCb *rgSchDynTddInfo = &(rgSchCb[schInst].rgSchDynTdd);
8203 RG_SCH_DYN_TDD_MARKTYPE(rgSchDynTddInfo, rgSchDynTddInfo->crntDTddSfIdx,
8204 RG_SCH_DYNTDD_NOTDEF);
8205 rgSchDynTddInfo->crntDTddSfIdx = (rgSchDynTddInfo->crntDTddSfIdx + 1) %
8206 RG_SCH_DYNTDD_MAX_SFINFO;
8208 //printf("Initializing Index %d \n", rgSchDynTddInfo->crntDTddSfIdx);
8214 /** @brief This function fills the TTI timinig info for each cell
8218 * Function: rgSchTomFillCellTtiInfo
8220 * @param [in] TfuTtiIndInfo *ttiInd
8221 * @param [in] Inst schInst
8222 * @param [out] uint8_t *nCell
8223 * @param [out] RgSchCellCb *cell[]
8230 static Void rgSchTomFillCellTtiInfo
8232 TfuTtiIndInfo *ttiInd,
8235 RgSchCellCb *cells[]
8238 static Void rgSchTomFillCellTtiInfo (ttiInd, schInst, nCell, cells)
8239 TfuTtiIndInfo *ttiInd;
8242 RgSchCellCb *cells[];
8247 TfuTtiCellInfo *cellInfo;
8251 CmLteTimingInfo frm;
8253 if (CM_LTE_MAX_CELLS < ttiInd->numCells)
8259 rgSCHDynTDDMrkCrntSfIdx(schInst);
8262 for (i = 0; i < ttiInd->numCells; i++)
8264 cellInfo = &ttiInd->cells[i];
8265 strtCellId = rgSchCb[schInst].genCfg.startCellId;
8266 Idx1 = (uint8_t)((cellInfo->cellId - strtCellId)&(CM_LTE_MAX_CELLS-1));
8267 cell = rgSchCb[schInst].cells[Idx1];
8268 /* Validate the cell */
8271 /* Use SCH inst 0 print buff */
8272 RGSCHDBGERRNEW(schInst,(rgSchPBuf(schInst),
8273 "RgLiTfuTtiInd()No cell exists for cellId %d\n",
8277 *nCell = *nCell + 1;
8278 cells[i] = (RgSchCellCb *)cell;
8281 if(cell->schTickDelta != cellInfo->schTickDelta)
8283 printf("\nMukesh: Delta changed for cellId=%d: curr delta=%d new delta=%d\n"
8284 "dlblankSf=%d ulblankSf=%d dummyTti=%d \n",
8285 cell->cellId, cell->schTickDelta, cellInfo->schTickDelta, cellInfo->dlBlankSf,cellInfo->ulBlankSf,
8286 cellInfo->isDummyTti);
8288 RGSCH_UPDATE_DELTA(schInst, cellInfo->schTickDelta);
8289 cell->schTickDelta = cellInfo->schTickDelta;
8292 cell->stopSiSch = cellInfo->dlBlankSf;
8293 cell->stopDlSch = cellInfo->dlBlankSf;
8294 cell->stopUlSch = cellInfo->ulBlankSf;
8295 if (cellInfo->isDummyTti)
8297 cell->stopDlSch = TRUE;
8299 if((0 == (cellInfo->timingInfo.sfn % 30)) && (0 == cellInfo->timingInfo.slot))
8301 //printf("5GTF_CHECK rgSCHTOMTtiInd (%d : %d)\n", cellInfo->timingInfo.sfn, cellInfo->timingInfo.slot);
8304 RGSCHCPYTIMEINFO(cellInfo->timingInfo, cell->crntTime);
8305 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->hiDci0Time,
8306 TFU_ULCNTRL_DLDELTA);
8307 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->dlDciTime,
8308 TFU_DLCNTRL_DLDELTA);
8309 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->rcpReqTime,
8310 TFU_RECPREQ_DLDELTA);
8311 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->hqRlsTime,
8312 TFU_HQFBKIND_ULDELTA);
8313 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->dlSfRlsTime,
8316 RGSCHCPYTIMEINFO_EMTC(cellInfo->timingInfo, cell->crntTime);
8317 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->hiDci0Time,
8318 TFU_ULCNTRL_DLDELTA);
8319 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->dlDciTime,
8320 TFU_DLCNTRL_DLDELTA);
8321 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->rcpReqTime,
8322 TFU_RECPREQ_DLDELTA);
8323 RGSCHDECRFRMCRNTTIME_EMTC(cell->crntTime, cell->hqRlsTime,
8324 TFU_HQFBKIND_ULDELTA);
8325 RGSCHDECRFRMCRNTTIME_EMTC(cell->crntTime, cell->dlSfRlsTime,
8328 rgSCHCmnUpdVars(cell);
8329 cell->isDlDataAllwd = TRUE;
8330 /* Get DownLink SubFrame */
8331 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
8332 frm = cell->crntTime;
8334 RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA);
8336 RGSCH_INCR_SUB_FRAME_EMTC(frm, RG_SCH_CMN_DL_DELTA);
8338 cellSch->dl.time = frm;
8344 uint8_t idx = (cell->crntTime.slot + RG_SCH_CMN_DL_DELTA) %
8345 RGSCH_NUM_SUB_FRAMES_5G;
8347 cell->isDlDataAllwd = RG_SCH_CMN_CHK_DL_DATA_ALLOWED(cell, idx);
8349 /*ccpu00130639 -ADD - used in UL HARQ proc id calculation*/
8350 if((cell->crntTime.sfn == 0) && (cell->crntTime.slot == 0))
8352 /* sfn Cycle used for Tdd UL Harq Proc Determination.
8353 This sfn Cycle will have values from 0 to numUl Harq-1. */
8354 cell->tddHqSfnCycle = (cell->tddHqSfnCycle + 1 ) %
8355 (rgSchTddUlNumHarqProcTbl[cell->ulDlCfgIdx]);
8359 if(cell->emtcEnable)
8361 rgSCHUtlEmtcResPrcTti(cell);
8367 void schFillCrntTime(
8368 SlotIndInfo slotInd,
8371 uint8_t cellCount = 0;
8372 for(cellCount = 0; cellCount < CM_LTE_MAX_CELLS; cellCount++)
8375 cell = rgSchCb[schInst].cells[cellCount];
8377 RGSCHCPYTIMEINFO(slotInd, cell->crntTime);
8379 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->hiDci0Time,
8380 TFU_ULCNTRL_DLDELTA);
8381 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->dlDciTime,
8382 TFU_DLCNTRL_DLDELTA);
8383 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->rcpReqTime,
8384 TFU_RECPREQ_DLDELTA);
8385 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->hqRlsTime,
8386 TFU_HQFBKIND_ULDELTA);
8387 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->dlSfRlsTime,
8390 RGSCH_INCR_SUB_FRAME(cell->crntTime, RG_SCH_CMN_DL_DELTA);
8392 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
8393 cellSch->dl.time = cell->crntTime;
8397 /** @brief This function prepares the TTI for scheduling and
8398 * invokes the Common channel scheduler. Uplink scheduler
8399 * is invoked first if UL Scheduling at CRC is not enabled
8403 * Function: rgSchTomTtiUlAndDlCmnChSch
8405 * @param [out] RgSchCellCb *cell
8411 static Void rgSchTomTtiUlAndDlCmnChSch
8416 static Void rgSchTomTtiUlAndDlCmnChSch (cell)
8421 cell->rlsHqArr[cell->crntHqIdx].numUes = 0;
8423 cell->crntHqIdx = cell->crntHqIdx % RGSCH_NUM_SUB_FRAMES;
8425 cmPrcTmr(&cell->tqCp, cell->tq, (PFV)rgSCHTmrProcTmr);
8426 rgSCHMeasGapANRepTtiHndl (cell);
8427 /* We need to fill the PHICH for the UL Data, first we need to get the UL
8428 * SF from Scheduler, next we fill the dlSf that goes out this TTI.
8429 * This must be performed prior to any other processing of the TTI
8430 * so that we do not wrap around and generate feedback prior to
8431 * reception of UL data.
8433 #ifndef RG_ULSCHED_AT_CRC
8436 uint8_t idx; /* Index into Uplink Sf array */
8438 Mval = rgSchTddPhichMValTbl[cell->ulDlCfgIdx]
8439 [cell->hiDci0Time.subframe];
8443 for(idx=0; idx < Mval; idx++)
8445 rgSCHCmnRlsUlSf(cell, idx);
8451 /* DTX processing for those Harq's which did not get feedback from L1 */
8452 rgSCHDhmRlsDlsfHqProc (cell, cell->hqRlsTime);
8453 /* Re-Init the Downlink subframe */
8454 rgSCHUtlDlRlsSubFrm(cell, cell->dlSfRlsTime);
8455 /* Added handling to retransmit
8456 * release PDCCH in case of DTX
8459 /*Check for DRX every TTI*/
8460 rgSCHDrxTtiInd(cell);
8462 /* For TDD, UL scheduling should happen after DL scheduling */
8464 #ifndef RG_ULSCHED_AT_CRC
8465 /* Perform UL scheduling */
8466 rgSCHCmnUlSch(cell);
8469 /* Perform DL scheduling for Common channels */
8470 rgSCHCmnDlCommonChSch(cell);
8475 /** @brief This function invokes the Non critical procedures like measurements,
8476 * and RGR configurations.
8480 * Function: rgSchTomTtiMiscFunctions
8482 * @param [in] RgSchCellCb *cell
8488 static Void rgSchTomTtiMiscFunctions
8493 static Void rgSchTomTtiMiscFunctions (cell)
8497 uint8_t suId = cell->tfuSap->sapCfg.suId;
8499 /* Invoke RAM Tti Handler */
8500 rgSCHRamTtiHndlr(cell);
8502 /* Handle RGR configurations */
8503 rgSCHGomTtiHndlr(cell, suId);
8505 if((RGM_PRB_REPORT_START == cell->prbUsage.prbRprtEnabld)
8506 && (!(cell->prbUsage.rprtPeriod) || ((glblTtiCnt % cell->prbUsage.rprtPeriod) == 0)))
8508 rgSCHUtlUpdAvgPrbUsage(cell);
8510 rgSCHL2Meas(cell,FALSE);
8513 /* LTE_ADV_FLAG_REMOVED_START */
8514 /* Report ABS Load information to application periodically */
8515 if((RGR_ENABLE == cell->lteAdvCb.absCfg.status) &&
8516 (cell->lteAdvCb.absCfg.absLoadPeriodicity))
8518 RgrLoadInfIndInfo *rgrLoadInf;
8521 cell->lteAdvCb.absLoadTtiCnt++;
8522 if(cell->lteAdvCb.absLoadTtiCnt >= cell->lteAdvCb.absCfg.absLoadPeriodicity)
8525 if(rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&rgrLoadInf,
8526 sizeof(RgrLoadInfIndInfo)) != ROK)
8528 RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),"Could not "
8529 "allocate memory for sending LoadInfo\n"));
8532 cell->lteAdvCb.absLoadTtiCnt = 0;
8533 rgrLoadInf->cellId = cell->cellId;
8534 rgrLoadInf->bw = cell->bwCfg.dlTotalBw;
8535 rgrLoadInf->type = RGR_ABS;
8536 for(idx= 0; idx<RGR_ABS_PATTERN_LEN; idx++)
8538 rgrLoadInf->u.absLoadInfo[idx] = cell->lteAdvCb.absLoadInfo[idx];
8539 cell->lteAdvCb.absLoadInfo[idx] = 0;
8541 rgSCHUtlRgrLoadInfInd(cell, rgrLoadInf);
8546 if(cell->isDlDataAllwd)
8548 /* Calling function to update CFI parameters*/
8549 rgSchCmnUpdCfiDb(cell, RG_SCH_CMN_DL_DELTA);
8553 /* Incrementing the ttiCnt in case of UL subframe */
8554 if(!cell->dynCfiCb.switchOvrInProgress)
8556 cell->dynCfiCb.ttiCnt++;
8560 rgSchCmnUpdCfiDb(cell, RG_SCH_CMN_DL_DELTA);
8563 /* LTE_ADV_FLAG_REMOVED_END */
8568 /** @brief This function invokes the Downlink scheduler
8572 * Function: rgSchTomTtiDlSch
8574 * @param [in] RgSchCellCb *cell
8580 static Void rgSchTomTtiDlSch
8585 static Void rgSchTomTtiDlSch (cell)
8590 if (cell->isDlDataAllwd && (cell->stopDlSch == FALSE))
8592 rgSCHCmnDlSch(cell);
8598 /** @brief This function invokes Consolidates the allocations
8599 * send the Subframe allocation info to MAC
8603 * Function: rgSchTomTtiCnsldtSfAlloc
8605 * @param [in] RgSchCellCb *cell
8611 static Void rgSchTomTtiCnsldtSfAlloc
8616 static Void rgSchTomTtiCnsldtSfAlloc (cell)
8621 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
8623 dlSf = rgSCHUtlSubFrmGet(cell, cellSch->dl.time);
8625 /* Prepare Subframe allocation info and send to MAC */
8626 rgSCHCmnCnsldtSfAlloc(cell);
8628 /* Call ACK NACK module to add to dlsf Queue */
8629 rgSCHAckNakRepAddToQ(cell, dlSf);
8631 rgSCHTomUtlProcTA(cell);
8636 /** @brief This function prepares the DL and UL Config requests
8641 * Function: rgSchTomTtiL1DlAndUlCfg
8643 * @param [in] RgSchCellCb *cell
8649 static Void rgSchTomTtiL1DlAndUlCfg
8652 RgTfuCntrlReqInfo *cntrlInfo
8655 static Void rgSchTomTtiL1DlAndUlCfg (cell, cntrlInfo)
8657 RgTfuCntrlReqInfo *cntrlInfo;
8660 RgSchDlSf *dlSf = rgSCHUtlSubFrmGet (cell, cell->dlDciTime);
8661 RgSchDlSf *ulSf = rgSCHUtlSubFrmGet (cell, cell->hiDci0Time);
8664 rgSCHTomUtlProcDlSf (dlSf, ulSf, cell, cntrlInfo, &err);
8665 /* Mark this frame as sent */
8666 dlSf->txDone = TRUE;
8668 rgBwAlloInfo[dlSf->sfNum] += dlSf->bwAssigned;
8669 rgBwAlcnt[dlSf->sfNum] ++;
8673 rgSCHTomUtlProcTddUlSf(cell);
8675 rgSCHTomUtlProcUlSf (cell, &err);
8681 /** @brief This function prepares does the Downlink subframe re-init and
8682 * Harq DTX processing
8686 * Function: rgSchTomUtlTddRlsSfAndHarq
8688 * @param [in] RgSchCellCb *cell
8694 static Void rgSchTomUtlTddRlsSfAndHarq
8699 static Void rgSchTomUtlTddRlsSfAndHarq (cell)
8704 /* ccpu00132341-MOD- rgSchTddRlsDlSubfrmTbl is dependent on DELTA(=2).
8705 * Instead rgSchTddDlAscSetIdxKTbl can be used as the K set gives proper
8707 /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper
8708 * output if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME()
8709 * as it is serving the purpose */
8710 if(rgSchTddDlAscSetIdxKTbl[cell->ulDlCfgIdx][cell->hqRlsTime.subframe].
8713 /* ccpu00132341-MOD- Providing the UL SF timing for avoiding
8714 * calculation inside the function */
8715 rgSCHDhmTddRlsSubFrm(cell, cell->hqRlsTime);
8716 rgSCHDhmRlsDlsfHqProc(cell, cell->hqRlsTime);
8721 /** @brief This function processes the UL subframe and fills TFU reception
8726 * Function: rgSCHTomUtlProcTddUlSf
8728 * @param [in] RgSchCellCb *cell
8734 static Void rgSCHTomUtlProcTddUlSf
8739 static Void rgSCHTomUtlProcTddUlSf (cell)
8745 if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
8746 [cell->rcpReqTime.subframe] == RG_SCH_TDD_UL_SUBFRAME)
8748 if (rgSCHTomUtlProcUlSf (cell, &err) != ROK)
8750 /* fill in err type and call sta ind */
8751 RGSCHDBGERRNEW(cell->instIdx, (rgSchPBuf(cell->instIdx),
8752 "Unable to process Uplink subframe for cellId (%d))\n",
8756 /* TDD Fix , to allow Special SF SRS CFg */
8757 else if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
8758 [cell->rcpReqTime.subframe] == RG_SCH_TDD_SPL_SUBFRAME)
8760 if (rgSCHTomUtlPrcUlTddSpclSf(cell, &err) != ROK)
8762 /* fill in err type and call sta ind */
8763 RGSCHDBGERRNEW(cell->instIdx, (rgSchPBuf(cell->instIdx),
8764 "Unable to process Sipceial subframe for cellId (%d))\n",
8774 /**********************************************************************
8777 **********************************************************************/