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 "envopt.h" /* environment options */
41 #include "envdep.h" /* environment dependent */
42 #include "envind.h" /* environment independent */
43 #include "gen.h" /* general layer */
44 #include "ssi.h" /* system services */
45 #include "cm5.h" /* common timers defines */
46 #include "cm_hash.h" /* common hash list defines */
47 #include "cm_llist.h" /* common linked list defines */
48 #include "cm_mblk.h" /* memory management */
49 #include "cm_tkns.h" /* common tokens */
50 #include "cm_lte.h" /* common tokens */
51 #include "tfu.h" /* RGU defines */
52 #include "lrg.h" /* layer management defines for LTE-MAC */
53 #include "rgr.h" /* layer management defines for LTE-MAC */
54 #include "rgm.h" /* layer management defines for LTE-MAC */
55 #include "rg_env.h" /* defines and macros for MAC */
56 #include "rg_sch_err.h" /* defines and macros for MAC */
57 #include "rg_sch_inf.h" /* defines and macros for MAC */
58 #include "rg_sch.h" /* defines and macros for MAC */
59 #include "rg_sch_cmn.h" /* typedefs for MAC */
60 #include "rl_interface.h"
61 #include "rl_common.h"
64 /* header/extern include files (.x) */
65 #include "gen.x" /* general layer typedefs */
66 #include "ssi.x" /* system services typedefs */
67 #include "cm5.x" /* common timers */
68 #include "cm_hash.x" /* common hash list */
69 #include "cm_lib.x" /* common library */
70 #include "cm_llist.x" /* common linked list */
71 #include "cm_mblk.x" /* memory management */
72 #include "cm_tkns.x" /* common tokens */
73 #include "cm_lte.x" /* common tokens */
74 #include "tfu.x" /* RGU types */
75 #include "lrg.x" /* layer management typedefs for MAC */
76 #include "rgr.x" /* layer management typedefs for MAC */
77 #include "rgm.x" /* layer management typedefs for MAC */
78 #include "rg_sch_inf.x" /* typedefs for Scheduler */
79 #include "rg_sch.x" /* typedefs for MAC */
80 #include "rg_sch_cmn.x" /* typedefs for MAC */
82 #include "rg_sch_emtc_ext.x"
84 U8 rgSCHCmnCalcPcqiBitSz(RgSchUeCb *ueCb,U8 numTxAnt);
85 PUBLIC S16 rgSCHDhm5gtfHqFdbkInd(RgSchUeCb *ue,RgSchCellCb *cell,CmLteTimingInfo timingInfo,TfuHqFdbk fdbk,RgSchErrInfo *err);
88 EXTERN Bool rgSCHEmtcChkEmtcUe ARGS(
93 EXTERN Void rgSchTomTtiEmtcSched ARGS(
98 EXTERN S16 rgSCHEmtcRamVldtProcRaReq
103 TfuRaReqIndInfo *raReqInd,
108 EXTERN Void rgSCHEmtcUpdCqiInfo
111 RgSchUePCqiCb *cqiCb,
114 EXTERN Void rgSCHEmtcUpdSRInfo
119 EXTERN Void rgSCHCmnEmtcHdlCrcFailInd
124 EXTERN S16 rgSCHEmtcTomUtlProcAtCrc
127 CmLteTimingInfo crntHiDci0Frm,
128 TfuCntrlReqInfo *cntrlInfo,
131 EXTERN Void rgSCHEmtcInitUeRecpReqLst
133 TfuRecpReqInfo *recpReqInfo
135 EXTERN Void rgSCHEmtcFillPucchRecpInfo
138 RgSchDlHqProcCb *hqCb,
141 EXTERN Bool rgSCHEmtcAddRecpInfoToLst
143 RgSchDlHqProcCb *hqCb,
144 TfuRecpReqInfo *recpReqInfo,
145 TfuUeRecpReqInfo *pucchRecpInfo,
148 EXTERN Void rgSCHEmtcWillUeRptCqi
153 EXTERN Void rgSchEmtcTomTtiCnsldtSfAlloc
158 EXTERN S16 rgSchEmtcTomTtiL1DlAndUlCfg
161 RgTfuCntrlReqInfo *cntrlInfo
164 EXTERN S16 rgSCHTomEmtcUtlFillDatRecpReq
166 TfuRecpReqInfo *recpReqInfo,
172 EXTERN S16 rgSCHEmtcTomUtlFillHqFdbkRecpReq
174 TfuRecpReqInfo *recpReqInfo,
180 EXTERN S16 rgSCHEmtcDhmRlsDlsfHqProc
183 CmLteTimingInfo timingInfo
186 EXTERN Void rgSCHEmtcCmnUlSch
191 #ifdef RG_ULSCHED_AT_CRC
192 EXTERN S16 rgSCHEmtcTomUtlProcDlSfAtCrc
195 CmLteTimingInfo crntUlFrm,
197 TfuCntrlReqInfo *cntrlInfo,
201 EXTERN RgSchEmtcDlSf* rgSCHEmtcUtlSubFrmGet
208 EXTERN U32 gDlMpdcchBlank;
209 EXTERN U32 gUlMpdcchBlank;
210 EXTERN S16 rgSCHUtlIotResPrcTti
217 EXTERN RgSchUeCb* rgSCHCmnGetHoUe
222 EXTERN RgSchUeCb* rgSCHCmnGetPoUe
226 CmLteTimingInfo timingInfo
228 PUBLIC S16 rgSCHTomUtlFillDatAperRecpReq ARGS(
233 TfuUeRecpReqInfo *datRecpInfo,
234 CmLteTimingInfo *timeInfo,
239 PUBLIC S16 rgSCHTomUtlFillDatPriRecpReq ARGS(
243 TfuUeRecpReqInfo *datRecpInfo,
244 CmLteTimingInfo *timeInfo,
249 PUBLIC S16 rgSCHTomUtlFillDatPCqiRecpReq ARGS(
253 TfuUeRecpReqInfo *datRecpInfo,
254 CmLteTimingInfo *timeInfo,
259 PUBLIC S16 rgSCHTomUtlFillDatSrsRecpReq ARGS(
263 TfuUeRecpReqInfo *datRecpInfo,
264 CmLteTimingInfo *timeInfo,
268 PUBLIC void schFillCrntTime(
273 EXTERN U32 delayedApiCnt;
274 U32 gPCellTb1AckCount=0,gPCellTb2AckCount=0,gPCellTb1NackCount=0,gPCellTb2NackCount=0;
275 U32 gSCellSchedCount=0,gPrimarySchedCount=0;
276 U32 gSCellTb1AckCount=0,gSCellTb2AckCount=0,gSCellTb1NackCount=0,gSCellTb2NackCount=0;
277 U32 gPCellTb1DtxCount = 0, gPCellTb2DtxCount = 0, gSCellTb1DtxCount = 0, gSCellTb2DtxCount = 0;
278 U32 gHqFdbkCount = 0;
282 U32 gCqiRecpCount = 0;
283 U32 gCqiRecpPuschCount = 0;
284 U32 gCqiRcvdCount = 0;
285 Bool gF1bCsPres = FALSE;
287 U32 gCqiReqCount = 0;
289 U32 gACqiRcvdCount = 0;
290 U32 gCqiReptToAppCount = 0;
291 U32 gRawACqiCount= 0;
292 U32 gCqiDropCount,gPucchDropCount;
293 U32 gCqiPucchLowSnrDropCount,gCqiPucchConfMaskDropCount,gCqiPuschConfMaskDropCount;
295 U32 gUlCrcFailCount = 0;
296 U32 gUlCrcPassCount = 0;
297 U32 gPuschCqiDropCount = 0;
298 U32 gCaDbgCaFrmt = 0;
299 U32 gCaDbgNonCaFrmt = 0;
300 U32 gPcellZeroBoOcc=0,gScellZeroBoOcc=0, dbgDelayedDatReqInMac=0,gDropDatReqCnt=0, gIccPktRcvrMemDropCnt=0;
304 U32 gUlCrcFailCounter = 0;
305 U32 gUlCrcPassCounter = 0;
309 EXTERN U32 gUl5gtfPdcchSend;
314 PRIVATE S16 rgSCHTomUtlFillCqiSrsWithSr ARGS
318 TfuRecpReqInfo *recpReqInfo,
319 TfuUeRecpReqInfo *pucchRecpInfo,
322 PRIVATE Bool rgSCHTomUtlFillDatHarqRecpReq ARGS
326 TfuUeRecpReqInfo *datRecpInfo,
327 TfuRecpReqInfo *recpReqInfo
329 PRIVATE S16 rgSCHTomUtlFillSrRecpReq ARGS((
330 TfuRecpReqInfo *recpReq,
334 PRIVATE S16 rgSCHTomUtlFillRiRecpReq ARGS((
335 TfuRecpReqInfo *recpReq,
339 PRIVATE S16 rgSCHTomUtlFillPcqiRecpReq ARGS((
340 TfuRecpReqInfo *recpReq,
344 PRIVATE S16 rgSCHTomUtlFillSrsRecpReq ARGS((
345 TfuRecpReqInfo *recpReq,
349 PRIVATE S16 rgSCHTomUtlGenIndices ARGS((
354 TfuSubbandInfo* sbInfo));
356 PRIVATE S16 rgSCHTomUtlFillCqiRiRecpReq ARGS(
358 TfuRecpReqInfo *recpReqInfo,
363 PRIVATE Void rgSchTomFillCellTtiInfo ARGS
365 TfuTtiIndInfo *ttiInd,
373 PUBLIC U32 rgBwAlloInfo[RGSCH_NUM_SUB_FRAMES]; /* Num of Rbs Allocated in each SF */
374 PUBLIC U32 rgBwAlcnt[RGSCH_NUM_SUB_FRAMES]; /*Num of times Allocation done in each Subframe */
377 /* rg006.201: [ccpu000111706, ccpu00112394]: Separated UL and DL TTI
384 U32 gDlNumUePerTti[20] = {0};
385 U32 gUlNumUePerTti[20] = {0};
386 PRIVATE S16 rgSCHTomUtlProcDlSf ARGS((
390 RgTfuCntrlReqInfo *cntrlInfo,
392 #ifdef RG_ULSCHED_AT_CRC
393 PRIVATE S16 rgSCHTomUtlProcDlSfAtCrc ARGS((
395 CmLteTimingInfo crntUlFrm,
397 TfuCntrlReqInfo *cntrlInfo,
399 #endif /* RG_ULSCHED_AT_CRC */
402 PRIVATE S16 rgSCHTomUtlPrcUlTddSpclSf ARGS((
405 #endif /* TFU_UPGRADE */
407 PRIVATE S16 rgSCHTomUtlFillPhich ARGS((
409 TfuCntrlReqInfo *cntrlInfo,
413 PRIVATE S16 rgSCHTomUtlFillDlPdcch ARGS((
415 TfuCntrlReqInfo *cntrlInfo,
418 PRIVATE S16 rgSCHTomUtlFillUlPdcch ARGS((
420 TfuCntrlReqInfo *cntrlInfo,
424 PRIVATE S16 rgSCHTomUtlProcTA ARGS((
427 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq ARGS((
428 TfuRecpReqInfo *recpReq,
433 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq ARGS((
434 TfuRecpReqInfo *recpReq,
440 PUBLIC S16 rgSCHTomFillOnlySrsRecpReq ARGS
444 TfuUeRecpReqInfo *datRecpInfo
446 PRIVATE S16 rgSCHTomUtlFillCqiSrSrsWithHq ARGS
449 TfuRecpReqInfo *recpReqInfo,
451 TfuUeRecpReqInfo *pucchRecpInfo,
453 Bool isDatPresOnSecCell
456 PUBLIC S16 rgSCHTomUtlFillRiBitWidthInfo ARGS
461 PUBLIC U8 rgSCHTomUtlFetchPcqiBitSz ARGS
468 PUBLIC U8 rgSCHTomUtlFetchPcqiBitSzPucchMode21 ARGS
471 TfuCqiPucchMode21 *mode21Info,
476 PUBLIC S16 rgSCHTomUtlMoveNxtOccasion ARGS
483 PRIVATE S16 rgSCHTomUtlMovePcqiNxtOccasion ARGS
490 PRIVATE S16 rgSCHTomUtlMovePriNxtOccasion ARGS
497 PRIVATE S16 rgSCHTomUtlMoveSrNxtOccasion ARGS
503 PRIVATE S16 rgSCHTomUtlMoveSrsNxtOccasion ARGS
508 PRIVATE S16 rgSCHTomUtlWillUeRprtCqiRi ARGS((
510 Bool *willueRprtCqiRii));
513 PRIVATE S16 rgSCHTomUtlFillDatRecpReq ARGS((
514 TfuRecpReqInfo *recpReq,
519 PRIVATE S16 rgSCHTomUtlFillDatRecpReq ARGS((
520 TfuRecpReqInfo *recpReq,
527 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk ARGS((
528 TfuRecpReqInfo *recpReqInfo,
539 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk ARGS((
540 TfuRecpReqInfo *recpReqInfo,
551 PRIVATE S16 rgSCHTomUtlFillSfHqFdbk ARGS((
552 TfuRecpReqInfo *recpReqInfo,
563 PRIVATE S16 rgSCHTomUtlFillSfHqFdbk ARGS((
564 TfuRecpReqInfo *recpReqInfo,
575 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForOneUe ARGS((
576 RgSchDlHqProcCb *hqCb,
577 TfuRecpReqInfo *recpReqInfo,
586 RgrTddAckNackMode ackNackMode,
587 RgSchUePucchRecpInfo **pucchInfoRef,
595 EXTERN PUBLIC Void rgSCHCmnDlSpsSch (RgSchCellCb *cell);
599 PRIVATE S16 rgSCHTomCnsdrRelPdcch ARGS
603 TfuRecpReqInfo *recpReqInfo,
608 PRIVATE S16 rgSCHTomCnsdrRelPdcch ARGS
612 TfuRecpReqInfo *recpReqInfo,
620 PRIVATE Void rgSchTomTtiMiscFunctions ARGS
625 PRIVATE Void rgSchTomTtiUlAndDlCmnChSch ARGS
630 PRIVATE Void rgSchTomTtiDlSch ARGS
635 PRIVATE Void rgSchTomTtiCnsldtSfAlloc ARGS
640 PRIVATE Void rgSchTomTtiL1DlAndUlCfg ARGS
643 RgTfuCntrlReqInfo *cntrlInfo
647 PRIVATE Void rgSCHTomUtlSendSfnTick ARGS
653 PRIVATE Void rgSchTomUtlTddRlsSfAndHarq ARGS
657 PRIVATE Void rgSCHTomUtlProcTddUlSf ARGS
662 PRIVATE Void rgSCHTomUtlGethqRes ARGS
670 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1 ARGS
672 RgSchDlHqProcCb *hqCb,
673 TfuUePucchRecpReq *hqRecpReq,
679 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234 ARGS
681 RgSchDlHqProcCb *hqCb,
682 TfuUePucchRecpReq *hqRecpReq,
692 PUBLIC U32 rgDlCqiRptCnt[16], rgTotDlCqiRpt;
695 U32 rgSch5gtfCqi2Mcs[15] =
696 {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14};
698 /* forward references */
700 /*HARQ Feedback interpretation in accordance with Femto Forum.
701 Note: There is no value as '0' in Femto Forum Spec but in order to retain
702 the existing usage in MAC (and its Acceptance), its being considered*/
703 CONSTANT PRIVATE U8 rgSchTomHqFbkMap[8] = {0,1,0,0,4,4,4,4};
704 /*added #defines instead of magic numbers*/
705 CONSTANT PRIVATE U32 rgSCHTomBinCoe[RG_SCH_MAX_NUM_UE_SEL_SUBBANDS][RG_SCH_MAX_TOT_NUM_SUBBANDS]={
706 {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},
707 {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},
708 {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},
709 {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},
710 {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},
711 {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}
715 /*ccpu00116923 - ADD - SRS present support*/
716 /*Tables Derived from 3GPP TS 36.211 Section 5.5.3.3 */
717 /* Table 5.5.3.3-1 */
719 CONSTANT PUBLIC RgSchFddCellSpSrsSubfrmTbl rgSchFddCellSpSrsSubfrmTbl = {
720 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE},
721 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE},
722 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE},
723 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE},
724 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
725 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE},
726 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE},
727 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE},
728 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE},
729 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
730 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
731 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
732 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
733 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE},
734 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE},
735 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}
738 /* Table 5.5.3.3-2 */
739 CONSTANT PUBLIC RgSchTddCellSpSrsSubfrmTbl rgSchTddCellSpSrsSubfrmTbl = {
740 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
741 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE},
742 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE},
743 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE},
744 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE},
745 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE},
746 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE},
747 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE},
748 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
749 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
750 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE},
751 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE},
752 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE},
753 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE},
754 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
755 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}
758 PUBLIC S8 rgSchCmnAper20n22DiffCqi[4] = {1, 2, 3, 4};
759 PUBLIC S8 rgSchCmnAper30n31DiffCqi[4] = {0, 1, 2, -1};
763 * @brief get Ue for dedicated preamble rach
767 * Function: rgSCHGetDedPrmUe
769 * Invoked by: rgSCHTomRaReqInd
771 * @param[in] RgSchCellCb *cell
772 * @param[in] TfuRaReqIndInfo *raReqInd
778 PUBLIC S16 rgSCHGetDedPrmUe
782 CmLteTimingInfo timingInfo,
786 PUBLIC S16 rgSCHGetDedPrmUe(cell, rapId, timingInfo, ue)
789 CmLteTimingInfo timingInfo;
793 RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch);
795 printf("rapId[%d] cellSch->rachCfg.dedPrmStart[%d] cellSch->rachCfg.numDedPrm[%d]\n",rapId,cellSch->rachCfg.dedPrmStart,cellSch->rachCfg.numDedPrm);
796 /* Finding UE in handOver List */
797 if ((rapId < cellSch->rachCfg.dedPrmStart) ||
798 (rapId > cellSch->rachCfg.dedPrmStart +
799 cellSch->rachCfg.numDedPrm - 1))
801 /* This ded Preamble corresponds to handover */
802 *ue = rgSCHCmnGetHoUe(cell, rapId);
803 printf(" his ded Preamble corresponds to hando\n");
805 else/* Finding UE from PDCCH Order Mappings */
807 /* Get the UE which has transmitted this RaReq */
808 *ue = rgSCHCmnGetPoUe(cell, rapId, timingInfo);
809 printf(" ==== inding UE from PDCCH Order Mapping\n");
814 * @brief Handler for processing Random Access request indication
819 * Function: rgSCHTomRaReqInd
821 * Handler for processing Random Access request indication recieved from
824 * Invoked by: RgLiTfuRaReqInd of LIM
827 * - Validate the information received: cellId value and raRnti values
828 * - Process the request: Call rgSCHRamProcRaReq (cell, raRnti, raReqInd)
830 * @param[in] RgSchCellCb *cell
831 * @param[in] TfuRaReqIndInfo *raReqInd
837 PUBLIC S16 rgSCHTomRaReqInd
840 TfuRaReqIndInfo *raReqInd
843 PUBLIC S16 rgSCHTomRaReqInd(cell, raReqInd)
845 TfuRaReqIndInfo *raReqInd;
852 Bool isEmtcUe = FALSE;
854 RgSchUeCb *ue = NULLP;
856 TRC2(rgSCHTomRaReqInd);
858 if(cell->cellId != raReqInd->cellId)
860 err.errType = RGSCHERR_TOM_RAREQIND;
861 err.errCause = RGSCHERR_TOM_INV_CELL_ID;
862 RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,
863 "rgSCHTomRaReqInd(): No cell found with raReq cellId = (%d) errorType (%d)"
864 " errorCause(%d)",raReqInd->cellId, err.errType, err.errCause);
868 for (raRntiCnt = 0; raRntiCnt < raReqInd->nmbOfRaRnti; raRntiCnt++)
870 for (raReqCnt = 0; raReqCnt < raReqInd->rachInfoArr->numRaReqInfo; raReqCnt++)
872 rapId = raReqInd->rachInfoArr[raRntiCnt].raReqInfoArr[raReqCnt].rapId;
874 if(RGSCH_IS_DEDPRM(cell, rapId))
876 rgSCHGetDedPrmUe(cell, rapId, raReqInd->timingInfo, &ue);
879 /* Since rapId is within dedicated range and No ue context
880 * is found means it is a spurious rach. So ignore it.*/
885 if(FALSE == isEmtcUe)
887 #if (ERRCLASS & ERRCLS_DEBUG)
888 if(raReqInd->rachInfoArr[raRntiCnt].raRnti > RGSCH_MAX_RA_RNTI)
890 RGSCHLOGERROR(cell->instIdx, ERRCLS_INT_PAR, ERG013,
891 (ErrVal)raReqInd->rachInfoArr[raRntiCnt].raRnti,
892 ("rgSCHTomRaReqInd(): raRnti is out of range\n"));
896 ret = rgSCHRamProcRaReq(raReqCnt, cell, raReqInd->rachInfoArr[raRntiCnt].raRnti,
897 (TfuRachInfo *)&raReqInd->rachInfoArr[raRntiCnt],
898 raReqInd->timingInfo, ue, &err);
901 err.errType = RGSCHERR_TOM_RAREQIND;
902 RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,
903 "RARNTI:%d rgSCHTomRaReqInd(): RAM processing failed errType(%d) "
904 "errCause(%d)", raReqInd->rachInfoArr[raRntiCnt].raRnti,
905 err.errType, err.errCause);
912 } /* rgSCHTomRaReqInd */
916 * @brief Handler for processing uplink CQI indication recieved from PHY.
920 * Function: rgSCHTomUlCqiInd
922 * Handler for processing uplink CQI indication recieved from PHY.
924 * Invoked by: RgLiTfuUlCqiInd
928 * - Invoke scheduler to push reported CQI info rgSCHUtlUlCqiInd
930 * @param[in] RgSchCellCb *cell
931 * @param[in] TfuUlCqiIndInfo *ulCqiInd
937 PUBLIC S16 rgSCHTomUlCqiInd
940 TfuUlCqiIndInfo *ulCqiInd
943 PUBLIC S16 rgSCHTomUlCqiInd(cell, ulCqiInd)
945 TfuUlCqiIndInfo *ulCqiInd;
950 TfuUlCqiRpt *ulCqiInfo;
951 TRC2(rgSCHTomUlCqiInd);
953 node = ulCqiInd->ulCqiRpt.first;
954 if(cell->cellId != ulCqiInd->cellId)
956 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
957 "rgSCHTomUlCqiInd() Unable to get the ulCqiInd cell with id(%d)",
962 for (;node; node=node->next)
964 ulCqiInfo = (TfuUlCqiRpt *)node->node;
965 #if (ERRCLASS & ERRCLS_DEBUG)
966 if(ulCqiInfo->numSubband == 0)
968 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Num Subband is"
969 "out of range RNTI:%d",ulCqiInfo->rnti);
973 if((ue = rgSCHDbmGetUeCb(cell, ulCqiInfo->rnti)) == NULLP)
976 if((ue = rgSCHDbmGetSpsUeCb(cell, ulCqiInfo->rnti)) == NULLP)
979 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get "
980 "the ue for RNTI:%d", ulCqiInfo->rnti);
984 /* wideband cqi is directly reported now. and also isTxPort0 */
985 rgSCHUtlUlCqiInd(cell, ue, ulCqiInfo);
988 } /* rgSCHTomUlCqiInd */
991 * @brief Handler for processing PUCCH power adjustment indication
995 * Function: rgSCHTomPucchDeltaPwrInd
997 * Handler for processing PUCCH power adjustment indication
1000 * Invoked by: RgLiTfuPucchDeltaPwrInd
1004 * - Invoke scheduler to push reported CQI info rgSCHUtlPucchDeltaPwrInd
1006 * @param[in] RgSchCellCb *cell
1007 * @param[in] TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
1013 PUBLIC S16 rgSCHTomPucchDeltaPwrInd
1016 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
1019 PUBLIC S16 rgSCHTomPucchDeltaPwrInd(cell, pucchDeltaPwr)
1021 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr;
1026 TfuPucchDeltaPwr *ueElem;
1028 TRC2(rgSCHTomPucchDeltaPwrInd);
1030 if(cell->cellId != pucchDeltaPwr->cellId)
1032 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1033 "rgSCHTomPucchDeltaPwrInd() Unable to get the pucchDeltaPwr cell with id(%d)",
1034 pucchDeltaPwr->cellId);
1038 node = pucchDeltaPwr->pucchDeltaPwrLst.first;
1039 for (;node; node=node->next)
1041 ueElem = (TfuPucchDeltaPwr *)node->node;
1042 if((ue = rgSCHDbmGetUeCb(cell, ueElem->rnti)) == NULLP)
1045 if((ue = rgSCHDbmGetSpsUeCb(cell, ueElem->rnti)) == NULLP)
1048 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d "
1049 "rgSCHTomPucchDeltaPwrInd() Unable to get the ue ",
1054 rgSCHUtlPucchDeltaPwrInd(cell, ue, ueElem->pucchDeltaPwr);
1057 } /* rgSCHTomPucchDeltaPwrInd */
1060 * @brief Handler for processing harq ACK/NACK indication recieved from PHY.
1064 * Function: rgSCHTomHarqAckInd
1066 * Handler for processing harq ACK/NACK indication recieved from PHY.
1068 * Invoked by: RgLiTfuHqInd
1071 * For each HqAckInfo received
1073 * - If UE doesnt exist look for a RaCb and invoke rgSCHRamMsg4FdbkInd
1074 * - Invoke HARQ module to pass HARQ-ACK info rgSCHDhmHqFdbkInd
1076 * @param[in] TfuHqIndInfo *harqAckInd
1082 PUBLIC S16 rgSCHTomHarqAckInd
1085 TfuHqIndInfo *harqAckInd
1088 PUBLIC S16 rgSCHTomHarqAckInd(cell, harqAckInd)
1090 TfuHqIndInfo *harqAckInd;
1101 RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1103 RgSchCellCb *iterCellP;
1105 TRC2(rgSCHTomHarqAckInd);
1107 if(cell->cellId != harqAckInd->cellId)
1109 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() Unable to get"
1110 " the cell for cellId (%d)", harqAckInd->cellId);
1111 err.errType = RGSCHERR_TOM_HARQACKIND;
1112 err.errCause = RGSCHERR_TOM_INV_CELL_ID;
1116 node = harqAckInd->hqIndLst.first;
1117 for (;node; node=node->next)
1119 hqInfo = (TfuHqInfo *)node->node;
1121 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1122 TfuHqFdbk fdbk = hqInfo->isAck[0];
1123 raCb = rgSCHDbmGetRaCb (cell, hqInfo->rnti);
1124 ue = rgSCHDbmGetUeCb (cell, hqInfo->rnti);
1125 if (ue != NULLP && raCb == NULLP)
1127 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, harqAckInd->timingInfo, fdbk, &err)) != ROK)
1129 err.errType = RGSCHERR_TOM_HARQACKIND;
1130 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
1131 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1132 err.errType, err.errCause);
1140 if ((rgSCHDhmRlsDlsfHqProc (cell, harqAckInd->timingInfo)) != ROK)
1142 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink "
1143 "subframe for cellId (%d) ", cell->cellId);
1144 err.errType = RGSCHERR_TOM_HARQACKIND;
1147 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
1149 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
1151 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
1153 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
1154 if(rlsHqBufs->numUes)
1156 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
1157 RgSchMacRlsHq (&pst, rlsHqBufs);
1159 rlsHqBufs->numUes = 0;
1163 rlsHqBufs->numUes = 0;
1164 node = harqAckInd->hqIndLst.first;
1165 for (;node; node=node->next)
1167 hqInfo = (TfuHqInfo *)node->node;
1168 for(tbCnt=0; tbCnt<TFU_MAX_HARQ_FDBKS; tbCnt++)
1170 hqInfo->isAck[tbCnt]=(TfuHqFdbk)rgSchTomHqFbkMap[hqInfo->isAck[tbCnt]];
1172 raCb = rgSCHDbmGetRaCb (cell, hqInfo->rnti);
1173 ue = rgSCHDbmGetUeCb (cell, hqInfo->rnti);
1174 if (ue == NULLP && raCb != NULLP)
1177 rgSCHRamMsg4FdbkInd (raCb);
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);
1190 else if (ue != NULLP && raCb == NULLP)
1192 /* Get the Downlink HARQ entity from ue */
1193 if ((rgSCHDhmHqFdbkInd (ue, RGSCH_HQ_FDB_IND_CB_TYPE_HQ_ENT,
1194 cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
1196 err.errType = RGSCHERR_TOM_HARQACKIND;
1197 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
1198 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1199 err.errType, err.errCause);
1203 else if (ue != NULLP && raCb != NULLP)
1205 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1206 cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
1208 err.errType = RGSCHERR_TOM_HARQACKIND;
1209 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1210 " feedback processing failed errType(%d) errCause(%d).",
1211 err.errType, err.errCause);
1217 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
1218 "UE CB or RA CB ", hqInfo->rnti);
1219 err.errType = RGSCHERR_TOM_HARQACKIND;
1224 /* Check with TDD call DHM*/
1225 if ((rgSCHDhmRlsDlsfHqProc (cell, harqAckInd->timingInfo)) != ROK)
1227 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink "
1228 "subframe for cellId (%d) ", harqAckInd->cellId);
1229 err.errType = RGSCHERR_TOM_HARQACKIND;
1232 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
1234 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
1236 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
1238 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
1239 if(rlsHqBufs->numUes)
1241 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
1242 RgSchMacRlsHq (&pst, rlsHqBufs);
1244 rlsHqBufs->numUes = 0;
1249 } /* rgSCHTomHarqAckInd */
1253 * @brief Handler for processing Scheduling Request indication
1254 * recieved from PHY for a list of UEs.
1258 * Function: rgSCHTomSrInd
1260 * Handler for processing Scheduling Request indication recieved from PHY
1263 * Invoked by: RgLiTfuSrInd
1267 * - Invoke scheduler to indicate SR rgSCHUtlSrRcvd
1269 * @param[in] TfuSrIndInfo *srInd
1275 PUBLIC S16 rgSCHTomSrInd
1281 PUBLIC S16 rgSCHTomSrInd(cell, srInd)
1283 TfuSrIndInfo *srInd;
1292 TRC2(rgSCHTomSrInd);
1294 if(cell->cellId != srInd->cellId)
1296 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for srcInd cellId"
1297 ":%d ", srInd->cellId);
1298 err.errType = RGSCHERR_TOM_SRIND;
1299 err.errCause = RGSCHERR_TOM_INV_CELL_ID;
1304 node = srInd->srLst.first;
1305 for (;node; node=node->next)
1309 srInfo = (TfuSrInfo *)node->node;
1310 ue = rgSCHDbmGetUeCb (cell, srInfo->rnti);
1313 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB",
1317 rgSCHUtlHdlUlTransInd(cell, ue, srInd->timingInfo);
1318 /*Need to activate UE as SR received*/
1319 if (ue->isDrxEnabled)
1321 rgSCHDrxSrInd(cell, ue);
1323 ret = rgSCHUtlSrRcvd (cell, ue, srInd->timingInfo, &err);
1326 err.errType = RGSCHERR_TOM_SRIND;
1327 RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,"Scheduler processing failed "
1328 "errType(%d) errCause(%d) RNTI:%d", err.errType, err.errCause,srInfo->rnti);
1333 } /* end of rgSCHTomSrInd */
1336 * @brief Handler for processing downlink CQI indication recieved from
1341 * Function: rgSCHTomDoaInd
1343 * Handler for processing DOA recieved from PHY
1346 * Invoked by: RgLiTfuDoaInd
1350 * - Invoke scheduler to indicate DOA rgSCHUtlDoaInd
1352 * @param[in] TfuDoaIndInfo *doaInd
1358 PUBLIC S16 rgSCHTomDoaInd
1361 TfuDoaIndInfo *doaInd
1364 PUBLIC S16 rgSCHTomDoaInd(cell, doaInd )
1366 TfuDoaIndInfo *doaInd;
1372 TRC2(rgSCHTomDoaInd);
1374 if(cell->cellId != doaInd->cellId)
1376 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for doaInd cellId"
1377 ":%d", doaInd->cellId);
1382 node = doaInd->doaRpt.first;
1383 for (;node; node=node->next)
1385 doaInfo = (TfuDoaRpt *)node->node;
1386 ue = rgSCHDbmGetUeCb (cell, doaInfo->rnti);
1389 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB",
1393 rgSCHUtlDoaInd(cell, ue, doaInfo);
1396 } /* rgSCHTomDoaInd */
1398 * @brief Handler for processing downlink CQI indication recieved from
1403 * Function: rgSCHTomDlCqiInd
1405 * Handler for processing downlink CQI indication recieved from PHY
1408 * Invoked by: RgLiTfuDlCqiInd
1412 * - Invoke scheduler to indicate DL CQI rgSCHUtlDlCqiInd
1414 * @param[in] TfuDlCqiIndInfo *dlCqiInd
1420 PUBLIC S16 rgSCHTomDlCqiInd
1423 TfuDlCqiIndInfo *dlCqiInd
1426 PUBLIC S16 rgSCHTomDlCqiInd(cell, dlCqiInd)
1428 TfuDlCqiIndInfo *dlCqiInd;
1433 TfuDlCqiRpt *dlCqiInfo;
1434 TRC2(rgSCHTomDlCqiInd);
1436 if(cell->cellId != dlCqiInd->cellId)
1438 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
1439 ":%d", dlCqiInd->cellId);
1444 node = dlCqiInd->dlCqiRptsLst.first;
1445 for (;node; node=node->next)
1447 dlCqiInfo = (TfuDlCqiRpt *)node->node;
1448 ue = rgSCHDbmGetUeCb (cell, dlCqiInfo->rnti);
1451 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%dUnable to get the UE CB",
1455 rgSCHUtlDlCqiInd(cell, ue, dlCqiInfo, dlCqiInd->timingInfo);
1456 rgSCHUtlHdlUlTransInd(cell, ue, dlCqiInd->timingInfo);
1459 } /* rgSCHTomDlCqiInd */
1462 * @brief Handler for moving PCQI instance for the next periodic occasion
1466 * Function: rgSCHTomUtlMovePcqiNxtOccasion
1468 * Handler for moving PCQI instance for the next periodic occasion
1470 * Invoked by: rgSCHTomUtlFill*
1473 * - For a UE move its occurence instance to next occasion
1474 * depending on its periodicity
1475 * - Remove it from the current list and insert it to the list
1476 * having the index matching with the derived number.
1478 * @param[in] RgSchCellCb *cell,
1479 * [in] RgSchUeCb *ue
1485 PRIVATE S16 rgSCHTomUtlMovePcqiNxtOccasion
1489 RgSchUePCqiCb *cqiCb
1492 PRIVATE S16 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb)
1495 RgSchUePCqiCb *cqiCb;
1500 CmLteTimingInfo timingInfo;
1501 TRC2(rgSCHTomUtlMovePcqiNxtOccasion);
1503 if(cqiCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_SB_REP)
1506 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timingInfo, TFU_DELTA);
1508 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timingInfo,
1509 TFU_RECPREQ_DLDELTA);
1511 RG_SCH_ADD_TO_CRNT_TIME(timingInfo,timingInfo,cqiCb->cqiPeri);
1512 rgSCHTomUtlPcqiSbCalcBpIdx(timingInfo,ue,cqiCb);
1514 /* Compute Next Transmission Instance */
1515 cqiIdx = cqiCb->cqiPeri + cqiCb->nCqiTrIdx;
1516 cqiIdx = cqiIdx%RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1517 /* Delete from current List and move to new list */
1518 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst,
1521 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to remove node",
1524 cqiCb->nCqiTrIdx = cqiIdx;
1525 cmLListAdd2Tail(&(cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst),
1526 &(cqiCb->cqiLstEnt));
1528 rgSCHUtlSCellHndlCqiCollsn(cqiCb);
1532 } /* rgSCHTomUtlMovePcqiNxtOccasion */
1535 * @brief Handler for moving RI instance for the next periodic occasion
1539 * Function: rgSCHTomUtlMovePriNxtOccasion
1541 * Handler for moving PCQI instance for the next periodic occasion
1543 * Invoked by: rgSCHTomUtlFill*
1546 * - For a UE move its occurence instance to next occasion
1547 * depending on its periodicity
1548 * - Remove it from the current list and insert it to the list
1549 * having the index matching with the derived number.
1551 * @param[in] RgSchCellCb *cell,
1552 * [in] RgSchUeCb *ue
1558 PRIVATE S16 rgSCHTomUtlMovePriNxtOccasion
1565 PRIVATE S16 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb)
1568 RgSchUePCqiCb *riCb;
1578 TRC2(rgSCHTomUtlMovePriNxtOccasion);
1579 crntTime = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)
1580 +(cell->crntTime.slot);
1581 #ifdef XEON_SPECIFIC_CHANGES
1582 RGSCHCPYTIMEINFO(cell->crntTime, ue->riRecpTime);
1584 /* Compute Next Transmission Instance */
1585 if (riCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_WB_REP)
1587 effPeriodicity = riCb->cqiPeri * riCb->riPeri;
1588 tempIdx = effPeriodicity + riCb->nRiTrIdx;
1592 effPeriodicity = (riCb->h * riCb->cqiPeri * riCb->riPeri);
1593 /* In case of SFN wraparound, the SB CQI reporting cycle breaks
1594 * and RI->WB CQI->SBCQI.. should resume. RI is repositioned
1595 * accordingly. WBCQI handling is naturally accomplished */
1596 if ((crntTime + TFU_RECPREQ_DLDELTA + effPeriodicity) >
1597 (RGSCH_MAX_SUBFRM_5G - 1))
1599 riTrInsTime = (effPeriodicity - riCb->cqiOffset + riCb->riOffset) % effPeriodicity;
1600 tempIdx = RGSCH_MAX_SUBFRM_5G + (effPeriodicity - riTrInsTime);
1601 /* In case of SFN wraparound, riDist should be distance from crntTime
1602 * + TFU_RECPREQ_DLDELTA to tempIdx. Updating effPeriodicity
1603 * to make riDist calculation consistent for both SFN wraparound
1604 * case and normal case */
1605 effPeriodicity = tempIdx - TFU_RECPREQ_DLDELTA - crntTime;
1609 tempIdx = effPeriodicity + riCb->nRiTrIdx;
1612 riIdx = tempIdx % RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1613 if (effPeriodicity >= RG_SCH_PCQI_SRS_SR_TRINS_SIZE)
1615 riDist = rgSCHUtlFindDist((U16)(crntTime + TFU_RECPREQ_DLDELTA),
1616 (U16)(crntTime + TFU_RECPREQ_DLDELTA + effPeriodicity));
1623 /* ccpu00138306- If Periodicity is equal to Queue Size or multiple of it
1624 * then the next occasion idx will be same as current Idx, Hence need not
1627 if((effPeriodicity%RG_SCH_PCQI_SRS_SR_TRINS_SIZE) != 0)
1629 /* Delete from current List and move to new list */
1630 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[riCb->nRiTrIdx].riLst,
1633 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"[%d]UEID:Unable to remove node",
1636 RG_SCH_RECORD(&riCb->histElem,RGSCH_ACTION_DEL, &cell->pCqiSrsSrLst[riCb->nRiTrIdx].riLst);
1637 cmLListAdd2Tail(&cell->pCqiSrsSrLst[riIdx].riLst,
1639 RG_SCH_RECORD(&riCb->histElem,RGSCH_ACTION_ADD, &cell->pCqiSrsSrLst[riIdx].riLst);
1648 riCb->nRiTrIdx = riIdx;
1649 riCb->riDist = riDist;
1652 rgSCHUtlSCellHndlRiCollsn(riCb);
1655 } /* rgSCHTomUtlMovePriNxtOccasion */
1658 * @brief Handler for moving SR instance for the next periodic occasion
1662 * Function: rgSCHTomUtlMoveSrNxtOccasion
1664 * Handler for moving SR instance for the next periodic occasion
1666 * Invoked by: rgSCHTomUtlFill*
1669 * - For a UE move its occurence instance to next occasion
1670 * depending on its periodicity
1671 * - Remove it from the current list and insert it to the list
1672 * having the index matching with the derived number.
1674 * @param[in] RgSchCellCb *cell,
1675 * [in] RgSchUeCb *ue
1681 PRIVATE S16 rgSCHTomUtlMoveSrNxtOccasion
1687 PRIVATE S16 rgSCHTomUtlMoveSrNxtOccasion(cell, ue)
1694 TRC2(rgSCHTomUtlMoveSrNxtOccasion);
1696 /* Compute Next Transmission Instance */
1697 srIdx = ue->srCb.peri + ue->srCb.nSrTrIdx;
1698 srIdx = srIdx%RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1699 /* Delete from current List and move to new list */
1700 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[ue->srCb.nSrTrIdx].srLst,
1701 &ue->srCb.srLstEnt))
1703 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to remove node",
1706 ue->srCb.nSrTrIdx = srIdx;
1707 cmLListAdd2Tail(&cell->pCqiSrsSrLst[ue->srCb.nSrTrIdx].srLst,
1708 &ue->srCb.srLstEnt);
1711 } /* rgSCHTomUtlMoveSrNxtOccasion */
1714 * @brief Handler for moving SRS instance for the next periodic occasion
1718 * Function: rgSCHTomUtlMoveSrsNxtOccasion
1720 * Handler for moving SRS instance for the next periodic occasion
1722 * Invoked by: rgSCHTomUtlFill*
1725 * - For a UE move its occurence instance to next occasion
1726 * depending on its periodicity
1727 * - Remove it from the current list and insert it to the list
1728 * having the index matching with the derived number.
1730 * @param[in] RgSchCellCb *cell,
1731 * [in] RgSchUeCb *ue
1737 PRIVATE S16 rgSCHTomUtlMoveSrsNxtOccasion
1743 PRIVATE S16 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue)
1754 TRC2(rgSCHTomUtlMoveSrsNxtOccasion);
1755 crntTime = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)
1756 +(cell->crntTime.slot);
1758 /* Compute Next Transmission Instance */
1759 tempIdx = ue->srsCb.peri + ue->srsCb.nSrsTrIdx;
1760 srsIdx = tempIdx %RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1761 if (ue->srsCb.peri > RG_SCH_PCQI_SRS_SR_TRINS_SIZE)
1763 srsDist = rgSCHUtlFindDist((U16)(crntTime + TFU_RECPREQ_DLDELTA),
1764 (U16)(crntTime + TFU_RECPREQ_DLDELTA + ue->srsCb.peri));
1771 /* ccpu00138306- If Periodicity is equal to Queue Size or multiple of it
1772 * then the next occasion idx will be same as current Idx, Hence need not
1775 if((ue->srsCb.peri%RG_SCH_PCQI_SRS_SR_TRINS_SIZE) != 0)
1777 /* Delete from current List and move to new list */
1778 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[ue->srsCb.nSrsTrIdx].srsLst,
1779 &ue->srsCb.srsLstEnt))
1781 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to remove node",
1784 cmLListAdd2Tail(&cell->pCqiSrsSrLst[srsIdx].srsLst,
1785 &ue->srsCb.srsLstEnt);
1794 ue->srsCb.nSrsTrIdx = srsIdx;
1795 ue->srsCb.srsDist = srsDist;
1798 } /* rgSCHTomUtlMoveSrsNxtOccasion */
1802 * @brief Handler for processing RAW CQI indication recieved from
1807 * Function: rgSCHTomRawCqiInd
1809 * Handler for processing RAW CQI indication recieved from PHY
1812 * Invoked by: RgLiTfuRawCqiInd
1816 * - Invoke scheduler to indicate Raw CQI rgSCHUtlRawCqiInd
1818 * @param[in] TfuRawCqiIndInfo *rawCqiInd
1824 PUBLIC S16 rgSCHTomRawCqiInd
1827 TfuRawCqiIndInfo *rawCqiInd
1830 PUBLIC S16 rgSCHTomRawCqiInd(cell, rawCqiInd)
1832 TfuRawCqiIndInfo *rawCqiInd;
1837 TfuRawCqiRpt* rawCqiInfo;
1841 RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1842 RgSchCellCb *iterCellP;
1853 TRC2(rgSCHTomRawCqiInd);
1855 if(cell->cellId != rawCqiInd->cellId)
1857 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
1858 ":%d", rawCqiInd->cellId);
1863 node = rawCqiInd->rawCqiRpt.first;
1864 for (;node; node=node->next)
1866 rawCqiInfo = (TfuRawCqiRpt *)node->node;
1867 ue = rgSCHDbmGetUeCb (cell, rawCqiInfo->crnti);
1868 raCb = rgSCHDbmGetRaCb (cell, rawCqiInfo->crnti);
1872 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"CRNTI:%d Unable to get the UECB",
1879 if (rawCqiInfo->numBits >= 5)
1880 printf("cellId [%d] crnti [%d] numBits [%d] uciPayload [0x%08x] sfn/sf [%d:%d]\n",
1881 cell->cellId, rawCqiInfo->crnti, rawCqiInfo->numBits, rawCqiInfo->uciPayload,
1882 rawCqiInd->timingInfo.sfn, rawCqiInd->timingInfo.slot);
1884 if (rawCqiInfo->numBits == 1)
1886 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1887 U8 fdbk = TFU_HQFDB_NACK;
1888 /* Process HARQ FdbkInd */
1889 hqAck = (rawCqiInfo->uciPayload >> 31) & 0x1;
1892 fdbk = TFU_HQFDB_ACK;
1893 hqInfo.isAck[0] = fdbk;
1895 if (ue != NULLP && raCb == NULLP)
1897 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, rawCqiInd->timingInfo, fdbk, &err)) != ROK)
1899 err.errType = RGSCHERR_TOM_HARQACKIND;
1900 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
1901 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1902 err.errType, err.errCause);
1906 else if (ue == NULLP && raCb != NULLP)
1908 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1909 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1911 err.errType = RGSCHERR_TOM_HARQACKIND;
1912 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1913 " feedback processing failed errType(%d) errCause(%d)",
1914 err.errType, err.errCause);
1919 else if (ue != NULLP && raCb != NULLP)
1921 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1922 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1924 err.errType = RGSCHERR_TOM_HARQACKIND;
1925 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1926 " feedback processing failed errType(%d) errCause(%d).",
1927 err.errType, err.errCause);
1933 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
1934 "UE CB or RA CB ", rawCqiInfo->crnti);
1935 err.errType = RGSCHERR_TOM_HARQACKIND;
1939 printf("rawCqiInfo->numBits [%d] uciPayload [0x%08x] sfn/sf [%d:%d]\n", rawCqiInfo->numBits,
1940 rawCqiInfo->uciPayload, rawCqiInd->timingInfo.sfn, rawCqiInd->timingInfo.slot);
1943 else if (rawCqiInfo->numBits == 5)
1945 /* Process CQI-RI Ind*/
1946 ri = (rawCqiInfo->uciPayload >> 27) & 0x1;
1947 cqi = (rawCqiInfo->uciPayload >> 28) & 0xF;
1951 printf("\n UE[%d] CQI[%d] Invalid\n", ue->ueId, cqi);
1954 ue->ue5gtfCb.mcs = rgSch5gtfCqi2Mcs[cqi - 1];
1955 ue->ue5gtfCb.rank = ri + 1;
1957 if (rawCqiInfo->numBits > 1)
1959 ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
1960 ueDl->mimoInfo.cwInfo[0].cqi = cqi;
1961 ueDl->cqiFlag = TRUE;
1962 rgSCHCmnDlSetUeAllocLmtLa(cell, ue);
1963 // rgSCHCheckAndSetTxScheme(cell, ue);
1968 printf("UE[%d] CQI[%d] MCS[%d] RI[%d]\n", ue->ueId, cqi, ue->ue5gtfCb.mcs, ri);
1971 else if (rawCqiInfo->numBits == 6)
1973 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1974 TfuHqFdbk fdbk = TFU_HQFDB_NACK;
1975 /* Process both HARQ and CQI-RI Ind*/
1976 ri = (rawCqiInfo->uciPayload >> 26) & 0x1;
1977 cqi = (rawCqiInfo->uciPayload >> 27) & 0xF;
1978 hqAck = (rawCqiInfo->uciPayload >> 31) & 0x1;
1981 printf("UE[%d] CQI[%d] Invalid\n", ue->ueId, cqi);
1984 ue->ue5gtfCb.mcs = rgSch5gtfCqi2Mcs[cqi - 1];
1985 ue->ue5gtfCb.rank = ri + 1;
1987 if (rawCqiInfo->numBits > 1)
1989 ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
1990 ueDl->mimoInfo.cwInfo[0].cqi = cqi;
1991 ueDl->cqiFlag = TRUE;
1992 rgSCHCmnDlSetUeAllocLmtLa(cell, ue);
1993 // rgSCHCheckAndSetTxScheme(cell, ue);
1998 fdbk = TFU_HQFDB_ACK;
1999 hqInfo.isAck[0] = fdbk;
2001 if (ue != NULLP && raCb == NULLP)
2003 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, rawCqiInd->timingInfo, fdbk, &err)) != ROK)
2005 err.errType = RGSCHERR_TOM_HARQACKIND;
2006 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
2007 "HARQ feedback processing failed errType(%d)errCause(%d)n",
2008 err.errType, err.errCause);
2012 else if (ue == NULLP && raCb != NULLP)
2014 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
2015 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
2017 err.errType = RGSCHERR_TOM_HARQACKIND;
2018 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
2019 " feedback processing failed errType(%d) errCause(%d)",
2020 err.errType, err.errCause);
2025 else if (ue != NULLP && raCb != NULLP)
2027 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
2028 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
2030 err.errType = RGSCHERR_TOM_HARQACKIND;
2031 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
2032 " feedback processing failed errType(%d) errCause(%d).",
2033 err.errType, err.errCause);
2039 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
2040 "UE CB or RA CB ", rawCqiInfo->crnti);
2041 err.errType = RGSCHERR_TOM_HARQACKIND;
2046 printf("\nUE[%u] CQI[%u] MCS[%u] RI[%u] HQ[%u]\n", ue->ueId, cqi, ue->ue5gtfCb.mcs, ri, hqAck);
2051 if ((rgSCHDhmRlsDlsfHqProc (cell, rawCqiInd->timingInfo)) != ROK)
2053 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink "
2054 "subframe for cellId (%d) ", cell->cellId);
2055 err.errType = RGSCHERR_TOM_HARQACKIND;
2058 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
2060 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
2062 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
2064 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
2065 if(rlsHqBufs->numUes)
2067 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
2068 RgSchMacRlsHq (&pst, rlsHqBufs);
2070 rlsHqBufs->numUes = 0;
2074 } /* rgSCHTomRawCqiInd */
2077 * @brief Handler for processing SRS indication recieved from
2082 * Function: rgSCHTomSrsInd
2084 * Handler for SRS indication recieved from PHY
2087 * Invoked by: RgLiTfuSrsInd
2091 * - Invoke scheduler to indicate UL SRS rgSCHUtlSrsInd
2093 * @param[in] TfuSrsIndInfo *srsInd
2099 PUBLIC S16 rgSCHTomSrsInd
2102 TfuSrsIndInfo *srsInd
2105 PUBLIC S16 rgSCHTomSrsInd(cell, srsInd)
2107 TfuSrsIndInfo *srsInd;
2114 TRC2(rgSCHTomSrsInd);
2116 if(cell->cellId != srsInd->cellId)
2118 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
2119 ":%d", srsInd->cellId);
2123 node = srsInd->srsRpt.first;
2124 for (;node; node=node->next)
2126 srsInfo = (TfuSrsRpt *)node->node;
2127 ue = rgSCHDbmGetUeCb (cell, srsInfo->ueId);
2130 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
2131 "UE CB", srsInfo->ueId);
2134 rgSCHUtlSrsInd(cell, ue, srsInfo, srsInd->timingInfo);
2135 rgSCHUtlHdlUlTransInd(cell, ue, srsInd->timingInfo);
2138 } /* rgSCHTomSrsInd */
2142 * Fun: rgSCHTomUtlGenIndices
2144 * Desc: This function reconstructs the Subband Indices for
2145 * of M selected Subbands conveyed by the UE for APeriodic Modes
2146 * 2-0 and 2-2. It decodes the Label which uniquely encodes M out
2154 * File: rg_sch_utl.c
2159 PRIVATE S16 rgSCHTomUtlGenIndices
2165 TfuSubbandInfo* sbInfo
2168 PRIVATE S16 rgSCHTomUtlGenIndices(label, posM, valN, valK, sbInfo)
2173 TfuSubbandInfo* sbInfo;
2176 U8 idx, kval, xval, xmin;
2179 for(kval=0; kval<posM;kval++)
2182 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe, (posM-kval-1));
2183 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe[posM-kval-1], (valN-xval-1));
2184 binCoe = rgSCHTomBinCoe[posM-kval-1][valN-xval-1];
2188 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe[posM-kval-1], (valN-xval-1));
2189 binCoe = rgSCHTomBinCoe[posM-kval-1][valN-xval-1];
2192 sbInfo[kval].numRb = valK;
2193 sbInfo[kval].rbStart = idx*valK;
2195 label = label-binCoe;
2198 } /* end of rgSCHTomUtlGenIndices*/
2202 * @brief Handler for processing decode failure indication recieved from
2207 * Function: rgSCHTomCrcInd
2209 * Handler for processing decode failure indication recieved from
2210 * PHY for a set of UEs.
2212 * Invoked by: RgLiTfuCrcInd of rg_sch.x
2215 * - Validate the information received and retrieve cell and ue.
2216 * - Process Decode failure Indication: Call rgSCHUhmProcHqFailure().
2218 * @param[in] TfuCrcIndInfo *crcInd
2224 PUBLIC S16 rgSCHTomCrcInd
2227 TfuCrcIndInfo *crcInd
2230 PUBLIC S16 rgSCHTomCrcInd(cell, crcInd)
2232 TfuCrcIndInfo *crcInd;
2235 RgSchUeCb *ue = NULLP;
2236 RgSchRaCb *raCb = NULLP;
2238 TfuCrcInfo *crcInfo;
2239 #ifdef RG_ULSCHED_AT_CRC
2242 CmLteTimingInfo crntHiDci0Frm;
2243 //RgSchCmnUlCell *cellUl;
2244 Inst inst = cell->instIdx;
2245 TfuCntrlReqInfo *cntrlInfo;
2253 RgSchUlHqProcCb *hqProc;
2257 RgSchUlHqProcCb *ulHqProc;
2260 TRC2(rgSCHTomCrcInd);
2262 if(cell->cellId != crcInd->cellId)
2264 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
2265 ":%d", crcInd->cellId);
2268 #ifdef RG_ULSCHED_AT_CRC
2271 static CmLteTimingInfo lastCrc = {2000,0};
2272 CmLteTimingInfo crntCrc = cell->crntTime;
2273 if (RGSCH_TIMEINFO_SAME(lastCrc, crntCrc))
2275 /*Removed the WA to drop 2nd CRC*/
2276 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"Recieved CRC "
2277 "twice per TTI @(%u,%u)", cell->crntTime.sfn,
2278 cell->crntTime.slot);
2284 node = crcInd->crcLst.first;
2285 for (;node; node=node->next)
2287 crcInfo = (TfuCrcInfo*)node->node;
2288 ue = rgSCHDbmGetUeCb (cell, crcInfo->rnti);
2292 /* Fetch from SPS List */
2293 ue = rgSCHDbmGetSpsUeCb(cell, crcInfo->rnti);
2297 raCb = rgSCHDbmGetRaCb (cell, crcInfo->rnti);
2304 /* Added Ul TB count for Uplink data scheduled*/
2308 ulHqProc = &(raCb->msg3HqProc);
2309 if(ulHqProc->remTx == (cell->rachCfg.maxMsg3Tx -1))
2311 cell->dlUlTbCnt.tbTransUlTotalCnt++;
2316 rgSCHUtlUlHqProcForUe(cell, crcInd->timingInfo, ue, &ulHqProc);
2317 if(ulHqProc->remTx == ((RgUeUlHqCb*)ulHqProc->hqEnt)->maxHqRetx)
2319 cell->dlUlTbCnt.tbTransUlTotalCnt++;
2324 if (crcInfo->isFailure == FALSE)
2328 rgSCHRamMsg3DatInd(raCb);
2330 /*ccpu00128820 - MOD - Msg3 alloc double delete issue*/
2331 hqProc = &(raCb->msg3HqProc);
2332 RGSCH_UPD_PHICH(cell->ulDlCfgIdx, crcInd->timingInfo.slot,
2340 gUlCrcPassCounter++;
2345 RGSCHCPYTIMEINFO(crcInd->timingInfo, ue->datIndTime);
2346 #ifndef MAC_SCH_STATS
2347 rgSCHUhmProcDatInd(cell, ue, crcInd->timingInfo);
2350 /** Stats update over here
2353 RgSchCmnUe *cmnUe = RG_SCH_CMN_GET_UE(ue,cell);
2355 rgSCHUhmProcDatInd(cell, ue, crcInd->timingInfo, cmnUe->ul.crntUlCqi[0]);
2357 #endif /* MAC_SCH_STATS */
2359 rgSCHUtlHdlUlTransInd(cell, ue, crcInd->timingInfo);
2361 rgSCHUtlHdlCrcInd(cell, ue, crcInd->timingInfo);
2369 /* SR_RACH_STATS : MSG3 Nack / DTX*/
2370 if (crcInfo->isDtx == TRUE)
2376 rgNumMsg3CrcFailed++;
2378 rgSCHRamMsg3FailureInd(raCb);
2380 rgSCHCmnEmtcHdlCrcFailInd(cell, raCb);
2382 /* Added Ul TB count for CRC Failure of MSG3 */
2384 ulHqProc = &(raCb->msg3HqProc);
2385 if(ulHqProc->remTx == (cell->rachCfg.maxMsg3Tx -1))
2387 cell->dlUlTbCnt.tbTransUlFaulty++;
2395 gUlCrcFailCounter++;
2400 #ifndef MAC_SCH_STATS
2401 rgSCHUhmProcHqFailure (cell, ue, crcInd->timingInfo, crcInfo->rv);
2404 RgSchCmnUe *cmnUe = RG_SCH_CMN_GET_UE(ue,cell);
2406 rgSCHUhmProcHqFailure (cell, ue, crcInd->timingInfo, crcInfo->rv, cmnUe->ul.crntUlCqi[0]);
2408 #endif /* MAC_SCH_STATS */
2409 rgSCHUtlHdlUlTransInd(cell, ue, crcInd->timingInfo);
2411 rgSCHUtlHdlCrcFailInd(cell, ue, crcInd->timingInfo);
2413 /* Added Ul TB count for CRC Failure of Uplink data */
2415 rgSCHUtlUlHqProcForUe(cell, crcInd->timingInfo, ue, &ulHqProc);
2416 if(ulHqProc->remTx == ((RgUeUlHqCb*)ulHqProc->hqEnt)->maxHqRetx)
2418 cell->dlUlTbCnt.tbTransUlFaulty++;
2425 /* ccpu00132653-ADD Added Sched_At_Crc Changes for TDD and optimized here
2426 the codebase across TDD and FDD*/
2427 #ifdef RG_ULSCHED_AT_CRC
2428 /* Changes to do uplink scheduling at CRC Indication */
2429 //cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
2430 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, crntHiDci0Frm, TFU_ULCNTRL_DLDELTA);
2433 rgSCHCmnRlsUlSf(cell,0);
2436 /* Allocating memory for CntrlReq as it required for both EMTC and
2438 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&cntrlInfo,
2439 sizeof(TfuCntrlReqInfo))) != ROK)
2441 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate TfuCntrlReqInfo "
2445 rgSCHCmnUlSch(cell);
2447 rgSCHL2Meas(cell,TRUE);
2449 /* Also, sending UL DCI and PHICH for just scheduled subframe */
2450 ulSf = rgSCHUtlSubFrmGet (cell, crntHiDci0Frm);
2452 if ((rgSCHTomUtlProcDlSfAtCrc (ulSf, crntHiDci0Frm, cell, cntrlInfo, &err)) != ROK)
2454 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomCrcInd() Unable to process"
2455 " downlink subframe for cellId %d", crcInd->cellId);
2456 err.errType = RGSCHERR_TOM_TTIIND;
2459 #endif /* RG_ULSCHED_AT_CRC */
2461 } /* rgSCHTomCrcInd */
2464 * @brief Handler for processing timing Advance indication recieved from
2469 * Function: rgSCHTomTimingAdvInd
2471 * Handler for processing timing advance indication recieved from PHY
2474 * Invoked by: RgLiTfuTimingAdvInd
2478 * - Call DHM to update value of Timing Advance rgSCHDhmUpdTa.
2480 * @param[in] TfuTimingAdvIndInfo *timingAdvInd
2486 PUBLIC S16 rgSCHTomTimingAdvInd
2489 TfuTimingAdvIndInfo *timingAdvInd
2492 PUBLIC S16 rgSCHTomTimingAdvInd(cell, timingAdvInd)
2494 TfuTimingAdvIndInfo *timingAdvInd;
2499 TfuTimingAdvInfo *timingAdvInfo;
2502 TRC2(rgSCHTomTimingAdvInd);
2504 if(cell->cellId != timingAdvInd->cellId)
2506 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
2507 "=(%d)", timingAdvInd->cellId);
2512 node = timingAdvInd->timingAdvLst.first;
2513 for (;node; node=node->next)
2515 timingAdvInfo = (TfuTimingAdvInfo *)node->node;
2516 ue = rgSCHDbmGetUeCb (cell, timingAdvInfo->rnti);
2519 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB",
2520 timingAdvInfo->rnti);
2523 rgSCHDhmUpdTa (cell, ue, timingAdvInfo->timingAdv);
2526 } /* rgSCHTomTimingAdvInd */
2529 * @brief Handler for processing TTI indication recieved from
2530 * PHY for 'n' cells.
2534 * Function: rgSCHTomTtiInd
2536 * Handler for processing slot indication recieved from MAC
2537 * for a cell. This is split into the below Steps.
2539 * 1: Complete the Uplink and Common Channel Scheduling for each Cell
2540 * 2: Complete the UE specific Scheduling for each Cell / across Cells.
2541 * 3: Consolidate the subframe allocations and send to each MAC instance
2542 * 4: Fill the Tfu structures for DL and UL Config requests
2543 * 5: Handle the RGR Config messages per Cell
2545 * @param[in] SlotIndInfo *slotInd
2546 * @param[in] Inst schInst
2550 PUBLIC Void rgSCHTomTtiInd
2552 SlotIndInfo *slotInd,
2556 PUBLIC Void rgSCHTomTtiInd(slotInd, schInst)
2557 SlotIndInfo *slotInd;
2561 RgInfSfAlloc *subfrmAlloc;
2562 RgTfuCntrlReqInfo *cntrlInfo = NULLP;
2566 RgSchCellCb *cell[CM_LTE_MAX_CELLS];
2567 RgSchCellCb *cellLst[CM_LTE_MAX_CELLS];
2569 TRC2(rgSCHTomTtiInd);
2575 //rgSchTomFillCellTtiInfo(slotInd, schInst, &nCell, &cell[0]);
2577 schFillCrntTime(*slotInd,schInst);
2578 for (i = 0; i < nCell; i++)
2580 /* Perform UL and DL Common Channel scheduling */
2581 rgSchTomTtiUlAndDlCmnChSch (cell[i]);
2584 /* Perform scheduling in Order of
2588 for (i = 0; i < nCell; i++)
2591 if (cell[i]->isDlDataAllwd && (cell[i]->stopDlSch == FALSE))
2593 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell[i]);
2594 /* Perform DL Retx scheduling */
2595 cellSch->apisDl->rgSCHDlRetxSched(cell[i], &cellSch->allocInfo);
2599 rgSchCmnPreDlSch(cell, nCell, cellLst);
2600 for (i = 0; i < nCell; i++)
2602 /* Perform DL scheduling */
2603 rgSchTomTtiDlSch (cellLst[i]);
2605 rgSchCmnPstDlSch(cell[0]);
2607 for (i = 0; i < nCell; i++)
2610 #ifndef RG_ULSCHED_AT_CRC
2611 /* Perform UL scheduling for TDD */
2612 rgSCHCmnUlSch (cell[i]);
2616 /* Init SF Alloc info per Cell */
2617 for (i = 0; i < nCell; i++)
2619 subfrmAlloc = &(cell[i]->sfAllocArr[cell[i]->crntSfIdx]);
2620 rgSCHUtlResetSfAlloc(subfrmAlloc,FALSE,TRUE);
2622 for (i = 0; i < nCell; i++)
2624 if (cell[i]->isDlDataAllwd && (cell[i]->stopSiSch == FALSE))
2626 subfrmAlloc = &(cell[i]->sfAllocArr[cell[i]->crntSfIdx]);
2628 * TFU_DLDATA_DLDELTA is used in this calculation because the subfrmAlloc
2629 * timingInfo which is being calculated here will be used by MAC
2631 RG_SCH_ADD_TO_CRNT_TIME(cell[i]->crntTime, subfrmAlloc->timingInfo,
2632 RG_DL_DELTA - TFU_DLDATA_DLDELTA);
2633 /* Consolidate the Allocations and send response to MAC instances */
2634 rgSchTomTtiCnsldtSfAlloc (cell[i]);
2638 for (i = 0; i < nCell; i++)
2640 if (cell[i]->isDlDataAllwd && (cell[i]->stopSiSch == FALSE))
2642 /* Send the consolidated Alloc Info to MAC instances */
2643 rgSCHCmnSndCnsldtInfo (cell[i]);
2647 for (i = 0; i < nCell; i++)
2649 /* Fill control data from scheduler to PHY */
2650 if ((ret = rgSCHUtlAllocEventMem((cell[i]->instIdx), (Ptr *)&cntrlInfo,
2651 sizeof(RgTfuCntrlReqInfo))) != ROK)
2653 RLOG_ARG0(L_ERROR,DBG_CELLID,cell[i]->cellId,"Unable to Allocate TfuCntrlReqInfo"
2659 /* Fill the TFU structures and send to CL */
2660 if(TRUE == cell[i]->emtcEnable)
2662 ret = rgSchEmtcTomTtiL1DlAndUlCfg (cell[i], cntrlInfo);
2666 && (NULLP != cntrlInfo))
2668 /* Fill the TFU structures and send to CL */
2669 rgSchTomTtiL1DlAndUlCfg (cell[i], cntrlInfo);
2673 rgSCHTomUtlSendSfnTick(cell[0]);
2676 for (i = 0; i < nCell; i++)
2678 /* Invoke non critical functions like measurements, etc */
2679 rgSchTomTtiMiscFunctions (cell[i]);
2684 U32 dbgUeIdChngAndDatReqInClCnt = 0;
2685 static U32 gTtiCount = 0;
2688 if(gTtiCount == 3000)
2690 #ifdef XEON_SPECIFIC_CHANGES
2691 printf("SChed:: (P/S)::(%u/%u) \n",
2692 gPrimarySchedCount,gSCellSchedCount);
2694 printf("\n HQFDBK :: %u\n",gHqFdbkCount);
2699 total = gPCellTb1AckCount + gPCellTb1NackCount + gPCellTb1DtxCount;
2700 total2 = gPCellTb2AckCount + gPCellTb2NackCount + gPCellTb2DtxCount;
2702 printf("\n PCell:: TB1:: (A/N/D)::(%u/%u/%u) TB2:: (A/N/D)::(%u/%u/%u)\n",
2703 gPCellTb1AckCount,gPCellTb1NackCount,gPCellTb1DtxCount,
2704 gPCellTb2AckCount,gPCellTb2NackCount,gPCellTb2DtxCount);
2705 if ((total != 0 ) && total2 != 0)
2707 printf("\n PCell:: TB1:: (AP/NP/DP)::(%.2f/%.2f/%.2f) TB2:: (AP/NP/DP)::(%.2f/%.2f/%.2f)\n",
2708 (float)gPCellTb1AckCount/total * 100,(float)gPCellTb1NackCount/total * 100,(float)gPCellTb1DtxCount/total * 100,
2709 (float)gPCellTb2AckCount/total2 *100 ,(float)gPCellTb2NackCount/total2 *100 ,(float)gPCellTb2DtxCount/total2 *2);
2712 total = gSCellTb1AckCount + gSCellTb1NackCount + gSCellTb1DtxCount;
2713 total2 = gSCellTb2AckCount + gSCellTb2NackCount + gSCellTb2DtxCount;
2716 printf("\n SCell:: TB1:: (A/N/D)::(%u/%u/%u) TB2:: (A/N/D)::(%u/%u/%u)\n",
2717 gSCellTb1AckCount,gSCellTb1NackCount,gSCellTb1DtxCount,
2718 gSCellTb2AckCount,gSCellTb2NackCount,gSCellTb2DtxCount);
2719 if ((total != 0 ) && total2 != 0)
2721 printf("\n SCell:: TB1:: (AP/NP/DP)::(%.2f/%.2f/%.2f) TB2:: (AP/NP/DP)::(%.2f/%.2f/%.2f)\n",
2722 (float)gSCellTb1AckCount/total * 100,(float)gSCellTb1NackCount/total * 100,(float)gSCellTb1DtxCount/total * 100,
2723 (float)gSCellTb2AckCount/total2 *100 ,(float)gSCellTb2NackCount/total2 *100 ,(float)gSCellTb2DtxCount/total2 *2);
2727 printf("\n CQI:: Recp(Pucch/Pusch):Rcvd(pcqi/rawacqireport/apcqi/AppReprt)::(%u/%u):(%u/%u/%u/%u)\n",
2728 gCqiRecpCount,gCqiRecpPuschCount,gCqiRcvdCount,gRawACqiCount,
2729 gACqiRcvdCount,gCqiReptToAppCount);
2731 printf("\n (F1BCS Count/Cqi/Ri/CqiDrop/PucchDrop/PuschCqiDrop)::(%u/%u/%u/%u/%u/%u)\n",
2732 gF1bCsCount,gCqiReqCount,gRiReqCount,gCqiDropCount,gPucchDropCount,gPuschCqiDropCount);
2734 printf("UL::(DCI0/CrcPass/CrcFail)::(%u/%u/%u)\n"
2735 "gPcellZeroBoOcc:%u\t gScellZeroBoOcc:%u dbgUeIdChngAndDatReqInClCnt: %u\n"
2736 "DelayedDatReqInMac: %u DelayedDatReqInCl : %u gIccPktRcvrMemDropCnt :%u\n",
2742 dbgUeIdChngAndDatReqInClCnt,
2743 dbgDelayedDatReqInMac,
2744 gDropDatReqCnt, gIccPktRcvrMemDropCnt);
2746 printf("SChed:: (P/S)::(%ld/%ld) \n",
2747 gPrimarySchedCount,gSCellSchedCount);
2749 printf("\n HQFDBK :: %ld\n",gHqFdbkCount);
2751 printf("\n PCell:: TB1:: (A/N/D)::(%ld/%ld/%ld) TB2:: (A/N/D)::(%ld/%ld/%ld)\n",
2752 gPCellTb1AckCount,gPCellTb1NackCount,gPCellTb1DtxCount,
2753 gPCellTb2AckCount,gPCellTb2NackCount,gPCellTb2DtxCount);
2755 printf("\n SCell:: TB1:: (A/N/D)::(%ld/%ld/%ld) TB2:: (A/N/D)::(%ld/%ld/%ld)\n",
2756 gSCellTb1AckCount,gSCellTb1NackCount,gSCellTb1DtxCount,
2757 gSCellTb2AckCount,gSCellTb2NackCount,gSCellTb2DtxCount);
2759 printf("\n CQI:: Recp(Pucch/Pusch):Rcvd(pcqi/rawacqireport/apcqi/AppReprt)::(%ld/%ld):(%ld/%ld/%ld/%ld)\n",
2760 gCqiRecpCount,gCqiRecpPuschCount,gCqiRcvdCount,gRawACqiCount,
2761 gACqiRcvdCount,gCqiReptToAppCount);
2762 printf("\n CQI:: PucchCqiSnrDropCnt/PucchCqiConfBitMaskDropCnt/PuschCqiConfMaskDropCount :: (%ld/%ld/%ld) \n",gCqiPucchLowSnrDropCount,gCqiPucchConfMaskDropCount,gCqiPuschConfMaskDropCount);
2764 printf("\n (F1BCS Count/Cqi/Ri/CqiDrop/PucchDrop/PuschCqiDrop)::(%ld/%ld/%ld/%ld/%ld/%ld)\n",
2765 gF1bCsCount,gCqiReqCount,gRiReqCount,gCqiDropCount,gPucchDropCount,gPuschCqiDropCount);
2767 printf("UL::(DCI0/CrcPass/CrcFail)::(%ld/%ld/%ld)\n"
2768 "gPcellZeroBoOcc:%ld\t gScellZeroBoOcc:%ld dbgUeIdChngAndDatReqInClCnt: %ld\n"
2769 "DelayedDatReqInMac: %ld DelayedDatReqInCl : %ld gIccPktRcvrMemDropCnt :%ld\n",
2775 dbgUeIdChngAndDatReqInClCnt,
2776 dbgDelayedDatReqInMac,
2777 gDropDatReqCnt, gIccPktRcvrMemDropCnt);
2778 //printf ("\n delayedApiCnt:%ld",delayedApiCnt);
2782 rgSCHLaaPrintStats();
2784 gCaDbgNonCaFrmt = gIccPktRcvrMemDropCnt = 0;
2796 gCqiPucchLowSnrDropCount = 0;
2797 gCqiPucchConfMaskDropCount = 0;
2798 gCqiPuschConfMaskDropCount = 0;
2799 gPuschCqiDropCount = 0;
2802 gUlCrcPassCount = 0;
2803 gUlCrcFailCount = 0;
2806 gCqiRecpPuschCount = 0;
2809 gCqiReptToAppCount = 0;
2814 gPrimarySchedCount = 0;
2815 gSCellSchedCount = 0;
2816 gSCellTb1AckCount = 0;
2817 gSCellTb2AckCount = 0;
2818 gSCellTb2AckCount = 0;
2819 gSCellTb2NackCount = 0;
2820 gPCellTb1AckCount = 0;
2821 gPCellTb1NackCount = 0;
2822 gPCellTb2AckCount = 0;
2823 gPCellTb2NackCount = 0;
2824 gSCellTb1NackCount=0;
2826 gPCellTb1DtxCount = 0;
2827 gPCellTb2DtxCount = 0;
2828 gSCellTb1DtxCount = 0;
2829 gSCellTb2DtxCount = 0;
2830 gPcellZeroBoOcc = 0;
2831 gScellZeroBoOcc = 0;
2839 } /* rgSCHTomTtiInd */
2841 /** @brief This function does the TTI processin for the uplink subframe,
2842 * already populated by the scheduler.
2846 * Function: rgSCHTomUtlProcUlSf
2849 * - Loop through the Uplink allocations present in the uplink subframe.
2850 * - For each allocation Fill a data reception request to be sent to PHY
2851 * - Also fills the harq reception requests for the expected HQ feedbacks.
2854 * @param [in] RgSchCellCb *cell
2855 * @param [out] RgSchErrInfo *err
2862 PRIVATE S16 rgSCHTomUtlProcUlSf
2868 PRIVATE S16 rgSCHTomUtlProcUlSf (cell, err)
2874 TfuRecpReqInfo *recpReqInfo;
2876 U16 validIdx = 0; /* Index computed from recreq's timing info*/
2878 Inst inst = cell->instIdx;
2880 TRC2(rgSCHTomUtlProcUlSf)
2882 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&recpReqInfo,
2883 sizeof(TfuRecpReqInfo))) != ROK)
2885 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate TfuRecpReqInfo "
2887 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
2890 recpReqInfo->cellId = cell->cellId;
2891 cmLListInit(&recpReqInfo->ueRecpReqLst);
2893 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, recpReqInfo->timingInfo,
2894 TFU_RECPREQ_DLDELTA);
2896 /* Filling data Reception requests */
2897 ret = rgSCHTomUtlFillDatRecpReq(recpReqInfo, cell,
2902 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to fill Data recption "
2903 "requests for cell");
2904 RGSCH_FREE_MEM(recpReqInfo);
2907 /* Filling HARQ Reception requests */
2908 ret = rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, validIdx,err);
2911 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to fill Harq Feedback "
2912 "reception requests for cell");
2913 RGSCH_FREE_MEM(recpReqInfo);
2916 /* sending the RecpReq to Phy */
2917 if (rgSCHUtlTfuRecpReq(inst, cell->tfuSap->sapCfg.suId, recpReqInfo) != ROK)
2919 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info for cell");
2922 } /* end of rgSCHTomUtlProcUlSf */
2926 /** @brief This function does the TTI processin for the uplink subframe,
2927 * already populated by the scheduler.
2931 * Function: rgSCHTomUtlPrcUlTddSpclSf
2934 * - Fill the SRS Info for the Special Subframe in Reception Req.
2935 * - Send the Reception Req to TFU
2938 * @param [in] RgSchCellCb *cell
2939 * @param [out] RgSchErrInfo *err
2945 PRIVATE S16 rgSCHTomUtlPrcUlTddSpclSf
2951 PRIVATE S16 rgSCHTomUtlPrcUlTddSpclSf (cell, err)
2957 TfuRecpReqInfo *recpReqInfo;
2958 U16 validIdx; /* Index computed from recreq's timing info*/
2959 Inst inst = cell->instIdx;
2961 TRC2(rgSCHTomUtlPrcUlTddSpclSf)
2963 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&recpReqInfo,
2964 sizeof(TfuRecpReqInfo))) != ROK)
2966 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to "
2967 "Allocate TfuRecpReqInfo for cell");
2968 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
2971 recpReqInfo->cellId = cell->cellId;
2972 cmLListInit(&recpReqInfo->ueRecpReqLst);
2974 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, recpReqInfo->timingInfo, TFU_RECPREQ_DLDELTA);
2976 RG_SCH_GET_IDX_PCQISRSSR(recpReqInfo->timingInfo, validIdx);
2979 if(cell->srsCfg.isSrsCfgPres &&
2980 rgSchTddCellSpSrsSubfrmTbl[cell->srsCfg.srsSubFrameCfg][recpReqInfo->timingInfo.slot])
2982 recpReqInfo->srsPres = TRUE;
2986 recpReqInfo->srsPres = FALSE;
2989 /* Filling SRS Reception requests */
2990 ret = rgSCHTomUtlFillSrsRecpReq (recpReqInfo, cell, validIdx, err);
2993 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to fill"
2994 " SRS recption requests for cell");;
2995 RGSCH_FREE_MEM(recpReqInfo);
2998 /* sending the RecpReq to Phy */
2999 if (rgSCHUtlTfuRecpReq(inst, cell->tfuSap->sapCfg.suId, recpReqInfo) != ROK)
3001 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to send "
3002 "Cntrl info for cell");
3005 } /* end of rgSCHTomUtlPrcUlTddSpclSf */
3008 /** @brief This function does all the processing related to a single downlink
3013 * Function: rgSCHTomUtlProcDlSf
3016 * - collate control data for all UEs and send to PHY
3017 * - collate data buffers for all UEs and send to PHY
3019 * @param [in] RgSchDlSf *dlSf
3020 * @param [in] RgSchDlSf *ulSf
3021 * @param [in] RgSchCellCb *cell
3022 * @param [out] RgSchErrInfo *err
3026 PRIVATE S16 rgSCHTomUtlProcDlSf
3031 RgTfuCntrlReqInfo *cntrlInfo,
3035 PRIVATE S16 rgSCHTomUtlProcDlSf (dlSf, ulSf, cell, cntrlInfo, err)
3039 RgTfuCntrlReqInfo *cntrlInfo;
3043 Inst inst = cell->instIdx;
3045 U8 sfTyp = 1; /* Dl Subframe */
3047 TRC2(rgSCHTomUtlProcDlSf);
3049 cmLListInit(&cntrlInfo->phichLst);
3050 cmLListInit(&cntrlInfo->dlPdcchLst);
3051 cmLListInit(&cntrlInfo->ulPdcchLst);
3053 #ifdef TFU_ALLOC_EVENT_NO_INIT
3054 cntrlInfo->ulTiming.sfn = cntrlInfo->ulTiming.subframe = 0;
3056 cntrlInfo->dlTiming = cell->dlDciTime;
3057 cntrlInfo->cellId = cell->cellId;
3058 cntrlInfo->ulTiming = cell->hiDci0Time;
3059 if((0 == (cntrlInfo->dlTiming.sfn % 30)) && (0 == cntrlInfo->dlTiming.slot))
3061 //printf("5GTF_CHECK rgSCHTomUtlProcDlSf Cntrl dl (%d : %d) ul (%d : %d)\n", cntrlInfo->dlTiming.sfn, cntrlInfo->dlTiming.subframe, cntrlInfo->ulTiming.sfn, cntrlInfo->ulTiming.subframe);
3063 /* Fill PCFICH info */
3064 /* Fix for DCFI FLE issue: when DL delta is 1 and UL delta is 0 and CFI
3065 *change happens in that SF then UL PDCCH allocation happens with old CFI
3066 *but CFI in control Req goes updated one since it was stored in the CELL
3068 cntrlInfo->cfi = dlSf->pdcchInfo.currCfi;
3069 #ifndef RG_ULSCHED_AT_CRC
3072 Mval = rgSchTddPhichMValTbl[cell->ulDlCfgIdx]
3073 [cell->hiDci0Time.subframe];
3074 if(dlSf->sfType == RG_SCH_SPL_SF_DATA)
3076 RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, cntrlInfo->cfi);
3081 /* Fill PHICH info */
3082 if ((ret = rgSCHTomUtlFillPhich (cell, cntrlInfo, ulSf, err)) != ROK)
3084 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PHICH info "
3085 "for cellId (%d)\n", cell->cellId));
3086 RGSCH_FREE_MEM(cntrlInfo);
3089 if ((ret = rgSCHTomUtlFillUlPdcch (cell, cntrlInfo, ulSf, err)) !=
3092 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PDCCH info "
3093 "for cellId (%d)\n", cell->cellId));
3094 RGSCH_FREE_MEM(cntrlInfo);
3099 if(0 == cntrlInfo->ulMpdcchLst.count)
3106 sfTyp = rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
3107 [cell->dlDciTime.subframe];
3109 if (sfTyp != 2) /* Uplink subframe */
3111 /* Fill PDCCH info */
3112 if ((ret = rgSCHTomUtlFillDlPdcch(cell,cntrlInfo, dlSf, err)) != ROK)
3114 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PDCCH info "
3115 "for cellId (%d)\n", cell->cellId));
3116 RGSCH_FREE_MEM(cntrlInfo);
3119 rgBwAlloInfo[dlSf->sfNum] += dlSf->bwAssigned;
3120 rgBwAlcnt[dlSf->sfNum] ++;
3123 #ifdef LTEMAC_SPS /* SPS_NEW_CHGS */
3124 cntrlInfo->isSPSOcc = dlSf->isSPSOcc;
3126 cntrlInfo->numDlActvUes += dlSf->numDlActvUes; /* 4UE_TTI_DELTA */
3127 dlSf->numDlActvUes = 0;
3129 if(0 == cntrlInfo->dlMpdcchLst.count)
3134 /* Now always sending down a cntrl req */
3135 /* sending the cntrl data to Phy */
3136 if (rgSCHUtlTfuCntrlReq(inst, cell->tfuSap->sapCfg.suId, cntrlInfo)
3139 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info "
3147 /** @brief This function handles sending of the PHICH information for the
3148 * downlink subframe to be sent in the next TTI.
3155 * - Loop through the PHICH information present in the downlink
3156 * subframe and fill the information in cntrlInfo.
3158 * @param [out] TfuCntrlReqInfo *cntrlInfo
3159 * @param [in] RgSchDlSf *dlSf
3160 * @param [out] RgSchErrInfo *err
3166 PRIVATE S16 rgSCHTomUtlFillPhich
3169 TfuCntrlReqInfo *cntrlInfo,
3174 PRIVATE S16 rgSCHTomUtlFillPhich(cell, cntrlInfo, dlSf, err)
3176 TfuCntrlReqInfo *cntrlInfo;
3184 TfuPhichInfo *harqAck;
3186 RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
3189 TRC2(rgSCHTomUtlFillPhich)
3191 /* Traversing the list of Phichs */
3192 node = dlSf->phichInfo.phichs.first;
3195 phich = (RgSchPhich*)node->node;
3196 if ((ret = rgSCHUtlGetEventMem((Ptr *)&harqAck, sizeof(TfuPhichInfo),
3197 &(cntrlInfo->memCp))) != ROK)
3199 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3202 #ifdef TFU_ALLOC_EVENT_NO_INIT
3203 harqAck->txPower = 0;
3205 /* fill in the tfu structure from the information present in the
3207 harqAck->rbStart = phich->rbStart;
3208 harqAck->nDmrs = phich->nDmrs;
3209 harqAck->isAck = phich->hqFeedBack;
3210 harqAck->isForMsg3 = phich->isForMsg3; /*SR_RACH_STATS : PHICH ACK/NACK for MSG3 */
3212 /* Changes for passing iPhich at TFU interface*/
3213 harqAck->iPhich = phich->iPhich;
3215 /* ccpu00138898 - Added Tx pwr offset for PHICH Tx*/
3217 harqAck->txPower = cellDl->phichTxPwrOffset;
3219 cmLListAdd2Tail(&cntrlInfo->phichLst, &(harqAck->lnk));
3220 harqAck->lnk.node = (PTR)harqAck;
3222 } /* end of while */
3228 /** @brief This function is a utility function to restart
3229 * deactivation timer.
3233 * Function: rgSCHTmrRestartScellDeactTmr
3236 * - Starts timer at scheduler
3238 * @param[in] RgSchCellCb *cell
3239 * @param[in] CmLteRnti rnti
3243 PRIVATE Void rgSCHTmrRestartScellDeactTmr
3249 PRIVATE Void rgSCHTmrRestartScellDeactTmr (cell, ueCb)
3255 RgSchUeCellInfo *sCellInfo = NULLP;
3259 if(RG_SCH_IS_CELL_SEC(ueCb, cell))
3261 sCellInfo = ueCb->cellInfo[(ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)])];
3263 if(sCellInfo->deactTmr.tmrEvnt != TMR_NONE)
3265 rgSCHTmrStopTmr(cell, RG_SCH_TMR_SCELL_DEACT, sCellInfo);
3267 if(PRSNT_NODEF == ueCb->sCellDeactTmrVal.pres)
3270 rgSCHTmrStartTmr(cell,sCellInfo,RG_SCH_TMR_SCELL_DEACT,
3271 ueCb->sCellDeactTmrVal.val);
3276 }/*end of rgSCHTmrRestartScellDeactTmr*/
3279 /** @brief This function will send all the PDCCH's for the given downlink
3287 * - Loop through all the scheduled HARQ processes and fill
3288 * the PDCCH information in cntrlInfo.
3290 * @param [out] TfuCntrlReqInfo *cntrlInfo
3291 * @param [in] RgSchDlSf *dlSf
3292 * @param [out] RgSchErrInfo *err
3297 EXTERN U32 numdlSpsRelSentToTf;
3299 PRIVATE S16 rgSCHTomUtlFillDlPdcch
3302 TfuCntrlReqInfo *cntrlInfo,
3307 PRIVATE S16 rgSCHTomUtlFillDlPdcch(cell,cntrlInfo, dlSf, err)
3309 TfuCntrlReqInfo *cntrlInfo;
3317 TfuPdcchInfo *tfuPdcch;
3318 U8 isDcivld = FALSE;
3321 TRC2(rgSCHTomUtlFillDlPdcch)
3323 /* Traversing the scheduled Harq processes */
3324 node = dlSf->pdcchInfo.pdcchs.first;
3327 pdcch = (RgSchPdcch*)node->node;
3328 switch(pdcch->dci.dciFormat)
3330 case TFU_DCI_FORMAT_3:
3331 isDcivld = (pdcch->dci.u.format3Info.isPucch) ? TRUE : FALSE;
3334 case TFU_DCI_FORMAT_3A:
3335 isDcivld = (pdcch->dci.u.format3AInfo.isPucch) ? TRUE : FALSE;
3348 /*ccpu00117179 - ADD - Build only non DCI format-0 messages */
3349 if((pdcch->dci.dciFormat == TFU_DCI_FORMAT_0) ||
3350 (pdcch->dci.dciFormat == TFU_DCI_FORMAT_A1) ||
3351 (pdcch->dci.dciFormat == TFU_DCI_FORMAT_A2))
3358 #ifdef RGSCH_SPS_STATS
3359 if((pdcch->dci.dciFormat == TFU_DCI_FORMAT_1A) &&
3360 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.mcs == 0x1F) &&
3361 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.type == TFU_ALLOC_TYPE_RIV) &&
3362 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.u.riv == 0xFFFFFFFF))
3364 numdlSpsRelSentToTf++;
3368 if ((ret = rgSCHUtlGetEventMem((Ptr *)&tfuPdcch, sizeof(TfuPdcchInfo),
3369 &(cntrlInfo->memCp))) != ROK)
3371 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3375 tfuPdcch->crnti = pdcch->crnti;
3376 tfuPdcch->isSpsRnti = pdcch->isSpsRnti;
3378 tfuPdcch->rnti = pdcch->rnti;
3381 rgSCHTmrRestartScellDeactTmr(cell,pdcch->ue);
3383 tfuPdcch->dciNumOfBits = pdcch->dciNumOfBits;
3385 tfuPdcch->nCce = pdcch->nCce;
3386 tfuPdcch->aggrLvl = pdcch->aggrLvl;
3387 tfuPdcch->dci = pdcch->dci;
3389 //TODO_SID: Need to check these values during INT
3390 tfuPdcch->sectorId = 0;
3391 tfuPdcch->sccIdx = 0;
3394 /* SR_RACH_STATS : Reset isTBMsg4 */
3395 pdcch->dci.u.format1aInfo.t.pdschInfo.isTBMsg4 = FALSE;
3396 /* To be enhanced later for 2.1 */
3397 cmLListAdd2Tail(&cntrlInfo->dlPdcchLst, &(tfuPdcch->lnk));
3398 tfuPdcch->lnk.node = (PTR)tfuPdcch;
3400 if((pdcch->rnti > 60) && (pdcch->rnti < 5000))
3402 #if defined (TENB_STATS) && defined (RG_5GTF)
3403 cell->tenbStats->sch.dl5gtfPdcchSend++;
3407 } /* end of while */
3409 if((numUePerTti) && (numUePerTti < RG_MAX_NUM_UE_PER_TTI ))
3411 cell->dlNumUeSchedPerTti[numUePerTti-1]++;
3413 gDlNumUePerTti[numUePerTti-1]++;
3417 } /* end of rgSCHTomUtlFillDlPdcch*/
3419 #ifdef RGSCH_SPS_STATS
3420 extern U32 rgSchSpsRelSentToTf;
3421 extern U32 rgSchSpsRelPdcchAllocd;
3423 /** @brief This function will send all the UL PDCCH's for the given
3431 * - Loop through all the scheduled HARQ processes and fill
3432 * the PDCCH information in cntrlInfo.
3434 * @param [out] TfuCntrlReqInfo *cntrlInfo
3435 * @param [in] RgSchDlSf *dlSf
3436 * @param [out] RgSchErrInfo *err
3442 PRIVATE S16 rgSCHTomUtlFillUlPdcch
3445 TfuCntrlReqInfo *cntrlInfo,
3450 PRIVATE S16 rgSCHTomUtlFillUlPdcch(cntrlInfo, dlSf, err)
3452 TfuCntrlReqInfo *cntrlInfo;
3460 TfuPdcchInfo *tfuPdcch;
3461 U8 isDcivld = FALSE;
3463 TRC2(rgSCHTomUtlFillUlPdcch)
3465 /* Traversing the scheduled Harq processes */
3466 node = dlSf->pdcchInfo.pdcchs.first;
3469 pdcch = (RgSchPdcch*)node->node;
3471 /*ccpu00116712- Function should pick only UL allocation related control
3473 switch(pdcch->dci.dciFormat)
3475 case TFU_DCI_FORMAT_A1:
3479 case TFU_DCI_FORMAT_A2:
3483 case TFU_DCI_FORMAT_3:
3484 isDcivld = (pdcch->dci.u.format3Info.isPucch) ? FALSE : TRUE;
3487 case TFU_DCI_FORMAT_3A:
3488 isDcivld = (pdcch->dci.u.format3AInfo.isPucch) ? FALSE : TRUE;
3503 /*ccpu00116712- Function should pick only UL allocation related control
3505 if ((ret = rgSCHUtlGetEventMem((Ptr *)&tfuPdcch, sizeof(TfuPdcchInfo),
3506 &(cntrlInfo->memCp))) != ROK)
3508 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3511 tfuPdcch->rnti = pdcch->rnti;
3513 rgSCHTmrRestartScellDeactTmr(cell,pdcch->ue);
3515 tfuPdcch->dciNumOfBits = pdcch->dciNumOfBits;
3517 tfuPdcch->nCce = pdcch->nCce;
3518 tfuPdcch->aggrLvl = pdcch->aggrLvl;
3519 tfuPdcch->dci = pdcch->dci;
3521 //TODO_SID: Need to check these values during INT
3522 tfuPdcch->sectorId = 0;
3523 tfuPdcch->sccIdx = 0;
3526 /* To be enhanced later for 2.1 */
3528 #if defined (TENB_STATS) && defined (RG_5GTF)
3529 cell->tenbStats->sch.ul5gtfPdcchSend++;
3531 cmLListAdd2Tail(&cntrlInfo->ulPdcchLst, &(tfuPdcch->lnk));
3532 tfuPdcch->lnk.node = (PTR)tfuPdcch;
3533 } /* end of while */
3535 #ifdef RGSCH_SPS_STATS
3536 if (rgSchSpsRelSentToTf != rgSchSpsRelPdcchAllocd)
3542 } /* end of rgSCHTomUtlFillUlPdcch*/
3544 /** @brief This function does the processing for Timing adjustment.
3551 * - Loop through the ue present ueTimeLst, decrement the remaining
3555 * @param [in] RgSchCellCb *cell
3561 PRIVATE S16 rgSCHTomUtlProcTA
3566 PRIVATE S16 rgSCHTomUtlProcTA (cell)
3573 TRC2(rgSCHTomUtlProcTA);
3575 node = cell->taUeLst.first;
3578 ue = (RgSchUeCb *)node->node;
3580 if (ue->dl.taCb.numRemSf == 0)
3582 ue->dl.taCb.state = RGSCH_TA_IDLE;
3583 /* If Outstanding Ta is present, schedule it */
3584 if(ue->dl.taCb.outStndngTa == TRUE)
3586 rgSCHUtlReTxTa(cell, ue);
3590 /* We need to reset state and also value of TA,
3591 * then we start the timer */
3592 ue->dl.taCb.ta = RGSCH_NO_TA_RQD;
3593 /* Start the timer only if TA is cfgd as FINITE value */
3594 if (ue->dl.taCb.cfgTaTmr)
3596 rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_TA, ue->dl.taCb.cfgTaTmr);
3599 /* need to delete from the link list */
3600 cmLListDelFrm(&(cell->taUeLst), &(ue->taLnk));
3601 ue->taLnk.node = NULLP;
3605 ue->dl.taCb.numRemSf--;
3607 } /* end of taUeLst */
3610 } /* end of rgSCHTomUtlProcTA */
3612 /** @brief This function handles filling of Hq reception request to
3627 PUBLIC S16 rgSCHTomUtlFillHqFdbkInfo
3629 TfuRecpReqInfo *recpReqInfo,
3632 RgSchDlHqProcCb *hqCb,
3634 TfuUeRecpReqInfo *pucchRecpInfo,
3635 RgSchDlHqProcCb *prvHqCb,
3639 PUBLIC S16 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, validIdx, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err)
3640 TfuRecpReqInfo *recpReqInfo;
3643 RgSchDlHqProcCb *hqCb;
3645 TfuUeRecpReqInfo *pucchRecpInfo;
3646 RgSchDlHqProcCb *prvHqCb;
3651 PUBLIC S16 rgSCHTomUtlFillHqFdbkInfo
3653 TfuRecpReqInfo *recpReqInfo,
3655 RgSchDlHqProcCb *hqCb,
3657 TfuUeRecpReqInfo *pucchRecpInfo,
3658 RgSchDlHqProcCb *prvHqCb,
3662 PUBLIC S16 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err)
3663 TfuRecpReqInfo *recpReqInfo;
3665 RgSchDlHqProcCb *hqCb;
3667 TfuUeRecpReqInfo *pucchRecpInfo;
3668 RgSchDlHqProcCb *prvHqCb;
3674 RgSchDlHqTbCb *tbCb;
3676 Bool isAddToLst = FALSE;
3678 for (idx = 0 ;idx < 2; idx++)
3680 if (HQ_TB_WAITING == hqCb->tbInfo[idx].state)
3682 tbCb = &hqCb->tbInfo[idx];
3684 /* FOR ACK NAK REP */
3685 if ((hqCb->hqE->ue != NULLP) &&
3686 (hqCb->hqE->ue->measGapCb.isMeasuring == TRUE))
3688 if ((tbCb->fbkRecpRepCntr) &&
3689 (--tbCb->fbkRecpRepCntr))
3691 /* Add to next subfarme */
3692 /* Add this hqCb to the next dlSf's ackNakRepQ */
3693 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
3694 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
3695 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
3696 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
3699 rgSCHTomUtlMoveNxtOccasion(cell, hqCb->hqE->ue, validIdx);
3707 /* Go to the next node */
3713 //if (hqCb != prvHqCb)
3715 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
3716 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
3719 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
3720 "TfuUeRecpReqInfo for cell");
3721 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3724 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
3725 if ((hqCb->hqE->ue != NULLP) /*&&
3726 ((tbCb->lchSchdData[0].lcId != 0) || (tbCb->taSnt ==
3730 pucchRecpInfo->rnti = hqCb->hqE->ue->ueId;
3734 if (hqCb->hqE->raCb)
3736 pucchRecpInfo->rnti = hqCb->hqE->raCb->tmpCrnti;
3742 if (!hqCb->spsN1PucchRes.pres)
3745 pucchRecpInfo->t.pucchRecpReq.hqType =
3746 TFU_HQ_RECP_REQ_NORMAL;
3747 pucchRecpInfo->t.pucchRecpReq.t.nCce =
3753 pucchRecpInfo->t.pucchRecpReq.hqType =
3754 TFU_HQ_RECP_REQ_N1PUCCH;
3755 pucchRecpInfo->t.pucchRecpReq.t.n1Pucch =
3756 hqCb->spsN1PucchRes.val;
3760 /* Handling of other types */
3761 pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
3762 #else /* TFU_UPGRADE */
3763 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
3764 if ((hqCb->tbInfo[0].state == HQ_TB_WAITING) &&
3765 (hqCb->tbInfo[1].state == HQ_TB_WAITING))
3767 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz = 2; /* MIMO */
3771 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz = 1; /* NON-MIMO */
3775 /* PucchRecpReq needs to be filled up for n1Pucch resource for SPS
3777 if (hqCb->spsN1PucchRes.pres)
3779 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
3782 #endif /* LTEMAC_SPS */
3784 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
3785 cell->pucchCfg.n1PucchAn);
3788 rgSCHEmtcFillPucchRecpInfo(cell, hqCb, &(pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0]));
3791 #endif/*TFU_UPGRADE*/
3794 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, hqCb->hqE->ue,
3795 pucchRecpInfo, validIdx,FALSE);
3798 /* Passing last parameter as FALSE in this case as it will be verified from hqCb*/
3799 isAddToLst = rgSCHEmtcAddRecpInfoToLst(hqCb,recpReqInfo, pucchRecpInfo,FALSE);
3803 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
3805 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
3808 if ((tbCb->fbkRecpRepCntr) &&
3809 (--tbCb->fbkRecpRepCntr))
3811 /* Add to next subfarme */
3812 /* Add this hqCb to the next dlSf's ackNakRepQ */
3813 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
3814 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
3815 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
3816 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
3822 }/* end of rgSCHTomUtlFillHqFdbkInfo */
3825 /** @brief This function handles filling of Hq reception request to
3830 * Function:rgSCHTomUtlFillHqFdbkFor5gtf
3834 * @param [out] TfuRecpReqInfo *recpReqInfo
3835 * @param [in] RgSchCellCb *cell
3836 * @param [in] U16 validIdx,
3837 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
3838 * @param [in] RgSchDlSf *dlSf,
3839 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
3840 * @param [out] RgSchErrInfo *err
3847 PRIVATE S16 rgSCHTomUtlFillHqFdbkFor5gtf
3849 TfuRecpReqInfo *recpReqInfo,
3852 RgSchDlHqInfo *dlSfHqInfo,
3854 TfuUeRecpReqInfo *pucchRecpInfo,
3858 PRIVATE S16 rgSCHTomUtlFillHqFdbkFor5gtf (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err)
3859 TfuRecpReqInfo *recpReqInfo;
3862 RgSchDlHqInfo *dlSfHqInfo;
3864 TfuUeRecpReqInfo *pucchRecpInfo;
3869 Inst inst = cell->instIdx;
3874 TfuUePucchRecpReq *pucchReqInfo = NULLP;
3876 hqPNode = dlSfHqInfo->hqPLst.first;
3877 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
3883 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
3884 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
3887 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate "
3888 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId));
3889 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3892 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
3893 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
3894 * instead of SPS-CRNTI */
3896 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
3898 pucchReqInfo->uciInfo = TFU_XPUCCH_UCI_INFO;
3900 /* 5gtf TODO : Hardcoded nPUCCHIdx */
3901 pucchReqInfo->uciPduInfo.pucchIndex = 0;
3903 pucchReqInfo->uciPduInfo.numBits = 1;
3905 /* 5gtf TODO : CQI Periodicity Hardcoded to (n,0)*/
3906 if (RGSCH_TIMEINFO_SAME (recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn))
3908 pucchReqInfo->uciPduInfo.numBits += 5;
3909 RG_SCH_ADD_TO_CRNT_TIME(recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn,
3910 ue->ue5gtfCb.cqiRiPer);
3913 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
3914 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
3916 }/* end of rgSCHTomUtlFillHqFdbkForFrmt1B */
3920 /** @brief This function handles filling of Hq reception request to
3925 * Function:rgSCHTomUtlFillHqFdbkForFrmt1B
3928 * Allocates the N1Pucch Resources based on teh A Value
3930 * @param [out] TfuRecpReqInfo *recpReqInfo
3931 * @param [in] RgSchCellCb *cell
3932 * @param [in] U16 validIdx,
3933 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
3934 * @param [in] RgSchDlSf *dlSf,
3935 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
3936 * @param [out] RgSchErrInfo *err
3944 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B
3946 TfuRecpReqInfo *recpReqInfo,
3949 RgSchDlHqInfo *dlSfHqInfo,
3951 TfuUeRecpReqInfo *pucchRecpInfo,
3955 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err)
3956 TfuRecpReqInfo *recpReqInfo;
3959 RgSchDlHqInfo *dlSfHqInfo;
3961 TfuUeRecpReqInfo *pucchRecpInfo;
3966 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B
3968 TfuRecpReqInfo *recpReqInfo,
3970 RgSchDlHqInfo *dlSfHqInfo,
3972 TfuUeRecpReqInfo *pucchRecpInfo,
3976 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B (recpReqInfo, cell, hqCb, dlSf, pucchRecpInfo, err)
3977 TfuRecpReqInfo *recpReqInfo;
3979 RgSchDlHqInfo *dlSfHqInfo;
3981 TfuUeRecpReqInfo *pucchRecpInfo;
3987 Inst inst = cell->instIdx;
3991 RgSchDlHqProcCb *hqCb = NULLP;
3993 TfuUePucchRecpReq *pucchReqInfo = NULLP;
3994 Bool isDatPresOnSecCell = FALSE;
3995 U8 primCellTbCount = 0;
3997 hqPNode = dlSfHqInfo->hqPLst.first;
3998 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
4004 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4005 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
4008 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate "
4009 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId));
4010 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4013 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4014 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
4015 * instead of SPS-CRNTI */
4017 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
4020 pucchReqInfo->hqType = TFU_HQ_RECP_REQ_NORMAL;
4021 /* Handling of other types */
4022 pucchReqInfo->type = TFU_UCI_HARQ;
4023 #else /* TFU_UPGRADE */
4024 pucchReqInfo->uciInfo = TFU_PUCCH_HARQ;
4025 /* Fill hqFdbkMode by using uciFrmtTyp from dlSfHqInfo */
4026 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
4027 /* Fill HqSz by using totalTbCnt based on the TM mode and
4028 * the number of serv cells configured*/
4030 pucchReqInfo->hqInfo.hqSz = ue->f1bCsAVal;
4031 pucchReqInfo->hqInfo.pucchResCnt = ue->f1bCsAVal;
4033 cmMemset((U8 *)pucchReqInfo->hqInfo.hqRes,0xff,sizeof(U16)*TFU_MAX_HQ_RES);
4035 /* Two Resources needs to be configured if the
4036 * serving cell is in mimo mode else single
4038 if ((dlSf->relPdcch != NULLP) &&
4039 (RGSCH_TIMEINFO_SAME(recpReqInfo->timingInfo, ue->relPdcchFbkTiming)))
4040 {/* Pcell is having sps rel pdcch present */
4041 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
4042 {/* prim cell is in mimo mode, use 0 and 1 */
4043 pucchReqInfo->hqInfo.hqRes[0] = (dlSf->relPdcch->nCce +
4044 cell->pucchCfg.n1PucchAn);
4045 pucchReqInfo->hqInfo.hqRes[1] = pucchReqInfo->hqInfo.hqRes[0] + 1;
4050 pucchReqInfo->hqInfo.hqRes[2] = (dlSf->relPdcch->nCce +
4051 cell->pucchCfg.n1PucchAn);
4053 /* Release the pdcch so that it will not further processed */
4054 rgSCHUtlPdcchPut(ue->cell,&dlSf->pdcchInfo, dlSf->relPdcch);
4055 dlSf->relPdcch = NULLP;/* only one UE will be scheduled for release pdcch order in one tti */
4057 #endif/*LTEMAC_SPS*/
4058 #endif/*TFU_UPGRADE*/
4061 hqCb = (RgSchDlHqProcCb *)hqPNode->node;
4062 hqPNode = hqPNode->next;
4063 /* In case of CSI + 1BCS , CSI will be
4064 * dropped if scheduling is present on
4065 * seconday cell.36.213 10.1.1
4067 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4069 isDatPresOnSecCell = TRUE;
4072 if ((hqCb->tbInfo[0].state == HQ_TB_WAITING) &&
4073 (hqCb->tbInfo[1].state == HQ_TB_WAITING))
4075 primCellTbCount = 2;
4078 primCellTbCount = 1;
4082 pucchReqInfo->t.nCce = hqCb->pdcch->nCce;
4085 switch(ue->f1bCsAVal)
4087 case RG_SCH_A_VAL_2:
4088 /* harq(0) is primary harq(1) is secondary) */
4089 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4091 pucchReqInfo->hqInfo.hqRes[1] = ue->n1PucchF1bResCb.\
4092 cw1N1Res[hqCb->tpc].n1PucchIdx;
4094 else/* primary cell */
4097 /* Need to consider only sps occasions */
4098 if (hqCb->spsN1PucchRes.pres)
4100 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
4103 #endif /* LTEMAC_SPS */
4106 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
4107 cell->pucchCfg.n1PucchAn);
4111 case RG_SCH_A_VAL_3:
4112 /* Serving cell in mimo mode should be
4113 * in 0 and 1 and the serving cell in siso
4114 * mode should be in 2 indices */
4115 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4117 U8 cellIdx = ue->cellIdToCellIdxMap[RG_SCH_CELLINDEX(hqCb->hqE->cell)];
4118 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[cellIdx]->txMode.txModeEnum) > 1)
4119 {/* Sec cell is in mimo mode, use 0 and 1 */
4120 pucchReqInfo->hqInfo.hqRes[0] =
4121 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
4123 pucchReqInfo->hqInfo.hqRes[1] =
4124 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
4127 {/* Sec cell is in siso mode, use 2 */
4128 pucchReqInfo->hqInfo.hqRes[2] =
4129 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
4133 {/* primary cell hq */
4134 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
4135 {/* prim cell is in mimo mode, use 0 and 1 */
4137 if (hqCb->spsN1PucchRes.pres)
4138 {/* SPS occasions */
4139 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
4140 pucchReqInfo->hqInfo.hqRes[1] = hqCb->spsN1PucchRes.val + 1;
4143 #endif /* LTEMAC_SPS */
4145 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
4146 cell->pucchCfg.n1PucchAn);
4147 pucchReqInfo->hqInfo.hqRes[1] = (hqCb->pdcch->nCce +
4148 cell->pucchCfg.n1PucchAn + 1);
4152 {/* prim cell is in siso mode use 2 */
4154 /* Need to consider only sps occasions */
4155 if (hqCb->spsN1PucchRes.pres)
4157 pucchReqInfo->hqInfo.hqRes[2] = hqCb->spsN1PucchRes.val;
4160 #endif /* LTEMAC_SPS */
4163 pucchReqInfo->hqInfo.hqRes[2] = (hqCb->pdcch->nCce +
4164 cell->pucchCfg.n1PucchAn);
4170 case RG_SCH_A_VAL_4:
4172 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4173 {/* 2 and 3 for sec cell */
4174 pucchReqInfo->hqInfo.hqRes[2] =
4175 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
4176 pucchReqInfo->hqInfo.hqRes[3] =
4177 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
4179 else/* primary cell */
4180 {/* 0 and 1 are for primary cell */
4182 /* Need to consider only sps occasions */
4183 if (hqCb->spsN1PucchRes.pres)
4185 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
4186 pucchReqInfo->hqInfo.hqRes[1] = hqCb->spsN1PucchRes.val + 1;
4189 #endif /* LTEMAC_SPS */
4192 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
4193 cell->pucchCfg.n1PucchAn);
4194 pucchReqInfo->hqInfo.hqRes[1] = (hqCb->pdcch->nCce +
4195 cell->pucchCfg.n1PucchAn + 1);
4202 /* TOD:: Add error print */
4206 #endif/*TFU_UPGRADE*/
4217 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, ue,
4218 pucchRecpInfo, validIdx,isDatPresOnSecCell);
4220 /* Channel selection wil not be used in case of
4221 * CQI + HARQ. if the data was present only on
4223 if((isDatPresOnSecCell == FALSE) &&
4224 (dlSfHqInfo->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS))
4225 {/* Data is present only on primary cell */
4227 switch(pucchReqInfo->uciInfo)
4229 case TFU_PUCCH_HARQ_SRS:
4230 case TFU_PUCCH_HARQ_CQI:
4231 case TFU_PUCCH_HARQ_SR_SRS:
4232 case TFU_PUCCH_HARQ_SR_CQI:
4234 dlSfHqInfo->uciFrmtTyp = RG_SCH_UCI_FORMAT1A_1B;
4235 pucchReqInfo->hqInfo.hqSz = primCellTbCount;
4236 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
4245 #endif/*TFU_UPGRADE*/
4246 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4247 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4249 }/* end of rgSCHTomUtlFillHqFdbkForFrmt1B */
4250 /** @brief This function handles filling of Hq reception request to
4255 * Function:rgSCHTomUtlFillHqFdbkForFrmt3
4258 * Allocates the N1Pucch Resources based on teh A Value
4260 * @param [out] TfuRecpReqInfo *recpReqInfo
4261 * @param [in] RgSchCellCb *cell
4262 * @param [in] U16 validIdx,
4263 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
4264 * @param [in] RgSchDlSf *dlSf,
4265 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
4266 * @param [out] RgSchErrInfo *err
4274 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3
4276 TfuRecpReqInfo *recpReqInfo,
4279 RgSchDlHqInfo *dlSfHqInfo,
4281 TfuUeRecpReqInfo *pucchRecpInfo,
4285 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3 (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err)
4286 TfuRecpReqInfo *recpReqInfo;
4289 RgSchDlHqInfo *dlSfHqInfo;
4291 TfuUeRecpReqInfo *pucchRecpInfo;
4296 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3
4298 TfuRecpReqInfo *recpReqInfo,
4300 RgSchDlHqInfo *dlSfHqInfo,
4302 TfuUeRecpReqInfo *pucchRecpInfo,
4306 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3 (recpReqInfo, cell, hqCb, dlSf, pucchRecpInfo, err)
4307 TfuRecpReqInfo *recpReqInfo;
4309 RgSchDlHqInfo *dlSfHqInfo;
4311 TfuUeRecpReqInfo *pucchRecpInfo;
4317 Inst inst = cell->instIdx;
4322 TfuUePucchRecpReq *pucchReqInfo = NULLP;
4324 //hqPNode = dlSfHqInfo->hqPLst.first;
4325 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
4331 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4332 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
4335 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate "
4336 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId));
4337 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4340 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4341 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
4342 * instead of SPS-CRNTI */
4344 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
4347 pucchReqInfo->hqType = TFU_HQ_RECP_REQ_NORMAL;
4348 /* Handling of other types */
4349 pucchReqInfo->type = TFU_UCI_HARQ;
4350 #else /* TFU_UPGRADE */
4351 pucchReqInfo->uciInfo = TFU_PUCCH_HARQ;
4352 /* Fill hqFdbkMode by using uciFrmtTyp from dlSfHqInfo */
4353 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
4354 /* Fill HqSz by using totalTbCnt based on the TM mode and
4355 * the number of serv cells configured*/
4357 pucchReqInfo->hqInfo.hqSz = ue->f1bCsAVal;
4358 pucchReqInfo->hqInfo.pucchResCnt = 1;
4360 cmMemset((U8 *)pucchReqInfo->hqInfo.hqRes,0xff,sizeof(U16)*TFU_MAX_HQ_RES);
4361 #endif/*TFU_UPGRADE*/
4362 pucchReqInfo->hqInfo.hqRes[0] = dlSfHqInfo->n3ScellPucch.n3PucchIdx;
4364 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, ue,
4365 pucchRecpInfo, validIdx,TRUE);
4366 #endif/*TFU_UPGRADE*/
4367 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4368 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4370 }/* end of rgSCHTomUtlFillHqFdbkForFrmt3 */
4374 /** @brief This function handles filling of HARQ feedback recption request to
4383 * @param [out] TfuRecpReqInfo *recpReqInfo
4384 * @param [in] RgSchCellCb *cell
4385 * @param [out] RgSchErrInfo *err
4392 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq
4394 TfuRecpReqInfo *recpReqInfo,
4400 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, validIdx, err)
4401 TfuRecpReqInfo *recpReqInfo;
4408 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq
4410 TfuRecpReqInfo *recpReqInfo,
4415 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, err)
4416 TfuRecpReqInfo *recpReqInfo;
4423 RgSchDlHqProcCb *hqCb;
4424 CmLteTimingInfo futTime;
4427 TfuUeRecpReqInfo *pucchRecpInfo = NULLP;
4429 RgSchDlHqProcCb *prvHqCb=NULLP;
4431 TRC2(rgSCHTomUtlFillHqFdbkRecpReq);
4438 /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper output
4439 * if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME() as it is
4440 * serving the purpose */
4441 RGSCHDECRFRMCRNTTIME(cell->crntTime, futTime, (RG_SCH_CMN_HARQ_INTERVAL -
4442 TFU_RECPREQ_DLDELTA));
4443 dlSf = rgSCHUtlSubFrmGet (cell, futTime);
4444 /* Get the next dlsf as well */
4445 RG_SCH_ADD_TO_CRNT_TIME(futTime, futTime, 1)
4446 nxtDlsf = rgSCHUtlSubFrmGet (cell, futTime);
4450 if (dlSf->ueLst.count != 0)
4452 node = dlSf->ueLst.first;
4455 ue = (RgSchUeCb *)(node->node);
4458 if(ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx].isPuschHarqRecpPres == TRUE)
4459 {/* This UE is already considered for PUSCH
4463 rgSCHTomUtlFillHqFdbkFor5gtf(recpReqInfo, cell, validIdx,
4464 &ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx], dlSf, pucchRecpInfo, err);
4465 } /* end of while */
4466 } /* If hq is expected */
4468 if (dlSf->msg4HqPLst.count != 0)
4471 node = dlSf->msg4HqPLst.first;
4474 hqCb = (RgSchDlHqProcCb*)(node->node);
4476 //TODO_SID: need to check validIdx
4477 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, validIdx, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err);
4479 } /* end of while */
4482 /* Check with TDD Code */
4483 /* FOR ACK NACK REP */
4485 } /* end of rgSCHTomUtlFillHqFdbkRecpReq */
4487 /** @brief This function handles filling of SR reception request to
4496 * @param [out] TfuRecpReqInfo *recpReqInfo
4497 * @param [in] RgSchCellCb *cell
4498 * @param [out] RgSchErrInfo *err
4505 PRIVATE S16 rgSCHTomUtlFillSrRecpReq
4507 TfuRecpReqInfo *recpReqInfo,
4513 PRIVATE S16 rgSCHTomUtlFillSrRecpReq (recpReqInfo, cell, validIdx, err)
4514 TfuRecpReqInfo *recpReqInfo;
4521 TfuUeRecpReqInfo *pucchRecpInfo;
4527 RgSchCmnUlUeSpsInfo *ulSpsUe = NULL;
4531 TRC2(rgSCHTomUtlFillSrRecpReq);
4535 node = cell->pCqiSrsSrLst[validIdx].srLst.first;
4538 ue = (RgSchUeCb *)(node->node);
4539 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4545 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4546 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4548 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4549 "TfuUeRecpReqInfo for cell RNTI:%d",ue->ueId);
4550 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4553 #ifdef TFU_ALLOC_EVENT_NO_INIT
4554 cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4555 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4561 /* Should we check for Rel8 and above???
4562 * Dont send SR recp req if logicalChannelSR-Mask enabled and UL SPS is
4564 ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue, cell);
4565 /* Avoiding check for ulSpsEnabled as isUlSpsActv FALSE if sps is not enabled*/
4566 if((ue->ul.ulSpsCfg.isLcSRMaskEnab) &&
4567 (ulSpsUe->isUlSpsActv))
4569 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
4574 pucchRecpInfo->rnti = ue->ueId;
4575 pucchRecpInfo->t.pucchRecpReq.srInfo.n1PucchIdx =
4576 ue->srCb.srCfg.srSetup.srResIdx;
4577 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR;
4578 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
4579 rgSCHTomUtlFillCqiSrsWithSr(cell, ue, recpReqInfo,
4580 pucchRecpInfo, validIdx);
4582 isAddToLst = rgSCHEmtcAddRecpInfoToLst(NULLP,recpReqInfo, pucchRecpInfo,ue->isEmtcUe);
4586 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4588 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4591 }/* end of rgSCHTomUtlFillSrRecpReq */
4594 /** @brief This function tells will the UE has a periodic CQI/PMI/RI
4603 * @param [in] RgSchUeCb *ue
4604 * @param [out] Bool *willueRprtCqiRi
4611 PRIVATE S16 rgSCHTomUtlWillUeRprtCqiRi
4614 Bool *willueRprtCqiRi
4617 PRIVATE S16 rgSCHTomUtlWillUeRprtCqiRi ( ue, willueRprtCqiRi)
4619 Bool *willueRprtCqiRi;
4622 TRC2(rgSCHTomUtlWillUeRprtCqiRi);
4624 /* Intialising Reporting probability as TRUE */
4625 *willueRprtCqiRi = TRUE;
4627 /* Checking the cases in which UE will not report CQIPMI/RI */
4628 if(ue->isDrxEnabled && ue->drxCb)
4631 if(ue->drxCb->cqiMask.pres && ue->drxCb->cqiMask.val == RGR_DRX_SETUP)
4632 {/*cqiMask is setup by upper layers */
4633 if((ue->drxCb->drxUlInactvMask & RG_SCH_DRX_ONDUR_BITMASK) ==
4634 RG_SCH_DRX_ONDUR_BITMASK)
4635 {/*onDuration NOT running, do not expect cqi/pmi/ri*/
4636 *willueRprtCqiRi = FALSE;
4640 #endif /*end of LTEMAC_R9*/
4641 /* ccpu00134258: Fix for CQI DRX issue*/
4642 if(ue->drxCb->onDurTmrLen > 2)
4644 if ( !RG_SCH_DRX_UL_IS_UE_ACTIVE(ue->drxCb) )
4645 {/*UE is not active, do not expect cqi/pmi/ri*/
4646 *willueRprtCqiRi = FALSE;
4649 }/*ue->isDrxEnabled*/
4652 } /*End of rgSCHTomUtlWillUeRprtCqiRi*/
4654 /** @brief This function handles filling of RI reception request to
4663 * @param [out] TfuRecpReqInfo *recpReqInfo
4664 * @param [in] RgSchCellCb *cell
4665 * @param [in] U16 validIdx
4666 * @param [out] RgSchErrInfo *err
4673 PRIVATE S16 rgSCHTomUtlFillRiRecpReq
4675 TfuRecpReqInfo *recpReqInfo,
4681 PRIVATE S16 rgSCHTomUtlFillRiRecpReq (recpReqInfo, cell, validIdx, err)
4682 TfuRecpReqInfo *recpReqInfo;
4689 TfuUeRecpReqInfo *pucchRecpInfo;
4692 Bool willUeRprtCqi; /* Flag set due to CQI Mask
4693 and UE inactive state (DRX) */
4694 RgSchUePCqiCb *riCb = NULLP;
4695 TRC2(rgSCHTomUtlFillRiRecpReq);
4697 node = cell->pCqiSrsSrLst[validIdx].riLst.first;
4700 riCb = (RgSchUePCqiCb *)(node->node);
4701 ue = riCb->servCellInfo->ue;
4702 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4704 if(riCb->riRecpPrcsd)
4706 /*ccpu00140578:: RI Proecssing is already done for this TTI
4707 * as part of PUSCH reception process or HARQ
4708 * Reception processing. Hence skipping this UE
4710 riCb->riRecpPrcsd = FALSE;
4713 if(riCb->riDist ==0)
4715 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
4716 #ifdef XEON_SPECIFIC_CHANGES
4717 if(RGSCH_TIMEINFO_SAME(cell->crntTime, ue->riRecpTime))
4723 if((TRUE == riCb->isRiIgnoByCollsn)
4724 || (willUeRprtCqi == FALSE))
4726 if(willUeRprtCqi == FALSE)
4729 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
4732 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4733 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4735 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4736 "TfuUeRecpReqInfo for cell RNTI:%d",ue->ueId);
4737 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4740 #ifdef TFU_ALLOC_EVENT_NO_INIT
4741 cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4742 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4745 pucchRecpInfo->rnti = ue->ueId;
4746 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
4747 riCb->cqiCfg.cqiSetup.cqiPResIdx;
4748 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = riCb->riNumBits;
4749 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_CQI;
4750 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
4752 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
4753 riCb->servCellInfo->sCellIdx;
4755 rgSCHTomUtlFillRiBitWidthInfo(ue);
4756 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
4757 if (ue->nPCqiCb->nCqiTrIdx == validIdx)
4759 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, ue->nPCqiCb);
4761 if((ue->srsCb.nSrsTrIdx == validIdx) && (ue->srsCb.srsDist ==0))
4763 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
4765 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4766 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4774 }/* end of rgSCHTomUtlFillRiRecpReq */
4777 /** @brief This function handles filling of 5GTF CQI-RI reception request to
4786 * @param [out] TfuRecpReqInfo *recpReqInfo
4787 * @param [in] RgSchCellCb *cell
4788 * @param [in] U16 validIdx
4789 * @param [out] RgSchErrInfo *err
4797 PRIVATE S16 rgSCHTomUtlFillCqiRiRecpReq
4799 TfuRecpReqInfo *recpReqInfo,
4805 PRIVATE S16 rgSCHTomUtlFillCqiRiRecpReq (recpReqInfo, cell, validIdx, err)
4806 TfuRecpReqInfo *recpReqInfo;
4812 TfuUeRecpReqInfo *pucchRecpInfo;
4813 RgSchUeCb *ue = NULLP;
4816 TRC2(rgSCHTomUtlFillCqiRiRecpReq);
4818 while ((ue = rgSCHDbmGetNextUeCb(cell, ue)) != NULLP)
4820 if (RGSCH_TIMEINFO_SAME (recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn))
4822 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4823 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4825 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4826 "TfuUeRecpReqInfo for cell RNTI:%d ", ue->ueId);
4827 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4830 #ifdef TFU_ALLOC_EVENT_NO_INIT
4831 cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4832 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4834 pucchRecpInfo->rnti = ue->ueId;
4835 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_XPUCCH_UCI_INFO;
4836 pucchRecpInfo->t.pucchRecpReq.uciPduInfo.pucchIndex = 0;
4837 pucchRecpInfo->t.pucchRecpReq.uciPduInfo.numBits = 5;
4839 RG_SCH_ADD_TO_CRNT_TIME(recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn,
4840 ue->ue5gtfCb.cqiRiPer);
4841 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4842 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4847 }/* end of rgSCHTomUtlFillCqiRiRecpReq */
4850 /** @brief This function handles filling of PCQI reception request to
4859 * @param [out] TfuRecpReqInfo *recpReqInfo
4860 * @param [in] RgSchCellCb *cell
4861 * @param [in] U16 validIdx
4862 * @param [out] RgSchErrInfo *err
4869 PRIVATE S16 rgSCHTomUtlFillPcqiRecpReq
4871 TfuRecpReqInfo *recpReqInfo,
4877 PRIVATE S16 rgSCHTomUtlFillPcqiRecpReq (recpReqInfo, cell, validIdx, err)
4878 TfuRecpReqInfo *recpReqInfo;
4885 TfuUeRecpReqInfo *pucchRecpInfo;
4890 Bool willUeRprtCqi; /* Flag set due to CQI Mask
4891 and UE Inactive state (DRX)*/
4893 RgSchUePCqiCb *cqiCb = NULLP;
4894 Bool isAddToLst = FALSE;
4896 TRC2(rgSCHTomUtlFillPcqiRecpReq);
4898 node = cell->pCqiSrsSrLst[validIdx].cqiLst.first;
4901 cqiCb = (RgSchUePCqiCb*)(node->node);
4902 ue = cqiCb->servCellInfo->ue;
4903 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4905 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
4907 if ((cqiCb->isCqiIgnoByCollsn == TRUE) ||
4908 (willUeRprtCqi == FALSE))
4910 if(willUeRprtCqi == FALSE)
4913 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
4917 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
4919 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
4920 cqiCb->servCellInfo->sCellIdx;
4922 cqiPmiSz = rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
4925 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to Fill CqiPmi "
4930 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4931 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4933 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4934 "TfuUeRecpReqInfo for cell RNTI:%d ", ue->ueId);
4935 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4938 #ifdef TFU_ALLOC_EVENT_NO_INIT
4939 cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4940 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4943 /*Fill PCQI params*/
4944 pucchRecpInfo->rnti = ue->ueId;
4945 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
4946 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
4947 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = cqiPmiSz;
4948 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_CQI;
4949 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
4950 if((ue->srsCb.nSrsTrIdx == validIdx) && (ue->srsCb.srsDist ==0))
4952 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
4955 isAddToLst = rgSCHEmtcAddRecpInfoToLst(NULLP,recpReqInfo, pucchRecpInfo,ue->isEmtcUe);
4959 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4961 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4964 }/* end of rgSCHTomUtlFillPcqiRecpReq */
4965 /** @brief This function handles filling of SRS reception request to
4974 * @param [out] TfuRecpReqInfo *recpReqInfo
4975 * @param [in] RgSchCellCb *cell
4976 * @param [in] U16 validIdx
4977 * @param [out] RgSchErrInfo *err
4983 PRIVATE S16 rgSCHTomUtlFillSrsRecpReq
4985 TfuRecpReqInfo *recpReqInfo,
4991 PRIVATE S16 rgSCHTomUtlFillSrsRecpReq (recpReqInfo, cell, validIdx, err)
4992 TfuRecpReqInfo *recpReqInfo;
4999 TfuUeRecpReqInfo *pucchRecpInfo;
5003 TRC2(rgSCHTomUtlFillSrsRecpReq);
5005 node = cell->pCqiSrsSrLst[validIdx].srsLst.first;
5008 ue = (RgSchUeCb *)(node->node);
5009 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
5011 if(ue->srsCb.srsRecpPrcsd)
5013 /* ccpu00140578::SRS Proecssing is already done for this TTI
5014 * as part of PUSCH or HARQ reception process and
5015 * hence skipping this UE */
5016 ue->srsCb.srsRecpPrcsd = FALSE;
5020 if(ue->srsCb.srsDist ==0)
5022 /* We need to add the recp request to be sent on the pucchANRep value. */
5023 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
5024 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
5026 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
5027 "TfuUeRecpReqInfo for RNTI:%d ",ue->ueId);
5028 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
5032 #ifdef TFU_ALLOC_EVENT_NO_INIT
5033 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
5037 pucchRecpInfo->rnti = ue->ueId;
5038 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
5039 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
5040 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
5041 ue->srsCb.srsCfg.srsSetup.fDomPosi;
5042 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
5043 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
5044 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
5045 ue->srsCb.srsCfg.srsSetup.txComb;
5046 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
5047 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
5048 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
5049 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
5051 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SRS;
5052 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
5053 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
5054 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
5058 ue->srsCb.srsDist--;
5062 }/* end of rgSCHTomUtlFillSrsRecpReq */
5065 /** @brief This function handles filling of data reception requests for
5074 * @param [out] TfuRecpReqInfo *recpReqInfo
5075 * @param [in] RgSchCellCb *cell
5076 * @param [out] RgSchErrInfo *err
5082 PRIVATE S16 rgSCHTomUtlFillDatRecpReq
5084 TfuRecpReqInfo *recpReqInfo,
5089 PRIVATE S16 rgSCHTomUtlFillDatRecpReq (recpReqInfo, cell, err)
5090 TfuRecpReqInfo *recpReqInfo;
5096 RgSchUlAlloc *alloc;
5097 TfuUeRecpReqInfo *datRecpInfo;
5099 TRC2(rgSCHTomUtlFillDatRecpReq)
5101 /* processing steps are
5102 * - Run through the UL allocations going out in this subframe.
5103 * - Run through the UL receptions expected the next subframe.
5105 alloc = rgSCHUtlFirstRcptnReq (cell);
5108 /* FOR ACK NACK REP */
5109 if (NULLP != alloc->ue)
5111 /* If measuring or ackNakRep we shall not send dat RecpReq */
5112 if ((alloc->ue->measGapCb.isMeasuring == TRUE) ||
5113 (alloc->ue->ackNakRepCb.isAckNakRep == TRUE))
5115 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
5120 if ((ret = rgSCHUtlGetEventMem((Ptr *)&datRecpInfo,
5121 sizeof(TfuUeRecpReqInfo),
5122 &(recpReqInfo->memCp))) != ROK)
5124 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
5125 "TfuUeRecpReqInfo for RNTI:%d ", alloc->ue->ueId);
5126 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
5129 if (!alloc->forMsg3)
5131 datRecpInfo->type = TFU_RECP_REQ_PUSCH;
5132 rgSCHUtlAllocRcptInfo (alloc,
5134 &datRecpInfo->t.puschRecpReq.mcs,
5135 &datRecpInfo->t.puschRecpReq.rbStart,
5136 &datRecpInfo->t.puschRecpReq.numRb,
5137 &datRecpInfo->t.puschRecpReq.rv,
5138 &datRecpInfo->t.puschRecpReq.size,
5139 &datRecpInfo->t.puschRecpReq.modType,
5140 &datRecpInfo->t.puschRecpReq.isRtx,
5141 &datRecpInfo->t.puschRecpReq.nDmrs,
5142 &datRecpInfo->t.puschRecpReq.ndi,
5143 &datRecpInfo->t.puschRecpReq.harqProcId
5148 datRecpInfo->type = TFU_RECP_REQ_MSG3;
5149 rgSCHUtlAllocRcptInfo (alloc,
5151 &datRecpInfo->t.msg3RecpReq.mcs,
5152 &datRecpInfo->t.msg3RecpReq.rbStart,
5153 &datRecpInfo->t.msg3RecpReq.numRb,
5154 /*ccpu00128993 - MOD - fix for msg3 softcombining bug*/
5155 &datRecpInfo->t.msg3RecpReq.rv,
5156 &datRecpInfo->t.msg3RecpReq.size,
5157 &datRecpInfo->t.msg3RecpReq.modType,
5158 &datRecpInfo->t.msg3RecpReq.isRtx,
5159 &datRecpInfo->t.msg3RecpReq.nDmrs,
5160 &datRecpInfo->t.msg3RecpReq.ndi,
5161 &datRecpInfo->t.msg3RecpReq.harqProcId
5165 /* Other fields of datRecpInfo shall be filled
5166 * here for new features */
5167 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(datRecpInfo->lnk));
5168 datRecpInfo->lnk.node = (PTR)datRecpInfo;
5170 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
5171 } /* end of while */
5173 } /* end of rgSCHTomUtlFillDatRecpReq */
5176 /** @brief This function handles filling of data reception requests for
5185 * @param [out] TfuRecpReqInfo *recpReqInfo
5186 * @param [in] RgSchCellCb *cell
5187 * @param [in] U16 validIdx
5188 * @param [out] RgSchErrInfo *err
5194 PRIVATE S16 rgSCHTomUtlFillDatRecpReq
5196 TfuRecpReqInfo *recpReqInfo,
5202 PRIVATE S16 rgSCHTomUtlFillDatRecpReq (recpReqInfo, cell, validIdx, err)
5203 TfuRecpReqInfo *recpReqInfo;
5209 CmLteTimingInfo dci0Time;
5212 RgSchUlAlloc *alloc;
5213 TfuUeRecpReqInfo *datRecpInfo;
5215 Bool hqPres; /*Set when HARQ Rec Req is present*/
5216 Bool isAperiodic = FALSE; /*Set when Aperiodic CQI is expected */
5219 TRC2(rgSCHTomUtlFillDatRecpReq);
5221 if((0 == (recpReqInfo->timingInfo.sfn % 30)) && (0 == recpReqInfo->timingInfo.slot))
5223 //printf("5GTF_CHECK rgSCHTomUtlFillDatRecpReq (%d : %d)\n", recpReqInfo->timingInfo.sfn, recpReqInfo->timingInfo.slot);
5225 /* processing steps are
5226 * - Run through the UL allocations going out in this subframe.
5227 * - Run through the UL receptions expected the next subframe.
5230 alloc = rgSCHUtlFirstRcptnReq (cell);
5233 isAperiodic = FALSE;
5234 ret = rgSCHUtlGetEventMem((Ptr *)&datRecpInfo,
5235 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
5238 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
5239 "TfuUeRecpReqInfo for RNTI:%d ", alloc->rnti);
5240 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
5243 #ifdef TFU_ALLOC_EVENT_NO_INIT
5244 datRecpInfo->t.puschRecpReq.initialNSrs.pres = FALSE;
5245 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = FALSE;
5247 datRecpInfo->type = TFU_RECP_REQ_PUSCH;
5248 /* ccpu00131944 - Intializing hqPres in each iteration*/
5250 /* Check if this if for MSG3 - no scope for feedback along with it. */
5251 if ((FALSE == alloc->forMsg3))
5253 /* Check if any DL HARQ processes has a feedback coming at the time of
5254 * this reception request.
5259 RGSCHDECRFRMCRNTTIME(cell->crntTime,dci0Time,(RGSCH_ULCTRL_RECP_DIST));
5261 idx = (dci0Time.sfn * RGSCH_NUM_SUB_FRAMES_5G + dci0Time.slot)%
5262 RGSCH_ULCTRL_RECP_DIST;
5264 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA;
5265 datRecpInfo->rnti = alloc->rnti;
5266 rgSCHUtlAllocRcptInfo (cell,alloc, &recpReqInfo->timingInfo,
5267 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5270 else /*Enters for Msg3 == TRUE condition*/
5272 /* ccpu00130884 - ADD - HO case when Msg3 alloc and Cqi/Ri/SRS opportunity
5273 * occur at same time */
5274 if(NULLP != alloc->ue)
5277 /* Only DATA is expected */
5278 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA;
5279 datRecpInfo->rnti = alloc->rnti;
5280 rgSCHUtlAllocRcptInfo (cell,alloc, &recpReqInfo->timingInfo,
5281 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5286 if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA &&
5287 datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_SRS &&
5288 isAperiodic == FALSE)
5290 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = TRUE;
5291 datRecpInfo->t.puschRecpReq.initialNumRbs.val = alloc->ue->initNumRbs;
5295 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = FALSE;
5298 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(datRecpInfo->lnk));
5299 datRecpInfo->lnk.node = (PTR)datRecpInfo;
5300 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
5302 } /* end of while */
5304 if(numUePerTti && (numUePerTti < RG_MAX_NUM_UE_PER_TTI))
5306 cell->ulNumUeSchedPerTti[numUePerTti-1]++;
5307 gUlNumUePerTti[numUePerTti - 1]++;
5310 } /* end of rgSCHTomUtlFillDatRecpReq */
5312 /* rg009.201. Added changes of TFU_UPGRADE */
5314 /***********************************************************
5316 * Func : rgSCHTomUtlFillRiBitWidthInfo
5319 * Desc : Fills the RI BitWidth and stores it for decoding.
5328 **********************************************************/
5330 PUBLIC S16 rgSCHTomUtlFillRiBitWidthInfo
5335 PUBLIC S16 rgSCHTomUtlFillRiBitWidthInfo(ueCb)
5339 RgSchUePCqiCb *riCb = ueCb->nPRiCb;
5340 TRC2(rgSCHTomUtlFillRiBitWidthInfo);
5342 if (ueCb->mimoInfo.txMode != RGR_UE_TM_3 &&
5343 ueCb->mimoInfo.txMode != RGR_UE_TM_4)
5348 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUCCH;
5349 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode=
5350 (TfuDlCqiPucchMode)riCb->cqiCfg.cqiSetup.prdModeEnum;
5351 switch(ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode)
5353 case TFU_PUCCH_CQI_MODE10:
5354 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info.type = TFU_RPT_RI;
5355 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info.u.ri =
5358 case TFU_PUCCH_CQI_MODE11:
5359 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info.type = TFU_RPT_RI;
5360 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info.u.ri =
5363 case TFU_PUCCH_CQI_MODE20:
5364 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info.type = TFU_RPT_RI;
5365 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info.u.ri =
5368 case TFU_PUCCH_CQI_MODE21:
5369 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info.type = TFU_RPT_RI;
5370 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info.u.ri =
5377 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5381 /***********************************************************
5383 * Func : rgSCHTomUtlFetchPcqiBitSz
5386 * Desc : Fetch the CQI/PMI bits for a UE based on the mode, periodicity.
5395 **********************************************************/
5397 PUBLIC U8 rgSCHTomUtlFetchPcqiBitSz
5404 PUBLIC U8 rgSCHTomUtlFetchPcqiBitSz(ueCb, numTxAnt, ri)
5412 TfuCqiPucchMode10 *mode10Info;
5413 TfuCqiPucchMode11 *mode11Info;
5414 TfuCqiPucchMode20 *mode20Info;
5415 TfuCqiPucchMode21 *mode21Info;
5416 RgSchUePCqiCb *cqiCb = ueCb->nPCqiCb;
5418 TRC3(rgSCHTomUtlFetchPcqiBitSz);
5420 confRepMode = cqiCb->cqiCfg.cqiSetup.prdModeEnum;
5421 if((ueCb->mimoInfo.txMode != RGR_UE_TM_3) &&
5422 (ueCb->mimoInfo.txMode != RGR_UE_TM_4))
5428 *ri = cqiCb->perRiVal;
5430 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUCCH;
5431 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode=
5432 (TfuDlCqiPucchMode)confRepMode;
5435 case RGR_PRD_CQI_MOD10:
5437 mode10Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info;
5439 mode10Info->type = TFU_RPT_CQI;
5440 mode10Info->u.cqi = 4;
5444 case RGR_PRD_CQI_MOD11:
5446 mode11Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info;
5447 mode11Info->type = TFU_RPT_CQI;
5453 mode11Info->u.cqi.cqi = 4;
5454 mode11Info->u.cqi.wideDiffCqi.pres = FALSE;
5455 mode11Info->u.cqi.pmi = 2;
5460 mode11Info->u.cqi.cqi = 4;
5461 mode11Info->u.cqi.wideDiffCqi.pres = TRUE;
5462 mode11Info->u.cqi.wideDiffCqi.val = 3;
5463 mode11Info->u.cqi.pmi = 1;
5466 else if(numTxAnt == 4)
5471 mode11Info->u.cqi.cqi = 4;
5472 mode11Info->u.cqi.wideDiffCqi.pres = FALSE;
5473 mode11Info->u.cqi.pmi = 4;
5478 mode11Info->u.cqi.cqi = 4;
5479 mode11Info->u.cqi.wideDiffCqi.pres = TRUE;
5480 mode11Info->u.cqi.wideDiffCqi.val = 3;
5481 mode11Info->u.cqi.pmi = 4;
5486 /* This is number of antenna case 1.
5487 * This is not applicable for Mode 1-1.
5488 * So setting it to invalid value */
5494 case RGR_PRD_CQI_MOD20:
5496 mode20Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info;
5497 mode20Info->type = TFU_RPT_CQI;
5501 mode20Info->u.cqi.isWideband = TRUE;
5502 mode20Info->u.cqi.u.wideCqi = 4;
5506 pcqiSz = 4 + cqiCb->label;
5507 mode20Info->u.cqi.isWideband = FALSE;
5508 mode20Info->u.cqi.u.subCqi.cqi = 4;
5509 mode20Info->u.cqi.u.subCqi.l = cqiCb->label;
5514 case RGR_PRD_CQI_MOD21:
5516 mode21Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info;
5517 mode21Info->type = TFU_RPT_CQI;
5518 //pcqiSz = rgSCHTomUtlFetchPcqiBitSzPucchMode21(ueCb,
5519 // mode21Info, numTxAnt, ri);
5527 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5532 /***********************************************************
5534 * Func : rgSCHTomUtlPcqiSbCalcBpIdx
5537 * Desc : Determines the BP index from the timing info
5546 **********************************************************/
5548 PUBLIC S16 rgSCHTomUtlPcqiSbCalcBpIdx
5550 CmLteTimingInfo crntTimInfo,
5552 RgSchUePCqiCb *cqiCb
5555 PUBLIC S16 rgSCHTomUtlPcqiSbCalcBpIdx(crntTimInfo, ueCb, cqiCb)
5556 CmLteTimingInfo crntTimInfo;
5558 RgSchUePCqiCb *cqiCb;
5561 U16 tti = (crntTimInfo.sfn * RGSCH_NUM_SUB_FRAMES_5G + crntTimInfo.slot);
5562 U16 prdNum = tti/cqiCb->cqiPeri;
5564 TRC2(rgSCHTomUtlPcqiSbCalcBpIdx);
5565 if((prdNum % cqiCb->h) == 0)
5569 cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_1;
5574 cqiCb->isWb = FALSE;
5575 cqiCb->bpIdx = ((prdNum % cqiCb->h) - 1) % cqiCb->J;
5577 cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_0;
5585 * @brief Function which moves PCQI, RI, SR and SRS to next periodicity
5586 * Occasions as that needs to be done in case of Ack/Nack repetition
5587 * reception request occasions or during Measurement Gap occasions.
5591 * Function: rgSCHTomUtlMoveNxtOccasion
5593 * Function which moves PCQI, RI, SR and SRS to next perodicity
5594 * Occasions as that needs to be done in case of Ack/Nack repetition
5595 * reception request occasions or during Measurement Gap occasions.
5597 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5600 * - Check whether the current Tx Instance matches with the rec req time
5601 * - If true, then move them to their next Tx Instance
5603 * @param[in] RgSchCellCb *cell,
5611 PUBLIC S16 rgSCHTomUtlMoveNxtOccasion
5618 PUBLIC S16 rgSCHTomUtlMoveNxtOccasion(cell, ue, validIdx)
5624 RgSchUePCqiCb *cqiCb = ue->nPCqiCb;
5625 RgSchUePCqiCb *riCb = ue->nPRiCb;
5626 TRC2(rgSCHTomUtlMoveNxtOccasion);
5628 /* ccpu00140578::Skip the UE if already RI recpetion
5629 * is processed in the same subframe */
5630 if ((riCb->nRiTrIdx == validIdx) &&
5631 (riCb->riRecpPrcsd == FALSE))
5633 if(riCb->riDist ==0)
5635 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
5641 /* ccpu00140578:: As this UE is considered for this TTI
5642 * Same UE should not get processed for RI reception
5643 * or for updating th RI distance.*/
5644 if(riCb->nRiTrIdx == validIdx)
5646 riCb->riRecpPrcsd = TRUE;
5649 if (cqiCb->nCqiTrIdx == validIdx)
5651 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
5654 /* ccpu00140578::Skip the UE if SRS recpetion
5655 * is already processed in the same subframe */
5656 if ((ue->srsCb.nSrsTrIdx == validIdx) &&
5657 (ue->srsCb.srsRecpPrcsd == FALSE))
5659 if(ue->srsCb.srsDist ==0)
5661 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
5665 ue->srsCb.srsDist--;
5667 /* ccpu00140578:: As this UE is considered for this TTI
5668 * Same UE should not get processed for SRS reception
5669 * or for updating th SRS distance.*/
5670 if(ue->srsCb.nSrsTrIdx == validIdx)
5672 ue->srsCb.srsRecpPrcsd = TRUE;
5675 if (ue->srCb.nSrTrIdx == validIdx)
5677 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
5680 } /* rgSCHTomUtlMoveNxtOccasion */
5683 /***********************************************************
5685 * Func : rgSCHTomPrepareAcqiRecp
5688 * Desc : Fetch the CQI/PMI bits for a UE based on the mode and store them
5689 * for decoding. Fill RECP request and prepare the scartchpad
5690 * to aid decoding of Aperiodic CQI.
5699 **********************************************************/
5701 PUBLIC Void rgSCHTomPrepareAcqiRecp
5705 TfuUePuschCqiRecpInfo *cqiRecpReqInfo,
5709 PUBLIC Void rgSCHTomPrepareAcqiRecp(ueCb, cell, cqiRecpReqInfo, ccIdx)
5712 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
5717 RgSchCqiRawPuschMode12 *mode12Info;
5718 RgSchCqiRawPuschMode20 *mode20Info;
5719 RgSchCqiRawPuschMode22 *mode22Info;
5720 RgSchCqiRawPuschMode30 *mode30Info;
5721 RgSchCqiRawPuschMode31 *mode31Info;
5722 U8 numTxAnt = cell->numTxAntPorts;
5723 U8 sCellIdx = ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)];
5725 RgSchUeACqiCb *acqiCb = &ueCb->cellInfo[sCellIdx]->acqiCb;
5727 TRC2(rgSCHTomPrepareAcqiRecp);
5730 cqiRecpReqInfo->reportType = TFU_APERIODIC_CQI_TYPE; /* Aperiodic */
5731 if (ueCb->mimoInfo.txMode == RGR_UE_TM_3 ||
5732 ueCb->mimoInfo.txMode == RGR_UE_TM_4)
5734 cqiRecpReqInfo->riSz[ccIdx].pres = TRUE;
5735 cqiRecpReqInfo->riSz[ccIdx].val = acqiCb->riNumBits;
5737 /* This flag will be rmeoved after making changes in BRDCM CL
5738 * Sachin is doing the change
5740 #if (defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
5742 cqiRecpReqInfo->cqiPmiSzR1[ccIdx] = acqiCb->cqiPmiSzR1;
5743 cqiRecpReqInfo->cqiPmiSzRn1[ccIdx] = acqiCb->cqiPmiSzRn1;
5745 if(ueCb->nPCqiCb->perRiVal == 1)
5747 cqiRecpReqInfo->cqiPmiSzR1[ccIdx] = acqiCb->cqiPmiSzR1;
5751 cqiRecpReqInfo->cqiPmiSzRn1[ccIdx] = acqiCb->cqiPmiSzRn1;
5754 /* Fill scratchpad to aid decoding of aper CQI upon
5756 confRepMode = acqiCb->aCqiCfg.aprdModeEnum;
5757 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUSCH;
5759 numOfCells = ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells;
5761 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5762 puschRawCqiInfo.mode = (TfuDlCqiPuschMode)confRepMode;
5764 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5765 puschRawCqiInfo.ri.pres = cqiRecpReqInfo->riSz[ccIdx].pres;
5767 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5768 puschRawCqiInfo.ri.val = cqiRecpReqInfo->riSz[ccIdx].val;
5770 /* Setting the sCellIdx */
5771 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5772 sCellIdx = sCellIdx;
5776 case RGR_APRD_CQI_MOD12:
5778 mode12Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5779 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode12Info;
5780 mode12Info->wideBCqiCw0 = 4;
5781 mode12Info->r1WideBCqiCw1 = 0;
5782 mode12Info->rg1WideBCqiCw1 = 4;
5785 mode12Info->r1TotalPmiBitLen = 2*acqiCb->N;
5786 mode12Info->rg1TotalPmiBitLen = acqiCb->N;
5788 else if(numTxAnt == 4)
5790 mode12Info->r1TotalPmiBitLen = 4*acqiCb->N;
5791 mode12Info->rg1TotalPmiBitLen = 4*acqiCb->N;
5796 case RGR_APRD_CQI_MOD20:
5798 mode20Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5799 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode20Info;
5800 mode20Info->wideBCqiCw = 4;
5801 mode20Info->subBandDiffCqi = 2;
5802 mode20Info->posOfM = acqiCb->L;
5806 case RGR_APRD_CQI_MOD22:
5808 mode22Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5809 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode22Info;
5810 mode22Info->wideBCqiCw0 = 4;
5811 mode22Info->sBDiffCqiCw0 = 2;
5812 mode22Info->r1WideBCqiCw1 = 0;
5813 mode22Info->r1SbDiffCqiCw1 = 0;
5814 mode22Info->rg1WideBCqiCw1 = 4;
5815 mode22Info->rg1SbDiffCqiCw1 = 2;
5816 mode22Info->posOfM = acqiCb->L;
5819 mode22Info->r1PmiBitLen = 4;
5820 mode22Info->rg1PmiBitLen = 2;
5822 else if(numTxAnt == 4)
5824 mode22Info->r1PmiBitLen = 8;
5825 mode22Info->rg1PmiBitLen = 8;
5830 case RGR_APRD_CQI_MOD30:
5832 mode30Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5833 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode30Info;
5834 mode30Info->wideBCqiCw = 4;
5835 mode30Info->totLenSbDiffCqi = 2*acqiCb->N;
5839 case RGR_APRD_CQI_MOD31:
5841 mode31Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5842 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode31Info;
5843 mode31Info->wideBCqiCw0 = 4;
5844 mode31Info->totLenSbDiffCqiCw0 = 2*acqiCb->N;
5845 mode31Info->r1WideBCqiCw1 = 0;
5846 mode31Info->r1TotLenSbDiffCqiCw1 =0;
5847 mode31Info->rg1WideBCqiCw1 = 4;
5848 mode31Info->rg1TotLenSbDiffCqiCw1 = 2*acqiCb->N;
5851 mode31Info->r1PmiBitLen = 2;
5852 mode31Info->rg1PmiBitLen = 1;
5854 else if(numTxAnt == 4)
5856 mode31Info->r1PmiBitLen = 4;
5857 mode31Info->rg1PmiBitLen = 4;
5868 * @brief Function which handles the filling of Aperiodic CQI/RI reception
5873 * Function: rgSCHTomUtlFillDatAperRecpReq
5875 * Function which handles the filling of Aperiodic CQI/RI reception
5878 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5881 * - Fill the reception request for the data arriving on the ULSCH
5882 * - Fill the reception request information for the Aperiodic CQI/PMI/RI
5884 * @param[in] RgSchCellCb *cell,
5885 * RgSchUlAlloc *alloc,
5886 * TfuUeRecpReqInfo *datRecpInfo,
5887 * CmLteTimingInfo *timeInfo,
5894 PUBLIC S16 rgSCHTomUtlFillDatAperRecpReq
5898 RgSchUlAlloc *alloc,
5899 TfuUeRecpReqInfo *datRecpInfo,
5900 CmLteTimingInfo *timeInfo,
5905 PUBLIC S16 rgSCHTomUtlFillDatAperRecpReq(cell, cqiReq, alloc, datRecpInfo, timeInfo, hqPres, validIdx)
5908 RgSchUlAlloc *alloc;
5909 TfuUeRecpReqInfo *datRecpInfo;
5910 CmLteTimingInfo *timeInfo;
5915 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
5916 RgSchUeCb *ueCb = alloc->ue;
5921 TRC2(rgSCHTomUtlFillDatAperRecpReq);
5923 /*Fill RI Reception Params*/
5924 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
5925 cqiRecpReqInfo->riBetaOff = alloc->ue->ul.betaRiOffst;
5926 cqiRecpReqInfo->cqiBetaOff = alloc->ue->ul.betaCqiOffst;
5929 cqiRecpReqInfo->cCNum = 0;
5930 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells = 0;
5933 rgSCHTomUtlGetTrigSet(cell, ueCb, cqiReq, &triggerSet);
5934 for (sIdx = 0; sIdx < CM_LTE_MAX_CELLS; sIdx++)
5936 /* The Aperiodic request for SCell index sIdx */
5937 if ((triggerSet >> (7 - sIdx)) & 0x01)
5939 /* The Aperiodic request for SCell index sIdx */
5940 rgSCHTomPrepareAcqiRecp(ueCb, ueCb->cellInfo[sIdx]->cell, cqiRecpReqInfo, cqiRecpReqInfo->cCNum);
5941 cqiRecpReqInfo->cCNum++;
5942 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells++;
5946 rgSCHTomPrepareAcqiRecp(ueCb, ueCb->cellInfo[0]->cell, cqiRecpReqInfo, cqiRecpReqInfo->cCNum);
5947 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells++;
5950 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5952 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
5954 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
5955 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
5959 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
5961 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
5965 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
5967 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
5969 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
5971 datRecpInfo->rnti = alloc->rnti;
5972 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
5973 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5975 } /* rgSCHTomUtlFillDatAperRecpReq */
5980 * @brief Function which handles the filling of Periodic RI reception
5981 * request values which arrives along with UL Data on ULSCH
5985 * Function: rgSCHTomUtlFillDatPriRecpReq
5987 * Function which handles the filling of Periodic RI reception
5988 * request values which arrives along with UL Data on ULSCH
5990 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5993 * - Fill the reception request for the data arriving on the ULSCH
5994 * - Fill the reception request information for the Periodic RI
5996 * @param[in] RgSchCellCb *cell,
5997 * RgSchUlAlloc *alloc,
5998 * TfuUeRecpReqInfo *datRecpInfo,
5999 * CmLteTimingInfo *timeInfo,
6006 PUBLIC S16 rgSCHTomUtlFillDatPriRecpReq
6009 RgSchUlAlloc *alloc,
6010 TfuUeRecpReqInfo *datRecpInfo,
6011 CmLteTimingInfo *timeInfo,
6016 PUBLIC S16 rgSCHTomUtlFillDatPriRecpReq(cell, alloc, datRecpInfo, timeInfo,
6019 RgSchUlAlloc *alloc;
6020 TfuUeRecpReqInfo *datRecpInfo;
6021 CmLteTimingInfo *timeInfo;
6026 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
6027 TRC2(rgSCHTomUtlFillDatPriRecpReq);
6029 /*Fill RI Reception Params*/
6030 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
6031 #ifdef TFU_ALLOC_EVENT_NO_INIT
6032 cqiRecpReqInfo->cqiBetaOff = 0;
6033 /* Fill only the first RI index since Periodic can come
6035 cqiRecpReqInfo->cqiPmiSzR1[0] = 0;
6036 cqiRecpReqInfo->cqiPmiSzRn1[0] = 0;
6038 cqiRecpReqInfo->reportType = TFU_PERIODIC_CQI_TYPE; /* periodic */
6039 cqiRecpReqInfo->riBetaOff = alloc->ue->ul.betaRiOffst;
6041 /* Fill only the first RI index since Periodic can come
6043 cqiRecpReqInfo->cCNum = 1;
6044 cqiRecpReqInfo->riSz[0].pres = TRUE;
6045 cqiRecpReqInfo->riSz[0].val = alloc->ue->nPRiCb->riNumBits;
6047 rgSCHTomUtlFillRiBitWidthInfo(alloc->ue);
6048 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
6050 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
6051 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
6055 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
6057 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
6061 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
6063 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
6065 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
6067 datRecpInfo->rnti = alloc->rnti;
6068 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
6069 &datRecpInfo->t.puschRecpReq.ulSchInfo);
6071 } /* rgSCHTomUtlFillDatPriRecpReq */
6075 * @brief Function which handles the filling of Periodic CQI/PMI reception
6076 * request values which arrives along with UL Data on ULSCH
6080 * Function: rgSCHTomUtlFillDatPCqiRecpReq
6082 * Function which handles the filling of Periodic CQI/PMI reception
6083 * request values which arrives along with UL Data on ULSCH
6085 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
6088 * - Fill the reception request for the data arriving on the ULSCH
6089 * - Fill the reception request information for the Periodic CQI/PMI
6091 * @param[in] RgSchCellCb *cell,
6092 * RgSchUlAlloc *alloc,
6093 * TfuUeRecpReqInfo *datRecpInfo,
6094 * CmLteTimingInfo *timeInfo,
6102 PUBLIC S16 rgSCHTomUtlFillDatPCqiRecpReq
6105 RgSchUlAlloc *alloc,
6106 TfuUeRecpReqInfo *datRecpInfo,
6107 CmLteTimingInfo *timeInfo,
6112 PUBLIC S16 rgSCHTomUtlFillDatPCqiRecpReq(cell, alloc, datRecpInfo,
6113 timeInfo, hqPres, validIdx)
6115 RgSchUlAlloc *alloc;
6116 TfuUeRecpReqInfo *datRecpInfo;
6117 CmLteTimingInfo *timeInfo;
6122 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
6123 U8 cqiPmiSz; /*Raw CQI/PMI Size*/
6126 TRC2(rgSCHTomUtlFillDatPCqiRecpReq);
6129 /*Fill CQI Reception Params*/
6130 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
6131 #ifdef TFU_ALLOC_EVENT_NO_INIT
6132 cqiRecpReqInfo->riBetaOff = 0;
6134 cqiRecpReqInfo->cqiBetaOff = alloc->ue->ul.betaCqiOffst;
6135 cqiPmiSz = rgSCHTomUtlFetchPcqiBitSz(alloc->ue, cell->numTxAntPorts, &ri);
6138 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Fill "
6139 "CqiPmi size RNTI:%d",alloc->rnti);
6143 /* Fill only the first RI index since Periodic can come
6145 cqiRecpReqInfo->cCNum = 1;
6146 cqiRecpReqInfo->reportType = TFU_PERIODIC_CQI_TYPE; /* Periodic */
6147 /* This flags will be removed once Sachin does changes
6149 #if (defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
6150 cqiRecpReqInfo->cqiPmiSzR1[0] = cqiPmiSz;
6151 cqiRecpReqInfo->cqiPmiSzRn1[0] = cqiPmiSz;
6155 cqiRecpReqInfo->cqiPmiSzR1[0] = cqiPmiSz;
6156 cqiRecpReqInfo->cqiPmiSzRn1[0] = 0;
6160 cqiRecpReqInfo->cqiPmiSzRn1[0] = cqiPmiSz;
6161 cqiRecpReqInfo->cqiPmiSzR1[0] = 0;
6164 cqiRecpReqInfo->riSz[0].pres = FALSE;
6166 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
6168 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
6169 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
6172 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
6174 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
6178 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
6180 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
6182 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
6184 datRecpInfo->rnti = alloc->rnti;
6185 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
6186 &datRecpInfo->t.puschRecpReq.ulSchInfo);
6188 } /* rgSCHTomUtlFillDatPCqiRecpReq */
6191 * @brief Function which handles the filling of SRS reception
6192 * request values which arrives along with UL Data on ULSCH
6196 * Function: rgSCHTomUtlFillDatSrsRecpReq
6198 * Function which handles the filling of SRS reception
6199 * request values which arrives along with UL Data on ULSCH
6201 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
6204 * - Fill the reception request for the data arriving on the ULSCH
6205 * - Fill the reception request information for the SRS
6207 * @param[in] RgSchCellCb *cell,
6208 * RgSchUlAlloc *alloc,
6209 * TfuUeRecpReqInfo *datRecpInfo,
6210 * CmLteTimingInfo *timeInfo,
6217 PUBLIC S16 rgSCHTomUtlFillDatSrsRecpReq
6220 RgSchUlAlloc *alloc,
6221 TfuUeRecpReqInfo *datRecpInfo,
6222 CmLteTimingInfo *timeInfo,
6226 PUBLIC S16 rgSCHTomUtlFillDatSrsRecpReq(cell, alloc, datRecpInfo, timeInfo,
6229 RgSchUlAlloc *alloc;
6230 TfuUeRecpReqInfo *datRecpInfo;
6231 CmLteTimingInfo *timeInfo;
6235 TRC2(rgSCHTomUtlFillDatSrsRecpReq);
6236 datRecpInfo->rnti = alloc->rnti;
6237 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
6240 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_HARQ_SRS;
6244 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_SRS;
6246 datRecpInfo->rnti = alloc->rnti;
6247 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
6248 &datRecpInfo->t.puschRecpReq.ulSchInfo);
6250 } /* rgSCHTomUtlFillDatSrsRecpReq */
6253 * @brief Function which handles the filling of only SRS reception
6254 * request values on ULSCH
6258 * Function: rgSCHTomFillOnlySrsRecpReq
6260 * Function which handles the filling of SRS reception
6261 * request values which arrives along with UL Data on ULSCH
6263 * Invoked by: rgSCHTomUtlFillDatSrsRecpReq of rg_sch_tom.c
6266 * - Fill the reception request for the data arriving on the ULSCH
6267 * - Fill the reception request information for the SRS
6269 * @param[in] RgSchCellCb *cell,
6270 * RgSchUlAlloc *alloc,
6271 * TfuUeRecpReqInfo *datRecpInfo,
6277 PUBLIC S16 rgSCHTomFillOnlySrsRecpReq
6280 RgSchUlAlloc *alloc,
6281 TfuUeRecpReqInfo *datRecpInfo
6284 PUBLIC S16 rgSCHTomFillOnlySrsRecpReq(cell, alloc, datRecpInfo)
6286 RgSchUlAlloc *alloc;
6287 TfuUeRecpReqInfo *datRecpInfo;
6290 TfuUePuschSrsRecpInfo *srsRecpReqInfo;
6291 TRC2(rgSCHTomFillOnlySrsRecpReq);
6293 srsRecpReqInfo = &datRecpInfo->t.puschRecpReq.srsInfo;
6294 srsRecpReqInfo->srsBw = (TfuUlSrsBwInfo)alloc->ue->srsCb.srsCfg.srsSetup.srsBw;
6295 srsRecpReqInfo->nRrc = alloc->ue->srsCb.srsCfg.srsSetup.fDomPosi;
6296 srsRecpReqInfo->srsHopBw = (TfuUlSrsHoBwInfo)alloc->ue->srsCb.srsCfg.srsSetup.srsHopBw;
6297 srsRecpReqInfo->transComb = alloc->ue->srsCb.srsCfg.srsSetup.txComb;
6298 srsRecpReqInfo->srsCfgIdx = alloc->ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6299 srsRecpReqInfo->srsCyclicShft = (TfuUlSrsCycShiftInfo)alloc->ue->srsCb.srsCfg.srsSetup.cycShift;
6301 /* ccpu00117050 - ADD - nSrs setting
6302 * Refer Section 5.2.2.6 of TS 36.212 V8.5.0*/
6303 datRecpInfo->t.puschRecpReq.ulSchInfo.nSrs = 1;
6306 } /* rgSCHTomFillOnlySrsRecpReq */
6309 * @brief Function which handles the filling of PCQI/RI, SRS and SR
6310 * Reception Request Information along
6311 * with the HARQ reception Request
6315 * Function: rgSCHTomUtlFillCqiSrSrsWithHq
6317 * Function which handles the filling of PCQI/RI, SRS ans SR
6318 * Reception Request Information along
6319 * with the HARQ reception Request
6322 * Invoked by: rgSCHTomUtlFillHqFdbkRecpReq &
6323 * rgSCHTomUtlFillSfHqFdbk of rg_sch_tom.c
6326 * - Fill the reception request for the Control Info arriving on the PUCCH
6327 * - Fill the reception request information for the SR, RI, CQI, SRS
6329 * @param[in] RgSchCellCb *cell,
6330 * TfuRecpReqInfo *recpReqInfo,
6331 * RgSchDlHqProcCb *hqCb,
6332 * @param[out] TfuUeRecpReqInfo *pucchRecpInfo
6333 * @param[in] U16 validIdx
6339 PRIVATE S16 rgSCHTomUtlFillCqiSrSrsWithHq
6342 TfuRecpReqInfo *recpReqInfo,
6344 TfuUeRecpReqInfo *pucchRecpInfo,
6346 Bool isDatPresOnSecCell
6349 PRIVATE S16 rgSCHTomUtlFillCqiSrSrsWithHq(cell, recpReqInfo, ue,
6350 pucchRecpInfo, validIdx,isDatPresOnSecCell)
6352 TfuRecpReqInfo *recpReqInfo;
6354 TfuUeRecpReqInfo *pucchRecpInfo;
6356 Bool isDatPresOnSecCell;
6359 RgSchUePCqiCb *cqiCb;
6360 RgSchUePCqiCb *riCb;
6361 U8 ri; /*To fetch RI value*/
6362 Bool willUeRprtCqi; /* Flag set due to CQI Mask and
6363 UE Inactive state (DRX)*/
6364 Bool willUeRprtSr = TRUE;
6365 TfuAckNackMode hqFdbkMode;
6368 Bool dropCqi = FALSE;
6370 RgSchCmnUlUeSpsInfo *ulSpsUe = NULL;
6373 RgSchEmtcUeInfo *emtcUe = NULLP;
6376 TRC2(rgSCHTomUtlFillCqiSrSrsWithHq);
6380 /*Changes for PUCCH Format3 */
6381 hqFdbkMode = pucchRecpInfo->t.pucchRecpReq.hqInfo.hqFdbkMode;
6382 numCqiBit = rgSCHCmnCalcPcqiBitSz (ue,cell->numTxAntPorts);
6383 totalPucchBits = pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz + numCqiBit;
6386 emtcUe = RG_GET_EMTC_UE_CB(ue);
6388 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
6389 #ifdef EMTC_ENABLE /*VINU*/
6392 if((emtcUe->pucchRepNumFr1 > 1) || (emtcUe->pucchRepNumFr2 > 1))
6394 willUeRprtCqi = FALSE;
6395 willUeRprtSr = FALSE;
6399 if(ue->srCb.nSrTrIdx == validIdx)
6403 /* Should we check for Rel8 and above???
6404 * Dont send SR recp req if logicalChannelSR-Mask enabled and UL SPS is
6406 ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue, cell);
6407 /* Avoiding check for ulSpsEnabled as isUlSpsActv FALSE if sps is not enabled*/
6408 if(!((ue->ul.ulSpsCfg.isLcSRMaskEnab) &&
6409 (ulSpsUe->isUlSpsActv)))
6416 pucchRecpInfo->t.pucchRecpReq.srInfo.n1PucchIdx =
6417 ue->srCb.srCfg.srSetup.srResIdx;
6418 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
6419 /* FORMAT3: If SR is present it will be appended after HARQ */
6420 totalPucchBits = totalPucchBits + 1;
6427 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
6429 /* LTE_ADV:: UE will drop CSI during CSI+1BCS if data is present
6430 * on sec cell(isDatPresOnSecCell)*/
6432 if (hqFdbkMode == TFU_ACK_NACK_CHANNEL_SELECTION)
6434 if (hqFdbkMode == TFU_UCI_FORMAT_1B_CS)
6437 if (isDatPresOnSecCell == TRUE)
6444 /* Format 3 Changes : If Hq + SR + CQI bits < 22 and simultaneousAckNackAndCQI-Format3
6445 is enabled then CQI will be multiplexed with HQ otherwise CQI will be dropped
6446 Spec 36.213 Sec 10.1.1 */
6447 else if (hqFdbkMode == TFU_UCI_FORMAT_3)
6449 if ((isDatPresOnSecCell == TRUE) &&
6450 ((!ue->simulAckNackCQIFormat3) || (totalPucchBits > 22)))
6458 cqiCb = ue->nPCqiCb;
6459 if(riCb->nRiTrIdx == validIdx)
6461 /*ccpu00140578:: Skip the UE if the RI is already processed
6463 if(riCb->riRecpPrcsd == FALSE)
6465 if(riCb->riDist == 0)
6467 if((riCb->cqiCfg.cqiSetup.sANCQI == TRUE) && (willUeRprtCqi == TRUE)&&
6468 (isDatPresOnSecCell == FALSE))
6471 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6472 riCb->cqiCfg.cqiSetup.cqiPResIdx;
6473 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6475 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_HARQ_SR)
6477 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI;
6481 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_CQI;
6483 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6485 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6486 ue->nPRiCb->servCellInfo->sCellIdx;
6488 rgSCHTomUtlFillRiBitWidthInfo(ue);
6489 if (ue->nPCqiCb->nCqiTrIdx == validIdx)
6491 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, ue->nPCqiCb);
6506 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
6512 /* Skip the UE for RI processing on PUCCH
6513 * in the same subframe as it already processed */
6514 if(riCb->nRiTrIdx == validIdx)
6516 /* As the new idx is same is current idx
6517 * then PUCCH reception processing will consider
6518 * RI also in the same subframe. To block this
6519 * below flag is used*/
6520 riCb->riRecpPrcsd = TRUE;
6524 else if(cqiCb->nCqiTrIdx == validIdx)
6526 if((cqiCb->cqiCfg.cqiSetup.sANCQI == TRUE) && (willUeRprtCqi == TRUE)&&
6527 (isDatPresOnSecCell == FALSE))
6530 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6531 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
6533 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6535 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6536 cqiCb->servCellInfo->sCellIdx;
6538 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6539 rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
6540 if(0 == pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz)
6542 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d "
6543 "Unable to Fill CqiPmi size", ue->ueId);
6546 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_HARQ_SR)
6548 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI;
6552 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_CQI;
6565 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6567 if(ue->srsCb.nSrsTrIdx == validIdx)
6569 /* ccpu00140578::Skip the UE for SRS reception processing
6570 * if already done as part of PUSCH recpetion
6572 if(ue->srsCb.srsRecpPrcsd == FALSE)
6574 if(ue->srsCb.srsDist ==0 )
6576 if((pucchRecpInfo->t.pucchRecpReq.uciInfo != TFU_PUCCH_HARQ_CQI)
6577 && (ue->srsCb.srsCfg.srsSetup.sANSrs)
6578 && (isDatPresOnSecCell == FALSE))
6581 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
6582 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
6583 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
6584 ue->srsCb.srsCfg.srsSetup.fDomPosi;
6585 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
6586 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
6587 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
6588 ue->srsCb.srsCfg.srsSetup.txComb;
6589 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
6590 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6591 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
6592 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
6593 /* ccpu00116923 - ADD - New Reception Request types for CQI and SRS with SR */
6594 switch(pucchRecpInfo->t.pucchRecpReq.uciInfo)
6596 case TFU_PUCCH_HARQ_SR:
6597 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_SRS;
6599 case TFU_PUCCH_HARQ_SR_CQI:
6600 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI_SRS;
6603 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SRS;
6607 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
6611 ue->srsCb.srsDist--;
6613 /* Skip the UE for SRS processing on PUCCH
6614 * in the same subframe as it already processed */
6615 if(ue->srsCb.nSrsTrIdx == validIdx)
6617 /* As the new idx is same is current idx
6618 * then PUCCH reception processing will consider
6619 * SRS also in the same subframe. To block this
6620 * below flag is used*/
6621 ue->srsCb.srsRecpPrcsd = TRUE;
6629 } /* rgSCHTomUtlFillCqiSrSrsWithHq */
6632 * @brief Function which handles the filling of PCQI/RI, SRS
6633 * Reception Request Information along with SR reception
6638 * Function: rgSCHTomUtlFillCqiSrsWithSr
6640 * Function which handles the filling of PCQI/RI, SRS
6641 * Reception Request Information along
6642 * with the SR reception Request
6645 * Invoked by: rgSCHTomUtlFillSrRecpReq of rg_sch_tom.c
6648 * - Fill the reception request for CQI/RI, SRS if they occur
6649 * in the same instance as of SR.
6651 * @param[in] RgSchCellCb *cell,
6653 * TfuRecpReqInfo *recpReqInfo,
6654 * @param[out] TfuUeRecpReqInfo *pucchRecpInfo
6655 * @param[in] U16 validIdx
6662 PRIVATE S16 rgSCHTomUtlFillCqiSrsWithSr
6666 TfuRecpReqInfo *recpReqInfo,
6667 TfuUeRecpReqInfo *pucchRecpInfo,
6671 PRIVATE S16 rgSCHTomUtlFillCqiSrsWithSr(cell, ue, recpReqInfo,
6672 pucchRecpInfo, validIdx)
6675 TfuRecpReqInfo *recpReqInfo;
6676 TfuUeRecpReqInfo *pucchRecpInfo;
6680 RgSchUePCqiCb *cqiCb;
6681 RgSchUePCqiCb *riCb;
6682 U8 ri; /*To fetch RI value*/
6683 Bool willUeRprtCqi; /* Flag set due to CQI Mask and
6684 UE Inactive state (DRX)*/
6685 TRC2(rgSCHTomUtlFillCqiSrsWithSr);
6688 cqiCb = ue->nPCqiCb;
6689 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
6691 rgSCHEmtcWillUeRptCqi(ue, &willUeRprtCqi);
6693 if(riCb->nRiTrIdx == validIdx)
6695 /*ccpu00140578:: Skip the UE if the RI is already processed
6697 if(riCb->riRecpPrcsd == FALSE)
6699 if(riCb->riDist == 0)
6701 if(willUeRprtCqi == TRUE)
6704 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6705 riCb->cqiCfg.cqiSetup.cqiPResIdx;
6706 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6709 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI;
6710 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6712 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6713 ue->nPRiCb->servCellInfo->sCellIdx;
6715 rgSCHTomUtlFillRiBitWidthInfo(ue);
6716 /* TODO:: syed Shouldn't this be done outside this if condition */
6717 if (cqiCb->nCqiTrIdx == validIdx)
6719 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6722 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
6728 if(riCb->nRiTrIdx == validIdx)
6729 {/* Need to skip this UE during PUCCH RI recpetion process
6730 in the current subframe */
6731 riCb->riRecpPrcsd = TRUE;
6735 else if(cqiCb->nCqiTrIdx == validIdx)
6737 if(willUeRprtCqi == TRUE)
6740 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6741 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
6743 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6746 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6747 cqiCb->servCellInfo->sCellIdx;
6749 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6750 rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
6751 if(0 == pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz)
6753 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d"
6754 " Unable to Fill CqiPmi size", ue->ueId);
6758 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI;
6760 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6762 if(ue->srsCb.nSrsTrIdx == validIdx)
6764 /* ccpu00140578:: Cnsider the SRS processing
6765 * only if not done in the same TTI
6766 * as part of PUSCH or HARQ reception process*/
6767 if(ue->srsCb.srsRecpPrcsd == FALSE)
6769 if(ue->srsCb.srsDist ==0 )
6771 if(ue->srsCb.srsCfg.srsSetup.sANSrs)
6774 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
6775 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
6776 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
6777 ue->srsCb.srsCfg.srsSetup.fDomPosi;
6778 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
6779 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
6780 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
6781 ue->srsCb.srsCfg.srsSetup.txComb;
6782 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
6783 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6784 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
6785 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
6786 /* ccpu00116923 - ADD - New Reception Request types for CQI and
6788 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_SR_CQI)
6790 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI_SRS;
6794 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_SRS;
6798 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
6802 ue->srsCb.srsDist--;
6804 /* Skip the UE for SRS processing on PUCCH
6805 * in the same subframe as it already processed */
6806 if(ue->srsCb.nSrsTrIdx == validIdx)
6808 /* As the new idx is same is current idx
6809 * then PUCCH reception processing will consider
6810 * SRS also in the same subframe. To block this
6811 * below flag is used*/
6812 ue->srsCb.srsRecpPrcsd = TRUE;
6818 } /* rgSCHTomUtlFillCqiSrsWithSr */
6824 /** @brief This function handles filling of HARQ feedback repetition
6825 * recption request for each subframe
6829 * Function: rgSCHTomUtlFillSfRepHqFdbk
6833 * @param [out] TfuRecpReqInfo *recpReqInfo
6834 * @param [in] RgSchCellCb *cell
6835 * @param [out] RgSchErrInfo *err
6836 * @param [in] RgSchDlSf *dlSf
6837 * @param [in] U8 noFdbks
6838 * @param [in] CmMemListCp *memCp
6839 * @param [in] U8 elemIdx
6840 * @param [in] RgSchDlSf *nxtDlsf
6847 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk
6849 TfuRecpReqInfo *recpReqInfo,
6850 RgSchCellCb *cellCb,
6860 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk (recpReqInfo, cellCb, err, dlSf,
6861 noFdbks, memCp, elemIdx, nxtDlsf, validIdx)
6862 TfuRecpReqInfo *recpReqInfo;
6863 RgSchCellCb *cellCb;
6874 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk
6876 TfuRecpReqInfo *recpReqInfo,
6877 RgSchCellCb *cellCb,
6886 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk (recpReqInfo, cellCb, err, dlSf,
6887 noFdbks, memCp, elemIdx, nxtDlsf)
6888 TfuRecpReqInfo *recpReqInfo;
6889 RgSchCellCb *cellCb;
6899 RgSchDlHqProcCb *hqCb;
6903 TfuUeRecpReqInfo *pucchRecpInfo;
6905 TfuUePucchHqRecpInfo *hqRecpReq;
6907 RgSchDlHqTbCb *tbCb;
6908 RgSchDlHqProcCb *prvHqCb = NULLP;
6910 TRC2(rgSCHTomUtlFillSfRepHqFdbk)
6912 node = dlSf->ackNakRepQ.first;
6915 tbCb = (RgSchDlHqTbCb *)(node->node);
6917 ueCb = hqCb->hqE->ue;
6919 if (--tbCb->fbkRecpRepCntr)
6921 /* Add to next subfarme */
6922 /* Add this hqCb to the next dlSf's ackNakRepQ */
6923 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
6924 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
6925 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
6926 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
6933 /* Go to the next node */
6938 if ((hqCb->hqE->ue != NULLP) &&
6939 (hqCb->hqE->ue->measGapCb.isMeasuring != TRUE)
6940 && (hqCb != prvHqCb)
6943 /* We need to add the recp request to be sent on the pucchANRep
6946 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
6947 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
6950 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to"
6951 "Allocate TfuUeRecpReqInfo for RNTI:%d ", ueCb->ueId);
6952 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
6955 pucchRecpInfo->rnti = ueCb->ueId;
6957 pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
6959 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
6962 /* FOR repetition Feedback shall come on n1PucchAnRep Configured per
6966 pucchRecpInfo->t.pucchRecpReq.hqType = TFU_HQ_RECP_REQ_N1PUCCH;
6967 pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = ueCb->ackNakRepCb.pucchRes;
6969 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
6970 hqRecpReq = &(pucchRecpInfo->t.pucchRecpReq.hqInfo);
6971 /* ACK NACK rep works only in bundling mode . */
6972 hqRecpReq->hqFdbkMode = (TfuAckNackMode)RGR_TDD_ACKNACK_MODE_BUNDL;
6973 if ((hqCb->hqPSfLnk.node != NULLP) &&
6974 (hqCb->hqPSfLnk.node != NULLP))
6977 hqRecpReq->hqSz = 2;
6981 hqRecpReq->hqSz = 1;
6983 hqRecpReq->pucchResCnt = 1;
6984 hqRecpReq->hqRes[0] = ueCb->ackNakRepCb.pucchRes;
6986 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
6987 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
6989 /* In a given dlSf, if there is 2 TBs context
6990 * stored for a given harq, then they are added
6991 * adjacent to each other in the subframe. To avoid
6992 * adding duplicate recpnInfo for each TB, store this
6993 * hqCb in prvHqCb. If nextHqCb is same as prvHqCb then
6994 * do not add reception req info.*/
6997 RGSCH_NULL_CHECK(cellCb->instIdx, hqCb->hqE->ue);
6998 rgSCHTomUtlMoveNxtOccasion(cellCb, hqCb->hqE->ue, validIdx);
7000 /* Go to the next node */
7007 /** @brief This function handles filling of HARQ feedback recption request
7012 * Function: rgSCHTomUtlFillSfHqFdbkInfo
7016 * @param [out] TfuRecpReqInfo *recpReqInfo
7017 * @param [in] RgSchCellCb *cell
7018 * @param [out] RgSchErrInfo *err
7019 * @param [in] RgSchDlSf *dlSf
7020 * @param [in] U8 noFdbks
7021 * @param [in] CmMemListCp *memCp
7022 * @param [in] U8 elemIdx
7023 * @param [in] RgSchDlSf *nxtDlsf
7024 * @param [in] U16 validIdx;
7031 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo
7033 TfuRecpReqInfo *recpReqInfo,
7034 RgSchCellCb *cellCb,
7042 RgSchDlHqProcCb *hqCb,
7043 RgSchUePucchRecpInfo *pucchInfo,
7045 RgSchDlHqProcCb *prvHqCb
7048 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo (recpReqInfo, cellCb, err, dlSf,
7049 noFdbks, memCp, elemIdx, nxtDlsf, validIdx, hqCb, pucchInfo, alloc, prvHqCb)
7050 TfuRecpReqInfo *recpReqInfo;
7051 RgSchCellCb *cellCb;
7059 RgSchDlHqProcCb *hqCb;
7060 RgSchUePucchRecpInfo *pucchInfo;
7062 RgSchDlHqProcCb *prvHqCb;
7066 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo
7068 TfuRecpReqInfo *recpReqInfo,
7069 RgSchCellCb *cellCb,
7076 RgSchDlHqProcCb *hqCb,
7077 RgSchUePucchRecpInfo *pucchInfo,
7079 RgSchDlHqProcCb *prvHqCb
7082 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo (recpReqInfo, cellCb, err, dlSf,
7083 noFdbks, memCp, elemIdx, nxtDlsf, hqCb, pucchInfo, alloc, prvHqCb)
7084 TfuRecpReqInfo *recpReqInfo;
7085 RgSchCellCb *cellCb;
7092 RgSchDlHqProcCb *hqCb;
7093 RgSchUePucchRecpInfo *pucchInfo;
7095 RgSchDlHqProcCb *prvHqCb;
7100 RgSchUeCb *ueCb = hqCb->hqE->ue;
7102 CmLteTimingInfo futTime;
7103 RgSchTddANInfo *anInfo;
7106 RgrTddAckNackMode ackNackMode;
7107 RgSchDlHqTbCb *tbCb;
7112 TRC2(rgSCHTomUtlFillSfHqFdbkInfo)
7115 RG_SCH_ADD_TO_CRNT_TIME(cellCb->crntTime, futTime, TFU_RECPREQ_DLDELTA);
7119 for (idx = 0 ;idx < 2; idx++)
7121 if (HQ_TB_WAITING == hqCb->tbInfo[idx].state)
7124 tbCb = &hqCb->tbInfo[idx];
7128 ackNackMode = ueCb->dl.ackNackMode;
7130 if(ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL)
7132 anInfo = rgSCHUtlGetUeANFdbkInfo(ueCb, &futTime);
7133 /* Only the last scheduled TB for the UE is for HARQ
7134 * ACK/NACK reception in Bundling case */
7135 if((anInfo == NULLP) ||
7136 (anInfo->latestMIdx != dlSf->dlFdbkInfo.m))
7143 /* Get the TFU reception request pointer, if present */
7144 cmHashListFind(&cellCb->ueTfuPendLst, (U8*) &ueCb->ueId,
7145 sizeof(ueCb->ueId), 0, (PTR *) &pucchInfo);
7148 /* For upgrade we shall use the existing logic of pending list. */
7149 cmHashListFind(&cellCb->ueTfuPendLst, (U8*) &ueCb->ueId,
7150 sizeof(ueCb->ueId), 0, (PTR *) &pucchInfo);
7153 else if(hqCb->hqE->raCb != NULLP)
7155 /* For RACH it is set to Bundling */
7156 ackNackMode = RGR_TDD_ACKNACK_MODE_BUNDL;
7157 rnti = hqCb->hqE->raCb->tmpCrnti;
7164 /* Do not proceed if PUSCH
7165 reception req is already filled*/
7170 /* Go to the next node */
7174 if(((ueCb == NULLP) || (ueCb->measGapCb.isMeasuring != TRUE))
7178 TknU16 n1PucchTkn = {FALSE, 0};
7181 pdcch = tbCb->hqP->pdcch;
7183 n1PucchTkn = hqCb->spsN1PucchRes;
7185 for (tbIndx = 0; tbIndx < TFU_MAX_TB; tbIndx++)
7187 if (hqCb->tbInfo[tbIndx].state == HQ_TB_WAITING &&
7188 (RGSCH_TIMEINFO_SAME(hqCb->tbInfo[tbIndx].fdbkTime,
7189 recpReqInfo->timingInfo)))
7192 hqCb->tbInfo[tbIndx].pucchFdbkIdx = hqCb->ulDai;
7195 ret = rgSCHTomUtlFillSfHqFdbkForOneUe(hqCb,recpReqInfo, cellCb, err, dlSf, noFdbks,
7196 memCp, elemIdx, nxtDlsf, rnti, ackNackMode, &pucchInfo, pdcch,
7197 n1PucchTkn, &alloc, hqSz);
7202 /* TODO:: In case of F1BCS and CSI in same subframe
7203 * UE shall drop the CSI if there was at least one
7204 * PDSCH transmission in any of the DL subframe
7205 * mapping to this UL subframe
7208 rgSCHTomUtlFillCqiSrSrsWithHq(cellCb,recpReqInfo, hqCb->hqE->ue,
7209 pucchInfo->pucchRecpInfo, validIdx,FALSE);
7211 if((hqCb->hqE->ue) &&
7212 (hqCb->hqE->ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS))
7215 if(RG_SCH_IS_CELL_SEC(hqCb->hqE->ue,hqCb->hqE->cell))
7217 switch(pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo)
7219 case TFU_PUCCH_HARQ_SR_CQI:
7220 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
7221 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
7223 case TFU_PUCCH_HARQ_CQI:
7224 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
7225 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
7227 case TFU_PUCCH_HARQ_SR_CQI_SRS:
7228 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_SRS;
7229 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
7231 case TFU_PUCCH_HARQ_SR_SRS:
7232 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
7234 case TFU_PUCCH_HARQ_SRS:
7235 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
7246 /* TODO antz - pushing the following code (under TFU_UPGRADE)
7247 * into the above function (...ForOneUe) did not work (caused
7248 * two additional TCs to fail). Don't know why. If this
7249 * is done later, make sure that the code branch
7250 * for relPdcch (later in this func) is also modified appropriately.
7252 /* Now add to the recp request or pending list */
7253 //if((elemIdx != (noFdbks - 1)))
7255 cmHashListInsert(&cellCb->ueTfuPendLst, (PTR) pucchInfo,
7256 (U8 *)&rnti ,(U16) sizeof(CmLteRnti));
7260 } /* If measuring */
7261 /* Go to the next node */
7262 if ((tbCb->fbkRecpRepCntr) && (--tbCb->fbkRecpRepCntr))
7264 /* Add to next subfarme */
7265 /* Add this hqCb to the next dlSf's ackNakRepQ */
7266 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
7267 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
7268 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
7269 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
7271 /* In a given dlSf, if there is 2 TBs context
7272 * stored for a given harq, then they are added
7273 * adjacent to each other in the subframe. To avoid
7274 * adding duplicate recpnInfo for each TB, store this
7275 * hqCb in prvHqCb. If nextHqCb is same as prvHqCb then
7276 * do not add reception req info.*/
7284 /** @brief This function calculates the pucch resource idx
7285 * that is to be filled in harq reception request
7289 * Function: rgSCHTomUtlGethqRes
7292 * -Calculate the pucch resource idx
7293 * Harq Reception Request for Format 1B with
7296 * @param [in] U8 noFdbks
7297 * @param [in] RgSchDlSf *dlSf
7298 * @param [in] RgSchPdcch *pdcch
7299 * @param [in] RgSchCellCb *cellCb
7300 * @param [out]U16 *hqRes
7304 PRIVATE Void rgSCHTomUtlGethqRes
7309 RgSchCellCb *cellCb,
7313 PRIVATE Void rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,hqRes)
7317 RgSchCellCb *cellCb;
7329 m = dlSf->dlFdbkInfo.m;
7331 P = rgSCHCmnGetPValFrmCCE(cellCb, nCce);
7332 nP = cellCb->rgSchTddNpValTbl[P];
7333 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
7334 *hqRes = (M - m - 1)* nP + (m * nPlusOne) + pdcch->nCce +
7335 cellCb->pucchCfg.n1PucchAn;
7340 /** @brief This function fills the harq reception request for
7341 * TDD in case of Fomat 1B with CS for M=1
7345 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1
7348 * -Fill Harq Reception Request for Format 1B with
7351 * @param [in] RgSchDlHqProcCb *hqCb
7352 * @param [in] TfuUePucchRecpReq *hqRecpReq
7353 * @param [in] U8 noFdbks
7354 * @param [in] RgSchDlSf *dlSf
7355 * @param [in] RgSchPdcch *pdcch
7356 * @param [in] RgSchCellCb *cellCb
7360 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1
7362 RgSchDlHqProcCb *hqCb,
7363 TfuUePucchRecpReq *hqRecpReq,
7370 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1(hqCb, hqRecpReq,
7371 noFdbks,dlSf,pdcch,cellCb)
7372 RgSchDlHqProcCb *hqCb;
7373 TfuUePucchRecpReq *hqRecpReq;
7377 RgSchCellCb *cellCb;
7380 RgSchUeCb *ue = NULLP;
7381 Bool isCellSec = FALSE;
7384 /*ccpu00147920: UeCb is NULL for SPS activation*/
7385 if(pdcch && pdcch->ue)
7386 {/* SPS Release pdcch or dynamic data */
7393 /* This is not supposed to happen
7394 * Error case. hqCB has to be ter
7395 * when pdcch is present . Adding
7396 * if check bcs of kwork*/
7403 if((hqCb != NULLP) &&
7404 (RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
7409 switch(ue->f1bCsAVal)
7411 case RG_SCH_A_VAL_2:
7412 /* harq(0) is primary harq(1) is secondary) */
7415 hqRecpReq->hqInfo.hqRes[1] = ue->n1PucchF1bResCb.
7416 cw1N1Res[hqCb->tpc].n1PucchIdx;
7418 else/* primary cell */
7421 /* hqCb will be null in case of sps rel pdcch */
7422 if ((hqCb) && hqCb->spsN1PucchRes.pres)
7423 {/* SPS occasion or dyn sched*/
7424 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
7427 #endif /* LTEMAC_SPS */
7428 {/* dyn data or sps release */
7432 /* This is not supposed to happen
7433 * Error case. hqCB has to be ter
7434 * when pdcch is present . Adding
7435 * if check bcs of kwork*/
7440 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7441 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7445 case RG_SCH_A_VAL_3:
7447 /* Serving cell in mimo mode should be
7448 * in 0 and 1 and the serving cell in siso
7449 * mode should be in 2 indices */
7452 U8 servCellIdx = rgSchUtlGetServCellIdx(hqCb->hqE->cell->instIdx,
7453 hqCb->hqE->cell->cellId,
7456 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1)
7457 {/* Sec cell is in mimo mode, use 0 and 1 */
7458 hqRecpReq->hqInfo.hqRes[0] =
7459 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7460 hqRecpReq->hqInfo.hqRes[1] =
7461 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
7464 {/* Sec cell is in siso mode, use 2 */
7465 hqRecpReq->hqInfo.hqRes[2] =
7466 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7470 {/* primary cell hq */
7472 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
7473 {/* prim cell is in mimo mode, use 0 and 1 */
7475 if (hqCb && hqCb->spsN1PucchRes.pres)
7476 {/* Not sps release */
7477 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
7480 #endif /* LTEMAC_SPS */
7481 {/* sps rel or dyn */
7485 /* This is not supposed to happen
7486 * Error case. hqCB has to be ter
7487 * when pdcch is present . Adding
7488 * if check bcs of kwork*/
7493 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7494 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7495 hqRecpReq->hqInfo.hqRes[1] = hqRes + 1;
7499 {/* prim cell is in siso mode use 2 */
7501 /* Consider sps occasions */
7502 if (hqCb && hqCb->spsN1PucchRes.pres)
7503 {/* Not sps release */
7504 hqRecpReq->hqInfo.hqRes[2] = hqCb->spsN1PucchRes.val;
7507 #endif /* LTEMAC_SPS */
7512 /* This is not supposed to happen
7513 * Error case. hqCB has to be ter
7514 * when pdcch is present . Adding
7515 * if check bcs of kwork*/
7520 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7521 hqRecpReq->hqInfo.hqRes[2] = hqRes;
7527 case RG_SCH_A_VAL_4:
7528 {/* Both the serv cells are in mimo mode */
7530 {/* 2 and 3 for sec cell */
7531 hqRecpReq->hqInfo.hqRes[2] =
7532 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7533 hqRecpReq->hqInfo.hqRes[3] =
7534 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
7536 else/* primary cell */
7537 {/* 0 and 1 are for primary cell */
7539 if (hqCb && hqCb->spsN1PucchRes.pres)
7540 {/* Not sps release */
7541 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
7544 #endif /* LTEMAC_SPS */
7549 /* This is not supposed to happen
7550 * Error case. hqCB has to be ter
7551 * when pdcch is present . Adding
7552 * if check bcs of kwork*/
7557 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7558 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7559 hqRecpReq->hqInfo.hqRes[1] = hqRes + 1;
7570 /** @brief This function fills the harq reception request for
7571 * TDD in case of Fomat 1B with CS for M>=2
7575 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234
7578 * -Fill Harq Reception Request for Format 1B with
7581 * @param [in] RgSchDlHqProcCb *hqCb
7582 * @param [in] TfuUePucchRecpReq *hqRecpReq
7583 * @param [in] U8 noFdbks
7584 * @param [in] RgSchDlSf *dlSf
7585 * @param [in] RgSchPdcch *pdcch
7586 * @param [in] RgSchCellCb *cellCb
7587 * @param [in] U8 elemIdx
7591 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234
7593 RgSchDlHqProcCb *hqCb,
7594 TfuUePucchRecpReq *hqRecpReq,
7598 RgSchCellCb *cellCb,
7602 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234(
7603 hqCb,hqRecpReq,noFdbks,dlSf,pdcch,cellCb,elemIdx)
7604 RgSchDlHqProcCb *hqCb;
7605 TfuUePucchRecpReq *hqRecpReq;
7609 RgSchCellCb *cellCb;
7614 Bool isCellSec = FALSE;
7619 {/* SPS Release pdcch or dynamic data */
7626 /* This is not supposed to happen
7627 * Error case. hqCB has to be ter
7628 * when pdcch is present . Adding
7629 * if check bcs of kwork*/
7636 if((hqCb != NULLP) && (ue != NULLP) &&
7637 (RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
7643 {/* Sec Cell indices are 2 and 3*/
7644 servCellIdx = rgSchUtlGetServCellIdx(hqCb->hqE->cell->instIdx,
7645 hqCb->hqE->cell->cellId,
7648 hqRecpReq->hqInfo.hqRes[2] =
7649 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7651 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1)
7653 hqRecpReq->hqInfo.hqRes[3] =
7654 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
7658 {/* Primary cell indices are 0 and 1 */
7660 * M > 2 if SPS occasion is present in any of the
7661 * DL subframe in the bundle, the n1Pucch(0) is
7662 * the SPS resource and n1Pucch(1) is the resource
7663 * derived from pdcch with DAI = 1
7664 * If No SPS Occasion
7665 * Then n1Pucch(0) is from pdcch with DAI =1
7666 * and n1Pucch(1) is from pdcch with DAI = 2
7670 {/* this is not sps release pdcch */
7671 if(hqCb->spsN1PucchRes.pres == TRUE)
7673 hqRes = hqCb->spsN1PucchRes.val;
7678 {/*Dynamic scheduling or SPS Release
7679 Derive from pdcch */
7680 if(pdcch->dlDai < 3)
7681 {/* No need to calcualte from DAI > 2 */
7682 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7688 hqRecpReq->hqInfo.hqRes[elemIdx] = hqRes;
7691 {/* Pdcch with DAI = 1 and 2 needs to be used
7692 for resource calculation*/
7693 if(hqCb && hqCb->spsN1PucchRes.pres == TRUE)
7694 {/* dyn or sps occasion */
7695 /* Shift the hqRes[0] if it was filled
7696 * if there was a pdcch with DAI 1 before to this
7699 {/* SPS occasion happened in the middle
7701 /* shifting the non SPS resource to n1Pucch(1) */
7702 hqRecpReq->hqInfo.hqRes[1] = hqRecpReq->hqInfo.hqRes[0];
7705 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7708 else if(pdcch && pdcch->dlDai < 3)
7710 else if(pdcch->dlDai < 3)
7712 {/* sps rel or dyn sched */
7713 /* hqCb wil not be present for sps release pdcch */
7714 if(hqCb && (pdcch->dlDai != hqCb->ulDai))
7715 {/* there was a SPS occasion before to this */
7716 if(pdcch->dlDai == 1)
7718 hqRecpReq->hqInfo.hqRes[1] = hqRes;
7719 }/* ignore the DAI 2 in this case */
7721 {/* There was no SPS occasion before to this */
7725 {/* Added check to ignore kwork warning */
7726 hqRecpReq->hqInfo.hqRes[(pdcch->dlDai)-1] = hqRes;
7735 /** @brief This function fills the harq reception request for
7736 * TDD in case of Fomat 1B with CS
7740 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCS
7743 * -Fill Harq Reception Request for Format 1B with
7746 * @param [in] RgSchDlSf *ulSf
7747 * @param [in] RgSchCellCb *cell
7748 * @param [out]TfuUePucchRecpReq *hqRecpReq
7752 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS
7754 RgSchDlHqProcCb *hqCb,
7755 TfuUePucchRecpReq *hqRecpReq,
7763 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS(hqCb,hqRecpReq,noFdbks,dlSf,pdcch,
7764 n1PucchTkn,elemIdx,cellCb)
7765 RgSchDlHqProcCb *hqCb;
7766 TfuUePucchRecpReq *hqRecpReq;
7771 RgSchCellCb *cellCb;
7774 /* Update teh fdbk mode if something different is present
7775 * in L1 API file for F1BS *//* 1 --> F1BCS */
7776 hqRecpReq->hqInfo.hqFdbkMode = TFU_ACK_NACK_CHANNEL_SELECTION;
7780 case RG_SCH_M_VAL_1:
7783 rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1(hqCb,hqRecpReq,
7784 noFdbks,dlSf,pdcch,cellCb);
7787 case RG_SCH_M_VAL_2:
7788 case RG_SCH_M_VAL_3:
7789 case RG_SCH_M_VAL_4:
7791 /* Spatial bundling will be applied */
7792 rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234(hqCb,hqRecpReq,
7793 noFdbks,dlSf,pdcch,cellCb,elemIdx);
7803 /***********************************************************
7805 * Func : rgSCHTomUtlFillSfHqFdbkForOneUe
7807 * Desc : Fill HARQ feedback info for one UE/entry
7815 **********************************************************/
7817 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForOneUe
7819 RgSchDlHqProcCb *hqCb,
7820 TfuRecpReqInfo *recpReqInfo,
7821 RgSchCellCb *cellCb,
7829 RgrTddAckNackMode ackNackMode,
7830 RgSchUePucchRecpInfo **pucchInfoRef,
7837 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForOneUe(hqCb,recpReqInfo, cellCb, err, dlSf,
7838 noFdbks, memCp, elemIdx, nxtDlsf, rnti, ackNackMode, pucchInfoRef,
7839 pdcch, n1PucchTkn, allocRef, hqSz)
7840 RgSchDlHqProcCb *hqCb;
7841 TfuRecpReqInfo *recpReqInfo;
7842 RgSchCellCb *cellCb;
7850 RgrTddAckNackMode ackNackMode;
7851 RgSchUePucchRecpInfo **pucchInfoRef;
7858 RgSchUePucchRecpInfo *pucchInfo = *pucchInfoRef;
7861 TfuUePucchRecpReq *hqRecpReq;
7876 Bool isFirstFdbk = FALSE;
7878 if(pucchInfo == NULLP)
7880 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchInfo,
7881 sizeof(RgSchUePucchRecpInfo), memCp)) != ROK)
7883 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to "
7884 "Allocate TfuUeRecpReqInfo for cell RNTI:%d",rnti);
7885 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
7889 #ifdef TFU_ALLOC_EVENT_NO_INIT
7890 pucchInfo->hashLstEnt.hashVal = 0;
7891 pucchInfo->hashLstEnt.keyLen = 0;
7892 pucchInfo->hashLstEnt.key = 0;
7893 pucchInfo->hashLstEnt.list.prev = pucchInfo->hashLstEnt.list.next = 0;
7895 if ((ret = rgSCHUtlGetEventMem((Ptr *)&(pucchInfo->pucchRecpInfo),
7896 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp))) != ROK)
7898 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to "
7899 "Allocate TfuUeRecpReqInfo for cell RNTI:%d",rnti);
7900 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
7903 cmMemset((U8 *)pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes,0xff,sizeof(U16)*TFU_MAX_HQ_RES);
7904 #ifdef TFU_ALLOC_EVENT_NO_INIT
7905 cmMemset((U8 *)&pucchInfo->pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
7907 pucchInfo->pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
7908 pucchInfo->pucchRecpInfo->rnti = rnti;
7910 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo=TFU_PUCCH_HARQ;
7917 /* Calculation of resources same for both bundling and muxing for M = 1
7920 RgSchUeCb *ue = rgSCHDbmGetUeCb (cellCb, rnti);
7921 if((ue) && (1 == ue->numSCells))
7923 if(ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS)
7925 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
7926 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS(hqCb,hqRecpReq,
7927 noFdbks,dlSf,pdcch,elemIdx,cellCb);
7930 {/* M = 1 case . size is same as A Value*/
7931 hqRecpReq->hqInfo.hqSz = ue->f1bCsAVal;
7932 hqRecpReq->hqInfo.pucchResCnt = hqRecpReq->hqInfo.hqSz;
7935 hqRecpReq->hqInfo.hqSz = (noFdbks * 2); /* M for 2 cells */
7936 hqRecpReq->hqInfo.pucchResCnt = 4;
7938 hqRecpReq->hqInfo.a = ue->f1bCsAVal;
7939 /* handling for SPS occasions*/
7942 /* set the datPresinFirstSUbframe to TRUE if this
7943 * is for pcell txion*/
7945 RgSchTddANInfo *anInfo = NULLP;
7947 /* if this txion is on pcell
7948 * sps occaion, dyn sched or sps release pdcch
7949 * set the sched present in first
7950 * dl subframe of the bundle to TRUE. This
7951 * is required for mapping the feedbak when SPS occasion
7952 * is present in any of the DL subframe in the bundle in
7955 /* SPS will happen only on pcell */
7956 if((hqCb == NULLP) || (!RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
7959 anInfo = rgSCHUtlGetUeANFdbkInfo(ue,
7960 &recpReqInfo->timingInfo,RGSCH_PCELL_INDEX);
7962 {/* ANInfo must be there. adding block
7964 RGSCHDBGERRNEW(cellCb->instIdx,(rgSchPBuf(cellCb->instIdx),
7965 "ANInfo should not be NULL for cellId=%d \n", cellCb->cellId));
7973 {/* This needs to be revisited while
7974 adding support for PUCCH format 3 */
7975 RGSCHDBGERRNEW(cellCb->instIdx,(rgSchPBuf(cellCb->instIdx),"Invalid Pucch format configured.."));
7982 if((ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) ||
7983 ((noFdbks == 1) && (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT)))
7985 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
7987 prevHqSize = hqRecpReq->hqInfo.hqSz;
7990 /* Only one index for bundling case */
7991 hqRecpReq->M = noFdbks;
7993 TFU_HQ_RECP_REQ_NORMAL;
7994 hqRecpReq->multCnt = 1;
7995 hqRecpReq->t.nCce[0] =
8000 rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
8002 hqRecpReq->type = TFU_UCI_HARQ;
8004 #else /* TFU_UPGRADE */
8007 if ((TRUE == isFirstFdbk) && (TRUE == n1PucchTkn.pres))
8009 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)ackNackMode;
8010 hqRecpReq->hqInfo.pucchResCnt=1;
8011 hqRecpReq->hqInfo.hqRes[0] = n1PucchTkn.val;
8012 hqRecpReq->hqInfo.hqSz = hqSz;
8015 else if (FALSE == n1PucchTkn.pres)
8018 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)ackNackMode;
8020 P = rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
8021 nP = cellCb->rgSchTddNpValTbl[P];
8022 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
8023 m = dlSf->dlFdbkInfo.m;
8024 /* In case of no UE */
8025 pucchRes = (M - m - 1)* nP + (m * nPlusOne) + pdcch->nCce +
8026 cellCb->pucchCfg.n1PucchAn;
8027 /*ccpu00130164:MOD-Changed to maitain value of
8028 hqRecpReq->hqInfo.pucchResCnt=1 in case of bundling*/
8029 /*ccpu00132284 -MOD- hqRes need to be updated after pucchReCnt set to 1
8030 * and resource should be update at index-0*/
8031 hqRecpReq->hqInfo.pucchResCnt=1;
8032 hqRecpReq->hqInfo.hqRes[hqRecpReq->hqInfo.pucchResCnt-1] = pucchRes;
8034 if((ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) && (hqSz > prevHqSize))
8035 hqRecpReq->hqInfo.hqSz = hqSz;
8036 else if (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT)
8037 hqRecpReq->hqInfo.hqSz = hqSz;
8039 hqRecpReq->hqInfo.hqSz = prevHqSize;
8041 #endif /* TFU_UPGRADE */
8043 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst,
8044 &(pucchInfo->pucchRecpInfo->lnk));
8045 pucchInfo->pucchRecpInfo->lnk.node =
8046 (PTR)pucchInfo->pucchRecpInfo;
8049 else /* Multiplexing */
8052 pucchInfo->pucchRecpInfo->t.pucchRecpReq.M = noFdbks;
8054 if (n1PucchTkn.pres == TRUE)
8056 pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqType =
8057 TFU_HQ_RECP_REQ_N1PUCCH;
8058 pucchInfo->pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = n1PucchTkn.val;
8063 pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqType =
8064 TFU_HQ_RECP_REQ_NORMAL;
8065 multCnt = pucchInfo->pucchRecpInfo->t.pucchRecpReq.multCnt;
8066 pucchInfo->pucchRecpInfo->t.pucchRecpReq.t.nCce[multCnt] =
8068 pucchInfo->pucchRecpInfo->t.pucchRecpReq.m[multCnt] =
8070 pucchInfo->pucchRecpInfo->t.pucchRecpReq.p[multCnt] =
8071 rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
8073 pucchInfo->pucchRecpInfo->t.pucchRecpReq.multCnt++;
8075 #else /* TFU_UPGRADE */
8077 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
8078 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)RGR_TDD_ACKNACK_MODE_MULT;
8079 hqRecpReq->hqInfo.hqSz = noFdbks;
8081 resIdx = hqRecpReq->hqInfo.pucchResCnt;
8082 hqRecpReq->hqInfo.pucchResCnt++;
8085 if (n1PucchTkn.pres == TRUE)
8087 hqRecpReq->hqInfo.hqRes[resIdx] = n1PucchTkn.val;
8093 m = dlSf->dlFdbkInfo.m;
8095 P = rgSCHCmnGetPValFrmCCE(cellCb, nCce);
8096 nP = cellCb->rgSchTddNpValTbl[P];
8097 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
8098 hqRecpReq->hqInfo.hqRes[resIdx] = (M - m - 1)* nP +
8099 (m * nPlusOne) + pdcch->nCce +
8100 cellCb->pucchCfg.n1PucchAn;
8102 #endif /* TFU_UPGRADE */
8103 /* If all the DL subframes are scanned, then
8104 * send TFU request*/
8106 if((elemIdx != noFdbks) && alloc)
8108 cmHashListInsert(&cellCb->ueTfuPendLst, (PTR) pucchInfo,
8109 (U8 *)&rnti, (U16) sizeof(rnti));
8114 pucchInfo->pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
8115 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst,
8116 &(pucchInfo->pucchRecpInfo->lnk));
8117 pucchInfo->pucchRecpInfo->lnk.node =
8118 (PTR)pucchInfo->pucchRecpInfo;
8119 /* Delete the entry after addition to the list */
8120 cmHashListDelete(&cellCb->ueTfuPendLst, (PTR) pucchInfo);
8126 *pucchInfoRef = pucchInfo;
8132 #ifdef RG_ULSCHED_AT_CRC
8133 /** @brief This function does all the processing related to a single downlink
8138 * Function: rgSCHTomUtlProcDlSfAtCrc
8141 * - collate control data for all UEs and send to PHY
8142 * - collate data buffers for all UEs and send to PHY
8144 * @param [in] RgSchDlSf *ulSf
8145 * @param [in] RgSchCellCb *cell
8146 * @param [in] TfuCntrlReqInfo *cntrlInfo
8147 * @param [out] RgSchErrInfo *err
8151 PRIVATE S16 rgSCHTomUtlProcDlSfAtCrc
8154 CmLteTimingInfo crntUlFrm,
8156 TfuCntrlReqInfo *cntrlInfo,
8160 PRIVATE S16 rgSCHTomUtlProcDlSfAtCrc (ulSf, crntUlFrm, cell, cntrlInfo, err)
8162 CmLteTimingInfo crntUlFrm;
8164 TfuCntrlReqInfo *cntrlInfo;
8168 Inst inst = cell->instIdx;
8171 TRC2(rgSCHTomUtlProcDlSfAtCrc);
8174 cntrlInfo->numDlActvUes = 0;
8175 cmLListInit(&cntrlInfo->phichLst);
8176 cmLListInit(&cntrlInfo->dlPdcchLst);
8177 cmLListInit(&cntrlInfo->ulPdcchLst);
8178 #ifdef TFU_ALLOC_EVENT_NO_INIT
8179 cntrlInfo->dlTiming.sfn = cntrlInfo->dlTiming.subframe = 0;
8183 cntrlInfo->ulTiming = crntUlFrm;
8184 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cntrlInfo->ulTiming, TFU_ULCNTRL_DLDELTA);
8186 cntrlInfo->cellId = cell->cellId;
8187 /* Fill PHICH info */
8188 if ((ret = rgSCHTomUtlFillPhich (cell, cntrlInfo, ulSf, err)) != ROK)
8190 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send PHICH info for "
8192 RGSCH_FREE_MEM(cntrlInfo);
8197 if ((ret = rgSCHTomUtlFillUlPdcch (cell, cntrlInfo, ulSf, err)) != ROK)
8199 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send PDCCH info for "
8201 RGSCH_FREE_MEM(cntrlInfo);
8206 if(0 == cntrlInfo->ulMpdcchLst.count)
8213 if ((cntrlInfo->ulPdcchLst.count || cntrlInfo->phichLst.count) || RG_SCH_EMTC_GET_PDCCHLST_CNT(cntrlInfo))
8215 if (cntrlInfo->ulPdcchLst.count || cntrlInfo->phichLst.count)
8218 if (rgSCHUtlTfuCntrlReq(inst, cell->tfuSap->sapCfg.suId, cntrlInfo)
8221 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info for"
8227 RGSCH_FREE_MEM(cntrlInfo);
8232 #endif /* #ifdef RG_ULSCHED_AT_CRC*/
8235 /** @brief This function sends the SFN Tick to L3
8240 * Function: rgSCHTomUtlSendSfnTick
8242 * @param [in] RgSchCellCb *cell
8245 PRIVATE Void rgSCHTomUtlSendSfnTick
8250 PRIVATE Void rgSCHTomUtlSendSfnTick (cell)
8254 RgrTtiIndInfo *rgrTtiInd;
8256 TRC2(rgSCHTomUtlSendSfnTick);
8258 /* TTI to be sent to RRM only once per system frame */
8259 /* Added support for period = 0 to disable tick to RRM */
8260 if ((cell->rrmTtiIndPrd != 0) &&
8261 ((cell->crntTime.sfn % cell->rrmTtiIndPrd) == 0) &&
8262 (cell->crntTime.slot == 0))
8264 /* Allocate a TTI indication structure and send to RRM over RGR interface */
8265 if (rgSCHUtlAllocSBuf (cell->instIdx,
8266 (Data**)&rgrTtiInd, sizeof(RgrTtiIndInfo)) != ROK)
8268 RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),
8269 "Mem alloc failed for RGR TTI ind, cellId (%d))\n",
8273 rgrTtiInd->cellId = cell->cellId;
8274 //rgrTtiInd->hSfn = cell->crntTime.hSfn;
8275 rgrTtiInd->sfn = cell->crntTime.sfn;
8277 if (rgSCHUtlRgrTtiInd (cell, rgrTtiInd) != ROK)
8279 RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),
8280 "Failed to send RGR TTI ind, cellId (%d))\n",
8282 rgSCHUtlFreeSBuf(cell->instIdx, (Data**)&rgrTtiInd,
8283 sizeof(RgrTtiIndInfo));
8293 /* @brief Mark Dyn TDD CrntSfIdx.
8297 * Function: rgSCHDynTDDMrkCrntSfIdx
8298 * Purpose: update the dyn tdd sunframe index
8299 * @param[in] Inst schInst
8304 PRIVATE Void rgSCHDynTDDMrkCrntSfIdx
8309 PRIVATE Void rgSCHDynTDDMrkCrntSfIdx(schInst)
8313 RgSchDynTddCb *rgSchDynTddInfo = &(rgSchCb[schInst].rgSchDynTdd);
8315 TRC2(rgSCHDynTDDMrkCrntSfIdx)
8317 RG_SCH_DYN_TDD_MARKTYPE(rgSchDynTddInfo, rgSchDynTddInfo->crntDTddSfIdx,
8318 RG_SCH_DYNTDD_NOTDEF);
8319 rgSchDynTddInfo->crntDTddSfIdx = (rgSchDynTddInfo->crntDTddSfIdx + 1) %
8320 RG_SCH_DYNTDD_MAX_SFINFO;
8322 //printf("Initializing Index %d \n", rgSchDynTddInfo->crntDTddSfIdx);
8328 /** @brief This function fills the TTI timinig info for each cell
8332 * Function: rgSchTomFillCellTtiInfo
8334 * @param [in] TfuTtiIndInfo *ttiInd
8335 * @param [in] Inst schInst
8336 * @param [out] U8 *nCell
8337 * @param [out] RgSchCellCb *cell[]
8344 PRIVATE Void rgSchTomFillCellTtiInfo
8346 TfuTtiIndInfo *ttiInd,
8349 RgSchCellCb *cells[]
8352 PRIVATE Void rgSchTomFillCellTtiInfo (ttiInd, schInst, nCell, cells)
8353 TfuTtiIndInfo *ttiInd;
8356 RgSchCellCb *cells[];
8361 TfuTtiCellInfo *cellInfo;
8365 CmLteTimingInfo frm;
8367 TRC2 (rgSchTomFillCellTtiInfo);
8369 if (CM_LTE_MAX_CELLS < ttiInd->numCells)
8375 rgSCHDynTDDMrkCrntSfIdx(schInst);
8378 for (i = 0; i < ttiInd->numCells; i++)
8380 cellInfo = &ttiInd->cells[i];
8381 strtCellId = rgSchCb[schInst].genCfg.startCellId;
8382 Idx1 = (U8)((cellInfo->cellId - strtCellId)&(CM_LTE_MAX_CELLS-1));
8383 cell = rgSchCb[schInst].cells[Idx1];
8384 /* Validate the cell */
8387 /* Use SCH inst 0 print buff */
8388 RGSCHDBGERRNEW(schInst,(rgSchPBuf(schInst),
8389 "RgLiTfuTtiInd()No cell exists for cellId %d\n",
8393 *nCell = *nCell + 1;
8394 cells[i] = (RgSchCellCb *)cell;
8397 if(cell->schTickDelta != cellInfo->schTickDelta)
8399 printf("\nMukesh: Delta changed for cellId=%d: curr delta=%d new delta=%d\n"
8400 "dlblankSf=%d ulblankSf=%d dummyTti=%d \n",
8401 cell->cellId, cell->schTickDelta, cellInfo->schTickDelta, cellInfo->dlBlankSf,cellInfo->ulBlankSf,
8402 cellInfo->isDummyTti);
8404 RGSCH_UPDATE_DELTA(schInst, cellInfo->schTickDelta);
8405 cell->schTickDelta = cellInfo->schTickDelta;
8408 cell->stopSiSch = cellInfo->dlBlankSf;
8409 cell->stopDlSch = cellInfo->dlBlankSf;
8410 cell->stopUlSch = cellInfo->ulBlankSf;
8411 if (cellInfo->isDummyTti)
8413 cell->stopDlSch = TRUE;
8415 if((0 == (cellInfo->timingInfo.sfn % 30)) && (0 == cellInfo->timingInfo.slot))
8417 //printf("5GTF_CHECK rgSCHTOMTtiInd (%d : %d)\n", cellInfo->timingInfo.sfn, cellInfo->timingInfo.slot);
8420 RGSCHCPYTIMEINFO(cellInfo->timingInfo, cell->crntTime);
8421 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->hiDci0Time,
8422 TFU_ULCNTRL_DLDELTA);
8423 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->dlDciTime,
8424 TFU_DLCNTRL_DLDELTA);
8425 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->rcpReqTime,
8426 TFU_RECPREQ_DLDELTA);
8427 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->hqRlsTime,
8428 TFU_HQFBKIND_ULDELTA);
8429 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->dlSfRlsTime,
8432 RGSCHCPYTIMEINFO_EMTC(cellInfo->timingInfo, cell->crntTime);
8433 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->hiDci0Time,
8434 TFU_ULCNTRL_DLDELTA);
8435 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->dlDciTime,
8436 TFU_DLCNTRL_DLDELTA);
8437 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->rcpReqTime,
8438 TFU_RECPREQ_DLDELTA);
8439 RGSCHDECRFRMCRNTTIME_EMTC(cell->crntTime, cell->hqRlsTime,
8440 TFU_HQFBKIND_ULDELTA);
8441 RGSCHDECRFRMCRNTTIME_EMTC(cell->crntTime, cell->dlSfRlsTime,
8444 rgSCHCmnUpdVars(cell);
8445 cell->isDlDataAllwd = TRUE;
8446 /* Get DownLink SubFrame */
8447 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
8448 frm = cell->crntTime;
8450 RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA);
8452 RGSCH_INCR_SUB_FRAME_EMTC(frm, RG_SCH_CMN_DL_DELTA);
8454 cellSch->dl.time = frm;
8460 U8 idx = (cell->crntTime.slot + RG_SCH_CMN_DL_DELTA) %
8461 RGSCH_NUM_SUB_FRAMES_5G;
8463 cell->isDlDataAllwd = RG_SCH_CMN_CHK_DL_DATA_ALLOWED(cell, idx);
8465 /*ccpu00130639 -ADD - used in UL HARQ proc id calculation*/
8466 if((cell->crntTime.sfn == 0) && (cell->crntTime.slot == 0))
8468 /* sfn Cycle used for Tdd UL Harq Proc Determination.
8469 This sfn Cycle will have values from 0 to numUl Harq-1. */
8470 cell->tddHqSfnCycle = (cell->tddHqSfnCycle + 1 ) %
8471 (rgSchTddUlNumHarqProcTbl[cell->ulDlCfgIdx]);
8475 if(cell->emtcEnable)
8477 rgSCHUtlEmtcResPrcTti(cell);
8483 void schFillCrntTime(
8484 SlotIndInfo slotInd,
8488 for(cellCount = 0; cellCount < CM_LTE_MAX_CELLS; cellCount++)
8491 cell = rgSchCb[schInst].cells[cellCount];
8493 RGSCHCPYTIMEINFO(slotInd, cell->crntTime);
8495 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->hiDci0Time,
8496 TFU_ULCNTRL_DLDELTA);
8497 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->dlDciTime,
8498 TFU_DLCNTRL_DLDELTA);
8499 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->rcpReqTime,
8500 TFU_RECPREQ_DLDELTA);
8501 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->hqRlsTime,
8502 TFU_HQFBKIND_ULDELTA);
8503 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->dlSfRlsTime,
8506 RGSCH_INCR_SUB_FRAME(cell->crntTime, RG_SCH_CMN_DL_DELTA);
8508 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
8509 cellSch->dl.time = cell->crntTime;
8513 /** @brief This function prepares the TTI for scheduling and
8514 * invokes the Common channel scheduler. Uplink scheduler
8515 * is invoked first if UL Scheduling at CRC is not enabled
8519 * Function: rgSchTomTtiUlAndDlCmnChSch
8521 * @param [out] RgSchCellCb *cell
8527 PRIVATE Void rgSchTomTtiUlAndDlCmnChSch
8532 PRIVATE Void rgSchTomTtiUlAndDlCmnChSch (cell)
8537 TRC2(rgSchTomTtiUlAndDlCmnChSch);
8539 cell->rlsHqArr[cell->crntHqIdx].numUes = 0;
8541 cell->crntHqIdx = cell->crntHqIdx % RGSCH_NUM_SUB_FRAMES;
8543 cmPrcTmr(&cell->tqCp, cell->tq, (PFV)rgSCHTmrProcTmr);
8544 rgSCHMeasGapANRepTtiHndl (cell);
8545 /* We need to fill the PHICH for the UL Data, first we need to get the UL
8546 * SF from Scheduler, next we fill the dlSf that goes out this TTI.
8547 * This must be performed prior to any other processing of the TTI
8548 * so that we do not wrap around and generate feedback prior to
8549 * reception of UL data.
8551 #ifndef RG_ULSCHED_AT_CRC
8554 U8 idx; /* Index into Uplink Sf array */
8556 Mval = rgSchTddPhichMValTbl[cell->ulDlCfgIdx]
8557 [cell->hiDci0Time.subframe];
8561 for(idx=0; idx < Mval; idx++)
8563 rgSCHCmnRlsUlSf(cell, idx);
8569 /* DTX processing for those Harq's which did not get feedback from L1 */
8570 rgSCHDhmRlsDlsfHqProc (cell, cell->hqRlsTime);
8571 /* Re-Init the Downlink subframe */
8572 rgSCHUtlDlRlsSubFrm(cell, cell->dlSfRlsTime);
8573 /* Added handling to retransmit
8574 * release PDCCH in case of DTX
8577 /*Check for DRX every TTI*/
8578 rgSCHDrxTtiInd(cell);
8580 /* For TDD, UL scheduling should happen after DL scheduling */
8582 #ifndef RG_ULSCHED_AT_CRC
8583 /* Perform UL scheduling */
8584 rgSCHCmnUlSch(cell);
8587 /* Perform DL scheduling for Common channels */
8588 rgSCHCmnDlCommonChSch(cell);
8593 /** @brief This function invokes the Non critical procedures like measurements,
8594 * and RGR configurations.
8598 * Function: rgSchTomTtiMiscFunctions
8600 * @param [in] RgSchCellCb *cell
8606 PRIVATE Void rgSchTomTtiMiscFunctions
8611 PRIVATE Void rgSchTomTtiMiscFunctions (cell)
8615 U8 suId = cell->tfuSap->sapCfg.suId;
8617 TRC2(rgSchTomTtiMiscFunctions);
8619 /* Invoke RAM Tti Handler */
8620 rgSCHRamTtiHndlr(cell);
8622 /* Handle RGR configurations */
8623 rgSCHGomTtiHndlr(cell, suId);
8625 if((RGM_PRB_REPORT_START == cell->prbUsage.prbRprtEnabld)
8626 && (!(cell->prbUsage.rprtPeriod) || ((glblTtiCnt % cell->prbUsage.rprtPeriod) == 0)))
8628 rgSCHUtlUpdAvgPrbUsage(cell);
8630 rgSCHL2Meas(cell,FALSE);
8633 /* LTE_ADV_FLAG_REMOVED_START */
8634 /* Report ABS Load information to application periodically */
8635 if((RGR_ENABLE == cell->lteAdvCb.absCfg.status) &&
8636 (cell->lteAdvCb.absCfg.absLoadPeriodicity))
8638 RgrLoadInfIndInfo *rgrLoadInf;
8641 cell->lteAdvCb.absLoadTtiCnt++;
8642 if(cell->lteAdvCb.absLoadTtiCnt >= cell->lteAdvCb.absCfg.absLoadPeriodicity)
8645 if(rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&rgrLoadInf,
8646 sizeof(RgrLoadInfIndInfo)) != ROK)
8648 RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),"Could not "
8649 "allocate memory for sending LoadInfo\n"));
8652 cell->lteAdvCb.absLoadTtiCnt = 0;
8653 rgrLoadInf->cellId = cell->cellId;
8654 rgrLoadInf->bw = cell->bwCfg.dlTotalBw;
8655 rgrLoadInf->type = RGR_ABS;
8656 for(idx= 0; idx<RGR_ABS_PATTERN_LEN; idx++)
8658 rgrLoadInf->u.absLoadInfo[idx] = cell->lteAdvCb.absLoadInfo[idx];
8659 cell->lteAdvCb.absLoadInfo[idx] = 0;
8661 rgSCHUtlRgrLoadInfInd(cell, rgrLoadInf);
8666 if(cell->isDlDataAllwd)
8668 /* Calling function to update CFI parameters*/
8669 rgSchCmnUpdCfiDb(cell, RG_SCH_CMN_DL_DELTA);
8673 /* Incrementing the ttiCnt in case of UL subframe */
8674 if(!cell->dynCfiCb.switchOvrInProgress)
8676 cell->dynCfiCb.ttiCnt++;
8680 rgSchCmnUpdCfiDb(cell, RG_SCH_CMN_DL_DELTA);
8683 /* LTE_ADV_FLAG_REMOVED_END */
8688 /** @brief This function invokes the Downlink scheduler
8692 * Function: rgSchTomTtiDlSch
8694 * @param [in] RgSchCellCb *cell
8700 PRIVATE Void rgSchTomTtiDlSch
8705 PRIVATE Void rgSchTomTtiDlSch (cell)
8709 TRC2(rgSchTomTtiDlSch);
8711 if (cell->isDlDataAllwd && (cell->stopDlSch == FALSE))
8713 rgSCHCmnDlSch(cell);
8719 /** @brief This function invokes Consolidates the allocations
8720 * send the Subframe allocation info to MAC
8724 * Function: rgSchTomTtiCnsldtSfAlloc
8726 * @param [in] RgSchCellCb *cell
8732 PRIVATE Void rgSchTomTtiCnsldtSfAlloc
8737 PRIVATE Void rgSchTomTtiCnsldtSfAlloc (cell)
8742 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
8744 dlSf = rgSCHUtlSubFrmGet(cell, cellSch->dl.time);
8746 TRC2(rgSchTomTtiCnsldtSfAlloc);
8748 /* Prepare Subframe allocation info and send to MAC */
8749 rgSCHCmnCnsldtSfAlloc(cell);
8751 /* Call ACK NACK module to add to dlsf Queue */
8752 rgSCHAckNakRepAddToQ(cell, dlSf);
8754 rgSCHTomUtlProcTA(cell);
8759 /** @brief This function prepares the DL and UL Config requests
8764 * Function: rgSchTomTtiL1DlAndUlCfg
8766 * @param [in] RgSchCellCb *cell
8772 PRIVATE Void rgSchTomTtiL1DlAndUlCfg
8775 RgTfuCntrlReqInfo *cntrlInfo
8778 PRIVATE Void rgSchTomTtiL1DlAndUlCfg (cell, cntrlInfo)
8780 RgTfuCntrlReqInfo *cntrlInfo;
8783 RgSchDlSf *dlSf = rgSCHUtlSubFrmGet (cell, cell->dlDciTime);
8784 RgSchDlSf *ulSf = rgSCHUtlSubFrmGet (cell, cell->hiDci0Time);
8787 TRC2(rgSchTomTtiL1DlAndUlCfg);
8789 rgSCHTomUtlProcDlSf (dlSf, ulSf, cell, cntrlInfo, &err);
8790 /* Mark this frame as sent */
8791 dlSf->txDone = TRUE;
8793 rgBwAlloInfo[dlSf->sfNum] += dlSf->bwAssigned;
8794 rgBwAlcnt[dlSf->sfNum] ++;
8798 rgSCHTomUtlProcTddUlSf(cell);
8800 rgSCHTomUtlProcUlSf (cell, &err);
8806 /** @brief This function prepares does the Downlink subframe re-init and
8807 * Harq DTX processing
8811 * Function: rgSchTomUtlTddRlsSfAndHarq
8813 * @param [in] RgSchCellCb *cell
8819 PRIVATE Void rgSchTomUtlTddRlsSfAndHarq
8824 PRIVATE Void rgSchTomUtlTddRlsSfAndHarq (cell)
8828 TRC2(rgSchTomUtlTddRlsSfAndHarq);
8830 /* ccpu00132341-MOD- rgSchTddRlsDlSubfrmTbl is dependent on DELTA(=2).
8831 * Instead rgSchTddDlAscSetIdxKTbl can be used as the K set gives proper
8833 /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper
8834 * output if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME()
8835 * as it is serving the purpose */
8836 if(rgSchTddDlAscSetIdxKTbl[cell->ulDlCfgIdx][cell->hqRlsTime.subframe].
8839 /* ccpu00132341-MOD- Providing the UL SF timing for avoiding
8840 * calculation inside the function */
8841 rgSCHDhmTddRlsSubFrm(cell, cell->hqRlsTime);
8842 rgSCHDhmRlsDlsfHqProc(cell, cell->hqRlsTime);
8847 /** @brief This function processes the UL subframe and fills TFU reception
8852 * Function: rgSCHTomUtlProcTddUlSf
8854 * @param [in] RgSchCellCb *cell
8860 PRIVATE Void rgSCHTomUtlProcTddUlSf
8865 PRIVATE Void rgSCHTomUtlProcTddUlSf (cell)
8871 TRC2(rgSCHTomUtlProcTddUlSf);
8873 if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
8874 [cell->rcpReqTime.subframe] == RG_SCH_TDD_UL_SUBFRAME)
8876 if (rgSCHTomUtlProcUlSf (cell, &err) != ROK)
8878 /* fill in err type and call sta ind */
8879 RGSCHDBGERRNEW(cell->instIdx, (rgSchPBuf(cell->instIdx),
8880 "Unable to process Uplink subframe for cellId (%d))\n",
8884 /* TDD Fix , to allow Special SF SRS CFg */
8885 else if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
8886 [cell->rcpReqTime.subframe] == RG_SCH_TDD_SPL_SUBFRAME)
8888 if (rgSCHTomUtlPrcUlTddSpclSf(cell, &err) != ROK)
8890 /* fill in err type and call sta ind */
8891 RGSCHDBGERRNEW(cell->instIdx, (rgSchPBuf(cell->instIdx),
8892 "Unable to process Sipceial subframe for cellId (%d))\n",
8902 /**********************************************************************
8905 **********************************************************************/