This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: cyg_interrupt_disable/enable question
- From: Gary Thomas <gthomas at ecoscentric dot com>
- To: andy dot tenka at delphiauto dot com
- Cc: eCos Discussion <ecos-discuss at sources dot redhat dot com>
- Date: 21 Sep 2002 11:52:09 -0600
- Subject: Re: [ECOS] cyg_interrupt_disable/enable question
- References: <05256C3B.005C7509.00@notes.delphiauto.com>
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