Infineon MOTIX™ MCU TLE985x Device Family SDK
types.h
Go to the documentation of this file.
1 /*
2  ***********************************************************************************************************************
3  *
4  * Copyright (c) 2012-2022, 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  **********************************************************************************************************************/
39 /*******************************************************************************
40 ** Author(s) Identity **
41 ********************************************************************************
42 ** Initials Name **
43 ** ---------------------------------------------------------------------------**
44 ** SS Steffen Storandt **
45 ** DM Daniel Mysliwitz **
46 ** TS T&S **
47 ** BG Blandine Guillot **
48 ** JO Julia Ott **
49 ** PS Patrik Schwarz **
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.3.0: 2018-06-26, TS: Macros to access bit fields of a register **
58 ** V0.3.1: 2018-07-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 '&' is **
65 ** certain to be 0 **
66 ** Field_Rd1() return typecase changed to (uint8) **
67 ** V0.3.2: 2019-03-11, JO: Changed 'typedef signed long long int64' to **
68 ** 'typedef signed long long sint64' **
69 ** V0.3.3: 2020-03-02, BG: Updated revision history format **
70 ** V0.3.4: 2020-07-28, JO: EP-435: check if __CC_ARM is defined before **
71 ** checking its value **
72 ** Use type definitions from TLE987x Pack (*_t) for **
73 ** uint8, uint16, uint32, uint64, sint8, sint16, **
74 ** sint32, and sint64 **
75 ** include file stdint.h **
76 ** V0.4.0: 2022-01-19, BG: EP-904: Added compatibility with IAR compiler **
77 ** V0.4.1: 2022-01-21, JO: EP-934: Updated copyright and branding **
78 ** V0.4.2: 2022-11-11, PS: EP-1346: used CMSIS INLINE definitions and C99 **
79 ** bool definition **
80 *******************************************************************************/
81 
82 #ifndef TYPES_H
83 #define TYPES_H
84 
85 /*******************************************************************************
86 ** Includes **
87 *******************************************************************************/
88 #include <stdint.h>
89 
90 /*******************************************************************************
91 ** Global Macro Definitions **
92 *******************************************************************************/
95 #define STD_REAL_FIX_POINT_16 (1)
96 #define STD_REAL_FIX_POINT_32 (2)
97 #define STD_REAL_FLOAT_32 (3)
98 
99 #ifndef STD_REAL_TYPE
100 #define STD_REAL_TYPE (STD_REAL_FIX_POINT_16)
101 #endif
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 #define STD_REAL_SHIFT_Qn8_y (-8 - 1)
116 #define STD_REAL_SHIFT_Qn7_y (-7 - 1)
117 #define STD_REAL_SHIFT_Qn6_y (-6 - 1)
118 #define STD_REAL_SHIFT_Qn5_y (-5 - 1)
119 #define STD_REAL_SHIFT_Qn4_y (-4 - 1)
120 #define STD_REAL_SHIFT_Qn3_y (-3 - 1)
121 #define STD_REAL_SHIFT_Qn2_y (-2 - 1)
122 #define STD_REAL_SHIFT_Qn1_y (-1 - 1)
124 #define STD_REAL_SHIFT_Q0_y ( 0 - 1)
125 #define STD_REAL_SHIFT_Q1_y ( 1 - 1)
126 #define STD_REAL_SHIFT_Q2_y ( 2 - 1)
127 #define STD_REAL_SHIFT_Q3_y ( 3 - 1)
128 #define STD_REAL_SHIFT_Q4_y ( 4 - 1)
129 #define STD_REAL_SHIFT_Q5_y ( 5 - 1)
130 #define STD_REAL_SHIFT_Q6_y ( 6 - 1)
131 #define STD_REAL_SHIFT_Q7_y ( 7 - 1)
132 #define STD_REAL_SHIFT_Q8_y ( 8 - 1)
133 #define STD_REAL_SHIFT_Q9_y ( 9 - 1)
134 #define STD_REAL_SHIFT_Q10_y ( 10 - 1)
135 #define STD_REAL_SHIFT_Q11_y ( 11 - 1)
136 #define STD_REAL_SHIFT_Q12_y ( 12 - 1)
137 #define STD_REAL_SHIFT_Q13_y ( 13 - 1)
138 #define STD_REAL_SHIFT_Q14_y ( 14 - 1)
139 #define STD_REAL_SHIFT_Q15_y ( 15 - 1)
140 #define STD_REAL_SHIFT_Q16_y ( 16 - 1)
141 #define STD_REAL_SHIFT_Q32_y ( 32 - 1)
143 #define NULL_PTR ((void*)0)
144 
145 #define INLINE __STATIC_INLINE
146 
147 #define MASK_WORD (0xFFFFFFFFU)
148 #define MASK_HALF_WORD (0xFFFFU)
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;
169 typedef unsigned char boolean;
174 #if (STD_REAL_TYPE == STD_REAL_FIX_POINT_16)
177 #elif (STD_REAL_TYPE == STD_REAL_FIX_POINT_32)
178 typedef FixPoint32 TStdReal;
179 typedef FixPoint32 TLongStdReal;
180 #elif (STD_REAL_TYPE == STD_REAL_FLOAT_32)
181 typedef float32 TStdReal;
182 typedef float32 TLongStdReal;
183 #endif
184 
185 
188 typedef struct _TStdRealComplex
189 {
193 
196 typedef struct
197 {
200 }TComplex;
201 
204 typedef struct
205 {
208 }TPhaseCurr;
209 
210 #endif /* TYPES_H */
211 
Complex type definition based on TStdReal.
Definition: types.h:189
TStdReal imag
Imaginary part.
Definition: types.h:190
TStdReal real
Real part.
Definition: types.h:191
Complex type definition.
Definition: types.h:197
sint16 Real
Real part.
Definition: types.h:198
sint16 Imag
Imaginary part.
Definition: types.h:199
2 phase currents type definition
Definition: types.h:205
sint16 A
Phase A current.
Definition: types.h:206
sint16 B
Phase B current.
Definition: types.h:207
short FixPoint16
16 bit fix point value
Definition: types.h:166
FixPoint32 TLongStdReal
Definition: types.h:176
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:175
unsigned char boolean
for use with TRUE/FALSE
Definition: types.h:169
struct _TStdRealComplex TStdRealComplex
Complex type definition based on TStdReal.
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