X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=cpu%2Ftypes.h;h=dcddaa59b8d6e228fd8715f42deb92e3e397dd8d;hb=HEAD;hp=be9b5fd5db6188117d098e8c46bf4373d53aef30;hpb=0cd848e854b65d37d71d83a833042294f9b874fd;p=bertos.git diff --git a/cpu/types.h b/cpu/types.h deleted file mode 100644 index be9b5fd5..00000000 --- a/cpu/types.h +++ /dev/null @@ -1,193 +0,0 @@ -/** - * \file - * - * - * \brief CPU-specific type definitions. - * - * \author Giovanni Bajo - * \author Bernardo Innocenti - * \author Stefano Fedrigo - * \author Francesco Sacchi - */ -#ifndef CPU_TYPES_H -#define CPU_TYPES_H - -#include "detect.h" -#include "attr.h" -#include /* for uintXX_t */ - -#if CPU_I196 - - typedef uint16_t cpuflags_t; // FIXME - typedef unsigned int cpustack_t; - #warning Verify following constant - #define SIZEOF_CPUSTACK_T 2 - -#elif CPU_X86 - - /* Get IRQ_* definitions from the hosting environment. */ - #include - #if OS_EMBEDDED - typedef uint32_t cpuflags_t; // FIXME - #endif /* OS_EMBEDDED */ - - #if CPU_X86_64 - typedef uint64_t cpustack_t; - #define SIZEOF_CPUSTACK_T 8 - #else - typedef uint32_t cpustack_t; - #define SIZEOF_CPUSTACK_T 4 - #endif - -#elif CPU_ARM - - typedef uint32_t cpuflags_t; - typedef uint32_t cpustack_t; - #define SIZEOF_CPUSTACK_T 4 - -#elif CPU_PPC - - typedef uint32_t cpuflags_t; // FIXME - typedef uint32_t cpustack_t; // FIXME - #define SIZEOF_CPUSTACK_T 4 - -#elif CPU_DSP56K - - typedef uint16_t cpuflags_t; - typedef unsigned int cpustack_t; - #warning Verify following costant - #define SIZEOF_CPUSTACK_T 2 - -#elif CPU_AVR - - typedef uint8_t cpuflags_t; - typedef uint8_t cpustack_t; - #define SIZEOF_CPUSTACK_T 1 - -#else - #error No CPU_... defined. -#endif - -/** - * \name Default type sizes. - * - * These defaults are reasonable for most 16/32bit machines. - * Some of these macros may be overridden by CPU-specific code above. - * - * ANSI C requires that the following equations be true: - * \code - * sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long) - * sizeof(float) <= sizeof(double) - * CPU_BITS_PER_CHAR >= 8 - * CPU_BITS_PER_SHORT >= 8 - * CPU_BITS_PER_INT >= 16 - * CPU_BITS_PER_LONG >= 32 - * \endcode - * \{ - */ -#ifndef SIZEOF_CHAR -#define SIZEOF_CHAR 1 -#endif - -#ifndef SIZEOF_SHORT -#define SIZEOF_SHORT 2 -#endif - -#ifndef SIZEOF_INT -#if CPU_REG_BITS < 32 - #define SIZEOF_INT 2 -#else - #define SIZEOF_INT 4 -#endif -#endif /* !SIZEOF_INT */ - -#ifndef SIZEOF_LONG -#if CPU_REG_BITS > 32 - #define SIZEOF_LONG 8 -#else - #define SIZEOF_LONG 4 -#endif -#endif - -#ifndef SIZEOF_PTR -#if CPU_REG_BITS < 32 - #define SIZEOF_PTR 2 -#elif CPU_REG_BITS == 32 - #define SIZEOF_PTR 4 -#else /* CPU_REG_BITS > 32 */ - #define SIZEOF_PTR 8 -#endif -#endif - -#ifndef CPU_BITS_PER_CHAR -#define CPU_BITS_PER_CHAR (SIZEOF_CHAR * 8) -#endif - -#ifndef CPU_BITS_PER_SHORT -#define CPU_BITS_PER_SHORT (SIZEOF_SHORT * CPU_BITS_PER_CHAR) -#endif - -#ifndef CPU_BITS_PER_INT -#define CPU_BITS_PER_INT (SIZEOF_INT * CPU_BITS_PER_CHAR) -#endif - -#ifndef CPU_BITS_PER_LONG -#define CPU_BITS_PER_LONG (SIZEOF_LONG * CPU_BITS_PER_CHAR) -#endif - -#ifndef CPU_BITS_PER_PTR -#define CPU_BITS_PER_PTR (SIZEOF_PTR * CPU_BITS_PER_CHAR) -#endif - - -/*\}*/ - -/* Sanity checks for the above definitions */ -STATIC_ASSERT(sizeof(char) == SIZEOF_CHAR); -STATIC_ASSERT(sizeof(short) == SIZEOF_SHORT); -STATIC_ASSERT(sizeof(long) == SIZEOF_LONG); -STATIC_ASSERT(sizeof(int) == SIZEOF_INT); -STATIC_ASSERT(sizeof(void *) == SIZEOF_PTR); -STATIC_ASSERT(sizeof(int8_t) * CPU_BITS_PER_CHAR == 8); -STATIC_ASSERT(sizeof(uint8_t) * CPU_BITS_PER_CHAR == 8); -STATIC_ASSERT(sizeof(int16_t) * CPU_BITS_PER_CHAR == 16); -STATIC_ASSERT(sizeof(uint16_t) * CPU_BITS_PER_CHAR == 16); -STATIC_ASSERT(sizeof(int32_t) * CPU_BITS_PER_CHAR == 32); -STATIC_ASSERT(sizeof(uint32_t) * CPU_BITS_PER_CHAR == 32); -#ifdef __HAS_INT64_T__ -STATIC_ASSERT(sizeof(int64_t) * CPU_BITS_PER_CHAR == 64); -STATIC_ASSERT(sizeof(uint64_t) * CPU_BITS_PER_CHAR == 64); -#endif -STATIC_ASSERT(sizeof(cpustack_t) == SIZEOF_CPUSTACK_T); - - -#endif /* CPU_TYPES_H */