Dmitry Diky wrote: > Fellows, > > In my application it is convenient to switch between IRQ and FIQ in some > interrupt service routine. > As I know FIQ mode used banked r8-r14 registers and no registers have to be > saved on stack (providing I want to have the things working :) > > So, when an IRQ interrupt occurs, I immediately enter to FIQ, then process my > interrupt request and then exit.. > > xxx_IRS: > msr cpsr_c, #MODE_FIQ|FIQ_BIT|IRQ_BIT ; @ switch to FIQ with ints dsbld. > ... ISR code ... > msr cpsr_c, #MODE_IRQ|FIQ_BIT|IRQ_BIT ; @ back to IRQ mode > sub pc,lr,#4 ; @ return from interrupt > > Everything seems to be working except I am not sure what happens to CPSR of > the user mode. As I understand, when nIRQ is asserted, CPSR being copied to > SPSR_irq and on IRQ exit SPSR_irq -> CPSR_usr. But what happens when I switch > to FIQ and back? Does the CPU core copy cpsr_irq to spsr_fiq and back > or... ??? In a few words: will be user's CPSR kept alive with such IRQ > servicing scheme? > > Thanks, > Dmitry. > Hi Dimitry, Uuuuuuuuuhhhhhhh, ... Are you sure you know what you are doing? FIQ- and IRQ-mode are dedicated modes for the two types of interrupts (FIQ and IRQ) ARM have. If you define an interrupt as a fast-IRQ (FIQ) than you have the goal that the system automatically enters FIQ mode and will save some additional registers when this interrupt occurs. If you define an (normal) IRQ your system will enter IRQ-mode. In opposite to other architectures ARM can perform a kind of hardware context switch by switching to another mode. In general you should NEVER change those modes manually in your software! These modes are changed by core itself when raising dedicated exceptions. There are only a few exceptions where to change it manually: e.g. after startup has finished you can switch form supervisor-mode to system-mode or user-mode before you enter application code. But in user-mode you will have only restricted access to system resources. This mode is dedicated for use with a RTOS which is protecting OS-layer from (evil) user-land applications. Sten -- /************************************************ Do you need a tiny and efficient real time operating system (RTOS) with a preemtive multitasking for LPC2000 or AT91SAM7? http://nanortos.net-attack.de/ Or some open-source tools and code for LPC2000? http://www.net-attack.de/ ************************************************/
Message
Re: [lpc2000] IRQ / FIQ status register general question.
2006-01-27 by Sten
Attachments
- No local attachments were found for this message.