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  * The applicable license agreement can be found at this pack's installation directory in the file
8  * license/IFX_SW_Licence_MOTIX_LITIX.txt
9  *
10  **********************************************************************************************************************/
21 /*******************************************************************************
22 ** Author(s) Identity **
23 ********************************************************************************
24 ** Initials Name **
25 ** ---------------------------------------------------------------------------**
26 ** SS Steffen Storandt **
27 ** DM Daniel Mysliwitz **
28 ** JO Julia Ott **
29 ** BG Blandine Guillot **
30 ** PS Patrik Schwarz **
31 *******************************************************************************/
32 
33 /*******************************************************************************
34 ** Revision Control History **
35 ********************************************************************************
36 ** V0.1.0: 2012-11-12, SS: Initial version **
37 ** V0.2.0: 2012-12-13, SS: Formal changes **
38 ** V0.2.1: 2017-11-13, DM: Register access macros added **
39 ** V0.2.2: 2018-02-14, DM: MISRA 2012 compliance, the following PC-Lint **
40 ** rules are globally deactivated: **
41 ** - Info 793: ANSI/ISO limit of 6 'significant **
42 ** characters in an external identifier **
43 ** - Info 835: A zero has been given as right **
44 ** argument to operator **
45 ** - Info 845: The left argument to operator '&' **
46 ** is certain to be 0 **
47 ** Field_Rd1() return typecase changed to (uint8) **
48 ** V0.2.3: 2019-03-11, JO: Changed 'typedef signed long long int64' to **
49 ** 'typedef signed long long sint64' **
50 ** V0.2.4: 2019-09-12, JO: For ARM GCC compatibility: **
51 ** - Added #include <stdint.h> **
52 ** - Use intx_t for defining sintx **
53 ** - Use uintx_t for defining uint **
54 ** V0.3.0: 2020-04-28, BG: Updated revision history format **
55 ** V0.3.1: 2020-08-11, JO: EP-449: Checked if __CC_ARM is defined before **
56 ** checking its value **
57 ** V0.3.2: 2020-10-12, BG: EP-515: Added a new error code when the watchdog **
58 ** is not triggered **
59 ** V0.3.3: 2020-10-21, BG: EP-539: Added return code when the modules are **
60 ** not enabled in CW **
61 ** V0.3.4: 2020-10-21, BG: EP-595: Added return code for Safe Shutdown **
62 ** V0.3.5: 2021-02-26, BG: EP-701: Added return codes when the SOW is not **
63 ** enabled **
64 ** V0.3.6: 2021-03-01, BG: EP-716: Added compatibility with IAR compiler **
65 ** V0.3.7: 2021-06-07, BG: EP-815: Added a return code when several errors **
66 ** occur in the BDRV init, so that the ORed error **
67 ** code is consistent in TLE_init() **
68 ** V0.3.8: 2021-08-04, JO: EP-897: Added else to define INLINE for other **
69 ** compilers as 'static inline' **
70 ** V0.3.9: 2021-11-12, JO: EP-937: Updated copyright and branding **
71 ** V0.4.0: 2022-06-23, JO: EP-1150: Removed ARMCC V6.18 warnings, **
72 ** changed from inline to __inline for C90 support **
73 ** V0.4.1: 2022-10-14, PS: EP-819: Replaced the INLINE define with the **
74 ** CMSIS related __STATIC_INLINE define **
75 ** V0.4.2: 2022-10-25, PS: EP-1333: Replaced boolean type with bool **
76 ** V0.4.3: 2024-11-05, JO: EP-1494: Updated license **
77 *******************************************************************************/
78 
79 #ifndef TYPES_H
80 #define TYPES_H
81 
82 #include <stdint.h>
83 #include "error_codes.h"
84 
85 /*******************************************************************************
86 ** Includes **
87 *******************************************************************************/
88 
89 /*******************************************************************************
90 ** Global Macro Definitions **
91 *******************************************************************************/
94 #define STD_REAL_FIX_POINT_16 (1)
95 #define STD_REAL_FIX_POINT_32 (2)
96 #define STD_REAL_FLOAT_32 (3)
97 
98 #ifndef STD_REAL_TYPE
99  #define STD_REAL_TYPE (STD_REAL_FIX_POINT_16)
100 #endif
101 
102 
105 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
106  #include <stdbool.h>
107 #else
108  #define bool unsigned int
109  #define true 1
110  #define false 0
111 #endif
112 
115 #ifndef NULL
116  #define NULL (0U)
117 #endif
118 
121 #define STD_REAL_SHIFT_Qn8_y (-8 - 1)
122 #define STD_REAL_SHIFT_Qn7_y (-7 - 1)
123 #define STD_REAL_SHIFT_Qn6_y (-6 - 1)
124 #define STD_REAL_SHIFT_Qn5_y (-5 - 1)
125 #define STD_REAL_SHIFT_Qn4_y (-4 - 1)
126 #define STD_REAL_SHIFT_Qn3_y (-3 - 1)
127 #define STD_REAL_SHIFT_Qn2_y (-2 - 1)
128 #define STD_REAL_SHIFT_Qn1_y (-1 - 1)
130 #define STD_REAL_SHIFT_Q0_y ( 0 - 1)
131 #define STD_REAL_SHIFT_Q1_y ( 1 - 1)
132 #define STD_REAL_SHIFT_Q2_y ( 2 - 1)
133 #define STD_REAL_SHIFT_Q3_y ( 3 - 1)
134 #define STD_REAL_SHIFT_Q4_y ( 4 - 1)
135 #define STD_REAL_SHIFT_Q5_y ( 5 - 1)
136 #define STD_REAL_SHIFT_Q6_y ( 6 - 1)
137 #define STD_REAL_SHIFT_Q7_y ( 7 - 1)
138 #define STD_REAL_SHIFT_Q8_y ( 8 - 1)
139 #define STD_REAL_SHIFT_Q9_y ( 9 - 1)
140 #define STD_REAL_SHIFT_Q10_y ( 10 - 1)
141 #define STD_REAL_SHIFT_Q11_y ( 11 - 1)
142 #define STD_REAL_SHIFT_Q12_y ( 12 - 1)
143 #define STD_REAL_SHIFT_Q13_y ( 13 - 1)
144 #define STD_REAL_SHIFT_Q14_y ( 14 - 1)
145 #define STD_REAL_SHIFT_Q15_y ( 15 - 1)
146 #define STD_REAL_SHIFT_Q16_y ( 16 - 1)
147 #define STD_REAL_SHIFT_Q32_y ( 32 - 1)
149 #define NULL_PTR ((void*)0)
150 
151 #define INLINE __STATIC_INLINE
152 
153 #define BIT0_POS (0u)
154 #define BIT1_POS (1u)
155 #define BIT2_POS (2u)
156 #define BIT3_POS (3u)
157 #define BIT4_POS (4u)
158 #define BIT5_POS (5u)
159 #define BIT6_POS (6u)
160 #define BIT7_POS (7u)
161 #define BIT8_POS (8u)
162 #define BIT9_POS (9u)
163 #define BIT10_POS (10u)
164 #define BIT11_POS (11u)
165 #define BIT12_POS (12u)
166 #define BIT13_POS (13u)
167 #define BIT14_POS (14u)
168 #define BIT15_POS (15u)
169 #define BIT16_POS (16u)
170 #define BIT17_POS (17u)
171 #define BIT18_POS (18u)
172 #define BIT19_POS (19u)
173 #define BIT20_POS (20u)
174 #define BIT21_POS (21u)
175 #define BIT22_POS (22u)
176 #define BIT23_POS (23u)
177 #define BIT24_POS (24u)
178 #define BIT25_POS (25u)
179 #define BIT26_POS (26u)
180 #define BIT27_POS (27u)
181 #define BIT28_POS (28u)
182 #define BIT29_POS (29u)
183 #define BIT30_POS (30u)
184 #define BIT31_POS (31u)
185 
190 #define ERR_LOG_CODE_MODULE_DISABLED_IN_CW (-116)
191 #define ERR_LOG_CODE_TIMEOUT (-101)
192 #define ERR_LOG_CODE_INVALID_VALUE (-103)
193 #define ERR_LOG_CODE_ADC1_SEQ_NOT_RUNNING (-104)
194 #define ERR_LOG_CODE_ADC2_SEQ_NOT_RUNNING (-105)
195 #define ERR_LOG_CODE_NO_TRIGGER (-106)
196 #define ERR_LOG_CODE_SOW_DISABLED (-107)
197 #define ERR_LOG_CODE_PARAM_OUT_OF_RANGE (-122)
198 #define ERR_LOG_CODE_SAFE_SHUTDOWN_ACTIVE (-118)
199 #define ERR_LOG_CODE_ERR_BDRV_INIT (-114)
201 /*******************************************************************************
202 ** Global Type Definitions **
203 *******************************************************************************/
204 typedef uint8_t uint8;
205 typedef uint16_t uint16;
206 typedef uint32_t uint32;
207 typedef uint64_t uint64;
209 typedef int8_t sint8;
210 typedef int16_t sint16;
211 typedef int32_t sint32;
212 typedef int64_t sint64;
214 typedef float float32;
215 typedef double float64;
217 typedef short FixPoint16;
218 typedef long FixPoint32;
223 #if (STD_REAL_TYPE == STD_REAL_FIX_POINT_16)
226 #elif (STD_REAL_TYPE == STD_REAL_FIX_POINT_32)
227  typedef FixPoint32 TStdReal;
228  typedef FixPoint32 TLongStdReal;
229 #elif (STD_REAL_TYPE == STD_REAL_FLOAT_32)
230  typedef float32 TStdReal;
231  typedef float32 TLongStdReal;
232 #endif
233 
234 
237 typedef struct StdRealComplex
238 {
242 
245 typedef struct
246 {
249 } TComplex;
250 
253 typedef struct
254 {
257 } TPhaseCurr;
258 
259 
260 #endif /* TYPES_H */
261 
Error codes definition.
Complex type definition based on TStdReal.
Definition: types.h:238
TStdReal imag
Imaginary part.
Definition: types.h:239
TStdReal real
Real part.
Definition: types.h:240
Complex type definition.
Definition: types.h:246
sint16 Real
Real part.
Definition: types.h:247
sint16 Imag
Imaginary part.
Definition: types.h:248
2 phase currents type definition
Definition: types.h:254
sint16 A
Phase A current.
Definition: types.h:255
sint16 B
Phase B current.
Definition: types.h:256
short FixPoint16
16 bit fix point value
Definition: types.h:217
FixPoint32 TLongStdReal
Definition: types.h:225
struct StdRealComplex TStdRealComplex
Complex type definition based on TStdReal.
double float64
64 bit float value
Definition: types.h:215
uint8_t uint8
8 bit unsigned value
Definition: types.h:204
long FixPoint32
32 bit fix point value
Definition: types.h:218
int8_t sint8
8 bit signed value
Definition: types.h:209
int64_t sint64
64 bit signed value
Definition: types.h:212
int32_t sint32
32 bit signed value
Definition: types.h:211
FixPoint16 TStdReal
Standard real type definitions to ease the use of different types.
Definition: types.h:224
int16_t sint16
16 bit signed value
Definition: types.h:210
float float32
32 bit float value
Definition: types.h:214
uint64_t uint64
64 bit unsigned value
Definition: types.h:207
uint16_t uint16
16 bit unsigned value
Definition: types.h:205
uint32_t uint32
32 bit unsigned value
Definition: types.h:206