X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=cfg%2Fcpu.h;h=949282150a6f54ebc65dbfc0b87b1032a7353203;hb=f7759618132fca8a34d8a02dc6d0acf0474e6ca1;hp=75ea08630a6c38a6185cf2e1c968c880e2d0410a;hpb=c020793ac02a12dc390df81e90344a9a16056d0e;p=bertos.git diff --git a/cfg/cpu.h b/cfg/cpu.h index 75ea0863..94928215 100755 --- a/cfg/cpu.h +++ b/cfg/cpu.h @@ -17,6 +17,21 @@ /*#* *#* $Log$ + *#* Revision 1.14 2006/07/19 12:54:12 bernie + *#* Documentation fixes. + *#* + *#* Revision 1.13 2006/03/27 04:49:23 bernie + *#* CPU_IDLE(): Fix for new emulator. + *#* + *#* Revision 1.12 2006/03/21 10:52:39 bernie + *#* Update ARM support. + *#* + *#* Revision 1.11 2006/03/20 17:49:00 bernie + *#* Spacing fix. + *#* + *#* Revision 1.10 2006/02/24 01:17:30 bernie + *#* CPU_SAVED_REGS_CNT: Declare for x86/x86_64. + *#* *#* Revision 1.9 2006/02/23 09:08:43 bernie *#* Add note for a frequently reported non-bug. *#* @@ -66,9 +81,10 @@ #define DEVLIB_CPU_H #include /* for uintXX_t */ +#include /* ARCH_EMUL */ -/*! +/** * \name Macros for determining CPU endianness. * \{ */ @@ -76,10 +92,10 @@ #define CPU_LITTLE_ENDIAN 0x3412 /* Look twice, pal. This is not a bug. */ /*\}*/ -/*! Macro to include cpu-specific versions of the headers. */ +/** Macro to include cpu-specific versions of the headers. */ #define CPU_HEADER(module) PP_STRINGIZE(PP_CAT3(module, _, CPU_ID).h) -/*! Macro to include cpu-specific versions of implementation files. */ +/** Macro to include cpu-specific versions of implementation files. */ #define CPU_CSOURCE(module) PP_STRINGIZE(PP_CAT3(module, _, CPU_ID).c) @@ -115,6 +131,7 @@ #define CPU_REGS_CNT 7 + #define CPU_SAVED_REGS_CNT 7 #define CPU_STACK_GROWS_UPWARD 0 #define CPU_SP_ON_EMPTY_SLOT 0 #define CPU_BYTE_ORDER CPU_LITTLE_ENDIAN @@ -135,29 +152,52 @@ #elif CPU_ARM + typedef uint32_t cpuflags_t; + typedef uint32_t cpustack_t; + + /* Register counts include SREG too */ + #define CPU_REG_BITS 32 + #define CPU_REGS_CNT 16 + #define CPU_SAVED_REGS_CNT FIXME + #define CPU_STACK_GROWS_UPWARD 0 //FIXME + #define CPU_SP_ON_EMPTY_SLOT 0 //FIXME + #define CPU_BYTE_ORDER (__BIG_ENDIAN__ ? CPU_BIG_ENDIAN : CPU_LITTLE_ENDIAN) + #define CPU_HARVARD 0 + #ifdef __IAR_SYSTEMS_ICC__ #include + #if __CPU_MODE__ == 1 /* Thumb */ + /* Use stubs */ + extern cpuflags_t get_CPSR(void); + extern void set_CPSR(cpuflags_t flags); + #else + #define get_CPSR __get_CPSR + #define set_CPSR __set_CPSR + #endif + #define NOP __no_operation() #define IRQ_DISABLE __disable_interrupt() #define IRQ_ENABLE __enable_interrupt() #define IRQ_SAVE_DISABLE(x) \ do { \ - (x) = __get_CPSR(); \ + (x) = get_CPSR(); \ __disable_interrupt(); \ } while (0) #define IRQ_RESTORE(x) \ do { \ - __set_CPSR(x); \ + set_CPSR(x); \ } while (0) #define IRQ_GETSTATE() \ - ((bool)(__get_CPSR() & 0xb0)) + ((bool)(get_CPSR() & 0xb0)) - #else /* __IAR_SYSTEMS_ICC__ */ + #define BREAKPOINT /* asm("bkpt 0") DOES NOT WORK */ + + #else /* !__IAR_SYSTEMS_ICC__ */ #warning "IRQ_ macros need testing!" @@ -222,18 +262,6 @@ #endif /* __IAR_SYSTEMS_ICC_ */ - typedef uint32_t cpuflags_t; - typedef uint32_t cpustack_t; - - /* Register counts include SREG too */ - #define CPU_REG_BITS 32 - #define CPU_REGS_CNT 16 - #define CPU_SAVED_REGS_CNT FIXME - #define CPU_STACK_GROWS_UPWARD 0 //FIXME - #define CPU_SP_ON_EMPTY_SLOT 0 //FIXME - #define CPU_BYTE_ORDER (__BIG_ENDIAN__ ? CPU_BIG_ENDIAN : CPU_LITTLE_ENDIAN) - #define CPU_HARVARD 0 - #elif CPU_PPC #define NOP asm volatile ("nop" ::) @@ -446,7 +474,7 @@ #else #define CPU_PUSH_CALL_CONTEXT(sp, func) \ - CPU_PUSH_WORD((sp), (func)) + CPU_PUSH_WORD((sp), (cpustack_t)(func)) #endif @@ -557,15 +585,12 @@ STATIC_ASSERT(sizeof(uint64_t) * CPU_BITS_PER_CHAR == 64); #if defined(ARCH_EMUL) && (ARCH & ARCH_EMUL) /* This emulator hook should yield the CPU to the host. */ EXTERN_C_BEGIN - void SchedulerIdle(void); + void emul_idle(void); EXTERN_C_END - #define CPU_IDLE SchedulerIdle() + #define CPU_IDLE emul_idle() #else /* !ARCH_EMUL */ #define CPU_IDLE do { /* nothing */ } while (0) #endif /* !ARCH_EMUL */ #endif /* !CPU_IDLE */ -/* OBSOLETE */ -#define SCHEDULER_IDLE CPU_IDLE - #endif /* DEVLIB_CPU_H */