X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=cfg%2Fcpu.h;h=9b9d31430fea3bc9dbe30d805a4c3493334f65b8;hb=6b2099c56772961182353617a8d4b839f6a1a6db;hp=b008247f0164fc2873ddf4cec316a95f3be94215;hpb=da0fda5198f56324a65f57b65a1dd7bc0f72e8ff;p=bertos.git diff --git a/cfg/cpu.h b/cfg/cpu.h index b008247f..9b9d3143 100755 --- a/cfg/cpu.h +++ b/cfg/cpu.h @@ -17,6 +17,12 @@ /*#* *#* $Log$ + *#* 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. *#* @@ -72,6 +78,7 @@ #define DEVLIB_CPU_H #include /* for uintXX_t */ +#include /* ARCH_EMUL */ /*! @@ -142,29 +149,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)) + + #define BREAKPOINT /* asm("bkpt 0") DOES NOT WORK */ - #else /* __IAR_SYSTEMS_ICC__ */ + #else /* !__IAR_SYSTEMS_ICC__ */ #warning "IRQ_ macros need testing!" @@ -229,18 +259,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" ::) @@ -564,15 +582,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 */