a90e54e70e9b5bbe3fbdb80859a4afc1c59b67e4
[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 3
22 #define SCH_DRX_TMRS_EXP_DELTA 1
23 #define UE_ACTIVE_FOR_ONDURATION 1
24 #define UE_ACTIVE_FOR_INACTIVE_TIMER 2
25 #define UE_ACTIVE_FOR_SR 4
26
27 /** @brief Macro to convert milli second to slots */
28 #define SCH_CNVRT_MS_TO_SLOT(_numSlot, _timeInMs, _mu)\
29 {\
30    _numSlot = _timeInMs * (1 << _mu);\
31 }
32
33 /** @brief Macro to convert number symbols to slots */
34 #define SCH_CNVRT_SYMBL_TO_SLOT(_numSlot, _numSymbl)\
35 {\
36    _numSlot = _numSymbl/MAX_SYMB_PER_SLOT; \
37 }
38
39 /**  @brief Macro to find the slot difference */
40 #define SCH_CALC_SLOT_DIFF(_newTime, _oldTime, _numOfSlotsPerRadioFrame)\
41 ((_newTime.sfn*_numOfSlotsPerRadioFrame+_newTime.slot) >= (_oldTime.sfn*_numOfSlotsPerRadioFrame+_oldTime.slot)?\
42 (_newTime.sfn*_numOfSlotsPerRadioFrame+_newTime.slot) - (_oldTime.sfn*_numOfSlotsPerRadioFrame+_oldTime.slot) : \
43 (_newTime.sfn*_numOfSlotsPerRadioFrame+_newTime.slot) + (1024*_numOfSlotsPerRadioFrame - (_oldTime.sfn*_numOfSlotsPerRadioFrame+_oldTime.slot)))
44
45 /** @brief Macro to used calculate timer index */
46 #define SCH_CALCULATE_TIMER_INDEX(_numSlots, _timerIndx)\
47 {\
48    _timerIndx = _numSlots % MAX_DRX_SIZE; \
49 }
50
51 void schInitDrxUeCb(SchUeCb *ueCb);
52 void schFillDrxUeCb(uint8_t numerology, SchDrxCfg drxCfg, SchDrxUeCb *drxUeCb);
53 void schDeleteUeDrxInfo(SchCellCb  *cell, SchUeCb *ueCb);
54 void schHandleStartDrxTimer(SchCellCb  *cell);
55 void schHdlDrxInActvStrtTmr(SchCellCb  *cell,  SchUeCb *ueCb, uint8_t delta);
56 void schInitDrxHarqCb(SchDrxHarqCb *hqCb);
57 void schAddUeInOndurationList(SchCellCb *cell, SchUeCb *ueCb, uint8_t delta);
58 void schDrxUeReCfgTimer(SchCellCb *cell, SchUeCb *ueCb);
59 void schHdlDrxShortCycleExpiryTimer(SchCellCb  *cell);
60 void schHdlDrxOnDurExpiryTimer(SchCellCb  *cell);
61 void schHandleExpiryDrxTimer(SchCellCb  *cell);
62 /**********************************************************************
63   End of file
64  **********************************************************************/