5dc5d18fa4e737804a9c63bf6ed2f5b41bd4dcb6
[o-du/phy.git] / fhi_lib / test / common / common_typedef_xran.h
1 /******************************************************************************
2 *
3 *   Copyright (c) 2019 Intel.
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 /*! \file common_typedef_xran.h
20     \brief  This header file defines those data type both used by eNB and UE.
21 */
22
23 #ifndef _COMMON_TYPEDEF_XRAN_H_
24 #define _COMMON_TYPEDEF_XRAN_H_
25
26 #include <stdint.h>
27
28 #include <stdio.h>
29 #include <stdbool.h>
30
31 /*!
32     \struct COMPLEX32
33     \brief Defines 64-bit complex structure; both real part and image part have 32 bit width.
34 */
35 typedef struct {
36     float re; /*!< 32-bit real part */
37     float im; /*!< 32-bit image part */
38 } COMPLEX32;
39
40 //! @{
41 /*!
42     \struct complex_int16_t
43     \brief Defines 32-bit complex structure; both real part and image part have 16 bit width.
44     \brief Same defines as COMPLEX16
45 */
46 typedef struct {
47     int16_t re; /*!< 16-bit real part */
48     int16_t im; /*!< 16-bit image part */
49 }complex_int16_t,COMPLEX16;
50 //! @}
51
52 /*!
53     \struct complex_int32_t
54     \brief Defines 64-bit complex structure; both real part and image part have 32 bit width.
55 */
56 typedef struct {
57     int32_t re; /*!< 32-bit real part */
58     int32_t im; /*!< 32-bit image part */
59 }complex_int32_t;
60
61 /*!
62     \struct complex_float
63     \brief Defines 64-bit complex structure; both real part and image part have 32 bit width.
64 */
65 typedef struct {
66     float re; /*!< 32-bit real part */
67     float im; /*!< 32-bit image part */
68 }complex_float;
69
70 /*!
71     \struct complex_double
72     \brief Defines 128-bit complex structure; both real part and image part have 64 bit width.
73 */
74 typedef struct {
75     double re; /*!< 64-bit real part */
76     double im; /*!< 64-bit image part */
77 }complex_double;
78
79 /*!
80     \typedef half
81     \brief half is a 16-bit IEEE floating-point standard number format.
82     \note In future this will be known as `short float' or `__fp16'.
83     \note Older compilers must provide proxy support for it as a plain 16-bit integer
84 */
85 typedef int16_t half;
86
87 /*!
88     \struct complex_half
89     \brief Defines 32-bit complex structure; both real part and image part have 16 bit width.
90 */
91 typedef struct {
92     half re; /*!< 16-bit real part */
93     half im; /*!< 16-bit image part */
94 }complex_half;
95
96 /*!
97     \enum instruction_cpu_support
98     \brief Define instruction the CPU can support.
99 */
100 typedef enum{
101     CPU_GENERIC, /*!< C */
102     SSE4_2,      /*!< SSE4_2 */
103     AVX,         /*!< AVX */
104     AVX2,        /*!< AVX2 */
105     AVX_512,     /*!< AVX512 */
106 }instruction_cpu_support;
107
108 /*!
109     \enum bblib_modulation_order
110     \brief Common enums for modulation order.
111 */
112 enum bblib_modulation_order {
113     BBLIB_BPSK   = 1, /*!< BPSK */
114     BBLIB_QPSK   = 2, /*!< QPSK */
115     BBLIB_PAM4   = 3, /*!< PAM4 */
116     BBLIB_QAM16  = 4, /*!< QAM16 */
117     BBLIB_PAM8   = 5, /*!< PAM8 */
118     BBLIB_QAM64  = 6, /*!< QAM64 */
119     BBLIB_PAM16  = 7, /*!< PAM16 */
120     BBLIB_QAM256 = 8  /*!< QAM256 */
121 };
122
123
124 #ifdef _WIN64
125 #define __align(x) __declspec(align(x))
126 #else
127 #define __align(x) __attribute__((aligned(x)))
128 #define _aligned_malloc(x,y) memalign(y,x)
129 #endif
130
131 /* Test time and loops for unit test */
132 #define TIME 40
133 #define LOOP 30
134
135 #endif /* #ifndef _COMMON_TYPEDEF_H_ */
136