|
1 /* |
|
2 * Copyright (c) 2002,2016 Mario de Sousa (msousa@fe.up.pt) |
|
3 * |
|
4 * This file is part of the Modbus library for Beremiz and matiec. |
|
5 * |
|
6 * This Modbus library is free software: you can redistribute it and/or modify |
|
7 * it under the terms of the GNU Lesser General Public License as published by |
|
8 * the Free Software Foundation, either version 3 of the License, or |
|
9 * (at your option) any later version. |
|
10 * |
|
11 * This program is distributed in the hope that it will be useful, but |
|
12 * WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser |
|
14 * General Public License for more details. |
|
15 * |
|
16 * You should have received a copy of the GNU Lesser General Public License |
|
17 * along with this Modbus library. If not, see <http://www.gnu.org/licenses/>. |
|
18 * |
|
19 * This code is made available on the understanding that it will not be |
|
20 * used in safety-critical situations without a full and competent review. |
|
21 */ |
|
22 |
|
23 |
|
24 |
|
25 #ifndef __MB_TYPES_H |
|
26 #define __MB_TYPES_H |
|
27 |
|
28 #ifndef __PLC_TYPES_H |
|
29 /* if we have already included the MatPLC's type definitions, we don't need to delare the types ourselves... */ |
|
30 |
|
31 |
|
32 /* Tell the stdint.h file we want the limits of the data types defined. */ |
|
33 /* If being compiled by a C++ compiler, this is required! */ |
|
34 /* If being compiled by a C compiler, this is ignored! */ |
|
35 #define __STDC_LIMIT_MACROS |
|
36 #include <stdint.h> |
|
37 |
|
38 |
|
39 |
|
40 /* We use the _leastX_t versions of the data types as these are guaranteed |
|
41 * to be the exact size we want. |
|
42 * The int8_t, etc..., may have been defined to be the same as the |
|
43 * _fastX_t version, which may take up more space than what is really wanted |
|
44 * in order as to speed up memory access. |
|
45 */ |
|
46 typedef uint_least64_t u64; /* 64-bit unsigned integer */ |
|
47 typedef int_least64_t i64; /* 64-bit signed integer */ |
|
48 |
|
49 typedef uint_least32_t u32; /* 32-bit unsigned integer */ |
|
50 typedef int_least32_t i32; /* 32-bit signed integer */ |
|
51 |
|
52 typedef uint_least16_t u16; /* 16-bit unsigned integer */ |
|
53 typedef int_least16_t i16; /* 16-bit signed integer */ |
|
54 |
|
55 typedef uint_least8_t u8; /* 8-bit unsigned integer */ |
|
56 typedef int_least8_t i8; /* 8-bit signed integer */ |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 #define u64_MAX UINT_LEAST64_MAX |
|
62 #define u64_MIN UINT_LEAST64_MIN |
|
63 #define i64_MAX INT_LEAST64_MAX |
|
64 #define i64_MIN INT_LEAST64_MIN |
|
65 |
|
66 #define u32_MAX UINT_LEAST32_MAX |
|
67 #define u32_MIN UINT_LEAST32_MIN |
|
68 #define i32_MAX INT_LEAST32_MAX |
|
69 #define i32_MIN INT_LEAST32_MIN |
|
70 |
|
71 #define u16_MAX UINT_LEAST16_MAX |
|
72 #define u16_MIN UINT_LEAST16_MIN |
|
73 #define i16_MAX INT_LEAST16_MAX |
|
74 #define i16_MIN INT_LEAST16_MIN |
|
75 |
|
76 #define u8_MAX UINT_LEAST8_MAX |
|
77 #define u8_MIN UINT_LEAST8_MIN |
|
78 #define i8_MAX INT_LEAST8_MAX |
|
79 #define i8_MIN INT_LEAST8_MIN |
|
80 |
|
81 |
|
82 #endif /* __PLC_TYPES_H */ |
|
83 |
|
84 #endif /* __MB_TYPES_H */ |
|
85 |