rtapi_stdint.h
1 // Copyright 2014 Jeff Epler 2 // 3 // This program is free software; you can redistribute it and/or modify 4 // it under the terms of the GNU General Public License as published by 5 // the Free Software Foundation; either version 2 of the License, or 6 // (at your option) any later version. 7 // 8 // This program is distributed in the hope that it will be useful, 9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 // GNU General Public License for more details. 12 // 13 // You should have received a copy of the GNU General Public License 14 // along with this program; if not, write to the Free Software 15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 16 #ifndef RTAPI_STDINT_H 17 #define RTAPI_STDINT_H 18 19 #ifdef __KERNEL__ 20 #include <asm/types.h> 21 typedef s8 rtapi_s8; 22 typedef s16 rtapi_s16; 23 typedef s32 rtapi_s32; 24 typedef s64 rtapi_s64; 25 typedef long rtapi_intptr_t; 26 typedef u8 rtapi_u8; 27 typedef u16 rtapi_u16; 28 typedef u32 rtapi_u32; 29 typedef u64 rtapi_u64; 30 typedef unsigned long rtapi_uintptr_t; 31 32 #define RTAPI_INT8_MAX (127) 33 #define RTAPI_INT8_MIN (-128) 34 #define RTAPI_UINT8_MAX (255) 35 36 #define RTAPI_INT16_MAX (32767) 37 #define RTAPI_INT16_MIN (-32768) 38 #define RTAPI_UINT16_MAX (65535) 39 40 #define RTAPI_INT32_MAX (2147483647) 41 #define RTAPI_INT32_MIN (-2147483647-1) 42 #define RTAPI_UINT32_MAX (4294967295ul) 43 44 #define RTAPI_INT64_MAX (9223372036854775807) 45 #define RTAPI_INT64_MIN (-9223372036854775807-1) 46 #define RTAPI_UINT64_MAX (18446744073709551615ull) 47 #else 48 #include <inttypes.h> 49 50 typedef int8_t rtapi_s8; 51 typedef int16_t rtapi_s16; 52 typedef int32_t rtapi_s32; 53 typedef int64_t rtapi_s64; 54 typedef intptr_t rtapi_intptr_t; 55 typedef uint8_t rtapi_u8; 56 typedef uint16_t rtapi_u16; 57 typedef uint32_t rtapi_u32; 58 typedef uint64_t rtapi_u64; 59 typedef uintptr_t rtapi_uintptr_t; 60 61 #define RTAPI_INT8_MAX INT8_MAX 62 #define RTAPI_INT8_MIN INT8_MIN 63 #define RTAPI_UINT8_MAX UINT8_MAX 64 65 #define RTAPI_INT16_MAX INT16_MAX 66 #define RTAPI_INT16_MIN INT16_MIN 67 #define RTAPI_UINT16_MAX UINT16_MAX 68 69 #define RTAPI_INT32_MAX INT32_MAX 70 #define RTAPI_INT32_MIN INT32_MIN 71 #define RTAPI_UINT32_MAX UINT32_MAX 72 73 #define RTAPI_INT64_MAX INT64_MAX 74 #define RTAPI_INT64_MIN INT64_MIN 75 #define RTAPI_UINT64_MAX UINT64_MAX 76 #endif 77 78 #endif