EmbDev.net

Forum: ARM programming with GCC/GNU tools How to use Interrupt


Author: Min Ge (minge519)
Posted on:

Rate this post
0 useful
not useful
Hi everyone,

I am trying to use Interrupt of AT91SAM7S256.
I read the example under WinARM. of at91sam7s64_Atmel_interrupt.
In file of Cstartup_SAM7.c, there have three functions
   - AT91F_Spurious_handler
   - AT91F_Default_IRQ_handler
   - AT91F_Default_FIQ_handler

But I can find ut the definition of those functions.
  Do I have to build those function by myself or I can get somewhere?
  How to use the 3 functions?
  How to use the functions to call different interrrpt handler files?

Thanks

Min Ge

Author: Jim Kaz (ancaritha)
Posted on:

Rate this post
0 useful
not useful
Min Ge wrote:
> Hi everyone,
>
> I am trying to use Interrupt of AT91SAM7S256.
> I read the example under WinARM. of at91sam7s64_Atmel_interrupt.
> In file of Cstartup_SAM7.c, there have three functions
>    - AT91F_Spurious_handler
>    - AT91F_Default_IRQ_handler
>    - AT91F_Default_FIQ_handler
>
> But I can find ut the definition of those functions.
>   Do I have to build those function by myself or I can get somewhere?
>   How to use the 3 functions?
>   How to use the functions to call different interrrpt handler files?
>
> Thanks
>
> Min Ge


I haven't worked with the S series, but I'm assuming that its similar to
the A3's.  Those three functions are default functions that don't do
anything.  They are handled in the assembly file.

To create your on interrupts, you have to to first enable what you want
to have interrupts, and then tell the main processor what to do with it.
The follow code is taking from the lib_AT91SAMA3 file that came with the
IAR example code.  I'm pretty sure the SAM7S has a similar file.

AT91F_AIC_ConfigureIt(AT91C_BASE_AIC, AT91C_ID_SYS,
EXTCOMM_INTERRUPT_PRIORITY, AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL,
InterruptServicer::Interrupt_ID_SYS);
AT91F_AIC_EnableIt(AT91C_BASE_AIC, AT91C_ID_SYS);

The word 'InterruptServicer::Interrupt_ID_SYS' is the name of the
function you want this interrupt to call when it fires.  Then you just
have to write that function somewhere else, and it is automatically
executed when that interrupt fires.

'EXTCOMM_INTERRUPT_PRIORITY' is just a number (the priority of the
interrupt.

Author: Min Ge (minge519)
Posted on:

Rate this post
0 useful
not useful
Jim Kaz wrote:
> I haven't worked with the S series, but I'm assuming that its similar to
> the A3's.  Those three functions are default functions that don't do
> anything.  They are handled in the assembly file.
>
> To create your on interrupts, you have to to first enable what you want
> to have interrupts, and then tell the main processor what to do with it.
> The follow code is taking from the lib_AT91SAMA3 file that came with the
> IAR example code.  I'm pretty sure the SAM7S has a similar file.
>
> AT91F_AIC_ConfigureIt(AT91C_BASE_AIC, AT91C_ID_SYS,
> EXTCOMM_INTERRUPT_PRIORITY, AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL,
> InterruptServicer::Interrupt_ID_SYS);
> AT91F_AIC_EnableIt(AT91C_BASE_AIC, AT91C_ID_SYS);
>
> The word 'InterruptServicer::Interrupt_ID_SYS' is the name of the
> function you want this interrupt to call when it fires.  Then you just
> have to write that function somewhere else, and it is automatically
> executed when that interrupt fires.
>
> 'EXTCOMM_INTERRUPT_PRIORITY' is just a number (the priority of the
> interrupt.

Thanks a lot. I'll try.

Min Ge

Author: Min Ge (minge519)
Posted on:

Rate this post
0 useful
not useful
Min Ge wrote:
> Jim Kaz wrote:
>> I haven't worked with the S series, but I'm assuming that its similar to
>> the A3's.  Those three functions are default functions that don't do
>> anything.  They are handled in the assembly file.
>>
>> To create your on interrupts, you have to to first enable what you want
>> to have interrupts, and then tell the main processor what to do with it.
>> The follow code is taking from the lib_AT91SAMA3 file that came with the
>> IAR example code.  I'm pretty sure the SAM7S has a similar file.
>>
>> AT91F_AIC_ConfigureIt(AT91C_BASE_AIC, AT91C_ID_SYS,
>> EXTCOMM_INTERRUPT_PRIORITY, AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL,
>> InterruptServicer::Interrupt_ID_SYS);
>> AT91F_AIC_EnableIt(AT91C_BASE_AIC, AT91C_ID_SYS);
>>
>> The word 'InterruptServicer::Interrupt_ID_SYS' is the name of the
>> function you want this interrupt to call when it fires.  Then you just
>> have to write that function somewhere else, and it is automatically
>> executed when that interrupt fires.
>>
>> 'EXTCOMM_INTERRUPT_PRIORITY' is just a number (the priority of the
>> interrupt.

Hi Jim,

I have designed and tested the interrupt as what you said. It is working
now.
Thanks a lot.

Min Ge

Author: Jim Kaz (ancaritha)
Posted on:

Rate this post
0 useful
not useful
Glad I could be of service :)

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.