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 *******************************************************************************/
18 #ifndef __COMMON_DEF_H__
19 #define __COMMON_DEF_H__
44 #include "gen.x" /* general */
45 #include "ssi.x" /* system services */
56 #define RADIO_FRAME_DURATION 10 /* Time duration of a radio frame in ms */
58 #define MAX_NUM_CELL 1
61 #define MAX_NUM_SRB 3 /* Max. no of Srbs */
62 #define MAX_NUM_DRB 29 /* spec 38.331, maxDRB */
64 /* 5G ORAN phy delay */
65 #define PHY_DELTA_DL 1
66 #define PHY_DELTA_UL 0
69 #define ODU_SELECTOR_LC 0
70 #define ODU_SELECTOR_TC 1
71 #define ODU_SELECTOR_LWLC 2
73 #define ODU_START_CRNTI 100
74 #define ODU_END_CRNTI 500
81 #define MIN_DRB_LCID 4
82 #define MAX_DRB_LCID 32
84 #define FREQ_DOM_RSRC_SIZE 6 /* i.e. 6 bytes because Size of frequency domain resource is 45 bits */
85 #define PUCCH_FORMAT_0 0
86 #define PUCCH_FORMAT_1 1
87 #define PUCCH_FORMAT_2 2
88 #define PUCCH_FORMAT_3 3
89 #define PUCCH_FORMAT_4 4
91 #define BANDWIDTH_20MHZ 20
92 #define BANDWIDTH_100MHZ 100
94 /* PRB allocation as per 38.101, Section 5.3.2 */
95 #define TOTAL_PRB_20MHZ_MU0 106
96 #define TOTAL_PRB_100MHZ_MU1 273
98 #define ODU_THROUGHPUT_PRINT_TIME_INTERVAL 5 /* in milliseconds */
100 /* Defining macros for common utility functions */
101 #define ODU_GET_MSG_BUF SGetMsg
102 #define ODU_PUT_MSG_BUF SPutMsg
103 #define ODU_ADD_PRE_MSG_MULT SAddPreMsgMult
104 #define ODU_ADD_PRE_MSG_MULT_IN_ORDER SAddPreMsgMultInOrder
105 #define ODU_ADD_POST_MSG_MULT SAddPstMsgMult
106 #define ODU_START_TASK SStartTask
107 #define ODU_STOP_TASK SStopTask
108 #define ODU_ATTACH_TTSK SAttachTTsk
109 #define ODU_POST_TASK SPstTsk
110 #define ODU_COPY_MSG_TO_FIX_BUF SCpyMsgFix
111 #define ODU_COPY_FIX_BUF_TO_MSG SCpyFixMsg
112 #define ODU_REG_TTSK SRegTTsk
113 #define ODU_SET_PROC_ID SSetProcId
114 #define ODU_GET_MSG_LEN SFndLenMsg
115 #define ODU_EXIT_TASK SExitTsk
116 #define ODU_PRINT_MSG SPrntMsg
117 #define ODU_REM_PRE_MSG SRemPreMsg
118 #define ODU_REM_PRE_MSG_MULT SRemPreMsgMult
119 #define ODU_REG_TMR_MT SRegTmrMt
120 #define ODU_SEGMENT_MSG SSegMsg
121 #define ODU_CAT_MSG SCatMsg
122 #define ODU_GET_PROCID SFndProcId
123 #define ODU_SET_THREAD_AFFINITY SSetAffinity
124 #define ODU_CREATE_TASK SCreateSTsk
127 /* Maximum slots for max periodicity and highest numerology is 320.
128 * However, aligning to fapi_interface.h, setting this macro to 160 */
129 #define MAX_TDD_PERIODICITY_SLOTS 160
130 #define MAX_SYMB_PER_SLOT 14
133 #define GET_UE_IDX( _crnti,_ueIdx) \
135 _ueIdx = _crnti - ODU_START_CRNTI + 1; \
138 #define GET_CRNTI( _crnti,_ueIdx) \
140 _crnti = _ueIdx + ODU_START_CRNTI - 1; \
143 /* Calculates cellIdx from cellId */
144 #define GET_CELL_IDX(_cellId, _cellIdx) \
146 _cellIdx = _cellId - 1; \
149 #define SET_BITS_MSB(_startBit, _numBits, _byte) \
151 _byte = (~((0xFF) >> _numBits)); \
152 _byte >>= _startBit; \
155 #define SET_BITS_LSB(_startBit, _numBits, _byte) \
157 _byte = (~((0xFF) << _numBits)); \
158 _byte <<= _startBit; \
161 /* this MACRO set 1 bit at the bit position */
162 #define SET_ONE_BIT(_bitPos, _out) \
164 _out = ((1<<_bitPos) | _out); \
167 /* this MACRO un-set 1 bit at the bit position */
168 #define UNSET_ONE_BIT(_bitPos, _out) \
170 _out = (~(1<<_bitPos) & _out); \
173 /* this MACRO finds the index of the rightmost set bit */
174 #define GET_RIGHT_MOST_SET_BIT( _in,_bitPos) \
176 _bitPos = __builtin_ctz(_in); \
232 typedef struct slotIndInfo
239 typedef struct PlmnIdentity
245 typedef struct oduCellId
251 typedef struct tddCfg
254 DlUlTxPeriodicity tddPeriod; /* DL UL Transmission periodicity */
255 SlotConfig slotCfg[MAX_TDD_PERIODICITY_SLOTS][MAX_SYMB_PER_SLOT];
259 OduCellStatus gCellStatus;
261 uint64_t gDlDataRcvdCnt; /* Number of DL data received at EGTP */
263 void freqDomRscAllocType0(uint16_t startPrb, uint16_t prbSize, uint8_t *freqDomain);
264 void oduCpyFixBufToMsg(uint8_t *fixBuf, Buffer *mBuf, uint16_t len);
265 uint8_t buildPlmnId(Plmn plmn, uint8_t *buf);
269 /**********************************************************************
271 ***********************************************************************/