EmbDev.net

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


von Min G. (minge519)


Rate this post
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

von Jim K. (ancaritha)


Rate this post
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.

von Min G. (minge519)


Rate this post
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

von Min G. (minge519)


Rate this post
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

von Jim K. (ancaritha)


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

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.