RTX51: DISABLING ALL INTERRUPTS (EA=0)
Information in this article applies to:
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.
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.
Last Reviewed: Friday, April 13, 2007
of your data.