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;
309 PRIVATE S16 rgSCHTomUtlFillCqiRiRecpReq ARGS(
311 TfuRecpReqInfo *recpReqInfo,
321 PUBLIC U32 rgBwAlloInfo[RGSCH_NUM_SUB_FRAMES]; /* Num of Rbs Allocated in each SF */
322 PUBLIC U32 rgBwAlcnt[RGSCH_NUM_SUB_FRAMES]; /*Num of times Allocation done in each Subframe */
325 /* rg006.201: [ccpu000111706, ccpu00112394]: Separated UL and DL TTI
332 U32 gDlNumUePerTti[20] = {0};
333 U32 gUlNumUePerTti[20] = {0};
334 PRIVATE S16 rgSCHTomUtlProcDlSf ARGS((
338 RgTfuCntrlReqInfo *cntrlInfo,
340 #ifdef RG_ULSCHED_AT_CRC
341 PRIVATE S16 rgSCHTomUtlProcDlSfAtCrc ARGS((
343 CmLteTimingInfo crntUlFrm,
345 TfuCntrlReqInfo *cntrlInfo,
347 #endif /* RG_ULSCHED_AT_CRC */
350 PRIVATE S16 rgSCHTomUtlPrcUlTddSpclSf ARGS((
353 #endif /* TFU_UPGRADE */
355 PRIVATE S16 rgSCHTomUtlFillPhich ARGS((
357 TfuCntrlReqInfo *cntrlInfo,
361 PRIVATE S16 rgSCHTomUtlFillDlPdcch ARGS((
363 TfuCntrlReqInfo *cntrlInfo,
366 PRIVATE S16 rgSCHTomUtlFillUlPdcch ARGS((
368 TfuCntrlReqInfo *cntrlInfo,
372 PRIVATE S16 rgSCHTomUtlProcTA ARGS((
375 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq ARGS((
376 TfuRecpReqInfo *recpReq,
381 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq ARGS((
382 TfuRecpReqInfo *recpReq,
388 PUBLIC S16 rgSCHTomFillOnlySrsRecpReq ARGS
392 TfuUeRecpReqInfo *datRecpInfo
395 PRIVATE S16 rgSCHTomUtlFillCqiSrsWithSr ARGS
399 TfuRecpReqInfo *recpReqInfo,
400 TfuUeRecpReqInfo *pucchRecpInfo,
404 PRIVATE S16 rgSCHTomUtlFillCqiSrSrsWithHq ARGS
407 TfuRecpReqInfo *recpReqInfo,
409 TfuUeRecpReqInfo *pucchRecpInfo,
411 Bool isDatPresOnSecCell
414 PUBLIC S16 rgSCHTomUtlFillRiBitWidthInfo ARGS
419 PUBLIC U8 rgSCHTomUtlFetchPcqiBitSz ARGS
426 PUBLIC U8 rgSCHTomUtlFetchPcqiBitSzPucchMode21 ARGS
429 TfuCqiPucchMode21 *mode21Info,
434 PUBLIC S16 rgSCHTomUtlMoveNxtOccasion ARGS
441 PRIVATE S16 rgSCHTomUtlMovePcqiNxtOccasion ARGS
448 PRIVATE S16 rgSCHTomUtlMovePriNxtOccasion ARGS
455 PRIVATE S16 rgSCHTomUtlMoveSrNxtOccasion ARGS
461 PRIVATE S16 rgSCHTomUtlMoveSrsNxtOccasion ARGS
467 PRIVATE Bool rgSCHTomUtlFillDatHarqRecpReq ARGS
471 TfuUeRecpReqInfo *datRecpInfo,
472 TfuRecpReqInfo *recpReqInfo
474 PRIVATE S16 rgSCHTomUtlFillSrRecpReq ARGS((
475 TfuRecpReqInfo *recpReq,
480 PRIVATE S16 rgSCHTomUtlWillUeRprtCqiRi ARGS((
482 Bool *willueRprtCqiRii));
484 PRIVATE S16 rgSCHTomUtlFillRiRecpReq ARGS((
485 TfuRecpReqInfo *recpReq,
489 PRIVATE S16 rgSCHTomUtlFillPcqiRecpReq ARGS((
490 TfuRecpReqInfo *recpReq,
494 PRIVATE S16 rgSCHTomUtlFillSrsRecpReq ARGS((
495 TfuRecpReqInfo *recpReq,
499 PRIVATE S16 rgSCHTomUtlGenIndices ARGS((
504 TfuSubbandInfo* sbInfo));
508 PRIVATE S16 rgSCHTomUtlFillDatRecpReq ARGS((
509 TfuRecpReqInfo *recpReq,
514 PRIVATE S16 rgSCHTomUtlFillDatRecpReq ARGS((
515 TfuRecpReqInfo *recpReq,
522 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk ARGS((
523 TfuRecpReqInfo *recpReqInfo,
534 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk ARGS((
535 TfuRecpReqInfo *recpReqInfo,
546 PRIVATE S16 rgSCHTomUtlFillSfHqFdbk ARGS((
547 TfuRecpReqInfo *recpReqInfo,
558 PRIVATE S16 rgSCHTomUtlFillSfHqFdbk ARGS((
559 TfuRecpReqInfo *recpReqInfo,
570 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForOneUe ARGS((
571 RgSchDlHqProcCb *hqCb,
572 TfuRecpReqInfo *recpReqInfo,
581 RgrTddAckNackMode ackNackMode,
582 RgSchUePucchRecpInfo **pucchInfoRef,
590 EXTERN PUBLIC Void rgSCHCmnDlSpsSch (RgSchCellCb *cell);
594 PRIVATE S16 rgSCHTomCnsdrRelPdcch ARGS
598 TfuRecpReqInfo *recpReqInfo,
603 PRIVATE S16 rgSCHTomCnsdrRelPdcch ARGS
607 TfuRecpReqInfo *recpReqInfo,
615 PRIVATE Void rgSchTomTtiMiscFunctions ARGS
620 PRIVATE Void rgSchTomTtiUlAndDlCmnChSch ARGS
625 PRIVATE Void rgSchTomTtiDlSch ARGS
630 PRIVATE Void rgSchTomTtiCnsldtSfAlloc ARGS
635 PRIVATE Void rgSchTomTtiL1DlAndUlCfg ARGS
638 RgTfuCntrlReqInfo *cntrlInfo
642 PRIVATE Void rgSCHTomUtlSendSfnTick ARGS
648 PRIVATE Void rgSchTomFillCellTtiInfo ARGS
650 TfuTtiIndInfo *ttiInd,
657 PRIVATE Void rgSchTomUtlTddRlsSfAndHarq ARGS
661 PRIVATE Void rgSCHTomUtlProcTddUlSf ARGS
666 PRIVATE Void rgSCHTomUtlGethqRes ARGS
674 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1 ARGS
676 RgSchDlHqProcCb *hqCb,
677 TfuUePucchRecpReq *hqRecpReq,
683 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234 ARGS
685 RgSchDlHqProcCb *hqCb,
686 TfuUePucchRecpReq *hqRecpReq,
696 PUBLIC U32 rgDlCqiRptCnt[16], rgTotDlCqiRpt;
699 U32 rgSch5gtfCqi2Mcs[15] =
700 {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14};
702 /* forward references */
704 /*HARQ Feedback interpretation in accordance with Femto Forum.
705 Note: There is no value as '0' in Femto Forum Spec but in order to retain
706 the existing usage in MAC (and its Acceptance), its being considered*/
707 CONSTANT PRIVATE U8 rgSchTomHqFbkMap[8] = {0,1,0,0,4,4,4,4};
708 /*added #defines instead of magic numbers*/
709 CONSTANT PRIVATE U32 rgSCHTomBinCoe[RG_SCH_MAX_NUM_UE_SEL_SUBBANDS][RG_SCH_MAX_TOT_NUM_SUBBANDS]={
710 {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},
711 {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},
712 {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},
713 {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},
714 {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},
715 {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}
719 /*ccpu00116923 - ADD - SRS present support*/
720 /*Tables Derived from 3GPP TS 36.211 Section 5.5.3.3 */
721 /* Table 5.5.3.3-1 */
723 CONSTANT PUBLIC RgSchFddCellSpSrsSubfrmTbl rgSchFddCellSpSrsSubfrmTbl = {
724 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE},
725 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE},
726 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE},
727 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE},
728 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
729 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE},
730 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE},
731 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE},
732 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE},
733 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
734 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
735 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
736 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
737 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE},
738 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE},
739 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}
742 /* Table 5.5.3.3-2 */
743 CONSTANT PUBLIC RgSchTddCellSpSrsSubfrmTbl rgSchTddCellSpSrsSubfrmTbl = {
744 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
745 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE},
746 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE},
747 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE},
748 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE},
749 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE},
750 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE},
751 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE},
752 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
753 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
754 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE},
755 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE},
756 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE},
757 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE},
758 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
759 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}
762 PUBLIC S8 rgSchCmnAper20n22DiffCqi[4] = {1, 2, 3, 4};
763 PUBLIC S8 rgSchCmnAper30n31DiffCqi[4] = {0, 1, 2, -1};
767 * @brief get Ue for dedicated preamble rach
771 * Function: rgSCHGetDedPrmUe
773 * Invoked by: rgSCHTomRaReqInd
775 * @param[in] RgSchCellCb *cell
776 * @param[in] TfuRaReqIndInfo *raReqInd
782 PUBLIC S16 rgSCHGetDedPrmUe
786 CmLteTimingInfo timingInfo,
790 PUBLIC S16 rgSCHGetDedPrmUe(cell, rapId, timingInfo, ue)
793 CmLteTimingInfo timingInfo;
797 RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch);
799 printf("rapId[%d] cellSch->rachCfg.dedPrmStart[%d] cellSch->rachCfg.numDedPrm[%d]\n",rapId,cellSch->rachCfg.dedPrmStart,cellSch->rachCfg.numDedPrm);
800 /* Finding UE in handOver List */
801 if ((rapId < cellSch->rachCfg.dedPrmStart) ||
802 (rapId > cellSch->rachCfg.dedPrmStart +
803 cellSch->rachCfg.numDedPrm - 1))
805 /* This ded Preamble corresponds to handover */
806 *ue = rgSCHCmnGetHoUe(cell, rapId);
807 printf(" his ded Preamble corresponds to hando\n");
809 else/* Finding UE from PDCCH Order Mappings */
811 /* Get the UE which has transmitted this RaReq */
812 *ue = rgSCHCmnGetPoUe(cell, rapId, timingInfo);
813 printf(" ==== inding UE from PDCCH Order Mapping\n");
818 * @brief Handler for processing Random Access request indication
823 * Function: rgSCHTomRaReqInd
825 * Handler for processing Random Access request indication recieved from
828 * Invoked by: RgLiTfuRaReqInd of LIM
831 * - Validate the information received: cellId value and raRnti values
832 * - Process the request: Call rgSCHRamProcRaReq (cell, raRnti, raReqInd)
834 * @param[in] RgSchCellCb *cell
835 * @param[in] TfuRaReqIndInfo *raReqInd
841 PUBLIC S16 rgSCHTomRaReqInd
844 TfuRaReqIndInfo *raReqInd
847 PUBLIC S16 rgSCHTomRaReqInd(cell, raReqInd)
849 TfuRaReqIndInfo *raReqInd;
856 Bool isEmtcUe = FALSE;
858 RgSchUeCb *ue = NULLP;
860 TRC2(rgSCHTomRaReqInd);
862 if(cell->cellId != raReqInd->cellId)
864 err.errType = RGSCHERR_TOM_RAREQIND;
865 err.errCause = RGSCHERR_TOM_INV_CELL_ID;
866 RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,
867 "rgSCHTomRaReqInd(): No cell found with raReq cellId = (%d) errorType (%d)"
868 " errorCause(%d)",raReqInd->cellId, err.errType, err.errCause);
872 for (raRntiCnt = 0; raRntiCnt < raReqInd->nmbOfRaRnti; raRntiCnt++)
874 for (raReqCnt = 0; raReqCnt < raReqInd->rachInfoArr->numRaReqInfo; raReqCnt++)
876 rapId = raReqInd->rachInfoArr[raRntiCnt].raReqInfoArr[raReqCnt].rapId;
878 if(RGSCH_IS_DEDPRM(cell, rapId))
880 rgSCHGetDedPrmUe(cell, rapId, raReqInd->timingInfo, &ue);
883 /* Since rapId is within dedicated range and No ue context
884 * is found means it is a spurious rach. So ignore it.*/
889 if(FALSE == isEmtcUe)
891 #if (ERRCLASS & ERRCLS_DEBUG)
892 if(raReqInd->rachInfoArr[raRntiCnt].raRnti > RGSCH_MAX_RA_RNTI)
894 RGSCHLOGERROR(cell->instIdx, ERRCLS_INT_PAR, ERG013,
895 (ErrVal)raReqInd->rachInfoArr[raRntiCnt].raRnti,
896 ("rgSCHTomRaReqInd(): raRnti is out of range\n"));
900 ret = rgSCHRamProcRaReq(raReqCnt, cell, raReqInd->rachInfoArr[raRntiCnt].raRnti,
901 (TfuRachInfo *)&raReqInd->rachInfoArr[raRntiCnt],
902 raReqInd->timingInfo, ue, &err);
905 err.errType = RGSCHERR_TOM_RAREQIND;
906 RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,
907 "RARNTI:%d rgSCHTomRaReqInd(): RAM processing failed errType(%d) "
908 "errCause(%d)", raReqInd->rachInfoArr[raRntiCnt].raRnti,
909 err.errType, err.errCause);
916 } /* rgSCHTomRaReqInd */
920 * @brief Handler for processing uplink CQI indication recieved from PHY.
924 * Function: rgSCHTomUlCqiInd
926 * Handler for processing uplink CQI indication recieved from PHY.
928 * Invoked by: RgLiTfuUlCqiInd
932 * - Invoke scheduler to push reported CQI info rgSCHUtlUlCqiInd
934 * @param[in] RgSchCellCb *cell
935 * @param[in] TfuUlCqiIndInfo *ulCqiInd
941 PUBLIC S16 rgSCHTomUlCqiInd
944 TfuUlCqiIndInfo *ulCqiInd
947 PUBLIC S16 rgSCHTomUlCqiInd(cell, ulCqiInd)
949 TfuUlCqiIndInfo *ulCqiInd;
954 TfuUlCqiRpt *ulCqiInfo;
955 TRC2(rgSCHTomUlCqiInd);
957 node = ulCqiInd->ulCqiRpt.first;
958 if(cell->cellId != ulCqiInd->cellId)
960 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
961 "rgSCHTomUlCqiInd() Unable to get the ulCqiInd cell with id(%d)",
966 for (;node; node=node->next)
968 ulCqiInfo = (TfuUlCqiRpt *)node->node;
969 #if (ERRCLASS & ERRCLS_DEBUG)
970 if(ulCqiInfo->numSubband == 0)
972 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Num Subband is"
973 "out of range RNTI:%d",ulCqiInfo->rnti);
977 if((ue = rgSCHDbmGetUeCb(cell, ulCqiInfo->rnti)) == NULLP)
980 if((ue = rgSCHDbmGetSpsUeCb(cell, ulCqiInfo->rnti)) == NULLP)
983 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get "
984 "the ue for RNTI:%d", ulCqiInfo->rnti);
988 /* wideband cqi is directly reported now. and also isTxPort0 */
989 rgSCHUtlUlCqiInd(cell, ue, ulCqiInfo);
992 } /* rgSCHTomUlCqiInd */
995 * @brief Handler for processing PUCCH power adjustment indication
999 * Function: rgSCHTomPucchDeltaPwrInd
1001 * Handler for processing PUCCH power adjustment indication
1002 * received from PHY.
1004 * Invoked by: RgLiTfuPucchDeltaPwrInd
1008 * - Invoke scheduler to push reported CQI info rgSCHUtlPucchDeltaPwrInd
1010 * @param[in] RgSchCellCb *cell
1011 * @param[in] TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
1017 PUBLIC S16 rgSCHTomPucchDeltaPwrInd
1020 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
1023 PUBLIC S16 rgSCHTomPucchDeltaPwrInd(cell, pucchDeltaPwr)
1025 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr;
1030 TfuPucchDeltaPwr *ueElem;
1032 TRC2(rgSCHTomPucchDeltaPwrInd);
1034 if(cell->cellId != pucchDeltaPwr->cellId)
1036 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1037 "rgSCHTomPucchDeltaPwrInd() Unable to get the pucchDeltaPwr cell with id(%d)",
1038 pucchDeltaPwr->cellId);
1042 node = pucchDeltaPwr->pucchDeltaPwrLst.first;
1043 for (;node; node=node->next)
1045 ueElem = (TfuPucchDeltaPwr *)node->node;
1046 if((ue = rgSCHDbmGetUeCb(cell, ueElem->rnti)) == NULLP)
1049 if((ue = rgSCHDbmGetSpsUeCb(cell, ueElem->rnti)) == NULLP)
1052 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d "
1053 "rgSCHTomPucchDeltaPwrInd() Unable to get the ue ",
1058 rgSCHUtlPucchDeltaPwrInd(cell, ue, ueElem->pucchDeltaPwr);
1061 } /* rgSCHTomPucchDeltaPwrInd */
1064 * @brief Handler for processing harq ACK/NACK indication recieved from PHY.
1068 * Function: rgSCHTomHarqAckInd
1070 * Handler for processing harq ACK/NACK indication recieved from PHY.
1072 * Invoked by: RgLiTfuHqInd
1075 * For each HqAckInfo received
1077 * - If UE doesnt exist look for a RaCb and invoke rgSCHRamMsg4FdbkInd
1078 * - Invoke HARQ module to pass HARQ-ACK info rgSCHDhmHqFdbkInd
1080 * @param[in] TfuHqIndInfo *harqAckInd
1086 PUBLIC S16 rgSCHTomHarqAckInd
1089 TfuHqIndInfo *harqAckInd
1092 PUBLIC S16 rgSCHTomHarqAckInd(cell, harqAckInd)
1094 TfuHqIndInfo *harqAckInd;
1107 RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1109 RgSchCellCb *iterCellP;
1111 TRC2(rgSCHTomHarqAckInd);
1113 if(cell->cellId != harqAckInd->cellId)
1115 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() Unable to get"
1116 " the cell for cellId (%d)", harqAckInd->cellId);
1117 err.errType = RGSCHERR_TOM_HARQACKIND;
1118 err.errCause = RGSCHERR_TOM_INV_CELL_ID;
1122 node = harqAckInd->hqIndLst.first;
1123 for (;node; node=node->next)
1125 hqInfo = (TfuHqInfo *)node->node;
1127 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1128 TfuHqFdbk fdbk = hqInfo->isAck[0];
1129 raCb = rgSCHDbmGetRaCb (cell, hqInfo->rnti);
1130 ue = rgSCHDbmGetUeCb (cell, hqInfo->rnti);
1131 if (ue != NULLP && raCb == NULLP)
1133 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, harqAckInd->timingInfo, fdbk, &err)) != ROK)
1135 err.errType = RGSCHERR_TOM_HARQACKIND;
1136 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
1137 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1138 err.errType, err.errCause);
1146 if ((rgSCHDhmRlsDlsfHqProc (cell, harqAckInd->timingInfo)) != ROK)
1148 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink "
1149 "subframe for cellId (%d) ", cell->cellId);
1150 err.errType = RGSCHERR_TOM_HARQACKIND;
1153 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
1155 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
1157 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
1159 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
1160 if(rlsHqBufs->numUes)
1162 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
1163 RgSchMacRlsHq (&pst, rlsHqBufs);
1165 rlsHqBufs->numUes = 0;
1169 rlsHqBufs->numUes = 0;
1170 node = harqAckInd->hqIndLst.first;
1171 for (;node; node=node->next)
1173 hqInfo = (TfuHqInfo *)node->node;
1174 for(tbCnt=0; tbCnt<TFU_MAX_HARQ_FDBKS; tbCnt++)
1176 hqInfo->isAck[tbCnt]=(TfuHqFdbk)rgSchTomHqFbkMap[hqInfo->isAck[tbCnt]];
1178 raCb = rgSCHDbmGetRaCb (cell, hqInfo->rnti);
1179 ue = rgSCHDbmGetUeCb (cell, hqInfo->rnti);
1180 if (ue == NULLP && raCb != NULLP)
1183 rgSCHRamMsg4FdbkInd (raCb);
1185 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1186 cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
1188 err.errType = RGSCHERR_TOM_HARQACKIND;
1189 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1190 " feedback processing failed errType(%d) errCause(%d)",
1191 err.errType, err.errCause);
1196 else if (ue != NULLP && raCb == NULLP)
1198 /* Get the Downlink HARQ entity from ue */
1199 if ((rgSCHDhmHqFdbkInd (ue, RGSCH_HQ_FDB_IND_CB_TYPE_HQ_ENT,
1200 cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
1202 err.errType = RGSCHERR_TOM_HARQACKIND;
1203 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
1204 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1205 err.errType, err.errCause);
1209 else if (ue != NULLP && raCb != NULLP)
1211 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1212 cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
1214 err.errType = RGSCHERR_TOM_HARQACKIND;
1215 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1216 " feedback processing failed errType(%d) errCause(%d).",
1217 err.errType, err.errCause);
1223 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
1224 "UE CB or RA CB ", hqInfo->rnti);
1225 err.errType = RGSCHERR_TOM_HARQACKIND;
1230 /* Check with TDD call DHM*/
1231 if ((rgSCHDhmRlsDlsfHqProc (cell, harqAckInd->timingInfo)) != ROK)
1233 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink "
1234 "subframe for cellId (%d) ", harqAckInd->cellId);
1235 err.errType = RGSCHERR_TOM_HARQACKIND;
1238 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
1240 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
1242 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
1244 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
1245 if(rlsHqBufs->numUes)
1247 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
1248 RgSchMacRlsHq (&pst, rlsHqBufs);
1250 rlsHqBufs->numUes = 0;
1255 } /* rgSCHTomHarqAckInd */
1259 * @brief Handler for processing Scheduling Request indication
1260 * recieved from PHY for a list of UEs.
1264 * Function: rgSCHTomSrInd
1266 * Handler for processing Scheduling Request indication recieved from PHY
1269 * Invoked by: RgLiTfuSrInd
1273 * - Invoke scheduler to indicate SR rgSCHUtlSrRcvd
1275 * @param[in] TfuSrIndInfo *srInd
1281 PUBLIC S16 rgSCHTomSrInd
1287 PUBLIC S16 rgSCHTomSrInd(cell, srInd)
1289 TfuSrIndInfo *srInd;
1298 TRC2(rgSCHTomSrInd);
1300 if(cell->cellId != srInd->cellId)
1302 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for srcInd cellId"
1303 ":%d ", srInd->cellId);
1304 err.errType = RGSCHERR_TOM_SRIND;
1305 err.errCause = RGSCHERR_TOM_INV_CELL_ID;
1310 node = srInd->srLst.first;
1311 for (;node; node=node->next)
1315 srInfo = (TfuSrInfo *)node->node;
1316 ue = rgSCHDbmGetUeCb (cell, srInfo->rnti);
1319 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB",
1323 rgSCHUtlHdlUlTransInd(cell, ue, srInd->timingInfo);
1324 /*Need to activate UE as SR received*/
1325 if (ue->isDrxEnabled)
1327 rgSCHDrxSrInd(cell, ue);
1329 ret = rgSCHUtlSrRcvd (cell, ue, srInd->timingInfo, &err);
1332 err.errType = RGSCHERR_TOM_SRIND;
1333 RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,"Scheduler processing failed "
1334 "errType(%d) errCause(%d) RNTI:%d", err.errType, err.errCause,srInfo->rnti);
1339 } /* end of rgSCHTomSrInd */
1342 * @brief Handler for processing downlink CQI indication recieved from
1347 * Function: rgSCHTomDoaInd
1349 * Handler for processing DOA recieved from PHY
1352 * Invoked by: RgLiTfuDoaInd
1356 * - Invoke scheduler to indicate DOA rgSCHUtlDoaInd
1358 * @param[in] TfuDoaIndInfo *doaInd
1364 PUBLIC S16 rgSCHTomDoaInd
1367 TfuDoaIndInfo *doaInd
1370 PUBLIC S16 rgSCHTomDoaInd(cell, doaInd )
1372 TfuDoaIndInfo *doaInd;
1378 TRC2(rgSCHTomDoaInd);
1380 if(cell->cellId != doaInd->cellId)
1382 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for doaInd cellId"
1383 ":%d", doaInd->cellId);
1388 node = doaInd->doaRpt.first;
1389 for (;node; node=node->next)
1391 doaInfo = (TfuDoaRpt *)node->node;
1392 ue = rgSCHDbmGetUeCb (cell, doaInfo->rnti);
1395 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB",
1399 rgSCHUtlDoaInd(cell, ue, doaInfo);
1402 } /* rgSCHTomDoaInd */
1404 * @brief Handler for processing downlink CQI indication recieved from
1409 * Function: rgSCHTomDlCqiInd
1411 * Handler for processing downlink CQI indication recieved from PHY
1414 * Invoked by: RgLiTfuDlCqiInd
1418 * - Invoke scheduler to indicate DL CQI rgSCHUtlDlCqiInd
1420 * @param[in] TfuDlCqiIndInfo *dlCqiInd
1426 PUBLIC S16 rgSCHTomDlCqiInd
1429 TfuDlCqiIndInfo *dlCqiInd
1432 PUBLIC S16 rgSCHTomDlCqiInd(cell, dlCqiInd)
1434 TfuDlCqiIndInfo *dlCqiInd;
1439 TfuDlCqiRpt *dlCqiInfo;
1440 TRC2(rgSCHTomDlCqiInd);
1442 if(cell->cellId != dlCqiInd->cellId)
1444 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
1445 ":%d", dlCqiInd->cellId);
1450 node = dlCqiInd->dlCqiRptsLst.first;
1451 for (;node; node=node->next)
1453 dlCqiInfo = (TfuDlCqiRpt *)node->node;
1454 ue = rgSCHDbmGetUeCb (cell, dlCqiInfo->rnti);
1457 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%dUnable to get the UE CB",
1461 rgSCHUtlDlCqiInd(cell, ue, dlCqiInfo, dlCqiInd->timingInfo);
1462 rgSCHUtlHdlUlTransInd(cell, ue, dlCqiInd->timingInfo);
1465 } /* rgSCHTomDlCqiInd */
1468 * @brief Handler for moving PCQI instance for the next periodic occasion
1472 * Function: rgSCHTomUtlMovePcqiNxtOccasion
1474 * Handler for moving PCQI instance for the next periodic occasion
1476 * Invoked by: rgSCHTomUtlFill*
1479 * - For a UE move its occurence instance to next occasion
1480 * depending on its periodicity
1481 * - Remove it from the current list and insert it to the list
1482 * having the index matching with the derived number.
1484 * @param[in] RgSchCellCb *cell,
1485 * [in] RgSchUeCb *ue
1491 PRIVATE S16 rgSCHTomUtlMovePcqiNxtOccasion
1495 RgSchUePCqiCb *cqiCb
1498 PRIVATE S16 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb)
1501 RgSchUePCqiCb *cqiCb;
1506 CmLteTimingInfo timingInfo;
1507 TRC2(rgSCHTomUtlMovePcqiNxtOccasion);
1509 if(cqiCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_SB_REP)
1512 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timingInfo, TFU_DELTA);
1514 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timingInfo,
1515 TFU_RECPREQ_DLDELTA);
1517 RG_SCH_ADD_TO_CRNT_TIME(timingInfo,timingInfo,cqiCb->cqiPeri);
1518 rgSCHTomUtlPcqiSbCalcBpIdx(timingInfo,ue,cqiCb);
1520 /* Compute Next Transmission Instance */
1521 cqiIdx = cqiCb->cqiPeri + cqiCb->nCqiTrIdx;
1522 cqiIdx = cqiIdx%RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1523 /* Delete from current List and move to new list */
1524 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst,
1527 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to remove node",
1530 cqiCb->nCqiTrIdx = cqiIdx;
1531 cmLListAdd2Tail(&(cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst),
1532 &(cqiCb->cqiLstEnt));
1534 rgSCHUtlSCellHndlCqiCollsn(cqiCb);
1538 } /* rgSCHTomUtlMovePcqiNxtOccasion */
1541 * @brief Handler for moving RI instance for the next periodic occasion
1545 * Function: rgSCHTomUtlMovePriNxtOccasion
1547 * Handler for moving PCQI instance for the next periodic occasion
1549 * Invoked by: rgSCHTomUtlFill*
1552 * - For a UE move its occurence instance to next occasion
1553 * depending on its periodicity
1554 * - Remove it from the current list and insert it to the list
1555 * having the index matching with the derived number.
1557 * @param[in] RgSchCellCb *cell,
1558 * [in] RgSchUeCb *ue
1564 PRIVATE S16 rgSCHTomUtlMovePriNxtOccasion
1571 PRIVATE S16 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb)
1574 RgSchUePCqiCb *riCb;
1584 TRC2(rgSCHTomUtlMovePriNxtOccasion);
1585 crntTime = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)
1586 +(cell->crntTime.slot);
1587 #ifdef XEON_SPECIFIC_CHANGES
1588 RGSCHCPYTIMEINFO(cell->crntTime, ue->riRecpTime);
1590 /* Compute Next Transmission Instance */
1591 if (riCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_WB_REP)
1593 effPeriodicity = riCb->cqiPeri * riCb->riPeri;
1594 tempIdx = effPeriodicity + riCb->nRiTrIdx;
1598 effPeriodicity = (riCb->h * riCb->cqiPeri * riCb->riPeri);
1599 /* In case of SFN wraparound, the SB CQI reporting cycle breaks
1600 * and RI->WB CQI->SBCQI.. should resume. RI is repositioned
1601 * accordingly. WBCQI handling is naturally accomplished */
1602 if ((crntTime + TFU_RECPREQ_DLDELTA + effPeriodicity) >
1603 (RGSCH_MAX_SUBFRM_5G - 1))
1605 riTrInsTime = (effPeriodicity - riCb->cqiOffset + riCb->riOffset) % effPeriodicity;
1606 tempIdx = RGSCH_MAX_SUBFRM_5G + (effPeriodicity - riTrInsTime);
1607 /* In case of SFN wraparound, riDist should be distance from crntTime
1608 * + TFU_RECPREQ_DLDELTA to tempIdx. Updating effPeriodicity
1609 * to make riDist calculation consistent for both SFN wraparound
1610 * case and normal case */
1611 effPeriodicity = tempIdx - TFU_RECPREQ_DLDELTA - crntTime;
1615 tempIdx = effPeriodicity + riCb->nRiTrIdx;
1618 riIdx = tempIdx % RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1619 if (effPeriodicity >= RG_SCH_PCQI_SRS_SR_TRINS_SIZE)
1621 riDist = rgSCHUtlFindDist((U16)(crntTime + TFU_RECPREQ_DLDELTA),
1622 (U16)(crntTime + TFU_RECPREQ_DLDELTA + effPeriodicity));
1629 /* ccpu00138306- If Periodicity is equal to Queue Size or multiple of it
1630 * then the next occasion idx will be same as current Idx, Hence need not
1633 if((effPeriodicity%RG_SCH_PCQI_SRS_SR_TRINS_SIZE) != 0)
1635 /* Delete from current List and move to new list */
1636 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[riCb->nRiTrIdx].riLst,
1639 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"[%d]UEID:Unable to remove node",
1642 RG_SCH_RECORD(&riCb->histElem,RGSCH_ACTION_DEL, &cell->pCqiSrsSrLst[riCb->nRiTrIdx].riLst);
1643 cmLListAdd2Tail(&cell->pCqiSrsSrLst[riIdx].riLst,
1645 RG_SCH_RECORD(&riCb->histElem,RGSCH_ACTION_ADD, &cell->pCqiSrsSrLst[riIdx].riLst);
1654 riCb->nRiTrIdx = riIdx;
1655 riCb->riDist = riDist;
1658 rgSCHUtlSCellHndlRiCollsn(riCb);
1661 } /* rgSCHTomUtlMovePriNxtOccasion */
1664 * @brief Handler for moving SR instance for the next periodic occasion
1668 * Function: rgSCHTomUtlMoveSrNxtOccasion
1670 * Handler for moving SR instance for the next periodic occasion
1672 * Invoked by: rgSCHTomUtlFill*
1675 * - For a UE move its occurence instance to next occasion
1676 * depending on its periodicity
1677 * - Remove it from the current list and insert it to the list
1678 * having the index matching with the derived number.
1680 * @param[in] RgSchCellCb *cell,
1681 * [in] RgSchUeCb *ue
1687 PRIVATE S16 rgSCHTomUtlMoveSrNxtOccasion
1693 PRIVATE S16 rgSCHTomUtlMoveSrNxtOccasion(cell, ue)
1700 TRC2(rgSCHTomUtlMoveSrNxtOccasion);
1702 /* Compute Next Transmission Instance */
1703 srIdx = ue->srCb.peri + ue->srCb.nSrTrIdx;
1704 srIdx = srIdx%RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1705 /* Delete from current List and move to new list */
1706 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[ue->srCb.nSrTrIdx].srLst,
1707 &ue->srCb.srLstEnt))
1709 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to remove node",
1712 ue->srCb.nSrTrIdx = srIdx;
1713 cmLListAdd2Tail(&cell->pCqiSrsSrLst[ue->srCb.nSrTrIdx].srLst,
1714 &ue->srCb.srLstEnt);
1717 } /* rgSCHTomUtlMoveSrNxtOccasion */
1720 * @brief Handler for moving SRS instance for the next periodic occasion
1724 * Function: rgSCHTomUtlMoveSrsNxtOccasion
1726 * Handler for moving SRS instance for the next periodic occasion
1728 * Invoked by: rgSCHTomUtlFill*
1731 * - For a UE move its occurence instance to next occasion
1732 * depending on its periodicity
1733 * - Remove it from the current list and insert it to the list
1734 * having the index matching with the derived number.
1736 * @param[in] RgSchCellCb *cell,
1737 * [in] RgSchUeCb *ue
1743 PRIVATE S16 rgSCHTomUtlMoveSrsNxtOccasion
1749 PRIVATE S16 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue)
1760 TRC2(rgSCHTomUtlMoveSrsNxtOccasion);
1761 crntTime = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)
1762 +(cell->crntTime.slot);
1764 /* Compute Next Transmission Instance */
1765 tempIdx = ue->srsCb.peri + ue->srsCb.nSrsTrIdx;
1766 srsIdx = tempIdx %RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1767 if (ue->srsCb.peri > RG_SCH_PCQI_SRS_SR_TRINS_SIZE)
1769 srsDist = rgSCHUtlFindDist((U16)(crntTime + TFU_RECPREQ_DLDELTA),
1770 (U16)(crntTime + TFU_RECPREQ_DLDELTA + ue->srsCb.peri));
1777 /* ccpu00138306- If Periodicity is equal to Queue Size or multiple of it
1778 * then the next occasion idx will be same as current Idx, Hence need not
1781 if((ue->srsCb.peri%RG_SCH_PCQI_SRS_SR_TRINS_SIZE) != 0)
1783 /* Delete from current List and move to new list */
1784 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[ue->srsCb.nSrsTrIdx].srsLst,
1785 &ue->srsCb.srsLstEnt))
1787 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to remove node",
1790 cmLListAdd2Tail(&cell->pCqiSrsSrLst[srsIdx].srsLst,
1791 &ue->srsCb.srsLstEnt);
1800 ue->srsCb.nSrsTrIdx = srsIdx;
1801 ue->srsCb.srsDist = srsDist;
1804 } /* rgSCHTomUtlMoveSrsNxtOccasion */
1808 * @brief Handler for processing RAW CQI indication recieved from
1813 * Function: rgSCHTomRawCqiInd
1815 * Handler for processing RAW CQI indication recieved from PHY
1818 * Invoked by: RgLiTfuRawCqiInd
1822 * - Invoke scheduler to indicate Raw CQI rgSCHUtlRawCqiInd
1824 * @param[in] TfuRawCqiIndInfo *rawCqiInd
1830 PUBLIC S16 rgSCHTomRawCqiInd
1833 TfuRawCqiIndInfo *rawCqiInd
1836 PUBLIC S16 rgSCHTomRawCqiInd(cell, rawCqiInd)
1838 TfuRawCqiIndInfo *rawCqiInd;
1843 TfuRawCqiRpt* rawCqiInfo;
1847 RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1848 RgSchCellCb *iterCellP;
1859 TRC2(rgSCHTomRawCqiInd);
1861 if(cell->cellId != rawCqiInd->cellId)
1863 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
1864 ":%d", rawCqiInd->cellId);
1869 node = rawCqiInd->rawCqiRpt.first;
1870 for (;node; node=node->next)
1872 rawCqiInfo = (TfuRawCqiRpt *)node->node;
1873 ue = rgSCHDbmGetUeCb (cell, rawCqiInfo->crnti);
1874 raCb = rgSCHDbmGetRaCb (cell, rawCqiInfo->crnti);
1878 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"CRNTI:%d Unable to get the UECB",
1885 if (rawCqiInfo->numBits >= 5)
1886 printf("cellId [%d] crnti [%d] numBits [%d] uciPayload [0x%08x] sfn/sf [%d:%d]\n",
1887 cell->cellId, rawCqiInfo->crnti, rawCqiInfo->numBits, rawCqiInfo->uciPayload,
1888 rawCqiInd->timingInfo.sfn, rawCqiInd->timingInfo.slot);
1890 if (rawCqiInfo->numBits == 1)
1892 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1893 U8 fdbk = TFU_HQFDB_NACK;
1894 /* Process HARQ FdbkInd */
1895 hqAck = (rawCqiInfo->uciPayload >> 31) & 0x1;
1898 fdbk = TFU_HQFDB_ACK;
1899 hqInfo.isAck[0] = fdbk;
1901 if (ue != NULLP && raCb == NULLP)
1903 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, rawCqiInd->timingInfo, fdbk, &err)) != ROK)
1905 err.errType = RGSCHERR_TOM_HARQACKIND;
1906 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
1907 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1908 err.errType, err.errCause);
1912 else if (ue == NULLP && raCb != NULLP)
1914 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1915 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1917 err.errType = RGSCHERR_TOM_HARQACKIND;
1918 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1919 " feedback processing failed errType(%d) errCause(%d)",
1920 err.errType, err.errCause);
1925 else if (ue != NULLP && raCb != NULLP)
1927 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1928 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1930 err.errType = RGSCHERR_TOM_HARQACKIND;
1931 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1932 " feedback processing failed errType(%d) errCause(%d).",
1933 err.errType, err.errCause);
1939 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
1940 "UE CB or RA CB ", rawCqiInfo->crnti);
1941 err.errType = RGSCHERR_TOM_HARQACKIND;
1945 printf("rawCqiInfo->numBits [%d] uciPayload [0x%08x] sfn/sf [%d:%d]\n", rawCqiInfo->numBits,
1946 rawCqiInfo->uciPayload, rawCqiInd->timingInfo.sfn, rawCqiInd->timingInfo.slot);
1949 else if (rawCqiInfo->numBits == 5)
1951 /* Process CQI-RI Ind*/
1952 ri = (rawCqiInfo->uciPayload >> 27) & 0x1;
1953 cqi = (rawCqiInfo->uciPayload >> 28) & 0xF;
1957 printf("\n UE[%d] CQI[%d] Invalid\n", ue->ueId, cqi);
1960 ue->ue5gtfCb.mcs = rgSch5gtfCqi2Mcs[cqi - 1];
1961 ue->ue5gtfCb.rank = ri + 1;
1963 if (rawCqiInfo->numBits > 1)
1965 ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
1966 ueDl->mimoInfo.cwInfo[0].cqi = cqi;
1967 ueDl->cqiFlag = TRUE;
1968 rgSCHCmnDlSetUeAllocLmtLa(cell, ue);
1969 // rgSCHCheckAndSetTxScheme(cell, ue);
1974 printf("UE[%d] CQI[%d] MCS[%d] RI[%d]\n", ue->ueId, cqi, ue->ue5gtfCb.mcs, ri);
1977 else if (rawCqiInfo->numBits == 6)
1979 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1980 TfuHqFdbk fdbk = TFU_HQFDB_NACK;
1981 /* Process both HARQ and CQI-RI Ind*/
1982 ri = (rawCqiInfo->uciPayload >> 26) & 0x1;
1983 cqi = (rawCqiInfo->uciPayload >> 27) & 0xF;
1984 hqAck = (rawCqiInfo->uciPayload >> 31) & 0x1;
1987 printf("UE[%d] CQI[%d] Invalid\n", ue->ueId, cqi);
1990 ue->ue5gtfCb.mcs = rgSch5gtfCqi2Mcs[cqi - 1];
1991 ue->ue5gtfCb.rank = ri + 1;
1993 if (rawCqiInfo->numBits > 1)
1995 ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
1996 ueDl->mimoInfo.cwInfo[0].cqi = cqi;
1997 ueDl->cqiFlag = TRUE;
1998 rgSCHCmnDlSetUeAllocLmtLa(cell, ue);
1999 // rgSCHCheckAndSetTxScheme(cell, ue);
2004 fdbk = TFU_HQFDB_ACK;
2005 hqInfo.isAck[0] = fdbk;
2007 if (ue != NULLP && raCb == NULLP)
2009 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, rawCqiInd->timingInfo, fdbk, &err)) != ROK)
2011 err.errType = RGSCHERR_TOM_HARQACKIND;
2012 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
2013 "HARQ feedback processing failed errType(%d)errCause(%d)n",
2014 err.errType, err.errCause);
2018 else if (ue == NULLP && raCb != NULLP)
2020 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
2021 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
2023 err.errType = RGSCHERR_TOM_HARQACKIND;
2024 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
2025 " feedback processing failed errType(%d) errCause(%d)",
2026 err.errType, err.errCause);
2031 else if (ue != NULLP && raCb != NULLP)
2033 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
2034 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
2036 err.errType = RGSCHERR_TOM_HARQACKIND;
2037 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
2038 " feedback processing failed errType(%d) errCause(%d).",
2039 err.errType, err.errCause);
2045 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
2046 "UE CB or RA CB ", rawCqiInfo->crnti);
2047 err.errType = RGSCHERR_TOM_HARQACKIND;
2052 printf("\nUE[%u] CQI[%u] MCS[%u] RI[%u] HQ[%u]\n", ue->ueId, cqi, ue->ue5gtfCb.mcs, ri, hqAck);
2057 if ((rgSCHDhmRlsDlsfHqProc (cell, rawCqiInd->timingInfo)) != ROK)
2059 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink "
2060 "subframe for cellId (%d) ", cell->cellId);
2061 err.errType = RGSCHERR_TOM_HARQACKIND;
2064 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
2066 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
2068 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
2070 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
2071 if(rlsHqBufs->numUes)
2073 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
2074 RgSchMacRlsHq (&pst, rlsHqBufs);
2076 rlsHqBufs->numUes = 0;
2080 } /* rgSCHTomRawCqiInd */
2083 * @brief Handler for processing SRS indication recieved from
2088 * Function: rgSCHTomSrsInd
2090 * Handler for SRS indication recieved from PHY
2093 * Invoked by: RgLiTfuSrsInd
2097 * - Invoke scheduler to indicate UL SRS rgSCHUtlSrsInd
2099 * @param[in] TfuSrsIndInfo *srsInd
2105 PUBLIC S16 rgSCHTomSrsInd
2108 TfuSrsIndInfo *srsInd
2111 PUBLIC S16 rgSCHTomSrsInd(cell, srsInd)
2113 TfuSrsIndInfo *srsInd;
2120 TRC2(rgSCHTomSrsInd);
2122 if(cell->cellId != srsInd->cellId)
2124 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
2125 ":%d", srsInd->cellId);
2129 node = srsInd->srsRpt.first;
2130 for (;node; node=node->next)
2132 srsInfo = (TfuSrsRpt *)node->node;
2133 ue = rgSCHDbmGetUeCb (cell, srsInfo->ueId);
2136 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
2137 "UE CB", srsInfo->ueId);
2140 rgSCHUtlSrsInd(cell, ue, srsInfo, srsInd->timingInfo);
2141 rgSCHUtlHdlUlTransInd(cell, ue, srsInd->timingInfo);
2144 } /* rgSCHTomSrsInd */
2148 * Fun: rgSCHTomUtlGenIndices
2150 * Desc: This function reconstructs the Subband Indices for
2151 * of M selected Subbands conveyed by the UE for APeriodic Modes
2152 * 2-0 and 2-2. It decodes the Label which uniquely encodes M out
2160 * File: rg_sch_utl.c
2165 PRIVATE S16 rgSCHTomUtlGenIndices
2171 TfuSubbandInfo* sbInfo
2174 PRIVATE S16 rgSCHTomUtlGenIndices(label, posM, valN, valK, sbInfo)
2179 TfuSubbandInfo* sbInfo;
2182 U8 idx, kval, xval, xmin;
2185 for(kval=0; kval<posM;kval++)
2188 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe, (posM-kval-1));
2189 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe[posM-kval-1], (valN-xval-1));
2190 binCoe = rgSCHTomBinCoe[posM-kval-1][valN-xval-1];
2194 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe[posM-kval-1], (valN-xval-1));
2195 binCoe = rgSCHTomBinCoe[posM-kval-1][valN-xval-1];
2198 sbInfo[kval].numRb = valK;
2199 sbInfo[kval].rbStart = idx*valK;
2201 label = label-binCoe;
2204 } /* end of rgSCHTomUtlGenIndices*/
2208 * @brief Handler for processing decode failure indication recieved from
2213 * Function: rgSCHTomCrcInd
2215 * Handler for processing decode failure indication recieved from
2216 * PHY for a set of UEs.
2218 * Invoked by: RgLiTfuCrcInd of rg_sch.x
2221 * - Validate the information received and retrieve cell and ue.
2222 * - Process Decode failure Indication: Call rgSCHUhmProcHqFailure().
2224 * @param[in] TfuCrcIndInfo *crcInd
2230 PUBLIC S16 rgSCHTomCrcInd
2233 TfuCrcIndInfo *crcInd
2236 PUBLIC S16 rgSCHTomCrcInd(cell, crcInd)
2238 TfuCrcIndInfo *crcInd;
2241 RgSchUeCb *ue = NULLP;
2242 RgSchRaCb *raCb = NULLP;
2244 TfuCrcInfo *crcInfo;
2245 #ifdef RG_ULSCHED_AT_CRC
2248 CmLteTimingInfo crntHiDci0Frm;
2249 //RgSchCmnUlCell *cellUl;
2250 Inst inst = cell->instIdx;
2251 TfuCntrlReqInfo *cntrlInfo;
2259 RgSchUlHqProcCb *hqProc;
2263 RgSchUlHqProcCb *ulHqProc;
2266 TRC2(rgSCHTomCrcInd);
2268 if(cell->cellId != crcInd->cellId)
2270 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
2271 ":%d", crcInd->cellId);
2274 #ifdef RG_ULSCHED_AT_CRC
2277 static CmLteTimingInfo lastCrc = {2000,0};
2278 CmLteTimingInfo crntCrc = cell->crntTime;
2279 if (RGSCH_TIMEINFO_SAME(lastCrc, crntCrc))
2281 /*Removed the WA to drop 2nd CRC*/
2282 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"Recieved CRC "
2283 "twice per TTI @(%u,%u)", cell->crntTime.sfn,
2284 cell->crntTime.slot);
2290 node = crcInd->crcLst.first;
2291 for (;node; node=node->next)
2293 crcInfo = (TfuCrcInfo*)node->node;
2294 ue = rgSCHDbmGetUeCb (cell, crcInfo->rnti);
2298 /* Fetch from SPS List */
2299 ue = rgSCHDbmGetSpsUeCb(cell, crcInfo->rnti);
2303 raCb = rgSCHDbmGetRaCb (cell, crcInfo->rnti);
2310 /* Added Ul TB count for Uplink data scheduled*/
2314 ulHqProc = &(raCb->msg3HqProc);
2315 if(ulHqProc->remTx == (cell->rachCfg.maxMsg3Tx -1))
2317 cell->dlUlTbCnt.tbTransUlTotalCnt++;
2322 rgSCHUtlUlHqProcForUe(cell, crcInd->timingInfo, ue, &ulHqProc);
2323 if(ulHqProc->remTx == ((RgUeUlHqCb*)ulHqProc->hqEnt)->maxHqRetx)
2325 cell->dlUlTbCnt.tbTransUlTotalCnt++;
2330 if (crcInfo->isFailure == FALSE)
2334 rgSCHRamMsg3DatInd(raCb);
2336 /*ccpu00128820 - MOD - Msg3 alloc double delete issue*/
2337 hqProc = &(raCb->msg3HqProc);
2338 RGSCH_UPD_PHICH(cell->ulDlCfgIdx, crcInd->timingInfo.slot,
2346 gUlCrcPassCounter++;
2351 RGSCHCPYTIMEINFO(crcInd->timingInfo, ue->datIndTime);
2352 #ifndef MAC_SCH_STATS
2353 rgSCHUhmProcDatInd(cell, ue, crcInd->timingInfo);
2356 /** Stats update over here
2359 RgSchCmnUe *cmnUe = RG_SCH_CMN_GET_UE(ue,cell);
2361 rgSCHUhmProcDatInd(cell, ue, crcInd->timingInfo, cmnUe->ul.crntUlCqi[0]);
2363 #endif /* MAC_SCH_STATS */
2365 rgSCHUtlHdlUlTransInd(cell, ue, crcInd->timingInfo);
2367 rgSCHUtlHdlCrcInd(cell, ue, crcInd->timingInfo);
2375 /* SR_RACH_STATS : MSG3 Nack / DTX*/
2376 if (crcInfo->isDtx == TRUE)
2382 rgNumMsg3CrcFailed++;
2384 rgSCHRamMsg3FailureInd(raCb);
2386 rgSCHCmnEmtcHdlCrcFailInd(cell, raCb);
2388 /* Added Ul TB count for CRC Failure of MSG3 */
2390 ulHqProc = &(raCb->msg3HqProc);
2391 if(ulHqProc->remTx == (cell->rachCfg.maxMsg3Tx -1))
2393 cell->dlUlTbCnt.tbTransUlFaulty++;
2401 gUlCrcFailCounter++;
2406 #ifndef MAC_SCH_STATS
2407 rgSCHUhmProcHqFailure (cell, ue, crcInd->timingInfo, crcInfo->rv);
2410 RgSchCmnUe *cmnUe = RG_SCH_CMN_GET_UE(ue,cell);
2412 rgSCHUhmProcHqFailure (cell, ue, crcInd->timingInfo, crcInfo->rv, cmnUe->ul.crntUlCqi[0]);
2414 #endif /* MAC_SCH_STATS */
2415 rgSCHUtlHdlUlTransInd(cell, ue, crcInd->timingInfo);
2417 rgSCHUtlHdlCrcFailInd(cell, ue, crcInd->timingInfo);
2419 /* Added Ul TB count for CRC Failure of Uplink data */
2421 rgSCHUtlUlHqProcForUe(cell, crcInd->timingInfo, ue, &ulHqProc);
2422 if(ulHqProc->remTx == ((RgUeUlHqCb*)ulHqProc->hqEnt)->maxHqRetx)
2424 cell->dlUlTbCnt.tbTransUlFaulty++;
2431 /* ccpu00132653-ADD Added Sched_At_Crc Changes for TDD and optimized here
2432 the codebase across TDD and FDD*/
2433 #ifdef RG_ULSCHED_AT_CRC
2434 /* Changes to do uplink scheduling at CRC Indication */
2435 //cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
2436 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, crntHiDci0Frm, TFU_ULCNTRL_DLDELTA);
2439 rgSCHCmnRlsUlSf(cell,0);
2442 /* Allocating memory for CntrlReq as it required for both EMTC and
2444 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&cntrlInfo,
2445 sizeof(TfuCntrlReqInfo))) != ROK)
2447 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate TfuCntrlReqInfo "
2451 rgSCHCmnUlSch(cell);
2453 rgSCHL2Meas(cell,TRUE);
2455 /* Also, sending UL DCI and PHICH for just scheduled subframe */
2456 ulSf = rgSCHUtlSubFrmGet (cell, crntHiDci0Frm);
2458 if ((rgSCHTomUtlProcDlSfAtCrc (ulSf, crntHiDci0Frm, cell, cntrlInfo, &err)) != ROK)
2460 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomCrcInd() Unable to process"
2461 " downlink subframe for cellId %d", crcInd->cellId);
2462 err.errType = RGSCHERR_TOM_TTIIND;
2465 #endif /* RG_ULSCHED_AT_CRC */
2467 } /* rgSCHTomCrcInd */
2470 * @brief Handler for processing timing Advance indication recieved from
2475 * Function: rgSCHTomTimingAdvInd
2477 * Handler for processing timing advance indication recieved from PHY
2480 * Invoked by: RgLiTfuTimingAdvInd
2484 * - Call DHM to update value of Timing Advance rgSCHDhmUpdTa.
2486 * @param[in] TfuTimingAdvIndInfo *timingAdvInd
2492 PUBLIC S16 rgSCHTomTimingAdvInd
2495 TfuTimingAdvIndInfo *timingAdvInd
2498 PUBLIC S16 rgSCHTomTimingAdvInd(cell, timingAdvInd)
2500 TfuTimingAdvIndInfo *timingAdvInd;
2505 TfuTimingAdvInfo *timingAdvInfo;
2508 TRC2(rgSCHTomTimingAdvInd);
2510 if(cell->cellId != timingAdvInd->cellId)
2512 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
2513 "=(%d)", timingAdvInd->cellId);
2518 node = timingAdvInd->timingAdvLst.first;
2519 for (;node; node=node->next)
2521 timingAdvInfo = (TfuTimingAdvInfo *)node->node;
2522 ue = rgSCHDbmGetUeCb (cell, timingAdvInfo->rnti);
2525 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB",
2526 timingAdvInfo->rnti);
2529 rgSCHDhmUpdTa (cell, ue, timingAdvInfo->timingAdv);
2532 } /* rgSCHTomTimingAdvInd */
2535 * @brief Handler for processing TTI indication recieved from
2536 * PHY for 'n' cells.
2540 * Function: rgSCHTomTtiInd
2542 * Handler for processing slot indication recieved from MAC
2543 * for a cell. This is split into the below Steps.
2545 * 1: Complete the Uplink and Common Channel Scheduling for each Cell
2546 * 2: Complete the UE specific Scheduling for each Cell / across Cells.
2547 * 3: Consolidate the subframe allocations and send to each MAC instance
2548 * 4: Fill the Tfu structures for DL and UL Config requests
2549 * 5: Handle the RGR Config messages per Cell
2551 * @param[in] SlotIndInfo *slotInd
2552 * @param[in] Inst schInst
2556 PUBLIC Void rgSCHTomTtiInd
2558 SlotIndInfo *slotInd,
2562 PUBLIC Void rgSCHTomTtiInd(slotInd, schInst)
2563 SlotIndInfo *slotInd;
2567 RgInfSfAlloc *subfrmAlloc;
2568 RgTfuCntrlReqInfo *cntrlInfo = NULLP;
2572 RgSchCellCb *cell[CM_LTE_MAX_CELLS];
2573 RgSchCellCb *cellLst[CM_LTE_MAX_CELLS];
2575 TRC2(rgSCHTomTtiInd);
2581 //rgSchTomFillCellTtiInfo(slotInd, schInst, &nCell, &cell[0]);
2583 schFillCrntTime(*slotInd,schInst);
2584 for (i = 0; i < nCell; i++)
2586 /* Perform UL and DL Common Channel scheduling */
2587 rgSchTomTtiUlAndDlCmnChSch (cell[i]);
2590 /* Perform scheduling in Order of
2594 for (i = 0; i < nCell; i++)
2597 if (cell[i]->isDlDataAllwd && (cell[i]->stopDlSch == FALSE))
2599 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell[i]);
2600 /* Perform DL Retx scheduling */
2601 cellSch->apisDl->rgSCHDlRetxSched(cell[i], &cellSch->allocInfo);
2605 rgSchCmnPreDlSch(cell, nCell, cellLst);
2606 for (i = 0; i < nCell; i++)
2608 /* Perform DL scheduling */
2609 rgSchTomTtiDlSch (cellLst[i]);
2611 rgSchCmnPstDlSch(cell[0]);
2613 for (i = 0; i < nCell; i++)
2616 #ifndef RG_ULSCHED_AT_CRC
2617 /* Perform UL scheduling for TDD */
2618 rgSCHCmnUlSch (cell[i]);
2622 /* Init SF Alloc info per Cell */
2623 for (i = 0; i < nCell; i++)
2625 subfrmAlloc = &(cell[i]->sfAllocArr[cell[i]->crntSfIdx]);
2626 rgSCHUtlResetSfAlloc(subfrmAlloc,FALSE,TRUE);
2628 for (i = 0; i < nCell; i++)
2630 if (cell[i]->isDlDataAllwd && (cell[i]->stopSiSch == FALSE))
2632 subfrmAlloc = &(cell[i]->sfAllocArr[cell[i]->crntSfIdx]);
2634 * TFU_DLDATA_DLDELTA is used in this calculation because the subfrmAlloc
2635 * timingInfo which is being calculated here will be used by MAC
2637 RG_SCH_ADD_TO_CRNT_TIME(cell[i]->crntTime, subfrmAlloc->timingInfo,
2638 RG_DL_DELTA - TFU_DLDATA_DLDELTA);
2639 /* Consolidate the Allocations and send response to MAC instances */
2640 rgSchTomTtiCnsldtSfAlloc (cell[i]);
2644 for (i = 0; i < nCell; i++)
2646 if (cell[i]->isDlDataAllwd && (cell[i]->stopSiSch == FALSE))
2648 /* Send the consolidated Alloc Info to MAC instances */
2649 rgSCHCmnSndCnsldtInfo (cell[i]);
2653 for (i = 0; i < nCell; i++)
2655 /* Fill control data from scheduler to PHY */
2656 if ((ret = rgSCHUtlAllocEventMem((cell[i]->instIdx), (Ptr *)&cntrlInfo,
2657 sizeof(RgTfuCntrlReqInfo))) != ROK)
2659 RLOG_ARG0(L_ERROR,DBG_CELLID,cell[i]->cellId,"Unable to Allocate TfuCntrlReqInfo"
2665 /* Fill the TFU structures and send to CL */
2666 if(TRUE == cell[i]->emtcEnable)
2668 ret = rgSchEmtcTomTtiL1DlAndUlCfg (cell[i], cntrlInfo);
2672 && (NULLP != cntrlInfo))
2674 /* Fill the TFU structures and send to CL */
2675 rgSchTomTtiL1DlAndUlCfg (cell[i], cntrlInfo);
2679 rgSCHTomUtlSendSfnTick(cell[0]);
2682 for (i = 0; i < nCell; i++)
2684 /* Invoke non critical functions like measurements, etc */
2685 rgSchTomTtiMiscFunctions (cell[i]);
2690 U32 dbgUeIdChngAndDatReqInClCnt = 0;
2691 static U32 gTtiCount = 0;
2694 if(gTtiCount == 3000)
2696 #ifdef XEON_SPECIFIC_CHANGES
2697 printf("SChed:: (P/S)::(%u/%u) \n",
2698 gPrimarySchedCount,gSCellSchedCount);
2700 printf("\n HQFDBK :: %u\n",gHqFdbkCount);
2705 total = gPCellTb1AckCount + gPCellTb1NackCount + gPCellTb1DtxCount;
2706 total2 = gPCellTb2AckCount + gPCellTb2NackCount + gPCellTb2DtxCount;
2708 printf("\n PCell:: TB1:: (A/N/D)::(%u/%u/%u) TB2:: (A/N/D)::(%u/%u/%u)\n",
2709 gPCellTb1AckCount,gPCellTb1NackCount,gPCellTb1DtxCount,
2710 gPCellTb2AckCount,gPCellTb2NackCount,gPCellTb2DtxCount);
2711 if ((total != 0 ) && total2 != 0)
2713 printf("\n PCell:: TB1:: (AP/NP/DP)::(%.2f/%.2f/%.2f) TB2:: (AP/NP/DP)::(%.2f/%.2f/%.2f)\n",
2714 (float)gPCellTb1AckCount/total * 100,(float)gPCellTb1NackCount/total * 100,(float)gPCellTb1DtxCount/total * 100,
2715 (float)gPCellTb2AckCount/total2 *100 ,(float)gPCellTb2NackCount/total2 *100 ,(float)gPCellTb2DtxCount/total2 *2);
2718 total = gSCellTb1AckCount + gSCellTb1NackCount + gSCellTb1DtxCount;
2719 total2 = gSCellTb2AckCount + gSCellTb2NackCount + gSCellTb2DtxCount;
2722 printf("\n SCell:: TB1:: (A/N/D)::(%u/%u/%u) TB2:: (A/N/D)::(%u/%u/%u)\n",
2723 gSCellTb1AckCount,gSCellTb1NackCount,gSCellTb1DtxCount,
2724 gSCellTb2AckCount,gSCellTb2NackCount,gSCellTb2DtxCount);
2725 if ((total != 0 ) && total2 != 0)
2727 printf("\n SCell:: TB1:: (AP/NP/DP)::(%.2f/%.2f/%.2f) TB2:: (AP/NP/DP)::(%.2f/%.2f/%.2f)\n",
2728 (float)gSCellTb1AckCount/total * 100,(float)gSCellTb1NackCount/total * 100,(float)gSCellTb1DtxCount/total * 100,
2729 (float)gSCellTb2AckCount/total2 *100 ,(float)gSCellTb2NackCount/total2 *100 ,(float)gSCellTb2DtxCount/total2 *2);
2733 printf("\n CQI:: Recp(Pucch/Pusch):Rcvd(pcqi/rawacqireport/apcqi/AppReprt)::(%u/%u):(%u/%u/%u/%u)\n",
2734 gCqiRecpCount,gCqiRecpPuschCount,gCqiRcvdCount,gRawACqiCount,
2735 gACqiRcvdCount,gCqiReptToAppCount);
2737 printf("\n (F1BCS Count/Cqi/Ri/CqiDrop/PucchDrop/PuschCqiDrop)::(%u/%u/%u/%u/%u/%u)\n",
2738 gF1bCsCount,gCqiReqCount,gRiReqCount,gCqiDropCount,gPucchDropCount,gPuschCqiDropCount);
2740 printf("UL::(DCI0/CrcPass/CrcFail)::(%u/%u/%u)\n"
2741 "gPcellZeroBoOcc:%u\t gScellZeroBoOcc:%u dbgUeIdChngAndDatReqInClCnt: %u\n"
2742 "DelayedDatReqInMac: %u DelayedDatReqInCl : %u gIccPktRcvrMemDropCnt :%u\n",
2748 dbgUeIdChngAndDatReqInClCnt,
2749 dbgDelayedDatReqInMac,
2750 gDropDatReqCnt, gIccPktRcvrMemDropCnt);
2752 printf("SChed:: (P/S)::(%ld/%ld) \n",
2753 gPrimarySchedCount,gSCellSchedCount);
2755 printf("\n HQFDBK :: %ld\n",gHqFdbkCount);
2757 printf("\n PCell:: TB1:: (A/N/D)::(%ld/%ld/%ld) TB2:: (A/N/D)::(%ld/%ld/%ld)\n",
2758 gPCellTb1AckCount,gPCellTb1NackCount,gPCellTb1DtxCount,
2759 gPCellTb2AckCount,gPCellTb2NackCount,gPCellTb2DtxCount);
2761 printf("\n SCell:: TB1:: (A/N/D)::(%ld/%ld/%ld) TB2:: (A/N/D)::(%ld/%ld/%ld)\n",
2762 gSCellTb1AckCount,gSCellTb1NackCount,gSCellTb1DtxCount,
2763 gSCellTb2AckCount,gSCellTb2NackCount,gSCellTb2DtxCount);
2765 printf("\n CQI:: Recp(Pucch/Pusch):Rcvd(pcqi/rawacqireport/apcqi/AppReprt)::(%ld/%ld):(%ld/%ld/%ld/%ld)\n",
2766 gCqiRecpCount,gCqiRecpPuschCount,gCqiRcvdCount,gRawACqiCount,
2767 gACqiRcvdCount,gCqiReptToAppCount);
2768 printf("\n CQI:: PucchCqiSnrDropCnt/PucchCqiConfBitMaskDropCnt/PuschCqiConfMaskDropCount :: (%ld/%ld/%ld) \n",gCqiPucchLowSnrDropCount,gCqiPucchConfMaskDropCount,gCqiPuschConfMaskDropCount);
2770 printf("\n (F1BCS Count/Cqi/Ri/CqiDrop/PucchDrop/PuschCqiDrop)::(%ld/%ld/%ld/%ld/%ld/%ld)\n",
2771 gF1bCsCount,gCqiReqCount,gRiReqCount,gCqiDropCount,gPucchDropCount,gPuschCqiDropCount);
2773 printf("UL::(DCI0/CrcPass/CrcFail)::(%ld/%ld/%ld)\n"
2774 "gPcellZeroBoOcc:%ld\t gScellZeroBoOcc:%ld dbgUeIdChngAndDatReqInClCnt: %ld\n"
2775 "DelayedDatReqInMac: %ld DelayedDatReqInCl : %ld gIccPktRcvrMemDropCnt :%ld\n",
2781 dbgUeIdChngAndDatReqInClCnt,
2782 dbgDelayedDatReqInMac,
2783 gDropDatReqCnt, gIccPktRcvrMemDropCnt);
2784 //printf ("\n delayedApiCnt:%ld",delayedApiCnt);
2788 rgSCHLaaPrintStats();
2790 gCaDbgNonCaFrmt = gIccPktRcvrMemDropCnt = 0;
2802 gCqiPucchLowSnrDropCount = 0;
2803 gCqiPucchConfMaskDropCount = 0;
2804 gCqiPuschConfMaskDropCount = 0;
2805 gPuschCqiDropCount = 0;
2808 gUlCrcPassCount = 0;
2809 gUlCrcFailCount = 0;
2812 gCqiRecpPuschCount = 0;
2815 gCqiReptToAppCount = 0;
2820 gPrimarySchedCount = 0;
2821 gSCellSchedCount = 0;
2822 gSCellTb1AckCount = 0;
2823 gSCellTb2AckCount = 0;
2824 gSCellTb2AckCount = 0;
2825 gSCellTb2NackCount = 0;
2826 gPCellTb1AckCount = 0;
2827 gPCellTb1NackCount = 0;
2828 gPCellTb2AckCount = 0;
2829 gPCellTb2NackCount = 0;
2830 gSCellTb1NackCount=0;
2832 gPCellTb1DtxCount = 0;
2833 gPCellTb2DtxCount = 0;
2834 gSCellTb1DtxCount = 0;
2835 gSCellTb2DtxCount = 0;
2836 gPcellZeroBoOcc = 0;
2837 gScellZeroBoOcc = 0;
2845 } /* rgSCHTomTtiInd */
2847 /** @brief This function does the TTI processin for the uplink subframe,
2848 * already populated by the scheduler.
2852 * Function: rgSCHTomUtlProcUlSf
2855 * - Loop through the Uplink allocations present in the uplink subframe.
2856 * - For each allocation Fill a data reception request to be sent to PHY
2857 * - Also fills the harq reception requests for the expected HQ feedbacks.
2860 * @param [in] RgSchCellCb *cell
2861 * @param [out] RgSchErrInfo *err
2868 PRIVATE S16 rgSCHTomUtlProcUlSf
2874 PRIVATE S16 rgSCHTomUtlProcUlSf (cell, err)
2880 TfuRecpReqInfo *recpReqInfo;
2882 U16 validIdx = 0; /* Index computed from recreq's timing info*/
2884 Inst inst = cell->instIdx;
2886 TRC2(rgSCHTomUtlProcUlSf)
2888 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&recpReqInfo,
2889 sizeof(TfuRecpReqInfo))) != ROK)
2891 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate TfuRecpReqInfo "
2893 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
2896 recpReqInfo->cellId = cell->cellId;
2897 cmLListInit(&recpReqInfo->ueRecpReqLst);
2899 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, recpReqInfo->timingInfo,
2900 TFU_RECPREQ_DLDELTA);
2902 /* Filling data Reception requests */
2903 ret = rgSCHTomUtlFillDatRecpReq(recpReqInfo, cell,
2908 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to fill Data recption "
2909 "requests for cell");
2910 RGSCH_FREE_MEM(recpReqInfo);
2913 /* Filling HARQ Reception requests */
2914 ret = rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, validIdx,err);
2917 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to fill Harq Feedback "
2918 "reception requests for cell");
2919 RGSCH_FREE_MEM(recpReqInfo);
2922 /* sending the RecpReq to Phy */
2923 if (rgSCHUtlTfuRecpReq(inst, cell->tfuSap->sapCfg.suId, recpReqInfo) != ROK)
2925 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info for cell");
2928 } /* end of rgSCHTomUtlProcUlSf */
2932 /** @brief This function does the TTI processin for the uplink subframe,
2933 * already populated by the scheduler.
2937 * Function: rgSCHTomUtlPrcUlTddSpclSf
2940 * - Fill the SRS Info for the Special Subframe in Reception Req.
2941 * - Send the Reception Req to TFU
2944 * @param [in] RgSchCellCb *cell
2945 * @param [out] RgSchErrInfo *err
2951 PRIVATE S16 rgSCHTomUtlPrcUlTddSpclSf
2957 PRIVATE S16 rgSCHTomUtlPrcUlTddSpclSf (cell, err)
2963 TfuRecpReqInfo *recpReqInfo;
2964 U16 validIdx; /* Index computed from recreq's timing info*/
2965 Inst inst = cell->instIdx;
2967 TRC2(rgSCHTomUtlPrcUlTddSpclSf)
2969 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&recpReqInfo,
2970 sizeof(TfuRecpReqInfo))) != ROK)
2972 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to "
2973 "Allocate TfuRecpReqInfo for cell");
2974 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
2977 recpReqInfo->cellId = cell->cellId;
2978 cmLListInit(&recpReqInfo->ueRecpReqLst);
2980 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, recpReqInfo->timingInfo, TFU_RECPREQ_DLDELTA);
2982 RG_SCH_GET_IDX_PCQISRSSR(recpReqInfo->timingInfo, validIdx);
2985 if(cell->srsCfg.isSrsCfgPres &&
2986 rgSchTddCellSpSrsSubfrmTbl[cell->srsCfg.srsSubFrameCfg][recpReqInfo->timingInfo.slot])
2988 recpReqInfo->srsPres = TRUE;
2992 recpReqInfo->srsPres = FALSE;
2995 /* Filling SRS Reception requests */
2996 ret = rgSCHTomUtlFillSrsRecpReq (recpReqInfo, cell, validIdx, err);
2999 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to fill"
3000 " SRS recption requests for cell");;
3001 RGSCH_FREE_MEM(recpReqInfo);
3004 /* sending the RecpReq to Phy */
3005 if (rgSCHUtlTfuRecpReq(inst, cell->tfuSap->sapCfg.suId, recpReqInfo) != ROK)
3007 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to send "
3008 "Cntrl info for cell");
3011 } /* end of rgSCHTomUtlPrcUlTddSpclSf */
3014 /** @brief This function does all the processing related to a single downlink
3019 * Function: rgSCHTomUtlProcDlSf
3022 * - collate control data for all UEs and send to PHY
3023 * - collate data buffers for all UEs and send to PHY
3025 * @param [in] RgSchDlSf *dlSf
3026 * @param [in] RgSchDlSf *ulSf
3027 * @param [in] RgSchCellCb *cell
3028 * @param [out] RgSchErrInfo *err
3032 PRIVATE S16 rgSCHTomUtlProcDlSf
3037 RgTfuCntrlReqInfo *cntrlInfo,
3041 PRIVATE S16 rgSCHTomUtlProcDlSf (dlSf, ulSf, cell, cntrlInfo, err)
3045 RgTfuCntrlReqInfo *cntrlInfo;
3049 Inst inst = cell->instIdx;
3051 U8 sfTyp = 1; /* Dl Subframe */
3053 TRC2(rgSCHTomUtlProcDlSf);
3055 cmLListInit(&cntrlInfo->phichLst);
3056 cmLListInit(&cntrlInfo->dlPdcchLst);
3057 cmLListInit(&cntrlInfo->ulPdcchLst);
3059 #ifdef TFU_ALLOC_EVENT_NO_INIT
3060 cntrlInfo->ulTiming.sfn = cntrlInfo->ulTiming.subframe = 0;
3062 cntrlInfo->dlTiming = cell->dlDciTime;
3063 cntrlInfo->cellId = cell->cellId;
3064 cntrlInfo->ulTiming = cell->hiDci0Time;
3065 if((0 == (cntrlInfo->dlTiming.sfn % 30)) && (0 == cntrlInfo->dlTiming.slot))
3067 //printf("5GTF_CHECK rgSCHTomUtlProcDlSf Cntrl dl (%d : %d) ul (%d : %d)\n", cntrlInfo->dlTiming.sfn, cntrlInfo->dlTiming.subframe, cntrlInfo->ulTiming.sfn, cntrlInfo->ulTiming.subframe);
3069 /* Fill PCFICH info */
3070 /* Fix for DCFI FLE issue: when DL delta is 1 and UL delta is 0 and CFI
3071 *change happens in that SF then UL PDCCH allocation happens with old CFI
3072 *but CFI in control Req goes updated one since it was stored in the CELL
3074 cntrlInfo->cfi = dlSf->pdcchInfo.currCfi;
3075 #ifndef RG_ULSCHED_AT_CRC
3078 Mval = rgSchTddPhichMValTbl[cell->ulDlCfgIdx]
3079 [cell->hiDci0Time.subframe];
3080 if(dlSf->sfType == RG_SCH_SPL_SF_DATA)
3082 RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, cntrlInfo->cfi);
3087 /* Fill PHICH info */
3088 if ((ret = rgSCHTomUtlFillPhich (cell, cntrlInfo, ulSf, err)) != ROK)
3090 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PHICH info "
3091 "for cellId (%d)\n", cell->cellId));
3092 RGSCH_FREE_MEM(cntrlInfo);
3095 if ((ret = rgSCHTomUtlFillUlPdcch (cell, cntrlInfo, ulSf, err)) !=
3098 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PDCCH info "
3099 "for cellId (%d)\n", cell->cellId));
3100 RGSCH_FREE_MEM(cntrlInfo);
3105 if(0 == cntrlInfo->ulMpdcchLst.count)
3112 sfTyp = rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
3113 [cell->dlDciTime.subframe];
3115 if (sfTyp != 2) /* Uplink subframe */
3117 /* Fill PDCCH info */
3118 if ((ret = rgSCHTomUtlFillDlPdcch(cell,cntrlInfo, dlSf, err)) != ROK)
3120 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PDCCH info "
3121 "for cellId (%d)\n", cell->cellId));
3122 RGSCH_FREE_MEM(cntrlInfo);
3125 rgBwAlloInfo[dlSf->sfNum] += dlSf->bwAssigned;
3126 rgBwAlcnt[dlSf->sfNum] ++;
3129 #ifdef LTEMAC_SPS /* SPS_NEW_CHGS */
3130 cntrlInfo->isSPSOcc = dlSf->isSPSOcc;
3132 cntrlInfo->numDlActvUes += dlSf->numDlActvUes; /* 4UE_TTI_DELTA */
3133 dlSf->numDlActvUes = 0;
3135 if(0 == cntrlInfo->dlMpdcchLst.count)
3140 /* Now always sending down a cntrl req */
3141 /* sending the cntrl data to Phy */
3142 if (rgSCHUtlTfuCntrlReq(inst, cell->tfuSap->sapCfg.suId, cntrlInfo)
3145 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info "
3153 /** @brief This function handles sending of the PHICH information for the
3154 * downlink subframe to be sent in the next TTI.
3161 * - Loop through the PHICH information present in the downlink
3162 * subframe and fill the information in cntrlInfo.
3164 * @param [out] TfuCntrlReqInfo *cntrlInfo
3165 * @param [in] RgSchDlSf *dlSf
3166 * @param [out] RgSchErrInfo *err
3172 PRIVATE S16 rgSCHTomUtlFillPhich
3175 TfuCntrlReqInfo *cntrlInfo,
3180 PRIVATE S16 rgSCHTomUtlFillPhich(cell, cntrlInfo, dlSf, err)
3182 TfuCntrlReqInfo *cntrlInfo;
3190 TfuPhichInfo *harqAck;
3192 RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
3195 TRC2(rgSCHTomUtlFillPhich)
3197 /* Traversing the list of Phichs */
3198 node = dlSf->phichInfo.phichs.first;
3201 phich = (RgSchPhich*)node->node;
3202 if ((ret = rgSCHUtlGetEventMem((Ptr *)&harqAck, sizeof(TfuPhichInfo),
3203 &(cntrlInfo->memCp))) != ROK)
3205 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3208 #ifdef TFU_ALLOC_EVENT_NO_INIT
3209 harqAck->txPower = 0;
3211 /* fill in the tfu structure from the information present in the
3213 harqAck->rbStart = phich->rbStart;
3214 harqAck->nDmrs = phich->nDmrs;
3215 harqAck->isAck = phich->hqFeedBack;
3216 harqAck->isForMsg3 = phich->isForMsg3; /*SR_RACH_STATS : PHICH ACK/NACK for MSG3 */
3218 /* Changes for passing iPhich at TFU interface*/
3219 harqAck->iPhich = phich->iPhich;
3221 /* ccpu00138898 - Added Tx pwr offset for PHICH Tx*/
3223 harqAck->txPower = cellDl->phichTxPwrOffset;
3225 cmLListAdd2Tail(&cntrlInfo->phichLst, &(harqAck->lnk));
3226 harqAck->lnk.node = (PTR)harqAck;
3228 } /* end of while */
3234 /** @brief This function is a utility function to restart
3235 * deactivation timer.
3239 * Function: rgSCHTmrRestartScellDeactTmr
3242 * - Starts timer at scheduler
3244 * @param[in] RgSchCellCb *cell
3245 * @param[in] CmLteRnti rnti
3249 PRIVATE Void rgSCHTmrRestartScellDeactTmr
3255 PRIVATE Void rgSCHTmrRestartScellDeactTmr (cell, ueCb)
3261 RgSchUeCellInfo *sCellInfo = NULLP;
3265 if(RG_SCH_IS_CELL_SEC(ueCb, cell))
3267 sCellInfo = ueCb->cellInfo[(ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)])];
3269 if(sCellInfo->deactTmr.tmrEvnt != TMR_NONE)
3271 rgSCHTmrStopTmr(cell, RG_SCH_TMR_SCELL_DEACT, sCellInfo);
3273 if(PRSNT_NODEF == ueCb->sCellDeactTmrVal.pres)
3276 rgSCHTmrStartTmr(cell,sCellInfo,RG_SCH_TMR_SCELL_DEACT,
3277 ueCb->sCellDeactTmrVal.val);
3282 }/*end of rgSCHTmrRestartScellDeactTmr*/
3285 /** @brief This function will send all the PDCCH's for the given downlink
3293 * - Loop through all the scheduled HARQ processes and fill
3294 * the PDCCH information in cntrlInfo.
3296 * @param [out] TfuCntrlReqInfo *cntrlInfo
3297 * @param [in] RgSchDlSf *dlSf
3298 * @param [out] RgSchErrInfo *err
3303 EXTERN U32 numdlSpsRelSentToTf;
3305 PRIVATE S16 rgSCHTomUtlFillDlPdcch
3308 TfuCntrlReqInfo *cntrlInfo,
3313 PRIVATE S16 rgSCHTomUtlFillDlPdcch(cell,cntrlInfo, dlSf, err)
3315 TfuCntrlReqInfo *cntrlInfo;
3323 TfuPdcchInfo *tfuPdcch;
3324 U8 isDcivld = FALSE;
3327 TRC2(rgSCHTomUtlFillDlPdcch)
3329 /* Traversing the scheduled Harq processes */
3330 node = dlSf->pdcchInfo.pdcchs.first;
3333 pdcch = (RgSchPdcch*)node->node;
3334 switch(pdcch->dci.dciFormat)
3336 case TFU_DCI_FORMAT_3:
3337 isDcivld = (pdcch->dci.u.format3Info.isPucch) ? TRUE : FALSE;
3340 case TFU_DCI_FORMAT_3A:
3341 isDcivld = (pdcch->dci.u.format3AInfo.isPucch) ? TRUE : FALSE;
3354 /*ccpu00117179 - ADD - Build only non DCI format-0 messages */
3355 if((pdcch->dci.dciFormat == TFU_DCI_FORMAT_0) ||
3356 (pdcch->dci.dciFormat == TFU_DCI_FORMAT_A1) ||
3357 (pdcch->dci.dciFormat == TFU_DCI_FORMAT_A2))
3364 #ifdef RGSCH_SPS_STATS
3365 if((pdcch->dci.dciFormat == TFU_DCI_FORMAT_1A) &&
3366 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.mcs == 0x1F) &&
3367 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.type == TFU_ALLOC_TYPE_RIV) &&
3368 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.u.riv == 0xFFFFFFFF))
3370 numdlSpsRelSentToTf++;
3374 if ((ret = rgSCHUtlGetEventMem((Ptr *)&tfuPdcch, sizeof(TfuPdcchInfo),
3375 &(cntrlInfo->memCp))) != ROK)
3377 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3381 tfuPdcch->crnti = pdcch->crnti;
3382 tfuPdcch->isSpsRnti = pdcch->isSpsRnti;
3384 tfuPdcch->rnti = pdcch->rnti;
3387 rgSCHTmrRestartScellDeactTmr(cell,pdcch->ue);
3389 tfuPdcch->dciNumOfBits = pdcch->dciNumOfBits;
3391 tfuPdcch->nCce = pdcch->nCce;
3392 tfuPdcch->aggrLvl = pdcch->aggrLvl;
3393 tfuPdcch->dci = pdcch->dci;
3395 //TODO_SID: Need to check these values during INT
3396 tfuPdcch->sectorId = 0;
3397 tfuPdcch->sccIdx = 0;
3400 /* SR_RACH_STATS : Reset isTBMsg4 */
3401 pdcch->dci.u.format1aInfo.t.pdschInfo.isTBMsg4 = FALSE;
3402 /* To be enhanced later for 2.1 */
3403 cmLListAdd2Tail(&cntrlInfo->dlPdcchLst, &(tfuPdcch->lnk));
3404 tfuPdcch->lnk.node = (PTR)tfuPdcch;
3406 if((pdcch->rnti > 60) && (pdcch->rnti < 5000))
3408 #if defined (TENB_STATS) && defined (RG_5GTF)
3409 cell->tenbStats->sch.dl5gtfPdcchSend++;
3413 } /* end of while */
3415 if((numUePerTti) && (numUePerTti < RG_MAX_NUM_UE_PER_TTI ))
3417 cell->dlNumUeSchedPerTti[numUePerTti-1]++;
3419 gDlNumUePerTti[numUePerTti-1]++;
3423 } /* end of rgSCHTomUtlFillDlPdcch*/
3425 #ifdef RGSCH_SPS_STATS
3426 extern U32 rgSchSpsRelSentToTf;
3427 extern U32 rgSchSpsRelPdcchAllocd;
3429 /** @brief This function will send all the UL PDCCH's for the given
3437 * - Loop through all the scheduled HARQ processes and fill
3438 * the PDCCH information in cntrlInfo.
3440 * @param [out] TfuCntrlReqInfo *cntrlInfo
3441 * @param [in] RgSchDlSf *dlSf
3442 * @param [out] RgSchErrInfo *err
3448 PRIVATE S16 rgSCHTomUtlFillUlPdcch
3451 TfuCntrlReqInfo *cntrlInfo,
3456 PRIVATE S16 rgSCHTomUtlFillUlPdcch(cntrlInfo, dlSf, err)
3458 TfuCntrlReqInfo *cntrlInfo;
3466 TfuPdcchInfo *tfuPdcch;
3467 U8 isDcivld = FALSE;
3469 TRC2(rgSCHTomUtlFillUlPdcch)
3471 /* Traversing the scheduled Harq processes */
3472 node = dlSf->pdcchInfo.pdcchs.first;
3475 pdcch = (RgSchPdcch*)node->node;
3477 /*ccpu00116712- Function should pick only UL allocation related control
3479 switch(pdcch->dci.dciFormat)
3481 case TFU_DCI_FORMAT_A1:
3485 case TFU_DCI_FORMAT_A2:
3489 case TFU_DCI_FORMAT_3:
3490 isDcivld = (pdcch->dci.u.format3Info.isPucch) ? FALSE : TRUE;
3493 case TFU_DCI_FORMAT_3A:
3494 isDcivld = (pdcch->dci.u.format3AInfo.isPucch) ? FALSE : TRUE;
3509 /*ccpu00116712- Function should pick only UL allocation related control
3511 if ((ret = rgSCHUtlGetEventMem((Ptr *)&tfuPdcch, sizeof(TfuPdcchInfo),
3512 &(cntrlInfo->memCp))) != ROK)
3514 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3517 tfuPdcch->rnti = pdcch->rnti;
3519 rgSCHTmrRestartScellDeactTmr(cell,pdcch->ue);
3521 tfuPdcch->dciNumOfBits = pdcch->dciNumOfBits;
3523 tfuPdcch->nCce = pdcch->nCce;
3524 tfuPdcch->aggrLvl = pdcch->aggrLvl;
3525 tfuPdcch->dci = pdcch->dci;
3527 //TODO_SID: Need to check these values during INT
3528 tfuPdcch->sectorId = 0;
3529 tfuPdcch->sccIdx = 0;
3532 /* To be enhanced later for 2.1 */
3534 #if defined (TENB_STATS) && defined (RG_5GTF)
3535 cell->tenbStats->sch.ul5gtfPdcchSend++;
3537 cmLListAdd2Tail(&cntrlInfo->ulPdcchLst, &(tfuPdcch->lnk));
3538 tfuPdcch->lnk.node = (PTR)tfuPdcch;
3539 } /* end of while */
3541 #ifdef RGSCH_SPS_STATS
3542 if (rgSchSpsRelSentToTf != rgSchSpsRelPdcchAllocd)
3548 } /* end of rgSCHTomUtlFillUlPdcch*/
3550 /** @brief This function does the processing for Timing adjustment.
3557 * - Loop through the ue present ueTimeLst, decrement the remaining
3561 * @param [in] RgSchCellCb *cell
3567 PRIVATE S16 rgSCHTomUtlProcTA
3572 PRIVATE S16 rgSCHTomUtlProcTA (cell)
3579 TRC2(rgSCHTomUtlProcTA);
3581 node = cell->taUeLst.first;
3584 ue = (RgSchUeCb *)node->node;
3586 if (ue->dl.taCb.numRemSf == 0)
3588 ue->dl.taCb.state = RGSCH_TA_IDLE;
3589 /* If Outstanding Ta is present, schedule it */
3590 if(ue->dl.taCb.outStndngTa == TRUE)
3592 rgSCHUtlReTxTa(cell, ue);
3596 /* We need to reset state and also value of TA,
3597 * then we start the timer */
3598 ue->dl.taCb.ta = RGSCH_NO_TA_RQD;
3599 /* Start the timer only if TA is cfgd as FINITE value */
3600 if (ue->dl.taCb.cfgTaTmr)
3602 rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_TA, ue->dl.taCb.cfgTaTmr);
3605 /* need to delete from the link list */
3606 cmLListDelFrm(&(cell->taUeLst), &(ue->taLnk));
3607 ue->taLnk.node = NULLP;
3611 ue->dl.taCb.numRemSf--;
3613 } /* end of taUeLst */
3616 } /* end of rgSCHTomUtlProcTA */
3618 /** @brief This function handles filling of Hq reception request to
3633 PUBLIC S16 rgSCHTomUtlFillHqFdbkInfo
3635 TfuRecpReqInfo *recpReqInfo,
3638 RgSchDlHqProcCb *hqCb,
3640 TfuUeRecpReqInfo *pucchRecpInfo,
3641 RgSchDlHqProcCb *prvHqCb,
3645 PUBLIC S16 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, validIdx, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err)
3646 TfuRecpReqInfo *recpReqInfo;
3649 RgSchDlHqProcCb *hqCb;
3651 TfuUeRecpReqInfo *pucchRecpInfo;
3652 RgSchDlHqProcCb *prvHqCb;
3657 PUBLIC S16 rgSCHTomUtlFillHqFdbkInfo
3659 TfuRecpReqInfo *recpReqInfo,
3661 RgSchDlHqProcCb *hqCb,
3663 TfuUeRecpReqInfo *pucchRecpInfo,
3664 RgSchDlHqProcCb *prvHqCb,
3668 PUBLIC S16 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err)
3669 TfuRecpReqInfo *recpReqInfo;
3671 RgSchDlHqProcCb *hqCb;
3673 TfuUeRecpReqInfo *pucchRecpInfo;
3674 RgSchDlHqProcCb *prvHqCb;
3680 RgSchDlHqTbCb *tbCb;
3682 Bool isAddToLst = FALSE;
3684 for (idx = 0 ;idx < 2; idx++)
3686 if (HQ_TB_WAITING == hqCb->tbInfo[idx].state)
3688 tbCb = &hqCb->tbInfo[idx];
3690 /* FOR ACK NAK REP */
3691 if ((hqCb->hqE->ue != NULLP) &&
3692 (hqCb->hqE->ue->measGapCb.isMeasuring == TRUE))
3694 if ((tbCb->fbkRecpRepCntr) &&
3695 (--tbCb->fbkRecpRepCntr))
3697 /* Add to next subfarme */
3698 /* Add this hqCb to the next dlSf's ackNakRepQ */
3699 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
3700 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
3701 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
3702 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
3705 rgSCHTomUtlMoveNxtOccasion(cell, hqCb->hqE->ue, validIdx);
3713 /* Go to the next node */
3719 //if (hqCb != prvHqCb)
3721 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
3722 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
3725 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
3726 "TfuUeRecpReqInfo for cell");
3727 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3730 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
3731 if ((hqCb->hqE->ue != NULLP) /*&&
3732 ((tbCb->lchSchdData[0].lcId != 0) || (tbCb->taSnt ==
3736 pucchRecpInfo->rnti = hqCb->hqE->ue->ueId;
3740 if (hqCb->hqE->raCb)
3742 pucchRecpInfo->rnti = hqCb->hqE->raCb->tmpCrnti;
3748 if (!hqCb->spsN1PucchRes.pres)
3751 pucchRecpInfo->t.pucchRecpReq.hqType =
3752 TFU_HQ_RECP_REQ_NORMAL;
3753 pucchRecpInfo->t.pucchRecpReq.t.nCce =
3759 pucchRecpInfo->t.pucchRecpReq.hqType =
3760 TFU_HQ_RECP_REQ_N1PUCCH;
3761 pucchRecpInfo->t.pucchRecpReq.t.n1Pucch =
3762 hqCb->spsN1PucchRes.val;
3766 /* Handling of other types */
3767 pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
3768 #else /* TFU_UPGRADE */
3769 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
3770 if ((hqCb->tbInfo[0].state == HQ_TB_WAITING) &&
3771 (hqCb->tbInfo[1].state == HQ_TB_WAITING))
3773 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz = 2; /* MIMO */
3777 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz = 1; /* NON-MIMO */
3781 /* PucchRecpReq needs to be filled up for n1Pucch resource for SPS
3783 if (hqCb->spsN1PucchRes.pres)
3785 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
3788 #endif /* LTEMAC_SPS */
3790 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
3791 cell->pucchCfg.n1PucchAn);
3794 rgSCHEmtcFillPucchRecpInfo(cell, hqCb, &(pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0]));
3797 #endif/*TFU_UPGRADE*/
3800 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, hqCb->hqE->ue,
3801 pucchRecpInfo, validIdx,FALSE);
3804 /* Passing last parameter as FALSE in this case as it will be verified from hqCb*/
3805 isAddToLst = rgSCHEmtcAddRecpInfoToLst(hqCb,recpReqInfo, pucchRecpInfo,FALSE);
3809 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
3811 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
3814 if ((tbCb->fbkRecpRepCntr) &&
3815 (--tbCb->fbkRecpRepCntr))
3817 /* Add to next subfarme */
3818 /* Add this hqCb to the next dlSf's ackNakRepQ */
3819 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
3820 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
3821 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
3822 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
3828 }/* end of rgSCHTomUtlFillHqFdbkInfo */
3831 /** @brief This function handles filling of Hq reception request to
3836 * Function:rgSCHTomUtlFillHqFdbkFor5gtf
3840 * @param [out] TfuRecpReqInfo *recpReqInfo
3841 * @param [in] RgSchCellCb *cell
3842 * @param [in] U16 validIdx,
3843 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
3844 * @param [in] RgSchDlSf *dlSf,
3845 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
3846 * @param [out] RgSchErrInfo *err
3853 PRIVATE S16 rgSCHTomUtlFillHqFdbkFor5gtf
3855 TfuRecpReqInfo *recpReqInfo,
3858 RgSchDlHqInfo *dlSfHqInfo,
3860 TfuUeRecpReqInfo *pucchRecpInfo,
3864 PRIVATE S16 rgSCHTomUtlFillHqFdbkFor5gtf (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err)
3865 TfuRecpReqInfo *recpReqInfo;
3868 RgSchDlHqInfo *dlSfHqInfo;
3870 TfuUeRecpReqInfo *pucchRecpInfo;
3875 Inst inst = cell->instIdx;
3880 TfuUePucchRecpReq *pucchReqInfo = NULLP;
3882 hqPNode = dlSfHqInfo->hqPLst.first;
3883 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
3889 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
3890 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
3893 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate "
3894 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId));
3895 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3898 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
3899 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
3900 * instead of SPS-CRNTI */
3902 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
3904 pucchReqInfo->uciInfo = TFU_XPUCCH_UCI_INFO;
3906 /* 5gtf TODO : Hardcoded nPUCCHIdx */
3907 pucchReqInfo->uciPduInfo.pucchIndex = 0;
3909 pucchReqInfo->uciPduInfo.numBits = 1;
3911 /* 5gtf TODO : CQI Periodicity Hardcoded to (n,0)*/
3912 if (RGSCH_TIMEINFO_SAME (recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn))
3914 pucchReqInfo->uciPduInfo.numBits += 5;
3915 RG_SCH_ADD_TO_CRNT_TIME(recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn,
3916 ue->ue5gtfCb.cqiRiPer);
3919 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
3920 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
3922 }/* end of rgSCHTomUtlFillHqFdbkForFrmt1B */
3926 /** @brief This function handles filling of Hq reception request to
3931 * Function:rgSCHTomUtlFillHqFdbkForFrmt1B
3934 * Allocates the N1Pucch Resources based on teh A Value
3936 * @param [out] TfuRecpReqInfo *recpReqInfo
3937 * @param [in] RgSchCellCb *cell
3938 * @param [in] U16 validIdx,
3939 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
3940 * @param [in] RgSchDlSf *dlSf,
3941 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
3942 * @param [out] RgSchErrInfo *err
3950 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B
3952 TfuRecpReqInfo *recpReqInfo,
3955 RgSchDlHqInfo *dlSfHqInfo,
3957 TfuUeRecpReqInfo *pucchRecpInfo,
3961 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err)
3962 TfuRecpReqInfo *recpReqInfo;
3965 RgSchDlHqInfo *dlSfHqInfo;
3967 TfuUeRecpReqInfo *pucchRecpInfo;
3972 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B
3974 TfuRecpReqInfo *recpReqInfo,
3976 RgSchDlHqInfo *dlSfHqInfo,
3978 TfuUeRecpReqInfo *pucchRecpInfo,
3982 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B (recpReqInfo, cell, hqCb, dlSf, pucchRecpInfo, err)
3983 TfuRecpReqInfo *recpReqInfo;
3985 RgSchDlHqInfo *dlSfHqInfo;
3987 TfuUeRecpReqInfo *pucchRecpInfo;
3993 Inst inst = cell->instIdx;
3997 RgSchDlHqProcCb *hqCb = NULLP;
3999 TfuUePucchRecpReq *pucchReqInfo = NULLP;
4000 Bool isDatPresOnSecCell = FALSE;
4001 U8 primCellTbCount = 0;
4003 hqPNode = dlSfHqInfo->hqPLst.first;
4004 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
4010 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4011 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
4014 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate "
4015 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId));
4016 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4019 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4020 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
4021 * instead of SPS-CRNTI */
4023 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
4026 pucchReqInfo->hqType = TFU_HQ_RECP_REQ_NORMAL;
4027 /* Handling of other types */
4028 pucchReqInfo->type = TFU_UCI_HARQ;
4029 #else /* TFU_UPGRADE */
4030 pucchReqInfo->uciInfo = TFU_PUCCH_HARQ;
4031 /* Fill hqFdbkMode by using uciFrmtTyp from dlSfHqInfo */
4032 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
4033 /* Fill HqSz by using totalTbCnt based on the TM mode and
4034 * the number of serv cells configured*/
4036 pucchReqInfo->hqInfo.hqSz = ue->f1bCsAVal;
4037 pucchReqInfo->hqInfo.pucchResCnt = ue->f1bCsAVal;
4039 cmMemset((U8 *)pucchReqInfo->hqInfo.hqRes,0xff,sizeof(U16)*TFU_MAX_HQ_RES);
4041 /* Two Resources needs to be configured if the
4042 * serving cell is in mimo mode else single
4044 if ((dlSf->relPdcch != NULLP) &&
4045 (RGSCH_TIMEINFO_SAME(recpReqInfo->timingInfo, ue->relPdcchFbkTiming)))
4046 {/* Pcell is having sps rel pdcch present */
4047 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
4048 {/* prim cell is in mimo mode, use 0 and 1 */
4049 pucchReqInfo->hqInfo.hqRes[0] = (dlSf->relPdcch->nCce +
4050 cell->pucchCfg.n1PucchAn);
4051 pucchReqInfo->hqInfo.hqRes[1] = pucchReqInfo->hqInfo.hqRes[0] + 1;
4056 pucchReqInfo->hqInfo.hqRes[2] = (dlSf->relPdcch->nCce +
4057 cell->pucchCfg.n1PucchAn);
4059 /* Release the pdcch so that it will not further processed */
4060 rgSCHUtlPdcchPut(ue->cell,&dlSf->pdcchInfo, dlSf->relPdcch);
4061 dlSf->relPdcch = NULLP;/* only one UE will be scheduled for release pdcch order in one tti */
4063 #endif/*LTEMAC_SPS*/
4064 #endif/*TFU_UPGRADE*/
4067 hqCb = (RgSchDlHqProcCb *)hqPNode->node;
4068 hqPNode = hqPNode->next;
4069 /* In case of CSI + 1BCS , CSI will be
4070 * dropped if scheduling is present on
4071 * seconday cell.36.213 10.1.1
4073 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4075 isDatPresOnSecCell = TRUE;
4078 if ((hqCb->tbInfo[0].state == HQ_TB_WAITING) &&
4079 (hqCb->tbInfo[1].state == HQ_TB_WAITING))
4081 primCellTbCount = 2;
4084 primCellTbCount = 1;
4088 pucchReqInfo->t.nCce = hqCb->pdcch->nCce;
4091 switch(ue->f1bCsAVal)
4093 case RG_SCH_A_VAL_2:
4094 /* harq(0) is primary harq(1) is secondary) */
4095 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4097 pucchReqInfo->hqInfo.hqRes[1] = ue->n1PucchF1bResCb.\
4098 cw1N1Res[hqCb->tpc].n1PucchIdx;
4100 else/* primary cell */
4103 /* Need to consider only sps occasions */
4104 if (hqCb->spsN1PucchRes.pres)
4106 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
4109 #endif /* LTEMAC_SPS */
4112 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
4113 cell->pucchCfg.n1PucchAn);
4117 case RG_SCH_A_VAL_3:
4118 /* Serving cell in mimo mode should be
4119 * in 0 and 1 and the serving cell in siso
4120 * mode should be in 2 indices */
4121 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4123 U8 cellIdx = ue->cellIdToCellIdxMap[RG_SCH_CELLINDEX(hqCb->hqE->cell)];
4124 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[cellIdx]->txMode.txModeEnum) > 1)
4125 {/* Sec cell is in mimo mode, use 0 and 1 */
4126 pucchReqInfo->hqInfo.hqRes[0] =
4127 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
4129 pucchReqInfo->hqInfo.hqRes[1] =
4130 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
4133 {/* Sec cell is in siso mode, use 2 */
4134 pucchReqInfo->hqInfo.hqRes[2] =
4135 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
4139 {/* primary cell hq */
4140 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
4141 {/* prim cell is in mimo mode, use 0 and 1 */
4143 if (hqCb->spsN1PucchRes.pres)
4144 {/* SPS occasions */
4145 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
4146 pucchReqInfo->hqInfo.hqRes[1] = hqCb->spsN1PucchRes.val + 1;
4149 #endif /* LTEMAC_SPS */
4151 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
4152 cell->pucchCfg.n1PucchAn);
4153 pucchReqInfo->hqInfo.hqRes[1] = (hqCb->pdcch->nCce +
4154 cell->pucchCfg.n1PucchAn + 1);
4158 {/* prim cell is in siso mode use 2 */
4160 /* Need to consider only sps occasions */
4161 if (hqCb->spsN1PucchRes.pres)
4163 pucchReqInfo->hqInfo.hqRes[2] = hqCb->spsN1PucchRes.val;
4166 #endif /* LTEMAC_SPS */
4169 pucchReqInfo->hqInfo.hqRes[2] = (hqCb->pdcch->nCce +
4170 cell->pucchCfg.n1PucchAn);
4176 case RG_SCH_A_VAL_4:
4178 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4179 {/* 2 and 3 for sec cell */
4180 pucchReqInfo->hqInfo.hqRes[2] =
4181 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
4182 pucchReqInfo->hqInfo.hqRes[3] =
4183 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
4185 else/* primary cell */
4186 {/* 0 and 1 are for primary cell */
4188 /* Need to consider only sps occasions */
4189 if (hqCb->spsN1PucchRes.pres)
4191 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
4192 pucchReqInfo->hqInfo.hqRes[1] = hqCb->spsN1PucchRes.val + 1;
4195 #endif /* LTEMAC_SPS */
4198 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
4199 cell->pucchCfg.n1PucchAn);
4200 pucchReqInfo->hqInfo.hqRes[1] = (hqCb->pdcch->nCce +
4201 cell->pucchCfg.n1PucchAn + 1);
4208 /* TOD:: Add error print */
4212 #endif/*TFU_UPGRADE*/
4223 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, ue,
4224 pucchRecpInfo, validIdx,isDatPresOnSecCell);
4226 /* Channel selection wil not be used in case of
4227 * CQI + HARQ. if the data was present only on
4229 if((isDatPresOnSecCell == FALSE) &&
4230 (dlSfHqInfo->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS))
4231 {/* Data is present only on primary cell */
4233 switch(pucchReqInfo->uciInfo)
4235 case TFU_PUCCH_HARQ_SRS:
4236 case TFU_PUCCH_HARQ_CQI:
4237 case TFU_PUCCH_HARQ_SR_SRS:
4238 case TFU_PUCCH_HARQ_SR_CQI:
4240 dlSfHqInfo->uciFrmtTyp = RG_SCH_UCI_FORMAT1A_1B;
4241 pucchReqInfo->hqInfo.hqSz = primCellTbCount;
4242 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
4251 #endif/*TFU_UPGRADE*/
4252 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4253 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4255 }/* end of rgSCHTomUtlFillHqFdbkForFrmt1B */
4256 /** @brief This function handles filling of Hq reception request to
4261 * Function:rgSCHTomUtlFillHqFdbkForFrmt3
4264 * Allocates the N1Pucch Resources based on teh A Value
4266 * @param [out] TfuRecpReqInfo *recpReqInfo
4267 * @param [in] RgSchCellCb *cell
4268 * @param [in] U16 validIdx,
4269 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
4270 * @param [in] RgSchDlSf *dlSf,
4271 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
4272 * @param [out] RgSchErrInfo *err
4280 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3
4282 TfuRecpReqInfo *recpReqInfo,
4285 RgSchDlHqInfo *dlSfHqInfo,
4287 TfuUeRecpReqInfo *pucchRecpInfo,
4291 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3 (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err)
4292 TfuRecpReqInfo *recpReqInfo;
4295 RgSchDlHqInfo *dlSfHqInfo;
4297 TfuUeRecpReqInfo *pucchRecpInfo;
4302 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3
4304 TfuRecpReqInfo *recpReqInfo,
4306 RgSchDlHqInfo *dlSfHqInfo,
4308 TfuUeRecpReqInfo *pucchRecpInfo,
4312 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3 (recpReqInfo, cell, hqCb, dlSf, pucchRecpInfo, err)
4313 TfuRecpReqInfo *recpReqInfo;
4315 RgSchDlHqInfo *dlSfHqInfo;
4317 TfuUeRecpReqInfo *pucchRecpInfo;
4323 Inst inst = cell->instIdx;
4328 TfuUePucchRecpReq *pucchReqInfo = NULLP;
4330 //hqPNode = dlSfHqInfo->hqPLst.first;
4331 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
4337 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4338 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
4341 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate "
4342 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId));
4343 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4346 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4347 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
4348 * instead of SPS-CRNTI */
4350 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
4353 pucchReqInfo->hqType = TFU_HQ_RECP_REQ_NORMAL;
4354 /* Handling of other types */
4355 pucchReqInfo->type = TFU_UCI_HARQ;
4356 #else /* TFU_UPGRADE */
4357 pucchReqInfo->uciInfo = TFU_PUCCH_HARQ;
4358 /* Fill hqFdbkMode by using uciFrmtTyp from dlSfHqInfo */
4359 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
4360 /* Fill HqSz by using totalTbCnt based on the TM mode and
4361 * the number of serv cells configured*/
4363 pucchReqInfo->hqInfo.hqSz = ue->f1bCsAVal;
4364 pucchReqInfo->hqInfo.pucchResCnt = 1;
4366 cmMemset((U8 *)pucchReqInfo->hqInfo.hqRes,0xff,sizeof(U16)*TFU_MAX_HQ_RES);
4367 #endif/*TFU_UPGRADE*/
4368 pucchReqInfo->hqInfo.hqRes[0] = dlSfHqInfo->n3ScellPucch.n3PucchIdx;
4370 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, ue,
4371 pucchRecpInfo, validIdx,TRUE);
4372 #endif/*TFU_UPGRADE*/
4373 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4374 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4376 }/* end of rgSCHTomUtlFillHqFdbkForFrmt3 */
4380 /** @brief This function handles filling of HARQ feedback recption request to
4389 * @param [out] TfuRecpReqInfo *recpReqInfo
4390 * @param [in] RgSchCellCb *cell
4391 * @param [out] RgSchErrInfo *err
4398 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq
4400 TfuRecpReqInfo *recpReqInfo,
4406 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, validIdx, err)
4407 TfuRecpReqInfo *recpReqInfo;
4414 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq
4416 TfuRecpReqInfo *recpReqInfo,
4421 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, err)
4422 TfuRecpReqInfo *recpReqInfo;
4429 RgSchDlHqProcCb *hqCb;
4430 CmLteTimingInfo futTime;
4433 TfuUeRecpReqInfo *pucchRecpInfo = NULLP;
4435 RgSchDlHqProcCb *prvHqCb=NULLP;
4437 TRC2(rgSCHTomUtlFillHqFdbkRecpReq);
4444 /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper output
4445 * if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME() as it is
4446 * serving the purpose */
4447 RGSCHDECRFRMCRNTTIME(cell->crntTime, futTime, (RG_SCH_CMN_HARQ_INTERVAL -
4448 TFU_RECPREQ_DLDELTA));
4449 dlSf = rgSCHUtlSubFrmGet (cell, futTime);
4450 /* Get the next dlsf as well */
4451 RG_SCH_ADD_TO_CRNT_TIME(futTime, futTime, 1)
4452 nxtDlsf = rgSCHUtlSubFrmGet (cell, futTime);
4456 if (dlSf->ueLst.count != 0)
4458 node = dlSf->ueLst.first;
4461 ue = (RgSchUeCb *)(node->node);
4464 if(ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx].isPuschHarqRecpPres == TRUE)
4465 {/* This UE is already considered for PUSCH
4469 rgSCHTomUtlFillHqFdbkFor5gtf(recpReqInfo, cell, validIdx,
4470 &ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx], dlSf, pucchRecpInfo, err);
4471 } /* end of while */
4472 } /* If hq is expected */
4474 if (dlSf->msg4HqPLst.count != 0)
4477 node = dlSf->msg4HqPLst.first;
4480 hqCb = (RgSchDlHqProcCb*)(node->node);
4482 //TODO_SID: need to check validIdx
4483 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, validIdx, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err);
4485 } /* end of while */
4488 /* Check with TDD Code */
4489 /* FOR ACK NACK REP */
4491 } /* end of rgSCHTomUtlFillHqFdbkRecpReq */
4493 /** @brief This function handles filling of SR reception request to
4502 * @param [out] TfuRecpReqInfo *recpReqInfo
4503 * @param [in] RgSchCellCb *cell
4504 * @param [out] RgSchErrInfo *err
4511 PRIVATE S16 rgSCHTomUtlFillSrRecpReq
4513 TfuRecpReqInfo *recpReqInfo,
4519 PRIVATE S16 rgSCHTomUtlFillSrRecpReq (recpReqInfo, cell, validIdx, err)
4520 TfuRecpReqInfo *recpReqInfo;
4527 TfuUeRecpReqInfo *pucchRecpInfo;
4533 RgSchCmnUlUeSpsInfo *ulSpsUe = NULL;
4537 TRC2(rgSCHTomUtlFillSrRecpReq);
4541 node = cell->pCqiSrsSrLst[validIdx].srLst.first;
4544 ue = (RgSchUeCb *)(node->node);
4545 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4551 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4552 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4554 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4555 "TfuUeRecpReqInfo for cell RNTI:%d",ue->ueId);
4556 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4559 #ifdef TFU_ALLOC_EVENT_NO_INIT
4560 cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4561 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4567 /* Should we check for Rel8 and above???
4568 * Dont send SR recp req if logicalChannelSR-Mask enabled and UL SPS is
4570 ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue, cell);
4571 /* Avoiding check for ulSpsEnabled as isUlSpsActv FALSE if sps is not enabled*/
4572 if((ue->ul.ulSpsCfg.isLcSRMaskEnab) &&
4573 (ulSpsUe->isUlSpsActv))
4575 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
4580 pucchRecpInfo->rnti = ue->ueId;
4581 pucchRecpInfo->t.pucchRecpReq.srInfo.n1PucchIdx =
4582 ue->srCb.srCfg.srSetup.srResIdx;
4583 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR;
4584 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
4585 rgSCHTomUtlFillCqiSrsWithSr(cell, ue, recpReqInfo,
4586 pucchRecpInfo, validIdx);
4588 isAddToLst = rgSCHEmtcAddRecpInfoToLst(NULLP,recpReqInfo, pucchRecpInfo,ue->isEmtcUe);
4592 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4594 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4597 }/* end of rgSCHTomUtlFillSrRecpReq */
4600 /** @brief This function tells will the UE has a periodic CQI/PMI/RI
4609 * @param [in] RgSchUeCb *ue
4610 * @param [out] Bool *willueRprtCqiRi
4617 PRIVATE S16 rgSCHTomUtlWillUeRprtCqiRi
4620 Bool *willueRprtCqiRi
4623 PRIVATE S16 rgSCHTomUtlWillUeRprtCqiRi ( ue, willueRprtCqiRi)
4625 Bool *willueRprtCqiRi;
4628 TRC2(rgSCHTomUtlWillUeRprtCqiRi);
4630 /* Intialising Reporting probability as TRUE */
4631 *willueRprtCqiRi = TRUE;
4633 /* Checking the cases in which UE will not report CQIPMI/RI */
4634 if(ue->isDrxEnabled && ue->drxCb)
4637 if(ue->drxCb->cqiMask.pres && ue->drxCb->cqiMask.val == RGR_DRX_SETUP)
4638 {/*cqiMask is setup by upper layers */
4639 if((ue->drxCb->drxUlInactvMask & RG_SCH_DRX_ONDUR_BITMASK) ==
4640 RG_SCH_DRX_ONDUR_BITMASK)
4641 {/*onDuration NOT running, do not expect cqi/pmi/ri*/
4642 *willueRprtCqiRi = FALSE;
4646 #endif /*end of LTEMAC_R9*/
4647 /* ccpu00134258: Fix for CQI DRX issue*/
4648 if(ue->drxCb->onDurTmrLen > 2)
4650 if ( !RG_SCH_DRX_UL_IS_UE_ACTIVE(ue->drxCb) )
4651 {/*UE is not active, do not expect cqi/pmi/ri*/
4652 *willueRprtCqiRi = FALSE;
4655 }/*ue->isDrxEnabled*/
4658 } /*End of rgSCHTomUtlWillUeRprtCqiRi*/
4660 /** @brief This function handles filling of RI reception request to
4669 * @param [out] TfuRecpReqInfo *recpReqInfo
4670 * @param [in] RgSchCellCb *cell
4671 * @param [in] U16 validIdx
4672 * @param [out] RgSchErrInfo *err
4679 PRIVATE S16 rgSCHTomUtlFillRiRecpReq
4681 TfuRecpReqInfo *recpReqInfo,
4687 PRIVATE S16 rgSCHTomUtlFillRiRecpReq (recpReqInfo, cell, validIdx, err)
4688 TfuRecpReqInfo *recpReqInfo;
4695 TfuUeRecpReqInfo *pucchRecpInfo;
4698 Bool willUeRprtCqi; /* Flag set due to CQI Mask
4699 and UE inactive state (DRX) */
4700 RgSchUePCqiCb *riCb = NULLP;
4701 TRC2(rgSCHTomUtlFillRiRecpReq);
4703 node = cell->pCqiSrsSrLst[validIdx].riLst.first;
4706 riCb = (RgSchUePCqiCb *)(node->node);
4707 ue = riCb->servCellInfo->ue;
4708 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4710 if(riCb->riRecpPrcsd)
4712 /*ccpu00140578:: RI Proecssing is already done for this TTI
4713 * as part of PUSCH reception process or HARQ
4714 * Reception processing. Hence skipping this UE
4716 riCb->riRecpPrcsd = FALSE;
4719 if(riCb->riDist ==0)
4721 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
4722 #ifdef XEON_SPECIFIC_CHANGES
4723 if(RGSCH_TIMEINFO_SAME(cell->crntTime, ue->riRecpTime))
4729 if((TRUE == riCb->isRiIgnoByCollsn)
4730 || (willUeRprtCqi == FALSE))
4732 if(willUeRprtCqi == FALSE)
4735 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
4738 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4739 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4741 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4742 "TfuUeRecpReqInfo for cell RNTI:%d",ue->ueId);
4743 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4746 #ifdef TFU_ALLOC_EVENT_NO_INIT
4747 cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4748 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4751 pucchRecpInfo->rnti = ue->ueId;
4752 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
4753 riCb->cqiCfg.cqiSetup.cqiPResIdx;
4754 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = riCb->riNumBits;
4755 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_CQI;
4756 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
4758 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
4759 riCb->servCellInfo->sCellIdx;
4761 rgSCHTomUtlFillRiBitWidthInfo(ue);
4762 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
4763 if (ue->nPCqiCb->nCqiTrIdx == validIdx)
4765 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, ue->nPCqiCb);
4767 if((ue->srsCb.nSrsTrIdx == validIdx) && (ue->srsCb.srsDist ==0))
4769 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
4771 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4772 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4780 }/* end of rgSCHTomUtlFillRiRecpReq */
4783 /** @brief This function handles filling of 5GTF CQI-RI reception request to
4792 * @param [out] TfuRecpReqInfo *recpReqInfo
4793 * @param [in] RgSchCellCb *cell
4794 * @param [in] U16 validIdx
4795 * @param [out] RgSchErrInfo *err
4803 PRIVATE S16 rgSCHTomUtlFillCqiRiRecpReq
4805 TfuRecpReqInfo *recpReqInfo,
4811 PRIVATE S16 rgSCHTomUtlFillCqiRiRecpReq (recpReqInfo, cell, validIdx, err)
4812 TfuRecpReqInfo *recpReqInfo;
4818 TfuUeRecpReqInfo *pucchRecpInfo;
4819 RgSchUeCb *ue = NULLP;
4822 TRC2(rgSCHTomUtlFillCqiRiRecpReq);
4824 while ((ue = rgSCHDbmGetNextUeCb(cell, ue)) != NULLP)
4826 if (RGSCH_TIMEINFO_SAME (recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn))
4828 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4829 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4831 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4832 "TfuUeRecpReqInfo for cell RNTI:%d ", ue->ueId);
4833 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4836 #ifdef TFU_ALLOC_EVENT_NO_INIT
4837 cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4838 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4840 pucchRecpInfo->rnti = ue->ueId;
4841 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_XPUCCH_UCI_INFO;
4842 pucchRecpInfo->t.pucchRecpReq.uciPduInfo.pucchIndex = 0;
4843 pucchRecpInfo->t.pucchRecpReq.uciPduInfo.numBits = 5;
4845 RG_SCH_ADD_TO_CRNT_TIME(recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn,
4846 ue->ue5gtfCb.cqiRiPer);
4847 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4848 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4853 }/* end of rgSCHTomUtlFillCqiRiRecpReq */
4856 /** @brief This function handles filling of PCQI reception request to
4865 * @param [out] TfuRecpReqInfo *recpReqInfo
4866 * @param [in] RgSchCellCb *cell
4867 * @param [in] U16 validIdx
4868 * @param [out] RgSchErrInfo *err
4875 PRIVATE S16 rgSCHTomUtlFillPcqiRecpReq
4877 TfuRecpReqInfo *recpReqInfo,
4883 PRIVATE S16 rgSCHTomUtlFillPcqiRecpReq (recpReqInfo, cell, validIdx, err)
4884 TfuRecpReqInfo *recpReqInfo;
4891 TfuUeRecpReqInfo *pucchRecpInfo;
4896 Bool willUeRprtCqi; /* Flag set due to CQI Mask
4897 and UE Inactive state (DRX)*/
4899 RgSchUePCqiCb *cqiCb = NULLP;
4900 Bool isAddToLst = FALSE;
4902 TRC2(rgSCHTomUtlFillPcqiRecpReq);
4904 node = cell->pCqiSrsSrLst[validIdx].cqiLst.first;
4907 cqiCb = (RgSchUePCqiCb*)(node->node);
4908 ue = cqiCb->servCellInfo->ue;
4909 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4911 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
4913 if ((cqiCb->isCqiIgnoByCollsn == TRUE) ||
4914 (willUeRprtCqi == FALSE))
4916 if(willUeRprtCqi == FALSE)
4919 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
4923 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
4925 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
4926 cqiCb->servCellInfo->sCellIdx;
4928 cqiPmiSz = rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
4931 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to Fill CqiPmi "
4936 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4937 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4939 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4940 "TfuUeRecpReqInfo for cell RNTI:%d ", ue->ueId);
4941 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4944 #ifdef TFU_ALLOC_EVENT_NO_INIT
4945 cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4946 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4949 /*Fill PCQI params*/
4950 pucchRecpInfo->rnti = ue->ueId;
4951 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
4952 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
4953 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = cqiPmiSz;
4954 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_CQI;
4955 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
4956 if((ue->srsCb.nSrsTrIdx == validIdx) && (ue->srsCb.srsDist ==0))
4958 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
4961 isAddToLst = rgSCHEmtcAddRecpInfoToLst(NULLP,recpReqInfo, pucchRecpInfo,ue->isEmtcUe);
4965 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4967 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4970 }/* end of rgSCHTomUtlFillPcqiRecpReq */
4971 /** @brief This function handles filling of SRS reception request to
4980 * @param [out] TfuRecpReqInfo *recpReqInfo
4981 * @param [in] RgSchCellCb *cell
4982 * @param [in] U16 validIdx
4983 * @param [out] RgSchErrInfo *err
4989 PRIVATE S16 rgSCHTomUtlFillSrsRecpReq
4991 TfuRecpReqInfo *recpReqInfo,
4997 PRIVATE S16 rgSCHTomUtlFillSrsRecpReq (recpReqInfo, cell, validIdx, err)
4998 TfuRecpReqInfo *recpReqInfo;
5005 TfuUeRecpReqInfo *pucchRecpInfo;
5009 TRC2(rgSCHTomUtlFillSrsRecpReq);
5011 node = cell->pCqiSrsSrLst[validIdx].srsLst.first;
5014 ue = (RgSchUeCb *)(node->node);
5015 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
5017 if(ue->srsCb.srsRecpPrcsd)
5019 /* ccpu00140578::SRS Proecssing is already done for this TTI
5020 * as part of PUSCH or HARQ reception process and
5021 * hence skipping this UE */
5022 ue->srsCb.srsRecpPrcsd = FALSE;
5026 if(ue->srsCb.srsDist ==0)
5028 /* We need to add the recp request to be sent on the pucchANRep value. */
5029 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
5030 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
5032 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
5033 "TfuUeRecpReqInfo for RNTI:%d ",ue->ueId);
5034 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
5038 #ifdef TFU_ALLOC_EVENT_NO_INIT
5039 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
5043 pucchRecpInfo->rnti = ue->ueId;
5044 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
5045 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
5046 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
5047 ue->srsCb.srsCfg.srsSetup.fDomPosi;
5048 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
5049 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
5050 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
5051 ue->srsCb.srsCfg.srsSetup.txComb;
5052 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
5053 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
5054 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
5055 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
5057 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SRS;
5058 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
5059 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
5060 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
5064 ue->srsCb.srsDist--;
5068 }/* end of rgSCHTomUtlFillSrsRecpReq */
5071 /** @brief This function handles filling of data reception requests for
5080 * @param [out] TfuRecpReqInfo *recpReqInfo
5081 * @param [in] RgSchCellCb *cell
5082 * @param [out] RgSchErrInfo *err
5088 PRIVATE S16 rgSCHTomUtlFillDatRecpReq
5090 TfuRecpReqInfo *recpReqInfo,
5095 PRIVATE S16 rgSCHTomUtlFillDatRecpReq (recpReqInfo, cell, err)
5096 TfuRecpReqInfo *recpReqInfo;
5102 RgSchUlAlloc *alloc;
5103 TfuUeRecpReqInfo *datRecpInfo;
5105 TRC2(rgSCHTomUtlFillDatRecpReq)
5107 /* processing steps are
5108 * - Run through the UL allocations going out in this subframe.
5109 * - Run through the UL receptions expected the next subframe.
5111 alloc = rgSCHUtlFirstRcptnReq (cell);
5114 /* FOR ACK NACK REP */
5115 if (NULLP != alloc->ue)
5117 /* If measuring or ackNakRep we shall not send dat RecpReq */
5118 if ((alloc->ue->measGapCb.isMeasuring == TRUE) ||
5119 (alloc->ue->ackNakRepCb.isAckNakRep == TRUE))
5121 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
5126 if ((ret = rgSCHUtlGetEventMem((Ptr *)&datRecpInfo,
5127 sizeof(TfuUeRecpReqInfo),
5128 &(recpReqInfo->memCp))) != ROK)
5130 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
5131 "TfuUeRecpReqInfo for RNTI:%d ", alloc->ue->ueId);
5132 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
5135 if (!alloc->forMsg3)
5137 datRecpInfo->type = TFU_RECP_REQ_PUSCH;
5138 rgSCHUtlAllocRcptInfo (alloc,
5140 &datRecpInfo->t.puschRecpReq.mcs,
5141 &datRecpInfo->t.puschRecpReq.rbStart,
5142 &datRecpInfo->t.puschRecpReq.numRb,
5143 &datRecpInfo->t.puschRecpReq.rv,
5144 &datRecpInfo->t.puschRecpReq.size,
5145 &datRecpInfo->t.puschRecpReq.modType,
5146 &datRecpInfo->t.puschRecpReq.isRtx,
5147 &datRecpInfo->t.puschRecpReq.nDmrs,
5148 &datRecpInfo->t.puschRecpReq.ndi,
5149 &datRecpInfo->t.puschRecpReq.harqProcId
5154 datRecpInfo->type = TFU_RECP_REQ_MSG3;
5155 rgSCHUtlAllocRcptInfo (alloc,
5157 &datRecpInfo->t.msg3RecpReq.mcs,
5158 &datRecpInfo->t.msg3RecpReq.rbStart,
5159 &datRecpInfo->t.msg3RecpReq.numRb,
5160 /*ccpu00128993 - MOD - fix for msg3 softcombining bug*/
5161 &datRecpInfo->t.msg3RecpReq.rv,
5162 &datRecpInfo->t.msg3RecpReq.size,
5163 &datRecpInfo->t.msg3RecpReq.modType,
5164 &datRecpInfo->t.msg3RecpReq.isRtx,
5165 &datRecpInfo->t.msg3RecpReq.nDmrs,
5166 &datRecpInfo->t.msg3RecpReq.ndi,
5167 &datRecpInfo->t.msg3RecpReq.harqProcId
5171 /* Other fields of datRecpInfo shall be filled
5172 * here for new features */
5173 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(datRecpInfo->lnk));
5174 datRecpInfo->lnk.node = (PTR)datRecpInfo;
5176 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
5177 } /* end of while */
5179 } /* end of rgSCHTomUtlFillDatRecpReq */
5182 /** @brief This function handles filling of data reception requests for
5191 * @param [out] TfuRecpReqInfo *recpReqInfo
5192 * @param [in] RgSchCellCb *cell
5193 * @param [in] U16 validIdx
5194 * @param [out] RgSchErrInfo *err
5200 PRIVATE S16 rgSCHTomUtlFillDatRecpReq
5202 TfuRecpReqInfo *recpReqInfo,
5208 PRIVATE S16 rgSCHTomUtlFillDatRecpReq (recpReqInfo, cell, validIdx, err)
5209 TfuRecpReqInfo *recpReqInfo;
5215 CmLteTimingInfo dci0Time;
5218 RgSchUlAlloc *alloc;
5219 TfuUeRecpReqInfo *datRecpInfo;
5221 Bool hqPres; /*Set when HARQ Rec Req is present*/
5222 Bool isAperiodic = FALSE; /*Set when Aperiodic CQI is expected */
5225 TRC2(rgSCHTomUtlFillDatRecpReq);
5227 if((0 == (recpReqInfo->timingInfo.sfn % 30)) && (0 == recpReqInfo->timingInfo.slot))
5229 //printf("5GTF_CHECK rgSCHTomUtlFillDatRecpReq (%d : %d)\n", recpReqInfo->timingInfo.sfn, recpReqInfo->timingInfo.slot);
5231 /* processing steps are
5232 * - Run through the UL allocations going out in this subframe.
5233 * - Run through the UL receptions expected the next subframe.
5236 alloc = rgSCHUtlFirstRcptnReq (cell);
5239 isAperiodic = FALSE;
5240 ret = rgSCHUtlGetEventMem((Ptr *)&datRecpInfo,
5241 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
5244 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
5245 "TfuUeRecpReqInfo for RNTI:%d ", alloc->rnti);
5246 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
5249 #ifdef TFU_ALLOC_EVENT_NO_INIT
5250 datRecpInfo->t.puschRecpReq.initialNSrs.pres = FALSE;
5251 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = FALSE;
5253 datRecpInfo->type = TFU_RECP_REQ_PUSCH;
5254 /* ccpu00131944 - Intializing hqPres in each iteration*/
5256 /* Check if this if for MSG3 - no scope for feedback along with it. */
5257 if ((FALSE == alloc->forMsg3))
5259 /* Check if any DL HARQ processes has a feedback coming at the time of
5260 * this reception request.
5265 RGSCHDECRFRMCRNTTIME(cell->crntTime,dci0Time,(RGSCH_ULCTRL_RECP_DIST));
5267 idx = (dci0Time.sfn * RGSCH_NUM_SUB_FRAMES_5G + dci0Time.slot)%
5268 RGSCH_ULCTRL_RECP_DIST;
5270 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA;
5271 datRecpInfo->rnti = alloc->rnti;
5272 rgSCHUtlAllocRcptInfo (cell,alloc, &recpReqInfo->timingInfo,
5273 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5276 else /*Enters for Msg3 == TRUE condition*/
5278 /* ccpu00130884 - ADD - HO case when Msg3 alloc and Cqi/Ri/SRS opportunity
5279 * occur at same time */
5280 if(NULLP != alloc->ue)
5283 /* Only DATA is expected */
5284 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA;
5285 datRecpInfo->rnti = alloc->rnti;
5286 rgSCHUtlAllocRcptInfo (cell,alloc, &recpReqInfo->timingInfo,
5287 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5292 if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA &&
5293 datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_SRS &&
5294 isAperiodic == FALSE)
5296 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = TRUE;
5297 datRecpInfo->t.puschRecpReq.initialNumRbs.val = alloc->ue->initNumRbs;
5301 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = FALSE;
5304 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(datRecpInfo->lnk));
5305 datRecpInfo->lnk.node = (PTR)datRecpInfo;
5306 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
5308 } /* end of while */
5310 if(numUePerTti && (numUePerTti < RG_MAX_NUM_UE_PER_TTI))
5312 cell->ulNumUeSchedPerTti[numUePerTti-1]++;
5313 gUlNumUePerTti[numUePerTti - 1]++;
5316 } /* end of rgSCHTomUtlFillDatRecpReq */
5318 /* rg009.201. Added changes of TFU_UPGRADE */
5320 /***********************************************************
5322 * Func : rgSCHTomUtlFillRiBitWidthInfo
5325 * Desc : Fills the RI BitWidth and stores it for decoding.
5334 **********************************************************/
5336 PUBLIC S16 rgSCHTomUtlFillRiBitWidthInfo
5341 PUBLIC S16 rgSCHTomUtlFillRiBitWidthInfo(ueCb)
5345 RgSchUePCqiCb *riCb = ueCb->nPRiCb;
5346 TRC2(rgSCHTomUtlFillRiBitWidthInfo);
5348 if (ueCb->mimoInfo.txMode != RGR_UE_TM_3 &&
5349 ueCb->mimoInfo.txMode != RGR_UE_TM_4)
5354 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUCCH;
5355 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode=
5356 (TfuDlCqiPucchMode)riCb->cqiCfg.cqiSetup.prdModeEnum;
5357 switch(ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode)
5359 case TFU_PUCCH_CQI_MODE10:
5360 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info.type = TFU_RPT_RI;
5361 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info.u.ri =
5364 case TFU_PUCCH_CQI_MODE11:
5365 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info.type = TFU_RPT_RI;
5366 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info.u.ri =
5369 case TFU_PUCCH_CQI_MODE20:
5370 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info.type = TFU_RPT_RI;
5371 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info.u.ri =
5374 case TFU_PUCCH_CQI_MODE21:
5375 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info.type = TFU_RPT_RI;
5376 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info.u.ri =
5383 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5387 /***********************************************************
5389 * Func : rgSCHTomUtlFetchPcqiBitSz
5392 * Desc : Fetch the CQI/PMI bits for a UE based on the mode, periodicity.
5401 **********************************************************/
5403 PUBLIC U8 rgSCHTomUtlFetchPcqiBitSz
5410 PUBLIC U8 rgSCHTomUtlFetchPcqiBitSz(ueCb, numTxAnt, ri)
5418 TfuCqiPucchMode10 *mode10Info;
5419 TfuCqiPucchMode11 *mode11Info;
5420 TfuCqiPucchMode20 *mode20Info;
5421 TfuCqiPucchMode21 *mode21Info;
5422 RgSchUePCqiCb *cqiCb = ueCb->nPCqiCb;
5424 TRC3(rgSCHTomUtlFetchPcqiBitSz);
5426 confRepMode = cqiCb->cqiCfg.cqiSetup.prdModeEnum;
5427 if((ueCb->mimoInfo.txMode != RGR_UE_TM_3) &&
5428 (ueCb->mimoInfo.txMode != RGR_UE_TM_4))
5434 *ri = cqiCb->perRiVal;
5436 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUCCH;
5437 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode=
5438 (TfuDlCqiPucchMode)confRepMode;
5441 case RGR_PRD_CQI_MOD10:
5443 mode10Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info;
5445 mode10Info->type = TFU_RPT_CQI;
5446 mode10Info->u.cqi = 4;
5450 case RGR_PRD_CQI_MOD11:
5452 mode11Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info;
5453 mode11Info->type = TFU_RPT_CQI;
5459 mode11Info->u.cqi.cqi = 4;
5460 mode11Info->u.cqi.wideDiffCqi.pres = FALSE;
5461 mode11Info->u.cqi.pmi = 2;
5466 mode11Info->u.cqi.cqi = 4;
5467 mode11Info->u.cqi.wideDiffCqi.pres = TRUE;
5468 mode11Info->u.cqi.wideDiffCqi.val = 3;
5469 mode11Info->u.cqi.pmi = 1;
5472 else if(numTxAnt == 4)
5477 mode11Info->u.cqi.cqi = 4;
5478 mode11Info->u.cqi.wideDiffCqi.pres = FALSE;
5479 mode11Info->u.cqi.pmi = 4;
5484 mode11Info->u.cqi.cqi = 4;
5485 mode11Info->u.cqi.wideDiffCqi.pres = TRUE;
5486 mode11Info->u.cqi.wideDiffCqi.val = 3;
5487 mode11Info->u.cqi.pmi = 4;
5492 /* This is number of antenna case 1.
5493 * This is not applicable for Mode 1-1.
5494 * So setting it to invalid value */
5500 case RGR_PRD_CQI_MOD20:
5502 mode20Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info;
5503 mode20Info->type = TFU_RPT_CQI;
5507 mode20Info->u.cqi.isWideband = TRUE;
5508 mode20Info->u.cqi.u.wideCqi = 4;
5512 pcqiSz = 4 + cqiCb->label;
5513 mode20Info->u.cqi.isWideband = FALSE;
5514 mode20Info->u.cqi.u.subCqi.cqi = 4;
5515 mode20Info->u.cqi.u.subCqi.l = cqiCb->label;
5520 case RGR_PRD_CQI_MOD21:
5522 mode21Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info;
5523 mode21Info->type = TFU_RPT_CQI;
5524 //pcqiSz = rgSCHTomUtlFetchPcqiBitSzPucchMode21(ueCb,
5525 // mode21Info, numTxAnt, ri);
5533 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5538 /***********************************************************
5540 * Func : rgSCHTomUtlPcqiSbCalcBpIdx
5543 * Desc : Determines the BP index from the timing info
5552 **********************************************************/
5554 PUBLIC S16 rgSCHTomUtlPcqiSbCalcBpIdx
5556 CmLteTimingInfo crntTimInfo,
5558 RgSchUePCqiCb *cqiCb
5561 PUBLIC S16 rgSCHTomUtlPcqiSbCalcBpIdx(crntTimInfo, ueCb, cqiCb)
5562 CmLteTimingInfo crntTimInfo;
5564 RgSchUePCqiCb *cqiCb;
5567 U16 tti = (crntTimInfo.sfn * RGSCH_NUM_SUB_FRAMES_5G + crntTimInfo.slot);
5568 U16 prdNum = tti/cqiCb->cqiPeri;
5570 TRC2(rgSCHTomUtlPcqiSbCalcBpIdx);
5571 if((prdNum % cqiCb->h) == 0)
5575 cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_1;
5580 cqiCb->isWb = FALSE;
5581 cqiCb->bpIdx = ((prdNum % cqiCb->h) - 1) % cqiCb->J;
5583 cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_0;
5591 * @brief Function which moves PCQI, RI, SR and SRS to next periodicity
5592 * Occasions as that needs to be done in case of Ack/Nack repetition
5593 * reception request occasions or during Measurement Gap occasions.
5597 * Function: rgSCHTomUtlMoveNxtOccasion
5599 * Function which moves PCQI, RI, SR and SRS to next perodicity
5600 * Occasions as that needs to be done in case of Ack/Nack repetition
5601 * reception request occasions or during Measurement Gap occasions.
5603 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5606 * - Check whether the current Tx Instance matches with the rec req time
5607 * - If true, then move them to their next Tx Instance
5609 * @param[in] RgSchCellCb *cell,
5617 PUBLIC S16 rgSCHTomUtlMoveNxtOccasion
5624 PUBLIC S16 rgSCHTomUtlMoveNxtOccasion(cell, ue, validIdx)
5630 RgSchUePCqiCb *cqiCb = ue->nPCqiCb;
5631 RgSchUePCqiCb *riCb = ue->nPRiCb;
5632 TRC2(rgSCHTomUtlMoveNxtOccasion);
5634 /* ccpu00140578::Skip the UE if already RI recpetion
5635 * is processed in the same subframe */
5636 if ((riCb->nRiTrIdx == validIdx) &&
5637 (riCb->riRecpPrcsd == FALSE))
5639 if(riCb->riDist ==0)
5641 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
5647 /* ccpu00140578:: As this UE is considered for this TTI
5648 * Same UE should not get processed for RI reception
5649 * or for updating th RI distance.*/
5650 if(riCb->nRiTrIdx == validIdx)
5652 riCb->riRecpPrcsd = TRUE;
5655 if (cqiCb->nCqiTrIdx == validIdx)
5657 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
5660 /* ccpu00140578::Skip the UE if SRS recpetion
5661 * is already processed in the same subframe */
5662 if ((ue->srsCb.nSrsTrIdx == validIdx) &&
5663 (ue->srsCb.srsRecpPrcsd == FALSE))
5665 if(ue->srsCb.srsDist ==0)
5667 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
5671 ue->srsCb.srsDist--;
5673 /* ccpu00140578:: As this UE is considered for this TTI
5674 * Same UE should not get processed for SRS reception
5675 * or for updating th SRS distance.*/
5676 if(ue->srsCb.nSrsTrIdx == validIdx)
5678 ue->srsCb.srsRecpPrcsd = TRUE;
5681 if (ue->srCb.nSrTrIdx == validIdx)
5683 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
5686 } /* rgSCHTomUtlMoveNxtOccasion */
5689 /***********************************************************
5691 * Func : rgSCHTomPrepareAcqiRecp
5694 * Desc : Fetch the CQI/PMI bits for a UE based on the mode and store them
5695 * for decoding. Fill RECP request and prepare the scartchpad
5696 * to aid decoding of Aperiodic CQI.
5705 **********************************************************/
5707 PUBLIC Void rgSCHTomPrepareAcqiRecp
5711 TfuUePuschCqiRecpInfo *cqiRecpReqInfo,
5715 PUBLIC Void rgSCHTomPrepareAcqiRecp(ueCb, cell, cqiRecpReqInfo, ccIdx)
5718 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
5723 RgSchCqiRawPuschMode12 *mode12Info;
5724 RgSchCqiRawPuschMode20 *mode20Info;
5725 RgSchCqiRawPuschMode22 *mode22Info;
5726 RgSchCqiRawPuschMode30 *mode30Info;
5727 RgSchCqiRawPuschMode31 *mode31Info;
5728 U8 numTxAnt = cell->numTxAntPorts;
5729 U8 sCellIdx = ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)];
5731 RgSchUeACqiCb *acqiCb = &ueCb->cellInfo[sCellIdx]->acqiCb;
5733 TRC2(rgSCHTomPrepareAcqiRecp);
5736 cqiRecpReqInfo->reportType = TFU_APERIODIC_CQI_TYPE; /* Aperiodic */
5737 if (ueCb->mimoInfo.txMode == RGR_UE_TM_3 ||
5738 ueCb->mimoInfo.txMode == RGR_UE_TM_4)
5740 cqiRecpReqInfo->riSz[ccIdx].pres = TRUE;
5741 cqiRecpReqInfo->riSz[ccIdx].val = acqiCb->riNumBits;
5743 /* This flag will be rmeoved after making changes in BRDCM CL
5744 * Sachin is doing the change
5746 #if (defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
5748 cqiRecpReqInfo->cqiPmiSzR1[ccIdx] = acqiCb->cqiPmiSzR1;
5749 cqiRecpReqInfo->cqiPmiSzRn1[ccIdx] = acqiCb->cqiPmiSzRn1;
5751 if(ueCb->nPCqiCb->perRiVal == 1)
5753 cqiRecpReqInfo->cqiPmiSzR1[ccIdx] = acqiCb->cqiPmiSzR1;
5757 cqiRecpReqInfo->cqiPmiSzRn1[ccIdx] = acqiCb->cqiPmiSzRn1;
5760 /* Fill scratchpad to aid decoding of aper CQI upon
5762 confRepMode = acqiCb->aCqiCfg.aprdModeEnum;
5763 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUSCH;
5765 numOfCells = ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells;
5767 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5768 puschRawCqiInfo.mode = (TfuDlCqiPuschMode)confRepMode;
5770 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5771 puschRawCqiInfo.ri.pres = cqiRecpReqInfo->riSz[ccIdx].pres;
5773 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5774 puschRawCqiInfo.ri.val = cqiRecpReqInfo->riSz[ccIdx].val;
5776 /* Setting the sCellIdx */
5777 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5778 sCellIdx = sCellIdx;
5782 case RGR_APRD_CQI_MOD12:
5784 mode12Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5785 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode12Info;
5786 mode12Info->wideBCqiCw0 = 4;
5787 mode12Info->r1WideBCqiCw1 = 0;
5788 mode12Info->rg1WideBCqiCw1 = 4;
5791 mode12Info->r1TotalPmiBitLen = 2*acqiCb->N;
5792 mode12Info->rg1TotalPmiBitLen = acqiCb->N;
5794 else if(numTxAnt == 4)
5796 mode12Info->r1TotalPmiBitLen = 4*acqiCb->N;
5797 mode12Info->rg1TotalPmiBitLen = 4*acqiCb->N;
5802 case RGR_APRD_CQI_MOD20:
5804 mode20Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5805 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode20Info;
5806 mode20Info->wideBCqiCw = 4;
5807 mode20Info->subBandDiffCqi = 2;
5808 mode20Info->posOfM = acqiCb->L;
5812 case RGR_APRD_CQI_MOD22:
5814 mode22Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5815 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode22Info;
5816 mode22Info->wideBCqiCw0 = 4;
5817 mode22Info->sBDiffCqiCw0 = 2;
5818 mode22Info->r1WideBCqiCw1 = 0;
5819 mode22Info->r1SbDiffCqiCw1 = 0;
5820 mode22Info->rg1WideBCqiCw1 = 4;
5821 mode22Info->rg1SbDiffCqiCw1 = 2;
5822 mode22Info->posOfM = acqiCb->L;
5825 mode22Info->r1PmiBitLen = 4;
5826 mode22Info->rg1PmiBitLen = 2;
5828 else if(numTxAnt == 4)
5830 mode22Info->r1PmiBitLen = 8;
5831 mode22Info->rg1PmiBitLen = 8;
5836 case RGR_APRD_CQI_MOD30:
5838 mode30Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5839 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode30Info;
5840 mode30Info->wideBCqiCw = 4;
5841 mode30Info->totLenSbDiffCqi = 2*acqiCb->N;
5845 case RGR_APRD_CQI_MOD31:
5847 mode31Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5848 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode31Info;
5849 mode31Info->wideBCqiCw0 = 4;
5850 mode31Info->totLenSbDiffCqiCw0 = 2*acqiCb->N;
5851 mode31Info->r1WideBCqiCw1 = 0;
5852 mode31Info->r1TotLenSbDiffCqiCw1 =0;
5853 mode31Info->rg1WideBCqiCw1 = 4;
5854 mode31Info->rg1TotLenSbDiffCqiCw1 = 2*acqiCb->N;
5857 mode31Info->r1PmiBitLen = 2;
5858 mode31Info->rg1PmiBitLen = 1;
5860 else if(numTxAnt == 4)
5862 mode31Info->r1PmiBitLen = 4;
5863 mode31Info->rg1PmiBitLen = 4;
5874 * @brief Function which handles the filling of Aperiodic CQI/RI reception
5879 * Function: rgSCHTomUtlFillDatAperRecpReq
5881 * Function which handles the filling of Aperiodic CQI/RI reception
5884 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5887 * - Fill the reception request for the data arriving on the ULSCH
5888 * - Fill the reception request information for the Aperiodic CQI/PMI/RI
5890 * @param[in] RgSchCellCb *cell,
5891 * RgSchUlAlloc *alloc,
5892 * TfuUeRecpReqInfo *datRecpInfo,
5893 * CmLteTimingInfo *timeInfo,
5900 PUBLIC S16 rgSCHTomUtlFillDatAperRecpReq
5904 RgSchUlAlloc *alloc,
5905 TfuUeRecpReqInfo *datRecpInfo,
5906 CmLteTimingInfo *timeInfo,
5911 PUBLIC S16 rgSCHTomUtlFillDatAperRecpReq(cell, cqiReq, alloc, datRecpInfo, timeInfo, hqPres, validIdx)
5914 RgSchUlAlloc *alloc;
5915 TfuUeRecpReqInfo *datRecpInfo;
5916 CmLteTimingInfo *timeInfo;
5921 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
5922 RgSchUeCb *ueCb = alloc->ue;
5927 TRC2(rgSCHTomUtlFillDatAperRecpReq);
5929 /*Fill RI Reception Params*/
5930 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
5931 cqiRecpReqInfo->riBetaOff = alloc->ue->ul.betaRiOffst;
5932 cqiRecpReqInfo->cqiBetaOff = alloc->ue->ul.betaCqiOffst;
5935 cqiRecpReqInfo->cCNum = 0;
5936 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells = 0;
5939 rgSCHTomUtlGetTrigSet(cell, ueCb, cqiReq, &triggerSet);
5940 for (sIdx = 0; sIdx < CM_LTE_MAX_CELLS; sIdx++)
5942 /* The Aperiodic request for SCell index sIdx */
5943 if ((triggerSet >> (7 - sIdx)) & 0x01)
5945 /* The Aperiodic request for SCell index sIdx */
5946 rgSCHTomPrepareAcqiRecp(ueCb, ueCb->cellInfo[sIdx]->cell, cqiRecpReqInfo, cqiRecpReqInfo->cCNum);
5947 cqiRecpReqInfo->cCNum++;
5948 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells++;
5952 rgSCHTomPrepareAcqiRecp(ueCb, ueCb->cellInfo[0]->cell, cqiRecpReqInfo, cqiRecpReqInfo->cCNum);
5953 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells++;
5956 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5958 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
5960 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
5961 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
5965 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
5967 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
5971 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
5973 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
5975 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
5977 datRecpInfo->rnti = alloc->rnti;
5978 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
5979 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5981 } /* rgSCHTomUtlFillDatAperRecpReq */
5986 * @brief Function which handles the filling of Periodic RI reception
5987 * request values which arrives along with UL Data on ULSCH
5991 * Function: rgSCHTomUtlFillDatPriRecpReq
5993 * Function which handles the filling of Periodic RI reception
5994 * request values which arrives along with UL Data on ULSCH
5996 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5999 * - Fill the reception request for the data arriving on the ULSCH
6000 * - Fill the reception request information for the Periodic RI
6002 * @param[in] RgSchCellCb *cell,
6003 * RgSchUlAlloc *alloc,
6004 * TfuUeRecpReqInfo *datRecpInfo,
6005 * CmLteTimingInfo *timeInfo,
6012 PUBLIC S16 rgSCHTomUtlFillDatPriRecpReq
6015 RgSchUlAlloc *alloc,
6016 TfuUeRecpReqInfo *datRecpInfo,
6017 CmLteTimingInfo *timeInfo,
6022 PUBLIC S16 rgSCHTomUtlFillDatPriRecpReq(cell, alloc, datRecpInfo, timeInfo,
6025 RgSchUlAlloc *alloc;
6026 TfuUeRecpReqInfo *datRecpInfo;
6027 CmLteTimingInfo *timeInfo;
6032 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
6033 TRC2(rgSCHTomUtlFillDatPriRecpReq);
6035 /*Fill RI Reception Params*/
6036 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
6037 #ifdef TFU_ALLOC_EVENT_NO_INIT
6038 cqiRecpReqInfo->cqiBetaOff = 0;
6039 /* Fill only the first RI index since Periodic can come
6041 cqiRecpReqInfo->cqiPmiSzR1[0] = 0;
6042 cqiRecpReqInfo->cqiPmiSzRn1[0] = 0;
6044 cqiRecpReqInfo->reportType = TFU_PERIODIC_CQI_TYPE; /* periodic */
6045 cqiRecpReqInfo->riBetaOff = alloc->ue->ul.betaRiOffst;
6047 /* Fill only the first RI index since Periodic can come
6049 cqiRecpReqInfo->cCNum = 1;
6050 cqiRecpReqInfo->riSz[0].pres = TRUE;
6051 cqiRecpReqInfo->riSz[0].val = alloc->ue->nPRiCb->riNumBits;
6053 rgSCHTomUtlFillRiBitWidthInfo(alloc->ue);
6054 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
6056 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
6057 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
6061 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
6063 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
6067 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
6069 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
6071 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
6073 datRecpInfo->rnti = alloc->rnti;
6074 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
6075 &datRecpInfo->t.puschRecpReq.ulSchInfo);
6077 } /* rgSCHTomUtlFillDatPriRecpReq */
6081 * @brief Function which handles the filling of Periodic CQI/PMI reception
6082 * request values which arrives along with UL Data on ULSCH
6086 * Function: rgSCHTomUtlFillDatPCqiRecpReq
6088 * Function which handles the filling of Periodic CQI/PMI reception
6089 * request values which arrives along with UL Data on ULSCH
6091 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
6094 * - Fill the reception request for the data arriving on the ULSCH
6095 * - Fill the reception request information for the Periodic CQI/PMI
6097 * @param[in] RgSchCellCb *cell,
6098 * RgSchUlAlloc *alloc,
6099 * TfuUeRecpReqInfo *datRecpInfo,
6100 * CmLteTimingInfo *timeInfo,
6108 PUBLIC S16 rgSCHTomUtlFillDatPCqiRecpReq
6111 RgSchUlAlloc *alloc,
6112 TfuUeRecpReqInfo *datRecpInfo,
6113 CmLteTimingInfo *timeInfo,
6118 PUBLIC S16 rgSCHTomUtlFillDatPCqiRecpReq(cell, alloc, datRecpInfo,
6119 timeInfo, hqPres, validIdx)
6121 RgSchUlAlloc *alloc;
6122 TfuUeRecpReqInfo *datRecpInfo;
6123 CmLteTimingInfo *timeInfo;
6128 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
6129 U8 cqiPmiSz; /*Raw CQI/PMI Size*/
6132 TRC2(rgSCHTomUtlFillDatPCqiRecpReq);
6135 /*Fill CQI Reception Params*/
6136 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
6137 #ifdef TFU_ALLOC_EVENT_NO_INIT
6138 cqiRecpReqInfo->riBetaOff = 0;
6140 cqiRecpReqInfo->cqiBetaOff = alloc->ue->ul.betaCqiOffst;
6141 cqiPmiSz = rgSCHTomUtlFetchPcqiBitSz(alloc->ue, cell->numTxAntPorts, &ri);
6144 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Fill "
6145 "CqiPmi size RNTI:%d",alloc->rnti);
6149 /* Fill only the first RI index since Periodic can come
6151 cqiRecpReqInfo->cCNum = 1;
6152 cqiRecpReqInfo->reportType = TFU_PERIODIC_CQI_TYPE; /* Periodic */
6153 /* This flags will be removed once Sachin does changes
6155 #if (defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
6156 cqiRecpReqInfo->cqiPmiSzR1[0] = cqiPmiSz;
6157 cqiRecpReqInfo->cqiPmiSzRn1[0] = cqiPmiSz;
6161 cqiRecpReqInfo->cqiPmiSzR1[0] = cqiPmiSz;
6162 cqiRecpReqInfo->cqiPmiSzRn1[0] = 0;
6166 cqiRecpReqInfo->cqiPmiSzRn1[0] = cqiPmiSz;
6167 cqiRecpReqInfo->cqiPmiSzR1[0] = 0;
6170 cqiRecpReqInfo->riSz[0].pres = FALSE;
6172 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
6174 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
6175 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
6178 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
6180 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
6184 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
6186 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
6188 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
6190 datRecpInfo->rnti = alloc->rnti;
6191 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
6192 &datRecpInfo->t.puschRecpReq.ulSchInfo);
6194 } /* rgSCHTomUtlFillDatPCqiRecpReq */
6197 * @brief Function which handles the filling of SRS reception
6198 * request values which arrives along with UL Data on ULSCH
6202 * Function: rgSCHTomUtlFillDatSrsRecpReq
6204 * Function which handles the filling of SRS reception
6205 * request values which arrives along with UL Data on ULSCH
6207 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
6210 * - Fill the reception request for the data arriving on the ULSCH
6211 * - Fill the reception request information for the SRS
6213 * @param[in] RgSchCellCb *cell,
6214 * RgSchUlAlloc *alloc,
6215 * TfuUeRecpReqInfo *datRecpInfo,
6216 * CmLteTimingInfo *timeInfo,
6223 PUBLIC S16 rgSCHTomUtlFillDatSrsRecpReq
6226 RgSchUlAlloc *alloc,
6227 TfuUeRecpReqInfo *datRecpInfo,
6228 CmLteTimingInfo *timeInfo,
6232 PUBLIC S16 rgSCHTomUtlFillDatSrsRecpReq(cell, alloc, datRecpInfo, timeInfo,
6235 RgSchUlAlloc *alloc;
6236 TfuUeRecpReqInfo *datRecpInfo;
6237 CmLteTimingInfo *timeInfo;
6241 TRC2(rgSCHTomUtlFillDatSrsRecpReq);
6242 datRecpInfo->rnti = alloc->rnti;
6243 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
6246 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_HARQ_SRS;
6250 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_SRS;
6252 datRecpInfo->rnti = alloc->rnti;
6253 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
6254 &datRecpInfo->t.puschRecpReq.ulSchInfo);
6256 } /* rgSCHTomUtlFillDatSrsRecpReq */
6259 * @brief Function which handles the filling of only SRS reception
6260 * request values on ULSCH
6264 * Function: rgSCHTomFillOnlySrsRecpReq
6266 * Function which handles the filling of SRS reception
6267 * request values which arrives along with UL Data on ULSCH
6269 * Invoked by: rgSCHTomUtlFillDatSrsRecpReq of rg_sch_tom.c
6272 * - Fill the reception request for the data arriving on the ULSCH
6273 * - Fill the reception request information for the SRS
6275 * @param[in] RgSchCellCb *cell,
6276 * RgSchUlAlloc *alloc,
6277 * TfuUeRecpReqInfo *datRecpInfo,
6283 PUBLIC S16 rgSCHTomFillOnlySrsRecpReq
6286 RgSchUlAlloc *alloc,
6287 TfuUeRecpReqInfo *datRecpInfo
6290 PUBLIC S16 rgSCHTomFillOnlySrsRecpReq(cell, alloc, datRecpInfo)
6292 RgSchUlAlloc *alloc;
6293 TfuUeRecpReqInfo *datRecpInfo;
6296 TfuUePuschSrsRecpInfo *srsRecpReqInfo;
6297 TRC2(rgSCHTomFillOnlySrsRecpReq);
6299 srsRecpReqInfo = &datRecpInfo->t.puschRecpReq.srsInfo;
6300 srsRecpReqInfo->srsBw = (TfuUlSrsBwInfo)alloc->ue->srsCb.srsCfg.srsSetup.srsBw;
6301 srsRecpReqInfo->nRrc = alloc->ue->srsCb.srsCfg.srsSetup.fDomPosi;
6302 srsRecpReqInfo->srsHopBw = (TfuUlSrsHoBwInfo)alloc->ue->srsCb.srsCfg.srsSetup.srsHopBw;
6303 srsRecpReqInfo->transComb = alloc->ue->srsCb.srsCfg.srsSetup.txComb;
6304 srsRecpReqInfo->srsCfgIdx = alloc->ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6305 srsRecpReqInfo->srsCyclicShft = (TfuUlSrsCycShiftInfo)alloc->ue->srsCb.srsCfg.srsSetup.cycShift;
6307 /* ccpu00117050 - ADD - nSrs setting
6308 * Refer Section 5.2.2.6 of TS 36.212 V8.5.0*/
6309 datRecpInfo->t.puschRecpReq.ulSchInfo.nSrs = 1;
6312 } /* rgSCHTomFillOnlySrsRecpReq */
6315 * @brief Function which handles the filling of PCQI/RI, SRS and SR
6316 * Reception Request Information along
6317 * with the HARQ reception Request
6321 * Function: rgSCHTomUtlFillCqiSrSrsWithHq
6323 * Function which handles the filling of PCQI/RI, SRS ans SR
6324 * Reception Request Information along
6325 * with the HARQ reception Request
6328 * Invoked by: rgSCHTomUtlFillHqFdbkRecpReq &
6329 * rgSCHTomUtlFillSfHqFdbk of rg_sch_tom.c
6332 * - Fill the reception request for the Control Info arriving on the PUCCH
6333 * - Fill the reception request information for the SR, RI, CQI, SRS
6335 * @param[in] RgSchCellCb *cell,
6336 * TfuRecpReqInfo *recpReqInfo,
6337 * RgSchDlHqProcCb *hqCb,
6338 * @param[out] TfuUeRecpReqInfo *pucchRecpInfo
6339 * @param[in] U16 validIdx
6345 PRIVATE S16 rgSCHTomUtlFillCqiSrSrsWithHq
6348 TfuRecpReqInfo *recpReqInfo,
6350 TfuUeRecpReqInfo *pucchRecpInfo,
6352 Bool isDatPresOnSecCell
6355 PRIVATE S16 rgSCHTomUtlFillCqiSrSrsWithHq(cell, recpReqInfo, ue,
6356 pucchRecpInfo, validIdx,isDatPresOnSecCell)
6358 TfuRecpReqInfo *recpReqInfo;
6360 TfuUeRecpReqInfo *pucchRecpInfo;
6362 Bool isDatPresOnSecCell;
6365 RgSchUePCqiCb *cqiCb;
6366 RgSchUePCqiCb *riCb;
6367 U8 ri; /*To fetch RI value*/
6368 Bool willUeRprtCqi; /* Flag set due to CQI Mask and
6369 UE Inactive state (DRX)*/
6370 Bool willUeRprtSr = TRUE;
6371 TfuAckNackMode hqFdbkMode;
6374 Bool dropCqi = FALSE;
6376 RgSchCmnUlUeSpsInfo *ulSpsUe = NULL;
6379 RgSchEmtcUeInfo *emtcUe = NULLP;
6382 TRC2(rgSCHTomUtlFillCqiSrSrsWithHq);
6386 /*Changes for PUCCH Format3 */
6387 hqFdbkMode = pucchRecpInfo->t.pucchRecpReq.hqInfo.hqFdbkMode;
6388 numCqiBit = rgSCHCmnCalcPcqiBitSz (ue,cell->numTxAntPorts);
6389 totalPucchBits = pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz + numCqiBit;
6392 emtcUe = RG_GET_EMTC_UE_CB(ue);
6394 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
6395 #ifdef EMTC_ENABLE /*VINU*/
6398 if((emtcUe->pucchRepNumFr1 > 1) || (emtcUe->pucchRepNumFr2 > 1))
6400 willUeRprtCqi = FALSE;
6401 willUeRprtSr = FALSE;
6405 if(ue->srCb.nSrTrIdx == validIdx)
6409 /* Should we check for Rel8 and above???
6410 * Dont send SR recp req if logicalChannelSR-Mask enabled and UL SPS is
6412 ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue, cell);
6413 /* Avoiding check for ulSpsEnabled as isUlSpsActv FALSE if sps is not enabled*/
6414 if(!((ue->ul.ulSpsCfg.isLcSRMaskEnab) &&
6415 (ulSpsUe->isUlSpsActv)))
6422 pucchRecpInfo->t.pucchRecpReq.srInfo.n1PucchIdx =
6423 ue->srCb.srCfg.srSetup.srResIdx;
6424 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
6425 /* FORMAT3: If SR is present it will be appended after HARQ */
6426 totalPucchBits = totalPucchBits + 1;
6433 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
6435 /* LTE_ADV:: UE will drop CSI during CSI+1BCS if data is present
6436 * on sec cell(isDatPresOnSecCell)*/
6438 if (hqFdbkMode == TFU_ACK_NACK_CHANNEL_SELECTION)
6440 if (hqFdbkMode == TFU_UCI_FORMAT_1B_CS)
6443 if (isDatPresOnSecCell == TRUE)
6450 /* Format 3 Changes : If Hq + SR + CQI bits < 22 and simultaneousAckNackAndCQI-Format3
6451 is enabled then CQI will be multiplexed with HQ otherwise CQI will be dropped
6452 Spec 36.213 Sec 10.1.1 */
6453 else if (hqFdbkMode == TFU_UCI_FORMAT_3)
6455 if ((isDatPresOnSecCell == TRUE) &&
6456 ((!ue->simulAckNackCQIFormat3) || (totalPucchBits > 22)))
6464 cqiCb = ue->nPCqiCb;
6465 if(riCb->nRiTrIdx == validIdx)
6467 /*ccpu00140578:: Skip the UE if the RI is already processed
6469 if(riCb->riRecpPrcsd == FALSE)
6471 if(riCb->riDist == 0)
6473 if((riCb->cqiCfg.cqiSetup.sANCQI == TRUE) && (willUeRprtCqi == TRUE)&&
6474 (isDatPresOnSecCell == FALSE))
6477 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6478 riCb->cqiCfg.cqiSetup.cqiPResIdx;
6479 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6481 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_HARQ_SR)
6483 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI;
6487 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_CQI;
6489 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6491 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6492 ue->nPRiCb->servCellInfo->sCellIdx;
6494 rgSCHTomUtlFillRiBitWidthInfo(ue);
6495 if (ue->nPCqiCb->nCqiTrIdx == validIdx)
6497 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, ue->nPCqiCb);
6512 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
6518 /* Skip the UE for RI processing on PUCCH
6519 * in the same subframe as it already processed */
6520 if(riCb->nRiTrIdx == validIdx)
6522 /* As the new idx is same is current idx
6523 * then PUCCH reception processing will consider
6524 * RI also in the same subframe. To block this
6525 * below flag is used*/
6526 riCb->riRecpPrcsd = TRUE;
6530 else if(cqiCb->nCqiTrIdx == validIdx)
6532 if((cqiCb->cqiCfg.cqiSetup.sANCQI == TRUE) && (willUeRprtCqi == TRUE)&&
6533 (isDatPresOnSecCell == FALSE))
6536 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6537 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
6539 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6541 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6542 cqiCb->servCellInfo->sCellIdx;
6544 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6545 rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
6546 if(0 == pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz)
6548 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d "
6549 "Unable to Fill CqiPmi size", ue->ueId);
6552 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_HARQ_SR)
6554 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI;
6558 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_CQI;
6571 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6573 if(ue->srsCb.nSrsTrIdx == validIdx)
6575 /* ccpu00140578::Skip the UE for SRS reception processing
6576 * if already done as part of PUSCH recpetion
6578 if(ue->srsCb.srsRecpPrcsd == FALSE)
6580 if(ue->srsCb.srsDist ==0 )
6582 if((pucchRecpInfo->t.pucchRecpReq.uciInfo != TFU_PUCCH_HARQ_CQI)
6583 && (ue->srsCb.srsCfg.srsSetup.sANSrs)
6584 && (isDatPresOnSecCell == FALSE))
6587 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
6588 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
6589 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
6590 ue->srsCb.srsCfg.srsSetup.fDomPosi;
6591 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
6592 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
6593 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
6594 ue->srsCb.srsCfg.srsSetup.txComb;
6595 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
6596 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6597 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
6598 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
6599 /* ccpu00116923 - ADD - New Reception Request types for CQI and SRS with SR */
6600 switch(pucchRecpInfo->t.pucchRecpReq.uciInfo)
6602 case TFU_PUCCH_HARQ_SR:
6603 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_SRS;
6605 case TFU_PUCCH_HARQ_SR_CQI:
6606 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI_SRS;
6609 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SRS;
6613 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
6617 ue->srsCb.srsDist--;
6619 /* Skip the UE for SRS processing on PUCCH
6620 * in the same subframe as it already processed */
6621 if(ue->srsCb.nSrsTrIdx == validIdx)
6623 /* As the new idx is same is current idx
6624 * then PUCCH reception processing will consider
6625 * SRS also in the same subframe. To block this
6626 * below flag is used*/
6627 ue->srsCb.srsRecpPrcsd = TRUE;
6635 } /* rgSCHTomUtlFillCqiSrSrsWithHq */
6638 * @brief Function which handles the filling of PCQI/RI, SRS
6639 * Reception Request Information along with SR reception
6644 * Function: rgSCHTomUtlFillCqiSrsWithSr
6646 * Function which handles the filling of PCQI/RI, SRS
6647 * Reception Request Information along
6648 * with the SR reception Request
6651 * Invoked by: rgSCHTomUtlFillSrRecpReq of rg_sch_tom.c
6654 * - Fill the reception request for CQI/RI, SRS if they occur
6655 * in the same instance as of SR.
6657 * @param[in] RgSchCellCb *cell,
6659 * TfuRecpReqInfo *recpReqInfo,
6660 * @param[out] TfuUeRecpReqInfo *pucchRecpInfo
6661 * @param[in] U16 validIdx
6668 PRIVATE S16 rgSCHTomUtlFillCqiSrsWithSr
6672 TfuRecpReqInfo *recpReqInfo,
6673 TfuUeRecpReqInfo *pucchRecpInfo,
6677 PRIVATE S16 rgSCHTomUtlFillCqiSrsWithSr(cell, ue, recpReqInfo,
6678 pucchRecpInfo, validIdx)
6681 TfuRecpReqInfo *recpReqInfo;
6682 TfuUeRecpReqInfo *pucchRecpInfo;
6686 RgSchUePCqiCb *cqiCb;
6687 RgSchUePCqiCb *riCb;
6688 U8 ri; /*To fetch RI value*/
6689 Bool willUeRprtCqi; /* Flag set due to CQI Mask and
6690 UE Inactive state (DRX)*/
6691 TRC2(rgSCHTomUtlFillCqiSrsWithSr);
6694 cqiCb = ue->nPCqiCb;
6695 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
6697 rgSCHEmtcWillUeRptCqi(ue, &willUeRprtCqi);
6699 if(riCb->nRiTrIdx == validIdx)
6701 /*ccpu00140578:: Skip the UE if the RI is already processed
6703 if(riCb->riRecpPrcsd == FALSE)
6705 if(riCb->riDist == 0)
6707 if(willUeRprtCqi == TRUE)
6710 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6711 riCb->cqiCfg.cqiSetup.cqiPResIdx;
6712 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6715 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI;
6716 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6718 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6719 ue->nPRiCb->servCellInfo->sCellIdx;
6721 rgSCHTomUtlFillRiBitWidthInfo(ue);
6722 /* TODO:: syed Shouldn't this be done outside this if condition */
6723 if (cqiCb->nCqiTrIdx == validIdx)
6725 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6728 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
6734 if(riCb->nRiTrIdx == validIdx)
6735 {/* Need to skip this UE during PUCCH RI recpetion process
6736 in the current subframe */
6737 riCb->riRecpPrcsd = TRUE;
6741 else if(cqiCb->nCqiTrIdx == validIdx)
6743 if(willUeRprtCqi == TRUE)
6746 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6747 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
6749 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6752 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6753 cqiCb->servCellInfo->sCellIdx;
6755 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6756 rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
6757 if(0 == pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz)
6759 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d"
6760 " Unable to Fill CqiPmi size", ue->ueId);
6764 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI;
6766 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6768 if(ue->srsCb.nSrsTrIdx == validIdx)
6770 /* ccpu00140578:: Cnsider the SRS processing
6771 * only if not done in the same TTI
6772 * as part of PUSCH or HARQ reception process*/
6773 if(ue->srsCb.srsRecpPrcsd == FALSE)
6775 if(ue->srsCb.srsDist ==0 )
6777 if(ue->srsCb.srsCfg.srsSetup.sANSrs)
6780 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
6781 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
6782 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
6783 ue->srsCb.srsCfg.srsSetup.fDomPosi;
6784 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
6785 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
6786 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
6787 ue->srsCb.srsCfg.srsSetup.txComb;
6788 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
6789 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6790 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
6791 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
6792 /* ccpu00116923 - ADD - New Reception Request types for CQI and
6794 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_SR_CQI)
6796 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI_SRS;
6800 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_SRS;
6804 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
6808 ue->srsCb.srsDist--;
6810 /* Skip the UE for SRS processing on PUCCH
6811 * in the same subframe as it already processed */
6812 if(ue->srsCb.nSrsTrIdx == validIdx)
6814 /* As the new idx is same is current idx
6815 * then PUCCH reception processing will consider
6816 * SRS also in the same subframe. To block this
6817 * below flag is used*/
6818 ue->srsCb.srsRecpPrcsd = TRUE;
6824 } /* rgSCHTomUtlFillCqiSrsWithSr */
6830 /** @brief This function handles filling of HARQ feedback repetition
6831 * recption request for each subframe
6835 * Function: rgSCHTomUtlFillSfRepHqFdbk
6839 * @param [out] TfuRecpReqInfo *recpReqInfo
6840 * @param [in] RgSchCellCb *cell
6841 * @param [out] RgSchErrInfo *err
6842 * @param [in] RgSchDlSf *dlSf
6843 * @param [in] U8 noFdbks
6844 * @param [in] CmMemListCp *memCp
6845 * @param [in] U8 elemIdx
6846 * @param [in] RgSchDlSf *nxtDlsf
6853 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk
6855 TfuRecpReqInfo *recpReqInfo,
6856 RgSchCellCb *cellCb,
6866 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk (recpReqInfo, cellCb, err, dlSf,
6867 noFdbks, memCp, elemIdx, nxtDlsf, validIdx)
6868 TfuRecpReqInfo *recpReqInfo;
6869 RgSchCellCb *cellCb;
6880 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk
6882 TfuRecpReqInfo *recpReqInfo,
6883 RgSchCellCb *cellCb,
6892 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk (recpReqInfo, cellCb, err, dlSf,
6893 noFdbks, memCp, elemIdx, nxtDlsf)
6894 TfuRecpReqInfo *recpReqInfo;
6895 RgSchCellCb *cellCb;
6905 RgSchDlHqProcCb *hqCb;
6909 TfuUeRecpReqInfo *pucchRecpInfo;
6911 TfuUePucchHqRecpInfo *hqRecpReq;
6913 RgSchDlHqTbCb *tbCb;
6914 RgSchDlHqProcCb *prvHqCb = NULLP;
6916 TRC2(rgSCHTomUtlFillSfRepHqFdbk)
6918 node = dlSf->ackNakRepQ.first;
6921 tbCb = (RgSchDlHqTbCb *)(node->node);
6923 ueCb = hqCb->hqE->ue;
6925 if (--tbCb->fbkRecpRepCntr)
6927 /* Add to next subfarme */
6928 /* Add this hqCb to the next dlSf's ackNakRepQ */
6929 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
6930 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
6931 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
6932 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
6939 /* Go to the next node */
6944 if ((hqCb->hqE->ue != NULLP) &&
6945 (hqCb->hqE->ue->measGapCb.isMeasuring != TRUE)
6946 && (hqCb != prvHqCb)
6949 /* We need to add the recp request to be sent on the pucchANRep
6952 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
6953 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
6956 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to"
6957 "Allocate TfuUeRecpReqInfo for RNTI:%d ", ueCb->ueId);
6958 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
6961 pucchRecpInfo->rnti = ueCb->ueId;
6963 pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
6965 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
6968 /* FOR repetition Feedback shall come on n1PucchAnRep Configured per
6972 pucchRecpInfo->t.pucchRecpReq.hqType = TFU_HQ_RECP_REQ_N1PUCCH;
6973 pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = ueCb->ackNakRepCb.pucchRes;
6975 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
6976 hqRecpReq = &(pucchRecpInfo->t.pucchRecpReq.hqInfo);
6977 /* ACK NACK rep works only in bundling mode . */
6978 hqRecpReq->hqFdbkMode = (TfuAckNackMode)RGR_TDD_ACKNACK_MODE_BUNDL;
6979 if ((hqCb->hqPSfLnk.node != NULLP) &&
6980 (hqCb->hqPSfLnk.node != NULLP))
6983 hqRecpReq->hqSz = 2;
6987 hqRecpReq->hqSz = 1;
6989 hqRecpReq->pucchResCnt = 1;
6990 hqRecpReq->hqRes[0] = ueCb->ackNakRepCb.pucchRes;
6992 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
6993 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
6995 /* In a given dlSf, if there is 2 TBs context
6996 * stored for a given harq, then they are added
6997 * adjacent to each other in the subframe. To avoid
6998 * adding duplicate recpnInfo for each TB, store this
6999 * hqCb in prvHqCb. If nextHqCb is same as prvHqCb then
7000 * do not add reception req info.*/
7003 RGSCH_NULL_CHECK(cellCb->instIdx, hqCb->hqE->ue);
7004 rgSCHTomUtlMoveNxtOccasion(cellCb, hqCb->hqE->ue, validIdx);
7006 /* Go to the next node */
7013 /** @brief This function handles filling of HARQ feedback recption request
7018 * Function: rgSCHTomUtlFillSfHqFdbkInfo
7022 * @param [out] TfuRecpReqInfo *recpReqInfo
7023 * @param [in] RgSchCellCb *cell
7024 * @param [out] RgSchErrInfo *err
7025 * @param [in] RgSchDlSf *dlSf
7026 * @param [in] U8 noFdbks
7027 * @param [in] CmMemListCp *memCp
7028 * @param [in] U8 elemIdx
7029 * @param [in] RgSchDlSf *nxtDlsf
7030 * @param [in] U16 validIdx;
7037 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo
7039 TfuRecpReqInfo *recpReqInfo,
7040 RgSchCellCb *cellCb,
7048 RgSchDlHqProcCb *hqCb,
7049 RgSchUePucchRecpInfo *pucchInfo,
7051 RgSchDlHqProcCb *prvHqCb
7054 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo (recpReqInfo, cellCb, err, dlSf,
7055 noFdbks, memCp, elemIdx, nxtDlsf, validIdx, hqCb, pucchInfo, alloc, prvHqCb)
7056 TfuRecpReqInfo *recpReqInfo;
7057 RgSchCellCb *cellCb;
7065 RgSchDlHqProcCb *hqCb;
7066 RgSchUePucchRecpInfo *pucchInfo;
7068 RgSchDlHqProcCb *prvHqCb;
7072 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo
7074 TfuRecpReqInfo *recpReqInfo,
7075 RgSchCellCb *cellCb,
7082 RgSchDlHqProcCb *hqCb,
7083 RgSchUePucchRecpInfo *pucchInfo,
7085 RgSchDlHqProcCb *prvHqCb
7088 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo (recpReqInfo, cellCb, err, dlSf,
7089 noFdbks, memCp, elemIdx, nxtDlsf, hqCb, pucchInfo, alloc, prvHqCb)
7090 TfuRecpReqInfo *recpReqInfo;
7091 RgSchCellCb *cellCb;
7098 RgSchDlHqProcCb *hqCb;
7099 RgSchUePucchRecpInfo *pucchInfo;
7101 RgSchDlHqProcCb *prvHqCb;
7106 RgSchUeCb *ueCb = hqCb->hqE->ue;
7108 CmLteTimingInfo futTime;
7109 RgSchTddANInfo *anInfo;
7112 RgrTddAckNackMode ackNackMode;
7113 RgSchDlHqTbCb *tbCb;
7118 TRC2(rgSCHTomUtlFillSfHqFdbkInfo)
7121 RG_SCH_ADD_TO_CRNT_TIME(cellCb->crntTime, futTime, TFU_RECPREQ_DLDELTA);
7125 for (idx = 0 ;idx < 2; idx++)
7127 if (HQ_TB_WAITING == hqCb->tbInfo[idx].state)
7130 tbCb = &hqCb->tbInfo[idx];
7134 ackNackMode = ueCb->dl.ackNackMode;
7136 if(ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL)
7138 anInfo = rgSCHUtlGetUeANFdbkInfo(ueCb, &futTime);
7139 /* Only the last scheduled TB for the UE is for HARQ
7140 * ACK/NACK reception in Bundling case */
7141 if((anInfo == NULLP) ||
7142 (anInfo->latestMIdx != dlSf->dlFdbkInfo.m))
7149 /* Get the TFU reception request pointer, if present */
7150 cmHashListFind(&cellCb->ueTfuPendLst, (U8*) &ueCb->ueId,
7151 sizeof(ueCb->ueId), 0, (PTR *) &pucchInfo);
7154 /* For upgrade we shall use the existing logic of pending list. */
7155 cmHashListFind(&cellCb->ueTfuPendLst, (U8*) &ueCb->ueId,
7156 sizeof(ueCb->ueId), 0, (PTR *) &pucchInfo);
7159 else if(hqCb->hqE->raCb != NULLP)
7161 /* For RACH it is set to Bundling */
7162 ackNackMode = RGR_TDD_ACKNACK_MODE_BUNDL;
7163 rnti = hqCb->hqE->raCb->tmpCrnti;
7170 /* Do not proceed if PUSCH
7171 reception req is already filled*/
7176 /* Go to the next node */
7180 if(((ueCb == NULLP) || (ueCb->measGapCb.isMeasuring != TRUE))
7184 TknU16 n1PucchTkn = {FALSE, 0};
7187 pdcch = tbCb->hqP->pdcch;
7189 n1PucchTkn = hqCb->spsN1PucchRes;
7191 for (tbIndx = 0; tbIndx < TFU_MAX_TB; tbIndx++)
7193 if (hqCb->tbInfo[tbIndx].state == HQ_TB_WAITING &&
7194 (RGSCH_TIMEINFO_SAME(hqCb->tbInfo[tbIndx].fdbkTime,
7195 recpReqInfo->timingInfo)))
7198 hqCb->tbInfo[tbIndx].pucchFdbkIdx = hqCb->ulDai;
7201 ret = rgSCHTomUtlFillSfHqFdbkForOneUe(hqCb,recpReqInfo, cellCb, err, dlSf, noFdbks,
7202 memCp, elemIdx, nxtDlsf, rnti, ackNackMode, &pucchInfo, pdcch,
7203 n1PucchTkn, &alloc, hqSz);
7208 /* TODO:: In case of F1BCS and CSI in same subframe
7209 * UE shall drop the CSI if there was at least one
7210 * PDSCH transmission in any of the DL subframe
7211 * mapping to this UL subframe
7214 rgSCHTomUtlFillCqiSrSrsWithHq(cellCb,recpReqInfo, hqCb->hqE->ue,
7215 pucchInfo->pucchRecpInfo, validIdx,FALSE);
7217 if((hqCb->hqE->ue) &&
7218 (hqCb->hqE->ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS))
7221 if(RG_SCH_IS_CELL_SEC(hqCb->hqE->ue,hqCb->hqE->cell))
7223 switch(pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo)
7225 case TFU_PUCCH_HARQ_SR_CQI:
7226 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
7227 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
7229 case TFU_PUCCH_HARQ_CQI:
7230 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
7231 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
7233 case TFU_PUCCH_HARQ_SR_CQI_SRS:
7234 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_SRS;
7235 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
7237 case TFU_PUCCH_HARQ_SR_SRS:
7238 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
7240 case TFU_PUCCH_HARQ_SRS:
7241 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
7252 /* TODO antz - pushing the following code (under TFU_UPGRADE)
7253 * into the above function (...ForOneUe) did not work (caused
7254 * two additional TCs to fail). Don't know why. If this
7255 * is done later, make sure that the code branch
7256 * for relPdcch (later in this func) is also modified appropriately.
7258 /* Now add to the recp request or pending list */
7259 //if((elemIdx != (noFdbks - 1)))
7261 cmHashListInsert(&cellCb->ueTfuPendLst, (PTR) pucchInfo,
7262 (U8 *)&rnti ,(U16) sizeof(CmLteRnti));
7266 } /* If measuring */
7267 /* Go to the next node */
7268 if ((tbCb->fbkRecpRepCntr) && (--tbCb->fbkRecpRepCntr))
7270 /* Add to next subfarme */
7271 /* Add this hqCb to the next dlSf's ackNakRepQ */
7272 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
7273 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
7274 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
7275 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
7277 /* In a given dlSf, if there is 2 TBs context
7278 * stored for a given harq, then they are added
7279 * adjacent to each other in the subframe. To avoid
7280 * adding duplicate recpnInfo for each TB, store this
7281 * hqCb in prvHqCb. If nextHqCb is same as prvHqCb then
7282 * do not add reception req info.*/
7290 /** @brief This function calculates the pucch resource idx
7291 * that is to be filled in harq reception request
7295 * Function: rgSCHTomUtlGethqRes
7298 * -Calculate the pucch resource idx
7299 * Harq Reception Request for Format 1B with
7302 * @param [in] U8 noFdbks
7303 * @param [in] RgSchDlSf *dlSf
7304 * @param [in] RgSchPdcch *pdcch
7305 * @param [in] RgSchCellCb *cellCb
7306 * @param [out]U16 *hqRes
7310 PRIVATE Void rgSCHTomUtlGethqRes
7315 RgSchCellCb *cellCb,
7319 PRIVATE Void rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,hqRes)
7323 RgSchCellCb *cellCb;
7335 m = dlSf->dlFdbkInfo.m;
7337 P = rgSCHCmnGetPValFrmCCE(cellCb, nCce);
7338 nP = cellCb->rgSchTddNpValTbl[P];
7339 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
7340 *hqRes = (M - m - 1)* nP + (m * nPlusOne) + pdcch->nCce +
7341 cellCb->pucchCfg.n1PucchAn;
7346 /** @brief This function fills the harq reception request for
7347 * TDD in case of Fomat 1B with CS for M=1
7351 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1
7354 * -Fill Harq Reception Request for Format 1B with
7357 * @param [in] RgSchDlHqProcCb *hqCb
7358 * @param [in] TfuUePucchRecpReq *hqRecpReq
7359 * @param [in] U8 noFdbks
7360 * @param [in] RgSchDlSf *dlSf
7361 * @param [in] RgSchPdcch *pdcch
7362 * @param [in] RgSchCellCb *cellCb
7366 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1
7368 RgSchDlHqProcCb *hqCb,
7369 TfuUePucchRecpReq *hqRecpReq,
7376 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1(hqCb, hqRecpReq,
7377 noFdbks,dlSf,pdcch,cellCb)
7378 RgSchDlHqProcCb *hqCb;
7379 TfuUePucchRecpReq *hqRecpReq;
7383 RgSchCellCb *cellCb;
7386 RgSchUeCb *ue = NULLP;
7387 Bool isCellSec = FALSE;
7390 /*ccpu00147920: UeCb is NULL for SPS activation*/
7391 if(pdcch && pdcch->ue)
7392 {/* SPS Release pdcch or dynamic data */
7399 /* This is not supposed to happen
7400 * Error case. hqCB has to be ter
7401 * when pdcch is present . Adding
7402 * if check bcs of kwork*/
7409 if((hqCb != NULLP) &&
7410 (RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
7415 switch(ue->f1bCsAVal)
7417 case RG_SCH_A_VAL_2:
7418 /* harq(0) is primary harq(1) is secondary) */
7421 hqRecpReq->hqInfo.hqRes[1] = ue->n1PucchF1bResCb.
7422 cw1N1Res[hqCb->tpc].n1PucchIdx;
7424 else/* primary cell */
7427 /* hqCb will be null in case of sps rel pdcch */
7428 if ((hqCb) && hqCb->spsN1PucchRes.pres)
7429 {/* SPS occasion or dyn sched*/
7430 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
7433 #endif /* LTEMAC_SPS */
7434 {/* dyn data or sps release */
7438 /* This is not supposed to happen
7439 * Error case. hqCB has to be ter
7440 * when pdcch is present . Adding
7441 * if check bcs of kwork*/
7446 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7447 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7451 case RG_SCH_A_VAL_3:
7453 /* Serving cell in mimo mode should be
7454 * in 0 and 1 and the serving cell in siso
7455 * mode should be in 2 indices */
7458 U8 servCellIdx = rgSchUtlGetServCellIdx(hqCb->hqE->cell->instIdx,
7459 hqCb->hqE->cell->cellId,
7462 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1)
7463 {/* Sec cell is in mimo mode, use 0 and 1 */
7464 hqRecpReq->hqInfo.hqRes[0] =
7465 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7466 hqRecpReq->hqInfo.hqRes[1] =
7467 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
7470 {/* Sec cell is in siso mode, use 2 */
7471 hqRecpReq->hqInfo.hqRes[2] =
7472 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7476 {/* primary cell hq */
7478 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
7479 {/* prim cell is in mimo mode, use 0 and 1 */
7481 if (hqCb && hqCb->spsN1PucchRes.pres)
7482 {/* Not sps release */
7483 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
7486 #endif /* LTEMAC_SPS */
7487 {/* sps rel or dyn */
7491 /* This is not supposed to happen
7492 * Error case. hqCB has to be ter
7493 * when pdcch is present . Adding
7494 * if check bcs of kwork*/
7499 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7500 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7501 hqRecpReq->hqInfo.hqRes[1] = hqRes + 1;
7505 {/* prim cell is in siso mode use 2 */
7507 /* Consider sps occasions */
7508 if (hqCb && hqCb->spsN1PucchRes.pres)
7509 {/* Not sps release */
7510 hqRecpReq->hqInfo.hqRes[2] = hqCb->spsN1PucchRes.val;
7513 #endif /* LTEMAC_SPS */
7518 /* This is not supposed to happen
7519 * Error case. hqCB has to be ter
7520 * when pdcch is present . Adding
7521 * if check bcs of kwork*/
7526 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7527 hqRecpReq->hqInfo.hqRes[2] = hqRes;
7533 case RG_SCH_A_VAL_4:
7534 {/* Both the serv cells are in mimo mode */
7536 {/* 2 and 3 for sec cell */
7537 hqRecpReq->hqInfo.hqRes[2] =
7538 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7539 hqRecpReq->hqInfo.hqRes[3] =
7540 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
7542 else/* primary cell */
7543 {/* 0 and 1 are for primary cell */
7545 if (hqCb && hqCb->spsN1PucchRes.pres)
7546 {/* Not sps release */
7547 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
7550 #endif /* LTEMAC_SPS */
7555 /* This is not supposed to happen
7556 * Error case. hqCB has to be ter
7557 * when pdcch is present . Adding
7558 * if check bcs of kwork*/
7563 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7564 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7565 hqRecpReq->hqInfo.hqRes[1] = hqRes + 1;
7576 /** @brief This function fills the harq reception request for
7577 * TDD in case of Fomat 1B with CS for M>=2
7581 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234
7584 * -Fill Harq Reception Request for Format 1B with
7587 * @param [in] RgSchDlHqProcCb *hqCb
7588 * @param [in] TfuUePucchRecpReq *hqRecpReq
7589 * @param [in] U8 noFdbks
7590 * @param [in] RgSchDlSf *dlSf
7591 * @param [in] RgSchPdcch *pdcch
7592 * @param [in] RgSchCellCb *cellCb
7593 * @param [in] U8 elemIdx
7597 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234
7599 RgSchDlHqProcCb *hqCb,
7600 TfuUePucchRecpReq *hqRecpReq,
7604 RgSchCellCb *cellCb,
7608 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234(
7609 hqCb,hqRecpReq,noFdbks,dlSf,pdcch,cellCb,elemIdx)
7610 RgSchDlHqProcCb *hqCb;
7611 TfuUePucchRecpReq *hqRecpReq;
7615 RgSchCellCb *cellCb;
7620 Bool isCellSec = FALSE;
7625 {/* SPS Release pdcch or dynamic data */
7632 /* This is not supposed to happen
7633 * Error case. hqCB has to be ter
7634 * when pdcch is present . Adding
7635 * if check bcs of kwork*/
7642 if((hqCb != NULLP) && (ue != NULLP) &&
7643 (RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
7649 {/* Sec Cell indices are 2 and 3*/
7650 servCellIdx = rgSchUtlGetServCellIdx(hqCb->hqE->cell->instIdx,
7651 hqCb->hqE->cell->cellId,
7654 hqRecpReq->hqInfo.hqRes[2] =
7655 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7657 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1)
7659 hqRecpReq->hqInfo.hqRes[3] =
7660 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
7664 {/* Primary cell indices are 0 and 1 */
7666 * M > 2 if SPS occasion is present in any of the
7667 * DL subframe in the bundle, the n1Pucch(0) is
7668 * the SPS resource and n1Pucch(1) is the resource
7669 * derived from pdcch with DAI = 1
7670 * If No SPS Occasion
7671 * Then n1Pucch(0) is from pdcch with DAI =1
7672 * and n1Pucch(1) is from pdcch with DAI = 2
7676 {/* this is not sps release pdcch */
7677 if(hqCb->spsN1PucchRes.pres == TRUE)
7679 hqRes = hqCb->spsN1PucchRes.val;
7684 {/*Dynamic scheduling or SPS Release
7685 Derive from pdcch */
7686 if(pdcch->dlDai < 3)
7687 {/* No need to calcualte from DAI > 2 */
7688 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7694 hqRecpReq->hqInfo.hqRes[elemIdx] = hqRes;
7697 {/* Pdcch with DAI = 1 and 2 needs to be used
7698 for resource calculation*/
7699 if(hqCb && hqCb->spsN1PucchRes.pres == TRUE)
7700 {/* dyn or sps occasion */
7701 /* Shift the hqRes[0] if it was filled
7702 * if there was a pdcch with DAI 1 before to this
7705 {/* SPS occasion happened in the middle
7707 /* shifting the non SPS resource to n1Pucch(1) */
7708 hqRecpReq->hqInfo.hqRes[1] = hqRecpReq->hqInfo.hqRes[0];
7711 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7714 else if(pdcch && pdcch->dlDai < 3)
7716 else if(pdcch->dlDai < 3)
7718 {/* sps rel or dyn sched */
7719 /* hqCb wil not be present for sps release pdcch */
7720 if(hqCb && (pdcch->dlDai != hqCb->ulDai))
7721 {/* there was a SPS occasion before to this */
7722 if(pdcch->dlDai == 1)
7724 hqRecpReq->hqInfo.hqRes[1] = hqRes;
7725 }/* ignore the DAI 2 in this case */
7727 {/* There was no SPS occasion before to this */
7731 {/* Added check to ignore kwork warning */
7732 hqRecpReq->hqInfo.hqRes[(pdcch->dlDai)-1] = hqRes;
7741 /** @brief This function fills the harq reception request for
7742 * TDD in case of Fomat 1B with CS
7746 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCS
7749 * -Fill Harq Reception Request for Format 1B with
7752 * @param [in] RgSchDlSf *ulSf
7753 * @param [in] RgSchCellCb *cell
7754 * @param [out]TfuUePucchRecpReq *hqRecpReq
7758 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS
7760 RgSchDlHqProcCb *hqCb,
7761 TfuUePucchRecpReq *hqRecpReq,
7769 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS(hqCb,hqRecpReq,noFdbks,dlSf,pdcch,
7770 n1PucchTkn,elemIdx,cellCb)
7771 RgSchDlHqProcCb *hqCb;
7772 TfuUePucchRecpReq *hqRecpReq;
7777 RgSchCellCb *cellCb;
7780 /* Update teh fdbk mode if something different is present
7781 * in L1 API file for F1BS *//* 1 --> F1BCS */
7782 hqRecpReq->hqInfo.hqFdbkMode = TFU_ACK_NACK_CHANNEL_SELECTION;
7786 case RG_SCH_M_VAL_1:
7789 rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1(hqCb,hqRecpReq,
7790 noFdbks,dlSf,pdcch,cellCb);
7793 case RG_SCH_M_VAL_2:
7794 case RG_SCH_M_VAL_3:
7795 case RG_SCH_M_VAL_4:
7797 /* Spatial bundling will be applied */
7798 rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234(hqCb,hqRecpReq,
7799 noFdbks,dlSf,pdcch,cellCb,elemIdx);
7809 /***********************************************************
7811 * Func : rgSCHTomUtlFillSfHqFdbkForOneUe
7813 * Desc : Fill HARQ feedback info for one UE/entry
7821 **********************************************************/
7823 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForOneUe
7825 RgSchDlHqProcCb *hqCb,
7826 TfuRecpReqInfo *recpReqInfo,
7827 RgSchCellCb *cellCb,
7835 RgrTddAckNackMode ackNackMode,
7836 RgSchUePucchRecpInfo **pucchInfoRef,
7843 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForOneUe(hqCb,recpReqInfo, cellCb, err, dlSf,
7844 noFdbks, memCp, elemIdx, nxtDlsf, rnti, ackNackMode, pucchInfoRef,
7845 pdcch, n1PucchTkn, allocRef, hqSz)
7846 RgSchDlHqProcCb *hqCb;
7847 TfuRecpReqInfo *recpReqInfo;
7848 RgSchCellCb *cellCb;
7856 RgrTddAckNackMode ackNackMode;
7857 RgSchUePucchRecpInfo **pucchInfoRef;
7864 RgSchUePucchRecpInfo *pucchInfo = *pucchInfoRef;
7867 TfuUePucchRecpReq *hqRecpReq;
7882 Bool isFirstFdbk = FALSE;
7884 if(pucchInfo == NULLP)
7886 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchInfo,
7887 sizeof(RgSchUePucchRecpInfo), memCp)) != ROK)
7889 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to "
7890 "Allocate TfuUeRecpReqInfo for cell RNTI:%d",rnti);
7891 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
7895 #ifdef TFU_ALLOC_EVENT_NO_INIT
7896 pucchInfo->hashLstEnt.hashVal = 0;
7897 pucchInfo->hashLstEnt.keyLen = 0;
7898 pucchInfo->hashLstEnt.key = 0;
7899 pucchInfo->hashLstEnt.list.prev = pucchInfo->hashLstEnt.list.next = 0;
7901 if ((ret = rgSCHUtlGetEventMem((Ptr *)&(pucchInfo->pucchRecpInfo),
7902 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp))) != ROK)
7904 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to "
7905 "Allocate TfuUeRecpReqInfo for cell RNTI:%d",rnti);
7906 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
7909 cmMemset((U8 *)pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes,0xff,sizeof(U16)*TFU_MAX_HQ_RES);
7910 #ifdef TFU_ALLOC_EVENT_NO_INIT
7911 cmMemset((U8 *)&pucchInfo->pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
7913 pucchInfo->pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
7914 pucchInfo->pucchRecpInfo->rnti = rnti;
7916 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo=TFU_PUCCH_HARQ;
7923 /* Calculation of resources same for both bundling and muxing for M = 1
7926 RgSchUeCb *ue = rgSCHDbmGetUeCb (cellCb, rnti);
7927 if((ue) && (1 == ue->numSCells))
7929 if(ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS)
7931 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
7932 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS(hqCb,hqRecpReq,
7933 noFdbks,dlSf,pdcch,elemIdx,cellCb);
7936 {/* M = 1 case . size is same as A Value*/
7937 hqRecpReq->hqInfo.hqSz = ue->f1bCsAVal;
7938 hqRecpReq->hqInfo.pucchResCnt = hqRecpReq->hqInfo.hqSz;
7941 hqRecpReq->hqInfo.hqSz = (noFdbks * 2); /* M for 2 cells */
7942 hqRecpReq->hqInfo.pucchResCnt = 4;
7944 hqRecpReq->hqInfo.a = ue->f1bCsAVal;
7945 /* handling for SPS occasions*/
7948 /* set the datPresinFirstSUbframe to TRUE if this
7949 * is for pcell txion*/
7951 RgSchTddANInfo *anInfo = NULLP;
7953 /* if this txion is on pcell
7954 * sps occaion, dyn sched or sps release pdcch
7955 * set the sched present in first
7956 * dl subframe of the bundle to TRUE. This
7957 * is required for mapping the feedbak when SPS occasion
7958 * is present in any of the DL subframe in the bundle in
7961 /* SPS will happen only on pcell */
7962 if((hqCb == NULLP) || (!RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
7965 anInfo = rgSCHUtlGetUeANFdbkInfo(ue,
7966 &recpReqInfo->timingInfo,RGSCH_PCELL_INDEX);
7968 {/* ANInfo must be there. adding block
7970 RGSCHDBGERRNEW(cellCb->instIdx,(rgSchPBuf(cellCb->instIdx),
7971 "ANInfo should not be NULL for cellId=%d \n", cellCb->cellId));
7979 {/* This needs to be revisited while
7980 adding support for PUCCH format 3 */
7981 RGSCHDBGERRNEW(cellCb->instIdx,(rgSchPBuf(cellCb->instIdx),"Invalid Pucch format configured.."));
7988 if((ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) ||
7989 ((noFdbks == 1) && (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT)))
7991 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
7993 prevHqSize = hqRecpReq->hqInfo.hqSz;
7996 /* Only one index for bundling case */
7997 hqRecpReq->M = noFdbks;
7999 TFU_HQ_RECP_REQ_NORMAL;
8000 hqRecpReq->multCnt = 1;
8001 hqRecpReq->t.nCce[0] =
8006 rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
8008 hqRecpReq->type = TFU_UCI_HARQ;
8010 #else /* TFU_UPGRADE */
8013 if ((TRUE == isFirstFdbk) && (TRUE == n1PucchTkn.pres))
8015 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)ackNackMode;
8016 hqRecpReq->hqInfo.pucchResCnt=1;
8017 hqRecpReq->hqInfo.hqRes[0] = n1PucchTkn.val;
8018 hqRecpReq->hqInfo.hqSz = hqSz;
8021 else if (FALSE == n1PucchTkn.pres)
8024 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)ackNackMode;
8026 P = rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
8027 nP = cellCb->rgSchTddNpValTbl[P];
8028 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
8029 m = dlSf->dlFdbkInfo.m;
8030 /* In case of no UE */
8031 pucchRes = (M - m - 1)* nP + (m * nPlusOne) + pdcch->nCce +
8032 cellCb->pucchCfg.n1PucchAn;
8033 /*ccpu00130164:MOD-Changed to maitain value of
8034 hqRecpReq->hqInfo.pucchResCnt=1 in case of bundling*/
8035 /*ccpu00132284 -MOD- hqRes need to be updated after pucchReCnt set to 1
8036 * and resource should be update at index-0*/
8037 hqRecpReq->hqInfo.pucchResCnt=1;
8038 hqRecpReq->hqInfo.hqRes[hqRecpReq->hqInfo.pucchResCnt-1] = pucchRes;
8040 if((ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) && (hqSz > prevHqSize))
8041 hqRecpReq->hqInfo.hqSz = hqSz;
8042 else if (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT)
8043 hqRecpReq->hqInfo.hqSz = hqSz;
8045 hqRecpReq->hqInfo.hqSz = prevHqSize;
8047 #endif /* TFU_UPGRADE */
8049 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst,
8050 &(pucchInfo->pucchRecpInfo->lnk));
8051 pucchInfo->pucchRecpInfo->lnk.node =
8052 (PTR)pucchInfo->pucchRecpInfo;
8055 else /* Multiplexing */
8058 pucchInfo->pucchRecpInfo->t.pucchRecpReq.M = noFdbks;
8060 if (n1PucchTkn.pres == TRUE)
8062 pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqType =
8063 TFU_HQ_RECP_REQ_N1PUCCH;
8064 pucchInfo->pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = n1PucchTkn.val;
8069 pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqType =
8070 TFU_HQ_RECP_REQ_NORMAL;
8071 multCnt = pucchInfo->pucchRecpInfo->t.pucchRecpReq.multCnt;
8072 pucchInfo->pucchRecpInfo->t.pucchRecpReq.t.nCce[multCnt] =
8074 pucchInfo->pucchRecpInfo->t.pucchRecpReq.m[multCnt] =
8076 pucchInfo->pucchRecpInfo->t.pucchRecpReq.p[multCnt] =
8077 rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
8079 pucchInfo->pucchRecpInfo->t.pucchRecpReq.multCnt++;
8081 #else /* TFU_UPGRADE */
8083 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
8084 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)RGR_TDD_ACKNACK_MODE_MULT;
8085 hqRecpReq->hqInfo.hqSz = noFdbks;
8087 resIdx = hqRecpReq->hqInfo.pucchResCnt;
8088 hqRecpReq->hqInfo.pucchResCnt++;
8091 if (n1PucchTkn.pres == TRUE)
8093 hqRecpReq->hqInfo.hqRes[resIdx] = n1PucchTkn.val;
8099 m = dlSf->dlFdbkInfo.m;
8101 P = rgSCHCmnGetPValFrmCCE(cellCb, nCce);
8102 nP = cellCb->rgSchTddNpValTbl[P];
8103 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
8104 hqRecpReq->hqInfo.hqRes[resIdx] = (M - m - 1)* nP +
8105 (m * nPlusOne) + pdcch->nCce +
8106 cellCb->pucchCfg.n1PucchAn;
8108 #endif /* TFU_UPGRADE */
8109 /* If all the DL subframes are scanned, then
8110 * send TFU request*/
8112 if((elemIdx != noFdbks) && alloc)
8114 cmHashListInsert(&cellCb->ueTfuPendLst, (PTR) pucchInfo,
8115 (U8 *)&rnti, (U16) sizeof(rnti));
8120 pucchInfo->pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
8121 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst,
8122 &(pucchInfo->pucchRecpInfo->lnk));
8123 pucchInfo->pucchRecpInfo->lnk.node =
8124 (PTR)pucchInfo->pucchRecpInfo;
8125 /* Delete the entry after addition to the list */
8126 cmHashListDelete(&cellCb->ueTfuPendLst, (PTR) pucchInfo);
8132 *pucchInfoRef = pucchInfo;
8138 #ifdef RG_ULSCHED_AT_CRC
8139 /** @brief This function does all the processing related to a single downlink
8144 * Function: rgSCHTomUtlProcDlSfAtCrc
8147 * - collate control data for all UEs and send to PHY
8148 * - collate data buffers for all UEs and send to PHY
8150 * @param [in] RgSchDlSf *ulSf
8151 * @param [in] RgSchCellCb *cell
8152 * @param [in] TfuCntrlReqInfo *cntrlInfo
8153 * @param [out] RgSchErrInfo *err
8157 PRIVATE S16 rgSCHTomUtlProcDlSfAtCrc
8160 CmLteTimingInfo crntUlFrm,
8162 TfuCntrlReqInfo *cntrlInfo,
8166 PRIVATE S16 rgSCHTomUtlProcDlSfAtCrc (ulSf, crntUlFrm, cell, cntrlInfo, err)
8168 CmLteTimingInfo crntUlFrm;
8170 TfuCntrlReqInfo *cntrlInfo;
8174 Inst inst = cell->instIdx;
8177 TRC2(rgSCHTomUtlProcDlSfAtCrc);
8180 cntrlInfo->numDlActvUes = 0;
8181 cmLListInit(&cntrlInfo->phichLst);
8182 cmLListInit(&cntrlInfo->dlPdcchLst);
8183 cmLListInit(&cntrlInfo->ulPdcchLst);
8184 #ifdef TFU_ALLOC_EVENT_NO_INIT
8185 cntrlInfo->dlTiming.sfn = cntrlInfo->dlTiming.subframe = 0;
8189 cntrlInfo->ulTiming = crntUlFrm;
8190 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cntrlInfo->ulTiming, TFU_ULCNTRL_DLDELTA);
8192 cntrlInfo->cellId = cell->cellId;
8193 /* Fill PHICH info */
8194 if ((ret = rgSCHTomUtlFillPhich (cell, cntrlInfo, ulSf, err)) != ROK)
8196 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send PHICH info for "
8198 RGSCH_FREE_MEM(cntrlInfo);
8203 if ((ret = rgSCHTomUtlFillUlPdcch (cell, cntrlInfo, ulSf, err)) != ROK)
8205 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send PDCCH info for "
8207 RGSCH_FREE_MEM(cntrlInfo);
8212 if(0 == cntrlInfo->ulMpdcchLst.count)
8219 if ((cntrlInfo->ulPdcchLst.count || cntrlInfo->phichLst.count) || RG_SCH_EMTC_GET_PDCCHLST_CNT(cntrlInfo))
8221 if (cntrlInfo->ulPdcchLst.count || cntrlInfo->phichLst.count)
8224 if (rgSCHUtlTfuCntrlReq(inst, cell->tfuSap->sapCfg.suId, cntrlInfo)
8227 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info for"
8233 RGSCH_FREE_MEM(cntrlInfo);
8238 #endif /* #ifdef RG_ULSCHED_AT_CRC*/
8241 /** @brief This function sends the SFN Tick to L3
8246 * Function: rgSCHTomUtlSendSfnTick
8248 * @param [in] RgSchCellCb *cell
8251 PRIVATE Void rgSCHTomUtlSendSfnTick
8256 PRIVATE Void rgSCHTomUtlSendSfnTick (cell)
8260 RgrTtiIndInfo *rgrTtiInd;
8262 TRC2(rgSCHTomUtlSendSfnTick);
8264 /* TTI to be sent to RRM only once per system frame */
8265 /* Added support for period = 0 to disable tick to RRM */
8266 if ((cell->rrmTtiIndPrd != 0) &&
8267 ((cell->crntTime.sfn % cell->rrmTtiIndPrd) == 0) &&
8268 (cell->crntTime.slot == 0))
8270 /* Allocate a TTI indication structure and send to RRM over RGR interface */
8271 if (rgSCHUtlAllocSBuf (cell->instIdx,
8272 (Data**)&rgrTtiInd, sizeof(RgrTtiIndInfo)) != ROK)
8274 RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),
8275 "Mem alloc failed for RGR TTI ind, cellId (%d))\n",
8279 rgrTtiInd->cellId = cell->cellId;
8280 //rgrTtiInd->hSfn = cell->crntTime.hSfn;
8281 rgrTtiInd->sfn = cell->crntTime.sfn;
8283 if (rgSCHUtlRgrTtiInd (cell, rgrTtiInd) != ROK)
8285 RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),
8286 "Failed to send RGR TTI ind, cellId (%d))\n",
8288 rgSCHUtlFreeSBuf(cell->instIdx, (Data**)&rgrTtiInd,
8289 sizeof(RgrTtiIndInfo));
8299 /* @brief Mark Dyn TDD CrntSfIdx.
8303 * Function: rgSCHDynTDDMrkCrntSfIdx
8304 * Purpose: update the dyn tdd sunframe index
8305 * @param[in] Inst schInst
8310 PRIVATE Void rgSCHDynTDDMrkCrntSfIdx
8315 PRIVATE Void rgSCHDynTDDMrkCrntSfIdx(schInst)
8319 RgSchDynTddCb *rgSchDynTddInfo = &(rgSchCb[schInst].rgSchDynTdd);
8321 TRC2(rgSCHDynTDDMrkCrntSfIdx)
8323 RG_SCH_DYN_TDD_MARKTYPE(rgSchDynTddInfo, rgSchDynTddInfo->crntDTddSfIdx,
8324 RG_SCH_DYNTDD_NOTDEF);
8325 rgSchDynTddInfo->crntDTddSfIdx = (rgSchDynTddInfo->crntDTddSfIdx + 1) %
8326 RG_SCH_DYNTDD_MAX_SFINFO;
8328 //printf("Initializing Index %d \n", rgSchDynTddInfo->crntDTddSfIdx);
8334 /** @brief This function fills the TTI timinig info for each cell
8338 * Function: rgSchTomFillCellTtiInfo
8340 * @param [in] TfuTtiIndInfo *ttiInd
8341 * @param [in] Inst schInst
8342 * @param [out] U8 *nCell
8343 * @param [out] RgSchCellCb *cell[]
8350 PRIVATE Void rgSchTomFillCellTtiInfo
8352 TfuTtiIndInfo *ttiInd,
8355 RgSchCellCb *cells[]
8358 PRIVATE Void rgSchTomFillCellTtiInfo (ttiInd, schInst, nCell, cells)
8359 TfuTtiIndInfo *ttiInd;
8362 RgSchCellCb *cells[];
8367 TfuTtiCellInfo *cellInfo;
8371 CmLteTimingInfo frm;
8373 TRC2 (rgSchTomFillCellTtiInfo);
8375 if (CM_LTE_MAX_CELLS < ttiInd->numCells)
8381 rgSCHDynTDDMrkCrntSfIdx(schInst);
8384 for (i = 0; i < ttiInd->numCells; i++)
8386 cellInfo = &ttiInd->cells[i];
8387 strtCellId = rgSchCb[schInst].genCfg.startCellId;
8388 Idx1 = (U8)((cellInfo->cellId - strtCellId)&(CM_LTE_MAX_CELLS-1));
8389 cell = rgSchCb[schInst].cells[Idx1];
8390 /* Validate the cell */
8393 /* Use SCH inst 0 print buff */
8394 RGSCHDBGERRNEW(schInst,(rgSchPBuf(schInst),
8395 "RgLiTfuTtiInd()No cell exists for cellId %d\n",
8399 *nCell = *nCell + 1;
8400 cells[i] = (RgSchCellCb *)cell;
8403 if(cell->schTickDelta != cellInfo->schTickDelta)
8405 printf("\nMukesh: Delta changed for cellId=%d: curr delta=%d new delta=%d\n"
8406 "dlblankSf=%d ulblankSf=%d dummyTti=%d \n",
8407 cell->cellId, cell->schTickDelta, cellInfo->schTickDelta, cellInfo->dlBlankSf,cellInfo->ulBlankSf,
8408 cellInfo->isDummyTti);
8410 RGSCH_UPDATE_DELTA(schInst, cellInfo->schTickDelta);
8411 cell->schTickDelta = cellInfo->schTickDelta;
8414 cell->stopSiSch = cellInfo->dlBlankSf;
8415 cell->stopDlSch = cellInfo->dlBlankSf;
8416 cell->stopUlSch = cellInfo->ulBlankSf;
8417 if (cellInfo->isDummyTti)
8419 cell->stopDlSch = TRUE;
8421 if((0 == (cellInfo->timingInfo.sfn % 30)) && (0 == cellInfo->timingInfo.slot))
8423 //printf("5GTF_CHECK rgSCHTOMTtiInd (%d : %d)\n", cellInfo->timingInfo.sfn, cellInfo->timingInfo.slot);
8426 RGSCHCPYTIMEINFO(cellInfo->timingInfo, cell->crntTime);
8427 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->hiDci0Time,
8428 TFU_ULCNTRL_DLDELTA);
8429 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->dlDciTime,
8430 TFU_DLCNTRL_DLDELTA);
8431 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->rcpReqTime,
8432 TFU_RECPREQ_DLDELTA);
8433 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->hqRlsTime,
8434 TFU_HQFBKIND_ULDELTA);
8435 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->dlSfRlsTime,
8438 RGSCHCPYTIMEINFO_EMTC(cellInfo->timingInfo, cell->crntTime);
8439 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->hiDci0Time,
8440 TFU_ULCNTRL_DLDELTA);
8441 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->dlDciTime,
8442 TFU_DLCNTRL_DLDELTA);
8443 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->rcpReqTime,
8444 TFU_RECPREQ_DLDELTA);
8445 RGSCHDECRFRMCRNTTIME_EMTC(cell->crntTime, cell->hqRlsTime,
8446 TFU_HQFBKIND_ULDELTA);
8447 RGSCHDECRFRMCRNTTIME_EMTC(cell->crntTime, cell->dlSfRlsTime,
8450 rgSCHCmnUpdVars(cell);
8451 cell->isDlDataAllwd = TRUE;
8452 /* Get DownLink SubFrame */
8453 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
8454 frm = cell->crntTime;
8456 RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA);
8458 RGSCH_INCR_SUB_FRAME_EMTC(frm, RG_SCH_CMN_DL_DELTA);
8460 cellSch->dl.time = frm;
8466 U8 idx = (cell->crntTime.slot + RG_SCH_CMN_DL_DELTA) %
8467 RGSCH_NUM_SUB_FRAMES_5G;
8469 cell->isDlDataAllwd = RG_SCH_CMN_CHK_DL_DATA_ALLOWED(cell, idx);
8471 /*ccpu00130639 -ADD - used in UL HARQ proc id calculation*/
8472 if((cell->crntTime.sfn == 0) && (cell->crntTime.slot == 0))
8474 /* sfn Cycle used for Tdd UL Harq Proc Determination.
8475 This sfn Cycle will have values from 0 to numUl Harq-1. */
8476 cell->tddHqSfnCycle = (cell->tddHqSfnCycle + 1 ) %
8477 (rgSchTddUlNumHarqProcTbl[cell->ulDlCfgIdx]);
8481 if(cell->emtcEnable)
8483 rgSCHUtlEmtcResPrcTti(cell);
8489 void schFillCrntTime(
8490 SlotIndInfo slotInd,
8494 for(cellCount = 0; cellCount < CM_LTE_MAX_CELLS; cellCount++)
8497 cell = rgSchCb[schInst].cells[cellCount];
8499 RGSCHCPYTIMEINFO(slotInd, cell->crntTime);
8501 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->hiDci0Time,
8502 TFU_ULCNTRL_DLDELTA);
8503 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->dlDciTime,
8504 TFU_DLCNTRL_DLDELTA);
8505 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->rcpReqTime,
8506 TFU_RECPREQ_DLDELTA);
8507 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->hqRlsTime,
8508 TFU_HQFBKIND_ULDELTA);
8509 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->dlSfRlsTime,
8512 RGSCH_INCR_SUB_FRAME(cell->crntTime, RG_SCH_CMN_DL_DELTA);
8514 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
8515 cellSch->dl.time = cell->crntTime;
8519 /** @brief This function prepares the TTI for scheduling and
8520 * invokes the Common channel scheduler. Uplink scheduler
8521 * is invoked first if UL Scheduling at CRC is not enabled
8525 * Function: rgSchTomTtiUlAndDlCmnChSch
8527 * @param [out] RgSchCellCb *cell
8533 PRIVATE Void rgSchTomTtiUlAndDlCmnChSch
8538 PRIVATE Void rgSchTomTtiUlAndDlCmnChSch (cell)
8543 TRC2(rgSchTomTtiUlAndDlCmnChSch);
8545 cell->rlsHqArr[cell->crntHqIdx].numUes = 0;
8547 cell->crntHqIdx = cell->crntHqIdx % RGSCH_NUM_SUB_FRAMES;
8549 cmPrcTmr(&cell->tqCp, cell->tq, (PFV)rgSCHTmrProcTmr);
8550 rgSCHMeasGapANRepTtiHndl (cell);
8551 /* We need to fill the PHICH for the UL Data, first we need to get the UL
8552 * SF from Scheduler, next we fill the dlSf that goes out this TTI.
8553 * This must be performed prior to any other processing of the TTI
8554 * so that we do not wrap around and generate feedback prior to
8555 * reception of UL data.
8557 #ifndef RG_ULSCHED_AT_CRC
8560 U8 idx; /* Index into Uplink Sf array */
8562 Mval = rgSchTddPhichMValTbl[cell->ulDlCfgIdx]
8563 [cell->hiDci0Time.subframe];
8567 for(idx=0; idx < Mval; idx++)
8569 rgSCHCmnRlsUlSf(cell, idx);
8575 /* DTX processing for those Harq's which did not get feedback from L1 */
8576 rgSCHDhmRlsDlsfHqProc (cell, cell->hqRlsTime);
8577 /* Re-Init the Downlink subframe */
8578 rgSCHUtlDlRlsSubFrm(cell, cell->dlSfRlsTime);
8579 /* Added handling to retransmit
8580 * release PDCCH in case of DTX
8583 /*Check for DRX every TTI*/
8584 rgSCHDrxTtiInd(cell);
8586 /* For TDD, UL scheduling should happen after DL scheduling */
8588 #ifndef RG_ULSCHED_AT_CRC
8589 /* Perform UL scheduling */
8590 rgSCHCmnUlSch(cell);
8593 /* Perform DL scheduling for Common channels */
8594 rgSCHCmnDlCommonChSch(cell);
8599 /** @brief This function invokes the Non critical procedures like measurements,
8600 * and RGR configurations.
8604 * Function: rgSchTomTtiMiscFunctions
8606 * @param [in] RgSchCellCb *cell
8612 PRIVATE Void rgSchTomTtiMiscFunctions
8617 PRIVATE Void rgSchTomTtiMiscFunctions (cell)
8621 U8 suId = cell->tfuSap->sapCfg.suId;
8623 TRC2(rgSchTomTtiMiscFunctions);
8625 /* Invoke RAM Tti Handler */
8626 rgSCHRamTtiHndlr(cell);
8628 /* Handle RGR configurations */
8629 rgSCHGomTtiHndlr(cell, suId);
8631 if((RGM_PRB_REPORT_START == cell->prbUsage.prbRprtEnabld)
8632 && (!(cell->prbUsage.rprtPeriod) || ((glblTtiCnt % cell->prbUsage.rprtPeriod) == 0)))
8634 rgSCHUtlUpdAvgPrbUsage(cell);
8636 rgSCHL2Meas(cell,FALSE);
8639 /* LTE_ADV_FLAG_REMOVED_START */
8640 /* Report ABS Load information to application periodically */
8641 if((RGR_ENABLE == cell->lteAdvCb.absCfg.status) &&
8642 (cell->lteAdvCb.absCfg.absLoadPeriodicity))
8644 RgrLoadInfIndInfo *rgrLoadInf;
8647 cell->lteAdvCb.absLoadTtiCnt++;
8648 if(cell->lteAdvCb.absLoadTtiCnt >= cell->lteAdvCb.absCfg.absLoadPeriodicity)
8651 if(rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&rgrLoadInf,
8652 sizeof(RgrLoadInfIndInfo)) != ROK)
8654 RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),"Could not "
8655 "allocate memory for sending LoadInfo\n"));
8658 cell->lteAdvCb.absLoadTtiCnt = 0;
8659 rgrLoadInf->cellId = cell->cellId;
8660 rgrLoadInf->bw = cell->bwCfg.dlTotalBw;
8661 rgrLoadInf->type = RGR_ABS;
8662 for(idx= 0; idx<RGR_ABS_PATTERN_LEN; idx++)
8664 rgrLoadInf->u.absLoadInfo[idx] = cell->lteAdvCb.absLoadInfo[idx];
8665 cell->lteAdvCb.absLoadInfo[idx] = 0;
8667 rgSCHUtlRgrLoadInfInd(cell, rgrLoadInf);
8672 if(cell->isDlDataAllwd)
8674 /* Calling function to update CFI parameters*/
8675 rgSchCmnUpdCfiDb(cell, RG_SCH_CMN_DL_DELTA);
8679 /* Incrementing the ttiCnt in case of UL subframe */
8680 if(!cell->dynCfiCb.switchOvrInProgress)
8682 cell->dynCfiCb.ttiCnt++;
8686 rgSchCmnUpdCfiDb(cell, RG_SCH_CMN_DL_DELTA);
8689 /* LTE_ADV_FLAG_REMOVED_END */
8694 /** @brief This function invokes the Downlink scheduler
8698 * Function: rgSchTomTtiDlSch
8700 * @param [in] RgSchCellCb *cell
8706 PRIVATE Void rgSchTomTtiDlSch
8711 PRIVATE Void rgSchTomTtiDlSch (cell)
8715 TRC2(rgSchTomTtiDlSch);
8717 if (cell->isDlDataAllwd && (cell->stopDlSch == FALSE))
8719 rgSCHCmnDlSch(cell);
8725 /** @brief This function invokes Consolidates the allocations
8726 * send the Subframe allocation info to MAC
8730 * Function: rgSchTomTtiCnsldtSfAlloc
8732 * @param [in] RgSchCellCb *cell
8738 PRIVATE Void rgSchTomTtiCnsldtSfAlloc
8743 PRIVATE Void rgSchTomTtiCnsldtSfAlloc (cell)
8748 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
8750 dlSf = rgSCHUtlSubFrmGet(cell, cellSch->dl.time);
8752 TRC2(rgSchTomTtiCnsldtSfAlloc);
8754 /* Prepare Subframe allocation info and send to MAC */
8755 rgSCHCmnCnsldtSfAlloc(cell);
8757 /* Call ACK NACK module to add to dlsf Queue */
8758 rgSCHAckNakRepAddToQ(cell, dlSf);
8760 rgSCHTomUtlProcTA(cell);
8765 /** @brief This function prepares the DL and UL Config requests
8770 * Function: rgSchTomTtiL1DlAndUlCfg
8772 * @param [in] RgSchCellCb *cell
8778 PRIVATE Void rgSchTomTtiL1DlAndUlCfg
8781 RgTfuCntrlReqInfo *cntrlInfo
8784 PRIVATE Void rgSchTomTtiL1DlAndUlCfg (cell, cntrlInfo)
8786 RgTfuCntrlReqInfo *cntrlInfo;
8789 RgSchDlSf *dlSf = rgSCHUtlSubFrmGet (cell, cell->dlDciTime);
8790 RgSchDlSf *ulSf = rgSCHUtlSubFrmGet (cell, cell->hiDci0Time);
8793 TRC2(rgSchTomTtiL1DlAndUlCfg);
8795 rgSCHTomUtlProcDlSf (dlSf, ulSf, cell, cntrlInfo, &err);
8796 /* Mark this frame as sent */
8797 dlSf->txDone = TRUE;
8799 rgBwAlloInfo[dlSf->sfNum] += dlSf->bwAssigned;
8800 rgBwAlcnt[dlSf->sfNum] ++;
8804 rgSCHTomUtlProcTddUlSf(cell);
8806 rgSCHTomUtlProcUlSf (cell, &err);
8812 /** @brief This function prepares does the Downlink subframe re-init and
8813 * Harq DTX processing
8817 * Function: rgSchTomUtlTddRlsSfAndHarq
8819 * @param [in] RgSchCellCb *cell
8825 PRIVATE Void rgSchTomUtlTddRlsSfAndHarq
8830 PRIVATE Void rgSchTomUtlTddRlsSfAndHarq (cell)
8834 TRC2(rgSchTomUtlTddRlsSfAndHarq);
8836 /* ccpu00132341-MOD- rgSchTddRlsDlSubfrmTbl is dependent on DELTA(=2).
8837 * Instead rgSchTddDlAscSetIdxKTbl can be used as the K set gives proper
8839 /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper
8840 * output if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME()
8841 * as it is serving the purpose */
8842 if(rgSchTddDlAscSetIdxKTbl[cell->ulDlCfgIdx][cell->hqRlsTime.subframe].
8845 /* ccpu00132341-MOD- Providing the UL SF timing for avoiding
8846 * calculation inside the function */
8847 rgSCHDhmTddRlsSubFrm(cell, cell->hqRlsTime);
8848 rgSCHDhmRlsDlsfHqProc(cell, cell->hqRlsTime);
8853 /** @brief This function processes the UL subframe and fills TFU reception
8858 * Function: rgSCHTomUtlProcTddUlSf
8860 * @param [in] RgSchCellCb *cell
8866 PRIVATE Void rgSCHTomUtlProcTddUlSf
8871 PRIVATE Void rgSCHTomUtlProcTddUlSf (cell)
8877 TRC2(rgSCHTomUtlProcTddUlSf);
8879 if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
8880 [cell->rcpReqTime.subframe] == RG_SCH_TDD_UL_SUBFRAME)
8882 if (rgSCHTomUtlProcUlSf (cell, &err) != ROK)
8884 /* fill in err type and call sta ind */
8885 RGSCHDBGERRNEW(cell->instIdx, (rgSchPBuf(cell->instIdx),
8886 "Unable to process Uplink subframe for cellId (%d))\n",
8890 /* TDD Fix , to allow Special SF SRS CFg */
8891 else if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
8892 [cell->rcpReqTime.subframe] == RG_SCH_TDD_SPL_SUBFRAME)
8894 if (rgSCHTomUtlPrcUlTddSpclSf(cell, &err) != ROK)
8896 /* fill in err type and call sta ind */
8897 RGSCHDBGERRNEW(cell->instIdx, (rgSchPBuf(cell->instIdx),
8898 "Unable to process Sipceial subframe for cellId (%d))\n",
8908 /**********************************************************************
8911 **********************************************************************/