1 #ifndef CYGONCE_HAL_PLF_INTR_H
2 #define CYGONCE_HAL_PLF_INTR_H
4 //==========================================================================
8 // Atlas Interrupt and clock support
10 //==========================================================================
11 //####ECOSGPLCOPYRIGHTBEGIN####
12 // -------------------------------------------
13 // This file is part of eCos, the Embedded Configurable Operating System.
14 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
16 // eCos is free software; you can redistribute it and/or modify it under
17 // the terms of the GNU General Public License as published by the Free
18 // Software Foundation; either version 2 or (at your option) any later version.
20 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
21 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 // You should have received a copy of the GNU General Public License along
26 // with eCos; if not, write to the Free Software Foundation, Inc.,
27 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
29 // As a special exception, if other files instantiate templates or use macros
30 // or inline functions from this file, or you compile this file and link it
31 // with other works to produce a work based on this file, this file does not
32 // by itself cause the resulting work to be covered by the GNU General Public
33 // License. However the source code for this file must still be made available
34 // in accordance with section (3) of the GNU General Public License.
36 // This exception does not invalidate any other reasons why a work based on
37 // this file might be covered by the GNU General Public License.
39 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
40 // at http://sources.redhat.com/ecos/ecos-license/
41 // -------------------------------------------
42 //####ECOSGPLCOPYRIGHTEND####
43 //==========================================================================
44 //#####DESCRIPTIONBEGIN####
47 // Contributors: nickg, jskov,
48 // gthomas, jlarmour, dmoseley, michael anburaj <michaelanburaj@hotmail.com>
50 // Purpose: Define Interrupt support
51 // Description: The macros defined here provide the HAL APIs for handling
52 // interrupts and the clock for the Atlas board.
55 // #include <cyg/hal/plf_intr.h>
59 //####DESCRIPTIONEND####
61 //==========================================================================
63 #include <pkgconf/hal.h>
65 // First an assembly safe part
67 //--------------------------------------------------------------------------
70 #ifndef CYGHWR_HAL_INTERRUPT_VECTORS_DEFINED
72 // These are decoded via the IP bits of the cause
73 // register when an external interrupt is delivered.
75 #define CYGNUM_HAL_INTERRUPT_SER 0
76 #define CYGNUM_HAL_INTERRUPT_TIM0 1
77 #define CYGNUM_HAL_INTERRUPT_2 2
78 #define CYGNUM_HAL_INTERRUPT_3 3
79 #define CYGNUM_HAL_INTERRUPT_FPGA_RTC 4
80 #define CYGNUM_HAL_INTERRUPT_COREHI 5
81 #define CYGNUM_HAL_INTERRUPT_CORELO 6
82 #define CYGNUM_HAL_INTERRUPT_7 7
83 #define CYGNUM_HAL_INTERRUPT_PCIA 8
84 #define CYGNUM_HAL_INTERRUPT_PCIB 9
85 #define CYGNUM_HAL_INTERRUPT_PCIC 10
86 #define CYGNUM_HAL_INTERRUPT_PCID 11
87 #define CYGNUM_HAL_INTERRUPT_ENUM 12
88 #define CYGNUM_HAL_INTERRUPT_DEG 13
89 #define CYGNUM_HAL_INTERRUPT_ATXFAIL 14
90 #define CYGNUM_HAL_INTERRUPT_INTA 15
91 #define CYGNUM_HAL_INTERRUPT_INTB 16
92 #define CYGNUM_HAL_INTERRUPT_INTC 17
93 #define CYGNUM_HAL_INTERRUPT_INTD 18
94 #define CYGNUM_HAL_INTERRUPT_SERR 19
95 #define CYGNUM_HAL_INTERRUPT_HW1 20
96 #define CYGNUM_HAL_INTERRUPT_HW2 21
97 #define CYGNUM_HAL_INTERRUPT_HW3 22
98 #define CYGNUM_HAL_INTERRUPT_HW4 23
99 #define CYGNUM_HAL_INTERRUPT_HW5 24
101 // Min/Max ISR numbers and how many there are
102 #define CYGNUM_HAL_ISR_MIN 0
103 #define CYGNUM_HAL_ISR_MAX 24
104 #define CYGNUM_HAL_ISR_COUNT 25
106 #define CYGNUM_HAL_INTERRUPT_DEBUG_UART CYGNUM_HAL_INTERRUPT_SER
108 #define CYGNUM_HAL_INTERRUPT_RTC CYGNUM_HAL_INTERRUPT_HW5
110 #define CYGHWR_HAL_INTERRUPT_VECTORS_DEFINED
115 //--------------------------------------------------------------------------
116 #ifndef __ASSEMBLER__
118 #include <cyg/infra/cyg_type.h>
120 //--------------------------------------------------------------------------
121 // Interrupt controller access.
123 #ifndef CYGHWR_HAL_INTERRUPT_CONTROLLER_ACCESS_DEFINED
125 // Array which stores the configured priority levels for the configured
127 externC volatile CYG_BYTE hal_interrupt_level[CYGNUM_HAL_ISR_COUNT];
129 #define HAL_INTERRUPT_MASK( _vector_ ) \
131 cyg_uint32 __vector = _vector_; \
133 if( (_vector_) < CYGNUM_HAL_INTERRUPT_HW1 ) \
134 HAL_WRITE_UINT32( HAL_ATLAS_INTRSTEN, (1<<(_vector_)) ); \
137 __vector -= (CYGNUM_HAL_INTERRUPT_HW1-1); \
141 "la $2,0x00000400\n" \
154 #define HAL_INTERRUPT_UNMASK( _vector_ ) \
156 cyg_uint32 __vector = _vector_; \
158 if( (__vector) < CYGNUM_HAL_INTERRUPT_HW1 ) \
160 HAL_WRITE_UINT32( HAL_ATLAS_INTSETEN, (1<<(__vector)) ); \
164 __vector -= (CYGNUM_HAL_INTERRUPT_HW1-1); \
168 "la $2,0x00000400\n" \
179 #define HAL_INTERRUPT_ACKNOWLEDGE( _vector_ ) \
181 cyg_uint32 __vector = _vector_; \
183 if( __vector >= CYGNUM_HAL_INTERRUPT_HW1 ) \
184 __vector -= (CYGNUM_HAL_INTERRUPT_HW1-1); \
190 "la $2,0x00000400\n" \
203 #define HAL_INTERRUPT_CONFIGURE( _vector_, _level_, _up_ ) \
207 #define HAL_INTERRUPT_SET_LEVEL( _vector_, _level_ ) \
211 #define CYGHWR_HAL_INTERRUPT_CONTROLLER_ACCESS_DEFINED
216 //--------------------------------------------------------------------------
217 // Control-C support.
219 #if defined(CYGDBG_HAL_MIPS_DEBUG_GDB_CTRLC_SUPPORT)
221 # define CYGHWR_HAL_GDB_PORT_VECTOR CYGNUM_HAL_INTERRUPT_SER
223 externC cyg_uint32 hal_ctrlc_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data);
225 # define HAL_CTRLC_ISR hal_ctrlc_isr
230 //----------------------------------------------------------------------------
232 #ifndef CYGHWR_HAL_RESET_DEFINED
233 extern void hal_atlas_reset( void );
234 #define CYGHWR_HAL_RESET_DEFINED
235 #define HAL_PLATFORM_RESET() hal_atlas_reset()
237 #define HAL_PLATFORM_RESET_ENTRY 0xbfc00000
239 #endif // CYGHWR_HAL_RESET_DEFINED
241 #endif // __ASSEMBLER__
243 //--------------------------------------------------------------------------
244 #endif // ifndef CYGONCE_HAL_PLF_INTR_H