more missing eCos types
[fw/openocd] / src / helper / types.h
index 1516bc2178c39056e8431a72f4cf6d2b8d53b777..f993ba21dc848ad20773fe71e5614e03f34daf72 100644 (file)
 #ifndef TYPES_H
 #define TYPES_H
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
 
 #ifndef u8
 typedef unsigned char u8;
@@ -61,7 +60,7 @@ typedef struct jtag_tap_s jtag_tap_t;
 #define true           1
 
 typedef int _Bool;
-#else 
+#else
 typedef bool _Bool;
 #endif /* __cplusplus */
 #endif /* HAVE__BOOL */
@@ -137,4 +136,23 @@ static inline void h_u16_to_be(u8* buf, int val)
        buf[1] = (u8) (val >> 0);
 }
 
+#ifdef __ECOS
+/* eCos plain lacks this definition... */
+typedef CYG_ADDRWORD intptr_t;
+typedef int64_t intmax_t;
+typedef uint64_t uintmax_t;
+#define INT8_MAX 0x7f
+#define INT8_MIN (-INT8_MAX - 1)
+#define UINT8_MAX (__CONCAT(INT8_MAX, U) * 2U + 1U)
+#define INT16_MAX 0x7fff
+#define INT16_MIN (-INT16_MAX - 1)
+#define UINT16_MAX (__CONCAT(INT16_MAX, U) * 2U + 1U)
+#define INT32_MAX 0x7fffffffL
+#define INT32_MIN (-INT32_MAX - 1L)
+#define UINT32_MAX (__CONCAT(INT32_MAX, U) * 2UL + 1UL)
+#define INT64_MAX 0x7fffffffffffffffLL
+#define INT64_MIN (-INT64_MAX - 1LL)
+#define UINT64_MAX (__CONCAT(INT64_MAX, U) * 2ULL + 1ULL)
+#endif
+
 #endif /* TYPES_H */