attr.h
Go to the documentation of this file.00001
00040 #ifndef CPU_ATTR_H
00041 #define CPU_ATTR_H
00042
00043 #include "detect.h"
00044
00045 #include "cfg/cfg_proc.h"
00046 #include "cfg/cfg_attr.h"
00047
00048
00053 #define CPU_BIG_ENDIAN 0x1234
00054 #define CPU_LITTLE_ENDIAN 0x3412
00055
00056
00058 #define CPU_HEADER(module) PP_STRINGIZE(drv/PP_CAT3(module, _, CPU_ID).h)
00059
00061 #define CPU_CSOURCE(module) PP_STRINGIZE(drv/PP_CAT3(module, _, CPU_ID).c)
00062
00063
00064 #if CPU_I196
00065
00066 #define NOP nop_instruction()
00067
00068 #define CPU_REG_BITS 16
00069 #define CPU_REGS_CNT 16
00070 #define CPU_BYTE_ORDER CPU_LITTLE_ENDIAN
00071 #define CPU_HARVARD 0
00072
00074 #define CPU_RAM_START 0x100
00075
00076 #elif CPU_X86
00077
00078 #define CPU_REGS_CNT 7
00079 #define CPU_BYTE_ORDER CPU_LITTLE_ENDIAN
00080 #define CPU_HARVARD 0
00081
00082 #if CPU_X86_64
00083 #define CPU_REG_BITS 64
00084
00085 #ifdef __WIN64__
00086
00087 #define SIZEOF_LONG 4
00088 #endif
00089 #else
00090 #define CPU_REG_BITS 32
00091 #endif
00092
00094 #define CPU_RAM_START 0x1000
00095
00096 #ifdef __GNUC__
00097 #define NOP asm volatile ("nop")
00098
00099 #define PAUSE asm volatile ("rep; nop" ::: "memory")
00100 #define BREAKPOINT asm volatile ("int3" ::)
00101 #endif
00102
00103 #elif CPU_ARM
00104
00105 #define CPU_REG_BITS 32
00106 #define CPU_REGS_CNT 16
00107 #define CPU_HARVARD 0
00108
00110 #if CPU_ARM_AT91
00111 #define CPU_RAM_START 0x00200000
00112 #else
00113 #warning Fix CPU_RAM_START address for your ARM, default value set to 0x200
00114 #define CPU_RAM_START 0x200
00115 #endif
00116
00117 #ifdef __IAR_SYSTEMS_ICC__
00118 #warning Check CPU_BYTE_ORDER
00119 #define CPU_BYTE_ORDER (__BIG_ENDIAN__ ? CPU_BIG_ENDIAN : CPU_LITTLE_ENDIAN)
00120
00121 #define NOP __no_operation()
00122
00123 #else
00124
00125 #if defined(__ARMEB__)
00126 #define CPU_BYTE_ORDER CPU_BIG_ENDIAN
00127 #elif defined(__ARMEL__)
00128 #define CPU_BYTE_ORDER CPU_LITTLE_ENDIAN
00129 #else
00130 #error Unable to detect ARM endianness!
00131 #endif
00132
00133 #define NOP asm volatile ("mov r0,r0" ::)
00134 #define BREAKPOINT
00135
00136 #if CONFIG_FAST_MEM
00137
00145 #define FAST_FUNC __attribute__((section(".data")))
00146
00152 #define FAST_RODATA __attribute__((section(".data")))
00153
00154 #else // !CONFIG_FAST_MEM
00155 #define FAST_RODATA
00156 #define FAST_FUNC
00157 #endif
00158
00159
00160
00161
00162 #define RAM_FUNC __attribute__((section(".data")))
00163
00164 #endif
00165
00166 #elif CPU_PPC
00167
00168 #define CPU_REG_BITS (CPU_PPC32 ? 32 : 64)
00169 #define CPU_REGS_CNT FIXME
00170 #define CPU_BYTE_ORDER (__BIG_ENDIAN__ ? CPU_BIG_ENDIAN : CPU_LITTLE_ENDIAN)
00171 #define CPU_HARVARD 0
00172
00174 #define CPU_RAM_START 0x1000
00175
00176 #ifdef __GNUC__
00177 #define NOP asm volatile ("nop" ::)
00178 #define BREAKPOINT asm volatile ("twge 2,2" ::)
00179 #endif
00180
00181 #elif CPU_DSP56K
00182
00183 #define CPU_REG_BITS 16
00184 #define CPU_REGS_CNT FIXME
00185 #define CPU_BYTE_ORDER CPU_BIG_ENDIAN
00186 #define CPU_HARVARD 1
00187
00188
00189 #define CPU_BITS_PER_CHAR 16
00190 #define SIZEOF_SHORT 1
00191 #define SIZEOF_INT 1
00192 #define SIZEOF_LONG 2
00193 #define SIZEOF_PTR 1
00194
00196 #define CPU_RAM_START 0x200
00197
00198 #define NOP asm(nop)
00199 #define BREAKPOINT asm(debug)
00200
00201 #elif CPU_AVR
00202
00203 #define NOP asm volatile ("nop" ::)
00204
00205 #define CPU_REG_BITS 8
00206 #define CPU_REGS_CNT 33
00207 #define CPU_BYTE_ORDER CPU_LITTLE_ENDIAN
00208 #define CPU_HARVARD 1
00209
00211 #if CPU_AVR_ATMEGA8 || CPU_AVR_ATMEGA32 || CPU_AVR_ATMEGA103
00212 #define CPU_RAM_START 0x60
00213 #elif CPU_AVR_ATMEGA64 || CPU_AVR_ATMEGA128 || CPU_AVR_ATMEGA168
00214 #define CPU_RAM_START 0x100
00215 #elif CPU_AVR_ATMEGA1281
00216 #define CPU_RAM_START 0x200
00217 #else
00218 #warning Fix CPU_RAM_START address for your AVR, default value set to 0x100
00219 #define CPU_RAM_START 0x100
00220 #endif
00221
00222 #else
00223 #error No CPU_... defined.
00224 #endif
00225
00226 #ifndef BREAKPOINT
00227 #define BREAKPOINT
00228 #endif
00229
00230 #ifndef FAST_FUNC
00232 #define FAST_FUNC
00233 #endif
00234
00235 #ifndef FAST_RODATA
00237 #define FAST_RODATA
00238 #endif
00239
00240 #ifndef PAUSE
00242 #define PAUSE {NOP; MEMORY_BARRIER;}
00243 #endif
00244
00245 #endif