Hello, I have take a piece of source at http://www.arm.com and tried to compile it using the CARM compiler. The code is shown below:
/* NewState=1 will enable IRQ, NewState=0 will disable IRQ */ /* ARM core must be in a privileged mode, e.g. supervisor */ void ChangeIRQ(unsigned int NewState) { int my_cpsr; __asm { MRS my_cpsr, CPSR /* get current program status */ ORR my_cpsr, my_cpsr,#0x80 /* set IRQ disable bit flag */ BIC my_cpsr, my_cpsr, NewState, LSL #7 /* reset IRQ bit with new value */ MSR CPSR_c, my_cpsr /* store updated program status */ } } void main(void) { __asm{MSR CPSR_c, #0x13} //Go into Supervisor Mode ChangeIRQ(0); while(1) { } }
Ok, thanks I didn't know that. I just thought that when they said at ARM.com, that this was the properly way to do it, when in ARM mode and in SUPERVISOR mode, it could be done. Sorry, but I don't know assembly yet, so i'm a bit green when it comes to using inline. You shouldn't have some code laying for disabling interrupt using code for the CARM compiler then?