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 EXTERN Bool rgSCHEmtcChkEmtcUe ARGS(
74 EXTERN Void rgSchTomTtiEmtcSched ARGS(
79 EXTERN S16 rgSCHEmtcRamVldtProcRaReq
84 TfuRaReqIndInfo *raReqInd,
89 EXTERN Void rgSCHEmtcUpdCqiInfo
95 EXTERN Void rgSCHEmtcUpdSRInfo
100 EXTERN Void rgSCHCmnEmtcHdlCrcFailInd
105 EXTERN S16 rgSCHEmtcTomUtlProcAtCrc
108 CmLteTimingInfo crntHiDci0Frm,
109 TfuCntrlReqInfo *cntrlInfo,
112 EXTERN Void rgSCHEmtcInitUeRecpReqLst
114 TfuRecpReqInfo *recpReqInfo
116 EXTERN Void rgSCHEmtcFillPucchRecpInfo
119 RgSchDlHqProcCb *hqCb,
122 EXTERN Bool rgSCHEmtcAddRecpInfoToLst
124 RgSchDlHqProcCb *hqCb,
125 TfuRecpReqInfo *recpReqInfo,
126 TfuUeRecpReqInfo *pucchRecpInfo,
129 EXTERN Void rgSCHEmtcWillUeRptCqi
134 EXTERN Void rgSchEmtcTomTtiCnsldtSfAlloc
139 EXTERN S16 rgSchEmtcTomTtiL1DlAndUlCfg
142 RgTfuCntrlReqInfo *cntrlInfo
145 EXTERN S16 rgSCHTomEmtcUtlFillDatRecpReq
147 TfuRecpReqInfo *recpReqInfo,
153 EXTERN S16 rgSCHEmtcTomUtlFillHqFdbkRecpReq
155 TfuRecpReqInfo *recpReqInfo,
161 EXTERN S16 rgSCHEmtcDhmRlsDlsfHqProc
164 CmLteTimingInfo timingInfo
167 EXTERN Void rgSCHEmtcCmnUlSch
172 #ifdef RG_ULSCHED_AT_CRC
173 EXTERN S16 rgSCHEmtcTomUtlProcDlSfAtCrc
176 CmLteTimingInfo crntUlFrm,
178 TfuCntrlReqInfo *cntrlInfo,
182 EXTERN RgSchEmtcDlSf* rgSCHEmtcUtlSubFrmGet
189 EXTERN uint32_t gDlMpdcchBlank;
190 EXTERN uint32_t gUlMpdcchBlank;
191 EXTERN S16 rgSCHUtlIotResPrcTti
198 EXTERN RgSchUeCb* rgSCHCmnGetHoUe
203 EXTERN 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(
254 EXTERN uint32_t delayedApiCnt;
255 uint32_t gPCellTb1AckCount=0,gPCellTb2AckCount=0,gPCellTb1NackCount=0,gPCellTb2NackCount=0;
256 uint32_t gSCellSchedCount=0,gPrimarySchedCount=0;
257 uint32_t gSCellTb1AckCount=0,gSCellTb2AckCount=0,gSCellTb1NackCount=0,gSCellTb2NackCount=0;
258 uint32_t gPCellTb1DtxCount = 0, gPCellTb2DtxCount = 0, gSCellTb1DtxCount = 0, gSCellTb2DtxCount = 0;
259 uint32_t gHqFdbkCount = 0;
263 uint32_t gCqiRecpCount = 0;
264 uint32_t gCqiRecpPuschCount = 0;
265 uint32_t gCqiRcvdCount = 0;
266 Bool gF1bCsPres = FALSE;
267 uint32_t gRiReqCount = 0;
268 uint32_t gCqiReqCount = 0;
269 uint32_t gF1bCsCount = 0;
270 uint32_t gACqiRcvdCount = 0;
271 uint32_t gCqiReptToAppCount = 0;
272 uint32_t gRawACqiCount= 0;
273 uint32_t gCqiDropCount,gPucchDropCount;
274 uint32_t gCqiPucchLowSnrDropCount,gCqiPucchConfMaskDropCount,gCqiPuschConfMaskDropCount;
275 uint32_t gDci0Count = 0;
276 uint32_t gUlCrcFailCount = 0;
277 uint32_t gUlCrcPassCount = 0;
278 uint32_t gPuschCqiDropCount = 0;
279 uint32_t gCaDbgCaFrmt = 0;
280 uint32_t gCaDbgNonCaFrmt = 0;
281 uint32_t gPcellZeroBoOcc=0,gScellZeroBoOcc=0, dbgDelayedDatReqInMac=0,gDropDatReqCnt=0, gIccPktRcvrMemDropCnt=0;
285 uint32_t gUlCrcFailCounter = 0;
286 uint32_t gUlCrcPassCounter = 0;
290 EXTERN uint32_t gUl5gtfPdcchSend;
295 PRIVATE S16 rgSCHTomUtlFillCqiSrsWithSr ARGS
299 TfuRecpReqInfo *recpReqInfo,
300 TfuUeRecpReqInfo *pucchRecpInfo,
303 PRIVATE Bool rgSCHTomUtlFillDatHarqRecpReq ARGS
307 TfuUeRecpReqInfo *datRecpInfo,
308 TfuRecpReqInfo *recpReqInfo
310 PRIVATE S16 rgSCHTomUtlFillSrRecpReq ARGS((
311 TfuRecpReqInfo *recpReq,
315 PRIVATE S16 rgSCHTomUtlFillRiRecpReq ARGS((
316 TfuRecpReqInfo *recpReq,
320 PRIVATE S16 rgSCHTomUtlFillPcqiRecpReq ARGS((
321 TfuRecpReqInfo *recpReq,
325 PRIVATE S16 rgSCHTomUtlFillSrsRecpReq ARGS((
326 TfuRecpReqInfo *recpReq,
330 PRIVATE S16 rgSCHTomUtlGenIndices ARGS((
335 TfuSubbandInfo* sbInfo));
337 PRIVATE S16 rgSCHTomUtlFillCqiRiRecpReq ARGS(
339 TfuRecpReqInfo *recpReqInfo,
344 PRIVATE Void rgSchTomFillCellTtiInfo ARGS
346 TfuTtiIndInfo *ttiInd,
354 uint32_t rgBwAlloInfo[RGSCH_NUM_SUB_FRAMES]; /* Num of Rbs Allocated in each SF */
355 uint32_t rgBwAlcnt[RGSCH_NUM_SUB_FRAMES]; /*Num of times Allocation done in each Subframe */
358 /* rg006.201: [ccpu000111706, ccpu00112394]: Separated UL and DL TTI
361 uint64_t glblTtiCnt = 0;
365 uint32_t gDlNumUePerTti[20] = {0};
366 uint32_t gUlNumUePerTti[20] = {0};
367 PRIVATE S16 rgSCHTomUtlProcDlSf ARGS((
371 RgTfuCntrlReqInfo *cntrlInfo,
373 #ifdef RG_ULSCHED_AT_CRC
374 PRIVATE S16 rgSCHTomUtlProcDlSfAtCrc ARGS((
376 CmLteTimingInfo crntUlFrm,
378 TfuCntrlReqInfo *cntrlInfo,
380 #endif /* RG_ULSCHED_AT_CRC */
383 PRIVATE S16 rgSCHTomUtlPrcUlTddSpclSf ARGS((
386 #endif /* TFU_UPGRADE */
388 PRIVATE S16 rgSCHTomUtlFillPhich ARGS((
390 TfuCntrlReqInfo *cntrlInfo,
394 PRIVATE S16 rgSCHTomUtlFillDlPdcch ARGS((
396 TfuCntrlReqInfo *cntrlInfo,
399 PRIVATE S16 rgSCHTomUtlFillUlPdcch ARGS((
401 TfuCntrlReqInfo *cntrlInfo,
405 PRIVATE S16 rgSCHTomUtlProcTA ARGS((
408 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq ARGS((
409 TfuRecpReqInfo *recpReq,
414 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq ARGS((
415 TfuRecpReqInfo *recpReq,
421 S16 rgSCHTomFillOnlySrsRecpReq ARGS
425 TfuUeRecpReqInfo *datRecpInfo
427 PRIVATE S16 rgSCHTomUtlFillCqiSrSrsWithHq ARGS
430 TfuRecpReqInfo *recpReqInfo,
432 TfuUeRecpReqInfo *pucchRecpInfo,
434 Bool isDatPresOnSecCell
437 S16 rgSCHTomUtlFillRiBitWidthInfo ARGS
442 uint8_t rgSCHTomUtlFetchPcqiBitSz ARGS
449 uint8_t rgSCHTomUtlFetchPcqiBitSzPucchMode21 ARGS
452 TfuCqiPucchMode21 *mode21Info,
457 S16 rgSCHTomUtlMoveNxtOccasion ARGS
464 PRIVATE S16 rgSCHTomUtlMovePcqiNxtOccasion ARGS
471 PRIVATE S16 rgSCHTomUtlMovePriNxtOccasion ARGS
478 PRIVATE S16 rgSCHTomUtlMoveSrNxtOccasion ARGS
484 PRIVATE S16 rgSCHTomUtlMoveSrsNxtOccasion ARGS
489 PRIVATE S16 rgSCHTomUtlWillUeRprtCqiRi ARGS((
491 Bool *willueRprtCqiRii));
494 PRIVATE S16 rgSCHTomUtlFillDatRecpReq ARGS((
495 TfuRecpReqInfo *recpReq,
500 PRIVATE S16 rgSCHTomUtlFillDatRecpReq ARGS((
501 TfuRecpReqInfo *recpReq,
508 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk ARGS((
509 TfuRecpReqInfo *recpReqInfo,
520 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk ARGS((
521 TfuRecpReqInfo *recpReqInfo,
532 PRIVATE S16 rgSCHTomUtlFillSfHqFdbk ARGS((
533 TfuRecpReqInfo *recpReqInfo,
544 PRIVATE S16 rgSCHTomUtlFillSfHqFdbk ARGS((
545 TfuRecpReqInfo *recpReqInfo,
556 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForOneUe ARGS((
557 RgSchDlHqProcCb *hqCb,
558 TfuRecpReqInfo *recpReqInfo,
567 RgrTddAckNackMode ackNackMode,
568 RgSchUePucchRecpInfo **pucchInfoRef,
570 TknUInt16 n1PucchTkn,
576 EXTERN Void rgSCHCmnDlSpsSch (RgSchCellCb *cell);
580 PRIVATE S16 rgSCHTomCnsdrRelPdcch ARGS
584 TfuRecpReqInfo *recpReqInfo,
589 PRIVATE S16 rgSCHTomCnsdrRelPdcch ARGS
593 TfuRecpReqInfo *recpReqInfo,
601 PRIVATE Void rgSchTomTtiMiscFunctions ARGS
606 PRIVATE Void rgSchTomTtiUlAndDlCmnChSch ARGS
611 PRIVATE Void rgSchTomTtiDlSch ARGS
616 PRIVATE Void rgSchTomTtiCnsldtSfAlloc ARGS
621 PRIVATE Void rgSchTomTtiL1DlAndUlCfg ARGS
624 RgTfuCntrlReqInfo *cntrlInfo
628 PRIVATE Void rgSCHTomUtlSendSfnTick ARGS
634 PRIVATE Void rgSchTomUtlTddRlsSfAndHarq ARGS
638 PRIVATE Void rgSCHTomUtlProcTddUlSf ARGS
643 PRIVATE Void rgSCHTomUtlGethqRes ARGS
651 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1 ARGS
653 RgSchDlHqProcCb *hqCb,
654 TfuUePucchRecpReq *hqRecpReq,
660 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234 ARGS
662 RgSchDlHqProcCb *hqCb,
663 TfuUePucchRecpReq *hqRecpReq,
673 uint32_t rgDlCqiRptCnt[16], rgTotDlCqiRpt;
676 uint32_t rgSch5gtfCqi2Mcs[15] =
677 {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14};
679 /* forward references */
681 /*HARQ Feedback interpretation in accordance with Femto Forum.
682 Note: There is no value as '0' in Femto Forum Spec but in order to retain
683 the existing usage in MAC (and its Acceptance), its being considered*/
684 //CONSTANT PRIVATE uint8_t rgSchTomHqFbkMap[8] = {0,1,0,0,4,4,4,4};
685 /*added #defines instead of magic numbers*/
686 /*CONSTANT PRIVATE uint32_t rgSCHTomBinCoe[RG_SCH_MAX_NUM_UE_SEL_SUBBANDS][RG_SCH_MAX_TOT_NUM_SUBBANDS]={
687 {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},
688 {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},
689 {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},
690 {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},
691 {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},
692 {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}
696 /*ccpu00116923 - ADD - SRS present support*/
697 /*Tables Derived from 3GPP TS 36.211 Section 5.5.3.3 */
698 /* Table 5.5.3.3-1 */
700 CONSTANT RgSchFddCellSpSrsSubfrmTbl rgSchFddCellSpSrsSubfrmTbl = {
701 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE},
702 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE},
703 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE},
704 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE},
705 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
706 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE},
707 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE},
708 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE},
709 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE},
710 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
711 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
712 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
713 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
714 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE},
715 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE},
716 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}
719 /* Table 5.5.3.3-2 */
720 CONSTANT RgSchTddCellSpSrsSubfrmTbl rgSchTddCellSpSrsSubfrmTbl = {
721 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
722 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE},
723 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE},
724 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE},
725 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE},
726 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE},
727 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE},
728 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE},
729 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
730 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
731 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE},
732 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE},
733 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE},
734 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE},
735 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
736 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}
739 S8 rgSchCmnAper20n22DiffCqi[4] = {1, 2, 3, 4};
740 S8 rgSchCmnAper30n31DiffCqi[4] = {0, 1, 2, -1};
744 * @brief get Ue for dedicated preamble rach
748 * Function: rgSCHGetDedPrmUe
750 * Invoked by: rgSCHTomRaReqInd
752 * @param[in] RgSchCellCb *cell
753 * @param[in] TfuRaReqIndInfo *raReqInd
763 CmLteTimingInfo timingInfo,
767 S16 rgSCHGetDedPrmUe(cell, rapId, timingInfo, ue)
770 CmLteTimingInfo timingInfo;
774 RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch);
776 printf("rapId[%d] cellSch->rachCfg.dedPrmStart[%d] cellSch->rachCfg.numDedPrm[%d]\n",rapId,cellSch->rachCfg.dedPrmStart,cellSch->rachCfg.numDedPrm);
777 /* Finding UE in handOver List */
778 if ((rapId < cellSch->rachCfg.dedPrmStart) ||
779 (rapId > cellSch->rachCfg.dedPrmStart +
780 cellSch->rachCfg.numDedPrm - 1))
782 /* This ded Preamble corresponds to handover */
783 *ue = rgSCHCmnGetHoUe(cell, rapId);
784 printf(" his ded Preamble corresponds to hando\n");
786 else/* Finding UE from PDCCH Order Mappings */
788 /* Get the UE which has transmitted this RaReq */
789 *ue = rgSCHCmnGetPoUe(cell, rapId, timingInfo);
790 printf(" ==== inding UE from PDCCH Order Mapping\n");
795 * @brief Handler for processing Random Access request indication
800 * Function: rgSCHTomRaReqInd
802 * Handler for processing Random Access request indication recieved from
805 * Invoked by: RgLiTfuRaReqInd of LIM
808 * - Validate the information received: cellId value and raRnti values
809 * - Process the request: Call rgSCHRamProcRaReq (cell, raRnti, raReqInd)
811 * @param[in] RgSchCellCb *cell
812 * @param[in] TfuRaReqIndInfo *raReqInd
821 TfuRaReqIndInfo *raReqInd
824 S16 rgSCHTomRaReqInd(cell, raReqInd)
826 TfuRaReqIndInfo *raReqInd;
833 Bool isEmtcUe = FALSE;
835 RgSchUeCb *ue = NULLP;
837 if(cell->cellId != raReqInd->cellId)
839 err.errType = RGSCHERR_TOM_RAREQIND;
840 err.errCause = RGSCHERR_TOM_INV_CELL_ID;
841 RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,
842 "rgSCHTomRaReqInd(): No cell found with raReq cellId = (%d) errorType (%d)"
843 " errorCause(%d)",raReqInd->cellId, err.errType, err.errCause);
847 for (raRntiCnt = 0; raRntiCnt < raReqInd->nmbOfRaRnti; raRntiCnt++)
849 for (raReqCnt = 0; raReqCnt < raReqInd->rachInfoArr->numRaReqInfo; raReqCnt++)
851 rapId = raReqInd->rachInfoArr[raRntiCnt].raReqInfoArr[raReqCnt].rapId;
853 if(RGSCH_IS_DEDPRM(cell, rapId))
855 rgSCHGetDedPrmUe(cell, rapId, raReqInd->timingInfo, &ue);
858 /* Since rapId is within dedicated range and No ue context
859 * is found means it is a spurious rach. So ignore it.*/
864 if(FALSE == isEmtcUe)
866 #if (ERRCLASS & ERRCLS_DEBUG)
867 if(raReqInd->rachInfoArr[raRntiCnt].raRnti > RGSCH_MAX_RA_RNTI)
869 RGSCHLOGERROR(cell->instIdx, ERRCLS_INT_PAR, ERG013,
870 (ErrVal)raReqInd->rachInfoArr[raRntiCnt].raRnti,
871 ("rgSCHTomRaReqInd(): raRnti is out of range\n"));
875 ret = rgSCHRamProcRaReq(raReqCnt, cell, raReqInd->rachInfoArr[raRntiCnt].raRnti,
876 (TfuRachInfo *)&raReqInd->rachInfoArr[raRntiCnt],
877 raReqInd->timingInfo, ue, &err);
880 err.errType = RGSCHERR_TOM_RAREQIND;
881 RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,
882 "RARNTI:%d rgSCHTomRaReqInd(): RAM processing failed errType(%d) "
883 "errCause(%d)", raReqInd->rachInfoArr[raRntiCnt].raRnti,
884 err.errType, err.errCause);
891 } /* rgSCHTomRaReqInd */
895 * @brief Handler for processing uplink CQI indication recieved from PHY.
899 * Function: rgSCHTomUlCqiInd
901 * Handler for processing uplink CQI indication recieved from PHY.
903 * Invoked by: RgLiTfuUlCqiInd
907 * - Invoke scheduler to push reported CQI info rgSCHUtlUlCqiInd
909 * @param[in] RgSchCellCb *cell
910 * @param[in] TfuUlCqiIndInfo *ulCqiInd
919 TfuUlCqiIndInfo *ulCqiInd
922 S16 rgSCHTomUlCqiInd(cell, ulCqiInd)
924 TfuUlCqiIndInfo *ulCqiInd;
929 TfuUlCqiRpt *ulCqiInfo;
931 node = ulCqiInd->ulCqiRpt.first;
932 if(cell->cellId != ulCqiInd->cellId)
934 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
935 "rgSCHTomUlCqiInd() Unable to get the ulCqiInd cell with id(%d)",
940 for (;node; node=node->next)
942 ulCqiInfo = (TfuUlCqiRpt *)node->node;
943 #if (ERRCLASS & ERRCLS_DEBUG)
944 if(ulCqiInfo->numSubband == 0)
946 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Num Subband is"
947 "out of range RNTI:%d",ulCqiInfo->rnti);
951 if((ue = rgSCHDbmGetUeCb(cell, ulCqiInfo->rnti)) == NULLP)
954 if((ue = rgSCHDbmGetSpsUeCb(cell, ulCqiInfo->rnti)) == NULLP)
957 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get "
958 "the ue for RNTI:%d", ulCqiInfo->rnti);
962 /* wideband cqi is directly reported now. and also isTxPort0 */
963 rgSCHUtlUlCqiInd(cell, ue, ulCqiInfo);
966 } /* rgSCHTomUlCqiInd */
969 * @brief Handler for processing PUCCH power adjustment indication
973 * Function: rgSCHTomPucchDeltaPwrInd
975 * Handler for processing PUCCH power adjustment indication
978 * Invoked by: RgLiTfuPucchDeltaPwrInd
982 * - Invoke scheduler to push reported CQI info rgSCHUtlPucchDeltaPwrInd
984 * @param[in] RgSchCellCb *cell
985 * @param[in] TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
991 S16 rgSCHTomPucchDeltaPwrInd
994 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
997 S16 rgSCHTomPucchDeltaPwrInd(cell, pucchDeltaPwr)
999 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr;
1004 TfuPucchDeltaPwr *ueElem;
1006 if(cell->cellId != pucchDeltaPwr->cellId)
1008 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1009 "rgSCHTomPucchDeltaPwrInd() Unable to get the pucchDeltaPwr cell with id(%d)",
1010 pucchDeltaPwr->cellId);
1014 node = pucchDeltaPwr->pucchDeltaPwrLst.first;
1015 for (;node; node=node->next)
1017 ueElem = (TfuPucchDeltaPwr *)node->node;
1018 if((ue = rgSCHDbmGetUeCb(cell, ueElem->rnti)) == NULLP)
1021 if((ue = rgSCHDbmGetSpsUeCb(cell, ueElem->rnti)) == NULLP)
1024 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d "
1025 "rgSCHTomPucchDeltaPwrInd() Unable to get the ue ",
1030 rgSCHUtlPucchDeltaPwrInd(cell, ue, ueElem->pucchDeltaPwr);
1033 } /* rgSCHTomPucchDeltaPwrInd */
1036 * @brief Handler for processing harq ACK/NACK indication recieved from PHY.
1040 * Function: rgSCHTomHarqAckInd
1042 * Handler for processing harq ACK/NACK indication recieved from PHY.
1044 * Invoked by: RgLiTfuHqInd
1047 * For each HqAckInfo received
1049 * - If UE doesnt exist look for a RaCb and invoke rgSCHRamMsg4FdbkInd
1050 * - Invoke HARQ module to pass HARQ-ACK info rgSCHDhmHqFdbkInd
1052 * @param[in] TfuHqIndInfo *harqAckInd
1058 S16 rgSCHTomHarqAckInd
1061 TfuHqIndInfo *harqAckInd
1064 S16 rgSCHTomHarqAckInd(cell, harqAckInd)
1066 TfuHqIndInfo *harqAckInd;
1077 RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1079 RgSchCellCb *iterCellP;
1081 if(cell->cellId != harqAckInd->cellId)
1083 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() Unable to get"
1084 " the cell for cellId (%d)", harqAckInd->cellId);
1085 err.errType = RGSCHERR_TOM_HARQACKIND;
1086 err.errCause = RGSCHERR_TOM_INV_CELL_ID;
1090 node = harqAckInd->hqIndLst.first;
1091 for (;node; node=node->next)
1093 hqInfo = (TfuHqInfo *)node->node;
1095 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1096 TfuHqFdbk fdbk = hqInfo->isAck[0];
1097 raCb = rgSCHDbmGetRaCb (cell, hqInfo->rnti);
1098 ue = rgSCHDbmGetUeCb (cell, hqInfo->rnti);
1099 if (ue != NULLP && raCb == NULLP)
1101 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, harqAckInd->timingInfo, fdbk, &err)) != ROK)
1103 err.errType = RGSCHERR_TOM_HARQACKIND;
1104 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
1105 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1106 err.errType, err.errCause);
1114 if ((rgSCHDhmRlsDlsfHqProc (cell, harqAckInd->timingInfo)) != ROK)
1116 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink "
1117 "subframe for cellId (%d) ", cell->cellId);
1118 err.errType = RGSCHERR_TOM_HARQACKIND;
1121 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
1123 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
1125 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
1127 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
1128 if(rlsHqBufs->numUes)
1130 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
1131 RgSchMacRlsHq (&pst, rlsHqBufs);
1133 rlsHqBufs->numUes = 0;
1137 rlsHqBufs->numUes = 0;
1138 node = harqAckInd->hqIndLst.first;
1139 for (;node; node=node->next)
1141 hqInfo = (TfuHqInfo *)node->node;
1142 for(tbCnt=0; tbCnt<TFU_MAX_HARQ_FDBKS; tbCnt++)
1144 hqInfo->isAck[tbCnt]=(TfuHqFdbk)rgSchTomHqFbkMap[hqInfo->isAck[tbCnt]];
1146 raCb = rgSCHDbmGetRaCb (cell, hqInfo->rnti);
1147 ue = rgSCHDbmGetUeCb (cell, hqInfo->rnti);
1148 if (ue == NULLP && raCb != NULLP)
1151 rgSCHRamMsg4FdbkInd (raCb);
1153 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1154 cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
1156 err.errType = RGSCHERR_TOM_HARQACKIND;
1157 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1158 " feedback processing failed errType(%d) errCause(%d)",
1159 err.errType, err.errCause);
1164 else if (ue != NULLP && raCb == NULLP)
1166 /* Get the Downlink HARQ entity from ue */
1167 if ((rgSCHDhmHqFdbkInd (ue, RGSCH_HQ_FDB_IND_CB_TYPE_HQ_ENT,
1168 cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
1170 err.errType = RGSCHERR_TOM_HARQACKIND;
1171 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
1172 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1173 err.errType, err.errCause);
1177 else if (ue != NULLP && raCb != NULLP)
1179 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1180 cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
1182 err.errType = RGSCHERR_TOM_HARQACKIND;
1183 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1184 " feedback processing failed errType(%d) errCause(%d).",
1185 err.errType, err.errCause);
1191 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
1192 "UE CB or RA CB ", hqInfo->rnti);
1193 err.errType = RGSCHERR_TOM_HARQACKIND;
1198 /* Check with TDD call DHM*/
1199 if ((rgSCHDhmRlsDlsfHqProc (cell, harqAckInd->timingInfo)) != ROK)
1201 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink "
1202 "subframe for cellId (%d) ", harqAckInd->cellId);
1203 err.errType = RGSCHERR_TOM_HARQACKIND;
1206 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
1208 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
1210 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
1212 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
1213 if(rlsHqBufs->numUes)
1215 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
1216 RgSchMacRlsHq (&pst, rlsHqBufs);
1218 rlsHqBufs->numUes = 0;
1223 } /* rgSCHTomHarqAckInd */
1227 * @brief Handler for processing Scheduling Request indication
1228 * recieved from PHY for a list of UEs.
1232 * Function: rgSCHTomSrInd
1234 * Handler for processing Scheduling Request indication recieved from PHY
1237 * Invoked by: RgLiTfuSrInd
1241 * - Invoke scheduler to indicate SR rgSCHUtlSrRcvd
1243 * @param[in] TfuSrIndInfo *srInd
1255 S16 rgSCHTomSrInd(cell, srInd)
1257 TfuSrIndInfo *srInd;
1266 if(cell->cellId != srInd->cellId)
1268 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for srcInd cellId"
1269 ":%d ", srInd->cellId);
1270 err.errType = RGSCHERR_TOM_SRIND;
1271 err.errCause = RGSCHERR_TOM_INV_CELL_ID;
1276 node = srInd->srLst.first;
1277 for (;node; node=node->next)
1281 srInfo = (TfuSrInfo *)node->node;
1282 ue = rgSCHDbmGetUeCb (cell, srInfo->rnti);
1285 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB",
1289 rgSCHUtlHdlUlTransInd(cell, ue, srInd->timingInfo);
1290 /*Need to activate UE as SR received*/
1291 if (ue->isDrxEnabled)
1293 rgSCHDrxSrInd(cell, ue);
1295 ret = rgSCHUtlSrRcvd (cell, ue, srInd->timingInfo, &err);
1298 err.errType = RGSCHERR_TOM_SRIND;
1299 RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,"Scheduler processing failed "
1300 "errType(%d) errCause(%d) RNTI:%d", err.errType, err.errCause,srInfo->rnti);
1305 } /* end of rgSCHTomSrInd */
1308 * @brief Handler for processing downlink CQI indication recieved from
1313 * Function: rgSCHTomDoaInd
1315 * Handler for processing DOA recieved from PHY
1318 * Invoked by: RgLiTfuDoaInd
1322 * - Invoke scheduler to indicate DOA rgSCHUtlDoaInd
1324 * @param[in] TfuDoaIndInfo *doaInd
1333 TfuDoaIndInfo *doaInd
1336 S16 rgSCHTomDoaInd(cell, doaInd )
1338 TfuDoaIndInfo *doaInd;
1345 if(cell->cellId != doaInd->cellId)
1347 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for doaInd cellId"
1348 ":%d", doaInd->cellId);
1353 node = doaInd->doaRpt.first;
1354 for (;node; node=node->next)
1356 doaInfo = (TfuDoaRpt *)node->node;
1357 ue = rgSCHDbmGetUeCb (cell, doaInfo->rnti);
1360 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB",
1364 rgSCHUtlDoaInd(cell, ue, doaInfo);
1367 } /* rgSCHTomDoaInd */
1369 * @brief Handler for processing downlink CQI indication recieved from
1374 * Function: rgSCHTomDlCqiInd
1376 * Handler for processing downlink CQI indication recieved from PHY
1379 * Invoked by: RgLiTfuDlCqiInd
1383 * - Invoke scheduler to indicate DL CQI rgSCHUtlDlCqiInd
1385 * @param[in] TfuDlCqiIndInfo *dlCqiInd
1391 S16 rgSCHTomDlCqiInd
1394 TfuDlCqiIndInfo *dlCqiInd
1397 S16 rgSCHTomDlCqiInd(cell, dlCqiInd)
1399 TfuDlCqiIndInfo *dlCqiInd;
1404 TfuDlCqiRpt *dlCqiInfo;
1406 if(cell->cellId != dlCqiInd->cellId)
1408 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
1409 ":%d", dlCqiInd->cellId);
1414 node = dlCqiInd->dlCqiRptsLst.first;
1415 for (;node; node=node->next)
1417 dlCqiInfo = (TfuDlCqiRpt *)node->node;
1418 ue = rgSCHDbmGetUeCb (cell, dlCqiInfo->rnti);
1421 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%dUnable to get the UE CB",
1425 rgSCHUtlDlCqiInd(cell, ue, dlCqiInfo, dlCqiInd->timingInfo);
1426 rgSCHUtlHdlUlTransInd(cell, ue, dlCqiInd->timingInfo);
1429 } /* rgSCHTomDlCqiInd */
1432 * @brief Handler for moving PCQI instance for the next periodic occasion
1436 * Function: rgSCHTomUtlMovePcqiNxtOccasion
1438 * Handler for moving PCQI instance for the next periodic occasion
1440 * Invoked by: rgSCHTomUtlFill*
1443 * - For a UE move its occurence instance to next occasion
1444 * depending on its periodicity
1445 * - Remove it from the current list and insert it to the list
1446 * having the index matching with the derived number.
1448 * @param[in] RgSchCellCb *cell,
1449 * [in] RgSchUeCb *ue
1455 PRIVATE S16 rgSCHTomUtlMovePcqiNxtOccasion
1459 RgSchUePCqiCb *cqiCb
1462 PRIVATE S16 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb)
1465 RgSchUePCqiCb *cqiCb;
1468 uint16_t cqiIdx = 0;
1470 CmLteTimingInfo timingInfo;
1472 if(cqiCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_SB_REP)
1475 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timingInfo, TFU_DELTA);
1477 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timingInfo,
1478 TFU_RECPREQ_DLDELTA);
1480 RG_SCH_ADD_TO_CRNT_TIME(timingInfo,timingInfo,cqiCb->cqiPeri);
1481 rgSCHTomUtlPcqiSbCalcBpIdx(timingInfo,ue,cqiCb);
1483 /* Compute Next Transmission Instance */
1484 cqiIdx = cqiCb->cqiPeri + cqiCb->nCqiTrIdx;
1485 cqiIdx = cqiIdx%RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1486 /* Delete from current List and move to new list */
1487 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst,
1490 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to remove node",
1493 cqiCb->nCqiTrIdx = cqiIdx;
1494 cmLListAdd2Tail(&(cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst),
1495 &(cqiCb->cqiLstEnt));
1497 rgSCHUtlSCellHndlCqiCollsn(cqiCb);
1501 } /* rgSCHTomUtlMovePcqiNxtOccasion */
1504 * @brief Handler for moving RI instance for the next periodic occasion
1508 * Function: rgSCHTomUtlMovePriNxtOccasion
1510 * Handler for moving PCQI instance for the next periodic occasion
1512 * Invoked by: rgSCHTomUtlFill*
1515 * - For a UE move its occurence instance to next occasion
1516 * depending on its periodicity
1517 * - Remove it from the current list and insert it to the list
1518 * having the index matching with the derived number.
1520 * @param[in] RgSchCellCb *cell,
1521 * [in] RgSchUeCb *ue
1527 PRIVATE S16 rgSCHTomUtlMovePriNxtOccasion
1534 PRIVATE S16 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb)
1537 RgSchUePCqiCb *riCb;
1542 uint16_t effPeriodicity;
1543 uint16_t riTrInsTime;
1547 crntTime = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)
1548 +(cell->crntTime.slot);
1549 #ifdef XEON_SPECIFIC_CHANGES
1550 RGSCHCPYTIMEINFO(cell->crntTime, ue->riRecpTime);
1552 /* Compute Next Transmission Instance */
1553 if (riCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_WB_REP)
1555 effPeriodicity = riCb->cqiPeri * riCb->riPeri;
1556 tempIdx = effPeriodicity + riCb->nRiTrIdx;
1560 effPeriodicity = (riCb->h * riCb->cqiPeri * riCb->riPeri);
1561 /* In case of SFN wraparound, the SB CQI reporting cycle breaks
1562 * and RI->WB CQI->SBCQI.. should resume. RI is repositioned
1563 * accordingly. WBCQI handling is naturally accomplished */
1564 if ((crntTime + TFU_RECPREQ_DLDELTA + effPeriodicity) >
1565 (RGSCH_MAX_SUBFRM_5G - 1))
1567 riTrInsTime = (effPeriodicity - riCb->cqiOffset + riCb->riOffset) % effPeriodicity;
1568 tempIdx = RGSCH_MAX_SUBFRM_5G + (effPeriodicity - riTrInsTime);
1569 /* In case of SFN wraparound, riDist should be distance from crntTime
1570 * + TFU_RECPREQ_DLDELTA to tempIdx. Updating effPeriodicity
1571 * to make riDist calculation consistent for both SFN wraparound
1572 * case and normal case */
1573 effPeriodicity = tempIdx - TFU_RECPREQ_DLDELTA - crntTime;
1577 tempIdx = effPeriodicity + riCb->nRiTrIdx;
1580 riIdx = tempIdx % RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1581 if (effPeriodicity >= RG_SCH_PCQI_SRS_SR_TRINS_SIZE)
1583 riDist = rgSCHUtlFindDist((uint16_t)(crntTime + TFU_RECPREQ_DLDELTA),
1584 (uint16_t)(crntTime + TFU_RECPREQ_DLDELTA + effPeriodicity));
1591 /* ccpu00138306- If Periodicity is equal to Queue Size or multiple of it
1592 * then the next occasion idx will be same as current Idx, Hence need not
1595 if((effPeriodicity%RG_SCH_PCQI_SRS_SR_TRINS_SIZE) != 0)
1597 /* Delete from current List and move to new list */
1598 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[riCb->nRiTrIdx].riLst,
1601 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"[%d]UEID:Unable to remove node",
1604 RG_SCH_RECORD(&riCb->histElem,RGSCH_ACTION_DEL, &cell->pCqiSrsSrLst[riCb->nRiTrIdx].riLst);
1605 cmLListAdd2Tail(&cell->pCqiSrsSrLst[riIdx].riLst,
1607 RG_SCH_RECORD(&riCb->histElem,RGSCH_ACTION_ADD, &cell->pCqiSrsSrLst[riIdx].riLst);
1616 riCb->nRiTrIdx = riIdx;
1617 riCb->riDist = riDist;
1620 rgSCHUtlSCellHndlRiCollsn(riCb);
1623 } /* rgSCHTomUtlMovePriNxtOccasion */
1626 * @brief Handler for moving SR instance for the next periodic occasion
1630 * Function: rgSCHTomUtlMoveSrNxtOccasion
1632 * Handler for moving SR instance for the next periodic occasion
1634 * Invoked by: rgSCHTomUtlFill*
1637 * - For a UE move its occurence instance to next occasion
1638 * depending on its periodicity
1639 * - Remove it from the current list and insert it to the list
1640 * having the index matching with the derived number.
1642 * @param[in] RgSchCellCb *cell,
1643 * [in] RgSchUeCb *ue
1649 PRIVATE S16 rgSCHTomUtlMoveSrNxtOccasion
1655 PRIVATE S16 rgSCHTomUtlMoveSrNxtOccasion(cell, ue)
1662 /* Compute Next Transmission Instance */
1663 srIdx = ue->srCb.peri + ue->srCb.nSrTrIdx;
1664 srIdx = srIdx%RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1665 /* Delete from current List and move to new list */
1666 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[ue->srCb.nSrTrIdx].srLst,
1667 &ue->srCb.srLstEnt))
1669 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to remove node",
1672 ue->srCb.nSrTrIdx = srIdx;
1673 cmLListAdd2Tail(&cell->pCqiSrsSrLst[ue->srCb.nSrTrIdx].srLst,
1674 &ue->srCb.srLstEnt);
1677 } /* rgSCHTomUtlMoveSrNxtOccasion */
1680 * @brief Handler for moving SRS instance for the next periodic occasion
1684 * Function: rgSCHTomUtlMoveSrsNxtOccasion
1686 * Handler for moving SRS instance for the next periodic occasion
1688 * Invoked by: rgSCHTomUtlFill*
1691 * - For a UE move its occurence instance to next occasion
1692 * depending on its periodicity
1693 * - Remove it from the current list and insert it to the list
1694 * having the index matching with the derived number.
1696 * @param[in] RgSchCellCb *cell,
1697 * [in] RgSchUeCb *ue
1703 PRIVATE S16 rgSCHTomUtlMoveSrsNxtOccasion
1709 PRIVATE S16 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue)
1720 crntTime = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)
1721 +(cell->crntTime.slot);
1723 /* Compute Next Transmission Instance */
1724 tempIdx = ue->srsCb.peri + ue->srsCb.nSrsTrIdx;
1725 srsIdx = tempIdx %RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1726 if (ue->srsCb.peri > RG_SCH_PCQI_SRS_SR_TRINS_SIZE)
1728 srsDist = rgSCHUtlFindDist((uint16_t)(crntTime + TFU_RECPREQ_DLDELTA),
1729 (uint16_t)(crntTime + TFU_RECPREQ_DLDELTA + ue->srsCb.peri));
1736 /* ccpu00138306- If Periodicity is equal to Queue Size or multiple of it
1737 * then the next occasion idx will be same as current Idx, Hence need not
1740 if((ue->srsCb.peri%RG_SCH_PCQI_SRS_SR_TRINS_SIZE) != 0)
1742 /* Delete from current List and move to new list */
1743 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[ue->srsCb.nSrsTrIdx].srsLst,
1744 &ue->srsCb.srsLstEnt))
1746 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to remove node",
1749 cmLListAdd2Tail(&cell->pCqiSrsSrLst[srsIdx].srsLst,
1750 &ue->srsCb.srsLstEnt);
1759 ue->srsCb.nSrsTrIdx = srsIdx;
1760 ue->srsCb.srsDist = srsDist;
1762 } /* rgSCHTomUtlMoveSrsNxtOccasion */
1766 * @brief Handler for processing RAW CQI indication recieved from
1771 * Function: rgSCHTomRawCqiInd
1773 * Handler for processing RAW CQI indication recieved from PHY
1776 * Invoked by: RgLiTfuRawCqiInd
1780 * - Invoke scheduler to indicate Raw CQI rgSCHUtlRawCqiInd
1782 * @param[in] TfuRawCqiIndInfo *rawCqiInd
1788 S16 rgSCHTomRawCqiInd
1791 TfuRawCqiIndInfo *rawCqiInd
1794 S16 rgSCHTomRawCqiInd(cell, rawCqiInd)
1796 TfuRawCqiIndInfo *rawCqiInd;
1801 TfuRawCqiRpt* rawCqiInfo;
1805 RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1806 RgSchCellCb *iterCellP;
1817 if(cell->cellId != rawCqiInd->cellId)
1819 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
1820 ":%d", rawCqiInd->cellId);
1825 node = rawCqiInd->rawCqiRpt.first;
1826 for (;node; node=node->next)
1828 rawCqiInfo = (TfuRawCqiRpt *)node->node;
1829 ue = rgSCHDbmGetUeCb (cell, rawCqiInfo->crnti);
1830 raCb = rgSCHDbmGetRaCb (cell, rawCqiInfo->crnti);
1834 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"CRNTI:%d Unable to get the UECB",
1841 if (rawCqiInfo->numBits >= 5)
1842 printf("cellId [%d] crnti [%d] numBits [%d] uciPayload [0x%08x] sfn/sf [%d:%d]\n",
1843 cell->cellId, rawCqiInfo->crnti, rawCqiInfo->numBits, rawCqiInfo->uciPayload,
1844 rawCqiInd->timingInfo.sfn, rawCqiInd->timingInfo.slot);
1846 if (rawCqiInfo->numBits == 1)
1848 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1849 uint8_t fdbk = TFU_HQFDB_NACK;
1850 /* Process HARQ FdbkInd */
1851 hqAck = (rawCqiInfo->uciPayload >> 31) & 0x1;
1854 fdbk = TFU_HQFDB_ACK;
1855 hqInfo.isAck[0] = fdbk;
1857 if (ue != NULLP && raCb == NULLP)
1859 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, rawCqiInd->timingInfo, fdbk, &err)) != ROK)
1861 err.errType = RGSCHERR_TOM_HARQACKIND;
1862 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
1863 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1864 err.errType, err.errCause);
1868 else if (ue == NULLP && raCb != NULLP)
1870 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1871 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1873 err.errType = RGSCHERR_TOM_HARQACKIND;
1874 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1875 " feedback processing failed errType(%d) errCause(%d)",
1876 err.errType, err.errCause);
1881 else if (ue != NULLP && raCb != NULLP)
1883 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1884 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1886 err.errType = RGSCHERR_TOM_HARQACKIND;
1887 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1888 " feedback processing failed errType(%d) errCause(%d).",
1889 err.errType, err.errCause);
1895 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
1896 "UE CB or RA CB ", rawCqiInfo->crnti);
1897 err.errType = RGSCHERR_TOM_HARQACKIND;
1901 printf("rawCqiInfo->numBits [%d] uciPayload [0x%08x] sfn/sf [%d:%d]\n", rawCqiInfo->numBits,
1902 rawCqiInfo->uciPayload, rawCqiInd->timingInfo.sfn, rawCqiInd->timingInfo.slot);
1905 else if (rawCqiInfo->numBits == 5)
1907 /* Process CQI-RI Ind*/
1908 ri = (rawCqiInfo->uciPayload >> 27) & 0x1;
1909 cqi = (rawCqiInfo->uciPayload >> 28) & 0xF;
1913 printf("\n UE[%d] CQI[%d] Invalid\n", ue->ueId, cqi);
1916 ue->ue5gtfCb.mcs = rgSch5gtfCqi2Mcs[cqi - 1];
1917 ue->ue5gtfCb.rank = ri + 1;
1919 if (rawCqiInfo->numBits > 1)
1921 ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
1922 ueDl->mimoInfo.cwInfo[0].cqi = cqi;
1923 ueDl->cqiFlag = TRUE;
1924 rgSCHCmnDlSetUeAllocLmtLa(cell, ue);
1925 // rgSCHCheckAndSetTxScheme(cell, ue);
1930 printf("UE[%d] CQI[%d] MCS[%d] RI[%d]\n", ue->ueId, cqi, ue->ue5gtfCb.mcs, ri);
1933 else if (rawCqiInfo->numBits == 6)
1935 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1936 TfuHqFdbk fdbk = TFU_HQFDB_NACK;
1937 /* Process both HARQ and CQI-RI Ind*/
1938 ri = (rawCqiInfo->uciPayload >> 26) & 0x1;
1939 cqi = (rawCqiInfo->uciPayload >> 27) & 0xF;
1940 hqAck = (rawCqiInfo->uciPayload >> 31) & 0x1;
1943 printf("UE[%d] CQI[%d] Invalid\n", ue->ueId, cqi);
1946 ue->ue5gtfCb.mcs = rgSch5gtfCqi2Mcs[cqi - 1];
1947 ue->ue5gtfCb.rank = ri + 1;
1949 if (rawCqiInfo->numBits > 1)
1951 ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
1952 ueDl->mimoInfo.cwInfo[0].cqi = cqi;
1953 ueDl->cqiFlag = TRUE;
1954 rgSCHCmnDlSetUeAllocLmtLa(cell, ue);
1955 // rgSCHCheckAndSetTxScheme(cell, ue);
1960 fdbk = TFU_HQFDB_ACK;
1961 hqInfo.isAck[0] = fdbk;
1963 if (ue != NULLP && raCb == NULLP)
1965 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, rawCqiInd->timingInfo, fdbk, &err)) != ROK)
1967 err.errType = RGSCHERR_TOM_HARQACKIND;
1968 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
1969 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1970 err.errType, err.errCause);
1974 else if (ue == NULLP && raCb != NULLP)
1976 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1977 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1979 err.errType = RGSCHERR_TOM_HARQACKIND;
1980 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1981 " feedback processing failed errType(%d) errCause(%d)",
1982 err.errType, err.errCause);
1987 else if (ue != NULLP && raCb != NULLP)
1989 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1990 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1992 err.errType = RGSCHERR_TOM_HARQACKIND;
1993 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1994 " feedback processing failed errType(%d) errCause(%d).",
1995 err.errType, err.errCause);
2001 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
2002 "UE CB or RA CB ", rawCqiInfo->crnti);
2003 err.errType = RGSCHERR_TOM_HARQACKIND;
2008 printf("\nUE[%u] CQI[%u] MCS[%u] RI[%u] HQ[%u]\n", ue->ueId, cqi, ue->ue5gtfCb.mcs, ri, hqAck);
2013 if ((rgSCHDhmRlsDlsfHqProc (cell, rawCqiInd->timingInfo)) != ROK)
2015 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink "
2016 "subframe for cellId (%d) ", cell->cellId);
2017 err.errType = RGSCHERR_TOM_HARQACKIND;
2020 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
2022 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
2024 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
2026 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
2027 if(rlsHqBufs->numUes)
2029 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
2030 RgSchMacRlsHq (&pst, rlsHqBufs);
2032 rlsHqBufs->numUes = 0;
2036 } /* rgSCHTomRawCqiInd */
2039 * @brief Handler for processing SRS indication recieved from
2044 * Function: rgSCHTomSrsInd
2046 * Handler for SRS indication recieved from PHY
2049 * Invoked by: RgLiTfuSrsInd
2053 * - Invoke scheduler to indicate UL SRS rgSCHUtlSrsInd
2055 * @param[in] TfuSrsIndInfo *srsInd
2064 TfuSrsIndInfo *srsInd
2067 S16 rgSCHTomSrsInd(cell, srsInd)
2069 TfuSrsIndInfo *srsInd;
2076 if(cell->cellId != srsInd->cellId)
2078 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
2079 ":%d", srsInd->cellId);
2083 node = srsInd->srsRpt.first;
2084 for (;node; node=node->next)
2086 srsInfo = (TfuSrsRpt *)node->node;
2087 ue = rgSCHDbmGetUeCb (cell, srsInfo->ueId);
2090 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
2091 "UE CB", srsInfo->ueId);
2094 rgSCHUtlSrsInd(cell, ue, srsInfo, srsInd->timingInfo);
2095 rgSCHUtlHdlUlTransInd(cell, ue, srsInd->timingInfo);
2098 } /* rgSCHTomSrsInd */
2102 * Fun: rgSCHTomUtlGenIndices
2104 * Desc: This function reconstructs the Subband Indices for
2105 * of M selected Subbands conveyed by the UE for APeriodic Modes
2106 * 2-0 and 2-2. It decodes the Label which uniquely encodes M out
2114 * File: rg_sch_utl.c
2119 PRIVATE S16 rgSCHTomUtlGenIndices
2125 TfuSubbandInfo* sbInfo
2128 PRIVATE S16 rgSCHTomUtlGenIndices(label, posM, valN, valK, sbInfo)
2133 TfuSubbandInfo* sbInfo;
2136 uint8_t idx, kval, xval, xmin;
2139 for(kval=0; kval<posM;kval++)
2142 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe, (posM-kval-1));
2143 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe[posM-kval-1], (valN-xval-1));
2144 binCoe = rgSCHTomBinCoe[posM-kval-1][valN-xval-1];
2148 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe[posM-kval-1], (valN-xval-1));
2149 binCoe = rgSCHTomBinCoe[posM-kval-1][valN-xval-1];
2152 sbInfo[kval].numRb = valK;
2153 sbInfo[kval].rbStart = idx*valK;
2155 label = label-binCoe;
2158 } /* end of rgSCHTomUtlGenIndices*/
2162 * @brief Handler for processing decode failure indication recieved from
2167 * Function: rgSCHTomCrcInd
2169 * Handler for processing decode failure indication recieved from
2170 * PHY for a set of UEs.
2172 * Invoked by: RgLiTfuCrcInd of rg_sch.x
2175 * - Validate the information received and retrieve cell and ue.
2176 * - Process Decode failure Indication: Call rgSCHUhmProcHqFailure().
2178 * @param[in] TfuCrcIndInfo *crcInd
2187 TfuCrcIndInfo *crcInd
2190 S16 rgSCHTomCrcInd(cell, crcInd)
2192 TfuCrcIndInfo *crcInd;
2195 RgSchUeCb *ue = NULLP;
2196 RgSchRaCb *raCb = NULLP;
2198 TfuCrcInfo *crcInfo;
2199 #ifdef RG_ULSCHED_AT_CRC
2202 CmLteTimingInfo crntHiDci0Frm;
2203 //RgSchCmnUlCell *cellUl;
2204 Inst inst = cell->instIdx;
2205 TfuCntrlReqInfo *cntrlInfo;
2213 RgSchUlHqProcCb *hqProc;
2217 RgSchUlHqProcCb *ulHqProc;
2220 if(cell->cellId != crcInd->cellId)
2222 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
2223 ":%d", crcInd->cellId);
2226 #ifdef RG_ULSCHED_AT_CRC
2229 static CmLteTimingInfo lastCrc = {2000,0};
2230 CmLteTimingInfo crntCrc = cell->crntTime;
2231 if (RGSCH_TIMEINFO_SAME(lastCrc, crntCrc))
2233 /*Removed the WA to drop 2nd CRC*/
2234 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"Recieved CRC "
2235 "twice per TTI @(%u,%u)", cell->crntTime.sfn,
2236 cell->crntTime.slot);
2242 node = crcInd->crcLst.first;
2243 for (;node; node=node->next)
2245 crcInfo = (TfuCrcInfo*)node->node;
2246 ue = rgSCHDbmGetUeCb (cell, crcInfo->rnti);
2250 /* Fetch from SPS List */
2251 ue = rgSCHDbmGetSpsUeCb(cell, crcInfo->rnti);
2255 raCb = rgSCHDbmGetRaCb (cell, crcInfo->rnti);
2262 /* Added Ul TB count for Uplink data scheduled*/
2266 ulHqProc = &(raCb->msg3HqProc);
2267 if(ulHqProc->remTx == (cell->rachCfg.maxMsg3Tx -1))
2269 cell->dlUlTbCnt.tbTransUlTotalCnt++;
2274 rgSCHUtlUlHqProcForUe(cell, crcInd->timingInfo, ue, &ulHqProc);
2275 if(ulHqProc->remTx == ((RgUeUlHqCb*)ulHqProc->hqEnt)->maxHqRetx)
2277 cell->dlUlTbCnt.tbTransUlTotalCnt++;
2282 if (crcInfo->isFailure == FALSE)
2286 rgSCHRamMsg3DatInd(raCb);
2288 /*ccpu00128820 - MOD - Msg3 alloc double delete issue*/
2289 hqProc = &(raCb->msg3HqProc);
2290 RGSCH_UPD_PHICH(cell->ulDlCfgIdx, crcInd->timingInfo.slot,
2298 gUlCrcPassCounter++;
2303 RGSCHCPYTIMEINFO(crcInd->timingInfo, ue->datIndTime);
2304 #ifndef MAC_SCH_STATS
2305 rgSCHUhmProcDatInd(cell, ue, crcInd->timingInfo);
2308 /** Stats update over here
2311 RgSchCmnUe *cmnUe = RG_SCH_CMN_GET_UE(ue,cell);
2313 rgSCHUhmProcDatInd(cell, ue, crcInd->timingInfo, cmnUe->ul.crntUlCqi[0]);
2315 #endif /* MAC_SCH_STATS */
2317 rgSCHUtlHdlUlTransInd(cell, ue, crcInd->timingInfo);
2319 rgSCHUtlHdlCrcInd(cell, ue, crcInd->timingInfo);
2327 /* SR_RACH_STATS : MSG3 Nack / DTX*/
2328 if (crcInfo->isDtx == TRUE)
2334 rgNumMsg3CrcFailed++;
2336 rgSCHRamMsg3FailureInd(raCb);
2338 rgSCHCmnEmtcHdlCrcFailInd(cell, raCb);
2340 /* Added Ul TB count for CRC Failure of MSG3 */
2342 ulHqProc = &(raCb->msg3HqProc);
2343 if(ulHqProc->remTx == (cell->rachCfg.maxMsg3Tx -1))
2345 cell->dlUlTbCnt.tbTransUlFaulty++;
2353 gUlCrcFailCounter++;
2358 #ifndef MAC_SCH_STATS
2359 rgSCHUhmProcHqFailure (cell, ue, crcInd->timingInfo, crcInfo->rv);
2362 RgSchCmnUe *cmnUe = RG_SCH_CMN_GET_UE(ue,cell);
2364 rgSCHUhmProcHqFailure (cell, ue, crcInd->timingInfo, crcInfo->rv, cmnUe->ul.crntUlCqi[0]);
2366 #endif /* MAC_SCH_STATS */
2367 rgSCHUtlHdlUlTransInd(cell, ue, crcInd->timingInfo);
2369 rgSCHUtlHdlCrcFailInd(cell, ue, crcInd->timingInfo);
2371 /* Added Ul TB count for CRC Failure of Uplink data */
2373 rgSCHUtlUlHqProcForUe(cell, crcInd->timingInfo, ue, &ulHqProc);
2374 if(ulHqProc->remTx == ((RgUeUlHqCb*)ulHqProc->hqEnt)->maxHqRetx)
2376 cell->dlUlTbCnt.tbTransUlFaulty++;
2383 /* ccpu00132653-ADD Added Sched_At_Crc Changes for TDD and optimized here
2384 the codebase across TDD and FDD*/
2385 #ifdef RG_ULSCHED_AT_CRC
2386 /* Changes to do uplink scheduling at CRC Indication */
2387 //cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
2388 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, crntHiDci0Frm, TFU_ULCNTRL_DLDELTA);
2391 rgSCHCmnRlsUlSf(cell,0);
2394 /* Allocating memory for CntrlReq as it required for both EMTC and
2396 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&cntrlInfo,
2397 sizeof(TfuCntrlReqInfo))) != ROK)
2399 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate TfuCntrlReqInfo "
2403 rgSCHCmnUlSch(cell);
2405 rgSCHL2Meas(cell,TRUE);
2407 /* Also, sending UL DCI and PHICH for just scheduled subframe */
2408 ulSf = rgSCHUtlSubFrmGet (cell, crntHiDci0Frm);
2410 if ((rgSCHTomUtlProcDlSfAtCrc (ulSf, crntHiDci0Frm, cell, cntrlInfo, &err)) != ROK)
2412 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomCrcInd() Unable to process"
2413 " downlink subframe for cellId %d", crcInd->cellId);
2414 err.errType = RGSCHERR_TOM_TTIIND;
2417 #endif /* RG_ULSCHED_AT_CRC */
2419 } /* rgSCHTomCrcInd */
2422 * @brief Handler for processing timing Advance indication recieved from
2427 * Function: rgSCHTomTimingAdvInd
2429 * Handler for processing timing advance indication recieved from PHY
2432 * Invoked by: RgLiTfuTimingAdvInd
2436 * - Call DHM to update value of Timing Advance rgSCHDhmUpdTa.
2438 * @param[in] TfuTimingAdvIndInfo *timingAdvInd
2444 S16 rgSCHTomTimingAdvInd
2447 TfuTimingAdvIndInfo *timingAdvInd
2450 S16 rgSCHTomTimingAdvInd(cell, timingAdvInd)
2452 TfuTimingAdvIndInfo *timingAdvInd;
2457 TfuTimingAdvInfo *timingAdvInfo;
2459 if(cell->cellId != timingAdvInd->cellId)
2461 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
2462 "=(%d)", timingAdvInd->cellId);
2467 node = timingAdvInd->timingAdvLst.first;
2468 for (;node; node=node->next)
2470 timingAdvInfo = (TfuTimingAdvInfo *)node->node;
2471 ue = rgSCHDbmGetUeCb (cell, timingAdvInfo->rnti);
2474 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB",
2475 timingAdvInfo->rnti);
2478 rgSCHDhmUpdTa (cell, ue, timingAdvInfo->timingAdv);
2481 } /* rgSCHTomTimingAdvInd */
2484 * @brief Handler for processing TTI indication recieved from
2485 * PHY for 'n' cells.
2489 * Function: rgSCHTomTtiInd
2491 * Handler for processing slot indication recieved from MAC
2492 * for a cell. This is split into the below Steps.
2494 * 1: Complete the Uplink and Common Channel Scheduling for each Cell
2495 * 2: Complete the UE specific Scheduling for each Cell / across Cells.
2496 * 3: Consolidate the subframe allocations and send to each MAC instance
2497 * 4: Fill the Tfu structures for DL and UL Config requests
2498 * 5: Handle the RGR Config messages per Cell
2500 * @param[in] SlotIndInfo *slotInd
2501 * @param[in] Inst schInst
2507 SlotIndInfo *slotInd,
2511 Void rgSCHTomTtiInd(slotInd, schInst)
2512 SlotIndInfo *slotInd;
2516 RgInfSfAlloc *subfrmAlloc;
2517 RgTfuCntrlReqInfo *cntrlInfo = NULLP;
2521 RgSchCellCb *cell[CM_LTE_MAX_CELLS];
2522 RgSchCellCb *cellLst[CM_LTE_MAX_CELLS];
2528 //rgSchTomFillCellTtiInfo(slotInd, schInst, &nCell, &cell[0]);
2530 schFillCrntTime(*slotInd,schInst);
2531 for (i = 0; i < nCell; i++)
2533 /* Perform UL and DL Common Channel scheduling */
2534 rgSchTomTtiUlAndDlCmnChSch (cell[i]);
2537 /* Perform scheduling in Order of
2541 for (i = 0; i < nCell; i++)
2544 if (cell[i]->isDlDataAllwd && (cell[i]->stopDlSch == FALSE))
2546 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell[i]);
2547 /* Perform DL Retx scheduling */
2548 cellSch->apisDl->rgSCHDlRetxSched(cell[i], &cellSch->allocInfo);
2552 rgSchCmnPreDlSch(cell, nCell, cellLst);
2553 for (i = 0; i < nCell; i++)
2555 /* Perform DL scheduling */
2556 rgSchTomTtiDlSch (cellLst[i]);
2558 rgSchCmnPstDlSch(cell[0]);
2560 for (i = 0; i < nCell; i++)
2563 #ifndef RG_ULSCHED_AT_CRC
2564 /* Perform UL scheduling for TDD */
2565 rgSCHCmnUlSch (cell[i]);
2569 /* Init SF Alloc info per Cell */
2570 for (i = 0; i < nCell; i++)
2572 subfrmAlloc = &(cell[i]->sfAllocArr[cell[i]->crntSfIdx]);
2573 rgSCHUtlResetSfAlloc(subfrmAlloc,FALSE,TRUE);
2575 for (i = 0; i < nCell; i++)
2577 if (cell[i]->isDlDataAllwd && (cell[i]->stopSiSch == FALSE))
2579 subfrmAlloc = &(cell[i]->sfAllocArr[cell[i]->crntSfIdx]);
2581 * TFU_DLDATA_DLDELTA is used in this calculation because the subfrmAlloc
2582 * timingInfo which is being calculated here will be used by MAC
2584 RG_SCH_ADD_TO_CRNT_TIME(cell[i]->crntTime, subfrmAlloc->timingInfo,
2585 RG_DL_DELTA - TFU_DLDATA_DLDELTA);
2586 /* Consolidate the Allocations and send response to MAC instances */
2587 rgSchTomTtiCnsldtSfAlloc (cell[i]);
2591 for (i = 0; i < nCell; i++)
2593 if (cell[i]->isDlDataAllwd && (cell[i]->stopSiSch == FALSE))
2595 /* Send the consolidated Alloc Info to MAC instances */
2596 rgSCHCmnSndCnsldtInfo (cell[i]);
2600 for (i = 0; i < nCell; i++)
2602 /* Fill control data from scheduler to PHY */
2603 if ((ret = rgSCHUtlAllocEventMem((cell[i]->instIdx), (Ptr *)&cntrlInfo,
2604 sizeof(RgTfuCntrlReqInfo))) != ROK)
2606 RLOG_ARG0(L_ERROR,DBG_CELLID,cell[i]->cellId,"Unable to Allocate TfuCntrlReqInfo"
2612 /* Fill the TFU structures and send to CL */
2613 if(TRUE == cell[i]->emtcEnable)
2615 ret = rgSchEmtcTomTtiL1DlAndUlCfg (cell[i], cntrlInfo);
2619 && (NULLP != cntrlInfo))
2621 /* Fill the TFU structures and send to CL */
2622 rgSchTomTtiL1DlAndUlCfg (cell[i], cntrlInfo);
2626 rgSCHTomUtlSendSfnTick(cell[0]);
2629 for (i = 0; i < nCell; i++)
2631 /* Invoke non critical functions like measurements, etc */
2632 rgSchTomTtiMiscFunctions (cell[i]);
2637 uint32_t dbgUeIdChngAndDatReqInClCnt = 0;
2638 static uint32_t gTtiCount = 0;
2641 if(gTtiCount == 3000)
2643 #ifdef XEON_SPECIFIC_CHANGES
2644 printf("SChed:: (P/S)::(%u/%u) \n",
2645 gPrimarySchedCount,gSCellSchedCount);
2647 printf("\n HQFDBK :: %u\n",gHqFdbkCount);
2652 total = gPCellTb1AckCount + gPCellTb1NackCount + gPCellTb1DtxCount;
2653 total2 = gPCellTb2AckCount + gPCellTb2NackCount + gPCellTb2DtxCount;
2655 printf("\n PCell:: TB1:: (A/N/D)::(%u/%u/%u) TB2:: (A/N/D)::(%u/%u/%u)\n",
2656 gPCellTb1AckCount,gPCellTb1NackCount,gPCellTb1DtxCount,
2657 gPCellTb2AckCount,gPCellTb2NackCount,gPCellTb2DtxCount);
2658 if ((total != 0 ) && total2 != 0)
2660 printf("\n PCell:: TB1:: (AP/NP/DP)::(%.2f/%.2f/%.2f) TB2:: (AP/NP/DP)::(%.2f/%.2f/%.2f)\n",
2661 (float)gPCellTb1AckCount/total * 100,(float)gPCellTb1NackCount/total * 100,(float)gPCellTb1DtxCount/total * 100,
2662 (float)gPCellTb2AckCount/total2 *100 ,(float)gPCellTb2NackCount/total2 *100 ,(float)gPCellTb2DtxCount/total2 *2);
2665 total = gSCellTb1AckCount + gSCellTb1NackCount + gSCellTb1DtxCount;
2666 total2 = gSCellTb2AckCount + gSCellTb2NackCount + gSCellTb2DtxCount;
2669 printf("\n SCell:: TB1:: (A/N/D)::(%u/%u/%u) TB2:: (A/N/D)::(%u/%u/%u)\n",
2670 gSCellTb1AckCount,gSCellTb1NackCount,gSCellTb1DtxCount,
2671 gSCellTb2AckCount,gSCellTb2NackCount,gSCellTb2DtxCount);
2672 if ((total != 0 ) && total2 != 0)
2674 printf("\n SCell:: TB1:: (AP/NP/DP)::(%.2f/%.2f/%.2f) TB2:: (AP/NP/DP)::(%.2f/%.2f/%.2f)\n",
2675 (float)gSCellTb1AckCount/total * 100,(float)gSCellTb1NackCount/total * 100,(float)gSCellTb1DtxCount/total * 100,
2676 (float)gSCellTb2AckCount/total2 *100 ,(float)gSCellTb2NackCount/total2 *100 ,(float)gSCellTb2DtxCount/total2 *2);
2680 printf("\n CQI:: Recp(Pucch/Pusch):Rcvd(pcqi/rawacqireport/apcqi/AppReprt)::(%u/%u):(%u/%u/%u/%u)\n",
2681 gCqiRecpCount,gCqiRecpPuschCount,gCqiRcvdCount,gRawACqiCount,
2682 gACqiRcvdCount,gCqiReptToAppCount);
2684 printf("\n (F1BCS Count/Cqi/Ri/CqiDrop/PucchDrop/PuschCqiDrop)::(%u/%u/%u/%u/%u/%u)\n",
2685 gF1bCsCount,gCqiReqCount,gRiReqCount,gCqiDropCount,gPucchDropCount,gPuschCqiDropCount);
2687 printf("UL::(DCI0/CrcPass/CrcFail)::(%u/%u/%u)\n"
2688 "gPcellZeroBoOcc:%u\t gScellZeroBoOcc:%u dbgUeIdChngAndDatReqInClCnt: %u\n"
2689 "DelayedDatReqInMac: %u DelayedDatReqInCl : %u gIccPktRcvrMemDropCnt :%u\n",
2695 dbgUeIdChngAndDatReqInClCnt,
2696 dbgDelayedDatReqInMac,
2697 gDropDatReqCnt, gIccPktRcvrMemDropCnt);
2699 printf("SChed:: (P/S)::(%ld/%ld) \n",
2700 gPrimarySchedCount,gSCellSchedCount);
2702 printf("\n HQFDBK :: %ld\n",gHqFdbkCount);
2704 printf("\n PCell:: TB1:: (A/N/D)::(%ld/%ld/%ld) TB2:: (A/N/D)::(%ld/%ld/%ld)\n",
2705 gPCellTb1AckCount,gPCellTb1NackCount,gPCellTb1DtxCount,
2706 gPCellTb2AckCount,gPCellTb2NackCount,gPCellTb2DtxCount);
2708 printf("\n SCell:: TB1:: (A/N/D)::(%ld/%ld/%ld) TB2:: (A/N/D)::(%ld/%ld/%ld)\n",
2709 gSCellTb1AckCount,gSCellTb1NackCount,gSCellTb1DtxCount,
2710 gSCellTb2AckCount,gSCellTb2NackCount,gSCellTb2DtxCount);
2712 printf("\n CQI:: Recp(Pucch/Pusch):Rcvd(pcqi/rawacqireport/apcqi/AppReprt)::(%ld/%ld):(%ld/%ld/%ld/%ld)\n",
2713 gCqiRecpCount,gCqiRecpPuschCount,gCqiRcvdCount,gRawACqiCount,
2714 gACqiRcvdCount,gCqiReptToAppCount);
2715 printf("\n CQI:: PucchCqiSnrDropCnt/PucchCqiConfBitMaskDropCnt/PuschCqiConfMaskDropCount :: (%ld/%ld/%ld) \n",gCqiPucchLowSnrDropCount,gCqiPucchConfMaskDropCount,gCqiPuschConfMaskDropCount);
2717 printf("\n (F1BCS Count/Cqi/Ri/CqiDrop/PucchDrop/PuschCqiDrop)::(%ld/%ld/%ld/%ld/%ld/%ld)\n",
2718 gF1bCsCount,gCqiReqCount,gRiReqCount,gCqiDropCount,gPucchDropCount,gPuschCqiDropCount);
2720 printf("UL::(DCI0/CrcPass/CrcFail)::(%ld/%ld/%ld)\n"
2721 "gPcellZeroBoOcc:%ld\t gScellZeroBoOcc:%ld dbgUeIdChngAndDatReqInClCnt: %ld\n"
2722 "DelayedDatReqInMac: %ld DelayedDatReqInCl : %ld gIccPktRcvrMemDropCnt :%ld\n",
2728 dbgUeIdChngAndDatReqInClCnt,
2729 dbgDelayedDatReqInMac,
2730 gDropDatReqCnt, gIccPktRcvrMemDropCnt);
2731 //printf ("\n delayedApiCnt:%ld",delayedApiCnt);
2735 rgSCHLaaPrintStats();
2737 gCaDbgNonCaFrmt = gIccPktRcvrMemDropCnt = 0;
2749 gCqiPucchLowSnrDropCount = 0;
2750 gCqiPucchConfMaskDropCount = 0;
2751 gCqiPuschConfMaskDropCount = 0;
2752 gPuschCqiDropCount = 0;
2755 gUlCrcPassCount = 0;
2756 gUlCrcFailCount = 0;
2759 gCqiRecpPuschCount = 0;
2762 gCqiReptToAppCount = 0;
2767 gPrimarySchedCount = 0;
2768 gSCellSchedCount = 0;
2769 gSCellTb1AckCount = 0;
2770 gSCellTb2AckCount = 0;
2771 gSCellTb2AckCount = 0;
2772 gSCellTb2NackCount = 0;
2773 gPCellTb1AckCount = 0;
2774 gPCellTb1NackCount = 0;
2775 gPCellTb2AckCount = 0;
2776 gPCellTb2NackCount = 0;
2777 gSCellTb1NackCount=0;
2779 gPCellTb1DtxCount = 0;
2780 gPCellTb2DtxCount = 0;
2781 gSCellTb1DtxCount = 0;
2782 gSCellTb2DtxCount = 0;
2783 gPcellZeroBoOcc = 0;
2784 gScellZeroBoOcc = 0;
2792 } /* rgSCHTomTtiInd */
2794 /** @brief This function does the TTI processin for the uplink subframe,
2795 * already populated by the scheduler.
2799 * Function: rgSCHTomUtlProcUlSf
2802 * - Loop through the Uplink allocations present in the uplink subframe.
2803 * - For each allocation Fill a data reception request to be sent to PHY
2804 * - Also fills the harq reception requests for the expected HQ feedbacks.
2807 * @param [in] RgSchCellCb *cell
2808 * @param [out] RgSchErrInfo *err
2815 PRIVATE S16 rgSCHTomUtlProcUlSf
2821 PRIVATE S16 rgSCHTomUtlProcUlSf (cell, err)
2827 TfuRecpReqInfo *recpReqInfo;
2829 uint16_t validIdx = 0; /* Index computed from recreq's timing info*/
2831 Inst inst = cell->instIdx;
2833 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&recpReqInfo,
2834 sizeof(TfuRecpReqInfo))) != ROK)
2836 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate TfuRecpReqInfo "
2838 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
2841 recpReqInfo->cellId = cell->cellId;
2842 cmLListInit(&recpReqInfo->ueRecpReqLst);
2844 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, recpReqInfo->timingInfo,
2845 TFU_RECPREQ_DLDELTA);
2847 /* Filling data Reception requests */
2848 ret = rgSCHTomUtlFillDatRecpReq(recpReqInfo, cell,
2853 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to fill Data recption "
2854 "requests for cell");
2855 RGSCH_FREE_MEM(recpReqInfo);
2858 /* Filling HARQ Reception requests */
2859 ret = rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, validIdx,err);
2862 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to fill Harq Feedback "
2863 "reception requests for cell");
2864 RGSCH_FREE_MEM(recpReqInfo);
2867 /* sending the RecpReq to Phy */
2868 if (rgSCHUtlTfuRecpReq(inst, cell->tfuSap->sapCfg.suId, recpReqInfo) != ROK)
2870 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info for cell");
2873 } /* end of rgSCHTomUtlProcUlSf */
2877 /** @brief This function does the TTI processin for the uplink subframe,
2878 * already populated by the scheduler.
2882 * Function: rgSCHTomUtlPrcUlTddSpclSf
2885 * - Fill the SRS Info for the Special Subframe in Reception Req.
2886 * - Send the Reception Req to TFU
2889 * @param [in] RgSchCellCb *cell
2890 * @param [out] RgSchErrInfo *err
2896 PRIVATE S16 rgSCHTomUtlPrcUlTddSpclSf
2902 PRIVATE S16 rgSCHTomUtlPrcUlTddSpclSf (cell, err)
2908 TfuRecpReqInfo *recpReqInfo;
2909 uint16_t validIdx; /* Index computed from recreq's timing info*/
2910 Inst inst = cell->instIdx;
2912 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&recpReqInfo,
2913 sizeof(TfuRecpReqInfo))) != ROK)
2915 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to "
2916 "Allocate TfuRecpReqInfo for cell");
2917 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
2920 recpReqInfo->cellId = cell->cellId;
2921 cmLListInit(&recpReqInfo->ueRecpReqLst);
2923 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, recpReqInfo->timingInfo, TFU_RECPREQ_DLDELTA);
2925 RG_SCH_GET_IDX_PCQISRSSR(recpReqInfo->timingInfo, validIdx);
2928 if(cell->srsCfg.isSrsCfgPres &&
2929 rgSchTddCellSpSrsSubfrmTbl[cell->srsCfg.srsSubFrameCfg][recpReqInfo->timingInfo.slot])
2931 recpReqInfo->srsPres = TRUE;
2935 recpReqInfo->srsPres = FALSE;
2938 /* Filling SRS Reception requests */
2939 ret = rgSCHTomUtlFillSrsRecpReq (recpReqInfo, cell, validIdx, err);
2942 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to fill"
2943 " SRS recption requests for cell");
2944 RGSCH_FREE_MEM(recpReqInfo);
2947 /* sending the RecpReq to Phy */
2948 if (rgSCHUtlTfuRecpReq(inst, cell->tfuSap->sapCfg.suId, recpReqInfo) != ROK)
2950 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to send "
2951 "Cntrl info for cell");
2954 } /* end of rgSCHTomUtlPrcUlTddSpclSf */
2957 /** @brief This function does all the processing related to a single downlink
2962 * Function: rgSCHTomUtlProcDlSf
2965 * - collate control data for all UEs and send to PHY
2966 * - collate data buffers for all UEs and send to PHY
2968 * @param [in] RgSchDlSf *dlSf
2969 * @param [in] RgSchDlSf *ulSf
2970 * @param [in] RgSchCellCb *cell
2971 * @param [out] RgSchErrInfo *err
2975 PRIVATE S16 rgSCHTomUtlProcDlSf
2980 RgTfuCntrlReqInfo *cntrlInfo,
2984 PRIVATE S16 rgSCHTomUtlProcDlSf (dlSf, ulSf, cell, cntrlInfo, err)
2988 RgTfuCntrlReqInfo *cntrlInfo;
2992 Inst inst = cell->instIdx;
2994 uint8_t sfTyp = 1; /* Dl Subframe */
2996 cmLListInit(&cntrlInfo->phichLst);
2997 cmLListInit(&cntrlInfo->dlPdcchLst);
2998 cmLListInit(&cntrlInfo->ulPdcchLst);
3000 #ifdef TFU_ALLOC_EVENT_NO_INIT
3001 cntrlInfo->ulTiming.sfn = cntrlInfo->ulTiming.subframe = 0;
3003 cntrlInfo->dlTiming = cell->dlDciTime;
3004 cntrlInfo->cellId = cell->cellId;
3005 cntrlInfo->ulTiming = cell->hiDci0Time;
3006 if((0 == (cntrlInfo->dlTiming.sfn % 30)) && (0 == cntrlInfo->dlTiming.slot))
3008 //printf("5GTF_CHECK rgSCHTomUtlProcDlSf Cntrl dl (%d : %d) ul (%d : %d)\n", cntrlInfo->dlTiming.sfn, cntrlInfo->dlTiming.subframe, cntrlInfo->ulTiming.sfn, cntrlInfo->ulTiming.subframe);
3010 /* Fill PCFICH info */
3011 /* Fix for DCFI FLE issue: when DL delta is 1 and UL delta is 0 and CFI
3012 *change happens in that SF then UL PDCCH allocation happens with old CFI
3013 *but CFI in control Req goes updated one since it was stored in the CELL
3015 cntrlInfo->cfi = dlSf->pdcchInfo.currCfi;
3016 #ifndef RG_ULSCHED_AT_CRC
3019 Mval = rgSchTddPhichMValTbl[cell->ulDlCfgIdx]
3020 [cell->hiDci0Time.subframe];
3021 if(dlSf->sfType == RG_SCH_SPL_SF_DATA)
3023 RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, cntrlInfo->cfi);
3028 /* Fill PHICH info */
3029 if ((ret = rgSCHTomUtlFillPhich (cell, cntrlInfo, ulSf, err)) != ROK)
3031 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PHICH info "
3032 "for cellId (%d)\n", cell->cellId));
3033 RGSCH_FREE_MEM(cntrlInfo);
3036 if ((ret = rgSCHTomUtlFillUlPdcch (cell, cntrlInfo, ulSf, err)) !=
3039 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PDCCH info "
3040 "for cellId (%d)\n", cell->cellId));
3041 RGSCH_FREE_MEM(cntrlInfo);
3046 if(0 == cntrlInfo->ulMpdcchLst.count)
3053 sfTyp = rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
3054 [cell->dlDciTime.subframe];
3056 if (sfTyp != 2) /* Uplink subframe */
3058 /* Fill PDCCH info */
3059 if ((ret = rgSCHTomUtlFillDlPdcch(cell,cntrlInfo, dlSf, err)) != ROK)
3061 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PDCCH info "
3062 "for cellId (%d)\n", cell->cellId));
3063 RGSCH_FREE_MEM(cntrlInfo);
3066 rgBwAlloInfo[dlSf->sfNum] += dlSf->bwAssigned;
3067 rgBwAlcnt[dlSf->sfNum] ++;
3070 #ifdef LTEMAC_SPS /* SPS_NEW_CHGS */
3071 cntrlInfo->isSPSOcc = dlSf->isSPSOcc;
3073 cntrlInfo->numDlActvUes += dlSf->numDlActvUes; /* 4UE_TTI_DELTA */
3074 dlSf->numDlActvUes = 0;
3076 if(0 == cntrlInfo->dlMpdcchLst.count)
3081 /* Now always sending down a cntrl req */
3082 /* sending the cntrl data to Phy */
3083 if (rgSCHUtlTfuCntrlReq(inst, cell->tfuSap->sapCfg.suId, cntrlInfo)
3086 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info "
3094 /** @brief This function handles sending of the PHICH information for the
3095 * downlink subframe to be sent in the next TTI.
3102 * - Loop through the PHICH information present in the downlink
3103 * subframe and fill the information in cntrlInfo.
3105 * @param [out] TfuCntrlReqInfo *cntrlInfo
3106 * @param [in] RgSchDlSf *dlSf
3107 * @param [out] RgSchErrInfo *err
3113 PRIVATE S16 rgSCHTomUtlFillPhich
3116 TfuCntrlReqInfo *cntrlInfo,
3121 PRIVATE S16 rgSCHTomUtlFillPhich(cell, cntrlInfo, dlSf, err)
3123 TfuCntrlReqInfo *cntrlInfo;
3131 TfuPhichInfo *harqAck;
3133 RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
3137 /* Traversing the list of Phichs */
3138 node = dlSf->phichInfo.phichs.first;
3141 phich = (RgSchPhich*)node->node;
3142 if ((ret = rgSCHUtlGetEventMem((Ptr *)&harqAck, sizeof(TfuPhichInfo),
3143 &(cntrlInfo->memCp))) != ROK)
3145 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3148 #ifdef TFU_ALLOC_EVENT_NO_INIT
3149 harqAck->txPower = 0;
3151 /* fill in the tfu structure from the information present in the
3153 harqAck->rbStart = phich->rbStart;
3154 harqAck->nDmrs = phich->nDmrs;
3155 harqAck->isAck = phich->hqFeedBack;
3156 harqAck->isForMsg3 = phich->isForMsg3; /*SR_RACH_STATS : PHICH ACK/NACK for MSG3 */
3158 /* Changes for passing iPhich at TFU interface*/
3159 harqAck->iPhich = phich->iPhich;
3161 /* ccpu00138898 - Added Tx pwr offset for PHICH Tx*/
3163 harqAck->txPower = cellDl->phichTxPwrOffset;
3165 cmLListAdd2Tail(&cntrlInfo->phichLst, &(harqAck->lnk));
3166 harqAck->lnk.node = (PTR)harqAck;
3168 } /* end of while */
3174 /** @brief This function is a utility function to restart
3175 * deactivation timer.
3179 * Function: rgSCHTmrRestartScellDeactTmr
3182 * - Starts timer at scheduler
3184 * @param[in] RgSchCellCb *cell
3185 * @param[in] CmLteRnti rnti
3189 PRIVATE Void rgSCHTmrRestartScellDeactTmr
3195 PRIVATE Void rgSCHTmrRestartScellDeactTmr (cell, ueCb)
3201 RgSchUeCellInfo *sCellInfo = NULLP;
3205 if(RG_SCH_IS_CELL_SEC(ueCb, cell))
3207 sCellInfo = ueCb->cellInfo[(ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)])];
3209 if(sCellInfo->deactTmr.tmrEvnt != TMR_NONE)
3211 rgSCHTmrStopTmr(cell, RG_SCH_TMR_SCELL_DEACT, sCellInfo);
3213 if(PRSNT_NODEF == ueCb->sCellDeactTmrVal.pres)
3216 rgSCHTmrStartTmr(cell,sCellInfo,RG_SCH_TMR_SCELL_DEACT,
3217 ueCb->sCellDeactTmrVal.val);
3222 }/*end of rgSCHTmrRestartScellDeactTmr*/
3225 /** @brief This function will send all the PDCCH's for the given downlink
3233 * - Loop through all the scheduled HARQ processes and fill
3234 * the PDCCH information in cntrlInfo.
3236 * @param [out] TfuCntrlReqInfo *cntrlInfo
3237 * @param [in] RgSchDlSf *dlSf
3238 * @param [out] RgSchErrInfo *err
3243 EXTERN uint32_t numdlSpsRelSentToTf;
3245 PRIVATE S16 rgSCHTomUtlFillDlPdcch
3248 TfuCntrlReqInfo *cntrlInfo,
3253 PRIVATE S16 rgSCHTomUtlFillDlPdcch(cell,cntrlInfo, dlSf, err)
3255 TfuCntrlReqInfo *cntrlInfo;
3263 TfuPdcchInfo *tfuPdcch;
3264 uint8_t isDcivld = FALSE;
3265 uint8_t numUePerTti = 0;
3268 /* Traversing the scheduled Harq processes */
3269 node = dlSf->pdcchInfo.pdcchs.first;
3272 pdcch = (RgSchPdcch*)node->node;
3273 switch(pdcch->dci.dciFormat)
3275 case TFU_DCI_FORMAT_3:
3276 isDcivld = (pdcch->dci.u.format3Info.isPucch) ? TRUE : FALSE;
3279 case TFU_DCI_FORMAT_3A:
3280 isDcivld = (pdcch->dci.u.format3AInfo.isPucch) ? TRUE : FALSE;
3293 /*ccpu00117179 - ADD - Build only non DCI format-0 messages */
3294 if((pdcch->dci.dciFormat == TFU_DCI_FORMAT_0) ||
3295 (pdcch->dci.dciFormat == TFU_DCI_FORMAT_A1) ||
3296 (pdcch->dci.dciFormat == TFU_DCI_FORMAT_A2))
3303 #ifdef RGSCH_SPS_STATS
3304 if((pdcch->dci.dciFormat == TFU_DCI_FORMAT_1A) &&
3305 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.mcs == 0x1F) &&
3306 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.type == TFU_ALLOC_TYPE_RIV) &&
3307 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.u.riv == 0xFFFFFFFF))
3309 numdlSpsRelSentToTf++;
3313 if ((ret = rgSCHUtlGetEventMem((Ptr *)&tfuPdcch, sizeof(TfuPdcchInfo),
3314 &(cntrlInfo->memCp))) != ROK)
3316 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3320 tfuPdcch->crnti = pdcch->crnti;
3321 tfuPdcch->isSpsRnti = pdcch->isSpsRnti;
3323 tfuPdcch->rnti = pdcch->rnti;
3326 rgSCHTmrRestartScellDeactTmr(cell,pdcch->ue);
3328 tfuPdcch->dciNumOfBits = pdcch->dciNumOfBits;
3330 tfuPdcch->nCce = pdcch->nCce;
3331 tfuPdcch->aggrLvl = pdcch->aggrLvl;
3332 tfuPdcch->dci = pdcch->dci;
3334 //TODO_SID: Need to check these values during INT
3335 tfuPdcch->sectorId = 0;
3336 tfuPdcch->sccIdx = 0;
3339 /* SR_RACH_STATS : Reset isTBMsg4 */
3340 pdcch->dci.u.format1aInfo.t.pdschInfo.isTBMsg4 = FALSE;
3341 /* To be enhanced later for 2.1 */
3342 cmLListAdd2Tail(&cntrlInfo->dlPdcchLst, &(tfuPdcch->lnk));
3343 tfuPdcch->lnk.node = (PTR)tfuPdcch;
3345 if((pdcch->rnti > 60) && (pdcch->rnti < 5000))
3347 #if defined (TENB_STATS) && defined (RG_5GTF)
3348 cell->tenbStats->sch.dl5gtfPdcchSend++;
3352 } /* end of while */
3354 if((numUePerTti) && (numUePerTti < RG_MAX_NUM_UE_PER_TTI ))
3356 cell->dlNumUeSchedPerTti[numUePerTti-1]++;
3358 gDlNumUePerTti[numUePerTti-1]++;
3362 } /* end of rgSCHTomUtlFillDlPdcch*/
3364 #ifdef RGSCH_SPS_STATS
3365 extern uint32_t rgSchSpsRelSentToTf;
3366 extern uint32_t rgSchSpsRelPdcchAllocd;
3368 /** @brief This function will send all the UL PDCCH's for the given
3376 * - Loop through all the scheduled HARQ processes and fill
3377 * the PDCCH information in cntrlInfo.
3379 * @param [out] TfuCntrlReqInfo *cntrlInfo
3380 * @param [in] RgSchDlSf *dlSf
3381 * @param [out] RgSchErrInfo *err
3387 PRIVATE S16 rgSCHTomUtlFillUlPdcch
3390 TfuCntrlReqInfo *cntrlInfo,
3395 PRIVATE S16 rgSCHTomUtlFillUlPdcch(cntrlInfo, dlSf, err)
3397 TfuCntrlReqInfo *cntrlInfo;
3405 TfuPdcchInfo *tfuPdcch;
3406 uint8_t isDcivld = FALSE;
3409 /* Traversing the scheduled Harq processes */
3410 node = dlSf->pdcchInfo.pdcchs.first;
3413 pdcch = (RgSchPdcch*)node->node;
3415 /*ccpu00116712- Function should pick only UL allocation related control
3417 switch(pdcch->dci.dciFormat)
3419 case TFU_DCI_FORMAT_A1:
3423 case TFU_DCI_FORMAT_A2:
3427 case TFU_DCI_FORMAT_3:
3428 isDcivld = (pdcch->dci.u.format3Info.isPucch) ? FALSE : TRUE;
3431 case TFU_DCI_FORMAT_3A:
3432 isDcivld = (pdcch->dci.u.format3AInfo.isPucch) ? FALSE : TRUE;
3447 /*ccpu00116712- Function should pick only UL allocation related control
3449 if ((ret = rgSCHUtlGetEventMem((Ptr *)&tfuPdcch, sizeof(TfuPdcchInfo),
3450 &(cntrlInfo->memCp))) != ROK)
3452 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3455 tfuPdcch->rnti = pdcch->rnti;
3457 rgSCHTmrRestartScellDeactTmr(cell,pdcch->ue);
3459 tfuPdcch->dciNumOfBits = pdcch->dciNumOfBits;
3461 tfuPdcch->nCce = pdcch->nCce;
3462 tfuPdcch->aggrLvl = pdcch->aggrLvl;
3463 tfuPdcch->dci = pdcch->dci;
3465 //TODO_SID: Need to check these values during INT
3466 tfuPdcch->sectorId = 0;
3467 tfuPdcch->sccIdx = 0;
3470 /* To be enhanced later for 2.1 */
3472 #if defined (TENB_STATS) && defined (RG_5GTF)
3473 cell->tenbStats->sch.ul5gtfPdcchSend++;
3475 cmLListAdd2Tail(&cntrlInfo->ulPdcchLst, &(tfuPdcch->lnk));
3476 tfuPdcch->lnk.node = (PTR)tfuPdcch;
3477 } /* end of while */
3479 #ifdef RGSCH_SPS_STATS
3480 if (rgSchSpsRelSentToTf != rgSchSpsRelPdcchAllocd)
3486 } /* end of rgSCHTomUtlFillUlPdcch*/
3488 /** @brief This function does the processing for Timing adjustment.
3495 * - Loop through the ue present ueTimeLst, decrement the remaining
3499 * @param [in] RgSchCellCb *cell
3505 PRIVATE S16 rgSCHTomUtlProcTA
3510 PRIVATE S16 rgSCHTomUtlProcTA (cell)
3517 node = cell->taUeLst.first;
3520 ue = (RgSchUeCb *)node->node;
3522 if (ue->dl.taCb.numRemSf == 0)
3524 ue->dl.taCb.state = RGSCH_TA_IDLE;
3525 /* If Outstanding Ta is present, schedule it */
3526 if(ue->dl.taCb.outStndngTa == TRUE)
3528 rgSCHUtlReTxTa(cell, ue);
3532 /* We need to reset state and also value of TA,
3533 * then we start the timer */
3534 ue->dl.taCb.ta = RGSCH_NO_TA_RQD;
3535 /* Start the timer only if TA is cfgd as FINITE value */
3536 if (ue->dl.taCb.cfgTaTmr)
3538 rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_TA, ue->dl.taCb.cfgTaTmr);
3541 /* need to delete from the link list */
3542 cmLListDelFrm(&(cell->taUeLst), &(ue->taLnk));
3543 ue->taLnk.node = NULLP;
3547 ue->dl.taCb.numRemSf--;
3549 } /* end of taUeLst */
3551 } /* end of rgSCHTomUtlProcTA */
3553 /** @brief This function handles filling of Hq reception request to
3568 S16 rgSCHTomUtlFillHqFdbkInfo
3570 TfuRecpReqInfo *recpReqInfo,
3573 RgSchDlHqProcCb *hqCb,
3575 TfuUeRecpReqInfo *pucchRecpInfo,
3576 RgSchDlHqProcCb *prvHqCb,
3580 S16 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, validIdx, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err)
3581 TfuRecpReqInfo *recpReqInfo;
3584 RgSchDlHqProcCb *hqCb;
3586 TfuUeRecpReqInfo *pucchRecpInfo;
3587 RgSchDlHqProcCb *prvHqCb;
3592 S16 rgSCHTomUtlFillHqFdbkInfo
3594 TfuRecpReqInfo *recpReqInfo,
3596 RgSchDlHqProcCb *hqCb,
3598 TfuUeRecpReqInfo *pucchRecpInfo,
3599 RgSchDlHqProcCb *prvHqCb,
3603 S16 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err)
3604 TfuRecpReqInfo *recpReqInfo;
3606 RgSchDlHqProcCb *hqCb;
3608 TfuUeRecpReqInfo *pucchRecpInfo;
3609 RgSchDlHqProcCb *prvHqCb;
3615 RgSchDlHqTbCb *tbCb;
3617 Bool isAddToLst = FALSE;
3619 for (idx = 0 ;idx < 2; idx++)
3621 if (HQ_TB_WAITING == hqCb->tbInfo[idx].state)
3623 tbCb = &hqCb->tbInfo[idx];
3625 /* FOR ACK NAK REP */
3626 if ((hqCb->hqE->ue != NULLP) &&
3627 (hqCb->hqE->ue->measGapCb.isMeasuring == TRUE))
3629 if ((tbCb->fbkRecpRepCntr) &&
3630 (--tbCb->fbkRecpRepCntr))
3632 /* Add to next subfarme */
3633 /* Add this hqCb to the next dlSf's ackNakRepQ */
3634 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
3635 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
3636 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
3637 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
3640 rgSCHTomUtlMoveNxtOccasion(cell, hqCb->hqE->ue, validIdx);
3648 /* Go to the next node */
3654 //if (hqCb != prvHqCb)
3656 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
3657 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
3660 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
3661 "TfuUeRecpReqInfo for cell");
3662 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3665 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
3666 if ((hqCb->hqE->ue != NULLP) /*&&
3667 ((tbCb->lchSchdData[0].lcId != 0) || (tbCb->taSnt ==
3671 pucchRecpInfo->rnti = hqCb->hqE->ue->ueId;
3675 if (hqCb->hqE->raCb)
3677 pucchRecpInfo->rnti = hqCb->hqE->raCb->tmpCrnti;
3683 if (!hqCb->spsN1PucchRes.pres)
3686 pucchRecpInfo->t.pucchRecpReq.hqType =
3687 TFU_HQ_RECP_REQ_NORMAL;
3688 pucchRecpInfo->t.pucchRecpReq.t.nCce =
3694 pucchRecpInfo->t.pucchRecpReq.hqType =
3695 TFU_HQ_RECP_REQ_N1PUCCH;
3696 pucchRecpInfo->t.pucchRecpReq.t.n1Pucch =
3697 hqCb->spsN1PucchRes.val;
3701 /* Handling of other types */
3702 pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
3703 #else /* TFU_UPGRADE */
3704 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
3705 if ((hqCb->tbInfo[0].state == HQ_TB_WAITING) &&
3706 (hqCb->tbInfo[1].state == HQ_TB_WAITING))
3708 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz = 2; /* MIMO */
3712 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz = 1; /* NON-MIMO */
3716 /* PucchRecpReq needs to be filled up for n1Pucch resource for SPS
3718 if (hqCb->spsN1PucchRes.pres)
3720 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
3723 #endif /* LTEMAC_SPS */
3725 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
3726 cell->pucchCfg.n1PucchAn);
3729 rgSCHEmtcFillPucchRecpInfo(cell, hqCb, &(pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0]));
3732 #endif/*TFU_UPGRADE*/
3735 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, hqCb->hqE->ue,
3736 pucchRecpInfo, validIdx,FALSE);
3739 /* Passing last parameter as FALSE in this case as it will be verified from hqCb*/
3740 isAddToLst = rgSCHEmtcAddRecpInfoToLst(hqCb,recpReqInfo, pucchRecpInfo,FALSE);
3744 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
3746 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
3749 if ((tbCb->fbkRecpRepCntr) &&
3750 (--tbCb->fbkRecpRepCntr))
3752 /* Add to next subfarme */
3753 /* Add this hqCb to the next dlSf's ackNakRepQ */
3754 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
3755 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
3756 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
3757 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
3763 }/* end of rgSCHTomUtlFillHqFdbkInfo */
3766 /** @brief This function handles filling of Hq reception request to
3771 * Function:rgSCHTomUtlFillHqFdbkFor5gtf
3775 * @param [out] TfuRecpReqInfo *recpReqInfo
3776 * @param [in] RgSchCellCb *cell
3777 * @param [in] uint16_t validIdx,
3778 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
3779 * @param [in] RgSchDlSf *dlSf,
3780 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
3781 * @param [out] RgSchErrInfo *err
3788 PRIVATE S16 rgSCHTomUtlFillHqFdbkFor5gtf
3790 TfuRecpReqInfo *recpReqInfo,
3793 RgSchDlHqInfo *dlSfHqInfo,
3795 TfuUeRecpReqInfo *pucchRecpInfo,
3799 PRIVATE S16 rgSCHTomUtlFillHqFdbkFor5gtf (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err)
3800 TfuRecpReqInfo *recpReqInfo;
3803 RgSchDlHqInfo *dlSfHqInfo;
3805 TfuUeRecpReqInfo *pucchRecpInfo;
3810 Inst inst = cell->instIdx;
3814 TfuUePucchRecpReq *pucchReqInfo = NULLP;
3816 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
3822 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
3823 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
3826 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate "
3827 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId));
3828 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3831 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
3832 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
3833 * instead of SPS-CRNTI */
3835 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
3837 pucchReqInfo->uciInfo = TFU_XPUCCH_UCI_INFO;
3839 /* 5gtf TODO : Hardcoded nPUCCHIdx */
3840 pucchReqInfo->uciPduInfo.pucchIndex = 0;
3842 pucchReqInfo->uciPduInfo.numBits = 1;
3844 /* 5gtf TODO : CQI Periodicity Hardcoded to (n,0)*/
3845 if (RGSCH_TIMEINFO_SAME (recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn))
3847 pucchReqInfo->uciPduInfo.numBits += 5;
3848 RG_SCH_ADD_TO_CRNT_TIME(recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn,
3849 ue->ue5gtfCb.cqiRiPer);
3852 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
3853 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
3855 }/* end of rgSCHTomUtlFillHqFdbkForFrmt1B */
3859 /** @brief This function handles filling of Hq reception request to
3864 * Function:rgSCHTomUtlFillHqFdbkForFrmt1B
3867 * Allocates the N1Pucch Resources based on teh A Value
3869 * @param [out] TfuRecpReqInfo *recpReqInfo
3870 * @param [in] RgSchCellCb *cell
3871 * @param [in] uint16_t validIdx,
3872 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
3873 * @param [in] RgSchDlSf *dlSf,
3874 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
3875 * @param [out] RgSchErrInfo *err
3883 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B
3885 TfuRecpReqInfo *recpReqInfo,
3888 RgSchDlHqInfo *dlSfHqInfo,
3890 TfuUeRecpReqInfo *pucchRecpInfo,
3894 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err)
3895 TfuRecpReqInfo *recpReqInfo;
3898 RgSchDlHqInfo *dlSfHqInfo;
3900 TfuUeRecpReqInfo *pucchRecpInfo;
3905 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B
3907 TfuRecpReqInfo *recpReqInfo,
3909 RgSchDlHqInfo *dlSfHqInfo,
3911 TfuUeRecpReqInfo *pucchRecpInfo,
3915 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B (recpReqInfo, cell, hqCb, dlSf, pucchRecpInfo, err)
3916 TfuRecpReqInfo *recpReqInfo;
3918 RgSchDlHqInfo *dlSfHqInfo;
3920 TfuUeRecpReqInfo *pucchRecpInfo;
3926 Inst inst = cell->instIdx;
3930 RgSchDlHqProcCb *hqCb = NULLP;
3932 TfuUePucchRecpReq *pucchReqInfo = NULLP;
3933 Bool isDatPresOnSecCell = FALSE;
3934 uint8_t primCellTbCount = 0;
3936 hqPNode = dlSfHqInfo->hqPLst.first;
3937 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
3943 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
3944 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
3947 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate "
3948 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId));
3949 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3952 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
3953 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
3954 * instead of SPS-CRNTI */
3956 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
3959 pucchReqInfo->hqType = TFU_HQ_RECP_REQ_NORMAL;
3960 /* Handling of other types */
3961 pucchReqInfo->type = TFU_UCI_HARQ;
3962 #else /* TFU_UPGRADE */
3963 pucchReqInfo->uciInfo = TFU_PUCCH_HARQ;
3964 /* Fill hqFdbkMode by using uciFrmtTyp from dlSfHqInfo */
3965 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
3966 /* Fill HqSz by using totalTbCnt based on the TM mode and
3967 * the number of serv cells configured*/
3969 pucchReqInfo->hqInfo.hqSz = ue->f1bCsAVal;
3970 pucchReqInfo->hqInfo.pucchResCnt = ue->f1bCsAVal;
3972 memset(pucchReqInfo->hqInfo.hqRes,0xff,sizeof(uint16_t)*TFU_MAX_HQ_RES);
3974 /* Two Resources needs to be configured if the
3975 * serving cell is in mimo mode else single
3977 if ((dlSf->relPdcch != NULLP) &&
3978 (RGSCH_TIMEINFO_SAME(recpReqInfo->timingInfo, ue->relPdcchFbkTiming)))
3979 {/* Pcell is having sps rel pdcch present */
3980 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
3981 {/* prim cell is in mimo mode, use 0 and 1 */
3982 pucchReqInfo->hqInfo.hqRes[0] = (dlSf->relPdcch->nCce +
3983 cell->pucchCfg.n1PucchAn);
3984 pucchReqInfo->hqInfo.hqRes[1] = pucchReqInfo->hqInfo.hqRes[0] + 1;
3989 pucchReqInfo->hqInfo.hqRes[2] = (dlSf->relPdcch->nCce +
3990 cell->pucchCfg.n1PucchAn);
3992 /* Release the pdcch so that it will not further processed */
3993 rgSCHUtlPdcchPut(ue->cell,&dlSf->pdcchInfo, dlSf->relPdcch);
3994 dlSf->relPdcch = NULLP;/* only one UE will be scheduled for release pdcch order in one tti */
3996 #endif/*LTEMAC_SPS*/
3997 #endif/*TFU_UPGRADE*/
4000 hqCb = (RgSchDlHqProcCb *)hqPNode->node;
4001 hqPNode = hqPNode->next;
4002 /* In case of CSI + 1BCS , CSI will be
4003 * dropped if scheduling is present on
4004 * seconday cell.36.213 10.1.1
4006 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4008 isDatPresOnSecCell = TRUE;
4011 if ((hqCb->tbInfo[0].state == HQ_TB_WAITING) &&
4012 (hqCb->tbInfo[1].state == HQ_TB_WAITING))
4014 primCellTbCount = 2;
4017 primCellTbCount = 1;
4021 pucchReqInfo->t.nCce = hqCb->pdcch->nCce;
4024 switch(ue->f1bCsAVal)
4026 case RG_SCH_A_VAL_2:
4027 /* harq(0) is primary harq(1) is secondary) */
4028 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4030 pucchReqInfo->hqInfo.hqRes[1] = ue->n1PucchF1bResCb.\
4031 cw1N1Res[hqCb->tpc].n1PucchIdx;
4033 else/* primary cell */
4036 /* Need to consider only sps occasions */
4037 if (hqCb->spsN1PucchRes.pres)
4039 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
4042 #endif /* LTEMAC_SPS */
4045 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
4046 cell->pucchCfg.n1PucchAn);
4050 case RG_SCH_A_VAL_3:
4051 /* Serving cell in mimo mode should be
4052 * in 0 and 1 and the serving cell in siso
4053 * mode should be in 2 indices */
4054 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4056 uint8_t cellIdx = ue->cellIdToCellIdxMap[RG_SCH_CELLINDEX(hqCb->hqE->cell)];
4057 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[cellIdx]->txMode.txModeEnum) > 1)
4058 {/* Sec cell is in mimo mode, use 0 and 1 */
4059 pucchReqInfo->hqInfo.hqRes[0] =
4060 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
4062 pucchReqInfo->hqInfo.hqRes[1] =
4063 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
4066 {/* Sec cell is in siso mode, use 2 */
4067 pucchReqInfo->hqInfo.hqRes[2] =
4068 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
4072 {/* primary cell hq */
4073 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
4074 {/* prim cell is in mimo mode, use 0 and 1 */
4076 if (hqCb->spsN1PucchRes.pres)
4077 {/* SPS occasions */
4078 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
4079 pucchReqInfo->hqInfo.hqRes[1] = hqCb->spsN1PucchRes.val + 1;
4082 #endif /* LTEMAC_SPS */
4084 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
4085 cell->pucchCfg.n1PucchAn);
4086 pucchReqInfo->hqInfo.hqRes[1] = (hqCb->pdcch->nCce +
4087 cell->pucchCfg.n1PucchAn + 1);
4091 {/* prim cell is in siso mode use 2 */
4093 /* Need to consider only sps occasions */
4094 if (hqCb->spsN1PucchRes.pres)
4096 pucchReqInfo->hqInfo.hqRes[2] = hqCb->spsN1PucchRes.val;
4099 #endif /* LTEMAC_SPS */
4102 pucchReqInfo->hqInfo.hqRes[2] = (hqCb->pdcch->nCce +
4103 cell->pucchCfg.n1PucchAn);
4109 case RG_SCH_A_VAL_4:
4111 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4112 {/* 2 and 3 for sec cell */
4113 pucchReqInfo->hqInfo.hqRes[2] =
4114 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
4115 pucchReqInfo->hqInfo.hqRes[3] =
4116 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
4118 else/* primary cell */
4119 {/* 0 and 1 are for primary cell */
4121 /* Need to consider only sps occasions */
4122 if (hqCb->spsN1PucchRes.pres)
4124 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
4125 pucchReqInfo->hqInfo.hqRes[1] = hqCb->spsN1PucchRes.val + 1;
4128 #endif /* LTEMAC_SPS */
4131 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
4132 cell->pucchCfg.n1PucchAn);
4133 pucchReqInfo->hqInfo.hqRes[1] = (hqCb->pdcch->nCce +
4134 cell->pucchCfg.n1PucchAn + 1);
4141 /* TOD:: Add error print */
4145 #endif/*TFU_UPGRADE*/
4156 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, ue,
4157 pucchRecpInfo, validIdx,isDatPresOnSecCell);
4159 /* Channel selection wil not be used in case of
4160 * CQI + HARQ. if the data was present only on
4162 if((isDatPresOnSecCell == FALSE) &&
4163 (dlSfHqInfo->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS))
4164 {/* Data is present only on primary cell */
4166 switch(pucchReqInfo->uciInfo)
4168 case TFU_PUCCH_HARQ_SRS:
4169 case TFU_PUCCH_HARQ_CQI:
4170 case TFU_PUCCH_HARQ_SR_SRS:
4171 case TFU_PUCCH_HARQ_SR_CQI:
4173 dlSfHqInfo->uciFrmtTyp = RG_SCH_UCI_FORMAT1A_1B;
4174 pucchReqInfo->hqInfo.hqSz = primCellTbCount;
4175 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
4184 #endif/*TFU_UPGRADE*/
4185 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4186 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4188 }/* end of rgSCHTomUtlFillHqFdbkForFrmt1B */
4189 /** @brief This function handles filling of Hq reception request to
4194 * Function:rgSCHTomUtlFillHqFdbkForFrmt3
4197 * Allocates the N1Pucch Resources based on teh A Value
4199 * @param [out] TfuRecpReqInfo *recpReqInfo
4200 * @param [in] RgSchCellCb *cell
4201 * @param [in] uint16_t validIdx,
4202 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
4203 * @param [in] RgSchDlSf *dlSf,
4204 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
4205 * @param [out] RgSchErrInfo *err
4213 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3
4215 TfuRecpReqInfo *recpReqInfo,
4218 RgSchDlHqInfo *dlSfHqInfo,
4220 TfuUeRecpReqInfo *pucchRecpInfo,
4224 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3 (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err)
4225 TfuRecpReqInfo *recpReqInfo;
4228 RgSchDlHqInfo *dlSfHqInfo;
4230 TfuUeRecpReqInfo *pucchRecpInfo;
4235 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3
4237 TfuRecpReqInfo *recpReqInfo,
4239 RgSchDlHqInfo *dlSfHqInfo,
4241 TfuUeRecpReqInfo *pucchRecpInfo,
4245 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3 (recpReqInfo, cell, hqCb, dlSf, pucchRecpInfo, err)
4246 TfuRecpReqInfo *recpReqInfo;
4248 RgSchDlHqInfo *dlSfHqInfo;
4250 TfuUeRecpReqInfo *pucchRecpInfo;
4256 Inst inst = cell->instIdx;
4261 TfuUePucchRecpReq *pucchReqInfo = NULLP;
4263 //hqPNode = dlSfHqInfo->hqPLst.first;
4264 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
4270 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4271 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
4274 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate "
4275 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId));
4276 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4279 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4280 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
4281 * instead of SPS-CRNTI */
4283 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
4286 pucchReqInfo->hqType = TFU_HQ_RECP_REQ_NORMAL;
4287 /* Handling of other types */
4288 pucchReqInfo->type = TFU_UCI_HARQ;
4289 #else /* TFU_UPGRADE */
4290 pucchReqInfo->uciInfo = TFU_PUCCH_HARQ;
4291 /* Fill hqFdbkMode by using uciFrmtTyp from dlSfHqInfo */
4292 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
4293 /* Fill HqSz by using totalTbCnt based on the TM mode and
4294 * the number of serv cells configured*/
4296 pucchReqInfo->hqInfo.hqSz = ue->f1bCsAVal;
4297 pucchReqInfo->hqInfo.pucchResCnt = 1;
4299 memset(pucchReqInfo->hqInfo.hqRes,0xff,sizeof(uint16_t)*TFU_MAX_HQ_RES);
4300 #endif/*TFU_UPGRADE*/
4301 pucchReqInfo->hqInfo.hqRes[0] = dlSfHqInfo->n3ScellPucch.n3PucchIdx;
4303 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, ue,
4304 pucchRecpInfo, validIdx,TRUE);
4305 #endif/*TFU_UPGRADE*/
4306 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4307 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4309 }/* end of rgSCHTomUtlFillHqFdbkForFrmt3 */
4313 /** @brief This function handles filling of HARQ feedback recption request to
4322 * @param [out] TfuRecpReqInfo *recpReqInfo
4323 * @param [in] RgSchCellCb *cell
4324 * @param [out] RgSchErrInfo *err
4331 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq
4333 TfuRecpReqInfo *recpReqInfo,
4339 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, validIdx, err)
4340 TfuRecpReqInfo *recpReqInfo;
4347 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq
4349 TfuRecpReqInfo *recpReqInfo,
4354 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, err)
4355 TfuRecpReqInfo *recpReqInfo;
4362 RgSchDlHqProcCb *hqCb;
4363 CmLteTimingInfo futTime;
4366 TfuUeRecpReqInfo *pucchRecpInfo = NULLP;
4368 RgSchDlHqProcCb *prvHqCb=NULLP;
4375 /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper output
4376 * if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME() as it is
4377 * serving the purpose */
4378 RGSCHDECRFRMCRNTTIME(cell->crntTime, futTime, (RG_SCH_CMN_HARQ_INTERVAL -
4379 TFU_RECPREQ_DLDELTA));
4380 dlSf = rgSCHUtlSubFrmGet (cell, futTime);
4381 /* Get the next dlsf as well */
4382 RG_SCH_ADD_TO_CRNT_TIME(futTime, futTime, 1)
4383 nxtDlsf = rgSCHUtlSubFrmGet (cell, futTime);
4387 if (dlSf->ueLst.count != 0)
4389 node = dlSf->ueLst.first;
4392 ue = (RgSchUeCb *)(node->node);
4395 if(ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx].isPuschHarqRecpPres == TRUE)
4396 {/* This UE is already considered for PUSCH
4400 rgSCHTomUtlFillHqFdbkFor5gtf(recpReqInfo, cell, validIdx,
4401 &ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx], dlSf, pucchRecpInfo, err);
4402 } /* end of while */
4403 } /* If hq is expected */
4405 if (dlSf->msg4HqPLst.count != 0)
4408 node = dlSf->msg4HqPLst.first;
4411 hqCb = (RgSchDlHqProcCb*)(node->node);
4413 //TODO_SID: need to check validIdx
4414 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, validIdx, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err);
4416 } /* end of while */
4419 /* Check with TDD Code */
4420 /* FOR ACK NACK REP */
4422 } /* end of rgSCHTomUtlFillHqFdbkRecpReq */
4424 /** @brief This function handles filling of SR reception request to
4433 * @param [out] TfuRecpReqInfo *recpReqInfo
4434 * @param [in] RgSchCellCb *cell
4435 * @param [out] RgSchErrInfo *err
4442 PRIVATE S16 rgSCHTomUtlFillSrRecpReq
4444 TfuRecpReqInfo *recpReqInfo,
4450 PRIVATE S16 rgSCHTomUtlFillSrRecpReq (recpReqInfo, cell, validIdx, err)
4451 TfuRecpReqInfo *recpReqInfo;
4458 TfuUeRecpReqInfo *pucchRecpInfo;
4464 RgSchCmnUlUeSpsInfo *ulSpsUe = NULL;
4470 node = cell->pCqiSrsSrLst[validIdx].srLst.first;
4473 ue = (RgSchUeCb *)(node->node);
4474 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4480 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4481 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4483 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4484 "TfuUeRecpReqInfo for cell RNTI:%d",ue->ueId);
4485 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4488 #ifdef TFU_ALLOC_EVENT_NO_INIT
4489 memset(&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4490 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4496 /* Should we check for Rel8 and above???
4497 * Dont send SR recp req if logicalChannelSR-Mask enabled and UL SPS is
4499 ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue, cell);
4500 /* Avoiding check for ulSpsEnabled as isUlSpsActv FALSE if sps is not enabled*/
4501 if((ue->ul.ulSpsCfg.isLcSRMaskEnab) &&
4502 (ulSpsUe->isUlSpsActv))
4504 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
4509 pucchRecpInfo->rnti = ue->ueId;
4510 pucchRecpInfo->t.pucchRecpReq.srInfo.n1PucchIdx =
4511 ue->srCb.srCfg.srSetup.srResIdx;
4512 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR;
4513 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
4514 rgSCHTomUtlFillCqiSrsWithSr(cell, ue, recpReqInfo,
4515 pucchRecpInfo, validIdx);
4517 isAddToLst = rgSCHEmtcAddRecpInfoToLst(NULLP,recpReqInfo, pucchRecpInfo,ue->isEmtcUe);
4521 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4523 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4526 }/* end of rgSCHTomUtlFillSrRecpReq */
4529 /** @brief This function tells will the UE has a periodic CQI/PMI/RI
4538 * @param [in] RgSchUeCb *ue
4539 * @param [out] Bool *willueRprtCqiRi
4546 PRIVATE S16 rgSCHTomUtlWillUeRprtCqiRi
4549 Bool *willueRprtCqiRi
4552 PRIVATE S16 rgSCHTomUtlWillUeRprtCqiRi ( ue, willueRprtCqiRi)
4554 Bool *willueRprtCqiRi;
4557 /* Intialising Reporting probability as TRUE */
4558 *willueRprtCqiRi = TRUE;
4560 /* Checking the cases in which UE will not report CQIPMI/RI */
4561 if(ue->isDrxEnabled && ue->drxCb)
4564 if(ue->drxCb->cqiMask.pres && ue->drxCb->cqiMask.val == RGR_DRX_SETUP)
4565 {/*cqiMask is setup by upper layers */
4566 if((ue->drxCb->drxUlInactvMask & RG_SCH_DRX_ONDUR_BITMASK) ==
4567 RG_SCH_DRX_ONDUR_BITMASK)
4568 {/*onDuration NOT running, do not expect cqi/pmi/ri*/
4569 *willueRprtCqiRi = FALSE;
4573 #endif /*end of LTEMAC_R9*/
4574 /* ccpu00134258: Fix for CQI DRX issue*/
4575 if(ue->drxCb->onDurTmrLen > 2)
4577 if ( !RG_SCH_DRX_UL_IS_UE_ACTIVE(ue->drxCb) )
4578 {/*UE is not active, do not expect cqi/pmi/ri*/
4579 *willueRprtCqiRi = FALSE;
4582 }/*ue->isDrxEnabled*/
4584 } /*End of rgSCHTomUtlWillUeRprtCqiRi*/
4586 /** @brief This function handles filling of RI reception request to
4595 * @param [out] TfuRecpReqInfo *recpReqInfo
4596 * @param [in] RgSchCellCb *cell
4597 * @param [in] uint16_t validIdx
4598 * @param [out] RgSchErrInfo *err
4605 PRIVATE S16 rgSCHTomUtlFillRiRecpReq
4607 TfuRecpReqInfo *recpReqInfo,
4613 PRIVATE S16 rgSCHTomUtlFillRiRecpReq (recpReqInfo, cell, validIdx, err)
4614 TfuRecpReqInfo *recpReqInfo;
4621 TfuUeRecpReqInfo *pucchRecpInfo;
4624 Bool willUeRprtCqi; /* Flag set due to CQI Mask
4625 and UE inactive state (DRX) */
4626 RgSchUePCqiCb *riCb = NULLP;
4628 node = cell->pCqiSrsSrLst[validIdx].riLst.first;
4631 riCb = (RgSchUePCqiCb *)(node->node);
4632 ue = riCb->servCellInfo->ue;
4633 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4635 if(riCb->riRecpPrcsd)
4637 /*ccpu00140578:: RI Proecssing is already done for this TTI
4638 * as part of PUSCH reception process or HARQ
4639 * Reception processing. Hence skipping this UE
4641 riCb->riRecpPrcsd = FALSE;
4644 if(riCb->riDist ==0)
4646 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
4647 #ifdef XEON_SPECIFIC_CHANGES
4648 if(RGSCH_TIMEINFO_SAME(cell->crntTime, ue->riRecpTime))
4654 if((TRUE == riCb->isRiIgnoByCollsn)
4655 || (willUeRprtCqi == FALSE))
4657 if(willUeRprtCqi == FALSE)
4660 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
4663 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4664 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4666 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4667 "TfuUeRecpReqInfo for cell RNTI:%d",ue->ueId);
4668 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4671 #ifdef TFU_ALLOC_EVENT_NO_INIT
4672 memset(&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4673 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4676 pucchRecpInfo->rnti = ue->ueId;
4677 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
4678 riCb->cqiCfg.cqiSetup.cqiPResIdx;
4679 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = riCb->riNumBits;
4680 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_CQI;
4681 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
4683 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
4684 riCb->servCellInfo->sCellIdx;
4686 rgSCHTomUtlFillRiBitWidthInfo(ue);
4687 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
4688 if (ue->nPCqiCb->nCqiTrIdx == validIdx)
4690 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, ue->nPCqiCb);
4692 if((ue->srsCb.nSrsTrIdx == validIdx) && (ue->srsCb.srsDist ==0))
4694 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
4696 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4697 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4705 }/* end of rgSCHTomUtlFillRiRecpReq */
4708 /** @brief This function handles filling of 5GTF CQI-RI reception request to
4717 * @param [out] TfuRecpReqInfo *recpReqInfo
4718 * @param [in] RgSchCellCb *cell
4719 * @param [in] uint16_t validIdx
4720 * @param [out] RgSchErrInfo *err
4728 PRIVATE S16 rgSCHTomUtlFillCqiRiRecpReq
4730 TfuRecpReqInfo *recpReqInfo,
4736 PRIVATE S16 rgSCHTomUtlFillCqiRiRecpReq (recpReqInfo, cell, validIdx, err)
4737 TfuRecpReqInfo *recpReqInfo;
4743 TfuUeRecpReqInfo *pucchRecpInfo;
4744 RgSchUeCb *ue = NULLP;
4747 while ((ue = rgSCHDbmGetNextUeCb(cell, ue)) != NULLP)
4749 if (RGSCH_TIMEINFO_SAME (recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn))
4751 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4752 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4754 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4755 "TfuUeRecpReqInfo for cell RNTI:%d ", ue->ueId);
4756 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4759 #ifdef TFU_ALLOC_EVENT_NO_INIT
4760 memset(&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4761 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4763 pucchRecpInfo->rnti = ue->ueId;
4764 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_XPUCCH_UCI_INFO;
4765 pucchRecpInfo->t.pucchRecpReq.uciPduInfo.pucchIndex = 0;
4766 pucchRecpInfo->t.pucchRecpReq.uciPduInfo.numBits = 5;
4768 RG_SCH_ADD_TO_CRNT_TIME(recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn,
4769 ue->ue5gtfCb.cqiRiPer);
4770 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4771 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4775 }/* end of rgSCHTomUtlFillCqiRiRecpReq */
4778 /** @brief This function handles filling of PCQI reception request to
4787 * @param [out] TfuRecpReqInfo *recpReqInfo
4788 * @param [in] RgSchCellCb *cell
4789 * @param [in] uint16_t validIdx
4790 * @param [out] RgSchErrInfo *err
4797 PRIVATE S16 rgSCHTomUtlFillPcqiRecpReq
4799 TfuRecpReqInfo *recpReqInfo,
4805 PRIVATE S16 rgSCHTomUtlFillPcqiRecpReq (recpReqInfo, cell, validIdx, err)
4806 TfuRecpReqInfo *recpReqInfo;
4813 TfuUeRecpReqInfo *pucchRecpInfo;
4817 uint8_t ri; /*RI value*/
4818 Bool willUeRprtCqi; /* Flag set due to CQI Mask
4819 and UE Inactive state (DRX)*/
4821 RgSchUePCqiCb *cqiCb = NULLP;
4822 Bool isAddToLst = FALSE;
4824 node = cell->pCqiSrsSrLst[validIdx].cqiLst.first;
4827 cqiCb = (RgSchUePCqiCb*)(node->node);
4828 ue = cqiCb->servCellInfo->ue;
4829 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4831 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
4833 if ((cqiCb->isCqiIgnoByCollsn == TRUE) ||
4834 (willUeRprtCqi == FALSE))
4836 if(willUeRprtCqi == FALSE)
4839 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
4843 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
4845 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
4846 cqiCb->servCellInfo->sCellIdx;
4848 cqiPmiSz = rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
4851 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to Fill CqiPmi "
4856 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4857 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4859 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4860 "TfuUeRecpReqInfo for cell RNTI:%d ", ue->ueId);
4861 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4864 #ifdef TFU_ALLOC_EVENT_NO_INIT
4865 memset(&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4866 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4869 /*Fill PCQI params*/
4870 pucchRecpInfo->rnti = ue->ueId;
4871 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
4872 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
4873 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = cqiPmiSz;
4874 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_CQI;
4875 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
4876 if((ue->srsCb.nSrsTrIdx == validIdx) && (ue->srsCb.srsDist ==0))
4878 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
4881 isAddToLst = rgSCHEmtcAddRecpInfoToLst(NULLP,recpReqInfo, pucchRecpInfo,ue->isEmtcUe);
4885 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4887 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4890 }/* end of rgSCHTomUtlFillPcqiRecpReq */
4891 /** @brief This function handles filling of SRS reception request to
4900 * @param [out] TfuRecpReqInfo *recpReqInfo
4901 * @param [in] RgSchCellCb *cell
4902 * @param [in] uint16_t validIdx
4903 * @param [out] RgSchErrInfo *err
4909 PRIVATE S16 rgSCHTomUtlFillSrsRecpReq
4911 TfuRecpReqInfo *recpReqInfo,
4917 PRIVATE S16 rgSCHTomUtlFillSrsRecpReq (recpReqInfo, cell, validIdx, err)
4918 TfuRecpReqInfo *recpReqInfo;
4925 TfuUeRecpReqInfo *pucchRecpInfo;
4929 node = cell->pCqiSrsSrLst[validIdx].srsLst.first;
4932 ue = (RgSchUeCb *)(node->node);
4933 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4935 if(ue->srsCb.srsRecpPrcsd)
4937 /* ccpu00140578::SRS Proecssing is already done for this TTI
4938 * as part of PUSCH or HARQ reception process and
4939 * hence skipping this UE */
4940 ue->srsCb.srsRecpPrcsd = FALSE;
4944 if(ue->srsCb.srsDist ==0)
4946 /* We need to add the recp request to be sent on the pucchANRep value. */
4947 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4948 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4950 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4951 "TfuUeRecpReqInfo for RNTI:%d ",ue->ueId);
4952 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4956 #ifdef TFU_ALLOC_EVENT_NO_INIT
4957 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4961 pucchRecpInfo->rnti = ue->ueId;
4962 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
4963 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
4964 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
4965 ue->srsCb.srsCfg.srsSetup.fDomPosi;
4966 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
4967 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
4968 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
4969 ue->srsCb.srsCfg.srsSetup.txComb;
4970 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
4971 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
4972 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
4973 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
4975 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SRS;
4976 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
4977 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4978 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4982 ue->srsCb.srsDist--;
4986 }/* end of rgSCHTomUtlFillSrsRecpReq */
4989 /** @brief This function handles filling of data reception requests for
4998 * @param [out] TfuRecpReqInfo *recpReqInfo
4999 * @param [in] RgSchCellCb *cell
5000 * @param [out] RgSchErrInfo *err
5006 PRIVATE S16 rgSCHTomUtlFillDatRecpReq
5008 TfuRecpReqInfo *recpReqInfo,
5013 PRIVATE S16 rgSCHTomUtlFillDatRecpReq (recpReqInfo, cell, err)
5014 TfuRecpReqInfo *recpReqInfo;
5020 RgSchUlAlloc *alloc;
5021 TfuUeRecpReqInfo *datRecpInfo;
5024 /* processing steps are
5025 * - Run through the UL allocations going out in this subframe.
5026 * - Run through the UL receptions expected the next subframe.
5028 alloc = rgSCHUtlFirstRcptnReq (cell);
5031 /* FOR ACK NACK REP */
5032 if (NULLP != alloc->ue)
5034 /* If measuring or ackNakRep we shall not send dat RecpReq */
5035 if ((alloc->ue->measGapCb.isMeasuring == TRUE) ||
5036 (alloc->ue->ackNakRepCb.isAckNakRep == TRUE))
5038 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
5043 if ((ret = rgSCHUtlGetEventMem((Ptr *)&datRecpInfo,
5044 sizeof(TfuUeRecpReqInfo),
5045 &(recpReqInfo->memCp))) != ROK)
5047 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
5048 "TfuUeRecpReqInfo for RNTI:%d ", alloc->ue->ueId);
5049 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
5052 if (!alloc->forMsg3)
5054 datRecpInfo->type = TFU_RECP_REQ_PUSCH;
5055 rgSCHUtlAllocRcptInfo (alloc,
5057 &datRecpInfo->t.puschRecpReq.mcs,
5058 &datRecpInfo->t.puschRecpReq.rbStart,
5059 &datRecpInfo->t.puschRecpReq.numRb,
5060 &datRecpInfo->t.puschRecpReq.rv,
5061 &datRecpInfo->t.puschRecpReq.size,
5062 &datRecpInfo->t.puschRecpReq.modType,
5063 &datRecpInfo->t.puschRecpReq.isRtx,
5064 &datRecpInfo->t.puschRecpReq.nDmrs,
5065 &datRecpInfo->t.puschRecpReq.ndi,
5066 &datRecpInfo->t.puschRecpReq.harqProcId
5071 datRecpInfo->type = TFU_RECP_REQ_MSG3;
5072 rgSCHUtlAllocRcptInfo (alloc,
5074 &datRecpInfo->t.msg3RecpReq.mcs,
5075 &datRecpInfo->t.msg3RecpReq.rbStart,
5076 &datRecpInfo->t.msg3RecpReq.numRb,
5077 /*ccpu00128993 - MOD - fix for msg3 softcombining bug*/
5078 &datRecpInfo->t.msg3RecpReq.rv,
5079 &datRecpInfo->t.msg3RecpReq.size,
5080 &datRecpInfo->t.msg3RecpReq.modType,
5081 &datRecpInfo->t.msg3RecpReq.isRtx,
5082 &datRecpInfo->t.msg3RecpReq.nDmrs,
5083 &datRecpInfo->t.msg3RecpReq.ndi,
5084 &datRecpInfo->t.msg3RecpReq.harqProcId
5088 /* Other fields of datRecpInfo shall be filled
5089 * here for new features */
5090 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(datRecpInfo->lnk));
5091 datRecpInfo->lnk.node = (PTR)datRecpInfo;
5093 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
5094 } /* end of while */
5096 } /* end of rgSCHTomUtlFillDatRecpReq */
5099 /** @brief This function handles filling of data reception requests for
5108 * @param [out] TfuRecpReqInfo *recpReqInfo
5109 * @param [in] RgSchCellCb *cell
5110 * @param [in] uint16_t validIdx
5111 * @param [out] RgSchErrInfo *err
5117 PRIVATE S16 rgSCHTomUtlFillDatRecpReq
5119 TfuRecpReqInfo *recpReqInfo,
5125 PRIVATE S16 rgSCHTomUtlFillDatRecpReq (recpReqInfo, cell, validIdx, err)
5126 TfuRecpReqInfo *recpReqInfo;
5132 CmLteTimingInfo dci0Time;
5135 RgSchUlAlloc *alloc;
5136 TfuUeRecpReqInfo *datRecpInfo;
5138 Bool isAperiodic = FALSE; /*Set when Aperiodic CQI is expected */
5139 uint8_t numUePerTti = 0;
5141 if((0 == (recpReqInfo->timingInfo.sfn % 30)) && (0 == recpReqInfo->timingInfo.slot))
5143 //printf("5GTF_CHECK rgSCHTomUtlFillDatRecpReq (%d : %d)\n", recpReqInfo->timingInfo.sfn, recpReqInfo->timingInfo.slot);
5145 /* processing steps are
5146 * - Run through the UL allocations going out in this subframe.
5147 * - Run through the UL receptions expected the next subframe.
5150 alloc = rgSCHUtlFirstRcptnReq (cell);
5153 isAperiodic = FALSE;
5154 ret = rgSCHUtlGetEventMem((Ptr *)&datRecpInfo,
5155 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
5158 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
5159 "TfuUeRecpReqInfo for RNTI:%d ", alloc->rnti);
5160 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
5163 #ifdef TFU_ALLOC_EVENT_NO_INIT
5164 datRecpInfo->t.puschRecpReq.initialNSrs.pres = FALSE;
5165 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = FALSE;
5167 datRecpInfo->type = TFU_RECP_REQ_PUSCH;
5168 /* Check if this if for MSG3 - no scope for feedback along with it. */
5169 if ((FALSE == alloc->forMsg3))
5171 /* Check if any DL HARQ processes has a feedback coming at the time of
5172 * this reception request.
5177 RGSCHDECRFRMCRNTTIME(cell->crntTime,dci0Time,(RGSCH_ULCTRL_RECP_DIST));
5179 idx = (dci0Time.sfn * RGSCH_NUM_SUB_FRAMES_5G + dci0Time.slot)%
5180 RGSCH_ULCTRL_RECP_DIST;
5182 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA;
5183 datRecpInfo->rnti = alloc->rnti;
5184 rgSCHUtlAllocRcptInfo (cell,alloc, &recpReqInfo->timingInfo,
5185 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5188 else /*Enters for Msg3 == TRUE condition*/
5190 /* ccpu00130884 - ADD - HO case when Msg3 alloc and Cqi/Ri/SRS opportunity
5191 * occur at same time */
5192 if(NULLP != alloc->ue)
5195 /* Only DATA is expected */
5196 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA;
5197 datRecpInfo->rnti = alloc->rnti;
5198 rgSCHUtlAllocRcptInfo (cell,alloc, &recpReqInfo->timingInfo,
5199 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5204 if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA &&
5205 datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_SRS &&
5206 isAperiodic == FALSE)
5208 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = TRUE;
5209 datRecpInfo->t.puschRecpReq.initialNumRbs.val = alloc->ue->initNumRbs;
5213 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = FALSE;
5216 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(datRecpInfo->lnk));
5217 datRecpInfo->lnk.node = (PTR)datRecpInfo;
5218 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
5220 } /* end of while */
5222 if(numUePerTti && (numUePerTti < RG_MAX_NUM_UE_PER_TTI))
5224 cell->ulNumUeSchedPerTti[numUePerTti-1]++;
5225 gUlNumUePerTti[numUePerTti - 1]++;
5228 } /* end of rgSCHTomUtlFillDatRecpReq */
5230 /* rg009.201. Added changes of TFU_UPGRADE */
5232 /***********************************************************
5234 * Func : rgSCHTomUtlFillRiBitWidthInfo
5237 * Desc : Fills the RI BitWidth and stores it for decoding.
5246 **********************************************************/
5248 S16 rgSCHTomUtlFillRiBitWidthInfo
5253 S16 rgSCHTomUtlFillRiBitWidthInfo(ueCb)
5257 RgSchUePCqiCb *riCb = ueCb->nPRiCb;
5259 if (ueCb->mimoInfo.txMode != RGR_UE_TM_3 &&
5260 ueCb->mimoInfo.txMode != RGR_UE_TM_4)
5265 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUCCH;
5266 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode=
5267 (TfuDlCqiPucchMode)riCb->cqiCfg.cqiSetup.prdModeEnum;
5268 switch(ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode)
5270 case TFU_PUCCH_CQI_MODE10:
5271 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info.type = TFU_RPT_RI;
5272 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info.u.ri =
5275 case TFU_PUCCH_CQI_MODE11:
5276 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info.type = TFU_RPT_RI;
5277 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info.u.ri =
5280 case TFU_PUCCH_CQI_MODE20:
5281 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info.type = TFU_RPT_RI;
5282 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info.u.ri =
5285 case TFU_PUCCH_CQI_MODE21:
5286 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info.type = TFU_RPT_RI;
5287 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info.u.ri =
5294 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5298 /***********************************************************
5300 * Func : rgSCHTomUtlFetchPcqiBitSz
5303 * Desc : Fetch the CQI/PMI bits for a UE based on the mode, periodicity.
5312 **********************************************************/
5314 uint8_t rgSCHTomUtlFetchPcqiBitSz
5321 uint8_t rgSCHTomUtlFetchPcqiBitSz(ueCb, numTxAnt, ri)
5327 uint8_t confRepMode;
5329 TfuCqiPucchMode10 *mode10Info;
5330 TfuCqiPucchMode11 *mode11Info;
5331 TfuCqiPucchMode20 *mode20Info;
5332 TfuCqiPucchMode21 *mode21Info;
5333 RgSchUePCqiCb *cqiCb = ueCb->nPCqiCb;
5336 confRepMode = cqiCb->cqiCfg.cqiSetup.prdModeEnum;
5337 if((ueCb->mimoInfo.txMode != RGR_UE_TM_3) &&
5338 (ueCb->mimoInfo.txMode != RGR_UE_TM_4))
5344 *ri = cqiCb->perRiVal;
5346 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUCCH;
5347 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode=
5348 (TfuDlCqiPucchMode)confRepMode;
5351 case RGR_PRD_CQI_MOD10:
5353 mode10Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info;
5355 mode10Info->type = TFU_RPT_CQI;
5356 mode10Info->u.cqi = 4;
5360 case RGR_PRD_CQI_MOD11:
5362 mode11Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info;
5363 mode11Info->type = TFU_RPT_CQI;
5369 mode11Info->u.cqi.cqi = 4;
5370 mode11Info->u.cqi.wideDiffCqi.pres = FALSE;
5371 mode11Info->u.cqi.pmi = 2;
5376 mode11Info->u.cqi.cqi = 4;
5377 mode11Info->u.cqi.wideDiffCqi.pres = TRUE;
5378 mode11Info->u.cqi.wideDiffCqi.val = 3;
5379 mode11Info->u.cqi.pmi = 1;
5382 else if(numTxAnt == 4)
5387 mode11Info->u.cqi.cqi = 4;
5388 mode11Info->u.cqi.wideDiffCqi.pres = FALSE;
5389 mode11Info->u.cqi.pmi = 4;
5394 mode11Info->u.cqi.cqi = 4;
5395 mode11Info->u.cqi.wideDiffCqi.pres = TRUE;
5396 mode11Info->u.cqi.wideDiffCqi.val = 3;
5397 mode11Info->u.cqi.pmi = 4;
5402 /* This is number of antenna case 1.
5403 * This is not applicable for Mode 1-1.
5404 * So setting it to invalid value */
5410 case RGR_PRD_CQI_MOD20:
5412 mode20Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info;
5413 mode20Info->type = TFU_RPT_CQI;
5417 mode20Info->u.cqi.isWideband = TRUE;
5418 mode20Info->u.cqi.u.wideCqi = 4;
5422 pcqiSz = 4 + cqiCb->label;
5423 mode20Info->u.cqi.isWideband = FALSE;
5424 mode20Info->u.cqi.u.subCqi.cqi = 4;
5425 mode20Info->u.cqi.u.subCqi.l = cqiCb->label;
5430 case RGR_PRD_CQI_MOD21:
5432 mode21Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info;
5433 mode21Info->type = TFU_RPT_CQI;
5434 //pcqiSz = rgSCHTomUtlFetchPcqiBitSzPucchMode21(ueCb,
5435 // mode21Info, numTxAnt, ri);
5443 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5448 /***********************************************************
5450 * Func : rgSCHTomUtlPcqiSbCalcBpIdx
5453 * Desc : Determines the BP index from the timing info
5462 **********************************************************/
5464 S16 rgSCHTomUtlPcqiSbCalcBpIdx
5466 CmLteTimingInfo crntTimInfo,
5468 RgSchUePCqiCb *cqiCb
5471 S16 rgSCHTomUtlPcqiSbCalcBpIdx(crntTimInfo, ueCb, cqiCb)
5472 CmLteTimingInfo crntTimInfo;
5474 RgSchUePCqiCb *cqiCb;
5477 uint16_t tti = (crntTimInfo.sfn * RGSCH_NUM_SUB_FRAMES_5G + crntTimInfo.slot);
5478 uint16_t prdNum = tti/cqiCb->cqiPeri;
5480 if((prdNum % cqiCb->h) == 0)
5484 cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_1;
5489 cqiCb->isWb = FALSE;
5490 cqiCb->bpIdx = ((prdNum % cqiCb->h) - 1) % cqiCb->J;
5492 cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_0;
5500 * @brief Function which moves PCQI, RI, SR and SRS to next periodicity
5501 * Occasions as that needs to be done in case of Ack/Nack repetition
5502 * reception request occasions or during Measurement Gap occasions.
5506 * Function: rgSCHTomUtlMoveNxtOccasion
5508 * Function which moves PCQI, RI, SR and SRS to next perodicity
5509 * Occasions as that needs to be done in case of Ack/Nack repetition
5510 * reception request occasions or during Measurement Gap occasions.
5512 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5515 * - Check whether the current Tx Instance matches with the rec req time
5516 * - If true, then move them to their next Tx Instance
5518 * @param[in] RgSchCellCb *cell,
5526 S16 rgSCHTomUtlMoveNxtOccasion
5533 S16 rgSCHTomUtlMoveNxtOccasion(cell, ue, validIdx)
5539 RgSchUePCqiCb *cqiCb = ue->nPCqiCb;
5540 RgSchUePCqiCb *riCb = ue->nPRiCb;
5542 /* ccpu00140578::Skip the UE if already RI recpetion
5543 * is processed in the same subframe */
5544 if ((riCb->nRiTrIdx == validIdx) &&
5545 (riCb->riRecpPrcsd == FALSE))
5547 if(riCb->riDist ==0)
5549 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
5555 /* ccpu00140578:: As this UE is considered for this TTI
5556 * Same UE should not get processed for RI reception
5557 * or for updating th RI distance.*/
5558 if(riCb->nRiTrIdx == validIdx)
5560 riCb->riRecpPrcsd = TRUE;
5563 if (cqiCb->nCqiTrIdx == validIdx)
5565 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
5568 /* ccpu00140578::Skip the UE if SRS recpetion
5569 * is already processed in the same subframe */
5570 if ((ue->srsCb.nSrsTrIdx == validIdx) &&
5571 (ue->srsCb.srsRecpPrcsd == FALSE))
5573 if(ue->srsCb.srsDist ==0)
5575 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
5579 ue->srsCb.srsDist--;
5581 /* ccpu00140578:: As this UE is considered for this TTI
5582 * Same UE should not get processed for SRS reception
5583 * or for updating th SRS distance.*/
5584 if(ue->srsCb.nSrsTrIdx == validIdx)
5586 ue->srsCb.srsRecpPrcsd = TRUE;
5589 if (ue->srCb.nSrTrIdx == validIdx)
5591 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
5594 } /* rgSCHTomUtlMoveNxtOccasion */
5597 /***********************************************************
5599 * Func : rgSCHTomPrepareAcqiRecp
5602 * Desc : Fetch the CQI/PMI bits for a UE based on the mode and store them
5603 * for decoding. Fill RECP request and prepare the scartchpad
5604 * to aid decoding of Aperiodic CQI.
5613 **********************************************************/
5615 Void rgSCHTomPrepareAcqiRecp
5619 TfuUePuschCqiRecpInfo *cqiRecpReqInfo,
5623 Void rgSCHTomPrepareAcqiRecp(ueCb, cell, cqiRecpReqInfo, ccIdx)
5626 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
5630 uint8_t confRepMode;
5631 RgSchCqiRawPuschMode12 *mode12Info;
5632 RgSchCqiRawPuschMode20 *mode20Info;
5633 RgSchCqiRawPuschMode22 *mode22Info;
5634 RgSchCqiRawPuschMode30 *mode30Info;
5635 RgSchCqiRawPuschMode31 *mode31Info;
5636 uint8_t numTxAnt = cell->numTxAntPorts;
5637 uint8_t sCellIdx = ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)];
5638 uint8_t numOfCells = 0;
5639 RgSchUeACqiCb *acqiCb = &ueCb->cellInfo[sCellIdx]->acqiCb;
5642 cqiRecpReqInfo->reportType = TFU_APERIODIC_CQI_TYPE; /* Aperiodic */
5643 if (ueCb->mimoInfo.txMode == RGR_UE_TM_3 ||
5644 ueCb->mimoInfo.txMode == RGR_UE_TM_4)
5646 cqiRecpReqInfo->riSz[ccIdx].pres = TRUE;
5647 cqiRecpReqInfo->riSz[ccIdx].val = acqiCb->riNumBits;
5649 /* This flag will be rmeoved after making changes in BRDCM CL
5650 * Sachin is doing the change
5652 #if (defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
5654 cqiRecpReqInfo->cqiPmiSzR1[ccIdx] = acqiCb->cqiPmiSzR1;
5655 cqiRecpReqInfo->cqiPmiSzRn1[ccIdx] = acqiCb->cqiPmiSzRn1;
5657 if(ueCb->nPCqiCb->perRiVal == 1)
5659 cqiRecpReqInfo->cqiPmiSzR1[ccIdx] = acqiCb->cqiPmiSzR1;
5663 cqiRecpReqInfo->cqiPmiSzRn1[ccIdx] = acqiCb->cqiPmiSzRn1;
5666 /* Fill scratchpad to aid decoding of aper CQI upon
5668 confRepMode = acqiCb->aCqiCfg.aprdModeEnum;
5669 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUSCH;
5671 numOfCells = ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells;
5673 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5674 puschRawCqiInfo.mode = (TfuDlCqiPuschMode)confRepMode;
5676 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5677 puschRawCqiInfo.ri.pres = cqiRecpReqInfo->riSz[ccIdx].pres;
5679 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5680 puschRawCqiInfo.ri.val = cqiRecpReqInfo->riSz[ccIdx].val;
5682 /* Setting the sCellIdx */
5683 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5684 sCellIdx = sCellIdx;
5688 case RGR_APRD_CQI_MOD12:
5690 mode12Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5691 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode12Info;
5692 mode12Info->wideBCqiCw0 = 4;
5693 mode12Info->r1WideBCqiCw1 = 0;
5694 mode12Info->rg1WideBCqiCw1 = 4;
5697 mode12Info->r1TotalPmiBitLen = 2*acqiCb->N;
5698 mode12Info->rg1TotalPmiBitLen = acqiCb->N;
5700 else if(numTxAnt == 4)
5702 mode12Info->r1TotalPmiBitLen = 4*acqiCb->N;
5703 mode12Info->rg1TotalPmiBitLen = 4*acqiCb->N;
5708 case RGR_APRD_CQI_MOD20:
5710 mode20Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5711 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode20Info;
5712 mode20Info->wideBCqiCw = 4;
5713 mode20Info->subBandDiffCqi = 2;
5714 mode20Info->posOfM = acqiCb->L;
5718 case RGR_APRD_CQI_MOD22:
5720 mode22Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5721 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode22Info;
5722 mode22Info->wideBCqiCw0 = 4;
5723 mode22Info->sBDiffCqiCw0 = 2;
5724 mode22Info->r1WideBCqiCw1 = 0;
5725 mode22Info->r1SbDiffCqiCw1 = 0;
5726 mode22Info->rg1WideBCqiCw1 = 4;
5727 mode22Info->rg1SbDiffCqiCw1 = 2;
5728 mode22Info->posOfM = acqiCb->L;
5731 mode22Info->r1PmiBitLen = 4;
5732 mode22Info->rg1PmiBitLen = 2;
5734 else if(numTxAnt == 4)
5736 mode22Info->r1PmiBitLen = 8;
5737 mode22Info->rg1PmiBitLen = 8;
5742 case RGR_APRD_CQI_MOD30:
5744 mode30Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5745 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode30Info;
5746 mode30Info->wideBCqiCw = 4;
5747 mode30Info->totLenSbDiffCqi = 2*acqiCb->N;
5751 case RGR_APRD_CQI_MOD31:
5753 mode31Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5754 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode31Info;
5755 mode31Info->wideBCqiCw0 = 4;
5756 mode31Info->totLenSbDiffCqiCw0 = 2*acqiCb->N;
5757 mode31Info->r1WideBCqiCw1 = 0;
5758 mode31Info->r1TotLenSbDiffCqiCw1 =0;
5759 mode31Info->rg1WideBCqiCw1 = 4;
5760 mode31Info->rg1TotLenSbDiffCqiCw1 = 2*acqiCb->N;
5763 mode31Info->r1PmiBitLen = 2;
5764 mode31Info->rg1PmiBitLen = 1;
5766 else if(numTxAnt == 4)
5768 mode31Info->r1PmiBitLen = 4;
5769 mode31Info->rg1PmiBitLen = 4;
5780 * @brief Function which handles the filling of Aperiodic CQI/RI reception
5785 * Function: rgSCHTomUtlFillDatAperRecpReq
5787 * Function which handles the filling of Aperiodic CQI/RI reception
5790 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5793 * - Fill the reception request for the data arriving on the ULSCH
5794 * - Fill the reception request information for the Aperiodic CQI/PMI/RI
5796 * @param[in] RgSchCellCb *cell,
5797 * RgSchUlAlloc *alloc,
5798 * TfuUeRecpReqInfo *datRecpInfo,
5799 * CmLteTimingInfo *timeInfo,
5806 S16 rgSCHTomUtlFillDatAperRecpReq
5810 RgSchUlAlloc *alloc,
5811 TfuUeRecpReqInfo *datRecpInfo,
5812 CmLteTimingInfo *timeInfo,
5817 S16 rgSCHTomUtlFillDatAperRecpReq(cell, cqiReq, alloc, datRecpInfo, timeInfo, hqPres, validIdx)
5820 RgSchUlAlloc *alloc;
5821 TfuUeRecpReqInfo *datRecpInfo;
5822 CmLteTimingInfo *timeInfo;
5827 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
5828 RgSchUeCb *ueCb = alloc->ue;
5830 uint8_t triggerSet = 0;
5834 /*Fill RI Reception Params*/
5835 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
5836 cqiRecpReqInfo->riBetaOff = alloc->ue->ul.betaRiOffst;
5837 cqiRecpReqInfo->cqiBetaOff = alloc->ue->ul.betaCqiOffst;
5840 cqiRecpReqInfo->cCNum = 0;
5841 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells = 0;
5844 rgSCHTomUtlGetTrigSet(cell, ueCb, cqiReq, &triggerSet);
5845 for (sIdx = 0; sIdx < CM_LTE_MAX_CELLS; sIdx++)
5847 /* The Aperiodic request for SCell index sIdx */
5848 if ((triggerSet >> (7 - sIdx)) & 0x01)
5850 /* The Aperiodic request for SCell index sIdx */
5851 rgSCHTomPrepareAcqiRecp(ueCb, ueCb->cellInfo[sIdx]->cell, cqiRecpReqInfo, cqiRecpReqInfo->cCNum);
5852 cqiRecpReqInfo->cCNum++;
5853 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells++;
5857 rgSCHTomPrepareAcqiRecp(ueCb, ueCb->cellInfo[0]->cell, cqiRecpReqInfo, cqiRecpReqInfo->cCNum);
5858 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells++;
5861 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5863 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
5865 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
5866 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
5870 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
5872 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
5876 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
5878 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
5880 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
5882 datRecpInfo->rnti = alloc->rnti;
5883 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
5884 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5886 } /* rgSCHTomUtlFillDatAperRecpReq */
5891 * @brief Function which handles the filling of Periodic RI reception
5892 * request values which arrives along with UL Data on ULSCH
5896 * Function: rgSCHTomUtlFillDatPriRecpReq
5898 * Function which handles the filling of Periodic RI reception
5899 * request values which arrives along with UL Data on ULSCH
5901 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5904 * - Fill the reception request for the data arriving on the ULSCH
5905 * - Fill the reception request information for the Periodic RI
5907 * @param[in] RgSchCellCb *cell,
5908 * RgSchUlAlloc *alloc,
5909 * TfuUeRecpReqInfo *datRecpInfo,
5910 * CmLteTimingInfo *timeInfo,
5917 S16 rgSCHTomUtlFillDatPriRecpReq
5920 RgSchUlAlloc *alloc,
5921 TfuUeRecpReqInfo *datRecpInfo,
5922 CmLteTimingInfo *timeInfo,
5927 S16 rgSCHTomUtlFillDatPriRecpReq(cell, alloc, datRecpInfo, timeInfo,
5930 RgSchUlAlloc *alloc;
5931 TfuUeRecpReqInfo *datRecpInfo;
5932 CmLteTimingInfo *timeInfo;
5937 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
5939 /*Fill RI Reception Params*/
5940 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
5941 #ifdef TFU_ALLOC_EVENT_NO_INIT
5942 cqiRecpReqInfo->cqiBetaOff = 0;
5943 /* Fill only the first RI index since Periodic can come
5945 cqiRecpReqInfo->cqiPmiSzR1[0] = 0;
5946 cqiRecpReqInfo->cqiPmiSzRn1[0] = 0;
5948 cqiRecpReqInfo->reportType = TFU_PERIODIC_CQI_TYPE; /* periodic */
5949 cqiRecpReqInfo->riBetaOff = alloc->ue->ul.betaRiOffst;
5951 /* Fill only the first RI index since Periodic can come
5953 cqiRecpReqInfo->cCNum = 1;
5954 cqiRecpReqInfo->riSz[0].pres = TRUE;
5955 cqiRecpReqInfo->riSz[0].val = alloc->ue->nPRiCb->riNumBits;
5957 rgSCHTomUtlFillRiBitWidthInfo(alloc->ue);
5958 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
5960 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
5961 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
5965 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
5967 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
5971 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
5973 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
5975 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
5977 datRecpInfo->rnti = alloc->rnti;
5978 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
5979 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5981 } /* rgSCHTomUtlFillDatPriRecpReq */
5985 * @brief Function which handles the filling of Periodic CQI/PMI reception
5986 * request values which arrives along with UL Data on ULSCH
5990 * Function: rgSCHTomUtlFillDatPCqiRecpReq
5992 * Function which handles the filling of Periodic CQI/PMI reception
5993 * request values which arrives along with UL Data on ULSCH
5995 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5998 * - Fill the reception request for the data arriving on the ULSCH
5999 * - Fill the reception request information for the Periodic CQI/PMI
6001 * @param[in] RgSchCellCb *cell,
6002 * RgSchUlAlloc *alloc,
6003 * TfuUeRecpReqInfo *datRecpInfo,
6004 * CmLteTimingInfo *timeInfo,
6012 S16 rgSCHTomUtlFillDatPCqiRecpReq
6015 RgSchUlAlloc *alloc,
6016 TfuUeRecpReqInfo *datRecpInfo,
6017 CmLteTimingInfo *timeInfo,
6022 S16 rgSCHTomUtlFillDatPCqiRecpReq(cell, alloc, datRecpInfo,
6023 timeInfo, hqPres, validIdx)
6025 RgSchUlAlloc *alloc;
6026 TfuUeRecpReqInfo *datRecpInfo;
6027 CmLteTimingInfo *timeInfo;
6032 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
6033 uint8_t cqiPmiSz; /*Raw CQI/PMI Size*/
6036 /*Fill CQI Reception Params*/
6037 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
6038 #ifdef TFU_ALLOC_EVENT_NO_INIT
6039 cqiRecpReqInfo->riBetaOff = 0;
6041 cqiRecpReqInfo->cqiBetaOff = alloc->ue->ul.betaCqiOffst;
6042 cqiPmiSz = rgSCHTomUtlFetchPcqiBitSz(alloc->ue, cell->numTxAntPorts, &ri);
6045 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Fill "
6046 "CqiPmi size RNTI:%d",alloc->rnti);
6050 /* Fill only the first RI index since Periodic can come
6052 cqiRecpReqInfo->cCNum = 1;
6053 cqiRecpReqInfo->reportType = TFU_PERIODIC_CQI_TYPE; /* Periodic */
6054 /* This flags will be removed once Sachin does changes
6056 #if (defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
6057 cqiRecpReqInfo->cqiPmiSzR1[0] = cqiPmiSz;
6058 cqiRecpReqInfo->cqiPmiSzRn1[0] = cqiPmiSz;
6062 cqiRecpReqInfo->cqiPmiSzR1[0] = cqiPmiSz;
6063 cqiRecpReqInfo->cqiPmiSzRn1[0] = 0;
6067 cqiRecpReqInfo->cqiPmiSzRn1[0] = cqiPmiSz;
6068 cqiRecpReqInfo->cqiPmiSzR1[0] = 0;
6071 cqiRecpReqInfo->riSz[0].pres = FALSE;
6073 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
6075 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
6076 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
6079 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
6081 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
6085 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
6087 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
6089 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
6091 datRecpInfo->rnti = alloc->rnti;
6092 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
6093 &datRecpInfo->t.puschRecpReq.ulSchInfo);
6095 } /* rgSCHTomUtlFillDatPCqiRecpReq */
6098 * @brief Function which handles the filling of SRS reception
6099 * request values which arrives along with UL Data on ULSCH
6103 * Function: rgSCHTomUtlFillDatSrsRecpReq
6105 * Function which handles the filling of SRS reception
6106 * request values which arrives along with UL Data on ULSCH
6108 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
6111 * - Fill the reception request for the data arriving on the ULSCH
6112 * - Fill the reception request information for the SRS
6114 * @param[in] RgSchCellCb *cell,
6115 * RgSchUlAlloc *alloc,
6116 * TfuUeRecpReqInfo *datRecpInfo,
6117 * CmLteTimingInfo *timeInfo,
6124 S16 rgSCHTomUtlFillDatSrsRecpReq
6127 RgSchUlAlloc *alloc,
6128 TfuUeRecpReqInfo *datRecpInfo,
6129 CmLteTimingInfo *timeInfo,
6133 S16 rgSCHTomUtlFillDatSrsRecpReq(cell, alloc, datRecpInfo, timeInfo,
6136 RgSchUlAlloc *alloc;
6137 TfuUeRecpReqInfo *datRecpInfo;
6138 CmLteTimingInfo *timeInfo;
6142 datRecpInfo->rnti = alloc->rnti;
6143 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
6146 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_HARQ_SRS;
6150 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_SRS;
6152 datRecpInfo->rnti = alloc->rnti;
6153 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
6154 &datRecpInfo->t.puschRecpReq.ulSchInfo);
6156 } /* rgSCHTomUtlFillDatSrsRecpReq */
6159 * @brief Function which handles the filling of only SRS reception
6160 * request values on ULSCH
6164 * Function: rgSCHTomFillOnlySrsRecpReq
6166 * Function which handles the filling of SRS reception
6167 * request values which arrives along with UL Data on ULSCH
6169 * Invoked by: rgSCHTomUtlFillDatSrsRecpReq of rg_sch_tom.c
6172 * - Fill the reception request for the data arriving on the ULSCH
6173 * - Fill the reception request information for the SRS
6175 * @param[in] RgSchCellCb *cell,
6176 * RgSchUlAlloc *alloc,
6177 * TfuUeRecpReqInfo *datRecpInfo,
6183 S16 rgSCHTomFillOnlySrsRecpReq
6186 RgSchUlAlloc *alloc,
6187 TfuUeRecpReqInfo *datRecpInfo
6190 S16 rgSCHTomFillOnlySrsRecpReq(cell, alloc, datRecpInfo)
6192 RgSchUlAlloc *alloc;
6193 TfuUeRecpReqInfo *datRecpInfo;
6196 TfuUePuschSrsRecpInfo *srsRecpReqInfo;
6198 srsRecpReqInfo = &datRecpInfo->t.puschRecpReq.srsInfo;
6199 srsRecpReqInfo->srsBw = (TfuUlSrsBwInfo)alloc->ue->srsCb.srsCfg.srsSetup.srsBw;
6200 srsRecpReqInfo->nRrc = alloc->ue->srsCb.srsCfg.srsSetup.fDomPosi;
6201 srsRecpReqInfo->srsHopBw = (TfuUlSrsHoBwInfo)alloc->ue->srsCb.srsCfg.srsSetup.srsHopBw;
6202 srsRecpReqInfo->transComb = alloc->ue->srsCb.srsCfg.srsSetup.txComb;
6203 srsRecpReqInfo->srsCfgIdx = alloc->ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6204 srsRecpReqInfo->srsCyclicShft = (TfuUlSrsCycShiftInfo)alloc->ue->srsCb.srsCfg.srsSetup.cycShift;
6206 /* ccpu00117050 - ADD - nSrs setting
6207 * Refer Section 5.2.2.6 of TS 36.212 V8.5.0*/
6208 datRecpInfo->t.puschRecpReq.ulSchInfo.nSrs = 1;
6211 } /* rgSCHTomFillOnlySrsRecpReq */
6214 * @brief Function which handles the filling of PCQI/RI, SRS and SR
6215 * Reception Request Information along
6216 * with the HARQ reception Request
6220 * Function: rgSCHTomUtlFillCqiSrSrsWithHq
6222 * Function which handles the filling of PCQI/RI, SRS ans SR
6223 * Reception Request Information along
6224 * with the HARQ reception Request
6227 * Invoked by: rgSCHTomUtlFillHqFdbkRecpReq &
6228 * rgSCHTomUtlFillSfHqFdbk of rg_sch_tom.c
6231 * - Fill the reception request for the Control Info arriving on the PUCCH
6232 * - Fill the reception request information for the SR, RI, CQI, SRS
6234 * @param[in] RgSchCellCb *cell,
6235 * TfuRecpReqInfo *recpReqInfo,
6236 * RgSchDlHqProcCb *hqCb,
6237 * @param[out] TfuUeRecpReqInfo *pucchRecpInfo
6238 * @param[in] uint16_t validIdx
6244 PRIVATE S16 rgSCHTomUtlFillCqiSrSrsWithHq
6247 TfuRecpReqInfo *recpReqInfo,
6249 TfuUeRecpReqInfo *pucchRecpInfo,
6251 Bool isDatPresOnSecCell
6254 PRIVATE S16 rgSCHTomUtlFillCqiSrSrsWithHq(cell, recpReqInfo, ue,
6255 pucchRecpInfo, validIdx,isDatPresOnSecCell)
6257 TfuRecpReqInfo *recpReqInfo;
6259 TfuUeRecpReqInfo *pucchRecpInfo;
6261 Bool isDatPresOnSecCell;
6264 RgSchUePCqiCb *cqiCb;
6265 RgSchUePCqiCb *riCb;
6266 uint8_t ri; /*To fetch RI value*/
6267 Bool willUeRprtCqi; /* Flag set due to CQI Mask and
6268 UE Inactive state (DRX)*/
6269 Bool willUeRprtSr = TRUE;
6270 TfuAckNackMode hqFdbkMode;
6272 uint8_t totalPucchBits;
6273 Bool dropCqi = FALSE;
6275 RgSchCmnUlUeSpsInfo *ulSpsUe = NULL;
6278 RgSchEmtcUeInfo *emtcUe = NULLP;
6283 /*Changes for PUCCH Format3 */
6284 hqFdbkMode = pucchRecpInfo->t.pucchRecpReq.hqInfo.hqFdbkMode;
6285 numCqiBit = rgSCHCmnCalcPcqiBitSz (ue,cell->numTxAntPorts);
6286 totalPucchBits = pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz + numCqiBit;
6289 emtcUe = RG_GET_EMTC_UE_CB(ue);
6291 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
6292 #ifdef EMTC_ENABLE /*VINU*/
6295 if((emtcUe->pucchRepNumFr1 > 1) || (emtcUe->pucchRepNumFr2 > 1))
6297 willUeRprtCqi = FALSE;
6298 willUeRprtSr = FALSE;
6302 if(ue->srCb.nSrTrIdx == validIdx)
6306 /* Should we check for Rel8 and above???
6307 * Dont send SR recp req if logicalChannelSR-Mask enabled and UL SPS is
6309 ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue, cell);
6310 /* Avoiding check for ulSpsEnabled as isUlSpsActv FALSE if sps is not enabled*/
6311 if(!((ue->ul.ulSpsCfg.isLcSRMaskEnab) &&
6312 (ulSpsUe->isUlSpsActv)))
6319 pucchRecpInfo->t.pucchRecpReq.srInfo.n1PucchIdx =
6320 ue->srCb.srCfg.srSetup.srResIdx;
6321 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
6322 /* FORMAT3: If SR is present it will be appended after HARQ */
6323 totalPucchBits = totalPucchBits + 1;
6330 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
6332 /* LTE_ADV:: UE will drop CSI during CSI+1BCS if data is present
6333 * on sec cell(isDatPresOnSecCell)*/
6335 if (hqFdbkMode == TFU_ACK_NACK_CHANNEL_SELECTION)
6337 if (hqFdbkMode == TFU_UCI_FORMAT_1B_CS)
6340 if (isDatPresOnSecCell == TRUE)
6347 /* Format 3 Changes : If Hq + SR + CQI bits < 22 and simultaneousAckNackAndCQI-Format3
6348 is enabled then CQI will be multiplexed with HQ otherwise CQI will be dropped
6349 Spec 36.213 Sec 10.1.1 */
6350 else if (hqFdbkMode == TFU_UCI_FORMAT_3)
6352 if ((isDatPresOnSecCell == TRUE) &&
6353 ((!ue->simulAckNackCQIFormat3) || (totalPucchBits > 22)))
6361 cqiCb = ue->nPCqiCb;
6362 if(riCb->nRiTrIdx == validIdx)
6364 /*ccpu00140578:: Skip the UE if the RI is already processed
6366 if(riCb->riRecpPrcsd == FALSE)
6368 if(riCb->riDist == 0)
6370 if((riCb->cqiCfg.cqiSetup.sANCQI == TRUE) && (willUeRprtCqi == TRUE)&&
6371 (isDatPresOnSecCell == FALSE))
6374 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6375 riCb->cqiCfg.cqiSetup.cqiPResIdx;
6376 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6378 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_HARQ_SR)
6380 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI;
6384 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_CQI;
6386 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6388 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6389 ue->nPRiCb->servCellInfo->sCellIdx;
6391 rgSCHTomUtlFillRiBitWidthInfo(ue);
6392 if (ue->nPCqiCb->nCqiTrIdx == validIdx)
6394 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, ue->nPCqiCb);
6409 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
6415 /* Skip the UE for RI processing on PUCCH
6416 * in the same subframe as it already processed */
6417 if(riCb->nRiTrIdx == validIdx)
6419 /* As the new idx is same is current idx
6420 * then PUCCH reception processing will consider
6421 * RI also in the same subframe. To block this
6422 * below flag is used*/
6423 riCb->riRecpPrcsd = TRUE;
6427 else if(cqiCb->nCqiTrIdx == validIdx)
6429 if((cqiCb->cqiCfg.cqiSetup.sANCQI == TRUE) && (willUeRprtCqi == TRUE)&&
6430 (isDatPresOnSecCell == FALSE))
6433 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6434 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
6436 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6438 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6439 cqiCb->servCellInfo->sCellIdx;
6441 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6442 rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
6443 if(0 == pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz)
6445 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d "
6446 "Unable to Fill CqiPmi size", ue->ueId);
6449 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_HARQ_SR)
6451 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI;
6455 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_CQI;
6468 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6470 if(ue->srsCb.nSrsTrIdx == validIdx)
6472 /* ccpu00140578::Skip the UE for SRS reception processing
6473 * if already done as part of PUSCH recpetion
6475 if(ue->srsCb.srsRecpPrcsd == FALSE)
6477 if(ue->srsCb.srsDist ==0 )
6479 if((pucchRecpInfo->t.pucchRecpReq.uciInfo != TFU_PUCCH_HARQ_CQI)
6480 && (ue->srsCb.srsCfg.srsSetup.sANSrs)
6481 && (isDatPresOnSecCell == FALSE))
6484 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
6485 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
6486 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
6487 ue->srsCb.srsCfg.srsSetup.fDomPosi;
6488 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
6489 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
6490 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
6491 ue->srsCb.srsCfg.srsSetup.txComb;
6492 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
6493 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6494 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
6495 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
6496 /* ccpu00116923 - ADD - New Reception Request types for CQI and SRS with SR */
6497 switch(pucchRecpInfo->t.pucchRecpReq.uciInfo)
6499 case TFU_PUCCH_HARQ_SR:
6500 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_SRS;
6502 case TFU_PUCCH_HARQ_SR_CQI:
6503 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI_SRS;
6506 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SRS;
6510 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
6514 ue->srsCb.srsDist--;
6516 /* Skip the UE for SRS processing on PUCCH
6517 * in the same subframe as it already processed */
6518 if(ue->srsCb.nSrsTrIdx == validIdx)
6520 /* As the new idx is same is current idx
6521 * then PUCCH reception processing will consider
6522 * SRS also in the same subframe. To block this
6523 * below flag is used*/
6524 ue->srsCb.srsRecpPrcsd = TRUE;
6532 } /* rgSCHTomUtlFillCqiSrSrsWithHq */
6535 * @brief Function which handles the filling of PCQI/RI, SRS
6536 * Reception Request Information along with SR reception
6541 * Function: rgSCHTomUtlFillCqiSrsWithSr
6543 * Function which handles the filling of PCQI/RI, SRS
6544 * Reception Request Information along
6545 * with the SR reception Request
6548 * Invoked by: rgSCHTomUtlFillSrRecpReq of rg_sch_tom.c
6551 * - Fill the reception request for CQI/RI, SRS if they occur
6552 * in the same instance as of SR.
6554 * @param[in] RgSchCellCb *cell,
6556 * TfuRecpReqInfo *recpReqInfo,
6557 * @param[out] TfuUeRecpReqInfo *pucchRecpInfo
6558 * @param[in] uint16_t validIdx
6565 PRIVATE S16 rgSCHTomUtlFillCqiSrsWithSr
6569 TfuRecpReqInfo *recpReqInfo,
6570 TfuUeRecpReqInfo *pucchRecpInfo,
6574 PRIVATE S16 rgSCHTomUtlFillCqiSrsWithSr(cell, ue, recpReqInfo,
6575 pucchRecpInfo, validIdx)
6578 TfuRecpReqInfo *recpReqInfo;
6579 TfuUeRecpReqInfo *pucchRecpInfo;
6583 RgSchUePCqiCb *cqiCb;
6584 RgSchUePCqiCb *riCb;
6585 uint8_t ri; /*To fetch RI value*/
6586 Bool willUeRprtCqi; /* Flag set due to CQI Mask and
6587 UE Inactive state (DRX)*/
6589 cqiCb = ue->nPCqiCb;
6590 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
6592 rgSCHEmtcWillUeRptCqi(ue, &willUeRprtCqi);
6594 if(riCb->nRiTrIdx == validIdx)
6596 /*ccpu00140578:: Skip the UE if the RI is already processed
6598 if(riCb->riRecpPrcsd == FALSE)
6600 if(riCb->riDist == 0)
6602 if(willUeRprtCqi == TRUE)
6605 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6606 riCb->cqiCfg.cqiSetup.cqiPResIdx;
6607 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6610 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI;
6611 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6613 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6614 ue->nPRiCb->servCellInfo->sCellIdx;
6616 rgSCHTomUtlFillRiBitWidthInfo(ue);
6617 /* TODO:: syed Shouldn't this be done outside this if condition */
6618 if (cqiCb->nCqiTrIdx == validIdx)
6620 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6623 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
6629 if(riCb->nRiTrIdx == validIdx)
6630 {/* Need to skip this UE during PUCCH RI recpetion process
6631 in the current subframe */
6632 riCb->riRecpPrcsd = TRUE;
6636 else if(cqiCb->nCqiTrIdx == validIdx)
6638 if(willUeRprtCqi == TRUE)
6641 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6642 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
6644 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6647 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6648 cqiCb->servCellInfo->sCellIdx;
6650 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6651 rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
6652 if(0 == pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz)
6654 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d"
6655 " Unable to Fill CqiPmi size", ue->ueId);
6659 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI;
6661 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6663 if(ue->srsCb.nSrsTrIdx == validIdx)
6665 /* ccpu00140578:: Cnsider the SRS processing
6666 * only if not done in the same TTI
6667 * as part of PUSCH or HARQ reception process*/
6668 if(ue->srsCb.srsRecpPrcsd == FALSE)
6670 if(ue->srsCb.srsDist ==0 )
6672 if(ue->srsCb.srsCfg.srsSetup.sANSrs)
6675 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
6676 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
6677 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
6678 ue->srsCb.srsCfg.srsSetup.fDomPosi;
6679 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
6680 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
6681 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
6682 ue->srsCb.srsCfg.srsSetup.txComb;
6683 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
6684 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6685 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
6686 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
6687 /* ccpu00116923 - ADD - New Reception Request types for CQI and
6689 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_SR_CQI)
6691 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI_SRS;
6695 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_SRS;
6699 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
6703 ue->srsCb.srsDist--;
6705 /* Skip the UE for SRS processing on PUCCH
6706 * in the same subframe as it already processed */
6707 if(ue->srsCb.nSrsTrIdx == validIdx)
6709 /* As the new idx is same is current idx
6710 * then PUCCH reception processing will consider
6711 * SRS also in the same subframe. To block this
6712 * below flag is used*/
6713 ue->srsCb.srsRecpPrcsd = TRUE;
6719 } /* rgSCHTomUtlFillCqiSrsWithSr */
6725 /** @brief This function handles filling of HARQ feedback repetition
6726 * recption request for each subframe
6730 * Function: rgSCHTomUtlFillSfRepHqFdbk
6734 * @param [out] TfuRecpReqInfo *recpReqInfo
6735 * @param [in] RgSchCellCb *cell
6736 * @param [out] RgSchErrInfo *err
6737 * @param [in] RgSchDlSf *dlSf
6738 * @param [in] uint8_t noFdbks
6739 * @param [in] CmMemListCp *memCp
6740 * @param [in] uint8_t elemIdx
6741 * @param [in] RgSchDlSf *nxtDlsf
6748 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk
6750 TfuRecpReqInfo *recpReqInfo,
6751 RgSchCellCb *cellCb,
6761 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk (recpReqInfo, cellCb, err, dlSf,
6762 noFdbks, memCp, elemIdx, nxtDlsf, validIdx)
6763 TfuRecpReqInfo *recpReqInfo;
6764 RgSchCellCb *cellCb;
6775 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk
6777 TfuRecpReqInfo *recpReqInfo,
6778 RgSchCellCb *cellCb,
6787 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk (recpReqInfo, cellCb, err, dlSf,
6788 noFdbks, memCp, elemIdx, nxtDlsf)
6789 TfuRecpReqInfo *recpReqInfo;
6790 RgSchCellCb *cellCb;
6800 RgSchDlHqProcCb *hqCb;
6804 TfuUeRecpReqInfo *pucchRecpInfo;
6806 TfuUePucchHqRecpInfo *hqRecpReq;
6808 RgSchDlHqTbCb *tbCb;
6809 RgSchDlHqProcCb *prvHqCb = NULLP;
6811 node = dlSf->ackNakRepQ.first;
6814 tbCb = (RgSchDlHqTbCb *)(node->node);
6816 ueCb = hqCb->hqE->ue;
6818 if (--tbCb->fbkRecpRepCntr)
6820 /* Add to next subfarme */
6821 /* Add this hqCb to the next dlSf's ackNakRepQ */
6822 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
6823 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
6824 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
6825 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
6832 /* Go to the next node */
6837 if ((hqCb->hqE->ue != NULLP) &&
6838 (hqCb->hqE->ue->measGapCb.isMeasuring != TRUE)
6839 && (hqCb != prvHqCb)
6842 /* We need to add the recp request to be sent on the pucchANRep
6845 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
6846 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
6849 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to"
6850 "Allocate TfuUeRecpReqInfo for RNTI:%d ", ueCb->ueId);
6851 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
6854 pucchRecpInfo->rnti = ueCb->ueId;
6856 pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
6858 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
6861 /* FOR repetition Feedback shall come on n1PucchAnRep Configured per
6865 pucchRecpInfo->t.pucchRecpReq.hqType = TFU_HQ_RECP_REQ_N1PUCCH;
6866 pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = ueCb->ackNakRepCb.pucchRes;
6868 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
6869 hqRecpReq = &(pucchRecpInfo->t.pucchRecpReq.hqInfo);
6870 /* ACK NACK rep works only in bundling mode . */
6871 hqRecpReq->hqFdbkMode = (TfuAckNackMode)RGR_TDD_ACKNACK_MODE_BUNDL;
6872 if ((hqCb->hqPSfLnk.node != NULLP) &&
6873 (hqCb->hqPSfLnk.node != NULLP))
6876 hqRecpReq->hqSz = 2;
6880 hqRecpReq->hqSz = 1;
6882 hqRecpReq->pucchResCnt = 1;
6883 hqRecpReq->hqRes[0] = ueCb->ackNakRepCb.pucchRes;
6885 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
6886 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
6888 /* In a given dlSf, if there is 2 TBs context
6889 * stored for a given harq, then they are added
6890 * adjacent to each other in the subframe. To avoid
6891 * adding duplicate recpnInfo for each TB, store this
6892 * hqCb in prvHqCb. If nextHqCb is same as prvHqCb then
6893 * do not add reception req info.*/
6896 RGSCH_NULL_CHECK(cellCb->instIdx, hqCb->hqE->ue);
6897 rgSCHTomUtlMoveNxtOccasion(cellCb, hqCb->hqE->ue, validIdx);
6899 /* Go to the next node */
6905 /** @brief This function handles filling of HARQ feedback recption request
6910 * Function: rgSCHTomUtlFillSfHqFdbkInfo
6914 * @param [out] TfuRecpReqInfo *recpReqInfo
6915 * @param [in] RgSchCellCb *cell
6916 * @param [out] RgSchErrInfo *err
6917 * @param [in] RgSchDlSf *dlSf
6918 * @param [in] uint8_t noFdbks
6919 * @param [in] CmMemListCp *memCp
6920 * @param [in] uint8_t elemIdx
6921 * @param [in] RgSchDlSf *nxtDlsf
6922 * @param [in] uint16_t validIdx;
6929 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo
6931 TfuRecpReqInfo *recpReqInfo,
6932 RgSchCellCb *cellCb,
6940 RgSchDlHqProcCb *hqCb,
6941 RgSchUePucchRecpInfo *pucchInfo,
6943 RgSchDlHqProcCb *prvHqCb
6946 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo (recpReqInfo, cellCb, err, dlSf,
6947 noFdbks, memCp, elemIdx, nxtDlsf, validIdx, hqCb, pucchInfo, alloc, prvHqCb)
6948 TfuRecpReqInfo *recpReqInfo;
6949 RgSchCellCb *cellCb;
6957 RgSchDlHqProcCb *hqCb;
6958 RgSchUePucchRecpInfo *pucchInfo;
6960 RgSchDlHqProcCb *prvHqCb;
6964 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo
6966 TfuRecpReqInfo *recpReqInfo,
6967 RgSchCellCb *cellCb,
6974 RgSchDlHqProcCb *hqCb,
6975 RgSchUePucchRecpInfo *pucchInfo,
6977 RgSchDlHqProcCb *prvHqCb
6980 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo (recpReqInfo, cellCb, err, dlSf,
6981 noFdbks, memCp, elemIdx, nxtDlsf, hqCb, pucchInfo, alloc, prvHqCb)
6982 TfuRecpReqInfo *recpReqInfo;
6983 RgSchCellCb *cellCb;
6990 RgSchDlHqProcCb *hqCb;
6991 RgSchUePucchRecpInfo *pucchInfo;
6993 RgSchDlHqProcCb *prvHqCb;
6998 RgSchUeCb *ueCb = hqCb->hqE->ue;
7000 CmLteTimingInfo futTime;
7001 RgSchTddANInfo *anInfo;
7004 RgrTddAckNackMode ackNackMode;
7005 RgSchDlHqTbCb *tbCb;
7011 RG_SCH_ADD_TO_CRNT_TIME(cellCb->crntTime, futTime, TFU_RECPREQ_DLDELTA);
7015 for (idx = 0 ;idx < 2; idx++)
7017 if (HQ_TB_WAITING == hqCb->tbInfo[idx].state)
7020 tbCb = &hqCb->tbInfo[idx];
7024 ackNackMode = ueCb->dl.ackNackMode;
7026 if(ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL)
7028 anInfo = rgSCHUtlGetUeANFdbkInfo(ueCb, &futTime);
7029 /* Only the last scheduled TB for the UE is for HARQ
7030 * ACK/NACK reception in Bundling case */
7031 if((anInfo == NULLP) ||
7032 (anInfo->latestMIdx != dlSf->dlFdbkInfo.m))
7039 /* Get the TFU reception request pointer, if present */
7040 cmHashListFind(&cellCb->ueTfuPendLst, (uint8_t*) &ueCb->ueId,
7041 sizeof(ueCb->ueId), 0, (PTR *) &pucchInfo);
7044 /* For upgrade we shall use the existing logic of pending list. */
7045 cmHashListFind(&cellCb->ueTfuPendLst, (uint8_t*) &ueCb->ueId,
7046 sizeof(ueCb->ueId), 0, (PTR *) &pucchInfo);
7049 else if(hqCb->hqE->raCb != NULLP)
7051 /* For RACH it is set to Bundling */
7052 ackNackMode = RGR_TDD_ACKNACK_MODE_BUNDL;
7053 rnti = hqCb->hqE->raCb->tmpCrnti;
7060 /* Do not proceed if PUSCH
7061 reception req is already filled*/
7066 /* Go to the next node */
7070 if(((ueCb == NULLP) || (ueCb->measGapCb.isMeasuring != TRUE))
7074 TknUInt16 n1PucchTkn = {FALSE, 0};
7077 pdcch = tbCb->hqP->pdcch;
7079 n1PucchTkn = hqCb->spsN1PucchRes;
7081 for (tbIndx = 0; tbIndx < TFU_MAX_TB; tbIndx++)
7083 if (hqCb->tbInfo[tbIndx].state == HQ_TB_WAITING &&
7084 (RGSCH_TIMEINFO_SAME(hqCb->tbInfo[tbIndx].fdbkTime,
7085 recpReqInfo->timingInfo)))
7088 hqCb->tbInfo[tbIndx].pucchFdbkIdx = hqCb->ulDai;
7091 ret = rgSCHTomUtlFillSfHqFdbkForOneUe(hqCb,recpReqInfo, cellCb, err, dlSf, noFdbks,
7092 memCp, elemIdx, nxtDlsf, rnti, ackNackMode, &pucchInfo, pdcch,
7093 n1PucchTkn, &alloc, hqSz);
7098 /* TODO:: In case of F1BCS and CSI in same subframe
7099 * UE shall drop the CSI if there was at least one
7100 * PDSCH transmission in any of the DL subframe
7101 * mapping to this UL subframe
7104 rgSCHTomUtlFillCqiSrSrsWithHq(cellCb,recpReqInfo, hqCb->hqE->ue,
7105 pucchInfo->pucchRecpInfo, validIdx,FALSE);
7107 if((hqCb->hqE->ue) &&
7108 (hqCb->hqE->ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS))
7111 if(RG_SCH_IS_CELL_SEC(hqCb->hqE->ue,hqCb->hqE->cell))
7113 switch(pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo)
7115 case TFU_PUCCH_HARQ_SR_CQI:
7116 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
7117 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
7119 case TFU_PUCCH_HARQ_CQI:
7120 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
7121 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
7123 case TFU_PUCCH_HARQ_SR_CQI_SRS:
7124 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_SRS;
7125 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
7127 case TFU_PUCCH_HARQ_SR_SRS:
7128 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
7130 case TFU_PUCCH_HARQ_SRS:
7131 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
7142 /* TODO antz - pushing the following code (under TFU_UPGRADE)
7143 * into the above function (...ForOneUe) did not work (caused
7144 * two additional TCs to fail). Don't know why. If this
7145 * is done later, make sure that the code branch
7146 * for relPdcch (later in this func) is also modified appropriately.
7148 /* Now add to the recp request or pending list */
7149 //if((elemIdx != (noFdbks - 1)))
7151 cmHashListInsert(&cellCb->ueTfuPendLst, (PTR) pucchInfo,
7152 (uint8_t *)&rnti ,(uint16_t) sizeof(CmLteRnti));
7156 } /* If measuring */
7157 /* Go to the next node */
7158 if ((tbCb->fbkRecpRepCntr) && (--tbCb->fbkRecpRepCntr))
7160 /* Add to next subfarme */
7161 /* Add this hqCb to the next dlSf's ackNakRepQ */
7162 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
7163 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
7164 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
7165 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
7167 /* In a given dlSf, if there is 2 TBs context
7168 * stored for a given harq, then they are added
7169 * adjacent to each other in the subframe. To avoid
7170 * adding duplicate recpnInfo for each TB, store this
7171 * hqCb in prvHqCb. If nextHqCb is same as prvHqCb then
7172 * do not add reception req info.*/
7180 /** @brief This function calculates the pucch resource idx
7181 * that is to be filled in harq reception request
7185 * Function: rgSCHTomUtlGethqRes
7188 * -Calculate the pucch resource idx
7189 * Harq Reception Request for Format 1B with
7192 * @param [in] uint8_t noFdbks
7193 * @param [in] RgSchDlSf *dlSf
7194 * @param [in] RgSchPdcch *pdcch
7195 * @param [in] RgSchCellCb *cellCb
7196 * @param [out]uint16_t *hqRes
7200 PRIVATE Void rgSCHTomUtlGethqRes
7205 RgSchCellCb *cellCb,
7209 PRIVATE Void rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,hqRes)
7213 RgSchCellCb *cellCb;
7225 m = dlSf->dlFdbkInfo.m;
7227 P = rgSCHCmnGetPValFrmCCE(cellCb, nCce);
7228 nP = cellCb->rgSchTddNpValTbl[P];
7229 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
7230 *hqRes = (M - m - 1)* nP + (m * nPlusOne) + pdcch->nCce +
7231 cellCb->pucchCfg.n1PucchAn;
7236 /** @brief This function fills the harq reception request for
7237 * TDD in case of Fomat 1B with CS for M=1
7241 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1
7244 * -Fill Harq Reception Request for Format 1B with
7247 * @param [in] RgSchDlHqProcCb *hqCb
7248 * @param [in] TfuUePucchRecpReq *hqRecpReq
7249 * @param [in] uint8_t noFdbks
7250 * @param [in] RgSchDlSf *dlSf
7251 * @param [in] RgSchPdcch *pdcch
7252 * @param [in] RgSchCellCb *cellCb
7256 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1
7258 RgSchDlHqProcCb *hqCb,
7259 TfuUePucchRecpReq *hqRecpReq,
7266 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1(hqCb, hqRecpReq,
7267 noFdbks,dlSf,pdcch,cellCb)
7268 RgSchDlHqProcCb *hqCb;
7269 TfuUePucchRecpReq *hqRecpReq;
7273 RgSchCellCb *cellCb;
7276 RgSchUeCb *ue = NULLP;
7277 Bool isCellSec = FALSE;
7280 /*ccpu00147920: UeCb is NULL for SPS activation*/
7281 if(pdcch && pdcch->ue)
7282 {/* SPS Release pdcch or dynamic data */
7289 /* This is not supposed to happen
7290 * Error case. hqCB has to be ter
7291 * when pdcch is present . Adding
7292 * if check bcs of kwork*/
7299 if((hqCb != NULLP) &&
7300 (RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
7305 switch(ue->f1bCsAVal)
7307 case RG_SCH_A_VAL_2:
7308 /* harq(0) is primary harq(1) is secondary) */
7311 hqRecpReq->hqInfo.hqRes[1] = ue->n1PucchF1bResCb.
7312 cw1N1Res[hqCb->tpc].n1PucchIdx;
7314 else/* primary cell */
7317 /* hqCb will be null in case of sps rel pdcch */
7318 if ((hqCb) && hqCb->spsN1PucchRes.pres)
7319 {/* SPS occasion or dyn sched*/
7320 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
7323 #endif /* LTEMAC_SPS */
7324 {/* dyn data or sps release */
7328 /* This is not supposed to happen
7329 * Error case. hqCB has to be ter
7330 * when pdcch is present . Adding
7331 * if check bcs of kwork*/
7336 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7337 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7341 case RG_SCH_A_VAL_3:
7343 /* Serving cell in mimo mode should be
7344 * in 0 and 1 and the serving cell in siso
7345 * mode should be in 2 indices */
7348 uint8_t servCellIdx = rgSchUtlGetServCellIdx(hqCb->hqE->cell->instIdx,
7349 hqCb->hqE->cell->cellId,
7352 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1)
7353 {/* Sec cell is in mimo mode, use 0 and 1 */
7354 hqRecpReq->hqInfo.hqRes[0] =
7355 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7356 hqRecpReq->hqInfo.hqRes[1] =
7357 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
7360 {/* Sec cell is in siso mode, use 2 */
7361 hqRecpReq->hqInfo.hqRes[2] =
7362 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7366 {/* primary cell hq */
7368 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
7369 {/* prim cell is in mimo mode, use 0 and 1 */
7371 if (hqCb && hqCb->spsN1PucchRes.pres)
7372 {/* Not sps release */
7373 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
7376 #endif /* LTEMAC_SPS */
7377 {/* sps rel or dyn */
7381 /* This is not supposed to happen
7382 * Error case. hqCB has to be ter
7383 * when pdcch is present . Adding
7384 * if check bcs of kwork*/
7389 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7390 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7391 hqRecpReq->hqInfo.hqRes[1] = hqRes + 1;
7395 {/* prim cell is in siso mode use 2 */
7397 /* Consider sps occasions */
7398 if (hqCb && hqCb->spsN1PucchRes.pres)
7399 {/* Not sps release */
7400 hqRecpReq->hqInfo.hqRes[2] = hqCb->spsN1PucchRes.val;
7403 #endif /* LTEMAC_SPS */
7408 /* This is not supposed to happen
7409 * Error case. hqCB has to be ter
7410 * when pdcch is present . Adding
7411 * if check bcs of kwork*/
7416 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7417 hqRecpReq->hqInfo.hqRes[2] = hqRes;
7423 case RG_SCH_A_VAL_4:
7424 {/* Both the serv cells are in mimo mode */
7426 {/* 2 and 3 for sec cell */
7427 hqRecpReq->hqInfo.hqRes[2] =
7428 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7429 hqRecpReq->hqInfo.hqRes[3] =
7430 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
7432 else/* primary cell */
7433 {/* 0 and 1 are for primary cell */
7435 if (hqCb && hqCb->spsN1PucchRes.pres)
7436 {/* Not sps release */
7437 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
7440 #endif /* LTEMAC_SPS */
7445 /* This is not supposed to happen
7446 * Error case. hqCB has to be ter
7447 * when pdcch is present . Adding
7448 * if check bcs of kwork*/
7453 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7454 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7455 hqRecpReq->hqInfo.hqRes[1] = hqRes + 1;
7466 /** @brief This function fills the harq reception request for
7467 * TDD in case of Fomat 1B with CS for M>=2
7471 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234
7474 * -Fill Harq Reception Request for Format 1B with
7477 * @param [in] RgSchDlHqProcCb *hqCb
7478 * @param [in] TfuUePucchRecpReq *hqRecpReq
7479 * @param [in] uint8_t noFdbks
7480 * @param [in] RgSchDlSf *dlSf
7481 * @param [in] RgSchPdcch *pdcch
7482 * @param [in] RgSchCellCb *cellCb
7483 * @param [in] uint8_t elemIdx
7487 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234
7489 RgSchDlHqProcCb *hqCb,
7490 TfuUePucchRecpReq *hqRecpReq,
7494 RgSchCellCb *cellCb,
7498 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234(
7499 hqCb,hqRecpReq,noFdbks,dlSf,pdcch,cellCb,elemIdx)
7500 RgSchDlHqProcCb *hqCb;
7501 TfuUePucchRecpReq *hqRecpReq;
7505 RgSchCellCb *cellCb;
7510 Bool isCellSec = FALSE;
7512 uint8_t servCellIdx;
7515 {/* SPS Release pdcch or dynamic data */
7522 /* This is not supposed to happen
7523 * Error case. hqCB has to be ter
7524 * when pdcch is present . Adding
7525 * if check bcs of kwork*/
7532 if((hqCb != NULLP) && (ue != NULLP) &&
7533 (RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
7539 {/* Sec Cell indices are 2 and 3*/
7540 servCellIdx = rgSchUtlGetServCellIdx(hqCb->hqE->cell->instIdx,
7541 hqCb->hqE->cell->cellId,
7544 hqRecpReq->hqInfo.hqRes[2] =
7545 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7547 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1)
7549 hqRecpReq->hqInfo.hqRes[3] =
7550 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
7554 {/* Primary cell indices are 0 and 1 */
7556 * M > 2 if SPS occasion is present in any of the
7557 * DL subframe in the bundle, the n1Pucch(0) is
7558 * the SPS resource and n1Pucch(1) is the resource
7559 * derived from pdcch with DAI = 1
7560 * If No SPS Occasion
7561 * Then n1Pucch(0) is from pdcch with DAI =1
7562 * and n1Pucch(1) is from pdcch with DAI = 2
7566 {/* this is not sps release pdcch */
7567 if(hqCb->spsN1PucchRes.pres == TRUE)
7569 hqRes = hqCb->spsN1PucchRes.val;
7574 {/*Dynamic scheduling or SPS Release
7575 Derive from pdcch */
7576 if(pdcch->dlDai < 3)
7577 {/* No need to calcualte from DAI > 2 */
7578 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7584 hqRecpReq->hqInfo.hqRes[elemIdx] = hqRes;
7587 {/* Pdcch with DAI = 1 and 2 needs to be used
7588 for resource calculation*/
7589 if(hqCb && hqCb->spsN1PucchRes.pres == TRUE)
7590 {/* dyn or sps occasion */
7591 /* Shift the hqRes[0] if it was filled
7592 * if there was a pdcch with DAI 1 before to this
7595 {/* SPS occasion happened in the middle
7597 /* shifting the non SPS resource to n1Pucch(1) */
7598 hqRecpReq->hqInfo.hqRes[1] = hqRecpReq->hqInfo.hqRes[0];
7601 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7604 else if(pdcch && pdcch->dlDai < 3)
7606 else if(pdcch->dlDai < 3)
7608 {/* sps rel or dyn sched */
7609 /* hqCb wil not be present for sps release pdcch */
7610 if(hqCb && (pdcch->dlDai != hqCb->ulDai))
7611 {/* there was a SPS occasion before to this */
7612 if(pdcch->dlDai == 1)
7614 hqRecpReq->hqInfo.hqRes[1] = hqRes;
7615 }/* ignore the DAI 2 in this case */
7617 {/* There was no SPS occasion before to this */
7621 {/* Added check to ignore kwork warning */
7622 hqRecpReq->hqInfo.hqRes[(pdcch->dlDai)-1] = hqRes;
7631 /** @brief This function fills the harq reception request for
7632 * TDD in case of Fomat 1B with CS
7636 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCS
7639 * -Fill Harq Reception Request for Format 1B with
7642 * @param [in] RgSchDlSf *ulSf
7643 * @param [in] RgSchCellCb *cell
7644 * @param [out]TfuUePucchRecpReq *hqRecpReq
7648 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS
7650 RgSchDlHqProcCb *hqCb,
7651 TfuUePucchRecpReq *hqRecpReq,
7659 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS(hqCb,hqRecpReq,noFdbks,dlSf,pdcch,
7660 n1PucchTkn,elemIdx,cellCb)
7661 RgSchDlHqProcCb *hqCb;
7662 TfuUePucchRecpReq *hqRecpReq;
7667 RgSchCellCb *cellCb;
7670 /* Update teh fdbk mode if something different is present
7671 * in L1 API file for F1BS *//* 1 --> F1BCS */
7672 hqRecpReq->hqInfo.hqFdbkMode = TFU_ACK_NACK_CHANNEL_SELECTION;
7676 case RG_SCH_M_VAL_1:
7679 rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1(hqCb,hqRecpReq,
7680 noFdbks,dlSf,pdcch,cellCb);
7683 case RG_SCH_M_VAL_2:
7684 case RG_SCH_M_VAL_3:
7685 case RG_SCH_M_VAL_4:
7687 /* Spatial bundling will be applied */
7688 rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234(hqCb,hqRecpReq,
7689 noFdbks,dlSf,pdcch,cellCb,elemIdx);
7699 /***********************************************************
7701 * Func : rgSCHTomUtlFillSfHqFdbkForOneUe
7703 * Desc : Fill HARQ feedback info for one UE/entry
7711 **********************************************************/
7713 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForOneUe
7715 RgSchDlHqProcCb *hqCb,
7716 TfuRecpReqInfo *recpReqInfo,
7717 RgSchCellCb *cellCb,
7725 RgrTddAckNackMode ackNackMode,
7726 RgSchUePucchRecpInfo **pucchInfoRef,
7728 TknUInt16 n1PucchTkn,
7733 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForOneUe(hqCb,recpReqInfo, cellCb, err, dlSf,
7734 noFdbks, memCp, elemIdx, nxtDlsf, rnti, ackNackMode, pucchInfoRef,
7735 pdcch, n1PucchTkn, allocRef, hqSz)
7736 RgSchDlHqProcCb *hqCb;
7737 TfuRecpReqInfo *recpReqInfo;
7738 RgSchCellCb *cellCb;
7746 RgrTddAckNackMode ackNackMode;
7747 RgSchUePucchRecpInfo **pucchInfoRef;
7749 TknUInt16 n1PucchTkn;
7754 RgSchUePucchRecpInfo *pucchInfo = *pucchInfoRef;
7757 TfuUePucchRecpReq *hqRecpReq;
7772 Bool isFirstFdbk = FALSE;
7774 if(pucchInfo == NULLP)
7776 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchInfo,
7777 sizeof(RgSchUePucchRecpInfo), memCp)) != ROK)
7779 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to "
7780 "Allocate TfuUeRecpReqInfo for cell RNTI:%d",rnti);
7781 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
7785 #ifdef TFU_ALLOC_EVENT_NO_INIT
7786 pucchInfo->hashLstEnt.hashVal = 0;
7787 pucchInfo->hashLstEnt.keyLen = 0;
7788 pucchInfo->hashLstEnt.key = 0;
7789 pucchInfo->hashLstEnt.list.prev = pucchInfo->hashLstEnt.list.next = 0;
7791 if ((ret = rgSCHUtlGetEventMem((Ptr *)&(pucchInfo->pucchRecpInfo),
7792 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp))) != ROK)
7794 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to "
7795 "Allocate TfuUeRecpReqInfo for cell RNTI:%d",rnti);
7796 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
7799 memset(pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes,0xff,sizeof(uint16_t)*TFU_MAX_HQ_RES);
7800 #ifdef TFU_ALLOC_EVENT_NO_INIT
7801 memset(&pucchInfo->pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
7803 pucchInfo->pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
7804 pucchInfo->pucchRecpInfo->rnti = rnti;
7806 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo=TFU_PUCCH_HARQ;
7813 /* Calculation of resources same for both bundling and muxing for M = 1
7816 RgSchUeCb *ue = rgSCHDbmGetUeCb (cellCb, rnti);
7817 if((ue) && (1 == ue->numSCells))
7819 if(ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS)
7821 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
7822 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS(hqCb,hqRecpReq,
7823 noFdbks,dlSf,pdcch,elemIdx,cellCb);
7826 {/* M = 1 case . size is same as A Value*/
7827 hqRecpReq->hqInfo.hqSz = ue->f1bCsAVal;
7828 hqRecpReq->hqInfo.pucchResCnt = hqRecpReq->hqInfo.hqSz;
7831 hqRecpReq->hqInfo.hqSz = (noFdbks * 2); /* M for 2 cells */
7832 hqRecpReq->hqInfo.pucchResCnt = 4;
7834 hqRecpReq->hqInfo.a = ue->f1bCsAVal;
7835 /* handling for SPS occasions*/
7838 /* set the datPresinFirstSUbframe to TRUE if this
7839 * is for pcell txion*/
7841 RgSchTddANInfo *anInfo = NULLP;
7843 /* if this txion is on pcell
7844 * sps occaion, dyn sched or sps release pdcch
7845 * set the sched present in first
7846 * dl subframe of the bundle to TRUE. This
7847 * is required for mapping the feedbak when SPS occasion
7848 * is present in any of the DL subframe in the bundle in
7851 /* SPS will happen only on pcell */
7852 if((hqCb == NULLP) || (!RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
7855 anInfo = rgSCHUtlGetUeANFdbkInfo(ue,
7856 &recpReqInfo->timingInfo,RGSCH_PCELL_INDEX);
7858 {/* ANInfo must be there. adding block
7860 RGSCHDBGERRNEW(cellCb->instIdx,(rgSchPBuf(cellCb->instIdx),
7861 "ANInfo should not be NULL for cellId=%d \n", cellCb->cellId));
7868 {/* This needs to be revisited while
7869 adding support for PUCCH format 3 */
7870 RGSCHDBGERRNEW(cellCb->instIdx,(rgSchPBuf(cellCb->instIdx),"Invalid Pucch format configured.."));
7877 if((ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) ||
7878 ((noFdbks == 1) && (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT)))
7880 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
7882 prevHqSize = hqRecpReq->hqInfo.hqSz;
7885 /* Only one index for bundling case */
7886 hqRecpReq->M = noFdbks;
7888 TFU_HQ_RECP_REQ_NORMAL;
7889 hqRecpReq->multCnt = 1;
7890 hqRecpReq->t.nCce[0] =
7895 rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
7897 hqRecpReq->type = TFU_UCI_HARQ;
7899 #else /* TFU_UPGRADE */
7902 if ((TRUE == isFirstFdbk) && (TRUE == n1PucchTkn.pres))
7904 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)ackNackMode;
7905 hqRecpReq->hqInfo.pucchResCnt=1;
7906 hqRecpReq->hqInfo.hqRes[0] = n1PucchTkn.val;
7907 hqRecpReq->hqInfo.hqSz = hqSz;
7910 else if (FALSE == n1PucchTkn.pres)
7913 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)ackNackMode;
7915 P = rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
7916 nP = cellCb->rgSchTddNpValTbl[P];
7917 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
7918 m = dlSf->dlFdbkInfo.m;
7919 /* In case of no UE */
7920 pucchRes = (M - m - 1)* nP + (m * nPlusOne) + pdcch->nCce +
7921 cellCb->pucchCfg.n1PucchAn;
7922 /*ccpu00130164:MOD-Changed to maitain value of
7923 hqRecpReq->hqInfo.pucchResCnt=1 in case of bundling*/
7924 /*ccpu00132284 -MOD- hqRes need to be updated after pucchReCnt set to 1
7925 * and resource should be update at index-0*/
7926 hqRecpReq->hqInfo.pucchResCnt=1;
7927 hqRecpReq->hqInfo.hqRes[hqRecpReq->hqInfo.pucchResCnt-1] = pucchRes;
7929 if((ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) && (hqSz > prevHqSize))
7930 hqRecpReq->hqInfo.hqSz = hqSz;
7931 else if (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT)
7932 hqRecpReq->hqInfo.hqSz = hqSz;
7934 hqRecpReq->hqInfo.hqSz = prevHqSize;
7936 #endif /* TFU_UPGRADE */
7938 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst,
7939 &(pucchInfo->pucchRecpInfo->lnk));
7940 pucchInfo->pucchRecpInfo->lnk.node =
7941 (PTR)pucchInfo->pucchRecpInfo;
7944 else /* Multiplexing */
7947 pucchInfo->pucchRecpInfo->t.pucchRecpReq.M = noFdbks;
7949 if (n1PucchTkn.pres == TRUE)
7951 pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqType =
7952 TFU_HQ_RECP_REQ_N1PUCCH;
7953 pucchInfo->pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = n1PucchTkn.val;
7958 pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqType =
7959 TFU_HQ_RECP_REQ_NORMAL;
7960 multCnt = pucchInfo->pucchRecpInfo->t.pucchRecpReq.multCnt;
7961 pucchInfo->pucchRecpInfo->t.pucchRecpReq.t.nCce[multCnt] =
7963 pucchInfo->pucchRecpInfo->t.pucchRecpReq.m[multCnt] =
7965 pucchInfo->pucchRecpInfo->t.pucchRecpReq.p[multCnt] =
7966 rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
7968 pucchInfo->pucchRecpInfo->t.pucchRecpReq.multCnt++;
7970 #else /* TFU_UPGRADE */
7972 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
7973 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)RGR_TDD_ACKNACK_MODE_MULT;
7974 hqRecpReq->hqInfo.hqSz = noFdbks;
7976 resIdx = hqRecpReq->hqInfo.pucchResCnt;
7977 hqRecpReq->hqInfo.pucchResCnt++;
7980 if (n1PucchTkn.pres == TRUE)
7982 hqRecpReq->hqInfo.hqRes[resIdx] = n1PucchTkn.val;
7988 m = dlSf->dlFdbkInfo.m;
7990 P = rgSCHCmnGetPValFrmCCE(cellCb, nCce);
7991 nP = cellCb->rgSchTddNpValTbl[P];
7992 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
7993 hqRecpReq->hqInfo.hqRes[resIdx] = (M - m - 1)* nP +
7994 (m * nPlusOne) + pdcch->nCce +
7995 cellCb->pucchCfg.n1PucchAn;
7997 #endif /* TFU_UPGRADE */
7998 /* If all the DL subframes are scanned, then
7999 * send TFU request*/
8001 if((elemIdx != noFdbks) && alloc)
8003 cmHashListInsert(&cellCb->ueTfuPendLst, (PTR) pucchInfo,
8004 (uint8_t *)&rnti, (uint16_t) sizeof(rnti));
8009 pucchInfo->pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
8010 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst,
8011 &(pucchInfo->pucchRecpInfo->lnk));
8012 pucchInfo->pucchRecpInfo->lnk.node =
8013 (PTR)pucchInfo->pucchRecpInfo;
8014 /* Delete the entry after addition to the list */
8015 cmHashListDelete(&cellCb->ueTfuPendLst, (PTR) pucchInfo);
8021 *pucchInfoRef = pucchInfo;
8027 #ifdef RG_ULSCHED_AT_CRC
8028 /** @brief This function does all the processing related to a single downlink
8033 * Function: rgSCHTomUtlProcDlSfAtCrc
8036 * - collate control data for all UEs and send to PHY
8037 * - collate data buffers for all UEs and send to PHY
8039 * @param [in] RgSchDlSf *ulSf
8040 * @param [in] RgSchCellCb *cell
8041 * @param [in] TfuCntrlReqInfo *cntrlInfo
8042 * @param [out] RgSchErrInfo *err
8046 PRIVATE S16 rgSCHTomUtlProcDlSfAtCrc
8049 CmLteTimingInfo crntUlFrm,
8051 TfuCntrlReqInfo *cntrlInfo,
8055 PRIVATE S16 rgSCHTomUtlProcDlSfAtCrc (ulSf, crntUlFrm, cell, cntrlInfo, err)
8057 CmLteTimingInfo crntUlFrm;
8059 TfuCntrlReqInfo *cntrlInfo;
8063 Inst inst = cell->instIdx;
8066 cntrlInfo->numDlActvUes = 0;
8067 cmLListInit(&cntrlInfo->phichLst);
8068 cmLListInit(&cntrlInfo->dlPdcchLst);
8069 cmLListInit(&cntrlInfo->ulPdcchLst);
8070 #ifdef TFU_ALLOC_EVENT_NO_INIT
8071 cntrlInfo->dlTiming.sfn = cntrlInfo->dlTiming.subframe = 0;
8075 cntrlInfo->ulTiming = crntUlFrm;
8076 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cntrlInfo->ulTiming, TFU_ULCNTRL_DLDELTA);
8078 cntrlInfo->cellId = cell->cellId;
8079 /* Fill PHICH info */
8080 if ((ret = rgSCHTomUtlFillPhich (cell, cntrlInfo, ulSf, err)) != ROK)
8082 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send PHICH info for "
8084 RGSCH_FREE_MEM(cntrlInfo);
8089 if ((ret = rgSCHTomUtlFillUlPdcch (cell, cntrlInfo, ulSf, err)) != ROK)
8091 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send PDCCH info for "
8093 RGSCH_FREE_MEM(cntrlInfo);
8098 if(0 == cntrlInfo->ulMpdcchLst.count)
8105 if ((cntrlInfo->ulPdcchLst.count || cntrlInfo->phichLst.count) || RG_SCH_EMTC_GET_PDCCHLST_CNT(cntrlInfo))
8107 if (cntrlInfo->ulPdcchLst.count || cntrlInfo->phichLst.count)
8110 if (rgSCHUtlTfuCntrlReq(inst, cell->tfuSap->sapCfg.suId, cntrlInfo)
8113 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info for"
8119 RGSCH_FREE_MEM(cntrlInfo);
8123 #endif /* #ifdef RG_ULSCHED_AT_CRC*/
8126 /** @brief This function sends the SFN Tick to L3
8131 * Function: rgSCHTomUtlSendSfnTick
8133 * @param [in] RgSchCellCb *cell
8136 PRIVATE Void rgSCHTomUtlSendSfnTick
8141 PRIVATE Void rgSCHTomUtlSendSfnTick (cell)
8145 RgrTtiIndInfo *rgrTtiInd;
8147 /* TTI to be sent to RRM only once per system frame */
8148 /* Added support for period = 0 to disable tick to RRM */
8149 if ((cell->rrmTtiIndPrd != 0) &&
8150 ((cell->crntTime.sfn % cell->rrmTtiIndPrd) == 0) &&
8151 (cell->crntTime.slot == 0))
8153 /* Allocate a TTI indication structure and send to RRM over RGR interface */
8154 if (rgSCHUtlAllocSBuf (cell->instIdx,
8155 (Data**)&rgrTtiInd, sizeof(RgrTtiIndInfo)) != ROK)
8157 RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),
8158 "Mem alloc failed for RGR TTI ind, cellId (%d))\n",
8162 rgrTtiInd->cellId = cell->cellId;
8163 //rgrTtiInd->hSfn = cell->crntTime.hSfn;
8164 rgrTtiInd->sfn = cell->crntTime.sfn;
8166 if (rgSCHUtlRgrTtiInd (cell, rgrTtiInd) != ROK)
8168 RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),
8169 "Failed to send RGR TTI ind, cellId (%d))\n",
8171 rgSCHUtlFreeSBuf(cell->instIdx, (Data**)&rgrTtiInd,
8172 sizeof(RgrTtiIndInfo));
8182 /* @brief Mark Dyn TDD CrntSfIdx.
8186 * Function: rgSCHDynTDDMrkCrntSfIdx
8187 * Purpose: update the dyn tdd sunframe index
8188 * @param[in] Inst schInst
8193 PRIVATE Void rgSCHDynTDDMrkCrntSfIdx
8198 PRIVATE Void rgSCHDynTDDMrkCrntSfIdx(schInst)
8202 RgSchDynTddCb *rgSchDynTddInfo = &(rgSchCb[schInst].rgSchDynTdd);
8205 RG_SCH_DYN_TDD_MARKTYPE(rgSchDynTddInfo, rgSchDynTddInfo->crntDTddSfIdx,
8206 RG_SCH_DYNTDD_NOTDEF);
8207 rgSchDynTddInfo->crntDTddSfIdx = (rgSchDynTddInfo->crntDTddSfIdx + 1) %
8208 RG_SCH_DYNTDD_MAX_SFINFO;
8210 //printf("Initializing Index %d \n", rgSchDynTddInfo->crntDTddSfIdx);
8216 /** @brief This function fills the TTI timinig info for each cell
8220 * Function: rgSchTomFillCellTtiInfo
8222 * @param [in] TfuTtiIndInfo *ttiInd
8223 * @param [in] Inst schInst
8224 * @param [out] uint8_t *nCell
8225 * @param [out] RgSchCellCb *cell[]
8232 PRIVATE Void rgSchTomFillCellTtiInfo
8234 TfuTtiIndInfo *ttiInd,
8237 RgSchCellCb *cells[]
8240 PRIVATE Void rgSchTomFillCellTtiInfo (ttiInd, schInst, nCell, cells)
8241 TfuTtiIndInfo *ttiInd;
8244 RgSchCellCb *cells[];
8249 TfuTtiCellInfo *cellInfo;
8253 CmLteTimingInfo frm;
8255 if (CM_LTE_MAX_CELLS < ttiInd->numCells)
8261 rgSCHDynTDDMrkCrntSfIdx(schInst);
8264 for (i = 0; i < ttiInd->numCells; i++)
8266 cellInfo = &ttiInd->cells[i];
8267 strtCellId = rgSchCb[schInst].genCfg.startCellId;
8268 Idx1 = (uint8_t)((cellInfo->cellId - strtCellId)&(CM_LTE_MAX_CELLS-1));
8269 cell = rgSchCb[schInst].cells[Idx1];
8270 /* Validate the cell */
8273 /* Use SCH inst 0 print buff */
8274 RGSCHDBGERRNEW(schInst,(rgSchPBuf(schInst),
8275 "RgLiTfuTtiInd()No cell exists for cellId %d\n",
8279 *nCell = *nCell + 1;
8280 cells[i] = (RgSchCellCb *)cell;
8283 if(cell->schTickDelta != cellInfo->schTickDelta)
8285 printf("\nMukesh: Delta changed for cellId=%d: curr delta=%d new delta=%d\n"
8286 "dlblankSf=%d ulblankSf=%d dummyTti=%d \n",
8287 cell->cellId, cell->schTickDelta, cellInfo->schTickDelta, cellInfo->dlBlankSf,cellInfo->ulBlankSf,
8288 cellInfo->isDummyTti);
8290 RGSCH_UPDATE_DELTA(schInst, cellInfo->schTickDelta);
8291 cell->schTickDelta = cellInfo->schTickDelta;
8294 cell->stopSiSch = cellInfo->dlBlankSf;
8295 cell->stopDlSch = cellInfo->dlBlankSf;
8296 cell->stopUlSch = cellInfo->ulBlankSf;
8297 if (cellInfo->isDummyTti)
8299 cell->stopDlSch = TRUE;
8301 if((0 == (cellInfo->timingInfo.sfn % 30)) && (0 == cellInfo->timingInfo.slot))
8303 //printf("5GTF_CHECK rgSCHTOMTtiInd (%d : %d)\n", cellInfo->timingInfo.sfn, cellInfo->timingInfo.slot);
8306 RGSCHCPYTIMEINFO(cellInfo->timingInfo, cell->crntTime);
8307 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->hiDci0Time,
8308 TFU_ULCNTRL_DLDELTA);
8309 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->dlDciTime,
8310 TFU_DLCNTRL_DLDELTA);
8311 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->rcpReqTime,
8312 TFU_RECPREQ_DLDELTA);
8313 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->hqRlsTime,
8314 TFU_HQFBKIND_ULDELTA);
8315 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->dlSfRlsTime,
8318 RGSCHCPYTIMEINFO_EMTC(cellInfo->timingInfo, cell->crntTime);
8319 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->hiDci0Time,
8320 TFU_ULCNTRL_DLDELTA);
8321 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->dlDciTime,
8322 TFU_DLCNTRL_DLDELTA);
8323 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->rcpReqTime,
8324 TFU_RECPREQ_DLDELTA);
8325 RGSCHDECRFRMCRNTTIME_EMTC(cell->crntTime, cell->hqRlsTime,
8326 TFU_HQFBKIND_ULDELTA);
8327 RGSCHDECRFRMCRNTTIME_EMTC(cell->crntTime, cell->dlSfRlsTime,
8330 rgSCHCmnUpdVars(cell);
8331 cell->isDlDataAllwd = TRUE;
8332 /* Get DownLink SubFrame */
8333 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
8334 frm = cell->crntTime;
8336 RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA);
8338 RGSCH_INCR_SUB_FRAME_EMTC(frm, RG_SCH_CMN_DL_DELTA);
8340 cellSch->dl.time = frm;
8346 uint8_t idx = (cell->crntTime.slot + RG_SCH_CMN_DL_DELTA) %
8347 RGSCH_NUM_SUB_FRAMES_5G;
8349 cell->isDlDataAllwd = RG_SCH_CMN_CHK_DL_DATA_ALLOWED(cell, idx);
8351 /*ccpu00130639 -ADD - used in UL HARQ proc id calculation*/
8352 if((cell->crntTime.sfn == 0) && (cell->crntTime.slot == 0))
8354 /* sfn Cycle used for Tdd UL Harq Proc Determination.
8355 This sfn Cycle will have values from 0 to numUl Harq-1. */
8356 cell->tddHqSfnCycle = (cell->tddHqSfnCycle + 1 ) %
8357 (rgSchTddUlNumHarqProcTbl[cell->ulDlCfgIdx]);
8361 if(cell->emtcEnable)
8363 rgSCHUtlEmtcResPrcTti(cell);
8369 void schFillCrntTime(
8370 SlotIndInfo slotInd,
8373 uint8_t cellCount = 0;
8374 for(cellCount = 0; cellCount < CM_LTE_MAX_CELLS; cellCount++)
8377 cell = rgSchCb[schInst].cells[cellCount];
8379 RGSCHCPYTIMEINFO(slotInd, cell->crntTime);
8381 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->hiDci0Time,
8382 TFU_ULCNTRL_DLDELTA);
8383 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->dlDciTime,
8384 TFU_DLCNTRL_DLDELTA);
8385 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->rcpReqTime,
8386 TFU_RECPREQ_DLDELTA);
8387 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->hqRlsTime,
8388 TFU_HQFBKIND_ULDELTA);
8389 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->dlSfRlsTime,
8392 RGSCH_INCR_SUB_FRAME(cell->crntTime, RG_SCH_CMN_DL_DELTA);
8394 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
8395 cellSch->dl.time = cell->crntTime;
8399 /** @brief This function prepares the TTI for scheduling and
8400 * invokes the Common channel scheduler. Uplink scheduler
8401 * is invoked first if UL Scheduling at CRC is not enabled
8405 * Function: rgSchTomTtiUlAndDlCmnChSch
8407 * @param [out] RgSchCellCb *cell
8413 PRIVATE Void rgSchTomTtiUlAndDlCmnChSch
8418 PRIVATE Void rgSchTomTtiUlAndDlCmnChSch (cell)
8423 cell->rlsHqArr[cell->crntHqIdx].numUes = 0;
8425 cell->crntHqIdx = cell->crntHqIdx % RGSCH_NUM_SUB_FRAMES;
8427 cmPrcTmr(&cell->tqCp, cell->tq, (PFV)rgSCHTmrProcTmr);
8428 rgSCHMeasGapANRepTtiHndl (cell);
8429 /* We need to fill the PHICH for the UL Data, first we need to get the UL
8430 * SF from Scheduler, next we fill the dlSf that goes out this TTI.
8431 * This must be performed prior to any other processing of the TTI
8432 * so that we do not wrap around and generate feedback prior to
8433 * reception of UL data.
8435 #ifndef RG_ULSCHED_AT_CRC
8438 uint8_t idx; /* Index into Uplink Sf array */
8440 Mval = rgSchTddPhichMValTbl[cell->ulDlCfgIdx]
8441 [cell->hiDci0Time.subframe];
8445 for(idx=0; idx < Mval; idx++)
8447 rgSCHCmnRlsUlSf(cell, idx);
8453 /* DTX processing for those Harq's which did not get feedback from L1 */
8454 rgSCHDhmRlsDlsfHqProc (cell, cell->hqRlsTime);
8455 /* Re-Init the Downlink subframe */
8456 rgSCHUtlDlRlsSubFrm(cell, cell->dlSfRlsTime);
8457 /* Added handling to retransmit
8458 * release PDCCH in case of DTX
8461 /*Check for DRX every TTI*/
8462 rgSCHDrxTtiInd(cell);
8464 /* For TDD, UL scheduling should happen after DL scheduling */
8466 #ifndef RG_ULSCHED_AT_CRC
8467 /* Perform UL scheduling */
8468 rgSCHCmnUlSch(cell);
8471 /* Perform DL scheduling for Common channels */
8472 rgSCHCmnDlCommonChSch(cell);
8477 /** @brief This function invokes the Non critical procedures like measurements,
8478 * and RGR configurations.
8482 * Function: rgSchTomTtiMiscFunctions
8484 * @param [in] RgSchCellCb *cell
8490 PRIVATE Void rgSchTomTtiMiscFunctions
8495 PRIVATE Void rgSchTomTtiMiscFunctions (cell)
8499 uint8_t suId = cell->tfuSap->sapCfg.suId;
8501 /* Invoke RAM Tti Handler */
8502 rgSCHRamTtiHndlr(cell);
8504 /* Handle RGR configurations */
8505 rgSCHGomTtiHndlr(cell, suId);
8507 if((RGM_PRB_REPORT_START == cell->prbUsage.prbRprtEnabld)
8508 && (!(cell->prbUsage.rprtPeriod) || ((glblTtiCnt % cell->prbUsage.rprtPeriod) == 0)))
8510 rgSCHUtlUpdAvgPrbUsage(cell);
8512 rgSCHL2Meas(cell,FALSE);
8515 /* LTE_ADV_FLAG_REMOVED_START */
8516 /* Report ABS Load information to application periodically */
8517 if((RGR_ENABLE == cell->lteAdvCb.absCfg.status) &&
8518 (cell->lteAdvCb.absCfg.absLoadPeriodicity))
8520 RgrLoadInfIndInfo *rgrLoadInf;
8523 cell->lteAdvCb.absLoadTtiCnt++;
8524 if(cell->lteAdvCb.absLoadTtiCnt >= cell->lteAdvCb.absCfg.absLoadPeriodicity)
8527 if(rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&rgrLoadInf,
8528 sizeof(RgrLoadInfIndInfo)) != ROK)
8530 RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),"Could not "
8531 "allocate memory for sending LoadInfo\n"));
8534 cell->lteAdvCb.absLoadTtiCnt = 0;
8535 rgrLoadInf->cellId = cell->cellId;
8536 rgrLoadInf->bw = cell->bwCfg.dlTotalBw;
8537 rgrLoadInf->type = RGR_ABS;
8538 for(idx= 0; idx<RGR_ABS_PATTERN_LEN; idx++)
8540 rgrLoadInf->u.absLoadInfo[idx] = cell->lteAdvCb.absLoadInfo[idx];
8541 cell->lteAdvCb.absLoadInfo[idx] = 0;
8543 rgSCHUtlRgrLoadInfInd(cell, rgrLoadInf);
8548 if(cell->isDlDataAllwd)
8550 /* Calling function to update CFI parameters*/
8551 rgSchCmnUpdCfiDb(cell, RG_SCH_CMN_DL_DELTA);
8555 /* Incrementing the ttiCnt in case of UL subframe */
8556 if(!cell->dynCfiCb.switchOvrInProgress)
8558 cell->dynCfiCb.ttiCnt++;
8562 rgSchCmnUpdCfiDb(cell, RG_SCH_CMN_DL_DELTA);
8565 /* LTE_ADV_FLAG_REMOVED_END */
8570 /** @brief This function invokes the Downlink scheduler
8574 * Function: rgSchTomTtiDlSch
8576 * @param [in] RgSchCellCb *cell
8582 PRIVATE Void rgSchTomTtiDlSch
8587 PRIVATE Void rgSchTomTtiDlSch (cell)
8592 if (cell->isDlDataAllwd && (cell->stopDlSch == FALSE))
8594 rgSCHCmnDlSch(cell);
8600 /** @brief This function invokes Consolidates the allocations
8601 * send the Subframe allocation info to MAC
8605 * Function: rgSchTomTtiCnsldtSfAlloc
8607 * @param [in] RgSchCellCb *cell
8613 PRIVATE Void rgSchTomTtiCnsldtSfAlloc
8618 PRIVATE Void rgSchTomTtiCnsldtSfAlloc (cell)
8623 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
8625 dlSf = rgSCHUtlSubFrmGet(cell, cellSch->dl.time);
8627 /* Prepare Subframe allocation info and send to MAC */
8628 rgSCHCmnCnsldtSfAlloc(cell);
8630 /* Call ACK NACK module to add to dlsf Queue */
8631 rgSCHAckNakRepAddToQ(cell, dlSf);
8633 rgSCHTomUtlProcTA(cell);
8638 /** @brief This function prepares the DL and UL Config requests
8643 * Function: rgSchTomTtiL1DlAndUlCfg
8645 * @param [in] RgSchCellCb *cell
8651 PRIVATE Void rgSchTomTtiL1DlAndUlCfg
8654 RgTfuCntrlReqInfo *cntrlInfo
8657 PRIVATE Void rgSchTomTtiL1DlAndUlCfg (cell, cntrlInfo)
8659 RgTfuCntrlReqInfo *cntrlInfo;
8662 RgSchDlSf *dlSf = rgSCHUtlSubFrmGet (cell, cell->dlDciTime);
8663 RgSchDlSf *ulSf = rgSCHUtlSubFrmGet (cell, cell->hiDci0Time);
8666 rgSCHTomUtlProcDlSf (dlSf, ulSf, cell, cntrlInfo, &err);
8667 /* Mark this frame as sent */
8668 dlSf->txDone = TRUE;
8670 rgBwAlloInfo[dlSf->sfNum] += dlSf->bwAssigned;
8671 rgBwAlcnt[dlSf->sfNum] ++;
8675 rgSCHTomUtlProcTddUlSf(cell);
8677 rgSCHTomUtlProcUlSf (cell, &err);
8683 /** @brief This function prepares does the Downlink subframe re-init and
8684 * Harq DTX processing
8688 * Function: rgSchTomUtlTddRlsSfAndHarq
8690 * @param [in] RgSchCellCb *cell
8696 PRIVATE Void rgSchTomUtlTddRlsSfAndHarq
8701 PRIVATE Void rgSchTomUtlTddRlsSfAndHarq (cell)
8706 /* ccpu00132341-MOD- rgSchTddRlsDlSubfrmTbl is dependent on DELTA(=2).
8707 * Instead rgSchTddDlAscSetIdxKTbl can be used as the K set gives proper
8709 /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper
8710 * output if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME()
8711 * as it is serving the purpose */
8712 if(rgSchTddDlAscSetIdxKTbl[cell->ulDlCfgIdx][cell->hqRlsTime.subframe].
8715 /* ccpu00132341-MOD- Providing the UL SF timing for avoiding
8716 * calculation inside the function */
8717 rgSCHDhmTddRlsSubFrm(cell, cell->hqRlsTime);
8718 rgSCHDhmRlsDlsfHqProc(cell, cell->hqRlsTime);
8723 /** @brief This function processes the UL subframe and fills TFU reception
8728 * Function: rgSCHTomUtlProcTddUlSf
8730 * @param [in] RgSchCellCb *cell
8736 PRIVATE Void rgSCHTomUtlProcTddUlSf
8741 PRIVATE Void rgSCHTomUtlProcTddUlSf (cell)
8747 if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
8748 [cell->rcpReqTime.subframe] == RG_SCH_TDD_UL_SUBFRAME)
8750 if (rgSCHTomUtlProcUlSf (cell, &err) != ROK)
8752 /* fill in err type and call sta ind */
8753 RGSCHDBGERRNEW(cell->instIdx, (rgSchPBuf(cell->instIdx),
8754 "Unable to process Uplink subframe for cellId (%d))\n",
8758 /* TDD Fix , to allow Special SF SRS CFg */
8759 else if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
8760 [cell->rcpReqTime.subframe] == RG_SCH_TDD_SPL_SUBFRAME)
8762 if (rgSCHTomUtlPrcUlTddSpclSf(cell, &err) != ROK)
8764 /* fill in err type and call sta ind */
8765 RGSCHDBGERRNEW(cell->instIdx, (rgSchPBuf(cell->instIdx),
8766 "Unable to process Sipceial subframe for cellId (%d))\n",
8776 /**********************************************************************
8779 **********************************************************************/