ARM Technical Support Knowledge Articles

DISABLING ALL INTERRUPTS (EA=0)

Applies to: RTX51 Real-time Kernel

Answer


Information in this article applies to:


QUESTION

What is the best way to disable all interrupts when working with RTX Full?

The os_disable_isr routine works well for individual interrupts, but I must disable all interrupts to protect a critical section in my application.

ANSWER

In many programs, a critical code section is a section of program code that may not be interrupted. These critical sections typically perform some operation that must be atomic in nature. The typical way to protect a critical section is to disable all interrupts before and re-enable them after the critical section.

The RTX51 documentation recommends against disabling all interrupts and direct manipulation of the interrupt enable register (specifically EA=0). However, there is no better way to disable all interrupts in an application. For example:

EA = 0;        // disable all interrupts
foo();         // your un-interruptible code sequence
               // foo() must not call any RTX51 routines
EA = 1;        // enable all interrupts

There are a few requirements you must consider if you disable and re-enable interrupts this way.

Note that the RTX51 kernel has no opportunity to interrupt the above sequence since the system timer interrupt (and any other interrupt) is blocked.

SEE ALSO

Article last edited on: 2007-04-13 07:06:56

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential