#define SYS32Mode 0x1F #define IRQ32Mode 0x12 #define FIQ32Mode 0x11 #define I_Bit 0x80 ; when I bit is set, IRQ is disabled #define F_Bit 0x40 ; when F bit is set, FIQ is disabled #define IAPMode 0x92 ;(IRQ32Mode|I_Bit)
static unsigned int sysreg; /* used as LR register */ #define IENABLE __asm { MRS sysreg, SPSR; MSR CPSR_c, #SYS32Mode; } #define IDISABLE __asm { MSR CPSR_c, #0x92; MSR SPSR_cxsf, sysreg; }
const unsigned int LED=(1<<24); //P1.24控制LED,低电平点亮