Disable LaTeX output.
[bertos.git] / cpu_detect.h
1 /*!
2  * \file
3  * <!--
4  * Copyright 2004 Develer S.r.l. (http://www.develer.com/)
5  * Copyright 2004 Giovanni Bajo
6  * This file is part of DevLib - See devlib/README for information.
7  * -->
8  *
9  * \brief CPU detection through special preprocessor macros
10  *
11  */
12
13 /*#*
14  *#* $Log$
15  *#* Revision 1.3  2004/12/31 17:39:26  bernie
16  *#* Use C89 comments only.
17  *#*
18  *#* Revision 1.2  2004/08/25 14:12:08  rasky
19  *#* Aggiornato il comment block dei log RCS
20  *#*
21  *#* Revision 1.1  2004/07/30 17:14:49  rasky
22  *#* File sfuggito al commit precedente (nuova gestione unificata del detect della CPU
23  *#*
24  *#* Revision 1.2  2004/07/30 10:31:07  rasky
25  *#* Aggiunto detect per ATmega128
26  *#*
27  *#* Revision 1.1  2004/07/22 16:37:34  rasky
28  *#* Nuovo file cpu_detect.h per il detect della CPU
29  *#* Nuova macro CPU_HEADER per includere l'header cpu-specific di ogni modulo
30  *#* Razionalizzazione dei principali #ifdef per piattaforma con le nuove macro
31  *#* Nuove macro-utility PP_STRINGIZE e PP_CATn
32  *#*
33  *#*/
34
35 #ifndef CPU_DETECT_H
36 #define CPU_DETECT_H
37
38 #if defined(__IAR_SYSTEMS_ICC) || defined(__IAR_SYSTEMS_ICC__)
39         #define CPU_I196                1
40         #define CPU_ID                  i196
41 #else
42         #define CPU_I196                0
43 #endif
44
45 #if defined(__i386__) || defined(_MSC_VER)
46         #define CPU_X86                 1
47         #define CPU_ID                  x86
48 #else
49         #define CPU_X86                 0
50 #endif
51
52 #if defined(__m56800E__) || defined(__m56800__)
53         #define CPU_DSP56K              1
54         #define CPU_ID                  dsp56k
55 #else
56         #define CPU_DSP56K              0
57 #endif
58
59 #if defined (__AVR__)
60         #define CPU_AVR                 1
61         #define CPU_ID                  avr
62
63         #if defined(__AVR_ATmega64__)
64                 #define CPU_AVR_ATMEGA64    1
65         #else
66                 #define CPU_AVR_ATMEGA64    0
67         #endif
68
69         #if defined(__AVR_ATmega103__)
70                 #define CPU_AVR_ATMEGA103   1
71         #else
72                 #define CPU_AVR_ATMEGA103   0
73         #endif
74
75         #if defined(__AVR_ATmega128__)
76                 #define CPU_AVR_ATMEGA128   1
77         #else
78                 #define CPU_AVR_ATMEGA128   0
79         #endif
80
81         #if defined(__AVR_ATmega8__)
82                 #define CPU_AVR_ATMEGA8     1
83         #else
84                 #define CPU_AVR_ATMEGA8     0
85         #endif
86 #else
87         #define CPU_AVR                 0
88         #define CPU_AVR_ATMEGA8         0
89         #define CPU_AVR_ATMEGA64        0
90         #define CPU_AVR_ATMEGA103       0
91         #define CPU_AVR_ATMEGA128       0
92 #endif
93
94
95 /* Self-check for the detection: only one CPU must be detected */
96 #if CPU_I196 + CPU_X86 + CPU_DSP56K + CPU_AVR == 0
97         #error Unknown CPU
98 #elif !defined(CPU_ID)
99         #error CPU_ID not defined
100 #elif CPU_I196 + CPU_X86 + CPU_DSP56K + CPU_AVR != 1
101         #error Internal CPU configuration error
102 #endif
103
104
105 #endif /* CPU_DETECT_H */