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.
36 /* header include files -- defines (.h) */
37 #include "common_def.h"
38 #include "tfu.h" /* RGU defines */
39 #include "lrg.h" /* layer management defines for LTE-MAC */
40 #include "rgr.h" /* layer management defines for LTE-MAC */
41 #include "rgm.h" /* layer management defines for LTE-MAC */
42 #include "rg_env.h" /* defines and macros for MAC */
43 #include "rg_sch_err.h" /* defines and macros for MAC */
44 #include "rg_sch_inf.h" /* defines and macros for MAC */
45 #include "rg_sch.h" /* defines and macros for MAC */
46 #include "rg_sch_cmn.h" /* typedefs for MAC */
49 /* header/extern include files (.x) */
50 #include "tfu.x" /* RGU types */
51 #include "lrg.x" /* layer management typedefs for MAC */
52 #include "rgr.x" /* layer management typedefs for MAC */
53 #include "rgm.x" /* layer management typedefs for MAC */
54 #include "rg_sch_inf.x" /* typedefs for Scheduler */
55 #include "rg_sch.x" /* typedefs for MAC */
56 #include "rg_sch_cmn.x" /* typedefs for MAC */
58 #include "rg_sch_emtc_ext.x"
60 uint8_t rgSCHCmnCalcPcqiBitSz(RgSchUeCb *ueCb,uint8_t numTxAnt);
61 S16 rgSCHDhm5gtfHqFdbkInd(RgSchUeCb *ue,RgSchCellCb *cell,CmLteTimingInfo timingInfo,TfuHqFdbk fdbk,RgSchErrInfo *err);
64 Bool rgSCHEmtcChkEmtcUe ARGS(
69 Void rgSchTomTtiEmtcSched ARGS(
74 S16 rgSCHEmtcRamVldtProcRaReq
79 TfuRaReqIndInfo *raReqInd,
84 Void rgSCHEmtcUpdCqiInfo
90 Void rgSCHEmtcUpdSRInfo
95 Void rgSCHCmnEmtcHdlCrcFailInd
100 S16 rgSCHEmtcTomUtlProcAtCrc
103 CmLteTimingInfo crntHiDci0Frm,
104 TfuCntrlReqInfo *cntrlInfo,
107 Void rgSCHEmtcInitUeRecpReqLst
109 TfuRecpReqInfo *recpReqInfo
111 Void rgSCHEmtcFillPucchRecpInfo
114 RgSchDlHqProcCb *hqCb,
117 Bool rgSCHEmtcAddRecpInfoToLst
119 RgSchDlHqProcCb *hqCb,
120 TfuRecpReqInfo *recpReqInfo,
121 TfuUeRecpReqInfo *pucchRecpInfo,
124 Void rgSCHEmtcWillUeRptCqi
129 Void rgSchEmtcTomTtiCnsldtSfAlloc
134 S16 rgSchEmtcTomTtiL1DlAndUlCfg
137 RgTfuCntrlReqInfo *cntrlInfo
140 S16 rgSCHTomEmtcUtlFillDatRecpReq
142 TfuRecpReqInfo *recpReqInfo,
148 S16 rgSCHEmtcTomUtlFillHqFdbkRecpReq
150 TfuRecpReqInfo *recpReqInfo,
156 S16 rgSCHEmtcDhmRlsDlsfHqProc
159 CmLteTimingInfo timingInfo
162 Void rgSCHEmtcCmnUlSch
167 #ifdef RG_ULSCHED_AT_CRC
168 S16 rgSCHEmtcTomUtlProcDlSfAtCrc
171 CmLteTimingInfo crntUlFrm,
173 TfuCntrlReqInfo *cntrlInfo,
177 RgSchEmtcDlSf* rgSCHEmtcUtlSubFrmGet
184 uint32_t gDlMpdcchBlank;
185 uint32_t gUlMpdcchBlank;
186 S16 rgSCHUtlIotResPrcTti
193 RgSchUeCb* rgSCHCmnGetHoUe
198 RgSchUeCb* rgSCHCmnGetPoUe
202 CmLteTimingInfo timingInfo
204 S16 rgSCHTomUtlFillDatAperRecpReq ARGS(
209 TfuUeRecpReqInfo *datRecpInfo,
210 CmLteTimingInfo *timeInfo,
215 S16 rgSCHTomUtlFillDatPriRecpReq ARGS(
219 TfuUeRecpReqInfo *datRecpInfo,
220 CmLteTimingInfo *timeInfo,
225 S16 rgSCHTomUtlFillDatPCqiRecpReq ARGS(
229 TfuUeRecpReqInfo *datRecpInfo,
230 CmLteTimingInfo *timeInfo,
235 S16 rgSCHTomUtlFillDatSrsRecpReq ARGS(
239 TfuUeRecpReqInfo *datRecpInfo,
240 CmLteTimingInfo *timeInfo,
244 void schFillCrntTime( SlotTimingInfo slotInd,Inst schInst);
247 uint32_t delayedApiCnt;
248 uint32_t gPCellTb1AckCount=0,gPCellTb2AckCount=0,gPCellTb1NackCount=0,gPCellTb2NackCount=0;
249 uint32_t gSCellSchedCount=0,gPrimarySchedCount=0;
250 uint32_t gSCellTb1AckCount=0,gSCellTb2AckCount=0,gSCellTb1NackCount=0,gSCellTb2NackCount=0;
251 uint32_t gPCellTb1DtxCount = 0, gPCellTb2DtxCount = 0, gSCellTb1DtxCount = 0, gSCellTb2DtxCount = 0;
252 uint32_t gHqFdbkCount = 0;
256 uint32_t gCqiRecpCount = 0;
257 uint32_t gCqiRecpPuschCount = 0;
258 uint32_t gCqiRcvdCount = 0;
259 Bool gF1bCsPres = FALSE;
260 uint32_t gRiReqCount = 0;
261 uint32_t gCqiReqCount = 0;
262 uint32_t gF1bCsCount = 0;
263 uint32_t gACqiRcvdCount = 0;
264 uint32_t gCqiReptToAppCount = 0;
265 uint32_t gRawACqiCount= 0;
266 uint32_t gCqiDropCount,gPucchDropCount;
267 uint32_t gCqiPucchLowSnrDropCount,gCqiPucchConfMaskDropCount,gCqiPuschConfMaskDropCount;
268 uint32_t gDci0Count = 0;
269 uint32_t gUlCrcFailCount = 0;
270 uint32_t gUlCrcPassCount = 0;
271 uint32_t gPuschCqiDropCount = 0;
272 uint32_t gCaDbgCaFrmt = 0;
273 uint32_t gCaDbgNonCaFrmt = 0;
274 uint32_t gPcellZeroBoOcc=0,gScellZeroBoOcc=0, dbgDelayedDatReqInMac=0,gDropDatReqCnt=0, gIccPktRcvrMemDropCnt=0;
278 uint32_t gUlCrcFailCounter = 0;
279 uint32_t gUlCrcPassCounter = 0;
283 uint32_t gUl5gtfPdcchSend;
288 static S16 rgSCHTomUtlFillCqiSrsWithSr ARGS
292 TfuRecpReqInfo *recpReqInfo,
293 TfuUeRecpReqInfo *pucchRecpInfo,
296 static Bool rgSCHTomUtlFillDatHarqRecpReq ARGS
300 TfuUeRecpReqInfo *datRecpInfo,
301 TfuRecpReqInfo *recpReqInfo
303 static S16 rgSCHTomUtlFillSrRecpReq ARGS((
304 TfuRecpReqInfo *recpReq,
308 static S16 rgSCHTomUtlFillRiRecpReq ARGS((
309 TfuRecpReqInfo *recpReq,
313 static S16 rgSCHTomUtlFillPcqiRecpReq ARGS((
314 TfuRecpReqInfo *recpReq,
318 static S16 rgSCHTomUtlFillSrsRecpReq ARGS((
319 TfuRecpReqInfo *recpReq,
323 static S16 rgSCHTomUtlGenIndices ARGS((
328 TfuSubbandInfo* sbInfo));
330 static S16 rgSCHTomUtlFillCqiRiRecpReq ARGS(
332 TfuRecpReqInfo *recpReqInfo,
337 static Void rgSchTomFillCellTtiInfo ARGS
339 TfuTtiIndInfo *ttiInd,
347 uint32_t rgBwAlloInfo[RGSCH_NUM_SUB_FRAMES]; /* Num of Rbs Allocated in each SF */
348 uint32_t rgBwAlcnt[RGSCH_NUM_SUB_FRAMES]; /*Num of times Allocation done in each Subframe */
351 /* rg006.201: [ccpu000111706, ccpu00112394]: Separated UL and DL TTI
354 uint64_t glblTtiCnt = 0;
358 uint32_t gDlNumUePerTti[20] = {0};
359 uint32_t gUlNumUePerTti[20] = {0};
360 static S16 rgSCHTomUtlProcDlSf ARGS((
364 RgTfuCntrlReqInfo *cntrlInfo,
366 #ifdef RG_ULSCHED_AT_CRC
367 static S16 rgSCHTomUtlProcDlSfAtCrc ARGS((
369 CmLteTimingInfo crntUlFrm,
371 TfuCntrlReqInfo *cntrlInfo,
373 #endif /* RG_ULSCHED_AT_CRC */
376 static S16 rgSCHTomUtlPrcUlTddSpclSf ARGS((
379 #endif /* TFU_UPGRADE */
381 static S16 rgSCHTomUtlFillPhich ARGS((
383 TfuCntrlReqInfo *cntrlInfo,
387 static S16 rgSCHTomUtlFillDlPdcch ARGS((
389 TfuCntrlReqInfo *cntrlInfo,
392 static S16 rgSCHTomUtlFillUlPdcch ARGS((
394 TfuCntrlReqInfo *cntrlInfo,
398 static S16 rgSCHTomUtlProcTA ARGS((
401 static S16 rgSCHTomUtlFillHqFdbkRecpReq ARGS((
402 TfuRecpReqInfo *recpReq,
407 static S16 rgSCHTomUtlFillHqFdbkRecpReq ARGS((
408 TfuRecpReqInfo *recpReq,
414 S16 rgSCHTomFillOnlySrsRecpReq ARGS
418 TfuUeRecpReqInfo *datRecpInfo
420 static S16 rgSCHTomUtlFillCqiSrSrsWithHq ARGS
423 TfuRecpReqInfo *recpReqInfo,
425 TfuUeRecpReqInfo *pucchRecpInfo,
427 Bool isDatPresOnSecCell
430 S16 rgSCHTomUtlFillRiBitWidthInfo ARGS
435 uint8_t rgSCHTomUtlFetchPcqiBitSz ARGS
442 uint8_t rgSCHTomUtlFetchPcqiBitSzPucchMode21 ARGS
445 TfuCqiPucchMode21 *mode21Info,
450 S16 rgSCHTomUtlMoveNxtOccasion ARGS
457 static S16 rgSCHTomUtlMovePcqiNxtOccasion ARGS
464 static S16 rgSCHTomUtlMovePriNxtOccasion ARGS
471 static S16 rgSCHTomUtlMoveSrNxtOccasion ARGS
477 static S16 rgSCHTomUtlMoveSrsNxtOccasion ARGS
482 static S16 rgSCHTomUtlWillUeRprtCqiRi ARGS((
484 Bool *willueRprtCqiRii));
487 static S16 rgSCHTomUtlFillDatRecpReq ARGS((
488 TfuRecpReqInfo *recpReq,
493 static S16 rgSCHTomUtlFillDatRecpReq ARGS((
494 TfuRecpReqInfo *recpReq,
501 static S16 rgSCHTomUtlFillSfRepHqFdbk ARGS((
502 TfuRecpReqInfo *recpReqInfo,
513 static S16 rgSCHTomUtlFillSfRepHqFdbk ARGS((
514 TfuRecpReqInfo *recpReqInfo,
525 static S16 rgSCHTomUtlFillSfHqFdbk ARGS((
526 TfuRecpReqInfo *recpReqInfo,
537 static S16 rgSCHTomUtlFillSfHqFdbk ARGS((
538 TfuRecpReqInfo *recpReqInfo,
549 static S16 rgSCHTomUtlFillSfHqFdbkForOneUe ARGS((
550 RgSchDlHqProcCb *hqCb,
551 TfuRecpReqInfo *recpReqInfo,
560 RgrTddAckNackMode ackNackMode,
561 RgSchUePucchRecpInfo **pucchInfoRef,
563 TknUInt16 n1PucchTkn,
569 Void rgSCHCmnDlSpsSch (RgSchCellCb *cell);
573 static S16 rgSCHTomCnsdrRelPdcch ARGS
577 TfuRecpReqInfo *recpReqInfo,
582 static S16 rgSCHTomCnsdrRelPdcch ARGS
586 TfuRecpReqInfo *recpReqInfo,
594 static Void rgSchTomTtiMiscFunctions ARGS
599 static Void rgSchTomTtiUlAndDlCmnChSch ARGS
604 static Void rgSchTomTtiDlSch ARGS
609 static Void rgSchTomTtiCnsldtSfAlloc ARGS
614 static Void rgSchTomTtiL1DlAndUlCfg ARGS
617 RgTfuCntrlReqInfo *cntrlInfo
621 static Void rgSCHTomUtlSendSfnTick ARGS
627 static Void rgSchTomUtlTddRlsSfAndHarq ARGS
631 static Void rgSCHTomUtlProcTddUlSf ARGS
636 static Void rgSCHTomUtlGethqRes ARGS
644 static Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1 ARGS
646 RgSchDlHqProcCb *hqCb,
647 TfuUePucchRecpReq *hqRecpReq,
653 static Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234 ARGS
655 RgSchDlHqProcCb *hqCb,
656 TfuUePucchRecpReq *hqRecpReq,
666 uint32_t rgDlCqiRptCnt[16], rgTotDlCqiRpt;
669 uint32_t rgSch5gtfCqi2Mcs[15] =
670 {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14};
672 /* forward references */
674 /*HARQ Feedback interpretation in accordance with Femto Forum.
675 Note: There is no value as '0' in Femto Forum Spec but in order to retain
676 the existing usage in MAC (and its Acceptance), its being considered*/
677 //const static uint8_t rgSchTomHqFbkMap[8] = {0,1,0,0,4,4,4,4};
678 /*added #defines instead of magic numbers*/
679 /*const static uint32_t rgSCHTomBinCoe[RG_SCH_MAX_NUM_UE_SEL_SUBBANDS][RG_SCH_MAX_TOT_NUM_SUBBANDS]={
680 {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},
681 {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},
682 {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},
683 {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},
684 {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},
685 {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}
689 /*ccpu00116923 - ADD - SRS present support*/
690 /*Tables Derived from 3GPP TS 36.211 Section 5.5.3.3 */
691 /* Table 5.5.3.3-1 */
693 const RgSchFddCellSpSrsSubfrmTbl rgSchFddCellSpSrsSubfrmTbl = {
694 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE},
695 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE},
696 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE},
697 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE},
698 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
699 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE},
700 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE},
701 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE},
702 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE},
703 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
704 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
705 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
706 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
707 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE},
708 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE},
709 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}
712 /* Table 5.5.3.3-2 */
713 const RgSchTddCellSpSrsSubfrmTbl rgSchTddCellSpSrsSubfrmTbl = {
714 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
715 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE},
716 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE},
717 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE},
718 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE},
719 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE},
720 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE},
721 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE},
722 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
723 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
724 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE},
725 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE},
726 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE},
727 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE},
728 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
729 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}
732 S8 rgSchCmnAper20n22DiffCqi[4] = {1, 2, 3, 4};
733 S8 rgSchCmnAper30n31DiffCqi[4] = {0, 1, 2, -1};
737 * @brief get Ue for dedicated preamble rach
741 * Function: rgSCHGetDedPrmUe
743 * Invoked by: rgSCHTomRaReqInd
745 * @param[in] RgSchCellCb *cell
746 * @param[in] TfuRaReqIndInfo *raReqInd
755 CmLteTimingInfo timingInfo,
759 RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch);
761 DU_LOG("\nINFO --> SCH : rapId[%d] cellSch->rachCfg.dedPrmStart[%d] cellSch->rachCfg.numDedPrm[%d]\n",\
762 rapId,cellSch->rachCfg.dedPrmStart,cellSch->rachCfg.numDedPrm);
763 /* Finding UE in handOver List */
764 if ((rapId < cellSch->rachCfg.dedPrmStart) ||
765 (rapId > cellSch->rachCfg.dedPrmStart +
766 cellSch->rachCfg.numDedPrm - 1))
768 /* This ded Preamble corresponds to handover */
769 *ue = rgSCHCmnGetHoUe(cell, rapId);
770 DU_LOG("\nDEBUG --> SCH : ded Preamble corresponds to handover\n");
772 else/* Finding UE from PDCCH Order Mappings */
774 /* Get the UE which has transmitted this RaReq */
775 *ue = rgSCHCmnGetPoUe(cell, rapId, timingInfo);
776 DU_LOG("\nDEBUG --> SCH : UE from PDCCH Order Mapping\n");
781 * @brief Handler for processing Random Access request indication
786 * Function: rgSCHTomRaReqInd
788 * Handler for processing Random Access request indication recieved from
791 * Invoked by: RgLiTfuRaReqInd of LIM
794 * - Validate the information received: cellId value and raRnti values
795 * - Process the request: Call rgSCHRamProcRaReq (cell, raRnti, raReqInd)
797 * @param[in] RgSchCellCb *cell
798 * @param[in] TfuRaReqIndInfo *raReqInd
806 TfuRaReqIndInfo *raReqInd
813 Bool isEmtcUe = FALSE;
815 RgSchUeCb *ue = NULLP;
817 if(cell->cellId != raReqInd->cellId)
819 err.errType = RGSCHERR_TOM_RAREQIND;
820 err.errCause = RGSCHERR_TOM_INV_CELL_ID;
821 DU_LOG("\nERROR --> SCH : rgSCHTomRaReqInd(): No cell found with raReq cellId = (%d) errorType (%d)"
822 " errorCause(%d)",raReqInd->cellId, err.errType, err.errCause);
826 for (raRntiCnt = 0; raRntiCnt < raReqInd->nmbOfRaRnti; raRntiCnt++)
828 for (raReqCnt = 0; raReqCnt < raReqInd->rachInfoArr->numRaReqInfo; raReqCnt++)
830 rapId = raReqInd->rachInfoArr[raRntiCnt].raReqInfoArr[raReqCnt].rapId;
832 if(RGSCH_IS_DEDPRM(cell, rapId))
834 rgSCHGetDedPrmUe(cell, rapId, raReqInd->timingInfo, &ue);
837 /* Since rapId is within dedicated range and No ue context
838 * is found means it is a spurious rach. So ignore it.*/
843 if(FALSE == isEmtcUe)
845 #if (ERRCLASS & ERRCLS_DEBUG)
846 if(raReqInd->rachInfoArr[raRntiCnt].raRnti > RGSCH_MAX_RA_RNTI)
848 DU_LOG("\nERROR --> SCH : rgSCHTomRaReqInd(): raRnti is out of range\n");
852 ret = rgSCHRamProcRaReq(raReqCnt, cell, raReqInd->rachInfoArr[raRntiCnt].raRnti,
853 (TfuRachInfo *)&raReqInd->rachInfoArr[raRntiCnt],
854 raReqInd->timingInfo, ue, &err);
857 err.errType = RGSCHERR_TOM_RAREQIND;
858 DU_LOG("\nERROR --> SCH : RARNTI:%d rgSCHTomRaReqInd(): RAM processing failed errType(%d) "
859 "errCause(%d)", raReqInd->rachInfoArr[raRntiCnt].raRnti,
860 err.errType, err.errCause);
867 } /* rgSCHTomRaReqInd */
871 * @brief Handler for processing uplink CQI indication recieved from PHY.
875 * Function: rgSCHTomUlCqiInd
877 * Handler for processing uplink CQI indication recieved from PHY.
879 * Invoked by: RgLiTfuUlCqiInd
883 * - Invoke scheduler to push reported CQI info rgSCHUtlUlCqiInd
885 * @param[in] RgSchCellCb *cell
886 * @param[in] TfuUlCqiIndInfo *ulCqiInd
894 TfuUlCqiIndInfo *ulCqiInd
899 TfuUlCqiRpt *ulCqiInfo;
901 node = ulCqiInd->ulCqiRpt.first;
902 if(cell->cellId != ulCqiInd->cellId)
904 DU_LOG("\nERROR --> SCH : rgSCHTomUlCqiInd() Unable to get the ulCqiInd cell with id(%d)",
909 for (;node; node=node->next)
911 ulCqiInfo = (TfuUlCqiRpt *)node->node;
912 #if (ERRCLASS & ERRCLS_DEBUG)
913 if(ulCqiInfo->numSubband == 0)
915 DU_LOG("\nERROR --> SCH : Num Subband is"
916 "out of range RNTI:%d",ulCqiInfo->rnti);
920 if((ue = rgSCHDbmGetUeCb(cell, ulCqiInfo->rnti)) == NULLP)
923 if((ue = rgSCHDbmGetSpsUeCb(cell, ulCqiInfo->rnti)) == NULLP)
926 DU_LOG("\nERROR --> SCH : Unable to get the ue for RNTI:%d", ulCqiInfo->rnti);
930 /* wideband cqi is directly reported now. and also isTxPort0 */
931 rgSCHUtlUlCqiInd(cell, ue, ulCqiInfo);
934 } /* rgSCHTomUlCqiInd */
937 * @brief Handler for processing PUCCH power adjustment indication
941 * Function: rgSCHTomPucchDeltaPwrInd
943 * Handler for processing PUCCH power adjustment indication
946 * Invoked by: RgLiTfuPucchDeltaPwrInd
950 * - Invoke scheduler to push reported CQI info rgSCHUtlPucchDeltaPwrInd
952 * @param[in] RgSchCellCb *cell
953 * @param[in] TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
958 S16 rgSCHTomPucchDeltaPwrInd
961 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
966 TfuPucchDeltaPwr *ueElem;
968 if(cell->cellId != pucchDeltaPwr->cellId)
970 DU_LOG("\nERROR --> SCH : rgSCHTomPucchDeltaPwrInd() Unable to get the pucchDeltaPwr cell with id(%d)",
971 pucchDeltaPwr->cellId);
975 node = pucchDeltaPwr->pucchDeltaPwrLst.first;
976 for (;node; node=node->next)
978 ueElem = (TfuPucchDeltaPwr *)node->node;
979 if((ue = rgSCHDbmGetUeCb(cell, ueElem->rnti)) == NULLP)
982 if((ue = rgSCHDbmGetSpsUeCb(cell, ueElem->rnti)) == NULLP)
985 DU_LOG("\nERROR --> SCH : RNTI:%d "
986 "rgSCHTomPucchDeltaPwrInd() Unable to get the ue ",
991 rgSCHUtlPucchDeltaPwrInd(cell, ue, ueElem->pucchDeltaPwr);
994 } /* rgSCHTomPucchDeltaPwrInd */
997 * @brief Handler for processing harq ACK/NACK indication recieved from PHY.
1001 * Function: rgSCHTomHarqAckInd
1003 * Handler for processing harq ACK/NACK indication recieved from PHY.
1005 * Invoked by: RgLiTfuHqInd
1008 * For each HqAckInfo received
1010 * - If UE doesnt exist look for a RaCb and invoke rgSCHRamMsg4FdbkInd
1011 * - Invoke HARQ module to pass HARQ-ACK info rgSCHDhmHqFdbkInd
1013 * @param[in] TfuHqIndInfo *harqAckInd
1018 S16 rgSCHTomHarqAckInd
1021 TfuHqIndInfo *harqAckInd
1032 RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1034 RgSchCellCb *iterCellP;
1036 if(cell->cellId != harqAckInd->cellId)
1038 DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() Unable to get"
1039 " the cell for cellId (%d)", harqAckInd->cellId);
1040 err.errType = RGSCHERR_TOM_HARQACKIND;
1041 err.errCause = RGSCHERR_TOM_INV_CELL_ID;
1045 node = harqAckInd->hqIndLst.first;
1046 for (;node; node=node->next)
1048 hqInfo = (TfuHqInfo *)node->node;
1050 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1051 TfuHqFdbk fdbk = hqInfo->isAck[0];
1052 raCb = rgSCHDbmGetRaCb (cell, hqInfo->rnti);
1053 ue = rgSCHDbmGetUeCb (cell, hqInfo->rnti);
1054 if (ue != NULLP && raCb == NULLP)
1056 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, harqAckInd->timingInfo, fdbk, &err)) != ROK)
1058 err.errType = RGSCHERR_TOM_HARQACKIND;
1059 DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() "
1060 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1061 err.errType, err.errCause);
1069 if ((rgSCHDhmRlsDlsfHqProc (cell, harqAckInd->timingInfo)) != ROK)
1071 DU_LOG("\nERROR --> SCH : Unable to Release Downlink "
1072 "subframe for cellId (%d) ", cell->cellId);
1073 err.errType = RGSCHERR_TOM_HARQACKIND;
1076 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
1078 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
1080 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
1082 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
1083 if(rlsHqBufs->numUes)
1085 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
1086 RgSchMacRlsHq (&pst, rlsHqBufs);
1088 rlsHqBufs->numUes = 0;
1092 rlsHqBufs->numUes = 0;
1093 node = harqAckInd->hqIndLst.first;
1094 for (;node; node=node->next)
1096 hqInfo = (TfuHqInfo *)node->node;
1097 for(tbCnt=0; tbCnt<TFU_MAX_HARQ_FDBKS; tbCnt++)
1099 hqInfo->isAck[tbCnt]=(TfuHqFdbk)rgSchTomHqFbkMap[hqInfo->isAck[tbCnt]];
1101 raCb = rgSCHDbmGetRaCb (cell, hqInfo->rnti);
1102 ue = rgSCHDbmGetUeCb (cell, hqInfo->rnti);
1103 if (ue == NULLP && raCb != NULLP)
1106 rgSCHRamMsg4FdbkInd (raCb);
1108 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1109 cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
1111 err.errType = RGSCHERR_TOM_HARQACKIND;
1112 DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() HARQ"
1113 " feedback processing failed errType(%d) errCause(%d)",
1114 err.errType, err.errCause);
1119 else if (ue != NULLP && raCb == NULLP)
1121 /* Get the Downlink HARQ entity from ue */
1122 if ((rgSCHDhmHqFdbkInd (ue, RGSCH_HQ_FDB_IND_CB_TYPE_HQ_ENT,
1123 cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
1125 err.errType = RGSCHERR_TOM_HARQACKIND;
1126 DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() "
1127 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1128 err.errType, err.errCause);
1132 else if (ue != NULLP && raCb != NULLP)
1134 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1135 cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
1137 err.errType = RGSCHERR_TOM_HARQACKIND;
1138 DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() HARQ"
1139 " feedback processing failed errType(%d) errCause(%d).",
1140 err.errType, err.errCause);
1146 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to get the "
1147 "UE CB or RA CB ", hqInfo->rnti);
1148 err.errType = RGSCHERR_TOM_HARQACKIND;
1153 /* Check with TDD call DHM*/
1154 if ((rgSCHDhmRlsDlsfHqProc (cell, harqAckInd->timingInfo)) != ROK)
1156 DU_LOG("\nERROR --> SCH : Unable to Release Downlink "
1157 "subframe for cellId (%d) ", harqAckInd->cellId);
1158 err.errType = RGSCHERR_TOM_HARQACKIND;
1161 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
1163 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
1165 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
1167 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
1168 if(rlsHqBufs->numUes)
1170 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
1171 RgSchMacRlsHq (&pst, rlsHqBufs);
1173 rlsHqBufs->numUes = 0;
1178 } /* rgSCHTomHarqAckInd */
1182 * @brief Handler for processing Scheduling Request indication
1183 * recieved from PHY for a list of UEs.
1187 * Function: rgSCHTomSrInd
1189 * Handler for processing Scheduling Request indication recieved from PHY
1192 * Invoked by: RgLiTfuSrInd
1196 * - Invoke scheduler to indicate SR rgSCHUtlSrRcvd
1198 * @param[in] TfuSrIndInfo *srInd
1215 if(cell->cellId != srInd->cellId)
1217 DU_LOG("\nERROR --> SCH : Unable to get the cell for srcInd cellId"
1218 ":%d ", srInd->cellId);
1219 err.errType = RGSCHERR_TOM_SRIND;
1220 err.errCause = RGSCHERR_TOM_INV_CELL_ID;
1225 node = srInd->srLst.first;
1226 for (;node; node=node->next)
1230 srInfo = (TfuSrInfo *)node->node;
1231 ue = rgSCHDbmGetUeCb (cell, srInfo->rnti);
1234 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to get the UE CB",
1238 rgSCHUtlHdlUlTransInd(cell, ue, srInd->timingInfo);
1239 /*Need to activate UE as SR received*/
1240 if (ue->isDrxEnabled)
1242 rgSCHDrxSrInd(cell, ue);
1244 ret = rgSCHUtlSrRcvd (cell, ue, srInd->timingInfo, &err);
1247 err.errType = RGSCHERR_TOM_SRIND;
1248 DU_LOG("\nERROR --> SCH : Scheduler processing failed "
1249 "errType(%d) errCause(%d) RNTI:%d", err.errType, err.errCause,srInfo->rnti);
1254 } /* end of rgSCHTomSrInd */
1257 * @brief Handler for processing downlink CQI indication recieved from
1262 * Function: rgSCHTomDoaInd
1264 * Handler for processing DOA recieved from PHY
1267 * Invoked by: RgLiTfuDoaInd
1271 * - Invoke scheduler to indicate DOA rgSCHUtlDoaInd
1273 * @param[in] TfuDoaIndInfo *doaInd
1281 TfuDoaIndInfo *doaInd
1288 if(cell->cellId != doaInd->cellId)
1290 DU_LOG("\nERROR --> SCH : Unable to get the cell for doaInd cellId"
1291 ":%d", doaInd->cellId);
1296 node = doaInd->doaRpt.first;
1297 for (;node; node=node->next)
1299 doaInfo = (TfuDoaRpt *)node->node;
1300 ue = rgSCHDbmGetUeCb (cell, doaInfo->rnti);
1303 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to get the UE CB",
1307 rgSCHUtlDoaInd(cell, ue, doaInfo);
1310 } /* rgSCHTomDoaInd */
1312 * @brief Handler for processing downlink CQI indication recieved from
1317 * Function: rgSCHTomDlCqiInd
1319 * Handler for processing downlink CQI indication recieved from PHY
1322 * Invoked by: RgLiTfuDlCqiInd
1326 * - Invoke scheduler to indicate DL CQI rgSCHUtlDlCqiInd
1328 * @param[in] TfuDlCqiIndInfo *dlCqiInd
1333 S16 rgSCHTomDlCqiInd
1336 TfuDlCqiIndInfo *dlCqiInd
1341 TfuDlCqiRpt *dlCqiInfo;
1343 if(cell->cellId != dlCqiInd->cellId)
1345 DU_LOG("\nERROR --> SCH : Unable to get the cell for cellId"
1346 ":%d", dlCqiInd->cellId);
1351 node = dlCqiInd->dlCqiRptsLst.first;
1352 for (;node; node=node->next)
1354 dlCqiInfo = (TfuDlCqiRpt *)node->node;
1355 ue = rgSCHDbmGetUeCb (cell, dlCqiInfo->rnti);
1358 DU_LOG("\nERROR --> SCH : RNTI:%dUnable to get the UE CB",
1362 rgSCHUtlDlCqiInd(cell, ue, dlCqiInfo, dlCqiInd->timingInfo);
1363 rgSCHUtlHdlUlTransInd(cell, ue, dlCqiInd->timingInfo);
1366 } /* rgSCHTomDlCqiInd */
1369 * @brief Handler for moving PCQI instance for the next periodic occasion
1373 * Function: rgSCHTomUtlMovePcqiNxtOccasion
1375 * Handler for moving PCQI instance for the next periodic occasion
1377 * Invoked by: rgSCHTomUtlFill*
1380 * - For a UE move its occurence instance to next occasion
1381 * depending on its periodicity
1382 * - Remove it from the current list and insert it to the list
1383 * having the index matching with the derived number.
1385 * @param[in] RgSchCellCb *cell,
1386 * [in] RgSchUeCb *ue
1391 static S16 rgSCHTomUtlMovePcqiNxtOccasion
1395 RgSchUePCqiCb *cqiCb
1398 uint16_t cqiIdx = 0;
1400 CmLteTimingInfo timingInfo;
1402 if(cqiCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_SB_REP)
1405 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timingInfo, TFU_DELTA);
1407 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timingInfo,
1408 TFU_RECPREQ_DLDELTA);
1410 RG_SCH_ADD_TO_CRNT_TIME(timingInfo,timingInfo,cqiCb->cqiPeri);
1411 rgSCHTomUtlPcqiSbCalcBpIdx(timingInfo,ue,cqiCb);
1413 /* Compute Next Transmission Instance */
1414 cqiIdx = cqiCb->cqiPeri + cqiCb->nCqiTrIdx;
1415 cqiIdx = cqiIdx%RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1416 /* Delete from current List and move to new list */
1417 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst,
1420 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to remove node",
1423 cqiCb->nCqiTrIdx = cqiIdx;
1424 cmLListAdd2Tail(&(cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst),
1425 &(cqiCb->cqiLstEnt));
1427 rgSCHUtlSCellHndlCqiCollsn(cqiCb);
1431 } /* rgSCHTomUtlMovePcqiNxtOccasion */
1434 * @brief Handler for moving RI instance for the next periodic occasion
1438 * Function: rgSCHTomUtlMovePriNxtOccasion
1440 * Handler for moving PCQI instance for the next periodic occasion
1442 * Invoked by: rgSCHTomUtlFill*
1445 * - For a UE move its occurence instance to next occasion
1446 * depending on its periodicity
1447 * - Remove it from the current list and insert it to the list
1448 * having the index matching with the derived number.
1450 * @param[in] RgSchCellCb *cell,
1451 * [in] RgSchUeCb *ue
1456 static S16 rgSCHTomUtlMovePriNxtOccasion
1465 uint16_t effPeriodicity;
1466 uint16_t riTrInsTime;
1470 crntTime = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)
1471 +(cell->crntTime.slot);
1472 #ifdef XEON_SPECIFIC_CHANGES
1473 RGSCHCPYTIMEINFO(cell->crntTime, ue->riRecpTime);
1475 /* Compute Next Transmission Instance */
1476 if (riCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_WB_REP)
1478 effPeriodicity = riCb->cqiPeri * riCb->riPeri;
1479 tempIdx = effPeriodicity + riCb->nRiTrIdx;
1483 effPeriodicity = (riCb->h * riCb->cqiPeri * riCb->riPeri);
1484 /* In case of SFN wraparound, the SB CQI reporting cycle breaks
1485 * and RI->WB CQI->SBCQI.. should resume. RI is repositioned
1486 * accordingly. WBCQI handling is naturally accomplished */
1487 if ((crntTime + TFU_RECPREQ_DLDELTA + effPeriodicity) >
1488 (RGSCH_MAX_SUBFRM_5G - 1))
1490 riTrInsTime = (effPeriodicity - riCb->cqiOffset + riCb->riOffset) % effPeriodicity;
1491 tempIdx = RGSCH_MAX_SUBFRM_5G + (effPeriodicity - riTrInsTime);
1492 /* In case of SFN wraparound, riDist should be distance from crntTime
1493 * + TFU_RECPREQ_DLDELTA to tempIdx. Updating effPeriodicity
1494 * to make riDist calculation consistent for both SFN wraparound
1495 * case and normal case */
1496 effPeriodicity = tempIdx - TFU_RECPREQ_DLDELTA - crntTime;
1500 tempIdx = effPeriodicity + riCb->nRiTrIdx;
1503 riIdx = tempIdx % RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1504 if (effPeriodicity >= RG_SCH_PCQI_SRS_SR_TRINS_SIZE)
1506 riDist = rgSCHUtlFindDist((uint16_t)(crntTime + TFU_RECPREQ_DLDELTA),
1507 (uint16_t)(crntTime + TFU_RECPREQ_DLDELTA + effPeriodicity));
1514 /* ccpu00138306- If Periodicity is equal to Queue Size or multiple of it
1515 * then the next occasion idx will be same as current Idx, Hence need not
1518 if((effPeriodicity%RG_SCH_PCQI_SRS_SR_TRINS_SIZE) != 0)
1520 /* Delete from current List and move to new list */
1521 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[riCb->nRiTrIdx].riLst,
1524 DU_LOG("\nERROR --> SCH : [%d]UEID:Unable to remove node",
1527 RG_SCH_RECORD(&riCb->histElem,RGSCH_ACTION_DEL, &cell->pCqiSrsSrLst[riCb->nRiTrIdx].riLst);
1528 cmLListAdd2Tail(&cell->pCqiSrsSrLst[riIdx].riLst,
1530 RG_SCH_RECORD(&riCb->histElem,RGSCH_ACTION_ADD, &cell->pCqiSrsSrLst[riIdx].riLst);
1539 riCb->nRiTrIdx = riIdx;
1540 riCb->riDist = riDist;
1543 rgSCHUtlSCellHndlRiCollsn(riCb);
1546 } /* rgSCHTomUtlMovePriNxtOccasion */
1549 * @brief Handler for moving SR instance for the next periodic occasion
1553 * Function: rgSCHTomUtlMoveSrNxtOccasion
1555 * Handler for moving SR instance for the next periodic occasion
1557 * Invoked by: rgSCHTomUtlFill*
1560 * - For a UE move its occurence instance to next occasion
1561 * depending on its periodicity
1562 * - Remove it from the current list and insert it to the list
1563 * having the index matching with the derived number.
1565 * @param[in] RgSchCellCb *cell,
1566 * [in] RgSchUeCb *ue
1571 static S16 rgSCHTomUtlMoveSrNxtOccasion
1579 /* Compute Next Transmission Instance */
1580 srIdx = ue->srCb.peri + ue->srCb.nSrTrIdx;
1581 srIdx = srIdx%RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1582 /* Delete from current List and move to new list */
1583 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[ue->srCb.nSrTrIdx].srLst,
1584 &ue->srCb.srLstEnt))
1586 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to remove node",
1589 ue->srCb.nSrTrIdx = srIdx;
1590 cmLListAdd2Tail(&cell->pCqiSrsSrLst[ue->srCb.nSrTrIdx].srLst,
1591 &ue->srCb.srLstEnt);
1594 } /* rgSCHTomUtlMoveSrNxtOccasion */
1597 * @brief Handler for moving SRS instance for the next periodic occasion
1601 * Function: rgSCHTomUtlMoveSrsNxtOccasion
1603 * Handler for moving SRS instance for the next periodic occasion
1605 * Invoked by: rgSCHTomUtlFill*
1608 * - For a UE move its occurence instance to next occasion
1609 * depending on its periodicity
1610 * - Remove it from the current list and insert it to the list
1611 * having the index matching with the derived number.
1613 * @param[in] RgSchCellCb *cell,
1614 * [in] RgSchUeCb *ue
1619 static S16 rgSCHTomUtlMoveSrsNxtOccasion
1631 crntTime = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)
1632 +(cell->crntTime.slot);
1634 /* Compute Next Transmission Instance */
1635 tempIdx = ue->srsCb.peri + ue->srsCb.nSrsTrIdx;
1636 srsIdx = tempIdx %RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1637 if (ue->srsCb.peri > RG_SCH_PCQI_SRS_SR_TRINS_SIZE)
1639 srsDist = rgSCHUtlFindDist((uint16_t)(crntTime + TFU_RECPREQ_DLDELTA),
1640 (uint16_t)(crntTime + TFU_RECPREQ_DLDELTA + ue->srsCb.peri));
1647 /* ccpu00138306- If Periodicity is equal to Queue Size or multiple of it
1648 * then the next occasion idx will be same as current Idx, Hence need not
1651 if((ue->srsCb.peri%RG_SCH_PCQI_SRS_SR_TRINS_SIZE) != 0)
1653 /* Delete from current List and move to new list */
1654 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[ue->srsCb.nSrsTrIdx].srsLst,
1655 &ue->srsCb.srsLstEnt))
1657 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to remove node",
1660 cmLListAdd2Tail(&cell->pCqiSrsSrLst[srsIdx].srsLst,
1661 &ue->srsCb.srsLstEnt);
1670 ue->srsCb.nSrsTrIdx = srsIdx;
1671 ue->srsCb.srsDist = srsDist;
1673 } /* rgSCHTomUtlMoveSrsNxtOccasion */
1677 * @brief Handler for processing RAW CQI indication recieved from
1682 * Function: rgSCHTomRawCqiInd
1684 * Handler for processing RAW CQI indication recieved from PHY
1687 * Invoked by: RgLiTfuRawCqiInd
1691 * - Invoke scheduler to indicate Raw CQI rgSCHUtlRawCqiInd
1693 * @param[in] TfuRawCqiIndInfo *rawCqiInd
1698 S16 rgSCHTomRawCqiInd
1701 TfuRawCqiIndInfo *rawCqiInd
1706 TfuRawCqiRpt* rawCqiInfo;
1710 RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1711 RgSchCellCb *iterCellP;
1722 if(cell->cellId != rawCqiInd->cellId)
1724 DU_LOG("\nERROR --> SCH : Unable to get the cell for cellId"
1725 ":%d", rawCqiInd->cellId);
1730 node = rawCqiInd->rawCqiRpt.first;
1731 for (;node; node=node->next)
1733 rawCqiInfo = (TfuRawCqiRpt *)node->node;
1734 ue = rgSCHDbmGetUeCb (cell, rawCqiInfo->crnti);
1735 raCb = rgSCHDbmGetRaCb (cell, rawCqiInfo->crnti);
1739 DU_LOG("\nERROR --> SCH : CRNTI:%d Unable to get the UECB",
1746 if (rawCqiInfo->numBits >= 5)
1747 DU_LOG("\nINFO --> SCH : cellId [%d] crnti [%d] numBits [%d] uciPayload [0x%08x] sfn/sf [%d:%d]\n",
1748 cell->cellId, rawCqiInfo->crnti, rawCqiInfo->numBits, rawCqiInfo->uciPayload,
1749 rawCqiInd->timingInfo.sfn, rawCqiInd->timingInfo.slot);
1751 if (rawCqiInfo->numBits == 1)
1753 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1754 uint8_t fdbk = TFU_HQFDB_NACK;
1755 /* Process HARQ FdbkInd */
1756 hqAck = (rawCqiInfo->uciPayload >> 31) & 0x1;
1759 fdbk = TFU_HQFDB_ACK;
1760 hqInfo.isAck[0] = fdbk;
1762 if (ue != NULLP && raCb == NULLP)
1764 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, rawCqiInd->timingInfo, fdbk, &err)) != ROK)
1766 err.errType = RGSCHERR_TOM_HARQACKIND;
1767 DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() "
1768 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1769 err.errType, err.errCause);
1773 else if (ue == NULLP && raCb != NULLP)
1775 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1776 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1778 err.errType = RGSCHERR_TOM_HARQACKIND;
1779 DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() HARQ"
1780 " feedback processing failed errType(%d) errCause(%d)",
1781 err.errType, err.errCause);
1786 else if (ue != NULLP && raCb != NULLP)
1788 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1789 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1791 err.errType = RGSCHERR_TOM_HARQACKIND;
1792 DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() HARQ"
1793 " feedback processing failed errType(%d) errCause(%d).",
1794 err.errType, err.errCause);
1800 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to get the "
1801 "UE CB or RA CB ", rawCqiInfo->crnti);
1802 err.errType = RGSCHERR_TOM_HARQACKIND;
1806 DU_LOG("rawCqiInfo->numBits [%d] uciPayload [0x%08x] sfn/sf [%d:%d]\n", rawCqiInfo->numBits,
1807 rawCqiInfo->uciPayload, rawCqiInd->timingInfo.sfn, rawCqiInd->timingInfo.slot);
1810 else if (rawCqiInfo->numBits == 5)
1812 /* Process CQI-RI Ind*/
1813 ri = (rawCqiInfo->uciPayload >> 27) & 0x1;
1814 cqi = (rawCqiInfo->uciPayload >> 28) & 0xF;
1818 DU_LOG("\nERROR --> SCH : UE[%d] CQI[%d] Invalid\n", ue->ueId, cqi);
1821 ue->ue5gtfCb.mcs = rgSch5gtfCqi2Mcs[cqi - 1];
1822 ue->ue5gtfCb.rank = ri + 1;
1824 if (rawCqiInfo->numBits > 1)
1826 ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
1827 ueDl->mimoInfo.cwInfo[0].cqi = cqi;
1828 ueDl->cqiFlag = TRUE;
1829 rgSCHCmnDlSetUeAllocLmtLa(cell, ue);
1830 // rgSCHCheckAndSetTxScheme(cell, ue);
1835 DU_LOG("\nERROR --> SCH : UE[%d] CQI[%d] MCS[%d] RI[%d]\n", ue->ueId, cqi, ue->ue5gtfCb.mcs, ri);
1838 else if (rawCqiInfo->numBits == 6)
1840 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1841 TfuHqFdbk fdbk = TFU_HQFDB_NACK;
1842 /* Process both HARQ and CQI-RI Ind*/
1843 ri = (rawCqiInfo->uciPayload >> 26) & 0x1;
1844 cqi = (rawCqiInfo->uciPayload >> 27) & 0xF;
1845 hqAck = (rawCqiInfo->uciPayload >> 31) & 0x1;
1848 DU_LOG("\nERROR --> SCH : UE[%d] CQI[%d] Invalid\n", ue->ueId, cqi);
1851 ue->ue5gtfCb.mcs = rgSch5gtfCqi2Mcs[cqi - 1];
1852 ue->ue5gtfCb.rank = ri + 1;
1854 if (rawCqiInfo->numBits > 1)
1856 ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
1857 ueDl->mimoInfo.cwInfo[0].cqi = cqi;
1858 ueDl->cqiFlag = TRUE;
1859 rgSCHCmnDlSetUeAllocLmtLa(cell, ue);
1860 // rgSCHCheckAndSetTxScheme(cell, ue);
1865 fdbk = TFU_HQFDB_ACK;
1866 hqInfo.isAck[0] = fdbk;
1868 if (ue != NULLP && raCb == NULLP)
1870 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, rawCqiInd->timingInfo, fdbk, &err)) != ROK)
1872 err.errType = RGSCHERR_TOM_HARQACKIND;
1873 DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() "
1874 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1875 err.errType, err.errCause);
1879 else if (ue == NULLP && raCb != NULLP)
1881 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1882 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1884 err.errType = RGSCHERR_TOM_HARQACKIND;
1885 DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() HARQ"
1886 " feedback processing failed errType(%d) errCause(%d)",
1887 err.errType, err.errCause);
1892 else if (ue != NULLP && raCb != NULLP)
1894 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1895 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1897 err.errType = RGSCHERR_TOM_HARQACKIND;
1898 DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() HARQ"
1899 " feedback processing failed errType(%d) errCause(%d).",
1900 err.errType, err.errCause);
1906 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to get the "
1907 "UE CB or RA CB ", rawCqiInfo->crnti);
1908 err.errType = RGSCHERR_TOM_HARQACKIND;
1913 DU_LOG("\nERROR --> SCH : UE[%u] CQI[%u] MCS[%u] RI[%u] HQ[%u]\n", ue->ueId, cqi, ue->ue5gtfCb.mcs, ri, hqAck);
1918 if ((rgSCHDhmRlsDlsfHqProc (cell, rawCqiInd->timingInfo)) != ROK)
1920 DU_LOG("\nERROR --> SCH : Unable to Release Downlink "
1921 "subframe for cellId (%d) ", cell->cellId);
1922 err.errType = RGSCHERR_TOM_HARQACKIND;
1925 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
1927 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
1929 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
1931 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
1932 if(rlsHqBufs->numUes)
1934 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
1935 RgSchMacRlsHq (&pst, rlsHqBufs);
1937 rlsHqBufs->numUes = 0;
1941 } /* rgSCHTomRawCqiInd */
1944 * @brief Handler for processing SRS indication recieved from
1949 * Function: rgSCHTomSrsInd
1951 * Handler for SRS indication recieved from PHY
1954 * Invoked by: RgLiTfuSrsInd
1958 * - Invoke scheduler to indicate UL SRS rgSCHUtlSrsInd
1960 * @param[in] TfuSrsIndInfo *srsInd
1968 TfuSrsIndInfo *srsInd
1975 if(cell->cellId != srsInd->cellId)
1977 DU_LOG("\nERROR --> SCH : Unable to get the cell for cellId"
1978 ":%d", srsInd->cellId);
1982 node = srsInd->srsRpt.first;
1983 for (;node; node=node->next)
1985 srsInfo = (TfuSrsRpt *)node->node;
1986 ue = rgSCHDbmGetUeCb (cell, srsInfo->ueId);
1989 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to get the "
1990 "UE CB", srsInfo->ueId);
1993 rgSCHUtlSrsInd(cell, ue, srsInfo, srsInd->timingInfo);
1994 rgSCHUtlHdlUlTransInd(cell, ue, srsInd->timingInfo);
1997 } /* rgSCHTomSrsInd */
2001 * Fun: rgSCHTomUtlGenIndices
2003 * Desc: This function reconstructs the Subband Indices for
2004 * of M selected Subbands conveyed by the UE for APeriodic Modes
2005 * 2-0 and 2-2. It decodes the Label which uniquely encodes M out
2013 * File: rg_sch_utl.c
2017 static S16 rgSCHTomUtlGenIndices
2023 TfuSubbandInfo* sbInfo
2026 uint8_t idx, kval, xval, xmin;
2029 for(kval=0; kval<posM;kval++)
2032 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe, (posM-kval-1));
2033 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe[posM-kval-1], (valN-xval-1));
2034 binCoe = rgSCHTomBinCoe[posM-kval-1][valN-xval-1];
2038 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe[posM-kval-1], (valN-xval-1));
2039 binCoe = rgSCHTomBinCoe[posM-kval-1][valN-xval-1];
2042 sbInfo[kval].numRb = valK;
2043 sbInfo[kval].rbStart = idx*valK;
2045 label = label-binCoe;
2048 } /* end of rgSCHTomUtlGenIndices*/
2052 * @brief Handler for processing decode failure indication recieved from
2057 * Function: rgSCHTomCrcInd
2059 * Handler for processing decode failure indication recieved from
2060 * PHY for a set of UEs.
2062 * Invoked by: RgLiTfuCrcInd of rg_sch.x
2065 * - Validate the information received and retrieve cell and ue.
2066 * - Process Decode failure Indication: Call rgSCHUhmProcHqFailure().
2068 * @param[in] TfuCrcIndInfo *crcInd
2076 TfuCrcIndInfo *crcInd
2079 RgSchUeCb *ue = NULLP;
2080 RgSchRaCb *raCb = NULLP;
2082 TfuCrcInfo *crcInfo;
2083 #ifdef RG_ULSCHED_AT_CRC
2086 CmLteTimingInfo crntHiDci0Frm;
2087 //RgSchCmnUlCell *cellUl;
2088 Inst inst = cell->instIdx;
2089 TfuCntrlReqInfo *cntrlInfo;
2097 RgSchUlHqProcCb *hqProc;
2101 RgSchUlHqProcCb *ulHqProc;
2104 if(cell->cellId != crcInd->cellId)
2106 DU_LOG("\nERROR --> SCH : Unable to get the cell for cellId"
2107 ":%d", crcInd->cellId);
2110 #ifdef RG_ULSCHED_AT_CRC
2113 static CmLteTimingInfo lastCrc = {2000,0};
2114 CmLteTimingInfo crntCrc = cell->crntTime;
2115 if (RGSCH_TIMEINFO_SAME(lastCrc, crntCrc))
2117 /*Removed the WA to drop 2nd CRC*/
2118 DU_LOG("\nINFO --> SCH : Recieved CRC "
2119 "twice per TTI @(%u,%u)", cell->crntTime.sfn,
2120 cell->crntTime.slot);
2126 node = crcInd->crcLst.first;
2127 for (;node; node=node->next)
2129 crcInfo = (TfuCrcInfo*)node->node;
2130 ue = rgSCHDbmGetUeCb (cell, crcInfo->rnti);
2134 /* Fetch from SPS List */
2135 ue = rgSCHDbmGetSpsUeCb(cell, crcInfo->rnti);
2139 raCb = rgSCHDbmGetRaCb (cell, crcInfo->rnti);
2146 /* Added Ul TB count for Uplink data scheduled*/
2150 ulHqProc = &(raCb->msg3HqProc);
2151 if(ulHqProc->remTx == (cell->rachCfg.maxMsg3Tx -1))
2153 cell->dlUlTbCnt.tbTransUlTotalCnt++;
2158 rgSCHUtlUlHqProcForUe(cell, crcInd->timingInfo, ue, &ulHqProc);
2159 if(ulHqProc->remTx == ((RgUeUlHqCb*)ulHqProc->hqEnt)->maxHqRetx)
2161 cell->dlUlTbCnt.tbTransUlTotalCnt++;
2166 if (crcInfo->isFailure == FALSE)
2170 rgSCHRamMsg3DatInd(raCb);
2172 /*ccpu00128820 - MOD - Msg3 alloc double delete issue*/
2173 hqProc = &(raCb->msg3HqProc);
2174 RGSCH_UPD_PHICH(cell->ulDlCfgIdx, crcInd->timingInfo.slot,
2182 gUlCrcPassCounter++;
2187 RGSCHCPYTIMEINFO(crcInd->timingInfo, ue->datIndTime);
2188 #ifndef MAC_SCH_STATS
2189 rgSCHUhmProcDatInd(cell, ue, crcInd->timingInfo);
2192 /** Stats update over here
2195 RgSchCmnUe *cmnUe = RG_SCH_CMN_GET_UE(ue,cell);
2197 rgSCHUhmProcDatInd(cell, ue, crcInd->timingInfo, cmnUe->ul.crntUlCqi[0]);
2199 #endif /* MAC_SCH_STATS */
2201 rgSCHUtlHdlUlTransInd(cell, ue, crcInd->timingInfo);
2203 rgSCHUtlHdlCrcInd(cell, ue, crcInd->timingInfo);
2211 /* SR_RACH_STATS : MSG3 Nack / DTX*/
2212 if (crcInfo->isDtx == TRUE)
2218 rgNumMsg3CrcFailed++;
2220 rgSCHRamMsg3FailureInd(raCb);
2222 rgSCHCmnEmtcHdlCrcFailInd(cell, raCb);
2224 /* Added Ul TB count for CRC Failure of MSG3 */
2226 ulHqProc = &(raCb->msg3HqProc);
2227 if(ulHqProc->remTx == (cell->rachCfg.maxMsg3Tx -1))
2229 cell->dlUlTbCnt.tbTransUlFaulty++;
2237 gUlCrcFailCounter++;
2242 #ifndef MAC_SCH_STATS
2243 rgSCHUhmProcHqFailure (cell, ue, crcInd->timingInfo, crcInfo->rv);
2246 RgSchCmnUe *cmnUe = RG_SCH_CMN_GET_UE(ue,cell);
2248 rgSCHUhmProcHqFailure (cell, ue, crcInd->timingInfo, crcInfo->rv, cmnUe->ul.crntUlCqi[0]);
2250 #endif /* MAC_SCH_STATS */
2251 rgSCHUtlHdlUlTransInd(cell, ue, crcInd->timingInfo);
2253 rgSCHUtlHdlCrcFailInd(cell, ue, crcInd->timingInfo);
2255 /* Added Ul TB count for CRC Failure of Uplink data */
2257 rgSCHUtlUlHqProcForUe(cell, crcInd->timingInfo, ue, &ulHqProc);
2258 if(ulHqProc->remTx == ((RgUeUlHqCb*)ulHqProc->hqEnt)->maxHqRetx)
2260 cell->dlUlTbCnt.tbTransUlFaulty++;
2267 /* ccpu00132653-ADD Added Sched_At_Crc Changes for TDD and optimized here
2268 the codebase across TDD and FDD*/
2269 #ifdef RG_ULSCHED_AT_CRC
2270 /* Changes to do uplink scheduling at CRC Indication */
2271 //cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
2272 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, crntHiDci0Frm, TFU_ULCNTRL_DLDELTA);
2275 rgSCHCmnRlsUlSf(cell,0);
2278 /* Allocating memory for CntrlReq as it required for both EMTC and
2280 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&cntrlInfo,
2281 sizeof(TfuCntrlReqInfo))) != ROK)
2283 DU_LOG("\nERROR --> SCH : Unable to Allocate TfuCntrlReqInfo "
2287 rgSCHCmnUlSch(cell);
2289 rgSCHL2Meas(cell,TRUE);
2291 /* Also, sending UL DCI and PHICH for just scheduled subframe */
2292 ulSf = rgSCHUtlSubFrmGet (cell, crntHiDci0Frm);
2294 if ((rgSCHTomUtlProcDlSfAtCrc (ulSf, crntHiDci0Frm, cell, cntrlInfo, &err)) != ROK)
2296 DU_LOG("\nERROR --> SCH : rgSCHTomCrcInd() Unable to process"
2297 " downlink subframe for cellId %d", crcInd->cellId);
2298 err.errType = RGSCHERR_TOM_TTIIND;
2301 #endif /* RG_ULSCHED_AT_CRC */
2303 } /* rgSCHTomCrcInd */
2306 * @brief Handler for processing timing Advance indication recieved from
2311 * Function: rgSCHTomTimingAdvInd
2313 * Handler for processing timing advance indication recieved from PHY
2316 * Invoked by: RgLiTfuTimingAdvInd
2320 * - Call DHM to update value of Timing Advance rgSCHDhmUpdTa.
2322 * @param[in] TfuTimingAdvIndInfo *timingAdvInd
2327 S16 rgSCHTomTimingAdvInd
2330 TfuTimingAdvIndInfo *timingAdvInd
2335 TfuTimingAdvInfo *timingAdvInfo;
2337 if(cell->cellId != timingAdvInd->cellId)
2339 DU_LOG("\nERROR --> SCH : Unable to get the cell for cellId"
2340 "=(%d)", timingAdvInd->cellId);
2345 node = timingAdvInd->timingAdvLst.first;
2346 for (;node; node=node->next)
2348 timingAdvInfo = (TfuTimingAdvInfo *)node->node;
2349 ue = rgSCHDbmGetUeCb (cell, timingAdvInfo->rnti);
2352 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to get the UE CB",
2353 timingAdvInfo->rnti);
2356 rgSCHDhmUpdTa (cell, ue, timingAdvInfo->timingAdv);
2359 } /* rgSCHTomTimingAdvInd */
2362 * @brief Handler for processing TTI indication recieved from
2363 * PHY for 'n' cells.
2367 * Function: rgSCHTomTtiInd
2369 * Handler for processing slot indication recieved from MAC
2370 * for a cell. This is split into the below Steps.
2372 * 1: Complete the Uplink and Common Channel Scheduling for each Cell
2373 * 2: Complete the UE specific Scheduling for each Cell / across Cells.
2374 * 3: Consolidate the subframe allocations and send to each MAC instance
2375 * 4: Fill the Tfu structures for DL and UL Config requests
2376 * 5: Handle the RGR Config messages per Cell
2378 * @param[in] SlotTimingInfo *slotInd
2379 * @param[in] Inst schInst
2384 SlotTimingInfo *slotInd,
2388 RgInfSfAlloc *subfrmAlloc;
2389 RgTfuCntrlReqInfo *cntrlInfo = NULLP;
2393 RgSchCellCb *cell[CM_LTE_MAX_CELLS];
2394 RgSchCellCb *cellLst[CM_LTE_MAX_CELLS];
2400 //rgSchTomFillCellTtiInfo(slotInd, schInst, &nCell, &cell[0]);
2402 schFillCrntTime(*slotInd,schInst);
2403 for (i = 0; i < nCell; i++)
2405 /* Perform UL and DL Common Channel scheduling */
2406 rgSchTomTtiUlAndDlCmnChSch (cell[i]);
2409 /* Perform scheduling in Order of
2413 for (i = 0; i < nCell; i++)
2416 if (cell[i]->isDlDataAllwd && (cell[i]->stopDlSch == FALSE))
2418 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell[i]);
2419 /* Perform DL Retx scheduling */
2420 cellSch->apisDl->rgSCHDlRetxSched(cell[i], &cellSch->allocInfo);
2424 rgSchCmnPreDlSch(cell, nCell, cellLst);
2425 for (i = 0; i < nCell; i++)
2427 /* Perform DL scheduling */
2428 rgSchTomTtiDlSch (cellLst[i]);
2430 rgSchCmnPstDlSch(cell[0]);
2432 for (i = 0; i < nCell; i++)
2435 #ifndef RG_ULSCHED_AT_CRC
2436 /* Perform UL scheduling for TDD */
2437 rgSCHCmnUlSch (cell[i]);
2441 /* Init SF Alloc info per Cell */
2442 for (i = 0; i < nCell; i++)
2444 subfrmAlloc = &(cell[i]->sfAllocArr[cell[i]->crntSfIdx]);
2445 rgSCHUtlResetSfAlloc(subfrmAlloc,FALSE,TRUE);
2447 for (i = 0; i < nCell; i++)
2449 if (cell[i]->isDlDataAllwd && (cell[i]->stopSiSch == FALSE))
2451 subfrmAlloc = &(cell[i]->sfAllocArr[cell[i]->crntSfIdx]);
2453 * TFU_DLDATA_DLDELTA is used in this calculation because the subfrmAlloc
2454 * timingInfo which is being calculated here will be used by MAC
2456 RG_SCH_ADD_TO_CRNT_TIME(cell[i]->crntTime, subfrmAlloc->timingInfo,
2457 RG_DL_DELTA - TFU_DLDATA_DLDELTA);
2458 /* Consolidate the Allocations and send response to MAC instances */
2459 rgSchTomTtiCnsldtSfAlloc (cell[i]);
2463 for (i = 0; i < nCell; i++)
2465 if (cell[i]->isDlDataAllwd && (cell[i]->stopSiSch == FALSE))
2467 /* Send the consolidated Alloc Info to MAC instances */
2468 rgSCHCmnSndCnsldtInfo (cell[i]);
2472 for (i = 0; i < nCell; i++)
2474 /* Fill control data from scheduler to PHY */
2475 if ((ret = rgSCHUtlAllocEventMem((cell[i]->instIdx), (Ptr *)&cntrlInfo,
2476 sizeof(RgTfuCntrlReqInfo))) != ROK)
2478 DU_LOG("\nERROR --> SCH : Unable to Allocate TfuCntrlReqInfo"
2484 /* Fill the TFU structures and send to CL */
2485 if(TRUE == cell[i]->emtcEnable)
2487 ret = rgSchEmtcTomTtiL1DlAndUlCfg (cell[i], cntrlInfo);
2491 && (NULLP != cntrlInfo))
2493 /* Fill the TFU structures and send to CL */
2494 rgSchTomTtiL1DlAndUlCfg (cell[i], cntrlInfo);
2498 rgSCHTomUtlSendSfnTick(cell[0]);
2501 for (i = 0; i < nCell; i++)
2503 /* Invoke non critical functions like measurements, etc */
2504 rgSchTomTtiMiscFunctions (cell[i]);
2509 uint32_t dbgUeIdChngAndDatReqInClCnt = 0;
2510 static uint32_t gTtiCount = 0;
2513 if(gTtiCount == 3000)
2515 #ifdef XEON_SPECIFIC_CHANGES
2516 DU_LOG("\nINFO --> SCH : SChed:: (P/S)::(%u/%u) \n",
2517 gPrimarySchedCount,gSCellSchedCount);
2519 DU_LOG("\nINFO --> SCH : HQFDBK :: %u\n",gHqFdbkCount);
2524 total = gPCellTb1AckCount + gPCellTb1NackCount + gPCellTb1DtxCount;
2525 total2 = gPCellTb2AckCount + gPCellTb2NackCount + gPCellTb2DtxCount;
2527 DU_LOG("\nINFO --> SCH : PCell:: TB1:: (A/N/D)::(%u/%u/%u) TB2:: (A/N/D)::(%u/%u/%u)\n",
2528 gPCellTb1AckCount,gPCellTb1NackCount,gPCellTb1DtxCount,
2529 gPCellTb2AckCount,gPCellTb2NackCount,gPCellTb2DtxCount);
2530 if ((total != 0 ) && total2 != 0)
2532 DU_LOG("\nINFO --> SCH : PCell:: TB1:: (AP/NP/DP)::(%.2f/%.2f/%.2f) TB2:: (AP/NP/DP)::(%.2f/%.2f/%.2f)\n",
2533 (float)gPCellTb1AckCount/total * 100,(float)gPCellTb1NackCount/total * 100,(float)gPCellTb1DtxCount/total * 100,
2534 (float)gPCellTb2AckCount/total2 *100 ,(float)gPCellTb2NackCount/total2 *100 ,(float)gPCellTb2DtxCount/total2 *2);
2537 total = gSCellTb1AckCount + gSCellTb1NackCount + gSCellTb1DtxCount;
2538 total2 = gSCellTb2AckCount + gSCellTb2NackCount + gSCellTb2DtxCount;
2541 DU_LOG("\nINFO --> SCH : SCell:: TB1:: (A/N/D)::(%u/%u/%u) TB2:: (A/N/D)::(%u/%u/%u)\n",
2542 gSCellTb1AckCount,gSCellTb1NackCount,gSCellTb1DtxCount,
2543 gSCellTb2AckCount,gSCellTb2NackCount,gSCellTb2DtxCount);
2544 if ((total != 0 ) && total2 != 0)
2546 DU_LOG("\nINFO --> SCH : SCell:: TB1:: (AP/NP/DP)::(%.2f/%.2f/%.2f) TB2:: (AP/NP/DP)::(%.2f/%.2f/%.2f)\n",
2547 (float)gSCellTb1AckCount/total * 100,(float)gSCellTb1NackCount/total * 100,(float)gSCellTb1DtxCount/total * 100,
2548 (float)gSCellTb2AckCount/total2 *100 ,(float)gSCellTb2NackCount/total2 *100 ,(float)gSCellTb2DtxCount/total2 *2);
2552 DU_LOG("\nINFO --> SCH : CQI:: Recp(Pucch/Pusch):Rcvd(pcqi/rawacqireport/apcqi/AppReprt)::(%u/%u):(%u/%u/%u/%u)\n",
2553 gCqiRecpCount,gCqiRecpPuschCount,gCqiRcvdCount,gRawACqiCount,
2554 gACqiRcvdCount,gCqiReptToAppCount);
2556 DU_LOG("\nINFO --> SCH : (F1BCS Count/Cqi/Ri/CqiDrop/PucchDrop/PuschCqiDrop)::(%u/%u/%u/%u/%u/%u)\n",
2557 gF1bCsCount,gCqiReqCount,gRiReqCount,gCqiDropCount,gPucchDropCount,gPuschCqiDropCount);
2559 DU_LOG("\nINFO --> SCH : UL::(DCI0/CrcPass/CrcFail)::(%u/%u/%u)\n"
2560 "gPcellZeroBoOcc:%u\t gScellZeroBoOcc:%u dbgUeIdChngAndDatReqInClCnt: %u\n"
2561 "DelayedDatReqInMac: %u DelayedDatReqInCl : %u gIccPktRcvrMemDropCnt :%u\n",
2567 dbgUeIdChngAndDatReqInClCnt,
2568 dbgDelayedDatReqInMac,
2569 gDropDatReqCnt, gIccPktRcvrMemDropCnt);
2571 DU_LOG("\nINFO --> SCH : SChed:: (P/S)::(%ld/%ld) \n",
2572 gPrimarySchedCount,gSCellSchedCount);
2574 DU_LOG("\nINFO --> SCH : HQFDBK :: %ld\n",gHqFdbkCount);
2577 DU_LOG("\nINFO --> SCH : PCell:: TB1:: (A/N/D)::(%ld/%ld/%ld) TB2:: (A/N/D)::(%ld/%ld/%ld)\n",
2578 gPCellTb1AckCount,gPCellTb1NackCount,gPCellTb1DtxCount,
2579 gPCellTb2AckCount,gPCellTb2NackCount,gPCellTb2DtxCount);
2581 DU_LOG("\nINFO --> SCH : SCell:: TB1:: (A/N/D)::(%ld/%ld/%ld) TB2:: (A/N/D)::(%ld/%ld/%ld)\n",
2582 gSCellTb1AckCount,gSCellTb1NackCount,gSCellTb1DtxCount,
2583 gSCellTb2AckCount,gSCellTb2NackCount,gSCellTb2DtxCount);
2585 DU_LOG("\nINFO --> SCH : CQI:: Recp(Pucch/Pusch):Rcvd(pcqi/rawacqireport/apcqi/AppReprt)::\
2586 (%ld/%ld):(%ld/%ld/%ld/%ld)\n",
2587 gCqiRecpCount,gCqiRecpPuschCount,gCqiRcvdCount,gRawACqiCount,
2588 gACqiRcvdCount,gCqiReptToAppCount);
2589 DU_LOG("\nINFO --> SCH : CQI:: PucchCqiSnrDropCnt/PucchCqiConfBitMaskDropCnt/PuschCqiConfMaskDropCount\
2590 :: (%ld/%ld/%ld) \n",gCqiPucchLowSnrDropCount,gCqiPucchConfMaskDropCount,gCqiPuschConfMaskDropCount);
2592 DU_LOG("\nINFO --> SCH : (F1BCS Count/Cqi/Ri/CqiDrop/PucchDrop/PuschCqiDrop)::(%ld/%ld/%ld/%ld/%ld/%ld)\n",
2593 gF1bCsCount,gCqiReqCount,gRiReqCount,gCqiDropCount,gPucchDropCount,gPuschCqiDropCount);
2595 DU_LOG("\nINFO --> SCH : UL::(DCI0/CrcPass/CrcFail)::(%ld/%ld/%ld)\n"
2596 "gPcellZeroBoOcc:%ld\t gScellZeroBoOcc:%ld dbgUeIdChngAndDatReqInClCnt: %ld\n"
2597 "DelayedDatReqInMac: %ld DelayedDatReqInCl : %ld gIccPktRcvrMemDropCnt :%ld\n",
2603 dbgUeIdChngAndDatReqInClCnt,
2604 dbgDelayedDatReqInMac,
2605 gDropDatReqCnt, gIccPktRcvrMemDropCnt);
2606 //DU_LOG("\nINFO --> SCH : delayedApiCnt:%ld",delayedApiCnt);
2610 rgSCHLaaPrintStats();
2612 gCaDbgNonCaFrmt = gIccPktRcvrMemDropCnt = 0;
2624 gCqiPucchLowSnrDropCount = 0;
2625 gCqiPucchConfMaskDropCount = 0;
2626 gCqiPuschConfMaskDropCount = 0;
2627 gPuschCqiDropCount = 0;
2630 gUlCrcPassCount = 0;
2631 gUlCrcFailCount = 0;
2634 gCqiRecpPuschCount = 0;
2637 gCqiReptToAppCount = 0;
2642 gPrimarySchedCount = 0;
2643 gSCellSchedCount = 0;
2644 gSCellTb1AckCount = 0;
2645 gSCellTb2AckCount = 0;
2646 gSCellTb2AckCount = 0;
2647 gSCellTb2NackCount = 0;
2648 gPCellTb1AckCount = 0;
2649 gPCellTb1NackCount = 0;
2650 gPCellTb2AckCount = 0;
2651 gPCellTb2NackCount = 0;
2652 gSCellTb1NackCount=0;
2654 gPCellTb1DtxCount = 0;
2655 gPCellTb2DtxCount = 0;
2656 gSCellTb1DtxCount = 0;
2657 gSCellTb2DtxCount = 0;
2658 gPcellZeroBoOcc = 0;
2659 gScellZeroBoOcc = 0;
2667 } /* rgSCHTomTtiInd */
2669 /** @brief This function does the TTI processin for the uplink subframe,
2670 * already populated by the scheduler.
2674 * Function: rgSCHTomUtlProcUlSf
2677 * - Loop through the Uplink allocations present in the uplink subframe.
2678 * - For each allocation Fill a data reception request to be sent to PHY
2679 * - Also fills the harq reception requests for the expected HQ feedbacks.
2682 * @param [in] RgSchCellCb *cell
2683 * @param [out] RgSchErrInfo *err
2689 static S16 rgSCHTomUtlProcUlSf
2696 TfuRecpReqInfo *recpReqInfo;
2698 uint16_t validIdx = 0; /* Index computed from recreq's timing info*/
2700 Inst inst = cell->instIdx;
2702 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&recpReqInfo,
2703 sizeof(TfuRecpReqInfo))) != ROK)
2705 DU_LOG("\nERROR --> SCH : Unable to Allocate TfuRecpReqInfo "
2707 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
2710 recpReqInfo->cellId = cell->cellId;
2711 cmLListInit(&recpReqInfo->ueRecpReqLst);
2713 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, recpReqInfo->timingInfo,
2714 TFU_RECPREQ_DLDELTA);
2716 /* Filling data Reception requests */
2717 ret = rgSCHTomUtlFillDatRecpReq(recpReqInfo, cell,
2722 DU_LOG("\nERROR --> SCH : Unable to fill Data recption "
2723 "requests for cell");
2724 RGSCH_FREE_MEM(recpReqInfo);
2727 /* Filling HARQ Reception requests */
2728 ret = rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, validIdx,err);
2731 DU_LOG("\nERROR --> SCH : Unable to fill Harq Feedback "
2732 "reception requests for cell");
2733 RGSCH_FREE_MEM(recpReqInfo);
2736 /* sending the RecpReq to Phy */
2737 //if (rgSCHUtlTfuRecpReq(inst, cell->tfuSap->sapCfg.suId, recpReqInfo) != ROK)
2739 DU_LOG("\nERROR --> SCH : Unable to send Cntrl info for cell");
2742 } /* end of rgSCHTomUtlProcUlSf */
2746 /** @brief This function does the TTI processin for the uplink subframe,
2747 * already populated by the scheduler.
2751 * Function: rgSCHTomUtlPrcUlTddSpclSf
2754 * - Fill the SRS Info for the Special Subframe in Reception Req.
2755 * - Send the Reception Req to TFU
2758 * @param [in] RgSchCellCb *cell
2759 * @param [out] RgSchErrInfo *err
2764 static S16 rgSCHTomUtlPrcUlTddSpclSf
2771 TfuRecpReqInfo *recpReqInfo;
2772 uint16_t validIdx; /* Index computed from recreq's timing info*/
2773 Inst inst = cell->instIdx;
2775 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&recpReqInfo,
2776 sizeof(TfuRecpReqInfo))) != ROK)
2778 DU_LOG("\nERROR --> SCH : rgSCHTomUtlPrcUlTddSpclSf() Unable to "
2779 "Allocate TfuRecpReqInfo for cell");
2780 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
2783 recpReqInfo->cellId = cell->cellId;
2784 cmLListInit(&recpReqInfo->ueRecpReqLst);
2786 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, recpReqInfo->timingInfo, TFU_RECPREQ_DLDELTA);
2788 RG_SCH_GET_IDX_PCQISRSSR(recpReqInfo->timingInfo, validIdx);
2791 if(cell->srsCfg.isSrsCfgPres &&
2792 rgSchTddCellSpSrsSubfrmTbl[cell->srsCfg.srsSubFrameCfg][recpReqInfo->timingInfo.slot])
2794 recpReqInfo->srsPres = TRUE;
2798 recpReqInfo->srsPres = FALSE;
2801 /* Filling SRS Reception requests */
2802 ret = rgSCHTomUtlFillSrsRecpReq (recpReqInfo, cell, validIdx, err);
2805 DU_LOG("\nERROR --> SCH : rgSCHTomUtlPrcUlTddSpclSf() Unable to fill"
2806 " SRS recption requests for cell");
2807 RGSCH_FREE_MEM(recpReqInfo);
2810 /* sending the RecpReq to Phy */
2811 //if (rgSCHUtlTfuRecpReq(inst, cell->tfuSap->sapCfg.suId, recpReqInfo) != ROK)
2813 DU_LOG("\nERROR --> SCH : rgSCHTomUtlPrcUlTddSpclSf() Unable to send "
2814 "Cntrl info for cell");
2817 } /* end of rgSCHTomUtlPrcUlTddSpclSf */
2820 /** @brief This function does all the processing related to a single downlink
2825 * Function: rgSCHTomUtlProcDlSf
2828 * - collate control data for all UEs and send to PHY
2829 * - collate data buffers for all UEs and send to PHY
2831 * @param [in] RgSchDlSf *dlSf
2832 * @param [in] RgSchDlSf *ulSf
2833 * @param [in] RgSchCellCb *cell
2834 * @param [out] RgSchErrInfo *err
2837 static S16 rgSCHTomUtlProcDlSf
2842 RgTfuCntrlReqInfo *cntrlInfo,
2847 uint8_t sfTyp = 1; /* Dl Subframe */
2849 cmLListInit(&cntrlInfo->phichLst);
2850 cmLListInit(&cntrlInfo->dlPdcchLst);
2851 cmLListInit(&cntrlInfo->ulPdcchLst);
2853 #ifdef TFU_ALLOC_EVENT_NO_INIT
2854 cntrlInfo->ulTiming.sfn = cntrlInfo->ulTiming.subframe = 0;
2856 cntrlInfo->dlTiming = cell->dlDciTime;
2857 cntrlInfo->cellId = cell->cellId;
2858 cntrlInfo->ulTiming = cell->hiDci0Time;
2859 if((0 == (cntrlInfo->dlTiming.sfn % 30)) && (0 == cntrlInfo->dlTiming.slot))
2861 //DU_LOG("\nERROR --> SCH : 5GTF_CHECK rgSCHTomUtlProcDlSf Cntrl dl (%d : %d) ul (%d : %d)\n", \
2862 cntrlInfo->dlTiming.sfn, cntrlInfo->dlTiming.subframe, cntrlInfo->ulTiming.sfn, cntrlInfo->ulTiming.subframe);
2864 /* Fill PCFICH info */
2865 /* Fix for DCFI FLE issue: when DL delta is 1 and UL delta is 0 and CFI
2866 *change happens in that SF then UL PDCCH allocation happens with old CFI
2867 *but CFI in control Req goes updated one since it was stored in the CELL
2869 cntrlInfo->cfi = dlSf->pdcchInfo.currCfi;
2870 #ifndef RG_ULSCHED_AT_CRC
2873 Mval = rgSchTddPhichMValTbl[cell->ulDlCfgIdx]
2874 [cell->hiDci0Time.subframe];
2875 if(dlSf->sfType == RG_SCH_SPL_SF_DATA)
2877 RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, cntrlInfo->cfi);
2882 /* Fill PHICH info */
2883 if ((ret = rgSCHTomUtlFillPhich (cell, cntrlInfo, ulSf, err)) != ROK)
2885 DU_LOG("\nERROR --> SCH : Unable to send PHICH info "
2886 "for cellId (%d)\n", cell->cellId);
2887 RGSCH_FREE_MEM(cntrlInfo);
2890 if ((ret = rgSCHTomUtlFillUlPdcch (cell, cntrlInfo, ulSf, err)) !=
2893 DU_LOG("\nERROR --> SCH : Unable to send PDCCH info "
2894 "for cellId (%d)\n", cell->cellId);
2895 RGSCH_FREE_MEM(cntrlInfo);
2900 if(0 == cntrlInfo->ulMpdcchLst.count)
2907 sfTyp = rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
2908 [cell->dlDciTime.subframe];
2910 if (sfTyp != 2) /* Uplink subframe */
2912 /* Fill PDCCH info */
2913 if ((ret = rgSCHTomUtlFillDlPdcch(cell,cntrlInfo, dlSf, err)) != ROK)
2915 DU_LOG("\nERROR --> SCH : Unable to send PDCCH info "
2916 "for cellId (%d)\n", cell->cellId);
2917 RGSCH_FREE_MEM(cntrlInfo);
2920 rgBwAlloInfo[dlSf->sfNum] += dlSf->bwAssigned;
2921 rgBwAlcnt[dlSf->sfNum] ++;
2924 #ifdef LTEMAC_SPS /* SPS_NEW_CHGS */
2925 cntrlInfo->isSPSOcc = dlSf->isSPSOcc;
2927 cntrlInfo->numDlActvUes += dlSf->numDlActvUes; /* 4UE_TTI_DELTA */
2928 dlSf->numDlActvUes = 0;
2930 if(0 == cntrlInfo->dlMpdcchLst.count)
2935 /* Now always sending down a cntrl req */
2936 /* sending the cntrl data to Phy */
2937 //if (rgSCHUtlTfuCntrlReq(inst, cell->tfuSap->sapCfg.suId, cntrlInfo)
2940 DU_LOG("\nERROR --> SCH : Unable to send Cntrl info for cell");
2947 /** @brief This function handles sending of the PHICH information for the
2948 * downlink subframe to be sent in the next TTI.
2955 * - Loop through the PHICH information present in the downlink
2956 * subframe and fill the information in cntrlInfo.
2958 * @param [out] TfuCntrlReqInfo *cntrlInfo
2959 * @param [in] RgSchDlSf *dlSf
2960 * @param [out] RgSchErrInfo *err
2965 static S16 rgSCHTomUtlFillPhich
2968 TfuCntrlReqInfo *cntrlInfo,
2976 TfuPhichInfo *harqAck;
2978 RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
2982 /* Traversing the list of Phichs */
2983 node = dlSf->phichInfo.phichs.first;
2986 phich = (RgSchPhich*)node->node;
2987 if ((ret = rgSCHUtlGetEventMem((Ptr *)&harqAck, sizeof(TfuPhichInfo),
2988 &(cntrlInfo->memCp))) != ROK)
2990 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
2993 #ifdef TFU_ALLOC_EVENT_NO_INIT
2994 harqAck->txPower = 0;
2996 /* fill in the tfu structure from the information present in the
2998 harqAck->rbStart = phich->rbStart;
2999 harqAck->nDmrs = phich->nDmrs;
3000 harqAck->isAck = phich->hqFeedBack;
3001 harqAck->isForMsg3 = phich->isForMsg3; /*SR_RACH_STATS : PHICH ACK/NACK for MSG3 */
3003 /* Changes for passing iPhich at TFU interface*/
3004 harqAck->iPhich = phich->iPhich;
3006 /* ccpu00138898 - Added Tx pwr offset for PHICH Tx*/
3008 harqAck->txPower = cellDl->phichTxPwrOffset;
3010 cmLListAdd2Tail(&cntrlInfo->phichLst, &(harqAck->lnk));
3011 harqAck->lnk.node = (PTR)harqAck;
3013 } /* end of while */
3019 /** @brief This function is a utility function to restart
3020 * deactivation timer.
3024 * Function: rgSCHTmrRestartScellDeactTmr
3027 * - Starts timer at scheduler
3029 * @param[in] RgSchCellCb *cell
3030 * @param[in] CmLteRnti rnti
3033 static Void rgSCHTmrRestartScellDeactTmr
3039 RgSchUeCellInfo *sCellInfo = NULLP;
3043 if(RG_SCH_IS_CELL_SEC(ueCb, cell))
3045 sCellInfo = ueCb->cellInfo[(ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)])];
3047 if(sCellInfo->deactTmr.tmrEvnt != TMR_NONE)
3049 rgSCHTmrStopTmr(cell, RG_SCH_TMR_SCELL_DEACT, sCellInfo);
3051 if(PRSNT_NODEF == ueCb->sCellDeactTmrVal.pres)
3054 rgSCHTmrStartTmr(cell,sCellInfo,RG_SCH_TMR_SCELL_DEACT,
3055 ueCb->sCellDeactTmrVal.val);
3060 }/*end of rgSCHTmrRestartScellDeactTmr*/
3063 /** @brief This function will send all the PDCCH's for the given downlink
3071 * - Loop through all the scheduled HARQ processes and fill
3072 * the PDCCH information in cntrlInfo.
3074 * @param [out] TfuCntrlReqInfo *cntrlInfo
3075 * @param [in] RgSchDlSf *dlSf
3076 * @param [out] RgSchErrInfo *err
3081 uint32_t numdlSpsRelSentToTf;
3082 static S16 rgSCHTomUtlFillDlPdcch
3085 TfuCntrlReqInfo *cntrlInfo,
3093 TfuPdcchInfo *tfuPdcch;
3094 uint8_t isDcivld = FALSE;
3095 uint8_t numUePerTti = 0;
3098 /* Traversing the scheduled Harq processes */
3099 node = dlSf->pdcchInfo.pdcchs.first;
3102 pdcch = (RgSchPdcch*)node->node;
3103 switch(pdcch->dci.dciFormat)
3105 case TFU_DCI_FORMAT_3:
3106 isDcivld = (pdcch->dci.u.format3Info.isPucch) ? TRUE : FALSE;
3109 case TFU_DCI_FORMAT_3A:
3110 isDcivld = (pdcch->dci.u.format3AInfo.isPucch) ? TRUE : FALSE;
3123 /*ccpu00117179 - ADD - Build only non DCI format-0 messages */
3124 if((pdcch->dci.dciFormat == TFU_DCI_FORMAT_0) ||
3125 (pdcch->dci.dciFormat == TFU_DCI_FORMAT_A1) ||
3126 (pdcch->dci.dciFormat == TFU_DCI_FORMAT_A2))
3133 #ifdef RGSCH_SPS_STATS
3134 if((pdcch->dci.dciFormat == TFU_DCI_FORMAT_1A) &&
3135 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.mcs == 0x1F) &&
3136 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.type == TFU_ALLOC_TYPE_RIV) &&
3137 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.u.riv == 0xFFFFFFFF))
3139 numdlSpsRelSentToTf++;
3143 if ((ret = rgSCHUtlGetEventMem((Ptr *)&tfuPdcch, sizeof(TfuPdcchInfo),
3144 &(cntrlInfo->memCp))) != ROK)
3146 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3150 tfuPdcch->crnti = pdcch->crnti;
3151 tfuPdcch->isSpsRnti = pdcch->isSpsRnti;
3153 tfuPdcch->rnti = pdcch->rnti;
3156 rgSCHTmrRestartScellDeactTmr(cell,pdcch->ue);
3158 tfuPdcch->dciNumOfBits = pdcch->dciNumOfBits;
3160 tfuPdcch->nCce = pdcch->nCce;
3161 tfuPdcch->aggrLvl = pdcch->aggrLvl;
3162 tfuPdcch->dci = pdcch->dci;
3164 //TODO_SID: Need to check these values during INT
3165 tfuPdcch->sectorId = 0;
3166 tfuPdcch->sccIdx = 0;
3169 /* SR_RACH_STATS : Reset isTBMsg4 */
3170 pdcch->dci.u.format1aInfo.t.pdschInfo.isTBMsg4 = FALSE;
3171 /* To be enhanced later for 2.1 */
3172 cmLListAdd2Tail(&cntrlInfo->dlPdcchLst, &(tfuPdcch->lnk));
3173 tfuPdcch->lnk.node = (PTR)tfuPdcch;
3175 if((pdcch->rnti > 60) && (pdcch->rnti < 5000))
3177 #if defined (TENB_STATS) && defined (RG_5GTF)
3178 cell->tenbStats->sch.dl5gtfPdcchSend++;
3182 } /* end of while */
3184 if((numUePerTti) && (numUePerTti < RG_MAX_NUM_UE_PER_TTI ))
3186 cell->dlNumUeSchedPerTti[numUePerTti-1]++;
3188 gDlNumUePerTti[numUePerTti-1]++;
3192 } /* end of rgSCHTomUtlFillDlPdcch*/
3194 #ifdef RGSCH_SPS_STATS
3195 uint32_t rgSchSpsRelSentToTf;
3196 uint32_t rgSchSpsRelPdcchAllocd;
3198 /** @brief This function will send all the UL PDCCH's for the given
3206 * - Loop through all the scheduled HARQ processes and fill
3207 * the PDCCH information in cntrlInfo.
3209 * @param [out] TfuCntrlReqInfo *cntrlInfo
3210 * @param [in] RgSchDlSf *dlSf
3211 * @param [out] RgSchErrInfo *err
3216 static S16 rgSCHTomUtlFillUlPdcch
3219 TfuCntrlReqInfo *cntrlInfo,
3227 TfuPdcchInfo *tfuPdcch;
3228 uint8_t isDcivld = FALSE;
3231 /* Traversing the scheduled Harq processes */
3232 node = dlSf->pdcchInfo.pdcchs.first;
3235 pdcch = (RgSchPdcch*)node->node;
3237 /*ccpu00116712- Function should pick only UL allocation related control
3239 switch(pdcch->dci.dciFormat)
3241 case TFU_DCI_FORMAT_A1:
3245 case TFU_DCI_FORMAT_A2:
3249 case TFU_DCI_FORMAT_3:
3250 isDcivld = (pdcch->dci.u.format3Info.isPucch) ? FALSE : TRUE;
3253 case TFU_DCI_FORMAT_3A:
3254 isDcivld = (pdcch->dci.u.format3AInfo.isPucch) ? FALSE : TRUE;
3269 /*ccpu00116712- Function should pick only UL allocation related control
3271 if ((ret = rgSCHUtlGetEventMem((Ptr *)&tfuPdcch, sizeof(TfuPdcchInfo),
3272 &(cntrlInfo->memCp))) != ROK)
3274 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3277 tfuPdcch->rnti = pdcch->rnti;
3279 rgSCHTmrRestartScellDeactTmr(cell,pdcch->ue);
3281 tfuPdcch->dciNumOfBits = pdcch->dciNumOfBits;
3283 tfuPdcch->nCce = pdcch->nCce;
3284 tfuPdcch->aggrLvl = pdcch->aggrLvl;
3285 tfuPdcch->dci = pdcch->dci;
3287 //TODO_SID: Need to check these values during INT
3288 tfuPdcch->sectorId = 0;
3289 tfuPdcch->sccIdx = 0;
3292 /* To be enhanced later for 2.1 */
3294 #if defined (TENB_STATS) && defined (RG_5GTF)
3295 cell->tenbStats->sch.ul5gtfPdcchSend++;
3297 cmLListAdd2Tail(&cntrlInfo->ulPdcchLst, &(tfuPdcch->lnk));
3298 tfuPdcch->lnk.node = (PTR)tfuPdcch;
3299 } /* end of while */
3301 #ifdef RGSCH_SPS_STATS
3302 if (rgSchSpsRelSentToTf != rgSchSpsRelPdcchAllocd)
3308 } /* end of rgSCHTomUtlFillUlPdcch*/
3310 /** @brief This function does the processing for Timing adjustment.
3317 * - Loop through the ue present ueTimeLst, decrement the remaining
3321 * @param [in] RgSchCellCb *cell
3326 static S16 rgSCHTomUtlProcTA(RgSchCellCb *cell)
3331 node = cell->taUeLst.first;
3334 ue = (RgSchUeCb *)node->node;
3336 if (ue->dl.taCb.numRemSf == 0)
3338 ue->dl.taCb.state = RGSCH_TA_IDLE;
3339 /* If Outstanding Ta is present, schedule it */
3340 if(ue->dl.taCb.outStndngTa == TRUE)
3342 rgSCHUtlReTxTa(cell, ue);
3346 /* We need to reset state and also value of TA,
3347 * then we start the timer */
3348 ue->dl.taCb.ta = RGSCH_NO_TA_RQD;
3349 /* Start the timer only if TA is cfgd as FINITE value */
3350 if (ue->dl.taCb.cfgTaTmr)
3352 rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_TA, ue->dl.taCb.cfgTaTmr);
3355 /* need to delete from the link list */
3356 cmLListDelFrm(&(cell->taUeLst), &(ue->taLnk));
3357 ue->taLnk.node = NULLP;
3361 ue->dl.taCb.numRemSf--;
3363 } /* end of taUeLst */
3365 } /* end of rgSCHTomUtlProcTA */
3367 /** @brief This function handles filling of Hq reception request to
3381 S16 rgSCHTomUtlFillHqFdbkInfo
3383 TfuRecpReqInfo *recpReqInfo,
3386 RgSchDlHqProcCb *hqCb,
3388 TfuUeRecpReqInfo *pucchRecpInfo,
3389 RgSchDlHqProcCb *prvHqCb,
3393 S16 rgSCHTomUtlFillHqFdbkInfo
3395 TfuRecpReqInfo *recpReqInfo,
3397 RgSchDlHqProcCb *hqCb,
3399 TfuUeRecpReqInfo *pucchRecpInfo,
3400 RgSchDlHqProcCb *prvHqCb,
3406 RgSchDlHqTbCb *tbCb;
3408 Bool isAddToLst = FALSE;
3410 for (idx = 0 ;idx < 2; idx++)
3412 if (HQ_TB_WAITING == hqCb->tbInfo[idx].state)
3414 tbCb = &hqCb->tbInfo[idx];
3416 /* FOR ACK NAK REP */
3417 if ((hqCb->hqE->ue != NULLP) &&
3418 (hqCb->hqE->ue->measGapCb.isMeasuring == TRUE))
3420 if ((tbCb->fbkRecpRepCntr) &&
3421 (--tbCb->fbkRecpRepCntr))
3423 /* Add to next subfarme */
3424 /* Add this hqCb to the next dlSf's ackNakRepQ */
3425 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
3426 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
3427 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
3428 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
3431 rgSCHTomUtlMoveNxtOccasion(cell, hqCb->hqE->ue, validIdx);
3439 /* Go to the next node */
3445 //if (hqCb != prvHqCb)
3447 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
3448 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
3451 DU_LOG("\nERROR --> SCH : Unable to Allocate TfuUeRecpReqInfo for cell");
3452 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3455 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
3456 if ((hqCb->hqE->ue != NULLP) /*&&
3457 ((tbCb->lchSchdData[0].lcId != 0) || (tbCb->taSnt ==
3461 pucchRecpInfo->rnti = hqCb->hqE->ue->ueId;
3465 if (hqCb->hqE->raCb)
3467 pucchRecpInfo->rnti = hqCb->hqE->raCb->tmpCrnti;
3473 if (!hqCb->spsN1PucchRes.pres)
3476 pucchRecpInfo->t.pucchRecpReq.hqType =
3477 TFU_HQ_RECP_REQ_NORMAL;
3478 pucchRecpInfo->t.pucchRecpReq.t.nCce =
3484 pucchRecpInfo->t.pucchRecpReq.hqType =
3485 TFU_HQ_RECP_REQ_N1PUCCH;
3486 pucchRecpInfo->t.pucchRecpReq.t.n1Pucch =
3487 hqCb->spsN1PucchRes.val;
3491 /* Handling of other types */
3492 pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
3493 #else /* TFU_UPGRADE */
3494 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
3495 if ((hqCb->tbInfo[0].state == HQ_TB_WAITING) &&
3496 (hqCb->tbInfo[1].state == HQ_TB_WAITING))
3498 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz = 2; /* MIMO */
3502 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz = 1; /* NON-MIMO */
3506 /* PucchRecpReq needs to be filled up for n1Pucch resource for SPS
3508 if (hqCb->spsN1PucchRes.pres)
3510 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
3513 #endif /* LTEMAC_SPS */
3515 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
3516 cell->pucchCfg.n1PucchAn);
3519 rgSCHEmtcFillPucchRecpInfo(cell, hqCb, &(pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0]));
3522 #endif/*TFU_UPGRADE*/
3525 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, hqCb->hqE->ue,
3526 pucchRecpInfo, validIdx,FALSE);
3529 /* Passing last parameter as FALSE in this case as it will be verified from hqCb*/
3530 isAddToLst = rgSCHEmtcAddRecpInfoToLst(hqCb,recpReqInfo, pucchRecpInfo,FALSE);
3534 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
3536 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
3539 if ((tbCb->fbkRecpRepCntr) &&
3540 (--tbCb->fbkRecpRepCntr))
3542 /* Add to next subfarme */
3543 /* Add this hqCb to the next dlSf's ackNakRepQ */
3544 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
3545 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
3546 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
3547 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
3553 }/* end of rgSCHTomUtlFillHqFdbkInfo */
3556 /** @brief This function handles filling of Hq reception request to
3561 * Function:rgSCHTomUtlFillHqFdbkFor5gtf
3565 * @param [out] TfuRecpReqInfo *recpReqInfo
3566 * @param [in] RgSchCellCb *cell
3567 * @param [in] uint16_t validIdx,
3568 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
3569 * @param [in] RgSchDlSf *dlSf,
3570 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
3571 * @param [out] RgSchErrInfo *err
3577 static S16 rgSCHTomUtlFillHqFdbkFor5gtf
3579 TfuRecpReqInfo *recpReqInfo,
3582 RgSchDlHqInfo *dlSfHqInfo,
3584 TfuUeRecpReqInfo *pucchRecpInfo,
3590 TfuUePucchRecpReq *pucchReqInfo = NULLP;
3592 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
3598 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
3599 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
3602 DU_LOG("\nERROR --> SCH : Unable to Allocate "
3603 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId);
3604 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3607 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
3608 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
3609 * instead of SPS-CRNTI */
3611 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
3613 pucchReqInfo->uciInfo = TFU_XPUCCH_UCI_INFO;
3615 /* 5gtf TODO : Hardcoded nPUCCHIdx */
3616 pucchReqInfo->uciPduInfo.pucchIndex = 0;
3618 pucchReqInfo->uciPduInfo.numBits = 1;
3620 /* 5gtf TODO : CQI Periodicity Hardcoded to (n,0)*/
3621 if (RGSCH_TIMEINFO_SAME (recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn))
3623 pucchReqInfo->uciPduInfo.numBits += 5;
3624 RG_SCH_ADD_TO_CRNT_TIME(recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn,
3625 ue->ue5gtfCb.cqiRiPer);
3628 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
3629 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
3631 }/* end of rgSCHTomUtlFillHqFdbkForFrmt1B */
3635 /** @brief This function handles filling of Hq reception request to
3640 * Function:rgSCHTomUtlFillHqFdbkForFrmt1B
3643 * Allocates the N1Pucch Resources based on teh A Value
3645 * @param [out] TfuRecpReqInfo *recpReqInfo
3646 * @param [in] RgSchCellCb *cell
3647 * @param [in] uint16_t validIdx,
3648 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
3649 * @param [in] RgSchDlSf *dlSf,
3650 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
3651 * @param [out] RgSchErrInfo *err
3658 static S16 rgSCHTomUtlFillHqFdbkForFrmt1B
3660 TfuRecpReqInfo *recpReqInfo,
3663 RgSchDlHqInfo *dlSfHqInfo,
3665 TfuUeRecpReqInfo *pucchRecpInfo,
3669 static S16 rgSCHTomUtlFillHqFdbkForFrmt1B
3671 TfuRecpReqInfo *recpReqInfo,
3673 RgSchDlHqInfo *dlSfHqInfo,
3675 TfuUeRecpReqInfo *pucchRecpInfo,
3681 Inst inst = cell->instIdx;
3685 RgSchDlHqProcCb *hqCb = NULLP;
3687 TfuUePucchRecpReq *pucchReqInfo = NULLP;
3688 Bool isDatPresOnSecCell = FALSE;
3689 uint8_t primCellTbCount = 0;
3691 hqPNode = dlSfHqInfo->hqPLst.first;
3692 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
3698 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
3699 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
3702 DU_LOG("\nERROR --> SCH : Unable to Allocate TfuUeRecpReqInfo for cellId=%d \n", cell->cellId);
3703 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3706 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
3707 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
3708 * instead of SPS-CRNTI */
3710 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
3713 pucchReqInfo->hqType = TFU_HQ_RECP_REQ_NORMAL;
3714 /* Handling of other types */
3715 pucchReqInfo->type = TFU_UCI_HARQ;
3716 #else /* TFU_UPGRADE */
3717 pucchReqInfo->uciInfo = TFU_PUCCH_HARQ;
3718 /* Fill hqFdbkMode by using uciFrmtTyp from dlSfHqInfo */
3719 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
3720 /* Fill HqSz by using totalTbCnt based on the TM mode and
3721 * the number of serv cells configured*/
3723 pucchReqInfo->hqInfo.hqSz = ue->f1bCsAVal;
3724 pucchReqInfo->hqInfo.pucchResCnt = ue->f1bCsAVal;
3726 memset(pucchReqInfo->hqInfo.hqRes,0xff,sizeof(uint16_t)*TFU_MAX_HQ_RES);
3728 /* Two Resources needs to be configured if the
3729 * serving cell is in mimo mode else single
3731 if ((dlSf->relPdcch != NULLP) &&
3732 (RGSCH_TIMEINFO_SAME(recpReqInfo->timingInfo, ue->relPdcchFbkTiming)))
3733 {/* Pcell is having sps rel pdcch present */
3734 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
3735 {/* prim cell is in mimo mode, use 0 and 1 */
3736 pucchReqInfo->hqInfo.hqRes[0] = (dlSf->relPdcch->nCce +
3737 cell->pucchCfg.n1PucchAn);
3738 pucchReqInfo->hqInfo.hqRes[1] = pucchReqInfo->hqInfo.hqRes[0] + 1;
3743 pucchReqInfo->hqInfo.hqRes[2] = (dlSf->relPdcch->nCce +
3744 cell->pucchCfg.n1PucchAn);
3746 /* Release the pdcch so that it will not further processed */
3747 rgSCHUtlPdcchPut(ue->cell,&dlSf->pdcchInfo, dlSf->relPdcch);
3748 dlSf->relPdcch = NULLP;/* only one UE will be scheduled for release pdcch order in one tti */
3750 #endif/*LTEMAC_SPS*/
3751 #endif/*TFU_UPGRADE*/
3754 hqCb = (RgSchDlHqProcCb *)hqPNode->node;
3755 hqPNode = hqPNode->next;
3756 /* In case of CSI + 1BCS , CSI will be
3757 * dropped if scheduling is present on
3758 * seconday cell.36.213 10.1.1
3760 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
3762 isDatPresOnSecCell = TRUE;
3765 if ((hqCb->tbInfo[0].state == HQ_TB_WAITING) &&
3766 (hqCb->tbInfo[1].state == HQ_TB_WAITING))
3768 primCellTbCount = 2;
3771 primCellTbCount = 1;
3775 pucchReqInfo->t.nCce = hqCb->pdcch->nCce;
3778 switch(ue->f1bCsAVal)
3780 case RG_SCH_A_VAL_2:
3781 /* harq(0) is primary harq(1) is secondary) */
3782 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
3784 pucchReqInfo->hqInfo.hqRes[1] = ue->n1PucchF1bResCb.\
3785 cw1N1Res[hqCb->tpc].n1PucchIdx;
3787 else/* primary cell */
3790 /* Need to consider only sps occasions */
3791 if (hqCb->spsN1PucchRes.pres)
3793 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
3796 #endif /* LTEMAC_SPS */
3799 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
3800 cell->pucchCfg.n1PucchAn);
3804 case RG_SCH_A_VAL_3:
3805 /* Serving cell in mimo mode should be
3806 * in 0 and 1 and the serving cell in siso
3807 * mode should be in 2 indices */
3808 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
3810 uint8_t cellIdx = ue->cellIdToCellIdxMap[RG_SCH_CELLINDEX(hqCb->hqE->cell)];
3811 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[cellIdx]->txMode.txModeEnum) > 1)
3812 {/* Sec cell is in mimo mode, use 0 and 1 */
3813 pucchReqInfo->hqInfo.hqRes[0] =
3814 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
3816 pucchReqInfo->hqInfo.hqRes[1] =
3817 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
3820 {/* Sec cell is in siso mode, use 2 */
3821 pucchReqInfo->hqInfo.hqRes[2] =
3822 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
3826 {/* primary cell hq */
3827 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
3828 {/* prim cell is in mimo mode, use 0 and 1 */
3830 if (hqCb->spsN1PucchRes.pres)
3831 {/* SPS occasions */
3832 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
3833 pucchReqInfo->hqInfo.hqRes[1] = hqCb->spsN1PucchRes.val + 1;
3836 #endif /* LTEMAC_SPS */
3838 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
3839 cell->pucchCfg.n1PucchAn);
3840 pucchReqInfo->hqInfo.hqRes[1] = (hqCb->pdcch->nCce +
3841 cell->pucchCfg.n1PucchAn + 1);
3845 {/* prim cell is in siso mode use 2 */
3847 /* Need to consider only sps occasions */
3848 if (hqCb->spsN1PucchRes.pres)
3850 pucchReqInfo->hqInfo.hqRes[2] = hqCb->spsN1PucchRes.val;
3853 #endif /* LTEMAC_SPS */
3856 pucchReqInfo->hqInfo.hqRes[2] = (hqCb->pdcch->nCce +
3857 cell->pucchCfg.n1PucchAn);
3863 case RG_SCH_A_VAL_4:
3865 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
3866 {/* 2 and 3 for sec cell */
3867 pucchReqInfo->hqInfo.hqRes[2] =
3868 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
3869 pucchReqInfo->hqInfo.hqRes[3] =
3870 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
3872 else/* primary cell */
3873 {/* 0 and 1 are for primary cell */
3875 /* Need to consider only sps occasions */
3876 if (hqCb->spsN1PucchRes.pres)
3878 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
3879 pucchReqInfo->hqInfo.hqRes[1] = hqCb->spsN1PucchRes.val + 1;
3882 #endif /* LTEMAC_SPS */
3885 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
3886 cell->pucchCfg.n1PucchAn);
3887 pucchReqInfo->hqInfo.hqRes[1] = (hqCb->pdcch->nCce +
3888 cell->pucchCfg.n1PucchAn + 1);
3895 /* TOD:: Add error print */
3899 #endif/*TFU_UPGRADE*/
3910 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, ue,
3911 pucchRecpInfo, validIdx,isDatPresOnSecCell);
3913 /* Channel selection wil not be used in case of
3914 * CQI + HARQ. if the data was present only on
3916 if((isDatPresOnSecCell == FALSE) &&
3917 (dlSfHqInfo->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS))
3918 {/* Data is present only on primary cell */
3920 switch(pucchReqInfo->uciInfo)
3922 case TFU_PUCCH_HARQ_SRS:
3923 case TFU_PUCCH_HARQ_CQI:
3924 case TFU_PUCCH_HARQ_SR_SRS:
3925 case TFU_PUCCH_HARQ_SR_CQI:
3927 dlSfHqInfo->uciFrmtTyp = RG_SCH_UCI_FORMAT1A_1B;
3928 pucchReqInfo->hqInfo.hqSz = primCellTbCount;
3929 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
3938 #endif/*TFU_UPGRADE*/
3939 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
3940 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
3942 }/* end of rgSCHTomUtlFillHqFdbkForFrmt1B */
3943 /** @brief This function handles filling of Hq reception request to
3948 * Function:rgSCHTomUtlFillHqFdbkForFrmt3
3951 * Allocates the N1Pucch Resources based on teh A Value
3953 * @param [out] TfuRecpReqInfo *recpReqInfo
3954 * @param [in] RgSchCellCb *cell
3955 * @param [in] uint16_t validIdx,
3956 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
3957 * @param [in] RgSchDlSf *dlSf,
3958 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
3959 * @param [out] RgSchErrInfo *err
3966 static S16 rgSCHTomUtlFillHqFdbkForFrmt3
3968 TfuRecpReqInfo *recpReqInfo,
3971 RgSchDlHqInfo *dlSfHqInfo,
3973 TfuUeRecpReqInfo *pucchRecpInfo,
3977 static S16 rgSCHTomUtlFillHqFdbkForFrmt3
3979 TfuRecpReqInfo *recpReqInfo,
3981 RgSchDlHqInfo *dlSfHqInfo,
3983 TfuUeRecpReqInfo *pucchRecpInfo,
3989 Inst inst = cell->instIdx;
3994 TfuUePucchRecpReq *pucchReqInfo = NULLP;
3996 //hqPNode = dlSfHqInfo->hqPLst.first;
3997 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
4003 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4004 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
4007 DU_LOG("\nERROR --> SCH : Unable to Allocate "
4008 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId);
4009 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4012 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4013 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
4014 * instead of SPS-CRNTI */
4016 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
4019 pucchReqInfo->hqType = TFU_HQ_RECP_REQ_NORMAL;
4020 /* Handling of other types */
4021 pucchReqInfo->type = TFU_UCI_HARQ;
4022 #else /* TFU_UPGRADE */
4023 pucchReqInfo->uciInfo = TFU_PUCCH_HARQ;
4024 /* Fill hqFdbkMode by using uciFrmtTyp from dlSfHqInfo */
4025 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
4026 /* Fill HqSz by using totalTbCnt based on the TM mode and
4027 * the number of serv cells configured*/
4029 pucchReqInfo->hqInfo.hqSz = ue->f1bCsAVal;
4030 pucchReqInfo->hqInfo.pucchResCnt = 1;
4032 memset(pucchReqInfo->hqInfo.hqRes,0xff,sizeof(uint16_t)*TFU_MAX_HQ_RES);
4033 #endif/*TFU_UPGRADE*/
4034 pucchReqInfo->hqInfo.hqRes[0] = dlSfHqInfo->n3ScellPucch.n3PucchIdx;
4036 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, ue,
4037 pucchRecpInfo, validIdx,TRUE);
4038 #endif/*TFU_UPGRADE*/
4039 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4040 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4042 }/* end of rgSCHTomUtlFillHqFdbkForFrmt3 */
4046 /** @brief This function handles filling of HARQ feedback recption request to
4055 * @param [out] TfuRecpReqInfo *recpReqInfo
4056 * @param [in] RgSchCellCb *cell
4057 * @param [out] RgSchErrInfo *err
4063 static S16 rgSCHTomUtlFillHqFdbkRecpReq
4065 TfuRecpReqInfo *recpReqInfo,
4071 static S16 rgSCHTomUtlFillHqFdbkRecpReq
4073 TfuRecpReqInfo *recpReqInfo,
4080 RgSchDlHqProcCb *hqCb;
4081 CmLteTimingInfo futTime;
4084 TfuUeRecpReqInfo *pucchRecpInfo = NULLP;
4086 RgSchDlHqProcCb *prvHqCb=NULLP;
4093 /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper output
4094 * if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME() as it is
4095 * serving the purpose */
4096 RGSCHDECRFRMCRNTTIME(cell->crntTime, futTime, (RG_SCH_CMN_HARQ_INTERVAL -
4097 TFU_RECPREQ_DLDELTA));
4098 dlSf = rgSCHUtlSubFrmGet (cell, futTime);
4099 /* Get the next dlsf as well */
4100 RG_SCH_ADD_TO_CRNT_TIME(futTime, futTime, 1)
4101 nxtDlsf = rgSCHUtlSubFrmGet (cell, futTime);
4105 if (dlSf->ueLst.count != 0)
4107 node = dlSf->ueLst.first;
4110 ue = (RgSchUeCb *)(node->node);
4113 if(ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx].isPuschHarqRecpPres == TRUE)
4114 {/* This UE is already considered for PUSCH
4118 rgSCHTomUtlFillHqFdbkFor5gtf(recpReqInfo, cell, validIdx,
4119 &ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx], dlSf, pucchRecpInfo, err);
4120 } /* end of while */
4121 } /* If hq is expected */
4123 if (dlSf->msg4HqPLst.count != 0)
4126 node = dlSf->msg4HqPLst.first;
4129 hqCb = (RgSchDlHqProcCb*)(node->node);
4131 //TODO_SID: need to check validIdx
4132 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, validIdx, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err);
4134 } /* end of while */
4137 /* Check with TDD Code */
4138 /* FOR ACK NACK REP */
4140 } /* end of rgSCHTomUtlFillHqFdbkRecpReq */
4142 /** @brief This function handles filling of SR reception request to
4151 * @param [out] TfuRecpReqInfo *recpReqInfo
4152 * @param [in] RgSchCellCb *cell
4153 * @param [out] RgSchErrInfo *err
4159 static S16 rgSCHTomUtlFillSrRecpReq
4161 TfuRecpReqInfo *recpReqInfo,
4168 TfuUeRecpReqInfo *pucchRecpInfo;
4174 RgSchCmnUlUeSpsInfo *ulSpsUe = NULL;
4180 node = cell->pCqiSrsSrLst[validIdx].srLst.first;
4183 ue = (RgSchUeCb *)(node->node);
4184 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4190 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4191 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4193 DU_LOG("\nERROR --> SCH : Unable to Allocate TfuUeRecpReqInfo for cell RNTI:%d",ue->ueId);
4194 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4197 #ifdef TFU_ALLOC_EVENT_NO_INIT
4198 memset(&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4199 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4205 /* Should we check for Rel8 and above???
4206 * Dont send SR recp req if logicalChannelSR-Mask enabled and UL SPS is
4208 ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue, cell);
4209 /* Avoiding check for ulSpsEnabled as isUlSpsActv FALSE if sps is not enabled*/
4210 if((ue->ul.ulSpsCfg.isLcSRMaskEnab) &&
4211 (ulSpsUe->isUlSpsActv))
4213 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
4218 pucchRecpInfo->rnti = ue->ueId;
4219 pucchRecpInfo->t.pucchRecpReq.srInfo.n1PucchIdx =
4220 ue->srCb.srCfg.srSetup.srResIdx;
4221 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR;
4222 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
4223 rgSCHTomUtlFillCqiSrsWithSr(cell, ue, recpReqInfo,
4224 pucchRecpInfo, validIdx);
4226 isAddToLst = rgSCHEmtcAddRecpInfoToLst(NULLP,recpReqInfo, pucchRecpInfo,ue->isEmtcUe);
4230 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4232 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4235 }/* end of rgSCHTomUtlFillSrRecpReq */
4238 /** @brief This function tells will the UE has a periodic CQI/PMI/RI
4247 * @param [in] RgSchUeCb *ue
4248 * @param [out] Bool *willueRprtCqiRi
4254 static S16 rgSCHTomUtlWillUeRprtCqiRi
4257 Bool *willueRprtCqiRi
4260 /* Intialising Reporting probability as TRUE */
4261 *willueRprtCqiRi = TRUE;
4263 /* Checking the cases in which UE will not report CQIPMI/RI */
4264 if(ue->isDrxEnabled && ue->drxCb)
4267 if(ue->drxCb->cqiMask.pres && ue->drxCb->cqiMask.val == RGR_DRX_SETUP)
4268 {/*cqiMask is setup by upper layers */
4269 if((ue->drxCb->drxUlInactvMask & RG_SCH_DRX_ONDUR_BITMASK) ==
4270 RG_SCH_DRX_ONDUR_BITMASK)
4271 {/*onDuration NOT running, do not expect cqi/pmi/ri*/
4272 *willueRprtCqiRi = FALSE;
4276 #endif /*end of LTEMAC_R9*/
4277 /* ccpu00134258: Fix for CQI DRX issue*/
4278 if(ue->drxCb->onDurTmrLen > 2)
4280 if ( !RG_SCH_DRX_UL_IS_UE_ACTIVE(ue->drxCb) )
4281 {/*UE is not active, do not expect cqi/pmi/ri*/
4282 *willueRprtCqiRi = FALSE;
4285 }/*ue->isDrxEnabled*/
4287 } /*End of rgSCHTomUtlWillUeRprtCqiRi*/
4289 /** @brief This function handles filling of RI reception request to
4298 * @param [out] TfuRecpReqInfo *recpReqInfo
4299 * @param [in] RgSchCellCb *cell
4300 * @param [in] uint16_t validIdx
4301 * @param [out] RgSchErrInfo *err
4307 static S16 rgSCHTomUtlFillRiRecpReq
4309 TfuRecpReqInfo *recpReqInfo,
4316 TfuUeRecpReqInfo *pucchRecpInfo;
4319 Bool willUeRprtCqi; /* Flag set due to CQI Mask
4320 and UE inactive state (DRX) */
4321 RgSchUePCqiCb *riCb = NULLP;
4323 node = cell->pCqiSrsSrLst[validIdx].riLst.first;
4326 riCb = (RgSchUePCqiCb *)(node->node);
4327 ue = riCb->servCellInfo->ue;
4328 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4330 if(riCb->riRecpPrcsd)
4332 /*ccpu00140578:: RI Proecssing is already done for this TTI
4333 * as part of PUSCH reception process or HARQ
4334 * Reception processing. Hence skipping this UE
4336 riCb->riRecpPrcsd = FALSE;
4339 if(riCb->riDist ==0)
4341 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
4342 #ifdef XEON_SPECIFIC_CHANGES
4343 if(RGSCH_TIMEINFO_SAME(cell->crntTime, ue->riRecpTime))
4349 if((TRUE == riCb->isRiIgnoByCollsn)
4350 || (willUeRprtCqi == FALSE))
4352 if(willUeRprtCqi == FALSE)
4355 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
4358 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4359 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4361 DU_LOG("\nERROR --> SCH : Unable to Allocate "
4362 "TfuUeRecpReqInfo for cell RNTI:%d",ue->ueId);
4363 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4366 #ifdef TFU_ALLOC_EVENT_NO_INIT
4367 memset(&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4368 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4371 pucchRecpInfo->rnti = ue->ueId;
4372 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
4373 riCb->cqiCfg.cqiSetup.cqiPResIdx;
4374 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = riCb->riNumBits;
4375 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_CQI;
4376 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
4378 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
4379 riCb->servCellInfo->sCellIdx;
4381 rgSCHTomUtlFillRiBitWidthInfo(ue);
4382 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
4383 if (ue->nPCqiCb->nCqiTrIdx == validIdx)
4385 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, ue->nPCqiCb);
4387 if((ue->srsCb.nSrsTrIdx == validIdx) && (ue->srsCb.srsDist ==0))
4389 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
4391 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4392 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4400 }/* end of rgSCHTomUtlFillRiRecpReq */
4403 /** @brief This function handles filling of 5GTF CQI-RI reception request to
4412 * @param [out] TfuRecpReqInfo *recpReqInfo
4413 * @param [in] RgSchCellCb *cell
4414 * @param [in] uint16_t validIdx
4415 * @param [out] RgSchErrInfo *err
4422 static S16 rgSCHTomUtlFillCqiRiRecpReq
4424 TfuRecpReqInfo *recpReqInfo,
4430 TfuUeRecpReqInfo *pucchRecpInfo;
4431 RgSchUeCb *ue = NULLP;
4434 while ((ue = rgSCHDbmGetNextUeCb(cell, ue)) != NULLP)
4436 if (RGSCH_TIMEINFO_SAME (recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn))
4438 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4439 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4441 DU_LOG("\nERROR --> SCH : Unable to Allocate TfuUeRecpReqInfo for cell RNTI:%d ", ue->ueId);
4442 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4445 #ifdef TFU_ALLOC_EVENT_NO_INIT
4446 memset(&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4447 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4449 pucchRecpInfo->rnti = ue->ueId;
4450 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_XPUCCH_UCI_INFO;
4451 pucchRecpInfo->t.pucchRecpReq.uciPduInfo.pucchIndex = 0;
4452 pucchRecpInfo->t.pucchRecpReq.uciPduInfo.numBits = 5;
4454 RG_SCH_ADD_TO_CRNT_TIME(recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn,
4455 ue->ue5gtfCb.cqiRiPer);
4456 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4457 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4461 }/* end of rgSCHTomUtlFillCqiRiRecpReq */
4464 /** @brief This function handles filling of PCQI reception request to
4473 * @param [out] TfuRecpReqInfo *recpReqInfo
4474 * @param [in] RgSchCellCb *cell
4475 * @param [in] uint16_t validIdx
4476 * @param [out] RgSchErrInfo *err
4482 static S16 rgSCHTomUtlFillPcqiRecpReq
4484 TfuRecpReqInfo *recpReqInfo,
4491 TfuUeRecpReqInfo *pucchRecpInfo;
4494 uint8_t ri; /*RI value*/
4495 Bool willUeRprtCqi; /* Flag set due to CQI Mask and UE Inactive state (DRX)*/
4497 RgSchUePCqiCb *cqiCb = NULLP;
4498 Bool isAddToLst = FALSE;
4500 node = cell->pCqiSrsSrLst[validIdx].cqiLst.first;
4503 cqiCb = (RgSchUePCqiCb*)(node->node);
4504 ue = cqiCb->servCellInfo->ue;
4505 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4507 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
4509 if ((cqiCb->isCqiIgnoByCollsn == TRUE) ||
4510 (willUeRprtCqi == FALSE))
4512 if(willUeRprtCqi == FALSE)
4515 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
4519 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
4521 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
4522 cqiCb->servCellInfo->sCellIdx;
4524 cqiPmiSz = rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
4527 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to Fill CqiPmi size", ue->ueId);
4531 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4532 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4534 DU_LOG("\nERROR --> SCH : Unable to Allocate TfuUeRecpReqInfo for cell RNTI:%d ", ue->ueId);
4535 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4538 #ifdef TFU_ALLOC_EVENT_NO_INIT
4539 memset(&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4540 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4543 /*Fill PCQI params*/
4544 pucchRecpInfo->rnti = ue->ueId;
4545 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
4546 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
4547 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = cqiPmiSz;
4548 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_CQI;
4549 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
4550 if((ue->srsCb.nSrsTrIdx == validIdx) && (ue->srsCb.srsDist ==0))
4552 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
4555 isAddToLst = rgSCHEmtcAddRecpInfoToLst(NULLP,recpReqInfo, pucchRecpInfo,ue->isEmtcUe);
4559 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4561 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4564 }/* end of rgSCHTomUtlFillPcqiRecpReq */
4565 /** @brief This function handles filling of SRS reception request to
4574 * @param [out] TfuRecpReqInfo *recpReqInfo
4575 * @param [in] RgSchCellCb *cell
4576 * @param [in] uint16_t validIdx
4577 * @param [out] RgSchErrInfo *err
4582 static S16 rgSCHTomUtlFillSrsRecpReq
4584 TfuRecpReqInfo *recpReqInfo,
4591 TfuUeRecpReqInfo *pucchRecpInfo;
4595 node = cell->pCqiSrsSrLst[validIdx].srsLst.first;
4598 ue = (RgSchUeCb *)(node->node);
4599 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4601 if(ue->srsCb.srsRecpPrcsd)
4603 /* ccpu00140578::SRS Proecssing is already done for this TTI
4604 * as part of PUSCH or HARQ reception process and
4605 * hence skipping this UE */
4606 ue->srsCb.srsRecpPrcsd = FALSE;
4610 if(ue->srsCb.srsDist ==0)
4612 /* We need to add the recp request to be sent on the pucchANRep value. */
4613 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4614 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4616 DU_LOG("\nERROR --> SCH : Unable to Allocate TfuUeRecpReqInfo for RNTI:%d ",ue->ueId);
4617 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4621 #ifdef TFU_ALLOC_EVENT_NO_INIT
4622 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4626 pucchRecpInfo->rnti = ue->ueId;
4627 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
4628 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
4629 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
4630 ue->srsCb.srsCfg.srsSetup.fDomPosi;
4631 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
4632 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
4633 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
4634 ue->srsCb.srsCfg.srsSetup.txComb;
4635 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
4636 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
4637 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
4638 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
4640 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SRS;
4641 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
4642 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4643 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4647 ue->srsCb.srsDist--;
4651 }/* end of rgSCHTomUtlFillSrsRecpReq */
4654 /** @brief This function handles filling of data reception requests for
4663 * @param [out] TfuRecpReqInfo *recpReqInfo
4664 * @param [in] RgSchCellCb *cell
4665 * @param [out] RgSchErrInfo *err
4670 static S16 rgSCHTomUtlFillDatRecpReq
4672 TfuRecpReqInfo *recpReqInfo,
4678 RgSchUlAlloc *alloc;
4679 TfuUeRecpReqInfo *datRecpInfo;
4682 /* processing steps are
4683 * - Run through the UL allocations going out in this subframe.
4684 * - Run through the UL receptions expected the next subframe.
4686 alloc = rgSCHUtlFirstRcptnReq (cell);
4689 /* FOR ACK NACK REP */
4690 if (NULLP != alloc->ue)
4692 /* If measuring or ackNakRep we shall not send dat RecpReq */
4693 if ((alloc->ue->measGapCb.isMeasuring == TRUE) ||
4694 (alloc->ue->ackNakRepCb.isAckNakRep == TRUE))
4696 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
4701 if ((ret = rgSCHUtlGetEventMem((Ptr *)&datRecpInfo,
4702 sizeof(TfuUeRecpReqInfo),
4703 &(recpReqInfo->memCp))) != ROK)
4705 DU_LOG("\nERROR --> SCH : Unable to Allocate TfuUeRecpReqInfo for RNTI:%d ", alloc->ue->ueId);
4706 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4709 if (!alloc->forMsg3)
4711 datRecpInfo->type = TFU_RECP_REQ_PUSCH;
4712 rgSCHUtlAllocRcptInfo (alloc,
4714 &datRecpInfo->t.puschRecpReq.mcs,
4715 &datRecpInfo->t.puschRecpReq.rbStart,
4716 &datRecpInfo->t.puschRecpReq.numRb,
4717 &datRecpInfo->t.puschRecpReq.rv,
4718 &datRecpInfo->t.puschRecpReq.size,
4719 &datRecpInfo->t.puschRecpReq.modType,
4720 &datRecpInfo->t.puschRecpReq.isRtx,
4721 &datRecpInfo->t.puschRecpReq.nDmrs,
4722 &datRecpInfo->t.puschRecpReq.ndi,
4723 &datRecpInfo->t.puschRecpReq.harqProcId
4728 datRecpInfo->type = TFU_RECP_REQ_MSG3;
4729 rgSCHUtlAllocRcptInfo (alloc,
4731 &datRecpInfo->t.msg3RecpReq.mcs,
4732 &datRecpInfo->t.msg3RecpReq.rbStart,
4733 &datRecpInfo->t.msg3RecpReq.numRb,
4734 /*ccpu00128993 - MOD - fix for msg3 softcombining bug*/
4735 &datRecpInfo->t.msg3RecpReq.rv,
4736 &datRecpInfo->t.msg3RecpReq.size,
4737 &datRecpInfo->t.msg3RecpReq.modType,
4738 &datRecpInfo->t.msg3RecpReq.isRtx,
4739 &datRecpInfo->t.msg3RecpReq.nDmrs,
4740 &datRecpInfo->t.msg3RecpReq.ndi,
4741 &datRecpInfo->t.msg3RecpReq.harqProcId
4745 /* Other fields of datRecpInfo shall be filled
4746 * here for new features */
4747 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(datRecpInfo->lnk));
4748 datRecpInfo->lnk.node = (PTR)datRecpInfo;
4750 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
4751 } /* end of while */
4753 } /* end of rgSCHTomUtlFillDatRecpReq */
4756 /** @brief This function handles filling of data reception requests for
4765 * @param [out] TfuRecpReqInfo *recpReqInfo
4766 * @param [in] RgSchCellCb *cell
4767 * @param [in] uint16_t validIdx
4768 * @param [out] RgSchErrInfo *err
4773 static S16 rgSCHTomUtlFillDatRecpReq
4775 TfuRecpReqInfo *recpReqInfo,
4781 CmLteTimingInfo dci0Time;
4784 RgSchUlAlloc *alloc;
4785 TfuUeRecpReqInfo *datRecpInfo;
4787 Bool isAperiodic = FALSE; /*Set when Aperiodic CQI is expected */
4788 uint8_t numUePerTti = 0;
4790 if((0 == (recpReqInfo->timingInfo.sfn % 30)) && (0 == recpReqInfo->timingInfo.slot))
4792 //DU_LOG("\nERROR --> SCH : 5GTF_CHECK rgSCHTomUtlFillDatRecpReq (%d : %d)\n",\
4793 recpReqInfo->timingInfo.sfn, recpReqInfo->timingInfo.slot);
4795 /* processing steps are
4796 * - Run through the UL allocations going out in this subframe.
4797 * - Run through the UL receptions expected the next subframe.
4800 alloc = rgSCHUtlFirstRcptnReq (cell);
4803 isAperiodic = FALSE;
4804 ret = rgSCHUtlGetEventMem((Ptr *)&datRecpInfo,
4805 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
4808 DU_LOG("\nERROR --> SCH : Unable to Allocate "
4809 "TfuUeRecpReqInfo for RNTI:%d ", alloc->rnti);
4810 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4813 #ifdef TFU_ALLOC_EVENT_NO_INIT
4814 datRecpInfo->t.puschRecpReq.initialNSrs.pres = FALSE;
4815 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = FALSE;
4817 datRecpInfo->type = TFU_RECP_REQ_PUSCH;
4818 /* Check if this if for MSG3 - no scope for feedback along with it. */
4819 if ((FALSE == alloc->forMsg3))
4821 /* Check if any DL HARQ processes has a feedback coming at the time of
4822 * this reception request.
4827 RGSCHDECRFRMCRNTTIME(cell->crntTime,dci0Time,(RGSCH_ULCTRL_RECP_DIST));
4829 idx = (dci0Time.sfn * RGSCH_NUM_SUB_FRAMES_5G + dci0Time.slot)%
4830 RGSCH_ULCTRL_RECP_DIST;
4832 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA;
4833 datRecpInfo->rnti = alloc->rnti;
4834 rgSCHUtlAllocRcptInfo (cell,alloc, &recpReqInfo->timingInfo,
4835 &datRecpInfo->t.puschRecpReq.ulSchInfo);
4838 else /*Enters for Msg3 == TRUE condition*/
4840 /* ccpu00130884 - ADD - HO case when Msg3 alloc and Cqi/Ri/SRS opportunity
4841 * occur at same time */
4842 if(NULLP != alloc->ue)
4845 /* Only DATA is expected */
4846 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA;
4847 datRecpInfo->rnti = alloc->rnti;
4848 rgSCHUtlAllocRcptInfo (cell,alloc, &recpReqInfo->timingInfo,
4849 &datRecpInfo->t.puschRecpReq.ulSchInfo);
4854 if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA &&
4855 datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_SRS &&
4856 isAperiodic == FALSE)
4858 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = TRUE;
4859 datRecpInfo->t.puschRecpReq.initialNumRbs.val = alloc->ue->initNumRbs;
4863 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = FALSE;
4866 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(datRecpInfo->lnk));
4867 datRecpInfo->lnk.node = (PTR)datRecpInfo;
4868 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
4870 } /* end of while */
4872 if(numUePerTti && (numUePerTti < RG_MAX_NUM_UE_PER_TTI))
4874 cell->ulNumUeSchedPerTti[numUePerTti-1]++;
4875 gUlNumUePerTti[numUePerTti - 1]++;
4878 } /* end of rgSCHTomUtlFillDatRecpReq */
4880 /* rg009.201. Added changes of TFU_UPGRADE */
4882 /***********************************************************
4884 * Func : rgSCHTomUtlFillRiBitWidthInfo
4887 * Desc : Fills the RI BitWidth and stores it for decoding.
4896 **********************************************************/
4897 S16 rgSCHTomUtlFillRiBitWidthInfo
4902 RgSchUePCqiCb *riCb = ueCb->nPRiCb;
4904 if (ueCb->mimoInfo.txMode != RGR_UE_TM_3 &&
4905 ueCb->mimoInfo.txMode != RGR_UE_TM_4)
4910 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUCCH;
4911 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode=
4912 (TfuDlCqiPucchMode)riCb->cqiCfg.cqiSetup.prdModeEnum;
4913 switch(ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode)
4915 case TFU_PUCCH_CQI_MODE10:
4916 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info.type = TFU_RPT_RI;
4917 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info.u.ri =
4920 case TFU_PUCCH_CQI_MODE11:
4921 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info.type = TFU_RPT_RI;
4922 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info.u.ri =
4925 case TFU_PUCCH_CQI_MODE20:
4926 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info.type = TFU_RPT_RI;
4927 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info.u.ri =
4930 case TFU_PUCCH_CQI_MODE21:
4931 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info.type = TFU_RPT_RI;
4932 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info.u.ri =
4939 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
4943 /***********************************************************
4945 * Func : rgSCHTomUtlFetchPcqiBitSz
4948 * Desc : Fetch the CQI/PMI bits for a UE based on the mode, periodicity.
4957 **********************************************************/
4958 uint8_t rgSCHTomUtlFetchPcqiBitSz
4965 uint8_t confRepMode;
4967 TfuCqiPucchMode10 *mode10Info;
4968 TfuCqiPucchMode11 *mode11Info;
4969 TfuCqiPucchMode20 *mode20Info;
4970 TfuCqiPucchMode21 *mode21Info;
4971 RgSchUePCqiCb *cqiCb = ueCb->nPCqiCb;
4974 confRepMode = cqiCb->cqiCfg.cqiSetup.prdModeEnum;
4975 if((ueCb->mimoInfo.txMode != RGR_UE_TM_3) &&
4976 (ueCb->mimoInfo.txMode != RGR_UE_TM_4))
4982 *ri = cqiCb->perRiVal;
4984 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUCCH;
4985 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode=
4986 (TfuDlCqiPucchMode)confRepMode;
4989 case RGR_PRD_CQI_MOD10:
4991 mode10Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info;
4993 mode10Info->type = TFU_RPT_CQI;
4994 mode10Info->u.cqi = 4;
4998 case RGR_PRD_CQI_MOD11:
5000 mode11Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info;
5001 mode11Info->type = TFU_RPT_CQI;
5007 mode11Info->u.cqi.cqi = 4;
5008 mode11Info->u.cqi.wideDiffCqi.pres = FALSE;
5009 mode11Info->u.cqi.pmi = 2;
5014 mode11Info->u.cqi.cqi = 4;
5015 mode11Info->u.cqi.wideDiffCqi.pres = TRUE;
5016 mode11Info->u.cqi.wideDiffCqi.val = 3;
5017 mode11Info->u.cqi.pmi = 1;
5020 else if(numTxAnt == 4)
5025 mode11Info->u.cqi.cqi = 4;
5026 mode11Info->u.cqi.wideDiffCqi.pres = FALSE;
5027 mode11Info->u.cqi.pmi = 4;
5032 mode11Info->u.cqi.cqi = 4;
5033 mode11Info->u.cqi.wideDiffCqi.pres = TRUE;
5034 mode11Info->u.cqi.wideDiffCqi.val = 3;
5035 mode11Info->u.cqi.pmi = 4;
5040 /* This is number of antenna case 1.
5041 * This is not applicable for Mode 1-1.
5042 * So setting it to invalid value */
5048 case RGR_PRD_CQI_MOD20:
5050 mode20Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info;
5051 mode20Info->type = TFU_RPT_CQI;
5055 mode20Info->u.cqi.isWideband = TRUE;
5056 mode20Info->u.cqi.u.wideCqi = 4;
5060 pcqiSz = 4 + cqiCb->label;
5061 mode20Info->u.cqi.isWideband = FALSE;
5062 mode20Info->u.cqi.u.subCqi.cqi = 4;
5063 mode20Info->u.cqi.u.subCqi.l = cqiCb->label;
5068 case RGR_PRD_CQI_MOD21:
5070 mode21Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info;
5071 mode21Info->type = TFU_RPT_CQI;
5072 //pcqiSz = rgSCHTomUtlFetchPcqiBitSzPucchMode21(ueCb,
5073 // mode21Info, numTxAnt, ri);
5081 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5086 /***********************************************************
5088 * Func : rgSCHTomUtlPcqiSbCalcBpIdx
5091 * Desc : Determines the BP index from the timing info
5100 **********************************************************/
5101 S16 rgSCHTomUtlPcqiSbCalcBpIdx
5103 CmLteTimingInfo crntTimInfo,
5105 RgSchUePCqiCb *cqiCb
5108 uint16_t tti = (crntTimInfo.sfn * RGSCH_NUM_SUB_FRAMES_5G + crntTimInfo.slot);
5109 uint16_t prdNum = tti/cqiCb->cqiPeri;
5111 if((prdNum % cqiCb->h) == 0)
5115 cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_1;
5120 cqiCb->isWb = FALSE;
5121 cqiCb->bpIdx = ((prdNum % cqiCb->h) - 1) % cqiCb->J;
5123 cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_0;
5131 * @brief Function which moves PCQI, RI, SR and SRS to next periodicity
5132 * Occasions as that needs to be done in case of Ack/Nack repetition
5133 * reception request occasions or during Measurement Gap occasions.
5137 * Function: rgSCHTomUtlMoveNxtOccasion
5139 * Function which moves PCQI, RI, SR and SRS to next perodicity
5140 * Occasions as that needs to be done in case of Ack/Nack repetition
5141 * reception request occasions or during Measurement Gap occasions.
5143 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5146 * - Check whether the current Tx Instance matches with the rec req time
5147 * - If true, then move them to their next Tx Instance
5149 * @param[in] RgSchCellCb *cell,
5156 S16 rgSCHTomUtlMoveNxtOccasion
5163 RgSchUePCqiCb *cqiCb = ue->nPCqiCb;
5164 RgSchUePCqiCb *riCb = ue->nPRiCb;
5166 /* ccpu00140578::Skip the UE if already RI recpetion
5167 * is processed in the same subframe */
5168 if ((riCb->nRiTrIdx == validIdx) &&
5169 (riCb->riRecpPrcsd == FALSE))
5171 if(riCb->riDist ==0)
5173 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
5179 /* ccpu00140578:: As this UE is considered for this TTI
5180 * Same UE should not get processed for RI reception
5181 * or for updating th RI distance.*/
5182 if(riCb->nRiTrIdx == validIdx)
5184 riCb->riRecpPrcsd = TRUE;
5187 if (cqiCb->nCqiTrIdx == validIdx)
5189 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
5192 /* ccpu00140578::Skip the UE if SRS recpetion
5193 * is already processed in the same subframe */
5194 if ((ue->srsCb.nSrsTrIdx == validIdx) &&
5195 (ue->srsCb.srsRecpPrcsd == FALSE))
5197 if(ue->srsCb.srsDist ==0)
5199 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
5203 ue->srsCb.srsDist--;
5205 /* ccpu00140578:: As this UE is considered for this TTI
5206 * Same UE should not get processed for SRS reception
5207 * or for updating th SRS distance.*/
5208 if(ue->srsCb.nSrsTrIdx == validIdx)
5210 ue->srsCb.srsRecpPrcsd = TRUE;
5213 if (ue->srCb.nSrTrIdx == validIdx)
5215 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
5218 } /* rgSCHTomUtlMoveNxtOccasion */
5221 /***********************************************************
5223 * Func : rgSCHTomPrepareAcqiRecp
5226 * Desc : Fetch the CQI/PMI bits for a UE based on the mode and store them
5227 * for decoding. Fill RECP request and prepare the scartchpad
5228 * to aid decoding of Aperiodic CQI.
5237 **********************************************************/
5238 Void rgSCHTomPrepareAcqiRecp
5242 TfuUePuschCqiRecpInfo *cqiRecpReqInfo,
5246 uint8_t confRepMode;
5247 RgSchCqiRawPuschMode12 *mode12Info;
5248 RgSchCqiRawPuschMode20 *mode20Info;
5249 RgSchCqiRawPuschMode22 *mode22Info;
5250 RgSchCqiRawPuschMode30 *mode30Info;
5251 RgSchCqiRawPuschMode31 *mode31Info;
5252 uint8_t numTxAnt = cell->numTxAntPorts;
5253 uint8_t sCellIdx = ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)];
5254 uint8_t numOfCells = 0;
5255 RgSchUeACqiCb *acqiCb = &ueCb->cellInfo[sCellIdx]->acqiCb;
5258 cqiRecpReqInfo->reportType = TFU_APERIODIC_CQI_TYPE; /* Aperiodic */
5259 if (ueCb->mimoInfo.txMode == RGR_UE_TM_3 ||
5260 ueCb->mimoInfo.txMode == RGR_UE_TM_4)
5262 cqiRecpReqInfo->riSz[ccIdx].pres = TRUE;
5263 cqiRecpReqInfo->riSz[ccIdx].val = acqiCb->riNumBits;
5265 /* This flag will be rmeoved after making changes in BRDCM CL
5266 * Sachin is doing the change
5268 #if (defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
5270 cqiRecpReqInfo->cqiPmiSzR1[ccIdx] = acqiCb->cqiPmiSzR1;
5271 cqiRecpReqInfo->cqiPmiSzRn1[ccIdx] = acqiCb->cqiPmiSzRn1;
5273 if(ueCb->nPCqiCb->perRiVal == 1)
5275 cqiRecpReqInfo->cqiPmiSzR1[ccIdx] = acqiCb->cqiPmiSzR1;
5279 cqiRecpReqInfo->cqiPmiSzRn1[ccIdx] = acqiCb->cqiPmiSzRn1;
5282 /* Fill scratchpad to aid decoding of aper CQI upon
5284 confRepMode = acqiCb->aCqiCfg.aprdModeEnum;
5285 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUSCH;
5287 numOfCells = ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells;
5289 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5290 puschRawCqiInfo.mode = (TfuDlCqiPuschMode)confRepMode;
5292 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5293 puschRawCqiInfo.ri.pres = cqiRecpReqInfo->riSz[ccIdx].pres;
5295 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5296 puschRawCqiInfo.ri.val = cqiRecpReqInfo->riSz[ccIdx].val;
5298 /* Setting the sCellIdx */
5299 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5300 sCellIdx = sCellIdx;
5304 case RGR_APRD_CQI_MOD12:
5306 mode12Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5307 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode12Info;
5308 mode12Info->wideBCqiCw0 = 4;
5309 mode12Info->r1WideBCqiCw1 = 0;
5310 mode12Info->rg1WideBCqiCw1 = 4;
5313 mode12Info->r1TotalPmiBitLen = 2*acqiCb->N;
5314 mode12Info->rg1TotalPmiBitLen = acqiCb->N;
5316 else if(numTxAnt == 4)
5318 mode12Info->r1TotalPmiBitLen = 4*acqiCb->N;
5319 mode12Info->rg1TotalPmiBitLen = 4*acqiCb->N;
5324 case RGR_APRD_CQI_MOD20:
5326 mode20Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5327 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode20Info;
5328 mode20Info->wideBCqiCw = 4;
5329 mode20Info->subBandDiffCqi = 2;
5330 mode20Info->posOfM = acqiCb->L;
5334 case RGR_APRD_CQI_MOD22:
5336 mode22Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5337 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode22Info;
5338 mode22Info->wideBCqiCw0 = 4;
5339 mode22Info->sBDiffCqiCw0 = 2;
5340 mode22Info->r1WideBCqiCw1 = 0;
5341 mode22Info->r1SbDiffCqiCw1 = 0;
5342 mode22Info->rg1WideBCqiCw1 = 4;
5343 mode22Info->rg1SbDiffCqiCw1 = 2;
5344 mode22Info->posOfM = acqiCb->L;
5347 mode22Info->r1PmiBitLen = 4;
5348 mode22Info->rg1PmiBitLen = 2;
5350 else if(numTxAnt == 4)
5352 mode22Info->r1PmiBitLen = 8;
5353 mode22Info->rg1PmiBitLen = 8;
5358 case RGR_APRD_CQI_MOD30:
5360 mode30Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5361 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode30Info;
5362 mode30Info->wideBCqiCw = 4;
5363 mode30Info->totLenSbDiffCqi = 2*acqiCb->N;
5367 case RGR_APRD_CQI_MOD31:
5369 mode31Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5370 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode31Info;
5371 mode31Info->wideBCqiCw0 = 4;
5372 mode31Info->totLenSbDiffCqiCw0 = 2*acqiCb->N;
5373 mode31Info->r1WideBCqiCw1 = 0;
5374 mode31Info->r1TotLenSbDiffCqiCw1 =0;
5375 mode31Info->rg1WideBCqiCw1 = 4;
5376 mode31Info->rg1TotLenSbDiffCqiCw1 = 2*acqiCb->N;
5379 mode31Info->r1PmiBitLen = 2;
5380 mode31Info->rg1PmiBitLen = 1;
5382 else if(numTxAnt == 4)
5384 mode31Info->r1PmiBitLen = 4;
5385 mode31Info->rg1PmiBitLen = 4;
5396 * @brief Function which handles the filling of Aperiodic CQI/RI reception
5401 * Function: rgSCHTomUtlFillDatAperRecpReq
5403 * Function which handles the filling of Aperiodic CQI/RI reception
5406 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5409 * - Fill the reception request for the data arriving on the ULSCH
5410 * - Fill the reception request information for the Aperiodic CQI/PMI/RI
5412 * @param[in] RgSchCellCb *cell,
5413 * RgSchUlAlloc *alloc,
5414 * TfuUeRecpReqInfo *datRecpInfo,
5415 * CmLteTimingInfo *timeInfo,
5421 S16 rgSCHTomUtlFillDatAperRecpReq
5425 RgSchUlAlloc *alloc,
5426 TfuUeRecpReqInfo *datRecpInfo,
5427 CmLteTimingInfo *timeInfo,
5432 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
5433 RgSchUeCb *ueCb = alloc->ue;
5435 uint8_t triggerSet = 0;
5439 /*Fill RI Reception Params*/
5440 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
5441 cqiRecpReqInfo->riBetaOff = alloc->ue->ul.betaRiOffst;
5442 cqiRecpReqInfo->cqiBetaOff = alloc->ue->ul.betaCqiOffst;
5445 cqiRecpReqInfo->cCNum = 0;
5446 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells = 0;
5449 rgSCHTomUtlGetTrigSet(cell, ueCb, cqiReq, &triggerSet);
5450 for (sIdx = 0; sIdx < CM_LTE_MAX_CELLS; sIdx++)
5452 /* The Aperiodic request for SCell index sIdx */
5453 if ((triggerSet >> (7 - sIdx)) & 0x01)
5455 /* The Aperiodic request for SCell index sIdx */
5456 rgSCHTomPrepareAcqiRecp(ueCb, ueCb->cellInfo[sIdx]->cell, cqiRecpReqInfo, cqiRecpReqInfo->cCNum);
5457 cqiRecpReqInfo->cCNum++;
5458 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells++;
5462 rgSCHTomPrepareAcqiRecp(ueCb, ueCb->cellInfo[0]->cell, cqiRecpReqInfo, cqiRecpReqInfo->cCNum);
5463 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells++;
5466 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5468 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
5470 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
5471 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
5475 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
5477 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
5481 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
5483 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
5485 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
5487 datRecpInfo->rnti = alloc->rnti;
5488 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
5489 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5491 } /* rgSCHTomUtlFillDatAperRecpReq */
5496 * @brief Function which handles the filling of Periodic RI reception
5497 * request values which arrives along with UL Data on ULSCH
5501 * Function: rgSCHTomUtlFillDatPriRecpReq
5503 * Function which handles the filling of Periodic RI reception
5504 * request values which arrives along with UL Data on ULSCH
5506 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5509 * - Fill the reception request for the data arriving on the ULSCH
5510 * - Fill the reception request information for the Periodic RI
5512 * @param[in] RgSchCellCb *cell,
5513 * RgSchUlAlloc *alloc,
5514 * TfuUeRecpReqInfo *datRecpInfo,
5515 * CmLteTimingInfo *timeInfo,
5521 S16 rgSCHTomUtlFillDatPriRecpReq
5524 RgSchUlAlloc *alloc,
5525 TfuUeRecpReqInfo *datRecpInfo,
5526 CmLteTimingInfo *timeInfo,
5531 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
5533 /*Fill RI Reception Params*/
5534 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
5535 #ifdef TFU_ALLOC_EVENT_NO_INIT
5536 cqiRecpReqInfo->cqiBetaOff = 0;
5537 /* Fill only the first RI index since Periodic can come
5539 cqiRecpReqInfo->cqiPmiSzR1[0] = 0;
5540 cqiRecpReqInfo->cqiPmiSzRn1[0] = 0;
5542 cqiRecpReqInfo->reportType = TFU_PERIODIC_CQI_TYPE; /* periodic */
5543 cqiRecpReqInfo->riBetaOff = alloc->ue->ul.betaRiOffst;
5545 /* Fill only the first RI index since Periodic can come
5547 cqiRecpReqInfo->cCNum = 1;
5548 cqiRecpReqInfo->riSz[0].pres = TRUE;
5549 cqiRecpReqInfo->riSz[0].val = alloc->ue->nPRiCb->riNumBits;
5551 rgSCHTomUtlFillRiBitWidthInfo(alloc->ue);
5552 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
5554 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
5555 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
5559 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
5561 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
5565 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
5567 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
5569 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
5571 datRecpInfo->rnti = alloc->rnti;
5572 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
5573 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5575 } /* rgSCHTomUtlFillDatPriRecpReq */
5579 * @brief Function which handles the filling of Periodic CQI/PMI reception
5580 * request values which arrives along with UL Data on ULSCH
5584 * Function: rgSCHTomUtlFillDatPCqiRecpReq
5586 * Function which handles the filling of Periodic CQI/PMI reception
5587 * request values which arrives along with UL Data on ULSCH
5589 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5592 * - Fill the reception request for the data arriving on the ULSCH
5593 * - Fill the reception request information for the Periodic CQI/PMI
5595 * @param[in] RgSchCellCb *cell,
5596 * RgSchUlAlloc *alloc,
5597 * TfuUeRecpReqInfo *datRecpInfo,
5598 * CmLteTimingInfo *timeInfo,
5605 S16 rgSCHTomUtlFillDatPCqiRecpReq
5608 RgSchUlAlloc *alloc,
5609 TfuUeRecpReqInfo *datRecpInfo,
5610 CmLteTimingInfo *timeInfo,
5615 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
5616 uint8_t cqiPmiSz; /*Raw CQI/PMI Size*/
5619 /*Fill CQI Reception Params*/
5620 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
5621 #ifdef TFU_ALLOC_EVENT_NO_INIT
5622 cqiRecpReqInfo->riBetaOff = 0;
5624 cqiRecpReqInfo->cqiBetaOff = alloc->ue->ul.betaCqiOffst;
5625 cqiPmiSz = rgSCHTomUtlFetchPcqiBitSz(alloc->ue, cell->numTxAntPorts, &ri);
5628 DU_LOG("\nERROR --> SCH : Unable to Fill "
5629 "CqiPmi size RNTI:%d",alloc->rnti);
5633 /* Fill only the first RI index since Periodic can come
5635 cqiRecpReqInfo->cCNum = 1;
5636 cqiRecpReqInfo->reportType = TFU_PERIODIC_CQI_TYPE; /* Periodic */
5637 /* This flags will be removed once Sachin does changes
5639 #if (defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
5640 cqiRecpReqInfo->cqiPmiSzR1[0] = cqiPmiSz;
5641 cqiRecpReqInfo->cqiPmiSzRn1[0] = cqiPmiSz;
5645 cqiRecpReqInfo->cqiPmiSzR1[0] = cqiPmiSz;
5646 cqiRecpReqInfo->cqiPmiSzRn1[0] = 0;
5650 cqiRecpReqInfo->cqiPmiSzRn1[0] = cqiPmiSz;
5651 cqiRecpReqInfo->cqiPmiSzR1[0] = 0;
5654 cqiRecpReqInfo->riSz[0].pres = FALSE;
5656 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
5658 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
5659 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
5662 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
5664 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
5668 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
5670 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
5672 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
5674 datRecpInfo->rnti = alloc->rnti;
5675 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
5676 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5678 } /* rgSCHTomUtlFillDatPCqiRecpReq */
5681 * @brief Function which handles the filling of SRS reception
5682 * request values which arrives along with UL Data on ULSCH
5686 * Function: rgSCHTomUtlFillDatSrsRecpReq
5688 * Function which handles the filling of SRS reception
5689 * request values which arrives along with UL Data on ULSCH
5691 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5694 * - Fill the reception request for the data arriving on the ULSCH
5695 * - Fill the reception request information for the SRS
5697 * @param[in] RgSchCellCb *cell,
5698 * RgSchUlAlloc *alloc,
5699 * TfuUeRecpReqInfo *datRecpInfo,
5700 * CmLteTimingInfo *timeInfo,
5706 S16 rgSCHTomUtlFillDatSrsRecpReq
5709 RgSchUlAlloc *alloc,
5710 TfuUeRecpReqInfo *datRecpInfo,
5711 CmLteTimingInfo *timeInfo,
5715 datRecpInfo->rnti = alloc->rnti;
5716 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
5719 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_HARQ_SRS;
5723 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_SRS;
5725 datRecpInfo->rnti = alloc->rnti;
5726 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
5727 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5729 } /* rgSCHTomUtlFillDatSrsRecpReq */
5732 * @brief Function which handles the filling of only SRS reception
5733 * request values on ULSCH
5737 * Function: rgSCHTomFillOnlySrsRecpReq
5739 * Function which handles the filling of SRS reception
5740 * request values which arrives along with UL Data on ULSCH
5742 * Invoked by: rgSCHTomUtlFillDatSrsRecpReq of rg_sch_tom.c
5745 * - Fill the reception request for the data arriving on the ULSCH
5746 * - Fill the reception request information for the SRS
5748 * @param[in] RgSchCellCb *cell,
5749 * RgSchUlAlloc *alloc,
5750 * TfuUeRecpReqInfo *datRecpInfo,
5755 S16 rgSCHTomFillOnlySrsRecpReq
5758 RgSchUlAlloc *alloc,
5759 TfuUeRecpReqInfo *datRecpInfo
5762 TfuUePuschSrsRecpInfo *srsRecpReqInfo;
5764 srsRecpReqInfo = &datRecpInfo->t.puschRecpReq.srsInfo;
5765 srsRecpReqInfo->srsBw = (TfuUlSrsBwInfo)alloc->ue->srsCb.srsCfg.srsSetup.srsBw;
5766 srsRecpReqInfo->nRrc = alloc->ue->srsCb.srsCfg.srsSetup.fDomPosi;
5767 srsRecpReqInfo->srsHopBw = (TfuUlSrsHoBwInfo)alloc->ue->srsCb.srsCfg.srsSetup.srsHopBw;
5768 srsRecpReqInfo->transComb = alloc->ue->srsCb.srsCfg.srsSetup.txComb;
5769 srsRecpReqInfo->srsCfgIdx = alloc->ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
5770 srsRecpReqInfo->srsCyclicShft = (TfuUlSrsCycShiftInfo)alloc->ue->srsCb.srsCfg.srsSetup.cycShift;
5772 /* ccpu00117050 - ADD - nSrs setting
5773 * Refer Section 5.2.2.6 of TS 36.212 V8.5.0*/
5774 datRecpInfo->t.puschRecpReq.ulSchInfo.nSrs = 1;
5777 } /* rgSCHTomFillOnlySrsRecpReq */
5780 * @brief Function which handles the filling of PCQI/RI, SRS and SR
5781 * Reception Request Information along
5782 * with the HARQ reception Request
5786 * Function: rgSCHTomUtlFillCqiSrSrsWithHq
5788 * Function which handles the filling of PCQI/RI, SRS ans SR
5789 * Reception Request Information along
5790 * with the HARQ reception Request
5793 * Invoked by: rgSCHTomUtlFillHqFdbkRecpReq &
5794 * rgSCHTomUtlFillSfHqFdbk of rg_sch_tom.c
5797 * - Fill the reception request for the Control Info arriving on the PUCCH
5798 * - Fill the reception request information for the SR, RI, CQI, SRS
5800 * @param[in] RgSchCellCb *cell,
5801 * TfuRecpReqInfo *recpReqInfo,
5802 * RgSchDlHqProcCb *hqCb,
5803 * @param[out] TfuUeRecpReqInfo *pucchRecpInfo
5804 * @param[in] uint16_t validIdx
5809 static S16 rgSCHTomUtlFillCqiSrSrsWithHq
5812 TfuRecpReqInfo *recpReqInfo,
5814 TfuUeRecpReqInfo *pucchRecpInfo,
5816 Bool isDatPresOnSecCell
5819 RgSchUePCqiCb *cqiCb;
5820 RgSchUePCqiCb *riCb;
5821 uint8_t ri; /*To fetch RI value*/
5822 Bool willUeRprtCqi; /* Flag set due to CQI Mask and UE Inactive state (DRX)*/
5823 Bool willUeRprtSr = TRUE;
5824 TfuAckNackMode hqFdbkMode;
5826 uint8_t totalPucchBits;
5827 Bool dropCqi = FALSE;
5829 RgSchCmnUlUeSpsInfo *ulSpsUe = NULL;
5832 RgSchEmtcUeInfo *emtcUe = NULLP;
5837 /*Changes for PUCCH Format3 */
5838 hqFdbkMode = pucchRecpInfo->t.pucchRecpReq.hqInfo.hqFdbkMode;
5839 numCqiBit = rgSCHCmnCalcPcqiBitSz (ue,cell->numTxAntPorts);
5840 totalPucchBits = pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz + numCqiBit;
5843 emtcUe = RG_GET_EMTC_UE_CB(ue);
5845 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
5846 #ifdef EMTC_ENABLE /*VINU*/
5849 if((emtcUe->pucchRepNumFr1 > 1) || (emtcUe->pucchRepNumFr2 > 1))
5851 willUeRprtCqi = FALSE;
5852 willUeRprtSr = FALSE;
5856 if(ue->srCb.nSrTrIdx == validIdx)
5860 /* Should we check for Rel8 and above???
5861 * Dont send SR recp req if logicalChannelSR-Mask enabled and UL SPS is
5863 ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue, cell);
5864 /* Avoiding check for ulSpsEnabled as isUlSpsActv FALSE if sps is not enabled*/
5865 if(!((ue->ul.ulSpsCfg.isLcSRMaskEnab) &&
5866 (ulSpsUe->isUlSpsActv)))
5873 pucchRecpInfo->t.pucchRecpReq.srInfo.n1PucchIdx =
5874 ue->srCb.srCfg.srSetup.srResIdx;
5875 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
5876 /* FORMAT3: If SR is present it will be appended after HARQ */
5877 totalPucchBits = totalPucchBits + 1;
5884 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
5886 /* LTE_ADV:: UE will drop CSI during CSI+1BCS if data is present
5887 * on sec cell(isDatPresOnSecCell)*/
5889 if (hqFdbkMode == TFU_ACK_NACK_CHANNEL_SELECTION)
5891 if (hqFdbkMode == TFU_UCI_FORMAT_1B_CS)
5894 if (isDatPresOnSecCell == TRUE)
5901 /* Format 3 Changes : If Hq + SR + CQI bits < 22 and simultaneousAckNackAndCQI-Format3
5902 is enabled then CQI will be multiplexed with HQ otherwise CQI will be dropped
5903 Spec 36.213 Sec 10.1.1 */
5904 else if (hqFdbkMode == TFU_UCI_FORMAT_3)
5906 if ((isDatPresOnSecCell == TRUE) &&
5907 ((!ue->simulAckNackCQIFormat3) || (totalPucchBits > 22)))
5915 cqiCb = ue->nPCqiCb;
5916 if(riCb->nRiTrIdx == validIdx)
5918 /*ccpu00140578:: Skip the UE if the RI is already processed
5920 if(riCb->riRecpPrcsd == FALSE)
5922 if(riCb->riDist == 0)
5924 if((riCb->cqiCfg.cqiSetup.sANCQI == TRUE) && (willUeRprtCqi == TRUE)&&
5925 (isDatPresOnSecCell == FALSE))
5928 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
5929 riCb->cqiCfg.cqiSetup.cqiPResIdx;
5930 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
5932 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_HARQ_SR)
5934 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI;
5938 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_CQI;
5940 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
5942 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
5943 ue->nPRiCb->servCellInfo->sCellIdx;
5945 rgSCHTomUtlFillRiBitWidthInfo(ue);
5946 if (ue->nPCqiCb->nCqiTrIdx == validIdx)
5948 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, ue->nPCqiCb);
5963 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
5969 /* Skip the UE for RI processing on PUCCH
5970 * in the same subframe as it already processed */
5971 if(riCb->nRiTrIdx == validIdx)
5973 /* As the new idx is same is current idx
5974 * then PUCCH reception processing will consider
5975 * RI also in the same subframe. To block this
5976 * below flag is used*/
5977 riCb->riRecpPrcsd = TRUE;
5981 else if(cqiCb->nCqiTrIdx == validIdx)
5983 if((cqiCb->cqiCfg.cqiSetup.sANCQI == TRUE) && (willUeRprtCqi == TRUE)&&
5984 (isDatPresOnSecCell == FALSE))
5987 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
5988 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
5990 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
5992 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
5993 cqiCb->servCellInfo->sCellIdx;
5995 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
5996 rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
5997 if(0 == pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz)
5999 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to Fill CqiPmi size", ue->ueId);
6002 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_HARQ_SR)
6004 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI;
6008 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_CQI;
6021 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6023 if(ue->srsCb.nSrsTrIdx == validIdx)
6025 /* ccpu00140578::Skip the UE for SRS reception processing
6026 * if already done as part of PUSCH recpetion
6028 if(ue->srsCb.srsRecpPrcsd == FALSE)
6030 if(ue->srsCb.srsDist ==0 )
6032 if((pucchRecpInfo->t.pucchRecpReq.uciInfo != TFU_PUCCH_HARQ_CQI)
6033 && (ue->srsCb.srsCfg.srsSetup.sANSrs)
6034 && (isDatPresOnSecCell == FALSE))
6037 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
6038 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
6039 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
6040 ue->srsCb.srsCfg.srsSetup.fDomPosi;
6041 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
6042 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
6043 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
6044 ue->srsCb.srsCfg.srsSetup.txComb;
6045 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
6046 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6047 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
6048 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
6049 /* ccpu00116923 - ADD - New Reception Request types for CQI and SRS with SR */
6050 switch(pucchRecpInfo->t.pucchRecpReq.uciInfo)
6052 case TFU_PUCCH_HARQ_SR:
6053 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_SRS;
6055 case TFU_PUCCH_HARQ_SR_CQI:
6056 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI_SRS;
6059 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SRS;
6063 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
6067 ue->srsCb.srsDist--;
6069 /* Skip the UE for SRS processing on PUCCH
6070 * in the same subframe as it already processed */
6071 if(ue->srsCb.nSrsTrIdx == validIdx)
6073 /* As the new idx is same is current idx
6074 * then PUCCH reception processing will consider
6075 * SRS also in the same subframe. To block this
6076 * below flag is used*/
6077 ue->srsCb.srsRecpPrcsd = TRUE;
6085 } /* rgSCHTomUtlFillCqiSrSrsWithHq */
6088 * @brief Function which handles the filling of PCQI/RI, SRS
6089 * Reception Request Information along with SR reception
6094 * Function: rgSCHTomUtlFillCqiSrsWithSr
6096 * Function which handles the filling of PCQI/RI, SRS
6097 * Reception Request Information along
6098 * with the SR reception Request
6101 * Invoked by: rgSCHTomUtlFillSrRecpReq of rg_sch_tom.c
6104 * - Fill the reception request for CQI/RI, SRS if they occur
6105 * in the same instance as of SR.
6107 * @param[in] RgSchCellCb *cell,
6109 * TfuRecpReqInfo *recpReqInfo,
6110 * @param[out] TfuUeRecpReqInfo *pucchRecpInfo
6111 * @param[in] uint16_t validIdx
6117 static S16 rgSCHTomUtlFillCqiSrsWithSr
6121 TfuRecpReqInfo *recpReqInfo,
6122 TfuUeRecpReqInfo *pucchRecpInfo,
6126 RgSchUePCqiCb *cqiCb;
6127 RgSchUePCqiCb *riCb;
6128 uint8_t ri; /*To fetch RI value*/
6129 Bool willUeRprtCqi; /* Flag set due to CQI Mask and
6130 UE Inactive state (DRX)*/
6132 cqiCb = ue->nPCqiCb;
6133 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
6135 rgSCHEmtcWillUeRptCqi(ue, &willUeRprtCqi);
6137 if(riCb->nRiTrIdx == validIdx)
6139 /*ccpu00140578:: Skip the UE if the RI is already processed
6141 if(riCb->riRecpPrcsd == FALSE)
6143 if(riCb->riDist == 0)
6145 if(willUeRprtCqi == TRUE)
6148 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6149 riCb->cqiCfg.cqiSetup.cqiPResIdx;
6150 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6153 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI;
6154 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6156 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6157 ue->nPRiCb->servCellInfo->sCellIdx;
6159 rgSCHTomUtlFillRiBitWidthInfo(ue);
6160 /* TODO:: syed Shouldn't this be done outside this if condition */
6161 if (cqiCb->nCqiTrIdx == validIdx)
6163 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6166 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
6172 if(riCb->nRiTrIdx == validIdx)
6173 {/* Need to skip this UE during PUCCH RI recpetion process
6174 in the current subframe */
6175 riCb->riRecpPrcsd = TRUE;
6179 else if(cqiCb->nCqiTrIdx == validIdx)
6181 if(willUeRprtCqi == TRUE)
6184 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6185 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
6187 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6190 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6191 cqiCb->servCellInfo->sCellIdx;
6193 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6194 rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
6195 if(0 == pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz)
6197 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to Fill CqiPmi size", ue->ueId);
6201 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI;
6203 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6205 if(ue->srsCb.nSrsTrIdx == validIdx)
6207 /* ccpu00140578:: Cnsider the SRS processing
6208 * only if not done in the same TTI
6209 * as part of PUSCH or HARQ reception process*/
6210 if(ue->srsCb.srsRecpPrcsd == FALSE)
6212 if(ue->srsCb.srsDist ==0 )
6214 if(ue->srsCb.srsCfg.srsSetup.sANSrs)
6217 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
6218 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
6219 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
6220 ue->srsCb.srsCfg.srsSetup.fDomPosi;
6221 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
6222 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
6223 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
6224 ue->srsCb.srsCfg.srsSetup.txComb;
6225 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
6226 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6227 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
6228 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
6229 /* ccpu00116923 - ADD - New Reception Request types for CQI and
6231 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_SR_CQI)
6233 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI_SRS;
6237 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_SRS;
6241 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
6245 ue->srsCb.srsDist--;
6247 /* Skip the UE for SRS processing on PUCCH
6248 * in the same subframe as it already processed */
6249 if(ue->srsCb.nSrsTrIdx == validIdx)
6251 /* As the new idx is same is current idx
6252 * then PUCCH reception processing will consider
6253 * SRS also in the same subframe. To block this
6254 * below flag is used*/
6255 ue->srsCb.srsRecpPrcsd = TRUE;
6261 } /* rgSCHTomUtlFillCqiSrsWithSr */
6267 /** @brief This function handles filling of HARQ feedback repetition
6268 * recption request for each subframe
6272 * Function: rgSCHTomUtlFillSfRepHqFdbk
6276 * @param [out] TfuRecpReqInfo *recpReqInfo
6277 * @param [in] RgSchCellCb *cell
6278 * @param [out] RgSchErrInfo *err
6279 * @param [in] RgSchDlSf *dlSf
6280 * @param [in] uint8_t noFdbks
6281 * @param [in] CmMemListCp *memCp
6282 * @param [in] uint8_t elemIdx
6283 * @param [in] RgSchDlSf *nxtDlsf
6289 static S16 rgSCHTomUtlFillSfRepHqFdbk
6291 TfuRecpReqInfo *recpReqInfo,
6292 RgSchCellCb *cellCb,
6302 static S16 rgSCHTomUtlFillSfRepHqFdbk
6304 TfuRecpReqInfo *recpReqInfo,
6305 RgSchCellCb *cellCb,
6315 RgSchDlHqProcCb *hqCb;
6319 TfuUeRecpReqInfo *pucchRecpInfo;
6321 TfuUePucchHqRecpInfo *hqRecpReq;
6323 RgSchDlHqTbCb *tbCb;
6324 RgSchDlHqProcCb *prvHqCb = NULLP;
6326 node = dlSf->ackNakRepQ.first;
6329 tbCb = (RgSchDlHqTbCb *)(node->node);
6331 ueCb = hqCb->hqE->ue;
6333 if (--tbCb->fbkRecpRepCntr)
6335 /* Add to next subfarme */
6336 /* Add this hqCb to the next dlSf's ackNakRepQ */
6337 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
6338 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
6339 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
6340 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
6347 /* Go to the next node */
6352 if ((hqCb->hqE->ue != NULLP) &&
6353 (hqCb->hqE->ue->measGapCb.isMeasuring != TRUE)
6354 && (hqCb != prvHqCb)
6357 /* We need to add the recp request to be sent on the pucchANRep
6360 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
6361 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
6364 DU_LOG("\nERROR --> SCH : Unable to"
6365 "Allocate TfuUeRecpReqInfo for RNTI:%d ", ueCb->ueId);
6366 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
6369 pucchRecpInfo->rnti = ueCb->ueId;
6371 pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
6373 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
6376 /* FOR repetition Feedback shall come on n1PucchAnRep Configured per
6380 pucchRecpInfo->t.pucchRecpReq.hqType = TFU_HQ_RECP_REQ_N1PUCCH;
6381 pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = ueCb->ackNakRepCb.pucchRes;
6383 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
6384 hqRecpReq = &(pucchRecpInfo->t.pucchRecpReq.hqInfo);
6385 /* ACK NACK rep works only in bundling mode . */
6386 hqRecpReq->hqFdbkMode = (TfuAckNackMode)RGR_TDD_ACKNACK_MODE_BUNDL;
6387 if ((hqCb->hqPSfLnk.node != NULLP) &&
6388 (hqCb->hqPSfLnk.node != NULLP))
6391 hqRecpReq->hqSz = 2;
6395 hqRecpReq->hqSz = 1;
6397 hqRecpReq->pucchResCnt = 1;
6398 hqRecpReq->hqRes[0] = ueCb->ackNakRepCb.pucchRes;
6400 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
6401 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
6403 /* In a given dlSf, if there is 2 TBs context
6404 * stored for a given harq, then they are added
6405 * adjacent to each other in the subframe. To avoid
6406 * adding duplicate recpnInfo for each TB, store this
6407 * hqCb in prvHqCb. If nextHqCb is same as prvHqCb then
6408 * do not add reception req info.*/
6411 RGSCH_NULL_CHECK(cellCb->instIdx, hqCb->hqE->ue);
6412 rgSCHTomUtlMoveNxtOccasion(cellCb, hqCb->hqE->ue, validIdx);
6414 /* Go to the next node */
6420 /** @brief This function handles filling of HARQ feedback recption request
6425 * Function: rgSCHTomUtlFillSfHqFdbkInfo
6429 * @param [out] TfuRecpReqInfo *recpReqInfo
6430 * @param [in] RgSchCellCb *cell
6431 * @param [out] RgSchErrInfo *err
6432 * @param [in] RgSchDlSf *dlSf
6433 * @param [in] uint8_t noFdbks
6434 * @param [in] CmMemListCp *memCp
6435 * @param [in] uint8_t elemIdx
6436 * @param [in] RgSchDlSf *nxtDlsf
6437 * @param [in] uint16_t validIdx;
6443 static S16 rgSCHTomUtlFillSfHqFdbkInfo
6445 TfuRecpReqInfo *recpReqInfo,
6446 RgSchCellCb *cellCb,
6454 RgSchDlHqProcCb *hqCb,
6455 RgSchUePucchRecpInfo *pucchInfo,
6457 RgSchDlHqProcCb *prvHqCb
6460 static S16 rgSCHTomUtlFillSfHqFdbkInfo
6462 TfuRecpReqInfo *recpReqInfo,
6463 RgSchCellCb *cellCb,
6470 RgSchDlHqProcCb *hqCb,
6471 RgSchUePucchRecpInfo *pucchInfo,
6473 RgSchDlHqProcCb *prvHqCb
6478 RgSchUeCb *ueCb = hqCb->hqE->ue;
6480 CmLteTimingInfo futTime;
6481 RgSchTddANInfo *anInfo;
6484 RgrTddAckNackMode ackNackMode;
6485 RgSchDlHqTbCb *tbCb;
6491 RG_SCH_ADD_TO_CRNT_TIME(cellCb->crntTime, futTime, TFU_RECPREQ_DLDELTA);
6495 for (idx = 0 ;idx < 2; idx++)
6497 if (HQ_TB_WAITING == hqCb->tbInfo[idx].state)
6500 tbCb = &hqCb->tbInfo[idx];
6504 ackNackMode = ueCb->dl.ackNackMode;
6506 if(ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL)
6508 anInfo = rgSCHUtlGetUeANFdbkInfo(ueCb, &futTime);
6509 /* Only the last scheduled TB for the UE is for HARQ
6510 * ACK/NACK reception in Bundling case */
6511 if((anInfo == NULLP) ||
6512 (anInfo->latestMIdx != dlSf->dlFdbkInfo.m))
6519 /* Get the TFU reception request pointer, if present */
6520 cmHashListFind(&cellCb->ueTfuPendLst, (uint8_t*) &ueCb->ueId,
6521 sizeof(ueCb->ueId), 0, (PTR *) &pucchInfo);
6524 /* For upgrade we shall use the existing logic of pending list. */
6525 cmHashListFind(&cellCb->ueTfuPendLst, (uint8_t*) &ueCb->ueId,
6526 sizeof(ueCb->ueId), 0, (PTR *) &pucchInfo);
6529 else if(hqCb->hqE->raCb != NULLP)
6531 /* For RACH it is set to Bundling */
6532 ackNackMode = RGR_TDD_ACKNACK_MODE_BUNDL;
6533 rnti = hqCb->hqE->raCb->tmpCrnti;
6540 /* Do not proceed if PUSCH
6541 reception req is already filled*/
6546 /* Go to the next node */
6550 if(((ueCb == NULLP) || (ueCb->measGapCb.isMeasuring != TRUE))
6554 TknUInt16 n1PucchTkn = {FALSE, 0};
6557 pdcch = tbCb->hqP->pdcch;
6559 n1PucchTkn = hqCb->spsN1PucchRes;
6561 for (tbIndx = 0; tbIndx < TFU_MAX_TB; tbIndx++)
6563 if (hqCb->tbInfo[tbIndx].state == HQ_TB_WAITING &&
6564 (RGSCH_TIMEINFO_SAME(hqCb->tbInfo[tbIndx].fdbkTime,
6565 recpReqInfo->timingInfo)))
6568 hqCb->tbInfo[tbIndx].pucchFdbkIdx = hqCb->ulDai;
6571 ret = rgSCHTomUtlFillSfHqFdbkForOneUe(hqCb,recpReqInfo, cellCb, err, dlSf, noFdbks,
6572 memCp, elemIdx, nxtDlsf, rnti, ackNackMode, &pucchInfo, pdcch,
6573 n1PucchTkn, &alloc, hqSz);
6578 /* TODO:: In case of F1BCS and CSI in same subframe
6579 * UE shall drop the CSI if there was at least one
6580 * PDSCH transmission in any of the DL subframe
6581 * mapping to this UL subframe
6584 rgSCHTomUtlFillCqiSrSrsWithHq(cellCb,recpReqInfo, hqCb->hqE->ue,
6585 pucchInfo->pucchRecpInfo, validIdx,FALSE);
6587 if((hqCb->hqE->ue) &&
6588 (hqCb->hqE->ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS))
6591 if(RG_SCH_IS_CELL_SEC(hqCb->hqE->ue,hqCb->hqE->cell))
6593 switch(pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo)
6595 case TFU_PUCCH_HARQ_SR_CQI:
6596 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
6597 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
6599 case TFU_PUCCH_HARQ_CQI:
6600 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
6601 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
6603 case TFU_PUCCH_HARQ_SR_CQI_SRS:
6604 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_SRS;
6605 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
6607 case TFU_PUCCH_HARQ_SR_SRS:
6608 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
6610 case TFU_PUCCH_HARQ_SRS:
6611 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
6622 /* TODO antz - pushing the following code (under TFU_UPGRADE)
6623 * into the above function (...ForOneUe) did not work (caused
6624 * two additional TCs to fail). Don't know why. If this
6625 * is done later, make sure that the code branch
6626 * for relPdcch (later in this func) is also modified appropriately.
6628 /* Now add to the recp request or pending list */
6629 //if((elemIdx != (noFdbks - 1)))
6631 cmHashListInsert(&cellCb->ueTfuPendLst, (PTR) pucchInfo,
6632 (uint8_t *)&rnti ,(uint16_t) sizeof(CmLteRnti));
6636 } /* If measuring */
6637 /* Go to the next node */
6638 if ((tbCb->fbkRecpRepCntr) && (--tbCb->fbkRecpRepCntr))
6640 /* Add to next subfarme */
6641 /* Add this hqCb to the next dlSf's ackNakRepQ */
6642 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
6643 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
6644 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
6645 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
6647 /* In a given dlSf, if there is 2 TBs context
6648 * stored for a given harq, then they are added
6649 * adjacent to each other in the subframe. To avoid
6650 * adding duplicate recpnInfo for each TB, store this
6651 * hqCb in prvHqCb. If nextHqCb is same as prvHqCb then
6652 * do not add reception req info.*/
6660 /** @brief This function calculates the pucch resource idx
6661 * that is to be filled in harq reception request
6665 * Function: rgSCHTomUtlGethqRes
6668 * -Calculate the pucch resource idx
6669 * Harq Reception Request for Format 1B with
6672 * @param [in] uint8_t noFdbks
6673 * @param [in] RgSchDlSf *dlSf
6674 * @param [in] RgSchPdcch *pdcch
6675 * @param [in] RgSchCellCb *cellCb
6676 * @param [out]uint16_t *hqRes
6679 static Void rgSCHTomUtlGethqRes
6684 RgSchCellCb *cellCb,
6696 m = dlSf->dlFdbkInfo.m;
6698 P = rgSCHCmnGetPValFrmCCE(cellCb, nCce);
6699 nP = cellCb->rgSchTddNpValTbl[P];
6700 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
6701 *hqRes = (M - m - 1)* nP + (m * nPlusOne) + pdcch->nCce +
6702 cellCb->pucchCfg.n1PucchAn;
6707 /** @brief This function fills the harq reception request for
6708 * TDD in case of Fomat 1B with CS for M=1
6712 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1
6715 * -Fill Harq Reception Request for Format 1B with
6718 * @param [in] RgSchDlHqProcCb *hqCb
6719 * @param [in] TfuUePucchRecpReq *hqRecpReq
6720 * @param [in] uint8_t noFdbks
6721 * @param [in] RgSchDlSf *dlSf
6722 * @param [in] RgSchPdcch *pdcch
6723 * @param [in] RgSchCellCb *cellCb
6726 static Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1
6728 RgSchDlHqProcCb *hqCb,
6729 TfuUePucchRecpReq *hqRecpReq,
6736 RgSchUeCb *ue = NULLP;
6737 Bool isCellSec = FALSE;
6740 /*ccpu00147920: UeCb is NULL for SPS activation*/
6741 if(pdcch && pdcch->ue)
6742 {/* SPS Release pdcch or dynamic data */
6749 /* This is not supposed to happen
6750 * Error case. hqCB has to be ter
6751 * when pdcch is present . Adding
6752 * if check bcs of kwork*/
6759 if((hqCb != NULLP) &&
6760 (RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
6765 switch(ue->f1bCsAVal)
6767 case RG_SCH_A_VAL_2:
6768 /* harq(0) is primary harq(1) is secondary) */
6771 hqRecpReq->hqInfo.hqRes[1] = ue->n1PucchF1bResCb.
6772 cw1N1Res[hqCb->tpc].n1PucchIdx;
6774 else/* primary cell */
6777 /* hqCb will be null in case of sps rel pdcch */
6778 if ((hqCb) && hqCb->spsN1PucchRes.pres)
6779 {/* SPS occasion or dyn sched*/
6780 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
6783 #endif /* LTEMAC_SPS */
6784 {/* dyn data or sps release */
6788 /* This is not supposed to happen
6789 * Error case. hqCB has to be ter
6790 * when pdcch is present . Adding
6791 * if check bcs of kwork*/
6796 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
6797 hqRecpReq->hqInfo.hqRes[0] = hqRes;
6801 case RG_SCH_A_VAL_3:
6803 /* Serving cell in mimo mode should be
6804 * in 0 and 1 and the serving cell in siso
6805 * mode should be in 2 indices */
6808 uint8_t servCellIdx = rgSchUtlGetServCellIdx(hqCb->hqE->cell->instIdx,
6809 hqCb->hqE->cell->cellId,
6812 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1)
6813 {/* Sec cell is in mimo mode, use 0 and 1 */
6814 hqRecpReq->hqInfo.hqRes[0] =
6815 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
6816 hqRecpReq->hqInfo.hqRes[1] =
6817 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
6820 {/* Sec cell is in siso mode, use 2 */
6821 hqRecpReq->hqInfo.hqRes[2] =
6822 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
6826 {/* primary cell hq */
6828 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
6829 {/* prim cell is in mimo mode, use 0 and 1 */
6831 if (hqCb && hqCb->spsN1PucchRes.pres)
6832 {/* Not sps release */
6833 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
6836 #endif /* LTEMAC_SPS */
6837 {/* sps rel or dyn */
6841 /* This is not supposed to happen
6842 * Error case. hqCB has to be ter
6843 * when pdcch is present . Adding
6844 * if check bcs of kwork*/
6849 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
6850 hqRecpReq->hqInfo.hqRes[0] = hqRes;
6851 hqRecpReq->hqInfo.hqRes[1] = hqRes + 1;
6855 {/* prim cell is in siso mode use 2 */
6857 /* Consider sps occasions */
6858 if (hqCb && hqCb->spsN1PucchRes.pres)
6859 {/* Not sps release */
6860 hqRecpReq->hqInfo.hqRes[2] = hqCb->spsN1PucchRes.val;
6863 #endif /* LTEMAC_SPS */
6868 /* This is not supposed to happen
6869 * Error case. hqCB has to be ter
6870 * when pdcch is present . Adding
6871 * if check bcs of kwork*/
6876 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
6877 hqRecpReq->hqInfo.hqRes[2] = hqRes;
6883 case RG_SCH_A_VAL_4:
6884 {/* Both the serv cells are in mimo mode */
6886 {/* 2 and 3 for sec cell */
6887 hqRecpReq->hqInfo.hqRes[2] =
6888 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
6889 hqRecpReq->hqInfo.hqRes[3] =
6890 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
6892 else/* primary cell */
6893 {/* 0 and 1 are for primary cell */
6895 if (hqCb && hqCb->spsN1PucchRes.pres)
6896 {/* Not sps release */
6897 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
6900 #endif /* LTEMAC_SPS */
6905 /* This is not supposed to happen
6906 * Error case. hqCB has to be ter
6907 * when pdcch is present . Adding
6908 * if check bcs of kwork*/
6913 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
6914 hqRecpReq->hqInfo.hqRes[0] = hqRes;
6915 hqRecpReq->hqInfo.hqRes[1] = hqRes + 1;
6926 /** @brief This function fills the harq reception request for
6927 * TDD in case of Fomat 1B with CS for M>=2
6931 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234
6934 * -Fill Harq Reception Request for Format 1B with
6937 * @param [in] RgSchDlHqProcCb *hqCb
6938 * @param [in] TfuUePucchRecpReq *hqRecpReq
6939 * @param [in] uint8_t noFdbks
6940 * @param [in] RgSchDlSf *dlSf
6941 * @param [in] RgSchPdcch *pdcch
6942 * @param [in] RgSchCellCb *cellCb
6943 * @param [in] uint8_t elemIdx
6946 static Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234
6948 RgSchDlHqProcCb *hqCb,
6949 TfuUePucchRecpReq *hqRecpReq,
6953 RgSchCellCb *cellCb,
6958 Bool isCellSec = FALSE;
6960 uint8_t servCellIdx;
6963 {/* SPS Release pdcch or dynamic data */
6970 /* This is not supposed to happen
6971 * Error case. hqCB has to be ter
6972 * when pdcch is present . Adding
6973 * if check bcs of kwork*/
6980 if((hqCb != NULLP) && (ue != NULLP) &&
6981 (RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
6987 {/* Sec Cell indices are 2 and 3*/
6988 servCellIdx = rgSchUtlGetServCellIdx(hqCb->hqE->cell->instIdx,
6989 hqCb->hqE->cell->cellId,
6992 hqRecpReq->hqInfo.hqRes[2] =
6993 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
6995 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1)
6997 hqRecpReq->hqInfo.hqRes[3] =
6998 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
7002 {/* Primary cell indices are 0 and 1 */
7004 * M > 2 if SPS occasion is present in any of the
7005 * DL subframe in the bundle, the n1Pucch(0) is
7006 * the SPS resource and n1Pucch(1) is the resource
7007 * derived from pdcch with DAI = 1
7008 * If No SPS Occasion
7009 * Then n1Pucch(0) is from pdcch with DAI =1
7010 * and n1Pucch(1) is from pdcch with DAI = 2
7014 {/* this is not sps release pdcch */
7015 if(hqCb->spsN1PucchRes.pres == TRUE)
7017 hqRes = hqCb->spsN1PucchRes.val;
7022 {/*Dynamic scheduling or SPS Release
7023 Derive from pdcch */
7024 if(pdcch->dlDai < 3)
7025 {/* No need to calcualte from DAI > 2 */
7026 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7032 hqRecpReq->hqInfo.hqRes[elemIdx] = hqRes;
7035 {/* Pdcch with DAI = 1 and 2 needs to be used
7036 for resource calculation*/
7037 if(hqCb && hqCb->spsN1PucchRes.pres == TRUE)
7038 {/* dyn or sps occasion */
7039 /* Shift the hqRes[0] if it was filled
7040 * if there was a pdcch with DAI 1 before to this
7043 {/* SPS occasion happened in the middle
7045 /* shifting the non SPS resource to n1Pucch(1) */
7046 hqRecpReq->hqInfo.hqRes[1] = hqRecpReq->hqInfo.hqRes[0];
7049 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7052 else if(pdcch && pdcch->dlDai < 3)
7054 else if(pdcch->dlDai < 3)
7056 {/* sps rel or dyn sched */
7057 /* hqCb wil not be present for sps release pdcch */
7058 if(hqCb && (pdcch->dlDai != hqCb->ulDai))
7059 {/* there was a SPS occasion before to this */
7060 if(pdcch->dlDai == 1)
7062 hqRecpReq->hqInfo.hqRes[1] = hqRes;
7063 }/* ignore the DAI 2 in this case */
7065 {/* There was no SPS occasion before to this */
7069 {/* Added check to ignore kwork warning */
7070 hqRecpReq->hqInfo.hqRes[(pdcch->dlDai)-1] = hqRes;
7079 /** @brief This function fills the harq reception request for
7080 * TDD in case of Fomat 1B with CS
7084 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCS
7087 * -Fill Harq Reception Request for Format 1B with
7090 * @param [in] RgSchDlSf *ulSf
7091 * @param [in] RgSchCellCb *cell
7092 * @param [out]TfuUePucchRecpReq *hqRecpReq
7095 static S16 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS
7097 RgSchDlHqProcCb *hqCb,
7098 TfuUePucchRecpReq *hqRecpReq,
7106 /* Update teh fdbk mode if something different is present
7107 * in L1 API file for F1BS *//* 1 --> F1BCS */
7108 hqRecpReq->hqInfo.hqFdbkMode = TFU_ACK_NACK_CHANNEL_SELECTION;
7112 case RG_SCH_M_VAL_1:
7115 rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1(hqCb,hqRecpReq,
7116 noFdbks,dlSf,pdcch,cellCb);
7119 case RG_SCH_M_VAL_2:
7120 case RG_SCH_M_VAL_3:
7121 case RG_SCH_M_VAL_4:
7123 /* Spatial bundling will be applied */
7124 rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234(hqCb,hqRecpReq,
7125 noFdbks,dlSf,pdcch,cellCb,elemIdx);
7135 /***********************************************************
7137 * Func : rgSCHTomUtlFillSfHqFdbkForOneUe
7139 * Desc : Fill HARQ feedback info for one UE/entry
7147 **********************************************************/
7148 static S16 rgSCHTomUtlFillSfHqFdbkForOneUe
7150 RgSchDlHqProcCb *hqCb,
7151 TfuRecpReqInfo *recpReqInfo,
7152 RgSchCellCb *cellCb,
7160 RgrTddAckNackMode ackNackMode,
7161 RgSchUePucchRecpInfo **pucchInfoRef,
7163 TknUInt16 n1PucchTkn,
7168 RgSchUePucchRecpInfo *pucchInfo = *pucchInfoRef;
7171 TfuUePucchRecpReq *hqRecpReq;
7186 Bool isFirstFdbk = FALSE;
7188 if(pucchInfo == NULLP)
7190 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchInfo,
7191 sizeof(RgSchUePucchRecpInfo), memCp)) != ROK)
7193 DU_LOG("\nERROR --> SCH : Unable to "
7194 "Allocate TfuUeRecpReqInfo for cell RNTI:%d",rnti);
7195 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
7199 #ifdef TFU_ALLOC_EVENT_NO_INIT
7200 pucchInfo->hashLstEnt.hashVal = 0;
7201 pucchInfo->hashLstEnt.keyLen = 0;
7202 pucchInfo->hashLstEnt.key = 0;
7203 pucchInfo->hashLstEnt.list.prev = pucchInfo->hashLstEnt.list.next = 0;
7205 if ((ret = rgSCHUtlGetEventMem((Ptr *)&(pucchInfo->pucchRecpInfo),
7206 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp))) != ROK)
7208 DU_LOG("\nERROR --> SCH : Unable to "
7209 "Allocate TfuUeRecpReqInfo for cell RNTI:%d",rnti);
7210 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
7213 memset(pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes,0xff,sizeof(uint16_t)*TFU_MAX_HQ_RES);
7214 #ifdef TFU_ALLOC_EVENT_NO_INIT
7215 memset(&pucchInfo->pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
7217 pucchInfo->pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
7218 pucchInfo->pucchRecpInfo->rnti = rnti;
7220 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo=TFU_PUCCH_HARQ;
7227 /* Calculation of resources same for both bundling and muxing for M = 1
7230 RgSchUeCb *ue = rgSCHDbmGetUeCb (cellCb, rnti);
7231 if((ue) && (1 == ue->numSCells))
7233 if(ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS)
7235 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
7236 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS(hqCb,hqRecpReq,
7237 noFdbks,dlSf,pdcch,elemIdx,cellCb);
7240 {/* M = 1 case . size is same as A Value*/
7241 hqRecpReq->hqInfo.hqSz = ue->f1bCsAVal;
7242 hqRecpReq->hqInfo.pucchResCnt = hqRecpReq->hqInfo.hqSz;
7245 hqRecpReq->hqInfo.hqSz = (noFdbks * 2); /* M for 2 cells */
7246 hqRecpReq->hqInfo.pucchResCnt = 4;
7248 hqRecpReq->hqInfo.a = ue->f1bCsAVal;
7249 /* handling for SPS occasions*/
7252 /* set the datPresinFirstSUbframe to TRUE if this
7253 * is for pcell txion*/
7255 RgSchTddANInfo *anInfo = NULLP;
7257 /* if this txion is on pcell
7258 * sps occaion, dyn sched or sps release pdcch
7259 * set the sched present in first
7260 * dl subframe of the bundle to TRUE. This
7261 * is required for mapping the feedbak when SPS occasion
7262 * is present in any of the DL subframe in the bundle in
7265 /* SPS will happen only on pcell */
7266 if((hqCb == NULLP) || (!RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
7269 anInfo = rgSCHUtlGetUeANFdbkInfo(ue,
7270 &recpReqInfo->timingInfo,RGSCH_PCELL_INDEX);
7272 {/* ANInfo must be there. adding block
7274 DU_LOG("\nERROR --> SCH : ANInfo should not be NULL for cellId=%d \n", cellCb->cellId);
7281 {/* This needs to be revisited while
7282 adding support for PUCCH format 3 */
7283 DU_LOG("\nERROR --> SCH : Invalid Pucch format configured..");
7290 if((ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) ||
7291 ((noFdbks == 1) && (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT)))
7293 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
7295 prevHqSize = hqRecpReq->hqInfo.hqSz;
7298 /* Only one index for bundling case */
7299 hqRecpReq->M = noFdbks;
7301 TFU_HQ_RECP_REQ_NORMAL;
7302 hqRecpReq->multCnt = 1;
7303 hqRecpReq->t.nCce[0] =
7308 rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
7310 hqRecpReq->type = TFU_UCI_HARQ;
7312 #else /* TFU_UPGRADE */
7315 if ((TRUE == isFirstFdbk) && (TRUE == n1PucchTkn.pres))
7317 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)ackNackMode;
7318 hqRecpReq->hqInfo.pucchResCnt=1;
7319 hqRecpReq->hqInfo.hqRes[0] = n1PucchTkn.val;
7320 hqRecpReq->hqInfo.hqSz = hqSz;
7323 else if (FALSE == n1PucchTkn.pres)
7326 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)ackNackMode;
7328 P = rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
7329 nP = cellCb->rgSchTddNpValTbl[P];
7330 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
7331 m = dlSf->dlFdbkInfo.m;
7332 /* In case of no UE */
7333 pucchRes = (M - m - 1)* nP + (m * nPlusOne) + pdcch->nCce +
7334 cellCb->pucchCfg.n1PucchAn;
7335 /*ccpu00130164:MOD-Changed to maitain value of
7336 hqRecpReq->hqInfo.pucchResCnt=1 in case of bundling*/
7337 /*ccpu00132284 -MOD- hqRes need to be updated after pucchReCnt set to 1
7338 * and resource should be update at index-0*/
7339 hqRecpReq->hqInfo.pucchResCnt=1;
7340 hqRecpReq->hqInfo.hqRes[hqRecpReq->hqInfo.pucchResCnt-1] = pucchRes;
7342 if((ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) && (hqSz > prevHqSize))
7343 hqRecpReq->hqInfo.hqSz = hqSz;
7344 else if (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT)
7345 hqRecpReq->hqInfo.hqSz = hqSz;
7347 hqRecpReq->hqInfo.hqSz = prevHqSize;
7349 #endif /* TFU_UPGRADE */
7351 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst,
7352 &(pucchInfo->pucchRecpInfo->lnk));
7353 pucchInfo->pucchRecpInfo->lnk.node =
7354 (PTR)pucchInfo->pucchRecpInfo;
7357 else /* Multiplexing */
7360 pucchInfo->pucchRecpInfo->t.pucchRecpReq.M = noFdbks;
7362 if (n1PucchTkn.pres == TRUE)
7364 pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqType =
7365 TFU_HQ_RECP_REQ_N1PUCCH;
7366 pucchInfo->pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = n1PucchTkn.val;
7371 pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqType =
7372 TFU_HQ_RECP_REQ_NORMAL;
7373 multCnt = pucchInfo->pucchRecpInfo->t.pucchRecpReq.multCnt;
7374 pucchInfo->pucchRecpInfo->t.pucchRecpReq.t.nCce[multCnt] =
7376 pucchInfo->pucchRecpInfo->t.pucchRecpReq.m[multCnt] =
7378 pucchInfo->pucchRecpInfo->t.pucchRecpReq.p[multCnt] =
7379 rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
7381 pucchInfo->pucchRecpInfo->t.pucchRecpReq.multCnt++;
7383 #else /* TFU_UPGRADE */
7385 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
7386 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)RGR_TDD_ACKNACK_MODE_MULT;
7387 hqRecpReq->hqInfo.hqSz = noFdbks;
7389 resIdx = hqRecpReq->hqInfo.pucchResCnt;
7390 hqRecpReq->hqInfo.pucchResCnt++;
7393 if (n1PucchTkn.pres == TRUE)
7395 hqRecpReq->hqInfo.hqRes[resIdx] = n1PucchTkn.val;
7401 m = dlSf->dlFdbkInfo.m;
7403 P = rgSCHCmnGetPValFrmCCE(cellCb, nCce);
7404 nP = cellCb->rgSchTddNpValTbl[P];
7405 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
7406 hqRecpReq->hqInfo.hqRes[resIdx] = (M - m - 1)* nP +
7407 (m * nPlusOne) + pdcch->nCce +
7408 cellCb->pucchCfg.n1PucchAn;
7410 #endif /* TFU_UPGRADE */
7411 /* If all the DL subframes are scanned, then
7412 * send TFU request*/
7414 if((elemIdx != noFdbks) && alloc)
7416 cmHashListInsert(&cellCb->ueTfuPendLst, (PTR) pucchInfo,
7417 (uint8_t *)&rnti, (uint16_t) sizeof(rnti));
7422 pucchInfo->pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
7423 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst,
7424 &(pucchInfo->pucchRecpInfo->lnk));
7425 pucchInfo->pucchRecpInfo->lnk.node =
7426 (PTR)pucchInfo->pucchRecpInfo;
7427 /* Delete the entry after addition to the list */
7428 cmHashListDelete(&cellCb->ueTfuPendLst, (PTR) pucchInfo);
7434 *pucchInfoRef = pucchInfo;
7440 #ifdef RG_ULSCHED_AT_CRC
7441 /** @brief This function does all the processing related to a single downlink
7446 * Function: rgSCHTomUtlProcDlSfAtCrc
7449 * - collate control data for all UEs and send to PHY
7450 * - collate data buffers for all UEs and send to PHY
7452 * @param [in] RgSchDlSf *ulSf
7453 * @param [in] RgSchCellCb *cell
7454 * @param [in] TfuCntrlReqInfo *cntrlInfo
7455 * @param [out] RgSchErrInfo *err
7458 static S16 rgSCHTomUtlProcDlSfAtCrc
7461 CmLteTimingInfo crntUlFrm,
7463 TfuCntrlReqInfo *cntrlInfo,
7467 Inst inst = cell->instIdx;
7470 cntrlInfo->numDlActvUes = 0;
7471 cmLListInit(&cntrlInfo->phichLst);
7472 cmLListInit(&cntrlInfo->dlPdcchLst);
7473 cmLListInit(&cntrlInfo->ulPdcchLst);
7474 #ifdef TFU_ALLOC_EVENT_NO_INIT
7475 cntrlInfo->dlTiming.sfn = cntrlInfo->dlTiming.subframe = 0;
7479 cntrlInfo->ulTiming = crntUlFrm;
7480 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cntrlInfo->ulTiming, TFU_ULCNTRL_DLDELTA);
7482 cntrlInfo->cellId = cell->cellId;
7483 /* Fill PHICH info */
7484 if ((ret = rgSCHTomUtlFillPhich (cell, cntrlInfo, ulSf, err)) != ROK)
7486 DU_LOG("\nERROR --> SCH : Unable to send PHICH info for cell");
7487 RGSCH_FREE_MEM(cntrlInfo);
7492 if ((ret = rgSCHTomUtlFillUlPdcch (cell, cntrlInfo, ulSf, err)) != ROK)
7494 DU_LOG("\nERROR --> SCH : Unable to send PDCCH info for cell");
7495 RGSCH_FREE_MEM(cntrlInfo);
7500 if(0 == cntrlInfo->ulMpdcchLst.count)
7507 if ((cntrlInfo->ulPdcchLst.count || cntrlInfo->phichLst.count) || RG_SCH_EMTC_GET_PDCCHLST_CNT(cntrlInfo))
7509 if (cntrlInfo->ulPdcchLst.count || cntrlInfo->phichLst.count)
7512 //if (rgSCHUtlTfuCntrlReq(inst, cell->tfuSap->sapCfg.suId, cntrlInfo) != ROK)
7514 DU_LOG("\nERROR --> SCH : Unable to send Cntrl info for cell");
7519 RGSCH_FREE_MEM(cntrlInfo);
7523 #endif /* #ifdef RG_ULSCHED_AT_CRC*/
7526 /** @brief This function sends the SFN Tick to L3
7531 * Function: rgSCHTomUtlSendSfnTick
7533 * @param [in] RgSchCellCb *cell
7535 static Void rgSCHTomUtlSendSfnTick
7540 RgrTtiIndInfo *rgrTtiInd;
7542 /* TTI to be sent to RRM only once per system frame */
7543 /* Added support for period = 0 to disable tick to RRM */
7544 if ((cell->rrmTtiIndPrd != 0) &&
7545 ((cell->crntTime.sfn % cell->rrmTtiIndPrd) == 0) &&
7546 (cell->crntTime.slot == 0))
7548 /* Allocate a TTI indication structure and send to RRM over RGR interface */
7549 if (rgSCHUtlAllocSBuf (cell->instIdx,
7550 (Data**)&rgrTtiInd, sizeof(RgrTtiIndInfo)) != ROK)
7552 DU_LOG("\nERROR --> SCH : Mem alloc failed for RGR TTI ind, cellId (%d))\n",
7556 rgrTtiInd->cellId = cell->cellId;
7557 //rgrTtiInd->hSfn = cell->crntTime.hSfn;
7558 rgrTtiInd->sfn = cell->crntTime.sfn;
7560 if (rgSCHUtlRgrTtiInd (cell, rgrTtiInd) != ROK)
7562 DU_LOG("\nERROR --> SCH : Failed to send RGR TTI ind, cellId (%d))\n",
7564 rgSCHUtlFreeSBuf(cell->instIdx, (Data**)&rgrTtiInd,
7565 sizeof(RgrTtiIndInfo));
7575 /* @brief Mark Dyn TDD CrntSfIdx.
7579 * Function: rgSCHDynTDDMrkCrntSfIdx
7580 * Purpose: update the dyn tdd sunframe index
7581 * @param[in] Inst schInst
7585 static Void rgSCHDynTDDMrkCrntSfIdx(Inst schInst)
7587 RgSchDynTddCb *rgSchDynTddInfo = &(rgSchCb[schInst].rgSchDynTdd);
7590 RG_SCH_DYN_TDD_MARKTYPE(rgSchDynTddInfo, rgSchDynTddInfo->crntDTddSfIdx,
7591 RG_SCH_DYNTDD_NOTDEF);
7592 rgSchDynTddInfo->crntDTddSfIdx = (rgSchDynTddInfo->crntDTddSfIdx + 1) %
7593 RG_SCH_DYNTDD_MAX_SFINFO;
7595 //DU_LOG("\nERROR --> SCH : Initializing Index %d \n", rgSchDynTddInfo->crntDTddSfIdx);
7601 /** @brief This function fills the TTI timinig info for each cell
7605 * Function: rgSchTomFillCellTtiInfo
7607 * @param [in] TfuTtiIndInfo *ttiInd
7608 * @param [in] Inst schInst
7609 * @param [out] uint8_t *nCell
7610 * @param [out] RgSchCellCb *cell[]
7616 static Void rgSchTomFillCellTtiInfo
7618 TfuTtiIndInfo *ttiInd,
7621 RgSchCellCb *cells[]
7626 TfuTtiCellInfo *cellInfo;
7630 CmLteTimingInfo frm;
7632 if (CM_LTE_MAX_CELLS < ttiInd->numCells)
7638 rgSCHDynTDDMrkCrntSfIdx(schInst);
7641 for (i = 0; i < ttiInd->numCells; i++)
7643 cellInfo = &ttiInd->cells[i];
7644 strtCellId = rgSchCb[schInst].genCfg.startCellId;
7645 Idx1 = (uint8_t)((cellInfo->cellId - strtCellId)&(CM_LTE_MAX_CELLS-1));
7646 cell = rgSchCb[schInst].cells[Idx1];
7647 /* Validate the cell */
7650 /* Use SCH inst 0 print buff */
7651 DU_LOG("\nERROR --> SCH : RgLiTfuTtiInd()No cell exists for cellId %d\n",
7655 *nCell = *nCell + 1;
7656 cells[i] = (RgSchCellCb *)cell;
7659 if(cell->schTickDelta != cellInfo->schTickDelta)
7661 DU_LOG("\nERROR --> SCH : Delta changed for cellId=%d: curr delta=%d new delta=%d\n"
7662 "dlblankSf=%d ulblankSf=%d dummyTti=%d \n",
7663 cell->cellId, cell->schTickDelta, cellInfo->schTickDelta, cellInfo->dlBlankSf,cellInfo->ulBlankSf,
7664 cellInfo->isDummyTti);
7666 RGSCH_UPDATE_DELTA(schInst, cellInfo->schTickDelta);
7667 cell->schTickDelta = cellInfo->schTickDelta;
7670 cell->stopSiSch = cellInfo->dlBlankSf;
7671 cell->stopDlSch = cellInfo->dlBlankSf;
7672 cell->stopUlSch = cellInfo->ulBlankSf;
7673 if (cellInfo->isDummyTti)
7675 cell->stopDlSch = TRUE;
7677 if((0 == (cellInfo->timingInfo.sfn % 30)) && (0 == cellInfo->timingInfo.slot))
7679 //DU_LOG("5GTF_CHECK rgSCHTOMTtiInd (%d : %d)\n", cellInfo->timingInfo.sfn, cellInfo->timingInfo.slot);
7682 RGSCHCPYTIMEINFO(cellInfo->timingInfo, cell->crntTime);
7683 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->hiDci0Time,
7684 TFU_ULCNTRL_DLDELTA);
7685 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->dlDciTime,
7686 TFU_DLCNTRL_DLDELTA);
7687 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->rcpReqTime,
7688 TFU_RECPREQ_DLDELTA);
7689 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->hqRlsTime,
7690 TFU_HQFBKIND_ULDELTA);
7691 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->dlSfRlsTime,
7694 RGSCHCPYTIMEINFO_EMTC(cellInfo->timingInfo, cell->crntTime);
7695 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->hiDci0Time,
7696 TFU_ULCNTRL_DLDELTA);
7697 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->dlDciTime,
7698 TFU_DLCNTRL_DLDELTA);
7699 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->rcpReqTime,
7700 TFU_RECPREQ_DLDELTA);
7701 RGSCHDECRFRMCRNTTIME_EMTC(cell->crntTime, cell->hqRlsTime,
7702 TFU_HQFBKIND_ULDELTA);
7703 RGSCHDECRFRMCRNTTIME_EMTC(cell->crntTime, cell->dlSfRlsTime,
7706 rgSCHCmnUpdVars(cell);
7707 cell->isDlDataAllwd = TRUE;
7708 /* Get DownLink SubFrame */
7709 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
7710 frm = cell->crntTime;
7712 RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA);
7714 RGSCH_INCR_SUB_FRAME_EMTC(frm, RG_SCH_CMN_DL_DELTA);
7716 cellSch->dl.time = frm;
7722 uint8_t idx = (cell->crntTime.slot + RG_SCH_CMN_DL_DELTA) %
7723 RGSCH_NUM_SUB_FRAMES_5G;
7725 cell->isDlDataAllwd = RG_SCH_CMN_CHK_DL_DATA_ALLOWED(cell, idx);
7727 /*ccpu00130639 -ADD - used in UL HARQ proc id calculation*/
7728 if((cell->crntTime.sfn == 0) && (cell->crntTime.slot == 0))
7730 /* sfn Cycle used for Tdd UL Harq Proc Determination.
7731 This sfn Cycle will have values from 0 to numUl Harq-1. */
7732 cell->tddHqSfnCycle = (cell->tddHqSfnCycle + 1 ) %
7733 (rgSchTddUlNumHarqProcTbl[cell->ulDlCfgIdx]);
7737 if(cell->emtcEnable)
7739 rgSCHUtlEmtcResPrcTti(cell);
7745 void schFillCrntTime(
7746 SlotTimingInfo slotInd,
7749 uint8_t cellCount = 0;
7750 for(cellCount = 0; cellCount < CM_LTE_MAX_CELLS; cellCount++)
7753 cell = rgSchCb[schInst].cells[cellCount];
7755 RGSCHCPYTIMEINFO(slotInd, cell->crntTime);
7757 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->hiDci0Time,
7758 TFU_ULCNTRL_DLDELTA);
7759 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->dlDciTime,
7760 TFU_DLCNTRL_DLDELTA);
7761 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->rcpReqTime,
7762 TFU_RECPREQ_DLDELTA);
7763 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->hqRlsTime,
7764 TFU_HQFBKIND_ULDELTA);
7765 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->dlSfRlsTime,
7768 RGSCH_INCR_SUB_FRAME(cell->crntTime, RG_SCH_CMN_DL_DELTA);
7770 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
7771 cellSch->dl.time = cell->crntTime;
7775 /** @brief This function prepares the TTI for scheduling and
7776 * invokes the Common channel scheduler. Uplink scheduler
7777 * is invoked first if UL Scheduling at CRC is not enabled
7781 * Function: rgSchTomTtiUlAndDlCmnChSch
7783 * @param [out] RgSchCellCb *cell
7788 static Void rgSchTomTtiUlAndDlCmnChSch
7794 cell->rlsHqArr[cell->crntHqIdx].numUes = 0;
7796 cell->crntHqIdx = cell->crntHqIdx % RGSCH_NUM_SUB_FRAMES;
7798 cmPrcTmr(&cell->tqCp, cell->tq, (PFV)rgSCHTmrProcTmr);
7799 rgSCHMeasGapANRepTtiHndl (cell);
7800 /* We need to fill the PHICH for the UL Data, first we need to get the UL
7801 * SF from Scheduler, next we fill the dlSf that goes out this TTI.
7802 * This must be performed prior to any other processing of the TTI
7803 * so that we do not wrap around and generate feedback prior to
7804 * reception of UL data.
7806 #ifndef RG_ULSCHED_AT_CRC
7809 uint8_t idx; /* Index into Uplink Sf array */
7811 Mval = rgSchTddPhichMValTbl[cell->ulDlCfgIdx]
7812 [cell->hiDci0Time.subframe];
7816 for(idx=0; idx < Mval; idx++)
7818 rgSCHCmnRlsUlSf(cell, idx);
7824 /* DTX processing for those Harq's which did not get feedback from L1 */
7825 rgSCHDhmRlsDlsfHqProc (cell, cell->hqRlsTime);
7826 /* Re-Init the Downlink subframe */
7827 rgSCHUtlDlRlsSubFrm(cell, cell->dlSfRlsTime);
7828 /* Added handling to retransmit
7829 * release PDCCH in case of DTX
7832 /*Check for DRX every TTI*/
7833 rgSCHDrxTtiInd(cell);
7835 /* For TDD, UL scheduling should happen after DL scheduling */
7837 #ifndef RG_ULSCHED_AT_CRC
7838 /* Perform UL scheduling */
7839 rgSCHCmnUlSch(cell);
7842 /* Perform DL scheduling for Common channels */
7843 rgSCHCmnDlCommonChSch(cell);
7848 /** @brief This function invokes the Non critical procedures like measurements,
7849 * and RGR configurations.
7853 * Function: rgSchTomTtiMiscFunctions
7855 * @param [in] RgSchCellCb *cell
7860 static Void rgSchTomTtiMiscFunctions
7865 uint8_t suId = cell->tfuSap->sapCfg.suId;
7867 /* Invoke RAM Tti Handler */
7868 rgSCHRamTtiHndlr(cell);
7870 /* Handle RGR configurations */
7871 rgSCHGomTtiHndlr(cell, suId);
7873 if((RGM_PRB_REPORT_START == cell->prbUsage.prbRprtEnabld)
7874 && (!(cell->prbUsage.rprtPeriod) || ((glblTtiCnt % cell->prbUsage.rprtPeriod) == 0)))
7876 rgSCHUtlUpdAvgPrbUsage(cell);
7878 rgSCHL2Meas(cell,FALSE);
7881 /* LTE_ADV_FLAG_REMOVED_START */
7882 /* Report ABS Load information to application periodically */
7883 if((RGR_ENABLE == cell->lteAdvCb.absCfg.status) &&
7884 (cell->lteAdvCb.absCfg.absLoadPeriodicity))
7886 RgrLoadInfIndInfo *rgrLoadInf;
7889 cell->lteAdvCb.absLoadTtiCnt++;
7890 if(cell->lteAdvCb.absLoadTtiCnt >= cell->lteAdvCb.absCfg.absLoadPeriodicity)
7893 if(rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&rgrLoadInf,
7894 sizeof(RgrLoadInfIndInfo)) != ROK)
7896 DU_LOG("\nERROR --> SCH : Could not "\
7897 "allocate memory for sending LoadInfo\n");
7900 cell->lteAdvCb.absLoadTtiCnt = 0;
7901 rgrLoadInf->cellId = cell->cellId;
7902 rgrLoadInf->bw = cell->bwCfg.dlTotalBw;
7903 rgrLoadInf->type = RGR_ABS;
7904 for(idx= 0; idx<RGR_ABS_PATTERN_LEN; idx++)
7906 rgrLoadInf->u.absLoadInfo[idx] = cell->lteAdvCb.absLoadInfo[idx];
7907 cell->lteAdvCb.absLoadInfo[idx] = 0;
7909 rgSCHUtlRgrLoadInfInd(cell, rgrLoadInf);
7914 if(cell->isDlDataAllwd)
7916 /* Calling function to update CFI parameters*/
7917 rgSchCmnUpdCfiDb(cell, RG_SCH_CMN_DL_DELTA);
7921 /* Incrementing the ttiCnt in case of UL subframe */
7922 if(!cell->dynCfiCb.switchOvrInProgress)
7924 cell->dynCfiCb.ttiCnt++;
7928 rgSchCmnUpdCfiDb(cell, RG_SCH_CMN_DL_DELTA);
7931 /* LTE_ADV_FLAG_REMOVED_END */
7936 /** @brief This function invokes the Downlink scheduler
7940 * Function: rgSchTomTtiDlSch
7942 * @param [in] RgSchCellCb *cell
7947 static Void rgSchTomTtiDlSch
7953 if (cell->isDlDataAllwd && (cell->stopDlSch == FALSE))
7955 rgSCHCmnDlSch(cell);
7961 /** @brief This function invokes Consolidates the allocations
7962 * send the Subframe allocation info to MAC
7966 * Function: rgSchTomTtiCnsldtSfAlloc
7968 * @param [in] RgSchCellCb *cell
7973 static Void rgSchTomTtiCnsldtSfAlloc
7979 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
7981 dlSf = rgSCHUtlSubFrmGet(cell, cellSch->dl.time);
7983 /* Prepare Subframe allocation info and send to MAC */
7984 rgSCHCmnCnsldtSfAlloc(cell);
7986 /* Call ACK NACK module to add to dlsf Queue */
7987 rgSCHAckNakRepAddToQ(cell, dlSf);
7989 rgSCHTomUtlProcTA(cell);
7994 /** @brief This function prepares the DL and UL Config requests
7999 * Function: rgSchTomTtiL1DlAndUlCfg
8001 * @param [in] RgSchCellCb *cell
8006 static Void rgSchTomTtiL1DlAndUlCfg
8009 RgTfuCntrlReqInfo *cntrlInfo
8012 RgSchDlSf *dlSf = rgSCHUtlSubFrmGet (cell, cell->dlDciTime);
8013 RgSchDlSf *ulSf = rgSCHUtlSubFrmGet (cell, cell->hiDci0Time);
8016 rgSCHTomUtlProcDlSf (dlSf, ulSf, cell, cntrlInfo, &err);
8017 /* Mark this frame as sent */
8018 dlSf->txDone = TRUE;
8020 rgBwAlloInfo[dlSf->sfNum] += dlSf->bwAssigned;
8021 rgBwAlcnt[dlSf->sfNum] ++;
8025 rgSCHTomUtlProcTddUlSf(cell);
8027 rgSCHTomUtlProcUlSf (cell, &err);
8033 /** @brief This function prepares does the Downlink subframe re-init and
8034 * Harq DTX processing
8038 * Function: rgSchTomUtlTddRlsSfAndHarq
8040 * @param [in] RgSchCellCb *cell
8045 static Void rgSchTomUtlTddRlsSfAndHarq
8051 /* ccpu00132341-MOD- rgSchTddRlsDlSubfrmTbl is dependent on DELTA(=2).
8052 * Instead rgSchTddDlAscSetIdxKTbl can be used as the K set gives proper
8054 /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper
8055 * output if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME()
8056 * as it is serving the purpose */
8057 if(rgSchTddDlAscSetIdxKTbl[cell->ulDlCfgIdx][cell->hqRlsTime.subframe].
8060 /* ccpu00132341-MOD- Providing the UL SF timing for avoiding
8061 * calculation inside the function */
8062 rgSCHDhmTddRlsSubFrm(cell, cell->hqRlsTime);
8063 rgSCHDhmRlsDlsfHqProc(cell, cell->hqRlsTime);
8068 /** @brief This function processes the UL subframe and fills TFU reception
8073 * Function: rgSCHTomUtlProcTddUlSf
8075 * @param [in] RgSchCellCb *cell
8080 static Void rgSCHTomUtlProcTddUlSf(RgSchCellCb *cell)
8084 if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
8085 [cell->rcpReqTime.subframe] == RG_SCH_TDD_UL_SUBFRAME)
8087 if (rgSCHTomUtlProcUlSf (cell, &err) != ROK)
8089 /* fill in err type and call sta ind */
8090 DU_LOG("\nERROR --> SCH : Unable to process Uplink subframe for cellId (%d))\n", cell->cellId);
8093 /* TDD Fix , to allow Special SF SRS CFg */
8094 else if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
8095 [cell->rcpReqTime.subframe] == RG_SCH_TDD_SPL_SUBFRAME)
8097 if (rgSCHTomUtlPrcUlTddSpclSf(cell, &err) != ROK)
8099 /* fill in err type and call sta ind */
8100 DU_LOG("\nERROR --> SCH : Unable to process Sipceial subframe for cellId (%d))\n", cell->cellId);
8109 /**********************************************************************
8112 **********************************************************************/