TLE986x Device Family SDK
types.h
Go to the documentation of this file.
1 /*
2  ***********************************************************************************************************************
3  *
4  * Copyright (c) 2015, 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 ** JO Julia Ott **
46 ** DM Daniel Mysliwitz **
47 ** BG Blandine Guillot **
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: Info 793: **
58 ** ANSI/ISO limit of 6 'significant characters in an**
59 ** external identifier, Info 835: A zero has been **
60 ** given as right argument to operator, Info 845: **
61 ** The left argument to operator '&' is certain to **
62 ** be 0, **
63 ** Field_Rd1() return typecase changed to (uint8) **
64 ** V0.2.3: 2019-03-11, JO: changed 'typedef signed long long int64' to **
65 ** 'typedef signed long long sint64' **
66 ** V0.2.4: 2020-10-08, JO: EP-507: Updated revision history format **
67 ** V0.2.5: 2020-10-12, JO: EP-506: remove ARMCC v6 Compiler warnings **
68 ** - check if __CC_ARM is defined before checking **
69 ** its value **
70 *******************************************************************************/
71 
72 #ifndef TYPES_H
73 #define TYPES_H
74 
75 /*******************************************************************************
76 ** Includes **
77 *******************************************************************************/
78 
79 /*******************************************************************************
80 ** Global Macro Definitions **
81 ********************************************************************************/
84 #define STD_REAL_FIX_POINT_16 (1)
85 #define STD_REAL_FIX_POINT_32 (2)
86 #define STD_REAL_FLOAT_32 (3)
87 
88 #ifndef STD_REAL_TYPE
89  #define STD_REAL_TYPE (STD_REAL_FIX_POINT_16)
90 #endif
91 
92 
95 #ifndef TRUE
96  #define TRUE (1U)
97 #endif
98 #ifndef FALSE
99  #define FALSE (0U)
100 #endif
101 
102 
105 #define STD_REAL_SHIFT_Qn8_y (-8 - 1)
106 #define STD_REAL_SHIFT_Qn7_y (-7 - 1)
107 #define STD_REAL_SHIFT_Qn6_y (-6 - 1)
108 #define STD_REAL_SHIFT_Qn5_y (-5 - 1)
109 #define STD_REAL_SHIFT_Qn4_y (-4 - 1)
110 #define STD_REAL_SHIFT_Qn3_y (-3 - 1)
111 #define STD_REAL_SHIFT_Qn2_y (-2 - 1)
112 #define STD_REAL_SHIFT_Qn1_y (-1 - 1)
114 #define STD_REAL_SHIFT_Q0_y ( 0 - 1)
115 #define STD_REAL_SHIFT_Q1_y ( 1 - 1)
116 #define STD_REAL_SHIFT_Q2_y ( 2 - 1)
117 #define STD_REAL_SHIFT_Q3_y ( 3 - 1)
118 #define STD_REAL_SHIFT_Q4_y ( 4 - 1)
119 #define STD_REAL_SHIFT_Q5_y ( 5 - 1)
120 #define STD_REAL_SHIFT_Q6_y ( 6 - 1)
121 #define STD_REAL_SHIFT_Q7_y ( 7 - 1)
122 #define STD_REAL_SHIFT_Q8_y ( 8 - 1)
123 #define STD_REAL_SHIFT_Q9_y ( 9 - 1)
124 #define STD_REAL_SHIFT_Q10_y ( 10 - 1)
125 #define STD_REAL_SHIFT_Q11_y ( 11 - 1)
126 #define STD_REAL_SHIFT_Q12_y ( 12 - 1)
127 #define STD_REAL_SHIFT_Q13_y ( 13 - 1)
128 #define STD_REAL_SHIFT_Q14_y ( 14 - 1)
129 #define STD_REAL_SHIFT_Q15_y ( 15 - 1)
130 #define STD_REAL_SHIFT_Q16_y ( 16 - 1)
131 #define STD_REAL_SHIFT_Q32_y ( 32 - 1)
133 #define NULL_PTR ((void*)0)
134 
135 #if defined __CC_ARM && (__CC_ARM == 1)
136  #define INLINE static __forceinline
137 #else
138  #define INLINE static inline
139 #endif /* (__CC_ARM == 1) */
140 
141 /*******************************************************************************
142 ** Global Type Definitions **
143 *******************************************************************************/
144 typedef unsigned char uint8;
145 typedef unsigned short uint16;
146 typedef unsigned int uint32;
147 typedef unsigned long long uint64;
149 typedef signed char sint8;
150 typedef signed short sint16;
151 typedef signed int sint32;
152 typedef signed long long sint64;
154 typedef float float32;
155 typedef double float64;
157 typedef short FixPoint16;
158 typedef long FixPoint32;
160 typedef unsigned char boolean;
165 #if (STD_REAL_TYPE == STD_REAL_FIX_POINT_16)
166  typedef FixPoint16 TStdReal;
167  typedef FixPoint32 TLongStdReal;
168 #elif (STD_REAL_TYPE == STD_REAL_FIX_POINT_32)
169  typedef FixPoint32 TStdReal;
170  typedef FixPoint32 TLongStdReal;
171 #elif (STD_REAL_TYPE == STD_REAL_FLOAT_32)
172  typedef float32 TStdReal;
173  typedef float32 TLongStdReal;
174 #endif
175 
176 
179 typedef struct _TStdRealComplex
180 {
181  TStdReal imag;
184 
187 typedef struct
188 {
189  sint16 Real;
190  sint16 Imag;
191 } TComplex;
192 
195 typedef struct
196 {
197  sint16 A;
198  sint16 B;
200 
201 typedef enum _bool
202 {
203  false = 0,
204  true = 1
205 } bool;
206 
207 #endif /* TYPES_H */
208 
_bool
_bool
Definition: types.h:196
FixPoint32
long FixPoint32
32 bit fix point value
Definition: types.h:153
sint16
signed short sint16
16 bit signed value
Definition: types.h:145
TStdReal
FixPoint16 TStdReal
Standard real type definitions to ease the use of different types.
Definition: types.h:161
float32
float float32
32 bit float value
Definition: types.h:149
uint16
unsigned short uint16
16 bit unsigned value
Definition: types.h:140
FixPoint16
short FixPoint16
16 bit fix point value
Definition: types.h:152
_TStdRealComplex::imag
TStdReal imag
Imaginary part.
Definition: types.h:176
_TStdRealComplex
Complex type definition based on TStdReal.
Definition: types.h:174
uint8
unsigned char uint8
8 bit unsigned value
Definition: types.h:139
uint64
unsigned long long uint64
64 bit unsigned value
Definition: types.h:142
uint32
unsigned int uint32
32 bit unsigned value
Definition: types.h:141
sint64
signed long long sint64
64 bit signed value
Definition: types.h:147
TStdRealComplex
struct _TStdRealComplex TStdRealComplex
Complex type definition based on TStdReal.
float64
double float64
64 bit float value
Definition: types.h:150
TPhaseCurr
2 phase currents type definition
Definition: types.h:190
TLongStdReal
FixPoint32 TLongStdReal
Definition: types.h:162
TComplex
Complex type definition.
Definition: types.h:182
bool
enum _bool bool
boolean
unsigned char boolean
for use with TRUE/FALSE
Definition: types.h:155
_TStdRealComplex::real
TStdReal real
Real part.
Definition: types.h:177
sint32
signed int sint32
32 bit signed value
Definition: types.h:146
sint8
signed char sint8
8 bit signed value
Definition: types.h:144