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 */
30 #if defined(__i386__) /* GCC */ \
31 || (defined(_M_IX86) && !defined(_WIN64)) /* MSVC */
36 #elif defined(__x86_64__) /* GCC */ \
37 || (defined(_M_IX86) && defined(_WIN64)) /* MSVC */
48 #if defined (_ARCH_PPC) || defined(_ARCH_PPC64)
51 #if defined(_ARCH_PPC)
56 #if defined(_ARCH_PPC64)
67 #if defined(__m56800E__) || defined(__m56800__)
78 #if defined(__AVR_ATmega64__)
79 #define CPU_AVR_ATMEGA64 1
81 #define CPU_AVR_ATMEGA64 0
84 #if defined(__AVR_ATmega103__)
85 #define CPU_AVR_ATMEGA103 1
87 #define CPU_AVR_ATMEGA103 0
90 #if defined(__AVR_ATmega128__)
91 #define CPU_AVR_ATMEGA128 1
93 #define CPU_AVR_ATMEGA128 0
96 #if defined(__AVR_ATmega8__)
97 #define CPU_AVR_ATMEGA8 1
99 #define CPU_AVR_ATMEGA8 0
102 #if defined(__AVR_ATmega168__)
103 #define CPU_AVR_ATMEGA168 1
105 #define CPU_AVR_ATMEGA168 0
108 #if defined(__AVR_ATmega1281__)
109 #define CPU_AVR_ATMEGA1281 1
111 #define CPU_AVR_ATMEGA1281 0
115 #define CPU_AVR_ATMEGA8 0
116 #define CPU_AVR_ATMEGA168 0
117 #define CPU_AVR_ATMEGA64 0
118 #define CPU_AVR_ATMEGA103 0
119 #define CPU_AVR_ATMEGA128 0
120 #define CPU_AVR_ATMEGA1281 0
124 /* Self-check for the detection: only one CPU must be detected */
125 #if CPU_ARM + CPU_I196 + CPU_X86 + CPU_PPC + CPU_DSP56K + CPU_AVR == 0
127 #elif !defined(CPU_ID)
128 #error CPU_ID not defined
129 #elif CPU_ARM + CPU_I196 + CPU_X86 + CPU_PPC + CPU_DSP56K + CPU_AVR != 1
130 #error Internal CPU configuration error
134 #endif /* CPU_DETECT_H */