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;
308 PRIVATE S16 rgSCHTomUtlFillCqiRiRecpReq ARGS(
310 TfuRecpReqInfo *recpReqInfo,
319 PUBLIC U32 rgBwAlloInfo[RGSCH_NUM_SUB_FRAMES]; /* Num of Rbs Allocated in each SF */
320 PUBLIC U32 rgBwAlcnt[RGSCH_NUM_SUB_FRAMES]; /*Num of times Allocation done in each Subframe */
323 /* rg006.201: [ccpu000111706, ccpu00112394]: Separated UL and DL TTI
330 U32 gDlNumUePerTti[20] = {0};
331 U32 gUlNumUePerTti[20] = {0};
332 PRIVATE S16 rgSCHTomUtlProcDlSf ARGS((
336 RgTfuCntrlReqInfo *cntrlInfo,
338 #ifdef RG_ULSCHED_AT_CRC
339 PRIVATE S16 rgSCHTomUtlProcDlSfAtCrc ARGS((
341 CmLteTimingInfo crntUlFrm,
343 TfuCntrlReqInfo *cntrlInfo,
345 #endif /* RG_ULSCHED_AT_CRC */
348 PRIVATE S16 rgSCHTomUtlPrcUlTddSpclSf ARGS((
351 #endif /* TFU_UPGRADE */
353 PRIVATE S16 rgSCHTomUtlFillPhich ARGS((
355 TfuCntrlReqInfo *cntrlInfo,
359 PRIVATE S16 rgSCHTomUtlFillDlPdcch ARGS((
361 TfuCntrlReqInfo *cntrlInfo,
364 PRIVATE S16 rgSCHTomUtlFillUlPdcch ARGS((
366 TfuCntrlReqInfo *cntrlInfo,
370 PRIVATE S16 rgSCHTomUtlProcTA ARGS((
373 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq ARGS((
374 TfuRecpReqInfo *recpReq,
379 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq ARGS((
380 TfuRecpReqInfo *recpReq,
386 PUBLIC S16 rgSCHTomFillOnlySrsRecpReq ARGS
390 TfuUeRecpReqInfo *datRecpInfo
393 PRIVATE S16 rgSCHTomUtlFillCqiSrsWithSr ARGS
397 TfuRecpReqInfo *recpReqInfo,
398 TfuUeRecpReqInfo *pucchRecpInfo,
402 PRIVATE S16 rgSCHTomUtlFillCqiSrSrsWithHq ARGS
405 TfuRecpReqInfo *recpReqInfo,
407 TfuUeRecpReqInfo *pucchRecpInfo,
409 Bool isDatPresOnSecCell
412 PUBLIC S16 rgSCHTomUtlFillRiBitWidthInfo ARGS
417 PUBLIC U8 rgSCHTomUtlFetchPcqiBitSz ARGS
424 PUBLIC U8 rgSCHTomUtlFetchPcqiBitSzPucchMode21 ARGS
427 TfuCqiPucchMode21 *mode21Info,
432 PUBLIC S16 rgSCHTomUtlMoveNxtOccasion ARGS
439 PRIVATE S16 rgSCHTomUtlMovePcqiNxtOccasion ARGS
446 PRIVATE S16 rgSCHTomUtlMovePriNxtOccasion ARGS
453 PRIVATE S16 rgSCHTomUtlMoveSrNxtOccasion ARGS
459 PRIVATE S16 rgSCHTomUtlMoveSrsNxtOccasion ARGS
465 PRIVATE Bool rgSCHTomUtlFillDatHarqRecpReq ARGS
469 TfuUeRecpReqInfo *datRecpInfo,
470 TfuRecpReqInfo *recpReqInfo
473 PRIVATE S16 rgSCHTomUtlFillSrRecpReq ARGS((
474 TfuRecpReqInfo *recpReq,
479 PRIVATE S16 rgSCHTomUtlWillUeRprtCqiRi ARGS((
481 Bool *willueRprtCqiRii));
483 PRIVATE S16 rgSCHTomUtlFillRiRecpReq ARGS((
484 TfuRecpReqInfo *recpReq,
489 PRIVATE S16 rgSCHTomUtlFillPcqiRecpReq ARGS((
490 TfuRecpReqInfo *recpReq,
495 PRIVATE S16 rgSCHTomUtlFillSrsRecpReq ARGS((
496 TfuRecpReqInfo *recpReq,
501 PRIVATE S16 rgSCHTomUtlGenIndices ARGS((
506 TfuSubbandInfo* sbInfo));
510 PRIVATE S16 rgSCHTomUtlFillDatRecpReq ARGS((
511 TfuRecpReqInfo *recpReq,
516 PRIVATE S16 rgSCHTomUtlFillDatRecpReq ARGS((
517 TfuRecpReqInfo *recpReq,
524 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk ARGS((
525 TfuRecpReqInfo *recpReqInfo,
536 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk ARGS((
537 TfuRecpReqInfo *recpReqInfo,
548 PRIVATE S16 rgSCHTomUtlFillSfHqFdbk ARGS((
549 TfuRecpReqInfo *recpReqInfo,
560 PRIVATE S16 rgSCHTomUtlFillSfHqFdbk ARGS((
561 TfuRecpReqInfo *recpReqInfo,
572 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForOneUe ARGS((
573 RgSchDlHqProcCb *hqCb,
574 TfuRecpReqInfo *recpReqInfo,
583 RgrTddAckNackMode ackNackMode,
584 RgSchUePucchRecpInfo **pucchInfoRef,
592 EXTERN PUBLIC Void rgSCHCmnDlSpsSch (RgSchCellCb *cell);
595 PRIVATE S16 rgSCHTomCnsdrRelPdcch ARGS
599 TfuRecpReqInfo *recpReqInfo,
604 PRIVATE S16 rgSCHTomCnsdrRelPdcch ARGS
608 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,
656 PRIVATE Void rgSchTomUtlTddRlsSfAndHarq ARGS
660 PRIVATE Void rgSCHTomUtlProcTddUlSf ARGS
665 PRIVATE Void rgSCHTomUtlGethqRes ARGS
673 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1 ARGS
675 RgSchDlHqProcCb *hqCb,
676 TfuUePucchRecpReq *hqRecpReq,
682 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234 ARGS
684 RgSchDlHqProcCb *hqCb,
685 TfuUePucchRecpReq *hqRecpReq,
695 PUBLIC U32 rgDlCqiRptCnt[16], rgTotDlCqiRpt;
698 U32 rgSch5gtfCqi2Mcs[15] =
699 {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14};
701 /* forward references */
703 /*HARQ Feedback interpretation in accordance with Femto Forum.
704 Note: There is no value as '0' in Femto Forum Spec but in order to retain
705 the existing usage in MAC (and its Acceptance), its being considered*/
706 CONSTANT PRIVATE U8 rgSchTomHqFbkMap[8] = {0,1,0,0,4,4,4,4};
707 /*added #defines instead of magic numbers*/
708 CONSTANT PRIVATE U32 rgSCHTomBinCoe[RG_SCH_MAX_NUM_UE_SEL_SUBBANDS][RG_SCH_MAX_TOT_NUM_SUBBANDS]={
709 {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},
710 {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},
711 {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},
712 {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},
713 {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},
714 {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}
718 /*ccpu00116923 - ADD - SRS present support*/
719 /*Tables Derived from 3GPP TS 36.211 Section 5.5.3.3 */
720 /* Table 5.5.3.3-1 */
722 CONSTANT PUBLIC RgSchFddCellSpSrsSubfrmTbl rgSchFddCellSpSrsSubfrmTbl = {
723 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE},
724 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE},
725 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE},
726 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE},
727 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
728 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE},
729 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE},
730 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE},
731 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE},
732 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
733 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
734 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
735 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
736 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE},
737 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE},
738 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}
741 /* Table 5.5.3.3-2 */
742 CONSTANT PUBLIC RgSchTddCellSpSrsSubfrmTbl rgSchTddCellSpSrsSubfrmTbl = {
743 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
744 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE},
745 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE},
746 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE},
747 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE},
748 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE},
749 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE},
750 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE},
751 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
752 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
753 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE},
754 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE},
755 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE},
756 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE},
757 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
758 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}
761 PUBLIC S8 rgSchCmnAper20n22DiffCqi[4] = {1, 2, 3, 4};
762 PUBLIC S8 rgSchCmnAper30n31DiffCqi[4] = {0, 1, 2, -1};
766 * @brief get Ue for dedicated preamble rach
770 * Function: rgSCHGetDedPrmUe
772 * Invoked by: rgSCHTomRaReqInd
774 * @param[in] RgSchCellCb *cell
775 * @param[in] TfuRaReqIndInfo *raReqInd
781 PUBLIC S16 rgSCHGetDedPrmUe
785 CmLteTimingInfo timingInfo,
789 PUBLIC S16 rgSCHGetDedPrmUe(cell, rapId, timingInfo, ue)
792 CmLteTimingInfo timingInfo;
796 RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch);
798 printf("rapId[%d] cellSch->rachCfg.dedPrmStart[%d] cellSch->rachCfg.numDedPrm[%d]\n",rapId,cellSch->rachCfg.dedPrmStart,cellSch->rachCfg.numDedPrm);
799 /* Finding UE in handOver List */
800 if ((rapId < cellSch->rachCfg.dedPrmStart) ||
801 (rapId > cellSch->rachCfg.dedPrmStart +
802 cellSch->rachCfg.numDedPrm - 1))
804 /* This ded Preamble corresponds to handover */
805 *ue = rgSCHCmnGetHoUe(cell, rapId);
806 printf(" his ded Preamble corresponds to hando\n");
808 else/* Finding UE from PDCCH Order Mappings */
810 /* Get the UE which has transmitted this RaReq */
811 *ue = rgSCHCmnGetPoUe(cell, rapId, timingInfo);
812 printf(" ==== inding UE from PDCCH Order Mapping\n");
817 * @brief Handler for processing Random Access request indication
822 * Function: rgSCHTomRaReqInd
824 * Handler for processing Random Access request indication recieved from
827 * Invoked by: RgLiTfuRaReqInd of LIM
830 * - Validate the information received: cellId value and raRnti values
831 * - Process the request: Call rgSCHRamProcRaReq (cell, raRnti, raReqInd)
833 * @param[in] RgSchCellCb *cell
834 * @param[in] TfuRaReqIndInfo *raReqInd
840 PUBLIC S16 rgSCHTomRaReqInd
843 TfuRaReqIndInfo *raReqInd
846 PUBLIC S16 rgSCHTomRaReqInd(cell, raReqInd)
848 TfuRaReqIndInfo *raReqInd;
855 Bool isEmtcUe = FALSE;
857 RgSchUeCb *ue = NULLP;
859 TRC2(rgSCHTomRaReqInd);
861 if(cell->cellId != raReqInd->cellId)
863 err.errType = RGSCHERR_TOM_RAREQIND;
864 err.errCause = RGSCHERR_TOM_INV_CELL_ID;
865 RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,
866 "rgSCHTomRaReqInd(): No cell found with raReq cellId = (%d) errorType (%d)"
867 " errorCause(%d)",raReqInd->cellId, err.errType, err.errCause);
871 for (raRntiCnt = 0; raRntiCnt < raReqInd->nmbOfRaRnti; raRntiCnt++)
873 for (raReqCnt = 0; raReqCnt < raReqInd->rachInfoArr->numRaReqInfo; raReqCnt++)
875 rapId = raReqInd->rachInfoArr[raRntiCnt].raReqInfoArr[raReqCnt].rapId;
877 if(RGSCH_IS_DEDPRM(cell, rapId))
879 rgSCHGetDedPrmUe(cell, rapId, raReqInd->timingInfo, &ue);
882 /* Since rapId is within dedicated range and No ue context
883 * is found means it is a spurious rach. So ignore it.*/
888 if(FALSE == isEmtcUe)
890 #if (ERRCLASS & ERRCLS_DEBUG)
891 if(raReqInd->rachInfoArr[raRntiCnt].raRnti > RGSCH_MAX_RA_RNTI)
893 RGSCHLOGERROR(cell->instIdx, ERRCLS_INT_PAR, ERG013,
894 (ErrVal)raReqInd->rachInfoArr[raRntiCnt].raRnti,
895 ("rgSCHTomRaReqInd(): raRnti is out of range\n"));
899 ret = rgSCHRamProcRaReq(raReqCnt, cell, raReqInd->rachInfoArr[raRntiCnt].raRnti,
900 (TfuRachInfo *)&raReqInd->rachInfoArr[raRntiCnt],
901 raReqInd->timingInfo, ue, &err);
904 err.errType = RGSCHERR_TOM_RAREQIND;
905 RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,
906 "RARNTI:%d rgSCHTomRaReqInd(): RAM processing failed errType(%d) "
907 "errCause(%d)", raReqInd->rachInfoArr[raRntiCnt].raRnti,
908 err.errType, err.errCause);
915 } /* rgSCHTomRaReqInd */
919 * @brief Handler for processing uplink CQI indication recieved from PHY.
923 * Function: rgSCHTomUlCqiInd
925 * Handler for processing uplink CQI indication recieved from PHY.
927 * Invoked by: RgLiTfuUlCqiInd
931 * - Invoke scheduler to push reported CQI info rgSCHUtlUlCqiInd
933 * @param[in] RgSchCellCb *cell
934 * @param[in] TfuUlCqiIndInfo *ulCqiInd
940 PUBLIC S16 rgSCHTomUlCqiInd
943 TfuUlCqiIndInfo *ulCqiInd
946 PUBLIC S16 rgSCHTomUlCqiInd(cell, ulCqiInd)
948 TfuUlCqiIndInfo *ulCqiInd;
953 TfuUlCqiRpt *ulCqiInfo;
954 TRC2(rgSCHTomUlCqiInd);
956 node = ulCqiInd->ulCqiRpt.first;
957 if(cell->cellId != ulCqiInd->cellId)
959 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
960 "rgSCHTomUlCqiInd() Unable to get the ulCqiInd cell with id(%d)",
965 for (;node; node=node->next)
967 ulCqiInfo = (TfuUlCqiRpt *)node->node;
968 #if (ERRCLASS & ERRCLS_DEBUG)
969 if(ulCqiInfo->numSubband == 0)
971 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Num Subband is"
972 "out of range RNTI:%d",ulCqiInfo->rnti);
976 if((ue = rgSCHDbmGetUeCb(cell, ulCqiInfo->rnti)) == NULLP)
979 if((ue = rgSCHDbmGetSpsUeCb(cell, ulCqiInfo->rnti)) == NULLP)
982 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get "
983 "the ue for RNTI:%d", ulCqiInfo->rnti);
987 /* wideband cqi is directly reported now. and also isTxPort0 */
988 rgSCHUtlUlCqiInd(cell, ue, ulCqiInfo);
991 } /* rgSCHTomUlCqiInd */
994 * @brief Handler for processing PUCCH power adjustment indication
998 * Function: rgSCHTomPucchDeltaPwrInd
1000 * Handler for processing PUCCH power adjustment indication
1001 * received from PHY.
1003 * Invoked by: RgLiTfuPucchDeltaPwrInd
1007 * - Invoke scheduler to push reported CQI info rgSCHUtlPucchDeltaPwrInd
1009 * @param[in] RgSchCellCb *cell
1010 * @param[in] TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
1016 PUBLIC S16 rgSCHTomPucchDeltaPwrInd
1019 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
1022 PUBLIC S16 rgSCHTomPucchDeltaPwrInd(cell, pucchDeltaPwr)
1024 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr;
1029 TfuPucchDeltaPwr *ueElem;
1031 TRC2(rgSCHTomPucchDeltaPwrInd);
1033 if(cell->cellId != pucchDeltaPwr->cellId)
1035 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1036 "rgSCHTomPucchDeltaPwrInd() Unable to get the pucchDeltaPwr cell with id(%d)",
1037 pucchDeltaPwr->cellId);
1041 node = pucchDeltaPwr->pucchDeltaPwrLst.first;
1042 for (;node; node=node->next)
1044 ueElem = (TfuPucchDeltaPwr *)node->node;
1045 if((ue = rgSCHDbmGetUeCb(cell, ueElem->rnti)) == NULLP)
1048 if((ue = rgSCHDbmGetSpsUeCb(cell, ueElem->rnti)) == NULLP)
1051 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d "
1052 "rgSCHTomPucchDeltaPwrInd() Unable to get the ue ",
1057 rgSCHUtlPucchDeltaPwrInd(cell, ue, ueElem->pucchDeltaPwr);
1060 } /* rgSCHTomPucchDeltaPwrInd */
1063 * @brief Handler for processing harq ACK/NACK indication recieved from PHY.
1067 * Function: rgSCHTomHarqAckInd
1069 * Handler for processing harq ACK/NACK indication recieved from PHY.
1071 * Invoked by: RgLiTfuHqInd
1074 * For each HqAckInfo received
1076 * - If UE doesnt exist look for a RaCb and invoke rgSCHRamMsg4FdbkInd
1077 * - Invoke HARQ module to pass HARQ-ACK info rgSCHDhmHqFdbkInd
1079 * @param[in] TfuHqIndInfo *harqAckInd
1085 PUBLIC S16 rgSCHTomHarqAckInd
1088 TfuHqIndInfo *harqAckInd
1091 PUBLIC S16 rgSCHTomHarqAckInd(cell, harqAckInd)
1093 TfuHqIndInfo *harqAckInd;
1106 RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1108 RgSchCellCb *iterCellP;
1110 TRC2(rgSCHTomHarqAckInd);
1112 if(cell->cellId != harqAckInd->cellId)
1114 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() Unable to get"
1115 " the cell for cellId (%d)", harqAckInd->cellId);
1116 err.errType = RGSCHERR_TOM_HARQACKIND;
1117 err.errCause = RGSCHERR_TOM_INV_CELL_ID;
1121 node = harqAckInd->hqIndLst.first;
1122 for (;node; node=node->next)
1124 hqInfo = (TfuHqInfo *)node->node;
1126 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1127 TfuHqFdbk fdbk = hqInfo->isAck[0];
1128 raCb = rgSCHDbmGetRaCb (cell, hqInfo->rnti);
1129 ue = rgSCHDbmGetUeCb (cell, hqInfo->rnti);
1130 if (ue != NULLP && raCb == NULLP)
1132 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, harqAckInd->timingInfo, fdbk, &err)) != ROK)
1134 err.errType = RGSCHERR_TOM_HARQACKIND;
1135 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
1136 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1137 err.errType, err.errCause);
1145 if ((rgSCHDhmRlsDlsfHqProc (cell, harqAckInd->timingInfo)) != ROK)
1147 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink "
1148 "subframe for cellId (%d) ", cell->cellId);
1149 err.errType = RGSCHERR_TOM_HARQACKIND;
1152 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
1154 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
1156 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
1158 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
1159 if(rlsHqBufs->numUes)
1161 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
1162 RgSchMacRlsHq (&pst, rlsHqBufs);
1164 rlsHqBufs->numUes = 0;
1168 rlsHqBufs->numUes = 0;
1169 node = harqAckInd->hqIndLst.first;
1170 for (;node; node=node->next)
1172 hqInfo = (TfuHqInfo *)node->node;
1173 for(tbCnt=0; tbCnt<TFU_MAX_HARQ_FDBKS; tbCnt++)
1175 hqInfo->isAck[tbCnt]=(TfuHqFdbk)rgSchTomHqFbkMap[hqInfo->isAck[tbCnt]];
1177 raCb = rgSCHDbmGetRaCb (cell, hqInfo->rnti);
1178 ue = rgSCHDbmGetUeCb (cell, hqInfo->rnti);
1179 if (ue == NULLP && raCb != NULLP)
1182 rgSCHRamMsg4FdbkInd (raCb);
1184 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1185 cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
1187 err.errType = RGSCHERR_TOM_HARQACKIND;
1188 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1189 " feedback processing failed errType(%d) errCause(%d)",
1190 err.errType, err.errCause);
1195 else if (ue != NULLP && raCb == NULLP)
1197 /* Get the Downlink HARQ entity from ue */
1198 if ((rgSCHDhmHqFdbkInd (ue, RGSCH_HQ_FDB_IND_CB_TYPE_HQ_ENT,
1199 cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
1201 err.errType = RGSCHERR_TOM_HARQACKIND;
1202 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
1203 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1204 err.errType, err.errCause);
1208 else if (ue != NULLP && raCb != NULLP)
1210 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1211 cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
1213 err.errType = RGSCHERR_TOM_HARQACKIND;
1214 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1215 " feedback processing failed errType(%d) errCause(%d).",
1216 err.errType, err.errCause);
1222 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
1223 "UE CB or RA CB ", hqInfo->rnti);
1224 err.errType = RGSCHERR_TOM_HARQACKIND;
1229 /* Check with TDD call DHM*/
1230 if ((rgSCHDhmRlsDlsfHqProc (cell, harqAckInd->timingInfo)) != ROK)
1232 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink "
1233 "subframe for cellId (%d) ", harqAckInd->cellId);
1234 err.errType = RGSCHERR_TOM_HARQACKIND;
1237 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
1239 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
1241 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
1243 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
1244 if(rlsHqBufs->numUes)
1246 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
1247 RgSchMacRlsHq (&pst, rlsHqBufs);
1249 rlsHqBufs->numUes = 0;
1254 } /* rgSCHTomHarqAckInd */
1258 * @brief Handler for processing Scheduling Request indication
1259 * recieved from PHY for a list of UEs.
1263 * Function: rgSCHTomSrInd
1265 * Handler for processing Scheduling Request indication recieved from PHY
1268 * Invoked by: RgLiTfuSrInd
1272 * - Invoke scheduler to indicate SR rgSCHUtlSrRcvd
1274 * @param[in] TfuSrIndInfo *srInd
1280 PUBLIC S16 rgSCHTomSrInd
1286 PUBLIC S16 rgSCHTomSrInd(cell, srInd)
1288 TfuSrIndInfo *srInd;
1297 TRC2(rgSCHTomSrInd);
1299 if(cell->cellId != srInd->cellId)
1301 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for srcInd cellId"
1302 ":%d ", srInd->cellId);
1303 err.errType = RGSCHERR_TOM_SRIND;
1304 err.errCause = RGSCHERR_TOM_INV_CELL_ID;
1309 node = srInd->srLst.first;
1310 for (;node; node=node->next)
1314 srInfo = (TfuSrInfo *)node->node;
1315 ue = rgSCHDbmGetUeCb (cell, srInfo->rnti);
1318 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB",
1322 rgSCHUtlHdlUlTransInd(cell, ue, srInd->timingInfo);
1323 /*Need to activate UE as SR received*/
1324 if (ue->isDrxEnabled)
1326 rgSCHDrxSrInd(cell, ue);
1328 ret = rgSCHUtlSrRcvd (cell, ue, srInd->timingInfo, &err);
1331 err.errType = RGSCHERR_TOM_SRIND;
1332 RLOG_ARG3(L_ERROR,DBG_CELLID,cell->cellId,"Scheduler processing failed "
1333 "errType(%d) errCause(%d) RNTI:%d", err.errType, err.errCause,srInfo->rnti);
1338 } /* end of rgSCHTomSrInd */
1341 * @brief Handler for processing downlink CQI indication recieved from
1346 * Function: rgSCHTomDoaInd
1348 * Handler for processing DOA recieved from PHY
1351 * Invoked by: RgLiTfuDoaInd
1355 * - Invoke scheduler to indicate DOA rgSCHUtlDoaInd
1357 * @param[in] TfuDoaIndInfo *doaInd
1363 PUBLIC S16 rgSCHTomDoaInd
1366 TfuDoaIndInfo *doaInd
1369 PUBLIC S16 rgSCHTomDoaInd(cell, doaInd )
1371 TfuDoaIndInfo *doaInd;
1377 TRC2(rgSCHTomDoaInd);
1379 if(cell->cellId != doaInd->cellId)
1381 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for doaInd cellId"
1382 ":%d", doaInd->cellId);
1387 node = doaInd->doaRpt.first;
1388 for (;node; node=node->next)
1390 doaInfo = (TfuDoaRpt *)node->node;
1391 ue = rgSCHDbmGetUeCb (cell, doaInfo->rnti);
1394 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB",
1398 rgSCHUtlDoaInd(cell, ue, doaInfo);
1401 } /* rgSCHTomDoaInd */
1403 * @brief Handler for processing downlink CQI indication recieved from
1408 * Function: rgSCHTomDlCqiInd
1410 * Handler for processing downlink CQI indication recieved from PHY
1413 * Invoked by: RgLiTfuDlCqiInd
1417 * - Invoke scheduler to indicate DL CQI rgSCHUtlDlCqiInd
1419 * @param[in] TfuDlCqiIndInfo *dlCqiInd
1425 PUBLIC S16 rgSCHTomDlCqiInd
1428 TfuDlCqiIndInfo *dlCqiInd
1431 PUBLIC S16 rgSCHTomDlCqiInd(cell, dlCqiInd)
1433 TfuDlCqiIndInfo *dlCqiInd;
1438 TfuDlCqiRpt *dlCqiInfo;
1439 TRC2(rgSCHTomDlCqiInd);
1441 if(cell->cellId != dlCqiInd->cellId)
1443 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
1444 ":%d", dlCqiInd->cellId);
1449 node = dlCqiInd->dlCqiRptsLst.first;
1450 for (;node; node=node->next)
1452 dlCqiInfo = (TfuDlCqiRpt *)node->node;
1453 ue = rgSCHDbmGetUeCb (cell, dlCqiInfo->rnti);
1456 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%dUnable to get the UE CB",
1460 rgSCHUtlDlCqiInd(cell, ue, dlCqiInfo, dlCqiInd->timingInfo);
1461 rgSCHUtlHdlUlTransInd(cell, ue, dlCqiInd->timingInfo);
1464 } /* rgSCHTomDlCqiInd */
1467 * @brief Handler for moving PCQI instance for the next periodic occasion
1471 * Function: rgSCHTomUtlMovePcqiNxtOccasion
1473 * Handler for moving PCQI instance for the next periodic occasion
1475 * Invoked by: rgSCHTomUtlFill*
1478 * - For a UE move its occurence instance to next occasion
1479 * depending on its periodicity
1480 * - Remove it from the current list and insert it to the list
1481 * having the index matching with the derived number.
1483 * @param[in] RgSchCellCb *cell,
1484 * [in] RgSchUeCb *ue
1490 PRIVATE S16 rgSCHTomUtlMovePcqiNxtOccasion
1494 RgSchUePCqiCb *cqiCb
1497 PRIVATE S16 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb)
1500 RgSchUePCqiCb *cqiCb;
1505 CmLteTimingInfo timingInfo;
1506 TRC2(rgSCHTomUtlMovePcqiNxtOccasion);
1508 if(cqiCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_SB_REP)
1511 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timingInfo, TFU_DELTA);
1513 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timingInfo,
1514 TFU_RECPREQ_DLDELTA);
1516 RG_SCH_ADD_TO_CRNT_TIME(timingInfo,timingInfo,cqiCb->cqiPeri);
1517 rgSCHTomUtlPcqiSbCalcBpIdx(timingInfo,ue,cqiCb);
1519 /* Compute Next Transmission Instance */
1520 cqiIdx = cqiCb->cqiPeri + cqiCb->nCqiTrIdx;
1521 cqiIdx = cqiIdx%RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1522 /* Delete from current List and move to new list */
1523 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst,
1526 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to remove node",
1529 cqiCb->nCqiTrIdx = cqiIdx;
1530 cmLListAdd2Tail(&(cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst),
1531 &(cqiCb->cqiLstEnt));
1533 rgSCHUtlSCellHndlCqiCollsn(cqiCb);
1537 } /* rgSCHTomUtlMovePcqiNxtOccasion */
1540 * @brief Handler for moving RI instance for the next periodic occasion
1544 * Function: rgSCHTomUtlMovePriNxtOccasion
1546 * Handler for moving PCQI instance for the next periodic occasion
1548 * Invoked by: rgSCHTomUtlFill*
1551 * - For a UE move its occurence instance to next occasion
1552 * depending on its periodicity
1553 * - Remove it from the current list and insert it to the list
1554 * having the index matching with the derived number.
1556 * @param[in] RgSchCellCb *cell,
1557 * [in] RgSchUeCb *ue
1563 PRIVATE S16 rgSCHTomUtlMovePriNxtOccasion
1570 PRIVATE S16 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb)
1573 RgSchUePCqiCb *riCb;
1583 TRC2(rgSCHTomUtlMovePriNxtOccasion);
1584 crntTime = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)
1585 +(cell->crntTime.slot);
1586 #ifdef XEON_SPECIFIC_CHANGES
1587 RGSCHCPYTIMEINFO(cell->crntTime, ue->riRecpTime);
1589 /* Compute Next Transmission Instance */
1590 if (riCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_WB_REP)
1592 effPeriodicity = riCb->cqiPeri * riCb->riPeri;
1593 tempIdx = effPeriodicity + riCb->nRiTrIdx;
1597 effPeriodicity = (riCb->h * riCb->cqiPeri * riCb->riPeri);
1598 /* In case of SFN wraparound, the SB CQI reporting cycle breaks
1599 * and RI->WB CQI->SBCQI.. should resume. RI is repositioned
1600 * accordingly. WBCQI handling is naturally accomplished */
1601 if ((crntTime + TFU_RECPREQ_DLDELTA + effPeriodicity) >
1602 (RGSCH_MAX_SUBFRM_5G - 1))
1604 riTrInsTime = (effPeriodicity - riCb->cqiOffset + riCb->riOffset) % effPeriodicity;
1605 tempIdx = RGSCH_MAX_SUBFRM_5G + (effPeriodicity - riTrInsTime);
1606 /* In case of SFN wraparound, riDist should be distance from crntTime
1607 * + TFU_RECPREQ_DLDELTA to tempIdx. Updating effPeriodicity
1608 * to make riDist calculation consistent for both SFN wraparound
1609 * case and normal case */
1610 effPeriodicity = tempIdx - TFU_RECPREQ_DLDELTA - crntTime;
1614 tempIdx = effPeriodicity + riCb->nRiTrIdx;
1617 riIdx = tempIdx % RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1618 if (effPeriodicity >= RG_SCH_PCQI_SRS_SR_TRINS_SIZE)
1620 riDist = rgSCHUtlFindDist((U16)(crntTime + TFU_RECPREQ_DLDELTA),
1621 (U16)(crntTime + TFU_RECPREQ_DLDELTA + effPeriodicity));
1628 /* ccpu00138306- If Periodicity is equal to Queue Size or multiple of it
1629 * then the next occasion idx will be same as current Idx, Hence need not
1632 if((effPeriodicity%RG_SCH_PCQI_SRS_SR_TRINS_SIZE) != 0)
1634 /* Delete from current List and move to new list */
1635 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[riCb->nRiTrIdx].riLst,
1638 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"[%d]UEID:Unable to remove node",
1641 RG_SCH_RECORD(&riCb->histElem,RGSCH_ACTION_DEL, &cell->pCqiSrsSrLst[riCb->nRiTrIdx].riLst);
1642 cmLListAdd2Tail(&cell->pCqiSrsSrLst[riIdx].riLst,
1644 RG_SCH_RECORD(&riCb->histElem,RGSCH_ACTION_ADD, &cell->pCqiSrsSrLst[riIdx].riLst);
1653 riCb->nRiTrIdx = riIdx;
1654 riCb->riDist = riDist;
1657 rgSCHUtlSCellHndlRiCollsn(riCb);
1660 } /* rgSCHTomUtlMovePriNxtOccasion */
1663 * @brief Handler for moving SR instance for the next periodic occasion
1667 * Function: rgSCHTomUtlMoveSrNxtOccasion
1669 * Handler for moving SR instance for the next periodic occasion
1671 * Invoked by: rgSCHTomUtlFill*
1674 * - For a UE move its occurence instance to next occasion
1675 * depending on its periodicity
1676 * - Remove it from the current list and insert it to the list
1677 * having the index matching with the derived number.
1679 * @param[in] RgSchCellCb *cell,
1680 * [in] RgSchUeCb *ue
1686 PRIVATE S16 rgSCHTomUtlMoveSrNxtOccasion
1692 PRIVATE S16 rgSCHTomUtlMoveSrNxtOccasion(cell, ue)
1699 TRC2(rgSCHTomUtlMoveSrNxtOccasion);
1701 /* Compute Next Transmission Instance */
1702 srIdx = ue->srCb.peri + ue->srCb.nSrTrIdx;
1703 srIdx = srIdx%RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1704 /* Delete from current List and move to new list */
1705 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[ue->srCb.nSrTrIdx].srLst,
1706 &ue->srCb.srLstEnt))
1708 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to remove node",
1711 ue->srCb.nSrTrIdx = srIdx;
1712 cmLListAdd2Tail(&cell->pCqiSrsSrLst[ue->srCb.nSrTrIdx].srLst,
1713 &ue->srCb.srLstEnt);
1716 } /* rgSCHTomUtlMoveSrNxtOccasion */
1719 * @brief Handler for moving SRS instance for the next periodic occasion
1723 * Function: rgSCHTomUtlMoveSrsNxtOccasion
1725 * Handler for moving SRS instance for the next periodic occasion
1727 * Invoked by: rgSCHTomUtlFill*
1730 * - For a UE move its occurence instance to next occasion
1731 * depending on its periodicity
1732 * - Remove it from the current list and insert it to the list
1733 * having the index matching with the derived number.
1735 * @param[in] RgSchCellCb *cell,
1736 * [in] RgSchUeCb *ue
1742 PRIVATE S16 rgSCHTomUtlMoveSrsNxtOccasion
1748 PRIVATE S16 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue)
1759 TRC2(rgSCHTomUtlMoveSrsNxtOccasion);
1760 crntTime = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)
1761 +(cell->crntTime.slot);
1763 /* Compute Next Transmission Instance */
1764 tempIdx = ue->srsCb.peri + ue->srsCb.nSrsTrIdx;
1765 srsIdx = tempIdx %RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1766 if (ue->srsCb.peri > RG_SCH_PCQI_SRS_SR_TRINS_SIZE)
1768 srsDist = rgSCHUtlFindDist((U16)(crntTime + TFU_RECPREQ_DLDELTA),
1769 (U16)(crntTime + TFU_RECPREQ_DLDELTA + ue->srsCb.peri));
1776 /* ccpu00138306- If Periodicity is equal to Queue Size or multiple of it
1777 * then the next occasion idx will be same as current Idx, Hence need not
1780 if((ue->srsCb.peri%RG_SCH_PCQI_SRS_SR_TRINS_SIZE) != 0)
1782 /* Delete from current List and move to new list */
1783 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[ue->srsCb.nSrsTrIdx].srsLst,
1784 &ue->srsCb.srsLstEnt))
1786 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to remove node",
1789 cmLListAdd2Tail(&cell->pCqiSrsSrLst[srsIdx].srsLst,
1790 &ue->srsCb.srsLstEnt);
1799 ue->srsCb.nSrsTrIdx = srsIdx;
1800 ue->srsCb.srsDist = srsDist;
1803 } /* rgSCHTomUtlMoveSrsNxtOccasion */
1807 * @brief Handler for processing RAW CQI indication recieved from
1812 * Function: rgSCHTomRawCqiInd
1814 * Handler for processing RAW CQI indication recieved from PHY
1817 * Invoked by: RgLiTfuRawCqiInd
1821 * - Invoke scheduler to indicate Raw CQI rgSCHUtlRawCqiInd
1823 * @param[in] TfuRawCqiIndInfo *rawCqiInd
1829 PUBLIC S16 rgSCHTomRawCqiInd
1832 TfuRawCqiIndInfo *rawCqiInd
1835 PUBLIC S16 rgSCHTomRawCqiInd(cell, rawCqiInd)
1837 TfuRawCqiIndInfo *rawCqiInd;
1842 TfuRawCqiRpt* rawCqiInfo;
1846 RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1847 RgSchCellCb *iterCellP;
1858 TRC2(rgSCHTomRawCqiInd);
1860 if(cell->cellId != rawCqiInd->cellId)
1862 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
1863 ":%d", rawCqiInd->cellId);
1868 node = rawCqiInd->rawCqiRpt.first;
1869 for (;node; node=node->next)
1871 rawCqiInfo = (TfuRawCqiRpt *)node->node;
1872 ue = rgSCHDbmGetUeCb (cell, rawCqiInfo->crnti);
1873 raCb = rgSCHDbmGetRaCb (cell, rawCqiInfo->crnti);
1877 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"CRNTI:%d Unable to get the UECB",
1884 if (rawCqiInfo->numBits >= 5)
1885 printf("cellId [%d] crnti [%d] numBits [%d] uciPayload [0x%08x] sfn/sf [%d:%d]\n",
1886 cell->cellId, rawCqiInfo->crnti, rawCqiInfo->numBits, rawCqiInfo->uciPayload,
1887 rawCqiInd->timingInfo.sfn, rawCqiInd->timingInfo.slot);
1889 if (rawCqiInfo->numBits == 1)
1891 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1892 U8 fdbk = TFU_HQFDB_NACK;
1893 /* Process HARQ FdbkInd */
1894 hqAck = (rawCqiInfo->uciPayload >> 31) & 0x1;
1897 fdbk = TFU_HQFDB_ACK;
1898 hqInfo.isAck[0] = fdbk;
1900 if (ue != NULLP && raCb == NULLP)
1902 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, rawCqiInd->timingInfo, fdbk, &err)) != ROK)
1904 err.errType = RGSCHERR_TOM_HARQACKIND;
1905 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
1906 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1907 err.errType, err.errCause);
1911 else if (ue == NULLP && raCb != NULLP)
1913 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1914 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1916 err.errType = RGSCHERR_TOM_HARQACKIND;
1917 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1918 " feedback processing failed errType(%d) errCause(%d)",
1919 err.errType, err.errCause);
1924 else if (ue != NULLP && raCb != NULLP)
1926 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1927 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1929 err.errType = RGSCHERR_TOM_HARQACKIND;
1930 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
1931 " feedback processing failed errType(%d) errCause(%d).",
1932 err.errType, err.errCause);
1938 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
1939 "UE CB or RA CB ", rawCqiInfo->crnti);
1940 err.errType = RGSCHERR_TOM_HARQACKIND;
1944 printf("rawCqiInfo->numBits [%d] uciPayload [0x%08x] sfn/sf [%d:%d]\n", rawCqiInfo->numBits,
1945 rawCqiInfo->uciPayload, rawCqiInd->timingInfo.sfn, rawCqiInd->timingInfo.slot);
1948 else if (rawCqiInfo->numBits == 5)
1950 /* Process CQI-RI Ind*/
1951 ri = (rawCqiInfo->uciPayload >> 27) & 0x1;
1952 cqi = (rawCqiInfo->uciPayload >> 28) & 0xF;
1956 printf("\n UE[%d] CQI[%d] Invalid\n", ue->ueId, cqi);
1959 ue->ue5gtfCb.mcs = rgSch5gtfCqi2Mcs[cqi - 1];
1960 ue->ue5gtfCb.rank = ri + 1;
1962 if (rawCqiInfo->numBits > 1)
1964 ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
1965 ueDl->mimoInfo.cwInfo[0].cqi = cqi;
1966 ueDl->cqiFlag = TRUE;
1967 rgSCHCmnDlSetUeAllocLmtLa(cell, ue);
1968 // rgSCHCheckAndSetTxScheme(cell, ue);
1973 printf("UE[%d] CQI[%d] MCS[%d] RI[%d]\n", ue->ueId, cqi, ue->ue5gtfCb.mcs, ri);
1976 else if (rawCqiInfo->numBits == 6)
1978 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1979 TfuHqFdbk fdbk = TFU_HQFDB_NACK;
1980 /* Process both HARQ and CQI-RI Ind*/
1981 ri = (rawCqiInfo->uciPayload >> 26) & 0x1;
1982 cqi = (rawCqiInfo->uciPayload >> 27) & 0xF;
1983 hqAck = (rawCqiInfo->uciPayload >> 31) & 0x1;
1986 printf("UE[%d] CQI[%d] Invalid\n", ue->ueId, cqi);
1989 ue->ue5gtfCb.mcs = rgSch5gtfCqi2Mcs[cqi - 1];
1990 ue->ue5gtfCb.rank = ri + 1;
1992 if (rawCqiInfo->numBits > 1)
1994 ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
1995 ueDl->mimoInfo.cwInfo[0].cqi = cqi;
1996 ueDl->cqiFlag = TRUE;
1997 rgSCHCmnDlSetUeAllocLmtLa(cell, ue);
1998 // rgSCHCheckAndSetTxScheme(cell, ue);
2003 fdbk = TFU_HQFDB_ACK;
2004 hqInfo.isAck[0] = fdbk;
2006 if (ue != NULLP && raCb == NULLP)
2008 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, rawCqiInd->timingInfo, fdbk, &err)) != ROK)
2010 err.errType = RGSCHERR_TOM_HARQACKIND;
2011 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() "
2012 "HARQ feedback processing failed errType(%d)errCause(%d)n",
2013 err.errType, err.errCause);
2017 else if (ue == NULLP && raCb != NULLP)
2019 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
2020 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
2022 err.errType = RGSCHERR_TOM_HARQACKIND;
2023 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
2024 " feedback processing failed errType(%d) errCause(%d)",
2025 err.errType, err.errCause);
2030 else if (ue != NULLP && raCb != NULLP)
2032 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
2033 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
2035 err.errType = RGSCHERR_TOM_HARQACKIND;
2036 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomHarqAckInd() HARQ"
2037 " feedback processing failed errType(%d) errCause(%d).",
2038 err.errType, err.errCause);
2044 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
2045 "UE CB or RA CB ", rawCqiInfo->crnti);
2046 err.errType = RGSCHERR_TOM_HARQACKIND;
2051 printf("\nUE[%u] CQI[%u] MCS[%u] RI[%u] HQ[%u]\n", ue->ueId, cqi, ue->ue5gtfCb.mcs, ri, hqAck);
2056 if ((rgSCHDhmRlsDlsfHqProc (cell, rawCqiInd->timingInfo)) != ROK)
2058 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Release Downlink "
2059 "subframe for cellId (%d) ", cell->cellId);
2060 err.errType = RGSCHERR_TOM_HARQACKIND;
2063 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
2065 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
2067 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
2069 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
2070 if(rlsHqBufs->numUes)
2072 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
2073 RgSchMacRlsHq (&pst, rlsHqBufs);
2075 rlsHqBufs->numUes = 0;
2079 } /* rgSCHTomRawCqiInd */
2082 * @brief Handler for processing SRS indication recieved from
2087 * Function: rgSCHTomSrsInd
2089 * Handler for SRS indication recieved from PHY
2092 * Invoked by: RgLiTfuSrsInd
2096 * - Invoke scheduler to indicate UL SRS rgSCHUtlSrsInd
2098 * @param[in] TfuSrsIndInfo *srsInd
2104 PUBLIC S16 rgSCHTomSrsInd
2107 TfuSrsIndInfo *srsInd
2110 PUBLIC S16 rgSCHTomSrsInd(cell, srsInd)
2112 TfuSrsIndInfo *srsInd;
2119 TRC2(rgSCHTomSrsInd);
2121 if(cell->cellId != srsInd->cellId)
2123 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
2124 ":%d", srsInd->cellId);
2128 node = srsInd->srsRpt.first;
2129 for (;node; node=node->next)
2131 srsInfo = (TfuSrsRpt *)node->node;
2132 ue = rgSCHDbmGetUeCb (cell, srsInfo->ueId);
2135 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the "
2136 "UE CB", srsInfo->ueId);
2139 rgSCHUtlSrsInd(cell, ue, srsInfo, srsInd->timingInfo);
2140 rgSCHUtlHdlUlTransInd(cell, ue, srsInd->timingInfo);
2143 } /* rgSCHTomSrsInd */
2147 * Fun: rgSCHTomUtlGenIndices
2149 * Desc: This function reconstructs the Subband Indices for
2150 * of M selected Subbands conveyed by the UE for APeriodic Modes
2151 * 2-0 and 2-2. It decodes the Label which uniquely encodes M out
2159 * File: rg_sch_utl.c
2163 PRIVATE S16 rgSCHTomUtlGenIndices
2169 TfuSubbandInfo* sbInfo
2172 PRIVATE S16 rgSCHTomUtlGenIndices(label, posM, valN, valK, sbInfo)
2177 TfuSubbandInfo* sbInfo;
2180 U8 idx, kval, xval, xmin;
2183 for(kval=0; kval<posM;kval++)
2186 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe, (posM-kval-1));
2187 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe[posM-kval-1], (valN-xval-1));
2188 binCoe = rgSCHTomBinCoe[posM-kval-1][valN-xval-1];
2192 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe[posM-kval-1], (valN-xval-1));
2193 binCoe = rgSCHTomBinCoe[posM-kval-1][valN-xval-1];
2196 sbInfo[kval].numRb = valK;
2197 sbInfo[kval].rbStart = idx*valK;
2199 label = label-binCoe;
2202 } /* end of rgSCHTomUtlGenIndices*/
2205 * @brief Handler for processing decode failure indication recieved from
2210 * Function: rgSCHTomCrcInd
2212 * Handler for processing decode failure indication recieved from
2213 * PHY for a set of UEs.
2215 * Invoked by: RgLiTfuCrcInd of rg_sch.x
2218 * - Validate the information received and retrieve cell and ue.
2219 * - Process Decode failure Indication: Call rgSCHUhmProcHqFailure().
2221 * @param[in] TfuCrcIndInfo *crcInd
2227 PUBLIC S16 rgSCHTomCrcInd
2230 TfuCrcIndInfo *crcInd
2233 PUBLIC S16 rgSCHTomCrcInd(cell, crcInd)
2235 TfuCrcIndInfo *crcInd;
2238 RgSchUeCb *ue = NULLP;
2239 RgSchRaCb *raCb = NULLP;
2241 TfuCrcInfo *crcInfo;
2242 #ifdef RG_ULSCHED_AT_CRC
2245 CmLteTimingInfo crntHiDci0Frm;
2246 //RgSchCmnUlCell *cellUl;
2247 Inst inst = cell->instIdx;
2248 TfuCntrlReqInfo *cntrlInfo;
2256 RgSchUlHqProcCb *hqProc;
2260 RgSchUlHqProcCb *ulHqProc;
2263 TRC2(rgSCHTomCrcInd);
2265 if(cell->cellId != crcInd->cellId)
2267 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
2268 ":%d", crcInd->cellId);
2271 #ifdef RG_ULSCHED_AT_CRC
2274 static CmLteTimingInfo lastCrc = {2000,0};
2275 CmLteTimingInfo crntCrc = cell->crntTime;
2276 if (RGSCH_TIMEINFO_SAME(lastCrc, crntCrc))
2278 /*Removed the WA to drop 2nd CRC*/
2279 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,"Recieved CRC "
2280 "twice per TTI @(%u,%u)", cell->crntTime.sfn,
2281 cell->crntTime.slot);
2287 node = crcInd->crcLst.first;
2288 for (;node; node=node->next)
2290 crcInfo = (TfuCrcInfo*)node->node;
2291 ue = rgSCHDbmGetUeCb (cell, crcInfo->rnti);
2295 /* Fetch from SPS List */
2296 ue = rgSCHDbmGetSpsUeCb(cell, crcInfo->rnti);
2300 raCb = rgSCHDbmGetRaCb (cell, crcInfo->rnti);
2307 /* Added Ul TB count for Uplink data scheduled*/
2311 ulHqProc = &(raCb->msg3HqProc);
2312 if(ulHqProc->remTx == (cell->rachCfg.maxMsg3Tx -1))
2314 cell->dlUlTbCnt.tbTransUlTotalCnt++;
2319 rgSCHUtlUlHqProcForUe(cell, crcInd->timingInfo, ue, &ulHqProc);
2320 if(ulHqProc->remTx == ((RgUeUlHqCb*)ulHqProc->hqEnt)->maxHqRetx)
2322 cell->dlUlTbCnt.tbTransUlTotalCnt++;
2327 if (crcInfo->isFailure == FALSE)
2331 rgSCHRamMsg3DatInd(raCb);
2333 /*ccpu00128820 - MOD - Msg3 alloc double delete issue*/
2334 hqProc = &(raCb->msg3HqProc);
2335 RGSCH_UPD_PHICH(cell->ulDlCfgIdx, crcInd->timingInfo.slot,
2343 gUlCrcPassCounter++;
2348 RGSCHCPYTIMEINFO(crcInd->timingInfo, ue->datIndTime);
2349 #ifndef MAC_SCH_STATS
2350 rgSCHUhmProcDatInd(cell, ue, crcInd->timingInfo);
2353 /** Stats update over here
2356 RgSchCmnUe *cmnUe = RG_SCH_CMN_GET_UE(ue,cell);
2358 rgSCHUhmProcDatInd(cell, ue, crcInd->timingInfo, cmnUe->ul.crntUlCqi[0]);
2360 #endif /* MAC_SCH_STATS */
2362 rgSCHUtlHdlUlTransInd(cell, ue, crcInd->timingInfo);
2364 rgSCHUtlHdlCrcInd(cell, ue, crcInd->timingInfo);
2372 /* SR_RACH_STATS : MSG3 Nack / DTX*/
2373 if (crcInfo->isDtx == TRUE)
2379 rgNumMsg3CrcFailed++;
2381 rgSCHRamMsg3FailureInd(raCb);
2383 rgSCHCmnEmtcHdlCrcFailInd(cell, raCb);
2385 /* Added Ul TB count for CRC Failure of MSG3 */
2387 ulHqProc = &(raCb->msg3HqProc);
2388 if(ulHqProc->remTx == (cell->rachCfg.maxMsg3Tx -1))
2390 cell->dlUlTbCnt.tbTransUlFaulty++;
2398 gUlCrcFailCounter++;
2403 #ifndef MAC_SCH_STATS
2404 rgSCHUhmProcHqFailure (cell, ue, crcInd->timingInfo, crcInfo->rv);
2407 RgSchCmnUe *cmnUe = RG_SCH_CMN_GET_UE(ue,cell);
2409 rgSCHUhmProcHqFailure (cell, ue, crcInd->timingInfo, crcInfo->rv, cmnUe->ul.crntUlCqi[0]);
2411 #endif /* MAC_SCH_STATS */
2412 rgSCHUtlHdlUlTransInd(cell, ue, crcInd->timingInfo);
2414 rgSCHUtlHdlCrcFailInd(cell, ue, crcInd->timingInfo);
2416 /* Added Ul TB count for CRC Failure of Uplink data */
2418 rgSCHUtlUlHqProcForUe(cell, crcInd->timingInfo, ue, &ulHqProc);
2419 if(ulHqProc->remTx == ((RgUeUlHqCb*)ulHqProc->hqEnt)->maxHqRetx)
2421 cell->dlUlTbCnt.tbTransUlFaulty++;
2428 /* ccpu00132653-ADD Added Sched_At_Crc Changes for TDD and optimized here
2429 the codebase across TDD and FDD*/
2430 #ifdef RG_ULSCHED_AT_CRC
2431 /* Changes to do uplink scheduling at CRC Indication */
2432 //cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
2433 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, crntHiDci0Frm, TFU_ULCNTRL_DLDELTA);
2436 rgSCHCmnRlsUlSf(cell,0);
2439 /* Allocating memory for CntrlReq as it required for both EMTC and
2441 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&cntrlInfo,
2442 sizeof(TfuCntrlReqInfo))) != ROK)
2444 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate TfuCntrlReqInfo "
2448 rgSCHCmnUlSch(cell);
2450 rgSCHL2Meas(cell,TRUE);
2452 /* Also, sending UL DCI and PHICH for just scheduled subframe */
2453 ulSf = rgSCHUtlSubFrmGet (cell, crntHiDci0Frm);
2455 if ((rgSCHTomUtlProcDlSfAtCrc (ulSf, crntHiDci0Frm, cell, cntrlInfo, &err)) != ROK)
2457 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomCrcInd() Unable to process"
2458 " downlink subframe for cellId %d", crcInd->cellId);
2459 err.errType = RGSCHERR_TOM_TTIIND;
2462 #endif /* RG_ULSCHED_AT_CRC */
2464 } /* rgSCHTomCrcInd */
2467 * @brief Handler for processing timing Advance indication recieved from
2472 * Function: rgSCHTomTimingAdvInd
2474 * Handler for processing timing advance indication recieved from PHY
2477 * Invoked by: RgLiTfuTimingAdvInd
2481 * - Call DHM to update value of Timing Advance rgSCHDhmUpdTa.
2483 * @param[in] TfuTimingAdvIndInfo *timingAdvInd
2489 PUBLIC S16 rgSCHTomTimingAdvInd
2492 TfuTimingAdvIndInfo *timingAdvInd
2495 PUBLIC S16 rgSCHTomTimingAdvInd(cell, timingAdvInd)
2497 TfuTimingAdvIndInfo *timingAdvInd;
2502 TfuTimingAdvInfo *timingAdvInfo;
2505 TRC2(rgSCHTomTimingAdvInd);
2507 if(cell->cellId != timingAdvInd->cellId)
2509 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the cell for cellId"
2510 "=(%d)", timingAdvInd->cellId);
2515 node = timingAdvInd->timingAdvLst.first;
2516 for (;node; node=node->next)
2518 timingAdvInfo = (TfuTimingAdvInfo *)node->node;
2519 ue = rgSCHDbmGetUeCb (cell, timingAdvInfo->rnti);
2522 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to get the UE CB",
2523 timingAdvInfo->rnti);
2526 rgSCHDhmUpdTa (cell, ue, timingAdvInfo->timingAdv);
2529 } /* rgSCHTomTimingAdvInd */
2532 * @brief Handler for processing TTI indication recieved from
2533 * PHY for 'n' cells.
2537 * Function: rgSCHTomTtiInd
2539 * Handler for processing slot indication recieved from MAC
2540 * for a cell. This is split into the below Steps.
2542 * 1: Complete the Uplink and Common Channel Scheduling for each Cell
2543 * 2: Complete the UE specific Scheduling for each Cell / across Cells.
2544 * 3: Consolidate the subframe allocations and send to each MAC instance
2545 * 4: Fill the Tfu structures for DL and UL Config requests
2546 * 5: Handle the RGR Config messages per Cell
2548 * @param[in] SlotIndInfo *slotInd
2549 * @param[in] Inst schInst
2553 PUBLIC Void rgSCHTomTtiInd
2555 SlotIndInfo *slotInd,
2559 PUBLIC Void rgSCHTomTtiInd(slotInd, schInst)
2560 SlotIndInfo *slotInd;
2564 RgInfSfAlloc *subfrmAlloc;
2565 RgTfuCntrlReqInfo *cntrlInfo = NULLP;
2569 RgSchCellCb *cell[CM_LTE_MAX_CELLS];
2570 RgSchCellCb *cellLst[CM_LTE_MAX_CELLS];
2572 TRC2(rgSCHTomTtiInd);
2578 //rgSchTomFillCellTtiInfo(slotInd, schInst, &nCell, &cell[0]);
2580 schFillCrntTime(*slotInd,schInst);
2581 for (i = 0; i < nCell; i++)
2583 /* Perform UL and DL Common Channel scheduling */
2584 rgSchTomTtiUlAndDlCmnChSch (cell[i]);
2587 /* Perform scheduling in Order of
2591 for (i = 0; i < nCell; i++)
2594 if (cell[i]->isDlDataAllwd && (cell[i]->stopDlSch == FALSE))
2596 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell[i]);
2597 /* Perform DL Retx scheduling */
2598 cellSch->apisDl->rgSCHDlRetxSched(cell[i], &cellSch->allocInfo);
2602 rgSchCmnPreDlSch(cell, nCell, cellLst);
2603 for (i = 0; i < nCell; i++)
2605 /* Perform DL scheduling */
2606 rgSchTomTtiDlSch (cellLst[i]);
2608 rgSchCmnPstDlSch(cell[0]);
2610 for (i = 0; i < nCell; i++)
2613 #ifndef RG_ULSCHED_AT_CRC
2614 /* Perform UL scheduling for TDD */
2615 rgSCHCmnUlSch (cell[i]);
2619 /* Init SF Alloc info per Cell */
2620 for (i = 0; i < nCell; i++)
2622 subfrmAlloc = &(cell[i]->sfAllocArr[cell[i]->crntSfIdx]);
2623 rgSCHUtlResetSfAlloc(subfrmAlloc,FALSE,TRUE);
2625 for (i = 0; i < nCell; i++)
2627 if (cell[i]->isDlDataAllwd && (cell[i]->stopSiSch == FALSE))
2629 subfrmAlloc = &(cell[i]->sfAllocArr[cell[i]->crntSfIdx]);
2631 * TFU_DLDATA_DLDELTA is used in this calculation because the subfrmAlloc
2632 * timingInfo which is being calculated here will be used by MAC
2634 RG_SCH_ADD_TO_CRNT_TIME(cell[i]->crntTime, subfrmAlloc->timingInfo,
2635 RG_DL_DELTA - TFU_DLDATA_DLDELTA);
2636 /* Consolidate the Allocations and send response to MAC instances */
2637 rgSchTomTtiCnsldtSfAlloc (cell[i]);
2641 for (i = 0; i < nCell; i++)
2643 if (cell[i]->isDlDataAllwd && (cell[i]->stopSiSch == FALSE))
2645 /* Send the consolidated Alloc Info to MAC instances */
2646 rgSCHCmnSndCnsldtInfo (cell[i]);
2650 for (i = 0; i < nCell; i++)
2652 /* Fill control data from scheduler to PHY */
2653 if ((ret = rgSCHUtlAllocEventMem((cell[i]->instIdx), (Ptr *)&cntrlInfo,
2654 sizeof(RgTfuCntrlReqInfo))) != ROK)
2656 RLOG_ARG0(L_ERROR,DBG_CELLID,cell[i]->cellId,"Unable to Allocate TfuCntrlReqInfo"
2662 /* Fill the TFU structures and send to CL */
2663 if(TRUE == cell[i]->emtcEnable)
2665 ret = rgSchEmtcTomTtiL1DlAndUlCfg (cell[i], cntrlInfo);
2669 && (NULLP != cntrlInfo))
2671 /* Fill the TFU structures and send to CL */
2672 rgSchTomTtiL1DlAndUlCfg (cell[i], cntrlInfo);
2676 rgSCHTomUtlSendSfnTick(cell[0]);
2679 for (i = 0; i < nCell; i++)
2681 /* Invoke non critical functions like measurements, etc */
2682 rgSchTomTtiMiscFunctions (cell[i]);
2687 U32 dbgUeIdChngAndDatReqInClCnt = 0;
2688 static U32 gTtiCount = 0;
2691 if(gTtiCount == 3000)
2693 #ifdef XEON_SPECIFIC_CHANGES
2694 printf("SChed:: (P/S)::(%u/%u) \n",
2695 gPrimarySchedCount,gSCellSchedCount);
2697 printf("\n HQFDBK :: %u\n",gHqFdbkCount);
2702 total = gPCellTb1AckCount + gPCellTb1NackCount + gPCellTb1DtxCount;
2703 total2 = gPCellTb2AckCount + gPCellTb2NackCount + gPCellTb2DtxCount;
2705 printf("\n PCell:: TB1:: (A/N/D)::(%u/%u/%u) TB2:: (A/N/D)::(%u/%u/%u)\n",
2706 gPCellTb1AckCount,gPCellTb1NackCount,gPCellTb1DtxCount,
2707 gPCellTb2AckCount,gPCellTb2NackCount,gPCellTb2DtxCount);
2708 if ((total != 0 ) && total2 != 0)
2710 printf("\n PCell:: TB1:: (AP/NP/DP)::(%.2f/%.2f/%.2f) TB2:: (AP/NP/DP)::(%.2f/%.2f/%.2f)\n",
2711 (float)gPCellTb1AckCount/total * 100,(float)gPCellTb1NackCount/total * 100,(float)gPCellTb1DtxCount/total * 100,
2712 (float)gPCellTb2AckCount/total2 *100 ,(float)gPCellTb2NackCount/total2 *100 ,(float)gPCellTb2DtxCount/total2 *2);
2715 total = gSCellTb1AckCount + gSCellTb1NackCount + gSCellTb1DtxCount;
2716 total2 = gSCellTb2AckCount + gSCellTb2NackCount + gSCellTb2DtxCount;
2719 printf("\n SCell:: TB1:: (A/N/D)::(%u/%u/%u) TB2:: (A/N/D)::(%u/%u/%u)\n",
2720 gSCellTb1AckCount,gSCellTb1NackCount,gSCellTb1DtxCount,
2721 gSCellTb2AckCount,gSCellTb2NackCount,gSCellTb2DtxCount);
2722 if ((total != 0 ) && total2 != 0)
2724 printf("\n SCell:: TB1:: (AP/NP/DP)::(%.2f/%.2f/%.2f) TB2:: (AP/NP/DP)::(%.2f/%.2f/%.2f)\n",
2725 (float)gSCellTb1AckCount/total * 100,(float)gSCellTb1NackCount/total * 100,(float)gSCellTb1DtxCount/total * 100,
2726 (float)gSCellTb2AckCount/total2 *100 ,(float)gSCellTb2NackCount/total2 *100 ,(float)gSCellTb2DtxCount/total2 *2);
2730 printf("\n CQI:: Recp(Pucch/Pusch):Rcvd(pcqi/rawacqireport/apcqi/AppReprt)::(%u/%u):(%u/%u/%u/%u)\n",
2731 gCqiRecpCount,gCqiRecpPuschCount,gCqiRcvdCount,gRawACqiCount,
2732 gACqiRcvdCount,gCqiReptToAppCount);
2734 printf("\n (F1BCS Count/Cqi/Ri/CqiDrop/PucchDrop/PuschCqiDrop)::(%u/%u/%u/%u/%u/%u)\n",
2735 gF1bCsCount,gCqiReqCount,gRiReqCount,gCqiDropCount,gPucchDropCount,gPuschCqiDropCount);
2737 printf("UL::(DCI0/CrcPass/CrcFail)::(%u/%u/%u)\n"
2738 "gPcellZeroBoOcc:%u\t gScellZeroBoOcc:%u dbgUeIdChngAndDatReqInClCnt: %u\n"
2739 "DelayedDatReqInMac: %u DelayedDatReqInCl : %u gIccPktRcvrMemDropCnt :%u\n",
2745 dbgUeIdChngAndDatReqInClCnt,
2746 dbgDelayedDatReqInMac,
2747 gDropDatReqCnt, gIccPktRcvrMemDropCnt);
2749 printf("SChed:: (P/S)::(%ld/%ld) \n",
2750 gPrimarySchedCount,gSCellSchedCount);
2752 printf("\n HQFDBK :: %ld\n",gHqFdbkCount);
2754 printf("\n PCell:: TB1:: (A/N/D)::(%ld/%ld/%ld) TB2:: (A/N/D)::(%ld/%ld/%ld)\n",
2755 gPCellTb1AckCount,gPCellTb1NackCount,gPCellTb1DtxCount,
2756 gPCellTb2AckCount,gPCellTb2NackCount,gPCellTb2DtxCount);
2758 printf("\n SCell:: TB1:: (A/N/D)::(%ld/%ld/%ld) TB2:: (A/N/D)::(%ld/%ld/%ld)\n",
2759 gSCellTb1AckCount,gSCellTb1NackCount,gSCellTb1DtxCount,
2760 gSCellTb2AckCount,gSCellTb2NackCount,gSCellTb2DtxCount);
2762 printf("\n CQI:: Recp(Pucch/Pusch):Rcvd(pcqi/rawacqireport/apcqi/AppReprt)::(%ld/%ld):(%ld/%ld/%ld/%ld)\n",
2763 gCqiRecpCount,gCqiRecpPuschCount,gCqiRcvdCount,gRawACqiCount,
2764 gACqiRcvdCount,gCqiReptToAppCount);
2765 printf("\n CQI:: PucchCqiSnrDropCnt/PucchCqiConfBitMaskDropCnt/PuschCqiConfMaskDropCount :: (%ld/%ld/%ld) \n",gCqiPucchLowSnrDropCount,gCqiPucchConfMaskDropCount,gCqiPuschConfMaskDropCount);
2767 printf("\n (F1BCS Count/Cqi/Ri/CqiDrop/PucchDrop/PuschCqiDrop)::(%ld/%ld/%ld/%ld/%ld/%ld)\n",
2768 gF1bCsCount,gCqiReqCount,gRiReqCount,gCqiDropCount,gPucchDropCount,gPuschCqiDropCount);
2770 printf("UL::(DCI0/CrcPass/CrcFail)::(%ld/%ld/%ld)\n"
2771 "gPcellZeroBoOcc:%ld\t gScellZeroBoOcc:%ld dbgUeIdChngAndDatReqInClCnt: %ld\n"
2772 "DelayedDatReqInMac: %ld DelayedDatReqInCl : %ld gIccPktRcvrMemDropCnt :%ld\n",
2778 dbgUeIdChngAndDatReqInClCnt,
2779 dbgDelayedDatReqInMac,
2780 gDropDatReqCnt, gIccPktRcvrMemDropCnt);
2781 //printf ("\n delayedApiCnt:%ld",delayedApiCnt);
2785 rgSCHLaaPrintStats();
2787 gCaDbgNonCaFrmt = gIccPktRcvrMemDropCnt = 0;
2799 gCqiPucchLowSnrDropCount = 0;
2800 gCqiPucchConfMaskDropCount = 0;
2801 gCqiPuschConfMaskDropCount = 0;
2802 gPuschCqiDropCount = 0;
2805 gUlCrcPassCount = 0;
2806 gUlCrcFailCount = 0;
2809 gCqiRecpPuschCount = 0;
2812 gCqiReptToAppCount = 0;
2817 gPrimarySchedCount = 0;
2818 gSCellSchedCount = 0;
2819 gSCellTb1AckCount = 0;
2820 gSCellTb2AckCount = 0;
2821 gSCellTb2AckCount = 0;
2822 gSCellTb2NackCount = 0;
2823 gPCellTb1AckCount = 0;
2824 gPCellTb1NackCount = 0;
2825 gPCellTb2AckCount = 0;
2826 gPCellTb2NackCount = 0;
2827 gSCellTb1NackCount=0;
2829 gPCellTb1DtxCount = 0;
2830 gPCellTb2DtxCount = 0;
2831 gSCellTb1DtxCount = 0;
2832 gSCellTb2DtxCount = 0;
2833 gPcellZeroBoOcc = 0;
2834 gScellZeroBoOcc = 0;
2842 } /* rgSCHTomTtiInd */
2844 /** @brief This function does the TTI processin for the uplink subframe,
2845 * already populated by the scheduler.
2849 * Function: rgSCHTomUtlProcUlSf
2852 * - Loop through the Uplink allocations present in the uplink subframe.
2853 * - For each allocation Fill a data reception request to be sent to PHY
2854 * - Also fills the harq reception requests for the expected HQ feedbacks.
2857 * @param [in] RgSchCellCb *cell
2858 * @param [out] RgSchErrInfo *err
2865 PRIVATE S16 rgSCHTomUtlProcUlSf
2871 PRIVATE S16 rgSCHTomUtlProcUlSf (cell, err)
2877 TfuRecpReqInfo *recpReqInfo;
2879 U16 validIdx = 0; /* Index computed from recreq's timing info*/
2881 Inst inst = cell->instIdx;
2883 TRC2(rgSCHTomUtlProcUlSf)
2885 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&recpReqInfo,
2886 sizeof(TfuRecpReqInfo))) != ROK)
2888 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate TfuRecpReqInfo "
2890 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
2893 recpReqInfo->cellId = cell->cellId;
2894 cmLListInit(&recpReqInfo->ueRecpReqLst);
2896 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, recpReqInfo->timingInfo,
2897 TFU_RECPREQ_DLDELTA);
2899 /* Filling data Reception requests */
2900 ret = rgSCHTomUtlFillDatRecpReq(recpReqInfo, cell,
2905 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to fill Data recption "
2906 "requests for cell");
2907 RGSCH_FREE_MEM(recpReqInfo);
2910 /* Filling HARQ Reception requests */
2911 ret = rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, validIdx,err);
2914 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to fill Harq Feedback "
2915 "reception requests for cell");
2916 RGSCH_FREE_MEM(recpReqInfo);
2919 /* sending the RecpReq to Phy */
2920 if (rgSCHUtlTfuRecpReq(inst, cell->tfuSap->sapCfg.suId, recpReqInfo) != ROK)
2922 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info for cell");
2925 } /* end of rgSCHTomUtlProcUlSf */
2929 /** @brief This function does the TTI processin for the uplink subframe,
2930 * already populated by the scheduler.
2934 * Function: rgSCHTomUtlPrcUlTddSpclSf
2937 * - Fill the SRS Info for the Special Subframe in Reception Req.
2938 * - Send the Reception Req to TFU
2941 * @param [in] RgSchCellCb *cell
2942 * @param [out] RgSchErrInfo *err
2948 PRIVATE S16 rgSCHTomUtlPrcUlTddSpclSf
2954 PRIVATE S16 rgSCHTomUtlPrcUlTddSpclSf (cell, err)
2960 TfuRecpReqInfo *recpReqInfo;
2961 U16 validIdx; /* Index computed from recreq's timing info*/
2962 Inst inst = cell->instIdx;
2964 TRC2(rgSCHTomUtlPrcUlTddSpclSf)
2966 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&recpReqInfo,
2967 sizeof(TfuRecpReqInfo))) != ROK)
2969 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to "
2970 "Allocate TfuRecpReqInfo for cell");
2971 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
2974 recpReqInfo->cellId = cell->cellId;
2975 cmLListInit(&recpReqInfo->ueRecpReqLst);
2977 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, recpReqInfo->timingInfo, TFU_RECPREQ_DLDELTA);
2979 RG_SCH_GET_IDX_PCQISRSSR(recpReqInfo->timingInfo, validIdx);
2982 if(cell->srsCfg.isSrsCfgPres &&
2983 rgSchTddCellSpSrsSubfrmTbl[cell->srsCfg.srsSubFrameCfg][recpReqInfo->timingInfo.slot])
2985 recpReqInfo->srsPres = TRUE;
2989 recpReqInfo->srsPres = FALSE;
2992 /* Filling SRS Reception requests */
2993 ret = rgSCHTomUtlFillSrsRecpReq (recpReqInfo, cell, validIdx, err);
2996 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to fill"
2997 " SRS recption requests for cell");;
2998 RGSCH_FREE_MEM(recpReqInfo);
3001 /* sending the RecpReq to Phy */
3002 if (rgSCHUtlTfuRecpReq(inst, cell->tfuSap->sapCfg.suId, recpReqInfo) != ROK)
3004 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSCHTomUtlPrcUlTddSpclSf() Unable to send "
3005 "Cntrl info for cell");
3008 } /* end of rgSCHTomUtlPrcUlTddSpclSf */
3011 /** @brief This function does all the processing related to a single downlink
3016 * Function: rgSCHTomUtlProcDlSf
3019 * - collate control data for all UEs and send to PHY
3020 * - collate data buffers for all UEs and send to PHY
3022 * @param [in] RgSchDlSf *dlSf
3023 * @param [in] RgSchDlSf *ulSf
3024 * @param [in] RgSchCellCb *cell
3025 * @param [out] RgSchErrInfo *err
3029 PRIVATE S16 rgSCHTomUtlProcDlSf
3034 RgTfuCntrlReqInfo *cntrlInfo,
3038 PRIVATE S16 rgSCHTomUtlProcDlSf (dlSf, ulSf, cell, cntrlInfo, err)
3042 RgTfuCntrlReqInfo *cntrlInfo;
3046 Inst inst = cell->instIdx;
3048 U8 sfTyp = 1; /* Dl Subframe */
3050 TRC2(rgSCHTomUtlProcDlSf);
3052 cmLListInit(&cntrlInfo->phichLst);
3053 cmLListInit(&cntrlInfo->dlPdcchLst);
3054 cmLListInit(&cntrlInfo->ulPdcchLst);
3056 #ifdef TFU_ALLOC_EVENT_NO_INIT
3057 cntrlInfo->ulTiming.sfn = cntrlInfo->ulTiming.subframe = 0;
3059 cntrlInfo->dlTiming = cell->dlDciTime;
3060 cntrlInfo->cellId = cell->cellId;
3061 cntrlInfo->ulTiming = cell->hiDci0Time;
3062 if((0 == (cntrlInfo->dlTiming.sfn % 30)) && (0 == cntrlInfo->dlTiming.slot))
3064 //printf("5GTF_CHECK rgSCHTomUtlProcDlSf Cntrl dl (%d : %d) ul (%d : %d)\n", cntrlInfo->dlTiming.sfn, cntrlInfo->dlTiming.subframe, cntrlInfo->ulTiming.sfn, cntrlInfo->ulTiming.subframe);
3066 /* Fill PCFICH info */
3067 /* Fix for DCFI FLE issue: when DL delta is 1 and UL delta is 0 and CFI
3068 *change happens in that SF then UL PDCCH allocation happens with old CFI
3069 *but CFI in control Req goes updated one since it was stored in the CELL
3071 cntrlInfo->cfi = dlSf->pdcchInfo.currCfi;
3072 #ifndef RG_ULSCHED_AT_CRC
3075 Mval = rgSchTddPhichMValTbl[cell->ulDlCfgIdx]
3076 [cell->hiDci0Time.subframe];
3077 if(dlSf->sfType == RG_SCH_SPL_SF_DATA)
3079 RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, cntrlInfo->cfi);
3084 /* Fill PHICH info */
3085 if ((ret = rgSCHTomUtlFillPhich (cell, cntrlInfo, ulSf, err)) != ROK)
3087 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PHICH info "
3088 "for cellId (%d)\n", cell->cellId));
3089 RGSCH_FREE_MEM(cntrlInfo);
3092 if ((ret = rgSCHTomUtlFillUlPdcch (cell, cntrlInfo, ulSf, err)) !=
3095 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PDCCH info "
3096 "for cellId (%d)\n", cell->cellId));
3097 RGSCH_FREE_MEM(cntrlInfo);
3102 if(0 == cntrlInfo->ulMpdcchLst.count)
3109 sfTyp = rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
3110 [cell->dlDciTime.subframe];
3112 if (sfTyp != 2) /* Uplink subframe */
3114 /* Fill PDCCH info */
3115 if ((ret = rgSCHTomUtlFillDlPdcch(cell,cntrlInfo, dlSf, err)) != ROK)
3117 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to send PDCCH info "
3118 "for cellId (%d)\n", cell->cellId));
3119 RGSCH_FREE_MEM(cntrlInfo);
3122 rgBwAlloInfo[dlSf->sfNum] += dlSf->bwAssigned;
3123 rgBwAlcnt[dlSf->sfNum] ++;
3126 #ifdef LTEMAC_SPS /* SPS_NEW_CHGS */
3127 cntrlInfo->isSPSOcc = dlSf->isSPSOcc;
3129 cntrlInfo->numDlActvUes += dlSf->numDlActvUes; /* 4UE_TTI_DELTA */
3130 dlSf->numDlActvUes = 0;
3132 if(0 == cntrlInfo->dlMpdcchLst.count)
3137 /* Now always sending down a cntrl req */
3138 /* sending the cntrl data to Phy */
3139 if (rgSCHUtlTfuCntrlReq(inst, cell->tfuSap->sapCfg.suId, cntrlInfo)
3142 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info "
3150 /** @brief This function handles sending of the PHICH information for the
3151 * downlink subframe to be sent in the next TTI.
3158 * - Loop through the PHICH information present in the downlink
3159 * subframe and fill the information in cntrlInfo.
3161 * @param [out] TfuCntrlReqInfo *cntrlInfo
3162 * @param [in] RgSchDlSf *dlSf
3163 * @param [out] RgSchErrInfo *err
3169 PRIVATE S16 rgSCHTomUtlFillPhich
3172 TfuCntrlReqInfo *cntrlInfo,
3177 PRIVATE S16 rgSCHTomUtlFillPhich(cell, cntrlInfo, dlSf, err)
3179 TfuCntrlReqInfo *cntrlInfo;
3187 TfuPhichInfo *harqAck;
3189 RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
3192 TRC2(rgSCHTomUtlFillPhich)
3194 /* Traversing the list of Phichs */
3195 node = dlSf->phichInfo.phichs.first;
3198 phich = (RgSchPhich*)node->node;
3199 if ((ret = rgSCHUtlGetEventMem((Ptr *)&harqAck, sizeof(TfuPhichInfo),
3200 &(cntrlInfo->memCp))) != ROK)
3202 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3205 #ifdef TFU_ALLOC_EVENT_NO_INIT
3206 harqAck->txPower = 0;
3208 /* fill in the tfu structure from the information present in the
3210 harqAck->rbStart = phich->rbStart;
3211 harqAck->nDmrs = phich->nDmrs;
3212 harqAck->isAck = phich->hqFeedBack;
3213 harqAck->isForMsg3 = phich->isForMsg3; /*SR_RACH_STATS : PHICH ACK/NACK for MSG3 */
3215 /* Changes for passing iPhich at TFU interface*/
3216 harqAck->iPhich = phich->iPhich;
3218 /* ccpu00138898 - Added Tx pwr offset for PHICH Tx*/
3220 harqAck->txPower = cellDl->phichTxPwrOffset;
3222 cmLListAdd2Tail(&cntrlInfo->phichLst, &(harqAck->lnk));
3223 harqAck->lnk.node = (PTR)harqAck;
3225 } /* end of while */
3231 /** @brief This function is a utility function to restart
3232 * deactivation timer.
3236 * Function: rgSCHTmrRestartScellDeactTmr
3239 * - Starts timer at scheduler
3241 * @param[in] RgSchCellCb *cell
3242 * @param[in] CmLteRnti rnti
3246 PRIVATE Void rgSCHTmrRestartScellDeactTmr
3252 PRIVATE Void rgSCHTmrRestartScellDeactTmr (cell, ueCb)
3258 RgSchUeCellInfo *sCellInfo = NULLP;
3262 if(RG_SCH_IS_CELL_SEC(ueCb, cell))
3264 sCellInfo = ueCb->cellInfo[(ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)])];
3266 if(sCellInfo->deactTmr.tmrEvnt != TMR_NONE)
3268 rgSCHTmrStopTmr(cell, RG_SCH_TMR_SCELL_DEACT, sCellInfo);
3270 if(PRSNT_NODEF == ueCb->sCellDeactTmrVal.pres)
3273 rgSCHTmrStartTmr(cell,sCellInfo,RG_SCH_TMR_SCELL_DEACT,
3274 ueCb->sCellDeactTmrVal.val);
3279 }/*end of rgSCHTmrRestartScellDeactTmr*/
3282 /** @brief This function will send all the PDCCH's for the given downlink
3290 * - Loop through all the scheduled HARQ processes and fill
3291 * the PDCCH information in cntrlInfo.
3293 * @param [out] TfuCntrlReqInfo *cntrlInfo
3294 * @param [in] RgSchDlSf *dlSf
3295 * @param [out] RgSchErrInfo *err
3300 EXTERN U32 numdlSpsRelSentToTf;
3302 PRIVATE S16 rgSCHTomUtlFillDlPdcch
3305 TfuCntrlReqInfo *cntrlInfo,
3310 PRIVATE S16 rgSCHTomUtlFillDlPdcch(cell,cntrlInfo, dlSf, err)
3312 TfuCntrlReqInfo *cntrlInfo;
3320 TfuPdcchInfo *tfuPdcch;
3321 U8 isDcivld = FALSE;
3324 TRC2(rgSCHTomUtlFillDlPdcch)
3326 /* Traversing the scheduled Harq processes */
3327 node = dlSf->pdcchInfo.pdcchs.first;
3330 pdcch = (RgSchPdcch*)node->node;
3331 switch(pdcch->dci.dciFormat)
3333 case TFU_DCI_FORMAT_3:
3334 isDcivld = (pdcch->dci.u.format3Info.isPucch) ? TRUE : FALSE;
3337 case TFU_DCI_FORMAT_3A:
3338 isDcivld = (pdcch->dci.u.format3AInfo.isPucch) ? TRUE : FALSE;
3351 /*ccpu00117179 - ADD - Build only non DCI format-0 messages */
3352 if((pdcch->dci.dciFormat == TFU_DCI_FORMAT_0) ||
3353 (pdcch->dci.dciFormat == TFU_DCI_FORMAT_A1) ||
3354 (pdcch->dci.dciFormat == TFU_DCI_FORMAT_A2))
3361 #ifdef RGSCH_SPS_STATS
3362 if((pdcch->dci.dciFormat == TFU_DCI_FORMAT_1A) &&
3363 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.mcs == 0x1F) &&
3364 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.type == TFU_ALLOC_TYPE_RIV) &&
3365 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.u.riv == 0xFFFFFFFF))
3367 numdlSpsRelSentToTf++;
3371 if ((ret = rgSCHUtlGetEventMem((Ptr *)&tfuPdcch, sizeof(TfuPdcchInfo),
3372 &(cntrlInfo->memCp))) != ROK)
3374 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3378 tfuPdcch->crnti = pdcch->crnti;
3379 tfuPdcch->isSpsRnti = pdcch->isSpsRnti;
3381 tfuPdcch->rnti = pdcch->rnti;
3384 rgSCHTmrRestartScellDeactTmr(cell,pdcch->ue);
3386 tfuPdcch->dciNumOfBits = pdcch->dciNumOfBits;
3388 tfuPdcch->nCce = pdcch->nCce;
3389 tfuPdcch->aggrLvl = pdcch->aggrLvl;
3390 tfuPdcch->dci = pdcch->dci;
3392 //TODO_SID: Need to check these values during INT
3393 tfuPdcch->sectorId = 0;
3394 tfuPdcch->sccIdx = 0;
3397 /* SR_RACH_STATS : Reset isTBMsg4 */
3398 pdcch->dci.u.format1aInfo.t.pdschInfo.isTBMsg4 = FALSE;
3399 /* To be enhanced later for 2.1 */
3400 cmLListAdd2Tail(&cntrlInfo->dlPdcchLst, &(tfuPdcch->lnk));
3401 tfuPdcch->lnk.node = (PTR)tfuPdcch;
3403 if((pdcch->rnti > 60) && (pdcch->rnti < 5000))
3405 #if defined (TENB_STATS) && defined (RG_5GTF)
3406 cell->tenbStats->sch.dl5gtfPdcchSend++;
3410 } /* end of while */
3412 if((numUePerTti) && (numUePerTti < RG_MAX_NUM_UE_PER_TTI ))
3414 cell->dlNumUeSchedPerTti[numUePerTti-1]++;
3416 gDlNumUePerTti[numUePerTti-1]++;
3420 } /* end of rgSCHTomUtlFillDlPdcch*/
3422 #ifdef RGSCH_SPS_STATS
3423 extern U32 rgSchSpsRelSentToTf;
3424 extern U32 rgSchSpsRelPdcchAllocd;
3426 /** @brief This function will send all the UL PDCCH's for the given
3434 * - Loop through all the scheduled HARQ processes and fill
3435 * the PDCCH information in cntrlInfo.
3437 * @param [out] TfuCntrlReqInfo *cntrlInfo
3438 * @param [in] RgSchDlSf *dlSf
3439 * @param [out] RgSchErrInfo *err
3445 PRIVATE S16 rgSCHTomUtlFillUlPdcch
3448 TfuCntrlReqInfo *cntrlInfo,
3453 PRIVATE S16 rgSCHTomUtlFillUlPdcch(cntrlInfo, dlSf, err)
3455 TfuCntrlReqInfo *cntrlInfo;
3463 TfuPdcchInfo *tfuPdcch;
3464 U8 isDcivld = FALSE;
3466 TRC2(rgSCHTomUtlFillUlPdcch)
3468 /* Traversing the scheduled Harq processes */
3469 node = dlSf->pdcchInfo.pdcchs.first;
3472 pdcch = (RgSchPdcch*)node->node;
3474 /*ccpu00116712- Function should pick only UL allocation related control
3476 switch(pdcch->dci.dciFormat)
3478 case TFU_DCI_FORMAT_A1:
3482 case TFU_DCI_FORMAT_A2:
3486 case TFU_DCI_FORMAT_3:
3487 isDcivld = (pdcch->dci.u.format3Info.isPucch) ? FALSE : TRUE;
3490 case TFU_DCI_FORMAT_3A:
3491 isDcivld = (pdcch->dci.u.format3AInfo.isPucch) ? FALSE : TRUE;
3506 /*ccpu00116712- Function should pick only UL allocation related control
3508 if ((ret = rgSCHUtlGetEventMem((Ptr *)&tfuPdcch, sizeof(TfuPdcchInfo),
3509 &(cntrlInfo->memCp))) != ROK)
3511 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3514 tfuPdcch->rnti = pdcch->rnti;
3516 rgSCHTmrRestartScellDeactTmr(cell,pdcch->ue);
3518 tfuPdcch->dciNumOfBits = pdcch->dciNumOfBits;
3520 tfuPdcch->nCce = pdcch->nCce;
3521 tfuPdcch->aggrLvl = pdcch->aggrLvl;
3522 tfuPdcch->dci = pdcch->dci;
3524 //TODO_SID: Need to check these values during INT
3525 tfuPdcch->sectorId = 0;
3526 tfuPdcch->sccIdx = 0;
3529 /* To be enhanced later for 2.1 */
3531 #if defined (TENB_STATS) && defined (RG_5GTF)
3532 cell->tenbStats->sch.ul5gtfPdcchSend++;
3534 cmLListAdd2Tail(&cntrlInfo->ulPdcchLst, &(tfuPdcch->lnk));
3535 tfuPdcch->lnk.node = (PTR)tfuPdcch;
3536 } /* end of while */
3538 #ifdef RGSCH_SPS_STATS
3539 if (rgSchSpsRelSentToTf != rgSchSpsRelPdcchAllocd)
3545 } /* end of rgSCHTomUtlFillUlPdcch*/
3547 /** @brief This function does the processing for Timing adjustment.
3554 * - Loop through the ue present ueTimeLst, decrement the remaining
3558 * @param [in] RgSchCellCb *cell
3564 PRIVATE S16 rgSCHTomUtlProcTA
3569 PRIVATE S16 rgSCHTomUtlProcTA (cell)
3576 TRC2(rgSCHTomUtlProcTA);
3578 node = cell->taUeLst.first;
3581 ue = (RgSchUeCb *)node->node;
3583 if (ue->dl.taCb.numRemSf == 0)
3585 ue->dl.taCb.state = RGSCH_TA_IDLE;
3586 /* If Outstanding Ta is present, schedule it */
3587 if(ue->dl.taCb.outStndngTa == TRUE)
3589 rgSCHUtlReTxTa(cell, ue);
3593 /* We need to reset state and also value of TA,
3594 * then we start the timer */
3595 ue->dl.taCb.ta = RGSCH_NO_TA_RQD;
3596 /* Start the timer only if TA is cfgd as FINITE value */
3597 if (ue->dl.taCb.cfgTaTmr)
3599 rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_TA, ue->dl.taCb.cfgTaTmr);
3602 /* need to delete from the link list */
3603 cmLListDelFrm(&(cell->taUeLst), &(ue->taLnk));
3604 ue->taLnk.node = NULLP;
3608 ue->dl.taCb.numRemSf--;
3610 } /* end of taUeLst */
3613 } /* end of rgSCHTomUtlProcTA */
3615 /** @brief This function handles filling of Hq reception request to
3630 PUBLIC S16 rgSCHTomUtlFillHqFdbkInfo
3632 TfuRecpReqInfo *recpReqInfo,
3635 RgSchDlHqProcCb *hqCb,
3637 TfuUeRecpReqInfo *pucchRecpInfo,
3638 RgSchDlHqProcCb *prvHqCb,
3642 PUBLIC S16 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, validIdx, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err)
3643 TfuRecpReqInfo *recpReqInfo;
3646 RgSchDlHqProcCb *hqCb;
3648 TfuUeRecpReqInfo *pucchRecpInfo;
3649 RgSchDlHqProcCb *prvHqCb;
3654 PUBLIC S16 rgSCHTomUtlFillHqFdbkInfo
3656 TfuRecpReqInfo *recpReqInfo,
3658 RgSchDlHqProcCb *hqCb,
3660 TfuUeRecpReqInfo *pucchRecpInfo,
3661 RgSchDlHqProcCb *prvHqCb,
3665 PUBLIC S16 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err)
3666 TfuRecpReqInfo *recpReqInfo;
3668 RgSchDlHqProcCb *hqCb;
3670 TfuUeRecpReqInfo *pucchRecpInfo;
3671 RgSchDlHqProcCb *prvHqCb;
3677 RgSchDlHqTbCb *tbCb;
3679 Bool isAddToLst = FALSE;
3681 for (idx = 0 ;idx < 2; idx++)
3683 if (HQ_TB_WAITING == hqCb->tbInfo[idx].state)
3685 tbCb = &hqCb->tbInfo[idx];
3687 /* FOR ACK NAK REP */
3688 if ((hqCb->hqE->ue != NULLP) &&
3689 (hqCb->hqE->ue->measGapCb.isMeasuring == TRUE))
3691 if ((tbCb->fbkRecpRepCntr) &&
3692 (--tbCb->fbkRecpRepCntr))
3694 /* Add to next subfarme */
3695 /* Add this hqCb to the next dlSf's ackNakRepQ */
3696 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
3697 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
3698 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
3699 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
3702 rgSCHTomUtlMoveNxtOccasion(cell, hqCb->hqE->ue, validIdx);
3710 /* Go to the next node */
3716 //if (hqCb != prvHqCb)
3718 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
3719 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
3722 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
3723 "TfuUeRecpReqInfo for cell");
3724 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3727 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
3728 if ((hqCb->hqE->ue != NULLP) /*&&
3729 ((tbCb->lchSchdData[0].lcId != 0) || (tbCb->taSnt ==
3733 pucchRecpInfo->rnti = hqCb->hqE->ue->ueId;
3737 if (hqCb->hqE->raCb)
3739 pucchRecpInfo->rnti = hqCb->hqE->raCb->tmpCrnti;
3745 if (!hqCb->spsN1PucchRes.pres)
3748 pucchRecpInfo->t.pucchRecpReq.hqType =
3749 TFU_HQ_RECP_REQ_NORMAL;
3750 pucchRecpInfo->t.pucchRecpReq.t.nCce =
3756 pucchRecpInfo->t.pucchRecpReq.hqType =
3757 TFU_HQ_RECP_REQ_N1PUCCH;
3758 pucchRecpInfo->t.pucchRecpReq.t.n1Pucch =
3759 hqCb->spsN1PucchRes.val;
3763 /* Handling of other types */
3764 pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
3765 #else /* TFU_UPGRADE */
3766 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
3767 if ((hqCb->tbInfo[0].state == HQ_TB_WAITING) &&
3768 (hqCb->tbInfo[1].state == HQ_TB_WAITING))
3770 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz = 2; /* MIMO */
3774 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz = 1; /* NON-MIMO */
3778 /* PucchRecpReq needs to be filled up for n1Pucch resource for SPS
3780 if (hqCb->spsN1PucchRes.pres)
3782 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
3785 #endif /* LTEMAC_SPS */
3787 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
3788 cell->pucchCfg.n1PucchAn);
3791 rgSCHEmtcFillPucchRecpInfo(cell, hqCb, &(pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0]));
3794 #endif/*TFU_UPGRADE*/
3797 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, hqCb->hqE->ue,
3798 pucchRecpInfo, validIdx,FALSE);
3801 /* Passing last parameter as FALSE in this case as it will be verified from hqCb*/
3802 isAddToLst = rgSCHEmtcAddRecpInfoToLst(hqCb,recpReqInfo, pucchRecpInfo,FALSE);
3806 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
3808 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
3811 if ((tbCb->fbkRecpRepCntr) &&
3812 (--tbCb->fbkRecpRepCntr))
3814 /* Add to next subfarme */
3815 /* Add this hqCb to the next dlSf's ackNakRepQ */
3816 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
3817 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
3818 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
3819 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
3825 }/* end of rgSCHTomUtlFillHqFdbkInfo */
3828 /** @brief This function handles filling of Hq reception request to
3833 * Function:rgSCHTomUtlFillHqFdbkFor5gtf
3837 * @param [out] TfuRecpReqInfo *recpReqInfo
3838 * @param [in] RgSchCellCb *cell
3839 * @param [in] U16 validIdx,
3840 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
3841 * @param [in] RgSchDlSf *dlSf,
3842 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
3843 * @param [out] RgSchErrInfo *err
3850 PRIVATE S16 rgSCHTomUtlFillHqFdbkFor5gtf
3852 TfuRecpReqInfo *recpReqInfo,
3855 RgSchDlHqInfo *dlSfHqInfo,
3857 TfuUeRecpReqInfo *pucchRecpInfo,
3861 PRIVATE S16 rgSCHTomUtlFillHqFdbkFor5gtf (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err)
3862 TfuRecpReqInfo *recpReqInfo;
3865 RgSchDlHqInfo *dlSfHqInfo;
3867 TfuUeRecpReqInfo *pucchRecpInfo;
3872 Inst inst = cell->instIdx;
3877 TfuUePucchRecpReq *pucchReqInfo = NULLP;
3879 hqPNode = dlSfHqInfo->hqPLst.first;
3880 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
3886 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
3887 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
3890 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate "
3891 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId));
3892 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3895 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
3896 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
3897 * instead of SPS-CRNTI */
3899 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
3901 pucchReqInfo->uciInfo = TFU_XPUCCH_UCI_INFO;
3903 /* 5gtf TODO : Hardcoded nPUCCHIdx */
3904 pucchReqInfo->uciPduInfo.pucchIndex = 0;
3906 pucchReqInfo->uciPduInfo.numBits = 1;
3908 /* 5gtf TODO : CQI Periodicity Hardcoded to (n,0)*/
3909 if (RGSCH_TIMEINFO_SAME (recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn))
3911 pucchReqInfo->uciPduInfo.numBits += 5;
3912 RG_SCH_ADD_TO_CRNT_TIME(recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn,
3913 ue->ue5gtfCb.cqiRiPer);
3916 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
3917 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
3919 }/* end of rgSCHTomUtlFillHqFdbkForFrmt1B */
3923 /** @brief This function handles filling of Hq reception request to
3928 * Function:rgSCHTomUtlFillHqFdbkForFrmt1B
3931 * Allocates the N1Pucch Resources based on teh A Value
3933 * @param [out] TfuRecpReqInfo *recpReqInfo
3934 * @param [in] RgSchCellCb *cell
3935 * @param [in] U16 validIdx,
3936 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
3937 * @param [in] RgSchDlSf *dlSf,
3938 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
3939 * @param [out] RgSchErrInfo *err
3947 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B
3949 TfuRecpReqInfo *recpReqInfo,
3952 RgSchDlHqInfo *dlSfHqInfo,
3954 TfuUeRecpReqInfo *pucchRecpInfo,
3958 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err)
3959 TfuRecpReqInfo *recpReqInfo;
3962 RgSchDlHqInfo *dlSfHqInfo;
3964 TfuUeRecpReqInfo *pucchRecpInfo;
3969 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B
3971 TfuRecpReqInfo *recpReqInfo,
3973 RgSchDlHqInfo *dlSfHqInfo,
3975 TfuUeRecpReqInfo *pucchRecpInfo,
3979 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt1B (recpReqInfo, cell, hqCb, dlSf, pucchRecpInfo, err)
3980 TfuRecpReqInfo *recpReqInfo;
3982 RgSchDlHqInfo *dlSfHqInfo;
3984 TfuUeRecpReqInfo *pucchRecpInfo;
3990 Inst inst = cell->instIdx;
3994 RgSchDlHqProcCb *hqCb = NULLP;
3996 TfuUePucchRecpReq *pucchReqInfo = NULLP;
3997 Bool isDatPresOnSecCell = FALSE;
3998 U8 primCellTbCount = 0;
4000 hqPNode = dlSfHqInfo->hqPLst.first;
4001 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
4007 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4008 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
4011 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate "
4012 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId));
4013 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4016 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4017 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
4018 * instead of SPS-CRNTI */
4020 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
4023 pucchReqInfo->hqType = TFU_HQ_RECP_REQ_NORMAL;
4024 /* Handling of other types */
4025 pucchReqInfo->type = TFU_UCI_HARQ;
4026 #else /* TFU_UPGRADE */
4027 pucchReqInfo->uciInfo = TFU_PUCCH_HARQ;
4028 /* Fill hqFdbkMode by using uciFrmtTyp from dlSfHqInfo */
4029 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
4030 /* Fill HqSz by using totalTbCnt based on the TM mode and
4031 * the number of serv cells configured*/
4033 pucchReqInfo->hqInfo.hqSz = ue->f1bCsAVal;
4034 pucchReqInfo->hqInfo.pucchResCnt = ue->f1bCsAVal;
4036 cmMemset((U8 *)pucchReqInfo->hqInfo.hqRes,0xff,sizeof(U16)*TFU_MAX_HQ_RES);
4038 /* Two Resources needs to be configured if the
4039 * serving cell is in mimo mode else single
4041 if ((dlSf->relPdcch != NULLP) &&
4042 (RGSCH_TIMEINFO_SAME(recpReqInfo->timingInfo, ue->relPdcchFbkTiming)))
4043 {/* Pcell is having sps rel pdcch present */
4044 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
4045 {/* prim cell is in mimo mode, use 0 and 1 */
4046 pucchReqInfo->hqInfo.hqRes[0] = (dlSf->relPdcch->nCce +
4047 cell->pucchCfg.n1PucchAn);
4048 pucchReqInfo->hqInfo.hqRes[1] = pucchReqInfo->hqInfo.hqRes[0] + 1;
4053 pucchReqInfo->hqInfo.hqRes[2] = (dlSf->relPdcch->nCce +
4054 cell->pucchCfg.n1PucchAn);
4056 /* Release the pdcch so that it will not further processed */
4057 rgSCHUtlPdcchPut(ue->cell,&dlSf->pdcchInfo, dlSf->relPdcch);
4058 dlSf->relPdcch = NULLP;/* only one UE will be scheduled for release pdcch order in one tti */
4060 #endif/*LTEMAC_SPS*/
4061 #endif/*TFU_UPGRADE*/
4064 hqCb = (RgSchDlHqProcCb *)hqPNode->node;
4065 hqPNode = hqPNode->next;
4066 /* In case of CSI + 1BCS , CSI will be
4067 * dropped if scheduling is present on
4068 * seconday cell.36.213 10.1.1
4070 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4072 isDatPresOnSecCell = TRUE;
4075 if ((hqCb->tbInfo[0].state == HQ_TB_WAITING) &&
4076 (hqCb->tbInfo[1].state == HQ_TB_WAITING))
4078 primCellTbCount = 2;
4081 primCellTbCount = 1;
4085 pucchReqInfo->t.nCce = hqCb->pdcch->nCce;
4088 switch(ue->f1bCsAVal)
4090 case RG_SCH_A_VAL_2:
4091 /* harq(0) is primary harq(1) is secondary) */
4092 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4094 pucchReqInfo->hqInfo.hqRes[1] = ue->n1PucchF1bResCb.\
4095 cw1N1Res[hqCb->tpc].n1PucchIdx;
4097 else/* primary cell */
4100 /* Need to consider only sps occasions */
4101 if (hqCb->spsN1PucchRes.pres)
4103 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
4106 #endif /* LTEMAC_SPS */
4109 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
4110 cell->pucchCfg.n1PucchAn);
4114 case RG_SCH_A_VAL_3:
4115 /* Serving cell in mimo mode should be
4116 * in 0 and 1 and the serving cell in siso
4117 * mode should be in 2 indices */
4118 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4120 U8 cellIdx = ue->cellIdToCellIdxMap[RG_SCH_CELLINDEX(hqCb->hqE->cell)];
4121 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[cellIdx]->txMode.txModeEnum) > 1)
4122 {/* Sec cell is in mimo mode, use 0 and 1 */
4123 pucchReqInfo->hqInfo.hqRes[0] =
4124 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
4126 pucchReqInfo->hqInfo.hqRes[1] =
4127 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
4130 {/* Sec cell is in siso mode, use 2 */
4131 pucchReqInfo->hqInfo.hqRes[2] =
4132 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
4136 {/* primary cell hq */
4137 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
4138 {/* prim cell is in mimo mode, use 0 and 1 */
4140 if (hqCb->spsN1PucchRes.pres)
4141 {/* SPS occasions */
4142 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
4143 pucchReqInfo->hqInfo.hqRes[1] = hqCb->spsN1PucchRes.val + 1;
4146 #endif /* LTEMAC_SPS */
4148 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
4149 cell->pucchCfg.n1PucchAn);
4150 pucchReqInfo->hqInfo.hqRes[1] = (hqCb->pdcch->nCce +
4151 cell->pucchCfg.n1PucchAn + 1);
4155 {/* prim cell is in siso mode use 2 */
4157 /* Need to consider only sps occasions */
4158 if (hqCb->spsN1PucchRes.pres)
4160 pucchReqInfo->hqInfo.hqRes[2] = hqCb->spsN1PucchRes.val;
4163 #endif /* LTEMAC_SPS */
4166 pucchReqInfo->hqInfo.hqRes[2] = (hqCb->pdcch->nCce +
4167 cell->pucchCfg.n1PucchAn);
4173 case RG_SCH_A_VAL_4:
4175 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
4176 {/* 2 and 3 for sec cell */
4177 pucchReqInfo->hqInfo.hqRes[2] =
4178 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
4179 pucchReqInfo->hqInfo.hqRes[3] =
4180 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
4182 else/* primary cell */
4183 {/* 0 and 1 are for primary cell */
4185 /* Need to consider only sps occasions */
4186 if (hqCb->spsN1PucchRes.pres)
4188 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
4189 pucchReqInfo->hqInfo.hqRes[1] = hqCb->spsN1PucchRes.val + 1;
4192 #endif /* LTEMAC_SPS */
4195 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
4196 cell->pucchCfg.n1PucchAn);
4197 pucchReqInfo->hqInfo.hqRes[1] = (hqCb->pdcch->nCce +
4198 cell->pucchCfg.n1PucchAn + 1);
4205 /* TOD:: Add error print */
4209 #endif/*TFU_UPGRADE*/
4220 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, ue,
4221 pucchRecpInfo, validIdx,isDatPresOnSecCell);
4223 /* Channel selection wil not be used in case of
4224 * CQI + HARQ. if the data was present only on
4226 if((isDatPresOnSecCell == FALSE) &&
4227 (dlSfHqInfo->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS))
4228 {/* Data is present only on primary cell */
4230 switch(pucchReqInfo->uciInfo)
4232 case TFU_PUCCH_HARQ_SRS:
4233 case TFU_PUCCH_HARQ_CQI:
4234 case TFU_PUCCH_HARQ_SR_SRS:
4235 case TFU_PUCCH_HARQ_SR_CQI:
4237 dlSfHqInfo->uciFrmtTyp = RG_SCH_UCI_FORMAT1A_1B;
4238 pucchReqInfo->hqInfo.hqSz = primCellTbCount;
4239 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
4248 #endif/*TFU_UPGRADE*/
4249 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4250 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4252 }/* end of rgSCHTomUtlFillHqFdbkForFrmt1B */
4253 /** @brief This function handles filling of Hq reception request to
4258 * Function:rgSCHTomUtlFillHqFdbkForFrmt3
4261 * Allocates the N1Pucch Resources based on teh A Value
4263 * @param [out] TfuRecpReqInfo *recpReqInfo
4264 * @param [in] RgSchCellCb *cell
4265 * @param [in] U16 validIdx,
4266 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
4267 * @param [in] RgSchDlSf *dlSf,
4268 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
4269 * @param [out] RgSchErrInfo *err
4277 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3
4279 TfuRecpReqInfo *recpReqInfo,
4282 RgSchDlHqInfo *dlSfHqInfo,
4284 TfuUeRecpReqInfo *pucchRecpInfo,
4288 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3 (recpReqInfo, cell, validIdx, hqCb, dlSf, pucchRecpInfo, err)
4289 TfuRecpReqInfo *recpReqInfo;
4292 RgSchDlHqInfo *dlSfHqInfo;
4294 TfuUeRecpReqInfo *pucchRecpInfo;
4299 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3
4301 TfuRecpReqInfo *recpReqInfo,
4303 RgSchDlHqInfo *dlSfHqInfo,
4305 TfuUeRecpReqInfo *pucchRecpInfo,
4309 PRIVATE S16 rgSCHTomUtlFillHqFdbkForFrmt3 (recpReqInfo, cell, hqCb, dlSf, pucchRecpInfo, err)
4310 TfuRecpReqInfo *recpReqInfo;
4312 RgSchDlHqInfo *dlSfHqInfo;
4314 TfuUeRecpReqInfo *pucchRecpInfo;
4320 Inst inst = cell->instIdx;
4325 TfuUePucchRecpReq *pucchReqInfo = NULLP;
4327 //hqPNode = dlSfHqInfo->hqPLst.first;
4328 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
4334 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4335 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
4338 RGSCHDBGERRNEW(inst,(rgSchPBuf(inst),"Unable to Allocate "
4339 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId));
4340 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4343 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4344 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
4345 * instead of SPS-CRNTI */
4347 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
4350 pucchReqInfo->hqType = TFU_HQ_RECP_REQ_NORMAL;
4351 /* Handling of other types */
4352 pucchReqInfo->type = TFU_UCI_HARQ;
4353 #else /* TFU_UPGRADE */
4354 pucchReqInfo->uciInfo = TFU_PUCCH_HARQ;
4355 /* Fill hqFdbkMode by using uciFrmtTyp from dlSfHqInfo */
4356 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
4357 /* Fill HqSz by using totalTbCnt based on the TM mode and
4358 * the number of serv cells configured*/
4360 pucchReqInfo->hqInfo.hqSz = ue->f1bCsAVal;
4361 pucchReqInfo->hqInfo.pucchResCnt = 1;
4363 cmMemset((U8 *)pucchReqInfo->hqInfo.hqRes,0xff,sizeof(U16)*TFU_MAX_HQ_RES);
4364 #endif/*TFU_UPGRADE*/
4365 pucchReqInfo->hqInfo.hqRes[0] = dlSfHqInfo->n3ScellPucch.n3PucchIdx;
4367 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, ue,
4368 pucchRecpInfo, validIdx,TRUE);
4369 #endif/*TFU_UPGRADE*/
4370 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4371 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4373 }/* end of rgSCHTomUtlFillHqFdbkForFrmt3 */
4377 /** @brief This function handles filling of HARQ feedback recption request to
4386 * @param [out] TfuRecpReqInfo *recpReqInfo
4387 * @param [in] RgSchCellCb *cell
4388 * @param [out] RgSchErrInfo *err
4395 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq
4397 TfuRecpReqInfo *recpReqInfo,
4403 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, validIdx, err)
4404 TfuRecpReqInfo *recpReqInfo;
4411 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq
4413 TfuRecpReqInfo *recpReqInfo,
4418 PRIVATE S16 rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, err)
4419 TfuRecpReqInfo *recpReqInfo;
4426 RgSchDlHqProcCb *hqCb;
4427 CmLteTimingInfo futTime;
4430 TfuUeRecpReqInfo *pucchRecpInfo = NULLP;
4432 RgSchDlHqProcCb *prvHqCb=NULLP;
4434 TRC2(rgSCHTomUtlFillHqFdbkRecpReq);
4441 /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper output
4442 * if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME() as it is
4443 * serving the purpose */
4444 RGSCHDECRFRMCRNTTIME(cell->crntTime, futTime, (RG_SCH_CMN_HARQ_INTERVAL -
4445 TFU_RECPREQ_DLDELTA));
4446 dlSf = rgSCHUtlSubFrmGet (cell, futTime);
4447 /* Get the next dlsf as well */
4448 RG_SCH_ADD_TO_CRNT_TIME(futTime, futTime, 1)
4449 nxtDlsf = rgSCHUtlSubFrmGet (cell, futTime);
4453 if (dlSf->ueLst.count != 0)
4455 node = dlSf->ueLst.first;
4458 ue = (RgSchUeCb *)(node->node);
4461 if(ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx].isPuschHarqRecpPres == TRUE)
4462 {/* This UE is already considered for PUSCH
4466 rgSCHTomUtlFillHqFdbkFor5gtf(recpReqInfo, cell, validIdx,
4467 &ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx], dlSf, pucchRecpInfo, err);
4468 } /* end of while */
4469 } /* If hq is expected */
4471 if (dlSf->msg4HqPLst.count != 0)
4474 node = dlSf->msg4HqPLst.first;
4477 hqCb = (RgSchDlHqProcCb*)(node->node);
4479 //TODO_SID: need to check validIdx
4480 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, validIdx, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err);
4482 } /* end of while */
4485 /* Check with TDD Code */
4486 /* FOR ACK NACK REP */
4488 } /* end of rgSCHTomUtlFillHqFdbkRecpReq */
4490 /** @brief This function handles filling of SR reception request to
4499 * @param [out] TfuRecpReqInfo *recpReqInfo
4500 * @param [in] RgSchCellCb *cell
4501 * @param [out] RgSchErrInfo *err
4507 PRIVATE S16 rgSCHTomUtlFillSrRecpReq
4509 TfuRecpReqInfo *recpReqInfo,
4515 PRIVATE S16 rgSCHTomUtlFillSrRecpReq (recpReqInfo, cell, validIdx, err)
4516 TfuRecpReqInfo *recpReqInfo;
4523 TfuUeRecpReqInfo *pucchRecpInfo;
4529 RgSchCmnUlUeSpsInfo *ulSpsUe = NULL;
4533 TRC2(rgSCHTomUtlFillSrRecpReq);
4537 node = cell->pCqiSrsSrLst[validIdx].srLst.first;
4540 ue = (RgSchUeCb *)(node->node);
4541 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4547 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4548 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4550 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4551 "TfuUeRecpReqInfo for cell RNTI:%d",ue->ueId);
4552 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4555 #ifdef TFU_ALLOC_EVENT_NO_INIT
4556 cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4557 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4563 /* Should we check for Rel8 and above???
4564 * Dont send SR recp req if logicalChannelSR-Mask enabled and UL SPS is
4566 ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue, cell);
4567 /* Avoiding check for ulSpsEnabled as isUlSpsActv FALSE if sps is not enabled*/
4568 if((ue->ul.ulSpsCfg.isLcSRMaskEnab) &&
4569 (ulSpsUe->isUlSpsActv))
4571 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
4576 pucchRecpInfo->rnti = ue->ueId;
4577 pucchRecpInfo->t.pucchRecpReq.srInfo.n1PucchIdx =
4578 ue->srCb.srCfg.srSetup.srResIdx;
4579 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR;
4580 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
4581 rgSCHTomUtlFillCqiSrsWithSr(cell, ue, recpReqInfo,
4582 pucchRecpInfo, validIdx);
4584 isAddToLst = rgSCHEmtcAddRecpInfoToLst(NULLP,recpReqInfo, pucchRecpInfo,ue->isEmtcUe);
4588 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4590 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4593 }/* end of rgSCHTomUtlFillSrRecpReq */
4596 /** @brief This function tells will the UE has a periodic CQI/PMI/RI
4605 * @param [in] RgSchUeCb *ue
4606 * @param [out] Bool *willueRprtCqiRi
4613 PRIVATE S16 rgSCHTomUtlWillUeRprtCqiRi
4616 Bool *willueRprtCqiRi
4619 PRIVATE S16 rgSCHTomUtlWillUeRprtCqiRi ( ue, willueRprtCqiRi)
4621 Bool *willueRprtCqiRi;
4624 TRC2(rgSCHTomUtlWillUeRprtCqiRi);
4626 /* Intialising Reporting probability as TRUE */
4627 *willueRprtCqiRi = TRUE;
4629 /* Checking the cases in which UE will not report CQIPMI/RI */
4630 if(ue->isDrxEnabled && ue->drxCb)
4633 if(ue->drxCb->cqiMask.pres && ue->drxCb->cqiMask.val == RGR_DRX_SETUP)
4634 {/*cqiMask is setup by upper layers */
4635 if((ue->drxCb->drxUlInactvMask & RG_SCH_DRX_ONDUR_BITMASK) ==
4636 RG_SCH_DRX_ONDUR_BITMASK)
4637 {/*onDuration NOT running, do not expect cqi/pmi/ri*/
4638 *willueRprtCqiRi = FALSE;
4642 #endif /*end of LTEMAC_R9*/
4643 /* ccpu00134258: Fix for CQI DRX issue*/
4644 if(ue->drxCb->onDurTmrLen > 2)
4646 if ( !RG_SCH_DRX_UL_IS_UE_ACTIVE(ue->drxCb) )
4647 {/*UE is not active, do not expect cqi/pmi/ri*/
4648 *willueRprtCqiRi = FALSE;
4651 }/*ue->isDrxEnabled*/
4654 } /*End of rgSCHTomUtlWillUeRprtCqiRi*/
4656 /** @brief This function handles filling of RI reception request to
4665 * @param [out] TfuRecpReqInfo *recpReqInfo
4666 * @param [in] RgSchCellCb *cell
4667 * @param [in] U16 validIdx
4668 * @param [out] RgSchErrInfo *err
4674 PRIVATE S16 rgSCHTomUtlFillRiRecpReq
4676 TfuRecpReqInfo *recpReqInfo,
4682 PRIVATE S16 rgSCHTomUtlFillRiRecpReq (recpReqInfo, cell, validIdx, err)
4683 TfuRecpReqInfo *recpReqInfo;
4690 TfuUeRecpReqInfo *pucchRecpInfo;
4693 Bool willUeRprtCqi; /* Flag set due to CQI Mask
4694 and UE inactive state (DRX) */
4695 RgSchUePCqiCb *riCb = NULLP;
4696 TRC2(rgSCHTomUtlFillRiRecpReq);
4698 node = cell->pCqiSrsSrLst[validIdx].riLst.first;
4701 riCb = (RgSchUePCqiCb *)(node->node);
4702 ue = riCb->servCellInfo->ue;
4703 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4705 if(riCb->riRecpPrcsd)
4707 /*ccpu00140578:: RI Proecssing is already done for this TTI
4708 * as part of PUSCH reception process or HARQ
4709 * Reception processing. Hence skipping this UE
4711 riCb->riRecpPrcsd = FALSE;
4714 if(riCb->riDist ==0)
4716 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
4717 #ifdef XEON_SPECIFIC_CHANGES
4718 if(RGSCH_TIMEINFO_SAME(cell->crntTime, ue->riRecpTime))
4724 if((TRUE == riCb->isRiIgnoByCollsn)
4725 || (willUeRprtCqi == FALSE))
4727 if(willUeRprtCqi == FALSE)
4730 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
4733 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4734 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4736 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4737 "TfuUeRecpReqInfo for cell RNTI:%d",ue->ueId);
4738 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4741 #ifdef TFU_ALLOC_EVENT_NO_INIT
4742 cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4743 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4746 pucchRecpInfo->rnti = ue->ueId;
4747 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
4748 riCb->cqiCfg.cqiSetup.cqiPResIdx;
4749 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = riCb->riNumBits;
4750 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_CQI;
4751 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
4753 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
4754 riCb->servCellInfo->sCellIdx;
4756 rgSCHTomUtlFillRiBitWidthInfo(ue);
4757 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
4758 if (ue->nPCqiCb->nCqiTrIdx == validIdx)
4760 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, ue->nPCqiCb);
4762 if((ue->srsCb.nSrsTrIdx == validIdx) && (ue->srsCb.srsDist ==0))
4764 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
4766 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4767 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4775 }/* end of rgSCHTomUtlFillRiRecpReq */
4778 /** @brief This function handles filling of 5GTF CQI-RI reception request to
4787 * @param [out] TfuRecpReqInfo *recpReqInfo
4788 * @param [in] RgSchCellCb *cell
4789 * @param [in] U16 validIdx
4790 * @param [out] RgSchErrInfo *err
4796 PRIVATE S16 rgSCHTomUtlFillCqiRiRecpReq
4798 TfuRecpReqInfo *recpReqInfo,
4804 PRIVATE S16 rgSCHTomUtlFillCqiRiRecpReq (recpReqInfo, cell, validIdx, err)
4805 TfuRecpReqInfo *recpReqInfo;
4811 TfuUeRecpReqInfo *pucchRecpInfo;
4812 RgSchUeCb *ue = NULLP;
4815 TRC2(rgSCHTomUtlFillCqiRiRecpReq);
4817 while ((ue = rgSCHDbmGetNextUeCb(cell, ue)) != NULLP)
4819 if (RGSCH_TIMEINFO_SAME (recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn))
4821 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4822 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4824 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4825 "TfuUeRecpReqInfo for cell RNTI:%d ", ue->ueId);
4826 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4829 #ifdef TFU_ALLOC_EVENT_NO_INIT
4830 cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4831 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4833 pucchRecpInfo->rnti = ue->ueId;
4834 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_XPUCCH_UCI_INFO;
4835 pucchRecpInfo->t.pucchRecpReq.uciPduInfo.pucchIndex = 0;
4836 pucchRecpInfo->t.pucchRecpReq.uciPduInfo.numBits = 5;
4838 RG_SCH_ADD_TO_CRNT_TIME(recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn,
4839 ue->ue5gtfCb.cqiRiPer);
4840 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4841 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4846 }/* end of rgSCHTomUtlFillCqiRiRecpReq */
4849 /** @brief This function handles filling of PCQI reception request to
4858 * @param [out] TfuRecpReqInfo *recpReqInfo
4859 * @param [in] RgSchCellCb *cell
4860 * @param [in] U16 validIdx
4861 * @param [out] RgSchErrInfo *err
4867 PRIVATE S16 rgSCHTomUtlFillPcqiRecpReq
4869 TfuRecpReqInfo *recpReqInfo,
4875 PRIVATE S16 rgSCHTomUtlFillPcqiRecpReq (recpReqInfo, cell, validIdx, err)
4876 TfuRecpReqInfo *recpReqInfo;
4883 TfuUeRecpReqInfo *pucchRecpInfo;
4888 Bool willUeRprtCqi; /* Flag set due to CQI Mask
4889 and UE Inactive state (DRX)*/
4891 RgSchUePCqiCb *cqiCb = NULLP;
4892 Bool isAddToLst = FALSE;
4894 TRC2(rgSCHTomUtlFillPcqiRecpReq);
4896 node = cell->pCqiSrsSrLst[validIdx].cqiLst.first;
4899 cqiCb = (RgSchUePCqiCb*)(node->node);
4900 ue = cqiCb->servCellInfo->ue;
4901 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4903 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
4905 if ((cqiCb->isCqiIgnoByCollsn == TRUE) ||
4906 (willUeRprtCqi == FALSE))
4908 if(willUeRprtCqi == FALSE)
4911 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
4915 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
4917 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
4918 cqiCb->servCellInfo->sCellIdx;
4920 cqiPmiSz = rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
4923 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d Unable to Fill CqiPmi "
4928 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4929 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4931 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
4932 "TfuUeRecpReqInfo for cell RNTI:%d ", ue->ueId);
4933 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4936 #ifdef TFU_ALLOC_EVENT_NO_INIT
4937 cmMemset((U8 *)&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4938 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4941 /*Fill PCQI params*/
4942 pucchRecpInfo->rnti = ue->ueId;
4943 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
4944 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
4945 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = cqiPmiSz;
4946 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_CQI;
4947 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
4948 if((ue->srsCb.nSrsTrIdx == validIdx) && (ue->srsCb.srsDist ==0))
4950 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
4953 isAddToLst = rgSCHEmtcAddRecpInfoToLst(NULLP,recpReqInfo, pucchRecpInfo,ue->isEmtcUe);
4957 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4959 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4962 }/* end of rgSCHTomUtlFillPcqiRecpReq */
4964 /** @brief This function handles filling of SRS reception request to
4973 * @param [out] TfuRecpReqInfo *recpReqInfo
4974 * @param [in] RgSchCellCb *cell
4975 * @param [in] U16 validIdx
4976 * @param [out] RgSchErrInfo *err
4982 PRIVATE S16 rgSCHTomUtlFillSrsRecpReq
4984 TfuRecpReqInfo *recpReqInfo,
4990 PRIVATE S16 rgSCHTomUtlFillSrsRecpReq (recpReqInfo, cell, validIdx, err)
4991 TfuRecpReqInfo *recpReqInfo;
4998 TfuUeRecpReqInfo *pucchRecpInfo;
5002 TRC2(rgSCHTomUtlFillSrsRecpReq);
5004 node = cell->pCqiSrsSrLst[validIdx].srsLst.first;
5007 ue = (RgSchUeCb *)(node->node);
5008 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
5010 if(ue->srsCb.srsRecpPrcsd)
5012 /* ccpu00140578::SRS Proecssing is already done for this TTI
5013 * as part of PUSCH or HARQ reception process and
5014 * hence skipping this UE */
5015 ue->srsCb.srsRecpPrcsd = FALSE;
5019 if(ue->srsCb.srsDist ==0)
5021 /* We need to add the recp request to be sent on the pucchANRep value. */
5022 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
5023 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
5025 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
5026 "TfuUeRecpReqInfo for RNTI:%d ",ue->ueId);
5027 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
5031 #ifdef TFU_ALLOC_EVENT_NO_INIT
5032 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
5036 pucchRecpInfo->rnti = ue->ueId;
5037 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
5038 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
5039 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
5040 ue->srsCb.srsCfg.srsSetup.fDomPosi;
5041 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
5042 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
5043 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
5044 ue->srsCb.srsCfg.srsSetup.txComb;
5045 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
5046 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
5047 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
5048 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
5050 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SRS;
5051 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
5052 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
5053 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
5057 ue->srsCb.srsDist--;
5061 }/* end of rgSCHTomUtlFillSrsRecpReq */
5064 /** @brief This function handles filling of data reception requests for
5073 * @param [out] TfuRecpReqInfo *recpReqInfo
5074 * @param [in] RgSchCellCb *cell
5075 * @param [out] RgSchErrInfo *err
5081 PRIVATE S16 rgSCHTomUtlFillDatRecpReq
5083 TfuRecpReqInfo *recpReqInfo,
5088 PRIVATE S16 rgSCHTomUtlFillDatRecpReq (recpReqInfo, cell, err)
5089 TfuRecpReqInfo *recpReqInfo;
5095 RgSchUlAlloc *alloc;
5096 TfuUeRecpReqInfo *datRecpInfo;
5098 TRC2(rgSCHTomUtlFillDatRecpReq)
5100 /* processing steps are
5101 * - Run through the UL allocations going out in this subframe.
5102 * - Run through the UL receptions expected the next subframe.
5104 alloc = rgSCHUtlFirstRcptnReq (cell);
5107 /* FOR ACK NACK REP */
5108 if (NULLP != alloc->ue)
5110 /* If measuring or ackNakRep we shall not send dat RecpReq */
5111 if ((alloc->ue->measGapCb.isMeasuring == TRUE) ||
5112 (alloc->ue->ackNakRepCb.isAckNakRep == TRUE))
5114 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
5119 if ((ret = rgSCHUtlGetEventMem((Ptr *)&datRecpInfo,
5120 sizeof(TfuUeRecpReqInfo),
5121 &(recpReqInfo->memCp))) != ROK)
5123 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
5124 "TfuUeRecpReqInfo for RNTI:%d ", alloc->ue->ueId);
5125 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
5128 if (!alloc->forMsg3)
5130 datRecpInfo->type = TFU_RECP_REQ_PUSCH;
5131 rgSCHUtlAllocRcptInfo (alloc,
5133 &datRecpInfo->t.puschRecpReq.mcs,
5134 &datRecpInfo->t.puschRecpReq.rbStart,
5135 &datRecpInfo->t.puschRecpReq.numRb,
5136 &datRecpInfo->t.puschRecpReq.rv,
5137 &datRecpInfo->t.puschRecpReq.size,
5138 &datRecpInfo->t.puschRecpReq.modType,
5139 &datRecpInfo->t.puschRecpReq.isRtx,
5140 &datRecpInfo->t.puschRecpReq.nDmrs,
5141 &datRecpInfo->t.puschRecpReq.ndi,
5142 &datRecpInfo->t.puschRecpReq.harqProcId
5147 datRecpInfo->type = TFU_RECP_REQ_MSG3;
5148 rgSCHUtlAllocRcptInfo (alloc,
5150 &datRecpInfo->t.msg3RecpReq.mcs,
5151 &datRecpInfo->t.msg3RecpReq.rbStart,
5152 &datRecpInfo->t.msg3RecpReq.numRb,
5153 /*ccpu00128993 - MOD - fix for msg3 softcombining bug*/
5154 &datRecpInfo->t.msg3RecpReq.rv,
5155 &datRecpInfo->t.msg3RecpReq.size,
5156 &datRecpInfo->t.msg3RecpReq.modType,
5157 &datRecpInfo->t.msg3RecpReq.isRtx,
5158 &datRecpInfo->t.msg3RecpReq.nDmrs,
5159 &datRecpInfo->t.msg3RecpReq.ndi,
5160 &datRecpInfo->t.msg3RecpReq.harqProcId
5164 /* Other fields of datRecpInfo shall be filled
5165 * here for new features */
5166 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(datRecpInfo->lnk));
5167 datRecpInfo->lnk.node = (PTR)datRecpInfo;
5169 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
5170 } /* end of while */
5172 } /* end of rgSCHTomUtlFillDatRecpReq */
5175 /** @brief This function handles filling of data reception requests for
5184 * @param [out] TfuRecpReqInfo *recpReqInfo
5185 * @param [in] RgSchCellCb *cell
5186 * @param [in] U16 validIdx
5187 * @param [out] RgSchErrInfo *err
5193 PRIVATE S16 rgSCHTomUtlFillDatRecpReq
5195 TfuRecpReqInfo *recpReqInfo,
5201 PRIVATE S16 rgSCHTomUtlFillDatRecpReq (recpReqInfo, cell, validIdx, err)
5202 TfuRecpReqInfo *recpReqInfo;
5208 CmLteTimingInfo dci0Time;
5211 RgSchUlAlloc *alloc;
5212 TfuUeRecpReqInfo *datRecpInfo;
5214 Bool hqPres; /*Set when HARQ Rec Req is present*/
5215 Bool isAperiodic = FALSE; /*Set when Aperiodic CQI is expected */
5218 TRC2(rgSCHTomUtlFillDatRecpReq);
5220 if((0 == (recpReqInfo->timingInfo.sfn % 30)) && (0 == recpReqInfo->timingInfo.slot))
5222 //printf("5GTF_CHECK rgSCHTomUtlFillDatRecpReq (%d : %d)\n", recpReqInfo->timingInfo.sfn, recpReqInfo->timingInfo.slot);
5224 /* processing steps are
5225 * - Run through the UL allocations going out in this subframe.
5226 * - Run through the UL receptions expected the next subframe.
5229 alloc = rgSCHUtlFirstRcptnReq (cell);
5232 isAperiodic = FALSE;
5233 ret = rgSCHUtlGetEventMem((Ptr *)&datRecpInfo,
5234 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
5237 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Allocate "
5238 "TfuUeRecpReqInfo for RNTI:%d ", alloc->rnti);
5239 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
5242 #ifdef TFU_ALLOC_EVENT_NO_INIT
5243 datRecpInfo->t.puschRecpReq.initialNSrs.pres = FALSE;
5244 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = FALSE;
5246 datRecpInfo->type = TFU_RECP_REQ_PUSCH;
5247 /* ccpu00131944 - Intializing hqPres in each iteration*/
5249 /* Check if this if for MSG3 - no scope for feedback along with it. */
5250 if ((FALSE == alloc->forMsg3))
5252 /* Check if any DL HARQ processes has a feedback coming at the time of
5253 * this reception request.
5258 RGSCHDECRFRMCRNTTIME(cell->crntTime,dci0Time,(RGSCH_ULCTRL_RECP_DIST));
5260 idx = (dci0Time.sfn * RGSCH_NUM_SUB_FRAMES_5G + dci0Time.slot)%
5261 RGSCH_ULCTRL_RECP_DIST;
5263 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA;
5264 datRecpInfo->rnti = alloc->rnti;
5265 rgSCHUtlAllocRcptInfo (cell,alloc, &recpReqInfo->timingInfo,
5266 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5269 else /*Enters for Msg3 == TRUE condition*/
5271 /* ccpu00130884 - ADD - HO case when Msg3 alloc and Cqi/Ri/SRS opportunity
5272 * occur at same time */
5273 if(NULLP != alloc->ue)
5276 /* Only DATA is expected */
5277 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA;
5278 datRecpInfo->rnti = alloc->rnti;
5279 rgSCHUtlAllocRcptInfo (cell,alloc, &recpReqInfo->timingInfo,
5280 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5285 if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA &&
5286 datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_SRS &&
5287 isAperiodic == FALSE)
5289 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = TRUE;
5290 datRecpInfo->t.puschRecpReq.initialNumRbs.val = alloc->ue->initNumRbs;
5294 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = FALSE;
5297 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(datRecpInfo->lnk));
5298 datRecpInfo->lnk.node = (PTR)datRecpInfo;
5299 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
5301 } /* end of while */
5303 if(numUePerTti && (numUePerTti < RG_MAX_NUM_UE_PER_TTI))
5305 cell->ulNumUeSchedPerTti[numUePerTti-1]++;
5306 gUlNumUePerTti[numUePerTti - 1]++;
5309 } /* end of rgSCHTomUtlFillDatRecpReq */
5311 /* rg009.201. Added changes of TFU_UPGRADE */
5313 /***********************************************************
5315 * Func : rgSCHTomUtlFillRiBitWidthInfo
5318 * Desc : Fills the RI BitWidth and stores it for decoding.
5327 **********************************************************/
5329 PUBLIC S16 rgSCHTomUtlFillRiBitWidthInfo
5334 PUBLIC S16 rgSCHTomUtlFillRiBitWidthInfo(ueCb)
5338 RgSchUePCqiCb *riCb = ueCb->nPRiCb;
5339 TRC2(rgSCHTomUtlFillRiBitWidthInfo);
5341 if (ueCb->mimoInfo.txMode != RGR_UE_TM_3 &&
5342 ueCb->mimoInfo.txMode != RGR_UE_TM_4)
5347 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUCCH;
5348 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode=
5349 (TfuDlCqiPucchMode)riCb->cqiCfg.cqiSetup.prdModeEnum;
5350 switch(ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode)
5352 case TFU_PUCCH_CQI_MODE10:
5353 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info.type = TFU_RPT_RI;
5354 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info.u.ri =
5357 case TFU_PUCCH_CQI_MODE11:
5358 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info.type = TFU_RPT_RI;
5359 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info.u.ri =
5362 case TFU_PUCCH_CQI_MODE20:
5363 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info.type = TFU_RPT_RI;
5364 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info.u.ri =
5367 case TFU_PUCCH_CQI_MODE21:
5368 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info.type = TFU_RPT_RI;
5369 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info.u.ri =
5376 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5380 /***********************************************************
5382 * Func : rgSCHTomUtlFetchPcqiBitSz
5385 * Desc : Fetch the CQI/PMI bits for a UE based on the mode, periodicity.
5394 **********************************************************/
5396 PUBLIC U8 rgSCHTomUtlFetchPcqiBitSz
5403 PUBLIC U8 rgSCHTomUtlFetchPcqiBitSz(ueCb, numTxAnt, ri)
5411 TfuCqiPucchMode10 *mode10Info;
5412 TfuCqiPucchMode11 *mode11Info;
5413 TfuCqiPucchMode20 *mode20Info;
5414 TfuCqiPucchMode21 *mode21Info;
5415 RgSchUePCqiCb *cqiCb = ueCb->nPCqiCb;
5417 TRC3(rgSCHTomUtlFetchPcqiBitSz);
5419 confRepMode = cqiCb->cqiCfg.cqiSetup.prdModeEnum;
5420 if((ueCb->mimoInfo.txMode != RGR_UE_TM_3) &&
5421 (ueCb->mimoInfo.txMode != RGR_UE_TM_4))
5427 *ri = cqiCb->perRiVal;
5429 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUCCH;
5430 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode=
5431 (TfuDlCqiPucchMode)confRepMode;
5434 case RGR_PRD_CQI_MOD10:
5436 mode10Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info;
5438 mode10Info->type = TFU_RPT_CQI;
5439 mode10Info->u.cqi = 4;
5443 case RGR_PRD_CQI_MOD11:
5445 mode11Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info;
5446 mode11Info->type = TFU_RPT_CQI;
5452 mode11Info->u.cqi.cqi = 4;
5453 mode11Info->u.cqi.wideDiffCqi.pres = FALSE;
5454 mode11Info->u.cqi.pmi = 2;
5459 mode11Info->u.cqi.cqi = 4;
5460 mode11Info->u.cqi.wideDiffCqi.pres = TRUE;
5461 mode11Info->u.cqi.wideDiffCqi.val = 3;
5462 mode11Info->u.cqi.pmi = 1;
5465 else if(numTxAnt == 4)
5470 mode11Info->u.cqi.cqi = 4;
5471 mode11Info->u.cqi.wideDiffCqi.pres = FALSE;
5472 mode11Info->u.cqi.pmi = 4;
5477 mode11Info->u.cqi.cqi = 4;
5478 mode11Info->u.cqi.wideDiffCqi.pres = TRUE;
5479 mode11Info->u.cqi.wideDiffCqi.val = 3;
5480 mode11Info->u.cqi.pmi = 4;
5485 /* This is number of antenna case 1.
5486 * This is not applicable for Mode 1-1.
5487 * So setting it to invalid value */
5493 case RGR_PRD_CQI_MOD20:
5495 mode20Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info;
5496 mode20Info->type = TFU_RPT_CQI;
5500 mode20Info->u.cqi.isWideband = TRUE;
5501 mode20Info->u.cqi.u.wideCqi = 4;
5505 pcqiSz = 4 + cqiCb->label;
5506 mode20Info->u.cqi.isWideband = FALSE;
5507 mode20Info->u.cqi.u.subCqi.cqi = 4;
5508 mode20Info->u.cqi.u.subCqi.l = cqiCb->label;
5513 case RGR_PRD_CQI_MOD21:
5515 mode21Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info;
5516 mode21Info->type = TFU_RPT_CQI;
5517 //pcqiSz = rgSCHTomUtlFetchPcqiBitSzPucchMode21(ueCb,
5518 // mode21Info, numTxAnt, ri);
5526 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5531 /***********************************************************
5533 * Func : rgSCHTomUtlPcqiSbCalcBpIdx
5536 * Desc : Determines the BP index from the timing info
5545 **********************************************************/
5547 PUBLIC S16 rgSCHTomUtlPcqiSbCalcBpIdx
5549 CmLteTimingInfo crntTimInfo,
5551 RgSchUePCqiCb *cqiCb
5554 PUBLIC S16 rgSCHTomUtlPcqiSbCalcBpIdx(crntTimInfo, ueCb, cqiCb)
5555 CmLteTimingInfo crntTimInfo;
5557 RgSchUePCqiCb *cqiCb;
5560 U16 tti = (crntTimInfo.sfn * RGSCH_NUM_SUB_FRAMES_5G + crntTimInfo.slot);
5561 U16 prdNum = tti/cqiCb->cqiPeri;
5563 TRC2(rgSCHTomUtlPcqiSbCalcBpIdx);
5564 if((prdNum % cqiCb->h) == 0)
5568 cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_1;
5573 cqiCb->isWb = FALSE;
5574 cqiCb->bpIdx = ((prdNum % cqiCb->h) - 1) % cqiCb->J;
5576 cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_0;
5584 * @brief Function which moves PCQI, RI, SR and SRS to next periodicity
5585 * Occasions as that needs to be done in case of Ack/Nack repetition
5586 * reception request occasions or during Measurement Gap occasions.
5590 * Function: rgSCHTomUtlMoveNxtOccasion
5592 * Function which moves PCQI, RI, SR and SRS to next perodicity
5593 * Occasions as that needs to be done in case of Ack/Nack repetition
5594 * reception request occasions or during Measurement Gap occasions.
5596 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5599 * - Check whether the current Tx Instance matches with the rec req time
5600 * - If true, then move them to their next Tx Instance
5602 * @param[in] RgSchCellCb *cell,
5610 PUBLIC S16 rgSCHTomUtlMoveNxtOccasion
5617 PUBLIC S16 rgSCHTomUtlMoveNxtOccasion(cell, ue, validIdx)
5623 RgSchUePCqiCb *cqiCb = ue->nPCqiCb;
5624 RgSchUePCqiCb *riCb = ue->nPRiCb;
5625 TRC2(rgSCHTomUtlMoveNxtOccasion);
5627 /* ccpu00140578::Skip the UE if already RI recpetion
5628 * is processed in the same subframe */
5629 if ((riCb->nRiTrIdx == validIdx) &&
5630 (riCb->riRecpPrcsd == FALSE))
5632 if(riCb->riDist ==0)
5634 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
5640 /* ccpu00140578:: As this UE is considered for this TTI
5641 * Same UE should not get processed for RI reception
5642 * or for updating th RI distance.*/
5643 if(riCb->nRiTrIdx == validIdx)
5645 riCb->riRecpPrcsd = TRUE;
5648 if (cqiCb->nCqiTrIdx == validIdx)
5650 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
5653 /* ccpu00140578::Skip the UE if SRS recpetion
5654 * is already processed in the same subframe */
5655 if ((ue->srsCb.nSrsTrIdx == validIdx) &&
5656 (ue->srsCb.srsRecpPrcsd == FALSE))
5658 if(ue->srsCb.srsDist ==0)
5660 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
5664 ue->srsCb.srsDist--;
5666 /* ccpu00140578:: As this UE is considered for this TTI
5667 * Same UE should not get processed for SRS reception
5668 * or for updating th SRS distance.*/
5669 if(ue->srsCb.nSrsTrIdx == validIdx)
5671 ue->srsCb.srsRecpPrcsd = TRUE;
5674 if (ue->srCb.nSrTrIdx == validIdx)
5676 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
5679 } /* rgSCHTomUtlMoveNxtOccasion */
5682 /***********************************************************
5684 * Func : rgSCHTomPrepareAcqiRecp
5687 * Desc : Fetch the CQI/PMI bits for a UE based on the mode and store them
5688 * for decoding. Fill RECP request and prepare the scartchpad
5689 * to aid decoding of Aperiodic CQI.
5698 **********************************************************/
5700 PUBLIC Void rgSCHTomPrepareAcqiRecp
5704 TfuUePuschCqiRecpInfo *cqiRecpReqInfo,
5708 PUBLIC Void rgSCHTomPrepareAcqiRecp(ueCb, cell, cqiRecpReqInfo, ccIdx)
5711 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
5716 RgSchCqiRawPuschMode12 *mode12Info;
5717 RgSchCqiRawPuschMode20 *mode20Info;
5718 RgSchCqiRawPuschMode22 *mode22Info;
5719 RgSchCqiRawPuschMode30 *mode30Info;
5720 RgSchCqiRawPuschMode31 *mode31Info;
5721 U8 numTxAnt = cell->numTxAntPorts;
5722 U8 sCellIdx = ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)];
5724 RgSchUeACqiCb *acqiCb = &ueCb->cellInfo[sCellIdx]->acqiCb;
5726 TRC2(rgSCHTomPrepareAcqiRecp);
5729 cqiRecpReqInfo->reportType = TFU_APERIODIC_CQI_TYPE; /* Aperiodic */
5730 if (ueCb->mimoInfo.txMode == RGR_UE_TM_3 ||
5731 ueCb->mimoInfo.txMode == RGR_UE_TM_4)
5733 cqiRecpReqInfo->riSz[ccIdx].pres = TRUE;
5734 cqiRecpReqInfo->riSz[ccIdx].val = acqiCb->riNumBits;
5736 /* This flag will be rmeoved after making changes in BRDCM CL
5737 * Sachin is doing the change
5739 #if (defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
5741 cqiRecpReqInfo->cqiPmiSzR1[ccIdx] = acqiCb->cqiPmiSzR1;
5742 cqiRecpReqInfo->cqiPmiSzRn1[ccIdx] = acqiCb->cqiPmiSzRn1;
5744 if(ueCb->nPCqiCb->perRiVal == 1)
5746 cqiRecpReqInfo->cqiPmiSzR1[ccIdx] = acqiCb->cqiPmiSzR1;
5750 cqiRecpReqInfo->cqiPmiSzRn1[ccIdx] = acqiCb->cqiPmiSzRn1;
5753 /* Fill scratchpad to aid decoding of aper CQI upon
5755 confRepMode = acqiCb->aCqiCfg.aprdModeEnum;
5756 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUSCH;
5758 numOfCells = ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells;
5760 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5761 puschRawCqiInfo.mode = (TfuDlCqiPuschMode)confRepMode;
5763 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5764 puschRawCqiInfo.ri.pres = cqiRecpReqInfo->riSz[ccIdx].pres;
5766 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5767 puschRawCqiInfo.ri.val = cqiRecpReqInfo->riSz[ccIdx].val;
5769 /* Setting the sCellIdx */
5770 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5771 sCellIdx = sCellIdx;
5775 case RGR_APRD_CQI_MOD12:
5777 mode12Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5778 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode12Info;
5779 mode12Info->wideBCqiCw0 = 4;
5780 mode12Info->r1WideBCqiCw1 = 0;
5781 mode12Info->rg1WideBCqiCw1 = 4;
5784 mode12Info->r1TotalPmiBitLen = 2*acqiCb->N;
5785 mode12Info->rg1TotalPmiBitLen = acqiCb->N;
5787 else if(numTxAnt == 4)
5789 mode12Info->r1TotalPmiBitLen = 4*acqiCb->N;
5790 mode12Info->rg1TotalPmiBitLen = 4*acqiCb->N;
5795 case RGR_APRD_CQI_MOD20:
5797 mode20Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5798 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode20Info;
5799 mode20Info->wideBCqiCw = 4;
5800 mode20Info->subBandDiffCqi = 2;
5801 mode20Info->posOfM = acqiCb->L;
5805 case RGR_APRD_CQI_MOD22:
5807 mode22Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5808 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode22Info;
5809 mode22Info->wideBCqiCw0 = 4;
5810 mode22Info->sBDiffCqiCw0 = 2;
5811 mode22Info->r1WideBCqiCw1 = 0;
5812 mode22Info->r1SbDiffCqiCw1 = 0;
5813 mode22Info->rg1WideBCqiCw1 = 4;
5814 mode22Info->rg1SbDiffCqiCw1 = 2;
5815 mode22Info->posOfM = acqiCb->L;
5818 mode22Info->r1PmiBitLen = 4;
5819 mode22Info->rg1PmiBitLen = 2;
5821 else if(numTxAnt == 4)
5823 mode22Info->r1PmiBitLen = 8;
5824 mode22Info->rg1PmiBitLen = 8;
5829 case RGR_APRD_CQI_MOD30:
5831 mode30Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5832 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode30Info;
5833 mode30Info->wideBCqiCw = 4;
5834 mode30Info->totLenSbDiffCqi = 2*acqiCb->N;
5838 case RGR_APRD_CQI_MOD31:
5840 mode31Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5841 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode31Info;
5842 mode31Info->wideBCqiCw0 = 4;
5843 mode31Info->totLenSbDiffCqiCw0 = 2*acqiCb->N;
5844 mode31Info->r1WideBCqiCw1 = 0;
5845 mode31Info->r1TotLenSbDiffCqiCw1 =0;
5846 mode31Info->rg1WideBCqiCw1 = 4;
5847 mode31Info->rg1TotLenSbDiffCqiCw1 = 2*acqiCb->N;
5850 mode31Info->r1PmiBitLen = 2;
5851 mode31Info->rg1PmiBitLen = 1;
5853 else if(numTxAnt == 4)
5855 mode31Info->r1PmiBitLen = 4;
5856 mode31Info->rg1PmiBitLen = 4;
5867 * @brief Function which handles the filling of Aperiodic CQI/RI reception
5872 * Function: rgSCHTomUtlFillDatAperRecpReq
5874 * Function which handles the filling of Aperiodic CQI/RI reception
5877 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5880 * - Fill the reception request for the data arriving on the ULSCH
5881 * - Fill the reception request information for the Aperiodic CQI/PMI/RI
5883 * @param[in] RgSchCellCb *cell,
5884 * RgSchUlAlloc *alloc,
5885 * TfuUeRecpReqInfo *datRecpInfo,
5886 * CmLteTimingInfo *timeInfo,
5893 PUBLIC S16 rgSCHTomUtlFillDatAperRecpReq
5897 RgSchUlAlloc *alloc,
5898 TfuUeRecpReqInfo *datRecpInfo,
5899 CmLteTimingInfo *timeInfo,
5904 PUBLIC S16 rgSCHTomUtlFillDatAperRecpReq(cell, cqiReq, alloc, datRecpInfo, timeInfo, hqPres, validIdx)
5907 RgSchUlAlloc *alloc;
5908 TfuUeRecpReqInfo *datRecpInfo;
5909 CmLteTimingInfo *timeInfo;
5914 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
5915 RgSchUeCb *ueCb = alloc->ue;
5920 TRC2(rgSCHTomUtlFillDatAperRecpReq);
5922 /*Fill RI Reception Params*/
5923 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
5924 cqiRecpReqInfo->riBetaOff = alloc->ue->ul.betaRiOffst;
5925 cqiRecpReqInfo->cqiBetaOff = alloc->ue->ul.betaCqiOffst;
5928 cqiRecpReqInfo->cCNum = 0;
5929 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells = 0;
5932 rgSCHTomUtlGetTrigSet(cell, ueCb, cqiReq, &triggerSet);
5933 for (sIdx = 0; sIdx < CM_LTE_MAX_CELLS; sIdx++)
5935 /* The Aperiodic request for SCell index sIdx */
5936 if ((triggerSet >> (7 - sIdx)) & 0x01)
5938 /* The Aperiodic request for SCell index sIdx */
5939 rgSCHTomPrepareAcqiRecp(ueCb, ueCb->cellInfo[sIdx]->cell, cqiRecpReqInfo, cqiRecpReqInfo->cCNum);
5940 cqiRecpReqInfo->cCNum++;
5941 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells++;
5945 rgSCHTomPrepareAcqiRecp(ueCb, ueCb->cellInfo[0]->cell, cqiRecpReqInfo, cqiRecpReqInfo->cCNum);
5946 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells++;
5949 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5951 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
5953 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
5954 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
5958 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
5960 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
5964 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
5966 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
5968 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
5970 datRecpInfo->rnti = alloc->rnti;
5971 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
5972 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5974 } /* rgSCHTomUtlFillDatAperRecpReq */
5979 * @brief Function which handles the filling of Periodic RI reception
5980 * request values which arrives along with UL Data on ULSCH
5984 * Function: rgSCHTomUtlFillDatPriRecpReq
5986 * Function which handles the filling of Periodic RI reception
5987 * request values which arrives along with UL Data on ULSCH
5989 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5992 * - Fill the reception request for the data arriving on the ULSCH
5993 * - Fill the reception request information for the Periodic RI
5995 * @param[in] RgSchCellCb *cell,
5996 * RgSchUlAlloc *alloc,
5997 * TfuUeRecpReqInfo *datRecpInfo,
5998 * CmLteTimingInfo *timeInfo,
6005 PUBLIC S16 rgSCHTomUtlFillDatPriRecpReq
6008 RgSchUlAlloc *alloc,
6009 TfuUeRecpReqInfo *datRecpInfo,
6010 CmLteTimingInfo *timeInfo,
6015 PUBLIC S16 rgSCHTomUtlFillDatPriRecpReq(cell, alloc, datRecpInfo, timeInfo,
6018 RgSchUlAlloc *alloc;
6019 TfuUeRecpReqInfo *datRecpInfo;
6020 CmLteTimingInfo *timeInfo;
6025 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
6026 TRC2(rgSCHTomUtlFillDatPriRecpReq);
6028 /*Fill RI Reception Params*/
6029 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
6030 #ifdef TFU_ALLOC_EVENT_NO_INIT
6031 cqiRecpReqInfo->cqiBetaOff = 0;
6032 /* Fill only the first RI index since Periodic can come
6034 cqiRecpReqInfo->cqiPmiSzR1[0] = 0;
6035 cqiRecpReqInfo->cqiPmiSzRn1[0] = 0;
6037 cqiRecpReqInfo->reportType = TFU_PERIODIC_CQI_TYPE; /* periodic */
6038 cqiRecpReqInfo->riBetaOff = alloc->ue->ul.betaRiOffst;
6040 /* Fill only the first RI index since Periodic can come
6042 cqiRecpReqInfo->cCNum = 1;
6043 cqiRecpReqInfo->riSz[0].pres = TRUE;
6044 cqiRecpReqInfo->riSz[0].val = alloc->ue->nPRiCb->riNumBits;
6046 rgSCHTomUtlFillRiBitWidthInfo(alloc->ue);
6047 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
6049 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
6050 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
6054 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
6056 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
6060 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
6062 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
6064 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
6066 datRecpInfo->rnti = alloc->rnti;
6067 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
6068 &datRecpInfo->t.puschRecpReq.ulSchInfo);
6070 } /* rgSCHTomUtlFillDatPriRecpReq */
6074 * @brief Function which handles the filling of Periodic CQI/PMI reception
6075 * request values which arrives along with UL Data on ULSCH
6079 * Function: rgSCHTomUtlFillDatPCqiRecpReq
6081 * Function which handles the filling of Periodic CQI/PMI reception
6082 * request values which arrives along with UL Data on ULSCH
6084 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
6087 * - Fill the reception request for the data arriving on the ULSCH
6088 * - Fill the reception request information for the Periodic CQI/PMI
6090 * @param[in] RgSchCellCb *cell,
6091 * RgSchUlAlloc *alloc,
6092 * TfuUeRecpReqInfo *datRecpInfo,
6093 * CmLteTimingInfo *timeInfo,
6101 PUBLIC S16 rgSCHTomUtlFillDatPCqiRecpReq
6104 RgSchUlAlloc *alloc,
6105 TfuUeRecpReqInfo *datRecpInfo,
6106 CmLteTimingInfo *timeInfo,
6111 PUBLIC S16 rgSCHTomUtlFillDatPCqiRecpReq(cell, alloc, datRecpInfo,
6112 timeInfo, hqPres, validIdx)
6114 RgSchUlAlloc *alloc;
6115 TfuUeRecpReqInfo *datRecpInfo;
6116 CmLteTimingInfo *timeInfo;
6121 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
6122 U8 cqiPmiSz; /*Raw CQI/PMI Size*/
6125 TRC2(rgSCHTomUtlFillDatPCqiRecpReq);
6128 /*Fill CQI Reception Params*/
6129 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
6130 #ifdef TFU_ALLOC_EVENT_NO_INIT
6131 cqiRecpReqInfo->riBetaOff = 0;
6133 cqiRecpReqInfo->cqiBetaOff = alloc->ue->ul.betaCqiOffst;
6134 cqiPmiSz = rgSCHTomUtlFetchPcqiBitSz(alloc->ue, cell->numTxAntPorts, &ri);
6137 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to Fill "
6138 "CqiPmi size RNTI:%d",alloc->rnti);
6142 /* Fill only the first RI index since Periodic can come
6144 cqiRecpReqInfo->cCNum = 1;
6145 cqiRecpReqInfo->reportType = TFU_PERIODIC_CQI_TYPE; /* Periodic */
6146 /* This flags will be removed once Sachin does changes
6148 #if (defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
6149 cqiRecpReqInfo->cqiPmiSzR1[0] = cqiPmiSz;
6150 cqiRecpReqInfo->cqiPmiSzRn1[0] = cqiPmiSz;
6154 cqiRecpReqInfo->cqiPmiSzR1[0] = cqiPmiSz;
6155 cqiRecpReqInfo->cqiPmiSzRn1[0] = 0;
6159 cqiRecpReqInfo->cqiPmiSzRn1[0] = cqiPmiSz;
6160 cqiRecpReqInfo->cqiPmiSzR1[0] = 0;
6163 cqiRecpReqInfo->riSz[0].pres = FALSE;
6165 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
6167 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
6168 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
6171 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
6173 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
6177 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
6179 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
6181 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
6183 datRecpInfo->rnti = alloc->rnti;
6184 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
6185 &datRecpInfo->t.puschRecpReq.ulSchInfo);
6187 } /* rgSCHTomUtlFillDatPCqiRecpReq */
6190 * @brief Function which handles the filling of SRS reception
6191 * request values which arrives along with UL Data on ULSCH
6195 * Function: rgSCHTomUtlFillDatSrsRecpReq
6197 * Function which handles the filling of SRS reception
6198 * request values which arrives along with UL Data on ULSCH
6200 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
6203 * - Fill the reception request for the data arriving on the ULSCH
6204 * - Fill the reception request information for the SRS
6206 * @param[in] RgSchCellCb *cell,
6207 * RgSchUlAlloc *alloc,
6208 * TfuUeRecpReqInfo *datRecpInfo,
6209 * CmLteTimingInfo *timeInfo,
6216 PUBLIC S16 rgSCHTomUtlFillDatSrsRecpReq
6219 RgSchUlAlloc *alloc,
6220 TfuUeRecpReqInfo *datRecpInfo,
6221 CmLteTimingInfo *timeInfo,
6225 PUBLIC S16 rgSCHTomUtlFillDatSrsRecpReq(cell, alloc, datRecpInfo, timeInfo,
6228 RgSchUlAlloc *alloc;
6229 TfuUeRecpReqInfo *datRecpInfo;
6230 CmLteTimingInfo *timeInfo;
6234 TRC2(rgSCHTomUtlFillDatSrsRecpReq);
6235 datRecpInfo->rnti = alloc->rnti;
6236 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
6239 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_HARQ_SRS;
6243 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_SRS;
6245 datRecpInfo->rnti = alloc->rnti;
6246 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
6247 &datRecpInfo->t.puschRecpReq.ulSchInfo);
6249 } /* rgSCHTomUtlFillDatSrsRecpReq */
6252 * @brief Function which handles the filling of only SRS reception
6253 * request values on ULSCH
6257 * Function: rgSCHTomFillOnlySrsRecpReq
6259 * Function which handles the filling of SRS reception
6260 * request values which arrives along with UL Data on ULSCH
6262 * Invoked by: rgSCHTomUtlFillDatSrsRecpReq of rg_sch_tom.c
6265 * - Fill the reception request for the data arriving on the ULSCH
6266 * - Fill the reception request information for the SRS
6268 * @param[in] RgSchCellCb *cell,
6269 * RgSchUlAlloc *alloc,
6270 * TfuUeRecpReqInfo *datRecpInfo,
6276 PUBLIC S16 rgSCHTomFillOnlySrsRecpReq
6279 RgSchUlAlloc *alloc,
6280 TfuUeRecpReqInfo *datRecpInfo
6283 PUBLIC S16 rgSCHTomFillOnlySrsRecpReq(cell, alloc, datRecpInfo)
6285 RgSchUlAlloc *alloc;
6286 TfuUeRecpReqInfo *datRecpInfo;
6289 TfuUePuschSrsRecpInfo *srsRecpReqInfo;
6290 TRC2(rgSCHTomFillOnlySrsRecpReq);
6292 srsRecpReqInfo = &datRecpInfo->t.puschRecpReq.srsInfo;
6293 srsRecpReqInfo->srsBw = (TfuUlSrsBwInfo)alloc->ue->srsCb.srsCfg.srsSetup.srsBw;
6294 srsRecpReqInfo->nRrc = alloc->ue->srsCb.srsCfg.srsSetup.fDomPosi;
6295 srsRecpReqInfo->srsHopBw = (TfuUlSrsHoBwInfo)alloc->ue->srsCb.srsCfg.srsSetup.srsHopBw;
6296 srsRecpReqInfo->transComb = alloc->ue->srsCb.srsCfg.srsSetup.txComb;
6297 srsRecpReqInfo->srsCfgIdx = alloc->ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6298 srsRecpReqInfo->srsCyclicShft = (TfuUlSrsCycShiftInfo)alloc->ue->srsCb.srsCfg.srsSetup.cycShift;
6300 /* ccpu00117050 - ADD - nSrs setting
6301 * Refer Section 5.2.2.6 of TS 36.212 V8.5.0*/
6302 datRecpInfo->t.puschRecpReq.ulSchInfo.nSrs = 1;
6305 } /* rgSCHTomFillOnlySrsRecpReq */
6308 * @brief Function which handles the filling of PCQI/RI, SRS and SR
6309 * Reception Request Information along
6310 * with the HARQ reception Request
6314 * Function: rgSCHTomUtlFillCqiSrSrsWithHq
6316 * Function which handles the filling of PCQI/RI, SRS ans SR
6317 * Reception Request Information along
6318 * with the HARQ reception Request
6321 * Invoked by: rgSCHTomUtlFillHqFdbkRecpReq &
6322 * rgSCHTomUtlFillSfHqFdbk of rg_sch_tom.c
6325 * - Fill the reception request for the Control Info arriving on the PUCCH
6326 * - Fill the reception request information for the SR, RI, CQI, SRS
6328 * @param[in] RgSchCellCb *cell,
6329 * TfuRecpReqInfo *recpReqInfo,
6330 * RgSchDlHqProcCb *hqCb,
6331 * @param[out] TfuUeRecpReqInfo *pucchRecpInfo
6332 * @param[in] U16 validIdx
6338 PRIVATE S16 rgSCHTomUtlFillCqiSrSrsWithHq
6341 TfuRecpReqInfo *recpReqInfo,
6343 TfuUeRecpReqInfo *pucchRecpInfo,
6345 Bool isDatPresOnSecCell
6348 PRIVATE S16 rgSCHTomUtlFillCqiSrSrsWithHq(cell, recpReqInfo, ue,
6349 pucchRecpInfo, validIdx,isDatPresOnSecCell)
6351 TfuRecpReqInfo *recpReqInfo;
6353 TfuUeRecpReqInfo *pucchRecpInfo;
6355 Bool isDatPresOnSecCell;
6358 RgSchUePCqiCb *cqiCb;
6359 RgSchUePCqiCb *riCb;
6360 U8 ri; /*To fetch RI value*/
6361 Bool willUeRprtCqi; /* Flag set due to CQI Mask and
6362 UE Inactive state (DRX)*/
6363 Bool willUeRprtSr = TRUE;
6364 TfuAckNackMode hqFdbkMode;
6367 Bool dropCqi = FALSE;
6369 RgSchCmnUlUeSpsInfo *ulSpsUe = NULL;
6372 RgSchEmtcUeInfo *emtcUe = NULLP;
6375 TRC2(rgSCHTomUtlFillCqiSrSrsWithHq);
6379 /*Changes for PUCCH Format3 */
6380 hqFdbkMode = pucchRecpInfo->t.pucchRecpReq.hqInfo.hqFdbkMode;
6381 numCqiBit = rgSCHCmnCalcPcqiBitSz (ue,cell->numTxAntPorts);
6382 totalPucchBits = pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz + numCqiBit;
6385 emtcUe = RG_GET_EMTC_UE_CB(ue);
6387 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
6388 #ifdef EMTC_ENABLE /*VINU*/
6391 if((emtcUe->pucchRepNumFr1 > 1) || (emtcUe->pucchRepNumFr2 > 1))
6393 willUeRprtCqi = FALSE;
6394 willUeRprtSr = FALSE;
6398 if(ue->srCb.nSrTrIdx == validIdx)
6402 /* Should we check for Rel8 and above???
6403 * Dont send SR recp req if logicalChannelSR-Mask enabled and UL SPS is
6405 ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue, cell);
6406 /* Avoiding check for ulSpsEnabled as isUlSpsActv FALSE if sps is not enabled*/
6407 if(!((ue->ul.ulSpsCfg.isLcSRMaskEnab) &&
6408 (ulSpsUe->isUlSpsActv)))
6415 pucchRecpInfo->t.pucchRecpReq.srInfo.n1PucchIdx =
6416 ue->srCb.srCfg.srSetup.srResIdx;
6417 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
6418 /* FORMAT3: If SR is present it will be appended after HARQ */
6419 totalPucchBits = totalPucchBits + 1;
6426 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
6428 /* LTE_ADV:: UE will drop CSI during CSI+1BCS if data is present
6429 * on sec cell(isDatPresOnSecCell)*/
6431 if (hqFdbkMode == TFU_ACK_NACK_CHANNEL_SELECTION)
6433 if (hqFdbkMode == TFU_UCI_FORMAT_1B_CS)
6436 if (isDatPresOnSecCell == TRUE)
6443 /* Format 3 Changes : If Hq + SR + CQI bits < 22 and simultaneousAckNackAndCQI-Format3
6444 is enabled then CQI will be multiplexed with HQ otherwise CQI will be dropped
6445 Spec 36.213 Sec 10.1.1 */
6446 else if (hqFdbkMode == TFU_UCI_FORMAT_3)
6448 if ((isDatPresOnSecCell == TRUE) &&
6449 ((!ue->simulAckNackCQIFormat3) || (totalPucchBits > 22)))
6457 cqiCb = ue->nPCqiCb;
6458 if(riCb->nRiTrIdx == validIdx)
6460 /*ccpu00140578:: Skip the UE if the RI is already processed
6462 if(riCb->riRecpPrcsd == FALSE)
6464 if(riCb->riDist == 0)
6466 if((riCb->cqiCfg.cqiSetup.sANCQI == TRUE) && (willUeRprtCqi == TRUE)&&
6467 (isDatPresOnSecCell == FALSE))
6470 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6471 riCb->cqiCfg.cqiSetup.cqiPResIdx;
6472 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6474 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_HARQ_SR)
6476 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI;
6480 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_CQI;
6482 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6484 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6485 ue->nPRiCb->servCellInfo->sCellIdx;
6487 rgSCHTomUtlFillRiBitWidthInfo(ue);
6488 if (ue->nPCqiCb->nCqiTrIdx == validIdx)
6490 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, ue->nPCqiCb);
6505 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
6511 /* Skip the UE for RI processing on PUCCH
6512 * in the same subframe as it already processed */
6513 if(riCb->nRiTrIdx == validIdx)
6515 /* As the new idx is same is current idx
6516 * then PUCCH reception processing will consider
6517 * RI also in the same subframe. To block this
6518 * below flag is used*/
6519 riCb->riRecpPrcsd = TRUE;
6523 else if(cqiCb->nCqiTrIdx == validIdx)
6525 if((cqiCb->cqiCfg.cqiSetup.sANCQI == TRUE) && (willUeRprtCqi == TRUE)&&
6526 (isDatPresOnSecCell == FALSE))
6529 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6530 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
6532 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6534 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6535 cqiCb->servCellInfo->sCellIdx;
6537 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6538 rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
6539 if(0 == pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz)
6541 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d "
6542 "Unable to Fill CqiPmi size", ue->ueId);
6545 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_HARQ_SR)
6547 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI;
6551 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_CQI;
6564 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6566 if(ue->srsCb.nSrsTrIdx == validIdx)
6568 /* ccpu00140578::Skip the UE for SRS reception processing
6569 * if already done as part of PUSCH recpetion
6571 if(ue->srsCb.srsRecpPrcsd == FALSE)
6573 if(ue->srsCb.srsDist ==0 )
6575 if((pucchRecpInfo->t.pucchRecpReq.uciInfo != TFU_PUCCH_HARQ_CQI)
6576 && (ue->srsCb.srsCfg.srsSetup.sANSrs)
6577 && (isDatPresOnSecCell == FALSE))
6580 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
6581 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
6582 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
6583 ue->srsCb.srsCfg.srsSetup.fDomPosi;
6584 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
6585 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
6586 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
6587 ue->srsCb.srsCfg.srsSetup.txComb;
6588 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
6589 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6590 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
6591 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
6592 /* ccpu00116923 - ADD - New Reception Request types for CQI and SRS with SR */
6593 switch(pucchRecpInfo->t.pucchRecpReq.uciInfo)
6595 case TFU_PUCCH_HARQ_SR:
6596 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_SRS;
6598 case TFU_PUCCH_HARQ_SR_CQI:
6599 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI_SRS;
6602 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SRS;
6606 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
6610 ue->srsCb.srsDist--;
6612 /* Skip the UE for SRS processing on PUCCH
6613 * in the same subframe as it already processed */
6614 if(ue->srsCb.nSrsTrIdx == validIdx)
6616 /* As the new idx is same is current idx
6617 * then PUCCH reception processing will consider
6618 * SRS also in the same subframe. To block this
6619 * below flag is used*/
6620 ue->srsCb.srsRecpPrcsd = TRUE;
6628 } /* rgSCHTomUtlFillCqiSrSrsWithHq */
6631 * @brief Function which handles the filling of PCQI/RI, SRS
6632 * Reception Request Information along with SR reception
6637 * Function: rgSCHTomUtlFillCqiSrsWithSr
6639 * Function which handles the filling of PCQI/RI, SRS
6640 * Reception Request Information along
6641 * with the SR reception Request
6644 * Invoked by: rgSCHTomUtlFillSrRecpReq of rg_sch_tom.c
6647 * - Fill the reception request for CQI/RI, SRS if they occur
6648 * in the same instance as of SR.
6650 * @param[in] RgSchCellCb *cell,
6652 * TfuRecpReqInfo *recpReqInfo,
6653 * @param[out] TfuUeRecpReqInfo *pucchRecpInfo
6654 * @param[in] U16 validIdx
6660 PRIVATE S16 rgSCHTomUtlFillCqiSrsWithSr
6664 TfuRecpReqInfo *recpReqInfo,
6665 TfuUeRecpReqInfo *pucchRecpInfo,
6669 PRIVATE S16 rgSCHTomUtlFillCqiSrsWithSr(cell, ue, recpReqInfo,
6670 pucchRecpInfo, validIdx)
6673 TfuRecpReqInfo *recpReqInfo;
6674 TfuUeRecpReqInfo *pucchRecpInfo;
6678 RgSchUePCqiCb *cqiCb;
6679 RgSchUePCqiCb *riCb;
6680 U8 ri; /*To fetch RI value*/
6681 Bool willUeRprtCqi; /* Flag set due to CQI Mask and
6682 UE Inactive state (DRX)*/
6683 TRC2(rgSCHTomUtlFillCqiSrsWithSr);
6686 cqiCb = ue->nPCqiCb;
6687 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
6689 rgSCHEmtcWillUeRptCqi(ue, &willUeRprtCqi);
6691 if(riCb->nRiTrIdx == validIdx)
6693 /*ccpu00140578:: Skip the UE if the RI is already processed
6695 if(riCb->riRecpPrcsd == FALSE)
6697 if(riCb->riDist == 0)
6699 if(willUeRprtCqi == TRUE)
6702 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6703 riCb->cqiCfg.cqiSetup.cqiPResIdx;
6704 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6707 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI;
6708 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6710 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6711 ue->nPRiCb->servCellInfo->sCellIdx;
6713 rgSCHTomUtlFillRiBitWidthInfo(ue);
6714 /* TODO:: syed Shouldn't this be done outside this if condition */
6715 if (cqiCb->nCqiTrIdx == validIdx)
6717 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6720 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
6726 if(riCb->nRiTrIdx == validIdx)
6727 {/* Need to skip this UE during PUCCH RI recpetion process
6728 in the current subframe */
6729 riCb->riRecpPrcsd = TRUE;
6733 else if(cqiCb->nCqiTrIdx == validIdx)
6735 if(willUeRprtCqi == TRUE)
6738 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6739 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
6741 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6744 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6745 cqiCb->servCellInfo->sCellIdx;
6747 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6748 rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
6749 if(0 == pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz)
6751 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"RNTI:%d"
6752 " Unable to Fill CqiPmi size", ue->ueId);
6756 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI;
6758 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6760 if(ue->srsCb.nSrsTrIdx == validIdx)
6762 /* ccpu00140578:: Cnsider the SRS processing
6763 * only if not done in the same TTI
6764 * as part of PUSCH or HARQ reception process*/
6765 if(ue->srsCb.srsRecpPrcsd == FALSE)
6767 if(ue->srsCb.srsDist ==0 )
6769 if(ue->srsCb.srsCfg.srsSetup.sANSrs)
6772 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
6773 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
6774 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
6775 ue->srsCb.srsCfg.srsSetup.fDomPosi;
6776 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
6777 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
6778 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
6779 ue->srsCb.srsCfg.srsSetup.txComb;
6780 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
6781 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6782 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
6783 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
6784 /* ccpu00116923 - ADD - New Reception Request types for CQI and
6786 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_SR_CQI)
6788 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI_SRS;
6792 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_SRS;
6796 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
6800 ue->srsCb.srsDist--;
6802 /* Skip the UE for SRS processing on PUCCH
6803 * in the same subframe as it already processed */
6804 if(ue->srsCb.nSrsTrIdx == validIdx)
6806 /* As the new idx is same is current idx
6807 * then PUCCH reception processing will consider
6808 * SRS also in the same subframe. To block this
6809 * below flag is used*/
6810 ue->srsCb.srsRecpPrcsd = TRUE;
6816 } /* rgSCHTomUtlFillCqiSrsWithSr */
6822 /** @brief This function handles filling of HARQ feedback repetition
6823 * recption request for each subframe
6827 * Function: rgSCHTomUtlFillSfRepHqFdbk
6831 * @param [out] TfuRecpReqInfo *recpReqInfo
6832 * @param [in] RgSchCellCb *cell
6833 * @param [out] RgSchErrInfo *err
6834 * @param [in] RgSchDlSf *dlSf
6835 * @param [in] U8 noFdbks
6836 * @param [in] CmMemListCp *memCp
6837 * @param [in] U8 elemIdx
6838 * @param [in] RgSchDlSf *nxtDlsf
6845 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk
6847 TfuRecpReqInfo *recpReqInfo,
6848 RgSchCellCb *cellCb,
6858 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk (recpReqInfo, cellCb, err, dlSf,
6859 noFdbks, memCp, elemIdx, nxtDlsf, validIdx)
6860 TfuRecpReqInfo *recpReqInfo;
6861 RgSchCellCb *cellCb;
6872 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk
6874 TfuRecpReqInfo *recpReqInfo,
6875 RgSchCellCb *cellCb,
6884 PRIVATE S16 rgSCHTomUtlFillSfRepHqFdbk (recpReqInfo, cellCb, err, dlSf,
6885 noFdbks, memCp, elemIdx, nxtDlsf)
6886 TfuRecpReqInfo *recpReqInfo;
6887 RgSchCellCb *cellCb;
6897 RgSchDlHqProcCb *hqCb;
6901 TfuUeRecpReqInfo *pucchRecpInfo;
6903 TfuUePucchHqRecpInfo *hqRecpReq;
6905 RgSchDlHqTbCb *tbCb;
6906 RgSchDlHqProcCb *prvHqCb = NULLP;
6908 TRC2(rgSCHTomUtlFillSfRepHqFdbk)
6910 node = dlSf->ackNakRepQ.first;
6913 tbCb = (RgSchDlHqTbCb *)(node->node);
6915 ueCb = hqCb->hqE->ue;
6917 if (--tbCb->fbkRecpRepCntr)
6919 /* Add to next subfarme */
6920 /* Add this hqCb to the next dlSf's ackNakRepQ */
6921 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
6922 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
6923 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
6924 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
6931 /* Go to the next node */
6936 if ((hqCb->hqE->ue != NULLP) &&
6937 (hqCb->hqE->ue->measGapCb.isMeasuring != TRUE)
6938 && (hqCb != prvHqCb)
6941 /* We need to add the recp request to be sent on the pucchANRep
6944 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
6945 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
6948 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to"
6949 "Allocate TfuUeRecpReqInfo for RNTI:%d ", ueCb->ueId);
6950 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
6953 pucchRecpInfo->rnti = ueCb->ueId;
6955 pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
6957 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
6960 /* FOR repetition Feedback shall come on n1PucchAnRep Configured per
6964 pucchRecpInfo->t.pucchRecpReq.hqType = TFU_HQ_RECP_REQ_N1PUCCH;
6965 pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = ueCb->ackNakRepCb.pucchRes;
6967 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
6968 hqRecpReq = &(pucchRecpInfo->t.pucchRecpReq.hqInfo);
6969 /* ACK NACK rep works only in bundling mode . */
6970 hqRecpReq->hqFdbkMode = (TfuAckNackMode)RGR_TDD_ACKNACK_MODE_BUNDL;
6971 if ((hqCb->hqPSfLnk.node != NULLP) &&
6972 (hqCb->hqPSfLnk.node != NULLP))
6975 hqRecpReq->hqSz = 2;
6979 hqRecpReq->hqSz = 1;
6981 hqRecpReq->pucchResCnt = 1;
6982 hqRecpReq->hqRes[0] = ueCb->ackNakRepCb.pucchRes;
6984 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
6985 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
6987 /* In a given dlSf, if there is 2 TBs context
6988 * stored for a given harq, then they are added
6989 * adjacent to each other in the subframe. To avoid
6990 * adding duplicate recpnInfo for each TB, store this
6991 * hqCb in prvHqCb. If nextHqCb is same as prvHqCb then
6992 * do not add reception req info.*/
6995 RGSCH_NULL_CHECK(cellCb->instIdx, hqCb->hqE->ue);
6996 rgSCHTomUtlMoveNxtOccasion(cellCb, hqCb->hqE->ue, validIdx);
6998 /* Go to the next node */
7005 /** @brief This function handles filling of HARQ feedback recption request
7010 * Function: rgSCHTomUtlFillSfHqFdbkInfo
7014 * @param [out] TfuRecpReqInfo *recpReqInfo
7015 * @param [in] RgSchCellCb *cell
7016 * @param [out] RgSchErrInfo *err
7017 * @param [in] RgSchDlSf *dlSf
7018 * @param [in] U8 noFdbks
7019 * @param [in] CmMemListCp *memCp
7020 * @param [in] U8 elemIdx
7021 * @param [in] RgSchDlSf *nxtDlsf
7022 * @param [in] U16 validIdx;
7029 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo
7031 TfuRecpReqInfo *recpReqInfo,
7032 RgSchCellCb *cellCb,
7040 RgSchDlHqProcCb *hqCb,
7041 RgSchUePucchRecpInfo *pucchInfo,
7043 RgSchDlHqProcCb *prvHqCb
7046 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo (recpReqInfo, cellCb, err, dlSf,
7047 noFdbks, memCp, elemIdx, nxtDlsf, validIdx, hqCb, pucchInfo, alloc, prvHqCb)
7048 TfuRecpReqInfo *recpReqInfo;
7049 RgSchCellCb *cellCb;
7057 RgSchDlHqProcCb *hqCb;
7058 RgSchUePucchRecpInfo *pucchInfo;
7060 RgSchDlHqProcCb *prvHqCb;
7064 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo
7066 TfuRecpReqInfo *recpReqInfo,
7067 RgSchCellCb *cellCb,
7074 RgSchDlHqProcCb *hqCb,
7075 RgSchUePucchRecpInfo *pucchInfo,
7077 RgSchDlHqProcCb *prvHqCb
7080 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkInfo (recpReqInfo, cellCb, err, dlSf,
7081 noFdbks, memCp, elemIdx, nxtDlsf, hqCb, pucchInfo, alloc, prvHqCb)
7082 TfuRecpReqInfo *recpReqInfo;
7083 RgSchCellCb *cellCb;
7090 RgSchDlHqProcCb *hqCb;
7091 RgSchUePucchRecpInfo *pucchInfo;
7093 RgSchDlHqProcCb *prvHqCb;
7098 RgSchUeCb *ueCb = hqCb->hqE->ue;
7100 CmLteTimingInfo futTime;
7101 RgSchTddANInfo *anInfo;
7104 RgrTddAckNackMode ackNackMode;
7105 RgSchDlHqTbCb *tbCb;
7110 TRC2(rgSCHTomUtlFillSfHqFdbkInfo)
7113 RG_SCH_ADD_TO_CRNT_TIME(cellCb->crntTime, futTime, TFU_RECPREQ_DLDELTA);
7117 for (idx = 0 ;idx < 2; idx++)
7119 if (HQ_TB_WAITING == hqCb->tbInfo[idx].state)
7122 tbCb = &hqCb->tbInfo[idx];
7126 ackNackMode = ueCb->dl.ackNackMode;
7128 if(ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL)
7130 anInfo = rgSCHUtlGetUeANFdbkInfo(ueCb, &futTime);
7131 /* Only the last scheduled TB for the UE is for HARQ
7132 * ACK/NACK reception in Bundling case */
7133 if((anInfo == NULLP) ||
7134 (anInfo->latestMIdx != dlSf->dlFdbkInfo.m))
7141 /* Get the TFU reception request pointer, if present */
7142 cmHashListFind(&cellCb->ueTfuPendLst, (U8*) &ueCb->ueId,
7143 sizeof(ueCb->ueId), 0, (PTR *) &pucchInfo);
7146 /* For upgrade we shall use the existing logic of pending list. */
7147 cmHashListFind(&cellCb->ueTfuPendLst, (U8*) &ueCb->ueId,
7148 sizeof(ueCb->ueId), 0, (PTR *) &pucchInfo);
7151 else if(hqCb->hqE->raCb != NULLP)
7153 /* For RACH it is set to Bundling */
7154 ackNackMode = RGR_TDD_ACKNACK_MODE_BUNDL;
7155 rnti = hqCb->hqE->raCb->tmpCrnti;
7162 /* Do not proceed if PUSCH
7163 reception req is already filled*/
7168 /* Go to the next node */
7172 if(((ueCb == NULLP) || (ueCb->measGapCb.isMeasuring != TRUE))
7176 TknU16 n1PucchTkn = {FALSE, 0};
7179 pdcch = tbCb->hqP->pdcch;
7181 n1PucchTkn = hqCb->spsN1PucchRes;
7183 for (tbIndx = 0; tbIndx < TFU_MAX_TB; tbIndx++)
7185 if (hqCb->tbInfo[tbIndx].state == HQ_TB_WAITING &&
7186 (RGSCH_TIMEINFO_SAME(hqCb->tbInfo[tbIndx].fdbkTime,
7187 recpReqInfo->timingInfo)))
7190 hqCb->tbInfo[tbIndx].pucchFdbkIdx = hqCb->ulDai;
7193 ret = rgSCHTomUtlFillSfHqFdbkForOneUe(hqCb,recpReqInfo, cellCb, err, dlSf, noFdbks,
7194 memCp, elemIdx, nxtDlsf, rnti, ackNackMode, &pucchInfo, pdcch,
7195 n1PucchTkn, &alloc, hqSz);
7200 /* TODO:: In case of F1BCS and CSI in same subframe
7201 * UE shall drop the CSI if there was at least one
7202 * PDSCH transmission in any of the DL subframe
7203 * mapping to this UL subframe
7206 rgSCHTomUtlFillCqiSrSrsWithHq(cellCb,recpReqInfo, hqCb->hqE->ue,
7207 pucchInfo->pucchRecpInfo, validIdx,FALSE);
7209 if((hqCb->hqE->ue) &&
7210 (hqCb->hqE->ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS))
7213 if(RG_SCH_IS_CELL_SEC(hqCb->hqE->ue,hqCb->hqE->cell))
7215 switch(pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo)
7217 case TFU_PUCCH_HARQ_SR_CQI:
7218 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
7219 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
7221 case TFU_PUCCH_HARQ_CQI:
7222 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
7223 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
7225 case TFU_PUCCH_HARQ_SR_CQI_SRS:
7226 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_SRS;
7227 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
7229 case TFU_PUCCH_HARQ_SR_SRS:
7230 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
7232 case TFU_PUCCH_HARQ_SRS:
7233 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
7244 /* TODO antz - pushing the following code (under TFU_UPGRADE)
7245 * into the above function (...ForOneUe) did not work (caused
7246 * two additional TCs to fail). Don't know why. If this
7247 * is done later, make sure that the code branch
7248 * for relPdcch (later in this func) is also modified appropriately.
7250 /* Now add to the recp request or pending list */
7251 //if((elemIdx != (noFdbks - 1)))
7253 cmHashListInsert(&cellCb->ueTfuPendLst, (PTR) pucchInfo,
7254 (U8 *)&rnti ,(U16) sizeof(CmLteRnti));
7258 } /* If measuring */
7259 /* Go to the next node */
7260 if ((tbCb->fbkRecpRepCntr) && (--tbCb->fbkRecpRepCntr))
7262 /* Add to next subfarme */
7263 /* Add this hqCb to the next dlSf's ackNakRepQ */
7264 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
7265 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
7266 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
7267 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
7269 /* In a given dlSf, if there is 2 TBs context
7270 * stored for a given harq, then they are added
7271 * adjacent to each other in the subframe. To avoid
7272 * adding duplicate recpnInfo for each TB, store this
7273 * hqCb in prvHqCb. If nextHqCb is same as prvHqCb then
7274 * do not add reception req info.*/
7282 /** @brief This function calculates the pucch resource idx
7283 * that is to be filled in harq reception request
7287 * Function: rgSCHTomUtlGethqRes
7290 * -Calculate the pucch resource idx
7291 * Harq Reception Request for Format 1B with
7294 * @param [in] U8 noFdbks
7295 * @param [in] RgSchDlSf *dlSf
7296 * @param [in] RgSchPdcch *pdcch
7297 * @param [in] RgSchCellCb *cellCb
7298 * @param [out]U16 *hqRes
7302 PRIVATE Void rgSCHTomUtlGethqRes
7307 RgSchCellCb *cellCb,
7311 PRIVATE Void rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,hqRes)
7315 RgSchCellCb *cellCb;
7327 m = dlSf->dlFdbkInfo.m;
7329 P = rgSCHCmnGetPValFrmCCE(cellCb, nCce);
7330 nP = cellCb->rgSchTddNpValTbl[P];
7331 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
7332 *hqRes = (M - m - 1)* nP + (m * nPlusOne) + pdcch->nCce +
7333 cellCb->pucchCfg.n1PucchAn;
7338 /** @brief This function fills the harq reception request for
7339 * TDD in case of Fomat 1B with CS for M=1
7343 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1
7346 * -Fill Harq Reception Request for Format 1B with
7349 * @param [in] RgSchDlHqProcCb *hqCb
7350 * @param [in] TfuUePucchRecpReq *hqRecpReq
7351 * @param [in] U8 noFdbks
7352 * @param [in] RgSchDlSf *dlSf
7353 * @param [in] RgSchPdcch *pdcch
7354 * @param [in] RgSchCellCb *cellCb
7358 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1
7360 RgSchDlHqProcCb *hqCb,
7361 TfuUePucchRecpReq *hqRecpReq,
7368 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1(hqCb, hqRecpReq,
7369 noFdbks,dlSf,pdcch,cellCb)
7370 RgSchDlHqProcCb *hqCb;
7371 TfuUePucchRecpReq *hqRecpReq;
7375 RgSchCellCb *cellCb;
7378 RgSchUeCb *ue = NULLP;
7379 Bool isCellSec = FALSE;
7382 /*ccpu00147920: UeCb is NULL for SPS activation*/
7383 if(pdcch && pdcch->ue)
7384 {/* SPS Release pdcch or dynamic data */
7391 /* This is not supposed to happen
7392 * Error case. hqCB has to be ter
7393 * when pdcch is present . Adding
7394 * if check bcs of kwork*/
7401 if((hqCb != NULLP) &&
7402 (RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
7407 switch(ue->f1bCsAVal)
7409 case RG_SCH_A_VAL_2:
7410 /* harq(0) is primary harq(1) is secondary) */
7413 hqRecpReq->hqInfo.hqRes[1] = ue->n1PucchF1bResCb.
7414 cw1N1Res[hqCb->tpc].n1PucchIdx;
7416 else/* primary cell */
7419 /* hqCb will be null in case of sps rel pdcch */
7420 if ((hqCb) && hqCb->spsN1PucchRes.pres)
7421 {/* SPS occasion or dyn sched*/
7422 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
7425 #endif /* LTEMAC_SPS */
7426 {/* dyn data or sps release */
7430 /* This is not supposed to happen
7431 * Error case. hqCB has to be ter
7432 * when pdcch is present . Adding
7433 * if check bcs of kwork*/
7438 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7439 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7443 case RG_SCH_A_VAL_3:
7445 /* Serving cell in mimo mode should be
7446 * in 0 and 1 and the serving cell in siso
7447 * mode should be in 2 indices */
7450 U8 servCellIdx = rgSchUtlGetServCellIdx(hqCb->hqE->cell->instIdx,
7451 hqCb->hqE->cell->cellId,
7454 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1)
7455 {/* Sec cell is in mimo mode, use 0 and 1 */
7456 hqRecpReq->hqInfo.hqRes[0] =
7457 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7458 hqRecpReq->hqInfo.hqRes[1] =
7459 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
7462 {/* Sec cell is in siso mode, use 2 */
7463 hqRecpReq->hqInfo.hqRes[2] =
7464 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7468 {/* primary cell hq */
7470 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
7471 {/* prim cell is in mimo mode, use 0 and 1 */
7473 if (hqCb && hqCb->spsN1PucchRes.pres)
7474 {/* Not sps release */
7475 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
7478 #endif /* LTEMAC_SPS */
7479 {/* sps rel or dyn */
7483 /* This is not supposed to happen
7484 * Error case. hqCB has to be ter
7485 * when pdcch is present . Adding
7486 * if check bcs of kwork*/
7491 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7492 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7493 hqRecpReq->hqInfo.hqRes[1] = hqRes + 1;
7497 {/* prim cell is in siso mode use 2 */
7499 /* Consider sps occasions */
7500 if (hqCb && hqCb->spsN1PucchRes.pres)
7501 {/* Not sps release */
7502 hqRecpReq->hqInfo.hqRes[2] = hqCb->spsN1PucchRes.val;
7505 #endif /* LTEMAC_SPS */
7510 /* This is not supposed to happen
7511 * Error case. hqCB has to be ter
7512 * when pdcch is present . Adding
7513 * if check bcs of kwork*/
7518 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7519 hqRecpReq->hqInfo.hqRes[2] = hqRes;
7525 case RG_SCH_A_VAL_4:
7526 {/* Both the serv cells are in mimo mode */
7528 {/* 2 and 3 for sec cell */
7529 hqRecpReq->hqInfo.hqRes[2] =
7530 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7531 hqRecpReq->hqInfo.hqRes[3] =
7532 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
7534 else/* primary cell */
7535 {/* 0 and 1 are for primary cell */
7537 if (hqCb && hqCb->spsN1PucchRes.pres)
7538 {/* Not sps release */
7539 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
7542 #endif /* LTEMAC_SPS */
7547 /* This is not supposed to happen
7548 * Error case. hqCB has to be ter
7549 * when pdcch is present . Adding
7550 * if check bcs of kwork*/
7555 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7556 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7557 hqRecpReq->hqInfo.hqRes[1] = hqRes + 1;
7568 /** @brief This function fills the harq reception request for
7569 * TDD in case of Fomat 1B with CS for M>=2
7573 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234
7576 * -Fill Harq Reception Request for Format 1B with
7579 * @param [in] RgSchDlHqProcCb *hqCb
7580 * @param [in] TfuUePucchRecpReq *hqRecpReq
7581 * @param [in] U8 noFdbks
7582 * @param [in] RgSchDlSf *dlSf
7583 * @param [in] RgSchPdcch *pdcch
7584 * @param [in] RgSchCellCb *cellCb
7585 * @param [in] U8 elemIdx
7589 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234
7591 RgSchDlHqProcCb *hqCb,
7592 TfuUePucchRecpReq *hqRecpReq,
7596 RgSchCellCb *cellCb,
7600 PRIVATE Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234(
7601 hqCb,hqRecpReq,noFdbks,dlSf,pdcch,cellCb,elemIdx)
7602 RgSchDlHqProcCb *hqCb;
7603 TfuUePucchRecpReq *hqRecpReq;
7607 RgSchCellCb *cellCb;
7612 Bool isCellSec = FALSE;
7617 {/* SPS Release pdcch or dynamic data */
7624 /* This is not supposed to happen
7625 * Error case. hqCB has to be ter
7626 * when pdcch is present . Adding
7627 * if check bcs of kwork*/
7634 if((hqCb != NULLP) && (ue != NULLP) &&
7635 (RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
7641 {/* Sec Cell indices are 2 and 3*/
7642 servCellIdx = rgSchUtlGetServCellIdx(hqCb->hqE->cell->instIdx,
7643 hqCb->hqE->cell->cellId,
7646 hqRecpReq->hqInfo.hqRes[2] =
7647 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
7649 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1)
7651 hqRecpReq->hqInfo.hqRes[3] =
7652 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
7656 {/* Primary cell indices are 0 and 1 */
7658 * M > 2 if SPS occasion is present in any of the
7659 * DL subframe in the bundle, the n1Pucch(0) is
7660 * the SPS resource and n1Pucch(1) is the resource
7661 * derived from pdcch with DAI = 1
7662 * If No SPS Occasion
7663 * Then n1Pucch(0) is from pdcch with DAI =1
7664 * and n1Pucch(1) is from pdcch with DAI = 2
7668 {/* this is not sps release pdcch */
7669 if(hqCb->spsN1PucchRes.pres == TRUE)
7671 hqRes = hqCb->spsN1PucchRes.val;
7676 {/*Dynamic scheduling or SPS Release
7677 Derive from pdcch */
7678 if(pdcch->dlDai < 3)
7679 {/* No need to calcualte from DAI > 2 */
7680 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7686 hqRecpReq->hqInfo.hqRes[elemIdx] = hqRes;
7689 {/* Pdcch with DAI = 1 and 2 needs to be used
7690 for resource calculation*/
7691 if(hqCb && hqCb->spsN1PucchRes.pres == TRUE)
7692 {/* dyn or sps occasion */
7693 /* Shift the hqRes[0] if it was filled
7694 * if there was a pdcch with DAI 1 before to this
7697 {/* SPS occasion happened in the middle
7699 /* shifting the non SPS resource to n1Pucch(1) */
7700 hqRecpReq->hqInfo.hqRes[1] = hqRecpReq->hqInfo.hqRes[0];
7703 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7706 else if(pdcch && pdcch->dlDai < 3)
7708 else if(pdcch->dlDai < 3)
7710 {/* sps rel or dyn sched */
7711 /* hqCb wil not be present for sps release pdcch */
7712 if(hqCb && (pdcch->dlDai != hqCb->ulDai))
7713 {/* there was a SPS occasion before to this */
7714 if(pdcch->dlDai == 1)
7716 hqRecpReq->hqInfo.hqRes[1] = hqRes;
7717 }/* ignore the DAI 2 in this case */
7719 {/* There was no SPS occasion before to this */
7723 {/* Added check to ignore kwork warning */
7724 hqRecpReq->hqInfo.hqRes[(pdcch->dlDai)-1] = hqRes;
7733 /** @brief This function fills the harq reception request for
7734 * TDD in case of Fomat 1B with CS
7738 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCS
7741 * -Fill Harq Reception Request for Format 1B with
7744 * @param [in] RgSchDlSf *ulSf
7745 * @param [in] RgSchCellCb *cell
7746 * @param [out]TfuUePucchRecpReq *hqRecpReq
7750 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS
7752 RgSchDlHqProcCb *hqCb,
7753 TfuUePucchRecpReq *hqRecpReq,
7761 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS(hqCb,hqRecpReq,noFdbks,dlSf,pdcch,
7762 n1PucchTkn,elemIdx,cellCb)
7763 RgSchDlHqProcCb *hqCb;
7764 TfuUePucchRecpReq *hqRecpReq;
7769 RgSchCellCb *cellCb;
7772 /* Update teh fdbk mode if something different is present
7773 * in L1 API file for F1BS *//* 1 --> F1BCS */
7774 hqRecpReq->hqInfo.hqFdbkMode = TFU_ACK_NACK_CHANNEL_SELECTION;
7778 case RG_SCH_M_VAL_1:
7781 rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1(hqCb,hqRecpReq,
7782 noFdbks,dlSf,pdcch,cellCb);
7785 case RG_SCH_M_VAL_2:
7786 case RG_SCH_M_VAL_3:
7787 case RG_SCH_M_VAL_4:
7789 /* Spatial bundling will be applied */
7790 rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234(hqCb,hqRecpReq,
7791 noFdbks,dlSf,pdcch,cellCb,elemIdx);
7801 /***********************************************************
7803 * Func : rgSCHTomUtlFillSfHqFdbkForOneUe
7805 * Desc : Fill HARQ feedback info for one UE/entry
7813 **********************************************************/
7815 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForOneUe
7817 RgSchDlHqProcCb *hqCb,
7818 TfuRecpReqInfo *recpReqInfo,
7819 RgSchCellCb *cellCb,
7827 RgrTddAckNackMode ackNackMode,
7828 RgSchUePucchRecpInfo **pucchInfoRef,
7835 PRIVATE S16 rgSCHTomUtlFillSfHqFdbkForOneUe(hqCb,recpReqInfo, cellCb, err, dlSf,
7836 noFdbks, memCp, elemIdx, nxtDlsf, rnti, ackNackMode, pucchInfoRef,
7837 pdcch, n1PucchTkn, allocRef, hqSz)
7838 RgSchDlHqProcCb *hqCb;
7839 TfuRecpReqInfo *recpReqInfo;
7840 RgSchCellCb *cellCb;
7848 RgrTddAckNackMode ackNackMode;
7849 RgSchUePucchRecpInfo **pucchInfoRef;
7856 RgSchUePucchRecpInfo *pucchInfo = *pucchInfoRef;
7859 TfuUePucchRecpReq *hqRecpReq;
7874 Bool isFirstFdbk = FALSE;
7876 if(pucchInfo == NULLP)
7878 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchInfo,
7879 sizeof(RgSchUePucchRecpInfo), memCp)) != ROK)
7881 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to "
7882 "Allocate TfuUeRecpReqInfo for cell RNTI:%d",rnti);
7883 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
7887 #ifdef TFU_ALLOC_EVENT_NO_INIT
7888 pucchInfo->hashLstEnt.hashVal = 0;
7889 pucchInfo->hashLstEnt.keyLen = 0;
7890 pucchInfo->hashLstEnt.key = 0;
7891 pucchInfo->hashLstEnt.list.prev = pucchInfo->hashLstEnt.list.next = 0;
7893 if ((ret = rgSCHUtlGetEventMem((Ptr *)&(pucchInfo->pucchRecpInfo),
7894 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp))) != ROK)
7896 RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to "
7897 "Allocate TfuUeRecpReqInfo for cell RNTI:%d",rnti);
7898 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
7901 cmMemset((U8 *)pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes,0xff,sizeof(U16)*TFU_MAX_HQ_RES);
7902 #ifdef TFU_ALLOC_EVENT_NO_INIT
7903 cmMemset((U8 *)&pucchInfo->pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
7905 pucchInfo->pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
7906 pucchInfo->pucchRecpInfo->rnti = rnti;
7908 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo=TFU_PUCCH_HARQ;
7915 /* Calculation of resources same for both bundling and muxing for M = 1
7918 RgSchUeCb *ue = rgSCHDbmGetUeCb (cellCb, rnti);
7919 if((ue) && (1 == ue->numSCells))
7921 if(ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS)
7923 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
7924 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS(hqCb,hqRecpReq,
7925 noFdbks,dlSf,pdcch,elemIdx,cellCb);
7928 {/* M = 1 case . size is same as A Value*/
7929 hqRecpReq->hqInfo.hqSz = ue->f1bCsAVal;
7930 hqRecpReq->hqInfo.pucchResCnt = hqRecpReq->hqInfo.hqSz;
7933 hqRecpReq->hqInfo.hqSz = (noFdbks * 2); /* M for 2 cells */
7934 hqRecpReq->hqInfo.pucchResCnt = 4;
7936 hqRecpReq->hqInfo.a = ue->f1bCsAVal;
7937 /* handling for SPS occasions*/
7940 /* set the datPresinFirstSUbframe to TRUE if this
7941 * is for pcell txion*/
7943 RgSchTddANInfo *anInfo = NULLP;
7945 /* if this txion is on pcell
7946 * sps occaion, dyn sched or sps release pdcch
7947 * set the sched present in first
7948 * dl subframe of the bundle to TRUE. This
7949 * is required for mapping the feedbak when SPS occasion
7950 * is present in any of the DL subframe in the bundle in
7953 /* SPS will happen only on pcell */
7954 if((hqCb == NULLP) || (!RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
7957 anInfo = rgSCHUtlGetUeANFdbkInfo(ue,
7958 &recpReqInfo->timingInfo,RGSCH_PCELL_INDEX);
7960 {/* ANInfo must be there. adding block
7962 RGSCHDBGERRNEW(cellCb->instIdx,(rgSchPBuf(cellCb->instIdx),
7963 "ANInfo should not be NULL for cellId=%d \n", cellCb->cellId));
7971 {/* This needs to be revisited while
7972 adding support for PUCCH format 3 */
7973 RGSCHDBGERRNEW(cellCb->instIdx,(rgSchPBuf(cellCb->instIdx),"Invalid Pucch format configured.."));
7980 if((ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) ||
7981 ((noFdbks == 1) && (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT)))
7983 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
7985 prevHqSize = hqRecpReq->hqInfo.hqSz;
7988 /* Only one index for bundling case */
7989 hqRecpReq->M = noFdbks;
7991 TFU_HQ_RECP_REQ_NORMAL;
7992 hqRecpReq->multCnt = 1;
7993 hqRecpReq->t.nCce[0] =
7998 rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
8000 hqRecpReq->type = TFU_UCI_HARQ;
8002 #else /* TFU_UPGRADE */
8005 if ((TRUE == isFirstFdbk) && (TRUE == n1PucchTkn.pres))
8007 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)ackNackMode;
8008 hqRecpReq->hqInfo.pucchResCnt=1;
8009 hqRecpReq->hqInfo.hqRes[0] = n1PucchTkn.val;
8010 hqRecpReq->hqInfo.hqSz = hqSz;
8013 else if (FALSE == n1PucchTkn.pres)
8016 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)ackNackMode;
8018 P = rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
8019 nP = cellCb->rgSchTddNpValTbl[P];
8020 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
8021 m = dlSf->dlFdbkInfo.m;
8022 /* In case of no UE */
8023 pucchRes = (M - m - 1)* nP + (m * nPlusOne) + pdcch->nCce +
8024 cellCb->pucchCfg.n1PucchAn;
8025 /*ccpu00130164:MOD-Changed to maitain value of
8026 hqRecpReq->hqInfo.pucchResCnt=1 in case of bundling*/
8027 /*ccpu00132284 -MOD- hqRes need to be updated after pucchReCnt set to 1
8028 * and resource should be update at index-0*/
8029 hqRecpReq->hqInfo.pucchResCnt=1;
8030 hqRecpReq->hqInfo.hqRes[hqRecpReq->hqInfo.pucchResCnt-1] = pucchRes;
8032 if((ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) && (hqSz > prevHqSize))
8033 hqRecpReq->hqInfo.hqSz = hqSz;
8034 else if (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT)
8035 hqRecpReq->hqInfo.hqSz = hqSz;
8037 hqRecpReq->hqInfo.hqSz = prevHqSize;
8039 #endif /* TFU_UPGRADE */
8041 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst,
8042 &(pucchInfo->pucchRecpInfo->lnk));
8043 pucchInfo->pucchRecpInfo->lnk.node =
8044 (PTR)pucchInfo->pucchRecpInfo;
8047 else /* Multiplexing */
8050 pucchInfo->pucchRecpInfo->t.pucchRecpReq.M = noFdbks;
8052 if (n1PucchTkn.pres == TRUE)
8054 pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqType =
8055 TFU_HQ_RECP_REQ_N1PUCCH;
8056 pucchInfo->pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = n1PucchTkn.val;
8061 pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqType =
8062 TFU_HQ_RECP_REQ_NORMAL;
8063 multCnt = pucchInfo->pucchRecpInfo->t.pucchRecpReq.multCnt;
8064 pucchInfo->pucchRecpInfo->t.pucchRecpReq.t.nCce[multCnt] =
8066 pucchInfo->pucchRecpInfo->t.pucchRecpReq.m[multCnt] =
8068 pucchInfo->pucchRecpInfo->t.pucchRecpReq.p[multCnt] =
8069 rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
8071 pucchInfo->pucchRecpInfo->t.pucchRecpReq.multCnt++;
8073 #else /* TFU_UPGRADE */
8075 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
8076 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)RGR_TDD_ACKNACK_MODE_MULT;
8077 hqRecpReq->hqInfo.hqSz = noFdbks;
8079 resIdx = hqRecpReq->hqInfo.pucchResCnt;
8080 hqRecpReq->hqInfo.pucchResCnt++;
8083 if (n1PucchTkn.pres == TRUE)
8085 hqRecpReq->hqInfo.hqRes[resIdx] = n1PucchTkn.val;
8091 m = dlSf->dlFdbkInfo.m;
8093 P = rgSCHCmnGetPValFrmCCE(cellCb, nCce);
8094 nP = cellCb->rgSchTddNpValTbl[P];
8095 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
8096 hqRecpReq->hqInfo.hqRes[resIdx] = (M - m - 1)* nP +
8097 (m * nPlusOne) + pdcch->nCce +
8098 cellCb->pucchCfg.n1PucchAn;
8100 #endif /* TFU_UPGRADE */
8101 /* If all the DL subframes are scanned, then
8102 * send TFU request*/
8104 if((elemIdx != noFdbks) && alloc)
8106 cmHashListInsert(&cellCb->ueTfuPendLst, (PTR) pucchInfo,
8107 (U8 *)&rnti, (U16) sizeof(rnti));
8112 pucchInfo->pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
8113 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst,
8114 &(pucchInfo->pucchRecpInfo->lnk));
8115 pucchInfo->pucchRecpInfo->lnk.node =
8116 (PTR)pucchInfo->pucchRecpInfo;
8117 /* Delete the entry after addition to the list */
8118 cmHashListDelete(&cellCb->ueTfuPendLst, (PTR) pucchInfo);
8124 *pucchInfoRef = pucchInfo;
8130 #ifdef RG_ULSCHED_AT_CRC
8131 /** @brief This function does all the processing related to a single downlink
8136 * Function: rgSCHTomUtlProcDlSfAtCrc
8139 * - collate control data for all UEs and send to PHY
8140 * - collate data buffers for all UEs and send to PHY
8142 * @param [in] RgSchDlSf *ulSf
8143 * @param [in] RgSchCellCb *cell
8144 * @param [in] TfuCntrlReqInfo *cntrlInfo
8145 * @param [out] RgSchErrInfo *err
8149 PRIVATE S16 rgSCHTomUtlProcDlSfAtCrc
8152 CmLteTimingInfo crntUlFrm,
8154 TfuCntrlReqInfo *cntrlInfo,
8158 PRIVATE S16 rgSCHTomUtlProcDlSfAtCrc (ulSf, crntUlFrm, cell, cntrlInfo, err)
8160 CmLteTimingInfo crntUlFrm;
8162 TfuCntrlReqInfo *cntrlInfo;
8166 Inst inst = cell->instIdx;
8169 TRC2(rgSCHTomUtlProcDlSfAtCrc);
8172 cntrlInfo->numDlActvUes = 0;
8173 cmLListInit(&cntrlInfo->phichLst);
8174 cmLListInit(&cntrlInfo->dlPdcchLst);
8175 cmLListInit(&cntrlInfo->ulPdcchLst);
8176 #ifdef TFU_ALLOC_EVENT_NO_INIT
8177 cntrlInfo->dlTiming.sfn = cntrlInfo->dlTiming.subframe = 0;
8181 cntrlInfo->ulTiming = crntUlFrm;
8182 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cntrlInfo->ulTiming, TFU_ULCNTRL_DLDELTA);
8184 cntrlInfo->cellId = cell->cellId;
8185 /* Fill PHICH info */
8186 if ((ret = rgSCHTomUtlFillPhich (cell, cntrlInfo, ulSf, err)) != ROK)
8188 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send PHICH info for "
8190 RGSCH_FREE_MEM(cntrlInfo);
8195 if ((ret = rgSCHTomUtlFillUlPdcch (cell, cntrlInfo, ulSf, err)) != ROK)
8197 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send PDCCH info for "
8199 RGSCH_FREE_MEM(cntrlInfo);
8204 if(0 == cntrlInfo->ulMpdcchLst.count)
8211 if ((cntrlInfo->ulPdcchLst.count || cntrlInfo->phichLst.count) || RG_SCH_EMTC_GET_PDCCHLST_CNT(cntrlInfo))
8213 if (cntrlInfo->ulPdcchLst.count || cntrlInfo->phichLst.count)
8216 if (rgSCHUtlTfuCntrlReq(inst, cell->tfuSap->sapCfg.suId, cntrlInfo)
8219 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Unable to send Cntrl info for"
8225 RGSCH_FREE_MEM(cntrlInfo);
8230 #endif /* #ifdef RG_ULSCHED_AT_CRC*/
8233 /** @brief This function sends the SFN Tick to L3
8238 * Function: rgSCHTomUtlSendSfnTick
8240 * @param [in] RgSchCellCb *cell
8243 PRIVATE Void rgSCHTomUtlSendSfnTick
8248 PRIVATE Void rgSCHTomUtlSendSfnTick (cell)
8252 RgrTtiIndInfo *rgrTtiInd;
8254 TRC2(rgSCHTomUtlSendSfnTick);
8256 /* TTI to be sent to RRM only once per system frame */
8257 /* Added support for period = 0 to disable tick to RRM */
8258 if ((cell->rrmTtiIndPrd != 0) &&
8259 ((cell->crntTime.sfn % cell->rrmTtiIndPrd) == 0) &&
8260 (cell->crntTime.slot == 0))
8262 /* Allocate a TTI indication structure and send to RRM over RGR interface */
8263 if (rgSCHUtlAllocSBuf (cell->instIdx,
8264 (Data**)&rgrTtiInd, sizeof(RgrTtiIndInfo)) != ROK)
8266 RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),
8267 "Mem alloc failed for RGR TTI ind, cellId (%d))\n",
8271 rgrTtiInd->cellId = cell->cellId;
8272 //rgrTtiInd->hSfn = cell->crntTime.hSfn;
8273 rgrTtiInd->sfn = cell->crntTime.sfn;
8275 if (rgSCHUtlRgrTtiInd (cell, rgrTtiInd) != ROK)
8277 RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),
8278 "Failed to send RGR TTI ind, cellId (%d))\n",
8280 rgSCHUtlFreeSBuf(cell->instIdx, (Data**)&rgrTtiInd,
8281 sizeof(RgrTtiIndInfo));
8291 /* @brief Mark Dyn TDD CrntSfIdx.
8295 * Function: rgSCHDynTDDMrkCrntSfIdx
8296 * Purpose: update the dyn tdd sunframe index
8297 * @param[in] Inst schInst
8301 PRIVATE Void rgSCHDynTDDMrkCrntSfIdx
8306 PRIVATE Void rgSCHDynTDDMrkCrntSfIdx(schInst)
8310 RgSchDynTddCb *rgSchDynTddInfo = &(rgSchCb[schInst].rgSchDynTdd);
8312 TRC2(rgSCHDynTDDMrkCrntSfIdx)
8314 RG_SCH_DYN_TDD_MARKTYPE(rgSchDynTddInfo, rgSchDynTddInfo->crntDTddSfIdx,
8315 RG_SCH_DYNTDD_NOTDEF);
8316 rgSchDynTddInfo->crntDTddSfIdx = (rgSchDynTddInfo->crntDTddSfIdx + 1) %
8317 RG_SCH_DYNTDD_MAX_SFINFO;
8319 //printf("Initializing Index %d \n", rgSchDynTddInfo->crntDTddSfIdx);
8325 /** @brief This function fills the TTI timinig info for each cell
8329 * Function: rgSchTomFillCellTtiInfo
8331 * @param [in] TfuTtiIndInfo *ttiInd
8332 * @param [in] Inst schInst
8333 * @param [out] U8 *nCell
8334 * @param [out] RgSchCellCb *cell[]
8340 PRIVATE Void rgSchTomFillCellTtiInfo
8342 TfuTtiIndInfo *ttiInd,
8345 RgSchCellCb *cells[]
8348 PRIVATE Void rgSchTomFillCellTtiInfo (ttiInd, schInst, nCell, cells)
8349 TfuTtiIndInfo *ttiInd;
8352 RgSchCellCb *cells[];
8357 TfuTtiCellInfo *cellInfo;
8361 CmLteTimingInfo frm;
8363 TRC2 (rgSchTomFillCellTtiInfo);
8365 if (CM_LTE_MAX_CELLS < ttiInd->numCells)
8371 rgSCHDynTDDMrkCrntSfIdx(schInst);
8374 for (i = 0; i < ttiInd->numCells; i++)
8376 cellInfo = &ttiInd->cells[i];
8377 strtCellId = rgSchCb[schInst].genCfg.startCellId;
8378 Idx1 = (U8)((cellInfo->cellId - strtCellId)&(CM_LTE_MAX_CELLS-1));
8379 cell = rgSchCb[schInst].cells[Idx1];
8380 /* Validate the cell */
8383 /* Use SCH inst 0 print buff */
8384 RGSCHDBGERRNEW(schInst,(rgSchPBuf(schInst),
8385 "RgLiTfuTtiInd()No cell exists for cellId %d\n",
8389 *nCell = *nCell + 1;
8390 cells[i] = (RgSchCellCb *)cell;
8393 if(cell->schTickDelta != cellInfo->schTickDelta)
8395 printf("\nMukesh: Delta changed for cellId=%d: curr delta=%d new delta=%d\n"
8396 "dlblankSf=%d ulblankSf=%d dummyTti=%d \n",
8397 cell->cellId, cell->schTickDelta, cellInfo->schTickDelta, cellInfo->dlBlankSf,cellInfo->ulBlankSf,
8398 cellInfo->isDummyTti);
8400 RGSCH_UPDATE_DELTA(schInst, cellInfo->schTickDelta);
8401 cell->schTickDelta = cellInfo->schTickDelta;
8404 cell->stopSiSch = cellInfo->dlBlankSf;
8405 cell->stopDlSch = cellInfo->dlBlankSf;
8406 cell->stopUlSch = cellInfo->ulBlankSf;
8407 if (cellInfo->isDummyTti)
8409 cell->stopDlSch = TRUE;
8411 if((0 == (cellInfo->timingInfo.sfn % 30)) && (0 == cellInfo->timingInfo.slot))
8413 //printf("5GTF_CHECK rgSCHTOMTtiInd (%d : %d)\n", cellInfo->timingInfo.sfn, cellInfo->timingInfo.slot);
8416 RGSCHCPYTIMEINFO(cellInfo->timingInfo, cell->crntTime);
8417 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->hiDci0Time,
8418 TFU_ULCNTRL_DLDELTA);
8419 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->dlDciTime,
8420 TFU_DLCNTRL_DLDELTA);
8421 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->rcpReqTime,
8422 TFU_RECPREQ_DLDELTA);
8423 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->hqRlsTime,
8424 TFU_HQFBKIND_ULDELTA);
8425 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->dlSfRlsTime,
8428 RGSCHCPYTIMEINFO_EMTC(cellInfo->timingInfo, cell->crntTime);
8429 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->hiDci0Time,
8430 TFU_ULCNTRL_DLDELTA);
8431 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->dlDciTime,
8432 TFU_DLCNTRL_DLDELTA);
8433 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->rcpReqTime,
8434 TFU_RECPREQ_DLDELTA);
8435 RGSCHDECRFRMCRNTTIME_EMTC(cell->crntTime, cell->hqRlsTime,
8436 TFU_HQFBKIND_ULDELTA);
8437 RGSCHDECRFRMCRNTTIME_EMTC(cell->crntTime, cell->dlSfRlsTime,
8440 rgSCHCmnUpdVars(cell);
8441 cell->isDlDataAllwd = TRUE;
8442 /* Get DownLink SubFrame */
8443 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
8444 frm = cell->crntTime;
8446 RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA);
8448 RGSCH_INCR_SUB_FRAME_EMTC(frm, RG_SCH_CMN_DL_DELTA);
8450 cellSch->dl.time = frm;
8456 U8 idx = (cell->crntTime.slot + RG_SCH_CMN_DL_DELTA) %
8457 RGSCH_NUM_SUB_FRAMES_5G;
8459 cell->isDlDataAllwd = RG_SCH_CMN_CHK_DL_DATA_ALLOWED(cell, idx);
8461 /*ccpu00130639 -ADD - used in UL HARQ proc id calculation*/
8462 if((cell->crntTime.sfn == 0) && (cell->crntTime.slot == 0))
8464 /* sfn Cycle used for Tdd UL Harq Proc Determination.
8465 This sfn Cycle will have values from 0 to numUl Harq-1. */
8466 cell->tddHqSfnCycle = (cell->tddHqSfnCycle + 1 ) %
8467 (rgSchTddUlNumHarqProcTbl[cell->ulDlCfgIdx]);
8471 if(cell->emtcEnable)
8473 rgSCHUtlEmtcResPrcTti(cell);
8479 void schFillCrntTime(
8480 SlotIndInfo slotInd,
8484 for(cellCount = 0; cellCount < CM_LTE_MAX_CELLS; cellCount++)
8487 cell = rgSchCb[schInst].cells[cellCount];
8489 RGSCHCPYTIMEINFO(slotInd, cell->crntTime);
8491 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->hiDci0Time,
8492 TFU_ULCNTRL_DLDELTA);
8493 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->dlDciTime,
8494 TFU_DLCNTRL_DLDELTA);
8495 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->rcpReqTime,
8496 TFU_RECPREQ_DLDELTA);
8497 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->hqRlsTime,
8498 TFU_HQFBKIND_ULDELTA);
8499 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->dlSfRlsTime,
8502 RGSCH_INCR_SUB_FRAME(cell->crntTime, RG_SCH_CMN_DL_DELTA);
8504 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
8505 cellSch->dl.time = cell->crntTime;
8509 /** @brief This function prepares the TTI for scheduling and
8510 * invokes the Common channel scheduler. Uplink scheduler
8511 * is invoked first if UL Scheduling at CRC is not enabled
8515 * Function: rgSchTomTtiUlAndDlCmnChSch
8517 * @param [out] RgSchCellCb *cell
8523 PRIVATE Void rgSchTomTtiUlAndDlCmnChSch
8528 PRIVATE Void rgSchTomTtiUlAndDlCmnChSch (cell)
8533 TRC2(rgSchTomTtiUlAndDlCmnChSch);
8535 cell->rlsHqArr[cell->crntHqIdx].numUes = 0;
8537 cell->crntHqIdx = cell->crntHqIdx % RGSCH_NUM_SUB_FRAMES;
8539 cmPrcTmr(&cell->tqCp, cell->tq, (PFV)rgSCHTmrProcTmr);
8540 rgSCHMeasGapANRepTtiHndl (cell);
8541 /* We need to fill the PHICH for the UL Data, first we need to get the UL
8542 * SF from Scheduler, next we fill the dlSf that goes out this TTI.
8543 * This must be performed prior to any other processing of the TTI
8544 * so that we do not wrap around and generate feedback prior to
8545 * reception of UL data.
8547 #ifndef RG_ULSCHED_AT_CRC
8550 U8 idx; /* Index into Uplink Sf array */
8552 Mval = rgSchTddPhichMValTbl[cell->ulDlCfgIdx]
8553 [cell->hiDci0Time.subframe];
8557 for(idx=0; idx < Mval; idx++)
8559 rgSCHCmnRlsUlSf(cell, idx);
8565 /* DTX processing for those Harq's which did not get feedback from L1 */
8566 rgSCHDhmRlsDlsfHqProc (cell, cell->hqRlsTime);
8567 /* Re-Init the Downlink subframe */
8568 rgSCHUtlDlRlsSubFrm(cell, cell->dlSfRlsTime);
8569 /* Added handling to retransmit
8570 * release PDCCH in case of DTX
8573 /*Check for DRX every TTI*/
8574 rgSCHDrxTtiInd(cell);
8576 /* For TDD, UL scheduling should happen after DL scheduling */
8578 #ifndef RG_ULSCHED_AT_CRC
8579 /* Perform UL scheduling */
8580 rgSCHCmnUlSch(cell);
8583 /* Perform DL scheduling for Common channels */
8584 rgSCHCmnDlCommonChSch(cell);
8589 /** @brief This function invokes the Non critical procedures like measurements,
8590 * and RGR configurations.
8594 * Function: rgSchTomTtiMiscFunctions
8596 * @param [in] RgSchCellCb *cell
8602 PRIVATE Void rgSchTomTtiMiscFunctions
8607 PRIVATE Void rgSchTomTtiMiscFunctions (cell)
8611 U8 suId = cell->tfuSap->sapCfg.suId;
8613 TRC2(rgSchTomTtiMiscFunctions);
8615 /* Invoke RAM Tti Handler */
8616 rgSCHRamTtiHndlr(cell);
8618 /* Handle RGR configurations */
8619 rgSCHGomTtiHndlr(cell, suId);
8621 if((RGM_PRB_REPORT_START == cell->prbUsage.prbRprtEnabld)
8622 && (!(cell->prbUsage.rprtPeriod) || ((glblTtiCnt % cell->prbUsage.rprtPeriod) == 0)))
8624 rgSCHUtlUpdAvgPrbUsage(cell);
8626 rgSCHL2Meas(cell,FALSE);
8629 /* LTE_ADV_FLAG_REMOVED_START */
8630 /* Report ABS Load information to application periodically */
8631 if((RGR_ENABLE == cell->lteAdvCb.absCfg.status) &&
8632 (cell->lteAdvCb.absCfg.absLoadPeriodicity))
8634 RgrLoadInfIndInfo *rgrLoadInf;
8637 cell->lteAdvCb.absLoadTtiCnt++;
8638 if(cell->lteAdvCb.absLoadTtiCnt >= cell->lteAdvCb.absCfg.absLoadPeriodicity)
8641 if(rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&rgrLoadInf,
8642 sizeof(RgrLoadInfIndInfo)) != ROK)
8644 RGSCHDBGERRNEW(cell->instIdx,(rgSchPBuf(cell->instIdx),"Could not "
8645 "allocate memory for sending LoadInfo\n"));
8648 cell->lteAdvCb.absLoadTtiCnt = 0;
8649 rgrLoadInf->cellId = cell->cellId;
8650 rgrLoadInf->bw = cell->bwCfg.dlTotalBw;
8651 rgrLoadInf->type = RGR_ABS;
8652 for(idx= 0; idx<RGR_ABS_PATTERN_LEN; idx++)
8654 rgrLoadInf->u.absLoadInfo[idx] = cell->lteAdvCb.absLoadInfo[idx];
8655 cell->lteAdvCb.absLoadInfo[idx] = 0;
8657 rgSCHUtlRgrLoadInfInd(cell, rgrLoadInf);
8662 if(cell->isDlDataAllwd)
8664 /* Calling function to update CFI parameters*/
8665 rgSchCmnUpdCfiDb(cell, RG_SCH_CMN_DL_DELTA);
8669 /* Incrementing the ttiCnt in case of UL subframe */
8670 if(!cell->dynCfiCb.switchOvrInProgress)
8672 cell->dynCfiCb.ttiCnt++;
8676 rgSchCmnUpdCfiDb(cell, RG_SCH_CMN_DL_DELTA);
8679 /* LTE_ADV_FLAG_REMOVED_END */
8684 /** @brief This function invokes the Downlink scheduler
8688 * Function: rgSchTomTtiDlSch
8690 * @param [in] RgSchCellCb *cell
8696 PRIVATE Void rgSchTomTtiDlSch
8701 PRIVATE Void rgSchTomTtiDlSch (cell)
8705 TRC2(rgSchTomTtiDlSch);
8707 if (cell->isDlDataAllwd && (cell->stopDlSch == FALSE))
8709 rgSCHCmnDlSch(cell);
8715 /** @brief This function invokes Consolidates the allocations
8716 * send the Subframe allocation info to MAC
8720 * Function: rgSchTomTtiCnsldtSfAlloc
8722 * @param [in] RgSchCellCb *cell
8728 PRIVATE Void rgSchTomTtiCnsldtSfAlloc
8733 PRIVATE Void rgSchTomTtiCnsldtSfAlloc (cell)
8738 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
8740 dlSf = rgSCHUtlSubFrmGet(cell, cellSch->dl.time);
8742 TRC2(rgSchTomTtiCnsldtSfAlloc);
8744 /* Prepare Subframe allocation info and send to MAC */
8745 rgSCHCmnCnsldtSfAlloc(cell);
8747 /* Call ACK NACK module to add to dlsf Queue */
8748 rgSCHAckNakRepAddToQ(cell, dlSf);
8750 rgSCHTomUtlProcTA(cell);
8755 /** @brief This function prepares the DL and UL Config requests
8760 * Function: rgSchTomTtiL1DlAndUlCfg
8762 * @param [in] RgSchCellCb *cell
8768 PRIVATE Void rgSchTomTtiL1DlAndUlCfg
8771 RgTfuCntrlReqInfo *cntrlInfo
8774 PRIVATE Void rgSchTomTtiL1DlAndUlCfg (cell, cntrlInfo)
8776 RgTfuCntrlReqInfo *cntrlInfo;
8779 RgSchDlSf *dlSf = rgSCHUtlSubFrmGet (cell, cell->dlDciTime);
8780 RgSchDlSf *ulSf = rgSCHUtlSubFrmGet (cell, cell->hiDci0Time);
8783 TRC2(rgSchTomTtiL1DlAndUlCfg);
8785 rgSCHTomUtlProcDlSf (dlSf, ulSf, cell, cntrlInfo, &err);
8786 /* Mark this frame as sent */
8787 dlSf->txDone = TRUE;
8789 rgBwAlloInfo[dlSf->sfNum] += dlSf->bwAssigned;
8790 rgBwAlcnt[dlSf->sfNum] ++;
8794 rgSCHTomUtlProcTddUlSf(cell);
8796 rgSCHTomUtlProcUlSf (cell, &err);
8802 /** @brief This function prepares does the Downlink subframe re-init and
8803 * Harq DTX processing
8807 * Function: rgSchTomUtlTddRlsSfAndHarq
8809 * @param [in] RgSchCellCb *cell
8815 PRIVATE Void rgSchTomUtlTddRlsSfAndHarq
8820 PRIVATE Void rgSchTomUtlTddRlsSfAndHarq (cell)
8824 TRC2(rgSchTomUtlTddRlsSfAndHarq);
8826 /* ccpu00132341-MOD- rgSchTddRlsDlSubfrmTbl is dependent on DELTA(=2).
8827 * Instead rgSchTddDlAscSetIdxKTbl can be used as the K set gives proper
8829 /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper
8830 * output if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME()
8831 * as it is serving the purpose */
8832 if(rgSchTddDlAscSetIdxKTbl[cell->ulDlCfgIdx][cell->hqRlsTime.subframe].
8835 /* ccpu00132341-MOD- Providing the UL SF timing for avoiding
8836 * calculation inside the function */
8837 rgSCHDhmTddRlsSubFrm(cell, cell->hqRlsTime);
8838 rgSCHDhmRlsDlsfHqProc(cell, cell->hqRlsTime);
8843 /** @brief This function processes the UL subframe and fills TFU reception
8848 * Function: rgSCHTomUtlProcTddUlSf
8850 * @param [in] RgSchCellCb *cell
8856 PRIVATE Void rgSCHTomUtlProcTddUlSf
8861 PRIVATE Void rgSCHTomUtlProcTddUlSf (cell)
8867 TRC2(rgSCHTomUtlProcTddUlSf);
8869 if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
8870 [cell->rcpReqTime.subframe] == RG_SCH_TDD_UL_SUBFRAME)
8872 if (rgSCHTomUtlProcUlSf (cell, &err) != ROK)
8874 /* fill in err type and call sta ind */
8875 RGSCHDBGERRNEW(cell->instIdx, (rgSchPBuf(cell->instIdx),
8876 "Unable to process Uplink subframe for cellId (%d))\n",
8880 /* TDD Fix , to allow Special SF SRS CFg */
8881 else if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
8882 [cell->rcpReqTime.subframe] == RG_SCH_TDD_SPL_SUBFRAME)
8884 if (rgSCHTomUtlPrcUlTddSpclSf(cell, &err) != ROK)
8886 /* fill in err type and call sta ind */
8887 RGSCHDBGERRNEW(cell->instIdx, (rgSchPBuf(cell->instIdx),
8888 "Unable to process Sipceial subframe for cellId (%d))\n",
8898 /**********************************************************************
8901 **********************************************************************/