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"
86 EXTERN Bool rgSCHEmtcChkEmtcUe ARGS(
91 EXTERN Void rgSchTomTtiEmtcSched ARGS(
96 EXTERN S16 rgSCHEmtcRamVldtProcRaReq
101 TfuRaReqIndInfo *raReqInd,
106 EXTERN Void rgSCHEmtcUpdCqiInfo
109 RgSchUePCqiCb *cqiCb,
112 EXTERN Void rgSCHEmtcUpdSRInfo
117 EXTERN Void rgSCHCmnEmtcHdlCrcFailInd
122 EXTERN S16 rgSCHEmtcTomUtlProcAtCrc
125 CmLteTimingInfo crntHiDci0Frm,
126 TfuCntrlReqInfo *cntrlInfo,
129 EXTERN Void rgSCHEmtcInitUeRecpReqLst
131 TfuRecpReqInfo *recpReqInfo
133 EXTERN Void rgSCHEmtcFillPucchRecpInfo
136 RgSchDlHqProcCb *hqCb,
139 EXTERN Bool rgSCHEmtcAddRecpInfoToLst
141 RgSchDlHqProcCb *hqCb,
142 TfuRecpReqInfo *recpReqInfo,
143 TfuUeRecpReqInfo *pucchRecpInfo,
146 EXTERN Void rgSCHEmtcWillUeRptCqi
151 EXTERN Void rgSchEmtcTomTtiCnsldtSfAlloc
156 EXTERN S16 rgSchEmtcTomTtiL1DlAndUlCfg
159 RgTfuCntrlReqInfo *cntrlInfo
162 EXTERN S16 rgSCHTomEmtcUtlFillDatRecpReq
164 TfuRecpReqInfo *recpReqInfo,
170 EXTERN S16 rgSCHEmtcTomUtlFillHqFdbkRecpReq
172 TfuRecpReqInfo *recpReqInfo,
178 EXTERN S16 rgSCHEmtcDhmRlsDlsfHqProc
181 CmLteTimingInfo timingInfo
184 EXTERN Void rgSCHEmtcCmnUlSch
189 #ifdef RG_ULSCHED_AT_CRC
190 EXTERN S16 rgSCHEmtcTomUtlProcDlSfAtCrc
193 CmLteTimingInfo crntUlFrm,
195 TfuCntrlReqInfo *cntrlInfo,
199 EXTERN RgSchEmtcDlSf* rgSCHEmtcUtlSubFrmGet
206 EXTERN U32 gDlMpdcchBlank;
207 EXTERN U32 gUlMpdcchBlank;
208 EXTERN S16 rgSCHUtlIotResPrcTti
215 EXTERN RgSchUeCb* rgSCHCmnGetHoUe
220 EXTERN RgSchUeCb* rgSCHCmnGetPoUe
224 CmLteTimingInfo timingInfo
226 PUBLIC S16 rgSCHTomUtlFillDatAperRecpReq ARGS(
231 TfuUeRecpReqInfo *datRecpInfo,
232 CmLteTimingInfo *timeInfo,
237 PUBLIC S16 rgSCHTomUtlFillDatPriRecpReq ARGS(
241 TfuUeRecpReqInfo *datRecpInfo,
242 CmLteTimingInfo *timeInfo,
247 PUBLIC S16 rgSCHTomUtlFillDatPCqiRecpReq ARGS(
251 TfuUeRecpReqInfo *datRecpInfo,
252 CmLteTimingInfo *timeInfo,
257 PUBLIC S16 rgSCHTomUtlFillDatSrsRecpReq ARGS(
261 TfuUeRecpReqInfo *datRecpInfo,
262 CmLteTimingInfo *timeInfo,
266 PUBLIC void schFillCrntTime(
271 EXTERN U32 delayedApiCnt;
272 U32 gPCellTb1AckCount=0,gPCellTb2AckCount=0,gPCellTb1NackCount=0,gPCellTb2NackCount=0;
273 U32 gSCellSchedCount=0,gPrimarySchedCount=0;
274 U32 gSCellTb1AckCount=0,gSCellTb2AckCount=0,gSCellTb1NackCount=0,gSCellTb2NackCount=0;
275 U32 gPCellTb1DtxCount = 0, gPCellTb2DtxCount = 0, gSCellTb1DtxCount = 0, gSCellTb2DtxCount = 0;
276 U32 gHqFdbkCount = 0;
280 U32 gCqiRecpCount = 0;
281 U32 gCqiRecpPuschCount = 0;
282 U32 gCqiRcvdCount = 0;
283 Bool gF1bCsPres = FALSE;
285 U32 gCqiReqCount = 0;
287 U32 gACqiRcvdCount = 0;
288 U32 gCqiReptToAppCount = 0;
289 U32 gRawACqiCount= 0;
290 U32 gCqiDropCount,gPucchDropCount;
291 U32 gCqiPucchLowSnrDropCount,gCqiPucchConfMaskDropCount,gCqiPuschConfMaskDropCount;
293 U32 gUlCrcFailCount = 0;
294 U32 gUlCrcPassCount = 0;
295 U32 gPuschCqiDropCount = 0;
296 U32 gCaDbgCaFrmt = 0;
297 U32 gCaDbgNonCaFrmt = 0;
298 U32 gPcellZeroBoOcc=0,gScellZeroBoOcc=0, dbgDelayedDatReqInMac=0,gDropDatReqCnt=0, gIccPktRcvrMemDropCnt=0;
302 U32 gUlCrcFailCounter = 0;
303 U32 gUlCrcPassCounter = 0;
307 EXTERN U32 gUl5gtfPdcchSend;
312 PRIVATE S16 rgSCHTomUtlFillCqiSrsWithSr ARGS
316 TfuRecpReqInfo *recpReqInfo,
317 TfuUeRecpReqInfo *pucchRecpInfo,
320 PRIVATE Bool rgSCHTomUtlFillDatHarqRecpReq ARGS
324 TfuUeRecpReqInfo *datRecpInfo,
325 TfuRecpReqInfo *recpReqInfo
327 PRIVATE S16 rgSCHTomUtlFillSrRecpReq ARGS((
328 TfuRecpReqInfo *recpReq,
332 PRIVATE S16 rgSCHTomUtlFillRiRecpReq ARGS((
333 TfuRecpReqInfo *recpReq,
337 PRIVATE S16 rgSCHTomUtlFillPcqiRecpReq ARGS((
338 TfuRecpReqInfo *recpReq,
342 PRIVATE S16 rgSCHTomUtlFillSrsRecpReq ARGS((
343 TfuRecpReqInfo *recpReq,
347 PRIVATE S16 rgSCHTomUtlGenIndices ARGS((
352 TfuSubbandInfo* sbInfo));
354 PRIVATE S16 rgSCHTomUtlFillCqiRiRecpReq ARGS(
356 TfuRecpReqInfo *recpReqInfo,
361 PRIVATE Void rgSchTomFillCellTtiInfo ARGS
363 TfuTtiIndInfo *ttiInd,
371 PUBLIC U32 rgBwAlloInfo[RGSCH_NUM_SUB_FRAMES]; /* Num of Rbs Allocated in each SF */
372 PUBLIC U32 rgBwAlcnt[RGSCH_NUM_SUB_FRAMES]; /*Num of times Allocation done in each Subframe */
375 /* rg006.201: [ccpu000111706, ccpu00112394]: Separated UL and DL TTI
382 U32 gDlNumUePerTti[20] = {0};
383 U32 gUlNumUePerTti[20] = {0};
384 PRIVATE S16 rgSCHTomUtlProcDlSf ARGS((
388 RgTfuCntrlReqInfo *cntrlInfo,
390 #ifdef RG_ULSCHED_AT_CRC
391 PRIVATE S16 rgSCHTomUtlProcDlSfAtCrc ARGS((
393 CmLteTimingInfo crntUlFrm,
395 TfuCntrlReqInfo *cntrlInfo,
397 #endif /* RG_ULSCHED_AT_CRC */
400 PRIVATE S16 rgSCHTomUtlPrcUlTddSpclSf ARGS((
403 #endif /* TFU_UPGRADE */
405 PRIVATE S16 rgSCHTomUtlFillPhich ARGS((
407 TfuCntrlReqInfo *cntrlInfo,
411 PRIVATE S16 rgSCHTomUtlFillDlPdcch ARGS((
413 TfuCntrlReqInfo *cntrlInfo,
416 PRIVATE S16 rgSCHTomUtlFillUlPdcch ARGS((
418 TfuCntrlReqInfo *cntrlInfo,
422 PRIVATE S16 rgSCHTomUtlProcTA ARGS((
425 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq ARGS((
426 TfuRecpReqInfo *recpReq,
431 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq ARGS((
432 TfuRecpReqInfo *recpReq,
438 PUBLIC S16 rgSCHTomFillOnlySrsRecpReq ARGS
442 TfuUeRecpReqInfo *datRecpInfo
444 PRIVATE S16 rgSCHTomUtlFillCqiSrSrsWithHq ARGS
447 TfuRecpReqInfo *recpReqInfo,
449 TfuUeRecpReqInfo *pucchRecpInfo,
451 Bool isDatPresOnSecCell
454 PUBLIC S16 rgSCHTomUtlFillRiBitWidthInfo ARGS
459 PUBLIC U8 rgSCHTomUtlFetchPcqiBitSz ARGS
466 PUBLIC U8 rgSCHTomUtlFetchPcqiBitSzPucchMode21 ARGS
469 TfuCqiPucchMode21 *mode21Info,
474 PUBLIC S16 rgSCHTomUtlMoveNxtOccasion ARGS
481 PRIVATE S16 rgSCHTomUtlMovePcqiNxtOccasion ARGS
488 PRIVATE S16 rgSCHTomUtlMovePriNxtOccasion ARGS
495 PRIVATE S16 rgSCHTomUtlMoveSrNxtOccasion ARGS
501 PRIVATE S16 rgSCHTomUtlMoveSrsNxtOccasion ARGS
506 PRIVATE S16 rgSCHTomUtlWillUeRprtCqiRi ARGS((
508 Bool *willueRprtCqiRii));
511 PRIVATE S16 rgSCHTomUtlFillDatRecpReq ARGS((
512 TfuRecpReqInfo *recpReq,
517 PRIVATE S16 rgSCHTomUtlFillDatRecpReq ARGS((
518 TfuRecpReqInfo *recpReq,
525 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk ARGS((
526 TfuRecpReqInfo *recpReqInfo,
537 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk ARGS((
538 TfuRecpReqInfo *recpReqInfo,
549 PRIVATE S16 rgSCHTomUtlFillSfHqFdbk ARGS((
550 TfuRecpReqInfo *recpReqInfo,
561 PRIVATE S16 rgSCHTomUtlFillSfHqFdbk ARGS((
562 TfuRecpReqInfo *recpReqInfo,
573 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForOneUe ARGS((
574 RgSchDlHqProcCb *hqCb,
575 TfuRecpReqInfo *recpReqInfo,
584 RgrTddAckNackMode ackNackMode,
585 RgSchUePucchRecpInfo **pucchInfoRef,
593 EXTERN PUBLIC Void rgSCHCmnDlSpsSch (RgSchCellCb *cell);
597 PRIVATE S16 rgSCHTomCnsdrRelPdcch ARGS
601 TfuRecpReqInfo *recpReqInfo,
606 PRIVATE S16 rgSCHTomCnsdrRelPdcch ARGS
610 TfuRecpReqInfo *recpReqInfo,
618 PRIVATE Void rgSchTomTtiMiscFunctions ARGS
623 PRIVATE Void rgSchTomTtiUlAndDlCmnChSch ARGS
628 PRIVATE Void rgSchTomTtiDlSch ARGS
633 PRIVATE Void rgSchTomTtiCnsldtSfAlloc ARGS
638 PRIVATE Void rgSchTomTtiL1DlAndUlCfg ARGS
641 RgTfuCntrlReqInfo *cntrlInfo
645 PRIVATE Void rgSCHTomUtlSendSfnTick ARGS
651 PRIVATE Void rgSchTomUtlTddRlsSfAndHarq ARGS
655 PRIVATE Void rgSCHTomUtlProcTddUlSf ARGS
660 PRIVATE Void rgSCHTomUtlGethqRes ARGS
668 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1 ARGS
670 RgSchDlHqProcCb *hqCb,
671 TfuUePucchRecpReq *hqRecpReq,
677 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234 ARGS
679 RgSchDlHqProcCb *hqCb,
680 TfuUePucchRecpReq *hqRecpReq,
690 PUBLIC U32 rgDlCqiRptCnt[16], rgTotDlCqiRpt;
693 U32 rgSch5gtfCqi2Mcs[15] =
694 {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14};
696 /* forward references */
698 /*HARQ Feedback interpretation in accordance with Femto Forum.
699 Note: There is no value as '0' in Femto Forum Spec but in order to retain
700 the existing usage in MAC (and its Acceptance), its being considered*/
701 CONSTANT PRIVATE U8 rgSchTomHqFbkMap[8] = {0,1,0,0,4,4,4,4};
702 /*added #defines instead of magic numbers*/
703 CONSTANT PRIVATE U32 rgSCHTomBinCoe[RG_SCH_MAX_NUM_UE_SEL_SUBBANDS][RG_SCH_MAX_TOT_NUM_SUBBANDS]={
704 {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},
705 {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},
706 {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},
707 {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},
708 {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},
709 {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}
713 /*ccpu00116923 - ADD - SRS present support*/
714 /*Tables Derived from 3GPP TS 36.211 Section 5.5.3.3 */
715 /* Table 5.5.3.3-1 */
717 CONSTANT PUBLIC RgSchFddCellSpSrsSubfrmTbl rgSchFddCellSpSrsSubfrmTbl = {
718 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE},
719 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE},
720 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE},
721 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE},
722 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
723 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE},
724 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE},
725 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE},
726 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE},
727 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
728 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
729 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
730 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
731 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE},
732 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE},
733 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}
736 /* Table 5.5.3.3-2 */
737 CONSTANT PUBLIC RgSchTddCellSpSrsSubfrmTbl rgSchTddCellSpSrsSubfrmTbl = {
738 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
739 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE},
740 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE},
741 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE},
742 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE},
743 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE},
744 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE},
745 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE},
746 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
747 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
748 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE},
749 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE},
750 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE},
751 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE},
752 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
753 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}
756 PUBLIC S8 rgSchCmnAper20n22DiffCqi[4] = {1, 2, 3, 4};
757 PUBLIC S8 rgSchCmnAper30n31DiffCqi[4] = {0, 1, 2, -1};
761 * @brief get Ue for dedicated preamble rach
765 * Function: rgSCHGetDedPrmUe
767 * Invoked by: rgSCHTomRaReqInd
769 * @param[in] RgSchCellCb *cell
770 * @param[in] TfuRaReqIndInfo *raReqInd
776 PUBLIC S16 rgSCHGetDedPrmUe
780 CmLteTimingInfo timingInfo,
784 PUBLIC S16 rgSCHGetDedPrmUe(cell, rapId, timingInfo, ue)
787 CmLteTimingInfo timingInfo;
791 RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch);
793 printf("rapId[%d] cellSch->rachCfg.dedPrmStart[%d] cellSch->rachCfg.numDedPrm[%d]\n",rapId,cellSch->rachCfg.dedPrmStart,cellSch->rachCfg.numDedPrm);
794 /* Finding UE in handOver List */
795 if ((rapId < cellSch->rachCfg.dedPrmStart) ||
796 (rapId > cellSch->rachCfg.dedPrmStart +
797 cellSch->rachCfg.numDedPrm - 1))
799 /* This ded Preamble corresponds to handover */
800 *ue = rgSCHCmnGetHoUe(cell, rapId);
801 printf(" his ded Preamble corresponds to hando\n");
803 else/* Finding UE from PDCCH Order Mappings */
805 /* Get the UE which has transmitted this RaReq */
806 *ue = rgSCHCmnGetPoUe(cell, rapId, timingInfo);
807 printf(" ==== inding UE from PDCCH Order Mapping\n");
812 * @brief Handler for processing Random Access request indication
817 * Function: rgSCHTomRaReqInd
819 * Handler for processing Random Access request indication recieved from
822 * Invoked by: RgLiTfuRaReqInd of LIM
825 * - Validate the information received: cellId value and raRnti values
826 * - Process the request: Call rgSCHRamProcRaReq (cell, raRnti, raReqInd)
828 * @param[in] RgSchCellCb *cell
829 * @param[in] TfuRaReqIndInfo *raReqInd
835 PUBLIC S16 rgSCHTomRaReqInd
838 TfuRaReqIndInfo *raReqInd
841 PUBLIC S16 rgSCHTomRaReqInd(cell, raReqInd)
843 TfuRaReqIndInfo *raReqInd;
850 Bool isEmtcUe = FALSE;
852 RgSchUeCb *ue = NULLP;
854 TRC2(rgSCHTomRaReqInd);
856 if(cell->cellId != raReqInd->cellId)
858 err.errType = RGSCHERR_TOM_RAREQIND;
859 err.errCause = RGSCHERR_TOM_INV_CELL_ID;
860 RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,
861 "rgSCHTomRaReqInd(): No cell found with raReq cellId = (%d) errorType (%d)"
862 " errorCause(%d)",raReqInd->cellId, err.errType, err.errCause);
866 for (raRntiCnt = 0; raRntiCnt < raReqInd->nmbOfRaRnti; raRntiCnt++)
868 for (raReqCnt = 0; raReqCnt < raReqInd->rachInfoArr->numRaReqInfo; raReqCnt++)
870 rapId = raReqInd->rachInfoArr[raRntiCnt].raReqInfoArr[raReqCnt].rapId;
872 if(RGSCH_IS_DEDPRM(cell, rapId))
874 rgSCHGetDedPrmUe(cell, rapId, raReqInd->timingInfo, &ue);
877 /* Since rapId is within dedicated range and No ue context
878 * is found means it is a spurious rach. So ignore it.*/
883 if(FALSE == isEmtcUe)
885 #if (ERRCLASS & ERRCLS_DEBUG)
886 if(raReqInd->rachInfoArr[raRntiCnt].raRnti > RGSCH_MAX_RA_RNTI)
888 RGSCHLOGERROR(cell->instIdx, ERRCLS_INT_PAR, ERG013,
889 (ErrVal)raReqInd->rachInfoArr[raRntiCnt].raRnti,
890 ("rgSCHTomRaReqInd(): raRnti is out of range\n"));
894 ret = rgSCHRamProcRaReq(raReqCnt, cell, raReqInd->rachInfoArr[raRntiCnt].raRnti,
895 (TfuRachInfo *)&raReqInd->rachInfoArr[raRntiCnt],
896 raReqInd->timingInfo, ue, &err);
899 err.errType = RGSCHERR_TOM_RAREQIND;
900 RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,
901 "RARNTI:%d rgSCHTomRaReqInd(): RAM processing failed errType(%d) "
902 "errCause(%d)", raReqInd->rachInfoArr[raRntiCnt].raRnti,
903 err.errType, err.errCause);
910 } /* rgSCHTomRaReqInd */
914 * @brief Handler for processing uplink CQI indication recieved from PHY.
918 * Function: rgSCHTomUlCqiInd
920 * Handler for processing uplink CQI indication recieved from PHY.
922 * Invoked by: RgLiTfuUlCqiInd
926 * - Invoke scheduler to push reported CQI info rgSCHUtlUlCqiInd
928 * @param[in] RgSchCellCb *cell
929 * @param[in] TfuUlCqiIndInfo *ulCqiInd
935 PUBLIC S16 rgSCHTomUlCqiInd
938 TfuUlCqiIndInfo *ulCqiInd
941 PUBLIC S16 rgSCHTomUlCqiInd(cell, ulCqiInd)
943 TfuUlCqiIndInfo *ulCqiInd;
948 TfuUlCqiRpt *ulCqiInfo;
949 TRC2(rgSCHTomUlCqiInd);
951 node = ulCqiInd->ulCqiRpt.first;
952 if(cell->cellId != ulCqiInd->cellId)
954 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
955 "rgSCHTomUlCqiInd() Unable to get the ulCqiInd cell with id(%d)",
960 for (;node; node=node->next)
962 ulCqiInfo = (TfuUlCqiRpt *)node->node;
963 #if (ERRCLASS & ERRCLS_DEBUG)
964 if(ulCqiInfo->numSubband == 0)
966 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Num Subband is"
967 "out of range RNTI:%d",ulCqiInfo->rnti);
971 if((ue = rgSCHDbmGetUeCb(cell, ulCqiInfo->rnti)) == NULLP)
974 if((ue = rgSCHDbmGetSpsUeCb(cell, ulCqiInfo->rnti)) == NULLP)
977 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get "
978 "the ue for RNTI:%d", ulCqiInfo->rnti);
982 /* wideband cqi is directly reported now. and also isTxPort0 */
983 rgSCHUtlUlCqiInd(cell, ue, ulCqiInfo);
986 } /* rgSCHTomUlCqiInd */
989 * @brief Handler for processing PUCCH power adjustment indication
993 * Function: rgSCHTomPucchDeltaPwrInd
995 * Handler for processing PUCCH power adjustment indication
998 * Invoked by: RgLiTfuPucchDeltaPwrInd
1002 * - Invoke scheduler to push reported CQI info rgSCHUtlPucchDeltaPwrInd
1004 * @param[in] RgSchCellCb *cell
1005 * @param[in] TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
1011 PUBLIC S16 rgSCHTomPucchDeltaPwrInd
1014 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
1017 PUBLIC S16 rgSCHTomPucchDeltaPwrInd(cell, pucchDeltaPwr)
1019 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr;
1024 TfuPucchDeltaPwr *ueElem;
1026 TRC2(rgSCHTomPucchDeltaPwrInd);
1028 if(cell->cellId != pucchDeltaPwr->cellId)
1030 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1031 "rgSCHTomPucchDeltaPwrInd() Unable to get the pucchDeltaPwr cell with id(%d)",
1032 pucchDeltaPwr->cellId);
1036 node = pucchDeltaPwr->pucchDeltaPwrLst.first;
1037 for (;node; node=node->next)
1039 ueElem = (TfuPucchDeltaPwr *)node->node;
1040 if((ue = rgSCHDbmGetUeCb(cell, ueElem->rnti)) == NULLP)
1043 if((ue = rgSCHDbmGetSpsUeCb(cell, ueElem->rnti)) == NULLP)
1046 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d "
1047 "rgSCHTomPucchDeltaPwrInd() Unable to get the ue ",
1052 rgSCHUtlPucchDeltaPwrInd(cell, ue, ueElem->pucchDeltaPwr);
1055 } /* rgSCHTomPucchDeltaPwrInd */
1058 * @brief Handler for processing harq ACK/NACK indication recieved from PHY.
1062 * Function: rgSCHTomHarqAckInd
1064 * Handler for processing harq ACK/NACK indication recieved from PHY.
1066 * Invoked by: RgLiTfuHqInd
1069 * For each HqAckInfo received
1071 * - If UE doesnt exist look for a RaCb and invoke rgSCHRamMsg4FdbkInd
1072 * - Invoke HARQ module to pass HARQ-ACK info rgSCHDhmHqFdbkInd
1074 * @param[in] TfuHqIndInfo *harqAckInd
1080 PUBLIC S16 rgSCHTomHarqAckInd
1083 TfuHqIndInfo *harqAckInd
1086 PUBLIC S16 rgSCHTomHarqAckInd(cell, harqAckInd)
1088 TfuHqIndInfo *harqAckInd;
1099 RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1101 RgSchCellCb *iterCellP;
1103 TRC2(rgSCHTomHarqAckInd);
1105 if(cell->cellId != harqAckInd->cellId)
1107 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() Unable to get"
1108 " the cell for cellId (%d)", harqAckInd->cellId);
1109 err.errType = RGSCHERR_TOM_HARQACKIND;
1110 err.errCause = RGSCHERR_TOM_INV_CELL_ID;
1114 node = harqAckInd->hqIndLst.first;
1115 for (;node; node=node->next)
1117 hqInfo = (TfuHqInfo *)node->node;
1119 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1120 TfuHqFdbk fdbk = hqInfo->isAck[0];
1121 raCb = rgSCHDbmGetRaCb (cell, hqInfo->rnti);
1122 ue = rgSCHDbmGetUeCb (cell, hqInfo->rnti);
1123 if (ue != NULLP && raCb == NULLP)
1125 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, harqAckInd->timingInfo, fdbk, &err)) != ROK)
1127 err.errType = RGSCHERR_TOM_HARQACKIND;
1128 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
1129 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1130 err.errType, err.errCause);
1138 if ((rgSCHDhmRlsDlsfHqProc (cell, harqAckInd->timingInfo)) != ROK)
1140 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink "
1141 "subframe for cellId (%d) ", cell->cellId);
1142 err.errType = RGSCHERR_TOM_HARQACKIND;
1145 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
1147 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
1149 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
1151 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
1152 if(rlsHqBufs->numUes)
1154 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
1155 RgSchMacRlsHq (&pst, rlsHqBufs);
1157 rlsHqBufs->numUes = 0;
1161 rlsHqBufs->numUes = 0;
1162 node = harqAckInd->hqIndLst.first;
1163 for (;node; node=node->next)
1165 hqInfo = (TfuHqInfo *)node->node;
1166 for(tbCnt=0; tbCnt<TFU_MAX_HARQ_FDBKS; tbCnt++)
1168 hqInfo->isAck[tbCnt]=(TfuHqFdbk)rgSchTomHqFbkMap[hqInfo->isAck[tbCnt]];
1170 raCb = rgSCHDbmGetRaCb (cell, hqInfo->rnti);
1171 ue = rgSCHDbmGetUeCb (cell, hqInfo->rnti);
1172 if (ue == NULLP && raCb != NULLP)
1175 rgSCHRamMsg4FdbkInd (raCb);
1177 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1178 cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
1180 err.errType = RGSCHERR_TOM_HARQACKIND;
1181 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1182 " feedback processing failed errType(%d) errCause(%d)",
1183 err.errType, err.errCause);
1188 else if (ue != NULLP && raCb == NULLP)
1190 /* Get the Downlink HARQ entity from ue */
1191 if ((rgSCHDhmHqFdbkInd (ue, RGSCH_HQ_FDB_IND_CB_TYPE_HQ_ENT,
1192 cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
1194 err.errType = RGSCHERR_TOM_HARQACKIND;
1195 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
1196 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1197 err.errType, err.errCause);
1201 else if (ue != NULLP && raCb != NULLP)
1203 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1204 cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
1206 err.errType = RGSCHERR_TOM_HARQACKIND;
1207 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1208 " feedback processing failed errType(%d) errCause(%d).",
1209 err.errType, err.errCause);
1215 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
1216 "UE CB or RA CB ", hqInfo->rnti);
1217 err.errType = RGSCHERR_TOM_HARQACKIND;
1222 /* Check with TDD call DHM*/
1223 if ((rgSCHDhmRlsDlsfHqProc (cell, harqAckInd->timingInfo)) != ROK)
1225 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink "
1226 "subframe for cellId (%d) ", harqAckInd->cellId);
1227 err.errType = RGSCHERR_TOM_HARQACKIND;
1230 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
1232 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
1234 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
1236 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
1237 if(rlsHqBufs->numUes)
1239 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
1240 RgSchMacRlsHq (&pst, rlsHqBufs);
1242 rlsHqBufs->numUes = 0;
1247 } /* rgSCHTomHarqAckInd */
1251 * @brief Handler for processing Scheduling Request indication
1252 * recieved from PHY for a list of UEs.
1256 * Function: rgSCHTomSrInd
1258 * Handler for processing Scheduling Request indication recieved from PHY
1261 * Invoked by: RgLiTfuSrInd
1265 * - Invoke scheduler to indicate SR rgSCHUtlSrRcvd
1267 * @param[in] TfuSrIndInfo *srInd
1273 PUBLIC S16 rgSCHTomSrInd
1279 PUBLIC S16 rgSCHTomSrInd(cell, srInd)
1281 TfuSrIndInfo *srInd;
1290 TRC2(rgSCHTomSrInd);
1292 if(cell->cellId != srInd->cellId)
1294 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for srcInd cellId"
1295 ":%d ", srInd->cellId);
1296 err.errType = RGSCHERR_TOM_SRIND;
1297 err.errCause = RGSCHERR_TOM_INV_CELL_ID;
1302 node = srInd->srLst.first;
1303 for (;node; node=node->next)
1307 srInfo = (TfuSrInfo *)node->node;
1308 ue = rgSCHDbmGetUeCb (cell, srInfo->rnti);
1311 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB",
1315 rgSCHUtlHdlUlTransInd(cell, ue, srInd->timingInfo);
1316 /*Need to activate UE as SR received*/
1317 if (ue->isDrxEnabled)
1319 rgSCHDrxSrInd(cell, ue);
1321 ret = rgSCHUtlSrRcvd (cell, ue, srInd->timingInfo, &err);
1324 err.errType = RGSCHERR_TOM_SRIND;
1325 RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,"Scheduler processing failed "
1326 "errType(%d) errCause(%d) RNTI:%d", err.errType, err.errCause,srInfo->rnti);
1331 } /* end of rgSCHTomSrInd */
1334 * @brief Handler for processing downlink CQI indication recieved from
1339 * Function: rgSCHTomDoaInd
1341 * Handler for processing DOA recieved from PHY
1344 * Invoked by: RgLiTfuDoaInd
1348 * - Invoke scheduler to indicate DOA rgSCHUtlDoaInd
1350 * @param[in] TfuDoaIndInfo *doaInd
1356 PUBLIC S16 rgSCHTomDoaInd
1359 TfuDoaIndInfo *doaInd
1362 PUBLIC S16 rgSCHTomDoaInd(cell, doaInd )
1364 TfuDoaIndInfo *doaInd;
1370 TRC2(rgSCHTomDoaInd);
1372 if(cell->cellId != doaInd->cellId)
1374 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for doaInd cellId"
1375 ":%d", doaInd->cellId);
1380 node = doaInd->doaRpt.first;
1381 for (;node; node=node->next)
1383 doaInfo = (TfuDoaRpt *)node->node;
1384 ue = rgSCHDbmGetUeCb (cell, doaInfo->rnti);
1387 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB",
1391 rgSCHUtlDoaInd(cell, ue, doaInfo);
1394 } /* rgSCHTomDoaInd */
1396 * @brief Handler for processing downlink CQI indication recieved from
1401 * Function: rgSCHTomDlCqiInd
1403 * Handler for processing downlink CQI indication recieved from PHY
1406 * Invoked by: RgLiTfuDlCqiInd
1410 * - Invoke scheduler to indicate DL CQI rgSCHUtlDlCqiInd
1412 * @param[in] TfuDlCqiIndInfo *dlCqiInd
1418 PUBLIC S16 rgSCHTomDlCqiInd
1421 TfuDlCqiIndInfo *dlCqiInd
1424 PUBLIC S16 rgSCHTomDlCqiInd(cell, dlCqiInd)
1426 TfuDlCqiIndInfo *dlCqiInd;
1431 TfuDlCqiRpt *dlCqiInfo;
1432 TRC2(rgSCHTomDlCqiInd);
1434 if(cell->cellId != dlCqiInd->cellId)
1436 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
1437 ":%d", dlCqiInd->cellId);
1442 node = dlCqiInd->dlCqiRptsLst.first;
1443 for (;node; node=node->next)
1445 dlCqiInfo = (TfuDlCqiRpt *)node->node;
1446 ue = rgSCHDbmGetUeCb (cell, dlCqiInfo->rnti);
1449 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%dUnable to get the UE CB",
1453 rgSCHUtlDlCqiInd(cell, ue, dlCqiInfo, dlCqiInd->timingInfo);
1454 rgSCHUtlHdlUlTransInd(cell, ue, dlCqiInd->timingInfo);
1457 } /* rgSCHTomDlCqiInd */
1460 * @brief Handler for moving PCQI instance for the next periodic occasion
1464 * Function: rgSCHTomUtlMovePcqiNxtOccasion
1466 * Handler for moving PCQI instance for the next periodic occasion
1468 * Invoked by: rgSCHTomUtlFill*
1471 * - For a UE move its occurence instance to next occasion
1472 * depending on its periodicity
1473 * - Remove it from the current list and insert it to the list
1474 * having the index matching with the derived number.
1476 * @param[in] RgSchCellCb *cell,
1477 * [in] RgSchUeCb *ue
1483 PRIVATE S16 rgSCHTomUtlMovePcqiNxtOccasion
1487 RgSchUePCqiCb *cqiCb
1490 PRIVATE S16 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb)
1493 RgSchUePCqiCb *cqiCb;
1498 CmLteTimingInfo timingInfo;
1499 TRC2(rgSCHTomUtlMovePcqiNxtOccasion);
1501 if(cqiCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_SB_REP)
1504 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timingInfo, TFU_DELTA);
1506 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timingInfo,
1507 TFU_RECPREQ_DLDELTA);
1509 RG_SCH_ADD_TO_CRNT_TIME(timingInfo,timingInfo,cqiCb->cqiPeri);
1510 rgSCHTomUtlPcqiSbCalcBpIdx(timingInfo,ue,cqiCb);
1512 /* Compute Next Transmission Instance */
1513 cqiIdx = cqiCb->cqiPeri + cqiCb->nCqiTrIdx;
1514 cqiIdx = cqiIdx%RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1515 /* Delete from current List and move to new list */
1516 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst,
1519 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to remove node",
1522 cqiCb->nCqiTrIdx = cqiIdx;
1523 cmLListAdd2Tail(&(cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst),
1524 &(cqiCb->cqiLstEnt));
1526 rgSCHUtlSCellHndlCqiCollsn(cqiCb);
1530 } /* rgSCHTomUtlMovePcqiNxtOccasion */
1533 * @brief Handler for moving RI instance for the next periodic occasion
1537 * Function: rgSCHTomUtlMovePriNxtOccasion
1539 * Handler for moving PCQI instance for the next periodic occasion
1541 * Invoked by: rgSCHTomUtlFill*
1544 * - For a UE move its occurence instance to next occasion
1545 * depending on its periodicity
1546 * - Remove it from the current list and insert it to the list
1547 * having the index matching with the derived number.
1549 * @param[in] RgSchCellCb *cell,
1550 * [in] RgSchUeCb *ue
1556 PRIVATE S16 rgSCHTomUtlMovePriNxtOccasion
1563 PRIVATE S16 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb)
1566 RgSchUePCqiCb *riCb;
1576 TRC2(rgSCHTomUtlMovePriNxtOccasion);
1577 crntTime = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)
1578 +(cell->crntTime.slot);
1579 #ifdef XEON_SPECIFIC_CHANGES
1580 RGSCHCPYTIMEINFO(cell->crntTime, ue->riRecpTime);
1582 /* Compute Next Transmission Instance */
1583 if (riCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_WB_REP)
1585 effPeriodicity = riCb->cqiPeri * riCb->riPeri;
1586 tempIdx = effPeriodicity + riCb->nRiTrIdx;
1590 effPeriodicity = (riCb->h * riCb->cqiPeri * riCb->riPeri);
1591 /* In case of SFN wraparound, the SB CQI reporting cycle breaks
1592 * and RI->WB CQI->SBCQI.. should resume. RI is repositioned
1593 * accordingly. WBCQI handling is naturally accomplished */
1594 if ((crntTime + TFU_RECPREQ_DLDELTA + effPeriodicity) >
1595 (RGSCH_MAX_SUBFRM_5G - 1))
1597 riTrInsTime = (effPeriodicity - riCb->cqiOffset + riCb->riOffset) % effPeriodicity;
1598 tempIdx = RGSCH_MAX_SUBFRM_5G + (effPeriodicity - riTrInsTime);
1599 /* In case of SFN wraparound, riDist should be distance from crntTime
1600 * + TFU_RECPREQ_DLDELTA to tempIdx. Updating effPeriodicity
1601 * to make riDist calculation consistent for both SFN wraparound
1602 * case and normal case */
1603 effPeriodicity = tempIdx - TFU_RECPREQ_DLDELTA - crntTime;
1607 tempIdx = effPeriodicity + riCb->nRiTrIdx;
1610 riIdx = tempIdx % RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1611 if (effPeriodicity >= RG_SCH_PCQI_SRS_SR_TRINS_SIZE)
1613 riDist = rgSCHUtlFindDist((U16)(crntTime + TFU_RECPREQ_DLDELTA),
1614 (U16)(crntTime + TFU_RECPREQ_DLDELTA + effPeriodicity));
1621 /* ccpu00138306- If Periodicity is equal to Queue Size or multiple of it
1622 * then the next occasion idx will be same as current Idx, Hence need not
1625 if((effPeriodicity%RG_SCH_PCQI_SRS_SR_TRINS_SIZE) != 0)
1627 /* Delete from current List and move to new list */
1628 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[riCb->nRiTrIdx].riLst,
1631 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"[%d]UEID:Unable to remove node",
1634 RG_SCH_RECORD(&riCb->histElem,RGSCH_ACTION_DEL, &cell->pCqiSrsSrLst[riCb->nRiTrIdx].riLst);
1635 cmLListAdd2Tail(&cell->pCqiSrsSrLst[riIdx].riLst,
1637 RG_SCH_RECORD(&riCb->histElem,RGSCH_ACTION_ADD, &cell->pCqiSrsSrLst[riIdx].riLst);
1646 riCb->nRiTrIdx = riIdx;
1647 riCb->riDist = riDist;
1650 rgSCHUtlSCellHndlRiCollsn(riCb);
1653 } /* rgSCHTomUtlMovePriNxtOccasion */
1656 * @brief Handler for moving SR instance for the next periodic occasion
1660 * Function: rgSCHTomUtlMoveSrNxtOccasion
1662 * Handler for moving SR instance for the next periodic occasion
1664 * Invoked by: rgSCHTomUtlFill*
1667 * - For a UE move its occurence instance to next occasion
1668 * depending on its periodicity
1669 * - Remove it from the current list and insert it to the list
1670 * having the index matching with the derived number.
1672 * @param[in] RgSchCellCb *cell,
1673 * [in] RgSchUeCb *ue
1679 PRIVATE S16 rgSCHTomUtlMoveSrNxtOccasion
1685 PRIVATE S16 rgSCHTomUtlMoveSrNxtOccasion(cell, ue)
1692 TRC2(rgSCHTomUtlMoveSrNxtOccasion);
1694 /* Compute Next Transmission Instance */
1695 srIdx = ue->srCb.peri + ue->srCb.nSrTrIdx;
1696 srIdx = srIdx%RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1697 /* Delete from current List and move to new list */
1698 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[ue->srCb.nSrTrIdx].srLst,
1699 &ue->srCb.srLstEnt))
1701 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to remove node",
1704 ue->srCb.nSrTrIdx = srIdx;
1705 cmLListAdd2Tail(&cell->pCqiSrsSrLst[ue->srCb.nSrTrIdx].srLst,
1706 &ue->srCb.srLstEnt);
1709 } /* rgSCHTomUtlMoveSrNxtOccasion */
1712 * @brief Handler for moving SRS instance for the next periodic occasion
1716 * Function: rgSCHTomUtlMoveSrsNxtOccasion
1718 * Handler for moving SRS instance for the next periodic occasion
1720 * Invoked by: rgSCHTomUtlFill*
1723 * - For a UE move its occurence instance to next occasion
1724 * depending on its periodicity
1725 * - Remove it from the current list and insert it to the list
1726 * having the index matching with the derived number.
1728 * @param[in] RgSchCellCb *cell,
1729 * [in] RgSchUeCb *ue
1735 PRIVATE S16 rgSCHTomUtlMoveSrsNxtOccasion
1741 PRIVATE S16 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue)
1752 TRC2(rgSCHTomUtlMoveSrsNxtOccasion);
1753 crntTime = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)
1754 +(cell->crntTime.slot);
1756 /* Compute Next Transmission Instance */
1757 tempIdx = ue->srsCb.peri + ue->srsCb.nSrsTrIdx;
1758 srsIdx = tempIdx %RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1759 if (ue->srsCb.peri > RG_SCH_PCQI_SRS_SR_TRINS_SIZE)
1761 srsDist = rgSCHUtlFindDist((U16)(crntTime + TFU_RECPREQ_DLDELTA),
1762 (U16)(crntTime + TFU_RECPREQ_DLDELTA + ue->srsCb.peri));
1769 /* ccpu00138306- If Periodicity is equal to Queue Size or multiple of it
1770 * then the next occasion idx will be same as current Idx, Hence need not
1773 if((ue->srsCb.peri%RG_SCH_PCQI_SRS_SR_TRINS_SIZE) != 0)
1775 /* Delete from current List and move to new list */
1776 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[ue->srsCb.nSrsTrIdx].srsLst,
1777 &ue->srsCb.srsLstEnt))
1779 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to remove node",
1782 cmLListAdd2Tail(&cell->pCqiSrsSrLst[srsIdx].srsLst,
1783 &ue->srsCb.srsLstEnt);
1792 ue->srsCb.nSrsTrIdx = srsIdx;
1793 ue->srsCb.srsDist = srsDist;
1796 } /* rgSCHTomUtlMoveSrsNxtOccasion */
1800 * @brief Handler for processing RAW CQI indication recieved from
1805 * Function: rgSCHTomRawCqiInd
1807 * Handler for processing RAW CQI indication recieved from PHY
1810 * Invoked by: RgLiTfuRawCqiInd
1814 * - Invoke scheduler to indicate Raw CQI rgSCHUtlRawCqiInd
1816 * @param[in] TfuRawCqiIndInfo *rawCqiInd
1822 PUBLIC S16 rgSCHTomRawCqiInd
1825 TfuRawCqiIndInfo *rawCqiInd
1828 PUBLIC S16 rgSCHTomRawCqiInd(cell, rawCqiInd)
1830 TfuRawCqiIndInfo *rawCqiInd;
1835 TfuRawCqiRpt* rawCqiInfo;
1839 RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1840 RgSchCellCb *iterCellP;
1851 TRC2(rgSCHTomRawCqiInd);
1853 if(cell->cellId != rawCqiInd->cellId)
1855 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
1856 ":%d", rawCqiInd->cellId);
1861 node = rawCqiInd->rawCqiRpt.first;
1862 for (;node; node=node->next)
1864 rawCqiInfo = (TfuRawCqiRpt *)node->node;
1865 ue = rgSCHDbmGetUeCb (cell, rawCqiInfo->crnti);
1866 raCb = rgSCHDbmGetRaCb (cell, rawCqiInfo->crnti);
1870 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"CRNTI:%d Unable to get the UECB",
1877 if (rawCqiInfo->numBits >= 5)
1878 printf("cellId [%d] crnti [%d] numBits [%d] uciPayload [0x%08x] sfn/sf [%d:%d]\n",
1879 cell->cellId, rawCqiInfo->crnti, rawCqiInfo->numBits, rawCqiInfo->uciPayload,
1880 rawCqiInd->timingInfo.sfn, rawCqiInd->timingInfo.slot);
1882 if (rawCqiInfo->numBits == 1)
1884 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1885 U8 fdbk = TFU_HQFDB_NACK;
1886 /* Process HARQ FdbkInd */
1887 hqAck = (rawCqiInfo->uciPayload >> 31) & 0x1;
1890 fdbk = TFU_HQFDB_ACK;
1891 hqInfo.isAck[0] = fdbk;
1893 if (ue != NULLP && raCb == NULLP)
1895 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, rawCqiInd->timingInfo, fdbk, &err)) != ROK)
1897 err.errType = RGSCHERR_TOM_HARQACKIND;
1898 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
1899 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1900 err.errType, err.errCause);
1904 else if (ue == NULLP && raCb != NULLP)
1906 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1907 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1909 err.errType = RGSCHERR_TOM_HARQACKIND;
1910 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1911 " feedback processing failed errType(%d) errCause(%d)",
1912 err.errType, err.errCause);
1917 else if (ue != NULLP && raCb != NULLP)
1919 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1920 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1922 err.errType = RGSCHERR_TOM_HARQACKIND;
1923 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1924 " feedback processing failed errType(%d) errCause(%d).",
1925 err.errType, err.errCause);
1931 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
1932 "UE CB or RA CB ", rawCqiInfo->crnti);
1933 err.errType = RGSCHERR_TOM_HARQACKIND;
1937 printf("rawCqiInfo->numBits [%d] uciPayload [0x%08x] sfn/sf [%d:%d]\n", rawCqiInfo->numBits,
1938 rawCqiInfo->uciPayload, rawCqiInd->timingInfo.sfn, rawCqiInd->timingInfo.slot);
1941 else if (rawCqiInfo->numBits == 5)
1943 /* Process CQI-RI Ind*/
1944 ri = (rawCqiInfo->uciPayload >> 27) & 0x1;
1945 cqi = (rawCqiInfo->uciPayload >> 28) & 0xF;
1949 printf("\n UE[%d] CQI[%d] Invalid\n", ue->ueId, cqi);
1952 ue->ue5gtfCb.mcs = rgSch5gtfCqi2Mcs[cqi - 1];
1953 ue->ue5gtfCb.rank = ri + 1;
1955 if (rawCqiInfo->numBits > 1)
1957 ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
1958 ueDl->mimoInfo.cwInfo[0].cqi = cqi;
1959 ueDl->cqiFlag = TRUE;
1960 rgSCHCmnDlSetUeAllocLmtLa(cell, ue);
1961 // rgSCHCheckAndSetTxScheme(cell, ue);
1966 printf("UE[%d] CQI[%d] MCS[%d] RI[%d]\n", ue->ueId, cqi, ue->ue5gtfCb.mcs, ri);
1969 else if (rawCqiInfo->numBits == 6)
1971 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1972 TfuHqFdbk fdbk = TFU_HQFDB_NACK;
1973 /* Process both HARQ and CQI-RI Ind*/
1974 ri = (rawCqiInfo->uciPayload >> 26) & 0x1;
1975 cqi = (rawCqiInfo->uciPayload >> 27) & 0xF;
1976 hqAck = (rawCqiInfo->uciPayload >> 31) & 0x1;
1979 printf("UE[%d] CQI[%d] Invalid\n", ue->ueId, cqi);
1982 ue->ue5gtfCb.mcs = rgSch5gtfCqi2Mcs[cqi - 1];
1983 ue->ue5gtfCb.rank = ri + 1;
1985 if (rawCqiInfo->numBits > 1)
1987 ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
1988 ueDl->mimoInfo.cwInfo[0].cqi = cqi;
1989 ueDl->cqiFlag = TRUE;
1990 rgSCHCmnDlSetUeAllocLmtLa(cell, ue);
1991 // rgSCHCheckAndSetTxScheme(cell, ue);
1996 fdbk = TFU_HQFDB_ACK;
1997 hqInfo.isAck[0] = fdbk;
1999 if (ue != NULLP && raCb == NULLP)
2001 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, rawCqiInd->timingInfo, fdbk, &err)) != ROK)
2003 err.errType = RGSCHERR_TOM_HARQACKIND;
2004 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
2005 "HARQ feedback processing failed errType(%d)errCause(%d)n",
2006 err.errType, err.errCause);
2010 else if (ue == NULLP && raCb != NULLP)
2012 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
2013 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
2015 err.errType = RGSCHERR_TOM_HARQACKIND;
2016 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
2017 " feedback processing failed errType(%d) errCause(%d)",
2018 err.errType, err.errCause);
2023 else if (ue != NULLP && raCb != NULLP)
2025 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
2026 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
2028 err.errType = RGSCHERR_TOM_HARQACKIND;
2029 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
2030 " feedback processing failed errType(%d) errCause(%d).",
2031 err.errType, err.errCause);
2037 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
2038 "UE CB or RA CB ", rawCqiInfo->crnti);
2039 err.errType = RGSCHERR_TOM_HARQACKIND;
2044 printf("\nUE[%u] CQI[%u] MCS[%u] RI[%u] HQ[%u]\n", ue->ueId, cqi, ue->ue5gtfCb.mcs, ri, hqAck);
2049 if ((rgSCHDhmRlsDlsfHqProc (cell, rawCqiInd->timingInfo)) != ROK)
2051 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink "
2052 "subframe for cellId (%d) ", cell->cellId);
2053 err.errType = RGSCHERR_TOM_HARQACKIND;
2056 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
2058 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
2060 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
2062 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
2063 if(rlsHqBufs->numUes)
2065 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
2066 RgSchMacRlsHq (&pst, rlsHqBufs);
2068 rlsHqBufs->numUes = 0;
2072 } /* rgSCHTomRawCqiInd */
2075 * @brief Handler for processing SRS indication recieved from
2080 * Function: rgSCHTomSrsInd
2082 * Handler for SRS indication recieved from PHY
2085 * Invoked by: RgLiTfuSrsInd
2089 * - Invoke scheduler to indicate UL SRS rgSCHUtlSrsInd
2091 * @param[in] TfuSrsIndInfo *srsInd
2097 PUBLIC S16 rgSCHTomSrsInd
2100 TfuSrsIndInfo *srsInd
2103 PUBLIC S16 rgSCHTomSrsInd(cell, srsInd)
2105 TfuSrsIndInfo *srsInd;
2112 TRC2(rgSCHTomSrsInd);
2114 if(cell->cellId != srsInd->cellId)
2116 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
2117 ":%d", srsInd->cellId);
2121 node = srsInd->srsRpt.first;
2122 for (;node; node=node->next)
2124 srsInfo = (TfuSrsRpt *)node->node;
2125 ue = rgSCHDbmGetUeCb (cell, srsInfo->ueId);
2128 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
2129 "UE CB", srsInfo->ueId);
2132 rgSCHUtlSrsInd(cell, ue, srsInfo, srsInd->timingInfo);
2133 rgSCHUtlHdlUlTransInd(cell, ue, srsInd->timingInfo);
2136 } /* rgSCHTomSrsInd */
2140 * Fun: rgSCHTomUtlGenIndices
2142 * Desc: This function reconstructs the Subband Indices for
2143 * of M selected Subbands conveyed by the UE for APeriodic Modes
2144 * 2-0 and 2-2. It decodes the Label which uniquely encodes M out
2152 * File: rg_sch_utl.c
2157 PRIVATE S16 rgSCHTomUtlGenIndices
2163 TfuSubbandInfo* sbInfo
2166 PRIVATE S16 rgSCHTomUtlGenIndices(label, posM, valN, valK, sbInfo)
2171 TfuSubbandInfo* sbInfo;
2174 U8 idx, kval, xval, xmin;
2177 for(kval=0; kval<posM;kval++)
2180 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe, (posM-kval-1));
2181 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe[posM-kval-1], (valN-xval-1));
2182 binCoe = rgSCHTomBinCoe[posM-kval-1][valN-xval-1];
2186 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe[posM-kval-1], (valN-xval-1));
2187 binCoe = rgSCHTomBinCoe[posM-kval-1][valN-xval-1];
2190 sbInfo[kval].numRb = valK;
2191 sbInfo[kval].rbStart = idx*valK;
2193 label = label-binCoe;
2196 } /* end of rgSCHTomUtlGenIndices*/
2200 * @brief Handler for processing decode failure indication recieved from
2205 * Function: rgSCHTomCrcInd
2207 * Handler for processing decode failure indication recieved from
2208 * PHY for a set of UEs.
2210 * Invoked by: RgLiTfuCrcInd of rg_sch.x
2213 * - Validate the information received and retrieve cell and ue.
2214 * - Process Decode failure Indication: Call rgSCHUhmProcHqFailure().
2216 * @param[in] TfuCrcIndInfo *crcInd
2222 PUBLIC S16 rgSCHTomCrcInd
2225 TfuCrcIndInfo *crcInd
2228 PUBLIC S16 rgSCHTomCrcInd(cell, crcInd)
2230 TfuCrcIndInfo *crcInd;
2233 RgSchUeCb *ue = NULLP;
2234 RgSchRaCb *raCb = NULLP;
2236 TfuCrcInfo *crcInfo;
2237 #ifdef RG_ULSCHED_AT_CRC
2240 CmLteTimingInfo crntHiDci0Frm;
2241 //RgSchCmnUlCell *cellUl;
2242 Inst inst = cell->instIdx;
2243 TfuCntrlReqInfo *cntrlInfo;
2251 RgSchUlHqProcCb *hqProc;
2255 RgSchUlHqProcCb *ulHqProc;
2258 TRC2(rgSCHTomCrcInd);
2260 if(cell->cellId != crcInd->cellId)
2262 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
2263 ":%d", crcInd->cellId);
2266 #ifdef RG_ULSCHED_AT_CRC
2269 static CmLteTimingInfo lastCrc = {2000,0};
2270 CmLteTimingInfo crntCrc = cell->crntTime;
2271 if (RGSCH_TIMEINFO_SAME(lastCrc, crntCrc))
2273 /*Removed the WA to drop 2nd CRC*/
2274 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"Recieved CRC "
2275 "twice per TTI @(%u,%u)", cell->crntTime.sfn,
2276 cell->crntTime.slot);
2282 node = crcInd->crcLst.first;
2283 for (;node; node=node->next)
2285 crcInfo = (TfuCrcInfo*)node->node;
2286 ue = rgSCHDbmGetUeCb (cell, crcInfo->rnti);
2290 /* Fetch from SPS List */
2291 ue = rgSCHDbmGetSpsUeCb(cell, crcInfo->rnti);
2295 raCb = rgSCHDbmGetRaCb (cell, crcInfo->rnti);
2302 /* Added Ul TB count for Uplink data scheduled*/
2306 ulHqProc = &(raCb->msg3HqProc);
2307 if(ulHqProc->remTx == (cell->rachCfg.maxMsg3Tx -1))
2309 cell->dlUlTbCnt.tbTransUlTotalCnt++;
2314 rgSCHUtlUlHqProcForUe(cell, crcInd->timingInfo, ue, &ulHqProc);
2315 if(ulHqProc->remTx == ((RgUeUlHqCb*)ulHqProc->hqEnt)->maxHqRetx)
2317 cell->dlUlTbCnt.tbTransUlTotalCnt++;
2322 if (crcInfo->isFailure == FALSE)
2326 rgSCHRamMsg3DatInd(raCb);
2328 /*ccpu00128820 - MOD - Msg3 alloc double delete issue*/
2329 hqProc = &(raCb->msg3HqProc);
2330 RGSCH_UPD_PHICH(cell->ulDlCfgIdx, crcInd->timingInfo.slot,
2338 gUlCrcPassCounter++;
2343 RGSCHCPYTIMEINFO(crcInd->timingInfo, ue->datIndTime);
2344 #ifndef MAC_SCH_STATS
2345 rgSCHUhmProcDatInd(cell, ue, crcInd->timingInfo);
2348 /** Stats update over here
2351 RgSchCmnUe *cmnUe = RG_SCH_CMN_GET_UE(ue,cell);
2353 rgSCHUhmProcDatInd(cell, ue, crcInd->timingInfo, cmnUe->ul.crntUlCqi[0]);
2355 #endif /* MAC_SCH_STATS */
2357 rgSCHUtlHdlUlTransInd(cell, ue, crcInd->timingInfo);
2359 rgSCHUtlHdlCrcInd(cell, ue, crcInd->timingInfo);
2367 /* SR_RACH_STATS : MSG3 Nack / DTX*/
2368 if (crcInfo->isDtx == TRUE)
2374 rgNumMsg3CrcFailed++;
2376 rgSCHRamMsg3FailureInd(raCb);
2378 rgSCHCmnEmtcHdlCrcFailInd(cell, raCb);
2380 /* Added Ul TB count for CRC Failure of MSG3 */
2382 ulHqProc = &(raCb->msg3HqProc);
2383 if(ulHqProc->remTx == (cell->rachCfg.maxMsg3Tx -1))
2385 cell->dlUlTbCnt.tbTransUlFaulty++;
2393 gUlCrcFailCounter++;
2398 #ifndef MAC_SCH_STATS
2399 rgSCHUhmProcHqFailure (cell, ue, crcInd->timingInfo, crcInfo->rv);
2402 RgSchCmnUe *cmnUe = RG_SCH_CMN_GET_UE(ue,cell);
2404 rgSCHUhmProcHqFailure (cell, ue, crcInd->timingInfo, crcInfo->rv, cmnUe->ul.crntUlCqi[0]);
2406 #endif /* MAC_SCH_STATS */
2407 rgSCHUtlHdlUlTransInd(cell, ue, crcInd->timingInfo);
2409 rgSCHUtlHdlCrcFailInd(cell, ue, crcInd->timingInfo);
2411 /* Added Ul TB count for CRC Failure of Uplink data */
2413 rgSCHUtlUlHqProcForUe(cell, crcInd->timingInfo, ue, &ulHqProc);
2414 if(ulHqProc->remTx == ((RgUeUlHqCb*)ulHqProc->hqEnt)->maxHqRetx)
2416 cell->dlUlTbCnt.tbTransUlFaulty++;
2423 /* ccpu00132653-ADD Added Sched_At_Crc Changes for TDD and optimized here
2424 the codebase across TDD and FDD*/
2425 #ifdef RG_ULSCHED_AT_CRC
2426 /* Changes to do uplink scheduling at CRC Indication */
2427 //cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
2428 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, crntHiDci0Frm, TFU_ULCNTRL_DLDELTA);
2431 rgSCHCmnRlsUlSf(cell,0);
2434 /* Allocating memory for CntrlReq as it required for both EMTC and
2436 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&cntrlInfo,
2437 sizeof(TfuCntrlReqInfo))) != ROK)
2439 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate TfuCntrlReqInfo "
2443 rgSCHCmnUlSch(cell);
2445 rgSCHL2Meas(cell,TRUE);
2447 /* Also, sending UL DCI and PHICH for just scheduled subframe */
2448 ulSf = rgSCHUtlSubFrmGet (cell, crntHiDci0Frm);
2450 if ((rgSCHTomUtlProcDlSfAtCrc (ulSf, crntHiDci0Frm, cell, cntrlInfo, &err)) != ROK)
2452 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomCrcInd() Unable to process"
2453 " downlink subframe for cellId %d", crcInd->cellId);
2454 err.errType = RGSCHERR_TOM_TTIIND;
2457 #endif /* RG_ULSCHED_AT_CRC */
2459 } /* rgSCHTomCrcInd */
2462 * @brief Handler for processing timing Advance indication recieved from
2467 * Function: rgSCHTomTimingAdvInd
2469 * Handler for processing timing advance indication recieved from PHY
2472 * Invoked by: RgLiTfuTimingAdvInd
2476 * - Call DHM to update value of Timing Advance rgSCHDhmUpdTa.
2478 * @param[in] TfuTimingAdvIndInfo *timingAdvInd
2484 PUBLIC S16 rgSCHTomTimingAdvInd
2487 TfuTimingAdvIndInfo *timingAdvInd
2490 PUBLIC S16 rgSCHTomTimingAdvInd(cell, timingAdvInd)
2492 TfuTimingAdvIndInfo *timingAdvInd;
2497 TfuTimingAdvInfo *timingAdvInfo;
2500 TRC2(rgSCHTomTimingAdvInd);
2502 if(cell->cellId != timingAdvInd->cellId)
2504 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
2505 "=(%d)", timingAdvInd->cellId);
2510 node = timingAdvInd->timingAdvLst.first;
2511 for (;node; node=node->next)
2513 timingAdvInfo = (TfuTimingAdvInfo *)node->node;
2514 ue = rgSCHDbmGetUeCb (cell, timingAdvInfo->rnti);
2517 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB",
2518 timingAdvInfo->rnti);
2521 rgSCHDhmUpdTa (cell, ue, timingAdvInfo->timingAdv);
2524 } /* rgSCHTomTimingAdvInd */
2527 * @brief Handler for processing TTI indication recieved from
2528 * PHY for 'n' cells.
2532 * Function: rgSCHTomTtiInd
2534 * Handler for processing slot indication recieved from MAC
2535 * for a cell. This is split into the below Steps.
2537 * 1: Complete the Uplink and Common Channel Scheduling for each Cell
2538 * 2: Complete the UE specific Scheduling for each Cell / across Cells.
2539 * 3: Consolidate the subframe allocations and send to each MAC instance
2540 * 4: Fill the Tfu structures for DL and UL Config requests
2541 * 5: Handle the RGR Config messages per Cell
2543 * @param[in] SlotIndInfo *slotInd
2544 * @param[in] Inst schInst
2548 PUBLIC Void rgSCHTomTtiInd
2550 SlotIndInfo *slotInd,
2554 PUBLIC Void rgSCHTomTtiInd(slotInd, schInst)
2555 SlotIndInfo *slotInd;
2559 RgInfSfAlloc *subfrmAlloc;
2560 RgTfuCntrlReqInfo *cntrlInfo = NULLP;
2564 RgSchCellCb *cell[CM_LTE_MAX_CELLS];
2565 RgSchCellCb *cellLst[CM_LTE_MAX_CELLS];
2567 TRC2(rgSCHTomTtiInd);
2573 //rgSchTomFillCellTtiInfo(slotInd, schInst, &nCell, &cell[0]);
2575 schFillCrntTime(*slotInd,schInst);
2576 for (i = 0; i < nCell; i++)
2578 /* Perform UL and DL Common Channel scheduling */
2579 rgSchTomTtiUlAndDlCmnChSch (cell[i]);
2582 /* Perform scheduling in Order of
2586 for (i = 0; i < nCell; i++)
2589 if (cell[i]->isDlDataAllwd && (cell[i]->stopDlSch == FALSE))
2591 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell[i]);
2592 /* Perform DL Retx scheduling */
2593 cellSch->apisDl->rgSCHDlRetxSched(cell[i], &cellSch->allocInfo);
2597 rgSchCmnPreDlSch(cell, nCell, cellLst);
2598 for (i = 0; i < nCell; i++)
2600 /* Perform DL scheduling */
2601 rgSchTomTtiDlSch (cellLst[i]);
2603 rgSchCmnPstDlSch(cell[0]);
2605 for (i = 0; i < nCell; i++)
2608 #ifndef RG_ULSCHED_AT_CRC
2609 /* Perform UL scheduling for TDD */
2610 rgSCHCmnUlSch (cell[i]);
2614 /* Init SF Alloc info per Cell */
2615 for (i = 0; i < nCell; i++)
2617 subfrmAlloc = &(cell[i]->sfAllocArr[cell[i]->crntSfIdx]);
2618 rgSCHUtlResetSfAlloc(subfrmAlloc,FALSE,TRUE);
2620 for (i = 0; i < nCell; i++)
2622 if (cell[i]->isDlDataAllwd && (cell[i]->stopSiSch == FALSE))
2624 subfrmAlloc = &(cell[i]->sfAllocArr[cell[i]->crntSfIdx]);
2626 * TFU_DLDATA_DLDELTA is used in this calculation because the subfrmAlloc
2627 * timingInfo which is being calculated here will be used by MAC
2629 RG_SCH_ADD_TO_CRNT_TIME(cell[i]->crntTime, subfrmAlloc->timingInfo,
2630 RG_DL_DELTA - TFU_DLDATA_DLDELTA);
2631 /* Consolidate the Allocations and send response to MAC instances */
2632 rgSchTomTtiCnsldtSfAlloc (cell[i]);
2636 for (i = 0; i < nCell; i++)
2638 if (cell[i]->isDlDataAllwd && (cell[i]->stopSiSch == FALSE))
2640 /* Send the consolidated Alloc Info to MAC instances */
2641 rgSCHCmnSndCnsldtInfo (cell[i]);
2645 for (i = 0; i < nCell; i++)
2647 /* Fill control data from scheduler to PHY */
2648 if ((ret = rgSCHUtlAllocEventMem((cell[i]->instIdx), (Ptr *)&cntrlInfo,
2649 sizeof(RgTfuCntrlReqInfo))) != ROK)
2651 RLOG_ARG0(L_ERROR,DBG_CELLID,cell[i]->cellId,"Unable to Allocate TfuCntrlReqInfo"
2657 /* Fill the TFU structures and send to CL */
2658 if(TRUE == cell[i]->emtcEnable)
2660 ret = rgSchEmtcTomTtiL1DlAndUlCfg (cell[i], cntrlInfo);
2664 && (NULLP != cntrlInfo))
2666 /* Fill the TFU structures and send to CL */
2667 rgSchTomTtiL1DlAndUlCfg (cell[i], cntrlInfo);
2671 rgSCHTomUtlSendSfnTick(cell[0]);
2674 for (i = 0; i < nCell; i++)
2676 /* Invoke non critical functions like measurements, etc */
2677 rgSchTomTtiMiscFunctions (cell[i]);
2682 U32 dbgUeIdChngAndDatReqInClCnt = 0;
2683 static U32 gTtiCount = 0;
2686 if(gTtiCount == 3000)
2688 #ifdef XEON_SPECIFIC_CHANGES
2689 printf("SChed:: (P/S)::(%u/%u) \n",
2690 gPrimarySchedCount,gSCellSchedCount);
2692 printf("\n HQFDBK :: %u\n",gHqFdbkCount);
2697 total = gPCellTb1AckCount + gPCellTb1NackCount + gPCellTb1DtxCount;
2698 total2 = gPCellTb2AckCount + gPCellTb2NackCount + gPCellTb2DtxCount;
2700 printf("\n PCell:: TB1:: (A/N/D)::(%u/%u/%u) TB2:: (A/N/D)::(%u/%u/%u)\n",
2701 gPCellTb1AckCount,gPCellTb1NackCount,gPCellTb1DtxCount,
2702 gPCellTb2AckCount,gPCellTb2NackCount,gPCellTb2DtxCount);
2703 if ((total != 0 ) && total2 != 0)
2705 printf("\n PCell:: TB1:: (AP/NP/DP)::(%.2f/%.2f/%.2f) TB2:: (AP/NP/DP)::(%.2f/%.2f/%.2f)\n",
2706 (float)gPCellTb1AckCount/total * 100,(float)gPCellTb1NackCount/total * 100,(float)gPCellTb1DtxCount/total * 100,
2707 (float)gPCellTb2AckCount/total2 *100 ,(float)gPCellTb2NackCount/total2 *100 ,(float)gPCellTb2DtxCount/total2 *2);
2710 total = gSCellTb1AckCount + gSCellTb1NackCount + gSCellTb1DtxCount;
2711 total2 = gSCellTb2AckCount + gSCellTb2NackCount + gSCellTb2DtxCount;
2714 printf("\n SCell:: TB1:: (A/N/D)::(%u/%u/%u) TB2:: (A/N/D)::(%u/%u/%u)\n",
2715 gSCellTb1AckCount,gSCellTb1NackCount,gSCellTb1DtxCount,
2716 gSCellTb2AckCount,gSCellTb2NackCount,gSCellTb2DtxCount);
2717 if ((total != 0 ) && total2 != 0)
2719 printf("\n SCell:: TB1:: (AP/NP/DP)::(%.2f/%.2f/%.2f) TB2:: (AP/NP/DP)::(%.2f/%.2f/%.2f)\n",
2720 (float)gSCellTb1AckCount/total * 100,(float)gSCellTb1NackCount/total * 100,(float)gSCellTb1DtxCount/total * 100,
2721 (float)gSCellTb2AckCount/total2 *100 ,(float)gSCellTb2NackCount/total2 *100 ,(float)gSCellTb2DtxCount/total2 *2);
2725 printf("\n CQI:: Recp(Pucch/Pusch):Rcvd(pcqi/rawacqireport/apcqi/AppReprt)::(%u/%u):(%u/%u/%u/%u)\n",
2726 gCqiRecpCount,gCqiRecpPuschCount,gCqiRcvdCount,gRawACqiCount,
2727 gACqiRcvdCount,gCqiReptToAppCount);
2729 printf("\n (F1BCS Count/Cqi/Ri/CqiDrop/PucchDrop/PuschCqiDrop)::(%u/%u/%u/%u/%u/%u)\n",
2730 gF1bCsCount,gCqiReqCount,gRiReqCount,gCqiDropCount,gPucchDropCount,gPuschCqiDropCount);
2732 printf("UL::(DCI0/CrcPass/CrcFail)::(%u/%u/%u)\n"
2733 "gPcellZeroBoOcc:%u\t gScellZeroBoOcc:%u dbgUeIdChngAndDatReqInClCnt: %u\n"
2734 "DelayedDatReqInMac: %u DelayedDatReqInCl : %u gIccPktRcvrMemDropCnt :%u\n",
2740 dbgUeIdChngAndDatReqInClCnt,
2741 dbgDelayedDatReqInMac,
2742 gDropDatReqCnt, gIccPktRcvrMemDropCnt);
2744 printf("SChed:: (P/S)::(%ld/%ld) \n",
2745 gPrimarySchedCount,gSCellSchedCount);
2747 printf("\n HQFDBK :: %ld\n",gHqFdbkCount);
2749 printf("\n PCell:: TB1:: (A/N/D)::(%ld/%ld/%ld) TB2:: (A/N/D)::(%ld/%ld/%ld)\n",
2750 gPCellTb1AckCount,gPCellTb1NackCount,gPCellTb1DtxCount,
2751 gPCellTb2AckCount,gPCellTb2NackCount,gPCellTb2DtxCount);
2753 printf("\n SCell:: TB1:: (A/N/D)::(%ld/%ld/%ld) TB2:: (A/N/D)::(%ld/%ld/%ld)\n",
2754 gSCellTb1AckCount,gSCellTb1NackCount,gSCellTb1DtxCount,
2755 gSCellTb2AckCount,gSCellTb2NackCount,gSCellTb2DtxCount);
2757 printf("\n CQI:: Recp(Pucch/Pusch):Rcvd(pcqi/rawacqireport/apcqi/AppReprt)::(%ld/%ld):(%ld/%ld/%ld/%ld)\n",
2758 gCqiRecpCount,gCqiRecpPuschCount,gCqiRcvdCount,gRawACqiCount,
2759 gACqiRcvdCount,gCqiReptToAppCount);
2760 printf("\n CQI:: PucchCqiSnrDropCnt/PucchCqiConfBitMaskDropCnt/PuschCqiConfMaskDropCount :: (%ld/%ld/%ld) \n",gCqiPucchLowSnrDropCount,gCqiPucchConfMaskDropCount,gCqiPuschConfMaskDropCount);
2762 printf("\n (F1BCS Count/Cqi/Ri/CqiDrop/PucchDrop/PuschCqiDrop)::(%ld/%ld/%ld/%ld/%ld/%ld)\n",
2763 gF1bCsCount,gCqiReqCount,gRiReqCount,gCqiDropCount,gPucchDropCount,gPuschCqiDropCount);
2765 printf("UL::(DCI0/CrcPass/CrcFail)::(%ld/%ld/%ld)\n"
2766 "gPcellZeroBoOcc:%ld\t gScellZeroBoOcc:%ld dbgUeIdChngAndDatReqInClCnt: %ld\n"
2767 "DelayedDatReqInMac: %ld DelayedDatReqInCl : %ld gIccPktRcvrMemDropCnt :%ld\n",
2773 dbgUeIdChngAndDatReqInClCnt,
2774 dbgDelayedDatReqInMac,
2775 gDropDatReqCnt, gIccPktRcvrMemDropCnt);
2776 //printf ("\n delayedApiCnt:%ld",delayedApiCnt);
2780 rgSCHLaaPrintStats();
2782 gCaDbgNonCaFrmt = gIccPktRcvrMemDropCnt = 0;
2794 gCqiPucchLowSnrDropCount = 0;
2795 gCqiPucchConfMaskDropCount = 0;
2796 gCqiPuschConfMaskDropCount = 0;
2797 gPuschCqiDropCount = 0;
2800 gUlCrcPassCount = 0;
2801 gUlCrcFailCount = 0;
2804 gCqiRecpPuschCount = 0;
2807 gCqiReptToAppCount = 0;
2812 gPrimarySchedCount = 0;
2813 gSCellSchedCount = 0;
2814 gSCellTb1AckCount = 0;
2815 gSCellTb2AckCount = 0;
2816 gSCellTb2AckCount = 0;
2817 gSCellTb2NackCount = 0;
2818 gPCellTb1AckCount = 0;
2819 gPCellTb1NackCount = 0;
2820 gPCellTb2AckCount = 0;
2821 gPCellTb2NackCount = 0;
2822 gSCellTb1NackCount=0;
2824 gPCellTb1DtxCount = 0;
2825 gPCellTb2DtxCount = 0;
2826 gSCellTb1DtxCount = 0;
2827 gSCellTb2DtxCount = 0;
2828 gPcellZeroBoOcc = 0;
2829 gScellZeroBoOcc = 0;
2837 } /* rgSCHTomTtiInd */
2839 /** @brief This function does the TTI processin for the uplink subframe,
2840 * already populated by the scheduler.
2844 * Function: rgSCHTomUtlProcUlSf
2847 * - Loop through the Uplink allocations present in the uplink subframe.
2848 * - For each allocation Fill a data reception request to be sent to PHY
2849 * - Also fills the harq reception requests for the expected HQ feedbacks.
2852 * @param [in] RgSchCellCb *cell
2853 * @param [out] RgSchErrInfo *err
2860 PRIVATE S16 rgSCHTomUtlProcUlSf
2866 PRIVATE S16 rgSCHTomUtlProcUlSf (cell, err)
2872 TfuRecpReqInfo *recpReqInfo;
2874 U16 validIdx = 0; /* Index computed from recreq's timing info*/
2876 Inst inst = cell->instIdx;
2878 TRC2(rgSCHTomUtlProcUlSf)
2880 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&recpReqInfo,
2881 sizeof(TfuRecpReqInfo))) != ROK)
2883 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate TfuRecpReqInfo "
2885 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
2888 recpReqInfo->cellId = cell->cellId;
2889 cmLListInit(&recpReqInfo->ueRecpReqLst);
2891 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, recpReqInfo->timingInfo,
2892 TFU_RECPREQ_DLDELTA);
2894 /* Filling data Reception requests */
2895 ret = rgSCHTomUtlFillDatRecpReq(recpReqInfo, cell,
2900 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to fill Data recption "
2901 "requests for cell");
2902 RGSCH_FREE_MEM(recpReqInfo);
2905 /* Filling HARQ Reception requests */
2906 ret = rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, validIdx,err);
2909 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to fill Harq Feedback "
2910 "reception requests for cell");
2911 RGSCH_FREE_MEM(recpReqInfo);
2914 /* sending the RecpReq to Phy */
2915 if (rgSCHUtlTfuRecpReq(inst, cell->tfuSap->sapCfg.suId, recpReqInfo) != ROK)
2917 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info for cell");
2920 } /* end of rgSCHTomUtlProcUlSf */
2924 /** @brief This function does the TTI processin for the uplink subframe,
2925 * already populated by the scheduler.
2929 * Function: rgSCHTomUtlPrcUlTddSpclSf
2932 * - Fill the SRS Info for the Special Subframe in Reception Req.
2933 * - Send the Reception Req to TFU
2936 * @param [in] RgSchCellCb *cell
2937 * @param [out] RgSchErrInfo *err
2943 PRIVATE S16 rgSCHTomUtlPrcUlTddSpclSf
2949 PRIVATE S16 rgSCHTomUtlPrcUlTddSpclSf (cell, err)
2955 TfuRecpReqInfo *recpReqInfo;
2956 U16 validIdx; /* Index computed from recreq's timing info*/
2957 Inst inst = cell->instIdx;
2959 TRC2(rgSCHTomUtlPrcUlTddSpclSf)
2961 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&recpReqInfo,
2962 sizeof(TfuRecpReqInfo))) != ROK)
2964 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to "
2965 "Allocate TfuRecpReqInfo for cell");
2966 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
2969 recpReqInfo->cellId = cell->cellId;
2970 cmLListInit(&recpReqInfo->ueRecpReqLst);
2972 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, recpReqInfo->timingInfo, TFU_RECPREQ_DLDELTA);
2974 RG_SCH_GET_IDX_PCQISRSSR(recpReqInfo->timingInfo, validIdx);
2977 if(cell->srsCfg.isSrsCfgPres &&
2978 rgSchTddCellSpSrsSubfrmTbl[cell->srsCfg.srsSubFrameCfg][recpReqInfo->timingInfo.slot])
2980 recpReqInfo->srsPres = TRUE;
2984 recpReqInfo->srsPres = FALSE;
2987 /* Filling SRS Reception requests */
2988 ret = rgSCHTomUtlFillSrsRecpReq (recpReqInfo, cell, validIdx, err);
2991 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to fill"
2992 " SRS recption requests for cell");;
2993 RGSCH_FREE_MEM(recpReqInfo);
2996 /* sending the RecpReq to Phy */
2997 if (rgSCHUtlTfuRecpReq(inst, cell->tfuSap->sapCfg.suId, recpReqInfo) != ROK)
2999 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to send "
3000 "Cntrl info for cell");
3003 } /* end of rgSCHTomUtlPrcUlTddSpclSf */
3006 /** @brief This function does all the processing related to a single downlink
3011 * Function: rgSCHTomUtlProcDlSf
3014 * - collate control data for all UEs and send to PHY
3015 * - collate data buffers for all UEs and send to PHY
3017 * @param [in] RgSchDlSf *dlSf
3018 * @param [in] RgSchDlSf *ulSf
3019 * @param [in] RgSchCellCb *cell
3020 * @param [out] RgSchErrInfo *err
3024 PRIVATE S16 rgSCHTomUtlProcDlSf
3029 RgTfuCntrlReqInfo *cntrlInfo,
3033 PRIVATE S16 rgSCHTomUtlProcDlSf (dlSf, ulSf, cell, cntrlInfo, err)
3037 RgTfuCntrlReqInfo *cntrlInfo;
3041 Inst inst = cell->instIdx;
3043 U8 sfTyp = 1; /* Dl Subframe */
3045 TRC2(rgSCHTomUtlProcDlSf);
3047 cmLListInit(&cntrlInfo->phichLst);
3048 cmLListInit(&cntrlInfo->dlPdcchLst);
3049 cmLListInit(&cntrlInfo->ulPdcchLst);
3051 #ifdef TFU_ALLOC_EVENT_NO_INIT
3052 cntrlInfo->ulTiming.sfn = cntrlInfo->ulTiming.subframe = 0;
3054 cntrlInfo->dlTiming = cell->dlDciTime;
3055 cntrlInfo->cellId = cell->cellId;
3056 cntrlInfo->ulTiming = cell->hiDci0Time;
3057 if((0 == (cntrlInfo->dlTiming.sfn % 30)) && (0 == cntrlInfo->dlTiming.slot))
3059 //printf("5GTF_CHECK rgSCHTomUtlProcDlSf Cntrl dl (%d : %d) ul (%d : %d)\n", cntrlInfo->dlTiming.sfn, cntrlInfo->dlTiming.subframe, cntrlInfo->ulTiming.sfn, cntrlInfo->ulTiming.subframe);
3061 /* Fill PCFICH info */
3062 /* Fix for DCFI FLE issue: when DL delta is 1 and UL delta is 0 and CFI
3063 *change happens in that SF then UL PDCCH allocation happens with old CFI
3064 *but CFI in control Req goes updated one since it was stored in the CELL
3066 cntrlInfo->cfi = dlSf->pdcchInfo.currCfi;
3067 #ifndef RG_ULSCHED_AT_CRC
3070 Mval = rgSchTddPhichMValTbl[cell->ulDlCfgIdx]
3071 [cell->hiDci0Time.subframe];
3072 if(dlSf->sfType == RG_SCH_SPL_SF_DATA)
3074 RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, cntrlInfo->cfi);
3079 /* Fill PHICH info */
3080 if ((ret = rgSCHTomUtlFillPhich (cell, cntrlInfo, ulSf, err)) != ROK)
3082 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PHICH info "
3083 "for cellId (%d)\n", cell->cellId));
3084 RGSCH_FREE_MEM(cntrlInfo);
3087 if ((ret = rgSCHTomUtlFillUlPdcch (cell, cntrlInfo, ulSf, err)) !=
3090 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PDCCH info "
3091 "for cellId (%d)\n", cell->cellId));
3092 RGSCH_FREE_MEM(cntrlInfo);
3097 if(0 == cntrlInfo->ulMpdcchLst.count)
3104 sfTyp = rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
3105 [cell->dlDciTime.subframe];
3107 if (sfTyp != 2) /* Uplink subframe */
3109 /* Fill PDCCH info */
3110 if ((ret = rgSCHTomUtlFillDlPdcch(cell,cntrlInfo, dlSf, err)) != ROK)
3112 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PDCCH info "
3113 "for cellId (%d)\n", cell->cellId));
3114 RGSCH_FREE_MEM(cntrlInfo);
3117 rgBwAlloInfo[dlSf->sfNum] += dlSf->bwAssigned;
3118 rgBwAlcnt[dlSf->sfNum] ++;
3121 #ifdef LTEMAC_SPS /* SPS_NEW_CHGS */
3122 cntrlInfo->isSPSOcc = dlSf->isSPSOcc;
3124 cntrlInfo->numDlActvUes += dlSf->numDlActvUes; /* 4UE_TTI_DELTA */
3125 dlSf->numDlActvUes = 0;
3127 if(0 == cntrlInfo->dlMpdcchLst.count)
3132 /* Now always sending down a cntrl req */
3133 /* sending the cntrl data to Phy */
3134 if (rgSCHUtlTfuCntrlReq(inst, cell->tfuSap->sapCfg.suId, cntrlInfo)
3137 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info "
3145 /** @brief This function handles sending of the PHICH information for the
3146 * downlink subframe to be sent in the next TTI.
3153 * - Loop through the PHICH information present in the downlink
3154 * subframe and fill the information in cntrlInfo.
3156 * @param [out] TfuCntrlReqInfo *cntrlInfo
3157 * @param [in] RgSchDlSf *dlSf
3158 * @param [out] RgSchErrInfo *err
3164 PRIVATE S16 rgSCHTomUtlFillPhich
3167 TfuCntrlReqInfo *cntrlInfo,
3172 PRIVATE S16 rgSCHTomUtlFillPhich(cell, cntrlInfo, dlSf, err)
3174 TfuCntrlReqInfo *cntrlInfo;
3182 TfuPhichInfo *harqAck;
3184 RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
3187 TRC2(rgSCHTomUtlFillPhich)
3189 /* Traversing the list of Phichs */
3190 node = dlSf->phichInfo.phichs.first;
3193 phich = (RgSchPhich*)node->node;
3194 if ((ret = rgSCHUtlGetEventMem((Ptr *)&harqAck, sizeof(TfuPhichInfo),
3195 &(cntrlInfo->memCp))) != ROK)
3197 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3200 #ifdef TFU_ALLOC_EVENT_NO_INIT
3201 harqAck->txPower = 0;
3203 /* fill in the tfu structure from the information present in the
3205 harqAck->rbStart = phich->rbStart;
3206 harqAck->nDmrs = phich->nDmrs;
3207 harqAck->isAck = phich->hqFeedBack;
3208 harqAck->isForMsg3 = phich->isForMsg3; /*SR_RACH_STATS : PHICH ACK/NACK for MSG3 */
3210 /* Changes for passing iPhich at TFU interface*/
3211 harqAck->iPhich = phich->iPhich;
3213 /* ccpu00138898 - Added Tx pwr offset for PHICH Tx*/
3215 harqAck->txPower = cellDl->phichTxPwrOffset;
3217 cmLListAdd2Tail(&cntrlInfo->phichLst, &(harqAck->lnk));
3218 harqAck->lnk.node = (PTR)harqAck;
3220 } /* end of while */
3226 /** @brief This function is a utility function to restart
3227 * deactivation timer.
3231 * Function: rgSCHTmrRestartScellDeactTmr
3234 * - Starts timer at scheduler
3236 * @param[in] RgSchCellCb *cell
3237 * @param[in] CmLteRnti rnti
3241 PRIVATE Void rgSCHTmrRestartScellDeactTmr
3247 PRIVATE Void rgSCHTmrRestartScellDeactTmr (cell, ueCb)
3253 RgSchUeCellInfo *sCellInfo = NULLP;
3257 if(RG_SCH_IS_CELL_SEC(ueCb, cell))
3259 sCellInfo = ueCb->cellInfo[(ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)])];
3261 if(sCellInfo->deactTmr.tmrEvnt != TMR_NONE)
3263 rgSCHTmrStopTmr(cell, RG_SCH_TMR_SCELL_DEACT, sCellInfo);
3265 if(PRSNT_NODEF == ueCb->sCellDeactTmrVal.pres)
3268 rgSCHTmrStartTmr(cell,sCellInfo,RG_SCH_TMR_SCELL_DEACT,
3269 ueCb->sCellDeactTmrVal.val);
3274 }/*end of rgSCHTmrRestartScellDeactTmr*/
3277 /** @brief This function will send all the PDCCH's for the given downlink
3285 * - Loop through all the scheduled HARQ processes and fill
3286 * the PDCCH information in cntrlInfo.
3288 * @param [out] TfuCntrlReqInfo *cntrlInfo
3289 * @param [in] RgSchDlSf *dlSf
3290 * @param [out] RgSchErrInfo *err
3295 EXTERN U32 numdlSpsRelSentToTf;
3297 PRIVATE S16 rgSCHTomUtlFillDlPdcch
3300 TfuCntrlReqInfo *cntrlInfo,
3305 PRIVATE S16 rgSCHTomUtlFillDlPdcch(cell,cntrlInfo, dlSf, err)
3307 TfuCntrlReqInfo *cntrlInfo;
3315 TfuPdcchInfo *tfuPdcch;
3316 U8 isDcivld = FALSE;
3319 TRC2(rgSCHTomUtlFillDlPdcch)
3321 /* Traversing the scheduled Harq processes */
3322 node = dlSf->pdcchInfo.pdcchs.first;
3325 pdcch = (RgSchPdcch*)node->node;
3326 switch(pdcch->dci.dciFormat)
3328 case TFU_DCI_FORMAT_3:
3329 isDcivld = (pdcch->dci.u.format3Info.isPucch) ? TRUE : FALSE;
3332 case TFU_DCI_FORMAT_3A:
3333 isDcivld = (pdcch->dci.u.format3AInfo.isPucch) ? TRUE : FALSE;
3346 /*ccpu00117179 - ADD - Build only non DCI format-0 messages */
3347 if((pdcch->dci.dciFormat == TFU_DCI_FORMAT_0) ||
3348 (pdcch->dci.dciFormat == TFU_DCI_FORMAT_A1) ||
3349 (pdcch->dci.dciFormat == TFU_DCI_FORMAT_A2))
3356 #ifdef RGSCH_SPS_STATS
3357 if((pdcch->dci.dciFormat == TFU_DCI_FORMAT_1A) &&
3358 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.mcs == 0x1F) &&
3359 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.type == TFU_ALLOC_TYPE_RIV) &&
3360 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.u.riv == 0xFFFFFFFF))
3362 numdlSpsRelSentToTf++;
3366 if ((ret = rgSCHUtlGetEventMem((Ptr *)&tfuPdcch, sizeof(TfuPdcchInfo),
3367 &(cntrlInfo->memCp))) != ROK)
3369 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3373 tfuPdcch->crnti = pdcch->crnti;
3374 tfuPdcch->isSpsRnti = pdcch->isSpsRnti;
3376 tfuPdcch->rnti = pdcch->rnti;
3379 rgSCHTmrRestartScellDeactTmr(cell,pdcch->ue);
3381 tfuPdcch->dciNumOfBits = pdcch->dciNumOfBits;
3383 tfuPdcch->nCce = pdcch->nCce;
3384 tfuPdcch->aggrLvl = pdcch->aggrLvl;
3385 tfuPdcch->dci = pdcch->dci;
3387 //TODO_SID: Need to check these values during INT
3388 tfuPdcch->sectorId = 0;
3389 tfuPdcch->sccIdx = 0;
3392 /* SR_RACH_STATS : Reset isTBMsg4 */
3393 pdcch->dci.u.format1aInfo.t.pdschInfo.isTBMsg4 = FALSE;
3394 /* To be enhanced later for 2.1 */
3395 cmLListAdd2Tail(&cntrlInfo->dlPdcchLst, &(tfuPdcch->lnk));
3396 tfuPdcch->lnk.node = (PTR)tfuPdcch;
3398 if((pdcch->rnti > 60) && (pdcch->rnti < 5000))
3400 #if defined (TENB_STATS) && defined (RG_5GTF)
3401 cell->tenbStats->sch.dl5gtfPdcchSend++;
3405 } /* end of while */
3407 if((numUePerTti) && (numUePerTti < RG_MAX_NUM_UE_PER_TTI ))
3409 cell->dlNumUeSchedPerTti[numUePerTti-1]++;
3411 gDlNumUePerTti[numUePerTti-1]++;
3415 } /* end of rgSCHTomUtlFillDlPdcch*/
3417 #ifdef RGSCH_SPS_STATS
3418 extern U32 rgSchSpsRelSentToTf;
3419 extern U32 rgSchSpsRelPdcchAllocd;
3421 /** @brief This function will send all the UL PDCCH's for the given
3429 * - Loop through all the scheduled HARQ processes and fill
3430 * the PDCCH information in cntrlInfo.
3432 * @param [out] TfuCntrlReqInfo *cntrlInfo
3433 * @param [in] RgSchDlSf *dlSf
3434 * @param [out] RgSchErrInfo *err
3440 PRIVATE S16 rgSCHTomUtlFillUlPdcch
3443 TfuCntrlReqInfo *cntrlInfo,
3448 PRIVATE S16 rgSCHTomUtlFillUlPdcch(cntrlInfo, dlSf, err)
3450 TfuCntrlReqInfo *cntrlInfo;
3458 TfuPdcchInfo *tfuPdcch;
3459 U8 isDcivld = FALSE;
3461 TRC2(rgSCHTomUtlFillUlPdcch)
3463 /* Traversing the scheduled Harq processes */
3464 node = dlSf->pdcchInfo.pdcchs.first;
3467 pdcch = (RgSchPdcch*)node->node;
3469 /*ccpu00116712- Function should pick only UL allocation related control
3471 switch(pdcch->dci.dciFormat)
3473 case TFU_DCI_FORMAT_A1:
3477 case TFU_DCI_FORMAT_A2:
3481 case TFU_DCI_FORMAT_3:
3482 isDcivld = (pdcch->dci.u.format3Info.isPucch) ? FALSE : TRUE;
3485 case TFU_DCI_FORMAT_3A:
3486 isDcivld = (pdcch->dci.u.format3AInfo.isPucch) ? FALSE : TRUE;
3501 /*ccpu00116712- Function should pick only UL allocation related control
3503 if ((ret = rgSCHUtlGetEventMem((Ptr *)&tfuPdcch, sizeof(TfuPdcchInfo),
3504 &(cntrlInfo->memCp))) != ROK)
3506 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3509 tfuPdcch->rnti = pdcch->rnti;
3511 rgSCHTmrRestartScellDeactTmr(cell,pdcch->ue);
3513 tfuPdcch->dciNumOfBits = pdcch->dciNumOfBits;
3515 tfuPdcch->nCce = pdcch->nCce;
3516 tfuPdcch->aggrLvl = pdcch->aggrLvl;
3517 tfuPdcch->dci = pdcch->dci;
3519 //TODO_SID: Need to check these values during INT
3520 tfuPdcch->sectorId = 0;
3521 tfuPdcch->sccIdx = 0;
3524 /* To be enhanced later for 2.1 */
3526 #if defined (TENB_STATS) && defined (RG_5GTF)
3527 cell->tenbStats->sch.ul5gtfPdcchSend++;
3529 cmLListAdd2Tail(&cntrlInfo->ulPdcchLst, &(tfuPdcch->lnk));
3530 tfuPdcch->lnk.node = (PTR)tfuPdcch;
3531 } /* end of while */
3533 #ifdef RGSCH_SPS_STATS
3534 if (rgSchSpsRelSentToTf != rgSchSpsRelPdcchAllocd)
3540 } /* end of rgSCHTomUtlFillUlPdcch*/
3542 /** @brief This function does the processing for Timing adjustment.
3549 * - Loop through the ue present ueTimeLst, decrement the remaining
3553 * @param [in] RgSchCellCb *cell
3559 PRIVATE S16 rgSCHTomUtlProcTA
3564 PRIVATE S16 rgSCHTomUtlProcTA (cell)
3571 TRC2(rgSCHTomUtlProcTA);
3573 node = cell->taUeLst.first;
3576 ue = (RgSchUeCb *)node->node;
3578 if (ue->dl.taCb.numRemSf == 0)
3580 ue->dl.taCb.state = RGSCH_TA_IDLE;
3581 /* If Outstanding Ta is present, schedule it */
3582 if(ue->dl.taCb.outStndngTa == TRUE)
3584 rgSCHUtlReTxTa(cell, ue);
3588 /* We need to reset state and also value of TA,
3589 * then we start the timer */
3590 ue->dl.taCb.ta = RGSCH_NO_TA_RQD;
3591 /* Start the timer only if TA is cfgd as FINITE value */
3592 if (ue->dl.taCb.cfgTaTmr)
3594 rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_TA, ue->dl.taCb.cfgTaTmr);
3597 /* need to delete from the link list */
3598 cmLListDelFrm(&(cell->taUeLst), &(ue->taLnk));
3599 ue->taLnk.node = NULLP;
3603 ue->dl.taCb.numRemSf--;
3605 } /* 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;
3872 TfuUePucchRecpReq *pucchReqInfo = NULLP;
3874 hqPNode = dlSfHqInfo->hqPLst.first;
3875 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
3881 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
3882 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
3885 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate "
3886 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId));
3887 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3890 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
3891 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
3892 * instead of SPS-CRNTI */
3894 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
3896 pucchReqInfo->uciInfo = TFU_XPUCCH_UCI_INFO;
3898 /* 5gtf TODO : Hardcoded nPUCCHIdx */
3899 pucchReqInfo->uciPduInfo.pucchIndex = 0;
3901 pucchReqInfo->uciPduInfo.numBits = 1;
3903 /* 5gtf TODO : CQI Periodicity Hardcoded to (n,0)*/
3904 if (RGSCH_TIMEINFO_SAME (recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn))
3906 pucchReqInfo->uciPduInfo.numBits += 5;
3907 RG_SCH_ADD_TO_CRNT_TIME(recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn,
3908 ue->ue5gtfCb.cqiRiPer);
3911 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
3912 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
3914 }/* end of rgSCHTomUtlFillHqFdbkForFrmt1B */
3918 /** @brief This function handles filling of Hq reception request to
3923 * Function:rgSCHTomUtlFillHqFdbkForFrmt1B
3926 * Allocates the N1Pucch Resources based on teh A Value
3928 * @param [out] TfuRecpReqInfo *recpReqInfo
3929 * @param [in] RgSchCellCb *cell
3930 * @param [in] U16 validIdx,
3931 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
3932 * @param [in] RgSchDlSf *dlSf,
3933 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
3934 * @param [out] RgSchErrInfo *err
3942 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B
3944 TfuRecpReqInfo *recpReqInfo,
3947 RgSchDlHqInfo *dlSfHqInfo,
3949 TfuUeRecpReqInfo *pucchRecpInfo,
3953 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err)
3954 TfuRecpReqInfo *recpReqInfo;
3957 RgSchDlHqInfo *dlSfHqInfo;
3959 TfuUeRecpReqInfo *pucchRecpInfo;
3964 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B
3966 TfuRecpReqInfo *recpReqInfo,
3968 RgSchDlHqInfo *dlSfHqInfo,
3970 TfuUeRecpReqInfo *pucchRecpInfo,
3974 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B (recpReqInfo, cell, hqCb, dlSf, pucchRecpInfo, err)
3975 TfuRecpReqInfo *recpReqInfo;
3977 RgSchDlHqInfo *dlSfHqInfo;
3979 TfuUeRecpReqInfo *pucchRecpInfo;
3985 Inst inst = cell->instIdx;
3989 RgSchDlHqProcCb *hqCb = NULLP;
3991 TfuUePucchRecpReq *pucchReqInfo = NULLP;
3992 Bool isDatPresOnSecCell = FALSE;
3993 U8 primCellTbCount = 0;
3995 hqPNode = dlSfHqInfo->hqPLst.first;
3996 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
4002 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4003 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
4006 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate "
4007 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId));
4008 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4011 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4012 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
4013 * instead of SPS-CRNTI */
4015 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
4018 pucchReqInfo->hqType = TFU_HQ_RECP_REQ_NORMAL;
4019 /* Handling of other types */
4020 pucchReqInfo->type = TFU_UCI_HARQ;
4021 #else /* TFU_UPGRADE */
4022 pucchReqInfo->uciInfo = TFU_PUCCH_HARQ;
4023 /* Fill hqFdbkMode by using uciFrmtTyp from dlSfHqInfo */
4024 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
4025 /* Fill HqSz by using totalTbCnt based on the TM mode and
4026 * the number of serv cells configured*/
4028 pucchReqInfo->hqInfo.hqSz = ue->f1bCsAVal;
4029 pucchReqInfo->hqInfo.pucchResCnt = ue->f1bCsAVal;
4031 cmMemset((U8 *)pucchReqInfo->hqInfo.hqRes,0xff,sizeof(U16)*TFU_MAX_HQ_RES);
4033 /* Two Resources needs to be configured if the
4034 * serving cell is in mimo mode else single
4036 if ((dlSf->relPdcch != NULLP) &&
4037 (RGSCH_TIMEINFO_SAME(recpReqInfo->timingInfo, ue->relPdcchFbkTiming)))
4038 {/* Pcell is having sps rel pdcch present */
4039 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
4040 {/* prim cell is in mimo mode, use 0 and 1 */
4041 pucchReqInfo->hqInfo.hqRes[0] = (dlSf->relPdcch->nCce +
4042 cell->pucchCfg.n1PucchAn);
4043 pucchReqInfo->hqInfo.hqRes[1] = pucchReqInfo->hqInfo.hqRes[0] + 1;
4048 pucchReqInfo->hqInfo.hqRes[2] = (dlSf->relPdcch->nCce +
4049 cell->pucchCfg.n1PucchAn);
4051 /* Release the pdcch so that it will not further processed */
4052 rgSCHUtlPdcchPut(ue->cell,&dlSf->pdcchInfo, dlSf->relPdcch);
4053 dlSf->relPdcch = NULLP;/* only one UE will be scheduled for release pdcch order in one tti */
4055 #endif/*LTEMAC_SPS*/
4056 #endif/*TFU_UPGRADE*/
4059 hqCb = (RgSchDlHqProcCb *)hqPNode->node;
4060 hqPNode = hqPNode->next;
4061 /* In case of CSI + 1BCS , CSI will be
4062 * dropped if scheduling is present on
4063 * seconday cell.36.213 10.1.1
4065 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4067 isDatPresOnSecCell = TRUE;
4070 if ((hqCb->tbInfo[0].state == HQ_TB_WAITING) &&
4071 (hqCb->tbInfo[1].state == HQ_TB_WAITING))
4073 primCellTbCount = 2;
4076 primCellTbCount = 1;
4080 pucchReqInfo->t.nCce = hqCb->pdcch->nCce;
4083 switch(ue->f1bCsAVal)
4085 case RG_SCH_A_VAL_2:
4086 /* harq(0) is primary harq(1) is secondary) */
4087 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4089 pucchReqInfo->hqInfo.hqRes[1] = ue->n1PucchF1bResCb.\
4090 cw1N1Res[hqCb->tpc].n1PucchIdx;
4092 else/* primary cell */
4095 /* Need to consider only sps occasions */
4096 if (hqCb->spsN1PucchRes.pres)
4098 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
4101 #endif /* LTEMAC_SPS */
4104 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
4105 cell->pucchCfg.n1PucchAn);
4109 case RG_SCH_A_VAL_3:
4110 /* Serving cell in mimo mode should be
4111 * in 0 and 1 and the serving cell in siso
4112 * mode should be in 2 indices */
4113 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4115 U8 cellIdx = ue->cellIdToCellIdxMap[RG_SCH_CELLINDEX(hqCb->hqE->cell)];
4116 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[cellIdx]->txMode.txModeEnum) > 1)
4117 {/* Sec cell is in mimo mode, use 0 and 1 */
4118 pucchReqInfo->hqInfo.hqRes[0] =
4119 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
4121 pucchReqInfo->hqInfo.hqRes[1] =
4122 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
4125 {/* Sec cell is in siso mode, use 2 */
4126 pucchReqInfo->hqInfo.hqRes[2] =
4127 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
4131 {/* primary cell hq */
4132 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
4133 {/* prim cell is in mimo mode, use 0 and 1 */
4135 if (hqCb->spsN1PucchRes.pres)
4136 {/* SPS occasions */
4137 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
4138 pucchReqInfo->hqInfo.hqRes[1] = hqCb->spsN1PucchRes.val + 1;
4141 #endif /* LTEMAC_SPS */
4143 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
4144 cell->pucchCfg.n1PucchAn);
4145 pucchReqInfo->hqInfo.hqRes[1] = (hqCb->pdcch->nCce +
4146 cell->pucchCfg.n1PucchAn + 1);
4150 {/* prim cell is in siso mode use 2 */
4152 /* Need to consider only sps occasions */
4153 if (hqCb->spsN1PucchRes.pres)
4155 pucchReqInfo->hqInfo.hqRes[2] = hqCb->spsN1PucchRes.val;
4158 #endif /* LTEMAC_SPS */
4161 pucchReqInfo->hqInfo.hqRes[2] = (hqCb->pdcch->nCce +
4162 cell->pucchCfg.n1PucchAn);
4168 case RG_SCH_A_VAL_4:
4170 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4171 {/* 2 and 3 for sec cell */
4172 pucchReqInfo->hqInfo.hqRes[2] =
4173 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
4174 pucchReqInfo->hqInfo.hqRes[3] =
4175 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
4177 else/* primary cell */
4178 {/* 0 and 1 are for primary cell */
4180 /* Need to consider only sps occasions */
4181 if (hqCb->spsN1PucchRes.pres)
4183 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
4184 pucchReqInfo->hqInfo.hqRes[1] = hqCb->spsN1PucchRes.val + 1;
4187 #endif /* LTEMAC_SPS */
4190 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
4191 cell->pucchCfg.n1PucchAn);
4192 pucchReqInfo->hqInfo.hqRes[1] = (hqCb->pdcch->nCce +
4193 cell->pucchCfg.n1PucchAn + 1);
4200 /* TOD:: Add error print */
4204 #endif/*TFU_UPGRADE*/
4215 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, ue,
4216 pucchRecpInfo, validIdx,isDatPresOnSecCell);
4218 /* Channel selection wil not be used in case of
4219 * CQI + HARQ. if the data was present only on
4221 if((isDatPresOnSecCell == FALSE) &&
4222 (dlSfHqInfo->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS))
4223 {/* Data is present only on primary cell */
4225 switch(pucchReqInfo->uciInfo)
4227 case TFU_PUCCH_HARQ_SRS:
4228 case TFU_PUCCH_HARQ_CQI:
4229 case TFU_PUCCH_HARQ_SR_SRS:
4230 case TFU_PUCCH_HARQ_SR_CQI:
4232 dlSfHqInfo->uciFrmtTyp = RG_SCH_UCI_FORMAT1A_1B;
4233 pucchReqInfo->hqInfo.hqSz = primCellTbCount;
4234 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
4243 #endif/*TFU_UPGRADE*/
4244 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4245 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4247 }/* end of rgSCHTomUtlFillHqFdbkForFrmt1B */
4248 /** @brief This function handles filling of Hq reception request to
4253 * Function:rgSCHTomUtlFillHqFdbkForFrmt3
4256 * Allocates the N1Pucch Resources based on teh A Value
4258 * @param [out] TfuRecpReqInfo *recpReqInfo
4259 * @param [in] RgSchCellCb *cell
4260 * @param [in] U16 validIdx,
4261 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
4262 * @param [in] RgSchDlSf *dlSf,
4263 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
4264 * @param [out] RgSchErrInfo *err
4272 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3
4274 TfuRecpReqInfo *recpReqInfo,
4277 RgSchDlHqInfo *dlSfHqInfo,
4279 TfuUeRecpReqInfo *pucchRecpInfo,
4283 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3 (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err)
4284 TfuRecpReqInfo *recpReqInfo;
4287 RgSchDlHqInfo *dlSfHqInfo;
4289 TfuUeRecpReqInfo *pucchRecpInfo;
4294 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3
4296 TfuRecpReqInfo *recpReqInfo,
4298 RgSchDlHqInfo *dlSfHqInfo,
4300 TfuUeRecpReqInfo *pucchRecpInfo,
4304 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3 (recpReqInfo, cell, hqCb, dlSf, pucchRecpInfo, err)
4305 TfuRecpReqInfo *recpReqInfo;
4307 RgSchDlHqInfo *dlSfHqInfo;
4309 TfuUeRecpReqInfo *pucchRecpInfo;
4315 Inst inst = cell->instIdx;
4320 TfuUePucchRecpReq *pucchReqInfo = NULLP;
4322 //hqPNode = dlSfHqInfo->hqPLst.first;
4323 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
4329 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4330 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
4333 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate "
4334 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId));
4335 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4338 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4339 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
4340 * instead of SPS-CRNTI */
4342 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
4345 pucchReqInfo->hqType = TFU_HQ_RECP_REQ_NORMAL;
4346 /* Handling of other types */
4347 pucchReqInfo->type = TFU_UCI_HARQ;
4348 #else /* TFU_UPGRADE */
4349 pucchReqInfo->uciInfo = TFU_PUCCH_HARQ;
4350 /* Fill hqFdbkMode by using uciFrmtTyp from dlSfHqInfo */
4351 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
4352 /* Fill HqSz by using totalTbCnt based on the TM mode and
4353 * the number of serv cells configured*/
4355 pucchReqInfo->hqInfo.hqSz = ue->f1bCsAVal;
4356 pucchReqInfo->hqInfo.pucchResCnt = 1;
4358 cmMemset((U8 *)pucchReqInfo->hqInfo.hqRes,0xff,sizeof(U16)*TFU_MAX_HQ_RES);
4359 #endif/*TFU_UPGRADE*/
4360 pucchReqInfo->hqInfo.hqRes[0] = dlSfHqInfo->n3ScellPucch.n3PucchIdx;
4362 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, ue,
4363 pucchRecpInfo, validIdx,TRUE);
4364 #endif/*TFU_UPGRADE*/
4365 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4366 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4368 }/* end of rgSCHTomUtlFillHqFdbkForFrmt3 */
4372 /** @brief This function handles filling of HARQ feedback recption request to
4381 * @param [out] TfuRecpReqInfo *recpReqInfo
4382 * @param [in] RgSchCellCb *cell
4383 * @param [out] RgSchErrInfo *err
4390 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq
4392 TfuRecpReqInfo *recpReqInfo,
4398 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, validIdx, err)
4399 TfuRecpReqInfo *recpReqInfo;
4406 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq
4408 TfuRecpReqInfo *recpReqInfo,
4413 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, err)
4414 TfuRecpReqInfo *recpReqInfo;
4421 RgSchDlHqProcCb *hqCb;
4422 CmLteTimingInfo futTime;
4425 TfuUeRecpReqInfo *pucchRecpInfo = NULLP;
4427 RgSchDlHqProcCb *prvHqCb=NULLP;
4429 TRC2(rgSCHTomUtlFillHqFdbkRecpReq);
4436 /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper output
4437 * if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME() as it is
4438 * serving the purpose */
4439 RGSCHDECRFRMCRNTTIME(cell->crntTime, futTime, (RG_SCH_CMN_HARQ_INTERVAL -
4440 TFU_RECPREQ_DLDELTA));
4441 dlSf = rgSCHUtlSubFrmGet (cell, futTime);
4442 /* Get the next dlsf as well */
4443 RG_SCH_ADD_TO_CRNT_TIME(futTime, futTime, 1)
4444 nxtDlsf = rgSCHUtlSubFrmGet (cell, futTime);
4448 if (dlSf->ueLst.count != 0)
4450 node = dlSf->ueLst.first;
4453 ue = (RgSchUeCb *)(node->node);
4456 if(ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx].isPuschHarqRecpPres == TRUE)
4457 {/* This UE is already considered for PUSCH
4461 rgSCHTomUtlFillHqFdbkFor5gtf(recpReqInfo, cell, validIdx,
4462 &ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx], dlSf, pucchRecpInfo, err);
4463 } /* end of while */
4464 } /* If hq is expected */
4466 if (dlSf->msg4HqPLst.count != 0)
4469 node = dlSf->msg4HqPLst.first;
4472 hqCb = (RgSchDlHqProcCb*)(node->node);
4474 //TODO_SID: need to check validIdx
4475 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, validIdx, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err);
4477 } /* end of while */
4480 /* Check with TDD Code */
4481 /* FOR ACK NACK REP */
4483 } /* end of rgSCHTomUtlFillHqFdbkRecpReq */
4485 /** @brief This function handles filling of SR reception request to
4494 * @param [out] TfuRecpReqInfo *recpReqInfo
4495 * @param [in] RgSchCellCb *cell
4496 * @param [out] RgSchErrInfo *err
4503 PRIVATE S16 rgSCHTomUtlFillSrRecpReq
4505 TfuRecpReqInfo *recpReqInfo,
4511 PRIVATE S16 rgSCHTomUtlFillSrRecpReq (recpReqInfo, cell, validIdx, err)
4512 TfuRecpReqInfo *recpReqInfo;
4519 TfuUeRecpReqInfo *pucchRecpInfo;
4525 RgSchCmnUlUeSpsInfo *ulSpsUe = NULL;
4529 TRC2(rgSCHTomUtlFillSrRecpReq);
4533 node = cell->pCqiSrsSrLst[validIdx].srLst.first;
4536 ue = (RgSchUeCb *)(node->node);
4537 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4543 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4544 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4546 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4547 "TfuUeRecpReqInfo for cell RNTI:%d",ue->ueId);
4548 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4551 #ifdef TFU_ALLOC_EVENT_NO_INIT
4552 cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4553 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4559 /* Should we check for Rel8 and above???
4560 * Dont send SR recp req if logicalChannelSR-Mask enabled and UL SPS is
4562 ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue, cell);
4563 /* Avoiding check for ulSpsEnabled as isUlSpsActv FALSE if sps is not enabled*/
4564 if((ue->ul.ulSpsCfg.isLcSRMaskEnab) &&
4565 (ulSpsUe->isUlSpsActv))
4567 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
4572 pucchRecpInfo->rnti = ue->ueId;
4573 pucchRecpInfo->t.pucchRecpReq.srInfo.n1PucchIdx =
4574 ue->srCb.srCfg.srSetup.srResIdx;
4575 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR;
4576 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
4577 rgSCHTomUtlFillCqiSrsWithSr(cell, ue, recpReqInfo,
4578 pucchRecpInfo, validIdx);
4580 isAddToLst = rgSCHEmtcAddRecpInfoToLst(NULLP,recpReqInfo, pucchRecpInfo,ue->isEmtcUe);
4584 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4586 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4589 }/* end of rgSCHTomUtlFillSrRecpReq */
4592 /** @brief This function tells will the UE has a periodic CQI/PMI/RI
4601 * @param [in] RgSchUeCb *ue
4602 * @param [out] Bool *willueRprtCqiRi
4609 PRIVATE S16 rgSCHTomUtlWillUeRprtCqiRi
4612 Bool *willueRprtCqiRi
4615 PRIVATE S16 rgSCHTomUtlWillUeRprtCqiRi ( ue, willueRprtCqiRi)
4617 Bool *willueRprtCqiRi;
4620 TRC2(rgSCHTomUtlWillUeRprtCqiRi);
4622 /* Intialising Reporting probability as TRUE */
4623 *willueRprtCqiRi = TRUE;
4625 /* Checking the cases in which UE will not report CQIPMI/RI */
4626 if(ue->isDrxEnabled && ue->drxCb)
4629 if(ue->drxCb->cqiMask.pres && ue->drxCb->cqiMask.val == RGR_DRX_SETUP)
4630 {/*cqiMask is setup by upper layers */
4631 if((ue->drxCb->drxUlInactvMask & RG_SCH_DRX_ONDUR_BITMASK) ==
4632 RG_SCH_DRX_ONDUR_BITMASK)
4633 {/*onDuration NOT running, do not expect cqi/pmi/ri*/
4634 *willueRprtCqiRi = FALSE;
4638 #endif /*end of LTEMAC_R9*/
4639 /* ccpu00134258: Fix for CQI DRX issue*/
4640 if(ue->drxCb->onDurTmrLen > 2)
4642 if ( !RG_SCH_DRX_UL_IS_UE_ACTIVE(ue->drxCb) )
4643 {/*UE is not active, do not expect cqi/pmi/ri*/
4644 *willueRprtCqiRi = FALSE;
4647 }/*ue->isDrxEnabled*/
4650 } /*End of rgSCHTomUtlWillUeRprtCqiRi*/
4652 /** @brief This function handles filling of RI reception request to
4661 * @param [out] TfuRecpReqInfo *recpReqInfo
4662 * @param [in] RgSchCellCb *cell
4663 * @param [in] U16 validIdx
4664 * @param [out] RgSchErrInfo *err
4671 PRIVATE S16 rgSCHTomUtlFillRiRecpReq
4673 TfuRecpReqInfo *recpReqInfo,
4679 PRIVATE S16 rgSCHTomUtlFillRiRecpReq (recpReqInfo, cell, validIdx, err)
4680 TfuRecpReqInfo *recpReqInfo;
4687 TfuUeRecpReqInfo *pucchRecpInfo;
4690 Bool willUeRprtCqi; /* Flag set due to CQI Mask
4691 and UE inactive state (DRX) */
4692 RgSchUePCqiCb *riCb = NULLP;
4693 TRC2(rgSCHTomUtlFillRiRecpReq);
4695 node = cell->pCqiSrsSrLst[validIdx].riLst.first;
4698 riCb = (RgSchUePCqiCb *)(node->node);
4699 ue = riCb->servCellInfo->ue;
4700 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4702 if(riCb->riRecpPrcsd)
4704 /*ccpu00140578:: RI Proecssing is already done for this TTI
4705 * as part of PUSCH reception process or HARQ
4706 * Reception processing. Hence skipping this UE
4708 riCb->riRecpPrcsd = FALSE;
4711 if(riCb->riDist ==0)
4713 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
4714 #ifdef XEON_SPECIFIC_CHANGES
4715 if(RGSCH_TIMEINFO_SAME(cell->crntTime, ue->riRecpTime))
4721 if((TRUE == riCb->isRiIgnoByCollsn)
4722 || (willUeRprtCqi == FALSE))
4724 if(willUeRprtCqi == FALSE)
4727 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
4730 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4731 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4733 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4734 "TfuUeRecpReqInfo for cell RNTI:%d",ue->ueId);
4735 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4738 #ifdef TFU_ALLOC_EVENT_NO_INIT
4739 cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4740 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4743 pucchRecpInfo->rnti = ue->ueId;
4744 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
4745 riCb->cqiCfg.cqiSetup.cqiPResIdx;
4746 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = riCb->riNumBits;
4747 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_CQI;
4748 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
4750 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
4751 riCb->servCellInfo->sCellIdx;
4753 rgSCHTomUtlFillRiBitWidthInfo(ue);
4754 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
4755 if (ue->nPCqiCb->nCqiTrIdx == validIdx)
4757 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, ue->nPCqiCb);
4759 if((ue->srsCb.nSrsTrIdx == validIdx) && (ue->srsCb.srsDist ==0))
4761 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
4763 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4764 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4772 }/* end of rgSCHTomUtlFillRiRecpReq */
4775 /** @brief This function handles filling of 5GTF CQI-RI reception request to
4784 * @param [out] TfuRecpReqInfo *recpReqInfo
4785 * @param [in] RgSchCellCb *cell
4786 * @param [in] U16 validIdx
4787 * @param [out] RgSchErrInfo *err
4795 PRIVATE S16 rgSCHTomUtlFillCqiRiRecpReq
4797 TfuRecpReqInfo *recpReqInfo,
4803 PRIVATE S16 rgSCHTomUtlFillCqiRiRecpReq (recpReqInfo, cell, validIdx, err)
4804 TfuRecpReqInfo *recpReqInfo;
4810 TfuUeRecpReqInfo *pucchRecpInfo;
4811 RgSchUeCb *ue = NULLP;
4814 TRC2(rgSCHTomUtlFillCqiRiRecpReq);
4816 while ((ue = rgSCHDbmGetNextUeCb(cell, ue)) != NULLP)
4818 if (RGSCH_TIMEINFO_SAME (recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn))
4820 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4821 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4823 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4824 "TfuUeRecpReqInfo for cell RNTI:%d ", ue->ueId);
4825 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4828 #ifdef TFU_ALLOC_EVENT_NO_INIT
4829 cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4830 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4832 pucchRecpInfo->rnti = ue->ueId;
4833 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_XPUCCH_UCI_INFO;
4834 pucchRecpInfo->t.pucchRecpReq.uciPduInfo.pucchIndex = 0;
4835 pucchRecpInfo->t.pucchRecpReq.uciPduInfo.numBits = 5;
4837 RG_SCH_ADD_TO_CRNT_TIME(recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn,
4838 ue->ue5gtfCb.cqiRiPer);
4839 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4840 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4845 }/* end of rgSCHTomUtlFillCqiRiRecpReq */
4848 /** @brief This function handles filling of PCQI reception request to
4857 * @param [out] TfuRecpReqInfo *recpReqInfo
4858 * @param [in] RgSchCellCb *cell
4859 * @param [in] U16 validIdx
4860 * @param [out] RgSchErrInfo *err
4867 PRIVATE S16 rgSCHTomUtlFillPcqiRecpReq
4869 TfuRecpReqInfo *recpReqInfo,
4875 PRIVATE S16 rgSCHTomUtlFillPcqiRecpReq (recpReqInfo, cell, validIdx, err)
4876 TfuRecpReqInfo *recpReqInfo;
4883 TfuUeRecpReqInfo *pucchRecpInfo;
4888 Bool willUeRprtCqi; /* Flag set due to CQI Mask
4889 and UE Inactive state (DRX)*/
4891 RgSchUePCqiCb *cqiCb = NULLP;
4892 Bool isAddToLst = FALSE;
4894 TRC2(rgSCHTomUtlFillPcqiRecpReq);
4896 node = cell->pCqiSrsSrLst[validIdx].cqiLst.first;
4899 cqiCb = (RgSchUePCqiCb*)(node->node);
4900 ue = cqiCb->servCellInfo->ue;
4901 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4903 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
4905 if ((cqiCb->isCqiIgnoByCollsn == TRUE) ||
4906 (willUeRprtCqi == FALSE))
4908 if(willUeRprtCqi == FALSE)
4911 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
4915 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
4917 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
4918 cqiCb->servCellInfo->sCellIdx;
4920 cqiPmiSz = rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
4923 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to Fill CqiPmi "
4928 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4929 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4931 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4932 "TfuUeRecpReqInfo for cell RNTI:%d ", ue->ueId);
4933 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4936 #ifdef TFU_ALLOC_EVENT_NO_INIT
4937 cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4938 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4941 /*Fill PCQI params*/
4942 pucchRecpInfo->rnti = ue->ueId;
4943 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
4944 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
4945 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = cqiPmiSz;
4946 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_CQI;
4947 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
4948 if((ue->srsCb.nSrsTrIdx == validIdx) && (ue->srsCb.srsDist ==0))
4950 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
4953 isAddToLst = rgSCHEmtcAddRecpInfoToLst(NULLP,recpReqInfo, pucchRecpInfo,ue->isEmtcUe);
4957 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4959 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4962 }/* end of rgSCHTomUtlFillPcqiRecpReq */
4963 /** @brief This function handles filling of SRS reception request to
4972 * @param [out] TfuRecpReqInfo *recpReqInfo
4973 * @param [in] RgSchCellCb *cell
4974 * @param [in] U16 validIdx
4975 * @param [out] RgSchErrInfo *err
4981 PRIVATE S16 rgSCHTomUtlFillSrsRecpReq
4983 TfuRecpReqInfo *recpReqInfo,
4989 PRIVATE S16 rgSCHTomUtlFillSrsRecpReq (recpReqInfo, cell, validIdx, err)
4990 TfuRecpReqInfo *recpReqInfo;
4997 TfuUeRecpReqInfo *pucchRecpInfo;
5001 TRC2(rgSCHTomUtlFillSrsRecpReq);
5003 node = cell->pCqiSrsSrLst[validIdx].srsLst.first;
5006 ue = (RgSchUeCb *)(node->node);
5007 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
5009 if(ue->srsCb.srsRecpPrcsd)
5011 /* ccpu00140578::SRS Proecssing is already done for this TTI
5012 * as part of PUSCH or HARQ reception process and
5013 * hence skipping this UE */
5014 ue->srsCb.srsRecpPrcsd = FALSE;
5018 if(ue->srsCb.srsDist ==0)
5020 /* We need to add the recp request to be sent on the pucchANRep value. */
5021 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
5022 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
5024 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
5025 "TfuUeRecpReqInfo for RNTI:%d ",ue->ueId);
5026 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
5030 #ifdef TFU_ALLOC_EVENT_NO_INIT
5031 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
5035 pucchRecpInfo->rnti = ue->ueId;
5036 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
5037 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
5038 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
5039 ue->srsCb.srsCfg.srsSetup.fDomPosi;
5040 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
5041 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
5042 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
5043 ue->srsCb.srsCfg.srsSetup.txComb;
5044 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
5045 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
5046 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
5047 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
5049 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SRS;
5050 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
5051 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
5052 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
5056 ue->srsCb.srsDist--;
5060 }/* end of rgSCHTomUtlFillSrsRecpReq */
5063 /** @brief This function handles filling of data reception requests for
5072 * @param [out] TfuRecpReqInfo *recpReqInfo
5073 * @param [in] RgSchCellCb *cell
5074 * @param [out] RgSchErrInfo *err
5080 PRIVATE S16 rgSCHTomUtlFillDatRecpReq
5082 TfuRecpReqInfo *recpReqInfo,
5087 PRIVATE S16 rgSCHTomUtlFillDatRecpReq (recpReqInfo, cell, err)
5088 TfuRecpReqInfo *recpReqInfo;
5094 RgSchUlAlloc *alloc;
5095 TfuUeRecpReqInfo *datRecpInfo;
5097 TRC2(rgSCHTomUtlFillDatRecpReq)
5099 /* processing steps are
5100 * - Run through the UL allocations going out in this subframe.
5101 * - Run through the UL receptions expected the next subframe.
5103 alloc = rgSCHUtlFirstRcptnReq (cell);
5106 /* FOR ACK NACK REP */
5107 if (NULLP != alloc->ue)
5109 /* If measuring or ackNakRep we shall not send dat RecpReq */
5110 if ((alloc->ue->measGapCb.isMeasuring == TRUE) ||
5111 (alloc->ue->ackNakRepCb.isAckNakRep == TRUE))
5113 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
5118 if ((ret = rgSCHUtlGetEventMem((Ptr *)&datRecpInfo,
5119 sizeof(TfuUeRecpReqInfo),
5120 &(recpReqInfo->memCp))) != ROK)
5122 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
5123 "TfuUeRecpReqInfo for RNTI:%d ", alloc->ue->ueId);
5124 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
5127 if (!alloc->forMsg3)
5129 datRecpInfo->type = TFU_RECP_REQ_PUSCH;
5130 rgSCHUtlAllocRcptInfo (alloc,
5132 &datRecpInfo->t.puschRecpReq.mcs,
5133 &datRecpInfo->t.puschRecpReq.rbStart,
5134 &datRecpInfo->t.puschRecpReq.numRb,
5135 &datRecpInfo->t.puschRecpReq.rv,
5136 &datRecpInfo->t.puschRecpReq.size,
5137 &datRecpInfo->t.puschRecpReq.modType,
5138 &datRecpInfo->t.puschRecpReq.isRtx,
5139 &datRecpInfo->t.puschRecpReq.nDmrs,
5140 &datRecpInfo->t.puschRecpReq.ndi,
5141 &datRecpInfo->t.puschRecpReq.harqProcId
5146 datRecpInfo->type = TFU_RECP_REQ_MSG3;
5147 rgSCHUtlAllocRcptInfo (alloc,
5149 &datRecpInfo->t.msg3RecpReq.mcs,
5150 &datRecpInfo->t.msg3RecpReq.rbStart,
5151 &datRecpInfo->t.msg3RecpReq.numRb,
5152 /*ccpu00128993 - MOD - fix for msg3 softcombining bug*/
5153 &datRecpInfo->t.msg3RecpReq.rv,
5154 &datRecpInfo->t.msg3RecpReq.size,
5155 &datRecpInfo->t.msg3RecpReq.modType,
5156 &datRecpInfo->t.msg3RecpReq.isRtx,
5157 &datRecpInfo->t.msg3RecpReq.nDmrs,
5158 &datRecpInfo->t.msg3RecpReq.ndi,
5159 &datRecpInfo->t.msg3RecpReq.harqProcId
5163 /* Other fields of datRecpInfo shall be filled
5164 * here for new features */
5165 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(datRecpInfo->lnk));
5166 datRecpInfo->lnk.node = (PTR)datRecpInfo;
5168 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
5169 } /* end of while */
5171 } /* end of rgSCHTomUtlFillDatRecpReq */
5174 /** @brief This function handles filling of data reception requests for
5183 * @param [out] TfuRecpReqInfo *recpReqInfo
5184 * @param [in] RgSchCellCb *cell
5185 * @param [in] U16 validIdx
5186 * @param [out] RgSchErrInfo *err
5192 PRIVATE S16 rgSCHTomUtlFillDatRecpReq
5194 TfuRecpReqInfo *recpReqInfo,
5200 PRIVATE S16 rgSCHTomUtlFillDatRecpReq (recpReqInfo, cell, validIdx, err)
5201 TfuRecpReqInfo *recpReqInfo;
5207 CmLteTimingInfo dci0Time;
5210 RgSchUlAlloc *alloc;
5211 TfuUeRecpReqInfo *datRecpInfo;
5213 Bool hqPres; /*Set when HARQ Rec Req is present*/
5214 Bool isAperiodic = FALSE; /*Set when Aperiodic CQI is expected */
5217 TRC2(rgSCHTomUtlFillDatRecpReq);
5219 if((0 == (recpReqInfo->timingInfo.sfn % 30)) && (0 == recpReqInfo->timingInfo.slot))
5221 //printf("5GTF_CHECK rgSCHTomUtlFillDatRecpReq (%d : %d)\n", recpReqInfo->timingInfo.sfn, recpReqInfo->timingInfo.slot);
5223 /* processing steps are
5224 * - Run through the UL allocations going out in this subframe.
5225 * - Run through the UL receptions expected the next subframe.
5228 alloc = rgSCHUtlFirstRcptnReq (cell);
5231 isAperiodic = FALSE;
5232 ret = rgSCHUtlGetEventMem((Ptr *)&datRecpInfo,
5233 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
5236 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
5237 "TfuUeRecpReqInfo for RNTI:%d ", alloc->rnti);
5238 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
5241 #ifdef TFU_ALLOC_EVENT_NO_INIT
5242 datRecpInfo->t.puschRecpReq.initialNSrs.pres = FALSE;
5243 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = FALSE;
5245 datRecpInfo->type = TFU_RECP_REQ_PUSCH;
5246 /* ccpu00131944 - Intializing hqPres in each iteration*/
5248 /* Check if this if for MSG3 - no scope for feedback along with it. */
5249 if ((FALSE == alloc->forMsg3))
5251 /* Check if any DL HARQ processes has a feedback coming at the time of
5252 * this reception request.
5257 RGSCHDECRFRMCRNTTIME(cell->crntTime,dci0Time,(RGSCH_ULCTRL_RECP_DIST));
5259 idx = (dci0Time.sfn * RGSCH_NUM_SUB_FRAMES_5G + dci0Time.slot)%
5260 RGSCH_ULCTRL_RECP_DIST;
5262 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA;
5263 datRecpInfo->rnti = alloc->rnti;
5264 rgSCHUtlAllocRcptInfo (cell,alloc, &recpReqInfo->timingInfo,
5265 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5268 else /*Enters for Msg3 == TRUE condition*/
5270 /* ccpu00130884 - ADD - HO case when Msg3 alloc and Cqi/Ri/SRS opportunity
5271 * occur at same time */
5272 if(NULLP != alloc->ue)
5275 /* Only DATA is expected */
5276 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA;
5277 datRecpInfo->rnti = alloc->rnti;
5278 rgSCHUtlAllocRcptInfo (cell,alloc, &recpReqInfo->timingInfo,
5279 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5284 if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA &&
5285 datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_SRS &&
5286 isAperiodic == FALSE)
5288 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = TRUE;
5289 datRecpInfo->t.puschRecpReq.initialNumRbs.val = alloc->ue->initNumRbs;
5293 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = FALSE;
5296 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(datRecpInfo->lnk));
5297 datRecpInfo->lnk.node = (PTR)datRecpInfo;
5298 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
5300 } /* end of while */
5302 if(numUePerTti && (numUePerTti < RG_MAX_NUM_UE_PER_TTI))
5304 cell->ulNumUeSchedPerTti[numUePerTti-1]++;
5305 gUlNumUePerTti[numUePerTti - 1]++;
5308 } /* end of rgSCHTomUtlFillDatRecpReq */
5310 /* rg009.201. Added changes of TFU_UPGRADE */
5312 /***********************************************************
5314 * Func : rgSCHTomUtlFillRiBitWidthInfo
5317 * Desc : Fills the RI BitWidth and stores it for decoding.
5326 **********************************************************/
5328 PUBLIC S16 rgSCHTomUtlFillRiBitWidthInfo
5333 PUBLIC S16 rgSCHTomUtlFillRiBitWidthInfo(ueCb)
5337 RgSchUePCqiCb *riCb = ueCb->nPRiCb;
5338 TRC2(rgSCHTomUtlFillRiBitWidthInfo);
5340 if (ueCb->mimoInfo.txMode != RGR_UE_TM_3 &&
5341 ueCb->mimoInfo.txMode != RGR_UE_TM_4)
5346 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUCCH;
5347 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode=
5348 (TfuDlCqiPucchMode)riCb->cqiCfg.cqiSetup.prdModeEnum;
5349 switch(ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode)
5351 case TFU_PUCCH_CQI_MODE10:
5352 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info.type = TFU_RPT_RI;
5353 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info.u.ri =
5356 case TFU_PUCCH_CQI_MODE11:
5357 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info.type = TFU_RPT_RI;
5358 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info.u.ri =
5361 case TFU_PUCCH_CQI_MODE20:
5362 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info.type = TFU_RPT_RI;
5363 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info.u.ri =
5366 case TFU_PUCCH_CQI_MODE21:
5367 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info.type = TFU_RPT_RI;
5368 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info.u.ri =
5375 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5379 /***********************************************************
5381 * Func : rgSCHTomUtlFetchPcqiBitSz
5384 * Desc : Fetch the CQI/PMI bits for a UE based on the mode, periodicity.
5393 **********************************************************/
5395 PUBLIC U8 rgSCHTomUtlFetchPcqiBitSz
5402 PUBLIC U8 rgSCHTomUtlFetchPcqiBitSz(ueCb, numTxAnt, ri)
5410 TfuCqiPucchMode10 *mode10Info;
5411 TfuCqiPucchMode11 *mode11Info;
5412 TfuCqiPucchMode20 *mode20Info;
5413 TfuCqiPucchMode21 *mode21Info;
5414 RgSchUePCqiCb *cqiCb = ueCb->nPCqiCb;
5416 TRC3(rgSCHTomUtlFetchPcqiBitSz);
5418 confRepMode = cqiCb->cqiCfg.cqiSetup.prdModeEnum;
5419 if((ueCb->mimoInfo.txMode != RGR_UE_TM_3) &&
5420 (ueCb->mimoInfo.txMode != RGR_UE_TM_4))
5426 *ri = cqiCb->perRiVal;
5428 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUCCH;
5429 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode=
5430 (TfuDlCqiPucchMode)confRepMode;
5433 case RGR_PRD_CQI_MOD10:
5435 mode10Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info;
5437 mode10Info->type = TFU_RPT_CQI;
5438 mode10Info->u.cqi = 4;
5442 case RGR_PRD_CQI_MOD11:
5444 mode11Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info;
5445 mode11Info->type = TFU_RPT_CQI;
5451 mode11Info->u.cqi.cqi = 4;
5452 mode11Info->u.cqi.wideDiffCqi.pres = FALSE;
5453 mode11Info->u.cqi.pmi = 2;
5458 mode11Info->u.cqi.cqi = 4;
5459 mode11Info->u.cqi.wideDiffCqi.pres = TRUE;
5460 mode11Info->u.cqi.wideDiffCqi.val = 3;
5461 mode11Info->u.cqi.pmi = 1;
5464 else if(numTxAnt == 4)
5469 mode11Info->u.cqi.cqi = 4;
5470 mode11Info->u.cqi.wideDiffCqi.pres = FALSE;
5471 mode11Info->u.cqi.pmi = 4;
5476 mode11Info->u.cqi.cqi = 4;
5477 mode11Info->u.cqi.wideDiffCqi.pres = TRUE;
5478 mode11Info->u.cqi.wideDiffCqi.val = 3;
5479 mode11Info->u.cqi.pmi = 4;
5484 /* This is number of antenna case 1.
5485 * This is not applicable for Mode 1-1.
5486 * So setting it to invalid value */
5492 case RGR_PRD_CQI_MOD20:
5494 mode20Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info;
5495 mode20Info->type = TFU_RPT_CQI;
5499 mode20Info->u.cqi.isWideband = TRUE;
5500 mode20Info->u.cqi.u.wideCqi = 4;
5504 pcqiSz = 4 + cqiCb->label;
5505 mode20Info->u.cqi.isWideband = FALSE;
5506 mode20Info->u.cqi.u.subCqi.cqi = 4;
5507 mode20Info->u.cqi.u.subCqi.l = cqiCb->label;
5512 case RGR_PRD_CQI_MOD21:
5514 mode21Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info;
5515 mode21Info->type = TFU_RPT_CQI;
5516 //pcqiSz = rgSCHTomUtlFetchPcqiBitSzPucchMode21(ueCb,
5517 // mode21Info, numTxAnt, ri);
5525 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5530 /***********************************************************
5532 * Func : rgSCHTomUtlPcqiSbCalcBpIdx
5535 * Desc : Determines the BP index from the timing info
5544 **********************************************************/
5546 PUBLIC S16 rgSCHTomUtlPcqiSbCalcBpIdx
5548 CmLteTimingInfo crntTimInfo,
5550 RgSchUePCqiCb *cqiCb
5553 PUBLIC S16 rgSCHTomUtlPcqiSbCalcBpIdx(crntTimInfo, ueCb, cqiCb)
5554 CmLteTimingInfo crntTimInfo;
5556 RgSchUePCqiCb *cqiCb;
5559 U16 tti = (crntTimInfo.sfn * RGSCH_NUM_SUB_FRAMES_5G + crntTimInfo.slot);
5560 U16 prdNum = tti/cqiCb->cqiPeri;
5562 TRC2(rgSCHTomUtlPcqiSbCalcBpIdx);
5563 if((prdNum % cqiCb->h) == 0)
5567 cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_1;
5572 cqiCb->isWb = FALSE;
5573 cqiCb->bpIdx = ((prdNum % cqiCb->h) - 1) % cqiCb->J;
5575 cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_0;
5583 * @brief Function which moves PCQI, RI, SR and SRS to next periodicity
5584 * Occasions as that needs to be done in case of Ack/Nack repetition
5585 * reception request occasions or during Measurement Gap occasions.
5589 * Function: rgSCHTomUtlMoveNxtOccasion
5591 * Function which moves PCQI, RI, SR and SRS to next perodicity
5592 * Occasions as that needs to be done in case of Ack/Nack repetition
5593 * reception request occasions or during Measurement Gap occasions.
5595 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5598 * - Check whether the current Tx Instance matches with the rec req time
5599 * - If true, then move them to their next Tx Instance
5601 * @param[in] RgSchCellCb *cell,
5609 PUBLIC S16 rgSCHTomUtlMoveNxtOccasion
5616 PUBLIC S16 rgSCHTomUtlMoveNxtOccasion(cell, ue, validIdx)
5622 RgSchUePCqiCb *cqiCb = ue->nPCqiCb;
5623 RgSchUePCqiCb *riCb = ue->nPRiCb;
5624 TRC2(rgSCHTomUtlMoveNxtOccasion);
5626 /* ccpu00140578::Skip the UE if already RI recpetion
5627 * is processed in the same subframe */
5628 if ((riCb->nRiTrIdx == validIdx) &&
5629 (riCb->riRecpPrcsd == FALSE))
5631 if(riCb->riDist ==0)
5633 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
5639 /* ccpu00140578:: As this UE is considered for this TTI
5640 * Same UE should not get processed for RI reception
5641 * or for updating th RI distance.*/
5642 if(riCb->nRiTrIdx == validIdx)
5644 riCb->riRecpPrcsd = TRUE;
5647 if (cqiCb->nCqiTrIdx == validIdx)
5649 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
5652 /* ccpu00140578::Skip the UE if SRS recpetion
5653 * is already processed in the same subframe */
5654 if ((ue->srsCb.nSrsTrIdx == validIdx) &&
5655 (ue->srsCb.srsRecpPrcsd == FALSE))
5657 if(ue->srsCb.srsDist ==0)
5659 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
5663 ue->srsCb.srsDist--;
5665 /* ccpu00140578:: As this UE is considered for this TTI
5666 * Same UE should not get processed for SRS reception
5667 * or for updating th SRS distance.*/
5668 if(ue->srsCb.nSrsTrIdx == validIdx)
5670 ue->srsCb.srsRecpPrcsd = TRUE;
5673 if (ue->srCb.nSrTrIdx == validIdx)
5675 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
5678 } /* rgSCHTomUtlMoveNxtOccasion */
5681 /***********************************************************
5683 * Func : rgSCHTomPrepareAcqiRecp
5686 * Desc : Fetch the CQI/PMI bits for a UE based on the mode and store them
5687 * for decoding. Fill RECP request and prepare the scartchpad
5688 * to aid decoding of Aperiodic CQI.
5697 **********************************************************/
5699 PUBLIC Void rgSCHTomPrepareAcqiRecp
5703 TfuUePuschCqiRecpInfo *cqiRecpReqInfo,
5707 PUBLIC Void rgSCHTomPrepareAcqiRecp(ueCb, cell, cqiRecpReqInfo, ccIdx)
5710 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
5715 RgSchCqiRawPuschMode12 *mode12Info;
5716 RgSchCqiRawPuschMode20 *mode20Info;
5717 RgSchCqiRawPuschMode22 *mode22Info;
5718 RgSchCqiRawPuschMode30 *mode30Info;
5719 RgSchCqiRawPuschMode31 *mode31Info;
5720 U8 numTxAnt = cell->numTxAntPorts;
5721 U8 sCellIdx = ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)];
5723 RgSchUeACqiCb *acqiCb = &ueCb->cellInfo[sCellIdx]->acqiCb;
5725 TRC2(rgSCHTomPrepareAcqiRecp);
5728 cqiRecpReqInfo->reportType = TFU_APERIODIC_CQI_TYPE; /* Aperiodic */
5729 if (ueCb->mimoInfo.txMode == RGR_UE_TM_3 ||
5730 ueCb->mimoInfo.txMode == RGR_UE_TM_4)
5732 cqiRecpReqInfo->riSz[ccIdx].pres = TRUE;
5733 cqiRecpReqInfo->riSz[ccIdx].val = acqiCb->riNumBits;
5735 /* This flag will be rmeoved after making changes in BRDCM CL
5736 * Sachin is doing the change
5738 #if (defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
5740 cqiRecpReqInfo->cqiPmiSzR1[ccIdx] = acqiCb->cqiPmiSzR1;
5741 cqiRecpReqInfo->cqiPmiSzRn1[ccIdx] = acqiCb->cqiPmiSzRn1;
5743 if(ueCb->nPCqiCb->perRiVal == 1)
5745 cqiRecpReqInfo->cqiPmiSzR1[ccIdx] = acqiCb->cqiPmiSzR1;
5749 cqiRecpReqInfo->cqiPmiSzRn1[ccIdx] = acqiCb->cqiPmiSzRn1;
5752 /* Fill scratchpad to aid decoding of aper CQI upon
5754 confRepMode = acqiCb->aCqiCfg.aprdModeEnum;
5755 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUSCH;
5757 numOfCells = ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells;
5759 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5760 puschRawCqiInfo.mode = (TfuDlCqiPuschMode)confRepMode;
5762 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5763 puschRawCqiInfo.ri.pres = cqiRecpReqInfo->riSz[ccIdx].pres;
5765 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5766 puschRawCqiInfo.ri.val = cqiRecpReqInfo->riSz[ccIdx].val;
5768 /* Setting the sCellIdx */
5769 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5770 sCellIdx = sCellIdx;
5774 case RGR_APRD_CQI_MOD12:
5776 mode12Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5777 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode12Info;
5778 mode12Info->wideBCqiCw0 = 4;
5779 mode12Info->r1WideBCqiCw1 = 0;
5780 mode12Info->rg1WideBCqiCw1 = 4;
5783 mode12Info->r1TotalPmiBitLen = 2*acqiCb->N;
5784 mode12Info->rg1TotalPmiBitLen = acqiCb->N;
5786 else if(numTxAnt == 4)
5788 mode12Info->r1TotalPmiBitLen = 4*acqiCb->N;
5789 mode12Info->rg1TotalPmiBitLen = 4*acqiCb->N;
5794 case RGR_APRD_CQI_MOD20:
5796 mode20Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5797 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode20Info;
5798 mode20Info->wideBCqiCw = 4;
5799 mode20Info->subBandDiffCqi = 2;
5800 mode20Info->posOfM = acqiCb->L;
5804 case RGR_APRD_CQI_MOD22:
5806 mode22Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5807 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode22Info;
5808 mode22Info->wideBCqiCw0 = 4;
5809 mode22Info->sBDiffCqiCw0 = 2;
5810 mode22Info->r1WideBCqiCw1 = 0;
5811 mode22Info->r1SbDiffCqiCw1 = 0;
5812 mode22Info->rg1WideBCqiCw1 = 4;
5813 mode22Info->rg1SbDiffCqiCw1 = 2;
5814 mode22Info->posOfM = acqiCb->L;
5817 mode22Info->r1PmiBitLen = 4;
5818 mode22Info->rg1PmiBitLen = 2;
5820 else if(numTxAnt == 4)
5822 mode22Info->r1PmiBitLen = 8;
5823 mode22Info->rg1PmiBitLen = 8;
5828 case RGR_APRD_CQI_MOD30:
5830 mode30Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5831 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode30Info;
5832 mode30Info->wideBCqiCw = 4;
5833 mode30Info->totLenSbDiffCqi = 2*acqiCb->N;
5837 case RGR_APRD_CQI_MOD31:
5839 mode31Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5840 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode31Info;
5841 mode31Info->wideBCqiCw0 = 4;
5842 mode31Info->totLenSbDiffCqiCw0 = 2*acqiCb->N;
5843 mode31Info->r1WideBCqiCw1 = 0;
5844 mode31Info->r1TotLenSbDiffCqiCw1 =0;
5845 mode31Info->rg1WideBCqiCw1 = 4;
5846 mode31Info->rg1TotLenSbDiffCqiCw1 = 2*acqiCb->N;
5849 mode31Info->r1PmiBitLen = 2;
5850 mode31Info->rg1PmiBitLen = 1;
5852 else if(numTxAnt == 4)
5854 mode31Info->r1PmiBitLen = 4;
5855 mode31Info->rg1PmiBitLen = 4;
5866 * @brief Function which handles the filling of Aperiodic CQI/RI reception
5871 * Function: rgSCHTomUtlFillDatAperRecpReq
5873 * Function which handles the filling of Aperiodic CQI/RI reception
5876 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5879 * - Fill the reception request for the data arriving on the ULSCH
5880 * - Fill the reception request information for the Aperiodic CQI/PMI/RI
5882 * @param[in] RgSchCellCb *cell,
5883 * RgSchUlAlloc *alloc,
5884 * TfuUeRecpReqInfo *datRecpInfo,
5885 * CmLteTimingInfo *timeInfo,
5892 PUBLIC S16 rgSCHTomUtlFillDatAperRecpReq
5896 RgSchUlAlloc *alloc,
5897 TfuUeRecpReqInfo *datRecpInfo,
5898 CmLteTimingInfo *timeInfo,
5903 PUBLIC S16 rgSCHTomUtlFillDatAperRecpReq(cell, cqiReq, alloc, datRecpInfo, timeInfo, hqPres, validIdx)
5906 RgSchUlAlloc *alloc;
5907 TfuUeRecpReqInfo *datRecpInfo;
5908 CmLteTimingInfo *timeInfo;
5913 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
5914 RgSchUeCb *ueCb = alloc->ue;
5919 TRC2(rgSCHTomUtlFillDatAperRecpReq);
5921 /*Fill RI Reception Params*/
5922 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
5923 cqiRecpReqInfo->riBetaOff = alloc->ue->ul.betaRiOffst;
5924 cqiRecpReqInfo->cqiBetaOff = alloc->ue->ul.betaCqiOffst;
5927 cqiRecpReqInfo->cCNum = 0;
5928 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells = 0;
5931 rgSCHTomUtlGetTrigSet(cell, ueCb, cqiReq, &triggerSet);
5932 for (sIdx = 0; sIdx < CM_LTE_MAX_CELLS; sIdx++)
5934 /* The Aperiodic request for SCell index sIdx */
5935 if ((triggerSet >> (7 - sIdx)) & 0x01)
5937 /* The Aperiodic request for SCell index sIdx */
5938 rgSCHTomPrepareAcqiRecp(ueCb, ueCb->cellInfo[sIdx]->cell, cqiRecpReqInfo, cqiRecpReqInfo->cCNum);
5939 cqiRecpReqInfo->cCNum++;
5940 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells++;
5944 rgSCHTomPrepareAcqiRecp(ueCb, ueCb->cellInfo[0]->cell, cqiRecpReqInfo, cqiRecpReqInfo->cCNum);
5945 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells++;
5948 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5950 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
5952 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
5953 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
5957 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
5959 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
5963 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
5965 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
5967 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
5969 datRecpInfo->rnti = alloc->rnti;
5970 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
5971 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5973 } /* rgSCHTomUtlFillDatAperRecpReq */
5978 * @brief Function which handles the filling of Periodic RI reception
5979 * request values which arrives along with UL Data on ULSCH
5983 * Function: rgSCHTomUtlFillDatPriRecpReq
5985 * Function which handles the filling of Periodic RI reception
5986 * request values which arrives along with UL Data on ULSCH
5988 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5991 * - Fill the reception request for the data arriving on the ULSCH
5992 * - Fill the reception request information for the Periodic RI
5994 * @param[in] RgSchCellCb *cell,
5995 * RgSchUlAlloc *alloc,
5996 * TfuUeRecpReqInfo *datRecpInfo,
5997 * CmLteTimingInfo *timeInfo,
6004 PUBLIC S16 rgSCHTomUtlFillDatPriRecpReq
6007 RgSchUlAlloc *alloc,
6008 TfuUeRecpReqInfo *datRecpInfo,
6009 CmLteTimingInfo *timeInfo,
6014 PUBLIC S16 rgSCHTomUtlFillDatPriRecpReq(cell, alloc, datRecpInfo, timeInfo,
6017 RgSchUlAlloc *alloc;
6018 TfuUeRecpReqInfo *datRecpInfo;
6019 CmLteTimingInfo *timeInfo;
6024 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
6025 TRC2(rgSCHTomUtlFillDatPriRecpReq);
6027 /*Fill RI Reception Params*/
6028 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
6029 #ifdef TFU_ALLOC_EVENT_NO_INIT
6030 cqiRecpReqInfo->cqiBetaOff = 0;
6031 /* Fill only the first RI index since Periodic can come
6033 cqiRecpReqInfo->cqiPmiSzR1[0] = 0;
6034 cqiRecpReqInfo->cqiPmiSzRn1[0] = 0;
6036 cqiRecpReqInfo->reportType = TFU_PERIODIC_CQI_TYPE; /* periodic */
6037 cqiRecpReqInfo->riBetaOff = alloc->ue->ul.betaRiOffst;
6039 /* Fill only the first RI index since Periodic can come
6041 cqiRecpReqInfo->cCNum = 1;
6042 cqiRecpReqInfo->riSz[0].pres = TRUE;
6043 cqiRecpReqInfo->riSz[0].val = alloc->ue->nPRiCb->riNumBits;
6045 rgSCHTomUtlFillRiBitWidthInfo(alloc->ue);
6046 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
6048 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
6049 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
6053 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
6055 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
6059 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
6061 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
6063 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
6065 datRecpInfo->rnti = alloc->rnti;
6066 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
6067 &datRecpInfo->t.puschRecpReq.ulSchInfo);
6069 } /* rgSCHTomUtlFillDatPriRecpReq */
6073 * @brief Function which handles the filling of Periodic CQI/PMI reception
6074 * request values which arrives along with UL Data on ULSCH
6078 * Function: rgSCHTomUtlFillDatPCqiRecpReq
6080 * Function which handles the filling of Periodic CQI/PMI reception
6081 * request values which arrives along with UL Data on ULSCH
6083 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
6086 * - Fill the reception request for the data arriving on the ULSCH
6087 * - Fill the reception request information for the Periodic CQI/PMI
6089 * @param[in] RgSchCellCb *cell,
6090 * RgSchUlAlloc *alloc,
6091 * TfuUeRecpReqInfo *datRecpInfo,
6092 * CmLteTimingInfo *timeInfo,
6100 PUBLIC S16 rgSCHTomUtlFillDatPCqiRecpReq
6103 RgSchUlAlloc *alloc,
6104 TfuUeRecpReqInfo *datRecpInfo,
6105 CmLteTimingInfo *timeInfo,
6110 PUBLIC S16 rgSCHTomUtlFillDatPCqiRecpReq(cell, alloc, datRecpInfo,
6111 timeInfo, hqPres, validIdx)
6113 RgSchUlAlloc *alloc;
6114 TfuUeRecpReqInfo *datRecpInfo;
6115 CmLteTimingInfo *timeInfo;
6120 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
6121 U8 cqiPmiSz; /*Raw CQI/PMI Size*/
6124 TRC2(rgSCHTomUtlFillDatPCqiRecpReq);
6127 /*Fill CQI Reception Params*/
6128 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
6129 #ifdef TFU_ALLOC_EVENT_NO_INIT
6130 cqiRecpReqInfo->riBetaOff = 0;
6132 cqiRecpReqInfo->cqiBetaOff = alloc->ue->ul.betaCqiOffst;
6133 cqiPmiSz = rgSCHTomUtlFetchPcqiBitSz(alloc->ue, cell->numTxAntPorts, &ri);
6136 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Fill "
6137 "CqiPmi size RNTI:%d",alloc->rnti);
6141 /* Fill only the first RI index since Periodic can come
6143 cqiRecpReqInfo->cCNum = 1;
6144 cqiRecpReqInfo->reportType = TFU_PERIODIC_CQI_TYPE; /* Periodic */
6145 /* This flags will be removed once Sachin does changes
6147 #if (defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
6148 cqiRecpReqInfo->cqiPmiSzR1[0] = cqiPmiSz;
6149 cqiRecpReqInfo->cqiPmiSzRn1[0] = cqiPmiSz;
6153 cqiRecpReqInfo->cqiPmiSzR1[0] = cqiPmiSz;
6154 cqiRecpReqInfo->cqiPmiSzRn1[0] = 0;
6158 cqiRecpReqInfo->cqiPmiSzRn1[0] = cqiPmiSz;
6159 cqiRecpReqInfo->cqiPmiSzR1[0] = 0;
6162 cqiRecpReqInfo->riSz[0].pres = FALSE;
6164 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
6166 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
6167 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
6170 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
6172 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
6176 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
6178 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
6180 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
6182 datRecpInfo->rnti = alloc->rnti;
6183 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
6184 &datRecpInfo->t.puschRecpReq.ulSchInfo);
6186 } /* rgSCHTomUtlFillDatPCqiRecpReq */
6189 * @brief Function which handles the filling of SRS reception
6190 * request values which arrives along with UL Data on ULSCH
6194 * Function: rgSCHTomUtlFillDatSrsRecpReq
6196 * Function which handles the filling of SRS reception
6197 * request values which arrives along with UL Data on ULSCH
6199 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
6202 * - Fill the reception request for the data arriving on the ULSCH
6203 * - Fill the reception request information for the SRS
6205 * @param[in] RgSchCellCb *cell,
6206 * RgSchUlAlloc *alloc,
6207 * TfuUeRecpReqInfo *datRecpInfo,
6208 * CmLteTimingInfo *timeInfo,
6215 PUBLIC S16 rgSCHTomUtlFillDatSrsRecpReq
6218 RgSchUlAlloc *alloc,
6219 TfuUeRecpReqInfo *datRecpInfo,
6220 CmLteTimingInfo *timeInfo,
6224 PUBLIC S16 rgSCHTomUtlFillDatSrsRecpReq(cell, alloc, datRecpInfo, timeInfo,
6227 RgSchUlAlloc *alloc;
6228 TfuUeRecpReqInfo *datRecpInfo;
6229 CmLteTimingInfo *timeInfo;
6233 TRC2(rgSCHTomUtlFillDatSrsRecpReq);
6234 datRecpInfo->rnti = alloc->rnti;
6235 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
6238 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_HARQ_SRS;
6242 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_SRS;
6244 datRecpInfo->rnti = alloc->rnti;
6245 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
6246 &datRecpInfo->t.puschRecpReq.ulSchInfo);
6248 } /* rgSCHTomUtlFillDatSrsRecpReq */
6251 * @brief Function which handles the filling of only SRS reception
6252 * request values on ULSCH
6256 * Function: rgSCHTomFillOnlySrsRecpReq
6258 * Function which handles the filling of SRS reception
6259 * request values which arrives along with UL Data on ULSCH
6261 * Invoked by: rgSCHTomUtlFillDatSrsRecpReq of rg_sch_tom.c
6264 * - Fill the reception request for the data arriving on the ULSCH
6265 * - Fill the reception request information for the SRS
6267 * @param[in] RgSchCellCb *cell,
6268 * RgSchUlAlloc *alloc,
6269 * TfuUeRecpReqInfo *datRecpInfo,
6275 PUBLIC S16 rgSCHTomFillOnlySrsRecpReq
6278 RgSchUlAlloc *alloc,
6279 TfuUeRecpReqInfo *datRecpInfo
6282 PUBLIC S16 rgSCHTomFillOnlySrsRecpReq(cell, alloc, datRecpInfo)
6284 RgSchUlAlloc *alloc;
6285 TfuUeRecpReqInfo *datRecpInfo;
6288 TfuUePuschSrsRecpInfo *srsRecpReqInfo;
6289 TRC2(rgSCHTomFillOnlySrsRecpReq);
6291 srsRecpReqInfo = &datRecpInfo->t.puschRecpReq.srsInfo;
6292 srsRecpReqInfo->srsBw = (TfuUlSrsBwInfo)alloc->ue->srsCb.srsCfg.srsSetup.srsBw;
6293 srsRecpReqInfo->nRrc = alloc->ue->srsCb.srsCfg.srsSetup.fDomPosi;
6294 srsRecpReqInfo->srsHopBw = (TfuUlSrsHoBwInfo)alloc->ue->srsCb.srsCfg.srsSetup.srsHopBw;
6295 srsRecpReqInfo->transComb = alloc->ue->srsCb.srsCfg.srsSetup.txComb;
6296 srsRecpReqInfo->srsCfgIdx = alloc->ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6297 srsRecpReqInfo->srsCyclicShft = (TfuUlSrsCycShiftInfo)alloc->ue->srsCb.srsCfg.srsSetup.cycShift;
6299 /* ccpu00117050 - ADD - nSrs setting
6300 * Refer Section 5.2.2.6 of TS 36.212 V8.5.0*/
6301 datRecpInfo->t.puschRecpReq.ulSchInfo.nSrs = 1;
6304 } /* rgSCHTomFillOnlySrsRecpReq */
6307 * @brief Function which handles the filling of PCQI/RI, SRS and SR
6308 * Reception Request Information along
6309 * with the HARQ reception Request
6313 * Function: rgSCHTomUtlFillCqiSrSrsWithHq
6315 * Function which handles the filling of PCQI/RI, SRS ans SR
6316 * Reception Request Information along
6317 * with the HARQ reception Request
6320 * Invoked by: rgSCHTomUtlFillHqFdbkRecpReq &
6321 * rgSCHTomUtlFillSfHqFdbk of rg_sch_tom.c
6324 * - Fill the reception request for the Control Info arriving on the PUCCH
6325 * - Fill the reception request information for the SR, RI, CQI, SRS
6327 * @param[in] RgSchCellCb *cell,
6328 * TfuRecpReqInfo *recpReqInfo,
6329 * RgSchDlHqProcCb *hqCb,
6330 * @param[out] TfuUeRecpReqInfo *pucchRecpInfo
6331 * @param[in] U16 validIdx
6337 PRIVATE S16 rgSCHTomUtlFillCqiSrSrsWithHq
6340 TfuRecpReqInfo *recpReqInfo,
6342 TfuUeRecpReqInfo *pucchRecpInfo,
6344 Bool isDatPresOnSecCell
6347 PRIVATE S16 rgSCHTomUtlFillCqiSrSrsWithHq(cell, recpReqInfo, ue,
6348 pucchRecpInfo, validIdx,isDatPresOnSecCell)
6350 TfuRecpReqInfo *recpReqInfo;
6352 TfuUeRecpReqInfo *pucchRecpInfo;
6354 Bool isDatPresOnSecCell;
6357 RgSchUePCqiCb *cqiCb;
6358 RgSchUePCqiCb *riCb;
6359 U8 ri; /*To fetch RI value*/
6360 Bool willUeRprtCqi; /* Flag set due to CQI Mask and
6361 UE Inactive state (DRX)*/
6362 Bool willUeRprtSr = TRUE;
6363 TfuAckNackMode hqFdbkMode;
6366 Bool dropCqi = FALSE;
6368 RgSchCmnUlUeSpsInfo *ulSpsUe = NULL;
6371 RgSchEmtcUeInfo *emtcUe = NULLP;
6374 TRC2(rgSCHTomUtlFillCqiSrSrsWithHq);
6378 /*Changes for PUCCH Format3 */
6379 hqFdbkMode = pucchRecpInfo->t.pucchRecpReq.hqInfo.hqFdbkMode;
6380 numCqiBit = rgSCHCmnCalcPcqiBitSz (ue,cell->numTxAntPorts);
6381 totalPucchBits = pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz + numCqiBit;
6384 emtcUe = RG_GET_EMTC_UE_CB(ue);
6386 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
6387 #ifdef EMTC_ENABLE /*VINU*/
6390 if((emtcUe->pucchRepNumFr1 > 1) || (emtcUe->pucchRepNumFr2 > 1))
6392 willUeRprtCqi = FALSE;
6393 willUeRprtSr = FALSE;
6397 if(ue->srCb.nSrTrIdx == validIdx)
6401 /* Should we check for Rel8 and above???
6402 * Dont send SR recp req if logicalChannelSR-Mask enabled and UL SPS is
6404 ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue, cell);
6405 /* Avoiding check for ulSpsEnabled as isUlSpsActv FALSE if sps is not enabled*/
6406 if(!((ue->ul.ulSpsCfg.isLcSRMaskEnab) &&
6407 (ulSpsUe->isUlSpsActv)))
6414 pucchRecpInfo->t.pucchRecpReq.srInfo.n1PucchIdx =
6415 ue->srCb.srCfg.srSetup.srResIdx;
6416 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
6417 /* FORMAT3: If SR is present it will be appended after HARQ */
6418 totalPucchBits = totalPucchBits + 1;
6425 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
6427 /* LTE_ADV:: UE will drop CSI during CSI+1BCS if data is present
6428 * on sec cell(isDatPresOnSecCell)*/
6430 if (hqFdbkMode == TFU_ACK_NACK_CHANNEL_SELECTION)
6432 if (hqFdbkMode == TFU_UCI_FORMAT_1B_CS)
6435 if (isDatPresOnSecCell == TRUE)
6442 /* Format 3 Changes : If Hq + SR + CQI bits < 22 and simultaneousAckNackAndCQI-Format3
6443 is enabled then CQI will be multiplexed with HQ otherwise CQI will be dropped
6444 Spec 36.213 Sec 10.1.1 */
6445 else if (hqFdbkMode == TFU_UCI_FORMAT_3)
6447 if ((isDatPresOnSecCell == TRUE) &&
6448 ((!ue->simulAckNackCQIFormat3) || (totalPucchBits > 22)))
6456 cqiCb = ue->nPCqiCb;
6457 if(riCb->nRiTrIdx == validIdx)
6459 /*ccpu00140578:: Skip the UE if the RI is already processed
6461 if(riCb->riRecpPrcsd == FALSE)
6463 if(riCb->riDist == 0)
6465 if((riCb->cqiCfg.cqiSetup.sANCQI == TRUE) && (willUeRprtCqi == TRUE)&&
6466 (isDatPresOnSecCell == FALSE))
6469 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6470 riCb->cqiCfg.cqiSetup.cqiPResIdx;
6471 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6473 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_HARQ_SR)
6475 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI;
6479 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_CQI;
6481 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6483 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6484 ue->nPRiCb->servCellInfo->sCellIdx;
6486 rgSCHTomUtlFillRiBitWidthInfo(ue);
6487 if (ue->nPCqiCb->nCqiTrIdx == validIdx)
6489 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, ue->nPCqiCb);
6504 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
6510 /* Skip the UE for RI processing on PUCCH
6511 * in the same subframe as it already processed */
6512 if(riCb->nRiTrIdx == validIdx)
6514 /* As the new idx is same is current idx
6515 * then PUCCH reception processing will consider
6516 * RI also in the same subframe. To block this
6517 * below flag is used*/
6518 riCb->riRecpPrcsd = TRUE;
6522 else if(cqiCb->nCqiTrIdx == validIdx)
6524 if((cqiCb->cqiCfg.cqiSetup.sANCQI == TRUE) && (willUeRprtCqi == TRUE)&&
6525 (isDatPresOnSecCell == FALSE))
6528 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6529 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
6531 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6533 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6534 cqiCb->servCellInfo->sCellIdx;
6536 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6537 rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
6538 if(0 == pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz)
6540 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d "
6541 "Unable to Fill CqiPmi size", ue->ueId);
6544 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_HARQ_SR)
6546 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI;
6550 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_CQI;
6563 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6565 if(ue->srsCb.nSrsTrIdx == validIdx)
6567 /* ccpu00140578::Skip the UE for SRS reception processing
6568 * if already done as part of PUSCH recpetion
6570 if(ue->srsCb.srsRecpPrcsd == FALSE)
6572 if(ue->srsCb.srsDist ==0 )
6574 if((pucchRecpInfo->t.pucchRecpReq.uciInfo != TFU_PUCCH_HARQ_CQI)
6575 && (ue->srsCb.srsCfg.srsSetup.sANSrs)
6576 && (isDatPresOnSecCell == FALSE))
6579 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
6580 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
6581 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
6582 ue->srsCb.srsCfg.srsSetup.fDomPosi;
6583 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
6584 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
6585 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
6586 ue->srsCb.srsCfg.srsSetup.txComb;
6587 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
6588 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6589 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
6590 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
6591 /* ccpu00116923 - ADD - New Reception Request types for CQI and SRS with SR */
6592 switch(pucchRecpInfo->t.pucchRecpReq.uciInfo)
6594 case TFU_PUCCH_HARQ_SR:
6595 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_SRS;
6597 case TFU_PUCCH_HARQ_SR_CQI:
6598 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI_SRS;
6601 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SRS;
6605 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
6609 ue->srsCb.srsDist--;
6611 /* Skip the UE for SRS processing on PUCCH
6612 * in the same subframe as it already processed */
6613 if(ue->srsCb.nSrsTrIdx == validIdx)
6615 /* As the new idx is same is current idx
6616 * then PUCCH reception processing will consider
6617 * SRS also in the same subframe. To block this
6618 * below flag is used*/
6619 ue->srsCb.srsRecpPrcsd = TRUE;
6627 } /* rgSCHTomUtlFillCqiSrSrsWithHq */
6630 * @brief Function which handles the filling of PCQI/RI, SRS
6631 * Reception Request Information along with SR reception
6636 * Function: rgSCHTomUtlFillCqiSrsWithSr
6638 * Function which handles the filling of PCQI/RI, SRS
6639 * Reception Request Information along
6640 * with the SR reception Request
6643 * Invoked by: rgSCHTomUtlFillSrRecpReq of rg_sch_tom.c
6646 * - Fill the reception request for CQI/RI, SRS if they occur
6647 * in the same instance as of SR.
6649 * @param[in] RgSchCellCb *cell,
6651 * TfuRecpReqInfo *recpReqInfo,
6652 * @param[out] TfuUeRecpReqInfo *pucchRecpInfo
6653 * @param[in] U16 validIdx
6660 PRIVATE S16 rgSCHTomUtlFillCqiSrsWithSr
6664 TfuRecpReqInfo *recpReqInfo,
6665 TfuUeRecpReqInfo *pucchRecpInfo,
6669 PRIVATE S16 rgSCHTomUtlFillCqiSrsWithSr(cell, ue, recpReqInfo,
6670 pucchRecpInfo, validIdx)
6673 TfuRecpReqInfo *recpReqInfo;
6674 TfuUeRecpReqInfo *pucchRecpInfo;
6678 RgSchUePCqiCb *cqiCb;
6679 RgSchUePCqiCb *riCb;
6680 U8 ri; /*To fetch RI value*/
6681 Bool willUeRprtCqi; /* Flag set due to CQI Mask and
6682 UE Inactive state (DRX)*/
6683 TRC2(rgSCHTomUtlFillCqiSrsWithSr);
6686 cqiCb = ue->nPCqiCb;
6687 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
6689 rgSCHEmtcWillUeRptCqi(ue, &willUeRprtCqi);
6691 if(riCb->nRiTrIdx == validIdx)
6693 /*ccpu00140578:: Skip the UE if the RI is already processed
6695 if(riCb->riRecpPrcsd == FALSE)
6697 if(riCb->riDist == 0)
6699 if(willUeRprtCqi == TRUE)
6702 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6703 riCb->cqiCfg.cqiSetup.cqiPResIdx;
6704 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6707 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI;
6708 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6710 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6711 ue->nPRiCb->servCellInfo->sCellIdx;
6713 rgSCHTomUtlFillRiBitWidthInfo(ue);
6714 /* TODO:: syed Shouldn't this be done outside this if condition */
6715 if (cqiCb->nCqiTrIdx == validIdx)
6717 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6720 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
6726 if(riCb->nRiTrIdx == validIdx)
6727 {/* Need to skip this UE during PUCCH RI recpetion process
6728 in the current subframe */
6729 riCb->riRecpPrcsd = TRUE;
6733 else if(cqiCb->nCqiTrIdx == validIdx)
6735 if(willUeRprtCqi == TRUE)
6738 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6739 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
6741 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6744 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6745 cqiCb->servCellInfo->sCellIdx;
6747 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6748 rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
6749 if(0 == pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz)
6751 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d"
6752 " Unable to Fill CqiPmi size", ue->ueId);
6756 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI;
6758 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6760 if(ue->srsCb.nSrsTrIdx == validIdx)
6762 /* ccpu00140578:: Cnsider the SRS processing
6763 * only if not done in the same TTI
6764 * as part of PUSCH or HARQ reception process*/
6765 if(ue->srsCb.srsRecpPrcsd == FALSE)
6767 if(ue->srsCb.srsDist ==0 )
6769 if(ue->srsCb.srsCfg.srsSetup.sANSrs)
6772 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
6773 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
6774 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
6775 ue->srsCb.srsCfg.srsSetup.fDomPosi;
6776 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
6777 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
6778 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
6779 ue->srsCb.srsCfg.srsSetup.txComb;
6780 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
6781 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6782 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
6783 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
6784 /* ccpu00116923 - ADD - New Reception Request types for CQI and
6786 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_SR_CQI)
6788 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI_SRS;
6792 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_SRS;
6796 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
6800 ue->srsCb.srsDist--;
6802 /* Skip the UE for SRS processing on PUCCH
6803 * in the same subframe as it already processed */
6804 if(ue->srsCb.nSrsTrIdx == validIdx)
6806 /* As the new idx is same is current idx
6807 * then PUCCH reception processing will consider
6808 * SRS also in the same subframe. To block this
6809 * below flag is used*/
6810 ue->srsCb.srsRecpPrcsd = TRUE;
6816 } /* rgSCHTomUtlFillCqiSrsWithSr */
6822 /** @brief This function handles filling of HARQ feedback repetition
6823 * recption request for each subframe
6827 * Function: rgSCHTomUtlFillSfRepHqFdbk
6831 * @param [out] TfuRecpReqInfo *recpReqInfo
6832 * @param [in] RgSchCellCb *cell
6833 * @param [out] RgSchErrInfo *err
6834 * @param [in] RgSchDlSf *dlSf
6835 * @param [in] U8 noFdbks
6836 * @param [in] CmMemListCp *memCp
6837 * @param [in] U8 elemIdx
6838 * @param [in] RgSchDlSf *nxtDlsf
6845 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk
6847 TfuRecpReqInfo *recpReqInfo,
6848 RgSchCellCb *cellCb,
6858 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk (recpReqInfo, cellCb, err, dlSf,
6859 noFdbks, memCp, elemIdx, nxtDlsf, validIdx)
6860 TfuRecpReqInfo *recpReqInfo;
6861 RgSchCellCb *cellCb;
6872 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk
6874 TfuRecpReqInfo *recpReqInfo,
6875 RgSchCellCb *cellCb,
6884 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk (recpReqInfo, cellCb, err, dlSf,
6885 noFdbks, memCp, elemIdx, nxtDlsf)
6886 TfuRecpReqInfo *recpReqInfo;
6887 RgSchCellCb *cellCb;
6897 RgSchDlHqProcCb *hqCb;
6901 TfuUeRecpReqInfo *pucchRecpInfo;
6903 TfuUePucchHqRecpInfo *hqRecpReq;
6905 RgSchDlHqTbCb *tbCb;
6906 RgSchDlHqProcCb *prvHqCb = NULLP;
6908 TRC2(rgSCHTomUtlFillSfRepHqFdbk)
6910 node = dlSf->ackNakRepQ.first;
6913 tbCb = (RgSchDlHqTbCb *)(node->node);
6915 ueCb = hqCb->hqE->ue;
6917 if (--tbCb->fbkRecpRepCntr)
6919 /* Add to next subfarme */
6920 /* Add this hqCb to the next dlSf's ackNakRepQ */
6921 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
6922 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
6923 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
6924 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
6931 /* Go to the next node */
6936 if ((hqCb->hqE->ue != NULLP) &&
6937 (hqCb->hqE->ue->measGapCb.isMeasuring != TRUE)
6938 && (hqCb != prvHqCb)
6941 /* We need to add the recp request to be sent on the pucchANRep
6944 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
6945 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
6948 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to"
6949 "Allocate TfuUeRecpReqInfo for RNTI:%d ", ueCb->ueId);
6950 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
6953 pucchRecpInfo->rnti = ueCb->ueId;
6955 pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
6957 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
6960 /* FOR repetition Feedback shall come on n1PucchAnRep Configured per
6964 pucchRecpInfo->t.pucchRecpReq.hqType = TFU_HQ_RECP_REQ_N1PUCCH;
6965 pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = ueCb->ackNakRepCb.pucchRes;
6967 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
6968 hqRecpReq = &(pucchRecpInfo->t.pucchRecpReq.hqInfo);
6969 /* ACK NACK rep works only in bundling mode . */
6970 hqRecpReq->hqFdbkMode = (TfuAckNackMode)RGR_TDD_ACKNACK_MODE_BUNDL;
6971 if ((hqCb->hqPSfLnk.node != NULLP) &&
6972 (hqCb->hqPSfLnk.node != NULLP))
6975 hqRecpReq->hqSz = 2;
6979 hqRecpReq->hqSz = 1;
6981 hqRecpReq->pucchResCnt = 1;
6982 hqRecpReq->hqRes[0] = ueCb->ackNakRepCb.pucchRes;
6984 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
6985 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
6987 /* In a given dlSf, if there is 2 TBs context
6988 * stored for a given harq, then they are added
6989 * adjacent to each other in the subframe. To avoid
6990 * adding duplicate recpnInfo for each TB, store this
6991 * hqCb in prvHqCb. If nextHqCb is same as prvHqCb then
6992 * do not add reception req info.*/
6995 RGSCH_NULL_CHECK(cellCb->instIdx, hqCb->hqE->ue);
6996 rgSCHTomUtlMoveNxtOccasion(cellCb, hqCb->hqE->ue, validIdx);
6998 /* Go to the next node */
7005 /** @brief This function handles filling of HARQ feedback recption request
7010 * Function: rgSCHTomUtlFillSfHqFdbkInfo
7014 * @param [out] TfuRecpReqInfo *recpReqInfo
7015 * @param [in] RgSchCellCb *cell
7016 * @param [out] RgSchErrInfo *err
7017 * @param [in] RgSchDlSf *dlSf
7018 * @param [in] U8 noFdbks
7019 * @param [in] CmMemListCp *memCp
7020 * @param [in] U8 elemIdx
7021 * @param [in] RgSchDlSf *nxtDlsf
7022 * @param [in] U16 validIdx;
7029 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo
7031 TfuRecpReqInfo *recpReqInfo,
7032 RgSchCellCb *cellCb,
7040 RgSchDlHqProcCb *hqCb,
7041 RgSchUePucchRecpInfo *pucchInfo,
7043 RgSchDlHqProcCb *prvHqCb
7046 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo (recpReqInfo, cellCb, err, dlSf,
7047 noFdbks, memCp, elemIdx, nxtDlsf, validIdx, hqCb, pucchInfo, alloc, prvHqCb)
7048 TfuRecpReqInfo *recpReqInfo;
7049 RgSchCellCb *cellCb;
7057 RgSchDlHqProcCb *hqCb;
7058 RgSchUePucchRecpInfo *pucchInfo;
7060 RgSchDlHqProcCb *prvHqCb;
7064 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo
7066 TfuRecpReqInfo *recpReqInfo,
7067 RgSchCellCb *cellCb,
7074 RgSchDlHqProcCb *hqCb,
7075 RgSchUePucchRecpInfo *pucchInfo,
7077 RgSchDlHqProcCb *prvHqCb
7080 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo (recpReqInfo, cellCb, err, dlSf,
7081 noFdbks, memCp, elemIdx, nxtDlsf, hqCb, pucchInfo, alloc, prvHqCb)
7082 TfuRecpReqInfo *recpReqInfo;
7083 RgSchCellCb *cellCb;
7090 RgSchDlHqProcCb *hqCb;
7091 RgSchUePucchRecpInfo *pucchInfo;
7093 RgSchDlHqProcCb *prvHqCb;
7098 RgSchUeCb *ueCb = hqCb->hqE->ue;
7100 CmLteTimingInfo futTime;
7101 RgSchTddANInfo *anInfo;
7104 RgrTddAckNackMode ackNackMode;
7105 RgSchDlHqTbCb *tbCb;
7110 TRC2(rgSCHTomUtlFillSfHqFdbkInfo)
7113 RG_SCH_ADD_TO_CRNT_TIME(cellCb->crntTime, futTime, TFU_RECPREQ_DLDELTA);
7117 for (idx = 0 ;idx < 2; idx++)
7119 if (HQ_TB_WAITING == hqCb->tbInfo[idx].state)
7122 tbCb = &hqCb->tbInfo[idx];
7126 ackNackMode = ueCb->dl.ackNackMode;
7128 if(ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL)
7130 anInfo = rgSCHUtlGetUeANFdbkInfo(ueCb, &futTime);
7131 /* Only the last scheduled TB for the UE is for HARQ
7132 * ACK/NACK reception in Bundling case */
7133 if((anInfo == NULLP) ||
7134 (anInfo->latestMIdx != dlSf->dlFdbkInfo.m))
7141 /* Get the TFU reception request pointer, if present */
7142 cmHashListFind(&cellCb->ueTfuPendLst, (U8*) &ueCb->ueId,
7143 sizeof(ueCb->ueId), 0, (PTR *) &pucchInfo);
7146 /* For upgrade we shall use the existing logic of pending list. */
7147 cmHashListFind(&cellCb->ueTfuPendLst, (U8*) &ueCb->ueId,
7148 sizeof(ueCb->ueId), 0, (PTR *) &pucchInfo);
7151 else if(hqCb->hqE->raCb != NULLP)
7153 /* For RACH it is set to Bundling */
7154 ackNackMode = RGR_TDD_ACKNACK_MODE_BUNDL;
7155 rnti = hqCb->hqE->raCb->tmpCrnti;
7162 /* Do not proceed if PUSCH
7163 reception req is already filled*/
7168 /* Go to the next node */
7172 if(((ueCb == NULLP) || (ueCb->measGapCb.isMeasuring != TRUE))
7176 TknU16 n1PucchTkn = {FALSE, 0};
7179 pdcch = tbCb->hqP->pdcch;
7181 n1PucchTkn = hqCb->spsN1PucchRes;
7183 for (tbIndx = 0; tbIndx < TFU_MAX_TB; tbIndx++)
7185 if (hqCb->tbInfo[tbIndx].state == HQ_TB_WAITING &&
7186 (RGSCH_TIMEINFO_SAME(hqCb->tbInfo[tbIndx].fdbkTime,
7187 recpReqInfo->timingInfo)))
7190 hqCb->tbInfo[tbIndx].pucchFdbkIdx = hqCb->ulDai;
7193 ret = rgSCHTomUtlFillSfHqFdbkForOneUe(hqCb,recpReqInfo, cellCb, err, dlSf, noFdbks,
7194 memCp, elemIdx, nxtDlsf, rnti, ackNackMode, &pucchInfo, pdcch,
7195 n1PucchTkn, &alloc, hqSz);
7200 /* TODO:: In case of F1BCS and CSI in same subframe
7201 * UE shall drop the CSI if there was at least one
7202 * PDSCH transmission in any of the DL subframe
7203 * mapping to this UL subframe
7206 rgSCHTomUtlFillCqiSrSrsWithHq(cellCb,recpReqInfo, hqCb->hqE->ue,
7207 pucchInfo->pucchRecpInfo, validIdx,FALSE);
7209 if((hqCb->hqE->ue) &&
7210 (hqCb->hqE->ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS))
7213 if(RG_SCH_IS_CELL_SEC(hqCb->hqE->ue,hqCb->hqE->cell))
7215 switch(pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo)
7217 case TFU_PUCCH_HARQ_SR_CQI:
7218 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
7219 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
7221 case TFU_PUCCH_HARQ_CQI:
7222 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
7223 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
7225 case TFU_PUCCH_HARQ_SR_CQI_SRS:
7226 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_SRS;
7227 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
7229 case TFU_PUCCH_HARQ_SR_SRS:
7230 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
7232 case TFU_PUCCH_HARQ_SRS:
7233 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
7244 /* TODO antz - pushing the following code (under TFU_UPGRADE)
7245 * into the above function (...ForOneUe) did not work (caused
7246 * two additional TCs to fail). Don't know why. If this
7247 * is done later, make sure that the code branch
7248 * for relPdcch (later in this func) is also modified appropriately.
7250 /* Now add to the recp request or pending list */
7251 //if((elemIdx != (noFdbks - 1)))
7253 cmHashListInsert(&cellCb->ueTfuPendLst, (PTR) pucchInfo,
7254 (U8 *)&rnti ,(U16) sizeof(CmLteRnti));
7258 } /* If measuring */
7259 /* Go to the next node */
7260 if ((tbCb->fbkRecpRepCntr) && (--tbCb->fbkRecpRepCntr))
7262 /* Add to next subfarme */
7263 /* Add this hqCb to the next dlSf's ackNakRepQ */
7264 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
7265 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
7266 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
7267 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
7269 /* In a given dlSf, if there is 2 TBs context
7270 * stored for a given harq, then they are added
7271 * adjacent to each other in the subframe. To avoid
7272 * adding duplicate recpnInfo for each TB, store this
7273 * hqCb in prvHqCb. If nextHqCb is same as prvHqCb then
7274 * do not add reception req info.*/
7282 /** @brief This function calculates the pucch resource idx
7283 * that is to be filled in harq reception request
7287 * Function: rgSCHTomUtlGethqRes
7290 * -Calculate the pucch resource idx
7291 * Harq Reception Request for Format 1B with
7294 * @param [in] U8 noFdbks
7295 * @param [in] RgSchDlSf *dlSf
7296 * @param [in] RgSchPdcch *pdcch
7297 * @param [in] RgSchCellCb *cellCb
7298 * @param [out]U16 *hqRes
7302 PRIVATE Void rgSCHTomUtlGethqRes
7307 RgSchCellCb *cellCb,
7311 PRIVATE Void rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,hqRes)
7315 RgSchCellCb *cellCb;
7327 m = dlSf->dlFdbkInfo.m;
7329 P = rgSCHCmnGetPValFrmCCE(cellCb, nCce);
7330 nP = cellCb->rgSchTddNpValTbl[P];
7331 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
7332 *hqRes = (M - m - 1)* nP + (m * nPlusOne) + pdcch->nCce +
7333 cellCb->pucchCfg.n1PucchAn;
7338 /** @brief This function fills the harq reception request for
7339 * TDD in case of Fomat 1B with CS for M=1
7343 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1
7346 * -Fill Harq Reception Request for Format 1B with
7349 * @param [in] RgSchDlHqProcCb *hqCb
7350 * @param [in] TfuUePucchRecpReq *hqRecpReq
7351 * @param [in] U8 noFdbks
7352 * @param [in] RgSchDlSf *dlSf
7353 * @param [in] RgSchPdcch *pdcch
7354 * @param [in] RgSchCellCb *cellCb
7358 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1
7360 RgSchDlHqProcCb *hqCb,
7361 TfuUePucchRecpReq *hqRecpReq,
7368 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1(hqCb, hqRecpReq,
7369 noFdbks,dlSf,pdcch,cellCb)
7370 RgSchDlHqProcCb *hqCb;
7371 TfuUePucchRecpReq *hqRecpReq;
7375 RgSchCellCb *cellCb;
7378 RgSchUeCb *ue = NULLP;
7379 Bool isCellSec = FALSE;
7382 /*ccpu00147920: UeCb is NULL for SPS activation*/
7383 if(pdcch && pdcch->ue)
7384 {/* SPS Release pdcch or dynamic data */
7391 /* This is not supposed to happen
7392 * Error case. hqCB has to be ter
7393 * when pdcch is present . Adding
7394 * if check bcs of kwork*/
7401 if((hqCb != NULLP) &&
7402 (RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
7407 switch(ue->f1bCsAVal)
7409 case RG_SCH_A_VAL_2:
7410 /* harq(0) is primary harq(1) is secondary) */
7413 hqRecpReq->hqInfo.hqRes[1] = ue->n1PucchF1bResCb.
7414 cw1N1Res[hqCb->tpc].n1PucchIdx;
7416 else/* primary cell */
7419 /* hqCb will be null in case of sps rel pdcch */
7420 if ((hqCb) && hqCb->spsN1PucchRes.pres)
7421 {/* SPS occasion or dyn sched*/
7422 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
7425 #endif /* LTEMAC_SPS */
7426 {/* dyn data or sps release */
7430 /* This is not supposed to happen
7431 * Error case. hqCB has to be ter
7432 * when pdcch is present . Adding
7433 * if check bcs of kwork*/
7438 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7439 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7443 case RG_SCH_A_VAL_3:
7445 /* Serving cell in mimo mode should be
7446 * in 0 and 1 and the serving cell in siso
7447 * mode should be in 2 indices */
7450 U8 servCellIdx = rgSchUtlGetServCellIdx(hqCb->hqE->cell->instIdx,
7451 hqCb->hqE->cell->cellId,
7454 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1)
7455 {/* Sec cell is in mimo mode, use 0 and 1 */
7456 hqRecpReq->hqInfo.hqRes[0] =
7457 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7458 hqRecpReq->hqInfo.hqRes[1] =
7459 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
7462 {/* Sec cell is in siso mode, use 2 */
7463 hqRecpReq->hqInfo.hqRes[2] =
7464 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7468 {/* primary cell hq */
7470 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
7471 {/* prim cell is in mimo mode, use 0 and 1 */
7473 if (hqCb && hqCb->spsN1PucchRes.pres)
7474 {/* Not sps release */
7475 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
7478 #endif /* LTEMAC_SPS */
7479 {/* sps rel or dyn */
7483 /* This is not supposed to happen
7484 * Error case. hqCB has to be ter
7485 * when pdcch is present . Adding
7486 * if check bcs of kwork*/
7491 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7492 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7493 hqRecpReq->hqInfo.hqRes[1] = hqRes + 1;
7497 {/* prim cell is in siso mode use 2 */
7499 /* Consider sps occasions */
7500 if (hqCb && hqCb->spsN1PucchRes.pres)
7501 {/* Not sps release */
7502 hqRecpReq->hqInfo.hqRes[2] = hqCb->spsN1PucchRes.val;
7505 #endif /* LTEMAC_SPS */
7510 /* This is not supposed to happen
7511 * Error case. hqCB has to be ter
7512 * when pdcch is present . Adding
7513 * if check bcs of kwork*/
7518 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7519 hqRecpReq->hqInfo.hqRes[2] = hqRes;
7525 case RG_SCH_A_VAL_4:
7526 {/* Both the serv cells are in mimo mode */
7528 {/* 2 and 3 for sec cell */
7529 hqRecpReq->hqInfo.hqRes[2] =
7530 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7531 hqRecpReq->hqInfo.hqRes[3] =
7532 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
7534 else/* primary cell */
7535 {/* 0 and 1 are for primary cell */
7537 if (hqCb && hqCb->spsN1PucchRes.pres)
7538 {/* Not sps release */
7539 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
7542 #endif /* LTEMAC_SPS */
7547 /* This is not supposed to happen
7548 * Error case. hqCB has to be ter
7549 * when pdcch is present . Adding
7550 * if check bcs of kwork*/
7555 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7556 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7557 hqRecpReq->hqInfo.hqRes[1] = hqRes + 1;
7568 /** @brief This function fills the harq reception request for
7569 * TDD in case of Fomat 1B with CS for M>=2
7573 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234
7576 * -Fill Harq Reception Request for Format 1B with
7579 * @param [in] RgSchDlHqProcCb *hqCb
7580 * @param [in] TfuUePucchRecpReq *hqRecpReq
7581 * @param [in] U8 noFdbks
7582 * @param [in] RgSchDlSf *dlSf
7583 * @param [in] RgSchPdcch *pdcch
7584 * @param [in] RgSchCellCb *cellCb
7585 * @param [in] U8 elemIdx
7589 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234
7591 RgSchDlHqProcCb *hqCb,
7592 TfuUePucchRecpReq *hqRecpReq,
7596 RgSchCellCb *cellCb,
7600 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234(
7601 hqCb,hqRecpReq,noFdbks,dlSf,pdcch,cellCb,elemIdx)
7602 RgSchDlHqProcCb *hqCb;
7603 TfuUePucchRecpReq *hqRecpReq;
7607 RgSchCellCb *cellCb;
7612 Bool isCellSec = FALSE;
7617 {/* SPS Release pdcch or dynamic data */
7624 /* This is not supposed to happen
7625 * Error case. hqCB has to be ter
7626 * when pdcch is present . Adding
7627 * if check bcs of kwork*/
7634 if((hqCb != NULLP) && (ue != NULLP) &&
7635 (RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
7641 {/* Sec Cell indices are 2 and 3*/
7642 servCellIdx = rgSchUtlGetServCellIdx(hqCb->hqE->cell->instIdx,
7643 hqCb->hqE->cell->cellId,
7646 hqRecpReq->hqInfo.hqRes[2] =
7647 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7649 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1)
7651 hqRecpReq->hqInfo.hqRes[3] =
7652 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
7656 {/* Primary cell indices are 0 and 1 */
7658 * M > 2 if SPS occasion is present in any of the
7659 * DL subframe in the bundle, the n1Pucch(0) is
7660 * the SPS resource and n1Pucch(1) is the resource
7661 * derived from pdcch with DAI = 1
7662 * If No SPS Occasion
7663 * Then n1Pucch(0) is from pdcch with DAI =1
7664 * and n1Pucch(1) is from pdcch with DAI = 2
7668 {/* this is not sps release pdcch */
7669 if(hqCb->spsN1PucchRes.pres == TRUE)
7671 hqRes = hqCb->spsN1PucchRes.val;
7676 {/*Dynamic scheduling or SPS Release
7677 Derive from pdcch */
7678 if(pdcch->dlDai < 3)
7679 {/* No need to calcualte from DAI > 2 */
7680 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7686 hqRecpReq->hqInfo.hqRes[elemIdx] = hqRes;
7689 {/* Pdcch with DAI = 1 and 2 needs to be used
7690 for resource calculation*/
7691 if(hqCb && hqCb->spsN1PucchRes.pres == TRUE)
7692 {/* dyn or sps occasion */
7693 /* Shift the hqRes[0] if it was filled
7694 * if there was a pdcch with DAI 1 before to this
7697 {/* SPS occasion happened in the middle
7699 /* shifting the non SPS resource to n1Pucch(1) */
7700 hqRecpReq->hqInfo.hqRes[1] = hqRecpReq->hqInfo.hqRes[0];
7703 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7706 else if(pdcch && pdcch->dlDai < 3)
7708 else if(pdcch->dlDai < 3)
7710 {/* sps rel or dyn sched */
7711 /* hqCb wil not be present for sps release pdcch */
7712 if(hqCb && (pdcch->dlDai != hqCb->ulDai))
7713 {/* there was a SPS occasion before to this */
7714 if(pdcch->dlDai == 1)
7716 hqRecpReq->hqInfo.hqRes[1] = hqRes;
7717 }/* ignore the DAI 2 in this case */
7719 {/* There was no SPS occasion before to this */
7723 {/* Added check to ignore kwork warning */
7724 hqRecpReq->hqInfo.hqRes[(pdcch->dlDai)-1] = hqRes;
7733 /** @brief This function fills the harq reception request for
7734 * TDD in case of Fomat 1B with CS
7738 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCS
7741 * -Fill Harq Reception Request for Format 1B with
7744 * @param [in] RgSchDlSf *ulSf
7745 * @param [in] RgSchCellCb *cell
7746 * @param [out]TfuUePucchRecpReq *hqRecpReq
7750 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS
7752 RgSchDlHqProcCb *hqCb,
7753 TfuUePucchRecpReq *hqRecpReq,
7761 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS(hqCb,hqRecpReq,noFdbks,dlSf,pdcch,
7762 n1PucchTkn,elemIdx,cellCb)
7763 RgSchDlHqProcCb *hqCb;
7764 TfuUePucchRecpReq *hqRecpReq;
7769 RgSchCellCb *cellCb;
7772 /* Update teh fdbk mode if something different is present
7773 * in L1 API file for F1BS *//* 1 --> F1BCS */
7774 hqRecpReq->hqInfo.hqFdbkMode = TFU_ACK_NACK_CHANNEL_SELECTION;
7778 case RG_SCH_M_VAL_1:
7781 rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1(hqCb,hqRecpReq,
7782 noFdbks,dlSf,pdcch,cellCb);
7785 case RG_SCH_M_VAL_2:
7786 case RG_SCH_M_VAL_3:
7787 case RG_SCH_M_VAL_4:
7789 /* Spatial bundling will be applied */
7790 rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234(hqCb,hqRecpReq,
7791 noFdbks,dlSf,pdcch,cellCb,elemIdx);
7801 /***********************************************************
7803 * Func : rgSCHTomUtlFillSfHqFdbkForOneUe
7805 * Desc : Fill HARQ feedback info for one UE/entry
7813 **********************************************************/
7815 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForOneUe
7817 RgSchDlHqProcCb *hqCb,
7818 TfuRecpReqInfo *recpReqInfo,
7819 RgSchCellCb *cellCb,
7827 RgrTddAckNackMode ackNackMode,
7828 RgSchUePucchRecpInfo **pucchInfoRef,
7835 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForOneUe(hqCb,recpReqInfo, cellCb, err, dlSf,
7836 noFdbks, memCp, elemIdx, nxtDlsf, rnti, ackNackMode, pucchInfoRef,
7837 pdcch, n1PucchTkn, allocRef, hqSz)
7838 RgSchDlHqProcCb *hqCb;
7839 TfuRecpReqInfo *recpReqInfo;
7840 RgSchCellCb *cellCb;
7848 RgrTddAckNackMode ackNackMode;
7849 RgSchUePucchRecpInfo **pucchInfoRef;
7856 RgSchUePucchRecpInfo *pucchInfo = *pucchInfoRef;
7859 TfuUePucchRecpReq *hqRecpReq;
7874 Bool isFirstFdbk = FALSE;
7876 if(pucchInfo == NULLP)
7878 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchInfo,
7879 sizeof(RgSchUePucchRecpInfo), memCp)) != ROK)
7881 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to "
7882 "Allocate TfuUeRecpReqInfo for cell RNTI:%d",rnti);
7883 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
7887 #ifdef TFU_ALLOC_EVENT_NO_INIT
7888 pucchInfo->hashLstEnt.hashVal = 0;
7889 pucchInfo->hashLstEnt.keyLen = 0;
7890 pucchInfo->hashLstEnt.key = 0;
7891 pucchInfo->hashLstEnt.list.prev = pucchInfo->hashLstEnt.list.next = 0;
7893 if ((ret = rgSCHUtlGetEventMem((Ptr *)&(pucchInfo->pucchRecpInfo),
7894 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp))) != ROK)
7896 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to "
7897 "Allocate TfuUeRecpReqInfo for cell RNTI:%d",rnti);
7898 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
7901 cmMemset((U8 *)pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes,0xff,sizeof(U16)*TFU_MAX_HQ_RES);
7902 #ifdef TFU_ALLOC_EVENT_NO_INIT
7903 cmMemset((U8 *)&pucchInfo->pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
7905 pucchInfo->pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
7906 pucchInfo->pucchRecpInfo->rnti = rnti;
7908 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo=TFU_PUCCH_HARQ;
7915 /* Calculation of resources same for both bundling and muxing for M = 1
7918 RgSchUeCb *ue = rgSCHDbmGetUeCb (cellCb, rnti);
7919 if((ue) && (1 == ue->numSCells))
7921 if(ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS)
7923 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
7924 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS(hqCb,hqRecpReq,
7925 noFdbks,dlSf,pdcch,elemIdx,cellCb);
7928 {/* M = 1 case . size is same as A Value*/
7929 hqRecpReq->hqInfo.hqSz = ue->f1bCsAVal;
7930 hqRecpReq->hqInfo.pucchResCnt = hqRecpReq->hqInfo.hqSz;
7933 hqRecpReq->hqInfo.hqSz = (noFdbks * 2); /* M for 2 cells */
7934 hqRecpReq->hqInfo.pucchResCnt = 4;
7936 hqRecpReq->hqInfo.a = ue->f1bCsAVal;
7937 /* handling for SPS occasions*/
7940 /* set the datPresinFirstSUbframe to TRUE if this
7941 * is for pcell txion*/
7943 RgSchTddANInfo *anInfo = NULLP;
7945 /* if this txion is on pcell
7946 * sps occaion, dyn sched or sps release pdcch
7947 * set the sched present in first
7948 * dl subframe of the bundle to TRUE. This
7949 * is required for mapping the feedbak when SPS occasion
7950 * is present in any of the DL subframe in the bundle in
7953 /* SPS will happen only on pcell */
7954 if((hqCb == NULLP) || (!RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
7957 anInfo = rgSCHUtlGetUeANFdbkInfo(ue,
7958 &recpReqInfo->timingInfo,RGSCH_PCELL_INDEX);
7960 {/* ANInfo must be there. adding block
7962 RGSCHDBGERRNEW(cellCb->instIdx,(rgSchPBuf(cellCb->instIdx),
7963 "ANInfo should not be NULL for cellId=%d \n", cellCb->cellId));
7971 {/* This needs to be revisited while
7972 adding support for PUCCH format 3 */
7973 RGSCHDBGERRNEW(cellCb->instIdx,(rgSchPBuf(cellCb->instIdx),"Invalid Pucch format configured.."));
7980 if((ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) ||
7981 ((noFdbks == 1) && (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT)))
7983 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
7985 prevHqSize = hqRecpReq->hqInfo.hqSz;
7988 /* Only one index for bundling case */
7989 hqRecpReq->M = noFdbks;
7991 TFU_HQ_RECP_REQ_NORMAL;
7992 hqRecpReq->multCnt = 1;
7993 hqRecpReq->t.nCce[0] =
7998 rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
8000 hqRecpReq->type = TFU_UCI_HARQ;
8002 #else /* TFU_UPGRADE */
8005 if ((TRUE == isFirstFdbk) && (TRUE == n1PucchTkn.pres))
8007 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)ackNackMode;
8008 hqRecpReq->hqInfo.pucchResCnt=1;
8009 hqRecpReq->hqInfo.hqRes[0] = n1PucchTkn.val;
8010 hqRecpReq->hqInfo.hqSz = hqSz;
8013 else if (FALSE == n1PucchTkn.pres)
8016 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)ackNackMode;
8018 P = rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
8019 nP = cellCb->rgSchTddNpValTbl[P];
8020 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
8021 m = dlSf->dlFdbkInfo.m;
8022 /* In case of no UE */
8023 pucchRes = (M - m - 1)* nP + (m * nPlusOne) + pdcch->nCce +
8024 cellCb->pucchCfg.n1PucchAn;
8025 /*ccpu00130164:MOD-Changed to maitain value of
8026 hqRecpReq->hqInfo.pucchResCnt=1 in case of bundling*/
8027 /*ccpu00132284 -MOD- hqRes need to be updated after pucchReCnt set to 1
8028 * and resource should be update at index-0*/
8029 hqRecpReq->hqInfo.pucchResCnt=1;
8030 hqRecpReq->hqInfo.hqRes[hqRecpReq->hqInfo.pucchResCnt-1] = pucchRes;
8032 if((ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) && (hqSz > prevHqSize))
8033 hqRecpReq->hqInfo.hqSz = hqSz;
8034 else if (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT)
8035 hqRecpReq->hqInfo.hqSz = hqSz;
8037 hqRecpReq->hqInfo.hqSz = prevHqSize;
8039 #endif /* TFU_UPGRADE */
8041 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst,
8042 &(pucchInfo->pucchRecpInfo->lnk));
8043 pucchInfo->pucchRecpInfo->lnk.node =
8044 (PTR)pucchInfo->pucchRecpInfo;
8047 else /* Multiplexing */
8050 pucchInfo->pucchRecpInfo->t.pucchRecpReq.M = noFdbks;
8052 if (n1PucchTkn.pres == TRUE)
8054 pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqType =
8055 TFU_HQ_RECP_REQ_N1PUCCH;
8056 pucchInfo->pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = n1PucchTkn.val;
8061 pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqType =
8062 TFU_HQ_RECP_REQ_NORMAL;
8063 multCnt = pucchInfo->pucchRecpInfo->t.pucchRecpReq.multCnt;
8064 pucchInfo->pucchRecpInfo->t.pucchRecpReq.t.nCce[multCnt] =
8066 pucchInfo->pucchRecpInfo->t.pucchRecpReq.m[multCnt] =
8068 pucchInfo->pucchRecpInfo->t.pucchRecpReq.p[multCnt] =
8069 rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
8071 pucchInfo->pucchRecpInfo->t.pucchRecpReq.multCnt++;
8073 #else /* TFU_UPGRADE */
8075 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
8076 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)RGR_TDD_ACKNACK_MODE_MULT;
8077 hqRecpReq->hqInfo.hqSz = noFdbks;
8079 resIdx = hqRecpReq->hqInfo.pucchResCnt;
8080 hqRecpReq->hqInfo.pucchResCnt++;
8083 if (n1PucchTkn.pres == TRUE)
8085 hqRecpReq->hqInfo.hqRes[resIdx] = n1PucchTkn.val;
8091 m = dlSf->dlFdbkInfo.m;
8093 P = rgSCHCmnGetPValFrmCCE(cellCb, nCce);
8094 nP = cellCb->rgSchTddNpValTbl[P];
8095 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
8096 hqRecpReq->hqInfo.hqRes[resIdx] = (M - m - 1)* nP +
8097 (m * nPlusOne) + pdcch->nCce +
8098 cellCb->pucchCfg.n1PucchAn;
8100 #endif /* TFU_UPGRADE */
8101 /* If all the DL subframes are scanned, then
8102 * send TFU request*/
8104 if((elemIdx != noFdbks) && alloc)
8106 cmHashListInsert(&cellCb->ueTfuPendLst, (PTR) pucchInfo,
8107 (U8 *)&rnti, (U16) sizeof(rnti));
8112 pucchInfo->pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
8113 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst,
8114 &(pucchInfo->pucchRecpInfo->lnk));
8115 pucchInfo->pucchRecpInfo->lnk.node =
8116 (PTR)pucchInfo->pucchRecpInfo;
8117 /* Delete the entry after addition to the list */
8118 cmHashListDelete(&cellCb->ueTfuPendLst, (PTR) pucchInfo);
8124 *pucchInfoRef = pucchInfo;
8130 #ifdef RG_ULSCHED_AT_CRC
8131 /** @brief This function does all the processing related to a single downlink
8136 * Function: rgSCHTomUtlProcDlSfAtCrc
8139 * - collate control data for all UEs and send to PHY
8140 * - collate data buffers for all UEs and send to PHY
8142 * @param [in] RgSchDlSf *ulSf
8143 * @param [in] RgSchCellCb *cell
8144 * @param [in] TfuCntrlReqInfo *cntrlInfo
8145 * @param [out] RgSchErrInfo *err
8149 PRIVATE S16 rgSCHTomUtlProcDlSfAtCrc
8152 CmLteTimingInfo crntUlFrm,
8154 TfuCntrlReqInfo *cntrlInfo,
8158 PRIVATE S16 rgSCHTomUtlProcDlSfAtCrc (ulSf, crntUlFrm, cell, cntrlInfo, err)
8160 CmLteTimingInfo crntUlFrm;
8162 TfuCntrlReqInfo *cntrlInfo;
8166 Inst inst = cell->instIdx;
8169 TRC2(rgSCHTomUtlProcDlSfAtCrc);
8172 cntrlInfo->numDlActvUes = 0;
8173 cmLListInit(&cntrlInfo->phichLst);
8174 cmLListInit(&cntrlInfo->dlPdcchLst);
8175 cmLListInit(&cntrlInfo->ulPdcchLst);
8176 #ifdef TFU_ALLOC_EVENT_NO_INIT
8177 cntrlInfo->dlTiming.sfn = cntrlInfo->dlTiming.subframe = 0;
8181 cntrlInfo->ulTiming = crntUlFrm;
8182 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cntrlInfo->ulTiming, TFU_ULCNTRL_DLDELTA);
8184 cntrlInfo->cellId = cell->cellId;
8185 /* Fill PHICH info */
8186 if ((ret = rgSCHTomUtlFillPhich (cell, cntrlInfo, ulSf, err)) != ROK)
8188 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send PHICH info for "
8190 RGSCH_FREE_MEM(cntrlInfo);
8195 if ((ret = rgSCHTomUtlFillUlPdcch (cell, cntrlInfo, ulSf, err)) != ROK)
8197 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send PDCCH info for "
8199 RGSCH_FREE_MEM(cntrlInfo);
8204 if(0 == cntrlInfo->ulMpdcchLst.count)
8211 if ((cntrlInfo->ulPdcchLst.count || cntrlInfo->phichLst.count) || RG_SCH_EMTC_GET_PDCCHLST_CNT(cntrlInfo))
8213 if (cntrlInfo->ulPdcchLst.count || cntrlInfo->phichLst.count)
8216 if (rgSCHUtlTfuCntrlReq(inst, cell->tfuSap->sapCfg.suId, cntrlInfo)
8219 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info for"
8225 RGSCH_FREE_MEM(cntrlInfo);
8230 #endif /* #ifdef RG_ULSCHED_AT_CRC*/
8233 /** @brief This function sends the SFN Tick to L3
8238 * Function: rgSCHTomUtlSendSfnTick
8240 * @param [in] RgSchCellCb *cell
8243 PRIVATE Void rgSCHTomUtlSendSfnTick
8248 PRIVATE Void rgSCHTomUtlSendSfnTick (cell)
8252 RgrTtiIndInfo *rgrTtiInd;
8254 TRC2(rgSCHTomUtlSendSfnTick);
8256 /* TTI to be sent to RRM only once per system frame */
8257 /* Added support for period = 0 to disable tick to RRM */
8258 if ((cell->rrmTtiIndPrd != 0) &&
8259 ((cell->crntTime.sfn % cell->rrmTtiIndPrd) == 0) &&
8260 (cell->crntTime.slot == 0))
8262 /* Allocate a TTI indication structure and send to RRM over RGR interface */
8263 if (rgSCHUtlAllocSBuf (cell->instIdx,
8264 (Data**)&rgrTtiInd, sizeof(RgrTtiIndInfo)) != ROK)
8266 RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),
8267 "Mem alloc failed for RGR TTI ind, cellId (%d))\n",
8271 rgrTtiInd->cellId = cell->cellId;
8272 //rgrTtiInd->hSfn = cell->crntTime.hSfn;
8273 rgrTtiInd->sfn = cell->crntTime.sfn;
8275 if (rgSCHUtlRgrTtiInd (cell, rgrTtiInd) != ROK)
8277 RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),
8278 "Failed to send RGR TTI ind, cellId (%d))\n",
8280 rgSCHUtlFreeSBuf(cell->instIdx, (Data**)&rgrTtiInd,
8281 sizeof(RgrTtiIndInfo));
8291 /* @brief Mark Dyn TDD CrntSfIdx.
8295 * Function: rgSCHDynTDDMrkCrntSfIdx
8296 * Purpose: update the dyn tdd sunframe index
8297 * @param[in] Inst schInst
8302 PRIVATE Void rgSCHDynTDDMrkCrntSfIdx
8307 PRIVATE Void rgSCHDynTDDMrkCrntSfIdx(schInst)
8311 RgSchDynTddCb *rgSchDynTddInfo = &(rgSchCb[schInst].rgSchDynTdd);
8313 TRC2(rgSCHDynTDDMrkCrntSfIdx)
8315 RG_SCH_DYN_TDD_MARKTYPE(rgSchDynTddInfo, rgSchDynTddInfo->crntDTddSfIdx,
8316 RG_SCH_DYNTDD_NOTDEF);
8317 rgSchDynTddInfo->crntDTddSfIdx = (rgSchDynTddInfo->crntDTddSfIdx + 1) %
8318 RG_SCH_DYNTDD_MAX_SFINFO;
8320 //printf("Initializing Index %d \n", rgSchDynTddInfo->crntDTddSfIdx);
8326 /** @brief This function fills the TTI timinig info for each cell
8330 * Function: rgSchTomFillCellTtiInfo
8332 * @param [in] TfuTtiIndInfo *ttiInd
8333 * @param [in] Inst schInst
8334 * @param [out] U8 *nCell
8335 * @param [out] RgSchCellCb *cell[]
8342 PRIVATE Void rgSchTomFillCellTtiInfo
8344 TfuTtiIndInfo *ttiInd,
8347 RgSchCellCb *cells[]
8350 PRIVATE Void rgSchTomFillCellTtiInfo (ttiInd, schInst, nCell, cells)
8351 TfuTtiIndInfo *ttiInd;
8354 RgSchCellCb *cells[];
8359 TfuTtiCellInfo *cellInfo;
8363 CmLteTimingInfo frm;
8365 TRC2 (rgSchTomFillCellTtiInfo);
8367 if (CM_LTE_MAX_CELLS < ttiInd->numCells)
8373 rgSCHDynTDDMrkCrntSfIdx(schInst);
8376 for (i = 0; i < ttiInd->numCells; i++)
8378 cellInfo = &ttiInd->cells[i];
8379 strtCellId = rgSchCb[schInst].genCfg.startCellId;
8380 Idx1 = (U8)((cellInfo->cellId - strtCellId)&(CM_LTE_MAX_CELLS-1));
8381 cell = rgSchCb[schInst].cells[Idx1];
8382 /* Validate the cell */
8385 /* Use SCH inst 0 print buff */
8386 RGSCHDBGERRNEW(schInst,(rgSchPBuf(schInst),
8387 "RgLiTfuTtiInd()No cell exists for cellId %d\n",
8391 *nCell = *nCell + 1;
8392 cells[i] = (RgSchCellCb *)cell;
8395 if(cell->schTickDelta != cellInfo->schTickDelta)
8397 printf("\nMukesh: Delta changed for cellId=%d: curr delta=%d new delta=%d\n"
8398 "dlblankSf=%d ulblankSf=%d dummyTti=%d \n",
8399 cell->cellId, cell->schTickDelta, cellInfo->schTickDelta, cellInfo->dlBlankSf,cellInfo->ulBlankSf,
8400 cellInfo->isDummyTti);
8402 RGSCH_UPDATE_DELTA(schInst, cellInfo->schTickDelta);
8403 cell->schTickDelta = cellInfo->schTickDelta;
8406 cell->stopSiSch = cellInfo->dlBlankSf;
8407 cell->stopDlSch = cellInfo->dlBlankSf;
8408 cell->stopUlSch = cellInfo->ulBlankSf;
8409 if (cellInfo->isDummyTti)
8411 cell->stopDlSch = TRUE;
8413 if((0 == (cellInfo->timingInfo.sfn % 30)) && (0 == cellInfo->timingInfo.slot))
8415 //printf("5GTF_CHECK rgSCHTOMTtiInd (%d : %d)\n", cellInfo->timingInfo.sfn, cellInfo->timingInfo.slot);
8418 RGSCHCPYTIMEINFO(cellInfo->timingInfo, cell->crntTime);
8419 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->hiDci0Time,
8420 TFU_ULCNTRL_DLDELTA);
8421 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->dlDciTime,
8422 TFU_DLCNTRL_DLDELTA);
8423 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->rcpReqTime,
8424 TFU_RECPREQ_DLDELTA);
8425 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->hqRlsTime,
8426 TFU_HQFBKIND_ULDELTA);
8427 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->dlSfRlsTime,
8430 RGSCHCPYTIMEINFO_EMTC(cellInfo->timingInfo, cell->crntTime);
8431 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->hiDci0Time,
8432 TFU_ULCNTRL_DLDELTA);
8433 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->dlDciTime,
8434 TFU_DLCNTRL_DLDELTA);
8435 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->rcpReqTime,
8436 TFU_RECPREQ_DLDELTA);
8437 RGSCHDECRFRMCRNTTIME_EMTC(cell->crntTime, cell->hqRlsTime,
8438 TFU_HQFBKIND_ULDELTA);
8439 RGSCHDECRFRMCRNTTIME_EMTC(cell->crntTime, cell->dlSfRlsTime,
8442 rgSCHCmnUpdVars(cell);
8443 cell->isDlDataAllwd = TRUE;
8444 /* Get DownLink SubFrame */
8445 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
8446 frm = cell->crntTime;
8448 RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA);
8450 RGSCH_INCR_SUB_FRAME_EMTC(frm, RG_SCH_CMN_DL_DELTA);
8452 cellSch->dl.time = frm;
8458 U8 idx = (cell->crntTime.slot + RG_SCH_CMN_DL_DELTA) %
8459 RGSCH_NUM_SUB_FRAMES_5G;
8461 cell->isDlDataAllwd = RG_SCH_CMN_CHK_DL_DATA_ALLOWED(cell, idx);
8463 /*ccpu00130639 -ADD - used in UL HARQ proc id calculation*/
8464 if((cell->crntTime.sfn == 0) && (cell->crntTime.slot == 0))
8466 /* sfn Cycle used for Tdd UL Harq Proc Determination.
8467 This sfn Cycle will have values from 0 to numUl Harq-1. */
8468 cell->tddHqSfnCycle = (cell->tddHqSfnCycle + 1 ) %
8469 (rgSchTddUlNumHarqProcTbl[cell->ulDlCfgIdx]);
8473 if(cell->emtcEnable)
8475 rgSCHUtlEmtcResPrcTti(cell);
8481 void schFillCrntTime(
8482 SlotIndInfo slotInd,
8486 for(cellCount = 0; cellCount < CM_LTE_MAX_CELLS; cellCount++)
8489 cell = rgSchCb[schInst].cells[cellCount];
8491 RGSCHCPYTIMEINFO(slotInd, cell->crntTime);
8493 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->hiDci0Time,
8494 TFU_ULCNTRL_DLDELTA);
8495 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->dlDciTime,
8496 TFU_DLCNTRL_DLDELTA);
8497 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->rcpReqTime,
8498 TFU_RECPREQ_DLDELTA);
8499 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->hqRlsTime,
8500 TFU_HQFBKIND_ULDELTA);
8501 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->dlSfRlsTime,
8504 RGSCH_INCR_SUB_FRAME(cell->crntTime, RG_SCH_CMN_DL_DELTA);
8506 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
8507 cellSch->dl.time = cell->crntTime;
8511 /** @brief This function prepares the TTI for scheduling and
8512 * invokes the Common channel scheduler. Uplink scheduler
8513 * is invoked first if UL Scheduling at CRC is not enabled
8517 * Function: rgSchTomTtiUlAndDlCmnChSch
8519 * @param [out] RgSchCellCb *cell
8525 PRIVATE Void rgSchTomTtiUlAndDlCmnChSch
8530 PRIVATE Void rgSchTomTtiUlAndDlCmnChSch (cell)
8535 TRC2(rgSchTomTtiUlAndDlCmnChSch);
8537 cell->rlsHqArr[cell->crntHqIdx].numUes = 0;
8539 cell->crntHqIdx = cell->crntHqIdx % RGSCH_NUM_SUB_FRAMES;
8541 cmPrcTmr(&cell->tqCp, cell->tq, (PFV)rgSCHTmrProcTmr);
8542 rgSCHMeasGapANRepTtiHndl (cell);
8543 /* We need to fill the PHICH for the UL Data, first we need to get the UL
8544 * SF from Scheduler, next we fill the dlSf that goes out this TTI.
8545 * This must be performed prior to any other processing of the TTI
8546 * so that we do not wrap around and generate feedback prior to
8547 * reception of UL data.
8549 #ifndef RG_ULSCHED_AT_CRC
8552 U8 idx; /* Index into Uplink Sf array */
8554 Mval = rgSchTddPhichMValTbl[cell->ulDlCfgIdx]
8555 [cell->hiDci0Time.subframe];
8559 for(idx=0; idx < Mval; idx++)
8561 rgSCHCmnRlsUlSf(cell, idx);
8567 /* DTX processing for those Harq's which did not get feedback from L1 */
8568 rgSCHDhmRlsDlsfHqProc (cell, cell->hqRlsTime);
8569 /* Re-Init the Downlink subframe */
8570 rgSCHUtlDlRlsSubFrm(cell, cell->dlSfRlsTime);
8571 /* Added handling to retransmit
8572 * release PDCCH in case of DTX
8575 /*Check for DRX every TTI*/
8576 rgSCHDrxTtiInd(cell);
8578 /* For TDD, UL scheduling should happen after DL scheduling */
8580 #ifndef RG_ULSCHED_AT_CRC
8581 /* Perform UL scheduling */
8582 rgSCHCmnUlSch(cell);
8585 /* Perform DL scheduling for Common channels */
8586 rgSCHCmnDlCommonChSch(cell);
8591 /** @brief This function invokes the Non critical procedures like measurements,
8592 * and RGR configurations.
8596 * Function: rgSchTomTtiMiscFunctions
8598 * @param [in] RgSchCellCb *cell
8604 PRIVATE Void rgSchTomTtiMiscFunctions
8609 PRIVATE Void rgSchTomTtiMiscFunctions (cell)
8613 U8 suId = cell->tfuSap->sapCfg.suId;
8615 TRC2(rgSchTomTtiMiscFunctions);
8617 /* Invoke RAM Tti Handler */
8618 rgSCHRamTtiHndlr(cell);
8620 /* Handle RGR configurations */
8621 rgSCHGomTtiHndlr(cell, suId);
8623 if((RGM_PRB_REPORT_START == cell->prbUsage.prbRprtEnabld)
8624 && (!(cell->prbUsage.rprtPeriod) || ((glblTtiCnt % cell->prbUsage.rprtPeriod) == 0)))
8626 rgSCHUtlUpdAvgPrbUsage(cell);
8628 rgSCHL2Meas(cell,FALSE);
8631 /* LTE_ADV_FLAG_REMOVED_START */
8632 /* Report ABS Load information to application periodically */
8633 if((RGR_ENABLE == cell->lteAdvCb.absCfg.status) &&
8634 (cell->lteAdvCb.absCfg.absLoadPeriodicity))
8636 RgrLoadInfIndInfo *rgrLoadInf;
8639 cell->lteAdvCb.absLoadTtiCnt++;
8640 if(cell->lteAdvCb.absLoadTtiCnt >= cell->lteAdvCb.absCfg.absLoadPeriodicity)
8643 if(rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&rgrLoadInf,
8644 sizeof(RgrLoadInfIndInfo)) != ROK)
8646 RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),"Could not "
8647 "allocate memory for sending LoadInfo\n"));
8650 cell->lteAdvCb.absLoadTtiCnt = 0;
8651 rgrLoadInf->cellId = cell->cellId;
8652 rgrLoadInf->bw = cell->bwCfg.dlTotalBw;
8653 rgrLoadInf->type = RGR_ABS;
8654 for(idx= 0; idx<RGR_ABS_PATTERN_LEN; idx++)
8656 rgrLoadInf->u.absLoadInfo[idx] = cell->lteAdvCb.absLoadInfo[idx];
8657 cell->lteAdvCb.absLoadInfo[idx] = 0;
8659 rgSCHUtlRgrLoadInfInd(cell, rgrLoadInf);
8664 if(cell->isDlDataAllwd)
8666 /* Calling function to update CFI parameters*/
8667 rgSchCmnUpdCfiDb(cell, RG_SCH_CMN_DL_DELTA);
8671 /* Incrementing the ttiCnt in case of UL subframe */
8672 if(!cell->dynCfiCb.switchOvrInProgress)
8674 cell->dynCfiCb.ttiCnt++;
8678 rgSchCmnUpdCfiDb(cell, RG_SCH_CMN_DL_DELTA);
8681 /* LTE_ADV_FLAG_REMOVED_END */
8686 /** @brief This function invokes the Downlink scheduler
8690 * Function: rgSchTomTtiDlSch
8692 * @param [in] RgSchCellCb *cell
8698 PRIVATE Void rgSchTomTtiDlSch
8703 PRIVATE Void rgSchTomTtiDlSch (cell)
8707 TRC2(rgSchTomTtiDlSch);
8709 if (cell->isDlDataAllwd && (cell->stopDlSch == FALSE))
8711 rgSCHCmnDlSch(cell);
8717 /** @brief This function invokes Consolidates the allocations
8718 * send the Subframe allocation info to MAC
8722 * Function: rgSchTomTtiCnsldtSfAlloc
8724 * @param [in] RgSchCellCb *cell
8730 PRIVATE Void rgSchTomTtiCnsldtSfAlloc
8735 PRIVATE Void rgSchTomTtiCnsldtSfAlloc (cell)
8740 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
8742 dlSf = rgSCHUtlSubFrmGet(cell, cellSch->dl.time);
8744 TRC2(rgSchTomTtiCnsldtSfAlloc);
8746 /* Prepare Subframe allocation info and send to MAC */
8747 rgSCHCmnCnsldtSfAlloc(cell);
8749 /* Call ACK NACK module to add to dlsf Queue */
8750 rgSCHAckNakRepAddToQ(cell, dlSf);
8752 rgSCHTomUtlProcTA(cell);
8757 /** @brief This function prepares the DL and UL Config requests
8762 * Function: rgSchTomTtiL1DlAndUlCfg
8764 * @param [in] RgSchCellCb *cell
8770 PRIVATE Void rgSchTomTtiL1DlAndUlCfg
8773 RgTfuCntrlReqInfo *cntrlInfo
8776 PRIVATE Void rgSchTomTtiL1DlAndUlCfg (cell, cntrlInfo)
8778 RgTfuCntrlReqInfo *cntrlInfo;
8781 RgSchDlSf *dlSf = rgSCHUtlSubFrmGet (cell, cell->dlDciTime);
8782 RgSchDlSf *ulSf = rgSCHUtlSubFrmGet (cell, cell->hiDci0Time);
8785 TRC2(rgSchTomTtiL1DlAndUlCfg);
8787 rgSCHTomUtlProcDlSf (dlSf, ulSf, cell, cntrlInfo, &err);
8788 /* Mark this frame as sent */
8789 dlSf->txDone = TRUE;
8791 rgBwAlloInfo[dlSf->sfNum] += dlSf->bwAssigned;
8792 rgBwAlcnt[dlSf->sfNum] ++;
8796 rgSCHTomUtlProcTddUlSf(cell);
8798 rgSCHTomUtlProcUlSf (cell, &err);
8804 /** @brief This function prepares does the Downlink subframe re-init and
8805 * Harq DTX processing
8809 * Function: rgSchTomUtlTddRlsSfAndHarq
8811 * @param [in] RgSchCellCb *cell
8817 PRIVATE Void rgSchTomUtlTddRlsSfAndHarq
8822 PRIVATE Void rgSchTomUtlTddRlsSfAndHarq (cell)
8826 TRC2(rgSchTomUtlTddRlsSfAndHarq);
8828 /* ccpu00132341-MOD- rgSchTddRlsDlSubfrmTbl is dependent on DELTA(=2).
8829 * Instead rgSchTddDlAscSetIdxKTbl can be used as the K set gives proper
8831 /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper
8832 * output if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME()
8833 * as it is serving the purpose */
8834 if(rgSchTddDlAscSetIdxKTbl[cell->ulDlCfgIdx][cell->hqRlsTime.subframe].
8837 /* ccpu00132341-MOD- Providing the UL SF timing for avoiding
8838 * calculation inside the function */
8839 rgSCHDhmTddRlsSubFrm(cell, cell->hqRlsTime);
8840 rgSCHDhmRlsDlsfHqProc(cell, cell->hqRlsTime);
8845 /** @brief This function processes the UL subframe and fills TFU reception
8850 * Function: rgSCHTomUtlProcTddUlSf
8852 * @param [in] RgSchCellCb *cell
8858 PRIVATE Void rgSCHTomUtlProcTddUlSf
8863 PRIVATE Void rgSCHTomUtlProcTddUlSf (cell)
8869 TRC2(rgSCHTomUtlProcTddUlSf);
8871 if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
8872 [cell->rcpReqTime.subframe] == RG_SCH_TDD_UL_SUBFRAME)
8874 if (rgSCHTomUtlProcUlSf (cell, &err) != ROK)
8876 /* fill in err type and call sta ind */
8877 RGSCHDBGERRNEW(cell->instIdx, (rgSchPBuf(cell->instIdx),
8878 "Unable to process Uplink subframe for cellId (%d))\n",
8882 /* TDD Fix , to allow Special SF SRS CFg */
8883 else if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
8884 [cell->rcpReqTime.subframe] == RG_SCH_TDD_SPL_SUBFRAME)
8886 if (rgSCHTomUtlPrcUlTddSpclSf(cell, &err) != ROK)
8888 /* fill in err type and call sta ind */
8889 RGSCHDBGERRNEW(cell->instIdx, (rgSchPBuf(cell->instIdx),
8890 "Unable to process Sipceial subframe for cellId (%d))\n",
8900 /**********************************************************************
8903 **********************************************************************/