Infineon MOTIX™ MCU TLE988x/9x Device Family SDK
types.h
Go to the documentation of this file.
1 /*
2  ***********************************************************************************************************************
3  *
4  * Copyright (c) Infineon Technologies AG
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the
8  * following conditions are met:
9  *
10  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following
11  * disclaimer.
12  *
13  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
14  * following disclaimer in the documentation and/or other materials provided with the distribution.
15  *
16  * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote
17  * products derived from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
25  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  **********************************************************************************************************************/
38 /*******************************************************************************
39 ** Author(s) Identity **
40 ********************************************************************************
41 ** Initials Name **
42 ** ---------------------------------------------------------------------------**
43 ** SS Steffen Storandt **
44 ** DM Daniel Mysliwitz **
45 ** JO Julia Ott **
46 ** BG Blandine Guillot **
47 ** PS Patrik Schwarz **
48 *******************************************************************************/
49 
50 /*******************************************************************************
51 ** Revision Control History **
52 ********************************************************************************
53 ** V0.1.0: 2012-11-12, SS: Initial version **
54 ** V0.2.0: 2012-12-13, SS: Formal changes **
55 ** V0.2.1: 2017-11-13, DM: Register access macros added **
56 ** V0.2.2: 2018-02-14, DM: MISRA 2012 compliance, the following PC-Lint **
57 ** rules are globally deactivated: **
58 ** - Info 793: ANSI/ISO limit of 6 'significant **
59 ** characters in an external identifier **
60 ** - Info 835: A zero has been given as right **
61 ** argument to operator **
62 ** - Info 845: The left argument to operator '&' **
63 ** is certain to be 0 **
64 ** Field_Rd1() return typecase changed to (uint8) **
65 ** V0.2.3: 2019-03-11, JO: Changed 'typedef signed long long int64' to **
66 ** 'typedef signed long long sint64' **
67 ** V0.2.4: 2019-09-12, JO: For ARM GCC compatibility: **
68 ** - Added #include <stdint.h> **
69 ** - Use intx_t for defining sintx **
70 ** - Use uintx_t for defining uint **
71 ** V0.3.0: 2020-04-28, BG: Updated revision history format **
72 ** V0.3.1: 2020-08-11, JO: EP-449: Checked if __CC_ARM is defined before **
73 ** checking its value **
74 ** V0.3.2: 2020-10-12, BG: EP-515: Added a new error code when the watchdog **
75 ** is not triggered **
76 ** V0.3.3: 2020-10-21, BG: EP-539: Added return code when the modules are **
77 ** not enabled in CW **
78 ** V0.3.4: 2020-10-21, BG: EP-595: Added return code for Safe Shutdown **
79 ** V0.3.5: 2021-02-26, BG: EP-701: Added return codes when the SOW is not **
80 ** enabled **
81 ** V0.3.6: 2021-03-01, BG: EP-716: Added compatibility with IAR compiler **
82 ** V0.3.7: 2021-06-07, BG: EP-815: Added a return code when several errors **
83 ** occur in the BDRV init, so that the ORed error **
84 ** code is consistent in TLE_init() **
85 ** V0.3.8: 2021-08-04, JO: EP-897: Added else to define INLINE for other **
86 ** compilers as 'static inline' **
87 ** V0.3.9: 2021-11-12, JO: EP-937: Updated copyright and branding **
88 ** V0.4.0: 2022-06-23, JO: EP-1150: Removed ARMCC V6.18 warnings, **
89 ** changed from inline to __inline for C90 support **
90 ** V0.4.1: 2022-10-14, PS: EP-819: Replaced the INLINE define with the **
91 ** CMSIS related __STATIC_INLINE define **
92 ** V0.4.2: 2022-10-25, PS: EP-1333: Replaced boolean type with bool **
93 *******************************************************************************/
94 
95 #ifndef TYPES_H
96 #define TYPES_H
97 
98 #include <stdint.h>
99 #include "error_codes.h"
100 
101 /*******************************************************************************
102 ** Includes **
103 *******************************************************************************/
104 
105 /*******************************************************************************
106 ** Global Macro Definitions **
107 *******************************************************************************/
110 #define STD_REAL_FIX_POINT_16 (1)
111 #define STD_REAL_FIX_POINT_32 (2)
112 #define STD_REAL_FLOAT_32 (3)
113 
114 #ifndef STD_REAL_TYPE
115  #define STD_REAL_TYPE (STD_REAL_FIX_POINT_16)
116 #endif
117 
118 
121 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
122  #include <stdbool.h>
123 #else
124  #define bool unsigned int
125  #define true 1
126  #define false 0
127 #endif
128 
131 #ifndef NULL
132  #define NULL (0U)
133 #endif
134 
137 #define STD_REAL_SHIFT_Qn8_y (-8 - 1)
138 #define STD_REAL_SHIFT_Qn7_y (-7 - 1)
139 #define STD_REAL_SHIFT_Qn6_y (-6 - 1)
140 #define STD_REAL_SHIFT_Qn5_y (-5 - 1)
141 #define STD_REAL_SHIFT_Qn4_y (-4 - 1)
142 #define STD_REAL_SHIFT_Qn3_y (-3 - 1)
143 #define STD_REAL_SHIFT_Qn2_y (-2 - 1)
144 #define STD_REAL_SHIFT_Qn1_y (-1 - 1)
146 #define STD_REAL_SHIFT_Q0_y ( 0 - 1)
147 #define STD_REAL_SHIFT_Q1_y ( 1 - 1)
148 #define STD_REAL_SHIFT_Q2_y ( 2 - 1)
149 #define STD_REAL_SHIFT_Q3_y ( 3 - 1)
150 #define STD_REAL_SHIFT_Q4_y ( 4 - 1)
151 #define STD_REAL_SHIFT_Q5_y ( 5 - 1)
152 #define STD_REAL_SHIFT_Q6_y ( 6 - 1)
153 #define STD_REAL_SHIFT_Q7_y ( 7 - 1)
154 #define STD_REAL_SHIFT_Q8_y ( 8 - 1)
155 #define STD_REAL_SHIFT_Q9_y ( 9 - 1)
156 #define STD_REAL_SHIFT_Q10_y ( 10 - 1)
157 #define STD_REAL_SHIFT_Q11_y ( 11 - 1)
158 #define STD_REAL_SHIFT_Q12_y ( 12 - 1)
159 #define STD_REAL_SHIFT_Q13_y ( 13 - 1)
160 #define STD_REAL_SHIFT_Q14_y ( 14 - 1)
161 #define STD_REAL_SHIFT_Q15_y ( 15 - 1)
162 #define STD_REAL_SHIFT_Q16_y ( 16 - 1)
163 #define STD_REAL_SHIFT_Q32_y ( 32 - 1)
165 #define NULL_PTR ((void*)0)
166 
167 #define INLINE __STATIC_INLINE
168 
169 #define BIT0_POS (0u)
170 #define BIT1_POS (1u)
171 #define BIT2_POS (2u)
172 #define BIT3_POS (3u)
173 #define BIT4_POS (4u)
174 #define BIT5_POS (5u)
175 #define BIT6_POS (6u)
176 #define BIT7_POS (7u)
177 #define BIT8_POS (8u)
178 #define BIT9_POS (9u)
179 #define BIT10_POS (10u)
180 #define BIT11_POS (11u)
181 #define BIT12_POS (12u)
182 #define BIT13_POS (13u)
183 #define BIT14_POS (14u)
184 #define BIT15_POS (15u)
185 #define BIT16_POS (16u)
186 #define BIT17_POS (17u)
187 #define BIT18_POS (18u)
188 #define BIT19_POS (19u)
189 #define BIT20_POS (20u)
190 #define BIT21_POS (21u)
191 #define BIT22_POS (22u)
192 #define BIT23_POS (23u)
193 #define BIT24_POS (24u)
194 #define BIT25_POS (25u)
195 #define BIT26_POS (26u)
196 #define BIT27_POS (27u)
197 #define BIT28_POS (28u)
198 #define BIT29_POS (29u)
199 #define BIT30_POS (30u)
200 #define BIT31_POS (31u)
201 
206 #define ERR_LOG_CODE_MODULE_DISABLED_IN_CW (-116)
207 #define ERR_LOG_CODE_TIMEOUT (-101)
208 #define ERR_LOG_CODE_INVALID_VALUE (-103)
209 #define ERR_LOG_CODE_ADC1_SEQ_NOT_RUNNING (-104)
210 #define ERR_LOG_CODE_ADC2_SEQ_NOT_RUNNING (-105)
211 #define ERR_LOG_CODE_NO_TRIGGER (-106)
212 #define ERR_LOG_CODE_SOW_DISABLED (-107)
213 #define ERR_LOG_CODE_PARAM_OUT_OF_RANGE (-122)
214 #define ERR_LOG_CODE_SAFE_SHUTDOWN_ACTIVE (-118)
215 #define ERR_LOG_CODE_ERR_BDRV_INIT (-114)
217 /*******************************************************************************
218 ** Global Type Definitions **
219 *******************************************************************************/
220 typedef uint8_t uint8;
221 typedef uint16_t uint16;
222 typedef uint32_t uint32;
223 typedef uint64_t uint64;
225 typedef int8_t sint8;
226 typedef int16_t sint16;
227 typedef int32_t sint32;
228 typedef int64_t sint64;
230 typedef float float32;
231 typedef double float64;
233 typedef short FixPoint16;
234 typedef long FixPoint32;
239 #if (STD_REAL_TYPE == STD_REAL_FIX_POINT_16)
242 #elif (STD_REAL_TYPE == STD_REAL_FIX_POINT_32)
243  typedef FixPoint32 TStdReal;
244  typedef FixPoint32 TLongStdReal;
245 #elif (STD_REAL_TYPE == STD_REAL_FLOAT_32)
246  typedef float32 TStdReal;
247  typedef float32 TLongStdReal;
248 #endif
249 
250 
253 typedef struct StdRealComplex
254 {
258 
261 typedef struct
262 {
265 } TComplex;
266 
269 typedef struct
270 {
273 } TPhaseCurr;
274 
275 
276 #endif /* TYPES_H */
277 
Error codes definition.
Complex type definition based on TStdReal.
Definition: types.h:254
TStdReal imag
Imaginary part.
Definition: types.h:255
TStdReal real
Real part.
Definition: types.h:256
Complex type definition.
Definition: types.h:262
sint16 Real
Real part.
Definition: types.h:263
sint16 Imag
Imaginary part.
Definition: types.h:264
2 phase currents type definition
Definition: types.h:270
sint16 A
Phase A current.
Definition: types.h:271
sint16 B
Phase B current.
Definition: types.h:272
short FixPoint16
16 bit fix point value
Definition: types.h:233
FixPoint32 TLongStdReal
Definition: types.h:241
struct StdRealComplex TStdRealComplex
Complex type definition based on TStdReal.
double float64
64 bit float value
Definition: types.h:231
uint8_t uint8
8 bit unsigned value
Definition: types.h:220
long FixPoint32
32 bit fix point value
Definition: types.h:234
int8_t sint8
8 bit signed value
Definition: types.h:225
int64_t sint64
64 bit signed value
Definition: types.h:228
int32_t sint32
32 bit signed value
Definition: types.h:227
FixPoint16 TStdReal
Standard real type definitions to ease the use of different types.
Definition: types.h:240
int16_t sint16
16 bit signed value
Definition: types.h:226
float float32
32 bit float value
Definition: types.h:230
uint64_t uint64
64 bit unsigned value
Definition: types.h:223
uint16_t uint16
16 bit unsigned value
Definition: types.h:221
uint32_t uint32
32 bit unsigned value
Definition: types.h:222