4 * Copyright 2004, 2005 Develer S.r.l. (http://www.develer.com/)
5 * Copyright 2004 Giovanni Bajo
6 * This file is part of DevLib - See README.devlib for information.
9 * \brief CPU detection through special preprocessor macros
14 #if defined(__arm__) /* GCC */ \
15 || defined(__ARM4TM__) /* IAR: defined for all cores >= 4tm */
22 #if (defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)) \
23 && !defined(__ARM4TM__) /* IAR: if not ARM assume I196 */
24 #warning Assuming CPU is I196
31 #if defined(__i386__) /* GCC */ \
32 || (defined(_M_IX86) && !defined(_WIN64)) /* MSVC */
37 #elif defined(__x86_64__) /* GCC */ \
38 || (defined(_M_IX86) && defined(_WIN64)) /* MSVC */
49 #if defined (_ARCH_PPC) || defined(_ARCH_PPC64)
52 #if defined(_ARCH_PPC)
57 #if defined(_ARCH_PPC64)
68 #if defined(__m56800E__) || defined(__m56800__)
79 #if defined(__AVR_ATmega64__)
80 #define CPU_AVR_ATMEGA64 1
82 #define CPU_AVR_ATMEGA64 0
85 #if defined(__AVR_ATmega103__)
86 #define CPU_AVR_ATMEGA103 1
88 #define CPU_AVR_ATMEGA103 0
91 #if defined(__AVR_ATmega128__)
92 #define CPU_AVR_ATMEGA128 1
94 #define CPU_AVR_ATMEGA128 0
97 #if defined(__AVR_ATmega8__)
98 #define CPU_AVR_ATMEGA8 1
100 #define CPU_AVR_ATMEGA8 0
103 #if defined(__AVR_ATmega168__)
104 #define CPU_AVR_ATMEGA168 1
106 #define CPU_AVR_ATMEGA168 0
109 #if defined(__AVR_ATmega1281__)
110 #define CPU_AVR_ATMEGA1281 1
112 #define CPU_AVR_ATMEGA1281 0
116 #define CPU_AVR_ATMEGA8 0
117 #define CPU_AVR_ATMEGA168 0
118 #define CPU_AVR_ATMEGA64 0
119 #define CPU_AVR_ATMEGA103 0
120 #define CPU_AVR_ATMEGA128 0
121 #define CPU_AVR_ATMEGA1281 0
125 /* Self-check for the detection: only one CPU must be detected */
126 #if CPU_ARM + CPU_I196 + CPU_X86 + CPU_PPC + CPU_DSP56K + CPU_AVR == 0
128 #elif !defined(CPU_ID)
129 #error CPU_ID not defined
130 #elif CPU_ARM + CPU_I196 + CPU_X86 + CPU_PPC + CPU_DSP56K + CPU_AVR != 1
131 #error Internal CPU configuration error
135 #endif /* CPU_DETECT_H */