-
Notifications
You must be signed in to change notification settings - Fork 3
/
std_types.h
executable file
·209 lines (186 loc) · 8.8 KB
/
std_types.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/*******************************************************************************
*
* Copyright (C) u-blox AG
* u-blox AG, Thalwil, Switzerland
*
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose without fee is hereby granted, provided that this entire notice
* is included in all copies of any software which is or includes a copy
* or modification of this software and in all copies of the supporting
* documentation for such software.
*
* THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR U-BLOX MAKES ANY
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*
*******************************************************************************
*
* Project: PE_ANS
*
******************************************************************************/
/*!
\file
\brief Standard Numeric Data Types
Basic numeric data have been defined for useability and easy porting of the
project to other targets. The idea is to have small types which provide
information about the ist range. These types are also known as the Tcl SECS
Notation. Microsoft uses the same types in their "UnmanagedType Enumeration"
in the .NET Framework Class Library. The types have been extended with other
types which are quite common in our software.
*/
/*******************************************************************************
* $Id: std_types.h 63615 2012-11-27 10:12:42Z andrea.foni $
******************************************************************************/
#ifndef __STD_TYPES_H__
#define __STD_TYPES_H__ //!< multiple inclusion guard
#ifndef _MSC_VER
#include <stdint.h>
#endif
#define FALSE 0 //!< false value
#define TRUE 1 //!< true value
#define CONFIRMED 2 //!< confirmed value
/*! \name Signed Integer Types */
//@{
typedef signed int I; //!< equal to I4 (on ARM7TDMI)
#ifdef _MSC_VER
typedef __int8 I1; //!< signed 1 byte integer
typedef __int16 I2; //!< signed 2 byte integer
typedef __int32 I4; //!< signed 4 byte integer
typedef __int64 I8; //!< signed 8 byte integer
#else
typedef int8_t I1; //!< signed 1 byte integer
typedef int16_t I2; //!< signed 2 byte integer
typedef int32_t I4; //!< signed 4 byte integer
typedef int64_t I8; //!< signed 8 byte integer
#endif
//@}
/*! \name Unsigned Integer Types */
//@{
typedef unsigned int U; //!< equal to U4 (on ARM7TDMI)
#ifdef _MSC_VER
typedef unsigned __int8 U1; //!< unsigned 1 byte integer
typedef unsigned __int16 U2; //!< unsigned 2 byte integer
typedef unsigned __int32 U4; //!< unsigned 4 byte integer
typedef unsigned __int64 U8; //!< unsigned 8 byte integer
#else
typedef uint8_t U1; //!< unsigned 1 byte integer
typedef uint16_t U2; //!< unsigned 2 byte integer
typedef uint32_t U4; //!< unsigned 4 byte integer
typedef uint64_t U8; //!< unsigned 8 byte integer
#endif
//@}
/*! \name Logical (or Boolean) Types */
//@{
typedef U L; //!< equal to L4 (on ARM7TDMI)
typedef U1 L1; //!< 1 byte logical (FALSE, TRUE and CONFIRMED only)
typedef U2 L2; //!< 2 byte logical (FALSE, TRUE and CONFIRMED only)
typedef U4 L4; //!< 4 byte logical (FALSE, TRUE and CONFIRMED only)
//@}
/*! \name Floating Point Types */
//@{
typedef float R4; //!< 4 byte floating point
typedef double R8; //!< 8 byte floating point
//@}
/*! \name Character Type */
//@{
typedef char CH; //!< ASCII character
//@}
/*! \name Complex Number Types */
//@{
//! Complex 2-byte data type; in-phase component is in high byte
typedef struct C2_s
{
I1 Q; //!< 1 byte quadrature (imaginary) component
I1 I; //!< 1 byte in-phase (real) component
} C2;
//! Complex 4-byte data type; in-phase component is in high half-word
typedef struct C4_s
{
I2 Q; //!< 2 byte quadrature (imaginary) component
I2 I; //!< 2 byte in-phase (real) component
} C4;
//! Complex 8-byte data type; in-phase component is in high word
typedef struct C8_s
{
I4 Q; //!< 4 byte quadrature (imaginary) component
I4 I; //!< 4 byte in-phase (real) component
} C8;
//@}
//! Helper Macro for FIXEDPOINT()
#define _FIXEDPOINTA(t,scale) F##t##_##scale
//! Create Fixed Point Type
#define FIXEDPOINT(t,scale) _FIXEDPOINTA(t,scale)
//! \name Unsigned Fixpoint Types
//@{
typedef U1 FU1_4; //!< 1 byte unsigned, scale 4: U.F
typedef U1 FU1_5; //!< 1 byte unsigned, scale 5: uuu.fF
typedef U2 FU2_4; //!< 2 bytes unsigned, scale 4: UUU.F
typedef U2 FU2_8; //!< 2 bytes unsigned, scale 8: UU.FF
typedef U2 FU2_12; //!< 2 bytes unsigned, scale 12: U.FFF
typedef U2 FU2_16; //!< 2 bytes unsigned, scale 16: .FFFF
typedef U4 FU4_4; //!< 4 bytes unsigned, scale 4: UUUUUUU.F
typedef U4 FU4_8; //!< 4 bytes unsigned, scale 8: UUUUUU.FF
typedef U4 FU4_12; //!< 4 bytes unsigned, scale 12: UUUUU.FFF
typedef U4 FU4_16; //!< 4 bytes unsigned, scale 16: UUUU.FFFF
typedef U4 FU4_20; //!< 4 bytes unsigned, scale 20: UUU.FFFFF
typedef U4 FU4_24; //!< 4 bytes unsigned, scale 24: UU.FFFFFF
typedef U4 FU4_28; //!< 4 bytes unsigned, scale 28: U.FFFFFFF
typedef U4 FU4_32; //!< 4 bytes unsigned, scale 32: .FFFFFFFF
typedef U8 FU8_4; //!< 8 bytes unsigned, scale 4: UUUUUUUUUUUUUUU.F
typedef U8 FU8_8; //!< 8 bytes unsigned, scale 8: UUUUUUUUUUUUUU.FF
typedef U8 FU8_12; //!< 8 bytes unsigned, scale 12: UUUUUUUUUUUUU.FFF
typedef U8 FU8_16; //!< 8 bytes unsigned, scale 16: UUUUUUUUUUUU.FFFF
typedef U8 FU8_20; //!< 8 bytes unsigned, scale 20: UUUUUUUUUUU.FFFFF
typedef U8 FU8_24; //!< 8 bytes unsigned, scale 24: UUUUUUUUUU.FFFFFF
typedef U8 FU8_28; //!< 8 bytes unsigned, scale 28: UUUUUUUUU.FFFFFFF
typedef U8 FU8_32; //!< 8 bytes unsigned, scale 32: UUUUUUUU.FFFFFFFF
typedef U8 FU8_36; //!< 8 bytes unsigned, scale 36: UUUUUUU.FFFFFFFFF
typedef U8 FU8_40; //!< 8 bytes unsigned, scale 40: UUUUUU.FFFFFFFFFF
typedef U8 FU8_44; //!< 8 bytes unsigned, scale 44: UUUUU.FFFFFFFFFFF
typedef U8 FU8_48; //!< 8 bytes unsigned, scale 48: UUUU.FFFFFFFFFFFF
typedef U8 FU8_52; //!< 8 bytes unsigned, scale 52: UUU.FFFFFFFFFFFFF
typedef U8 FU8_56; //!< 8 bytes unsigned, scale 56: UU.FFFFFFFFFFFFFF
typedef U8 FU8_60; //!< 8 bytes unsigned, scale 60: U.FFFFFFFFFFFFFFF
typedef U8 FU8_64; //!< 8 bytes unsigned, scale 64: .FFFFFFFFFFFFFFFF
//@}
//! \name Signed Fixpoint Types
//@{
typedef I1 FI1_4; //!< 1 byte signed, scale 4: I.F
typedef I2 FI2_4; //!< 2 bytes signed, scale 4: III.F
typedef I2 FI2_8; //!< 2 bytes signed, scale 8: II.FF
typedef I2 FI2_12; //!< 2 bytes signed, scale 12: I.FFF
typedef I2 FI2_16; //!< 2 bytes signed, scale 16: .FFFF
typedef I4 FI4_4; //!< 4 bytes signed, scale 4: IIIIIII.F
typedef I4 FI4_8; //!< 4 bytes signed, scale 8: IIIIII.FF
typedef I4 FI4_12; //!< 4 bytes signed, scale 12: IIIII.FFF
typedef I4 FI4_16; //!< 4 bytes signed, scale 16: IIII.FFFF
typedef I4 FI4_20; //!< 4 bytes signed, scale 20: III.FFFFF
typedef I4 FI4_24; //!< 4 bytes signed, scale 24: II.FFFFFF
typedef I4 FI4_28; //!< 4 bytes signed, scale 28: I.FFFFFFF
typedef I4 FI4_31; //!< 4 bytes signed, scale 31: i.fffFFFFFFF
typedef I4 FI4_32; //!< 4 bytes signed, scale 32: .FFFFFFFF
typedef I8 FI8_4; //!< 8 bytes signed, scale 4: IIIIIIIIIIIIIII.F
typedef I8 FI8_8; //!< 8 bytes signed, scale 8: IIIIIIIIIIIIII.FF
typedef I8 FI8_12; //!< 8 bytes signed, scale 12: IIIIIIIIIIIII.FFF
typedef I8 FI8_16; //!< 8 bytes signed, scale 16: IIIIIIIIIIII.FFFF
typedef I8 FI8_20; //!< 8 bytes signed, scale 20: IIIIIIIIIII.FFFFF
typedef I8 FI8_24; //!< 8 bytes signed, scale 24: IIIIIIIIII.FFFFFF
typedef I8 FI8_28; //!< 8 bytes signed, scale 28: IIIIIIIII.FFFFFFF
typedef I8 FI8_32; //!< 8 bytes signed, scale 32: IIIIIIII.FFFFFFFF
typedef I8 FI8_36; //!< 8 bytes signed, scale 36: IIIIIII.FFFFFFFFF
typedef I8 FI8_40; //!< 8 bytes signed, scale 40: IIIIII.FFFFFFFFFF
typedef I8 FI8_44; //!< 8 bytes signed, scale 44: IIIII.FFFFFFFFFFF
typedef I8 FI8_48; //!< 8 bytes signed, scale 48: IIII.FFFFFFFFFFFF
typedef I8 FI8_52; //!< 8 bytes signed, scale 52: III.FFFFFFFFFFFFF
typedef I8 FI8_56; //!< 8 bytes signed, scale 56: II.FFFFFFFFFFFFFF
typedef I8 FI8_60; //!< 8 bytes signed, scale 60: I.FFFFFFFFFFFFFFF
typedef I8 FI8_64; //!< 8 bytes signed, scale 64: .FFFFFFFFFFFFFFFF
//@}
/*! \name Volatile Register Type */
//@{
#define REG volatile U4 //!< 32 bit Register value
//@}
#endif // __STD_TYPES_H__