Ejemplo n.º 1
0
void NACKEDFUNC
usb_int (void)
{
  ISR_STORE();
  ISR_ENABLE_NEST();
  usb_int_safe();
  ISR_DISABLE_NEST();
  *AT91C_AIC_EOICR = 0; 
  ISR_RESTORE();
}
Ejemplo n.º 2
0
/* 
  - changed ISR "in" and "out" for gcc
  - adapted "ramfunc" to gcc
*/

#include "sys/AT91SAM7S64.h"                    /* AT91SAMT7S64 definitions */
#include "sys/Board.h"
#include "dvISR/interrupt_utils.h"

#ifdef ERAM   /* Fast IRQ functions Run in RAM  - see board.h */
#define ATTR RAMFUNC
#else
#define ATTR
#endif


#if 0
// mt: assembler code ported to gcc in interrupt_utils.h
// Keil original:
// Macros for Interrupt Nesting
#define IENABLE                             /* Nested Interrupts Entry */   \
  __asm { MRS     LR, SPSR      }           /* Copy SPSR_irq to LR     */   \
  __asm { STMFD   SP!, {LR}     }           /* Save SPSR_irq           */   \
  __asm { MSR     CPSR_c, #0x1F }           /* Enable IRQ (Sys Mode)   */   \
  __asm { STMFD   SP!, {LR}     }           /* Save LR                 */ 

#define IDISABLE                            /* Nested Interrupts Exit  */   \
  __asm { LDMFD   SP!, {LR}     }           /* Restore LR              */   \
  __asm { MSR     CPSR_c, #0x92 }           /* Disable IRQ (IRQ Mode)  */   \
  __asm { LDMFD   SP!, {LR}     }           /* Restore SPSR_irq to LR  */   \
  __asm { MSR     SPSR_cxsf, LR }           /* Copy LR to SPSR_irq     */ 
#endif
 

extern volatile AT91S_PIO * pPIO;                    /* Global Pointer to PIO */


// void irq0_int (void) __irq __atr {          /* IRQ0 (Push button SW2)    */
//void INTFUNC ATTR irq0_int (void) {          /* IRQ0 (Push button SW2)    */
void NACKEDFUNC ATTR irq0_int (void) {          /* IRQ0 (Push button SW2)    */

  ISR_STORE(); 
  ISR_ENABLE_NEST();                        /* Enable Interrupt nesting  */
  if ((pPIO->PIO_PDSR & SW2) == 0) {       /* Check if SW2 is pressed   */
    pPIO->PIO_CODR = LED2;                  /* Turn On LED2              */
    while ((pPIO->PIO_PDSR & SW2) == 0);   /* Wait until SW2 is released */
    pPIO->PIO_SODR = LED2;                  /* Turn Off LED2             */
  }
  ISR_DISABLE_NEST();                       /* Disable Interrupt nesting */
  *AT91C_AIC_EOICR = 0;                     /* End of Interrupt          */
  ISR_RESTORE();
}