00001
00038 #ifndef CPU_REGS_H_INCLUDED
00039 #define CPU_REGS_H_INCLUDED
00040
00041 #define XMEGA_CPU_BASE 0x30 //!< Base address of CPU registers
00042
00043 #define CPUR_CCP 0x04 //!< Configuration Change Protection
00044 #define CPUR_RAMPD 0x08 //!< Extended Direct Address
00045 #define CPUR_RAMPX 0x09 //!< Extended X Pointer
00046 #define CPUR_RAMPY 0x0a //!< Extended Y Pointer
00047 #define CPUR_RAMPZ 0x0b //!< Extended Z Pointer
00048 #define CPUR_EIND 0x0c //!< Extended Indirect
00049 #define CPUR_SPL 0x0d //!< Stack Pointer Low
00050 #define CPUR_SPH 0x0e //!< Stack Pointer High
00051 #define CPUR_SREG 0x0f //!< Status Register
00052 # define CPUR_SREG_I (1 << 7) //!< Interrupt Enable
00053 # define CPUR_SREG_T (1 << 6) //!< Bit Copy Storage
00054 # define CPUR_SREG_H (1 << 5) //!< Half Carry
00055 # define CPUR_SREG_S (1 << 4) //!< Sign
00056 # define CPUR_SREG_V (1 << 3) //!< Overflow
00057 # define CPUR_SREG_N (1 << 2) //!< Negative
00058 # define CPUR_SREG_Z (1 << 1) //!< Zero
00059 # define CPUR_SREG_C (1 << 0) //!< Carry
00060
00062 #define CPU_REG(name) (XMEGA_CPU_BASE + CPUR_##name)
00063
00064
00065 #define CCP_SPM 0x9D
00066 #define CCP_IOREG 0xD8
00067
00068 #ifndef __ASSEMBLY__
00069
00070 #include <io.h>
00071
00075 #define cpu_read_reg8(reg) \
00076 mmio_read8((void *)(XMEGA_CPU_BASE + CPUR_##reg))
00077
00081 #define cpu_write_reg8(reg, value) \
00082 mmio_write8((void *)(XMEGA_CPU_BASE + CPUR_##reg), value)
00083
00084 #else
00085
00086
00087 #define LD_CPUREG(val, name) in val, XMEGA_CPU_BASE + CPUR_##name
00088 #define ST_CPUREG(val, name) out XMEGA_CPU_BASE + CPUR_##name, val
00089
00090 #endif
00091
00092 #endif