interrupt_example_gcc.c File Reference

#include <avr32/io.h>
#include <sys/interrupts.h>

Include dependency graph for interrupt_example_gcc.c:

Go to the source code of this file.

Defines

#define FAILURE   -1;
#define INPUT_MASK   0x000000ff
#define OUTPUT_MASK   0x0000ff00
#define SUCCESS   0;

Functions

int main (void)
__int_handler * pioc_int_handler ()


Define Documentation

#define FAILURE   -1;
 

Definition at line 52 of file interrupt_example_gcc.c.

#define INPUT_MASK   0x000000ff
 

Definition at line 54 of file interrupt_example_gcc.c.

Referenced by main(), pioc_int_handler(), and pioc_interrupt_handler().

#define OUTPUT_MASK   0x0000ff00
 

Definition at line 55 of file interrupt_example_gcc.c.

Referenced by main().

#define SUCCESS   0;
 

Definition at line 51 of file interrupt_example_gcc.c.


Function Documentation

int main void   ) 
 

The main function. It sets up the interrupt handler and waits for interrupts from the dip switch.

Parameters:
; 
Returns:
;

Definition at line 82 of file interrupt_example_gcc.c.

References INPUT_MASK, OUTPUT_MASK, and pioc_int_handler().

00083 {
00084   volatile struct avr32_pio_t *pioc = &AVR32_PIOC;
00085 
00086   /* 
00087   Setup the PIO controller. Set PIOC[8..15] as output, PIOC[0..7] as input.
00088   To get this to work on your stk1000, connect J6 to J15 and J3 to J25
00089   */
00090 
00091   pioc->odr= INPUT_MASK;
00092   pioc->per = OUTPUT_MASK;
00093   pioc->oer = OUTPUT_MASK;
00094   pioc->codr = INPUT_MASK & OUTPUT_MASK;
00095   pioc->puer = INPUT_MASK & OUTPUT_MASK;
00096   pioc->idr &= ~INPUT_MASK;
00097   pioc->ier = INPUT_MASK;
00098   pioc->ower = OUTPUT_MASK;
00099 
00100 
00101   /* Setup the interrupt handler, handled by newlib */
00102   set_interrupts_base( (void *) AVR32_INTC_ADDRESS );
00103   /* register_intterupt( (__int_handler) {func}, {GROUP}, {LINE}, {LEVEL} ); */ 
00104   register_interrupt( (__int_handler) (pioc_int_handler), AVR32_PIOC_IRQ/32, AVR32_PIOC_IRQ % 32, INT0);
00105   init_interrupts();
00106 
00107   while(1);
00108 
00109   return 0;
00110 }

Here is the call graph for this function:

__int_handler* pioc_int_handler  ) 
 

The gcc PIO interrupt handler.

Parameters:
; 
Returns:
;

Definition at line 62 of file interrupt_example_gcc.c.

References INPUT_MASK.

Referenced by main().

00063 {
00064   volatile struct avr32_pio_t *pioc = &AVR32_PIOC;
00065   int status;
00066 
00067   status = pioc->isr;
00068   status = pioc->pdsr;
00069 
00070   pioc->odsr =~(status&INPUT_MASK)<<8; /* set led */
00071 
00072   return (void *) 0;
00073 }


Generated on Wed May 10 15:23:24 2006 for AVR32101 The AVR32 Interrupt Controller by  doxygen 1.4.6