[ Jira id - ODUHIGH-593 ] Pack and unpack function nomenclature correction
[o-du/l2.git] / src / cm / cm_lte.x
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 /********************************************************************20**
20   
21         Name:    Common LTE
22     
23         Type:    C include file
24   
25         Desc:    This file Contains the Data structures for Common LTE
26  
27         File:    cm_lte.x
28
29         Sid:      cm_lte.x@@/main/2 - Fri Nov 13 14:09:17 2009
30   
31         Prg:     chakrapani
32   
33 *********************************************************************21*/
34
35 #ifndef __CM_LTE_X__
36 #define __CM_LTE_X__
37
38 #include <cm_lte.h>
39 /* Packing Defines */
40 #define cmPkLteRbId              oduPackUInt8
41 #define cmPkLteRnti              oduPackUInt16
42 #define cmPkLteCellId            oduPackUInt16
43 #define cmPkLteRlcMode           oduPackUInt8
44 #define cmPkLteLcId              oduPackUInt8
45 #define cmPkLteLcType            oduPackUInt8
46 #define cmPkLteAggrLvl           oduPackUInt32
47
48 /* Unpacking Defines */
49 #define cmUnpkLteRbId            oduUnpackUInt8
50 #define cmUnpkLteRnti            oduUnpackUInt16
51 #define cmUnpkLteCellId          oduUnpackUInt16
52 #define cmUnpkLteRlcMode         oduUnpackUInt8
53 #define cmUnpkLteLcId            oduUnpackUInt8
54 #define cmUnpkLteLcType          oduUnpackUInt8
55 #define cmUnpkLteAggrLvl         oduUnpackUInt32
56
57 #define MAX_POOL_SIZE        6      /*!< Maximum pool size */
58 #define MAX_REGION_SIZE      5      /*!< Maximum Region size */
59 #ifdef PACK_STRUCT
60 #define CM_PACK_STRUCT __attribute__((packed))
61 #else
62 #define CM_PACK_STRUCT
63 #endif
64
65
66
67
68 #ifdef __cplusplus
69 extern "C" {
70 #endif  /*__cplusplus*/
71
72 /** @file cm_lte.x
73     @brief CM_LTE Interface File (cm_lte.x)
74 */
75  
76 /* definitions for Common LTE */
77
78 /** @brief Radio Bearer ID */
79 typedef uint8_t    CmLteRbId;
80
81 /** @brief Cell ID */
82 typedef uint16_t   CmLteCellId;
83
84 /** @brief RNTI */
85 typedef uint16_t   CmLteRnti;
86
87 /** @brief Mode Type TM/UM/AM */
88 typedef uint8_t    CmLteRlcMode;
89
90 /** @brief Logical Channel ID */
91 typedef uint8_t    CmLteLcId;         
92
93 /** @brief Logical Channel Type */
94 typedef uint8_t    CmLteLcType;         
95
96 /** @brief Transport Channel Type */
97 typedef uint8_t    CmLteTrchType;         
98
99 /** @brief Contention Resolution ID */
100 typedef uint8_t CmLteContResId[6];
101
102 /** @brief RLC ID */
103 typedef struct cmLteRlcId
104 {
105   CmLteRbId     rbId;   /*!< Radio Bearer ID */
106   uint8_t            rbType; /*!< RB Type */
107   CmLteRnti     ueId;   /*!< UE ID */
108   CmLteCellId   cellId; /*!< Cell ID */
109 }CmLteRlcId;
110
111 /** @brief LTE Timing Info */
112 typedef struct cmLteTimingInfo
113 {
114 #if 0
115    uint16_t hSfn;                 /*!< Hyper System Frame Number */
116 #endif
117    uint16_t sfn;                  /*!< System Frame Number */
118    uint16_t slot;             /*!< Subframe number */
119 } CmLteTimingInfo;
120
121 /** @brief PDCP ID */
122 typedef struct cmLtePdcpId
123 {
124    CmLteCellId   cellId;      /*!< Cell ID */
125    CmLteRnti     ueId;        /*!< UE ID */
126    CmLteRbId     rbId;        /*!< PDCP Instance ID */
127    uint8_t            rbType;      /*!< RB type */
128 } CmLtePdcpId;
129
130 /* Defining structures for Memory Information for L2-MEAS */
131 typedef struct cmLtePoolInfo
132 {
133    uint32_t   poolSize;
134    uint32_t   totAvailable;
135    uint32_t   crntUsed;
136    uint32_t   maxUsed;
137 } CmLtePoolInfo;
138
139 typedef struct cmLteRegionInfo
140 {
141    uint8_t   regionType; /* 0-SSI 1-Shared */
142    uint8_t   regionId;
143    uint8_t   numPools;
144    uint8_t   isGenMemInfoUpdated;
145    CmLtePoolInfo poolInfo[MAX_POOL_SIZE];
146 }CmLteRegionInfo;
147
148 typedef struct cmLteMemInfo
149 {
150    uint8_t           numRegions;
151    uint8_t           idx;
152    CmLteRegionInfo   regInfo[MAX_REGION_SIZE];
153 }CmLteMemInfo;
154
155 /** @brief CPU Utilization INFO */
156 typedef struct cmLteCpuUtilInfo
157 {
158    uint32_t      avgCpuUtil; /*!< average cpu utilization */
159    uint32_t      maxCpuUtil; /*!< Max cpu utilization */
160 }CmLteCpuUtilInfo;
161
162 /** @brief CPU INFO */
163 typedef struct cmLteCpuInfo
164 {
165    uint8_t       numCores;        /*!< number of cores*/
166    CmLteCpuUtilInfo cpuUtil[CM_MAX_CPU_CORES]; /*!< cpu measurement info*/
167 }CmLteCpuInfo;
168 /** @brief CPU Utilization INFO */
169 typedef struct cmCpuUtilStatsInfo
170 {
171    uint32_t      numSamples;
172    uint32_t      maxCpuUtil; /*!< Max cpu utilization */
173    uint32_t      totCpuUtil; /*!< Total cpu utilization */
174 }CmCpuUtilStatsInfo;
175
176 /** @brief CPU INFO */
177 typedef struct cmCpuStatsInfo
178 {
179    uint8_t       numCores;        /*!< number of cores*/
180    CmCpuUtilStatsInfo cpuUtil[CM_MAX_CPU_CORES]; /*!< cpu measurement info*/
181 }CmCpuStatsInfo;
182
183
184
185
186 /** @brief Counter Statistics */
187 typedef uint32_t  CntrSts;
188
189 /** @brief Aggregation Level */
190 typedef enum cmLteAggrLvl
191 {
192    CM_LTE_AGGR_LVL2 = 2,  /*!< Aggregation level 2 */
193    CM_LTE_AGGR_LVL4 = 4,  /*!< Aggregation level 4 */
194    CM_LTE_AGGR_LVL8 = 8,  /*!< Aggregation level 8 */
195    CM_LTE_AGGR_LVL16= 16   /*!< Aggregation level 16 */
196 } CmLteAggrLvl;
197
198 /** @brief UE Category */
199 typedef enum cmLteUeCategory
200 {
201    CM_LTE_UE_CAT_1 = 1,
202    CM_LTE_UE_CAT_2,
203    CM_LTE_UE_CAT_3,
204    CM_LTE_UE_CAT_4,
205    CM_LTE_UE_CAT_5,
206    CM_LTE_UE_CAT_6,
207    CM_LTE_UE_CAT_7, /* RRC-REL10-Upgrade */
208    CM_LTE_UE_CAT_8
209 } CmLteUeCategory;
210
211 /****************************************************************************
212  *                         PACK/UNPACK Functions
213  ***************************************************************************/
214
215 S16 cmUpdateSsiMemInfo(CmLteMemInfo *mInfo);
216
217 S16 cmFillMemUtilizationMeas(CmLteMemInfo *memoryInfo,CmLteMemInfo *memInfo);
218
219 S16 cmClearMemUtilizationCounter(CmLteMemInfo *memInfo);
220 S16 UpdateSocMemInfo(uint8_t area , CmLteMemInfo *mInfo);
221
222 S16 cmFillCpuUtilizationMeas(CmLteCpuInfo *cpuMeasInfo,CmCpuStatsInfo *cpuInfo);
223
224 S16 cmClearCpuUtilizationCounter(CmCpuStatsInfo *cpuInfo);
225 Void UpdateSocCpuInfo(CmCpuStatsInfo *cpuInfo,uint8_t Idx);
226
227 S16 SGetRegPoolInfo(uint8_t* numRegion, uint8_t* numPool);
228
229 /* Packing Functions */
230 S16 cmPkLteRlcId ARGS ((
231 CmLteRlcId *param,
232 Buffer *mBuf
233 ));
234
235 S16 cmPkLteTimingInfo ARGS ((
236 CmLteTimingInfo *param,
237 Buffer *mBuf
238 ));
239
240 S16 cmPkLtePdcpId ARGS ((
241 CmLtePdcpId *param,
242 Buffer *mBuf
243 ));
244
245 /* Unpack Function */
246 S16 cmUnpkLteRlcId ARGS ((
247 CmLteRlcId *param,
248 Buffer *mBuf
249 ));
250
251 S16 cmUnpkLteTimingInfo ARGS ((
252 CmLteTimingInfo *param,
253 Buffer *mBuf
254 ));
255
256 S16 cmUnpkLtePdcpId ARGS ((
257 CmLtePdcpId *param,
258 Buffer *mBuf
259 ));
260
261 #ifdef TENB_TTI_PERF
262
263 typedef struct cmTtiProc 
264 {
265         uint32_t totTtiProcessingTime;
266         uint32_t numOfTti;
267         uint32_t maxTtiProcessingTime;
268         uint32_t ttiStretchCount;
269         uint32_t ttiThresholdExceedCount;
270         /* this count is added to compare phy reported tti stretch and calculated tti stretch */
271         uint32_t phyReptTtiStretchCount;
272 }CmTtiProc;
273
274 extern CmTtiProc ttiProc;
275
276 Void cmUpdateTtiCounters(uint32_t ttiProcessingTime);
277 Void cmResetTtiCounters(Void); 
278 #endif
279
280 #ifdef __cplusplus
281 }
282 #endif /* __cplusplus */
283 #endif /* __CM_LTE_X__ */
284
285 /********************************************************************30**
286   
287          End of file
288 **********************************************************************/