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;
1797 } /* rgSCHTomUtlMoveSrsNxtOccasion */
1801 * @brief Handler for processing RAW CQI indication recieved from
1806 * Function: rgSCHTomRawCqiInd
1808 * Handler for processing RAW CQI indication recieved from PHY
1811 * Invoked by: RgLiTfuRawCqiInd
1815 * - Invoke scheduler to indicate Raw CQI rgSCHUtlRawCqiInd
1817 * @param[in] TfuRawCqiIndInfo *rawCqiInd
1823 PUBLIC S16 rgSCHTomRawCqiInd
1826 TfuRawCqiIndInfo *rawCqiInd
1829 PUBLIC S16 rgSCHTomRawCqiInd(cell, rawCqiInd)
1831 TfuRawCqiIndInfo *rawCqiInd;
1836 TfuRawCqiRpt* rawCqiInfo;
1840 RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1841 RgSchCellCb *iterCellP;
1852 TRC2(rgSCHTomRawCqiInd);
1854 if(cell->cellId != rawCqiInd->cellId)
1856 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
1857 ":%d", rawCqiInd->cellId);
1862 node = rawCqiInd->rawCqiRpt.first;
1863 for (;node; node=node->next)
1865 rawCqiInfo = (TfuRawCqiRpt *)node->node;
1866 ue = rgSCHDbmGetUeCb (cell, rawCqiInfo->crnti);
1867 raCb = rgSCHDbmGetRaCb (cell, rawCqiInfo->crnti);
1871 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"CRNTI:%d Unable to get the UECB",
1878 if (rawCqiInfo->numBits >= 5)
1879 printf("cellId [%d] crnti [%d] numBits [%d] uciPayload [0x%08x] sfn/sf [%d:%d]\n",
1880 cell->cellId, rawCqiInfo->crnti, rawCqiInfo->numBits, rawCqiInfo->uciPayload,
1881 rawCqiInd->timingInfo.sfn, rawCqiInd->timingInfo.slot);
1883 if (rawCqiInfo->numBits == 1)
1885 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1886 U8 fdbk = TFU_HQFDB_NACK;
1887 /* Process HARQ FdbkInd */
1888 hqAck = (rawCqiInfo->uciPayload >> 31) & 0x1;
1891 fdbk = TFU_HQFDB_ACK;
1892 hqInfo.isAck[0] = fdbk;
1894 if (ue != NULLP && raCb == NULLP)
1896 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, rawCqiInd->timingInfo, fdbk, &err)) != ROK)
1898 err.errType = RGSCHERR_TOM_HARQACKIND;
1899 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
1900 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1901 err.errType, err.errCause);
1905 else if (ue == NULLP && raCb != NULLP)
1907 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1908 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1910 err.errType = RGSCHERR_TOM_HARQACKIND;
1911 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1912 " feedback processing failed errType(%d) errCause(%d)",
1913 err.errType, err.errCause);
1918 else if (ue != NULLP && raCb != NULLP)
1920 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1921 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1923 err.errType = RGSCHERR_TOM_HARQACKIND;
1924 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1925 " feedback processing failed errType(%d) errCause(%d).",
1926 err.errType, err.errCause);
1932 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
1933 "UE CB or RA CB ", rawCqiInfo->crnti);
1934 err.errType = RGSCHERR_TOM_HARQACKIND;
1938 printf("rawCqiInfo->numBits [%d] uciPayload [0x%08x] sfn/sf [%d:%d]\n", rawCqiInfo->numBits,
1939 rawCqiInfo->uciPayload, rawCqiInd->timingInfo.sfn, rawCqiInd->timingInfo.slot);
1942 else if (rawCqiInfo->numBits == 5)
1944 /* Process CQI-RI Ind*/
1945 ri = (rawCqiInfo->uciPayload >> 27) & 0x1;
1946 cqi = (rawCqiInfo->uciPayload >> 28) & 0xF;
1950 printf("\n UE[%d] CQI[%d] Invalid\n", ue->ueId, cqi);
1953 ue->ue5gtfCb.mcs = rgSch5gtfCqi2Mcs[cqi - 1];
1954 ue->ue5gtfCb.rank = ri + 1;
1956 if (rawCqiInfo->numBits > 1)
1958 ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
1959 ueDl->mimoInfo.cwInfo[0].cqi = cqi;
1960 ueDl->cqiFlag = TRUE;
1961 rgSCHCmnDlSetUeAllocLmtLa(cell, ue);
1962 // rgSCHCheckAndSetTxScheme(cell, ue);
1967 printf("UE[%d] CQI[%d] MCS[%d] RI[%d]\n", ue->ueId, cqi, ue->ue5gtfCb.mcs, ri);
1970 else if (rawCqiInfo->numBits == 6)
1972 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1973 TfuHqFdbk fdbk = TFU_HQFDB_NACK;
1974 /* Process both HARQ and CQI-RI Ind*/
1975 ri = (rawCqiInfo->uciPayload >> 26) & 0x1;
1976 cqi = (rawCqiInfo->uciPayload >> 27) & 0xF;
1977 hqAck = (rawCqiInfo->uciPayload >> 31) & 0x1;
1980 printf("UE[%d] CQI[%d] Invalid\n", ue->ueId, cqi);
1983 ue->ue5gtfCb.mcs = rgSch5gtfCqi2Mcs[cqi - 1];
1984 ue->ue5gtfCb.rank = ri + 1;
1986 if (rawCqiInfo->numBits > 1)
1988 ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
1989 ueDl->mimoInfo.cwInfo[0].cqi = cqi;
1990 ueDl->cqiFlag = TRUE;
1991 rgSCHCmnDlSetUeAllocLmtLa(cell, ue);
1992 // rgSCHCheckAndSetTxScheme(cell, ue);
1997 fdbk = TFU_HQFDB_ACK;
1998 hqInfo.isAck[0] = fdbk;
2000 if (ue != NULLP && raCb == NULLP)
2002 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, rawCqiInd->timingInfo, fdbk, &err)) != ROK)
2004 err.errType = RGSCHERR_TOM_HARQACKIND;
2005 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
2006 "HARQ feedback processing failed errType(%d)errCause(%d)n",
2007 err.errType, err.errCause);
2011 else if (ue == NULLP && raCb != NULLP)
2013 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
2014 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
2016 err.errType = RGSCHERR_TOM_HARQACKIND;
2017 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
2018 " feedback processing failed errType(%d) errCause(%d)",
2019 err.errType, err.errCause);
2024 else if (ue != NULLP && raCb != NULLP)
2026 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
2027 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
2029 err.errType = RGSCHERR_TOM_HARQACKIND;
2030 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
2031 " feedback processing failed errType(%d) errCause(%d).",
2032 err.errType, err.errCause);
2038 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
2039 "UE CB or RA CB ", rawCqiInfo->crnti);
2040 err.errType = RGSCHERR_TOM_HARQACKIND;
2045 printf("\nUE[%u] CQI[%u] MCS[%u] RI[%u] HQ[%u]\n", ue->ueId, cqi, ue->ue5gtfCb.mcs, ri, hqAck);
2050 if ((rgSCHDhmRlsDlsfHqProc (cell, rawCqiInd->timingInfo)) != ROK)
2052 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink "
2053 "subframe for cellId (%d) ", cell->cellId);
2054 err.errType = RGSCHERR_TOM_HARQACKIND;
2057 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
2059 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
2061 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
2063 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
2064 if(rlsHqBufs->numUes)
2066 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
2067 RgSchMacRlsHq (&pst, rlsHqBufs);
2069 rlsHqBufs->numUes = 0;
2073 } /* rgSCHTomRawCqiInd */
2076 * @brief Handler for processing SRS indication recieved from
2081 * Function: rgSCHTomSrsInd
2083 * Handler for SRS indication recieved from PHY
2086 * Invoked by: RgLiTfuSrsInd
2090 * - Invoke scheduler to indicate UL SRS rgSCHUtlSrsInd
2092 * @param[in] TfuSrsIndInfo *srsInd
2098 PUBLIC S16 rgSCHTomSrsInd
2101 TfuSrsIndInfo *srsInd
2104 PUBLIC S16 rgSCHTomSrsInd(cell, srsInd)
2106 TfuSrsIndInfo *srsInd;
2113 TRC2(rgSCHTomSrsInd);
2115 if(cell->cellId != srsInd->cellId)
2117 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
2118 ":%d", srsInd->cellId);
2122 node = srsInd->srsRpt.first;
2123 for (;node; node=node->next)
2125 srsInfo = (TfuSrsRpt *)node->node;
2126 ue = rgSCHDbmGetUeCb (cell, srsInfo->ueId);
2129 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
2130 "UE CB", srsInfo->ueId);
2133 rgSCHUtlSrsInd(cell, ue, srsInfo, srsInd->timingInfo);
2134 rgSCHUtlHdlUlTransInd(cell, ue, srsInd->timingInfo);
2137 } /* rgSCHTomSrsInd */
2141 * Fun: rgSCHTomUtlGenIndices
2143 * Desc: This function reconstructs the Subband Indices for
2144 * of M selected Subbands conveyed by the UE for APeriodic Modes
2145 * 2-0 and 2-2. It decodes the Label which uniquely encodes M out
2153 * File: rg_sch_utl.c
2158 PRIVATE S16 rgSCHTomUtlGenIndices
2164 TfuSubbandInfo* sbInfo
2167 PRIVATE S16 rgSCHTomUtlGenIndices(label, posM, valN, valK, sbInfo)
2172 TfuSubbandInfo* sbInfo;
2175 U8 idx, kval, xval, xmin;
2178 for(kval=0; kval<posM;kval++)
2181 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe, (posM-kval-1));
2182 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe[posM-kval-1], (valN-xval-1));
2183 binCoe = rgSCHTomBinCoe[posM-kval-1][valN-xval-1];
2187 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe[posM-kval-1], (valN-xval-1));
2188 binCoe = rgSCHTomBinCoe[posM-kval-1][valN-xval-1];
2191 sbInfo[kval].numRb = valK;
2192 sbInfo[kval].rbStart = idx*valK;
2194 label = label-binCoe;
2197 } /* end of rgSCHTomUtlGenIndices*/
2201 * @brief Handler for processing decode failure indication recieved from
2206 * Function: rgSCHTomCrcInd
2208 * Handler for processing decode failure indication recieved from
2209 * PHY for a set of UEs.
2211 * Invoked by: RgLiTfuCrcInd of rg_sch.x
2214 * - Validate the information received and retrieve cell and ue.
2215 * - Process Decode failure Indication: Call rgSCHUhmProcHqFailure().
2217 * @param[in] TfuCrcIndInfo *crcInd
2223 PUBLIC S16 rgSCHTomCrcInd
2226 TfuCrcIndInfo *crcInd
2229 PUBLIC S16 rgSCHTomCrcInd(cell, crcInd)
2231 TfuCrcIndInfo *crcInd;
2234 RgSchUeCb *ue = NULLP;
2235 RgSchRaCb *raCb = NULLP;
2237 TfuCrcInfo *crcInfo;
2238 #ifdef RG_ULSCHED_AT_CRC
2241 CmLteTimingInfo crntHiDci0Frm;
2242 //RgSchCmnUlCell *cellUl;
2243 Inst inst = cell->instIdx;
2244 TfuCntrlReqInfo *cntrlInfo;
2252 RgSchUlHqProcCb *hqProc;
2256 RgSchUlHqProcCb *ulHqProc;
2259 TRC2(rgSCHTomCrcInd);
2261 if(cell->cellId != crcInd->cellId)
2263 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
2264 ":%d", crcInd->cellId);
2267 #ifdef RG_ULSCHED_AT_CRC
2270 static CmLteTimingInfo lastCrc = {2000,0};
2271 CmLteTimingInfo crntCrc = cell->crntTime;
2272 if (RGSCH_TIMEINFO_SAME(lastCrc, crntCrc))
2274 /*Removed the WA to drop 2nd CRC*/
2275 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"Recieved CRC "
2276 "twice per TTI @(%u,%u)", cell->crntTime.sfn,
2277 cell->crntTime.slot);
2283 node = crcInd->crcLst.first;
2284 for (;node; node=node->next)
2286 crcInfo = (TfuCrcInfo*)node->node;
2287 ue = rgSCHDbmGetUeCb (cell, crcInfo->rnti);
2291 /* Fetch from SPS List */
2292 ue = rgSCHDbmGetSpsUeCb(cell, crcInfo->rnti);
2296 raCb = rgSCHDbmGetRaCb (cell, crcInfo->rnti);
2303 /* Added Ul TB count for Uplink data scheduled*/
2307 ulHqProc = &(raCb->msg3HqProc);
2308 if(ulHqProc->remTx == (cell->rachCfg.maxMsg3Tx -1))
2310 cell->dlUlTbCnt.tbTransUlTotalCnt++;
2315 rgSCHUtlUlHqProcForUe(cell, crcInd->timingInfo, ue, &ulHqProc);
2316 if(ulHqProc->remTx == ((RgUeUlHqCb*)ulHqProc->hqEnt)->maxHqRetx)
2318 cell->dlUlTbCnt.tbTransUlTotalCnt++;
2323 if (crcInfo->isFailure == FALSE)
2327 rgSCHRamMsg3DatInd(raCb);
2329 /*ccpu00128820 - MOD - Msg3 alloc double delete issue*/
2330 hqProc = &(raCb->msg3HqProc);
2331 RGSCH_UPD_PHICH(cell->ulDlCfgIdx, crcInd->timingInfo.slot,
2339 gUlCrcPassCounter++;
2344 RGSCHCPYTIMEINFO(crcInd->timingInfo, ue->datIndTime);
2345 #ifndef MAC_SCH_STATS
2346 rgSCHUhmProcDatInd(cell, ue, crcInd->timingInfo);
2349 /** Stats update over here
2352 RgSchCmnUe *cmnUe = RG_SCH_CMN_GET_UE(ue,cell);
2354 rgSCHUhmProcDatInd(cell, ue, crcInd->timingInfo, cmnUe->ul.crntUlCqi[0]);
2356 #endif /* MAC_SCH_STATS */
2358 rgSCHUtlHdlUlTransInd(cell, ue, crcInd->timingInfo);
2360 rgSCHUtlHdlCrcInd(cell, ue, crcInd->timingInfo);
2368 /* SR_RACH_STATS : MSG3 Nack / DTX*/
2369 if (crcInfo->isDtx == TRUE)
2375 rgNumMsg3CrcFailed++;
2377 rgSCHRamMsg3FailureInd(raCb);
2379 rgSCHCmnEmtcHdlCrcFailInd(cell, raCb);
2381 /* Added Ul TB count for CRC Failure of MSG3 */
2383 ulHqProc = &(raCb->msg3HqProc);
2384 if(ulHqProc->remTx == (cell->rachCfg.maxMsg3Tx -1))
2386 cell->dlUlTbCnt.tbTransUlFaulty++;
2394 gUlCrcFailCounter++;
2399 #ifndef MAC_SCH_STATS
2400 rgSCHUhmProcHqFailure (cell, ue, crcInd->timingInfo, crcInfo->rv);
2403 RgSchCmnUe *cmnUe = RG_SCH_CMN_GET_UE(ue,cell);
2405 rgSCHUhmProcHqFailure (cell, ue, crcInd->timingInfo, crcInfo->rv, cmnUe->ul.crntUlCqi[0]);
2407 #endif /* MAC_SCH_STATS */
2408 rgSCHUtlHdlUlTransInd(cell, ue, crcInd->timingInfo);
2410 rgSCHUtlHdlCrcFailInd(cell, ue, crcInd->timingInfo);
2412 /* Added Ul TB count for CRC Failure of Uplink data */
2414 rgSCHUtlUlHqProcForUe(cell, crcInd->timingInfo, ue, &ulHqProc);
2415 if(ulHqProc->remTx == ((RgUeUlHqCb*)ulHqProc->hqEnt)->maxHqRetx)
2417 cell->dlUlTbCnt.tbTransUlFaulty++;
2424 /* ccpu00132653-ADD Added Sched_At_Crc Changes for TDD and optimized here
2425 the codebase across TDD and FDD*/
2426 #ifdef RG_ULSCHED_AT_CRC
2427 /* Changes to do uplink scheduling at CRC Indication */
2428 //cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
2429 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, crntHiDci0Frm, TFU_ULCNTRL_DLDELTA);
2432 rgSCHCmnRlsUlSf(cell,0);
2435 /* Allocating memory for CntrlReq as it required for both EMTC and
2437 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&cntrlInfo,
2438 sizeof(TfuCntrlReqInfo))) != ROK)
2440 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate TfuCntrlReqInfo "
2444 rgSCHCmnUlSch(cell);
2446 rgSCHL2Meas(cell,TRUE);
2448 /* Also, sending UL DCI and PHICH for just scheduled subframe */
2449 ulSf = rgSCHUtlSubFrmGet (cell, crntHiDci0Frm);
2451 if ((rgSCHTomUtlProcDlSfAtCrc (ulSf, crntHiDci0Frm, cell, cntrlInfo, &err)) != ROK)
2453 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomCrcInd() Unable to process"
2454 " downlink subframe for cellId %d", crcInd->cellId);
2455 err.errType = RGSCHERR_TOM_TTIIND;
2458 #endif /* RG_ULSCHED_AT_CRC */
2460 } /* rgSCHTomCrcInd */
2463 * @brief Handler for processing timing Advance indication recieved from
2468 * Function: rgSCHTomTimingAdvInd
2470 * Handler for processing timing advance indication recieved from PHY
2473 * Invoked by: RgLiTfuTimingAdvInd
2477 * - Call DHM to update value of Timing Advance rgSCHDhmUpdTa.
2479 * @param[in] TfuTimingAdvIndInfo *timingAdvInd
2485 PUBLIC S16 rgSCHTomTimingAdvInd
2488 TfuTimingAdvIndInfo *timingAdvInd
2491 PUBLIC S16 rgSCHTomTimingAdvInd(cell, timingAdvInd)
2493 TfuTimingAdvIndInfo *timingAdvInd;
2498 TfuTimingAdvInfo *timingAdvInfo;
2501 TRC2(rgSCHTomTimingAdvInd);
2503 if(cell->cellId != timingAdvInd->cellId)
2505 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
2506 "=(%d)", timingAdvInd->cellId);
2511 node = timingAdvInd->timingAdvLst.first;
2512 for (;node; node=node->next)
2514 timingAdvInfo = (TfuTimingAdvInfo *)node->node;
2515 ue = rgSCHDbmGetUeCb (cell, timingAdvInfo->rnti);
2518 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB",
2519 timingAdvInfo->rnti);
2522 rgSCHDhmUpdTa (cell, ue, timingAdvInfo->timingAdv);
2525 } /* rgSCHTomTimingAdvInd */
2528 * @brief Handler for processing TTI indication recieved from
2529 * PHY for 'n' cells.
2533 * Function: rgSCHTomTtiInd
2535 * Handler for processing slot indication recieved from MAC
2536 * for a cell. This is split into the below Steps.
2538 * 1: Complete the Uplink and Common Channel Scheduling for each Cell
2539 * 2: Complete the UE specific Scheduling for each Cell / across Cells.
2540 * 3: Consolidate the subframe allocations and send to each MAC instance
2541 * 4: Fill the Tfu structures for DL and UL Config requests
2542 * 5: Handle the RGR Config messages per Cell
2544 * @param[in] SlotIndInfo *slotInd
2545 * @param[in] Inst schInst
2549 PUBLIC Void rgSCHTomTtiInd
2551 SlotIndInfo *slotInd,
2555 PUBLIC Void rgSCHTomTtiInd(slotInd, schInst)
2556 SlotIndInfo *slotInd;
2560 RgInfSfAlloc *subfrmAlloc;
2561 RgTfuCntrlReqInfo *cntrlInfo = NULLP;
2565 RgSchCellCb *cell[CM_LTE_MAX_CELLS];
2566 RgSchCellCb *cellLst[CM_LTE_MAX_CELLS];
2568 TRC2(rgSCHTomTtiInd);
2574 //rgSchTomFillCellTtiInfo(slotInd, schInst, &nCell, &cell[0]);
2576 schFillCrntTime(*slotInd,schInst);
2577 for (i = 0; i < nCell; i++)
2579 /* Perform UL and DL Common Channel scheduling */
2580 rgSchTomTtiUlAndDlCmnChSch (cell[i]);
2583 /* Perform scheduling in Order of
2587 for (i = 0; i < nCell; i++)
2590 if (cell[i]->isDlDataAllwd && (cell[i]->stopDlSch == FALSE))
2592 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell[i]);
2593 /* Perform DL Retx scheduling */
2594 cellSch->apisDl->rgSCHDlRetxSched(cell[i], &cellSch->allocInfo);
2598 rgSchCmnPreDlSch(cell, nCell, cellLst);
2599 for (i = 0; i < nCell; i++)
2601 /* Perform DL scheduling */
2602 rgSchTomTtiDlSch (cellLst[i]);
2604 rgSchCmnPstDlSch(cell[0]);
2606 for (i = 0; i < nCell; i++)
2609 #ifndef RG_ULSCHED_AT_CRC
2610 /* Perform UL scheduling for TDD */
2611 rgSCHCmnUlSch (cell[i]);
2615 /* Init SF Alloc info per Cell */
2616 for (i = 0; i < nCell; i++)
2618 subfrmAlloc = &(cell[i]->sfAllocArr[cell[i]->crntSfIdx]);
2619 rgSCHUtlResetSfAlloc(subfrmAlloc,FALSE,TRUE);
2621 for (i = 0; i < nCell; i++)
2623 if (cell[i]->isDlDataAllwd && (cell[i]->stopSiSch == FALSE))
2625 subfrmAlloc = &(cell[i]->sfAllocArr[cell[i]->crntSfIdx]);
2627 * TFU_DLDATA_DLDELTA is used in this calculation because the subfrmAlloc
2628 * timingInfo which is being calculated here will be used by MAC
2630 RG_SCH_ADD_TO_CRNT_TIME(cell[i]->crntTime, subfrmAlloc->timingInfo,
2631 RG_DL_DELTA - TFU_DLDATA_DLDELTA);
2632 /* Consolidate the Allocations and send response to MAC instances */
2633 rgSchTomTtiCnsldtSfAlloc (cell[i]);
2637 for (i = 0; i < nCell; i++)
2639 if (cell[i]->isDlDataAllwd && (cell[i]->stopSiSch == FALSE))
2641 /* Send the consolidated Alloc Info to MAC instances */
2642 rgSCHCmnSndCnsldtInfo (cell[i]);
2646 for (i = 0; i < nCell; i++)
2648 /* Fill control data from scheduler to PHY */
2649 if ((ret = rgSCHUtlAllocEventMem((cell[i]->instIdx), (Ptr *)&cntrlInfo,
2650 sizeof(RgTfuCntrlReqInfo))) != ROK)
2652 RLOG_ARG0(L_ERROR,DBG_CELLID,cell[i]->cellId,"Unable to Allocate TfuCntrlReqInfo"
2658 /* Fill the TFU structures and send to CL */
2659 if(TRUE == cell[i]->emtcEnable)
2661 ret = rgSchEmtcTomTtiL1DlAndUlCfg (cell[i], cntrlInfo);
2665 && (NULLP != cntrlInfo))
2667 /* Fill the TFU structures and send to CL */
2668 rgSchTomTtiL1DlAndUlCfg (cell[i], cntrlInfo);
2672 rgSCHTomUtlSendSfnTick(cell[0]);
2675 for (i = 0; i < nCell; i++)
2677 /* Invoke non critical functions like measurements, etc */
2678 rgSchTomTtiMiscFunctions (cell[i]);
2683 U32 dbgUeIdChngAndDatReqInClCnt = 0;
2684 static U32 gTtiCount = 0;
2687 if(gTtiCount == 3000)
2689 #ifdef XEON_SPECIFIC_CHANGES
2690 printf("SChed:: (P/S)::(%u/%u) \n",
2691 gPrimarySchedCount,gSCellSchedCount);
2693 printf("\n HQFDBK :: %u\n",gHqFdbkCount);
2698 total = gPCellTb1AckCount + gPCellTb1NackCount + gPCellTb1DtxCount;
2699 total2 = gPCellTb2AckCount + gPCellTb2NackCount + gPCellTb2DtxCount;
2701 printf("\n PCell:: TB1:: (A/N/D)::(%u/%u/%u) TB2:: (A/N/D)::(%u/%u/%u)\n",
2702 gPCellTb1AckCount,gPCellTb1NackCount,gPCellTb1DtxCount,
2703 gPCellTb2AckCount,gPCellTb2NackCount,gPCellTb2DtxCount);
2704 if ((total != 0 ) && total2 != 0)
2706 printf("\n PCell:: TB1:: (AP/NP/DP)::(%.2f/%.2f/%.2f) TB2:: (AP/NP/DP)::(%.2f/%.2f/%.2f)\n",
2707 (float)gPCellTb1AckCount/total * 100,(float)gPCellTb1NackCount/total * 100,(float)gPCellTb1DtxCount/total * 100,
2708 (float)gPCellTb2AckCount/total2 *100 ,(float)gPCellTb2NackCount/total2 *100 ,(float)gPCellTb2DtxCount/total2 *2);
2711 total = gSCellTb1AckCount + gSCellTb1NackCount + gSCellTb1DtxCount;
2712 total2 = gSCellTb2AckCount + gSCellTb2NackCount + gSCellTb2DtxCount;
2715 printf("\n SCell:: TB1:: (A/N/D)::(%u/%u/%u) TB2:: (A/N/D)::(%u/%u/%u)\n",
2716 gSCellTb1AckCount,gSCellTb1NackCount,gSCellTb1DtxCount,
2717 gSCellTb2AckCount,gSCellTb2NackCount,gSCellTb2DtxCount);
2718 if ((total != 0 ) && total2 != 0)
2720 printf("\n SCell:: TB1:: (AP/NP/DP)::(%.2f/%.2f/%.2f) TB2:: (AP/NP/DP)::(%.2f/%.2f/%.2f)\n",
2721 (float)gSCellTb1AckCount/total * 100,(float)gSCellTb1NackCount/total * 100,(float)gSCellTb1DtxCount/total * 100,
2722 (float)gSCellTb2AckCount/total2 *100 ,(float)gSCellTb2NackCount/total2 *100 ,(float)gSCellTb2DtxCount/total2 *2);
2726 printf("\n CQI:: Recp(Pucch/Pusch):Rcvd(pcqi/rawacqireport/apcqi/AppReprt)::(%u/%u):(%u/%u/%u/%u)\n",
2727 gCqiRecpCount,gCqiRecpPuschCount,gCqiRcvdCount,gRawACqiCount,
2728 gACqiRcvdCount,gCqiReptToAppCount);
2730 printf("\n (F1BCS Count/Cqi/Ri/CqiDrop/PucchDrop/PuschCqiDrop)::(%u/%u/%u/%u/%u/%u)\n",
2731 gF1bCsCount,gCqiReqCount,gRiReqCount,gCqiDropCount,gPucchDropCount,gPuschCqiDropCount);
2733 printf("UL::(DCI0/CrcPass/CrcFail)::(%u/%u/%u)\n"
2734 "gPcellZeroBoOcc:%u\t gScellZeroBoOcc:%u dbgUeIdChngAndDatReqInClCnt: %u\n"
2735 "DelayedDatReqInMac: %u DelayedDatReqInCl : %u gIccPktRcvrMemDropCnt :%u\n",
2741 dbgUeIdChngAndDatReqInClCnt,
2742 dbgDelayedDatReqInMac,
2743 gDropDatReqCnt, gIccPktRcvrMemDropCnt);
2745 printf("SChed:: (P/S)::(%ld/%ld) \n",
2746 gPrimarySchedCount,gSCellSchedCount);
2748 printf("\n HQFDBK :: %ld\n",gHqFdbkCount);
2750 printf("\n PCell:: TB1:: (A/N/D)::(%ld/%ld/%ld) TB2:: (A/N/D)::(%ld/%ld/%ld)\n",
2751 gPCellTb1AckCount,gPCellTb1NackCount,gPCellTb1DtxCount,
2752 gPCellTb2AckCount,gPCellTb2NackCount,gPCellTb2DtxCount);
2754 printf("\n SCell:: TB1:: (A/N/D)::(%ld/%ld/%ld) TB2:: (A/N/D)::(%ld/%ld/%ld)\n",
2755 gSCellTb1AckCount,gSCellTb1NackCount,gSCellTb1DtxCount,
2756 gSCellTb2AckCount,gSCellTb2NackCount,gSCellTb2DtxCount);
2758 printf("\n CQI:: Recp(Pucch/Pusch):Rcvd(pcqi/rawacqireport/apcqi/AppReprt)::(%ld/%ld):(%ld/%ld/%ld/%ld)\n",
2759 gCqiRecpCount,gCqiRecpPuschCount,gCqiRcvdCount,gRawACqiCount,
2760 gACqiRcvdCount,gCqiReptToAppCount);
2761 printf("\n CQI:: PucchCqiSnrDropCnt/PucchCqiConfBitMaskDropCnt/PuschCqiConfMaskDropCount :: (%ld/%ld/%ld) \n",gCqiPucchLowSnrDropCount,gCqiPucchConfMaskDropCount,gCqiPuschConfMaskDropCount);
2763 printf("\n (F1BCS Count/Cqi/Ri/CqiDrop/PucchDrop/PuschCqiDrop)::(%ld/%ld/%ld/%ld/%ld/%ld)\n",
2764 gF1bCsCount,gCqiReqCount,gRiReqCount,gCqiDropCount,gPucchDropCount,gPuschCqiDropCount);
2766 printf("UL::(DCI0/CrcPass/CrcFail)::(%ld/%ld/%ld)\n"
2767 "gPcellZeroBoOcc:%ld\t gScellZeroBoOcc:%ld dbgUeIdChngAndDatReqInClCnt: %ld\n"
2768 "DelayedDatReqInMac: %ld DelayedDatReqInCl : %ld gIccPktRcvrMemDropCnt :%ld\n",
2774 dbgUeIdChngAndDatReqInClCnt,
2775 dbgDelayedDatReqInMac,
2776 gDropDatReqCnt, gIccPktRcvrMemDropCnt);
2777 //printf ("\n delayedApiCnt:%ld",delayedApiCnt);
2781 rgSCHLaaPrintStats();
2783 gCaDbgNonCaFrmt = gIccPktRcvrMemDropCnt = 0;
2795 gCqiPucchLowSnrDropCount = 0;
2796 gCqiPucchConfMaskDropCount = 0;
2797 gCqiPuschConfMaskDropCount = 0;
2798 gPuschCqiDropCount = 0;
2801 gUlCrcPassCount = 0;
2802 gUlCrcFailCount = 0;
2805 gCqiRecpPuschCount = 0;
2808 gCqiReptToAppCount = 0;
2813 gPrimarySchedCount = 0;
2814 gSCellSchedCount = 0;
2815 gSCellTb1AckCount = 0;
2816 gSCellTb2AckCount = 0;
2817 gSCellTb2AckCount = 0;
2818 gSCellTb2NackCount = 0;
2819 gPCellTb1AckCount = 0;
2820 gPCellTb1NackCount = 0;
2821 gPCellTb2AckCount = 0;
2822 gPCellTb2NackCount = 0;
2823 gSCellTb1NackCount=0;
2825 gPCellTb1DtxCount = 0;
2826 gPCellTb2DtxCount = 0;
2827 gSCellTb1DtxCount = 0;
2828 gSCellTb2DtxCount = 0;
2829 gPcellZeroBoOcc = 0;
2830 gScellZeroBoOcc = 0;
2838 } /* rgSCHTomTtiInd */
2840 /** @brief This function does the TTI processin for the uplink subframe,
2841 * already populated by the scheduler.
2845 * Function: rgSCHTomUtlProcUlSf
2848 * - Loop through the Uplink allocations present in the uplink subframe.
2849 * - For each allocation Fill a data reception request to be sent to PHY
2850 * - Also fills the harq reception requests for the expected HQ feedbacks.
2853 * @param [in] RgSchCellCb *cell
2854 * @param [out] RgSchErrInfo *err
2861 PRIVATE S16 rgSCHTomUtlProcUlSf
2867 PRIVATE S16 rgSCHTomUtlProcUlSf (cell, err)
2873 TfuRecpReqInfo *recpReqInfo;
2875 U16 validIdx = 0; /* Index computed from recreq's timing info*/
2877 Inst inst = cell->instIdx;
2879 TRC2(rgSCHTomUtlProcUlSf)
2881 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&recpReqInfo,
2882 sizeof(TfuRecpReqInfo))) != ROK)
2884 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate TfuRecpReqInfo "
2886 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
2889 recpReqInfo->cellId = cell->cellId;
2890 cmLListInit(&recpReqInfo->ueRecpReqLst);
2892 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, recpReqInfo->timingInfo,
2893 TFU_RECPREQ_DLDELTA);
2895 /* Filling data Reception requests */
2896 ret = rgSCHTomUtlFillDatRecpReq(recpReqInfo, cell,
2901 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to fill Data recption "
2902 "requests for cell");
2903 RGSCH_FREE_MEM(recpReqInfo);
2906 /* Filling HARQ Reception requests */
2907 ret = rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, validIdx,err);
2910 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to fill Harq Feedback "
2911 "reception requests for cell");
2912 RGSCH_FREE_MEM(recpReqInfo);
2915 /* sending the RecpReq to Phy */
2916 if (rgSCHUtlTfuRecpReq(inst, cell->tfuSap->sapCfg.suId, recpReqInfo) != ROK)
2918 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info for cell");
2921 } /* end of rgSCHTomUtlProcUlSf */
2925 /** @brief This function does the TTI processin for the uplink subframe,
2926 * already populated by the scheduler.
2930 * Function: rgSCHTomUtlPrcUlTddSpclSf
2933 * - Fill the SRS Info for the Special Subframe in Reception Req.
2934 * - Send the Reception Req to TFU
2937 * @param [in] RgSchCellCb *cell
2938 * @param [out] RgSchErrInfo *err
2944 PRIVATE S16 rgSCHTomUtlPrcUlTddSpclSf
2950 PRIVATE S16 rgSCHTomUtlPrcUlTddSpclSf (cell, err)
2956 TfuRecpReqInfo *recpReqInfo;
2957 U16 validIdx; /* Index computed from recreq's timing info*/
2958 Inst inst = cell->instIdx;
2960 TRC2(rgSCHTomUtlPrcUlTddSpclSf)
2962 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&recpReqInfo,
2963 sizeof(TfuRecpReqInfo))) != ROK)
2965 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to "
2966 "Allocate TfuRecpReqInfo for cell");
2967 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
2970 recpReqInfo->cellId = cell->cellId;
2971 cmLListInit(&recpReqInfo->ueRecpReqLst);
2973 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, recpReqInfo->timingInfo, TFU_RECPREQ_DLDELTA);
2975 RG_SCH_GET_IDX_PCQISRSSR(recpReqInfo->timingInfo, validIdx);
2978 if(cell->srsCfg.isSrsCfgPres &&
2979 rgSchTddCellSpSrsSubfrmTbl[cell->srsCfg.srsSubFrameCfg][recpReqInfo->timingInfo.slot])
2981 recpReqInfo->srsPres = TRUE;
2985 recpReqInfo->srsPres = FALSE;
2988 /* Filling SRS Reception requests */
2989 ret = rgSCHTomUtlFillSrsRecpReq (recpReqInfo, cell, validIdx, err);
2992 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to fill"
2993 " SRS recption requests for cell");;
2994 RGSCH_FREE_MEM(recpReqInfo);
2997 /* sending the RecpReq to Phy */
2998 if (rgSCHUtlTfuRecpReq(inst, cell->tfuSap->sapCfg.suId, recpReqInfo) != ROK)
3000 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to send "
3001 "Cntrl info for cell");
3004 } /* end of rgSCHTomUtlPrcUlTddSpclSf */
3007 /** @brief This function does all the processing related to a single downlink
3012 * Function: rgSCHTomUtlProcDlSf
3015 * - collate control data for all UEs and send to PHY
3016 * - collate data buffers for all UEs and send to PHY
3018 * @param [in] RgSchDlSf *dlSf
3019 * @param [in] RgSchDlSf *ulSf
3020 * @param [in] RgSchCellCb *cell
3021 * @param [out] RgSchErrInfo *err
3025 PRIVATE S16 rgSCHTomUtlProcDlSf
3030 RgTfuCntrlReqInfo *cntrlInfo,
3034 PRIVATE S16 rgSCHTomUtlProcDlSf (dlSf, ulSf, cell, cntrlInfo, err)
3038 RgTfuCntrlReqInfo *cntrlInfo;
3042 Inst inst = cell->instIdx;
3044 U8 sfTyp = 1; /* Dl Subframe */
3046 TRC2(rgSCHTomUtlProcDlSf);
3048 cmLListInit(&cntrlInfo->phichLst);
3049 cmLListInit(&cntrlInfo->dlPdcchLst);
3050 cmLListInit(&cntrlInfo->ulPdcchLst);
3052 #ifdef TFU_ALLOC_EVENT_NO_INIT
3053 cntrlInfo->ulTiming.sfn = cntrlInfo->ulTiming.subframe = 0;
3055 cntrlInfo->dlTiming = cell->dlDciTime;
3056 cntrlInfo->cellId = cell->cellId;
3057 cntrlInfo->ulTiming = cell->hiDci0Time;
3058 if((0 == (cntrlInfo->dlTiming.sfn % 30)) && (0 == cntrlInfo->dlTiming.slot))
3060 //printf("5GTF_CHECK rgSCHTomUtlProcDlSf Cntrl dl (%d : %d) ul (%d : %d)\n", cntrlInfo->dlTiming.sfn, cntrlInfo->dlTiming.subframe, cntrlInfo->ulTiming.sfn, cntrlInfo->ulTiming.subframe);
3062 /* Fill PCFICH info */
3063 /* Fix for DCFI FLE issue: when DL delta is 1 and UL delta is 0 and CFI
3064 *change happens in that SF then UL PDCCH allocation happens with old CFI
3065 *but CFI in control Req goes updated one since it was stored in the CELL
3067 cntrlInfo->cfi = dlSf->pdcchInfo.currCfi;
3068 #ifndef RG_ULSCHED_AT_CRC
3071 Mval = rgSchTddPhichMValTbl[cell->ulDlCfgIdx]
3072 [cell->hiDci0Time.subframe];
3073 if(dlSf->sfType == RG_SCH_SPL_SF_DATA)
3075 RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, cntrlInfo->cfi);
3080 /* Fill PHICH info */
3081 if ((ret = rgSCHTomUtlFillPhich (cell, cntrlInfo, ulSf, err)) != ROK)
3083 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PHICH info "
3084 "for cellId (%d)\n", cell->cellId));
3085 RGSCH_FREE_MEM(cntrlInfo);
3088 if ((ret = rgSCHTomUtlFillUlPdcch (cell, cntrlInfo, ulSf, err)) !=
3091 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PDCCH info "
3092 "for cellId (%d)\n", cell->cellId));
3093 RGSCH_FREE_MEM(cntrlInfo);
3098 if(0 == cntrlInfo->ulMpdcchLst.count)
3105 sfTyp = rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
3106 [cell->dlDciTime.subframe];
3108 if (sfTyp != 2) /* Uplink subframe */
3110 /* Fill PDCCH info */
3111 if ((ret = rgSCHTomUtlFillDlPdcch(cell,cntrlInfo, dlSf, err)) != ROK)
3113 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PDCCH info "
3114 "for cellId (%d)\n", cell->cellId));
3115 RGSCH_FREE_MEM(cntrlInfo);
3118 rgBwAlloInfo[dlSf->sfNum] += dlSf->bwAssigned;
3119 rgBwAlcnt[dlSf->sfNum] ++;
3122 #ifdef LTEMAC_SPS /* SPS_NEW_CHGS */
3123 cntrlInfo->isSPSOcc = dlSf->isSPSOcc;
3125 cntrlInfo->numDlActvUes += dlSf->numDlActvUes; /* 4UE_TTI_DELTA */
3126 dlSf->numDlActvUes = 0;
3128 if(0 == cntrlInfo->dlMpdcchLst.count)
3133 /* Now always sending down a cntrl req */
3134 /* sending the cntrl data to Phy */
3135 if (rgSCHUtlTfuCntrlReq(inst, cell->tfuSap->sapCfg.suId, cntrlInfo)
3138 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info "
3146 /** @brief This function handles sending of the PHICH information for the
3147 * downlink subframe to be sent in the next TTI.
3154 * - Loop through the PHICH information present in the downlink
3155 * subframe and fill the information in cntrlInfo.
3157 * @param [out] TfuCntrlReqInfo *cntrlInfo
3158 * @param [in] RgSchDlSf *dlSf
3159 * @param [out] RgSchErrInfo *err
3165 PRIVATE S16 rgSCHTomUtlFillPhich
3168 TfuCntrlReqInfo *cntrlInfo,
3173 PRIVATE S16 rgSCHTomUtlFillPhich(cell, cntrlInfo, dlSf, err)
3175 TfuCntrlReqInfo *cntrlInfo;
3183 TfuPhichInfo *harqAck;
3185 RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
3188 TRC2(rgSCHTomUtlFillPhich)
3190 /* Traversing the list of Phichs */
3191 node = dlSf->phichInfo.phichs.first;
3194 phich = (RgSchPhich*)node->node;
3195 if ((ret = rgSCHUtlGetEventMem((Ptr *)&harqAck, sizeof(TfuPhichInfo),
3196 &(cntrlInfo->memCp))) != ROK)
3198 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3201 #ifdef TFU_ALLOC_EVENT_NO_INIT
3202 harqAck->txPower = 0;
3204 /* fill in the tfu structure from the information present in the
3206 harqAck->rbStart = phich->rbStart;
3207 harqAck->nDmrs = phich->nDmrs;
3208 harqAck->isAck = phich->hqFeedBack;
3209 harqAck->isForMsg3 = phich->isForMsg3; /*SR_RACH_STATS : PHICH ACK/NACK for MSG3 */
3211 /* Changes for passing iPhich at TFU interface*/
3212 harqAck->iPhich = phich->iPhich;
3214 /* ccpu00138898 - Added Tx pwr offset for PHICH Tx*/
3216 harqAck->txPower = cellDl->phichTxPwrOffset;
3218 cmLListAdd2Tail(&cntrlInfo->phichLst, &(harqAck->lnk));
3219 harqAck->lnk.node = (PTR)harqAck;
3221 } /* end of while */
3227 /** @brief This function is a utility function to restart
3228 * deactivation timer.
3232 * Function: rgSCHTmrRestartScellDeactTmr
3235 * - Starts timer at scheduler
3237 * @param[in] RgSchCellCb *cell
3238 * @param[in] CmLteRnti rnti
3242 PRIVATE Void rgSCHTmrRestartScellDeactTmr
3248 PRIVATE Void rgSCHTmrRestartScellDeactTmr (cell, ueCb)
3254 RgSchUeCellInfo *sCellInfo = NULLP;
3258 if(RG_SCH_IS_CELL_SEC(ueCb, cell))
3260 sCellInfo = ueCb->cellInfo[(ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)])];
3262 if(sCellInfo->deactTmr.tmrEvnt != TMR_NONE)
3264 rgSCHTmrStopTmr(cell, RG_SCH_TMR_SCELL_DEACT, sCellInfo);
3266 if(PRSNT_NODEF == ueCb->sCellDeactTmrVal.pres)
3269 rgSCHTmrStartTmr(cell,sCellInfo,RG_SCH_TMR_SCELL_DEACT,
3270 ueCb->sCellDeactTmrVal.val);
3275 }/*end of rgSCHTmrRestartScellDeactTmr*/
3278 /** @brief This function will send all the PDCCH's for the given downlink
3286 * - Loop through all the scheduled HARQ processes and fill
3287 * the PDCCH information in cntrlInfo.
3289 * @param [out] TfuCntrlReqInfo *cntrlInfo
3290 * @param [in] RgSchDlSf *dlSf
3291 * @param [out] RgSchErrInfo *err
3296 EXTERN U32 numdlSpsRelSentToTf;
3298 PRIVATE S16 rgSCHTomUtlFillDlPdcch
3301 TfuCntrlReqInfo *cntrlInfo,
3306 PRIVATE S16 rgSCHTomUtlFillDlPdcch(cell,cntrlInfo, dlSf, err)
3308 TfuCntrlReqInfo *cntrlInfo;
3316 TfuPdcchInfo *tfuPdcch;
3317 U8 isDcivld = FALSE;
3320 TRC2(rgSCHTomUtlFillDlPdcch)
3322 /* Traversing the scheduled Harq processes */
3323 node = dlSf->pdcchInfo.pdcchs.first;
3326 pdcch = (RgSchPdcch*)node->node;
3327 switch(pdcch->dci.dciFormat)
3329 case TFU_DCI_FORMAT_3:
3330 isDcivld = (pdcch->dci.u.format3Info.isPucch) ? TRUE : FALSE;
3333 case TFU_DCI_FORMAT_3A:
3334 isDcivld = (pdcch->dci.u.format3AInfo.isPucch) ? TRUE : FALSE;
3347 /*ccpu00117179 - ADD - Build only non DCI format-0 messages */
3348 if((pdcch->dci.dciFormat == TFU_DCI_FORMAT_0) ||
3349 (pdcch->dci.dciFormat == TFU_DCI_FORMAT_A1) ||
3350 (pdcch->dci.dciFormat == TFU_DCI_FORMAT_A2))
3357 #ifdef RGSCH_SPS_STATS
3358 if((pdcch->dci.dciFormat == TFU_DCI_FORMAT_1A) &&
3359 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.mcs == 0x1F) &&
3360 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.type == TFU_ALLOC_TYPE_RIV) &&
3361 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.u.riv == 0xFFFFFFFF))
3363 numdlSpsRelSentToTf++;
3367 if ((ret = rgSCHUtlGetEventMem((Ptr *)&tfuPdcch, sizeof(TfuPdcchInfo),
3368 &(cntrlInfo->memCp))) != ROK)
3370 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3374 tfuPdcch->crnti = pdcch->crnti;
3375 tfuPdcch->isSpsRnti = pdcch->isSpsRnti;
3377 tfuPdcch->rnti = pdcch->rnti;
3380 rgSCHTmrRestartScellDeactTmr(cell,pdcch->ue);
3382 tfuPdcch->dciNumOfBits = pdcch->dciNumOfBits;
3384 tfuPdcch->nCce = pdcch->nCce;
3385 tfuPdcch->aggrLvl = pdcch->aggrLvl;
3386 tfuPdcch->dci = pdcch->dci;
3388 //TODO_SID: Need to check these values during INT
3389 tfuPdcch->sectorId = 0;
3390 tfuPdcch->sccIdx = 0;
3393 /* SR_RACH_STATS : Reset isTBMsg4 */
3394 pdcch->dci.u.format1aInfo.t.pdschInfo.isTBMsg4 = FALSE;
3395 /* To be enhanced later for 2.1 */
3396 cmLListAdd2Tail(&cntrlInfo->dlPdcchLst, &(tfuPdcch->lnk));
3397 tfuPdcch->lnk.node = (PTR)tfuPdcch;
3399 if((pdcch->rnti > 60) && (pdcch->rnti < 5000))
3401 #if defined (TENB_STATS) && defined (RG_5GTF)
3402 cell->tenbStats->sch.dl5gtfPdcchSend++;
3406 } /* end of while */
3408 if((numUePerTti) && (numUePerTti < RG_MAX_NUM_UE_PER_TTI ))
3410 cell->dlNumUeSchedPerTti[numUePerTti-1]++;
3412 gDlNumUePerTti[numUePerTti-1]++;
3416 } /* end of rgSCHTomUtlFillDlPdcch*/
3418 #ifdef RGSCH_SPS_STATS
3419 extern U32 rgSchSpsRelSentToTf;
3420 extern U32 rgSchSpsRelPdcchAllocd;
3422 /** @brief This function will send all the UL PDCCH's for the given
3430 * - Loop through all the scheduled HARQ processes and fill
3431 * the PDCCH information in cntrlInfo.
3433 * @param [out] TfuCntrlReqInfo *cntrlInfo
3434 * @param [in] RgSchDlSf *dlSf
3435 * @param [out] RgSchErrInfo *err
3441 PRIVATE S16 rgSCHTomUtlFillUlPdcch
3444 TfuCntrlReqInfo *cntrlInfo,
3449 PRIVATE S16 rgSCHTomUtlFillUlPdcch(cntrlInfo, dlSf, err)
3451 TfuCntrlReqInfo *cntrlInfo;
3459 TfuPdcchInfo *tfuPdcch;
3460 U8 isDcivld = FALSE;
3462 TRC2(rgSCHTomUtlFillUlPdcch)
3464 /* Traversing the scheduled Harq processes */
3465 node = dlSf->pdcchInfo.pdcchs.first;
3468 pdcch = (RgSchPdcch*)node->node;
3470 /*ccpu00116712- Function should pick only UL allocation related control
3472 switch(pdcch->dci.dciFormat)
3474 case TFU_DCI_FORMAT_A1:
3478 case TFU_DCI_FORMAT_A2:
3482 case TFU_DCI_FORMAT_3:
3483 isDcivld = (pdcch->dci.u.format3Info.isPucch) ? FALSE : TRUE;
3486 case TFU_DCI_FORMAT_3A:
3487 isDcivld = (pdcch->dci.u.format3AInfo.isPucch) ? FALSE : TRUE;
3502 /*ccpu00116712- Function should pick only UL allocation related control
3504 if ((ret = rgSCHUtlGetEventMem((Ptr *)&tfuPdcch, sizeof(TfuPdcchInfo),
3505 &(cntrlInfo->memCp))) != ROK)
3507 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3510 tfuPdcch->rnti = pdcch->rnti;
3512 rgSCHTmrRestartScellDeactTmr(cell,pdcch->ue);
3514 tfuPdcch->dciNumOfBits = pdcch->dciNumOfBits;
3516 tfuPdcch->nCce = pdcch->nCce;
3517 tfuPdcch->aggrLvl = pdcch->aggrLvl;
3518 tfuPdcch->dci = pdcch->dci;
3520 //TODO_SID: Need to check these values during INT
3521 tfuPdcch->sectorId = 0;
3522 tfuPdcch->sccIdx = 0;
3525 /* To be enhanced later for 2.1 */
3527 #if defined (TENB_STATS) && defined (RG_5GTF)
3528 cell->tenbStats->sch.ul5gtfPdcchSend++;
3530 cmLListAdd2Tail(&cntrlInfo->ulPdcchLst, &(tfuPdcch->lnk));
3531 tfuPdcch->lnk.node = (PTR)tfuPdcch;
3532 } /* end of while */
3534 #ifdef RGSCH_SPS_STATS
3535 if (rgSchSpsRelSentToTf != rgSchSpsRelPdcchAllocd)
3541 } /* end of rgSCHTomUtlFillUlPdcch*/
3543 /** @brief This function does the processing for Timing adjustment.
3550 * - Loop through the ue present ueTimeLst, decrement the remaining
3554 * @param [in] RgSchCellCb *cell
3560 PRIVATE S16 rgSCHTomUtlProcTA
3565 PRIVATE S16 rgSCHTomUtlProcTA (cell)
3572 TRC2(rgSCHTomUtlProcTA);
3574 node = cell->taUeLst.first;
3577 ue = (RgSchUeCb *)node->node;
3579 if (ue->dl.taCb.numRemSf == 0)
3581 ue->dl.taCb.state = RGSCH_TA_IDLE;
3582 /* If Outstanding Ta is present, schedule it */
3583 if(ue->dl.taCb.outStndngTa == TRUE)
3585 rgSCHUtlReTxTa(cell, ue);
3589 /* We need to reset state and also value of TA,
3590 * then we start the timer */
3591 ue->dl.taCb.ta = RGSCH_NO_TA_RQD;
3592 /* Start the timer only if TA is cfgd as FINITE value */
3593 if (ue->dl.taCb.cfgTaTmr)
3595 rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_TA, ue->dl.taCb.cfgTaTmr);
3598 /* need to delete from the link list */
3599 cmLListDelFrm(&(cell->taUeLst), &(ue->taLnk));
3600 ue->taLnk.node = NULLP;
3604 ue->dl.taCb.numRemSf--;
3606 } /* end of taUeLst */
3608 } /* end of rgSCHTomUtlProcTA */
3610 /** @brief This function handles filling of Hq reception request to
3625 PUBLIC S16 rgSCHTomUtlFillHqFdbkInfo
3627 TfuRecpReqInfo *recpReqInfo,
3630 RgSchDlHqProcCb *hqCb,
3632 TfuUeRecpReqInfo *pucchRecpInfo,
3633 RgSchDlHqProcCb *prvHqCb,
3637 PUBLIC S16 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, validIdx, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err)
3638 TfuRecpReqInfo *recpReqInfo;
3641 RgSchDlHqProcCb *hqCb;
3643 TfuUeRecpReqInfo *pucchRecpInfo;
3644 RgSchDlHqProcCb *prvHqCb;
3649 PUBLIC S16 rgSCHTomUtlFillHqFdbkInfo
3651 TfuRecpReqInfo *recpReqInfo,
3653 RgSchDlHqProcCb *hqCb,
3655 TfuUeRecpReqInfo *pucchRecpInfo,
3656 RgSchDlHqProcCb *prvHqCb,
3660 PUBLIC S16 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err)
3661 TfuRecpReqInfo *recpReqInfo;
3663 RgSchDlHqProcCb *hqCb;
3665 TfuUeRecpReqInfo *pucchRecpInfo;
3666 RgSchDlHqProcCb *prvHqCb;
3672 RgSchDlHqTbCb *tbCb;
3674 Bool isAddToLst = FALSE;
3676 for (idx = 0 ;idx < 2; idx++)
3678 if (HQ_TB_WAITING == hqCb->tbInfo[idx].state)
3680 tbCb = &hqCb->tbInfo[idx];
3682 /* FOR ACK NAK REP */
3683 if ((hqCb->hqE->ue != NULLP) &&
3684 (hqCb->hqE->ue->measGapCb.isMeasuring == TRUE))
3686 if ((tbCb->fbkRecpRepCntr) &&
3687 (--tbCb->fbkRecpRepCntr))
3689 /* Add to next subfarme */
3690 /* Add this hqCb to the next dlSf's ackNakRepQ */
3691 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
3692 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
3693 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
3694 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
3697 rgSCHTomUtlMoveNxtOccasion(cell, hqCb->hqE->ue, validIdx);
3705 /* Go to the next node */
3711 //if (hqCb != prvHqCb)
3713 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
3714 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
3717 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
3718 "TfuUeRecpReqInfo for cell");
3719 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3722 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
3723 if ((hqCb->hqE->ue != NULLP) /*&&
3724 ((tbCb->lchSchdData[0].lcId != 0) || (tbCb->taSnt ==
3728 pucchRecpInfo->rnti = hqCb->hqE->ue->ueId;
3732 if (hqCb->hqE->raCb)
3734 pucchRecpInfo->rnti = hqCb->hqE->raCb->tmpCrnti;
3740 if (!hqCb->spsN1PucchRes.pres)
3743 pucchRecpInfo->t.pucchRecpReq.hqType =
3744 TFU_HQ_RECP_REQ_NORMAL;
3745 pucchRecpInfo->t.pucchRecpReq.t.nCce =
3751 pucchRecpInfo->t.pucchRecpReq.hqType =
3752 TFU_HQ_RECP_REQ_N1PUCCH;
3753 pucchRecpInfo->t.pucchRecpReq.t.n1Pucch =
3754 hqCb->spsN1PucchRes.val;
3758 /* Handling of other types */
3759 pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
3760 #else /* TFU_UPGRADE */
3761 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
3762 if ((hqCb->tbInfo[0].state == HQ_TB_WAITING) &&
3763 (hqCb->tbInfo[1].state == HQ_TB_WAITING))
3765 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz = 2; /* MIMO */
3769 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz = 1; /* NON-MIMO */
3773 /* PucchRecpReq needs to be filled up for n1Pucch resource for SPS
3775 if (hqCb->spsN1PucchRes.pres)
3777 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
3780 #endif /* LTEMAC_SPS */
3782 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
3783 cell->pucchCfg.n1PucchAn);
3786 rgSCHEmtcFillPucchRecpInfo(cell, hqCb, &(pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0]));
3789 #endif/*TFU_UPGRADE*/
3792 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, hqCb->hqE->ue,
3793 pucchRecpInfo, validIdx,FALSE);
3796 /* Passing last parameter as FALSE in this case as it will be verified from hqCb*/
3797 isAddToLst = rgSCHEmtcAddRecpInfoToLst(hqCb,recpReqInfo, pucchRecpInfo,FALSE);
3801 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
3803 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
3806 if ((tbCb->fbkRecpRepCntr) &&
3807 (--tbCb->fbkRecpRepCntr))
3809 /* Add to next subfarme */
3810 /* Add this hqCb to the next dlSf's ackNakRepQ */
3811 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
3812 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
3813 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
3814 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
3820 }/* end of rgSCHTomUtlFillHqFdbkInfo */
3823 /** @brief This function handles filling of Hq reception request to
3828 * Function:rgSCHTomUtlFillHqFdbkFor5gtf
3832 * @param [out] TfuRecpReqInfo *recpReqInfo
3833 * @param [in] RgSchCellCb *cell
3834 * @param [in] U16 validIdx,
3835 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
3836 * @param [in] RgSchDlSf *dlSf,
3837 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
3838 * @param [out] RgSchErrInfo *err
3845 PRIVATE S16 rgSCHTomUtlFillHqFdbkFor5gtf
3847 TfuRecpReqInfo *recpReqInfo,
3850 RgSchDlHqInfo *dlSfHqInfo,
3852 TfuUeRecpReqInfo *pucchRecpInfo,
3856 PRIVATE S16 rgSCHTomUtlFillHqFdbkFor5gtf (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err)
3857 TfuRecpReqInfo *recpReqInfo;
3860 RgSchDlHqInfo *dlSfHqInfo;
3862 TfuUeRecpReqInfo *pucchRecpInfo;
3867 Inst inst = cell->instIdx;
3871 TfuUePucchRecpReq *pucchReqInfo = NULLP;
3873 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
3879 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
3880 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
3883 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate "
3884 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId));
3885 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3888 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
3889 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
3890 * instead of SPS-CRNTI */
3892 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
3894 pucchReqInfo->uciInfo = TFU_XPUCCH_UCI_INFO;
3896 /* 5gtf TODO : Hardcoded nPUCCHIdx */
3897 pucchReqInfo->uciPduInfo.pucchIndex = 0;
3899 pucchReqInfo->uciPduInfo.numBits = 1;
3901 /* 5gtf TODO : CQI Periodicity Hardcoded to (n,0)*/
3902 if (RGSCH_TIMEINFO_SAME (recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn))
3904 pucchReqInfo->uciPduInfo.numBits += 5;
3905 RG_SCH_ADD_TO_CRNT_TIME(recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn,
3906 ue->ue5gtfCb.cqiRiPer);
3909 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
3910 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
3912 }/* end of rgSCHTomUtlFillHqFdbkForFrmt1B */
3916 /** @brief This function handles filling of Hq reception request to
3921 * Function:rgSCHTomUtlFillHqFdbkForFrmt1B
3924 * Allocates the N1Pucch Resources based on teh A Value
3926 * @param [out] TfuRecpReqInfo *recpReqInfo
3927 * @param [in] RgSchCellCb *cell
3928 * @param [in] U16 validIdx,
3929 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
3930 * @param [in] RgSchDlSf *dlSf,
3931 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
3932 * @param [out] RgSchErrInfo *err
3940 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B
3942 TfuRecpReqInfo *recpReqInfo,
3945 RgSchDlHqInfo *dlSfHqInfo,
3947 TfuUeRecpReqInfo *pucchRecpInfo,
3951 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err)
3952 TfuRecpReqInfo *recpReqInfo;
3955 RgSchDlHqInfo *dlSfHqInfo;
3957 TfuUeRecpReqInfo *pucchRecpInfo;
3962 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B
3964 TfuRecpReqInfo *recpReqInfo,
3966 RgSchDlHqInfo *dlSfHqInfo,
3968 TfuUeRecpReqInfo *pucchRecpInfo,
3972 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B (recpReqInfo, cell, hqCb, dlSf, pucchRecpInfo, err)
3973 TfuRecpReqInfo *recpReqInfo;
3975 RgSchDlHqInfo *dlSfHqInfo;
3977 TfuUeRecpReqInfo *pucchRecpInfo;
3983 Inst inst = cell->instIdx;
3987 RgSchDlHqProcCb *hqCb = NULLP;
3989 TfuUePucchRecpReq *pucchReqInfo = NULLP;
3990 Bool isDatPresOnSecCell = FALSE;
3991 U8 primCellTbCount = 0;
3993 hqPNode = dlSfHqInfo->hqPLst.first;
3994 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
4000 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4001 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
4004 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate "
4005 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId));
4006 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4009 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4010 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
4011 * instead of SPS-CRNTI */
4013 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
4016 pucchReqInfo->hqType = TFU_HQ_RECP_REQ_NORMAL;
4017 /* Handling of other types */
4018 pucchReqInfo->type = TFU_UCI_HARQ;
4019 #else /* TFU_UPGRADE */
4020 pucchReqInfo->uciInfo = TFU_PUCCH_HARQ;
4021 /* Fill hqFdbkMode by using uciFrmtTyp from dlSfHqInfo */
4022 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
4023 /* Fill HqSz by using totalTbCnt based on the TM mode and
4024 * the number of serv cells configured*/
4026 pucchReqInfo->hqInfo.hqSz = ue->f1bCsAVal;
4027 pucchReqInfo->hqInfo.pucchResCnt = ue->f1bCsAVal;
4029 cmMemset((U8 *)pucchReqInfo->hqInfo.hqRes,0xff,sizeof(U16)*TFU_MAX_HQ_RES);
4031 /* Two Resources needs to be configured if the
4032 * serving cell is in mimo mode else single
4034 if ((dlSf->relPdcch != NULLP) &&
4035 (RGSCH_TIMEINFO_SAME(recpReqInfo->timingInfo, ue->relPdcchFbkTiming)))
4036 {/* Pcell is having sps rel pdcch present */
4037 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
4038 {/* prim cell is in mimo mode, use 0 and 1 */
4039 pucchReqInfo->hqInfo.hqRes[0] = (dlSf->relPdcch->nCce +
4040 cell->pucchCfg.n1PucchAn);
4041 pucchReqInfo->hqInfo.hqRes[1] = pucchReqInfo->hqInfo.hqRes[0] + 1;
4046 pucchReqInfo->hqInfo.hqRes[2] = (dlSf->relPdcch->nCce +
4047 cell->pucchCfg.n1PucchAn);
4049 /* Release the pdcch so that it will not further processed */
4050 rgSCHUtlPdcchPut(ue->cell,&dlSf->pdcchInfo, dlSf->relPdcch);
4051 dlSf->relPdcch = NULLP;/* only one UE will be scheduled for release pdcch order in one tti */
4053 #endif/*LTEMAC_SPS*/
4054 #endif/*TFU_UPGRADE*/
4057 hqCb = (RgSchDlHqProcCb *)hqPNode->node;
4058 hqPNode = hqPNode->next;
4059 /* In case of CSI + 1BCS , CSI will be
4060 * dropped if scheduling is present on
4061 * seconday cell.36.213 10.1.1
4063 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4065 isDatPresOnSecCell = TRUE;
4068 if ((hqCb->tbInfo[0].state == HQ_TB_WAITING) &&
4069 (hqCb->tbInfo[1].state == HQ_TB_WAITING))
4071 primCellTbCount = 2;
4074 primCellTbCount = 1;
4078 pucchReqInfo->t.nCce = hqCb->pdcch->nCce;
4081 switch(ue->f1bCsAVal)
4083 case RG_SCH_A_VAL_2:
4084 /* harq(0) is primary harq(1) is secondary) */
4085 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4087 pucchReqInfo->hqInfo.hqRes[1] = ue->n1PucchF1bResCb.\
4088 cw1N1Res[hqCb->tpc].n1PucchIdx;
4090 else/* primary cell */
4093 /* Need to consider only sps occasions */
4094 if (hqCb->spsN1PucchRes.pres)
4096 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
4099 #endif /* LTEMAC_SPS */
4102 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
4103 cell->pucchCfg.n1PucchAn);
4107 case RG_SCH_A_VAL_3:
4108 /* Serving cell in mimo mode should be
4109 * in 0 and 1 and the serving cell in siso
4110 * mode should be in 2 indices */
4111 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4113 U8 cellIdx = ue->cellIdToCellIdxMap[RG_SCH_CELLINDEX(hqCb->hqE->cell)];
4114 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[cellIdx]->txMode.txModeEnum) > 1)
4115 {/* Sec cell is in mimo mode, use 0 and 1 */
4116 pucchReqInfo->hqInfo.hqRes[0] =
4117 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
4119 pucchReqInfo->hqInfo.hqRes[1] =
4120 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
4123 {/* Sec cell is in siso mode, use 2 */
4124 pucchReqInfo->hqInfo.hqRes[2] =
4125 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
4129 {/* primary cell hq */
4130 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
4131 {/* prim cell is in mimo mode, use 0 and 1 */
4133 if (hqCb->spsN1PucchRes.pres)
4134 {/* SPS occasions */
4135 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
4136 pucchReqInfo->hqInfo.hqRes[1] = hqCb->spsN1PucchRes.val + 1;
4139 #endif /* LTEMAC_SPS */
4141 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
4142 cell->pucchCfg.n1PucchAn);
4143 pucchReqInfo->hqInfo.hqRes[1] = (hqCb->pdcch->nCce +
4144 cell->pucchCfg.n1PucchAn + 1);
4148 {/* prim cell is in siso mode use 2 */
4150 /* Need to consider only sps occasions */
4151 if (hqCb->spsN1PucchRes.pres)
4153 pucchReqInfo->hqInfo.hqRes[2] = hqCb->spsN1PucchRes.val;
4156 #endif /* LTEMAC_SPS */
4159 pucchReqInfo->hqInfo.hqRes[2] = (hqCb->pdcch->nCce +
4160 cell->pucchCfg.n1PucchAn);
4166 case RG_SCH_A_VAL_4:
4168 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4169 {/* 2 and 3 for sec cell */
4170 pucchReqInfo->hqInfo.hqRes[2] =
4171 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
4172 pucchReqInfo->hqInfo.hqRes[3] =
4173 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
4175 else/* primary cell */
4176 {/* 0 and 1 are for primary cell */
4178 /* Need to consider only sps occasions */
4179 if (hqCb->spsN1PucchRes.pres)
4181 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
4182 pucchReqInfo->hqInfo.hqRes[1] = hqCb->spsN1PucchRes.val + 1;
4185 #endif /* LTEMAC_SPS */
4188 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
4189 cell->pucchCfg.n1PucchAn);
4190 pucchReqInfo->hqInfo.hqRes[1] = (hqCb->pdcch->nCce +
4191 cell->pucchCfg.n1PucchAn + 1);
4198 /* TOD:: Add error print */
4202 #endif/*TFU_UPGRADE*/
4213 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, ue,
4214 pucchRecpInfo, validIdx,isDatPresOnSecCell);
4216 /* Channel selection wil not be used in case of
4217 * CQI + HARQ. if the data was present only on
4219 if((isDatPresOnSecCell == FALSE) &&
4220 (dlSfHqInfo->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS))
4221 {/* Data is present only on primary cell */
4223 switch(pucchReqInfo->uciInfo)
4225 case TFU_PUCCH_HARQ_SRS:
4226 case TFU_PUCCH_HARQ_CQI:
4227 case TFU_PUCCH_HARQ_SR_SRS:
4228 case TFU_PUCCH_HARQ_SR_CQI:
4230 dlSfHqInfo->uciFrmtTyp = RG_SCH_UCI_FORMAT1A_1B;
4231 pucchReqInfo->hqInfo.hqSz = primCellTbCount;
4232 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
4241 #endif/*TFU_UPGRADE*/
4242 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4243 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4245 }/* end of rgSCHTomUtlFillHqFdbkForFrmt1B */
4246 /** @brief This function handles filling of Hq reception request to
4251 * Function:rgSCHTomUtlFillHqFdbkForFrmt3
4254 * Allocates the N1Pucch Resources based on teh A Value
4256 * @param [out] TfuRecpReqInfo *recpReqInfo
4257 * @param [in] RgSchCellCb *cell
4258 * @param [in] U16 validIdx,
4259 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
4260 * @param [in] RgSchDlSf *dlSf,
4261 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
4262 * @param [out] RgSchErrInfo *err
4270 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3
4272 TfuRecpReqInfo *recpReqInfo,
4275 RgSchDlHqInfo *dlSfHqInfo,
4277 TfuUeRecpReqInfo *pucchRecpInfo,
4281 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3 (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err)
4282 TfuRecpReqInfo *recpReqInfo;
4285 RgSchDlHqInfo *dlSfHqInfo;
4287 TfuUeRecpReqInfo *pucchRecpInfo;
4292 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3
4294 TfuRecpReqInfo *recpReqInfo,
4296 RgSchDlHqInfo *dlSfHqInfo,
4298 TfuUeRecpReqInfo *pucchRecpInfo,
4302 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3 (recpReqInfo, cell, hqCb, dlSf, pucchRecpInfo, err)
4303 TfuRecpReqInfo *recpReqInfo;
4305 RgSchDlHqInfo *dlSfHqInfo;
4307 TfuUeRecpReqInfo *pucchRecpInfo;
4313 Inst inst = cell->instIdx;
4318 TfuUePucchRecpReq *pucchReqInfo = NULLP;
4320 //hqPNode = dlSfHqInfo->hqPLst.first;
4321 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
4327 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4328 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
4331 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate "
4332 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId));
4333 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4336 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4337 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
4338 * instead of SPS-CRNTI */
4340 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
4343 pucchReqInfo->hqType = TFU_HQ_RECP_REQ_NORMAL;
4344 /* Handling of other types */
4345 pucchReqInfo->type = TFU_UCI_HARQ;
4346 #else /* TFU_UPGRADE */
4347 pucchReqInfo->uciInfo = TFU_PUCCH_HARQ;
4348 /* Fill hqFdbkMode by using uciFrmtTyp from dlSfHqInfo */
4349 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
4350 /* Fill HqSz by using totalTbCnt based on the TM mode and
4351 * the number of serv cells configured*/
4353 pucchReqInfo->hqInfo.hqSz = ue->f1bCsAVal;
4354 pucchReqInfo->hqInfo.pucchResCnt = 1;
4356 cmMemset((U8 *)pucchReqInfo->hqInfo.hqRes,0xff,sizeof(U16)*TFU_MAX_HQ_RES);
4357 #endif/*TFU_UPGRADE*/
4358 pucchReqInfo->hqInfo.hqRes[0] = dlSfHqInfo->n3ScellPucch.n3PucchIdx;
4360 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, ue,
4361 pucchRecpInfo, validIdx,TRUE);
4362 #endif/*TFU_UPGRADE*/
4363 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4364 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4366 }/* end of rgSCHTomUtlFillHqFdbkForFrmt3 */
4370 /** @brief This function handles filling of HARQ feedback recption request to
4379 * @param [out] TfuRecpReqInfo *recpReqInfo
4380 * @param [in] RgSchCellCb *cell
4381 * @param [out] RgSchErrInfo *err
4388 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq
4390 TfuRecpReqInfo *recpReqInfo,
4396 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, validIdx, err)
4397 TfuRecpReqInfo *recpReqInfo;
4404 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq
4406 TfuRecpReqInfo *recpReqInfo,
4411 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, err)
4412 TfuRecpReqInfo *recpReqInfo;
4419 RgSchDlHqProcCb *hqCb;
4420 CmLteTimingInfo futTime;
4423 TfuUeRecpReqInfo *pucchRecpInfo = NULLP;
4425 RgSchDlHqProcCb *prvHqCb=NULLP;
4427 TRC2(rgSCHTomUtlFillHqFdbkRecpReq);
4434 /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper output
4435 * if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME() as it is
4436 * serving the purpose */
4437 RGSCHDECRFRMCRNTTIME(cell->crntTime, futTime, (RG_SCH_CMN_HARQ_INTERVAL -
4438 TFU_RECPREQ_DLDELTA));
4439 dlSf = rgSCHUtlSubFrmGet (cell, futTime);
4440 /* Get the next dlsf as well */
4441 RG_SCH_ADD_TO_CRNT_TIME(futTime, futTime, 1)
4442 nxtDlsf = rgSCHUtlSubFrmGet (cell, futTime);
4446 if (dlSf->ueLst.count != 0)
4448 node = dlSf->ueLst.first;
4451 ue = (RgSchUeCb *)(node->node);
4454 if(ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx].isPuschHarqRecpPres == TRUE)
4455 {/* This UE is already considered for PUSCH
4459 rgSCHTomUtlFillHqFdbkFor5gtf(recpReqInfo, cell, validIdx,
4460 &ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx], dlSf, pucchRecpInfo, err);
4461 } /* end of while */
4462 } /* If hq is expected */
4464 if (dlSf->msg4HqPLst.count != 0)
4467 node = dlSf->msg4HqPLst.first;
4470 hqCb = (RgSchDlHqProcCb*)(node->node);
4472 //TODO_SID: need to check validIdx
4473 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, validIdx, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err);
4475 } /* end of while */
4478 /* Check with TDD Code */
4479 /* FOR ACK NACK REP */
4481 } /* end of rgSCHTomUtlFillHqFdbkRecpReq */
4483 /** @brief This function handles filling of SR reception request to
4492 * @param [out] TfuRecpReqInfo *recpReqInfo
4493 * @param [in] RgSchCellCb *cell
4494 * @param [out] RgSchErrInfo *err
4501 PRIVATE S16 rgSCHTomUtlFillSrRecpReq
4503 TfuRecpReqInfo *recpReqInfo,
4509 PRIVATE S16 rgSCHTomUtlFillSrRecpReq (recpReqInfo, cell, validIdx, err)
4510 TfuRecpReqInfo *recpReqInfo;
4517 TfuUeRecpReqInfo *pucchRecpInfo;
4523 RgSchCmnUlUeSpsInfo *ulSpsUe = NULL;
4527 TRC2(rgSCHTomUtlFillSrRecpReq);
4531 node = cell->pCqiSrsSrLst[validIdx].srLst.first;
4534 ue = (RgSchUeCb *)(node->node);
4535 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4541 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4542 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4544 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4545 "TfuUeRecpReqInfo for cell RNTI:%d",ue->ueId);
4546 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4549 #ifdef TFU_ALLOC_EVENT_NO_INIT
4550 cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4551 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4557 /* Should we check for Rel8 and above???
4558 * Dont send SR recp req if logicalChannelSR-Mask enabled and UL SPS is
4560 ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue, cell);
4561 /* Avoiding check for ulSpsEnabled as isUlSpsActv FALSE if sps is not enabled*/
4562 if((ue->ul.ulSpsCfg.isLcSRMaskEnab) &&
4563 (ulSpsUe->isUlSpsActv))
4565 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
4570 pucchRecpInfo->rnti = ue->ueId;
4571 pucchRecpInfo->t.pucchRecpReq.srInfo.n1PucchIdx =
4572 ue->srCb.srCfg.srSetup.srResIdx;
4573 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR;
4574 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
4575 rgSCHTomUtlFillCqiSrsWithSr(cell, ue, recpReqInfo,
4576 pucchRecpInfo, validIdx);
4578 isAddToLst = rgSCHEmtcAddRecpInfoToLst(NULLP,recpReqInfo, pucchRecpInfo,ue->isEmtcUe);
4582 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4584 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4587 }/* end of rgSCHTomUtlFillSrRecpReq */
4590 /** @brief This function tells will the UE has a periodic CQI/PMI/RI
4599 * @param [in] RgSchUeCb *ue
4600 * @param [out] Bool *willueRprtCqiRi
4607 PRIVATE S16 rgSCHTomUtlWillUeRprtCqiRi
4610 Bool *willueRprtCqiRi
4613 PRIVATE S16 rgSCHTomUtlWillUeRprtCqiRi ( ue, willueRprtCqiRi)
4615 Bool *willueRprtCqiRi;
4618 TRC2(rgSCHTomUtlWillUeRprtCqiRi);
4620 /* Intialising Reporting probability as TRUE */
4621 *willueRprtCqiRi = TRUE;
4623 /* Checking the cases in which UE will not report CQIPMI/RI */
4624 if(ue->isDrxEnabled && ue->drxCb)
4627 if(ue->drxCb->cqiMask.pres && ue->drxCb->cqiMask.val == RGR_DRX_SETUP)
4628 {/*cqiMask is setup by upper layers */
4629 if((ue->drxCb->drxUlInactvMask & RG_SCH_DRX_ONDUR_BITMASK) ==
4630 RG_SCH_DRX_ONDUR_BITMASK)
4631 {/*onDuration NOT running, do not expect cqi/pmi/ri*/
4632 *willueRprtCqiRi = FALSE;
4636 #endif /*end of LTEMAC_R9*/
4637 /* ccpu00134258: Fix for CQI DRX issue*/
4638 if(ue->drxCb->onDurTmrLen > 2)
4640 if ( !RG_SCH_DRX_UL_IS_UE_ACTIVE(ue->drxCb) )
4641 {/*UE is not active, do not expect cqi/pmi/ri*/
4642 *willueRprtCqiRi = FALSE;
4645 }/*ue->isDrxEnabled*/
4647 } /*End of rgSCHTomUtlWillUeRprtCqiRi*/
4649 /** @brief This function handles filling of RI reception request to
4658 * @param [out] TfuRecpReqInfo *recpReqInfo
4659 * @param [in] RgSchCellCb *cell
4660 * @param [in] U16 validIdx
4661 * @param [out] RgSchErrInfo *err
4668 PRIVATE S16 rgSCHTomUtlFillRiRecpReq
4670 TfuRecpReqInfo *recpReqInfo,
4676 PRIVATE S16 rgSCHTomUtlFillRiRecpReq (recpReqInfo, cell, validIdx, err)
4677 TfuRecpReqInfo *recpReqInfo;
4684 TfuUeRecpReqInfo *pucchRecpInfo;
4687 Bool willUeRprtCqi; /* Flag set due to CQI Mask
4688 and UE inactive state (DRX) */
4689 RgSchUePCqiCb *riCb = NULLP;
4690 TRC2(rgSCHTomUtlFillRiRecpReq);
4692 node = cell->pCqiSrsSrLst[validIdx].riLst.first;
4695 riCb = (RgSchUePCqiCb *)(node->node);
4696 ue = riCb->servCellInfo->ue;
4697 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4699 if(riCb->riRecpPrcsd)
4701 /*ccpu00140578:: RI Proecssing is already done for this TTI
4702 * as part of PUSCH reception process or HARQ
4703 * Reception processing. Hence skipping this UE
4705 riCb->riRecpPrcsd = FALSE;
4708 if(riCb->riDist ==0)
4710 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
4711 #ifdef XEON_SPECIFIC_CHANGES
4712 if(RGSCH_TIMEINFO_SAME(cell->crntTime, ue->riRecpTime))
4718 if((TRUE == riCb->isRiIgnoByCollsn)
4719 || (willUeRprtCqi == FALSE))
4721 if(willUeRprtCqi == FALSE)
4724 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
4727 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4728 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4730 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4731 "TfuUeRecpReqInfo for cell RNTI:%d",ue->ueId);
4732 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4735 #ifdef TFU_ALLOC_EVENT_NO_INIT
4736 cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4737 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4740 pucchRecpInfo->rnti = ue->ueId;
4741 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
4742 riCb->cqiCfg.cqiSetup.cqiPResIdx;
4743 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = riCb->riNumBits;
4744 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_CQI;
4745 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
4747 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
4748 riCb->servCellInfo->sCellIdx;
4750 rgSCHTomUtlFillRiBitWidthInfo(ue);
4751 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
4752 if (ue->nPCqiCb->nCqiTrIdx == validIdx)
4754 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, ue->nPCqiCb);
4756 if((ue->srsCb.nSrsTrIdx == validIdx) && (ue->srsCb.srsDist ==0))
4758 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
4760 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4761 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4769 }/* end of rgSCHTomUtlFillRiRecpReq */
4772 /** @brief This function handles filling of 5GTF CQI-RI reception request to
4781 * @param [out] TfuRecpReqInfo *recpReqInfo
4782 * @param [in] RgSchCellCb *cell
4783 * @param [in] U16 validIdx
4784 * @param [out] RgSchErrInfo *err
4792 PRIVATE S16 rgSCHTomUtlFillCqiRiRecpReq
4794 TfuRecpReqInfo *recpReqInfo,
4800 PRIVATE S16 rgSCHTomUtlFillCqiRiRecpReq (recpReqInfo, cell, validIdx, err)
4801 TfuRecpReqInfo *recpReqInfo;
4807 TfuUeRecpReqInfo *pucchRecpInfo;
4808 RgSchUeCb *ue = NULLP;
4811 TRC2(rgSCHTomUtlFillCqiRiRecpReq);
4813 while ((ue = rgSCHDbmGetNextUeCb(cell, ue)) != NULLP)
4815 if (RGSCH_TIMEINFO_SAME (recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn))
4817 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4818 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4820 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4821 "TfuUeRecpReqInfo for cell RNTI:%d ", ue->ueId);
4822 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4825 #ifdef TFU_ALLOC_EVENT_NO_INIT
4826 cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4827 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4829 pucchRecpInfo->rnti = ue->ueId;
4830 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_XPUCCH_UCI_INFO;
4831 pucchRecpInfo->t.pucchRecpReq.uciPduInfo.pucchIndex = 0;
4832 pucchRecpInfo->t.pucchRecpReq.uciPduInfo.numBits = 5;
4834 RG_SCH_ADD_TO_CRNT_TIME(recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn,
4835 ue->ue5gtfCb.cqiRiPer);
4836 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4837 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4841 }/* end of rgSCHTomUtlFillCqiRiRecpReq */
4844 /** @brief This function handles filling of PCQI reception request to
4853 * @param [out] TfuRecpReqInfo *recpReqInfo
4854 * @param [in] RgSchCellCb *cell
4855 * @param [in] U16 validIdx
4856 * @param [out] RgSchErrInfo *err
4863 PRIVATE S16 rgSCHTomUtlFillPcqiRecpReq
4865 TfuRecpReqInfo *recpReqInfo,
4871 PRIVATE S16 rgSCHTomUtlFillPcqiRecpReq (recpReqInfo, cell, validIdx, err)
4872 TfuRecpReqInfo *recpReqInfo;
4879 TfuUeRecpReqInfo *pucchRecpInfo;
4884 Bool willUeRprtCqi; /* Flag set due to CQI Mask
4885 and UE Inactive state (DRX)*/
4887 RgSchUePCqiCb *cqiCb = NULLP;
4888 Bool isAddToLst = FALSE;
4890 TRC2(rgSCHTomUtlFillPcqiRecpReq);
4892 node = cell->pCqiSrsSrLst[validIdx].cqiLst.first;
4895 cqiCb = (RgSchUePCqiCb*)(node->node);
4896 ue = cqiCb->servCellInfo->ue;
4897 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4899 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
4901 if ((cqiCb->isCqiIgnoByCollsn == TRUE) ||
4902 (willUeRprtCqi == FALSE))
4904 if(willUeRprtCqi == FALSE)
4907 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
4911 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
4913 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
4914 cqiCb->servCellInfo->sCellIdx;
4916 cqiPmiSz = rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
4919 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to Fill CqiPmi "
4924 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4925 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4927 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4928 "TfuUeRecpReqInfo for cell RNTI:%d ", ue->ueId);
4929 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4932 #ifdef TFU_ALLOC_EVENT_NO_INIT
4933 cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4934 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4937 /*Fill PCQI params*/
4938 pucchRecpInfo->rnti = ue->ueId;
4939 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
4940 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
4941 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = cqiPmiSz;
4942 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_CQI;
4943 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
4944 if((ue->srsCb.nSrsTrIdx == validIdx) && (ue->srsCb.srsDist ==0))
4946 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
4949 isAddToLst = rgSCHEmtcAddRecpInfoToLst(NULLP,recpReqInfo, pucchRecpInfo,ue->isEmtcUe);
4953 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4955 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4958 }/* end of rgSCHTomUtlFillPcqiRecpReq */
4959 /** @brief This function handles filling of SRS reception request to
4968 * @param [out] TfuRecpReqInfo *recpReqInfo
4969 * @param [in] RgSchCellCb *cell
4970 * @param [in] U16 validIdx
4971 * @param [out] RgSchErrInfo *err
4977 PRIVATE S16 rgSCHTomUtlFillSrsRecpReq
4979 TfuRecpReqInfo *recpReqInfo,
4985 PRIVATE S16 rgSCHTomUtlFillSrsRecpReq (recpReqInfo, cell, validIdx, err)
4986 TfuRecpReqInfo *recpReqInfo;
4993 TfuUeRecpReqInfo *pucchRecpInfo;
4997 TRC2(rgSCHTomUtlFillSrsRecpReq);
4999 node = cell->pCqiSrsSrLst[validIdx].srsLst.first;
5002 ue = (RgSchUeCb *)(node->node);
5003 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
5005 if(ue->srsCb.srsRecpPrcsd)
5007 /* ccpu00140578::SRS Proecssing is already done for this TTI
5008 * as part of PUSCH or HARQ reception process and
5009 * hence skipping this UE */
5010 ue->srsCb.srsRecpPrcsd = FALSE;
5014 if(ue->srsCb.srsDist ==0)
5016 /* We need to add the recp request to be sent on the pucchANRep value. */
5017 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
5018 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
5020 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
5021 "TfuUeRecpReqInfo for RNTI:%d ",ue->ueId);
5022 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
5026 #ifdef TFU_ALLOC_EVENT_NO_INIT
5027 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
5031 pucchRecpInfo->rnti = ue->ueId;
5032 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
5033 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
5034 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
5035 ue->srsCb.srsCfg.srsSetup.fDomPosi;
5036 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
5037 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
5038 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
5039 ue->srsCb.srsCfg.srsSetup.txComb;
5040 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
5041 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
5042 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
5043 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
5045 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SRS;
5046 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
5047 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
5048 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
5052 ue->srsCb.srsDist--;
5056 }/* end of rgSCHTomUtlFillSrsRecpReq */
5059 /** @brief This function handles filling of data reception requests for
5068 * @param [out] TfuRecpReqInfo *recpReqInfo
5069 * @param [in] RgSchCellCb *cell
5070 * @param [out] RgSchErrInfo *err
5076 PRIVATE S16 rgSCHTomUtlFillDatRecpReq
5078 TfuRecpReqInfo *recpReqInfo,
5083 PRIVATE S16 rgSCHTomUtlFillDatRecpReq (recpReqInfo, cell, err)
5084 TfuRecpReqInfo *recpReqInfo;
5090 RgSchUlAlloc *alloc;
5091 TfuUeRecpReqInfo *datRecpInfo;
5093 TRC2(rgSCHTomUtlFillDatRecpReq)
5095 /* processing steps are
5096 * - Run through the UL allocations going out in this subframe.
5097 * - Run through the UL receptions expected the next subframe.
5099 alloc = rgSCHUtlFirstRcptnReq (cell);
5102 /* FOR ACK NACK REP */
5103 if (NULLP != alloc->ue)
5105 /* If measuring or ackNakRep we shall not send dat RecpReq */
5106 if ((alloc->ue->measGapCb.isMeasuring == TRUE) ||
5107 (alloc->ue->ackNakRepCb.isAckNakRep == TRUE))
5109 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
5114 if ((ret = rgSCHUtlGetEventMem((Ptr *)&datRecpInfo,
5115 sizeof(TfuUeRecpReqInfo),
5116 &(recpReqInfo->memCp))) != ROK)
5118 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
5119 "TfuUeRecpReqInfo for RNTI:%d ", alloc->ue->ueId);
5120 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
5123 if (!alloc->forMsg3)
5125 datRecpInfo->type = TFU_RECP_REQ_PUSCH;
5126 rgSCHUtlAllocRcptInfo (alloc,
5128 &datRecpInfo->t.puschRecpReq.mcs,
5129 &datRecpInfo->t.puschRecpReq.rbStart,
5130 &datRecpInfo->t.puschRecpReq.numRb,
5131 &datRecpInfo->t.puschRecpReq.rv,
5132 &datRecpInfo->t.puschRecpReq.size,
5133 &datRecpInfo->t.puschRecpReq.modType,
5134 &datRecpInfo->t.puschRecpReq.isRtx,
5135 &datRecpInfo->t.puschRecpReq.nDmrs,
5136 &datRecpInfo->t.puschRecpReq.ndi,
5137 &datRecpInfo->t.puschRecpReq.harqProcId
5142 datRecpInfo->type = TFU_RECP_REQ_MSG3;
5143 rgSCHUtlAllocRcptInfo (alloc,
5145 &datRecpInfo->t.msg3RecpReq.mcs,
5146 &datRecpInfo->t.msg3RecpReq.rbStart,
5147 &datRecpInfo->t.msg3RecpReq.numRb,
5148 /*ccpu00128993 - MOD - fix for msg3 softcombining bug*/
5149 &datRecpInfo->t.msg3RecpReq.rv,
5150 &datRecpInfo->t.msg3RecpReq.size,
5151 &datRecpInfo->t.msg3RecpReq.modType,
5152 &datRecpInfo->t.msg3RecpReq.isRtx,
5153 &datRecpInfo->t.msg3RecpReq.nDmrs,
5154 &datRecpInfo->t.msg3RecpReq.ndi,
5155 &datRecpInfo->t.msg3RecpReq.harqProcId
5159 /* Other fields of datRecpInfo shall be filled
5160 * here for new features */
5161 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(datRecpInfo->lnk));
5162 datRecpInfo->lnk.node = (PTR)datRecpInfo;
5164 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
5165 } /* end of while */
5167 } /* end of rgSCHTomUtlFillDatRecpReq */
5170 /** @brief This function handles filling of data reception requests for
5179 * @param [out] TfuRecpReqInfo *recpReqInfo
5180 * @param [in] RgSchCellCb *cell
5181 * @param [in] U16 validIdx
5182 * @param [out] RgSchErrInfo *err
5188 PRIVATE S16 rgSCHTomUtlFillDatRecpReq
5190 TfuRecpReqInfo *recpReqInfo,
5196 PRIVATE S16 rgSCHTomUtlFillDatRecpReq (recpReqInfo, cell, validIdx, err)
5197 TfuRecpReqInfo *recpReqInfo;
5203 CmLteTimingInfo dci0Time;
5206 RgSchUlAlloc *alloc;
5207 TfuUeRecpReqInfo *datRecpInfo;
5209 Bool isAperiodic = FALSE; /*Set when Aperiodic CQI is expected */
5212 TRC2(rgSCHTomUtlFillDatRecpReq);
5214 if((0 == (recpReqInfo->timingInfo.sfn % 30)) && (0 == recpReqInfo->timingInfo.slot))
5216 //printf("5GTF_CHECK rgSCHTomUtlFillDatRecpReq (%d : %d)\n", recpReqInfo->timingInfo.sfn, recpReqInfo->timingInfo.slot);
5218 /* processing steps are
5219 * - Run through the UL allocations going out in this subframe.
5220 * - Run through the UL receptions expected the next subframe.
5223 alloc = rgSCHUtlFirstRcptnReq (cell);
5226 isAperiodic = FALSE;
5227 ret = rgSCHUtlGetEventMem((Ptr *)&datRecpInfo,
5228 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
5231 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
5232 "TfuUeRecpReqInfo for RNTI:%d ", alloc->rnti);
5233 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
5236 #ifdef TFU_ALLOC_EVENT_NO_INIT
5237 datRecpInfo->t.puschRecpReq.initialNSrs.pres = FALSE;
5238 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = FALSE;
5240 datRecpInfo->type = TFU_RECP_REQ_PUSCH;
5241 /* Check if this if for MSG3 - no scope for feedback along with it. */
5242 if ((FALSE == alloc->forMsg3))
5244 /* Check if any DL HARQ processes has a feedback coming at the time of
5245 * this reception request.
5250 RGSCHDECRFRMCRNTTIME(cell->crntTime,dci0Time,(RGSCH_ULCTRL_RECP_DIST));
5252 idx = (dci0Time.sfn * RGSCH_NUM_SUB_FRAMES_5G + dci0Time.slot)%
5253 RGSCH_ULCTRL_RECP_DIST;
5255 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA;
5256 datRecpInfo->rnti = alloc->rnti;
5257 rgSCHUtlAllocRcptInfo (cell,alloc, &recpReqInfo->timingInfo,
5258 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5261 else /*Enters for Msg3 == TRUE condition*/
5263 /* ccpu00130884 - ADD - HO case when Msg3 alloc and Cqi/Ri/SRS opportunity
5264 * occur at same time */
5265 if(NULLP != alloc->ue)
5268 /* Only DATA is expected */
5269 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA;
5270 datRecpInfo->rnti = alloc->rnti;
5271 rgSCHUtlAllocRcptInfo (cell,alloc, &recpReqInfo->timingInfo,
5272 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5277 if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA &&
5278 datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_SRS &&
5279 isAperiodic == FALSE)
5281 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = TRUE;
5282 datRecpInfo->t.puschRecpReq.initialNumRbs.val = alloc->ue->initNumRbs;
5286 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = FALSE;
5289 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(datRecpInfo->lnk));
5290 datRecpInfo->lnk.node = (PTR)datRecpInfo;
5291 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
5293 } /* end of while */
5295 if(numUePerTti && (numUePerTti < RG_MAX_NUM_UE_PER_TTI))
5297 cell->ulNumUeSchedPerTti[numUePerTti-1]++;
5298 gUlNumUePerTti[numUePerTti - 1]++;
5301 } /* end of rgSCHTomUtlFillDatRecpReq */
5303 /* rg009.201. Added changes of TFU_UPGRADE */
5305 /***********************************************************
5307 * Func : rgSCHTomUtlFillRiBitWidthInfo
5310 * Desc : Fills the RI BitWidth and stores it for decoding.
5319 **********************************************************/
5321 PUBLIC S16 rgSCHTomUtlFillRiBitWidthInfo
5326 PUBLIC S16 rgSCHTomUtlFillRiBitWidthInfo(ueCb)
5330 RgSchUePCqiCb *riCb = ueCb->nPRiCb;
5331 TRC2(rgSCHTomUtlFillRiBitWidthInfo);
5333 if (ueCb->mimoInfo.txMode != RGR_UE_TM_3 &&
5334 ueCb->mimoInfo.txMode != RGR_UE_TM_4)
5339 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUCCH;
5340 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode=
5341 (TfuDlCqiPucchMode)riCb->cqiCfg.cqiSetup.prdModeEnum;
5342 switch(ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode)
5344 case TFU_PUCCH_CQI_MODE10:
5345 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info.type = TFU_RPT_RI;
5346 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info.u.ri =
5349 case TFU_PUCCH_CQI_MODE11:
5350 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info.type = TFU_RPT_RI;
5351 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info.u.ri =
5354 case TFU_PUCCH_CQI_MODE20:
5355 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info.type = TFU_RPT_RI;
5356 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info.u.ri =
5359 case TFU_PUCCH_CQI_MODE21:
5360 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info.type = TFU_RPT_RI;
5361 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info.u.ri =
5368 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5372 /***********************************************************
5374 * Func : rgSCHTomUtlFetchPcqiBitSz
5377 * Desc : Fetch the CQI/PMI bits for a UE based on the mode, periodicity.
5386 **********************************************************/
5388 PUBLIC U8 rgSCHTomUtlFetchPcqiBitSz
5395 PUBLIC U8 rgSCHTomUtlFetchPcqiBitSz(ueCb, numTxAnt, ri)
5403 TfuCqiPucchMode10 *mode10Info;
5404 TfuCqiPucchMode11 *mode11Info;
5405 TfuCqiPucchMode20 *mode20Info;
5406 TfuCqiPucchMode21 *mode21Info;
5407 RgSchUePCqiCb *cqiCb = ueCb->nPCqiCb;
5409 TRC3(rgSCHTomUtlFetchPcqiBitSz);
5411 confRepMode = cqiCb->cqiCfg.cqiSetup.prdModeEnum;
5412 if((ueCb->mimoInfo.txMode != RGR_UE_TM_3) &&
5413 (ueCb->mimoInfo.txMode != RGR_UE_TM_4))
5419 *ri = cqiCb->perRiVal;
5421 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUCCH;
5422 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode=
5423 (TfuDlCqiPucchMode)confRepMode;
5426 case RGR_PRD_CQI_MOD10:
5428 mode10Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info;
5430 mode10Info->type = TFU_RPT_CQI;
5431 mode10Info->u.cqi = 4;
5435 case RGR_PRD_CQI_MOD11:
5437 mode11Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info;
5438 mode11Info->type = TFU_RPT_CQI;
5444 mode11Info->u.cqi.cqi = 4;
5445 mode11Info->u.cqi.wideDiffCqi.pres = FALSE;
5446 mode11Info->u.cqi.pmi = 2;
5451 mode11Info->u.cqi.cqi = 4;
5452 mode11Info->u.cqi.wideDiffCqi.pres = TRUE;
5453 mode11Info->u.cqi.wideDiffCqi.val = 3;
5454 mode11Info->u.cqi.pmi = 1;
5457 else if(numTxAnt == 4)
5462 mode11Info->u.cqi.cqi = 4;
5463 mode11Info->u.cqi.wideDiffCqi.pres = FALSE;
5464 mode11Info->u.cqi.pmi = 4;
5469 mode11Info->u.cqi.cqi = 4;
5470 mode11Info->u.cqi.wideDiffCqi.pres = TRUE;
5471 mode11Info->u.cqi.wideDiffCqi.val = 3;
5472 mode11Info->u.cqi.pmi = 4;
5477 /* This is number of antenna case 1.
5478 * This is not applicable for Mode 1-1.
5479 * So setting it to invalid value */
5485 case RGR_PRD_CQI_MOD20:
5487 mode20Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info;
5488 mode20Info->type = TFU_RPT_CQI;
5492 mode20Info->u.cqi.isWideband = TRUE;
5493 mode20Info->u.cqi.u.wideCqi = 4;
5497 pcqiSz = 4 + cqiCb->label;
5498 mode20Info->u.cqi.isWideband = FALSE;
5499 mode20Info->u.cqi.u.subCqi.cqi = 4;
5500 mode20Info->u.cqi.u.subCqi.l = cqiCb->label;
5505 case RGR_PRD_CQI_MOD21:
5507 mode21Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info;
5508 mode21Info->type = TFU_RPT_CQI;
5509 //pcqiSz = rgSCHTomUtlFetchPcqiBitSzPucchMode21(ueCb,
5510 // mode21Info, numTxAnt, ri);
5518 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5523 /***********************************************************
5525 * Func : rgSCHTomUtlPcqiSbCalcBpIdx
5528 * Desc : Determines the BP index from the timing info
5537 **********************************************************/
5539 PUBLIC S16 rgSCHTomUtlPcqiSbCalcBpIdx
5541 CmLteTimingInfo crntTimInfo,
5543 RgSchUePCqiCb *cqiCb
5546 PUBLIC S16 rgSCHTomUtlPcqiSbCalcBpIdx(crntTimInfo, ueCb, cqiCb)
5547 CmLteTimingInfo crntTimInfo;
5549 RgSchUePCqiCb *cqiCb;
5552 U16 tti = (crntTimInfo.sfn * RGSCH_NUM_SUB_FRAMES_5G + crntTimInfo.slot);
5553 U16 prdNum = tti/cqiCb->cqiPeri;
5555 TRC2(rgSCHTomUtlPcqiSbCalcBpIdx);
5556 if((prdNum % cqiCb->h) == 0)
5560 cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_1;
5565 cqiCb->isWb = FALSE;
5566 cqiCb->bpIdx = ((prdNum % cqiCb->h) - 1) % cqiCb->J;
5568 cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_0;
5576 * @brief Function which moves PCQI, RI, SR and SRS to next periodicity
5577 * Occasions as that needs to be done in case of Ack/Nack repetition
5578 * reception request occasions or during Measurement Gap occasions.
5582 * Function: rgSCHTomUtlMoveNxtOccasion
5584 * Function which moves PCQI, RI, SR and SRS to next perodicity
5585 * Occasions as that needs to be done in case of Ack/Nack repetition
5586 * reception request occasions or during Measurement Gap occasions.
5588 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5591 * - Check whether the current Tx Instance matches with the rec req time
5592 * - If true, then move them to their next Tx Instance
5594 * @param[in] RgSchCellCb *cell,
5602 PUBLIC S16 rgSCHTomUtlMoveNxtOccasion
5609 PUBLIC S16 rgSCHTomUtlMoveNxtOccasion(cell, ue, validIdx)
5615 RgSchUePCqiCb *cqiCb = ue->nPCqiCb;
5616 RgSchUePCqiCb *riCb = ue->nPRiCb;
5617 TRC2(rgSCHTomUtlMoveNxtOccasion);
5619 /* ccpu00140578::Skip the UE if already RI recpetion
5620 * is processed in the same subframe */
5621 if ((riCb->nRiTrIdx == validIdx) &&
5622 (riCb->riRecpPrcsd == FALSE))
5624 if(riCb->riDist ==0)
5626 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
5632 /* ccpu00140578:: As this UE is considered for this TTI
5633 * Same UE should not get processed for RI reception
5634 * or for updating th RI distance.*/
5635 if(riCb->nRiTrIdx == validIdx)
5637 riCb->riRecpPrcsd = TRUE;
5640 if (cqiCb->nCqiTrIdx == validIdx)
5642 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
5645 /* ccpu00140578::Skip the UE if SRS recpetion
5646 * is already processed in the same subframe */
5647 if ((ue->srsCb.nSrsTrIdx == validIdx) &&
5648 (ue->srsCb.srsRecpPrcsd == FALSE))
5650 if(ue->srsCb.srsDist ==0)
5652 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
5656 ue->srsCb.srsDist--;
5658 /* ccpu00140578:: As this UE is considered for this TTI
5659 * Same UE should not get processed for SRS reception
5660 * or for updating th SRS distance.*/
5661 if(ue->srsCb.nSrsTrIdx == validIdx)
5663 ue->srsCb.srsRecpPrcsd = TRUE;
5666 if (ue->srCb.nSrTrIdx == validIdx)
5668 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
5671 } /* rgSCHTomUtlMoveNxtOccasion */
5674 /***********************************************************
5676 * Func : rgSCHTomPrepareAcqiRecp
5679 * Desc : Fetch the CQI/PMI bits for a UE based on the mode and store them
5680 * for decoding. Fill RECP request and prepare the scartchpad
5681 * to aid decoding of Aperiodic CQI.
5690 **********************************************************/
5692 PUBLIC Void rgSCHTomPrepareAcqiRecp
5696 TfuUePuschCqiRecpInfo *cqiRecpReqInfo,
5700 PUBLIC Void rgSCHTomPrepareAcqiRecp(ueCb, cell, cqiRecpReqInfo, ccIdx)
5703 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
5708 RgSchCqiRawPuschMode12 *mode12Info;
5709 RgSchCqiRawPuschMode20 *mode20Info;
5710 RgSchCqiRawPuschMode22 *mode22Info;
5711 RgSchCqiRawPuschMode30 *mode30Info;
5712 RgSchCqiRawPuschMode31 *mode31Info;
5713 U8 numTxAnt = cell->numTxAntPorts;
5714 U8 sCellIdx = ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)];
5716 RgSchUeACqiCb *acqiCb = &ueCb->cellInfo[sCellIdx]->acqiCb;
5718 TRC2(rgSCHTomPrepareAcqiRecp);
5721 cqiRecpReqInfo->reportType = TFU_APERIODIC_CQI_TYPE; /* Aperiodic */
5722 if (ueCb->mimoInfo.txMode == RGR_UE_TM_3 ||
5723 ueCb->mimoInfo.txMode == RGR_UE_TM_4)
5725 cqiRecpReqInfo->riSz[ccIdx].pres = TRUE;
5726 cqiRecpReqInfo->riSz[ccIdx].val = acqiCb->riNumBits;
5728 /* This flag will be rmeoved after making changes in BRDCM CL
5729 * Sachin is doing the change
5731 #if (defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
5733 cqiRecpReqInfo->cqiPmiSzR1[ccIdx] = acqiCb->cqiPmiSzR1;
5734 cqiRecpReqInfo->cqiPmiSzRn1[ccIdx] = acqiCb->cqiPmiSzRn1;
5736 if(ueCb->nPCqiCb->perRiVal == 1)
5738 cqiRecpReqInfo->cqiPmiSzR1[ccIdx] = acqiCb->cqiPmiSzR1;
5742 cqiRecpReqInfo->cqiPmiSzRn1[ccIdx] = acqiCb->cqiPmiSzRn1;
5745 /* Fill scratchpad to aid decoding of aper CQI upon
5747 confRepMode = acqiCb->aCqiCfg.aprdModeEnum;
5748 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUSCH;
5750 numOfCells = ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells;
5752 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5753 puschRawCqiInfo.mode = (TfuDlCqiPuschMode)confRepMode;
5755 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5756 puschRawCqiInfo.ri.pres = cqiRecpReqInfo->riSz[ccIdx].pres;
5758 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5759 puschRawCqiInfo.ri.val = cqiRecpReqInfo->riSz[ccIdx].val;
5761 /* Setting the sCellIdx */
5762 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5763 sCellIdx = sCellIdx;
5767 case RGR_APRD_CQI_MOD12:
5769 mode12Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5770 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode12Info;
5771 mode12Info->wideBCqiCw0 = 4;
5772 mode12Info->r1WideBCqiCw1 = 0;
5773 mode12Info->rg1WideBCqiCw1 = 4;
5776 mode12Info->r1TotalPmiBitLen = 2*acqiCb->N;
5777 mode12Info->rg1TotalPmiBitLen = acqiCb->N;
5779 else if(numTxAnt == 4)
5781 mode12Info->r1TotalPmiBitLen = 4*acqiCb->N;
5782 mode12Info->rg1TotalPmiBitLen = 4*acqiCb->N;
5787 case RGR_APRD_CQI_MOD20:
5789 mode20Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5790 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode20Info;
5791 mode20Info->wideBCqiCw = 4;
5792 mode20Info->subBandDiffCqi = 2;
5793 mode20Info->posOfM = acqiCb->L;
5797 case RGR_APRD_CQI_MOD22:
5799 mode22Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5800 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode22Info;
5801 mode22Info->wideBCqiCw0 = 4;
5802 mode22Info->sBDiffCqiCw0 = 2;
5803 mode22Info->r1WideBCqiCw1 = 0;
5804 mode22Info->r1SbDiffCqiCw1 = 0;
5805 mode22Info->rg1WideBCqiCw1 = 4;
5806 mode22Info->rg1SbDiffCqiCw1 = 2;
5807 mode22Info->posOfM = acqiCb->L;
5810 mode22Info->r1PmiBitLen = 4;
5811 mode22Info->rg1PmiBitLen = 2;
5813 else if(numTxAnt == 4)
5815 mode22Info->r1PmiBitLen = 8;
5816 mode22Info->rg1PmiBitLen = 8;
5821 case RGR_APRD_CQI_MOD30:
5823 mode30Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5824 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode30Info;
5825 mode30Info->wideBCqiCw = 4;
5826 mode30Info->totLenSbDiffCqi = 2*acqiCb->N;
5830 case RGR_APRD_CQI_MOD31:
5832 mode31Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5833 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode31Info;
5834 mode31Info->wideBCqiCw0 = 4;
5835 mode31Info->totLenSbDiffCqiCw0 = 2*acqiCb->N;
5836 mode31Info->r1WideBCqiCw1 = 0;
5837 mode31Info->r1TotLenSbDiffCqiCw1 =0;
5838 mode31Info->rg1WideBCqiCw1 = 4;
5839 mode31Info->rg1TotLenSbDiffCqiCw1 = 2*acqiCb->N;
5842 mode31Info->r1PmiBitLen = 2;
5843 mode31Info->rg1PmiBitLen = 1;
5845 else if(numTxAnt == 4)
5847 mode31Info->r1PmiBitLen = 4;
5848 mode31Info->rg1PmiBitLen = 4;
5859 * @brief Function which handles the filling of Aperiodic CQI/RI reception
5864 * Function: rgSCHTomUtlFillDatAperRecpReq
5866 * Function which handles the filling of Aperiodic CQI/RI reception
5869 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5872 * - Fill the reception request for the data arriving on the ULSCH
5873 * - Fill the reception request information for the Aperiodic CQI/PMI/RI
5875 * @param[in] RgSchCellCb *cell,
5876 * RgSchUlAlloc *alloc,
5877 * TfuUeRecpReqInfo *datRecpInfo,
5878 * CmLteTimingInfo *timeInfo,
5885 PUBLIC S16 rgSCHTomUtlFillDatAperRecpReq
5889 RgSchUlAlloc *alloc,
5890 TfuUeRecpReqInfo *datRecpInfo,
5891 CmLteTimingInfo *timeInfo,
5896 PUBLIC S16 rgSCHTomUtlFillDatAperRecpReq(cell, cqiReq, alloc, datRecpInfo, timeInfo, hqPres, validIdx)
5899 RgSchUlAlloc *alloc;
5900 TfuUeRecpReqInfo *datRecpInfo;
5901 CmLteTimingInfo *timeInfo;
5906 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
5907 RgSchUeCb *ueCb = alloc->ue;
5912 TRC2(rgSCHTomUtlFillDatAperRecpReq);
5914 /*Fill RI Reception Params*/
5915 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
5916 cqiRecpReqInfo->riBetaOff = alloc->ue->ul.betaRiOffst;
5917 cqiRecpReqInfo->cqiBetaOff = alloc->ue->ul.betaCqiOffst;
5920 cqiRecpReqInfo->cCNum = 0;
5921 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells = 0;
5924 rgSCHTomUtlGetTrigSet(cell, ueCb, cqiReq, &triggerSet);
5925 for (sIdx = 0; sIdx < CM_LTE_MAX_CELLS; sIdx++)
5927 /* The Aperiodic request for SCell index sIdx */
5928 if ((triggerSet >> (7 - sIdx)) & 0x01)
5930 /* The Aperiodic request for SCell index sIdx */
5931 rgSCHTomPrepareAcqiRecp(ueCb, ueCb->cellInfo[sIdx]->cell, cqiRecpReqInfo, cqiRecpReqInfo->cCNum);
5932 cqiRecpReqInfo->cCNum++;
5933 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells++;
5937 rgSCHTomPrepareAcqiRecp(ueCb, ueCb->cellInfo[0]->cell, cqiRecpReqInfo, cqiRecpReqInfo->cCNum);
5938 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells++;
5941 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5943 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
5945 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
5946 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
5950 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
5952 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
5956 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
5958 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
5960 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
5962 datRecpInfo->rnti = alloc->rnti;
5963 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
5964 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5966 } /* rgSCHTomUtlFillDatAperRecpReq */
5971 * @brief Function which handles the filling of Periodic RI reception
5972 * request values which arrives along with UL Data on ULSCH
5976 * Function: rgSCHTomUtlFillDatPriRecpReq
5978 * Function which handles the filling of Periodic RI reception
5979 * request values which arrives along with UL Data on ULSCH
5981 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5984 * - Fill the reception request for the data arriving on the ULSCH
5985 * - Fill the reception request information for the Periodic RI
5987 * @param[in] RgSchCellCb *cell,
5988 * RgSchUlAlloc *alloc,
5989 * TfuUeRecpReqInfo *datRecpInfo,
5990 * CmLteTimingInfo *timeInfo,
5997 PUBLIC S16 rgSCHTomUtlFillDatPriRecpReq
6000 RgSchUlAlloc *alloc,
6001 TfuUeRecpReqInfo *datRecpInfo,
6002 CmLteTimingInfo *timeInfo,
6007 PUBLIC S16 rgSCHTomUtlFillDatPriRecpReq(cell, alloc, datRecpInfo, timeInfo,
6010 RgSchUlAlloc *alloc;
6011 TfuUeRecpReqInfo *datRecpInfo;
6012 CmLteTimingInfo *timeInfo;
6017 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
6018 TRC2(rgSCHTomUtlFillDatPriRecpReq);
6020 /*Fill RI Reception Params*/
6021 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
6022 #ifdef TFU_ALLOC_EVENT_NO_INIT
6023 cqiRecpReqInfo->cqiBetaOff = 0;
6024 /* Fill only the first RI index since Periodic can come
6026 cqiRecpReqInfo->cqiPmiSzR1[0] = 0;
6027 cqiRecpReqInfo->cqiPmiSzRn1[0] = 0;
6029 cqiRecpReqInfo->reportType = TFU_PERIODIC_CQI_TYPE; /* periodic */
6030 cqiRecpReqInfo->riBetaOff = alloc->ue->ul.betaRiOffst;
6032 /* Fill only the first RI index since Periodic can come
6034 cqiRecpReqInfo->cCNum = 1;
6035 cqiRecpReqInfo->riSz[0].pres = TRUE;
6036 cqiRecpReqInfo->riSz[0].val = alloc->ue->nPRiCb->riNumBits;
6038 rgSCHTomUtlFillRiBitWidthInfo(alloc->ue);
6039 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
6041 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
6042 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
6046 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
6048 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
6052 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
6054 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
6056 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
6058 datRecpInfo->rnti = alloc->rnti;
6059 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
6060 &datRecpInfo->t.puschRecpReq.ulSchInfo);
6062 } /* rgSCHTomUtlFillDatPriRecpReq */
6066 * @brief Function which handles the filling of Periodic CQI/PMI reception
6067 * request values which arrives along with UL Data on ULSCH
6071 * Function: rgSCHTomUtlFillDatPCqiRecpReq
6073 * Function which handles the filling of Periodic CQI/PMI reception
6074 * request values which arrives along with UL Data on ULSCH
6076 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
6079 * - Fill the reception request for the data arriving on the ULSCH
6080 * - Fill the reception request information for the Periodic CQI/PMI
6082 * @param[in] RgSchCellCb *cell,
6083 * RgSchUlAlloc *alloc,
6084 * TfuUeRecpReqInfo *datRecpInfo,
6085 * CmLteTimingInfo *timeInfo,
6093 PUBLIC S16 rgSCHTomUtlFillDatPCqiRecpReq
6096 RgSchUlAlloc *alloc,
6097 TfuUeRecpReqInfo *datRecpInfo,
6098 CmLteTimingInfo *timeInfo,
6103 PUBLIC S16 rgSCHTomUtlFillDatPCqiRecpReq(cell, alloc, datRecpInfo,
6104 timeInfo, hqPres, validIdx)
6106 RgSchUlAlloc *alloc;
6107 TfuUeRecpReqInfo *datRecpInfo;
6108 CmLteTimingInfo *timeInfo;
6113 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
6114 U8 cqiPmiSz; /*Raw CQI/PMI Size*/
6117 TRC2(rgSCHTomUtlFillDatPCqiRecpReq);
6120 /*Fill CQI Reception Params*/
6121 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
6122 #ifdef TFU_ALLOC_EVENT_NO_INIT
6123 cqiRecpReqInfo->riBetaOff = 0;
6125 cqiRecpReqInfo->cqiBetaOff = alloc->ue->ul.betaCqiOffst;
6126 cqiPmiSz = rgSCHTomUtlFetchPcqiBitSz(alloc->ue, cell->numTxAntPorts, &ri);
6129 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Fill "
6130 "CqiPmi size RNTI:%d",alloc->rnti);
6134 /* Fill only the first RI index since Periodic can come
6136 cqiRecpReqInfo->cCNum = 1;
6137 cqiRecpReqInfo->reportType = TFU_PERIODIC_CQI_TYPE; /* Periodic */
6138 /* This flags will be removed once Sachin does changes
6140 #if (defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
6141 cqiRecpReqInfo->cqiPmiSzR1[0] = cqiPmiSz;
6142 cqiRecpReqInfo->cqiPmiSzRn1[0] = cqiPmiSz;
6146 cqiRecpReqInfo->cqiPmiSzR1[0] = cqiPmiSz;
6147 cqiRecpReqInfo->cqiPmiSzRn1[0] = 0;
6151 cqiRecpReqInfo->cqiPmiSzRn1[0] = cqiPmiSz;
6152 cqiRecpReqInfo->cqiPmiSzR1[0] = 0;
6155 cqiRecpReqInfo->riSz[0].pres = FALSE;
6157 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
6159 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
6160 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
6163 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
6165 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
6169 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
6171 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
6173 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
6175 datRecpInfo->rnti = alloc->rnti;
6176 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
6177 &datRecpInfo->t.puschRecpReq.ulSchInfo);
6179 } /* rgSCHTomUtlFillDatPCqiRecpReq */
6182 * @brief Function which handles the filling of SRS reception
6183 * request values which arrives along with UL Data on ULSCH
6187 * Function: rgSCHTomUtlFillDatSrsRecpReq
6189 * Function which handles the filling of SRS reception
6190 * request values which arrives along with UL Data on ULSCH
6192 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
6195 * - Fill the reception request for the data arriving on the ULSCH
6196 * - Fill the reception request information for the SRS
6198 * @param[in] RgSchCellCb *cell,
6199 * RgSchUlAlloc *alloc,
6200 * TfuUeRecpReqInfo *datRecpInfo,
6201 * CmLteTimingInfo *timeInfo,
6208 PUBLIC S16 rgSCHTomUtlFillDatSrsRecpReq
6211 RgSchUlAlloc *alloc,
6212 TfuUeRecpReqInfo *datRecpInfo,
6213 CmLteTimingInfo *timeInfo,
6217 PUBLIC S16 rgSCHTomUtlFillDatSrsRecpReq(cell, alloc, datRecpInfo, timeInfo,
6220 RgSchUlAlloc *alloc;
6221 TfuUeRecpReqInfo *datRecpInfo;
6222 CmLteTimingInfo *timeInfo;
6226 TRC2(rgSCHTomUtlFillDatSrsRecpReq);
6227 datRecpInfo->rnti = alloc->rnti;
6228 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
6231 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_HARQ_SRS;
6235 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_SRS;
6237 datRecpInfo->rnti = alloc->rnti;
6238 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
6239 &datRecpInfo->t.puschRecpReq.ulSchInfo);
6241 } /* rgSCHTomUtlFillDatSrsRecpReq */
6244 * @brief Function which handles the filling of only SRS reception
6245 * request values on ULSCH
6249 * Function: rgSCHTomFillOnlySrsRecpReq
6251 * Function which handles the filling of SRS reception
6252 * request values which arrives along with UL Data on ULSCH
6254 * Invoked by: rgSCHTomUtlFillDatSrsRecpReq of rg_sch_tom.c
6257 * - Fill the reception request for the data arriving on the ULSCH
6258 * - Fill the reception request information for the SRS
6260 * @param[in] RgSchCellCb *cell,
6261 * RgSchUlAlloc *alloc,
6262 * TfuUeRecpReqInfo *datRecpInfo,
6268 PUBLIC S16 rgSCHTomFillOnlySrsRecpReq
6271 RgSchUlAlloc *alloc,
6272 TfuUeRecpReqInfo *datRecpInfo
6275 PUBLIC S16 rgSCHTomFillOnlySrsRecpReq(cell, alloc, datRecpInfo)
6277 RgSchUlAlloc *alloc;
6278 TfuUeRecpReqInfo *datRecpInfo;
6281 TfuUePuschSrsRecpInfo *srsRecpReqInfo;
6282 TRC2(rgSCHTomFillOnlySrsRecpReq);
6284 srsRecpReqInfo = &datRecpInfo->t.puschRecpReq.srsInfo;
6285 srsRecpReqInfo->srsBw = (TfuUlSrsBwInfo)alloc->ue->srsCb.srsCfg.srsSetup.srsBw;
6286 srsRecpReqInfo->nRrc = alloc->ue->srsCb.srsCfg.srsSetup.fDomPosi;
6287 srsRecpReqInfo->srsHopBw = (TfuUlSrsHoBwInfo)alloc->ue->srsCb.srsCfg.srsSetup.srsHopBw;
6288 srsRecpReqInfo->transComb = alloc->ue->srsCb.srsCfg.srsSetup.txComb;
6289 srsRecpReqInfo->srsCfgIdx = alloc->ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6290 srsRecpReqInfo->srsCyclicShft = (TfuUlSrsCycShiftInfo)alloc->ue->srsCb.srsCfg.srsSetup.cycShift;
6292 /* ccpu00117050 - ADD - nSrs setting
6293 * Refer Section 5.2.2.6 of TS 36.212 V8.5.0*/
6294 datRecpInfo->t.puschRecpReq.ulSchInfo.nSrs = 1;
6297 } /* rgSCHTomFillOnlySrsRecpReq */
6300 * @brief Function which handles the filling of PCQI/RI, SRS and SR
6301 * Reception Request Information along
6302 * with the HARQ reception Request
6306 * Function: rgSCHTomUtlFillCqiSrSrsWithHq
6308 * Function which handles the filling of PCQI/RI, SRS ans SR
6309 * Reception Request Information along
6310 * with the HARQ reception Request
6313 * Invoked by: rgSCHTomUtlFillHqFdbkRecpReq &
6314 * rgSCHTomUtlFillSfHqFdbk of rg_sch_tom.c
6317 * - Fill the reception request for the Control Info arriving on the PUCCH
6318 * - Fill the reception request information for the SR, RI, CQI, SRS
6320 * @param[in] RgSchCellCb *cell,
6321 * TfuRecpReqInfo *recpReqInfo,
6322 * RgSchDlHqProcCb *hqCb,
6323 * @param[out] TfuUeRecpReqInfo *pucchRecpInfo
6324 * @param[in] U16 validIdx
6330 PRIVATE S16 rgSCHTomUtlFillCqiSrSrsWithHq
6333 TfuRecpReqInfo *recpReqInfo,
6335 TfuUeRecpReqInfo *pucchRecpInfo,
6337 Bool isDatPresOnSecCell
6340 PRIVATE S16 rgSCHTomUtlFillCqiSrSrsWithHq(cell, recpReqInfo, ue,
6341 pucchRecpInfo, validIdx,isDatPresOnSecCell)
6343 TfuRecpReqInfo *recpReqInfo;
6345 TfuUeRecpReqInfo *pucchRecpInfo;
6347 Bool isDatPresOnSecCell;
6350 RgSchUePCqiCb *cqiCb;
6351 RgSchUePCqiCb *riCb;
6352 U8 ri; /*To fetch RI value*/
6353 Bool willUeRprtCqi; /* Flag set due to CQI Mask and
6354 UE Inactive state (DRX)*/
6355 Bool willUeRprtSr = TRUE;
6356 TfuAckNackMode hqFdbkMode;
6359 Bool dropCqi = FALSE;
6361 RgSchCmnUlUeSpsInfo *ulSpsUe = NULL;
6364 RgSchEmtcUeInfo *emtcUe = NULLP;
6367 TRC2(rgSCHTomUtlFillCqiSrSrsWithHq);
6371 /*Changes for PUCCH Format3 */
6372 hqFdbkMode = pucchRecpInfo->t.pucchRecpReq.hqInfo.hqFdbkMode;
6373 numCqiBit = rgSCHCmnCalcPcqiBitSz (ue,cell->numTxAntPorts);
6374 totalPucchBits = pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz + numCqiBit;
6377 emtcUe = RG_GET_EMTC_UE_CB(ue);
6379 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
6380 #ifdef EMTC_ENABLE /*VINU*/
6383 if((emtcUe->pucchRepNumFr1 > 1) || (emtcUe->pucchRepNumFr2 > 1))
6385 willUeRprtCqi = FALSE;
6386 willUeRprtSr = FALSE;
6390 if(ue->srCb.nSrTrIdx == validIdx)
6394 /* Should we check for Rel8 and above???
6395 * Dont send SR recp req if logicalChannelSR-Mask enabled and UL SPS is
6397 ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue, cell);
6398 /* Avoiding check for ulSpsEnabled as isUlSpsActv FALSE if sps is not enabled*/
6399 if(!((ue->ul.ulSpsCfg.isLcSRMaskEnab) &&
6400 (ulSpsUe->isUlSpsActv)))
6407 pucchRecpInfo->t.pucchRecpReq.srInfo.n1PucchIdx =
6408 ue->srCb.srCfg.srSetup.srResIdx;
6409 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
6410 /* FORMAT3: If SR is present it will be appended after HARQ */
6411 totalPucchBits = totalPucchBits + 1;
6418 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
6420 /* LTE_ADV:: UE will drop CSI during CSI+1BCS if data is present
6421 * on sec cell(isDatPresOnSecCell)*/
6423 if (hqFdbkMode == TFU_ACK_NACK_CHANNEL_SELECTION)
6425 if (hqFdbkMode == TFU_UCI_FORMAT_1B_CS)
6428 if (isDatPresOnSecCell == TRUE)
6435 /* Format 3 Changes : If Hq + SR + CQI bits < 22 and simultaneousAckNackAndCQI-Format3
6436 is enabled then CQI will be multiplexed with HQ otherwise CQI will be dropped
6437 Spec 36.213 Sec 10.1.1 */
6438 else if (hqFdbkMode == TFU_UCI_FORMAT_3)
6440 if ((isDatPresOnSecCell == TRUE) &&
6441 ((!ue->simulAckNackCQIFormat3) || (totalPucchBits > 22)))
6449 cqiCb = ue->nPCqiCb;
6450 if(riCb->nRiTrIdx == validIdx)
6452 /*ccpu00140578:: Skip the UE if the RI is already processed
6454 if(riCb->riRecpPrcsd == FALSE)
6456 if(riCb->riDist == 0)
6458 if((riCb->cqiCfg.cqiSetup.sANCQI == TRUE) && (willUeRprtCqi == TRUE)&&
6459 (isDatPresOnSecCell == FALSE))
6462 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6463 riCb->cqiCfg.cqiSetup.cqiPResIdx;
6464 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6466 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_HARQ_SR)
6468 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI;
6472 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_CQI;
6474 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6476 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6477 ue->nPRiCb->servCellInfo->sCellIdx;
6479 rgSCHTomUtlFillRiBitWidthInfo(ue);
6480 if (ue->nPCqiCb->nCqiTrIdx == validIdx)
6482 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, ue->nPCqiCb);
6497 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
6503 /* Skip the UE for RI processing on PUCCH
6504 * in the same subframe as it already processed */
6505 if(riCb->nRiTrIdx == validIdx)
6507 /* As the new idx is same is current idx
6508 * then PUCCH reception processing will consider
6509 * RI also in the same subframe. To block this
6510 * below flag is used*/
6511 riCb->riRecpPrcsd = TRUE;
6515 else if(cqiCb->nCqiTrIdx == validIdx)
6517 if((cqiCb->cqiCfg.cqiSetup.sANCQI == TRUE) && (willUeRprtCqi == TRUE)&&
6518 (isDatPresOnSecCell == FALSE))
6521 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6522 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
6524 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6526 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6527 cqiCb->servCellInfo->sCellIdx;
6529 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6530 rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
6531 if(0 == pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz)
6533 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d "
6534 "Unable to Fill CqiPmi size", ue->ueId);
6537 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_HARQ_SR)
6539 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI;
6543 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_CQI;
6556 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6558 if(ue->srsCb.nSrsTrIdx == validIdx)
6560 /* ccpu00140578::Skip the UE for SRS reception processing
6561 * if already done as part of PUSCH recpetion
6563 if(ue->srsCb.srsRecpPrcsd == FALSE)
6565 if(ue->srsCb.srsDist ==0 )
6567 if((pucchRecpInfo->t.pucchRecpReq.uciInfo != TFU_PUCCH_HARQ_CQI)
6568 && (ue->srsCb.srsCfg.srsSetup.sANSrs)
6569 && (isDatPresOnSecCell == FALSE))
6572 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
6573 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
6574 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
6575 ue->srsCb.srsCfg.srsSetup.fDomPosi;
6576 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
6577 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
6578 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
6579 ue->srsCb.srsCfg.srsSetup.txComb;
6580 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
6581 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6582 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
6583 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
6584 /* ccpu00116923 - ADD - New Reception Request types for CQI and SRS with SR */
6585 switch(pucchRecpInfo->t.pucchRecpReq.uciInfo)
6587 case TFU_PUCCH_HARQ_SR:
6588 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_SRS;
6590 case TFU_PUCCH_HARQ_SR_CQI:
6591 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI_SRS;
6594 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SRS;
6598 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
6602 ue->srsCb.srsDist--;
6604 /* Skip the UE for SRS processing on PUCCH
6605 * in the same subframe as it already processed */
6606 if(ue->srsCb.nSrsTrIdx == validIdx)
6608 /* As the new idx is same is current idx
6609 * then PUCCH reception processing will consider
6610 * SRS also in the same subframe. To block this
6611 * below flag is used*/
6612 ue->srsCb.srsRecpPrcsd = TRUE;
6620 } /* rgSCHTomUtlFillCqiSrSrsWithHq */
6623 * @brief Function which handles the filling of PCQI/RI, SRS
6624 * Reception Request Information along with SR reception
6629 * Function: rgSCHTomUtlFillCqiSrsWithSr
6631 * Function which handles the filling of PCQI/RI, SRS
6632 * Reception Request Information along
6633 * with the SR reception Request
6636 * Invoked by: rgSCHTomUtlFillSrRecpReq of rg_sch_tom.c
6639 * - Fill the reception request for CQI/RI, SRS if they occur
6640 * in the same instance as of SR.
6642 * @param[in] RgSchCellCb *cell,
6644 * TfuRecpReqInfo *recpReqInfo,
6645 * @param[out] TfuUeRecpReqInfo *pucchRecpInfo
6646 * @param[in] U16 validIdx
6653 PRIVATE S16 rgSCHTomUtlFillCqiSrsWithSr
6657 TfuRecpReqInfo *recpReqInfo,
6658 TfuUeRecpReqInfo *pucchRecpInfo,
6662 PRIVATE S16 rgSCHTomUtlFillCqiSrsWithSr(cell, ue, recpReqInfo,
6663 pucchRecpInfo, validIdx)
6666 TfuRecpReqInfo *recpReqInfo;
6667 TfuUeRecpReqInfo *pucchRecpInfo;
6671 RgSchUePCqiCb *cqiCb;
6672 RgSchUePCqiCb *riCb;
6673 U8 ri; /*To fetch RI value*/
6674 Bool willUeRprtCqi; /* Flag set due to CQI Mask and
6675 UE Inactive state (DRX)*/
6676 TRC2(rgSCHTomUtlFillCqiSrsWithSr);
6679 cqiCb = ue->nPCqiCb;
6680 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
6682 rgSCHEmtcWillUeRptCqi(ue, &willUeRprtCqi);
6684 if(riCb->nRiTrIdx == validIdx)
6686 /*ccpu00140578:: Skip the UE if the RI is already processed
6688 if(riCb->riRecpPrcsd == FALSE)
6690 if(riCb->riDist == 0)
6692 if(willUeRprtCqi == TRUE)
6695 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6696 riCb->cqiCfg.cqiSetup.cqiPResIdx;
6697 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6700 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI;
6701 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6703 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6704 ue->nPRiCb->servCellInfo->sCellIdx;
6706 rgSCHTomUtlFillRiBitWidthInfo(ue);
6707 /* TODO:: syed Shouldn't this be done outside this if condition */
6708 if (cqiCb->nCqiTrIdx == validIdx)
6710 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6713 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
6719 if(riCb->nRiTrIdx == validIdx)
6720 {/* Need to skip this UE during PUCCH RI recpetion process
6721 in the current subframe */
6722 riCb->riRecpPrcsd = TRUE;
6726 else if(cqiCb->nCqiTrIdx == validIdx)
6728 if(willUeRprtCqi == TRUE)
6731 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6732 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
6734 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6737 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6738 cqiCb->servCellInfo->sCellIdx;
6740 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6741 rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
6742 if(0 == pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz)
6744 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d"
6745 " Unable to Fill CqiPmi size", ue->ueId);
6749 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI;
6751 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6753 if(ue->srsCb.nSrsTrIdx == validIdx)
6755 /* ccpu00140578:: Cnsider the SRS processing
6756 * only if not done in the same TTI
6757 * as part of PUSCH or HARQ reception process*/
6758 if(ue->srsCb.srsRecpPrcsd == FALSE)
6760 if(ue->srsCb.srsDist ==0 )
6762 if(ue->srsCb.srsCfg.srsSetup.sANSrs)
6765 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
6766 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
6767 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
6768 ue->srsCb.srsCfg.srsSetup.fDomPosi;
6769 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
6770 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
6771 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
6772 ue->srsCb.srsCfg.srsSetup.txComb;
6773 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
6774 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6775 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
6776 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
6777 /* ccpu00116923 - ADD - New Reception Request types for CQI and
6779 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_SR_CQI)
6781 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI_SRS;
6785 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_SRS;
6789 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
6793 ue->srsCb.srsDist--;
6795 /* Skip the UE for SRS processing on PUCCH
6796 * in the same subframe as it already processed */
6797 if(ue->srsCb.nSrsTrIdx == validIdx)
6799 /* As the new idx is same is current idx
6800 * then PUCCH reception processing will consider
6801 * SRS also in the same subframe. To block this
6802 * below flag is used*/
6803 ue->srsCb.srsRecpPrcsd = TRUE;
6809 } /* rgSCHTomUtlFillCqiSrsWithSr */
6815 /** @brief This function handles filling of HARQ feedback repetition
6816 * recption request for each subframe
6820 * Function: rgSCHTomUtlFillSfRepHqFdbk
6824 * @param [out] TfuRecpReqInfo *recpReqInfo
6825 * @param [in] RgSchCellCb *cell
6826 * @param [out] RgSchErrInfo *err
6827 * @param [in] RgSchDlSf *dlSf
6828 * @param [in] U8 noFdbks
6829 * @param [in] CmMemListCp *memCp
6830 * @param [in] U8 elemIdx
6831 * @param [in] RgSchDlSf *nxtDlsf
6838 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk
6840 TfuRecpReqInfo *recpReqInfo,
6841 RgSchCellCb *cellCb,
6851 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk (recpReqInfo, cellCb, err, dlSf,
6852 noFdbks, memCp, elemIdx, nxtDlsf, validIdx)
6853 TfuRecpReqInfo *recpReqInfo;
6854 RgSchCellCb *cellCb;
6865 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk
6867 TfuRecpReqInfo *recpReqInfo,
6868 RgSchCellCb *cellCb,
6877 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk (recpReqInfo, cellCb, err, dlSf,
6878 noFdbks, memCp, elemIdx, nxtDlsf)
6879 TfuRecpReqInfo *recpReqInfo;
6880 RgSchCellCb *cellCb;
6890 RgSchDlHqProcCb *hqCb;
6894 TfuUeRecpReqInfo *pucchRecpInfo;
6896 TfuUePucchHqRecpInfo *hqRecpReq;
6898 RgSchDlHqTbCb *tbCb;
6899 RgSchDlHqProcCb *prvHqCb = NULLP;
6901 TRC2(rgSCHTomUtlFillSfRepHqFdbk)
6903 node = dlSf->ackNakRepQ.first;
6906 tbCb = (RgSchDlHqTbCb *)(node->node);
6908 ueCb = hqCb->hqE->ue;
6910 if (--tbCb->fbkRecpRepCntr)
6912 /* Add to next subfarme */
6913 /* Add this hqCb to the next dlSf's ackNakRepQ */
6914 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
6915 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
6916 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
6917 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
6924 /* Go to the next node */
6929 if ((hqCb->hqE->ue != NULLP) &&
6930 (hqCb->hqE->ue->measGapCb.isMeasuring != TRUE)
6931 && (hqCb != prvHqCb)
6934 /* We need to add the recp request to be sent on the pucchANRep
6937 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
6938 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
6941 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to"
6942 "Allocate TfuUeRecpReqInfo for RNTI:%d ", ueCb->ueId);
6943 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
6946 pucchRecpInfo->rnti = ueCb->ueId;
6948 pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
6950 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
6953 /* FOR repetition Feedback shall come on n1PucchAnRep Configured per
6957 pucchRecpInfo->t.pucchRecpReq.hqType = TFU_HQ_RECP_REQ_N1PUCCH;
6958 pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = ueCb->ackNakRepCb.pucchRes;
6960 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
6961 hqRecpReq = &(pucchRecpInfo->t.pucchRecpReq.hqInfo);
6962 /* ACK NACK rep works only in bundling mode . */
6963 hqRecpReq->hqFdbkMode = (TfuAckNackMode)RGR_TDD_ACKNACK_MODE_BUNDL;
6964 if ((hqCb->hqPSfLnk.node != NULLP) &&
6965 (hqCb->hqPSfLnk.node != NULLP))
6968 hqRecpReq->hqSz = 2;
6972 hqRecpReq->hqSz = 1;
6974 hqRecpReq->pucchResCnt = 1;
6975 hqRecpReq->hqRes[0] = ueCb->ackNakRepCb.pucchRes;
6977 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
6978 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
6980 /* In a given dlSf, if there is 2 TBs context
6981 * stored for a given harq, then they are added
6982 * adjacent to each other in the subframe. To avoid
6983 * adding duplicate recpnInfo for each TB, store this
6984 * hqCb in prvHqCb. If nextHqCb is same as prvHqCb then
6985 * do not add reception req info.*/
6988 RGSCH_NULL_CHECK(cellCb->instIdx, hqCb->hqE->ue);
6989 rgSCHTomUtlMoveNxtOccasion(cellCb, hqCb->hqE->ue, validIdx);
6991 /* Go to the next node */
6997 /** @brief This function handles filling of HARQ feedback recption request
7002 * Function: rgSCHTomUtlFillSfHqFdbkInfo
7006 * @param [out] TfuRecpReqInfo *recpReqInfo
7007 * @param [in] RgSchCellCb *cell
7008 * @param [out] RgSchErrInfo *err
7009 * @param [in] RgSchDlSf *dlSf
7010 * @param [in] U8 noFdbks
7011 * @param [in] CmMemListCp *memCp
7012 * @param [in] U8 elemIdx
7013 * @param [in] RgSchDlSf *nxtDlsf
7014 * @param [in] U16 validIdx;
7021 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo
7023 TfuRecpReqInfo *recpReqInfo,
7024 RgSchCellCb *cellCb,
7032 RgSchDlHqProcCb *hqCb,
7033 RgSchUePucchRecpInfo *pucchInfo,
7035 RgSchDlHqProcCb *prvHqCb
7038 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo (recpReqInfo, cellCb, err, dlSf,
7039 noFdbks, memCp, elemIdx, nxtDlsf, validIdx, hqCb, pucchInfo, alloc, prvHqCb)
7040 TfuRecpReqInfo *recpReqInfo;
7041 RgSchCellCb *cellCb;
7049 RgSchDlHqProcCb *hqCb;
7050 RgSchUePucchRecpInfo *pucchInfo;
7052 RgSchDlHqProcCb *prvHqCb;
7056 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo
7058 TfuRecpReqInfo *recpReqInfo,
7059 RgSchCellCb *cellCb,
7066 RgSchDlHqProcCb *hqCb,
7067 RgSchUePucchRecpInfo *pucchInfo,
7069 RgSchDlHqProcCb *prvHqCb
7072 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo (recpReqInfo, cellCb, err, dlSf,
7073 noFdbks, memCp, elemIdx, nxtDlsf, hqCb, pucchInfo, alloc, prvHqCb)
7074 TfuRecpReqInfo *recpReqInfo;
7075 RgSchCellCb *cellCb;
7082 RgSchDlHqProcCb *hqCb;
7083 RgSchUePucchRecpInfo *pucchInfo;
7085 RgSchDlHqProcCb *prvHqCb;
7090 RgSchUeCb *ueCb = hqCb->hqE->ue;
7092 CmLteTimingInfo futTime;
7093 RgSchTddANInfo *anInfo;
7096 RgrTddAckNackMode ackNackMode;
7097 RgSchDlHqTbCb *tbCb;
7102 TRC2(rgSCHTomUtlFillSfHqFdbkInfo)
7105 RG_SCH_ADD_TO_CRNT_TIME(cellCb->crntTime, futTime, TFU_RECPREQ_DLDELTA);
7109 for (idx = 0 ;idx < 2; idx++)
7111 if (HQ_TB_WAITING == hqCb->tbInfo[idx].state)
7114 tbCb = &hqCb->tbInfo[idx];
7118 ackNackMode = ueCb->dl.ackNackMode;
7120 if(ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL)
7122 anInfo = rgSCHUtlGetUeANFdbkInfo(ueCb, &futTime);
7123 /* Only the last scheduled TB for the UE is for HARQ
7124 * ACK/NACK reception in Bundling case */
7125 if((anInfo == NULLP) ||
7126 (anInfo->latestMIdx != dlSf->dlFdbkInfo.m))
7133 /* Get the TFU reception request pointer, if present */
7134 cmHashListFind(&cellCb->ueTfuPendLst, (U8*) &ueCb->ueId,
7135 sizeof(ueCb->ueId), 0, (PTR *) &pucchInfo);
7138 /* For upgrade we shall use the existing logic of pending list. */
7139 cmHashListFind(&cellCb->ueTfuPendLst, (U8*) &ueCb->ueId,
7140 sizeof(ueCb->ueId), 0, (PTR *) &pucchInfo);
7143 else if(hqCb->hqE->raCb != NULLP)
7145 /* For RACH it is set to Bundling */
7146 ackNackMode = RGR_TDD_ACKNACK_MODE_BUNDL;
7147 rnti = hqCb->hqE->raCb->tmpCrnti;
7154 /* Do not proceed if PUSCH
7155 reception req is already filled*/
7160 /* Go to the next node */
7164 if(((ueCb == NULLP) || (ueCb->measGapCb.isMeasuring != TRUE))
7168 TknU16 n1PucchTkn = {FALSE, 0};
7171 pdcch = tbCb->hqP->pdcch;
7173 n1PucchTkn = hqCb->spsN1PucchRes;
7175 for (tbIndx = 0; tbIndx < TFU_MAX_TB; tbIndx++)
7177 if (hqCb->tbInfo[tbIndx].state == HQ_TB_WAITING &&
7178 (RGSCH_TIMEINFO_SAME(hqCb->tbInfo[tbIndx].fdbkTime,
7179 recpReqInfo->timingInfo)))
7182 hqCb->tbInfo[tbIndx].pucchFdbkIdx = hqCb->ulDai;
7185 ret = rgSCHTomUtlFillSfHqFdbkForOneUe(hqCb,recpReqInfo, cellCb, err, dlSf, noFdbks,
7186 memCp, elemIdx, nxtDlsf, rnti, ackNackMode, &pucchInfo, pdcch,
7187 n1PucchTkn, &alloc, hqSz);
7192 /* TODO:: In case of F1BCS and CSI in same subframe
7193 * UE shall drop the CSI if there was at least one
7194 * PDSCH transmission in any of the DL subframe
7195 * mapping to this UL subframe
7198 rgSCHTomUtlFillCqiSrSrsWithHq(cellCb,recpReqInfo, hqCb->hqE->ue,
7199 pucchInfo->pucchRecpInfo, validIdx,FALSE);
7201 if((hqCb->hqE->ue) &&
7202 (hqCb->hqE->ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS))
7205 if(RG_SCH_IS_CELL_SEC(hqCb->hqE->ue,hqCb->hqE->cell))
7207 switch(pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo)
7209 case TFU_PUCCH_HARQ_SR_CQI:
7210 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
7211 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
7213 case TFU_PUCCH_HARQ_CQI:
7214 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
7215 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
7217 case TFU_PUCCH_HARQ_SR_CQI_SRS:
7218 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_SRS;
7219 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
7221 case TFU_PUCCH_HARQ_SR_SRS:
7222 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
7224 case TFU_PUCCH_HARQ_SRS:
7225 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
7236 /* TODO antz - pushing the following code (under TFU_UPGRADE)
7237 * into the above function (...ForOneUe) did not work (caused
7238 * two additional TCs to fail). Don't know why. If this
7239 * is done later, make sure that the code branch
7240 * for relPdcch (later in this func) is also modified appropriately.
7242 /* Now add to the recp request or pending list */
7243 //if((elemIdx != (noFdbks - 1)))
7245 cmHashListInsert(&cellCb->ueTfuPendLst, (PTR) pucchInfo,
7246 (U8 *)&rnti ,(U16) sizeof(CmLteRnti));
7250 } /* If measuring */
7251 /* Go to the next node */
7252 if ((tbCb->fbkRecpRepCntr) && (--tbCb->fbkRecpRepCntr))
7254 /* Add to next subfarme */
7255 /* Add this hqCb to the next dlSf's ackNakRepQ */
7256 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
7257 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
7258 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
7259 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
7261 /* In a given dlSf, if there is 2 TBs context
7262 * stored for a given harq, then they are added
7263 * adjacent to each other in the subframe. To avoid
7264 * adding duplicate recpnInfo for each TB, store this
7265 * hqCb in prvHqCb. If nextHqCb is same as prvHqCb then
7266 * do not add reception req info.*/
7274 /** @brief This function calculates the pucch resource idx
7275 * that is to be filled in harq reception request
7279 * Function: rgSCHTomUtlGethqRes
7282 * -Calculate the pucch resource idx
7283 * Harq Reception Request for Format 1B with
7286 * @param [in] U8 noFdbks
7287 * @param [in] RgSchDlSf *dlSf
7288 * @param [in] RgSchPdcch *pdcch
7289 * @param [in] RgSchCellCb *cellCb
7290 * @param [out]U16 *hqRes
7294 PRIVATE Void rgSCHTomUtlGethqRes
7299 RgSchCellCb *cellCb,
7303 PRIVATE Void rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,hqRes)
7307 RgSchCellCb *cellCb;
7319 m = dlSf->dlFdbkInfo.m;
7321 P = rgSCHCmnGetPValFrmCCE(cellCb, nCce);
7322 nP = cellCb->rgSchTddNpValTbl[P];
7323 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
7324 *hqRes = (M - m - 1)* nP + (m * nPlusOne) + pdcch->nCce +
7325 cellCb->pucchCfg.n1PucchAn;
7330 /** @brief This function fills the harq reception request for
7331 * TDD in case of Fomat 1B with CS for M=1
7335 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1
7338 * -Fill Harq Reception Request for Format 1B with
7341 * @param [in] RgSchDlHqProcCb *hqCb
7342 * @param [in] TfuUePucchRecpReq *hqRecpReq
7343 * @param [in] U8 noFdbks
7344 * @param [in] RgSchDlSf *dlSf
7345 * @param [in] RgSchPdcch *pdcch
7346 * @param [in] RgSchCellCb *cellCb
7350 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1
7352 RgSchDlHqProcCb *hqCb,
7353 TfuUePucchRecpReq *hqRecpReq,
7360 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1(hqCb, hqRecpReq,
7361 noFdbks,dlSf,pdcch,cellCb)
7362 RgSchDlHqProcCb *hqCb;
7363 TfuUePucchRecpReq *hqRecpReq;
7367 RgSchCellCb *cellCb;
7370 RgSchUeCb *ue = NULLP;
7371 Bool isCellSec = FALSE;
7374 /*ccpu00147920: UeCb is NULL for SPS activation*/
7375 if(pdcch && pdcch->ue)
7376 {/* SPS Release pdcch or dynamic data */
7383 /* This is not supposed to happen
7384 * Error case. hqCB has to be ter
7385 * when pdcch is present . Adding
7386 * if check bcs of kwork*/
7393 if((hqCb != NULLP) &&
7394 (RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
7399 switch(ue->f1bCsAVal)
7401 case RG_SCH_A_VAL_2:
7402 /* harq(0) is primary harq(1) is secondary) */
7405 hqRecpReq->hqInfo.hqRes[1] = ue->n1PucchF1bResCb.
7406 cw1N1Res[hqCb->tpc].n1PucchIdx;
7408 else/* primary cell */
7411 /* hqCb will be null in case of sps rel pdcch */
7412 if ((hqCb) && hqCb->spsN1PucchRes.pres)
7413 {/* SPS occasion or dyn sched*/
7414 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
7417 #endif /* LTEMAC_SPS */
7418 {/* dyn data or sps release */
7422 /* This is not supposed to happen
7423 * Error case. hqCB has to be ter
7424 * when pdcch is present . Adding
7425 * if check bcs of kwork*/
7430 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7431 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7435 case RG_SCH_A_VAL_3:
7437 /* Serving cell in mimo mode should be
7438 * in 0 and 1 and the serving cell in siso
7439 * mode should be in 2 indices */
7442 U8 servCellIdx = rgSchUtlGetServCellIdx(hqCb->hqE->cell->instIdx,
7443 hqCb->hqE->cell->cellId,
7446 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1)
7447 {/* Sec cell is in mimo mode, use 0 and 1 */
7448 hqRecpReq->hqInfo.hqRes[0] =
7449 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7450 hqRecpReq->hqInfo.hqRes[1] =
7451 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
7454 {/* Sec cell is in siso mode, use 2 */
7455 hqRecpReq->hqInfo.hqRes[2] =
7456 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7460 {/* primary cell hq */
7462 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
7463 {/* prim cell is in mimo mode, use 0 and 1 */
7465 if (hqCb && hqCb->spsN1PucchRes.pres)
7466 {/* Not sps release */
7467 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
7470 #endif /* LTEMAC_SPS */
7471 {/* sps rel or dyn */
7475 /* This is not supposed to happen
7476 * Error case. hqCB has to be ter
7477 * when pdcch is present . Adding
7478 * if check bcs of kwork*/
7483 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7484 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7485 hqRecpReq->hqInfo.hqRes[1] = hqRes + 1;
7489 {/* prim cell is in siso mode use 2 */
7491 /* Consider sps occasions */
7492 if (hqCb && hqCb->spsN1PucchRes.pres)
7493 {/* Not sps release */
7494 hqRecpReq->hqInfo.hqRes[2] = hqCb->spsN1PucchRes.val;
7497 #endif /* LTEMAC_SPS */
7502 /* This is not supposed to happen
7503 * Error case. hqCB has to be ter
7504 * when pdcch is present . Adding
7505 * if check bcs of kwork*/
7510 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7511 hqRecpReq->hqInfo.hqRes[2] = hqRes;
7517 case RG_SCH_A_VAL_4:
7518 {/* Both the serv cells are in mimo mode */
7520 {/* 2 and 3 for sec cell */
7521 hqRecpReq->hqInfo.hqRes[2] =
7522 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7523 hqRecpReq->hqInfo.hqRes[3] =
7524 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
7526 else/* primary cell */
7527 {/* 0 and 1 are for primary cell */
7529 if (hqCb && hqCb->spsN1PucchRes.pres)
7530 {/* Not sps release */
7531 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
7534 #endif /* LTEMAC_SPS */
7539 /* This is not supposed to happen
7540 * Error case. hqCB has to be ter
7541 * when pdcch is present . Adding
7542 * if check bcs of kwork*/
7547 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7548 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7549 hqRecpReq->hqInfo.hqRes[1] = hqRes + 1;
7560 /** @brief This function fills the harq reception request for
7561 * TDD in case of Fomat 1B with CS for M>=2
7565 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234
7568 * -Fill Harq Reception Request for Format 1B with
7571 * @param [in] RgSchDlHqProcCb *hqCb
7572 * @param [in] TfuUePucchRecpReq *hqRecpReq
7573 * @param [in] U8 noFdbks
7574 * @param [in] RgSchDlSf *dlSf
7575 * @param [in] RgSchPdcch *pdcch
7576 * @param [in] RgSchCellCb *cellCb
7577 * @param [in] U8 elemIdx
7581 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234
7583 RgSchDlHqProcCb *hqCb,
7584 TfuUePucchRecpReq *hqRecpReq,
7588 RgSchCellCb *cellCb,
7592 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234(
7593 hqCb,hqRecpReq,noFdbks,dlSf,pdcch,cellCb,elemIdx)
7594 RgSchDlHqProcCb *hqCb;
7595 TfuUePucchRecpReq *hqRecpReq;
7599 RgSchCellCb *cellCb;
7604 Bool isCellSec = FALSE;
7609 {/* SPS Release pdcch or dynamic data */
7616 /* This is not supposed to happen
7617 * Error case. hqCB has to be ter
7618 * when pdcch is present . Adding
7619 * if check bcs of kwork*/
7626 if((hqCb != NULLP) && (ue != NULLP) &&
7627 (RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
7633 {/* Sec Cell indices are 2 and 3*/
7634 servCellIdx = rgSchUtlGetServCellIdx(hqCb->hqE->cell->instIdx,
7635 hqCb->hqE->cell->cellId,
7638 hqRecpReq->hqInfo.hqRes[2] =
7639 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7641 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1)
7643 hqRecpReq->hqInfo.hqRes[3] =
7644 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
7648 {/* Primary cell indices are 0 and 1 */
7650 * M > 2 if SPS occasion is present in any of the
7651 * DL subframe in the bundle, the n1Pucch(0) is
7652 * the SPS resource and n1Pucch(1) is the resource
7653 * derived from pdcch with DAI = 1
7654 * If No SPS Occasion
7655 * Then n1Pucch(0) is from pdcch with DAI =1
7656 * and n1Pucch(1) is from pdcch with DAI = 2
7660 {/* this is not sps release pdcch */
7661 if(hqCb->spsN1PucchRes.pres == TRUE)
7663 hqRes = hqCb->spsN1PucchRes.val;
7668 {/*Dynamic scheduling or SPS Release
7669 Derive from pdcch */
7670 if(pdcch->dlDai < 3)
7671 {/* No need to calcualte from DAI > 2 */
7672 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7678 hqRecpReq->hqInfo.hqRes[elemIdx] = hqRes;
7681 {/* Pdcch with DAI = 1 and 2 needs to be used
7682 for resource calculation*/
7683 if(hqCb && hqCb->spsN1PucchRes.pres == TRUE)
7684 {/* dyn or sps occasion */
7685 /* Shift the hqRes[0] if it was filled
7686 * if there was a pdcch with DAI 1 before to this
7689 {/* SPS occasion happened in the middle
7691 /* shifting the non SPS resource to n1Pucch(1) */
7692 hqRecpReq->hqInfo.hqRes[1] = hqRecpReq->hqInfo.hqRes[0];
7695 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7698 else if(pdcch && pdcch->dlDai < 3)
7700 else if(pdcch->dlDai < 3)
7702 {/* sps rel or dyn sched */
7703 /* hqCb wil not be present for sps release pdcch */
7704 if(hqCb && (pdcch->dlDai != hqCb->ulDai))
7705 {/* there was a SPS occasion before to this */
7706 if(pdcch->dlDai == 1)
7708 hqRecpReq->hqInfo.hqRes[1] = hqRes;
7709 }/* ignore the DAI 2 in this case */
7711 {/* There was no SPS occasion before to this */
7715 {/* Added check to ignore kwork warning */
7716 hqRecpReq->hqInfo.hqRes[(pdcch->dlDai)-1] = hqRes;
7725 /** @brief This function fills the harq reception request for
7726 * TDD in case of Fomat 1B with CS
7730 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCS
7733 * -Fill Harq Reception Request for Format 1B with
7736 * @param [in] RgSchDlSf *ulSf
7737 * @param [in] RgSchCellCb *cell
7738 * @param [out]TfuUePucchRecpReq *hqRecpReq
7742 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS
7744 RgSchDlHqProcCb *hqCb,
7745 TfuUePucchRecpReq *hqRecpReq,
7753 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS(hqCb,hqRecpReq,noFdbks,dlSf,pdcch,
7754 n1PucchTkn,elemIdx,cellCb)
7755 RgSchDlHqProcCb *hqCb;
7756 TfuUePucchRecpReq *hqRecpReq;
7761 RgSchCellCb *cellCb;
7764 /* Update teh fdbk mode if something different is present
7765 * in L1 API file for F1BS *//* 1 --> F1BCS */
7766 hqRecpReq->hqInfo.hqFdbkMode = TFU_ACK_NACK_CHANNEL_SELECTION;
7770 case RG_SCH_M_VAL_1:
7773 rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1(hqCb,hqRecpReq,
7774 noFdbks,dlSf,pdcch,cellCb);
7777 case RG_SCH_M_VAL_2:
7778 case RG_SCH_M_VAL_3:
7779 case RG_SCH_M_VAL_4:
7781 /* Spatial bundling will be applied */
7782 rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234(hqCb,hqRecpReq,
7783 noFdbks,dlSf,pdcch,cellCb,elemIdx);
7793 /***********************************************************
7795 * Func : rgSCHTomUtlFillSfHqFdbkForOneUe
7797 * Desc : Fill HARQ feedback info for one UE/entry
7805 **********************************************************/
7807 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForOneUe
7809 RgSchDlHqProcCb *hqCb,
7810 TfuRecpReqInfo *recpReqInfo,
7811 RgSchCellCb *cellCb,
7819 RgrTddAckNackMode ackNackMode,
7820 RgSchUePucchRecpInfo **pucchInfoRef,
7827 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForOneUe(hqCb,recpReqInfo, cellCb, err, dlSf,
7828 noFdbks, memCp, elemIdx, nxtDlsf, rnti, ackNackMode, pucchInfoRef,
7829 pdcch, n1PucchTkn, allocRef, hqSz)
7830 RgSchDlHqProcCb *hqCb;
7831 TfuRecpReqInfo *recpReqInfo;
7832 RgSchCellCb *cellCb;
7840 RgrTddAckNackMode ackNackMode;
7841 RgSchUePucchRecpInfo **pucchInfoRef;
7848 RgSchUePucchRecpInfo *pucchInfo = *pucchInfoRef;
7851 TfuUePucchRecpReq *hqRecpReq;
7866 Bool isFirstFdbk = FALSE;
7868 if(pucchInfo == NULLP)
7870 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchInfo,
7871 sizeof(RgSchUePucchRecpInfo), memCp)) != ROK)
7873 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to "
7874 "Allocate TfuUeRecpReqInfo for cell RNTI:%d",rnti);
7875 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
7879 #ifdef TFU_ALLOC_EVENT_NO_INIT
7880 pucchInfo->hashLstEnt.hashVal = 0;
7881 pucchInfo->hashLstEnt.keyLen = 0;
7882 pucchInfo->hashLstEnt.key = 0;
7883 pucchInfo->hashLstEnt.list.prev = pucchInfo->hashLstEnt.list.next = 0;
7885 if ((ret = rgSCHUtlGetEventMem((Ptr *)&(pucchInfo->pucchRecpInfo),
7886 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp))) != ROK)
7888 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to "
7889 "Allocate TfuUeRecpReqInfo for cell RNTI:%d",rnti);
7890 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
7893 cmMemset((U8 *)pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes,0xff,sizeof(U16)*TFU_MAX_HQ_RES);
7894 #ifdef TFU_ALLOC_EVENT_NO_INIT
7895 cmMemset((U8 *)&pucchInfo->pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
7897 pucchInfo->pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
7898 pucchInfo->pucchRecpInfo->rnti = rnti;
7900 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo=TFU_PUCCH_HARQ;
7907 /* Calculation of resources same for both bundling and muxing for M = 1
7910 RgSchUeCb *ue = rgSCHDbmGetUeCb (cellCb, rnti);
7911 if((ue) && (1 == ue->numSCells))
7913 if(ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS)
7915 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
7916 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS(hqCb,hqRecpReq,
7917 noFdbks,dlSf,pdcch,elemIdx,cellCb);
7920 {/* M = 1 case . size is same as A Value*/
7921 hqRecpReq->hqInfo.hqSz = ue->f1bCsAVal;
7922 hqRecpReq->hqInfo.pucchResCnt = hqRecpReq->hqInfo.hqSz;
7925 hqRecpReq->hqInfo.hqSz = (noFdbks * 2); /* M for 2 cells */
7926 hqRecpReq->hqInfo.pucchResCnt = 4;
7928 hqRecpReq->hqInfo.a = ue->f1bCsAVal;
7929 /* handling for SPS occasions*/
7932 /* set the datPresinFirstSUbframe to TRUE if this
7933 * is for pcell txion*/
7935 RgSchTddANInfo *anInfo = NULLP;
7937 /* if this txion is on pcell
7938 * sps occaion, dyn sched or sps release pdcch
7939 * set the sched present in first
7940 * dl subframe of the bundle to TRUE. This
7941 * is required for mapping the feedbak when SPS occasion
7942 * is present in any of the DL subframe in the bundle in
7945 /* SPS will happen only on pcell */
7946 if((hqCb == NULLP) || (!RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
7949 anInfo = rgSCHUtlGetUeANFdbkInfo(ue,
7950 &recpReqInfo->timingInfo,RGSCH_PCELL_INDEX);
7952 {/* ANInfo must be there. adding block
7954 RGSCHDBGERRNEW(cellCb->instIdx,(rgSchPBuf(cellCb->instIdx),
7955 "ANInfo should not be NULL for cellId=%d \n", cellCb->cellId));
7962 {/* This needs to be revisited while
7963 adding support for PUCCH format 3 */
7964 RGSCHDBGERRNEW(cellCb->instIdx,(rgSchPBuf(cellCb->instIdx),"Invalid Pucch format configured.."));
7971 if((ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) ||
7972 ((noFdbks == 1) && (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT)))
7974 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
7976 prevHqSize = hqRecpReq->hqInfo.hqSz;
7979 /* Only one index for bundling case */
7980 hqRecpReq->M = noFdbks;
7982 TFU_HQ_RECP_REQ_NORMAL;
7983 hqRecpReq->multCnt = 1;
7984 hqRecpReq->t.nCce[0] =
7989 rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
7991 hqRecpReq->type = TFU_UCI_HARQ;
7993 #else /* TFU_UPGRADE */
7996 if ((TRUE == isFirstFdbk) && (TRUE == n1PucchTkn.pres))
7998 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)ackNackMode;
7999 hqRecpReq->hqInfo.pucchResCnt=1;
8000 hqRecpReq->hqInfo.hqRes[0] = n1PucchTkn.val;
8001 hqRecpReq->hqInfo.hqSz = hqSz;
8004 else if (FALSE == n1PucchTkn.pres)
8007 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)ackNackMode;
8009 P = rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
8010 nP = cellCb->rgSchTddNpValTbl[P];
8011 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
8012 m = dlSf->dlFdbkInfo.m;
8013 /* In case of no UE */
8014 pucchRes = (M - m - 1)* nP + (m * nPlusOne) + pdcch->nCce +
8015 cellCb->pucchCfg.n1PucchAn;
8016 /*ccpu00130164:MOD-Changed to maitain value of
8017 hqRecpReq->hqInfo.pucchResCnt=1 in case of bundling*/
8018 /*ccpu00132284 -MOD- hqRes need to be updated after pucchReCnt set to 1
8019 * and resource should be update at index-0*/
8020 hqRecpReq->hqInfo.pucchResCnt=1;
8021 hqRecpReq->hqInfo.hqRes[hqRecpReq->hqInfo.pucchResCnt-1] = pucchRes;
8023 if((ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) && (hqSz > prevHqSize))
8024 hqRecpReq->hqInfo.hqSz = hqSz;
8025 else if (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT)
8026 hqRecpReq->hqInfo.hqSz = hqSz;
8028 hqRecpReq->hqInfo.hqSz = prevHqSize;
8030 #endif /* TFU_UPGRADE */
8032 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst,
8033 &(pucchInfo->pucchRecpInfo->lnk));
8034 pucchInfo->pucchRecpInfo->lnk.node =
8035 (PTR)pucchInfo->pucchRecpInfo;
8038 else /* Multiplexing */
8041 pucchInfo->pucchRecpInfo->t.pucchRecpReq.M = noFdbks;
8043 if (n1PucchTkn.pres == TRUE)
8045 pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqType =
8046 TFU_HQ_RECP_REQ_N1PUCCH;
8047 pucchInfo->pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = n1PucchTkn.val;
8052 pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqType =
8053 TFU_HQ_RECP_REQ_NORMAL;
8054 multCnt = pucchInfo->pucchRecpInfo->t.pucchRecpReq.multCnt;
8055 pucchInfo->pucchRecpInfo->t.pucchRecpReq.t.nCce[multCnt] =
8057 pucchInfo->pucchRecpInfo->t.pucchRecpReq.m[multCnt] =
8059 pucchInfo->pucchRecpInfo->t.pucchRecpReq.p[multCnt] =
8060 rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
8062 pucchInfo->pucchRecpInfo->t.pucchRecpReq.multCnt++;
8064 #else /* TFU_UPGRADE */
8066 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
8067 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)RGR_TDD_ACKNACK_MODE_MULT;
8068 hqRecpReq->hqInfo.hqSz = noFdbks;
8070 resIdx = hqRecpReq->hqInfo.pucchResCnt;
8071 hqRecpReq->hqInfo.pucchResCnt++;
8074 if (n1PucchTkn.pres == TRUE)
8076 hqRecpReq->hqInfo.hqRes[resIdx] = n1PucchTkn.val;
8082 m = dlSf->dlFdbkInfo.m;
8084 P = rgSCHCmnGetPValFrmCCE(cellCb, nCce);
8085 nP = cellCb->rgSchTddNpValTbl[P];
8086 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
8087 hqRecpReq->hqInfo.hqRes[resIdx] = (M - m - 1)* nP +
8088 (m * nPlusOne) + pdcch->nCce +
8089 cellCb->pucchCfg.n1PucchAn;
8091 #endif /* TFU_UPGRADE */
8092 /* If all the DL subframes are scanned, then
8093 * send TFU request*/
8095 if((elemIdx != noFdbks) && alloc)
8097 cmHashListInsert(&cellCb->ueTfuPendLst, (PTR) pucchInfo,
8098 (U8 *)&rnti, (U16) sizeof(rnti));
8103 pucchInfo->pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
8104 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst,
8105 &(pucchInfo->pucchRecpInfo->lnk));
8106 pucchInfo->pucchRecpInfo->lnk.node =
8107 (PTR)pucchInfo->pucchRecpInfo;
8108 /* Delete the entry after addition to the list */
8109 cmHashListDelete(&cellCb->ueTfuPendLst, (PTR) pucchInfo);
8115 *pucchInfoRef = pucchInfo;
8121 #ifdef RG_ULSCHED_AT_CRC
8122 /** @brief This function does all the processing related to a single downlink
8127 * Function: rgSCHTomUtlProcDlSfAtCrc
8130 * - collate control data for all UEs and send to PHY
8131 * - collate data buffers for all UEs and send to PHY
8133 * @param [in] RgSchDlSf *ulSf
8134 * @param [in] RgSchCellCb *cell
8135 * @param [in] TfuCntrlReqInfo *cntrlInfo
8136 * @param [out] RgSchErrInfo *err
8140 PRIVATE S16 rgSCHTomUtlProcDlSfAtCrc
8143 CmLteTimingInfo crntUlFrm,
8145 TfuCntrlReqInfo *cntrlInfo,
8149 PRIVATE S16 rgSCHTomUtlProcDlSfAtCrc (ulSf, crntUlFrm, cell, cntrlInfo, err)
8151 CmLteTimingInfo crntUlFrm;
8153 TfuCntrlReqInfo *cntrlInfo;
8157 Inst inst = cell->instIdx;
8160 TRC2(rgSCHTomUtlProcDlSfAtCrc);
8163 cntrlInfo->numDlActvUes = 0;
8164 cmLListInit(&cntrlInfo->phichLst);
8165 cmLListInit(&cntrlInfo->dlPdcchLst);
8166 cmLListInit(&cntrlInfo->ulPdcchLst);
8167 #ifdef TFU_ALLOC_EVENT_NO_INIT
8168 cntrlInfo->dlTiming.sfn = cntrlInfo->dlTiming.subframe = 0;
8172 cntrlInfo->ulTiming = crntUlFrm;
8173 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cntrlInfo->ulTiming, TFU_ULCNTRL_DLDELTA);
8175 cntrlInfo->cellId = cell->cellId;
8176 /* Fill PHICH info */
8177 if ((ret = rgSCHTomUtlFillPhich (cell, cntrlInfo, ulSf, err)) != ROK)
8179 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send PHICH info for "
8181 RGSCH_FREE_MEM(cntrlInfo);
8186 if ((ret = rgSCHTomUtlFillUlPdcch (cell, cntrlInfo, ulSf, err)) != ROK)
8188 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send PDCCH info for "
8190 RGSCH_FREE_MEM(cntrlInfo);
8195 if(0 == cntrlInfo->ulMpdcchLst.count)
8202 if ((cntrlInfo->ulPdcchLst.count || cntrlInfo->phichLst.count) || RG_SCH_EMTC_GET_PDCCHLST_CNT(cntrlInfo))
8204 if (cntrlInfo->ulPdcchLst.count || cntrlInfo->phichLst.count)
8207 if (rgSCHUtlTfuCntrlReq(inst, cell->tfuSap->sapCfg.suId, cntrlInfo)
8210 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info for"
8216 RGSCH_FREE_MEM(cntrlInfo);
8220 #endif /* #ifdef RG_ULSCHED_AT_CRC*/
8223 /** @brief This function sends the SFN Tick to L3
8228 * Function: rgSCHTomUtlSendSfnTick
8230 * @param [in] RgSchCellCb *cell
8233 PRIVATE Void rgSCHTomUtlSendSfnTick
8238 PRIVATE Void rgSCHTomUtlSendSfnTick (cell)
8242 RgrTtiIndInfo *rgrTtiInd;
8244 TRC2(rgSCHTomUtlSendSfnTick);
8246 /* TTI to be sent to RRM only once per system frame */
8247 /* Added support for period = 0 to disable tick to RRM */
8248 if ((cell->rrmTtiIndPrd != 0) &&
8249 ((cell->crntTime.sfn % cell->rrmTtiIndPrd) == 0) &&
8250 (cell->crntTime.slot == 0))
8252 /* Allocate a TTI indication structure and send to RRM over RGR interface */
8253 if (rgSCHUtlAllocSBuf (cell->instIdx,
8254 (Data**)&rgrTtiInd, sizeof(RgrTtiIndInfo)) != ROK)
8256 RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),
8257 "Mem alloc failed for RGR TTI ind, cellId (%d))\n",
8261 rgrTtiInd->cellId = cell->cellId;
8262 //rgrTtiInd->hSfn = cell->crntTime.hSfn;
8263 rgrTtiInd->sfn = cell->crntTime.sfn;
8265 if (rgSCHUtlRgrTtiInd (cell, rgrTtiInd) != ROK)
8267 RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),
8268 "Failed to send RGR TTI ind, cellId (%d))\n",
8270 rgSCHUtlFreeSBuf(cell->instIdx, (Data**)&rgrTtiInd,
8271 sizeof(RgrTtiIndInfo));
8281 /* @brief Mark Dyn TDD CrntSfIdx.
8285 * Function: rgSCHDynTDDMrkCrntSfIdx
8286 * Purpose: update the dyn tdd sunframe index
8287 * @param[in] Inst schInst
8292 PRIVATE Void rgSCHDynTDDMrkCrntSfIdx
8297 PRIVATE Void rgSCHDynTDDMrkCrntSfIdx(schInst)
8301 RgSchDynTddCb *rgSchDynTddInfo = &(rgSchCb[schInst].rgSchDynTdd);
8303 TRC2(rgSCHDynTDDMrkCrntSfIdx)
8305 RG_SCH_DYN_TDD_MARKTYPE(rgSchDynTddInfo, rgSchDynTddInfo->crntDTddSfIdx,
8306 RG_SCH_DYNTDD_NOTDEF);
8307 rgSchDynTddInfo->crntDTddSfIdx = (rgSchDynTddInfo->crntDTddSfIdx + 1) %
8308 RG_SCH_DYNTDD_MAX_SFINFO;
8310 //printf("Initializing Index %d \n", rgSchDynTddInfo->crntDTddSfIdx);
8316 /** @brief This function fills the TTI timinig info for each cell
8320 * Function: rgSchTomFillCellTtiInfo
8322 * @param [in] TfuTtiIndInfo *ttiInd
8323 * @param [in] Inst schInst
8324 * @param [out] U8 *nCell
8325 * @param [out] RgSchCellCb *cell[]
8332 PRIVATE Void rgSchTomFillCellTtiInfo
8334 TfuTtiIndInfo *ttiInd,
8337 RgSchCellCb *cells[]
8340 PRIVATE Void rgSchTomFillCellTtiInfo (ttiInd, schInst, nCell, cells)
8341 TfuTtiIndInfo *ttiInd;
8344 RgSchCellCb *cells[];
8349 TfuTtiCellInfo *cellInfo;
8353 CmLteTimingInfo frm;
8355 TRC2 (rgSchTomFillCellTtiInfo);
8357 if (CM_LTE_MAX_CELLS < ttiInd->numCells)
8363 rgSCHDynTDDMrkCrntSfIdx(schInst);
8366 for (i = 0; i < ttiInd->numCells; i++)
8368 cellInfo = &ttiInd->cells[i];
8369 strtCellId = rgSchCb[schInst].genCfg.startCellId;
8370 Idx1 = (U8)((cellInfo->cellId - strtCellId)&(CM_LTE_MAX_CELLS-1));
8371 cell = rgSchCb[schInst].cells[Idx1];
8372 /* Validate the cell */
8375 /* Use SCH inst 0 print buff */
8376 RGSCHDBGERRNEW(schInst,(rgSchPBuf(schInst),
8377 "RgLiTfuTtiInd()No cell exists for cellId %d\n",
8381 *nCell = *nCell + 1;
8382 cells[i] = (RgSchCellCb *)cell;
8385 if(cell->schTickDelta != cellInfo->schTickDelta)
8387 printf("\nMukesh: Delta changed for cellId=%d: curr delta=%d new delta=%d\n"
8388 "dlblankSf=%d ulblankSf=%d dummyTti=%d \n",
8389 cell->cellId, cell->schTickDelta, cellInfo->schTickDelta, cellInfo->dlBlankSf,cellInfo->ulBlankSf,
8390 cellInfo->isDummyTti);
8392 RGSCH_UPDATE_DELTA(schInst, cellInfo->schTickDelta);
8393 cell->schTickDelta = cellInfo->schTickDelta;
8396 cell->stopSiSch = cellInfo->dlBlankSf;
8397 cell->stopDlSch = cellInfo->dlBlankSf;
8398 cell->stopUlSch = cellInfo->ulBlankSf;
8399 if (cellInfo->isDummyTti)
8401 cell->stopDlSch = TRUE;
8403 if((0 == (cellInfo->timingInfo.sfn % 30)) && (0 == cellInfo->timingInfo.slot))
8405 //printf("5GTF_CHECK rgSCHTOMTtiInd (%d : %d)\n", cellInfo->timingInfo.sfn, cellInfo->timingInfo.slot);
8408 RGSCHCPYTIMEINFO(cellInfo->timingInfo, cell->crntTime);
8409 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->hiDci0Time,
8410 TFU_ULCNTRL_DLDELTA);
8411 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->dlDciTime,
8412 TFU_DLCNTRL_DLDELTA);
8413 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->rcpReqTime,
8414 TFU_RECPREQ_DLDELTA);
8415 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->hqRlsTime,
8416 TFU_HQFBKIND_ULDELTA);
8417 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->dlSfRlsTime,
8420 RGSCHCPYTIMEINFO_EMTC(cellInfo->timingInfo, cell->crntTime);
8421 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->hiDci0Time,
8422 TFU_ULCNTRL_DLDELTA);
8423 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->dlDciTime,
8424 TFU_DLCNTRL_DLDELTA);
8425 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->rcpReqTime,
8426 TFU_RECPREQ_DLDELTA);
8427 RGSCHDECRFRMCRNTTIME_EMTC(cell->crntTime, cell->hqRlsTime,
8428 TFU_HQFBKIND_ULDELTA);
8429 RGSCHDECRFRMCRNTTIME_EMTC(cell->crntTime, cell->dlSfRlsTime,
8432 rgSCHCmnUpdVars(cell);
8433 cell->isDlDataAllwd = TRUE;
8434 /* Get DownLink SubFrame */
8435 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
8436 frm = cell->crntTime;
8438 RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA);
8440 RGSCH_INCR_SUB_FRAME_EMTC(frm, RG_SCH_CMN_DL_DELTA);
8442 cellSch->dl.time = frm;
8448 U8 idx = (cell->crntTime.slot + RG_SCH_CMN_DL_DELTA) %
8449 RGSCH_NUM_SUB_FRAMES_5G;
8451 cell->isDlDataAllwd = RG_SCH_CMN_CHK_DL_DATA_ALLOWED(cell, idx);
8453 /*ccpu00130639 -ADD - used in UL HARQ proc id calculation*/
8454 if((cell->crntTime.sfn == 0) && (cell->crntTime.slot == 0))
8456 /* sfn Cycle used for Tdd UL Harq Proc Determination.
8457 This sfn Cycle will have values from 0 to numUl Harq-1. */
8458 cell->tddHqSfnCycle = (cell->tddHqSfnCycle + 1 ) %
8459 (rgSchTddUlNumHarqProcTbl[cell->ulDlCfgIdx]);
8463 if(cell->emtcEnable)
8465 rgSCHUtlEmtcResPrcTti(cell);
8471 void schFillCrntTime(
8472 SlotIndInfo slotInd,
8476 for(cellCount = 0; cellCount < CM_LTE_MAX_CELLS; cellCount++)
8479 cell = rgSchCb[schInst].cells[cellCount];
8481 RGSCHCPYTIMEINFO(slotInd, cell->crntTime);
8483 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->hiDci0Time,
8484 TFU_ULCNTRL_DLDELTA);
8485 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->dlDciTime,
8486 TFU_DLCNTRL_DLDELTA);
8487 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->rcpReqTime,
8488 TFU_RECPREQ_DLDELTA);
8489 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->hqRlsTime,
8490 TFU_HQFBKIND_ULDELTA);
8491 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->dlSfRlsTime,
8494 RGSCH_INCR_SUB_FRAME(cell->crntTime, RG_SCH_CMN_DL_DELTA);
8496 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
8497 cellSch->dl.time = cell->crntTime;
8501 /** @brief This function prepares the TTI for scheduling and
8502 * invokes the Common channel scheduler. Uplink scheduler
8503 * is invoked first if UL Scheduling at CRC is not enabled
8507 * Function: rgSchTomTtiUlAndDlCmnChSch
8509 * @param [out] RgSchCellCb *cell
8515 PRIVATE Void rgSchTomTtiUlAndDlCmnChSch
8520 PRIVATE Void rgSchTomTtiUlAndDlCmnChSch (cell)
8525 TRC2(rgSchTomTtiUlAndDlCmnChSch);
8527 cell->rlsHqArr[cell->crntHqIdx].numUes = 0;
8529 cell->crntHqIdx = cell->crntHqIdx % RGSCH_NUM_SUB_FRAMES;
8531 cmPrcTmr(&cell->tqCp, cell->tq, (PFV)rgSCHTmrProcTmr);
8532 rgSCHMeasGapANRepTtiHndl (cell);
8533 /* We need to fill the PHICH for the UL Data, first we need to get the UL
8534 * SF from Scheduler, next we fill the dlSf that goes out this TTI.
8535 * This must be performed prior to any other processing of the TTI
8536 * so that we do not wrap around and generate feedback prior to
8537 * reception of UL data.
8539 #ifndef RG_ULSCHED_AT_CRC
8542 U8 idx; /* Index into Uplink Sf array */
8544 Mval = rgSchTddPhichMValTbl[cell->ulDlCfgIdx]
8545 [cell->hiDci0Time.subframe];
8549 for(idx=0; idx < Mval; idx++)
8551 rgSCHCmnRlsUlSf(cell, idx);
8557 /* DTX processing for those Harq's which did not get feedback from L1 */
8558 rgSCHDhmRlsDlsfHqProc (cell, cell->hqRlsTime);
8559 /* Re-Init the Downlink subframe */
8560 rgSCHUtlDlRlsSubFrm(cell, cell->dlSfRlsTime);
8561 /* Added handling to retransmit
8562 * release PDCCH in case of DTX
8565 /*Check for DRX every TTI*/
8566 rgSCHDrxTtiInd(cell);
8568 /* For TDD, UL scheduling should happen after DL scheduling */
8570 #ifndef RG_ULSCHED_AT_CRC
8571 /* Perform UL scheduling */
8572 rgSCHCmnUlSch(cell);
8575 /* Perform DL scheduling for Common channels */
8576 rgSCHCmnDlCommonChSch(cell);
8581 /** @brief This function invokes the Non critical procedures like measurements,
8582 * and RGR configurations.
8586 * Function: rgSchTomTtiMiscFunctions
8588 * @param [in] RgSchCellCb *cell
8594 PRIVATE Void rgSchTomTtiMiscFunctions
8599 PRIVATE Void rgSchTomTtiMiscFunctions (cell)
8603 U8 suId = cell->tfuSap->sapCfg.suId;
8605 TRC2(rgSchTomTtiMiscFunctions);
8607 /* Invoke RAM Tti Handler */
8608 rgSCHRamTtiHndlr(cell);
8610 /* Handle RGR configurations */
8611 rgSCHGomTtiHndlr(cell, suId);
8613 if((RGM_PRB_REPORT_START == cell->prbUsage.prbRprtEnabld)
8614 && (!(cell->prbUsage.rprtPeriod) || ((glblTtiCnt % cell->prbUsage.rprtPeriod) == 0)))
8616 rgSCHUtlUpdAvgPrbUsage(cell);
8618 rgSCHL2Meas(cell,FALSE);
8621 /* LTE_ADV_FLAG_REMOVED_START */
8622 /* Report ABS Load information to application periodically */
8623 if((RGR_ENABLE == cell->lteAdvCb.absCfg.status) &&
8624 (cell->lteAdvCb.absCfg.absLoadPeriodicity))
8626 RgrLoadInfIndInfo *rgrLoadInf;
8629 cell->lteAdvCb.absLoadTtiCnt++;
8630 if(cell->lteAdvCb.absLoadTtiCnt >= cell->lteAdvCb.absCfg.absLoadPeriodicity)
8633 if(rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&rgrLoadInf,
8634 sizeof(RgrLoadInfIndInfo)) != ROK)
8636 RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),"Could not "
8637 "allocate memory for sending LoadInfo\n"));
8640 cell->lteAdvCb.absLoadTtiCnt = 0;
8641 rgrLoadInf->cellId = cell->cellId;
8642 rgrLoadInf->bw = cell->bwCfg.dlTotalBw;
8643 rgrLoadInf->type = RGR_ABS;
8644 for(idx= 0; idx<RGR_ABS_PATTERN_LEN; idx++)
8646 rgrLoadInf->u.absLoadInfo[idx] = cell->lteAdvCb.absLoadInfo[idx];
8647 cell->lteAdvCb.absLoadInfo[idx] = 0;
8649 rgSCHUtlRgrLoadInfInd(cell, rgrLoadInf);
8654 if(cell->isDlDataAllwd)
8656 /* Calling function to update CFI parameters*/
8657 rgSchCmnUpdCfiDb(cell, RG_SCH_CMN_DL_DELTA);
8661 /* Incrementing the ttiCnt in case of UL subframe */
8662 if(!cell->dynCfiCb.switchOvrInProgress)
8664 cell->dynCfiCb.ttiCnt++;
8668 rgSchCmnUpdCfiDb(cell, RG_SCH_CMN_DL_DELTA);
8671 /* LTE_ADV_FLAG_REMOVED_END */
8676 /** @brief This function invokes the Downlink scheduler
8680 * Function: rgSchTomTtiDlSch
8682 * @param [in] RgSchCellCb *cell
8688 PRIVATE Void rgSchTomTtiDlSch
8693 PRIVATE Void rgSchTomTtiDlSch (cell)
8697 TRC2(rgSchTomTtiDlSch);
8699 if (cell->isDlDataAllwd && (cell->stopDlSch == FALSE))
8701 rgSCHCmnDlSch(cell);
8707 /** @brief This function invokes Consolidates the allocations
8708 * send the Subframe allocation info to MAC
8712 * Function: rgSchTomTtiCnsldtSfAlloc
8714 * @param [in] RgSchCellCb *cell
8720 PRIVATE Void rgSchTomTtiCnsldtSfAlloc
8725 PRIVATE Void rgSchTomTtiCnsldtSfAlloc (cell)
8730 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
8732 dlSf = rgSCHUtlSubFrmGet(cell, cellSch->dl.time);
8734 TRC2(rgSchTomTtiCnsldtSfAlloc);
8736 /* Prepare Subframe allocation info and send to MAC */
8737 rgSCHCmnCnsldtSfAlloc(cell);
8739 /* Call ACK NACK module to add to dlsf Queue */
8740 rgSCHAckNakRepAddToQ(cell, dlSf);
8742 rgSCHTomUtlProcTA(cell);
8747 /** @brief This function prepares the DL and UL Config requests
8752 * Function: rgSchTomTtiL1DlAndUlCfg
8754 * @param [in] RgSchCellCb *cell
8760 PRIVATE Void rgSchTomTtiL1DlAndUlCfg
8763 RgTfuCntrlReqInfo *cntrlInfo
8766 PRIVATE Void rgSchTomTtiL1DlAndUlCfg (cell, cntrlInfo)
8768 RgTfuCntrlReqInfo *cntrlInfo;
8771 RgSchDlSf *dlSf = rgSCHUtlSubFrmGet (cell, cell->dlDciTime);
8772 RgSchDlSf *ulSf = rgSCHUtlSubFrmGet (cell, cell->hiDci0Time);
8775 TRC2(rgSchTomTtiL1DlAndUlCfg);
8777 rgSCHTomUtlProcDlSf (dlSf, ulSf, cell, cntrlInfo, &err);
8778 /* Mark this frame as sent */
8779 dlSf->txDone = TRUE;
8781 rgBwAlloInfo[dlSf->sfNum] += dlSf->bwAssigned;
8782 rgBwAlcnt[dlSf->sfNum] ++;
8786 rgSCHTomUtlProcTddUlSf(cell);
8788 rgSCHTomUtlProcUlSf (cell, &err);
8794 /** @brief This function prepares does the Downlink subframe re-init and
8795 * Harq DTX processing
8799 * Function: rgSchTomUtlTddRlsSfAndHarq
8801 * @param [in] RgSchCellCb *cell
8807 PRIVATE Void rgSchTomUtlTddRlsSfAndHarq
8812 PRIVATE Void rgSchTomUtlTddRlsSfAndHarq (cell)
8816 TRC2(rgSchTomUtlTddRlsSfAndHarq);
8818 /* ccpu00132341-MOD- rgSchTddRlsDlSubfrmTbl is dependent on DELTA(=2).
8819 * Instead rgSchTddDlAscSetIdxKTbl can be used as the K set gives proper
8821 /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper
8822 * output if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME()
8823 * as it is serving the purpose */
8824 if(rgSchTddDlAscSetIdxKTbl[cell->ulDlCfgIdx][cell->hqRlsTime.subframe].
8827 /* ccpu00132341-MOD- Providing the UL SF timing for avoiding
8828 * calculation inside the function */
8829 rgSCHDhmTddRlsSubFrm(cell, cell->hqRlsTime);
8830 rgSCHDhmRlsDlsfHqProc(cell, cell->hqRlsTime);
8835 /** @brief This function processes the UL subframe and fills TFU reception
8840 * Function: rgSCHTomUtlProcTddUlSf
8842 * @param [in] RgSchCellCb *cell
8848 PRIVATE Void rgSCHTomUtlProcTddUlSf
8853 PRIVATE Void rgSCHTomUtlProcTddUlSf (cell)
8859 TRC2(rgSCHTomUtlProcTddUlSf);
8861 if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
8862 [cell->rcpReqTime.subframe] == RG_SCH_TDD_UL_SUBFRAME)
8864 if (rgSCHTomUtlProcUlSf (cell, &err) != ROK)
8866 /* fill in err type and call sta ind */
8867 RGSCHDBGERRNEW(cell->instIdx, (rgSchPBuf(cell->instIdx),
8868 "Unable to process Uplink subframe for cellId (%d))\n",
8872 /* TDD Fix , to allow Special SF SRS CFg */
8873 else if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
8874 [cell->rcpReqTime.subframe] == RG_SCH_TDD_SPL_SUBFRAME)
8876 if (rgSCHTomUtlPrcUlTddSpclSf(cell, &err) != ROK)
8878 /* fill in err type and call sta ind */
8879 RGSCHDBGERRNEW(cell->instIdx, (rgSchPBuf(cell->instIdx),
8880 "Unable to process Sipceial subframe for cellId (%d))\n",
8890 /**********************************************************************
8893 **********************************************************************/