irq.h
Go to the documentation of this file.
00001 /******************************************************************************
00002  *   irq.h:  Interrupt related Header file for Philips LPC214x Family 
00003  *   Microprocessors
00004  *
00005  *   Copyright(C) 2006, Philips Semiconductor
00006  *   All rights reserved.
00007  *
00008  *   History
00009  *   2005.10.01  ver 1.00    Prelimnary version, first Release
00010  *
00011  *   21. Apr. 2006 - modified for gnu/gcc by Martin Thomas
00012  ******************************************************************************/
00013 #ifndef __IRQ_H 
00014 #define __IRQ_H
00015 
00016 // #define __irq __attribute__ ((interrupt("IRQ")))
00017 // #define __fiq __attribute__ ((interrupt("FIQ")))
00018 #define __irq
00019 #define __fiq
00020 
00021 
00022 /* if nested interrupt is used, NEST_INTERRUPT needs to be set to 1, otherwise 0 */
00023 // mthomas : macros disabled for now 
00024 // nesting is the default in the current arm-elf-gcc/WinARM-port
00025 // see Startup.S function IRQ_Wrapper
00026 //#define NESTED_INTERRUPT      1
00027 #define NESTED_INTERRUPT        0
00028 
00029 #define I_Bit                   0x80
00030 #define F_Bit                   0x40
00031 
00032 #define SYS32Mode               0x1F
00033 #define IRQ32Mode               0x12
00034 #define FIQ32Mode               0x11
00035 
00036 #define WDT_INT                 0
00037 #define SWI_INT                 1
00038 #define ARM_CORE0_INT           2
00039 #define ARM_CORE1_INT           3
00040 #define TIMER0_INT              4
00041 #define TIMER1_INT              5
00042 #define UART0_INT               6
00043 #define UART1_INT               7
00044 #define PWM0_INT                8
00045 #define I2C0_INT                9
00046 #define SPI0_INT                10
00047 #define SPI1_INT                11
00048 #define PLL_INT                 12
00049 #define RTC_INT                 13
00050 #define EINT0_INT               14
00051 #define EINT1_INT               15
00052 #define EINT2_INT               16
00053 #define EINT3_INT               17
00054 #define ADC0_INT                18
00055 #define I2C1_INT                19
00056 #define BOD_INT                 20
00057 #define ADC1_INT                21
00058 #define USB_INT                 22
00059 
00060 #define IRQ_SLOT_EN             0x20    /* bit 5 in Vector control register */
00061 #define VIC_SIZE                16
00062 
00063 #define VECT_ADDR_INDEX 0x100
00064 #define VECT_CNTL_INDEX 0x200
00065 
00066 /* Be aware that, from compiler to compiler, nested interrupt will have to
00067 be handled differently. More details can be found in Philips LPC2000
00068 family app-note AN10381 */
00069  
00070 /* unlike Keil Compiler, don't save and restore registers into the stack
00071 in RVD as the compiler does that for you. See RVD ARM compiler Inline and
00072 embedded assemblers, "Rules for using __asm and asm keywords. */
00073 // static DWORD sysreg;         /* used as LR register */
00074 
00075 #if 0
00076 #if NESTED_INTERRUPT 
00077 #define IENABLE __asm { MRS LR, SPSR } \
00078                                 __asm { STMFD SP!, {LR} } \
00079                                 __asm { MSR CPSR_c, #SYS32Mode } \
00080                                 __asm { STMFD SP!, {LR} }
00081 #else
00082 #define IENABLE ;       /* do nothing */
00083 #endif
00084 
00085 #if NESTED_INTERRUPT
00086 #define IDISABLE        __asm { LDMFD SP!, {LR} } \
00087                                         __asm { MSR CPSR_c, #(IRQ32Mode|I_Bit) } \
00088                                         __asm { LDMFD SP!, {LR} } \
00089                                         __asm { MSR SPSR_cxsf, LR }
00090 #else
00091 #define IDISABLE ;      /* do nothing */
00092 #endif
00093 #endif
00094 
00095 #if NESTED_INTERRUPT 
00096 #warning "Macros not tested successfully with arm-elf-gcc
00097 #define IENABLE asm volatile( \
00098  "MRS     LR, SPSR \n"  \
00099  "STMFD   SP!, {LR} \n" \
00100  "MSR     CPSR_c, #0x1F \n" \
00101  "STMFD   SP!, {LR} " )
00102 #else
00103 #define IENABLE ;       /* do nothing */
00104 #endif
00105 
00106 #if NESTED_INTERRUPT
00107 #define IDISABLE asm volatile(  \
00108  "LDMFD   SP!, {LR} \n" \
00109  "MSR     CPSR_c, #0x92 \n" \
00110  "LDMFD   SP!, {LR} \n" \
00111  "MSR     SPSR_cxsf, LR \n" )
00112 #else
00113 #define IDISABLE ;      /* do nothing */
00114 #endif
00115 
00116 
00117 void init_VIC( void );
00118 unsigned long install_irq( unsigned long IntNumber, void *HandlerAddr );
00119 unsigned long uninstall_irq( unsigned long IntNumber );
00120 
00121 
00122 
00123 #endif /* end __IRQ_H */
00124 
00125 /******************************************************************************
00126 **                            End Of File
00127 ******************************************************************************/


ccny_asctec_firmware_2
Author(s): Ivan Dryanovski, Roberto G. Valenti
autogenerated on Tue Jan 7 2014 11:04:17