Infineon MOTIX™ MCU TLE987x 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 ** **
42 ** Initials Name **
43 ** ---------------------------------------------------------------------------**
44 ** SS Steffen Storandt **
45 ** DM Daniel Mysliwitz **
46 ** JO Julia Ott **
47 ** BG Blandine Guillot **
48 ** PS Patrik Schwarz **
49 ** VO Vanessa Ongaro **
50 *******************************************************************************/
51 
52 /*******************************************************************************
53 ** Revision Control History **
54 ********************************************************************************
55 ** V0.1.0: 2012-11-12, SS: Initial version **
56 ** V0.2.0: 2012-12-13, SS: Formal changes **
57 ** V0.2.1: 2017-11-13, DM: Register access macros added **
58 ** V0.2.2: 2018-02-14, DM: MISRA 2012 compliance, the following PC-Lint **
59 ** rules are globally deactivated: **
60 ** - Info 793: ANSI/ISO limit of 6 'significant **
61 ** characters in an external identifier **
62 ** - Info 835: A zero has been given as right **
63 ** argument to operator **
64 ** - Info 845: The left argument to operator '&' **
65 ** is certain to be 0 **
66 ** Field_Rd1() return typecase changed to (uint8) **
67 ** V0.2.3: 2019-03-11, JO: Changed 'typedef signed long long int64' to **
68 ** 'typedef signed long long sint64' **
69 ** V0.2.4: 2019-09-12, JO: For ARM GCC compatibility: **
70 ** - Added #include <stdint.h> **
71 ** - Use intx_t for defining sintx **
72 ** - Use uintx_t for defining uint **
73 ** V0.2.5: 2020-04-15, BG: Updated revision history format **
74 ** V0.2.6: 2020-07-21, BG: EP-439: Formatted .h/.c files **
75 ** V0.2.7: 2020-07-28, JO: EP-431: Checked if __CC_ARM is defined before **
76 ** checking its value **
77 ** V0.2.8: 2021-06-30, BG: EP-855: Added "defined" in condition for IAR **
78 ** V0.2.9: 2022-02-28, JO: EP-936: Updated copyright and branding **
79 ** V0.3.0: 2022-10-18, PS: EP-1153: Replaced boolean type with bool **
80 ** V0.3.1: 2022-10-18, VO: EP-1252: Removed ARMCC V6.18 warnings, **
81 ** Added __inline for C90 support **
82 *******************************************************************************/
83 
84 #ifndef TYPES_H
85 #define TYPES_H
86 
87 #include <stdint.h>
88 
89 /*******************************************************************************
90 ** Includes **
91 *******************************************************************************/
92 
93 /*******************************************************************************
94 ** Global Macro Definitions **
95 *******************************************************************************/
98 #define STD_REAL_FIX_POINT_16 (1)
99 #define STD_REAL_FIX_POINT_32 (2)
100 #define STD_REAL_FLOAT_32 (3)
101 
102 #ifndef STD_REAL_TYPE
103  #define STD_REAL_TYPE (STD_REAL_FIX_POINT_16)
104 #endif
105 
108 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
109  #include <stdbool.h>
110 #else
111  #define bool unsigned int
112  #define true 1
113  #define false 0
114 #endif
115 
118 #define STD_REAL_SHIFT_Qn8_y (-8 - 1)
119 #define STD_REAL_SHIFT_Qn7_y (-7 - 1)
120 #define STD_REAL_SHIFT_Qn6_y (-6 - 1)
121 #define STD_REAL_SHIFT_Qn5_y (-5 - 1)
122 #define STD_REAL_SHIFT_Qn4_y (-4 - 1)
123 #define STD_REAL_SHIFT_Qn3_y (-3 - 1)
124 #define STD_REAL_SHIFT_Qn2_y (-2 - 1)
125 #define STD_REAL_SHIFT_Qn1_y (-1 - 1)
127 #define STD_REAL_SHIFT_Q0_y ( 0 - 1)
128 #define STD_REAL_SHIFT_Q1_y ( 1 - 1)
129 #define STD_REAL_SHIFT_Q2_y ( 2 - 1)
130 #define STD_REAL_SHIFT_Q3_y ( 3 - 1)
131 #define STD_REAL_SHIFT_Q4_y ( 4 - 1)
132 #define STD_REAL_SHIFT_Q5_y ( 5 - 1)
133 #define STD_REAL_SHIFT_Q6_y ( 6 - 1)
134 #define STD_REAL_SHIFT_Q7_y ( 7 - 1)
135 #define STD_REAL_SHIFT_Q8_y ( 8 - 1)
136 #define STD_REAL_SHIFT_Q9_y ( 9 - 1)
137 #define STD_REAL_SHIFT_Q10_y ( 10 - 1)
138 #define STD_REAL_SHIFT_Q11_y ( 11 - 1)
139 #define STD_REAL_SHIFT_Q12_y ( 12 - 1)
140 #define STD_REAL_SHIFT_Q13_y ( 13 - 1)
141 #define STD_REAL_SHIFT_Q14_y ( 14 - 1)
142 #define STD_REAL_SHIFT_Q15_y ( 15 - 1)
143 #define STD_REAL_SHIFT_Q16_y ( 16 - 1)
144 #define STD_REAL_SHIFT_Q32_y ( 32 - 1)
146 #define NULL_PTR ((void*)0)
147 
148 #define INLINE __STATIC_INLINE
149 
150 /*******************************************************************************
151 ** Global Type Definitions **
152 *******************************************************************************/
153 typedef uint8_t uint8;
154 typedef uint16_t uint16;
155 typedef uint32_t uint32;
156 typedef uint64_t uint64;
158 typedef int8_t sint8;
159 typedef int16_t sint16;
160 typedef int32_t sint32;
161 typedef int64_t sint64;
163 typedef float float32;
164 typedef double float64;
166 typedef short FixPoint16;
167 typedef long FixPoint32;
172 #if (STD_REAL_TYPE == STD_REAL_FIX_POINT_16)
175 #elif (STD_REAL_TYPE == STD_REAL_FIX_POINT_32)
176  typedef FixPoint32 TStdReal;
177  typedef FixPoint32 TLongStdReal;
178 #elif (STD_REAL_TYPE == STD_REAL_FLOAT_32)
179  typedef float32 TStdReal;
180  typedef float32 TLongStdReal;
181 #endif
182 
183 
186 typedef struct StdRealComplex
187 {
191 
194 typedef struct Complex
195 {
199 
202 typedef struct PhaseCurr
203 {
207 
208 #endif /* TYPES_H */
209 
Complex type definition.
Definition: types.h:195
sint16 Real
Real part.
Definition: types.h:196
sint16 Imag
Imaginary part.
Definition: types.h:197
2 phase currents type definition
Definition: types.h:203
sint16 A
Phase A current.
Definition: types.h:204
sint16 B
Phase B current.
Definition: types.h:205
Complex type definition based on TStdReal.
Definition: types.h:187
TStdReal imag
Imaginary part.
Definition: types.h:188
TStdReal real
Real part.
Definition: types.h:189
short FixPoint16
16 bit fix point value
Definition: types.h:166
FixPoint32 TLongStdReal
Definition: types.h:174
struct PhaseCurr TPhaseCurr
2 phase currents type definition
struct StdRealComplex TStdRealComplex
Complex type definition based on TStdReal.
double float64
64 bit float value
Definition: types.h:164
uint8_t uint8
8 bit unsigned value
Definition: types.h:153
long FixPoint32
32 bit fix point value
Definition: types.h:167
int8_t sint8
8 bit signed value
Definition: types.h:158
int64_t sint64
64 bit signed value
Definition: types.h:161
int32_t sint32
32 bit signed value
Definition: types.h:160
FixPoint16 TStdReal
Standard real type definitions to ease the use of different types.
Definition: types.h:173
struct Complex TComplex
Complex type definition.
int16_t sint16
16 bit signed value
Definition: types.h:159
float float32
32 bit float value
Definition: types.h:163
uint64_t uint64
64 bit unsigned value
Definition: types.h:156
uint16_t uint16
16 bit unsigned value
Definition: types.h:154
uint32_t uint32
32 bit unsigned value
Definition: types.h:155