1 |
27 |
unneback |
#ifndef CYGONCE_HAL_PLF_INTR_H
|
2 |
|
|
#define CYGONCE_HAL_PLF_INTR_H
|
3 |
|
|
|
4 |
|
|
//==========================================================================
|
5 |
|
|
//
|
6 |
|
|
// plf_intr.h
|
7 |
|
|
//
|
8 |
|
|
// Atlas Interrupt and clock support
|
9 |
|
|
//
|
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.
|
15 |
|
|
//
|
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.
|
19 |
|
|
//
|
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
|
23 |
|
|
// for more details.
|
24 |
|
|
//
|
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.
|
28 |
|
|
//
|
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.
|
35 |
|
|
//
|
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.
|
38 |
|
|
//
|
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####
|
45 |
|
|
//
|
46 |
|
|
// Author(s): nickg
|
47 |
|
|
// Contributors: nickg, jskov,
|
48 |
|
|
// gthomas, jlarmour, dmoseley
|
49 |
|
|
// Date: 2000-06-06
|
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.
|
53 |
|
|
//
|
54 |
|
|
// Usage:
|
55 |
|
|
// #include <cyg/hal/plf_intr.h>
|
56 |
|
|
// ...
|
57 |
|
|
//
|
58 |
|
|
//
|
59 |
|
|
//####DESCRIPTIONEND####
|
60 |
|
|
//
|
61 |
|
|
//==========================================================================
|
62 |
|
|
|
63 |
|
|
#include <pkgconf/hal.h>
|
64 |
|
|
|
65 |
|
|
#include <cyg/infra/cyg_type.h>
|
66 |
|
|
#include <cyg/hal/plf_io.h>
|
67 |
|
|
|
68 |
|
|
//--------------------------------------------------------------------------
|
69 |
|
|
// Interrupt vectors.
|
70 |
|
|
|
71 |
|
|
#ifndef CYGHWR_HAL_INTERRUPT_VECTORS_DEFINED
|
72 |
|
|
|
73 |
|
|
// These are decoded via the IP bits of the cause
|
74 |
|
|
// register when an external interrupt is delivered.
|
75 |
|
|
|
76 |
|
|
#define CYGNUM_HAL_INTERRUPT_SER 0
|
77 |
|
|
#define CYGNUM_HAL_INTERRUPT_TIM0 1
|
78 |
|
|
#define CYGNUM_HAL_INTERRUPT_2 2
|
79 |
|
|
#define CYGNUM_HAL_INTERRUPT_3 3
|
80 |
|
|
#define CYGNUM_HAL_INTERRUPT_FPGA_RTC 4
|
81 |
|
|
#define CYGNUM_HAL_INTERRUPT_COREHI 5
|
82 |
|
|
#define CYGNUM_HAL_INTERRUPT_CORELO 6
|
83 |
|
|
#define CYGNUM_HAL_INTERRUPT_7 7
|
84 |
|
|
#define CYGNUM_HAL_INTERRUPT_PCIA 8
|
85 |
|
|
#define CYGNUM_HAL_INTERRUPT_PCIB 9
|
86 |
|
|
#define CYGNUM_HAL_INTERRUPT_PCIC 10
|
87 |
|
|
#define CYGNUM_HAL_INTERRUPT_PCID 11
|
88 |
|
|
#define CYGNUM_HAL_INTERRUPT_ENUM 12
|
89 |
|
|
#define CYGNUM_HAL_INTERRUPT_DEG 13
|
90 |
|
|
#define CYGNUM_HAL_INTERRUPT_ATXFAIL 14
|
91 |
|
|
#define CYGNUM_HAL_INTERRUPT_INTA 15
|
92 |
|
|
#define CYGNUM_HAL_INTERRUPT_INTB 16
|
93 |
|
|
#define CYGNUM_HAL_INTERRUPT_INTC 17
|
94 |
|
|
#define CYGNUM_HAL_INTERRUPT_INTD 18
|
95 |
|
|
#define CYGNUM_HAL_INTERRUPT_SERR 19
|
96 |
|
|
#define CYGNUM_HAL_INTERRUPT_HW1 20
|
97 |
|
|
#define CYGNUM_HAL_INTERRUPT_HW2 21
|
98 |
|
|
#define CYGNUM_HAL_INTERRUPT_HW3 22
|
99 |
|
|
#define CYGNUM_HAL_INTERRUPT_HW4 23
|
100 |
|
|
#define CYGNUM_HAL_INTERRUPT_HW5 24
|
101 |
|
|
|
102 |
|
|
// Min/Max ISR numbers and how many there are
|
103 |
|
|
#define CYGNUM_HAL_ISR_MIN 0
|
104 |
|
|
#define CYGNUM_HAL_ISR_MAX 24
|
105 |
|
|
#define CYGNUM_HAL_ISR_COUNT 25
|
106 |
|
|
|
107 |
|
|
#define CYGNUM_HAL_INTERRUPT_DEBUG_UART CYGNUM_HAL_INTERRUPT_SER
|
108 |
|
|
|
109 |
|
|
#define CYGNUM_HAL_INTERRUPT_RTC CYGNUM_HAL_INTERRUPT_HW5
|
110 |
|
|
|
111 |
|
|
#define CYGHWR_HAL_INTERRUPT_VECTORS_DEFINED
|
112 |
|
|
|
113 |
|
|
#endif
|
114 |
|
|
|
115 |
|
|
//--------------------------------------------------------------------------
|
116 |
|
|
// Interrupt controller access.
|
117 |
|
|
|
118 |
|
|
#ifndef CYGHWR_HAL_INTERRUPT_CONTROLLER_ACCESS_DEFINED
|
119 |
|
|
|
120 |
|
|
// Array which stores the configured priority levels for the configured
|
121 |
|
|
// interrupts.
|
122 |
|
|
externC volatile CYG_BYTE hal_interrupt_level[CYGNUM_HAL_ISR_COUNT];
|
123 |
|
|
|
124 |
|
|
#define HAL_INTERRUPT_MASK( _vector_ ) \
|
125 |
|
|
{ \
|
126 |
|
|
cyg_uint32 __vector = _vector_; \
|
127 |
|
|
\
|
128 |
|
|
if( (_vector_) < CYGNUM_HAL_INTERRUPT_HW1 ) \
|
129 |
|
|
HAL_WRITE_UINT32( HAL_ATLAS_INTRSTEN, (1<<(_vector_)) ); \
|
130 |
|
|
else \
|
131 |
|
|
{ \
|
132 |
|
|
__vector -= (CYGNUM_HAL_INTERRUPT_HW1-1); \
|
133 |
|
|
\
|
134 |
|
|
asm volatile ( \
|
135 |
|
|
"mfc0 $3,$12\n" \
|
136 |
|
|
"la $2,0x00000400\n" \
|
137 |
|
|
"sllv $2,$2,%0\n" \
|
138 |
|
|
"nor $2,$2,$0\n" \
|
139 |
|
|
"and $3,$3,$2\n" \
|
140 |
|
|
"mtc0 $3,$12\n" \
|
141 |
|
|
"nop; nop; nop\n" \
|
142 |
|
|
: \
|
143 |
|
|
: "r"(__vector) \
|
144 |
|
|
: "$2", "$3" \
|
145 |
|
|
); \
|
146 |
|
|
} \
|
147 |
|
|
}
|
148 |
|
|
|
149 |
|
|
#define HAL_INTERRUPT_UNMASK( _vector_ ) \
|
150 |
|
|
{ \
|
151 |
|
|
cyg_uint32 __vector = _vector_; \
|
152 |
|
|
\
|
153 |
|
|
if( (__vector) < CYGNUM_HAL_INTERRUPT_HW1 ) \
|
154 |
|
|
{ \
|
155 |
|
|
HAL_WRITE_UINT32( HAL_ATLAS_INTSETEN, (1<<(__vector)) ); \
|
156 |
|
|
__vector = 0; \
|
157 |
|
|
} \
|
158 |
|
|
else \
|
159 |
|
|
__vector -= (CYGNUM_HAL_INTERRUPT_HW1-1); \
|
160 |
|
|
\
|
161 |
|
|
asm volatile ( \
|
162 |
|
|
"mfc0 $3,$12\n" \
|
163 |
|
|
"la $2,0x00000400\n" \
|
164 |
|
|
"sllv $2,$2,%0\n" \
|
165 |
|
|
"or $3,$3,$2\n" \
|
166 |
|
|
"mtc0 $3,$12\n" \
|
167 |
|
|
"nop; nop; nop\n" \
|
168 |
|
|
: \
|
169 |
|
|
: "r"(__vector) \
|
170 |
|
|
: "$2", "$3" \
|
171 |
|
|
); \
|
172 |
|
|
}
|
173 |
|
|
|
174 |
|
|
#define HAL_INTERRUPT_ACKNOWLEDGE( _vector_ ) \
|
175 |
|
|
{ \
|
176 |
|
|
cyg_uint32 __vector = _vector_; \
|
177 |
|
|
\
|
178 |
|
|
if( __vector >= CYGNUM_HAL_INTERRUPT_HW1 ) \
|
179 |
|
|
__vector -= (CYGNUM_HAL_INTERRUPT_HW1-1); \
|
180 |
|
|
else \
|
181 |
|
|
__vector = 0; \
|
182 |
|
|
\
|
183 |
|
|
asm volatile ( \
|
184 |
|
|
"mfc0 $3,$13\n" \
|
185 |
|
|
"la $2,0x00000400\n" \
|
186 |
|
|
"sllv $2,$2,%0\n" \
|
187 |
|
|
"nor $2,$2,$0\n" \
|
188 |
|
|
"and $3,$3,$2\n" \
|
189 |
|
|
"mtc0 $3,$13\n" \
|
190 |
|
|
"nop; nop; nop\n" \
|
191 |
|
|
: \
|
192 |
|
|
: "r"(__vector) \
|
193 |
|
|
: "$2", "$3" \
|
194 |
|
|
); \
|
195 |
|
|
\
|
196 |
|
|
}
|
197 |
|
|
|
198 |
|
|
#define HAL_INTERRUPT_CONFIGURE( _vector_, _level_, _up_ ) \
|
199 |
|
|
{ \
|
200 |
|
|
}
|
201 |
|
|
|
202 |
|
|
#define HAL_INTERRUPT_SET_LEVEL( _vector_, _level_ ) \
|
203 |
|
|
{ \
|
204 |
|
|
}
|
205 |
|
|
|
206 |
|
|
#define CYGHWR_HAL_INTERRUPT_CONTROLLER_ACCESS_DEFINED
|
207 |
|
|
|
208 |
|
|
#endif
|
209 |
|
|
|
210 |
|
|
|
211 |
|
|
//--------------------------------------------------------------------------
|
212 |
|
|
// Control-C support.
|
213 |
|
|
|
214 |
|
|
#if defined(CYGDBG_HAL_MIPS_DEBUG_GDB_CTRLC_SUPPORT)
|
215 |
|
|
|
216 |
|
|
# define CYGHWR_HAL_GDB_PORT_VECTOR CYGNUM_HAL_INTERRUPT_SER
|
217 |
|
|
|
218 |
|
|
externC cyg_uint32 hal_ctrlc_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data);
|
219 |
|
|
|
220 |
|
|
# define HAL_CTRLC_ISR hal_ctrlc_isr
|
221 |
|
|
|
222 |
|
|
#endif
|
223 |
|
|
|
224 |
|
|
|
225 |
|
|
//----------------------------------------------------------------------------
|
226 |
|
|
// Reset.
|
227 |
|
|
#ifndef CYGHWR_HAL_RESET_DEFINED
|
228 |
|
|
extern void hal_atlas_reset( void );
|
229 |
|
|
#define CYGHWR_HAL_RESET_DEFINED
|
230 |
|
|
#define HAL_PLATFORM_RESET() hal_atlas_reset()
|
231 |
|
|
|
232 |
|
|
#define HAL_PLATFORM_RESET_ENTRY 0xbfc00000
|
233 |
|
|
|
234 |
|
|
#endif // CYGHWR_HAL_RESET_DEFINED
|
235 |
|
|
|
236 |
|
|
//--------------------------------------------------------------------------
|
237 |
|
|
#endif // ifndef CYGONCE_HAL_PLF_INTR_H
|
238 |
|
|
// End of plf_intr.h
|