msousa@0: /* msousa@0: * Copyright (c) 2002,2016 Mario de Sousa (msousa@fe.up.pt) msousa@0: * msousa@0: * This file is part of the Modbus library for Beremiz and matiec. msousa@0: * msousa@0: * This Modbus library is free software: you can redistribute it and/or modify msousa@0: * it under the terms of the GNU Lesser General Public License as published by msousa@0: * the Free Software Foundation, either version 3 of the License, or msousa@0: * (at your option) any later version. msousa@0: * msousa@0: * This program is distributed in the hope that it will be useful, but msousa@0: * WITHOUT ANY WARRANTY; without even the implied warranty of msousa@0: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser msousa@0: * General Public License for more details. msousa@0: * msousa@0: * You should have received a copy of the GNU Lesser General Public License msousa@0: * along with this Modbus library. If not, see . msousa@0: * msousa@0: * This code is made available on the understanding that it will not be msousa@0: * used in safety-critical situations without a full and competent review. msousa@0: */ msousa@0: msousa@0: msousa@0: msousa@0: #ifndef __MB_TYPES_H msousa@0: #define __MB_TYPES_H msousa@0: msousa@0: #ifndef __PLC_TYPES_H msousa@0: /* if we have already included the MatPLC's type definitions, we don't need to delare the types ourselves... */ msousa@0: msousa@0: msousa@0: /* Tell the stdint.h file we want the limits of the data types defined. */ msousa@0: /* If being compiled by a C++ compiler, this is required! */ msousa@0: /* If being compiled by a C compiler, this is ignored! */ msousa@0: #define __STDC_LIMIT_MACROS msousa@0: #include msousa@0: msousa@0: msousa@0: msousa@0: /* We use the _leastX_t versions of the data types as these are guaranteed msousa@0: * to be the exact size we want. msousa@0: * The int8_t, etc..., may have been defined to be the same as the msousa@0: * _fastX_t version, which may take up more space than what is really wanted msousa@0: * in order as to speed up memory access. msousa@0: */ msousa@0: typedef uint_least64_t u64; /* 64-bit unsigned integer */ msousa@0: typedef int_least64_t i64; /* 64-bit signed integer */ msousa@0: msousa@0: typedef uint_least32_t u32; /* 32-bit unsigned integer */ msousa@0: typedef int_least32_t i32; /* 32-bit signed integer */ msousa@0: msousa@0: typedef uint_least16_t u16; /* 16-bit unsigned integer */ msousa@0: typedef int_least16_t i16; /* 16-bit signed integer */ msousa@0: msousa@0: typedef uint_least8_t u8; /* 8-bit unsigned integer */ msousa@0: typedef int_least8_t i8; /* 8-bit signed integer */ msousa@0: msousa@0: msousa@0: msousa@0: msousa@0: #define u64_MAX UINT_LEAST64_MAX msousa@0: #define u64_MIN UINT_LEAST64_MIN msousa@0: #define i64_MAX INT_LEAST64_MAX msousa@0: #define i64_MIN INT_LEAST64_MIN msousa@0: msousa@0: #define u32_MAX UINT_LEAST32_MAX msousa@0: #define u32_MIN UINT_LEAST32_MIN msousa@0: #define i32_MAX INT_LEAST32_MAX msousa@0: #define i32_MIN INT_LEAST32_MIN msousa@0: msousa@0: #define u16_MAX UINT_LEAST16_MAX msousa@0: #define u16_MIN UINT_LEAST16_MIN msousa@0: #define i16_MAX INT_LEAST16_MAX msousa@0: #define i16_MIN INT_LEAST16_MIN msousa@0: msousa@0: #define u8_MAX UINT_LEAST8_MAX msousa@0: #define u8_MIN UINT_LEAST8_MIN msousa@0: #define i8_MAX INT_LEAST8_MAX msousa@0: #define i8_MIN INT_LEAST8_MIN msousa@0: msousa@0: msousa@0: #endif /* __PLC_TYPES_H */ msousa@0: msousa@0: #endif /* __MB_TYPES_H */ msousa@0: