setjmp.h, time_t: Remove ancient retrocompatibility; Remove MSVC double to float...
[bertos.git] / cpu_detect.h
1 /*!
2  * \file
3  * <!--
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.
7  * -->
8  *
9  * \brief CPU detection through special preprocessor macros
10  *
11  */
12
13 /*#*
14  *#* $Log$
15  *#* Revision 1.4  2005/02/16 20:33:24  bernie
16  *#* Preliminary PPC support.
17  *#*
18  *#* Revision 1.3  2004/12/31 17:39:26  bernie
19  *#* Use C89 comments only.
20  *#*
21  *#* Revision 1.2  2004/08/25 14:12:08  rasky
22  *#* Aggiornato il comment block dei log RCS
23  *#*
24  *#* Revision 1.1  2004/07/30 17:14:49  rasky
25  *#* File sfuggito al commit precedente (nuova gestione unificata del detect della CPU
26  *#*
27  *#* Revision 1.2  2004/07/30 10:31:07  rasky
28  *#* Aggiunto detect per ATmega128
29  *#*/
30
31 #ifndef CPU_DETECT_H
32 #define CPU_DETECT_H
33
34 #if defined(__IAR_SYSTEMS_ICC) || defined(__IAR_SYSTEMS_ICC__)
35         #define CPU_I196                1
36         #define CPU_ID                  i196
37 #else
38         #define CPU_I196                0
39 #endif
40
41 #if defined(__i386__) || defined(_MSC_VER)
42         #define CPU_X86                 1
43         #define CPU_ID                  x86
44 #else
45         #define CPU_X86                 0
46 #endif
47
48 #if defined (_ARCH_PPC) || defined(_ARCH_PPC64)
49         #define CPU_PPC                 1
50         #define CPU_ID                  ppc
51         #if defined(_ARCH_PPC)
52                 #define CPU_PPC32       1
53         #else
54                 #define CPU_PPC32       0
55         #endif
56         #if defined(_ARCH_PPC64)
57                 #define CPU_PPC64       1
58         #else
59                 #define CPU_PPC64       0
60         #endif
61 #else
62         #define CPU_PPC                 0
63         #define CPU_PPC32               0
64         #define CPU_PPC64               0
65 #endif
66
67 #if defined(__m56800E__) || defined(__m56800__)
68         #define CPU_DSP56K              1
69         #define CPU_ID                  dsp56k
70 #else
71         #define CPU_DSP56K              0
72 #endif
73
74 #if defined (__AVR__)
75         #define CPU_AVR                 1
76         #define CPU_ID                  avr
77
78         #if defined(__AVR_ATmega64__)
79                 #define CPU_AVR_ATMEGA64    1
80         #else
81                 #define CPU_AVR_ATMEGA64    0
82         #endif
83
84         #if defined(__AVR_ATmega103__)
85                 #define CPU_AVR_ATMEGA103   1
86         #else
87                 #define CPU_AVR_ATMEGA103   0
88         #endif
89
90         #if defined(__AVR_ATmega128__)
91                 #define CPU_AVR_ATMEGA128   1
92         #else
93                 #define CPU_AVR_ATMEGA128   0
94         #endif
95
96         #if defined(__AVR_ATmega8__)
97                 #define CPU_AVR_ATMEGA8     1
98         #else
99                 #define CPU_AVR_ATMEGA8     0
100         #endif
101 #else
102         #define CPU_AVR                 0
103         #define CPU_AVR_ATMEGA8         0
104         #define CPU_AVR_ATMEGA64        0
105         #define CPU_AVR_ATMEGA103       0
106         #define CPU_AVR_ATMEGA128       0
107 #endif
108
109
110 /* Self-check for the detection: only one CPU must be detected */
111 #if CPU_I196 + CPU_X86 + CPU_PPC + CPU_DSP56K + CPU_AVR == 0
112         #error Unknown CPU
113 #elif !defined(CPU_ID)
114         #error CPU_ID not defined
115 #elif CPU_I196 + CPU_X86 + CPU_PPC + CPU_DSP56K + CPU_AVR != 1
116         #error Internal CPU configuration error
117 #endif
118
119
120 #endif /* CPU_DETECT_H */