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: Interrupt on ARM


>>>>> "Jacques" == Jacques Ehrlich <ehrlich@lcpc.fr> writes:

    Jacques> Hi !
    Jacques> I'm trying to handle hardware interrupt from external IRQ lines on ARM E7T,
    Jacques> using ecos kernel API :
    Jacques> - void cyg_interrupt_create
    Jacques> - void cyg_interrupt_attach
    Jacques> - void cyg_interrupt_enable
    Jacques> - etc...
    Jacques> but without success.
    Jacques> Where can I find a simple example of source code ?
    Jacques> Below is an abstract of my code :

    Jacques> cyg_uint32 myISR(cyg_vector_t vector, cyg_addrword_t data)
    Jacques> {
                <snip>
    Jacques> 	return 0;
    Jacques> }

Minor point. That return code should usually be either CYG_ISR_HANDLED
or CYG_ISR_CALL_DSR, unless the hardware requires chained interrupts.

    Jacques> cyg_interrupt_create((cyg_vector_t)CYGNUM_HAL_VECTOR_IRQ, 0, 0, myISR,
    Jacques>                      myDSR, &handle, &intr);

I think the problem here is with the use of CYGNUM_HAL_VECTOR_IRQ. You
have misunderstood the meaning of eCos interrupt vectors.

A typical ARM target has an interrupt controller, either on-chip or
external. The various devices such as clock, serial, ethernet, ...
have their interrupt lines connected to the interrupt controller. The
interrupt controller is in turn connected to the main processor's IRQ
pin. When any device requests an interrupt, the interrupt controller
signals the IRQ pin. The interrupt controller allows various interrupt
sources to be masked, etc. A typical interrupt controller will support
something like 32 interrupt lines, numbered 0-31. Those numbers are
the interrupt vectors that get passed to cyg_interrupt_create(),
cyg_interrupt_mask(), etc.

When the processor receives an IRQ interrupt from the controller,
it switches to an eCos vector service routine or VSR for IRQ's. That
VSR sets up an environment suitable for calling C code. Then it looks
at the interrupt controller to find out which device actually
interrupted, and calls the associated interrupt handler. eCos does
allow applications to install a replacement VSR, and
CYGNUM_HAL_VECTOR_IRQ would be used for that purpose.

The exact details of which vectors are associated with which device
depend on the target, since different targets will have different
interrupt controllers and the various devices may be wired to
different pins on the interrupt controller. Looking at some existing
device drivers may help.

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]