Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] What's Best Way to Globally Disable Interrupts

2005-05-02 by Robert Adsett

At 07:30 PM 5/2/05 +0000, kaiandxiulpc2000 wrote:
>If my user application is running with interrupts occurring, then I
>need to disable all interrupts for a bit of time:
>
>1) Should I use the C command "VICIntEnable=0x00000000"?
>OR
>2) Set the IRQ and FIQ bits in the cpsr?  Also, then do I have to be
>in
>non-user mode (i.e. privileged mode) to enable/disable the IRQ/FIQ
>bits
>in the cpsr?

In my opinion number 2 will cause you the least problems.  In fact I would 
disable interrupts before modifying VICIntEnable. And yes you have to be in 
a mode other than user mode.  On the other hand there is no reason to be in 
user mode anyway.  The only thing that distinguishes user mode from system 
mode is that in user mode is that in user mode you cannot set and clear the 
interrupt enable bits.

Personally I prefer a disable/restore interrupt pair rather than a 
disable/enable interrupt pair.  There is an implementation of the former in 
the newlib-lpc library that should be easily separable from that library if 
desired.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,   be 
they legal, genetic, or physical.  If you don't believe me, try to chew a 
radio signal. "  -- Kelvin Throop, III
http://www.aeolusdevelopment.com/

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.