This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: Use of IRQ on ARM
- From: Francesco Regazzoni <regazzoni at alari dot ch>
- To: ecos-discuss at sourceware dot org
- Date: Fri, 03 Mar 2006 18:08:10 -0500
- Subject: Re: [ECOS] Use of IRQ on ARM
- References: <43FF6A23.3030906@alari.ch> <20060224220021.GW19406@lunn.ch>
Hi,
I applied your suggestions and worked fine.
Thanks a lot.
Andrew Lunn wrote:
> 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
--
Ing. Francesco Regazzoni,
PhD student at ALaRI - USI, Lugano [http://www.alari.ch]
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss