This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cyg_interrupt_disable/enable question


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]