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: Bart Veer <bartv at ecoscentric dot com>
- To: andy dot tenka at delphiauto dot com
- Cc: ecos-discuss at sources dot redhat dot com
- Date: Sat, 21 Sep 2002 20:11:07 +0100 (BST)
- Subject: Re: [ECOS] cyg_interrupt_disable/enable question
- References: <05256C3B.005C7509.00@notes.delphiauto.com>
>>>>> "Andy" == andy tenka <andy.tenka@delphiauto.com> writes:
Andy> Do cyg_interrupt_enable and cyg_interrupt_disable always
Andy> have to have a 1-1 correspondence?
At the kernel level, yes. The kernel maintains a counter for disable
and enable calls, and only invokes the underlying HAL routines when
the counter is 0. This is important for SMP systems.
At the HAL level, HAL_DISABLE_INTERRUPTS() and HAL_ENABLE_INTERRUPTS()
operate directly on the hardware and do not involve any counting.
Andy> In other words, if we call cyg_interrupt_disable twice, and
Andy> call cyg_interrupt_enable once, will the interrupts be
Andy> enabled? (I realize that this is not a clean thing to do,
Andy> this is just an academic question).
Interrupts would not be enabled.
>>>>> "Andy" == andy tenka <andy.tenka@delphiauto.com> writes:
Andy> One followup question:
Andy> Does cyg_disable_interrupt also mask the scheduler interrupt
Andy> (ie, disables the scheduler)?
No, but it is not usually an issue. Locking the scheduler would
stop the current thread being preempted if an I/O operation completes
and the ISR/DSR wake up a higher-priority thread. Disabling interrupts
implicitly prevents preemption by not allowing the ISR/DSR to run.
Bart
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss