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: a couple of ARM7 quirks...


>>>>> "Jim" == jyl087  <jyl087@netscape.net> writes:

    Jim> With eCos 2.0 on an ARM7 platform (my own HAL), I'm seeing
    Jim> a couple of strange things that I wonder if others have seen:

    Jim> 1. My HAL_DISABLE_INTERRUPT function works just fine, but
    Jim> when I attempt to use cyg_interrupt_disable(), interrupts
    Jim> don't seem to stop. I tried following the code for the
    Jim> cyg_interrupt_disable() function, but I'm not sure how it
    Jim> works. This may be a shortcoming of my HAL, but any ideas on
    Jim> this?

I did not write the relevant kernel code, but I took a look:

cyg_interrupt_disable() became a bit more complicated when the SMP
support was added. The implementation is in
kernel/current/src/common/kapi.cxx, which just calls the underlying
C++ kernel function Cyg_Interrupt::disable_interrupts().

Cyg_Interrupt::disable_interrupts() can be found in
kernel/current/src/intr/intr.cxx. That manipulates a counter and, if
appropriate, calls spin_intsave(). Note that at the kernel level
interrupt enabling/disabling is counted, so if there are two calls to
disable interrupts in succession then there must be two calls to
reenable them. Enabling interrupts when they are already disabled will
trigger an assertion failure.

spin_intsave() is in kernel/current/include/smp.hxx, and essentially
just invokes the HAL macro.

If the HAL macro works but the kernel functions don't, the most
probable explanation is that something is going wrong with the
counter. Maybe it is not being initialized properly by the HAL - the
counter is static data so should be in the bss section and hence
automatically zeroed. Or maybe there is a spurious call to
cyg_enable_interrupts() somewhere and you are running with assertions
disabled - if you are still getting the HAL working then assertions
should definitely be enabled.

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]