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 */
44 #include "rl_interface.h"
45 #include "rl_common.h"
48 /* header/extern include files (.x) */
49 #include "tfu.x" /* RGU types */
50 #include "lrg.x" /* layer management typedefs for MAC */
51 #include "rgr.x" /* layer management typedefs for MAC */
52 #include "rg_sch_inf.x" /* typedefs for MAC */
53 #include "rg_sch.x" /* typedefs for MAC */
56 Void rgSCHSCellActivation ARGS((
57 RgSchUeCellInfo *sCell
60 /** @brief This function is a utility function to start timers, it is a
65 * Function: rgSCHTmrStartTmr
68 * - Starts timer at scheduler
70 * @param[in] RgSchCellCb *cell
72 * @param[in] S16 tmrEvnt
73 * @param[in] uint32_t tmrVal
76 Void rgSCHTmrStartTmr(RgSchCellCb *cell,Ptr cb,S16 tmrEvnt,uint32_t tmrVal)
81 RgSchUeCellInfo *sCellCb = NULLP;
87 if(tmrEvnt == RG_SCH_TMR_SCELL_DEACT)
89 sCellCb = (RgSchUeCellInfo *)cb;
99 case RG_SCH_TMR_ACKNACK_REP:
100 arg.timers = &(ue->ackNakRepCb.ackNakRepTmr);
101 DU_LOG("\nINFO --> SCH : Hit AckNackRep timer");
103 case RG_SCH_TMR_MEASGAP:
104 arg.timers = &(ue->measGapCb.measGapTmr);
106 case RG_SCH_TMR_UL_ACKNACK:
107 arg.timers = &(ue->ackNakRepCb.ackNakRepUlInactvTmr);
109 case RG_SCH_TMR_DL_ACKNACK:
110 arg.timers = &(ue->ackNakRepCb.ackNakRepDlInactvTmr);
112 case RG_SCH_TMR_UL_MEASGAP:
113 arg.timers = &(ue->measGapCb.measGapUlInactvTmr);
115 case RG_SCH_TMR_DL_MEASGAP:
116 arg.timers = &(ue->measGapCb.measGapDlInactvTmr);
119 arg.timers = &(ue->taTmr);
121 /*MS_WORKAROUND for CR FIXME */
125 arg.timers = &(ue->bsrTmr);
131 #ifdef NO_BSR_SR_5GTF
134 arg.timers = &(ue->bsrTmr);
138 case RG_SCH_TMR_TXMODE_TRNSTN:
140 arg.timers = &(ue->txModeTransTmr);
144 case RG_SCH_TMR_SCELL_DEACT:
146 arg.timers = &(sCellCb->deactTmr);
149 case RG_SCH_TMR_SCELL_ACT_DELAY:
151 sCellCb = (RgSchUeCellInfo *)cb;
152 arg.timers = &(sCellCb->actDelayTmr);
157 DU_LOG("\nERROR --> SCH : rgSCHTmrStartTmr() Incorrect Timer event");
161 arg.tqCp = &(cell->tqCp);
173 /** @brief This function stops the timer.
177 * Function: rgSCHTmrStopTmr
180 * - Stops timer at scheduler.
182 * @param[in] RgSchCellCb *cell
183 * @param[in] S16 tmrEvnt
187 Void rgSCHTmrStopTmr(RgSchCellCb *cell,S16 tmrEvnt,Ptr cb)
192 RgSchUeCellInfo *sCellCb = NULLP;
198 if(tmrEvnt == RG_SCH_TMR_SCELL_DEACT)
200 sCellCb = (RgSchUeCellInfo *)cb;
210 case RG_SCH_TMR_ACKNACK_REP:
211 arg.timers = &(ue->ackNakRepCb.ackNakRepTmr);
213 case RG_SCH_TMR_MEASGAP:
214 arg.timers = &(ue->measGapCb.measGapTmr);
216 case RG_SCH_TMR_UL_ACKNACK:
217 arg.timers = &(ue->ackNakRepCb.ackNakRepUlInactvTmr);
219 case RG_SCH_TMR_DL_ACKNACK:
220 arg.timers = &(ue->ackNakRepCb.ackNakRepDlInactvTmr);
222 case RG_SCH_TMR_UL_MEASGAP:
223 arg.timers = &(ue->measGapCb.measGapUlInactvTmr);
225 case RG_SCH_TMR_DL_MEASGAP:
226 arg.timers = &(ue->measGapCb.measGapDlInactvTmr);
229 arg.timers = &(ue->taTmr);
231 /*MS_WORKAROUND for CR FIXME */
236 arg.timers = &(ue->bsrTmr);
242 #ifdef NO_BSR_SR_5GTF
245 arg.timers = &(ue->bsrTmr);
250 case RG_SCH_TMR_TXMODE_TRNSTN:
252 arg.timers = &(ue->txModeTransTmr);
256 case RG_SCH_TMR_SCELL_DEACT:
258 arg.timers = &(sCellCb->deactTmr);
261 case RG_SCH_TMR_SCELL_ACT_DELAY:
263 sCellCb = (RgSchUeCellInfo *)cb;
264 arg.timers = &(sCellCb->actDelayTmr);
270 DU_LOG("\nERROR --> SCH : rgSCHTmrStopTmr() Incorrect Timer event");
274 arg.tqCp = &(cell->tqCp);
285 /** @brief This function handles timer expiry.
289 * Function: rgSCHTmrProcTmr
292 * - Handles processing on timer expiry at scheduler.
295 * @param[in] S16 tmrEvnt
298 Void rgSCHTmrProcTmr(Ptr cb,S16 tmrEvnt)
300 RgSchUeCb *ue = NULLP;
302 RgSchUeCellInfo *sCellCb = NULLP;
308 if(tmrEvnt == RG_SCH_TMR_SCELL_DEACT)
310 sCellCb = (RgSchUeCellInfo *)cb;
321 case RG_SCH_TMR_ACKNACK_REP:
322 rgSCHAckNakRepTmrExpry (ue);
324 case RG_SCH_TMR_MEASGAP:
325 rgSCHMeasGapANRepTmrExpry (ue);
327 case RG_SCH_TMR_UL_MEASGAP:
328 case RG_SCH_TMR_UL_ACKNACK:
329 rgSCHMeasGapANRepUlInactvTmrExpry (ue, (uint8_t)tmrEvnt);
331 case RG_SCH_TMR_DL_ACKNACK:
332 case RG_SCH_TMR_DL_MEASGAP:
333 rgSCHMeasGapANRepDlInactvTmrExpry (ue, (uint8_t)tmrEvnt);
337 /*TODO Needto handle TA Timer expiry for EMTC UE*/
338 if(TRUE == ue->isEmtcUe)
340 DU_LOG("\nINFO --> SCH : TA Timer Expiry is not handled for EMTC UE\n");
344 rgSCHDhmProcTAExp (ue);
346 /*MS_WORKAROUND for CR FIXME */
350 rgSCHCmnBsrTmrExpry(ue);
356 rgSCHCmnBsrTmrExpry(ue);
361 case RG_SCH_TMR_TXMODE_TRNSTN:
363 ue->txModeTransCmplt = TRUE;
367 case RG_SCH_TMR_SCELL_DEACT:
369 rgSCHSCellDeactTmrExpry(sCellCb);
372 case RG_SCH_TMR_SCELL_ACT_DELAY:
374 sCellCb = (RgSchUeCellInfo *)cb;
375 rgSCHSCellActivation(sCellCb);
382 DU_LOG("\nERROR --> SCH : rgSCHTmrProcTmr() Incorrect Timer event");
390 /**********************************************************************
393 **********************************************************************/