[Epic-ID: ODUHIGH-462][Task-ID: ODUHIGH-472] Implementation of drx timer
[o-du/l2.git] / src / 5gnrsch / sch_drx.h
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
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                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
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 *******************************************************************************/
18
19 #define SCH_DRX_INVALID_DISTANCE -1
20 #define SCH_DRX_INVALID_INDEX 0xFFFFFF 
21 #define SCH_DRX_MAX_DELTA 1
22 #define SCH_DRX_TMRS_EXP_DELTA 1
23
24 /** @brief Macro to convert milli second to slots */
25 #define SCH_CNVRT_MS_TO_SLOT(_numSlot, _numMs, _mu)\
26 {\
27    _numSlot = _numMs * (1 << _mu);\
28 }
29
30 /** @brief Macro to convert number symbols to slots */
31 #define SCH_CNVRT_SYMBL_TO_SLOT(_numSlot, _numSymbl)\
32 {\
33    _numSlot = _numSymbl/14; \
34 }
35
36 /**  @brief Macro to find the slot difference */
37 #define SCH_CALC_SLOT_DIFF(_newTime, _oldTime, _numOfSlotsPerRadioFrame)\
38 ((_newTime.sfn*_numOfSlotsPerRadioFrame+_newTime.slot) >= (_oldTime.sfn*_numOfSlotsPerRadioFrame+_oldTime.slot)?\
39 (_newTime.sfn*_numOfSlotsPerRadioFrame+_newTime.slot) - (_oldTime.sfn*_numOfSlotsPerRadioFrame+_oldTime.slot) : \
40 (_newTime.sfn*_numOfSlotsPerRadioFrame+_newTime.slot) + (1024*_numOfSlotsPerRadioFrame - (_oldTime.sfn*_numOfSlotsPerRadioFrame+_oldTime.slot)))
41
42 void schInitDrxUeCb(SchUeCb *ueCb);
43 void schFillDrxUeCb(uint8_t numerology, SchDrxCfg drxCfg, SchDrxUeCb *drxUeCb);
44 void schDeleteUeDrxInfo(SchCellCb  *cell, SchUeCb *ueCb);
45 void schHandleStartDrxTimer(SchCellCb  *cell);
46 void schHdlDrxInActvStrtTmr(SchCellCb  *cell,  SchUeCb *ueCb, uint8_t delta);
47 void schInitDrxHarqCb(SchDrxHarqCb *hqCb);
48 void schAddUeInOndurationAndShortCycleList(SchCellCb *cell, SchUeCb *ueCb, uint8_t delta);
49 void schDrxUeReCfgTimer(SchCellCb *cell, SchUeCb *ueCb);
50 void schHdlDrxShortCycleExpiryTimer(SchCellCb  *cell);
51 void schHdlDrxOnDurExpiryTimer(SchCellCb  *cell);
52 void schHandleExpiryDrxTimer(SchCellCb  *cell);
53 /**********************************************************************
54   End of file
55  **********************************************************************/