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_tmr.c
32 @brief This module does processing related to timers for the scheduler.
35 /* header include files -- defines (.h) */
36 #include "common_def.h"
37 #include "tfu.h" /* RGU defines */
38 #include "lrg.h" /* layer management defines for LTE-MAC */
39 #include "rgr.h" /* layer management defines for LTE-MAC */
40 #include "rg_env.h" /* defines and macros for MAC */
41 #include "rg_sch_err.h" /* defines and macros for MAC */
42 #include "rg_sch_inf.h" /* defines and macros for MAC */
43 #include "rg_sch.h" /* defines and macros for MAC */
46 /* header/extern include files (.x) */
47 #include "tfu.x" /* RGU types */
48 #include "lrg.x" /* layer management typedefs for MAC */
49 #include "rgr.x" /* layer management typedefs for MAC */
50 #include "rg_sch_inf.x" /* typedefs for MAC */
51 #include "rg_sch.x" /* typedefs for MAC */
54 Void rgSCHSCellActivation ARGS((
55 RgSchUeCellInfo *sCell
58 /** @brief This function is a utility function to start timers, it is a
63 * Function: rgSCHTmrStartTmr
66 * - Starts timer at scheduler
68 * @param[in] RgSchCellCb *cell
70 * @param[in] S16 tmrEvnt
71 * @param[in] uint32_t tmrVal
74 Void rgSCHTmrStartTmr(RgSchCellCb *cell,Ptr cb,S16 tmrEvnt,uint32_t tmrVal)
79 RgSchUeCellInfo *sCellCb = NULLP;
85 if(tmrEvnt == RG_SCH_TMR_SCELL_DEACT)
87 sCellCb = (RgSchUeCellInfo *)cb;
97 case RG_SCH_TMR_ACKNACK_REP:
98 arg.timers = &(ue->ackNakRepCb.ackNakRepTmr);
99 DU_LOG("\nINFO --> SCH : Hit AckNackRep timer");
101 case RG_SCH_TMR_MEASGAP:
102 arg.timers = &(ue->measGapCb.measGapTmr);
104 case RG_SCH_TMR_UL_ACKNACK:
105 arg.timers = &(ue->ackNakRepCb.ackNakRepUlInactvTmr);
107 case RG_SCH_TMR_DL_ACKNACK:
108 arg.timers = &(ue->ackNakRepCb.ackNakRepDlInactvTmr);
110 case RG_SCH_TMR_UL_MEASGAP:
111 arg.timers = &(ue->measGapCb.measGapUlInactvTmr);
113 case RG_SCH_TMR_DL_MEASGAP:
114 arg.timers = &(ue->measGapCb.measGapDlInactvTmr);
117 arg.timers = &(ue->taTmr);
119 /*MS_WORKAROUND for CR FIXME */
123 arg.timers = &(ue->bsrTmr);
129 #ifdef NO_BSR_SR_5GTF
132 arg.timers = &(ue->bsrTmr);
136 case RG_SCH_TMR_TXMODE_TRNSTN:
138 arg.timers = &(ue->txModeTransTmr);
142 case RG_SCH_TMR_SCELL_DEACT:
144 arg.timers = &(sCellCb->deactTmr);
147 case RG_SCH_TMR_SCELL_ACT_DELAY:
149 sCellCb = (RgSchUeCellInfo *)cb;
150 arg.timers = &(sCellCb->actDelayTmr);
155 DU_LOG("\nERROR --> SCH : rgSCHTmrStartTmr() Incorrect Timer event");
159 arg.tqCp = &(cell->tqCp);
171 /** @brief This function stops the timer.
175 * Function: rgSCHTmrStopTmr
178 * - Stops timer at scheduler.
180 * @param[in] RgSchCellCb *cell
181 * @param[in] S16 tmrEvnt
185 Void rgSCHTmrStopTmr(RgSchCellCb *cell,S16 tmrEvnt,Ptr cb)
190 RgSchUeCellInfo *sCellCb = NULLP;
196 if(tmrEvnt == RG_SCH_TMR_SCELL_DEACT)
198 sCellCb = (RgSchUeCellInfo *)cb;
208 case RG_SCH_TMR_ACKNACK_REP:
209 arg.timers = &(ue->ackNakRepCb.ackNakRepTmr);
211 case RG_SCH_TMR_MEASGAP:
212 arg.timers = &(ue->measGapCb.measGapTmr);
214 case RG_SCH_TMR_UL_ACKNACK:
215 arg.timers = &(ue->ackNakRepCb.ackNakRepUlInactvTmr);
217 case RG_SCH_TMR_DL_ACKNACK:
218 arg.timers = &(ue->ackNakRepCb.ackNakRepDlInactvTmr);
220 case RG_SCH_TMR_UL_MEASGAP:
221 arg.timers = &(ue->measGapCb.measGapUlInactvTmr);
223 case RG_SCH_TMR_DL_MEASGAP:
224 arg.timers = &(ue->measGapCb.measGapDlInactvTmr);
227 arg.timers = &(ue->taTmr);
229 /*MS_WORKAROUND for CR FIXME */
234 arg.timers = &(ue->bsrTmr);
240 #ifdef NO_BSR_SR_5GTF
243 arg.timers = &(ue->bsrTmr);
248 case RG_SCH_TMR_TXMODE_TRNSTN:
250 arg.timers = &(ue->txModeTransTmr);
254 case RG_SCH_TMR_SCELL_DEACT:
256 arg.timers = &(sCellCb->deactTmr);
259 case RG_SCH_TMR_SCELL_ACT_DELAY:
261 sCellCb = (RgSchUeCellInfo *)cb;
262 arg.timers = &(sCellCb->actDelayTmr);
268 DU_LOG("\nERROR --> SCH : rgSCHTmrStopTmr() Incorrect Timer event");
272 arg.tqCp = &(cell->tqCp);
283 /** @brief This function handles timer expiry.
287 * Function: rgSCHTmrProcTmr
290 * - Handles processing on timer expiry at scheduler.
293 * @param[in] S16 tmrEvnt
296 Void rgSCHTmrProcTmr(Ptr cb,S16 tmrEvnt)
298 RgSchUeCb *ue = NULLP;
300 RgSchUeCellInfo *sCellCb = NULLP;
306 if(tmrEvnt == RG_SCH_TMR_SCELL_DEACT)
308 sCellCb = (RgSchUeCellInfo *)cb;
319 case RG_SCH_TMR_ACKNACK_REP:
320 rgSCHAckNakRepTmrExpry (ue);
322 case RG_SCH_TMR_MEASGAP:
323 rgSCHMeasGapANRepTmrExpry (ue);
325 case RG_SCH_TMR_UL_MEASGAP:
326 case RG_SCH_TMR_UL_ACKNACK:
327 rgSCHMeasGapANRepUlInactvTmrExpry (ue, (uint8_t)tmrEvnt);
329 case RG_SCH_TMR_DL_ACKNACK:
330 case RG_SCH_TMR_DL_MEASGAP:
331 rgSCHMeasGapANRepDlInactvTmrExpry (ue, (uint8_t)tmrEvnt);
335 /*TODO Needto handle TA Timer expiry for EMTC UE*/
336 if(TRUE == ue->isEmtcUe)
338 DU_LOG("\nINFO --> SCH : TA Timer Expiry is not handled for EMTC UE\n");
342 rgSCHDhmProcTAExp (ue);
344 /*MS_WORKAROUND for CR FIXME */
348 rgSCHCmnBsrTmrExpry(ue);
354 rgSCHCmnBsrTmrExpry(ue);
359 case RG_SCH_TMR_TXMODE_TRNSTN:
361 ue->txModeTransCmplt = TRUE;
365 case RG_SCH_TMR_SCELL_DEACT:
367 rgSCHSCellDeactTmrExpry(sCellCb);
370 case RG_SCH_TMR_SCELL_ACT_DELAY:
372 sCellCb = (RgSchUeCellInfo *)cb;
373 rgSCHSCellActivation(sCellCb);
380 DU_LOG("\nERROR --> SCH : rgSCHTmrProcTmr() Incorrect Timer event");
388 /**********************************************************************
391 **********************************************************************/