From f1710d97efaf32c5e0ff00432b6b9e80d69e1c50 Mon Sep 17 00:00:00 2001 From: rasky Date: Fri, 30 Jul 2004 17:14:49 +0000 Subject: [PATCH] File sfuggito al commit precedente (nuova gestione unificata del detect della CPU git-svn-id: https://src.develer.com/svnoss/bertos/trunk@96 38d2e660-2303-0410-9eaa-f027e97ec537 --- cpu_detect.h | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100755 cpu_detect.h diff --git a/cpu_detect.h b/cpu_detect.h new file mode 100755 index 00000000..94b05680 --- /dev/null +++ b/cpu_detect.h @@ -0,0 +1,99 @@ +/*! + * \file + * + * + * \brief CPU detection through special preprocessor macros + * + */ + +/* + * $Log$ + * Revision 1.1 2004/07/30 17:14:49 rasky + * File sfuggito al commit precedente (nuova gestione unificata del detect della CPU + * + * Revision 1.2 2004/07/30 10:31:07 rasky + * Aggiunto detect per ATmega128 + * + * Revision 1.1 2004/07/22 16:37:34 rasky + * Nuovo file cpu_detect.h per il detect della CPU + * Nuova macro CPU_HEADER per includere l'header cpu-specific di ogni modulo + * Razionalizzazione dei principali #ifdef per piattaforma con le nuove macro + * Nuove macro-utility PP_STRINGIZE e PP_CATn + * + */ + +#ifndef CPU_DETECT_H +#define CPU_DETECT_H + +#if defined(__IAR_SYSTEMS_ICC) || defined(__IAR_SYSTEMS_ICC__) + #define CPU_I196 1 + #define CPU_ID i196 +#else + #define CPU_I196 0 +#endif + +#if defined(__i386__) || defined(_MSC_VER) + #define CPU_X86 1 + #define CPU_ID x86 +#else + #define CPU_X86 0 +#endif + +#if defined(__m56800E__) || defined(__m56800__) + #define CPU_DSP56K 1 + #define CPU_ID dsp56k +#else + #define CPU_DSP56K 0 +#endif + +#if defined (__AVR__) + #define CPU_AVR 1 + #define CPU_ID avr + + #if defined(__AVR_ATmega64__) + #define CPU_AVR_ATMEGA64 1 + #else + #define CPU_AVR_ATMEGA64 0 + #endif + + #if defined(__AVR_ATmega103__) + #define CPU_AVR_ATMEGA103 1 + #else + #define CPU_AVR_ATMEGA103 0 + #endif + + #if defined(__AVR_ATmega128__) + #define CPU_AVR_ATMEGA128 1 + #else + #define CPU_AVR_ATMEGA128 0 + #endif + + #if defined(__AVR_ATmega8__) + #define CPU_AVR_ATMEGA8 1 + #else + #define CPU_AVR_ATMEGA8 0 + #endif +#else + #define CPU_AVR 0 + #define CPU_AVR_ATMEGA8 0 + #define CPU_AVR_ATMEGA64 0 + #define CPU_AVR_ATMEGA103 0 + #define CPU_AVR_ATMEGA128 0 +#endif + + +// Self-check for the detection: only one CPU must be detected +#if CPU_I196 + CPU_X86 + CPU_DSP56K + CPU_AVR == 0 + #error Unknown CPU +#elif !defined(CPU_ID) + #error CPU_ID not defined +#elif CPU_I196 + CPU_X86 + CPU_DSP56K + CPU_AVR != 1 + #error Internal CPU configuration error +#endif + + +#endif /* CPU_DETECT_H */ -- 2.25.1