27202d32a44c6abbb4393f0fa618f731e14cc848
[o-du/phy.git] / fhi_lib / test / common / common_typedef_xran.h
1 /******************************************************************************\r
2 *\r
3 *   Copyright (c) 2019 Intel.\r
4 *\r
5 *   Licensed under the Apache License, Version 2.0 (the "License");\r
6 *   you may not use this file except in compliance with the License.\r
7 *   You may obtain a copy of the License at\r
8 *\r
9 *       http://www.apache.org/licenses/LICENSE-2.0\r
10 *\r
11 *   Unless required by applicable law or agreed to in writing, software\r
12 *   distributed under the License is distributed on an "AS IS" BASIS,\r
13 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
14 *   See the License for the specific language governing permissions and\r
15 *   limitations under the License.\r
16 *\r
17 *******************************************************************************/\r
18 \r
19 /*! \file common_typedef_xran.h\r
20     \brief  This header file defines those data type both used by eNB and UE.\r
21 */\r
22 \r
23 #ifndef _COMMON_TYPEDEF_XRAN_H_\r
24 #define _COMMON_TYPEDEF_XRAN_H_\r
25 \r
26 #include <stdint.h>\r
27 \r
28 #include <stdio.h>\r
29 #include <stdbool.h>\r
30 \r
31 /*!\r
32     \struct COMPLEX32\r
33     \brief Defines 64-bit complex structure; both real part and image part have 32 bit width.\r
34 */\r
35 typedef struct {\r
36     float re; /*!< 32-bit real part */\r
37     float im; /*!< 32-bit image part */\r
38 } COMPLEX32;\r
39 \r
40 //! @{\r
41 /*!\r
42     \struct complex_int16_t\r
43     \brief Defines 32-bit complex structure; both real part and image part have 16 bit width.\r
44     \brief Same defines as COMPLEX16\r
45 */\r
46 typedef struct {\r
47     int16_t re; /*!< 16-bit real part */\r
48     int16_t im; /*!< 16-bit image part */\r
49 }complex_int16_t,COMPLEX16;\r
50 //! @}\r
51 \r
52 /*!\r
53     \struct complex_int32_t\r
54     \brief Defines 64-bit complex structure; both real part and image part have 32 bit width.\r
55 */\r
56 typedef struct {\r
57     int32_t re; /*!< 32-bit real part */\r
58     int32_t im; /*!< 32-bit image part */\r
59 }complex_int32_t;\r
60 \r
61 /*!\r
62     \struct complex_float\r
63     \brief Defines 64-bit complex structure; both real part and image part have 32 bit width.\r
64 */\r
65 typedef struct {\r
66     float re; /*!< 32-bit real part */\r
67     float im; /*!< 32-bit image part */\r
68 }complex_float;\r
69 \r
70 /*!\r
71     \struct complex_double\r
72     \brief Defines 128-bit complex structure; both real part and image part have 64 bit width.\r
73 */\r
74 typedef struct {\r
75     double re; /*!< 64-bit real part */\r
76     double im; /*!< 64-bit image part */\r
77 }complex_double;\r
78 \r
79 /*!\r
80     \typedef half\r
81     \brief half is a 16-bit IEEE floating-point standard number format.\r
82     \note In future this will be known as `short float' or `__fp16'.\r
83     \note Older compilers must provide proxy support for it as a plain 16-bit integer\r
84 */\r
85 typedef int16_t half;\r
86 \r
87 /*!\r
88     \struct complex_half\r
89     \brief Defines 32-bit complex structure; both real part and image part have 16 bit width.\r
90 */\r
91 typedef struct {\r
92     half re; /*!< 16-bit real part */\r
93     half im; /*!< 16-bit image part */\r
94 }complex_half;\r
95 \r
96 /*!\r
97     \enum instruction_cpu_support\r
98     \brief Define instruction the CPU can support.\r
99 */\r
100 typedef enum{\r
101     CPU_GENERIC, /*!< C */\r
102     SSE4_2,      /*!< SSE4_2 */\r
103     AVX,         /*!< AVX */\r
104     AVX2,        /*!< AVX2 */\r
105     AVX_512,     /*!< AVX512 */\r
106 }instruction_cpu_support;\r
107 \r
108 /*!\r
109     \enum bblib_modulation_order\r
110     \brief Common enums for modulation order.\r
111 */\r
112 enum bblib_modulation_order {\r
113     BBLIB_BPSK   = 1, /*!< BPSK */\r
114     BBLIB_QPSK   = 2, /*!< QPSK */\r
115     BBLIB_PAM4   = 3, /*!< PAM4 */\r
116     BBLIB_QAM16  = 4, /*!< QAM16 */\r
117     BBLIB_PAM8   = 5, /*!< PAM8 */\r
118     BBLIB_QAM64  = 6, /*!< QAM64 */\r
119     BBLIB_PAM16  = 7, /*!< PAM16 */\r
120     BBLIB_QAM256 = 8  /*!< QAM256 */\r
121 };\r
122 \r
123 \r
124 #ifdef _WIN64\r
125 #define __align(x) __declspec(align(x))\r
126 #else\r
127 #define __align(x) __attribute__((aligned(x)))\r
128 #define _aligned_malloc(x,y) memalign(y,x)\r
129 #endif\r
130 \r
131 /* Test time and loops for unit test */\r
132 #define TIME 40\r
133 #define LOOP 30\r
134 \r
135 #endif /* #ifndef _COMMON_TYPEDEF_H_ */\r
136 \r