This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: Use of IRQ on ARM
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Francesco Regazzoni <regazzoni at alari dot ch>
- Cc: ecos-discuss at sourceware dot org
- Date: Fri, 24 Feb 2006 23:00:21 +0100
- Subject: Re: [ECOS] Use of IRQ on ARM
- References: <43FF6A23.3030906@alari.ch>
On Fri, Feb 24, 2006 at 03:18:43PM -0500, Francesco Regazzoni wrote:
> Hi,
>
> I have one questions about attaching an handler for the IRQ generated by
> an ARM simulator.
>
> I generate my eCos using:
> ecosconfig new integrator_arm9
> ecosconfig add posix
>
>
>
> Then in my main.c I added this:
>
> static cyg_interrupt int1;
> static cyg_handle_t int1_handle;
> int initInterruptHandler(void) {
> cyg_vector_t int1_vector = CYGNUM_HAL_VECTOR_IRQ;
> cyg_priority_t int1_priority = 0;
>
> cyg_interrupt_create (
> int1_vector,
> int1_priority,
> 0,
> &MyHandler,
> NULL,
> &int1_handle,
> &int1);
>
> cyg_interrupt_attach (int1_handle);
> cyg_interrupt_unmask (int1_vector);
> cyg_interrupt_enable();
> }
>
>
> and I call it here:
>
> int main(int argc, char **argv)
> {
> initInterruptHandler();
> while (1) {}
> }
>
>
> I was expecting to see my MyHandler being called when IRQ is raised, but
> when the pin of the CPU is up, I don't see my function being executed.
>
>
> Am I missing something?
The ARM processor only has two interrupts, IRQ and FIQ. So most chips
contain the "Advanced Interrupt Controller". This multiplexes many
interrupt sources onto the IRQ. See hal_platform_ints.h for a list of
these interrupts. cyg_interrupt_create() installs an interrupt handler
for one of these multiplex interrupts.
If you really want to install a handler for the IRQ, you need to use
the function cyg_interrupt_set_vsr(). Note that the function you
register must be a real interrupt handler, ie it must take care to not
destroy any registers. This means you will need to write it in
assembly language.
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss