| Details | Message |
|---|
Read-Only Author Varuzhan Danielyan Posted 1-Feb-2005 06:17 Toolset ARM |  Global Interruption Disable/Enable Varuzhan Danielyan Which is the easiest way for Global Interruptions Disable/Enable in CA for LPC2129?
Varuzhan |
|
Read-Only Author Keil Reinhard Posted 1-Feb-2005 07:05 Toolset ARM |  RE: Global Interruption Disable/Enable Keil Reinhard There are really two solutions to this problem.
1. If you need just a single routine that has the interrupt system disabled, you should write a __swi function. swi (= software interrupt) prevents that a function can be interrupted by an __irq. __fiq functions are not blocked.
2. For specific interrupt blocking see: http://www.keil.com/support/docs/2888.htm
Reinhard |
|
Read-Only Author Varuzhan Danielyan Posted 1-Feb-2005 12:01 Toolset ARM |  RE: Global Interruption Disable/Enable Varuzhan Danielyan As I understand, if program uses both IRQ and FIQ, the __swi function cannot be used. More, if I want to disable interruptions not for the whole function, but only for a part of code, I must write to the VICIntEnClr register as in the example. But in the example one need to disable only TIMER0 interruption. What if I need to disable all interruptions? If I write
temp = VICIntEnable; VICIntEnClr = temp; ... VICIntEnable = temp;
there is a risk, that if interruption happened between the two first operators, and the interrupt handler changes the value of the VICIntEnable register, a wrong value will be restored by the last operator. Am I wrong? Is there an absolutely reliable way to disable ALL interruptions for LPC2100? It is so easy in other microcontrollers.
Varuzhan |
|
Read-Only Author Keil Reinhard Posted 1-Feb-2005 12:05 Toolset ARM |  RE: Global Interruption Disable/Enable Keil Reinhard You are correct about the __swi, but why do you need to block an fiq?
It would be dangerous to change VICIntEnable in an interrupt function! You should not partice this programming style.
Reinhard |
|
Read-Only Author Varuzhan Danielyan Posted 1-Feb-2005 12:06 Toolset ARM |  RE: Global Interruption Disable/Enable Varuzhan Danielyan As I understand, if program uses both IRQ and FIQ, the __swi function cannot be used. More, if I want to disable interruptions not for the whole function, but only for a part of code, I must write to the VICIntEnClr register as in the example. But in the example one need to disable only TIMER0 interruption. What if I need to disable all interruptions? If I write
temp = VICIntEnable; VICIntEnClr = temp; ... VICIntEnable = temp;
there is a risk, that if interruption happened between the two first operators, and the interrupt handler changes the value of the VICIntEnable register, a wrong value will be restored by the last operator. Am I wrong? Is there an absolutely reliable way to disable ALL interruptions for LPC2100? It is so easy in other microcontrollers.
Varuzhan |
|
Read-Only Author Varuzhan Danielyan Posted 1-Feb-2005 12:13 Toolset ARM |  RE: Global Interruption Disable/Enable Varuzhan Danielyan I am sorry for repeating message - bad working telephone line. I agree about the bad stile. Then can I define two macros:
unsigned int temp; #define _DISABLE (temp = VICIntEnable; VICIntEnClr = temp);
#define _ENABLE (VICIntEnable = temp;)
and use them in my code?
Thank you, Varuzhan |
|
Read-Only Author Varuzhan Danielyan Posted 1-Feb-2005 12:21 Toolset ARM |  RE: Global Interruption Disable/Enable Varuzhan Danielyan Sure, without brackets |
|
Read-Only Author Keil Reinhard Posted 2-Feb-2005 01:00 Toolset ARM |  RE: Global Interruption Disable/Enable Keil Reinhard Each ARM controller is somehow different.
A generic solution to disable all interrupts is to set the CPSR I + F flag (similar code as documented under: http://www.keil.com/support/docs/2910.htm).
But tell my: why can you not use the __swi method?
Reinhard |
|
Read-Only Author Varuzhan Danielyan Posted 2-Feb-2005 02:04 Toolset ARM |  RE: Global Interruption Disable/Enable Varuzhan Danielyan Thank you very much! The __swi method is really nice, but sometimes one will not want to have a function call overhead to protect only a couple of instructions.
Another question: do the methods, mentioned in whole this topik, including the __swi, protect from Spurious Interrupts?
Varuzhan |
|
Read-Only Author Jon Ward Posted 2-Feb-2005 09:03 Toolset ARM |  RE: Global Interruption Disable/Enable Jon Ward The __swi method is really nice, but sometimes one will not want to have a function call overhead to protect only a couple of instructions.
Isn't the __swi call less code (and overhead) than disabling interrupts?
do the methods, mentioned in whole this topik, including the __swi, protect from Spurious Interrupts?
Masking interrupts inhibits interrupts (spurious or not). However, a spurious interrupt is an unexpected interrupt. Once interrupts are unmasked, the spurious interrupt triggers. Then, the interrupt handler will need to handle it.
Jon |
|