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 */
47 #include "rl_interface.h"
48 #include "rl_common.h"
51 /* header/extern include files (.x) */
52 #include "tfu.x" /* RGU types */
53 #include "lrg.x" /* layer management typedefs for MAC */
54 #include "rgr.x" /* layer management typedefs for MAC */
55 #include "rgm.x" /* layer management typedefs for MAC */
56 #include "rg_sch_inf.x" /* typedefs for Scheduler */
57 #include "rg_sch.x" /* typedefs for MAC */
58 #include "rg_sch_cmn.x" /* typedefs for MAC */
60 #include "rg_sch_emtc_ext.x"
62 uint8_t rgSCHCmnCalcPcqiBitSz(RgSchUeCb *ueCb,uint8_t numTxAnt);
63 S16 rgSCHDhm5gtfHqFdbkInd(RgSchUeCb *ue,RgSchCellCb *cell,CmLteTimingInfo timingInfo,TfuHqFdbk fdbk,RgSchErrInfo *err);
66 Bool rgSCHEmtcChkEmtcUe ARGS(
71 Void rgSchTomTtiEmtcSched ARGS(
76 S16 rgSCHEmtcRamVldtProcRaReq
81 TfuRaReqIndInfo *raReqInd,
86 Void rgSCHEmtcUpdCqiInfo
92 Void rgSCHEmtcUpdSRInfo
97 Void rgSCHCmnEmtcHdlCrcFailInd
102 S16 rgSCHEmtcTomUtlProcAtCrc
105 CmLteTimingInfo crntHiDci0Frm,
106 TfuCntrlReqInfo *cntrlInfo,
109 Void rgSCHEmtcInitUeRecpReqLst
111 TfuRecpReqInfo *recpReqInfo
113 Void rgSCHEmtcFillPucchRecpInfo
116 RgSchDlHqProcCb *hqCb,
119 Bool rgSCHEmtcAddRecpInfoToLst
121 RgSchDlHqProcCb *hqCb,
122 TfuRecpReqInfo *recpReqInfo,
123 TfuUeRecpReqInfo *pucchRecpInfo,
126 Void rgSCHEmtcWillUeRptCqi
131 Void rgSchEmtcTomTtiCnsldtSfAlloc
136 S16 rgSchEmtcTomTtiL1DlAndUlCfg
139 RgTfuCntrlReqInfo *cntrlInfo
142 S16 rgSCHTomEmtcUtlFillDatRecpReq
144 TfuRecpReqInfo *recpReqInfo,
150 S16 rgSCHEmtcTomUtlFillHqFdbkRecpReq
152 TfuRecpReqInfo *recpReqInfo,
158 S16 rgSCHEmtcDhmRlsDlsfHqProc
161 CmLteTimingInfo timingInfo
164 Void rgSCHEmtcCmnUlSch
169 #ifdef RG_ULSCHED_AT_CRC
170 S16 rgSCHEmtcTomUtlProcDlSfAtCrc
173 CmLteTimingInfo crntUlFrm,
175 TfuCntrlReqInfo *cntrlInfo,
179 RgSchEmtcDlSf* rgSCHEmtcUtlSubFrmGet
186 uint32_t gDlMpdcchBlank;
187 uint32_t gUlMpdcchBlank;
188 S16 rgSCHUtlIotResPrcTti
195 RgSchUeCb* rgSCHCmnGetHoUe
200 RgSchUeCb* rgSCHCmnGetPoUe
204 CmLteTimingInfo timingInfo
206 S16 rgSCHTomUtlFillDatAperRecpReq ARGS(
211 TfuUeRecpReqInfo *datRecpInfo,
212 CmLteTimingInfo *timeInfo,
217 S16 rgSCHTomUtlFillDatPriRecpReq ARGS(
221 TfuUeRecpReqInfo *datRecpInfo,
222 CmLteTimingInfo *timeInfo,
227 S16 rgSCHTomUtlFillDatPCqiRecpReq ARGS(
231 TfuUeRecpReqInfo *datRecpInfo,
232 CmLteTimingInfo *timeInfo,
237 S16 rgSCHTomUtlFillDatSrsRecpReq ARGS(
241 TfuUeRecpReqInfo *datRecpInfo,
242 CmLteTimingInfo *timeInfo,
246 void schFillCrntTime( SlotIndInfo slotInd,Inst schInst);
249 uint32_t delayedApiCnt;
250 uint32_t gPCellTb1AckCount=0,gPCellTb2AckCount=0,gPCellTb1NackCount=0,gPCellTb2NackCount=0;
251 uint32_t gSCellSchedCount=0,gPrimarySchedCount=0;
252 uint32_t gSCellTb1AckCount=0,gSCellTb2AckCount=0,gSCellTb1NackCount=0,gSCellTb2NackCount=0;
253 uint32_t gPCellTb1DtxCount = 0, gPCellTb2DtxCount = 0, gSCellTb1DtxCount = 0, gSCellTb2DtxCount = 0;
254 uint32_t gHqFdbkCount = 0;
258 uint32_t gCqiRecpCount = 0;
259 uint32_t gCqiRecpPuschCount = 0;
260 uint32_t gCqiRcvdCount = 0;
261 Bool gF1bCsPres = FALSE;
262 uint32_t gRiReqCount = 0;
263 uint32_t gCqiReqCount = 0;
264 uint32_t gF1bCsCount = 0;
265 uint32_t gACqiRcvdCount = 0;
266 uint32_t gCqiReptToAppCount = 0;
267 uint32_t gRawACqiCount= 0;
268 uint32_t gCqiDropCount,gPucchDropCount;
269 uint32_t gCqiPucchLowSnrDropCount,gCqiPucchConfMaskDropCount,gCqiPuschConfMaskDropCount;
270 uint32_t gDci0Count = 0;
271 uint32_t gUlCrcFailCount = 0;
272 uint32_t gUlCrcPassCount = 0;
273 uint32_t gPuschCqiDropCount = 0;
274 uint32_t gCaDbgCaFrmt = 0;
275 uint32_t gCaDbgNonCaFrmt = 0;
276 uint32_t gPcellZeroBoOcc=0,gScellZeroBoOcc=0, dbgDelayedDatReqInMac=0,gDropDatReqCnt=0, gIccPktRcvrMemDropCnt=0;
280 uint32_t gUlCrcFailCounter = 0;
281 uint32_t gUlCrcPassCounter = 0;
285 uint32_t gUl5gtfPdcchSend;
290 static S16 rgSCHTomUtlFillCqiSrsWithSr ARGS
294 TfuRecpReqInfo *recpReqInfo,
295 TfuUeRecpReqInfo *pucchRecpInfo,
298 static Bool rgSCHTomUtlFillDatHarqRecpReq ARGS
302 TfuUeRecpReqInfo *datRecpInfo,
303 TfuRecpReqInfo *recpReqInfo
305 static S16 rgSCHTomUtlFillSrRecpReq ARGS((
306 TfuRecpReqInfo *recpReq,
310 static S16 rgSCHTomUtlFillRiRecpReq ARGS((
311 TfuRecpReqInfo *recpReq,
315 static S16 rgSCHTomUtlFillPcqiRecpReq ARGS((
316 TfuRecpReqInfo *recpReq,
320 static S16 rgSCHTomUtlFillSrsRecpReq ARGS((
321 TfuRecpReqInfo *recpReq,
325 static S16 rgSCHTomUtlGenIndices ARGS((
330 TfuSubbandInfo* sbInfo));
332 static S16 rgSCHTomUtlFillCqiRiRecpReq ARGS(
334 TfuRecpReqInfo *recpReqInfo,
339 static Void rgSchTomFillCellTtiInfo ARGS
341 TfuTtiIndInfo *ttiInd,
349 uint32_t rgBwAlloInfo[RGSCH_NUM_SUB_FRAMES]; /* Num of Rbs Allocated in each SF */
350 uint32_t rgBwAlcnt[RGSCH_NUM_SUB_FRAMES]; /*Num of times Allocation done in each Subframe */
353 /* rg006.201: [ccpu000111706, ccpu00112394]: Separated UL and DL TTI
356 uint64_t glblTtiCnt = 0;
360 uint32_t gDlNumUePerTti[20] = {0};
361 uint32_t gUlNumUePerTti[20] = {0};
362 static S16 rgSCHTomUtlProcDlSf ARGS((
366 RgTfuCntrlReqInfo *cntrlInfo,
368 #ifdef RG_ULSCHED_AT_CRC
369 static S16 rgSCHTomUtlProcDlSfAtCrc ARGS((
371 CmLteTimingInfo crntUlFrm,
373 TfuCntrlReqInfo *cntrlInfo,
375 #endif /* RG_ULSCHED_AT_CRC */
378 static S16 rgSCHTomUtlPrcUlTddSpclSf ARGS((
381 #endif /* TFU_UPGRADE */
383 static S16 rgSCHTomUtlFillPhich ARGS((
385 TfuCntrlReqInfo *cntrlInfo,
389 static S16 rgSCHTomUtlFillDlPdcch ARGS((
391 TfuCntrlReqInfo *cntrlInfo,
394 static S16 rgSCHTomUtlFillUlPdcch ARGS((
396 TfuCntrlReqInfo *cntrlInfo,
400 static S16 rgSCHTomUtlProcTA ARGS((
403 static S16 rgSCHTomUtlFillHqFdbkRecpReq ARGS((
404 TfuRecpReqInfo *recpReq,
409 static S16 rgSCHTomUtlFillHqFdbkRecpReq ARGS((
410 TfuRecpReqInfo *recpReq,
416 S16 rgSCHTomFillOnlySrsRecpReq ARGS
420 TfuUeRecpReqInfo *datRecpInfo
422 static S16 rgSCHTomUtlFillCqiSrSrsWithHq ARGS
425 TfuRecpReqInfo *recpReqInfo,
427 TfuUeRecpReqInfo *pucchRecpInfo,
429 Bool isDatPresOnSecCell
432 S16 rgSCHTomUtlFillRiBitWidthInfo ARGS
437 uint8_t rgSCHTomUtlFetchPcqiBitSz ARGS
444 uint8_t rgSCHTomUtlFetchPcqiBitSzPucchMode21 ARGS
447 TfuCqiPucchMode21 *mode21Info,
452 S16 rgSCHTomUtlMoveNxtOccasion ARGS
459 static S16 rgSCHTomUtlMovePcqiNxtOccasion ARGS
466 static S16 rgSCHTomUtlMovePriNxtOccasion ARGS
473 static S16 rgSCHTomUtlMoveSrNxtOccasion ARGS
479 static S16 rgSCHTomUtlMoveSrsNxtOccasion ARGS
484 static S16 rgSCHTomUtlWillUeRprtCqiRi ARGS((
486 Bool *willueRprtCqiRii));
489 static S16 rgSCHTomUtlFillDatRecpReq ARGS((
490 TfuRecpReqInfo *recpReq,
495 static S16 rgSCHTomUtlFillDatRecpReq ARGS((
496 TfuRecpReqInfo *recpReq,
503 static S16 rgSCHTomUtlFillSfRepHqFdbk ARGS((
504 TfuRecpReqInfo *recpReqInfo,
515 static S16 rgSCHTomUtlFillSfRepHqFdbk ARGS((
516 TfuRecpReqInfo *recpReqInfo,
527 static S16 rgSCHTomUtlFillSfHqFdbk ARGS((
528 TfuRecpReqInfo *recpReqInfo,
539 static S16 rgSCHTomUtlFillSfHqFdbk ARGS((
540 TfuRecpReqInfo *recpReqInfo,
551 static S16 rgSCHTomUtlFillSfHqFdbkForOneUe ARGS((
552 RgSchDlHqProcCb *hqCb,
553 TfuRecpReqInfo *recpReqInfo,
562 RgrTddAckNackMode ackNackMode,
563 RgSchUePucchRecpInfo **pucchInfoRef,
565 TknUInt16 n1PucchTkn,
571 Void rgSCHCmnDlSpsSch (RgSchCellCb *cell);
575 static S16 rgSCHTomCnsdrRelPdcch ARGS
579 TfuRecpReqInfo *recpReqInfo,
584 static S16 rgSCHTomCnsdrRelPdcch ARGS
588 TfuRecpReqInfo *recpReqInfo,
596 static Void rgSchTomTtiMiscFunctions ARGS
601 static Void rgSchTomTtiUlAndDlCmnChSch ARGS
606 static Void rgSchTomTtiDlSch ARGS
611 static Void rgSchTomTtiCnsldtSfAlloc ARGS
616 static Void rgSchTomTtiL1DlAndUlCfg ARGS
619 RgTfuCntrlReqInfo *cntrlInfo
623 static Void rgSCHTomUtlSendSfnTick ARGS
629 static Void rgSchTomUtlTddRlsSfAndHarq ARGS
633 static Void rgSCHTomUtlProcTddUlSf ARGS
638 static Void rgSCHTomUtlGethqRes ARGS
646 static Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1 ARGS
648 RgSchDlHqProcCb *hqCb,
649 TfuUePucchRecpReq *hqRecpReq,
655 static Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234 ARGS
657 RgSchDlHqProcCb *hqCb,
658 TfuUePucchRecpReq *hqRecpReq,
668 uint32_t rgDlCqiRptCnt[16], rgTotDlCqiRpt;
671 uint32_t rgSch5gtfCqi2Mcs[15] =
672 {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14};
674 /* forward references */
676 /*HARQ Feedback interpretation in accordance with Femto Forum.
677 Note: There is no value as '0' in Femto Forum Spec but in order to retain
678 the existing usage in MAC (and its Acceptance), its being considered*/
679 //const static uint8_t rgSchTomHqFbkMap[8] = {0,1,0,0,4,4,4,4};
680 /*added #defines instead of magic numbers*/
681 /*const static uint32_t rgSCHTomBinCoe[RG_SCH_MAX_NUM_UE_SEL_SUBBANDS][RG_SCH_MAX_TOT_NUM_SUBBANDS]={
682 {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},
683 {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},
684 {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},
685 {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},
686 {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},
687 {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}
691 /*ccpu00116923 - ADD - SRS present support*/
692 /*Tables Derived from 3GPP TS 36.211 Section 5.5.3.3 */
693 /* Table 5.5.3.3-1 */
695 const RgSchFddCellSpSrsSubfrmTbl rgSchFddCellSpSrsSubfrmTbl = {
696 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE},
697 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE},
698 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE},
699 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE},
700 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
701 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE},
702 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE},
703 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE},
704 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE},
705 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
706 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
707 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
708 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
709 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE},
710 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE},
711 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}
714 /* Table 5.5.3.3-2 */
715 const RgSchTddCellSpSrsSubfrmTbl rgSchTddCellSpSrsSubfrmTbl = {
716 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
717 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE},
718 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE},
719 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE},
720 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE},
721 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE},
722 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE},
723 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE},
724 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
725 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE},
726 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE},
727 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE},
728 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE},
729 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE},
730 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
731 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}
734 S8 rgSchCmnAper20n22DiffCqi[4] = {1, 2, 3, 4};
735 S8 rgSchCmnAper30n31DiffCqi[4] = {0, 1, 2, -1};
739 * @brief get Ue for dedicated preamble rach
743 * Function: rgSCHGetDedPrmUe
745 * Invoked by: rgSCHTomRaReqInd
747 * @param[in] RgSchCellCb *cell
748 * @param[in] TfuRaReqIndInfo *raReqInd
757 CmLteTimingInfo timingInfo,
761 RgSchCmnCell *cellSch = (RgSchCmnCell *)(cell->sc.sch);
763 DU_LOG("\nINFO --> SCH : rapId[%d] cellSch->rachCfg.dedPrmStart[%d] cellSch->rachCfg.numDedPrm[%d]\n",\
764 rapId,cellSch->rachCfg.dedPrmStart,cellSch->rachCfg.numDedPrm);
765 /* Finding UE in handOver List */
766 if ((rapId < cellSch->rachCfg.dedPrmStart) ||
767 (rapId > cellSch->rachCfg.dedPrmStart +
768 cellSch->rachCfg.numDedPrm - 1))
770 /* This ded Preamble corresponds to handover */
771 *ue = rgSCHCmnGetHoUe(cell, rapId);
772 DU_LOG("\nDEBUG --> SCH : ded Preamble corresponds to handover\n");
774 else/* Finding UE from PDCCH Order Mappings */
776 /* Get the UE which has transmitted this RaReq */
777 *ue = rgSCHCmnGetPoUe(cell, rapId, timingInfo);
778 DU_LOG("\nDEBUG --> SCH : UE from PDCCH Order Mapping\n");
783 * @brief Handler for processing Random Access request indication
788 * Function: rgSCHTomRaReqInd
790 * Handler for processing Random Access request indication recieved from
793 * Invoked by: RgLiTfuRaReqInd of LIM
796 * - Validate the information received: cellId value and raRnti values
797 * - Process the request: Call rgSCHRamProcRaReq (cell, raRnti, raReqInd)
799 * @param[in] RgSchCellCb *cell
800 * @param[in] TfuRaReqIndInfo *raReqInd
808 TfuRaReqIndInfo *raReqInd
815 Bool isEmtcUe = FALSE;
817 RgSchUeCb *ue = NULLP;
819 if(cell->cellId != raReqInd->cellId)
821 err.errType = RGSCHERR_TOM_RAREQIND;
822 err.errCause = RGSCHERR_TOM_INV_CELL_ID;
823 DU_LOG("\nERROR --> SCH : rgSCHTomRaReqInd(): No cell found with raReq cellId = (%d) errorType (%d)"
824 " errorCause(%d)",raReqInd->cellId, err.errType, err.errCause);
828 for (raRntiCnt = 0; raRntiCnt < raReqInd->nmbOfRaRnti; raRntiCnt++)
830 for (raReqCnt = 0; raReqCnt < raReqInd->rachInfoArr->numRaReqInfo; raReqCnt++)
832 rapId = raReqInd->rachInfoArr[raRntiCnt].raReqInfoArr[raReqCnt].rapId;
834 if(RGSCH_IS_DEDPRM(cell, rapId))
836 rgSCHGetDedPrmUe(cell, rapId, raReqInd->timingInfo, &ue);
839 /* Since rapId is within dedicated range and No ue context
840 * is found means it is a spurious rach. So ignore it.*/
845 if(FALSE == isEmtcUe)
847 #if (ERRCLASS & ERRCLS_DEBUG)
848 if(raReqInd->rachInfoArr[raRntiCnt].raRnti > RGSCH_MAX_RA_RNTI)
850 DU_LOG("\nERROR --> SCH : rgSCHTomRaReqInd(): raRnti is out of range\n");
854 ret = rgSCHRamProcRaReq(raReqCnt, cell, raReqInd->rachInfoArr[raRntiCnt].raRnti,
855 (TfuRachInfo *)&raReqInd->rachInfoArr[raRntiCnt],
856 raReqInd->timingInfo, ue, &err);
859 err.errType = RGSCHERR_TOM_RAREQIND;
860 DU_LOG("\nERROR --> SCH : RARNTI:%d rgSCHTomRaReqInd(): RAM processing failed errType(%d) "
861 "errCause(%d)", raReqInd->rachInfoArr[raRntiCnt].raRnti,
862 err.errType, err.errCause);
869 } /* rgSCHTomRaReqInd */
873 * @brief Handler for processing uplink CQI indication recieved from PHY.
877 * Function: rgSCHTomUlCqiInd
879 * Handler for processing uplink CQI indication recieved from PHY.
881 * Invoked by: RgLiTfuUlCqiInd
885 * - Invoke scheduler to push reported CQI info rgSCHUtlUlCqiInd
887 * @param[in] RgSchCellCb *cell
888 * @param[in] TfuUlCqiIndInfo *ulCqiInd
896 TfuUlCqiIndInfo *ulCqiInd
901 TfuUlCqiRpt *ulCqiInfo;
903 node = ulCqiInd->ulCqiRpt.first;
904 if(cell->cellId != ulCqiInd->cellId)
906 DU_LOG("\nERROR --> SCH : rgSCHTomUlCqiInd() Unable to get the ulCqiInd cell with id(%d)",
911 for (;node; node=node->next)
913 ulCqiInfo = (TfuUlCqiRpt *)node->node;
914 #if (ERRCLASS & ERRCLS_DEBUG)
915 if(ulCqiInfo->numSubband == 0)
917 DU_LOG("\nERROR --> SCH : Num Subband is"
918 "out of range RNTI:%d",ulCqiInfo->rnti);
922 if((ue = rgSCHDbmGetUeCb(cell, ulCqiInfo->rnti)) == NULLP)
925 if((ue = rgSCHDbmGetSpsUeCb(cell, ulCqiInfo->rnti)) == NULLP)
928 DU_LOG("\nERROR --> SCH : Unable to get the ue for RNTI:%d", ulCqiInfo->rnti);
932 /* wideband cqi is directly reported now. and also isTxPort0 */
933 rgSCHUtlUlCqiInd(cell, ue, ulCqiInfo);
936 } /* rgSCHTomUlCqiInd */
939 * @brief Handler for processing PUCCH power adjustment indication
943 * Function: rgSCHTomPucchDeltaPwrInd
945 * Handler for processing PUCCH power adjustment indication
948 * Invoked by: RgLiTfuPucchDeltaPwrInd
952 * - Invoke scheduler to push reported CQI info rgSCHUtlPucchDeltaPwrInd
954 * @param[in] RgSchCellCb *cell
955 * @param[in] TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
960 S16 rgSCHTomPucchDeltaPwrInd
963 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
968 TfuPucchDeltaPwr *ueElem;
970 if(cell->cellId != pucchDeltaPwr->cellId)
972 DU_LOG("\nERROR --> SCH : rgSCHTomPucchDeltaPwrInd() Unable to get the pucchDeltaPwr cell with id(%d)",
973 pucchDeltaPwr->cellId);
977 node = pucchDeltaPwr->pucchDeltaPwrLst.first;
978 for (;node; node=node->next)
980 ueElem = (TfuPucchDeltaPwr *)node->node;
981 if((ue = rgSCHDbmGetUeCb(cell, ueElem->rnti)) == NULLP)
984 if((ue = rgSCHDbmGetSpsUeCb(cell, ueElem->rnti)) == NULLP)
987 DU_LOG("\nERROR --> SCH : RNTI:%d "
988 "rgSCHTomPucchDeltaPwrInd() Unable to get the ue ",
993 rgSCHUtlPucchDeltaPwrInd(cell, ue, ueElem->pucchDeltaPwr);
996 } /* rgSCHTomPucchDeltaPwrInd */
999 * @brief Handler for processing harq ACK/NACK indication recieved from PHY.
1003 * Function: rgSCHTomHarqAckInd
1005 * Handler for processing harq ACK/NACK indication recieved from PHY.
1007 * Invoked by: RgLiTfuHqInd
1010 * For each HqAckInfo received
1012 * - If UE doesnt exist look for a RaCb and invoke rgSCHRamMsg4FdbkInd
1013 * - Invoke HARQ module to pass HARQ-ACK info rgSCHDhmHqFdbkInd
1015 * @param[in] TfuHqIndInfo *harqAckInd
1020 S16 rgSCHTomHarqAckInd
1023 TfuHqIndInfo *harqAckInd
1034 RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1036 RgSchCellCb *iterCellP;
1038 if(cell->cellId != harqAckInd->cellId)
1040 DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() Unable to get"
1041 " the cell for cellId (%d)", harqAckInd->cellId);
1042 err.errType = RGSCHERR_TOM_HARQACKIND;
1043 err.errCause = RGSCHERR_TOM_INV_CELL_ID;
1047 node = harqAckInd->hqIndLst.first;
1048 for (;node; node=node->next)
1050 hqInfo = (TfuHqInfo *)node->node;
1052 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1053 TfuHqFdbk fdbk = hqInfo->isAck[0];
1054 raCb = rgSCHDbmGetRaCb (cell, hqInfo->rnti);
1055 ue = rgSCHDbmGetUeCb (cell, hqInfo->rnti);
1056 if (ue != NULLP && raCb == NULLP)
1058 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, harqAckInd->timingInfo, fdbk, &err)) != ROK)
1060 err.errType = RGSCHERR_TOM_HARQACKIND;
1061 DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() "
1062 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1063 err.errType, err.errCause);
1071 if ((rgSCHDhmRlsDlsfHqProc (cell, harqAckInd->timingInfo)) != ROK)
1073 DU_LOG("\nERROR --> SCH : Unable to Release Downlink "
1074 "subframe for cellId (%d) ", cell->cellId);
1075 err.errType = RGSCHERR_TOM_HARQACKIND;
1078 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
1080 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
1082 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
1084 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
1085 if(rlsHqBufs->numUes)
1087 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
1088 RgSchMacRlsHq (&pst, rlsHqBufs);
1090 rlsHqBufs->numUes = 0;
1094 rlsHqBufs->numUes = 0;
1095 node = harqAckInd->hqIndLst.first;
1096 for (;node; node=node->next)
1098 hqInfo = (TfuHqInfo *)node->node;
1099 for(tbCnt=0; tbCnt<TFU_MAX_HARQ_FDBKS; tbCnt++)
1101 hqInfo->isAck[tbCnt]=(TfuHqFdbk)rgSchTomHqFbkMap[hqInfo->isAck[tbCnt]];
1103 raCb = rgSCHDbmGetRaCb (cell, hqInfo->rnti);
1104 ue = rgSCHDbmGetUeCb (cell, hqInfo->rnti);
1105 if (ue == NULLP && raCb != NULLP)
1108 rgSCHRamMsg4FdbkInd (raCb);
1110 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1111 cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
1113 err.errType = RGSCHERR_TOM_HARQACKIND;
1114 DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() HARQ"
1115 " feedback processing failed errType(%d) errCause(%d)",
1116 err.errType, err.errCause);
1121 else if (ue != NULLP && raCb == NULLP)
1123 /* Get the Downlink HARQ entity from ue */
1124 if ((rgSCHDhmHqFdbkInd (ue, RGSCH_HQ_FDB_IND_CB_TYPE_HQ_ENT,
1125 cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
1127 err.errType = RGSCHERR_TOM_HARQACKIND;
1128 DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() "
1129 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1130 err.errType, err.errCause);
1134 else if (ue != NULLP && raCb != NULLP)
1136 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1137 cell, harqAckInd->timingInfo, hqInfo, rlsHqBufs, &err)) != ROK)
1139 err.errType = RGSCHERR_TOM_HARQACKIND;
1140 DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() HARQ"
1141 " feedback processing failed errType(%d) errCause(%d).",
1142 err.errType, err.errCause);
1148 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to get the "
1149 "UE CB or RA CB ", hqInfo->rnti);
1150 err.errType = RGSCHERR_TOM_HARQACKIND;
1155 /* Check with TDD call DHM*/
1156 if ((rgSCHDhmRlsDlsfHqProc (cell, harqAckInd->timingInfo)) != ROK)
1158 DU_LOG("\nERROR --> SCH : Unable to Release Downlink "
1159 "subframe for cellId (%d) ", harqAckInd->cellId);
1160 err.errType = RGSCHERR_TOM_HARQACKIND;
1163 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
1165 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
1167 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
1169 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
1170 if(rlsHqBufs->numUes)
1172 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
1173 RgSchMacRlsHq (&pst, rlsHqBufs);
1175 rlsHqBufs->numUes = 0;
1180 } /* rgSCHTomHarqAckInd */
1184 * @brief Handler for processing Scheduling Request indication
1185 * recieved from PHY for a list of UEs.
1189 * Function: rgSCHTomSrInd
1191 * Handler for processing Scheduling Request indication recieved from PHY
1194 * Invoked by: RgLiTfuSrInd
1198 * - Invoke scheduler to indicate SR rgSCHUtlSrRcvd
1200 * @param[in] TfuSrIndInfo *srInd
1217 if(cell->cellId != srInd->cellId)
1219 DU_LOG("\nERROR --> SCH : Unable to get the cell for srcInd cellId"
1220 ":%d ", srInd->cellId);
1221 err.errType = RGSCHERR_TOM_SRIND;
1222 err.errCause = RGSCHERR_TOM_INV_CELL_ID;
1227 node = srInd->srLst.first;
1228 for (;node; node=node->next)
1232 srInfo = (TfuSrInfo *)node->node;
1233 ue = rgSCHDbmGetUeCb (cell, srInfo->rnti);
1236 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to get the UE CB",
1240 rgSCHUtlHdlUlTransInd(cell, ue, srInd->timingInfo);
1241 /*Need to activate UE as SR received*/
1242 if (ue->isDrxEnabled)
1244 rgSCHDrxSrInd(cell, ue);
1246 ret = rgSCHUtlSrRcvd (cell, ue, srInd->timingInfo, &err);
1249 err.errType = RGSCHERR_TOM_SRIND;
1250 DU_LOG("\nERROR --> SCH : Scheduler processing failed "
1251 "errType(%d) errCause(%d) RNTI:%d", err.errType, err.errCause,srInfo->rnti);
1256 } /* end of rgSCHTomSrInd */
1259 * @brief Handler for processing downlink CQI indication recieved from
1264 * Function: rgSCHTomDoaInd
1266 * Handler for processing DOA recieved from PHY
1269 * Invoked by: RgLiTfuDoaInd
1273 * - Invoke scheduler to indicate DOA rgSCHUtlDoaInd
1275 * @param[in] TfuDoaIndInfo *doaInd
1283 TfuDoaIndInfo *doaInd
1290 if(cell->cellId != doaInd->cellId)
1292 DU_LOG("\nERROR --> SCH : Unable to get the cell for doaInd cellId"
1293 ":%d", doaInd->cellId);
1298 node = doaInd->doaRpt.first;
1299 for (;node; node=node->next)
1301 doaInfo = (TfuDoaRpt *)node->node;
1302 ue = rgSCHDbmGetUeCb (cell, doaInfo->rnti);
1305 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to get the UE CB",
1309 rgSCHUtlDoaInd(cell, ue, doaInfo);
1312 } /* rgSCHTomDoaInd */
1314 * @brief Handler for processing downlink CQI indication recieved from
1319 * Function: rgSCHTomDlCqiInd
1321 * Handler for processing downlink CQI indication recieved from PHY
1324 * Invoked by: RgLiTfuDlCqiInd
1328 * - Invoke scheduler to indicate DL CQI rgSCHUtlDlCqiInd
1330 * @param[in] TfuDlCqiIndInfo *dlCqiInd
1335 S16 rgSCHTomDlCqiInd
1338 TfuDlCqiIndInfo *dlCqiInd
1343 TfuDlCqiRpt *dlCqiInfo;
1345 if(cell->cellId != dlCqiInd->cellId)
1347 DU_LOG("\nERROR --> SCH : Unable to get the cell for cellId"
1348 ":%d", dlCqiInd->cellId);
1353 node = dlCqiInd->dlCqiRptsLst.first;
1354 for (;node; node=node->next)
1356 dlCqiInfo = (TfuDlCqiRpt *)node->node;
1357 ue = rgSCHDbmGetUeCb (cell, dlCqiInfo->rnti);
1360 DU_LOG("\nERROR --> SCH : RNTI:%dUnable to get the UE CB",
1364 rgSCHUtlDlCqiInd(cell, ue, dlCqiInfo, dlCqiInd->timingInfo);
1365 rgSCHUtlHdlUlTransInd(cell, ue, dlCqiInd->timingInfo);
1368 } /* rgSCHTomDlCqiInd */
1371 * @brief Handler for moving PCQI instance for the next periodic occasion
1375 * Function: rgSCHTomUtlMovePcqiNxtOccasion
1377 * Handler for moving PCQI instance for the next periodic occasion
1379 * Invoked by: rgSCHTomUtlFill*
1382 * - For a UE move its occurence instance to next occasion
1383 * depending on its periodicity
1384 * - Remove it from the current list and insert it to the list
1385 * having the index matching with the derived number.
1387 * @param[in] RgSchCellCb *cell,
1388 * [in] RgSchUeCb *ue
1393 static S16 rgSCHTomUtlMovePcqiNxtOccasion
1397 RgSchUePCqiCb *cqiCb
1400 uint16_t cqiIdx = 0;
1402 CmLteTimingInfo timingInfo;
1404 if(cqiCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_SB_REP)
1407 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timingInfo, TFU_DELTA);
1409 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, timingInfo,
1410 TFU_RECPREQ_DLDELTA);
1412 RG_SCH_ADD_TO_CRNT_TIME(timingInfo,timingInfo,cqiCb->cqiPeri);
1413 rgSCHTomUtlPcqiSbCalcBpIdx(timingInfo,ue,cqiCb);
1415 /* Compute Next Transmission Instance */
1416 cqiIdx = cqiCb->cqiPeri + cqiCb->nCqiTrIdx;
1417 cqiIdx = cqiIdx%RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1418 /* Delete from current List and move to new list */
1419 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst,
1422 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to remove node",
1425 cqiCb->nCqiTrIdx = cqiIdx;
1426 cmLListAdd2Tail(&(cell->pCqiSrsSrLst[cqiCb->nCqiTrIdx].cqiLst),
1427 &(cqiCb->cqiLstEnt));
1429 rgSCHUtlSCellHndlCqiCollsn(cqiCb);
1433 } /* rgSCHTomUtlMovePcqiNxtOccasion */
1436 * @brief Handler for moving RI instance for the next periodic occasion
1440 * Function: rgSCHTomUtlMovePriNxtOccasion
1442 * Handler for moving PCQI instance for the next periodic occasion
1444 * Invoked by: rgSCHTomUtlFill*
1447 * - For a UE move its occurence instance to next occasion
1448 * depending on its periodicity
1449 * - Remove it from the current list and insert it to the list
1450 * having the index matching with the derived number.
1452 * @param[in] RgSchCellCb *cell,
1453 * [in] RgSchUeCb *ue
1458 static S16 rgSCHTomUtlMovePriNxtOccasion
1467 uint16_t effPeriodicity;
1468 uint16_t riTrInsTime;
1472 crntTime = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)
1473 +(cell->crntTime.slot);
1474 #ifdef XEON_SPECIFIC_CHANGES
1475 RGSCHCPYTIMEINFO(cell->crntTime, ue->riRecpTime);
1477 /* Compute Next Transmission Instance */
1478 if (riCb->cqiCfg.cqiSetup.cqiRepType == RGR_UE_PCQI_WB_REP)
1480 effPeriodicity = riCb->cqiPeri * riCb->riPeri;
1481 tempIdx = effPeriodicity + riCb->nRiTrIdx;
1485 effPeriodicity = (riCb->h * riCb->cqiPeri * riCb->riPeri);
1486 /* In case of SFN wraparound, the SB CQI reporting cycle breaks
1487 * and RI->WB CQI->SBCQI.. should resume. RI is repositioned
1488 * accordingly. WBCQI handling is naturally accomplished */
1489 if ((crntTime + TFU_RECPREQ_DLDELTA + effPeriodicity) >
1490 (RGSCH_MAX_SUBFRM_5G - 1))
1492 riTrInsTime = (effPeriodicity - riCb->cqiOffset + riCb->riOffset) % effPeriodicity;
1493 tempIdx = RGSCH_MAX_SUBFRM_5G + (effPeriodicity - riTrInsTime);
1494 /* In case of SFN wraparound, riDist should be distance from crntTime
1495 * + TFU_RECPREQ_DLDELTA to tempIdx. Updating effPeriodicity
1496 * to make riDist calculation consistent for both SFN wraparound
1497 * case and normal case */
1498 effPeriodicity = tempIdx - TFU_RECPREQ_DLDELTA - crntTime;
1502 tempIdx = effPeriodicity + riCb->nRiTrIdx;
1505 riIdx = tempIdx % RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1506 if (effPeriodicity >= RG_SCH_PCQI_SRS_SR_TRINS_SIZE)
1508 riDist = rgSCHUtlFindDist((uint16_t)(crntTime + TFU_RECPREQ_DLDELTA),
1509 (uint16_t)(crntTime + TFU_RECPREQ_DLDELTA + effPeriodicity));
1516 /* ccpu00138306- If Periodicity is equal to Queue Size or multiple of it
1517 * then the next occasion idx will be same as current Idx, Hence need not
1520 if((effPeriodicity%RG_SCH_PCQI_SRS_SR_TRINS_SIZE) != 0)
1522 /* Delete from current List and move to new list */
1523 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[riCb->nRiTrIdx].riLst,
1526 DU_LOG("\nERROR --> SCH : [%d]UEID:Unable to remove node",
1529 RG_SCH_RECORD(&riCb->histElem,RGSCH_ACTION_DEL, &cell->pCqiSrsSrLst[riCb->nRiTrIdx].riLst);
1530 cmLListAdd2Tail(&cell->pCqiSrsSrLst[riIdx].riLst,
1532 RG_SCH_RECORD(&riCb->histElem,RGSCH_ACTION_ADD, &cell->pCqiSrsSrLst[riIdx].riLst);
1541 riCb->nRiTrIdx = riIdx;
1542 riCb->riDist = riDist;
1545 rgSCHUtlSCellHndlRiCollsn(riCb);
1548 } /* rgSCHTomUtlMovePriNxtOccasion */
1551 * @brief Handler for moving SR instance for the next periodic occasion
1555 * Function: rgSCHTomUtlMoveSrNxtOccasion
1557 * Handler for moving SR instance for the next periodic occasion
1559 * Invoked by: rgSCHTomUtlFill*
1562 * - For a UE move its occurence instance to next occasion
1563 * depending on its periodicity
1564 * - Remove it from the current list and insert it to the list
1565 * having the index matching with the derived number.
1567 * @param[in] RgSchCellCb *cell,
1568 * [in] RgSchUeCb *ue
1573 static S16 rgSCHTomUtlMoveSrNxtOccasion
1581 /* Compute Next Transmission Instance */
1582 srIdx = ue->srCb.peri + ue->srCb.nSrTrIdx;
1583 srIdx = srIdx%RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1584 /* Delete from current List and move to new list */
1585 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[ue->srCb.nSrTrIdx].srLst,
1586 &ue->srCb.srLstEnt))
1588 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to remove node",
1591 ue->srCb.nSrTrIdx = srIdx;
1592 cmLListAdd2Tail(&cell->pCqiSrsSrLst[ue->srCb.nSrTrIdx].srLst,
1593 &ue->srCb.srLstEnt);
1596 } /* rgSCHTomUtlMoveSrNxtOccasion */
1599 * @brief Handler for moving SRS instance for the next periodic occasion
1603 * Function: rgSCHTomUtlMoveSrsNxtOccasion
1605 * Handler for moving SRS instance for the next periodic occasion
1607 * Invoked by: rgSCHTomUtlFill*
1610 * - For a UE move its occurence instance to next occasion
1611 * depending on its periodicity
1612 * - Remove it from the current list and insert it to the list
1613 * having the index matching with the derived number.
1615 * @param[in] RgSchCellCb *cell,
1616 * [in] RgSchUeCb *ue
1621 static S16 rgSCHTomUtlMoveSrsNxtOccasion
1633 crntTime = (cell->crntTime.sfn * RGSCH_NUM_SUB_FRAMES_5G)
1634 +(cell->crntTime.slot);
1636 /* Compute Next Transmission Instance */
1637 tempIdx = ue->srsCb.peri + ue->srsCb.nSrsTrIdx;
1638 srsIdx = tempIdx %RG_SCH_PCQI_SRS_SR_TRINS_SIZE;
1639 if (ue->srsCb.peri > RG_SCH_PCQI_SRS_SR_TRINS_SIZE)
1641 srsDist = rgSCHUtlFindDist((uint16_t)(crntTime + TFU_RECPREQ_DLDELTA),
1642 (uint16_t)(crntTime + TFU_RECPREQ_DLDELTA + ue->srsCb.peri));
1649 /* ccpu00138306- If Periodicity is equal to Queue Size or multiple of it
1650 * then the next occasion idx will be same as current Idx, Hence need not
1653 if((ue->srsCb.peri%RG_SCH_PCQI_SRS_SR_TRINS_SIZE) != 0)
1655 /* Delete from current List and move to new list */
1656 if (NULLP == cmLListDelFrm(&cell->pCqiSrsSrLst[ue->srsCb.nSrsTrIdx].srsLst,
1657 &ue->srsCb.srsLstEnt))
1659 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to remove node",
1662 cmLListAdd2Tail(&cell->pCqiSrsSrLst[srsIdx].srsLst,
1663 &ue->srsCb.srsLstEnt);
1672 ue->srsCb.nSrsTrIdx = srsIdx;
1673 ue->srsCb.srsDist = srsDist;
1675 } /* rgSCHTomUtlMoveSrsNxtOccasion */
1679 * @brief Handler for processing RAW CQI indication recieved from
1684 * Function: rgSCHTomRawCqiInd
1686 * Handler for processing RAW CQI indication recieved from PHY
1689 * Invoked by: RgLiTfuRawCqiInd
1693 * - Invoke scheduler to indicate Raw CQI rgSCHUtlRawCqiInd
1695 * @param[in] TfuRawCqiIndInfo *rawCqiInd
1700 S16 rgSCHTomRawCqiInd
1703 TfuRawCqiIndInfo *rawCqiInd
1708 TfuRawCqiRpt* rawCqiInfo;
1712 RgInfRlsHqInfo *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1713 RgSchCellCb *iterCellP;
1724 if(cell->cellId != rawCqiInd->cellId)
1726 DU_LOG("\nERROR --> SCH : Unable to get the cell for cellId"
1727 ":%d", rawCqiInd->cellId);
1732 node = rawCqiInd->rawCqiRpt.first;
1733 for (;node; node=node->next)
1735 rawCqiInfo = (TfuRawCqiRpt *)node->node;
1736 ue = rgSCHDbmGetUeCb (cell, rawCqiInfo->crnti);
1737 raCb = rgSCHDbmGetRaCb (cell, rawCqiInfo->crnti);
1741 DU_LOG("\nERROR --> SCH : CRNTI:%d Unable to get the UECB",
1748 if (rawCqiInfo->numBits >= 5)
1749 DU_LOG("\nINFO --> SCH : cellId [%d] crnti [%d] numBits [%d] uciPayload [0x%08x] sfn/sf [%d:%d]\n",
1750 cell->cellId, rawCqiInfo->crnti, rawCqiInfo->numBits, rawCqiInfo->uciPayload,
1751 rawCqiInd->timingInfo.sfn, rawCqiInd->timingInfo.slot);
1753 if (rawCqiInfo->numBits == 1)
1755 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1756 uint8_t fdbk = TFU_HQFDB_NACK;
1757 /* Process HARQ FdbkInd */
1758 hqAck = (rawCqiInfo->uciPayload >> 31) & 0x1;
1761 fdbk = TFU_HQFDB_ACK;
1762 hqInfo.isAck[0] = fdbk;
1764 if (ue != NULLP && raCb == NULLP)
1766 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, rawCqiInd->timingInfo, fdbk, &err)) != ROK)
1768 err.errType = RGSCHERR_TOM_HARQACKIND;
1769 DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() "
1770 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1771 err.errType, err.errCause);
1775 else if (ue == NULLP && raCb != NULLP)
1777 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1778 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1780 err.errType = RGSCHERR_TOM_HARQACKIND;
1781 DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() HARQ"
1782 " feedback processing failed errType(%d) errCause(%d)",
1783 err.errType, err.errCause);
1788 else if (ue != NULLP && raCb != NULLP)
1790 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1791 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1793 err.errType = RGSCHERR_TOM_HARQACKIND;
1794 DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() HARQ"
1795 " feedback processing failed errType(%d) errCause(%d).",
1796 err.errType, err.errCause);
1802 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to get the "
1803 "UE CB or RA CB ", rawCqiInfo->crnti);
1804 err.errType = RGSCHERR_TOM_HARQACKIND;
1808 DU_LOG("rawCqiInfo->numBits [%d] uciPayload [0x%08x] sfn/sf [%d:%d]\n", rawCqiInfo->numBits,
1809 rawCqiInfo->uciPayload, rawCqiInd->timingInfo.sfn, rawCqiInd->timingInfo.slot);
1812 else if (rawCqiInfo->numBits == 5)
1814 /* Process CQI-RI Ind*/
1815 ri = (rawCqiInfo->uciPayload >> 27) & 0x1;
1816 cqi = (rawCqiInfo->uciPayload >> 28) & 0xF;
1820 DU_LOG("\nERROR --> SCH : UE[%d] CQI[%d] Invalid\n", ue->ueId, cqi);
1823 ue->ue5gtfCb.mcs = rgSch5gtfCqi2Mcs[cqi - 1];
1824 ue->ue5gtfCb.rank = ri + 1;
1826 if (rawCqiInfo->numBits > 1)
1828 ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
1829 ueDl->mimoInfo.cwInfo[0].cqi = cqi;
1830 ueDl->cqiFlag = TRUE;
1831 rgSCHCmnDlSetUeAllocLmtLa(cell, ue);
1832 // rgSCHCheckAndSetTxScheme(cell, ue);
1837 DU_LOG("\nERROR --> SCH : UE[%d] CQI[%d] MCS[%d] RI[%d]\n", ue->ueId, cqi, ue->ue5gtfCb.mcs, ri);
1840 else if (rawCqiInfo->numBits == 6)
1842 rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
1843 TfuHqFdbk fdbk = TFU_HQFDB_NACK;
1844 /* Process both HARQ and CQI-RI Ind*/
1845 ri = (rawCqiInfo->uciPayload >> 26) & 0x1;
1846 cqi = (rawCqiInfo->uciPayload >> 27) & 0xF;
1847 hqAck = (rawCqiInfo->uciPayload >> 31) & 0x1;
1850 DU_LOG("\nERROR --> SCH : UE[%d] CQI[%d] Invalid\n", ue->ueId, cqi);
1853 ue->ue5gtfCb.mcs = rgSch5gtfCqi2Mcs[cqi - 1];
1854 ue->ue5gtfCb.rank = ri + 1;
1856 if (rawCqiInfo->numBits > 1)
1858 ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
1859 ueDl->mimoInfo.cwInfo[0].cqi = cqi;
1860 ueDl->cqiFlag = TRUE;
1861 rgSCHCmnDlSetUeAllocLmtLa(cell, ue);
1862 // rgSCHCheckAndSetTxScheme(cell, ue);
1867 fdbk = TFU_HQFDB_ACK;
1868 hqInfo.isAck[0] = fdbk;
1870 if (ue != NULLP && raCb == NULLP)
1872 if ((rgSCHDhm5gtfHqFdbkInd (ue, cell, rawCqiInd->timingInfo, fdbk, &err)) != ROK)
1874 err.errType = RGSCHERR_TOM_HARQACKIND;
1875 DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() "
1876 "HARQ feedback processing failed errType(%d)errCause(%d)n",
1877 err.errType, err.errCause);
1881 else if (ue == NULLP && raCb != NULLP)
1883 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1884 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1886 err.errType = RGSCHERR_TOM_HARQACKIND;
1887 DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() HARQ"
1888 " feedback processing failed errType(%d) errCause(%d)",
1889 err.errType, err.errCause);
1894 else if (ue != NULLP && raCb != NULLP)
1896 if ((rgSCHDhmHqFdbkInd (raCb, RGSCH_HQ_FDB_IND_CB_TYPE_RA_CB,
1897 cell, rawCqiInd->timingInfo, &hqInfo, rlsHqBufs, &err)) != ROK)
1899 err.errType = RGSCHERR_TOM_HARQACKIND;
1900 DU_LOG("\nERROR --> SCH : rgSCHTomHarqAckInd() HARQ"
1901 " feedback processing failed errType(%d) errCause(%d).",
1902 err.errType, err.errCause);
1908 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to get the "
1909 "UE CB or RA CB ", rawCqiInfo->crnti);
1910 err.errType = RGSCHERR_TOM_HARQACKIND;
1915 DU_LOG("\nERROR --> SCH : UE[%u] CQI[%u] MCS[%u] RI[%u] HQ[%u]\n", ue->ueId, cqi, ue->ue5gtfCb.mcs, ri, hqAck);
1920 if ((rgSCHDhmRlsDlsfHqProc (cell, rawCqiInd->timingInfo)) != ROK)
1922 DU_LOG("\nERROR --> SCH : Unable to Release Downlink "
1923 "subframe for cellId (%d) ", cell->cellId);
1924 err.errType = RGSCHERR_TOM_HARQACKIND;
1927 for (cellIdx = 0; cellIdx < CM_LTE_MAX_CELLS; cellIdx++)
1929 if (NULLP != rgSchCb[cell->instIdx].cells[cellIdx])
1931 iterCellP = rgSchCb[cell->instIdx].cells[cellIdx];
1933 rlsHqBufs = &(iterCellP->rlsHqArr[iterCellP->crntHqIdx]);
1934 if(rlsHqBufs->numUes)
1936 rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], iterCellP->macInst);
1937 RgSchMacRlsHq (&pst, rlsHqBufs);
1939 rlsHqBufs->numUes = 0;
1943 } /* rgSCHTomRawCqiInd */
1946 * @brief Handler for processing SRS indication recieved from
1951 * Function: rgSCHTomSrsInd
1953 * Handler for SRS indication recieved from PHY
1956 * Invoked by: RgLiTfuSrsInd
1960 * - Invoke scheduler to indicate UL SRS rgSCHUtlSrsInd
1962 * @param[in] TfuSrsIndInfo *srsInd
1970 TfuSrsIndInfo *srsInd
1977 if(cell->cellId != srsInd->cellId)
1979 DU_LOG("\nERROR --> SCH : Unable to get the cell for cellId"
1980 ":%d", srsInd->cellId);
1984 node = srsInd->srsRpt.first;
1985 for (;node; node=node->next)
1987 srsInfo = (TfuSrsRpt *)node->node;
1988 ue = rgSCHDbmGetUeCb (cell, srsInfo->ueId);
1991 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to get the "
1992 "UE CB", srsInfo->ueId);
1995 rgSCHUtlSrsInd(cell, ue, srsInfo, srsInd->timingInfo);
1996 rgSCHUtlHdlUlTransInd(cell, ue, srsInd->timingInfo);
1999 } /* rgSCHTomSrsInd */
2003 * Fun: rgSCHTomUtlGenIndices
2005 * Desc: This function reconstructs the Subband Indices for
2006 * of M selected Subbands conveyed by the UE for APeriodic Modes
2007 * 2-0 and 2-2. It decodes the Label which uniquely encodes M out
2015 * File: rg_sch_utl.c
2019 static S16 rgSCHTomUtlGenIndices
2025 TfuSubbandInfo* sbInfo
2028 uint8_t idx, kval, xval, xmin;
2031 for(kval=0; kval<posM;kval++)
2034 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe, (posM-kval-1));
2035 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe[posM-kval-1], (valN-xval-1));
2036 binCoe = rgSCHTomBinCoe[posM-kval-1][valN-xval-1];
2040 RGSCH_ARRAY_BOUND_CHECK_WITH_POS_IDX(0, rgSCHTomBinCoe[posM-kval-1], (valN-xval-1));
2041 binCoe = rgSCHTomBinCoe[posM-kval-1][valN-xval-1];
2044 sbInfo[kval].numRb = valK;
2045 sbInfo[kval].rbStart = idx*valK;
2047 label = label-binCoe;
2050 } /* end of rgSCHTomUtlGenIndices*/
2054 * @brief Handler for processing decode failure indication recieved from
2059 * Function: rgSCHTomCrcInd
2061 * Handler for processing decode failure indication recieved from
2062 * PHY for a set of UEs.
2064 * Invoked by: RgLiTfuCrcInd of rg_sch.x
2067 * - Validate the information received and retrieve cell and ue.
2068 * - Process Decode failure Indication: Call rgSCHUhmProcHqFailure().
2070 * @param[in] TfuCrcIndInfo *crcInd
2078 TfuCrcIndInfo *crcInd
2081 RgSchUeCb *ue = NULLP;
2082 RgSchRaCb *raCb = NULLP;
2084 TfuCrcInfo *crcInfo;
2085 #ifdef RG_ULSCHED_AT_CRC
2088 CmLteTimingInfo crntHiDci0Frm;
2089 //RgSchCmnUlCell *cellUl;
2090 Inst inst = cell->instIdx;
2091 TfuCntrlReqInfo *cntrlInfo;
2099 RgSchUlHqProcCb *hqProc;
2103 RgSchUlHqProcCb *ulHqProc;
2106 if(cell->cellId != crcInd->cellId)
2108 DU_LOG("\nERROR --> SCH : Unable to get the cell for cellId"
2109 ":%d", crcInd->cellId);
2112 #ifdef RG_ULSCHED_AT_CRC
2115 static CmLteTimingInfo lastCrc = {2000,0};
2116 CmLteTimingInfo crntCrc = cell->crntTime;
2117 if (RGSCH_TIMEINFO_SAME(lastCrc, crntCrc))
2119 /*Removed the WA to drop 2nd CRC*/
2120 DU_LOG("\nINFO --> SCH : Recieved CRC "
2121 "twice per TTI @(%u,%u)", cell->crntTime.sfn,
2122 cell->crntTime.slot);
2128 node = crcInd->crcLst.first;
2129 for (;node; node=node->next)
2131 crcInfo = (TfuCrcInfo*)node->node;
2132 ue = rgSCHDbmGetUeCb (cell, crcInfo->rnti);
2136 /* Fetch from SPS List */
2137 ue = rgSCHDbmGetSpsUeCb(cell, crcInfo->rnti);
2141 raCb = rgSCHDbmGetRaCb (cell, crcInfo->rnti);
2148 /* Added Ul TB count for Uplink data scheduled*/
2152 ulHqProc = &(raCb->msg3HqProc);
2153 if(ulHqProc->remTx == (cell->rachCfg.maxMsg3Tx -1))
2155 cell->dlUlTbCnt.tbTransUlTotalCnt++;
2160 rgSCHUtlUlHqProcForUe(cell, crcInd->timingInfo, ue, &ulHqProc);
2161 if(ulHqProc->remTx == ((RgUeUlHqCb*)ulHqProc->hqEnt)->maxHqRetx)
2163 cell->dlUlTbCnt.tbTransUlTotalCnt++;
2168 if (crcInfo->isFailure == FALSE)
2172 rgSCHRamMsg3DatInd(raCb);
2174 /*ccpu00128820 - MOD - Msg3 alloc double delete issue*/
2175 hqProc = &(raCb->msg3HqProc);
2176 RGSCH_UPD_PHICH(cell->ulDlCfgIdx, crcInd->timingInfo.slot,
2184 gUlCrcPassCounter++;
2189 RGSCHCPYTIMEINFO(crcInd->timingInfo, ue->datIndTime);
2190 #ifndef MAC_SCH_STATS
2191 rgSCHUhmProcDatInd(cell, ue, crcInd->timingInfo);
2194 /** Stats update over here
2197 RgSchCmnUe *cmnUe = RG_SCH_CMN_GET_UE(ue,cell);
2199 rgSCHUhmProcDatInd(cell, ue, crcInd->timingInfo, cmnUe->ul.crntUlCqi[0]);
2201 #endif /* MAC_SCH_STATS */
2203 rgSCHUtlHdlUlTransInd(cell, ue, crcInd->timingInfo);
2205 rgSCHUtlHdlCrcInd(cell, ue, crcInd->timingInfo);
2213 /* SR_RACH_STATS : MSG3 Nack / DTX*/
2214 if (crcInfo->isDtx == TRUE)
2220 rgNumMsg3CrcFailed++;
2222 rgSCHRamMsg3FailureInd(raCb);
2224 rgSCHCmnEmtcHdlCrcFailInd(cell, raCb);
2226 /* Added Ul TB count for CRC Failure of MSG3 */
2228 ulHqProc = &(raCb->msg3HqProc);
2229 if(ulHqProc->remTx == (cell->rachCfg.maxMsg3Tx -1))
2231 cell->dlUlTbCnt.tbTransUlFaulty++;
2239 gUlCrcFailCounter++;
2244 #ifndef MAC_SCH_STATS
2245 rgSCHUhmProcHqFailure (cell, ue, crcInd->timingInfo, crcInfo->rv);
2248 RgSchCmnUe *cmnUe = RG_SCH_CMN_GET_UE(ue,cell);
2250 rgSCHUhmProcHqFailure (cell, ue, crcInd->timingInfo, crcInfo->rv, cmnUe->ul.crntUlCqi[0]);
2252 #endif /* MAC_SCH_STATS */
2253 rgSCHUtlHdlUlTransInd(cell, ue, crcInd->timingInfo);
2255 rgSCHUtlHdlCrcFailInd(cell, ue, crcInd->timingInfo);
2257 /* Added Ul TB count for CRC Failure of Uplink data */
2259 rgSCHUtlUlHqProcForUe(cell, crcInd->timingInfo, ue, &ulHqProc);
2260 if(ulHqProc->remTx == ((RgUeUlHqCb*)ulHqProc->hqEnt)->maxHqRetx)
2262 cell->dlUlTbCnt.tbTransUlFaulty++;
2269 /* ccpu00132653-ADD Added Sched_At_Crc Changes for TDD and optimized here
2270 the codebase across TDD and FDD*/
2271 #ifdef RG_ULSCHED_AT_CRC
2272 /* Changes to do uplink scheduling at CRC Indication */
2273 //cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
2274 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, crntHiDci0Frm, TFU_ULCNTRL_DLDELTA);
2277 rgSCHCmnRlsUlSf(cell,0);
2280 /* Allocating memory for CntrlReq as it required for both EMTC and
2282 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&cntrlInfo,
2283 sizeof(TfuCntrlReqInfo))) != ROK)
2285 DU_LOG("\nERROR --> SCH : Unable to Allocate TfuCntrlReqInfo "
2289 rgSCHCmnUlSch(cell);
2291 rgSCHL2Meas(cell,TRUE);
2293 /* Also, sending UL DCI and PHICH for just scheduled subframe */
2294 ulSf = rgSCHUtlSubFrmGet (cell, crntHiDci0Frm);
2296 if ((rgSCHTomUtlProcDlSfAtCrc (ulSf, crntHiDci0Frm, cell, cntrlInfo, &err)) != ROK)
2298 DU_LOG("\nERROR --> SCH : rgSCHTomCrcInd() Unable to process"
2299 " downlink subframe for cellId %d", crcInd->cellId);
2300 err.errType = RGSCHERR_TOM_TTIIND;
2303 #endif /* RG_ULSCHED_AT_CRC */
2305 } /* rgSCHTomCrcInd */
2308 * @brief Handler for processing timing Advance indication recieved from
2313 * Function: rgSCHTomTimingAdvInd
2315 * Handler for processing timing advance indication recieved from PHY
2318 * Invoked by: RgLiTfuTimingAdvInd
2322 * - Call DHM to update value of Timing Advance rgSCHDhmUpdTa.
2324 * @param[in] TfuTimingAdvIndInfo *timingAdvInd
2329 S16 rgSCHTomTimingAdvInd
2332 TfuTimingAdvIndInfo *timingAdvInd
2337 TfuTimingAdvInfo *timingAdvInfo;
2339 if(cell->cellId != timingAdvInd->cellId)
2341 DU_LOG("\nERROR --> SCH : Unable to get the cell for cellId"
2342 "=(%d)", timingAdvInd->cellId);
2347 node = timingAdvInd->timingAdvLst.first;
2348 for (;node; node=node->next)
2350 timingAdvInfo = (TfuTimingAdvInfo *)node->node;
2351 ue = rgSCHDbmGetUeCb (cell, timingAdvInfo->rnti);
2354 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to get the UE CB",
2355 timingAdvInfo->rnti);
2358 rgSCHDhmUpdTa (cell, ue, timingAdvInfo->timingAdv);
2361 } /* rgSCHTomTimingAdvInd */
2364 * @brief Handler for processing TTI indication recieved from
2365 * PHY for 'n' cells.
2369 * Function: rgSCHTomTtiInd
2371 * Handler for processing slot indication recieved from MAC
2372 * for a cell. This is split into the below Steps.
2374 * 1: Complete the Uplink and Common Channel Scheduling for each Cell
2375 * 2: Complete the UE specific Scheduling for each Cell / across Cells.
2376 * 3: Consolidate the subframe allocations and send to each MAC instance
2377 * 4: Fill the Tfu structures for DL and UL Config requests
2378 * 5: Handle the RGR Config messages per Cell
2380 * @param[in] SlotIndInfo *slotInd
2381 * @param[in] Inst schInst
2386 SlotIndInfo *slotInd,
2390 RgInfSfAlloc *subfrmAlloc;
2391 RgTfuCntrlReqInfo *cntrlInfo = NULLP;
2395 RgSchCellCb *cell[CM_LTE_MAX_CELLS];
2396 RgSchCellCb *cellLst[CM_LTE_MAX_CELLS];
2402 //rgSchTomFillCellTtiInfo(slotInd, schInst, &nCell, &cell[0]);
2404 schFillCrntTime(*slotInd,schInst);
2405 for (i = 0; i < nCell; i++)
2407 /* Perform UL and DL Common Channel scheduling */
2408 rgSchTomTtiUlAndDlCmnChSch (cell[i]);
2411 /* Perform scheduling in Order of
2415 for (i = 0; i < nCell; i++)
2418 if (cell[i]->isDlDataAllwd && (cell[i]->stopDlSch == FALSE))
2420 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell[i]);
2421 /* Perform DL Retx scheduling */
2422 cellSch->apisDl->rgSCHDlRetxSched(cell[i], &cellSch->allocInfo);
2426 rgSchCmnPreDlSch(cell, nCell, cellLst);
2427 for (i = 0; i < nCell; i++)
2429 /* Perform DL scheduling */
2430 rgSchTomTtiDlSch (cellLst[i]);
2432 rgSchCmnPstDlSch(cell[0]);
2434 for (i = 0; i < nCell; i++)
2437 #ifndef RG_ULSCHED_AT_CRC
2438 /* Perform UL scheduling for TDD */
2439 rgSCHCmnUlSch (cell[i]);
2443 /* Init SF Alloc info per Cell */
2444 for (i = 0; i < nCell; i++)
2446 subfrmAlloc = &(cell[i]->sfAllocArr[cell[i]->crntSfIdx]);
2447 rgSCHUtlResetSfAlloc(subfrmAlloc,FALSE,TRUE);
2449 for (i = 0; i < nCell; i++)
2451 if (cell[i]->isDlDataAllwd && (cell[i]->stopSiSch == FALSE))
2453 subfrmAlloc = &(cell[i]->sfAllocArr[cell[i]->crntSfIdx]);
2455 * TFU_DLDATA_DLDELTA is used in this calculation because the subfrmAlloc
2456 * timingInfo which is being calculated here will be used by MAC
2458 RG_SCH_ADD_TO_CRNT_TIME(cell[i]->crntTime, subfrmAlloc->timingInfo,
2459 RG_DL_DELTA - TFU_DLDATA_DLDELTA);
2460 /* Consolidate the Allocations and send response to MAC instances */
2461 rgSchTomTtiCnsldtSfAlloc (cell[i]);
2465 for (i = 0; i < nCell; i++)
2467 if (cell[i]->isDlDataAllwd && (cell[i]->stopSiSch == FALSE))
2469 /* Send the consolidated Alloc Info to MAC instances */
2470 rgSCHCmnSndCnsldtInfo (cell[i]);
2474 for (i = 0; i < nCell; i++)
2476 /* Fill control data from scheduler to PHY */
2477 if ((ret = rgSCHUtlAllocEventMem((cell[i]->instIdx), (Ptr *)&cntrlInfo,
2478 sizeof(RgTfuCntrlReqInfo))) != ROK)
2480 DU_LOG("\nERROR --> SCH : Unable to Allocate TfuCntrlReqInfo"
2486 /* Fill the TFU structures and send to CL */
2487 if(TRUE == cell[i]->emtcEnable)
2489 ret = rgSchEmtcTomTtiL1DlAndUlCfg (cell[i], cntrlInfo);
2493 && (NULLP != cntrlInfo))
2495 /* Fill the TFU structures and send to CL */
2496 rgSchTomTtiL1DlAndUlCfg (cell[i], cntrlInfo);
2500 rgSCHTomUtlSendSfnTick(cell[0]);
2503 for (i = 0; i < nCell; i++)
2505 /* Invoke non critical functions like measurements, etc */
2506 rgSchTomTtiMiscFunctions (cell[i]);
2511 uint32_t dbgUeIdChngAndDatReqInClCnt = 0;
2512 static uint32_t gTtiCount = 0;
2515 if(gTtiCount == 3000)
2517 #ifdef XEON_SPECIFIC_CHANGES
2518 DU_LOG("\nINFO --> SCH : SChed:: (P/S)::(%u/%u) \n",
2519 gPrimarySchedCount,gSCellSchedCount);
2521 DU_LOG("\nINFO --> SCH : HQFDBK :: %u\n",gHqFdbkCount);
2526 total = gPCellTb1AckCount + gPCellTb1NackCount + gPCellTb1DtxCount;
2527 total2 = gPCellTb2AckCount + gPCellTb2NackCount + gPCellTb2DtxCount;
2529 DU_LOG("\nINFO --> SCH : PCell:: TB1:: (A/N/D)::(%u/%u/%u) TB2:: (A/N/D)::(%u/%u/%u)\n",
2530 gPCellTb1AckCount,gPCellTb1NackCount,gPCellTb1DtxCount,
2531 gPCellTb2AckCount,gPCellTb2NackCount,gPCellTb2DtxCount);
2532 if ((total != 0 ) && total2 != 0)
2534 DU_LOG("\nINFO --> SCH : PCell:: TB1:: (AP/NP/DP)::(%.2f/%.2f/%.2f) TB2:: (AP/NP/DP)::(%.2f/%.2f/%.2f)\n",
2535 (float)gPCellTb1AckCount/total * 100,(float)gPCellTb1NackCount/total * 100,(float)gPCellTb1DtxCount/total * 100,
2536 (float)gPCellTb2AckCount/total2 *100 ,(float)gPCellTb2NackCount/total2 *100 ,(float)gPCellTb2DtxCount/total2 *2);
2539 total = gSCellTb1AckCount + gSCellTb1NackCount + gSCellTb1DtxCount;
2540 total2 = gSCellTb2AckCount + gSCellTb2NackCount + gSCellTb2DtxCount;
2543 DU_LOG("\nINFO --> SCH : SCell:: TB1:: (A/N/D)::(%u/%u/%u) TB2:: (A/N/D)::(%u/%u/%u)\n",
2544 gSCellTb1AckCount,gSCellTb1NackCount,gSCellTb1DtxCount,
2545 gSCellTb2AckCount,gSCellTb2NackCount,gSCellTb2DtxCount);
2546 if ((total != 0 ) && total2 != 0)
2548 DU_LOG("\nINFO --> SCH : SCell:: TB1:: (AP/NP/DP)::(%.2f/%.2f/%.2f) TB2:: (AP/NP/DP)::(%.2f/%.2f/%.2f)\n",
2549 (float)gSCellTb1AckCount/total * 100,(float)gSCellTb1NackCount/total * 100,(float)gSCellTb1DtxCount/total * 100,
2550 (float)gSCellTb2AckCount/total2 *100 ,(float)gSCellTb2NackCount/total2 *100 ,(float)gSCellTb2DtxCount/total2 *2);
2554 DU_LOG("\nINFO --> SCH : CQI:: Recp(Pucch/Pusch):Rcvd(pcqi/rawacqireport/apcqi/AppReprt)::(%u/%u):(%u/%u/%u/%u)\n",
2555 gCqiRecpCount,gCqiRecpPuschCount,gCqiRcvdCount,gRawACqiCount,
2556 gACqiRcvdCount,gCqiReptToAppCount);
2558 DU_LOG("\nINFO --> SCH : (F1BCS Count/Cqi/Ri/CqiDrop/PucchDrop/PuschCqiDrop)::(%u/%u/%u/%u/%u/%u)\n",
2559 gF1bCsCount,gCqiReqCount,gRiReqCount,gCqiDropCount,gPucchDropCount,gPuschCqiDropCount);
2561 DU_LOG("\nINFO --> SCH : UL::(DCI0/CrcPass/CrcFail)::(%u/%u/%u)\n"
2562 "gPcellZeroBoOcc:%u\t gScellZeroBoOcc:%u dbgUeIdChngAndDatReqInClCnt: %u\n"
2563 "DelayedDatReqInMac: %u DelayedDatReqInCl : %u gIccPktRcvrMemDropCnt :%u\n",
2569 dbgUeIdChngAndDatReqInClCnt,
2570 dbgDelayedDatReqInMac,
2571 gDropDatReqCnt, gIccPktRcvrMemDropCnt);
2573 DU_LOG("\nINFO --> SCH : SChed:: (P/S)::(%ld/%ld) \n",
2574 gPrimarySchedCount,gSCellSchedCount);
2576 DU_LOG("\nINFO --> SCH : HQFDBK :: %ld\n",gHqFdbkCount);
2579 DU_LOG("\nINFO --> SCH : PCell:: TB1:: (A/N/D)::(%ld/%ld/%ld) TB2:: (A/N/D)::(%ld/%ld/%ld)\n",
2580 gPCellTb1AckCount,gPCellTb1NackCount,gPCellTb1DtxCount,
2581 gPCellTb2AckCount,gPCellTb2NackCount,gPCellTb2DtxCount);
2583 DU_LOG("\nINFO --> SCH : SCell:: TB1:: (A/N/D)::(%ld/%ld/%ld) TB2:: (A/N/D)::(%ld/%ld/%ld)\n",
2584 gSCellTb1AckCount,gSCellTb1NackCount,gSCellTb1DtxCount,
2585 gSCellTb2AckCount,gSCellTb2NackCount,gSCellTb2DtxCount);
2587 DU_LOG("\nINFO --> SCH : CQI:: Recp(Pucch/Pusch):Rcvd(pcqi/rawacqireport/apcqi/AppReprt)::\
2588 (%ld/%ld):(%ld/%ld/%ld/%ld)\n",
2589 gCqiRecpCount,gCqiRecpPuschCount,gCqiRcvdCount,gRawACqiCount,
2590 gACqiRcvdCount,gCqiReptToAppCount);
2591 DU_LOG("\nINFO --> SCH : CQI:: PucchCqiSnrDropCnt/PucchCqiConfBitMaskDropCnt/PuschCqiConfMaskDropCount\
2592 :: (%ld/%ld/%ld) \n",gCqiPucchLowSnrDropCount,gCqiPucchConfMaskDropCount,gCqiPuschConfMaskDropCount);
2594 DU_LOG("\nINFO --> SCH : (F1BCS Count/Cqi/Ri/CqiDrop/PucchDrop/PuschCqiDrop)::(%ld/%ld/%ld/%ld/%ld/%ld)\n",
2595 gF1bCsCount,gCqiReqCount,gRiReqCount,gCqiDropCount,gPucchDropCount,gPuschCqiDropCount);
2597 DU_LOG("\nINFO --> SCH : UL::(DCI0/CrcPass/CrcFail)::(%ld/%ld/%ld)\n"
2598 "gPcellZeroBoOcc:%ld\t gScellZeroBoOcc:%ld dbgUeIdChngAndDatReqInClCnt: %ld\n"
2599 "DelayedDatReqInMac: %ld DelayedDatReqInCl : %ld gIccPktRcvrMemDropCnt :%ld\n",
2605 dbgUeIdChngAndDatReqInClCnt,
2606 dbgDelayedDatReqInMac,
2607 gDropDatReqCnt, gIccPktRcvrMemDropCnt);
2608 //DU_LOG("\nINFO --> SCH : delayedApiCnt:%ld",delayedApiCnt);
2612 rgSCHLaaPrintStats();
2614 gCaDbgNonCaFrmt = gIccPktRcvrMemDropCnt = 0;
2626 gCqiPucchLowSnrDropCount = 0;
2627 gCqiPucchConfMaskDropCount = 0;
2628 gCqiPuschConfMaskDropCount = 0;
2629 gPuschCqiDropCount = 0;
2632 gUlCrcPassCount = 0;
2633 gUlCrcFailCount = 0;
2636 gCqiRecpPuschCount = 0;
2639 gCqiReptToAppCount = 0;
2644 gPrimarySchedCount = 0;
2645 gSCellSchedCount = 0;
2646 gSCellTb1AckCount = 0;
2647 gSCellTb2AckCount = 0;
2648 gSCellTb2AckCount = 0;
2649 gSCellTb2NackCount = 0;
2650 gPCellTb1AckCount = 0;
2651 gPCellTb1NackCount = 0;
2652 gPCellTb2AckCount = 0;
2653 gPCellTb2NackCount = 0;
2654 gSCellTb1NackCount=0;
2656 gPCellTb1DtxCount = 0;
2657 gPCellTb2DtxCount = 0;
2658 gSCellTb1DtxCount = 0;
2659 gSCellTb2DtxCount = 0;
2660 gPcellZeroBoOcc = 0;
2661 gScellZeroBoOcc = 0;
2669 } /* rgSCHTomTtiInd */
2671 /** @brief This function does the TTI processin for the uplink subframe,
2672 * already populated by the scheduler.
2676 * Function: rgSCHTomUtlProcUlSf
2679 * - Loop through the Uplink allocations present in the uplink subframe.
2680 * - For each allocation Fill a data reception request to be sent to PHY
2681 * - Also fills the harq reception requests for the expected HQ feedbacks.
2684 * @param [in] RgSchCellCb *cell
2685 * @param [out] RgSchErrInfo *err
2691 static S16 rgSCHTomUtlProcUlSf
2698 TfuRecpReqInfo *recpReqInfo;
2700 uint16_t validIdx = 0; /* Index computed from recreq's timing info*/
2702 Inst inst = cell->instIdx;
2704 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&recpReqInfo,
2705 sizeof(TfuRecpReqInfo))) != ROK)
2707 DU_LOG("\nERROR --> SCH : Unable to Allocate TfuRecpReqInfo "
2709 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
2712 recpReqInfo->cellId = cell->cellId;
2713 cmLListInit(&recpReqInfo->ueRecpReqLst);
2715 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, recpReqInfo->timingInfo,
2716 TFU_RECPREQ_DLDELTA);
2718 /* Filling data Reception requests */
2719 ret = rgSCHTomUtlFillDatRecpReq(recpReqInfo, cell,
2724 DU_LOG("\nERROR --> SCH : Unable to fill Data recption "
2725 "requests for cell");
2726 RGSCH_FREE_MEM(recpReqInfo);
2729 /* Filling HARQ Reception requests */
2730 ret = rgSCHTomUtlFillHqFdbkRecpReq (recpReqInfo, cell, validIdx,err);
2733 DU_LOG("\nERROR --> SCH : Unable to fill Harq Feedback "
2734 "reception requests for cell");
2735 RGSCH_FREE_MEM(recpReqInfo);
2738 /* sending the RecpReq to Phy */
2739 //if (rgSCHUtlTfuRecpReq(inst, cell->tfuSap->sapCfg.suId, recpReqInfo) != ROK)
2741 DU_LOG("\nERROR --> SCH : Unable to send Cntrl info for cell");
2744 } /* end of rgSCHTomUtlProcUlSf */
2748 /** @brief This function does the TTI processin for the uplink subframe,
2749 * already populated by the scheduler.
2753 * Function: rgSCHTomUtlPrcUlTddSpclSf
2756 * - Fill the SRS Info for the Special Subframe in Reception Req.
2757 * - Send the Reception Req to TFU
2760 * @param [in] RgSchCellCb *cell
2761 * @param [out] RgSchErrInfo *err
2766 static S16 rgSCHTomUtlPrcUlTddSpclSf
2773 TfuRecpReqInfo *recpReqInfo;
2774 uint16_t validIdx; /* Index computed from recreq's timing info*/
2775 Inst inst = cell->instIdx;
2777 if ((ret = rgSCHUtlAllocEventMem(inst, (Ptr *)&recpReqInfo,
2778 sizeof(TfuRecpReqInfo))) != ROK)
2780 DU_LOG("\nERROR --> SCH : rgSCHTomUtlPrcUlTddSpclSf() Unable to "
2781 "Allocate TfuRecpReqInfo for cell");
2782 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
2785 recpReqInfo->cellId = cell->cellId;
2786 cmLListInit(&recpReqInfo->ueRecpReqLst);
2788 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, recpReqInfo->timingInfo, TFU_RECPREQ_DLDELTA);
2790 RG_SCH_GET_IDX_PCQISRSSR(recpReqInfo->timingInfo, validIdx);
2793 if(cell->srsCfg.isSrsCfgPres &&
2794 rgSchTddCellSpSrsSubfrmTbl[cell->srsCfg.srsSubFrameCfg][recpReqInfo->timingInfo.slot])
2796 recpReqInfo->srsPres = TRUE;
2800 recpReqInfo->srsPres = FALSE;
2803 /* Filling SRS Reception requests */
2804 ret = rgSCHTomUtlFillSrsRecpReq (recpReqInfo, cell, validIdx, err);
2807 DU_LOG("\nERROR --> SCH : rgSCHTomUtlPrcUlTddSpclSf() Unable to fill"
2808 " SRS recption requests for cell");
2809 RGSCH_FREE_MEM(recpReqInfo);
2812 /* sending the RecpReq to Phy */
2813 //if (rgSCHUtlTfuRecpReq(inst, cell->tfuSap->sapCfg.suId, recpReqInfo) != ROK)
2815 DU_LOG("\nERROR --> SCH : rgSCHTomUtlPrcUlTddSpclSf() Unable to send "
2816 "Cntrl info for cell");
2819 } /* end of rgSCHTomUtlPrcUlTddSpclSf */
2822 /** @brief This function does all the processing related to a single downlink
2827 * Function: rgSCHTomUtlProcDlSf
2830 * - collate control data for all UEs and send to PHY
2831 * - collate data buffers for all UEs and send to PHY
2833 * @param [in] RgSchDlSf *dlSf
2834 * @param [in] RgSchDlSf *ulSf
2835 * @param [in] RgSchCellCb *cell
2836 * @param [out] RgSchErrInfo *err
2839 static S16 rgSCHTomUtlProcDlSf
2844 RgTfuCntrlReqInfo *cntrlInfo,
2849 uint8_t sfTyp = 1; /* Dl Subframe */
2851 cmLListInit(&cntrlInfo->phichLst);
2852 cmLListInit(&cntrlInfo->dlPdcchLst);
2853 cmLListInit(&cntrlInfo->ulPdcchLst);
2855 #ifdef TFU_ALLOC_EVENT_NO_INIT
2856 cntrlInfo->ulTiming.sfn = cntrlInfo->ulTiming.subframe = 0;
2858 cntrlInfo->dlTiming = cell->dlDciTime;
2859 cntrlInfo->cellId = cell->cellId;
2860 cntrlInfo->ulTiming = cell->hiDci0Time;
2861 if((0 == (cntrlInfo->dlTiming.sfn % 30)) && (0 == cntrlInfo->dlTiming.slot))
2863 //DU_LOG("\nERROR --> SCH : 5GTF_CHECK rgSCHTomUtlProcDlSf Cntrl dl (%d : %d) ul (%d : %d)\n", \
2864 cntrlInfo->dlTiming.sfn, cntrlInfo->dlTiming.subframe, cntrlInfo->ulTiming.sfn, cntrlInfo->ulTiming.subframe);
2866 /* Fill PCFICH info */
2867 /* Fix for DCFI FLE issue: when DL delta is 1 and UL delta is 0 and CFI
2868 *change happens in that SF then UL PDCCH allocation happens with old CFI
2869 *but CFI in control Req goes updated one since it was stored in the CELL
2871 cntrlInfo->cfi = dlSf->pdcchInfo.currCfi;
2872 #ifndef RG_ULSCHED_AT_CRC
2875 Mval = rgSchTddPhichMValTbl[cell->ulDlCfgIdx]
2876 [cell->hiDci0Time.subframe];
2877 if(dlSf->sfType == RG_SCH_SPL_SF_DATA)
2879 RGSCH_GET_SPS_SF_CFI(cell->bwCfg.dlTotalBw, cntrlInfo->cfi);
2884 /* Fill PHICH info */
2885 if ((ret = rgSCHTomUtlFillPhich (cell, cntrlInfo, ulSf, err)) != ROK)
2887 DU_LOG("\nERROR --> SCH : Unable to send PHICH info "
2888 "for cellId (%d)\n", cell->cellId);
2889 RGSCH_FREE_MEM(cntrlInfo);
2892 if ((ret = rgSCHTomUtlFillUlPdcch (cell, cntrlInfo, ulSf, err)) !=
2895 DU_LOG("\nERROR --> SCH : Unable to send PDCCH info "
2896 "for cellId (%d)\n", cell->cellId);
2897 RGSCH_FREE_MEM(cntrlInfo);
2902 if(0 == cntrlInfo->ulMpdcchLst.count)
2909 sfTyp = rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
2910 [cell->dlDciTime.subframe];
2912 if (sfTyp != 2) /* Uplink subframe */
2914 /* Fill PDCCH info */
2915 if ((ret = rgSCHTomUtlFillDlPdcch(cell,cntrlInfo, dlSf, err)) != ROK)
2917 DU_LOG("\nERROR --> SCH : Unable to send PDCCH info "
2918 "for cellId (%d)\n", cell->cellId);
2919 RGSCH_FREE_MEM(cntrlInfo);
2922 rgBwAlloInfo[dlSf->sfNum] += dlSf->bwAssigned;
2923 rgBwAlcnt[dlSf->sfNum] ++;
2926 #ifdef LTEMAC_SPS /* SPS_NEW_CHGS */
2927 cntrlInfo->isSPSOcc = dlSf->isSPSOcc;
2929 cntrlInfo->numDlActvUes += dlSf->numDlActvUes; /* 4UE_TTI_DELTA */
2930 dlSf->numDlActvUes = 0;
2932 if(0 == cntrlInfo->dlMpdcchLst.count)
2937 /* Now always sending down a cntrl req */
2938 /* sending the cntrl data to Phy */
2939 //if (rgSCHUtlTfuCntrlReq(inst, cell->tfuSap->sapCfg.suId, cntrlInfo)
2942 DU_LOG("\nERROR --> SCH : Unable to send Cntrl info for cell");
2949 /** @brief This function handles sending of the PHICH information for the
2950 * downlink subframe to be sent in the next TTI.
2957 * - Loop through the PHICH information present in the downlink
2958 * subframe and fill the information in cntrlInfo.
2960 * @param [out] TfuCntrlReqInfo *cntrlInfo
2961 * @param [in] RgSchDlSf *dlSf
2962 * @param [out] RgSchErrInfo *err
2967 static S16 rgSCHTomUtlFillPhich
2970 TfuCntrlReqInfo *cntrlInfo,
2978 TfuPhichInfo *harqAck;
2980 RgSchCmnDlCell *cellDl = RG_SCH_CMN_GET_DL_CELL(cell);
2984 /* Traversing the list of Phichs */
2985 node = dlSf->phichInfo.phichs.first;
2988 phich = (RgSchPhich*)node->node;
2989 if ((ret = rgSCHUtlGetEventMem((Ptr *)&harqAck, sizeof(TfuPhichInfo),
2990 &(cntrlInfo->memCp))) != ROK)
2992 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
2995 #ifdef TFU_ALLOC_EVENT_NO_INIT
2996 harqAck->txPower = 0;
2998 /* fill in the tfu structure from the information present in the
3000 harqAck->rbStart = phich->rbStart;
3001 harqAck->nDmrs = phich->nDmrs;
3002 harqAck->isAck = phich->hqFeedBack;
3003 harqAck->isForMsg3 = phich->isForMsg3; /*SR_RACH_STATS : PHICH ACK/NACK for MSG3 */
3005 /* Changes for passing iPhich at TFU interface*/
3006 harqAck->iPhich = phich->iPhich;
3008 /* ccpu00138898 - Added Tx pwr offset for PHICH Tx*/
3010 harqAck->txPower = cellDl->phichTxPwrOffset;
3012 cmLListAdd2Tail(&cntrlInfo->phichLst, &(harqAck->lnk));
3013 harqAck->lnk.node = (PTR)harqAck;
3015 } /* end of while */
3021 /** @brief This function is a utility function to restart
3022 * deactivation timer.
3026 * Function: rgSCHTmrRestartScellDeactTmr
3029 * - Starts timer at scheduler
3031 * @param[in] RgSchCellCb *cell
3032 * @param[in] CmLteRnti rnti
3035 static Void rgSCHTmrRestartScellDeactTmr
3041 RgSchUeCellInfo *sCellInfo = NULLP;
3045 if(RG_SCH_IS_CELL_SEC(ueCb, cell))
3047 sCellInfo = ueCb->cellInfo[(ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)])];
3049 if(sCellInfo->deactTmr.tmrEvnt != TMR_NONE)
3051 rgSCHTmrStopTmr(cell, RG_SCH_TMR_SCELL_DEACT, sCellInfo);
3053 if(PRSNT_NODEF == ueCb->sCellDeactTmrVal.pres)
3056 rgSCHTmrStartTmr(cell,sCellInfo,RG_SCH_TMR_SCELL_DEACT,
3057 ueCb->sCellDeactTmrVal.val);
3062 }/*end of rgSCHTmrRestartScellDeactTmr*/
3065 /** @brief This function will send all the PDCCH's for the given downlink
3073 * - Loop through all the scheduled HARQ processes and fill
3074 * the PDCCH information in cntrlInfo.
3076 * @param [out] TfuCntrlReqInfo *cntrlInfo
3077 * @param [in] RgSchDlSf *dlSf
3078 * @param [out] RgSchErrInfo *err
3083 uint32_t numdlSpsRelSentToTf;
3084 static S16 rgSCHTomUtlFillDlPdcch
3087 TfuCntrlReqInfo *cntrlInfo,
3095 TfuPdcchInfo *tfuPdcch;
3096 uint8_t isDcivld = FALSE;
3097 uint8_t numUePerTti = 0;
3100 /* Traversing the scheduled Harq processes */
3101 node = dlSf->pdcchInfo.pdcchs.first;
3104 pdcch = (RgSchPdcch*)node->node;
3105 switch(pdcch->dci.dciFormat)
3107 case TFU_DCI_FORMAT_3:
3108 isDcivld = (pdcch->dci.u.format3Info.isPucch) ? TRUE : FALSE;
3111 case TFU_DCI_FORMAT_3A:
3112 isDcivld = (pdcch->dci.u.format3AInfo.isPucch) ? TRUE : FALSE;
3125 /*ccpu00117179 - ADD - Build only non DCI format-0 messages */
3126 if((pdcch->dci.dciFormat == TFU_DCI_FORMAT_0) ||
3127 (pdcch->dci.dciFormat == TFU_DCI_FORMAT_A1) ||
3128 (pdcch->dci.dciFormat == TFU_DCI_FORMAT_A2))
3135 #ifdef RGSCH_SPS_STATS
3136 if((pdcch->dci.dciFormat == TFU_DCI_FORMAT_1A) &&
3137 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.mcs == 0x1F) &&
3138 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.type == TFU_ALLOC_TYPE_RIV) &&
3139 (pdcch->dci.u.format1aInfo.t.pdschInfo.allocInfo.alloc.u.riv == 0xFFFFFFFF))
3141 numdlSpsRelSentToTf++;
3145 if ((ret = rgSCHUtlGetEventMem((Ptr *)&tfuPdcch, sizeof(TfuPdcchInfo),
3146 &(cntrlInfo->memCp))) != ROK)
3148 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3152 tfuPdcch->crnti = pdcch->crnti;
3153 tfuPdcch->isSpsRnti = pdcch->isSpsRnti;
3155 tfuPdcch->rnti = pdcch->rnti;
3158 rgSCHTmrRestartScellDeactTmr(cell,pdcch->ue);
3160 tfuPdcch->dciNumOfBits = pdcch->dciNumOfBits;
3162 tfuPdcch->nCce = pdcch->nCce;
3163 tfuPdcch->aggrLvl = pdcch->aggrLvl;
3164 tfuPdcch->dci = pdcch->dci;
3166 //TODO_SID: Need to check these values during INT
3167 tfuPdcch->sectorId = 0;
3168 tfuPdcch->sccIdx = 0;
3171 /* SR_RACH_STATS : Reset isTBMsg4 */
3172 pdcch->dci.u.format1aInfo.t.pdschInfo.isTBMsg4 = FALSE;
3173 /* To be enhanced later for 2.1 */
3174 cmLListAdd2Tail(&cntrlInfo->dlPdcchLst, &(tfuPdcch->lnk));
3175 tfuPdcch->lnk.node = (PTR)tfuPdcch;
3177 if((pdcch->rnti > 60) && (pdcch->rnti < 5000))
3179 #if defined (TENB_STATS) && defined (RG_5GTF)
3180 cell->tenbStats->sch.dl5gtfPdcchSend++;
3184 } /* end of while */
3186 if((numUePerTti) && (numUePerTti < RG_MAX_NUM_UE_PER_TTI ))
3188 cell->dlNumUeSchedPerTti[numUePerTti-1]++;
3190 gDlNumUePerTti[numUePerTti-1]++;
3194 } /* end of rgSCHTomUtlFillDlPdcch*/
3196 #ifdef RGSCH_SPS_STATS
3197 uint32_t rgSchSpsRelSentToTf;
3198 uint32_t rgSchSpsRelPdcchAllocd;
3200 /** @brief This function will send all the UL PDCCH's for the given
3208 * - Loop through all the scheduled HARQ processes and fill
3209 * the PDCCH information in cntrlInfo.
3211 * @param [out] TfuCntrlReqInfo *cntrlInfo
3212 * @param [in] RgSchDlSf *dlSf
3213 * @param [out] RgSchErrInfo *err
3218 static S16 rgSCHTomUtlFillUlPdcch
3221 TfuCntrlReqInfo *cntrlInfo,
3229 TfuPdcchInfo *tfuPdcch;
3230 uint8_t isDcivld = FALSE;
3233 /* Traversing the scheduled Harq processes */
3234 node = dlSf->pdcchInfo.pdcchs.first;
3237 pdcch = (RgSchPdcch*)node->node;
3239 /*ccpu00116712- Function should pick only UL allocation related control
3241 switch(pdcch->dci.dciFormat)
3243 case TFU_DCI_FORMAT_A1:
3247 case TFU_DCI_FORMAT_A2:
3251 case TFU_DCI_FORMAT_3:
3252 isDcivld = (pdcch->dci.u.format3Info.isPucch) ? FALSE : TRUE;
3255 case TFU_DCI_FORMAT_3A:
3256 isDcivld = (pdcch->dci.u.format3AInfo.isPucch) ? FALSE : TRUE;
3271 /*ccpu00116712- Function should pick only UL allocation related control
3273 if ((ret = rgSCHUtlGetEventMem((Ptr *)&tfuPdcch, sizeof(TfuPdcchInfo),
3274 &(cntrlInfo->memCp))) != ROK)
3276 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3279 tfuPdcch->rnti = pdcch->rnti;
3281 rgSCHTmrRestartScellDeactTmr(cell,pdcch->ue);
3283 tfuPdcch->dciNumOfBits = pdcch->dciNumOfBits;
3285 tfuPdcch->nCce = pdcch->nCce;
3286 tfuPdcch->aggrLvl = pdcch->aggrLvl;
3287 tfuPdcch->dci = pdcch->dci;
3289 //TODO_SID: Need to check these values during INT
3290 tfuPdcch->sectorId = 0;
3291 tfuPdcch->sccIdx = 0;
3294 /* To be enhanced later for 2.1 */
3296 #if defined (TENB_STATS) && defined (RG_5GTF)
3297 cell->tenbStats->sch.ul5gtfPdcchSend++;
3299 cmLListAdd2Tail(&cntrlInfo->ulPdcchLst, &(tfuPdcch->lnk));
3300 tfuPdcch->lnk.node = (PTR)tfuPdcch;
3301 } /* end of while */
3303 #ifdef RGSCH_SPS_STATS
3304 if (rgSchSpsRelSentToTf != rgSchSpsRelPdcchAllocd)
3310 } /* end of rgSCHTomUtlFillUlPdcch*/
3312 /** @brief This function does the processing for Timing adjustment.
3319 * - Loop through the ue present ueTimeLst, decrement the remaining
3323 * @param [in] RgSchCellCb *cell
3328 static S16 rgSCHTomUtlProcTA(RgSchCellCb *cell)
3333 node = cell->taUeLst.first;
3336 ue = (RgSchUeCb *)node->node;
3338 if (ue->dl.taCb.numRemSf == 0)
3340 ue->dl.taCb.state = RGSCH_TA_IDLE;
3341 /* If Outstanding Ta is present, schedule it */
3342 if(ue->dl.taCb.outStndngTa == TRUE)
3344 rgSCHUtlReTxTa(cell, ue);
3348 /* We need to reset state and also value of TA,
3349 * then we start the timer */
3350 ue->dl.taCb.ta = RGSCH_NO_TA_RQD;
3351 /* Start the timer only if TA is cfgd as FINITE value */
3352 if (ue->dl.taCb.cfgTaTmr)
3354 rgSCHTmrStartTmr (cell, ue, RG_SCH_TMR_TA, ue->dl.taCb.cfgTaTmr);
3357 /* need to delete from the link list */
3358 cmLListDelFrm(&(cell->taUeLst), &(ue->taLnk));
3359 ue->taLnk.node = NULLP;
3363 ue->dl.taCb.numRemSf--;
3365 } /* end of taUeLst */
3367 } /* end of rgSCHTomUtlProcTA */
3369 /** @brief This function handles filling of Hq reception request to
3383 S16 rgSCHTomUtlFillHqFdbkInfo
3385 TfuRecpReqInfo *recpReqInfo,
3388 RgSchDlHqProcCb *hqCb,
3390 TfuUeRecpReqInfo *pucchRecpInfo,
3391 RgSchDlHqProcCb *prvHqCb,
3395 S16 rgSCHTomUtlFillHqFdbkInfo
3397 TfuRecpReqInfo *recpReqInfo,
3399 RgSchDlHqProcCb *hqCb,
3401 TfuUeRecpReqInfo *pucchRecpInfo,
3402 RgSchDlHqProcCb *prvHqCb,
3408 RgSchDlHqTbCb *tbCb;
3410 Bool isAddToLst = FALSE;
3412 for (idx = 0 ;idx < 2; idx++)
3414 if (HQ_TB_WAITING == hqCb->tbInfo[idx].state)
3416 tbCb = &hqCb->tbInfo[idx];
3418 /* FOR ACK NAK REP */
3419 if ((hqCb->hqE->ue != NULLP) &&
3420 (hqCb->hqE->ue->measGapCb.isMeasuring == TRUE))
3422 if ((tbCb->fbkRecpRepCntr) &&
3423 (--tbCb->fbkRecpRepCntr))
3425 /* Add to next subfarme */
3426 /* Add this hqCb to the next dlSf's ackNakRepQ */
3427 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
3428 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
3429 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
3430 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
3433 rgSCHTomUtlMoveNxtOccasion(cell, hqCb->hqE->ue, validIdx);
3441 /* Go to the next node */
3447 //if (hqCb != prvHqCb)
3449 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
3450 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
3453 DU_LOG("\nERROR --> SCH : Unable to Allocate TfuUeRecpReqInfo for cell");
3454 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3457 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
3458 if ((hqCb->hqE->ue != NULLP) /*&&
3459 ((tbCb->lchSchdData[0].lcId != 0) || (tbCb->taSnt ==
3463 pucchRecpInfo->rnti = hqCb->hqE->ue->ueId;
3467 if (hqCb->hqE->raCb)
3469 pucchRecpInfo->rnti = hqCb->hqE->raCb->tmpCrnti;
3475 if (!hqCb->spsN1PucchRes.pres)
3478 pucchRecpInfo->t.pucchRecpReq.hqType =
3479 TFU_HQ_RECP_REQ_NORMAL;
3480 pucchRecpInfo->t.pucchRecpReq.t.nCce =
3486 pucchRecpInfo->t.pucchRecpReq.hqType =
3487 TFU_HQ_RECP_REQ_N1PUCCH;
3488 pucchRecpInfo->t.pucchRecpReq.t.n1Pucch =
3489 hqCb->spsN1PucchRes.val;
3493 /* Handling of other types */
3494 pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
3495 #else /* TFU_UPGRADE */
3496 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
3497 if ((hqCb->tbInfo[0].state == HQ_TB_WAITING) &&
3498 (hqCb->tbInfo[1].state == HQ_TB_WAITING))
3500 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz = 2; /* MIMO */
3504 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz = 1; /* NON-MIMO */
3508 /* PucchRecpReq needs to be filled up for n1Pucch resource for SPS
3510 if (hqCb->spsN1PucchRes.pres)
3512 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
3515 #endif /* LTEMAC_SPS */
3517 pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
3518 cell->pucchCfg.n1PucchAn);
3521 rgSCHEmtcFillPucchRecpInfo(cell, hqCb, &(pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes[0]));
3524 #endif/*TFU_UPGRADE*/
3527 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, hqCb->hqE->ue,
3528 pucchRecpInfo, validIdx,FALSE);
3531 /* Passing last parameter as FALSE in this case as it will be verified from hqCb*/
3532 isAddToLst = rgSCHEmtcAddRecpInfoToLst(hqCb,recpReqInfo, pucchRecpInfo,FALSE);
3536 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
3538 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
3541 if ((tbCb->fbkRecpRepCntr) &&
3542 (--tbCb->fbkRecpRepCntr))
3544 /* Add to next subfarme */
3545 /* Add this hqCb to the next dlSf's ackNakRepQ */
3546 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
3547 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
3548 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
3549 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
3555 }/* end of rgSCHTomUtlFillHqFdbkInfo */
3558 /** @brief This function handles filling of Hq reception request to
3563 * Function:rgSCHTomUtlFillHqFdbkFor5gtf
3567 * @param [out] TfuRecpReqInfo *recpReqInfo
3568 * @param [in] RgSchCellCb *cell
3569 * @param [in] uint16_t validIdx,
3570 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
3571 * @param [in] RgSchDlSf *dlSf,
3572 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
3573 * @param [out] RgSchErrInfo *err
3579 static S16 rgSCHTomUtlFillHqFdbkFor5gtf
3581 TfuRecpReqInfo *recpReqInfo,
3584 RgSchDlHqInfo *dlSfHqInfo,
3586 TfuUeRecpReqInfo *pucchRecpInfo,
3592 TfuUePucchRecpReq *pucchReqInfo = NULLP;
3594 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
3600 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
3601 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
3604 DU_LOG("\nERROR --> SCH : Unable to Allocate "
3605 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId);
3606 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3609 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
3610 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
3611 * instead of SPS-CRNTI */
3613 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
3615 pucchReqInfo->uciInfo = TFU_XPUCCH_UCI_INFO;
3617 /* 5gtf TODO : Hardcoded nPUCCHIdx */
3618 pucchReqInfo->uciPduInfo.pucchIndex = 0;
3620 pucchReqInfo->uciPduInfo.numBits = 1;
3622 /* 5gtf TODO : CQI Periodicity Hardcoded to (n,0)*/
3623 if (RGSCH_TIMEINFO_SAME (recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn))
3625 pucchReqInfo->uciPduInfo.numBits += 5;
3626 RG_SCH_ADD_TO_CRNT_TIME(recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn,
3627 ue->ue5gtfCb.cqiRiPer);
3630 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
3631 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
3633 }/* end of rgSCHTomUtlFillHqFdbkForFrmt1B */
3637 /** @brief This function handles filling of Hq reception request to
3642 * Function:rgSCHTomUtlFillHqFdbkForFrmt1B
3645 * Allocates the N1Pucch Resources based on teh A Value
3647 * @param [out] TfuRecpReqInfo *recpReqInfo
3648 * @param [in] RgSchCellCb *cell
3649 * @param [in] uint16_t validIdx,
3650 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
3651 * @param [in] RgSchDlSf *dlSf,
3652 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
3653 * @param [out] RgSchErrInfo *err
3660 static S16 rgSCHTomUtlFillHqFdbkForFrmt1B
3662 TfuRecpReqInfo *recpReqInfo,
3665 RgSchDlHqInfo *dlSfHqInfo,
3667 TfuUeRecpReqInfo *pucchRecpInfo,
3671 static S16 rgSCHTomUtlFillHqFdbkForFrmt1B
3673 TfuRecpReqInfo *recpReqInfo,
3675 RgSchDlHqInfo *dlSfHqInfo,
3677 TfuUeRecpReqInfo *pucchRecpInfo,
3683 Inst inst = cell->instIdx;
3687 RgSchDlHqProcCb *hqCb = NULLP;
3689 TfuUePucchRecpReq *pucchReqInfo = NULLP;
3690 Bool isDatPresOnSecCell = FALSE;
3691 uint8_t primCellTbCount = 0;
3693 hqPNode = dlSfHqInfo->hqPLst.first;
3694 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
3700 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
3701 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
3704 DU_LOG("\nERROR --> SCH : Unable to Allocate TfuUeRecpReqInfo for cellId=%d \n", cell->cellId);
3705 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
3708 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
3709 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
3710 * instead of SPS-CRNTI */
3712 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
3715 pucchReqInfo->hqType = TFU_HQ_RECP_REQ_NORMAL;
3716 /* Handling of other types */
3717 pucchReqInfo->type = TFU_UCI_HARQ;
3718 #else /* TFU_UPGRADE */
3719 pucchReqInfo->uciInfo = TFU_PUCCH_HARQ;
3720 /* Fill hqFdbkMode by using uciFrmtTyp from dlSfHqInfo */
3721 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
3722 /* Fill HqSz by using totalTbCnt based on the TM mode and
3723 * the number of serv cells configured*/
3725 pucchReqInfo->hqInfo.hqSz = ue->f1bCsAVal;
3726 pucchReqInfo->hqInfo.pucchResCnt = ue->f1bCsAVal;
3728 memset(pucchReqInfo->hqInfo.hqRes,0xff,sizeof(uint16_t)*TFU_MAX_HQ_RES);
3730 /* Two Resources needs to be configured if the
3731 * serving cell is in mimo mode else single
3733 if ((dlSf->relPdcch != NULLP) &&
3734 (RGSCH_TIMEINFO_SAME(recpReqInfo->timingInfo, ue->relPdcchFbkTiming)))
3735 {/* Pcell is having sps rel pdcch present */
3736 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
3737 {/* prim cell is in mimo mode, use 0 and 1 */
3738 pucchReqInfo->hqInfo.hqRes[0] = (dlSf->relPdcch->nCce +
3739 cell->pucchCfg.n1PucchAn);
3740 pucchReqInfo->hqInfo.hqRes[1] = pucchReqInfo->hqInfo.hqRes[0] + 1;
3745 pucchReqInfo->hqInfo.hqRes[2] = (dlSf->relPdcch->nCce +
3746 cell->pucchCfg.n1PucchAn);
3748 /* Release the pdcch so that it will not further processed */
3749 rgSCHUtlPdcchPut(ue->cell,&dlSf->pdcchInfo, dlSf->relPdcch);
3750 dlSf->relPdcch = NULLP;/* only one UE will be scheduled for release pdcch order in one tti */
3752 #endif/*LTEMAC_SPS*/
3753 #endif/*TFU_UPGRADE*/
3756 hqCb = (RgSchDlHqProcCb *)hqPNode->node;
3757 hqPNode = hqPNode->next;
3758 /* In case of CSI + 1BCS , CSI will be
3759 * dropped if scheduling is present on
3760 * seconday cell.36.213 10.1.1
3762 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
3764 isDatPresOnSecCell = TRUE;
3767 if ((hqCb->tbInfo[0].state == HQ_TB_WAITING) &&
3768 (hqCb->tbInfo[1].state == HQ_TB_WAITING))
3770 primCellTbCount = 2;
3773 primCellTbCount = 1;
3777 pucchReqInfo->t.nCce = hqCb->pdcch->nCce;
3780 switch(ue->f1bCsAVal)
3782 case RG_SCH_A_VAL_2:
3783 /* harq(0) is primary harq(1) is secondary) */
3784 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
3786 pucchReqInfo->hqInfo.hqRes[1] = ue->n1PucchF1bResCb.\
3787 cw1N1Res[hqCb->tpc].n1PucchIdx;
3789 else/* primary cell */
3792 /* Need to consider only sps occasions */
3793 if (hqCb->spsN1PucchRes.pres)
3795 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
3798 #endif /* LTEMAC_SPS */
3801 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
3802 cell->pucchCfg.n1PucchAn);
3806 case RG_SCH_A_VAL_3:
3807 /* Serving cell in mimo mode should be
3808 * in 0 and 1 and the serving cell in siso
3809 * mode should be in 2 indices */
3810 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
3812 uint8_t cellIdx = ue->cellIdToCellIdxMap[RG_SCH_CELLINDEX(hqCb->hqE->cell)];
3813 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[cellIdx]->txMode.txModeEnum) > 1)
3814 {/* Sec cell is in mimo mode, use 0 and 1 */
3815 pucchReqInfo->hqInfo.hqRes[0] =
3816 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
3818 pucchReqInfo->hqInfo.hqRes[1] =
3819 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
3822 {/* Sec cell is in siso mode, use 2 */
3823 pucchReqInfo->hqInfo.hqRes[2] =
3824 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
3828 {/* primary cell hq */
3829 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
3830 {/* prim cell is in mimo mode, use 0 and 1 */
3832 if (hqCb->spsN1PucchRes.pres)
3833 {/* SPS occasions */
3834 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
3835 pucchReqInfo->hqInfo.hqRes[1] = hqCb->spsN1PucchRes.val + 1;
3838 #endif /* LTEMAC_SPS */
3840 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
3841 cell->pucchCfg.n1PucchAn);
3842 pucchReqInfo->hqInfo.hqRes[1] = (hqCb->pdcch->nCce +
3843 cell->pucchCfg.n1PucchAn + 1);
3847 {/* prim cell is in siso mode use 2 */
3849 /* Need to consider only sps occasions */
3850 if (hqCb->spsN1PucchRes.pres)
3852 pucchReqInfo->hqInfo.hqRes[2] = hqCb->spsN1PucchRes.val;
3855 #endif /* LTEMAC_SPS */
3858 pucchReqInfo->hqInfo.hqRes[2] = (hqCb->pdcch->nCce +
3859 cell->pucchCfg.n1PucchAn);
3865 case RG_SCH_A_VAL_4:
3867 if(RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell))
3868 {/* 2 and 3 for sec cell */
3869 pucchReqInfo->hqInfo.hqRes[2] =
3870 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
3871 pucchReqInfo->hqInfo.hqRes[3] =
3872 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
3874 else/* primary cell */
3875 {/* 0 and 1 are for primary cell */
3877 /* Need to consider only sps occasions */
3878 if (hqCb->spsN1PucchRes.pres)
3880 pucchReqInfo->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
3881 pucchReqInfo->hqInfo.hqRes[1] = hqCb->spsN1PucchRes.val + 1;
3884 #endif /* LTEMAC_SPS */
3887 pucchReqInfo->hqInfo.hqRes[0] = (hqCb->pdcch->nCce +
3888 cell->pucchCfg.n1PucchAn);
3889 pucchReqInfo->hqInfo.hqRes[1] = (hqCb->pdcch->nCce +
3890 cell->pucchCfg.n1PucchAn + 1);
3897 /* TOD:: Add error print */
3901 #endif/*TFU_UPGRADE*/
3912 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, ue,
3913 pucchRecpInfo, validIdx,isDatPresOnSecCell);
3915 /* Channel selection wil not be used in case of
3916 * CQI + HARQ. if the data was present only on
3918 if((isDatPresOnSecCell == FALSE) &&
3919 (dlSfHqInfo->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS))
3920 {/* Data is present only on primary cell */
3922 switch(pucchReqInfo->uciInfo)
3924 case TFU_PUCCH_HARQ_SRS:
3925 case TFU_PUCCH_HARQ_CQI:
3926 case TFU_PUCCH_HARQ_SR_SRS:
3927 case TFU_PUCCH_HARQ_SR_CQI:
3929 dlSfHqInfo->uciFrmtTyp = RG_SCH_UCI_FORMAT1A_1B;
3930 pucchReqInfo->hqInfo.hqSz = primCellTbCount;
3931 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
3940 #endif/*TFU_UPGRADE*/
3941 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
3942 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
3944 }/* end of rgSCHTomUtlFillHqFdbkForFrmt1B */
3945 /** @brief This function handles filling of Hq reception request to
3950 * Function:rgSCHTomUtlFillHqFdbkForFrmt3
3953 * Allocates the N1Pucch Resources based on teh A Value
3955 * @param [out] TfuRecpReqInfo *recpReqInfo
3956 * @param [in] RgSchCellCb *cell
3957 * @param [in] uint16_t validIdx,
3958 * @param [in] RgSchDlHqInfo *dlSfHqInfo,
3959 * @param [in] RgSchDlSf *dlSf,
3960 * @param [in] TfuUeRecpReqInfo *pucchRecpInfo,
3961 * @param [out] RgSchErrInfo *err
3968 static S16 rgSCHTomUtlFillHqFdbkForFrmt3
3970 TfuRecpReqInfo *recpReqInfo,
3973 RgSchDlHqInfo *dlSfHqInfo,
3975 TfuUeRecpReqInfo *pucchRecpInfo,
3979 static S16 rgSCHTomUtlFillHqFdbkForFrmt3
3981 TfuRecpReqInfo *recpReqInfo,
3983 RgSchDlHqInfo *dlSfHqInfo,
3985 TfuUeRecpReqInfo *pucchRecpInfo,
3991 Inst inst = cell->instIdx;
3996 TfuUePucchRecpReq *pucchReqInfo = NULLP;
3998 //hqPNode = dlSfHqInfo->hqPLst.first;
3999 ue = (RgSchUeCb*)dlSfHqInfo->dlSfUeLnk.node;
4005 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4006 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
4009 DU_LOG("\nERROR --> SCH : Unable to Allocate "
4010 "TfuUeRecpReqInfo for cellId=%d \n", cell->cellId);
4011 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4014 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4015 pucchRecpInfo->rnti = ue->ueId; /* Even for Rel pdcch also setting CRNTI
4016 * instead of SPS-CRNTI */
4018 pucchReqInfo = &(pucchRecpInfo->t.pucchRecpReq);
4021 pucchReqInfo->hqType = TFU_HQ_RECP_REQ_NORMAL;
4022 /* Handling of other types */
4023 pucchReqInfo->type = TFU_UCI_HARQ;
4024 #else /* TFU_UPGRADE */
4025 pucchReqInfo->uciInfo = TFU_PUCCH_HARQ;
4026 /* Fill hqFdbkMode by using uciFrmtTyp from dlSfHqInfo */
4027 pucchReqInfo->hqInfo.hqFdbkMode = rgSchUtlGetFdbkMode(dlSfHqInfo->uciFrmtTyp);
4028 /* Fill HqSz by using totalTbCnt based on the TM mode and
4029 * the number of serv cells configured*/
4031 pucchReqInfo->hqInfo.hqSz = ue->f1bCsAVal;
4032 pucchReqInfo->hqInfo.pucchResCnt = 1;
4034 memset(pucchReqInfo->hqInfo.hqRes,0xff,sizeof(uint16_t)*TFU_MAX_HQ_RES);
4035 #endif/*TFU_UPGRADE*/
4036 pucchReqInfo->hqInfo.hqRes[0] = dlSfHqInfo->n3ScellPucch.n3PucchIdx;
4038 rgSCHTomUtlFillCqiSrSrsWithHq(cell,recpReqInfo, ue,
4039 pucchRecpInfo, validIdx,TRUE);
4040 #endif/*TFU_UPGRADE*/
4041 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4042 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4044 }/* end of rgSCHTomUtlFillHqFdbkForFrmt3 */
4048 /** @brief This function handles filling of HARQ feedback recption request to
4057 * @param [out] TfuRecpReqInfo *recpReqInfo
4058 * @param [in] RgSchCellCb *cell
4059 * @param [out] RgSchErrInfo *err
4065 static S16 rgSCHTomUtlFillHqFdbkRecpReq
4067 TfuRecpReqInfo *recpReqInfo,
4073 static S16 rgSCHTomUtlFillHqFdbkRecpReq
4075 TfuRecpReqInfo *recpReqInfo,
4082 RgSchDlHqProcCb *hqCb;
4083 CmLteTimingInfo futTime;
4086 TfuUeRecpReqInfo *pucchRecpInfo = NULLP;
4088 RgSchDlHqProcCb *prvHqCb=NULLP;
4095 /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper output
4096 * if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME() as it is
4097 * serving the purpose */
4098 RGSCHDECRFRMCRNTTIME(cell->crntTime, futTime, (RG_SCH_CMN_HARQ_INTERVAL -
4099 TFU_RECPREQ_DLDELTA));
4100 dlSf = rgSCHUtlSubFrmGet (cell, futTime);
4101 /* Get the next dlsf as well */
4102 RG_SCH_ADD_TO_CRNT_TIME(futTime, futTime, 1)
4103 nxtDlsf = rgSCHUtlSubFrmGet (cell, futTime);
4107 if (dlSf->ueLst.count != 0)
4109 node = dlSf->ueLst.first;
4112 ue = (RgSchUeCb *)(node->node);
4115 if(ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx].isPuschHarqRecpPres == TRUE)
4116 {/* This UE is already considered for PUSCH
4120 rgSCHTomUtlFillHqFdbkFor5gtf(recpReqInfo, cell, validIdx,
4121 &ue->dl.dlSfHqInfo[cell->cellId][dlSf->dlIdx], dlSf, pucchRecpInfo, err);
4122 } /* end of while */
4123 } /* If hq is expected */
4125 if (dlSf->msg4HqPLst.count != 0)
4128 node = dlSf->msg4HqPLst.first;
4131 hqCb = (RgSchDlHqProcCb*)(node->node);
4133 //TODO_SID: need to check validIdx
4134 rgSCHTomUtlFillHqFdbkInfo (recpReqInfo, cell, validIdx, hqCb, nxtDlsf, pucchRecpInfo, prvHqCb, err);
4136 } /* end of while */
4139 /* Check with TDD Code */
4140 /* FOR ACK NACK REP */
4142 } /* end of rgSCHTomUtlFillHqFdbkRecpReq */
4144 /** @brief This function handles filling of SR reception request to
4153 * @param [out] TfuRecpReqInfo *recpReqInfo
4154 * @param [in] RgSchCellCb *cell
4155 * @param [out] RgSchErrInfo *err
4161 static S16 rgSCHTomUtlFillSrRecpReq
4163 TfuRecpReqInfo *recpReqInfo,
4170 TfuUeRecpReqInfo *pucchRecpInfo;
4176 RgSchCmnUlUeSpsInfo *ulSpsUe = NULL;
4182 node = cell->pCqiSrsSrLst[validIdx].srLst.first;
4185 ue = (RgSchUeCb *)(node->node);
4186 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4192 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4193 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4195 DU_LOG("\nERROR --> SCH : Unable to Allocate TfuUeRecpReqInfo for cell RNTI:%d",ue->ueId);
4196 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4199 #ifdef TFU_ALLOC_EVENT_NO_INIT
4200 memset(&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4201 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4207 /* Should we check for Rel8 and above???
4208 * Dont send SR recp req if logicalChannelSR-Mask enabled and UL SPS is
4210 ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue, cell);
4211 /* Avoiding check for ulSpsEnabled as isUlSpsActv FALSE if sps is not enabled*/
4212 if((ue->ul.ulSpsCfg.isLcSRMaskEnab) &&
4213 (ulSpsUe->isUlSpsActv))
4215 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
4220 pucchRecpInfo->rnti = ue->ueId;
4221 pucchRecpInfo->t.pucchRecpReq.srInfo.n1PucchIdx =
4222 ue->srCb.srCfg.srSetup.srResIdx;
4223 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR;
4224 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
4225 rgSCHTomUtlFillCqiSrsWithSr(cell, ue, recpReqInfo,
4226 pucchRecpInfo, validIdx);
4228 isAddToLst = rgSCHEmtcAddRecpInfoToLst(NULLP,recpReqInfo, pucchRecpInfo,ue->isEmtcUe);
4232 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4234 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4237 }/* end of rgSCHTomUtlFillSrRecpReq */
4240 /** @brief This function tells will the UE has a periodic CQI/PMI/RI
4249 * @param [in] RgSchUeCb *ue
4250 * @param [out] Bool *willueRprtCqiRi
4256 static S16 rgSCHTomUtlWillUeRprtCqiRi
4259 Bool *willueRprtCqiRi
4262 /* Intialising Reporting probability as TRUE */
4263 *willueRprtCqiRi = TRUE;
4265 /* Checking the cases in which UE will not report CQIPMI/RI */
4266 if(ue->isDrxEnabled && ue->drxCb)
4269 if(ue->drxCb->cqiMask.pres && ue->drxCb->cqiMask.val == RGR_DRX_SETUP)
4270 {/*cqiMask is setup by upper layers */
4271 if((ue->drxCb->drxUlInactvMask & RG_SCH_DRX_ONDUR_BITMASK) ==
4272 RG_SCH_DRX_ONDUR_BITMASK)
4273 {/*onDuration NOT running, do not expect cqi/pmi/ri*/
4274 *willueRprtCqiRi = FALSE;
4278 #endif /*end of LTEMAC_R9*/
4279 /* ccpu00134258: Fix for CQI DRX issue*/
4280 if(ue->drxCb->onDurTmrLen > 2)
4282 if ( !RG_SCH_DRX_UL_IS_UE_ACTIVE(ue->drxCb) )
4283 {/*UE is not active, do not expect cqi/pmi/ri*/
4284 *willueRprtCqiRi = FALSE;
4287 }/*ue->isDrxEnabled*/
4289 } /*End of rgSCHTomUtlWillUeRprtCqiRi*/
4291 /** @brief This function handles filling of RI reception request to
4300 * @param [out] TfuRecpReqInfo *recpReqInfo
4301 * @param [in] RgSchCellCb *cell
4302 * @param [in] uint16_t validIdx
4303 * @param [out] RgSchErrInfo *err
4309 static S16 rgSCHTomUtlFillRiRecpReq
4311 TfuRecpReqInfo *recpReqInfo,
4318 TfuUeRecpReqInfo *pucchRecpInfo;
4321 Bool willUeRprtCqi; /* Flag set due to CQI Mask
4322 and UE inactive state (DRX) */
4323 RgSchUePCqiCb *riCb = NULLP;
4325 node = cell->pCqiSrsSrLst[validIdx].riLst.first;
4328 riCb = (RgSchUePCqiCb *)(node->node);
4329 ue = riCb->servCellInfo->ue;
4330 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4332 if(riCb->riRecpPrcsd)
4334 /*ccpu00140578:: RI Proecssing is already done for this TTI
4335 * as part of PUSCH reception process or HARQ
4336 * Reception processing. Hence skipping this UE
4338 riCb->riRecpPrcsd = FALSE;
4341 if(riCb->riDist ==0)
4343 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
4344 #ifdef XEON_SPECIFIC_CHANGES
4345 if(RGSCH_TIMEINFO_SAME(cell->crntTime, ue->riRecpTime))
4351 if((TRUE == riCb->isRiIgnoByCollsn)
4352 || (willUeRprtCqi == FALSE))
4354 if(willUeRprtCqi == FALSE)
4357 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
4360 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4361 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4363 DU_LOG("\nERROR --> SCH : Unable to Allocate "
4364 "TfuUeRecpReqInfo for cell RNTI:%d",ue->ueId);
4365 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4368 #ifdef TFU_ALLOC_EVENT_NO_INIT
4369 memset(&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4370 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4373 pucchRecpInfo->rnti = ue->ueId;
4374 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
4375 riCb->cqiCfg.cqiSetup.cqiPResIdx;
4376 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = riCb->riNumBits;
4377 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_CQI;
4378 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
4380 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
4381 riCb->servCellInfo->sCellIdx;
4383 rgSCHTomUtlFillRiBitWidthInfo(ue);
4384 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
4385 if (ue->nPCqiCb->nCqiTrIdx == validIdx)
4387 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, ue->nPCqiCb);
4389 if((ue->srsCb.nSrsTrIdx == validIdx) && (ue->srsCb.srsDist ==0))
4391 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
4393 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4394 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4402 }/* end of rgSCHTomUtlFillRiRecpReq */
4405 /** @brief This function handles filling of 5GTF CQI-RI reception request to
4414 * @param [out] TfuRecpReqInfo *recpReqInfo
4415 * @param [in] RgSchCellCb *cell
4416 * @param [in] uint16_t validIdx
4417 * @param [out] RgSchErrInfo *err
4424 static S16 rgSCHTomUtlFillCqiRiRecpReq
4426 TfuRecpReqInfo *recpReqInfo,
4432 TfuUeRecpReqInfo *pucchRecpInfo;
4433 RgSchUeCb *ue = NULLP;
4436 while ((ue = rgSCHDbmGetNextUeCb(cell, ue)) != NULLP)
4438 if (RGSCH_TIMEINFO_SAME (recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn))
4440 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4441 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4443 DU_LOG("\nERROR --> SCH : Unable to Allocate TfuUeRecpReqInfo for cell RNTI:%d ", ue->ueId);
4444 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4447 #ifdef TFU_ALLOC_EVENT_NO_INIT
4448 memset(&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4449 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4451 pucchRecpInfo->rnti = ue->ueId;
4452 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_XPUCCH_UCI_INFO;
4453 pucchRecpInfo->t.pucchRecpReq.uciPduInfo.pucchIndex = 0;
4454 pucchRecpInfo->t.pucchRecpReq.uciPduInfo.numBits = 5;
4456 RG_SCH_ADD_TO_CRNT_TIME(recpReqInfo->timingInfo, ue->ue5gtfCb.nxtCqiRiOccn,
4457 ue->ue5gtfCb.cqiRiPer);
4458 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4459 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4463 }/* end of rgSCHTomUtlFillCqiRiRecpReq */
4466 /** @brief This function handles filling of PCQI reception request to
4475 * @param [out] TfuRecpReqInfo *recpReqInfo
4476 * @param [in] RgSchCellCb *cell
4477 * @param [in] uint16_t validIdx
4478 * @param [out] RgSchErrInfo *err
4484 static S16 rgSCHTomUtlFillPcqiRecpReq
4486 TfuRecpReqInfo *recpReqInfo,
4493 TfuUeRecpReqInfo *pucchRecpInfo;
4496 uint8_t ri; /*RI value*/
4497 Bool willUeRprtCqi; /* Flag set due to CQI Mask and UE Inactive state (DRX)*/
4499 RgSchUePCqiCb *cqiCb = NULLP;
4500 Bool isAddToLst = FALSE;
4502 node = cell->pCqiSrsSrLst[validIdx].cqiLst.first;
4505 cqiCb = (RgSchUePCqiCb*)(node->node);
4506 ue = cqiCb->servCellInfo->ue;
4507 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4509 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
4511 if ((cqiCb->isCqiIgnoByCollsn == TRUE) ||
4512 (willUeRprtCqi == FALSE))
4514 if(willUeRprtCqi == FALSE)
4517 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
4521 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
4523 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
4524 cqiCb->servCellInfo->sCellIdx;
4526 cqiPmiSz = rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
4529 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to Fill CqiPmi size", ue->ueId);
4533 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4534 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4536 DU_LOG("\nERROR --> SCH : Unable to Allocate TfuUeRecpReqInfo for cell RNTI:%d ", ue->ueId);
4537 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4540 #ifdef TFU_ALLOC_EVENT_NO_INIT
4541 memset(&pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
4542 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4545 /*Fill PCQI params*/
4546 pucchRecpInfo->rnti = ue->ueId;
4547 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
4548 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
4549 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz = cqiPmiSz;
4550 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_CQI;
4551 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
4552 if((ue->srsCb.nSrsTrIdx == validIdx) && (ue->srsCb.srsDist ==0))
4554 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
4557 isAddToLst = rgSCHEmtcAddRecpInfoToLst(NULLP,recpReqInfo, pucchRecpInfo,ue->isEmtcUe);
4561 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4563 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4566 }/* end of rgSCHTomUtlFillPcqiRecpReq */
4567 /** @brief This function handles filling of SRS reception request to
4576 * @param [out] TfuRecpReqInfo *recpReqInfo
4577 * @param [in] RgSchCellCb *cell
4578 * @param [in] uint16_t validIdx
4579 * @param [out] RgSchErrInfo *err
4584 static S16 rgSCHTomUtlFillSrsRecpReq
4586 TfuRecpReqInfo *recpReqInfo,
4593 TfuUeRecpReqInfo *pucchRecpInfo;
4597 node = cell->pCqiSrsSrLst[validIdx].srsLst.first;
4600 ue = (RgSchUeCb *)(node->node);
4601 /* Fix: ccpu00124011: Fix for missing reception request for UE with same offset */
4603 if(ue->srsCb.srsRecpPrcsd)
4605 /* ccpu00140578::SRS Proecssing is already done for this TTI
4606 * as part of PUSCH or HARQ reception process and
4607 * hence skipping this UE */
4608 ue->srsCb.srsRecpPrcsd = FALSE;
4612 if(ue->srsCb.srsDist ==0)
4614 /* We need to add the recp request to be sent on the pucchANRep value. */
4615 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
4616 sizeof(TfuUeRecpReqInfo),&(recpReqInfo->memCp))) != ROK)
4618 DU_LOG("\nERROR --> SCH : Unable to Allocate TfuUeRecpReqInfo for RNTI:%d ",ue->ueId);
4619 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4623 #ifdef TFU_ALLOC_EVENT_NO_INIT
4624 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
4628 pucchRecpInfo->rnti = ue->ueId;
4629 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
4630 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
4631 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
4632 ue->srsCb.srsCfg.srsSetup.fDomPosi;
4633 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
4634 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
4635 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
4636 ue->srsCb.srsCfg.srsSetup.txComb;
4637 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
4638 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
4639 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
4640 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
4642 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SRS;
4643 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
4644 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
4645 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
4649 ue->srsCb.srsDist--;
4653 }/* end of rgSCHTomUtlFillSrsRecpReq */
4656 /** @brief This function handles filling of data reception requests for
4665 * @param [out] TfuRecpReqInfo *recpReqInfo
4666 * @param [in] RgSchCellCb *cell
4667 * @param [out] RgSchErrInfo *err
4672 static S16 rgSCHTomUtlFillDatRecpReq
4674 TfuRecpReqInfo *recpReqInfo,
4680 RgSchUlAlloc *alloc;
4681 TfuUeRecpReqInfo *datRecpInfo;
4684 /* processing steps are
4685 * - Run through the UL allocations going out in this subframe.
4686 * - Run through the UL receptions expected the next subframe.
4688 alloc = rgSCHUtlFirstRcptnReq (cell);
4691 /* FOR ACK NACK REP */
4692 if (NULLP != alloc->ue)
4694 /* If measuring or ackNakRep we shall not send dat RecpReq */
4695 if ((alloc->ue->measGapCb.isMeasuring == TRUE) ||
4696 (alloc->ue->ackNakRepCb.isAckNakRep == TRUE))
4698 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
4703 if ((ret = rgSCHUtlGetEventMem((Ptr *)&datRecpInfo,
4704 sizeof(TfuUeRecpReqInfo),
4705 &(recpReqInfo->memCp))) != ROK)
4707 DU_LOG("\nERROR --> SCH : Unable to Allocate TfuUeRecpReqInfo for RNTI:%d ", alloc->ue->ueId);
4708 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4711 if (!alloc->forMsg3)
4713 datRecpInfo->type = TFU_RECP_REQ_PUSCH;
4714 rgSCHUtlAllocRcptInfo (alloc,
4716 &datRecpInfo->t.puschRecpReq.mcs,
4717 &datRecpInfo->t.puschRecpReq.rbStart,
4718 &datRecpInfo->t.puschRecpReq.numRb,
4719 &datRecpInfo->t.puschRecpReq.rv,
4720 &datRecpInfo->t.puschRecpReq.size,
4721 &datRecpInfo->t.puschRecpReq.modType,
4722 &datRecpInfo->t.puschRecpReq.isRtx,
4723 &datRecpInfo->t.puschRecpReq.nDmrs,
4724 &datRecpInfo->t.puschRecpReq.ndi,
4725 &datRecpInfo->t.puschRecpReq.harqProcId
4730 datRecpInfo->type = TFU_RECP_REQ_MSG3;
4731 rgSCHUtlAllocRcptInfo (alloc,
4733 &datRecpInfo->t.msg3RecpReq.mcs,
4734 &datRecpInfo->t.msg3RecpReq.rbStart,
4735 &datRecpInfo->t.msg3RecpReq.numRb,
4736 /*ccpu00128993 - MOD - fix for msg3 softcombining bug*/
4737 &datRecpInfo->t.msg3RecpReq.rv,
4738 &datRecpInfo->t.msg3RecpReq.size,
4739 &datRecpInfo->t.msg3RecpReq.modType,
4740 &datRecpInfo->t.msg3RecpReq.isRtx,
4741 &datRecpInfo->t.msg3RecpReq.nDmrs,
4742 &datRecpInfo->t.msg3RecpReq.ndi,
4743 &datRecpInfo->t.msg3RecpReq.harqProcId
4747 /* Other fields of datRecpInfo shall be filled
4748 * here for new features */
4749 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(datRecpInfo->lnk));
4750 datRecpInfo->lnk.node = (PTR)datRecpInfo;
4752 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
4753 } /* end of while */
4755 } /* end of rgSCHTomUtlFillDatRecpReq */
4758 /** @brief This function handles filling of data reception requests for
4767 * @param [out] TfuRecpReqInfo *recpReqInfo
4768 * @param [in] RgSchCellCb *cell
4769 * @param [in] uint16_t validIdx
4770 * @param [out] RgSchErrInfo *err
4775 static S16 rgSCHTomUtlFillDatRecpReq
4777 TfuRecpReqInfo *recpReqInfo,
4783 CmLteTimingInfo dci0Time;
4786 RgSchUlAlloc *alloc;
4787 TfuUeRecpReqInfo *datRecpInfo;
4789 Bool isAperiodic = FALSE; /*Set when Aperiodic CQI is expected */
4790 uint8_t numUePerTti = 0;
4792 if((0 == (recpReqInfo->timingInfo.sfn % 30)) && (0 == recpReqInfo->timingInfo.slot))
4794 //DU_LOG("\nERROR --> SCH : 5GTF_CHECK rgSCHTomUtlFillDatRecpReq (%d : %d)\n",\
4795 recpReqInfo->timingInfo.sfn, recpReqInfo->timingInfo.slot);
4797 /* processing steps are
4798 * - Run through the UL allocations going out in this subframe.
4799 * - Run through the UL receptions expected the next subframe.
4802 alloc = rgSCHUtlFirstRcptnReq (cell);
4805 isAperiodic = FALSE;
4806 ret = rgSCHUtlGetEventMem((Ptr *)&datRecpInfo,
4807 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
4810 DU_LOG("\nERROR --> SCH : Unable to Allocate "
4811 "TfuUeRecpReqInfo for RNTI:%d ", alloc->rnti);
4812 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
4815 #ifdef TFU_ALLOC_EVENT_NO_INIT
4816 datRecpInfo->t.puschRecpReq.initialNSrs.pres = FALSE;
4817 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = FALSE;
4819 datRecpInfo->type = TFU_RECP_REQ_PUSCH;
4820 /* Check if this if for MSG3 - no scope for feedback along with it. */
4821 if ((FALSE == alloc->forMsg3))
4823 /* Check if any DL HARQ processes has a feedback coming at the time of
4824 * this reception request.
4829 RGSCHDECRFRMCRNTTIME(cell->crntTime,dci0Time,(RGSCH_ULCTRL_RECP_DIST));
4831 idx = (dci0Time.sfn * RGSCH_NUM_SUB_FRAMES_5G + dci0Time.slot)%
4832 RGSCH_ULCTRL_RECP_DIST;
4834 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA;
4835 datRecpInfo->rnti = alloc->rnti;
4836 rgSCHUtlAllocRcptInfo (cell,alloc, &recpReqInfo->timingInfo,
4837 &datRecpInfo->t.puschRecpReq.ulSchInfo);
4840 else /*Enters for Msg3 == TRUE condition*/
4842 /* ccpu00130884 - ADD - HO case when Msg3 alloc and Cqi/Ri/SRS opportunity
4843 * occur at same time */
4844 if(NULLP != alloc->ue)
4847 /* Only DATA is expected */
4848 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA;
4849 datRecpInfo->rnti = alloc->rnti;
4850 rgSCHUtlAllocRcptInfo (cell,alloc, &recpReqInfo->timingInfo,
4851 &datRecpInfo->t.puschRecpReq.ulSchInfo);
4856 if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA &&
4857 datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_SRS &&
4858 isAperiodic == FALSE)
4860 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = TRUE;
4861 datRecpInfo->t.puschRecpReq.initialNumRbs.val = alloc->ue->initNumRbs;
4865 datRecpInfo->t.puschRecpReq.initialNumRbs.pres = FALSE;
4868 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(datRecpInfo->lnk));
4869 datRecpInfo->lnk.node = (PTR)datRecpInfo;
4870 alloc = rgSCHUtlNextRcptnReq (cell, alloc);
4872 } /* end of while */
4874 if(numUePerTti && (numUePerTti < RG_MAX_NUM_UE_PER_TTI))
4876 cell->ulNumUeSchedPerTti[numUePerTti-1]++;
4877 gUlNumUePerTti[numUePerTti - 1]++;
4880 } /* end of rgSCHTomUtlFillDatRecpReq */
4882 /* rg009.201. Added changes of TFU_UPGRADE */
4884 /***********************************************************
4886 * Func : rgSCHTomUtlFillRiBitWidthInfo
4889 * Desc : Fills the RI BitWidth and stores it for decoding.
4898 **********************************************************/
4899 S16 rgSCHTomUtlFillRiBitWidthInfo
4904 RgSchUePCqiCb *riCb = ueCb->nPRiCb;
4906 if (ueCb->mimoInfo.txMode != RGR_UE_TM_3 &&
4907 ueCb->mimoInfo.txMode != RGR_UE_TM_4)
4912 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUCCH;
4913 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode=
4914 (TfuDlCqiPucchMode)riCb->cqiCfg.cqiSetup.prdModeEnum;
4915 switch(ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode)
4917 case TFU_PUCCH_CQI_MODE10:
4918 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info.type = TFU_RPT_RI;
4919 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info.u.ri =
4922 case TFU_PUCCH_CQI_MODE11:
4923 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info.type = TFU_RPT_RI;
4924 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info.u.ri =
4927 case TFU_PUCCH_CQI_MODE20:
4928 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info.type = TFU_RPT_RI;
4929 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info.u.ri =
4932 case TFU_PUCCH_CQI_MODE21:
4933 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info.type = TFU_RPT_RI;
4934 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info.u.ri =
4941 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
4945 /***********************************************************
4947 * Func : rgSCHTomUtlFetchPcqiBitSz
4950 * Desc : Fetch the CQI/PMI bits for a UE based on the mode, periodicity.
4959 **********************************************************/
4960 uint8_t rgSCHTomUtlFetchPcqiBitSz
4967 uint8_t confRepMode;
4969 TfuCqiPucchMode10 *mode10Info;
4970 TfuCqiPucchMode11 *mode11Info;
4971 TfuCqiPucchMode20 *mode20Info;
4972 TfuCqiPucchMode21 *mode21Info;
4973 RgSchUePCqiCb *cqiCb = ueCb->nPCqiCb;
4976 confRepMode = cqiCb->cqiCfg.cqiSetup.prdModeEnum;
4977 if((ueCb->mimoInfo.txMode != RGR_UE_TM_3) &&
4978 (ueCb->mimoInfo.txMode != RGR_UE_TM_4))
4984 *ri = cqiCb->perRiVal;
4986 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUCCH;
4987 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.mode=
4988 (TfuDlCqiPucchMode)confRepMode;
4991 case RGR_PRD_CQI_MOD10:
4993 mode10Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode10Info;
4995 mode10Info->type = TFU_RPT_CQI;
4996 mode10Info->u.cqi = 4;
5000 case RGR_PRD_CQI_MOD11:
5002 mode11Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode11Info;
5003 mode11Info->type = TFU_RPT_CQI;
5009 mode11Info->u.cqi.cqi = 4;
5010 mode11Info->u.cqi.wideDiffCqi.pres = FALSE;
5011 mode11Info->u.cqi.pmi = 2;
5016 mode11Info->u.cqi.cqi = 4;
5017 mode11Info->u.cqi.wideDiffCqi.pres = TRUE;
5018 mode11Info->u.cqi.wideDiffCqi.val = 3;
5019 mode11Info->u.cqi.pmi = 1;
5022 else if(numTxAnt == 4)
5027 mode11Info->u.cqi.cqi = 4;
5028 mode11Info->u.cqi.wideDiffCqi.pres = FALSE;
5029 mode11Info->u.cqi.pmi = 4;
5034 mode11Info->u.cqi.cqi = 4;
5035 mode11Info->u.cqi.wideDiffCqi.pres = TRUE;
5036 mode11Info->u.cqi.wideDiffCqi.val = 3;
5037 mode11Info->u.cqi.pmi = 4;
5042 /* This is number of antenna case 1.
5043 * This is not applicable for Mode 1-1.
5044 * So setting it to invalid value */
5050 case RGR_PRD_CQI_MOD20:
5052 mode20Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode20Info;
5053 mode20Info->type = TFU_RPT_CQI;
5057 mode20Info->u.cqi.isWideband = TRUE;
5058 mode20Info->u.cqi.u.wideCqi = 4;
5062 pcqiSz = 4 + cqiCb->label;
5063 mode20Info->u.cqi.isWideband = FALSE;
5064 mode20Info->u.cqi.u.subCqi.cqi = 4;
5065 mode20Info->u.cqi.u.subCqi.l = cqiCb->label;
5070 case RGR_PRD_CQI_MOD21:
5072 mode21Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pucch.pucchRawCqiInfo.u.mode21Info;
5073 mode21Info->type = TFU_RPT_CQI;
5074 //pcqiSz = rgSCHTomUtlFetchPcqiBitSzPucchMode21(ueCb,
5075 // mode21Info, numTxAnt, ri);
5083 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5088 /***********************************************************
5090 * Func : rgSCHTomUtlPcqiSbCalcBpIdx
5093 * Desc : Determines the BP index from the timing info
5102 **********************************************************/
5103 S16 rgSCHTomUtlPcqiSbCalcBpIdx
5105 CmLteTimingInfo crntTimInfo,
5107 RgSchUePCqiCb *cqiCb
5110 uint16_t tti = (crntTimInfo.sfn * RGSCH_NUM_SUB_FRAMES_5G + crntTimInfo.slot);
5111 uint16_t prdNum = tti/cqiCb->cqiPeri;
5113 if((prdNum % cqiCb->h) == 0)
5117 cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_1;
5122 cqiCb->isWb = FALSE;
5123 cqiCb->bpIdx = ((prdNum % cqiCb->h) - 1) % cqiCb->J;
5125 cqiCb->prioLvl = RG_SCH_CQI_PRIO_LVL_0;
5133 * @brief Function which moves PCQI, RI, SR and SRS to next periodicity
5134 * Occasions as that needs to be done in case of Ack/Nack repetition
5135 * reception request occasions or during Measurement Gap occasions.
5139 * Function: rgSCHTomUtlMoveNxtOccasion
5141 * Function which moves PCQI, RI, SR and SRS to next perodicity
5142 * Occasions as that needs to be done in case of Ack/Nack repetition
5143 * reception request occasions or during Measurement Gap occasions.
5145 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5148 * - Check whether the current Tx Instance matches with the rec req time
5149 * - If true, then move them to their next Tx Instance
5151 * @param[in] RgSchCellCb *cell,
5158 S16 rgSCHTomUtlMoveNxtOccasion
5165 RgSchUePCqiCb *cqiCb = ue->nPCqiCb;
5166 RgSchUePCqiCb *riCb = ue->nPRiCb;
5168 /* ccpu00140578::Skip the UE if already RI recpetion
5169 * is processed in the same subframe */
5170 if ((riCb->nRiTrIdx == validIdx) &&
5171 (riCb->riRecpPrcsd == FALSE))
5173 if(riCb->riDist ==0)
5175 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
5181 /* ccpu00140578:: As this UE is considered for this TTI
5182 * Same UE should not get processed for RI reception
5183 * or for updating th RI distance.*/
5184 if(riCb->nRiTrIdx == validIdx)
5186 riCb->riRecpPrcsd = TRUE;
5189 if (cqiCb->nCqiTrIdx == validIdx)
5191 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
5194 /* ccpu00140578::Skip the UE if SRS recpetion
5195 * is already processed in the same subframe */
5196 if ((ue->srsCb.nSrsTrIdx == validIdx) &&
5197 (ue->srsCb.srsRecpPrcsd == FALSE))
5199 if(ue->srsCb.srsDist ==0)
5201 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
5205 ue->srsCb.srsDist--;
5207 /* ccpu00140578:: As this UE is considered for this TTI
5208 * Same UE should not get processed for SRS reception
5209 * or for updating th SRS distance.*/
5210 if(ue->srsCb.nSrsTrIdx == validIdx)
5212 ue->srsCb.srsRecpPrcsd = TRUE;
5215 if (ue->srCb.nSrTrIdx == validIdx)
5217 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
5220 } /* rgSCHTomUtlMoveNxtOccasion */
5223 /***********************************************************
5225 * Func : rgSCHTomPrepareAcqiRecp
5228 * Desc : Fetch the CQI/PMI bits for a UE based on the mode and store them
5229 * for decoding. Fill RECP request and prepare the scartchpad
5230 * to aid decoding of Aperiodic CQI.
5239 **********************************************************/
5240 Void rgSCHTomPrepareAcqiRecp
5244 TfuUePuschCqiRecpInfo *cqiRecpReqInfo,
5248 uint8_t confRepMode;
5249 RgSchCqiRawPuschMode12 *mode12Info;
5250 RgSchCqiRawPuschMode20 *mode20Info;
5251 RgSchCqiRawPuschMode22 *mode22Info;
5252 RgSchCqiRawPuschMode30 *mode30Info;
5253 RgSchCqiRawPuschMode31 *mode31Info;
5254 uint8_t numTxAnt = cell->numTxAntPorts;
5255 uint8_t sCellIdx = ueCb->cellIdToCellIdxMap[RG_SCH_CELLINDEX(cell)];
5256 uint8_t numOfCells = 0;
5257 RgSchUeACqiCb *acqiCb = &ueCb->cellInfo[sCellIdx]->acqiCb;
5260 cqiRecpReqInfo->reportType = TFU_APERIODIC_CQI_TYPE; /* Aperiodic */
5261 if (ueCb->mimoInfo.txMode == RGR_UE_TM_3 ||
5262 ueCb->mimoInfo.txMode == RGR_UE_TM_4)
5264 cqiRecpReqInfo->riSz[ccIdx].pres = TRUE;
5265 cqiRecpReqInfo->riSz[ccIdx].val = acqiCb->riNumBits;
5267 /* This flag will be rmeoved after making changes in BRDCM CL
5268 * Sachin is doing the change
5270 #if (defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
5272 cqiRecpReqInfo->cqiPmiSzR1[ccIdx] = acqiCb->cqiPmiSzR1;
5273 cqiRecpReqInfo->cqiPmiSzRn1[ccIdx] = acqiCb->cqiPmiSzRn1;
5275 if(ueCb->nPCqiCb->perRiVal == 1)
5277 cqiRecpReqInfo->cqiPmiSzR1[ccIdx] = acqiCb->cqiPmiSzR1;
5281 cqiRecpReqInfo->cqiPmiSzRn1[ccIdx] = acqiCb->cqiPmiSzRn1;
5284 /* Fill scratchpad to aid decoding of aper CQI upon
5286 confRepMode = acqiCb->aCqiCfg.aprdModeEnum;
5287 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].type = TFU_RECP_REQ_PUSCH;
5289 numOfCells = ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells;
5291 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5292 puschRawCqiInfo.mode = (TfuDlCqiPuschMode)confRepMode;
5294 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5295 puschRawCqiInfo.ri.pres = cqiRecpReqInfo->riSz[ccIdx].pres;
5297 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5298 puschRawCqiInfo.ri.val = cqiRecpReqInfo->riSz[ccIdx].val;
5300 /* Setting the sCellIdx */
5301 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.cqiBitWidth[numOfCells].\
5302 sCellIdx = sCellIdx;
5306 case RGR_APRD_CQI_MOD12:
5308 mode12Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5309 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode12Info;
5310 mode12Info->wideBCqiCw0 = 4;
5311 mode12Info->r1WideBCqiCw1 = 0;
5312 mode12Info->rg1WideBCqiCw1 = 4;
5315 mode12Info->r1TotalPmiBitLen = 2*acqiCb->N;
5316 mode12Info->rg1TotalPmiBitLen = acqiCb->N;
5318 else if(numTxAnt == 4)
5320 mode12Info->r1TotalPmiBitLen = 4*acqiCb->N;
5321 mode12Info->rg1TotalPmiBitLen = 4*acqiCb->N;
5326 case RGR_APRD_CQI_MOD20:
5328 mode20Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5329 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode20Info;
5330 mode20Info->wideBCqiCw = 4;
5331 mode20Info->subBandDiffCqi = 2;
5332 mode20Info->posOfM = acqiCb->L;
5336 case RGR_APRD_CQI_MOD22:
5338 mode22Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5339 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode22Info;
5340 mode22Info->wideBCqiCw0 = 4;
5341 mode22Info->sBDiffCqiCw0 = 2;
5342 mode22Info->r1WideBCqiCw1 = 0;
5343 mode22Info->r1SbDiffCqiCw1 = 0;
5344 mode22Info->rg1WideBCqiCw1 = 4;
5345 mode22Info->rg1SbDiffCqiCw1 = 2;
5346 mode22Info->posOfM = acqiCb->L;
5349 mode22Info->r1PmiBitLen = 4;
5350 mode22Info->rg1PmiBitLen = 2;
5352 else if(numTxAnt == 4)
5354 mode22Info->r1PmiBitLen = 8;
5355 mode22Info->rg1PmiBitLen = 8;
5360 case RGR_APRD_CQI_MOD30:
5362 mode30Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5363 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode30Info;
5364 mode30Info->wideBCqiCw = 4;
5365 mode30Info->totLenSbDiffCqi = 2*acqiCb->N;
5369 case RGR_APRD_CQI_MOD31:
5371 mode31Info = &ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.\
5372 cqiBitWidth[numOfCells].puschRawCqiInfo.u.mode31Info;
5373 mode31Info->wideBCqiCw0 = 4;
5374 mode31Info->totLenSbDiffCqiCw0 = 2*acqiCb->N;
5375 mode31Info->r1WideBCqiCw1 = 0;
5376 mode31Info->r1TotLenSbDiffCqiCw1 =0;
5377 mode31Info->rg1WideBCqiCw1 = 4;
5378 mode31Info->rg1TotLenSbDiffCqiCw1 = 2*acqiCb->N;
5381 mode31Info->r1PmiBitLen = 2;
5382 mode31Info->rg1PmiBitLen = 1;
5384 else if(numTxAnt == 4)
5386 mode31Info->r1PmiBitLen = 4;
5387 mode31Info->rg1PmiBitLen = 4;
5398 * @brief Function which handles the filling of Aperiodic CQI/RI reception
5403 * Function: rgSCHTomUtlFillDatAperRecpReq
5405 * Function which handles the filling of Aperiodic CQI/RI reception
5408 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5411 * - Fill the reception request for the data arriving on the ULSCH
5412 * - Fill the reception request information for the Aperiodic CQI/PMI/RI
5414 * @param[in] RgSchCellCb *cell,
5415 * RgSchUlAlloc *alloc,
5416 * TfuUeRecpReqInfo *datRecpInfo,
5417 * CmLteTimingInfo *timeInfo,
5423 S16 rgSCHTomUtlFillDatAperRecpReq
5427 RgSchUlAlloc *alloc,
5428 TfuUeRecpReqInfo *datRecpInfo,
5429 CmLteTimingInfo *timeInfo,
5434 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
5435 RgSchUeCb *ueCb = alloc->ue;
5437 uint8_t triggerSet = 0;
5441 /*Fill RI Reception Params*/
5442 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
5443 cqiRecpReqInfo->riBetaOff = alloc->ue->ul.betaRiOffst;
5444 cqiRecpReqInfo->cqiBetaOff = alloc->ue->ul.betaCqiOffst;
5447 cqiRecpReqInfo->cCNum = 0;
5448 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells = 0;
5451 rgSCHTomUtlGetTrigSet(cell, ueCb, cqiReq, &triggerSet);
5452 for (sIdx = 0; sIdx < CM_LTE_MAX_CELLS; sIdx++)
5454 /* The Aperiodic request for SCell index sIdx */
5455 if ((triggerSet >> (7 - sIdx)) & 0x01)
5457 /* The Aperiodic request for SCell index sIdx */
5458 rgSCHTomPrepareAcqiRecp(ueCb, ueCb->cellInfo[sIdx]->cell, cqiRecpReqInfo, cqiRecpReqInfo->cCNum);
5459 cqiRecpReqInfo->cCNum++;
5460 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells++;
5464 rgSCHTomPrepareAcqiRecp(ueCb, ueCb->cellInfo[0]->cell, cqiRecpReqInfo, cqiRecpReqInfo->cCNum);
5465 ueCb->rawCqiBitW[ueCb->cqiRiWritIdx].u.pusch.numOfCells++;
5468 RG_SCH_INCR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
5470 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
5472 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
5473 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
5477 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
5479 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
5483 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
5485 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
5487 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
5489 datRecpInfo->rnti = alloc->rnti;
5490 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
5491 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5493 } /* rgSCHTomUtlFillDatAperRecpReq */
5498 * @brief Function which handles the filling of Periodic RI reception
5499 * request values which arrives along with UL Data on ULSCH
5503 * Function: rgSCHTomUtlFillDatPriRecpReq
5505 * Function which handles the filling of Periodic RI reception
5506 * request values which arrives along with UL Data on ULSCH
5508 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5511 * - Fill the reception request for the data arriving on the ULSCH
5512 * - Fill the reception request information for the Periodic RI
5514 * @param[in] RgSchCellCb *cell,
5515 * RgSchUlAlloc *alloc,
5516 * TfuUeRecpReqInfo *datRecpInfo,
5517 * CmLteTimingInfo *timeInfo,
5523 S16 rgSCHTomUtlFillDatPriRecpReq
5526 RgSchUlAlloc *alloc,
5527 TfuUeRecpReqInfo *datRecpInfo,
5528 CmLteTimingInfo *timeInfo,
5533 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
5535 /*Fill RI Reception Params*/
5536 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
5537 #ifdef TFU_ALLOC_EVENT_NO_INIT
5538 cqiRecpReqInfo->cqiBetaOff = 0;
5539 /* Fill only the first RI index since Periodic can come
5541 cqiRecpReqInfo->cqiPmiSzR1[0] = 0;
5542 cqiRecpReqInfo->cqiPmiSzRn1[0] = 0;
5544 cqiRecpReqInfo->reportType = TFU_PERIODIC_CQI_TYPE; /* periodic */
5545 cqiRecpReqInfo->riBetaOff = alloc->ue->ul.betaRiOffst;
5547 /* Fill only the first RI index since Periodic can come
5549 cqiRecpReqInfo->cCNum = 1;
5550 cqiRecpReqInfo->riSz[0].pres = TRUE;
5551 cqiRecpReqInfo->riSz[0].val = alloc->ue->nPRiCb->riNumBits;
5553 rgSCHTomUtlFillRiBitWidthInfo(alloc->ue);
5554 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
5556 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
5557 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
5561 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
5563 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
5567 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
5569 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
5571 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
5573 datRecpInfo->rnti = alloc->rnti;
5574 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
5575 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5577 } /* rgSCHTomUtlFillDatPriRecpReq */
5581 * @brief Function which handles the filling of Periodic CQI/PMI reception
5582 * request values which arrives along with UL Data on ULSCH
5586 * Function: rgSCHTomUtlFillDatPCqiRecpReq
5588 * Function which handles the filling of Periodic CQI/PMI reception
5589 * request values which arrives along with UL Data on ULSCH
5591 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5594 * - Fill the reception request for the data arriving on the ULSCH
5595 * - Fill the reception request information for the Periodic CQI/PMI
5597 * @param[in] RgSchCellCb *cell,
5598 * RgSchUlAlloc *alloc,
5599 * TfuUeRecpReqInfo *datRecpInfo,
5600 * CmLteTimingInfo *timeInfo,
5607 S16 rgSCHTomUtlFillDatPCqiRecpReq
5610 RgSchUlAlloc *alloc,
5611 TfuUeRecpReqInfo *datRecpInfo,
5612 CmLteTimingInfo *timeInfo,
5617 TfuUePuschCqiRecpInfo *cqiRecpReqInfo;
5618 uint8_t cqiPmiSz; /*Raw CQI/PMI Size*/
5621 /*Fill CQI Reception Params*/
5622 cqiRecpReqInfo = &datRecpInfo->t.puschRecpReq.cqiRiInfo;
5623 #ifdef TFU_ALLOC_EVENT_NO_INIT
5624 cqiRecpReqInfo->riBetaOff = 0;
5626 cqiRecpReqInfo->cqiBetaOff = alloc->ue->ul.betaCqiOffst;
5627 cqiPmiSz = rgSCHTomUtlFetchPcqiBitSz(alloc->ue, cell->numTxAntPorts, &ri);
5630 DU_LOG("\nERROR --> SCH : Unable to Fill "
5631 "CqiPmi size RNTI:%d",alloc->rnti);
5635 /* Fill only the first RI index since Periodic can come
5637 cqiRecpReqInfo->cCNum = 1;
5638 cqiRecpReqInfo->reportType = TFU_PERIODIC_CQI_TYPE; /* Periodic */
5639 /* This flags will be removed once Sachin does changes
5641 #if (defined (TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
5642 cqiRecpReqInfo->cqiPmiSzR1[0] = cqiPmiSz;
5643 cqiRecpReqInfo->cqiPmiSzRn1[0] = cqiPmiSz;
5647 cqiRecpReqInfo->cqiPmiSzR1[0] = cqiPmiSz;
5648 cqiRecpReqInfo->cqiPmiSzRn1[0] = 0;
5652 cqiRecpReqInfo->cqiPmiSzRn1[0] = cqiPmiSz;
5653 cqiRecpReqInfo->cqiPmiSzR1[0] = 0;
5656 cqiRecpReqInfo->riSz[0].pres = FALSE;
5658 if((alloc->ue->srsCb.nSrsTrIdx == validIdx) && (alloc->ue->srsCb.srsDist ==0))
5660 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
5661 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_SRS;
5664 (datRecpInfo->t.puschRecpReq.rcpInfo == TFU_PUSCH_DATA_CQI_SRS))
5666 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ_SRS;
5670 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI_HARQ;
5672 else if(datRecpInfo->t.puschRecpReq.rcpInfo != TFU_PUSCH_DATA_CQI_SRS)
5674 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_CQI;
5676 datRecpInfo->rnti = alloc->rnti;
5677 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
5678 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5680 } /* rgSCHTomUtlFillDatPCqiRecpReq */
5683 * @brief Function which handles the filling of SRS reception
5684 * request values which arrives along with UL Data on ULSCH
5688 * Function: rgSCHTomUtlFillDatSrsRecpReq
5690 * Function which handles the filling of SRS reception
5691 * request values which arrives along with UL Data on ULSCH
5693 * Invoked by: rgSCHTomUtlFillDatRecpReq of rg_sch_tom.c
5696 * - Fill the reception request for the data arriving on the ULSCH
5697 * - Fill the reception request information for the SRS
5699 * @param[in] RgSchCellCb *cell,
5700 * RgSchUlAlloc *alloc,
5701 * TfuUeRecpReqInfo *datRecpInfo,
5702 * CmLteTimingInfo *timeInfo,
5708 S16 rgSCHTomUtlFillDatSrsRecpReq
5711 RgSchUlAlloc *alloc,
5712 TfuUeRecpReqInfo *datRecpInfo,
5713 CmLteTimingInfo *timeInfo,
5717 datRecpInfo->rnti = alloc->rnti;
5718 rgSCHTomFillOnlySrsRecpReq(cell,alloc, datRecpInfo);
5721 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_HARQ_SRS;
5725 datRecpInfo->t.puschRecpReq.rcpInfo = TFU_PUSCH_DATA_SRS;
5727 datRecpInfo->rnti = alloc->rnti;
5728 rgSCHUtlAllocRcptInfo (cell, alloc, timeInfo,
5729 &datRecpInfo->t.puschRecpReq.ulSchInfo);
5731 } /* rgSCHTomUtlFillDatSrsRecpReq */
5734 * @brief Function which handles the filling of only SRS reception
5735 * request values on ULSCH
5739 * Function: rgSCHTomFillOnlySrsRecpReq
5741 * Function which handles the filling of SRS reception
5742 * request values which arrives along with UL Data on ULSCH
5744 * Invoked by: rgSCHTomUtlFillDatSrsRecpReq of rg_sch_tom.c
5747 * - Fill the reception request for the data arriving on the ULSCH
5748 * - Fill the reception request information for the SRS
5750 * @param[in] RgSchCellCb *cell,
5751 * RgSchUlAlloc *alloc,
5752 * TfuUeRecpReqInfo *datRecpInfo,
5757 S16 rgSCHTomFillOnlySrsRecpReq
5760 RgSchUlAlloc *alloc,
5761 TfuUeRecpReqInfo *datRecpInfo
5764 TfuUePuschSrsRecpInfo *srsRecpReqInfo;
5766 srsRecpReqInfo = &datRecpInfo->t.puschRecpReq.srsInfo;
5767 srsRecpReqInfo->srsBw = (TfuUlSrsBwInfo)alloc->ue->srsCb.srsCfg.srsSetup.srsBw;
5768 srsRecpReqInfo->nRrc = alloc->ue->srsCb.srsCfg.srsSetup.fDomPosi;
5769 srsRecpReqInfo->srsHopBw = (TfuUlSrsHoBwInfo)alloc->ue->srsCb.srsCfg.srsSetup.srsHopBw;
5770 srsRecpReqInfo->transComb = alloc->ue->srsCb.srsCfg.srsSetup.txComb;
5771 srsRecpReqInfo->srsCfgIdx = alloc->ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
5772 srsRecpReqInfo->srsCyclicShft = (TfuUlSrsCycShiftInfo)alloc->ue->srsCb.srsCfg.srsSetup.cycShift;
5774 /* ccpu00117050 - ADD - nSrs setting
5775 * Refer Section 5.2.2.6 of TS 36.212 V8.5.0*/
5776 datRecpInfo->t.puschRecpReq.ulSchInfo.nSrs = 1;
5779 } /* rgSCHTomFillOnlySrsRecpReq */
5782 * @brief Function which handles the filling of PCQI/RI, SRS and SR
5783 * Reception Request Information along
5784 * with the HARQ reception Request
5788 * Function: rgSCHTomUtlFillCqiSrSrsWithHq
5790 * Function which handles the filling of PCQI/RI, SRS ans SR
5791 * Reception Request Information along
5792 * with the HARQ reception Request
5795 * Invoked by: rgSCHTomUtlFillHqFdbkRecpReq &
5796 * rgSCHTomUtlFillSfHqFdbk of rg_sch_tom.c
5799 * - Fill the reception request for the Control Info arriving on the PUCCH
5800 * - Fill the reception request information for the SR, RI, CQI, SRS
5802 * @param[in] RgSchCellCb *cell,
5803 * TfuRecpReqInfo *recpReqInfo,
5804 * RgSchDlHqProcCb *hqCb,
5805 * @param[out] TfuUeRecpReqInfo *pucchRecpInfo
5806 * @param[in] uint16_t validIdx
5811 static S16 rgSCHTomUtlFillCqiSrSrsWithHq
5814 TfuRecpReqInfo *recpReqInfo,
5816 TfuUeRecpReqInfo *pucchRecpInfo,
5818 Bool isDatPresOnSecCell
5821 RgSchUePCqiCb *cqiCb;
5822 RgSchUePCqiCb *riCb;
5823 uint8_t ri; /*To fetch RI value*/
5824 Bool willUeRprtCqi; /* Flag set due to CQI Mask and UE Inactive state (DRX)*/
5825 Bool willUeRprtSr = TRUE;
5826 TfuAckNackMode hqFdbkMode;
5828 uint8_t totalPucchBits;
5829 Bool dropCqi = FALSE;
5831 RgSchCmnUlUeSpsInfo *ulSpsUe = NULL;
5834 RgSchEmtcUeInfo *emtcUe = NULLP;
5839 /*Changes for PUCCH Format3 */
5840 hqFdbkMode = pucchRecpInfo->t.pucchRecpReq.hqInfo.hqFdbkMode;
5841 numCqiBit = rgSCHCmnCalcPcqiBitSz (ue,cell->numTxAntPorts);
5842 totalPucchBits = pucchRecpInfo->t.pucchRecpReq.hqInfo.hqSz + numCqiBit;
5845 emtcUe = RG_GET_EMTC_UE_CB(ue);
5847 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
5848 #ifdef EMTC_ENABLE /*VINU*/
5851 if((emtcUe->pucchRepNumFr1 > 1) || (emtcUe->pucchRepNumFr2 > 1))
5853 willUeRprtCqi = FALSE;
5854 willUeRprtSr = FALSE;
5858 if(ue->srCb.nSrTrIdx == validIdx)
5862 /* Should we check for Rel8 and above???
5863 * Dont send SR recp req if logicalChannelSR-Mask enabled and UL SPS is
5865 ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue, cell);
5866 /* Avoiding check for ulSpsEnabled as isUlSpsActv FALSE if sps is not enabled*/
5867 if(!((ue->ul.ulSpsCfg.isLcSRMaskEnab) &&
5868 (ulSpsUe->isUlSpsActv)))
5875 pucchRecpInfo->t.pucchRecpReq.srInfo.n1PucchIdx =
5876 ue->srCb.srCfg.srSetup.srResIdx;
5877 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
5878 /* FORMAT3: If SR is present it will be appended after HARQ */
5879 totalPucchBits = totalPucchBits + 1;
5886 rgSCHTomUtlMoveSrNxtOccasion(cell, ue);
5888 /* LTE_ADV:: UE will drop CSI during CSI+1BCS if data is present
5889 * on sec cell(isDatPresOnSecCell)*/
5891 if (hqFdbkMode == TFU_ACK_NACK_CHANNEL_SELECTION)
5893 if (hqFdbkMode == TFU_UCI_FORMAT_1B_CS)
5896 if (isDatPresOnSecCell == TRUE)
5903 /* Format 3 Changes : If Hq + SR + CQI bits < 22 and simultaneousAckNackAndCQI-Format3
5904 is enabled then CQI will be multiplexed with HQ otherwise CQI will be dropped
5905 Spec 36.213 Sec 10.1.1 */
5906 else if (hqFdbkMode == TFU_UCI_FORMAT_3)
5908 if ((isDatPresOnSecCell == TRUE) &&
5909 ((!ue->simulAckNackCQIFormat3) || (totalPucchBits > 22)))
5917 cqiCb = ue->nPCqiCb;
5918 if(riCb->nRiTrIdx == validIdx)
5920 /*ccpu00140578:: Skip the UE if the RI is already processed
5922 if(riCb->riRecpPrcsd == FALSE)
5924 if(riCb->riDist == 0)
5926 if((riCb->cqiCfg.cqiSetup.sANCQI == TRUE) && (willUeRprtCqi == TRUE)&&
5927 (isDatPresOnSecCell == FALSE))
5930 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
5931 riCb->cqiCfg.cqiSetup.cqiPResIdx;
5932 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
5934 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_HARQ_SR)
5936 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI;
5940 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_CQI;
5942 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
5944 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
5945 ue->nPRiCb->servCellInfo->sCellIdx;
5947 rgSCHTomUtlFillRiBitWidthInfo(ue);
5948 if (ue->nPCqiCb->nCqiTrIdx == validIdx)
5950 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, ue->nPCqiCb);
5965 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
5971 /* Skip the UE for RI processing on PUCCH
5972 * in the same subframe as it already processed */
5973 if(riCb->nRiTrIdx == validIdx)
5975 /* As the new idx is same is current idx
5976 * then PUCCH reception processing will consider
5977 * RI also in the same subframe. To block this
5978 * below flag is used*/
5979 riCb->riRecpPrcsd = TRUE;
5983 else if(cqiCb->nCqiTrIdx == validIdx)
5985 if((cqiCb->cqiCfg.cqiSetup.sANCQI == TRUE) && (willUeRprtCqi == TRUE)&&
5986 (isDatPresOnSecCell == FALSE))
5989 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
5990 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
5992 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
5994 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
5995 cqiCb->servCellInfo->sCellIdx;
5997 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
5998 rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
5999 if(0 == pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz)
6001 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to Fill CqiPmi size", ue->ueId);
6004 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_HARQ_SR)
6006 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI;
6010 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_CQI;
6023 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6025 if(ue->srsCb.nSrsTrIdx == validIdx)
6027 /* ccpu00140578::Skip the UE for SRS reception processing
6028 * if already done as part of PUSCH recpetion
6030 if(ue->srsCb.srsRecpPrcsd == FALSE)
6032 if(ue->srsCb.srsDist ==0 )
6034 if((pucchRecpInfo->t.pucchRecpReq.uciInfo != TFU_PUCCH_HARQ_CQI)
6035 && (ue->srsCb.srsCfg.srsSetup.sANSrs)
6036 && (isDatPresOnSecCell == FALSE))
6039 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
6040 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
6041 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
6042 ue->srsCb.srsCfg.srsSetup.fDomPosi;
6043 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
6044 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
6045 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
6046 ue->srsCb.srsCfg.srsSetup.txComb;
6047 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
6048 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6049 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
6050 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
6051 /* ccpu00116923 - ADD - New Reception Request types for CQI and SRS with SR */
6052 switch(pucchRecpInfo->t.pucchRecpReq.uciInfo)
6054 case TFU_PUCCH_HARQ_SR:
6055 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_SRS;
6057 case TFU_PUCCH_HARQ_SR_CQI:
6058 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_CQI_SRS;
6061 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SRS;
6065 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
6069 ue->srsCb.srsDist--;
6071 /* Skip the UE for SRS processing on PUCCH
6072 * in the same subframe as it already processed */
6073 if(ue->srsCb.nSrsTrIdx == validIdx)
6075 /* As the new idx is same is current idx
6076 * then PUCCH reception processing will consider
6077 * SRS also in the same subframe. To block this
6078 * below flag is used*/
6079 ue->srsCb.srsRecpPrcsd = TRUE;
6087 } /* rgSCHTomUtlFillCqiSrSrsWithHq */
6090 * @brief Function which handles the filling of PCQI/RI, SRS
6091 * Reception Request Information along with SR reception
6096 * Function: rgSCHTomUtlFillCqiSrsWithSr
6098 * Function which handles the filling of PCQI/RI, SRS
6099 * Reception Request Information along
6100 * with the SR reception Request
6103 * Invoked by: rgSCHTomUtlFillSrRecpReq of rg_sch_tom.c
6106 * - Fill the reception request for CQI/RI, SRS if they occur
6107 * in the same instance as of SR.
6109 * @param[in] RgSchCellCb *cell,
6111 * TfuRecpReqInfo *recpReqInfo,
6112 * @param[out] TfuUeRecpReqInfo *pucchRecpInfo
6113 * @param[in] uint16_t validIdx
6119 static S16 rgSCHTomUtlFillCqiSrsWithSr
6123 TfuRecpReqInfo *recpReqInfo,
6124 TfuUeRecpReqInfo *pucchRecpInfo,
6128 RgSchUePCqiCb *cqiCb;
6129 RgSchUePCqiCb *riCb;
6130 uint8_t ri; /*To fetch RI value*/
6131 Bool willUeRprtCqi; /* Flag set due to CQI Mask and
6132 UE Inactive state (DRX)*/
6134 cqiCb = ue->nPCqiCb;
6135 rgSCHTomUtlWillUeRprtCqiRi(ue, &willUeRprtCqi);
6137 rgSCHEmtcWillUeRptCqi(ue, &willUeRprtCqi);
6139 if(riCb->nRiTrIdx == validIdx)
6141 /*ccpu00140578:: Skip the UE if the RI is already processed
6143 if(riCb->riRecpPrcsd == FALSE)
6145 if(riCb->riDist == 0)
6147 if(willUeRprtCqi == TRUE)
6150 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6151 riCb->cqiCfg.cqiSetup.cqiPResIdx;
6152 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6155 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI;
6156 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6158 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6159 ue->nPRiCb->servCellInfo->sCellIdx;
6161 rgSCHTomUtlFillRiBitWidthInfo(ue);
6162 /* TODO:: syed Shouldn't this be done outside this if condition */
6163 if (cqiCb->nCqiTrIdx == validIdx)
6165 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6168 rgSCHTomUtlMovePriNxtOccasion(cell, ue, riCb);
6174 if(riCb->nRiTrIdx == validIdx)
6175 {/* Need to skip this UE during PUCCH RI recpetion process
6176 in the current subframe */
6177 riCb->riRecpPrcsd = TRUE;
6181 else if(cqiCb->nCqiTrIdx == validIdx)
6183 if(willUeRprtCqi == TRUE)
6186 pucchRecpInfo->t.pucchRecpReq.cqiInfo.n2PucchIdx =
6187 cqiCb->cqiCfg.cqiSetup.cqiPResIdx;
6189 ue->rawCqiBitW[ue->cqiRiWritIdx].recvTime = recpReqInfo->timingInfo;
6192 ue->rawCqiBitW[ue->cqiRiWritIdx].u.pucch.sCellIdx =
6193 cqiCb->servCellInfo->sCellIdx;
6195 pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz =
6196 rgSCHTomUtlFetchPcqiBitSz(ue, cell->numTxAntPorts, &ri);
6197 if(0 == pucchRecpInfo->t.pucchRecpReq.cqiInfo.cqiPmiSz)
6199 DU_LOG("\nERROR --> SCH : RNTI:%d Unable to Fill CqiPmi size", ue->ueId);
6203 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI;
6205 rgSCHTomUtlMovePcqiNxtOccasion(cell, ue, cqiCb);
6207 if(ue->srsCb.nSrsTrIdx == validIdx)
6209 /* ccpu00140578:: Cnsider the SRS processing
6210 * only if not done in the same TTI
6211 * as part of PUSCH or HARQ reception process*/
6212 if(ue->srsCb.srsRecpPrcsd == FALSE)
6214 if(ue->srsCb.srsDist ==0 )
6216 if(ue->srsCb.srsCfg.srsSetup.sANSrs)
6219 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsBw =
6220 (TfuUlSrsBwInfo)ue->srsCb.srsCfg.srsSetup.srsBw;
6221 pucchRecpInfo->t.pucchRecpReq.srsInfo.nRrc =
6222 ue->srsCb.srsCfg.srsSetup.fDomPosi;
6223 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsHopBw =
6224 (TfuUlSrsHoBwInfo)ue->srsCb.srsCfg.srsSetup.srsHopBw;
6225 pucchRecpInfo->t.pucchRecpReq.srsInfo.transComb =
6226 ue->srsCb.srsCfg.srsSetup.txComb;
6227 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCfgIdx =
6228 ue->srsCb.srsCfg.srsSetup.srsCfgIdx;
6229 pucchRecpInfo->t.pucchRecpReq.srsInfo.srsCyclicShft =
6230 (TfuUlSrsCycShiftInfo)ue->srsCb.srsCfg.srsSetup.cycShift;
6231 /* ccpu00116923 - ADD - New Reception Request types for CQI and
6233 if(pucchRecpInfo->t.pucchRecpReq.uciInfo == TFU_PUCCH_SR_CQI)
6235 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_CQI_SRS;
6239 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_SR_SRS;
6243 rgSCHTomUtlMoveSrsNxtOccasion(cell, ue);
6247 ue->srsCb.srsDist--;
6249 /* Skip the UE for SRS processing on PUCCH
6250 * in the same subframe as it already processed */
6251 if(ue->srsCb.nSrsTrIdx == validIdx)
6253 /* As the new idx is same is current idx
6254 * then PUCCH reception processing will consider
6255 * SRS also in the same subframe. To block this
6256 * below flag is used*/
6257 ue->srsCb.srsRecpPrcsd = TRUE;
6263 } /* rgSCHTomUtlFillCqiSrsWithSr */
6269 /** @brief This function handles filling of HARQ feedback repetition
6270 * recption request for each subframe
6274 * Function: rgSCHTomUtlFillSfRepHqFdbk
6278 * @param [out] TfuRecpReqInfo *recpReqInfo
6279 * @param [in] RgSchCellCb *cell
6280 * @param [out] RgSchErrInfo *err
6281 * @param [in] RgSchDlSf *dlSf
6282 * @param [in] uint8_t noFdbks
6283 * @param [in] CmMemListCp *memCp
6284 * @param [in] uint8_t elemIdx
6285 * @param [in] RgSchDlSf *nxtDlsf
6291 static S16 rgSCHTomUtlFillSfRepHqFdbk
6293 TfuRecpReqInfo *recpReqInfo,
6294 RgSchCellCb *cellCb,
6304 static S16 rgSCHTomUtlFillSfRepHqFdbk
6306 TfuRecpReqInfo *recpReqInfo,
6307 RgSchCellCb *cellCb,
6317 RgSchDlHqProcCb *hqCb;
6321 TfuUeRecpReqInfo *pucchRecpInfo;
6323 TfuUePucchHqRecpInfo *hqRecpReq;
6325 RgSchDlHqTbCb *tbCb;
6326 RgSchDlHqProcCb *prvHqCb = NULLP;
6328 node = dlSf->ackNakRepQ.first;
6331 tbCb = (RgSchDlHqTbCb *)(node->node);
6333 ueCb = hqCb->hqE->ue;
6335 if (--tbCb->fbkRecpRepCntr)
6337 /* Add to next subfarme */
6338 /* Add this hqCb to the next dlSf's ackNakRepQ */
6339 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
6340 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
6341 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
6342 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
6349 /* Go to the next node */
6354 if ((hqCb->hqE->ue != NULLP) &&
6355 (hqCb->hqE->ue->measGapCb.isMeasuring != TRUE)
6356 && (hqCb != prvHqCb)
6359 /* We need to add the recp request to be sent on the pucchANRep
6362 ret = rgSCHUtlGetEventMem((Ptr *)&pucchRecpInfo,
6363 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp));
6366 DU_LOG("\nERROR --> SCH : Unable to"
6367 "Allocate TfuUeRecpReqInfo for RNTI:%d ", ueCb->ueId);
6368 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
6371 pucchRecpInfo->rnti = ueCb->ueId;
6373 pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
6375 pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
6378 /* FOR repetition Feedback shall come on n1PucchAnRep Configured per
6382 pucchRecpInfo->t.pucchRecpReq.hqType = TFU_HQ_RECP_REQ_N1PUCCH;
6383 pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = ueCb->ackNakRepCb.pucchRes;
6385 pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
6386 hqRecpReq = &(pucchRecpInfo->t.pucchRecpReq.hqInfo);
6387 /* ACK NACK rep works only in bundling mode . */
6388 hqRecpReq->hqFdbkMode = (TfuAckNackMode)RGR_TDD_ACKNACK_MODE_BUNDL;
6389 if ((hqCb->hqPSfLnk.node != NULLP) &&
6390 (hqCb->hqPSfLnk.node != NULLP))
6393 hqRecpReq->hqSz = 2;
6397 hqRecpReq->hqSz = 1;
6399 hqRecpReq->pucchResCnt = 1;
6400 hqRecpReq->hqRes[0] = ueCb->ackNakRepCb.pucchRes;
6402 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst, &(pucchRecpInfo->lnk));
6403 pucchRecpInfo->lnk.node = (PTR)pucchRecpInfo;
6405 /* In a given dlSf, if there is 2 TBs context
6406 * stored for a given harq, then they are added
6407 * adjacent to each other in the subframe. To avoid
6408 * adding duplicate recpnInfo for each TB, store this
6409 * hqCb in prvHqCb. If nextHqCb is same as prvHqCb then
6410 * do not add reception req info.*/
6413 RGSCH_NULL_CHECK(cellCb->instIdx, hqCb->hqE->ue);
6414 rgSCHTomUtlMoveNxtOccasion(cellCb, hqCb->hqE->ue, validIdx);
6416 /* Go to the next node */
6422 /** @brief This function handles filling of HARQ feedback recption request
6427 * Function: rgSCHTomUtlFillSfHqFdbkInfo
6431 * @param [out] TfuRecpReqInfo *recpReqInfo
6432 * @param [in] RgSchCellCb *cell
6433 * @param [out] RgSchErrInfo *err
6434 * @param [in] RgSchDlSf *dlSf
6435 * @param [in] uint8_t noFdbks
6436 * @param [in] CmMemListCp *memCp
6437 * @param [in] uint8_t elemIdx
6438 * @param [in] RgSchDlSf *nxtDlsf
6439 * @param [in] uint16_t validIdx;
6445 static S16 rgSCHTomUtlFillSfHqFdbkInfo
6447 TfuRecpReqInfo *recpReqInfo,
6448 RgSchCellCb *cellCb,
6456 RgSchDlHqProcCb *hqCb,
6457 RgSchUePucchRecpInfo *pucchInfo,
6459 RgSchDlHqProcCb *prvHqCb
6462 static S16 rgSCHTomUtlFillSfHqFdbkInfo
6464 TfuRecpReqInfo *recpReqInfo,
6465 RgSchCellCb *cellCb,
6472 RgSchDlHqProcCb *hqCb,
6473 RgSchUePucchRecpInfo *pucchInfo,
6475 RgSchDlHqProcCb *prvHqCb
6480 RgSchUeCb *ueCb = hqCb->hqE->ue;
6482 CmLteTimingInfo futTime;
6483 RgSchTddANInfo *anInfo;
6486 RgrTddAckNackMode ackNackMode;
6487 RgSchDlHqTbCb *tbCb;
6493 RG_SCH_ADD_TO_CRNT_TIME(cellCb->crntTime, futTime, TFU_RECPREQ_DLDELTA);
6497 for (idx = 0 ;idx < 2; idx++)
6499 if (HQ_TB_WAITING == hqCb->tbInfo[idx].state)
6502 tbCb = &hqCb->tbInfo[idx];
6506 ackNackMode = ueCb->dl.ackNackMode;
6508 if(ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL)
6510 anInfo = rgSCHUtlGetUeANFdbkInfo(ueCb, &futTime);
6511 /* Only the last scheduled TB for the UE is for HARQ
6512 * ACK/NACK reception in Bundling case */
6513 if((anInfo == NULLP) ||
6514 (anInfo->latestMIdx != dlSf->dlFdbkInfo.m))
6521 /* Get the TFU reception request pointer, if present */
6522 cmHashListFind(&cellCb->ueTfuPendLst, (uint8_t*) &ueCb->ueId,
6523 sizeof(ueCb->ueId), 0, (PTR *) &pucchInfo);
6526 /* For upgrade we shall use the existing logic of pending list. */
6527 cmHashListFind(&cellCb->ueTfuPendLst, (uint8_t*) &ueCb->ueId,
6528 sizeof(ueCb->ueId), 0, (PTR *) &pucchInfo);
6531 else if(hqCb->hqE->raCb != NULLP)
6533 /* For RACH it is set to Bundling */
6534 ackNackMode = RGR_TDD_ACKNACK_MODE_BUNDL;
6535 rnti = hqCb->hqE->raCb->tmpCrnti;
6542 /* Do not proceed if PUSCH
6543 reception req is already filled*/
6548 /* Go to the next node */
6552 if(((ueCb == NULLP) || (ueCb->measGapCb.isMeasuring != TRUE))
6556 TknUInt16 n1PucchTkn = {FALSE, 0};
6559 pdcch = tbCb->hqP->pdcch;
6561 n1PucchTkn = hqCb->spsN1PucchRes;
6563 for (tbIndx = 0; tbIndx < TFU_MAX_TB; tbIndx++)
6565 if (hqCb->tbInfo[tbIndx].state == HQ_TB_WAITING &&
6566 (RGSCH_TIMEINFO_SAME(hqCb->tbInfo[tbIndx].fdbkTime,
6567 recpReqInfo->timingInfo)))
6570 hqCb->tbInfo[tbIndx].pucchFdbkIdx = hqCb->ulDai;
6573 ret = rgSCHTomUtlFillSfHqFdbkForOneUe(hqCb,recpReqInfo, cellCb, err, dlSf, noFdbks,
6574 memCp, elemIdx, nxtDlsf, rnti, ackNackMode, &pucchInfo, pdcch,
6575 n1PucchTkn, &alloc, hqSz);
6580 /* TODO:: In case of F1BCS and CSI in same subframe
6581 * UE shall drop the CSI if there was at least one
6582 * PDSCH transmission in any of the DL subframe
6583 * mapping to this UL subframe
6586 rgSCHTomUtlFillCqiSrSrsWithHq(cellCb,recpReqInfo, hqCb->hqE->ue,
6587 pucchInfo->pucchRecpInfo, validIdx,FALSE);
6589 if((hqCb->hqE->ue) &&
6590 (hqCb->hqE->ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS))
6593 if(RG_SCH_IS_CELL_SEC(hqCb->hqE->ue,hqCb->hqE->cell))
6595 switch(pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo)
6597 case TFU_PUCCH_HARQ_SR_CQI:
6598 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
6599 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
6601 case TFU_PUCCH_HARQ_CQI:
6602 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
6603 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
6605 case TFU_PUCCH_HARQ_SR_CQI_SRS:
6606 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR_SRS;
6607 RG_SCH_DECR_CQIRI_INDEX(ueCb->cqiRiWritIdx);
6609 case TFU_PUCCH_HARQ_SR_SRS:
6610 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ_SR;
6612 case TFU_PUCCH_HARQ_SRS:
6613 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo = TFU_PUCCH_HARQ;
6624 /* TODO antz - pushing the following code (under TFU_UPGRADE)
6625 * into the above function (...ForOneUe) did not work (caused
6626 * two additional TCs to fail). Don't know why. If this
6627 * is done later, make sure that the code branch
6628 * for relPdcch (later in this func) is also modified appropriately.
6630 /* Now add to the recp request or pending list */
6631 //if((elemIdx != (noFdbks - 1)))
6633 cmHashListInsert(&cellCb->ueTfuPendLst, (PTR) pucchInfo,
6634 (uint8_t *)&rnti ,(uint16_t) sizeof(CmLteRnti));
6638 } /* If measuring */
6639 /* Go to the next node */
6640 if ((tbCb->fbkRecpRepCntr) && (--tbCb->fbkRecpRepCntr))
6642 /* Add to next subfarme */
6643 /* Add this hqCb to the next dlSf's ackNakRepQ */
6644 cmLListAdd2Tail (&(nxtDlsf->ackNakRepQ),
6645 &(tbCb->anRepLnk[tbCb->fbkRecpRepCntr]));
6646 tbCb->anRepLnk[tbCb->fbkRecpRepCntr].node = (PTR)tbCb;
6647 tbCb->crntSubfrm[tbCb->fbkRecpRepCntr] = nxtDlsf;
6649 /* In a given dlSf, if there is 2 TBs context
6650 * stored for a given harq, then they are added
6651 * adjacent to each other in the subframe. To avoid
6652 * adding duplicate recpnInfo for each TB, store this
6653 * hqCb in prvHqCb. If nextHqCb is same as prvHqCb then
6654 * do not add reception req info.*/
6662 /** @brief This function calculates the pucch resource idx
6663 * that is to be filled in harq reception request
6667 * Function: rgSCHTomUtlGethqRes
6670 * -Calculate the pucch resource idx
6671 * Harq Reception Request for Format 1B with
6674 * @param [in] uint8_t noFdbks
6675 * @param [in] RgSchDlSf *dlSf
6676 * @param [in] RgSchPdcch *pdcch
6677 * @param [in] RgSchCellCb *cellCb
6678 * @param [out]uint16_t *hqRes
6681 static Void rgSCHTomUtlGethqRes
6686 RgSchCellCb *cellCb,
6698 m = dlSf->dlFdbkInfo.m;
6700 P = rgSCHCmnGetPValFrmCCE(cellCb, nCce);
6701 nP = cellCb->rgSchTddNpValTbl[P];
6702 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
6703 *hqRes = (M - m - 1)* nP + (m * nPlusOne) + pdcch->nCce +
6704 cellCb->pucchCfg.n1PucchAn;
6709 /** @brief This function fills the harq reception request for
6710 * TDD in case of Fomat 1B with CS for M=1
6714 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1
6717 * -Fill Harq Reception Request for Format 1B with
6720 * @param [in] RgSchDlHqProcCb *hqCb
6721 * @param [in] TfuUePucchRecpReq *hqRecpReq
6722 * @param [in] uint8_t noFdbks
6723 * @param [in] RgSchDlSf *dlSf
6724 * @param [in] RgSchPdcch *pdcch
6725 * @param [in] RgSchCellCb *cellCb
6728 static Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1
6730 RgSchDlHqProcCb *hqCb,
6731 TfuUePucchRecpReq *hqRecpReq,
6738 RgSchUeCb *ue = NULLP;
6739 Bool isCellSec = FALSE;
6742 /*ccpu00147920: UeCb is NULL for SPS activation*/
6743 if(pdcch && pdcch->ue)
6744 {/* SPS Release pdcch or dynamic data */
6751 /* This is not supposed to happen
6752 * Error case. hqCB has to be ter
6753 * when pdcch is present . Adding
6754 * if check bcs of kwork*/
6761 if((hqCb != NULLP) &&
6762 (RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
6767 switch(ue->f1bCsAVal)
6769 case RG_SCH_A_VAL_2:
6770 /* harq(0) is primary harq(1) is secondary) */
6773 hqRecpReq->hqInfo.hqRes[1] = ue->n1PucchF1bResCb.
6774 cw1N1Res[hqCb->tpc].n1PucchIdx;
6776 else/* primary cell */
6779 /* hqCb will be null in case of sps rel pdcch */
6780 if ((hqCb) && hqCb->spsN1PucchRes.pres)
6781 {/* SPS occasion or dyn sched*/
6782 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
6785 #endif /* LTEMAC_SPS */
6786 {/* dyn data or sps release */
6790 /* This is not supposed to happen
6791 * Error case. hqCB has to be ter
6792 * when pdcch is present . Adding
6793 * if check bcs of kwork*/
6798 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
6799 hqRecpReq->hqInfo.hqRes[0] = hqRes;
6803 case RG_SCH_A_VAL_3:
6805 /* Serving cell in mimo mode should be
6806 * in 0 and 1 and the serving cell in siso
6807 * mode should be in 2 indices */
6810 uint8_t servCellIdx = rgSchUtlGetServCellIdx(hqCb->hqE->cell->instIdx,
6811 hqCb->hqE->cell->cellId,
6814 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1)
6815 {/* Sec cell is in mimo mode, use 0 and 1 */
6816 hqRecpReq->hqInfo.hqRes[0] =
6817 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
6818 hqRecpReq->hqInfo.hqRes[1] =
6819 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
6822 {/* Sec cell is in siso mode, use 2 */
6823 hqRecpReq->hqInfo.hqRes[2] =
6824 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
6828 {/* primary cell hq */
6830 if(rgSCHUtlGetMaxTbSupp(ue->mimoInfo.txMode) > 1)
6831 {/* prim cell is in mimo mode, use 0 and 1 */
6833 if (hqCb && hqCb->spsN1PucchRes.pres)
6834 {/* Not sps release */
6835 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
6838 #endif /* LTEMAC_SPS */
6839 {/* sps rel or dyn */
6843 /* This is not supposed to happen
6844 * Error case. hqCB has to be ter
6845 * when pdcch is present . Adding
6846 * if check bcs of kwork*/
6851 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
6852 hqRecpReq->hqInfo.hqRes[0] = hqRes;
6853 hqRecpReq->hqInfo.hqRes[1] = hqRes + 1;
6857 {/* prim cell is in siso mode use 2 */
6859 /* Consider sps occasions */
6860 if (hqCb && hqCb->spsN1PucchRes.pres)
6861 {/* Not sps release */
6862 hqRecpReq->hqInfo.hqRes[2] = hqCb->spsN1PucchRes.val;
6865 #endif /* LTEMAC_SPS */
6870 /* This is not supposed to happen
6871 * Error case. hqCB has to be ter
6872 * when pdcch is present . Adding
6873 * if check bcs of kwork*/
6878 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
6879 hqRecpReq->hqInfo.hqRes[2] = hqRes;
6885 case RG_SCH_A_VAL_4:
6886 {/* Both the serv cells are in mimo mode */
6888 {/* 2 and 3 for sec cell */
6889 hqRecpReq->hqInfo.hqRes[2] =
6890 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
6891 hqRecpReq->hqInfo.hqRes[3] =
6892 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
6894 else/* primary cell */
6895 {/* 0 and 1 are for primary cell */
6897 if (hqCb && hqCb->spsN1PucchRes.pres)
6898 {/* Not sps release */
6899 hqRecpReq->hqInfo.hqRes[0] = hqCb->spsN1PucchRes.val;
6902 #endif /* LTEMAC_SPS */
6907 /* This is not supposed to happen
6908 * Error case. hqCB has to be ter
6909 * when pdcch is present . Adding
6910 * if check bcs of kwork*/
6915 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
6916 hqRecpReq->hqInfo.hqRes[0] = hqRes;
6917 hqRecpReq->hqInfo.hqRes[1] = hqRes + 1;
6928 /** @brief This function fills the harq reception request for
6929 * TDD in case of Fomat 1B with CS for M>=2
6933 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234
6936 * -Fill Harq Reception Request for Format 1B with
6939 * @param [in] RgSchDlHqProcCb *hqCb
6940 * @param [in] TfuUePucchRecpReq *hqRecpReq
6941 * @param [in] uint8_t noFdbks
6942 * @param [in] RgSchDlSf *dlSf
6943 * @param [in] RgSchPdcch *pdcch
6944 * @param [in] RgSchCellCb *cellCb
6945 * @param [in] uint8_t elemIdx
6948 static Void rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234
6950 RgSchDlHqProcCb *hqCb,
6951 TfuUePucchRecpReq *hqRecpReq,
6955 RgSchCellCb *cellCb,
6960 Bool isCellSec = FALSE;
6962 uint8_t servCellIdx;
6965 {/* SPS Release pdcch or dynamic data */
6972 /* This is not supposed to happen
6973 * Error case. hqCB has to be ter
6974 * when pdcch is present . Adding
6975 * if check bcs of kwork*/
6982 if((hqCb != NULLP) && (ue != NULLP) &&
6983 (RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
6989 {/* Sec Cell indices are 2 and 3*/
6990 servCellIdx = rgSchUtlGetServCellIdx(hqCb->hqE->cell->instIdx,
6991 hqCb->hqE->cell->cellId,
6994 hqRecpReq->hqInfo.hqRes[2] =
6995 ue->n1PucchF1bResCb.cw1N1Res[hqCb->tpc].n1PucchIdx;
6997 if(rgSCHUtlGetMaxTbSupp(ue->cellInfo[servCellIdx]->txMode.txModeEnum) > 1)
6999 hqRecpReq->hqInfo.hqRes[3] =
7000 ue->n1PucchF1bResCb.cw2N1Res[hqCb->tpc].n1PucchIdx;
7004 {/* Primary cell indices are 0 and 1 */
7006 * M > 2 if SPS occasion is present in any of the
7007 * DL subframe in the bundle, the n1Pucch(0) is
7008 * the SPS resource and n1Pucch(1) is the resource
7009 * derived from pdcch with DAI = 1
7010 * If No SPS Occasion
7011 * Then n1Pucch(0) is from pdcch with DAI =1
7012 * and n1Pucch(1) is from pdcch with DAI = 2
7016 {/* this is not sps release pdcch */
7017 if(hqCb->spsN1PucchRes.pres == TRUE)
7019 hqRes = hqCb->spsN1PucchRes.val;
7024 {/*Dynamic scheduling or SPS Release
7025 Derive from pdcch */
7026 if(pdcch->dlDai < 3)
7027 {/* No need to calcualte from DAI > 2 */
7028 rgSCHTomUtlGethqRes(noFdbks,dlSf,pdcch,cellCb,&hqRes);
7034 hqRecpReq->hqInfo.hqRes[elemIdx] = hqRes;
7037 {/* Pdcch with DAI = 1 and 2 needs to be used
7038 for resource calculation*/
7039 if(hqCb && hqCb->spsN1PucchRes.pres == TRUE)
7040 {/* dyn or sps occasion */
7041 /* Shift the hqRes[0] if it was filled
7042 * if there was a pdcch with DAI 1 before to this
7045 {/* SPS occasion happened in the middle
7047 /* shifting the non SPS resource to n1Pucch(1) */
7048 hqRecpReq->hqInfo.hqRes[1] = hqRecpReq->hqInfo.hqRes[0];
7051 hqRecpReq->hqInfo.hqRes[0] = hqRes;
7054 else if(pdcch && pdcch->dlDai < 3)
7056 else if(pdcch->dlDai < 3)
7058 {/* sps rel or dyn sched */
7059 /* hqCb wil not be present for sps release pdcch */
7060 if(hqCb && (pdcch->dlDai != hqCb->ulDai))
7061 {/* there was a SPS occasion before to this */
7062 if(pdcch->dlDai == 1)
7064 hqRecpReq->hqInfo.hqRes[1] = hqRes;
7065 }/* ignore the DAI 2 in this case */
7067 {/* There was no SPS occasion before to this */
7071 {/* Added check to ignore kwork warning */
7072 hqRecpReq->hqInfo.hqRes[(pdcch->dlDai)-1] = hqRes;
7081 /** @brief This function fills the harq reception request for
7082 * TDD in case of Fomat 1B with CS
7086 * Function: rgSCHTomUtlFillSfHqFdbkForFrmt1BCS
7089 * -Fill Harq Reception Request for Format 1B with
7092 * @param [in] RgSchDlSf *ulSf
7093 * @param [in] RgSchCellCb *cell
7094 * @param [out]TfuUePucchRecpReq *hqRecpReq
7097 static S16 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS
7099 RgSchDlHqProcCb *hqCb,
7100 TfuUePucchRecpReq *hqRecpReq,
7108 /* Update teh fdbk mode if something different is present
7109 * in L1 API file for F1BS *//* 1 --> F1BCS */
7110 hqRecpReq->hqInfo.hqFdbkMode = TFU_ACK_NACK_CHANNEL_SELECTION;
7114 case RG_SCH_M_VAL_1:
7117 rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM1(hqCb,hqRecpReq,
7118 noFdbks,dlSf,pdcch,cellCb);
7121 case RG_SCH_M_VAL_2:
7122 case RG_SCH_M_VAL_3:
7123 case RG_SCH_M_VAL_4:
7125 /* Spatial bundling will be applied */
7126 rgSCHTomUtlFillSfHqFdbkForFrmt1BCSForM234(hqCb,hqRecpReq,
7127 noFdbks,dlSf,pdcch,cellCb,elemIdx);
7137 /***********************************************************
7139 * Func : rgSCHTomUtlFillSfHqFdbkForOneUe
7141 * Desc : Fill HARQ feedback info for one UE/entry
7149 **********************************************************/
7150 static S16 rgSCHTomUtlFillSfHqFdbkForOneUe
7152 RgSchDlHqProcCb *hqCb,
7153 TfuRecpReqInfo *recpReqInfo,
7154 RgSchCellCb *cellCb,
7162 RgrTddAckNackMode ackNackMode,
7163 RgSchUePucchRecpInfo **pucchInfoRef,
7165 TknUInt16 n1PucchTkn,
7170 RgSchUePucchRecpInfo *pucchInfo = *pucchInfoRef;
7173 TfuUePucchRecpReq *hqRecpReq;
7188 Bool isFirstFdbk = FALSE;
7190 if(pucchInfo == NULLP)
7192 if ((ret = rgSCHUtlGetEventMem((Ptr *)&pucchInfo,
7193 sizeof(RgSchUePucchRecpInfo), memCp)) != ROK)
7195 DU_LOG("\nERROR --> SCH : Unable to "
7196 "Allocate TfuUeRecpReqInfo for cell RNTI:%d",rnti);
7197 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
7201 #ifdef TFU_ALLOC_EVENT_NO_INIT
7202 pucchInfo->hashLstEnt.hashVal = 0;
7203 pucchInfo->hashLstEnt.keyLen = 0;
7204 pucchInfo->hashLstEnt.key = 0;
7205 pucchInfo->hashLstEnt.list.prev = pucchInfo->hashLstEnt.list.next = 0;
7207 if ((ret = rgSCHUtlGetEventMem((Ptr *)&(pucchInfo->pucchRecpInfo),
7208 sizeof(TfuUeRecpReqInfo), &(recpReqInfo->memCp))) != ROK)
7210 DU_LOG("\nERROR --> SCH : Unable to "
7211 "Allocate TfuUeRecpReqInfo for cell RNTI:%d",rnti);
7212 err->errCause = RGSCHERR_TOM_MEM_EXHAUST;
7215 memset(pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqInfo.hqRes,0xff,sizeof(uint16_t)*TFU_MAX_HQ_RES);
7216 #ifdef TFU_ALLOC_EVENT_NO_INIT
7217 memset(&pucchInfo->pucchRecpInfo->t.pucchRecpReq, 0, sizeof(TfuUePucchRecpReq));
7219 pucchInfo->pucchRecpInfo->type = TFU_RECP_REQ_PUCCH;
7220 pucchInfo->pucchRecpInfo->rnti = rnti;
7222 pucchInfo->pucchRecpInfo->t.pucchRecpReq.uciInfo=TFU_PUCCH_HARQ;
7229 /* Calculation of resources same for both bundling and muxing for M = 1
7232 RgSchUeCb *ue = rgSCHDbmGetUeCb (cellCb, rnti);
7233 if((ue) && (1 == ue->numSCells))
7235 if(ue->uciFrmtTyp == RG_SCH_UCI_FORMAT1B_CS)
7237 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
7238 rgSCHTomUtlFillSfHqFdbkForFrmt1BCS(hqCb,hqRecpReq,
7239 noFdbks,dlSf,pdcch,elemIdx,cellCb);
7242 {/* M = 1 case . size is same as A Value*/
7243 hqRecpReq->hqInfo.hqSz = ue->f1bCsAVal;
7244 hqRecpReq->hqInfo.pucchResCnt = hqRecpReq->hqInfo.hqSz;
7247 hqRecpReq->hqInfo.hqSz = (noFdbks * 2); /* M for 2 cells */
7248 hqRecpReq->hqInfo.pucchResCnt = 4;
7250 hqRecpReq->hqInfo.a = ue->f1bCsAVal;
7251 /* handling for SPS occasions*/
7254 /* set the datPresinFirstSUbframe to TRUE if this
7255 * is for pcell txion*/
7257 RgSchTddANInfo *anInfo = NULLP;
7259 /* if this txion is on pcell
7260 * sps occaion, dyn sched or sps release pdcch
7261 * set the sched present in first
7262 * dl subframe of the bundle to TRUE. This
7263 * is required for mapping the feedbak when SPS occasion
7264 * is present in any of the DL subframe in the bundle in
7267 /* SPS will happen only on pcell */
7268 if((hqCb == NULLP) || (!RG_SCH_IS_CELL_SEC(ue,hqCb->hqE->cell)))
7271 anInfo = rgSCHUtlGetUeANFdbkInfo(ue,
7272 &recpReqInfo->timingInfo,RGSCH_PCELL_INDEX);
7274 {/* ANInfo must be there. adding block
7276 DU_LOG("\nERROR --> SCH : ANInfo should not be NULL for cellId=%d \n", cellCb->cellId);
7283 {/* This needs to be revisited while
7284 adding support for PUCCH format 3 */
7285 DU_LOG("\nERROR --> SCH : Invalid Pucch format configured..");
7292 if((ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) ||
7293 ((noFdbks == 1) && (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT)))
7295 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
7297 prevHqSize = hqRecpReq->hqInfo.hqSz;
7300 /* Only one index for bundling case */
7301 hqRecpReq->M = noFdbks;
7303 TFU_HQ_RECP_REQ_NORMAL;
7304 hqRecpReq->multCnt = 1;
7305 hqRecpReq->t.nCce[0] =
7310 rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
7312 hqRecpReq->type = TFU_UCI_HARQ;
7314 #else /* TFU_UPGRADE */
7317 if ((TRUE == isFirstFdbk) && (TRUE == n1PucchTkn.pres))
7319 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)ackNackMode;
7320 hqRecpReq->hqInfo.pucchResCnt=1;
7321 hqRecpReq->hqInfo.hqRes[0] = n1PucchTkn.val;
7322 hqRecpReq->hqInfo.hqSz = hqSz;
7325 else if (FALSE == n1PucchTkn.pres)
7328 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)ackNackMode;
7330 P = rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
7331 nP = cellCb->rgSchTddNpValTbl[P];
7332 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
7333 m = dlSf->dlFdbkInfo.m;
7334 /* In case of no UE */
7335 pucchRes = (M - m - 1)* nP + (m * nPlusOne) + pdcch->nCce +
7336 cellCb->pucchCfg.n1PucchAn;
7337 /*ccpu00130164:MOD-Changed to maitain value of
7338 hqRecpReq->hqInfo.pucchResCnt=1 in case of bundling*/
7339 /*ccpu00132284 -MOD- hqRes need to be updated after pucchReCnt set to 1
7340 * and resource should be update at index-0*/
7341 hqRecpReq->hqInfo.pucchResCnt=1;
7342 hqRecpReq->hqInfo.hqRes[hqRecpReq->hqInfo.pucchResCnt-1] = pucchRes;
7344 if((ackNackMode == RGR_TDD_ACKNACK_MODE_BUNDL) && (hqSz > prevHqSize))
7345 hqRecpReq->hqInfo.hqSz = hqSz;
7346 else if (ackNackMode == RGR_TDD_ACKNACK_MODE_MULT)
7347 hqRecpReq->hqInfo.hqSz = hqSz;
7349 hqRecpReq->hqInfo.hqSz = prevHqSize;
7351 #endif /* TFU_UPGRADE */
7353 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst,
7354 &(pucchInfo->pucchRecpInfo->lnk));
7355 pucchInfo->pucchRecpInfo->lnk.node =
7356 (PTR)pucchInfo->pucchRecpInfo;
7359 else /* Multiplexing */
7362 pucchInfo->pucchRecpInfo->t.pucchRecpReq.M = noFdbks;
7364 if (n1PucchTkn.pres == TRUE)
7366 pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqType =
7367 TFU_HQ_RECP_REQ_N1PUCCH;
7368 pucchInfo->pucchRecpInfo->t.pucchRecpReq.t.n1Pucch = n1PucchTkn.val;
7373 pucchInfo->pucchRecpInfo->t.pucchRecpReq.hqType =
7374 TFU_HQ_RECP_REQ_NORMAL;
7375 multCnt = pucchInfo->pucchRecpInfo->t.pucchRecpReq.multCnt;
7376 pucchInfo->pucchRecpInfo->t.pucchRecpReq.t.nCce[multCnt] =
7378 pucchInfo->pucchRecpInfo->t.pucchRecpReq.m[multCnt] =
7380 pucchInfo->pucchRecpInfo->t.pucchRecpReq.p[multCnt] =
7381 rgSCHCmnGetPValFrmCCE(cellCb, pdcch->nCce);
7383 pucchInfo->pucchRecpInfo->t.pucchRecpReq.multCnt++;
7385 #else /* TFU_UPGRADE */
7387 hqRecpReq = &(pucchInfo->pucchRecpInfo->t.pucchRecpReq);
7388 hqRecpReq->hqInfo.hqFdbkMode = (TfuAckNackMode)RGR_TDD_ACKNACK_MODE_MULT;
7389 hqRecpReq->hqInfo.hqSz = noFdbks;
7391 resIdx = hqRecpReq->hqInfo.pucchResCnt;
7392 hqRecpReq->hqInfo.pucchResCnt++;
7395 if (n1PucchTkn.pres == TRUE)
7397 hqRecpReq->hqInfo.hqRes[resIdx] = n1PucchTkn.val;
7403 m = dlSf->dlFdbkInfo.m;
7405 P = rgSCHCmnGetPValFrmCCE(cellCb, nCce);
7406 nP = cellCb->rgSchTddNpValTbl[P];
7407 nPlusOne = cellCb->rgSchTddNpValTbl[P + 1];
7408 hqRecpReq->hqInfo.hqRes[resIdx] = (M - m - 1)* nP +
7409 (m * nPlusOne) + pdcch->nCce +
7410 cellCb->pucchCfg.n1PucchAn;
7412 #endif /* TFU_UPGRADE */
7413 /* If all the DL subframes are scanned, then
7414 * send TFU request*/
7416 if((elemIdx != noFdbks) && alloc)
7418 cmHashListInsert(&cellCb->ueTfuPendLst, (PTR) pucchInfo,
7419 (uint8_t *)&rnti, (uint16_t) sizeof(rnti));
7424 pucchInfo->pucchRecpInfo->t.pucchRecpReq.type = TFU_UCI_HARQ;
7425 cmLListAdd2Tail(&recpReqInfo->ueRecpReqLst,
7426 &(pucchInfo->pucchRecpInfo->lnk));
7427 pucchInfo->pucchRecpInfo->lnk.node =
7428 (PTR)pucchInfo->pucchRecpInfo;
7429 /* Delete the entry after addition to the list */
7430 cmHashListDelete(&cellCb->ueTfuPendLst, (PTR) pucchInfo);
7436 *pucchInfoRef = pucchInfo;
7442 #ifdef RG_ULSCHED_AT_CRC
7443 /** @brief This function does all the processing related to a single downlink
7448 * Function: rgSCHTomUtlProcDlSfAtCrc
7451 * - collate control data for all UEs and send to PHY
7452 * - collate data buffers for all UEs and send to PHY
7454 * @param [in] RgSchDlSf *ulSf
7455 * @param [in] RgSchCellCb *cell
7456 * @param [in] TfuCntrlReqInfo *cntrlInfo
7457 * @param [out] RgSchErrInfo *err
7460 static S16 rgSCHTomUtlProcDlSfAtCrc
7463 CmLteTimingInfo crntUlFrm,
7465 TfuCntrlReqInfo *cntrlInfo,
7469 Inst inst = cell->instIdx;
7472 cntrlInfo->numDlActvUes = 0;
7473 cmLListInit(&cntrlInfo->phichLst);
7474 cmLListInit(&cntrlInfo->dlPdcchLst);
7475 cmLListInit(&cntrlInfo->ulPdcchLst);
7476 #ifdef TFU_ALLOC_EVENT_NO_INIT
7477 cntrlInfo->dlTiming.sfn = cntrlInfo->dlTiming.subframe = 0;
7481 cntrlInfo->ulTiming = crntUlFrm;
7482 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cntrlInfo->ulTiming, TFU_ULCNTRL_DLDELTA);
7484 cntrlInfo->cellId = cell->cellId;
7485 /* Fill PHICH info */
7486 if ((ret = rgSCHTomUtlFillPhich (cell, cntrlInfo, ulSf, err)) != ROK)
7488 DU_LOG("\nERROR --> SCH : Unable to send PHICH info for cell");
7489 RGSCH_FREE_MEM(cntrlInfo);
7494 if ((ret = rgSCHTomUtlFillUlPdcch (cell, cntrlInfo, ulSf, err)) != ROK)
7496 DU_LOG("\nERROR --> SCH : Unable to send PDCCH info for cell");
7497 RGSCH_FREE_MEM(cntrlInfo);
7502 if(0 == cntrlInfo->ulMpdcchLst.count)
7509 if ((cntrlInfo->ulPdcchLst.count || cntrlInfo->phichLst.count) || RG_SCH_EMTC_GET_PDCCHLST_CNT(cntrlInfo))
7511 if (cntrlInfo->ulPdcchLst.count || cntrlInfo->phichLst.count)
7514 //if (rgSCHUtlTfuCntrlReq(inst, cell->tfuSap->sapCfg.suId, cntrlInfo) != ROK)
7516 DU_LOG("\nERROR --> SCH : Unable to send Cntrl info for cell");
7521 RGSCH_FREE_MEM(cntrlInfo);
7525 #endif /* #ifdef RG_ULSCHED_AT_CRC*/
7528 /** @brief This function sends the SFN Tick to L3
7533 * Function: rgSCHTomUtlSendSfnTick
7535 * @param [in] RgSchCellCb *cell
7537 static Void rgSCHTomUtlSendSfnTick
7542 RgrTtiIndInfo *rgrTtiInd;
7544 /* TTI to be sent to RRM only once per system frame */
7545 /* Added support for period = 0 to disable tick to RRM */
7546 if ((cell->rrmTtiIndPrd != 0) &&
7547 ((cell->crntTime.sfn % cell->rrmTtiIndPrd) == 0) &&
7548 (cell->crntTime.slot == 0))
7550 /* Allocate a TTI indication structure and send to RRM over RGR interface */
7551 if (rgSCHUtlAllocSBuf (cell->instIdx,
7552 (Data**)&rgrTtiInd, sizeof(RgrTtiIndInfo)) != ROK)
7554 DU_LOG("\nERROR --> SCH : Mem alloc failed for RGR TTI ind, cellId (%d))\n",
7558 rgrTtiInd->cellId = cell->cellId;
7559 //rgrTtiInd->hSfn = cell->crntTime.hSfn;
7560 rgrTtiInd->sfn = cell->crntTime.sfn;
7562 if (rgSCHUtlRgrTtiInd (cell, rgrTtiInd) != ROK)
7564 DU_LOG("\nERROR --> SCH : Failed to send RGR TTI ind, cellId (%d))\n",
7566 rgSCHUtlFreeSBuf(cell->instIdx, (Data**)&rgrTtiInd,
7567 sizeof(RgrTtiIndInfo));
7577 /* @brief Mark Dyn TDD CrntSfIdx.
7581 * Function: rgSCHDynTDDMrkCrntSfIdx
7582 * Purpose: update the dyn tdd sunframe index
7583 * @param[in] Inst schInst
7587 static Void rgSCHDynTDDMrkCrntSfIdx(Inst schInst)
7589 RgSchDynTddCb *rgSchDynTddInfo = &(rgSchCb[schInst].rgSchDynTdd);
7592 RG_SCH_DYN_TDD_MARKTYPE(rgSchDynTddInfo, rgSchDynTddInfo->crntDTddSfIdx,
7593 RG_SCH_DYNTDD_NOTDEF);
7594 rgSchDynTddInfo->crntDTddSfIdx = (rgSchDynTddInfo->crntDTddSfIdx + 1) %
7595 RG_SCH_DYNTDD_MAX_SFINFO;
7597 //DU_LOG("\nERROR --> SCH : Initializing Index %d \n", rgSchDynTddInfo->crntDTddSfIdx);
7603 /** @brief This function fills the TTI timinig info for each cell
7607 * Function: rgSchTomFillCellTtiInfo
7609 * @param [in] TfuTtiIndInfo *ttiInd
7610 * @param [in] Inst schInst
7611 * @param [out] uint8_t *nCell
7612 * @param [out] RgSchCellCb *cell[]
7618 static Void rgSchTomFillCellTtiInfo
7620 TfuTtiIndInfo *ttiInd,
7623 RgSchCellCb *cells[]
7628 TfuTtiCellInfo *cellInfo;
7632 CmLteTimingInfo frm;
7634 if (CM_LTE_MAX_CELLS < ttiInd->numCells)
7640 rgSCHDynTDDMrkCrntSfIdx(schInst);
7643 for (i = 0; i < ttiInd->numCells; i++)
7645 cellInfo = &ttiInd->cells[i];
7646 strtCellId = rgSchCb[schInst].genCfg.startCellId;
7647 Idx1 = (uint8_t)((cellInfo->cellId - strtCellId)&(CM_LTE_MAX_CELLS-1));
7648 cell = rgSchCb[schInst].cells[Idx1];
7649 /* Validate the cell */
7652 /* Use SCH inst 0 print buff */
7653 DU_LOG("\nERROR --> SCH : RgLiTfuTtiInd()No cell exists for cellId %d\n",
7657 *nCell = *nCell + 1;
7658 cells[i] = (RgSchCellCb *)cell;
7661 if(cell->schTickDelta != cellInfo->schTickDelta)
7663 DU_LOG("\nERROR --> SCH : Delta changed for cellId=%d: curr delta=%d new delta=%d\n"
7664 "dlblankSf=%d ulblankSf=%d dummyTti=%d \n",
7665 cell->cellId, cell->schTickDelta, cellInfo->schTickDelta, cellInfo->dlBlankSf,cellInfo->ulBlankSf,
7666 cellInfo->isDummyTti);
7668 RGSCH_UPDATE_DELTA(schInst, cellInfo->schTickDelta);
7669 cell->schTickDelta = cellInfo->schTickDelta;
7672 cell->stopSiSch = cellInfo->dlBlankSf;
7673 cell->stopDlSch = cellInfo->dlBlankSf;
7674 cell->stopUlSch = cellInfo->ulBlankSf;
7675 if (cellInfo->isDummyTti)
7677 cell->stopDlSch = TRUE;
7679 if((0 == (cellInfo->timingInfo.sfn % 30)) && (0 == cellInfo->timingInfo.slot))
7681 //DU_LOG("5GTF_CHECK rgSCHTOMTtiInd (%d : %d)\n", cellInfo->timingInfo.sfn, cellInfo->timingInfo.slot);
7684 RGSCHCPYTIMEINFO(cellInfo->timingInfo, cell->crntTime);
7685 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->hiDci0Time,
7686 TFU_ULCNTRL_DLDELTA);
7687 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->dlDciTime,
7688 TFU_DLCNTRL_DLDELTA);
7689 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->rcpReqTime,
7690 TFU_RECPREQ_DLDELTA);
7691 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->hqRlsTime,
7692 TFU_HQFBKIND_ULDELTA);
7693 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->dlSfRlsTime,
7696 RGSCHCPYTIMEINFO_EMTC(cellInfo->timingInfo, cell->crntTime);
7697 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->hiDci0Time,
7698 TFU_ULCNTRL_DLDELTA);
7699 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->dlDciTime,
7700 TFU_DLCNTRL_DLDELTA);
7701 RG_SCH_ADD_TO_CRNT_TIME_EMTC(cell->crntTime, cell->rcpReqTime,
7702 TFU_RECPREQ_DLDELTA);
7703 RGSCHDECRFRMCRNTTIME_EMTC(cell->crntTime, cell->hqRlsTime,
7704 TFU_HQFBKIND_ULDELTA);
7705 RGSCHDECRFRMCRNTTIME_EMTC(cell->crntTime, cell->dlSfRlsTime,
7708 rgSCHCmnUpdVars(cell);
7709 cell->isDlDataAllwd = TRUE;
7710 /* Get DownLink SubFrame */
7711 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
7712 frm = cell->crntTime;
7714 RGSCH_INCR_SUB_FRAME(frm, RG_SCH_CMN_DL_DELTA);
7716 RGSCH_INCR_SUB_FRAME_EMTC(frm, RG_SCH_CMN_DL_DELTA);
7718 cellSch->dl.time = frm;
7724 uint8_t idx = (cell->crntTime.slot + RG_SCH_CMN_DL_DELTA) %
7725 RGSCH_NUM_SUB_FRAMES_5G;
7727 cell->isDlDataAllwd = RG_SCH_CMN_CHK_DL_DATA_ALLOWED(cell, idx);
7729 /*ccpu00130639 -ADD - used in UL HARQ proc id calculation*/
7730 if((cell->crntTime.sfn == 0) && (cell->crntTime.slot == 0))
7732 /* sfn Cycle used for Tdd UL Harq Proc Determination.
7733 This sfn Cycle will have values from 0 to numUl Harq-1. */
7734 cell->tddHqSfnCycle = (cell->tddHqSfnCycle + 1 ) %
7735 (rgSchTddUlNumHarqProcTbl[cell->ulDlCfgIdx]);
7739 if(cell->emtcEnable)
7741 rgSCHUtlEmtcResPrcTti(cell);
7747 void schFillCrntTime(
7748 SlotIndInfo slotInd,
7751 uint8_t cellCount = 0;
7752 for(cellCount = 0; cellCount < CM_LTE_MAX_CELLS; cellCount++)
7755 cell = rgSchCb[schInst].cells[cellCount];
7757 RGSCHCPYTIMEINFO(slotInd, cell->crntTime);
7759 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->hiDci0Time,
7760 TFU_ULCNTRL_DLDELTA);
7761 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->dlDciTime,
7762 TFU_DLCNTRL_DLDELTA);
7763 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, cell->rcpReqTime,
7764 TFU_RECPREQ_DLDELTA);
7765 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->hqRlsTime,
7766 TFU_HQFBKIND_ULDELTA);
7767 RGSCHDECRFRMCRNTTIME(cell->crntTime, cell->dlSfRlsTime,
7770 RGSCH_INCR_SUB_FRAME(cell->crntTime, RG_SCH_CMN_DL_DELTA);
7772 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
7773 cellSch->dl.time = cell->crntTime;
7777 /** @brief This function prepares the TTI for scheduling and
7778 * invokes the Common channel scheduler. Uplink scheduler
7779 * is invoked first if UL Scheduling at CRC is not enabled
7783 * Function: rgSchTomTtiUlAndDlCmnChSch
7785 * @param [out] RgSchCellCb *cell
7790 static Void rgSchTomTtiUlAndDlCmnChSch
7796 cell->rlsHqArr[cell->crntHqIdx].numUes = 0;
7798 cell->crntHqIdx = cell->crntHqIdx % RGSCH_NUM_SUB_FRAMES;
7800 cmPrcTmr(&cell->tqCp, cell->tq, (PFV)rgSCHTmrProcTmr);
7801 rgSCHMeasGapANRepTtiHndl (cell);
7802 /* We need to fill the PHICH for the UL Data, first we need to get the UL
7803 * SF from Scheduler, next we fill the dlSf that goes out this TTI.
7804 * This must be performed prior to any other processing of the TTI
7805 * so that we do not wrap around and generate feedback prior to
7806 * reception of UL data.
7808 #ifndef RG_ULSCHED_AT_CRC
7811 uint8_t idx; /* Index into Uplink Sf array */
7813 Mval = rgSchTddPhichMValTbl[cell->ulDlCfgIdx]
7814 [cell->hiDci0Time.subframe];
7818 for(idx=0; idx < Mval; idx++)
7820 rgSCHCmnRlsUlSf(cell, idx);
7826 /* DTX processing for those Harq's which did not get feedback from L1 */
7827 rgSCHDhmRlsDlsfHqProc (cell, cell->hqRlsTime);
7828 /* Re-Init the Downlink subframe */
7829 rgSCHUtlDlRlsSubFrm(cell, cell->dlSfRlsTime);
7830 /* Added handling to retransmit
7831 * release PDCCH in case of DTX
7834 /*Check for DRX every TTI*/
7835 rgSCHDrxTtiInd(cell);
7837 /* For TDD, UL scheduling should happen after DL scheduling */
7839 #ifndef RG_ULSCHED_AT_CRC
7840 /* Perform UL scheduling */
7841 rgSCHCmnUlSch(cell);
7844 /* Perform DL scheduling for Common channels */
7845 rgSCHCmnDlCommonChSch(cell);
7850 /** @brief This function invokes the Non critical procedures like measurements,
7851 * and RGR configurations.
7855 * Function: rgSchTomTtiMiscFunctions
7857 * @param [in] RgSchCellCb *cell
7862 static Void rgSchTomTtiMiscFunctions
7867 uint8_t suId = cell->tfuSap->sapCfg.suId;
7869 /* Invoke RAM Tti Handler */
7870 rgSCHRamTtiHndlr(cell);
7872 /* Handle RGR configurations */
7873 rgSCHGomTtiHndlr(cell, suId);
7875 if((RGM_PRB_REPORT_START == cell->prbUsage.prbRprtEnabld)
7876 && (!(cell->prbUsage.rprtPeriod) || ((glblTtiCnt % cell->prbUsage.rprtPeriod) == 0)))
7878 rgSCHUtlUpdAvgPrbUsage(cell);
7880 rgSCHL2Meas(cell,FALSE);
7883 /* LTE_ADV_FLAG_REMOVED_START */
7884 /* Report ABS Load information to application periodically */
7885 if((RGR_ENABLE == cell->lteAdvCb.absCfg.status) &&
7886 (cell->lteAdvCb.absCfg.absLoadPeriodicity))
7888 RgrLoadInfIndInfo *rgrLoadInf;
7891 cell->lteAdvCb.absLoadTtiCnt++;
7892 if(cell->lteAdvCb.absLoadTtiCnt >= cell->lteAdvCb.absCfg.absLoadPeriodicity)
7895 if(rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&rgrLoadInf,
7896 sizeof(RgrLoadInfIndInfo)) != ROK)
7898 DU_LOG("\nERROR --> SCH : Could not "\
7899 "allocate memory for sending LoadInfo\n");
7902 cell->lteAdvCb.absLoadTtiCnt = 0;
7903 rgrLoadInf->cellId = cell->cellId;
7904 rgrLoadInf->bw = cell->bwCfg.dlTotalBw;
7905 rgrLoadInf->type = RGR_ABS;
7906 for(idx= 0; idx<RGR_ABS_PATTERN_LEN; idx++)
7908 rgrLoadInf->u.absLoadInfo[idx] = cell->lteAdvCb.absLoadInfo[idx];
7909 cell->lteAdvCb.absLoadInfo[idx] = 0;
7911 rgSCHUtlRgrLoadInfInd(cell, rgrLoadInf);
7916 if(cell->isDlDataAllwd)
7918 /* Calling function to update CFI parameters*/
7919 rgSchCmnUpdCfiDb(cell, RG_SCH_CMN_DL_DELTA);
7923 /* Incrementing the ttiCnt in case of UL subframe */
7924 if(!cell->dynCfiCb.switchOvrInProgress)
7926 cell->dynCfiCb.ttiCnt++;
7930 rgSchCmnUpdCfiDb(cell, RG_SCH_CMN_DL_DELTA);
7933 /* LTE_ADV_FLAG_REMOVED_END */
7938 /** @brief This function invokes the Downlink scheduler
7942 * Function: rgSchTomTtiDlSch
7944 * @param [in] RgSchCellCb *cell
7949 static Void rgSchTomTtiDlSch
7955 if (cell->isDlDataAllwd && (cell->stopDlSch == FALSE))
7957 rgSCHCmnDlSch(cell);
7963 /** @brief This function invokes Consolidates the allocations
7964 * send the Subframe allocation info to MAC
7968 * Function: rgSchTomTtiCnsldtSfAlloc
7970 * @param [in] RgSchCellCb *cell
7975 static Void rgSchTomTtiCnsldtSfAlloc
7981 RgSchCmnCell *cellSch = RG_SCH_CMN_GET_CELL(cell);
7983 dlSf = rgSCHUtlSubFrmGet(cell, cellSch->dl.time);
7985 /* Prepare Subframe allocation info and send to MAC */
7986 rgSCHCmnCnsldtSfAlloc(cell);
7988 /* Call ACK NACK module to add to dlsf Queue */
7989 rgSCHAckNakRepAddToQ(cell, dlSf);
7991 rgSCHTomUtlProcTA(cell);
7996 /** @brief This function prepares the DL and UL Config requests
8001 * Function: rgSchTomTtiL1DlAndUlCfg
8003 * @param [in] RgSchCellCb *cell
8008 static Void rgSchTomTtiL1DlAndUlCfg
8011 RgTfuCntrlReqInfo *cntrlInfo
8014 RgSchDlSf *dlSf = rgSCHUtlSubFrmGet (cell, cell->dlDciTime);
8015 RgSchDlSf *ulSf = rgSCHUtlSubFrmGet (cell, cell->hiDci0Time);
8018 rgSCHTomUtlProcDlSf (dlSf, ulSf, cell, cntrlInfo, &err);
8019 /* Mark this frame as sent */
8020 dlSf->txDone = TRUE;
8022 rgBwAlloInfo[dlSf->sfNum] += dlSf->bwAssigned;
8023 rgBwAlcnt[dlSf->sfNum] ++;
8027 rgSCHTomUtlProcTddUlSf(cell);
8029 rgSCHTomUtlProcUlSf (cell, &err);
8035 /** @brief This function prepares does the Downlink subframe re-init and
8036 * Harq DTX processing
8040 * Function: rgSchTomUtlTddRlsSfAndHarq
8042 * @param [in] RgSchCellCb *cell
8047 static Void rgSchTomUtlTddRlsSfAndHarq
8053 /* ccpu00132341-MOD- rgSchTddRlsDlSubfrmTbl is dependent on DELTA(=2).
8054 * Instead rgSchTddDlAscSetIdxKTbl can be used as the K set gives proper
8056 /* ccpu00133109: Removed RGSCHSUBFRMCRNTTIME as it is not giving proper
8057 * output if diff is more than 10. Instead using RGSCHDECRFRMCRNTTIME()
8058 * as it is serving the purpose */
8059 if(rgSchTddDlAscSetIdxKTbl[cell->ulDlCfgIdx][cell->hqRlsTime.subframe].
8062 /* ccpu00132341-MOD- Providing the UL SF timing for avoiding
8063 * calculation inside the function */
8064 rgSCHDhmTddRlsSubFrm(cell, cell->hqRlsTime);
8065 rgSCHDhmRlsDlsfHqProc(cell, cell->hqRlsTime);
8070 /** @brief This function processes the UL subframe and fills TFU reception
8075 * Function: rgSCHTomUtlProcTddUlSf
8077 * @param [in] RgSchCellCb *cell
8082 static Void rgSCHTomUtlProcTddUlSf(RgSchCellCb *cell)
8086 if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
8087 [cell->rcpReqTime.subframe] == RG_SCH_TDD_UL_SUBFRAME)
8089 if (rgSCHTomUtlProcUlSf (cell, &err) != ROK)
8091 /* fill in err type and call sta ind */
8092 DU_LOG("\nERROR --> SCH : Unable to process Uplink subframe for cellId (%d))\n", cell->cellId);
8095 /* TDD Fix , to allow Special SF SRS CFg */
8096 else if(rgSchTddUlDlSubfrmTbl[cell->ulDlCfgIdx]
8097 [cell->rcpReqTime.subframe] == RG_SCH_TDD_SPL_SUBFRAME)
8099 if (rgSCHTomUtlPrcUlTddSpclSf(cell, &err) != ROK)
8101 /* fill in err type and call sta ind */
8102 DU_LOG("\nERROR --> SCH : Unable to process Sipceial subframe for cellId (%d))\n", cell->cellId);
8111 /**********************************************************************
8114 **********************************************************************/