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 Marcus and John also for responding so quickly
TO Marcus -
From ur help also i got a clear idea. it works fine if my code is running in privileged mode.
My question is If my code is not running in non privileged mode, How to change to privileged mode?
If my code is running in USR mode i can not alter CPSR bits so can not change MODE from USR to SUPERVISOR.
So how to change the mode from USR to SUPERVISOR.
Thanx In Advance
> So how to change the mode from USR to SUPERVISOR.
Have a look at the SVC instruction.
-- Marcus