Replaced old SSI function with new macros jira id - ODUHIGH-212
[o-du/l2.git] / src / cm / common_def.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 #ifndef __COMMON_DEF_H__
19 #define __COMMON_DEF_H__
20
21 #include <stdio.h>
22 #include <ctype.h>
23 #include <stdlib.h>
24 #include <string.h>
25 #include <stdbool.h>
26 #include <stdint.h>
27
28 #include "cm_mem.h"
29 #include "cm_math.h"
30 #include "envopt.h"
31 #include "envdep.h"
32 #include "envind.h"
33 #include "gen.h" 
34 #include "ssi.h" 
35 #include "cm5.h"
36 #include "cm_tkns.h"
37 #include "cm_mblk.h"
38 #include "cm_llist.h"
39 #include "cm_hash.h"
40 #include "cm_lte.h"
41 #include "cm_err.h"
42 #include "cm_tpt.h"
43 #include "cm.h"
44 #include "gen.x"           /* general */
45 #include "ssi.x"           /* system services */
46 #include "cm_math.x"
47 #include "cm_tpt.x"
48 #include "cm_tkns.x" 
49 #include "cm_mblk.x"
50 #include "cm_llist.x"
51 #include "cm5.x" 
52 #include "cm_hash.x"
53 #include "cm_lte.x"
54 #include "cm_lib.x"
55 #include "du_log.h"
56
57 /* MAX values */
58 #define MAX_NUM_CELL 1
59 #define MAX_NUM_UE   1
60
61 /* 5G ORAN phy delay */
62 #define PHY_DELTA 2
63
64  /* SELECTORS */ 
65 #define ODU_SELECTOR_LC 0
66 #define ODU_SELECTOR_TC 1
67 #define ODU_SELECTOR_LWLC 2
68
69 #define ODU_START_CRNTI   100
70 #define ODU_END_CRNTI     500
71
72 /* Defining macros for common utility functions */
73 #define ODU_GET_MSG SGetMsg
74 #define ODU_PUT_MSG SPutMsg
75 #define ODU_ADD_PRE_MSG_MULT SAddPreMsgMult
76 #define ODU_ADD_POST_MSG_MULT SAddPstMsgMult
77 #define ODU_START_TASK SStartTask
78 #define ODU_STOP_TASK SStopTask
79 #define ODU_ATTACH_TTSK SAttachTTsk
80 #define ODU_POST_TASK SPstTsk
81 #define ODU_COPY_MSG_TO_FIX_BUF SCpyMsgFix
82 #define ODU_REG_TTSK SRegTTsk
83 #define ODU_SET_PROC_ID SSetProcId
84 #define ODU_FIND_MSG_LEN SFndLenMsg
85 #define ODU_EXIT_TASK SExitTsk
86 #define ODU_PRINT_MSG SPrntMsg
87 #define ODU_REM_PRE_MSG SRemPreMsg
88 #define ODU_REG_TMR_MT SRegTmrMt
89
90 #define GET_UE_IDX( _crnti,_ueIdx)         \
91 {                                          \
92    _ueIdx = _crnti - ODU_START_CRNTI + 1;  \
93 }
94
95 #define GET_CRNTI( _crnti,_ueIdx)          \
96 {                                          \
97    _crnti = _ueIdx + ODU_START_CRTNI - 1;  \
98 }
99
100 /* Calculates cellIdx from cellId */
101 #define GET_CELL_IDX(_cellId, _cellIdx)   \
102 {                                         \
103    _cellIdx = _cellId - 1;                \
104 }
105
106 #define SET_BITS_MSB(_startBit, _numBits, _byte) \
107 {                                                \
108    _byte = (~((0xFF) >> _numBits));              \
109        _byte >>= _startBit;                          \
110 }
111
112 #define SET_BITS_LSB(_startBit, _numBits, _byte) \
113 {                                                \
114    _byte = (~((0xFF) << _numBits));              \
115        _byte <<= _startBit;                          \
116 }
117
118
119 typedef struct slotIndInfo
120 {
121    uint16_t cellId;
122    uint16_t sfn;
123    uint16_t slot;
124 }SlotIndInfo;
125
126 typedef struct PlmnIdentity
127 {
128    uint8_t mcc[3];
129    uint8_t mnc[3];
130 }Plmn;
131
132 void schAllocFreqDomRscType0(uint16_t startPrb, uint16_t prbSize, uint8_t *freqDomain);
133
134 #endif
135
136 /**********************************************************************
137   End of file
138 ***********************************************************************/