Hi
I am new TO ARM7 And KEIL uVISION4 IDE.
I am using AT91FR40162S ATMEL COntroller.
When i created a project using KEIL IDE and selected AT91FR40162S ATMEL COntroller from the device list. Automatically startup.s file is added to the project.
In startup.s file Interrupts are Enabled and Disabled by following assembly code:
To Disable the interrupts
I_Bit EQU 0x80 ; when I bit is set, IRQ is disabled F_Bit EQU 0x40 ; when F bit is set, FIQ is disabled
; Enter Undefined Instruction Mode and set its Stack Pointer
MSR CPSR_c, #Mode_UND:OR:I_Bit:OR:F_Bit so interrupts are disabled here as corresponding bits in CPSR are set.
To Enable the interrupts
; Enter User Mode and set its Stack Pointer MSR CPSR_c, #Mode_USR
So interrupts are enabled
then after all the settings in startup.s it will jump to main.c file
QUESTION:
1. I want to enable and disable the interrupts in my main.c file. So How will i be able to access the CPSR register in my c coding.
Thanx a Lot Martin
I got the idea from ur code. But i need to be in supervisor mode to alter the CPSR register.
When i entered to the main function i was in USR mode so was not able to alter the CPSR register.
I want to know if i am in USR mode in my application main.c then if i want to change the CPSR register i need to change the MODE to SUPERVISOR mode.
So To alter CPSR bits How to change from USR mode to SUPERVISOR mode.
Thanx a lot in advance