[ECOS] cyg_interrupt_disable/enable question
Gary Thomas
gthomas@ecoscentric.com
Sat Sep 21 11:10:00 GMT 2002
On Sat, 2002-09-21 at 10:46, andy.tenka@delphiauto.com wrote:
>
>
> Do cyg_interrupt_enable and cyg_interrupt_disable always have to have a 1-1
> correspondence?
>
> In other words, if we call cyg_interrupt_disable twice, and call
> cyg_interrupt_enable once, will the
> interrupts be enabled? (I realize that this is not a clean thing to do, this is
> just an academic question).
These functions are not "tied" in any way.
HAL_ENABLE_INTERRUPTS() - enables the interrupts, no matter what
HAL_DISABLE_INTERRUPTS() - disables them, no matter what
If you want to disable interrupts and then restore the previous
interrupt state, use this sequence:
cyg_uint32 old;
HAL_DISABLE_INTERRUPTS(old);
...
HAL_RESTORE_INTERRUPTS(old);
Note: this is often not necessary - simply disabling scheduling is
often a better choice:
cyg_scheduler_lock();
...
cyg_scheduler_unlock();
--
------------------------------------------------------------
Gary Thomas |
eCosCentric, Ltd. |
+1 (970) 229-1963 | eCos & RedBoot experts
gthomas@ecoscentric.com |
http://www.ecoscentric.com/ |
------------------------------------------------------------
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss
More information about the Ecos-discuss
mailing list