1 |
27 |
unneback |
#ifndef CYGONCE_HAL_VAR_INTR_H
|
2 |
|
|
#define CYGONCE_HAL_VAR_INTR_H
|
3 |
|
|
|
4 |
|
|
//==========================================================================
|
5 |
|
|
//
|
6 |
|
|
// var_intr.h
|
7 |
|
|
//
|
8 |
|
|
// AM31 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
|
49 |
|
|
// Date: 1999-02-16
|
50 |
|
|
// Purpose: AM31 Interrupt support
|
51 |
|
|
// Description: The macros defined here provide the HAL APIs for handling
|
52 |
|
|
// interrupts and the clock for AM31 variants of the MN10300
|
53 |
|
|
// architecture.
|
54 |
|
|
//
|
55 |
|
|
// Usage:
|
56 |
|
|
// #include <cyg/hal/var_intr.h>
|
57 |
|
|
// ...
|
58 |
|
|
//
|
59 |
|
|
//
|
60 |
|
|
//####DESCRIPTIONEND####
|
61 |
|
|
//
|
62 |
|
|
//==========================================================================
|
63 |
|
|
|
64 |
|
|
#include <pkgconf/hal.h>
|
65 |
|
|
|
66 |
|
|
#include <cyg/infra/cyg_type.h>
|
67 |
|
|
|
68 |
|
|
#include <cyg/hal/plf_intr.h>
|
69 |
|
|
|
70 |
|
|
//--------------------------------------------------------------------------
|
71 |
|
|
|
72 |
|
|
// The MN10300 has a somewhat complex interrupt structure. Besides the
|
73 |
|
|
// reset and NMI vectors there are seven maskable interrupt vectors
|
74 |
|
|
// which must point to code in the 64k starting at 0x40000000. There
|
75 |
|
|
// are also 25 Interrupt control groups, each of which can have 4
|
76 |
|
|
// interrupt lines attached, for a theoretical total of 100 interrupts
|
77 |
|
|
// (!). Some of these are dedicated to specific devices, other to
|
78 |
|
|
// external pins, and others are not connected to anything, resulting
|
79 |
|
|
// in only 45 that can actually be delivered. Each control group may
|
80 |
|
|
// be assigned one of seven interrupt levels, and is delivered to the
|
81 |
|
|
// corresponding vector. Software can then use a register to determine
|
82 |
|
|
// the delivering group and detect from there which interrupt has been
|
83 |
|
|
// delivered.
|
84 |
|
|
//
|
85 |
|
|
// The approach we will adopt at present is for the code attached to
|
86 |
|
|
// each vector to save state and jump via a table to a VSR. The
|
87 |
|
|
// default VSR will fully decode the delivered interrupt into a table
|
88 |
|
|
// of isr/data/object entries. VSR replacement will operate on the
|
89 |
|
|
// first level indirection table rather than the hardware
|
90 |
|
|
// vectors. This is the fastest mechanism, however it needs 100*3*4 +
|
91 |
|
|
// 7*4 = 1228 bytes for the tables.
|
92 |
|
|
//
|
93 |
|
|
|
94 |
|
|
//--------------------------------------------------------------------------
|
95 |
|
|
// Interrupt vectors.
|
96 |
|
|
|
97 |
|
|
// The level-specific hardware vectors
|
98 |
|
|
// These correspond to VSRs and are the values to use for HAL_VSR_GET/SET
|
99 |
|
|
#define CYGNUM_HAL_VECTOR_0 0
|
100 |
|
|
#define CYGNUM_HAL_VECTOR_1 1
|
101 |
|
|
#define CYGNUM_HAL_VECTOR_2 2
|
102 |
|
|
#define CYGNUM_HAL_VECTOR_3 3
|
103 |
|
|
#define CYGNUM_HAL_VECTOR_4 4
|
104 |
|
|
#define CYGNUM_HAL_VECTOR_5 5
|
105 |
|
|
#define CYGNUM_HAL_VECTOR_6 6
|
106 |
|
|
#define CYGNUM_HAL_VECTOR_NMI_ENTRY 7
|
107 |
|
|
#define CYGNUM_HAL_VECTOR_TRAP 8
|
108 |
|
|
#define CYGNUM_HAL_VECTOR_NMI 9
|
109 |
|
|
#define CYGNUM_HAL_VECTOR_WATCHDOG 10
|
110 |
|
|
#define CYGNUM_HAL_VECTOR_SYSTEM_ERROR 11
|
111 |
|
|
|
112 |
|
|
#define CYGNUM_HAL_VSR_MIN 0
|
113 |
|
|
#define CYGNUM_HAL_VSR_MAX 11
|
114 |
|
|
#define CYGNUM_HAL_VSR_COUNT 12
|
115 |
|
|
|
116 |
|
|
// Exception numbers. These are the values used when passed out to an
|
117 |
|
|
// external exception handler using cyg_hal_deliver_exception()
|
118 |
|
|
|
119 |
|
|
#define CYGNUM_HAL_EXCEPTION_NMI CYGNUM_HAL_VECTOR_NMI
|
120 |
|
|
#define CYGNUM_HAL_EXCEPTION_WATCHDOG CYGNUM_HAL_VECTOR_WATCHDOG
|
121 |
|
|
#define CYGNUM_HAL_EXCEPTION_SYSTEM_ERROR CYGNUM_HAL_VECTOR_SYSTEM_ERROR
|
122 |
|
|
|
123 |
|
|
#define CYGNUM_HAL_EXCEPTION_DATA_ACCESS CYGNUM_HAL_EXCEPTION_SYSTEM_ERROR
|
124 |
|
|
|
125 |
|
|
#define CYGNUM_HAL_EXCEPTION_MIN CYGNUM_HAL_VSR_MIN
|
126 |
|
|
#define CYGNUM_HAL_EXCEPTION_MAX CYGNUM_HAL_VSR_MAX
|
127 |
|
|
#define CYGNUM_HAL_EXCEPTION_COUNT CYGNUM_HAL_VSR_COUNT
|
128 |
|
|
|
129 |
|
|
// The decoded interrupts
|
130 |
|
|
|
131 |
|
|
#define CYGNUM_HAL_INTERRUPT_NMIRQ 0
|
132 |
|
|
#define CYGNUM_HAL_INTERRUPT_WATCHDOG 1
|
133 |
|
|
#define CYGNUM_HAL_INTERRUPT_SYSTEM_ERROR 2
|
134 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_3 3
|
135 |
|
|
|
136 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_4 4
|
137 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_5 5
|
138 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_6 6
|
139 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_7 7
|
140 |
|
|
|
141 |
|
|
#define CYGNUM_HAL_INTERRUPT_TIMER_0 8
|
142 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_9 9
|
143 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_10 10
|
144 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_11 11
|
145 |
|
|
|
146 |
|
|
#define CYGNUM_HAL_INTERRUPT_TIMER_1 12
|
147 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_13 13
|
148 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_14 14
|
149 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_15 15
|
150 |
|
|
|
151 |
|
|
#define CYGNUM_HAL_INTERRUPT_TIMER_2 16
|
152 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_17 17
|
153 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_18 18
|
154 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_19 19
|
155 |
|
|
|
156 |
|
|
#define CYGNUM_HAL_INTERRUPT_TIMER_3 20
|
157 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_21 21
|
158 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_22 22
|
159 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_23 23
|
160 |
|
|
|
161 |
|
|
#define CYGNUM_HAL_INTERRUPT_TIMER_4 24
|
162 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_25 25
|
163 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_26 26
|
164 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_27 27
|
165 |
|
|
|
166 |
|
|
#define CYGNUM_HAL_INTERRUPT_TIMER_5 28
|
167 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_29 29
|
168 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_30 30
|
169 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_31 31
|
170 |
|
|
|
171 |
|
|
#define CYGNUM_HAL_INTERRUPT_TIMER_6 32
|
172 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_33 33
|
173 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_34 34
|
174 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_35 35
|
175 |
|
|
|
176 |
|
|
#define CYGNUM_HAL_INTERRUPT_TIMER_6_COMPARE_A 36
|
177 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_37 37
|
178 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_38 38
|
179 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_39 39
|
180 |
|
|
|
181 |
|
|
#define CYGNUM_HAL_INTERRUPT_TIMER_6_COMPARE_B 40
|
182 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_41 41
|
183 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_42 42
|
184 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_43 43
|
185 |
|
|
|
186 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_44 44
|
187 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_45 45
|
188 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_46 46
|
189 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_47 47
|
190 |
|
|
|
191 |
|
|
#define CYGNUM_HAL_INTERRUPT_DMA0 48
|
192 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_49 49
|
193 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_50 50
|
194 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_51 51
|
195 |
|
|
|
196 |
|
|
#define CYGNUM_HAL_INTERRUPT_DMA1 52
|
197 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_53 53
|
198 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_54 54
|
199 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_55 55
|
200 |
|
|
|
201 |
|
|
#define CYGNUM_HAL_INTERRUPT_DMA2 56
|
202 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_57 57
|
203 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_58 58
|
204 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_59 59
|
205 |
|
|
|
206 |
|
|
#define CYGNUM_HAL_INTERRUPT_DMA3 60
|
207 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_61 61
|
208 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_62 62
|
209 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_63 63
|
210 |
|
|
|
211 |
|
|
#define CYGNUM_HAL_INTERRUPT_SERIAL_0_RX 64
|
212 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_65 65
|
213 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_66 66
|
214 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_67 67
|
215 |
|
|
|
216 |
|
|
#define CYGNUM_HAL_INTERRUPT_SERIAL_0_TX 68
|
217 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_69 69
|
218 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_70 70
|
219 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_71 71
|
220 |
|
|
|
221 |
|
|
#define CYGNUM_HAL_INTERRUPT_SERIAL_1_RX 72
|
222 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_73 73
|
223 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_74 74
|
224 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_75 75
|
225 |
|
|
|
226 |
|
|
#define CYGNUM_HAL_INTERRUPT_SERIAL_1_TX 76
|
227 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_77 77
|
228 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_78 78
|
229 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_79 79
|
230 |
|
|
|
231 |
|
|
#define CYGNUM_HAL_INTERRUPT_SERIAL_2_RX 80
|
232 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_81 81
|
233 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_82 82
|
234 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_83 83
|
235 |
|
|
|
236 |
|
|
#define CYGNUM_HAL_INTERRUPT_SERIAL_2_TX 84
|
237 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_85 85
|
238 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_86 86
|
239 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_87 87
|
240 |
|
|
|
241 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_88 88
|
242 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_89 89
|
243 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_90 90
|
244 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_91 91
|
245 |
|
|
|
246 |
|
|
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_0 92
|
247 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_93 93
|
248 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_94 94
|
249 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_95 95
|
250 |
|
|
|
251 |
|
|
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_1 96
|
252 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_97 97
|
253 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_98 98
|
254 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_99 99
|
255 |
|
|
|
256 |
|
|
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_2 100
|
257 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_101 101
|
258 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_102 102
|
259 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_103 103
|
260 |
|
|
|
261 |
|
|
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_3 104
|
262 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_105 105
|
263 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_106 106
|
264 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_107 107
|
265 |
|
|
|
266 |
|
|
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_4 108
|
267 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_109 109
|
268 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_110 110
|
269 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_111 111
|
270 |
|
|
|
271 |
|
|
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_5 112
|
272 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_113 113
|
273 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_114 114
|
274 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_115 115
|
275 |
|
|
|
276 |
|
|
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_6 116
|
277 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_117 117
|
278 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_118 118
|
279 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_119 119
|
280 |
|
|
|
281 |
|
|
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_7 120
|
282 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_121 121
|
283 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_122 122
|
284 |
|
|
#define CYGNUM_HAL_INTERRUPT_RESERVED_123 123
|
285 |
|
|
|
286 |
|
|
#define CYGNUM_HAL_ISR_MIN 0
|
287 |
|
|
#define CYGNUM_HAL_ISR_MAX 123
|
288 |
|
|
|
289 |
|
|
#define CYGNUM_HAL_ISR_COUNT (3+((CYGNUM_HAL_ISR_MAX+1)/4))
|
290 |
|
|
|
291 |
|
|
// The vector used by the Real time clock
|
292 |
|
|
|
293 |
|
|
#define CYGNUM_HAL_INTERRUPT_RTC CYGNUM_HAL_INTERRUPT_TIMER_5
|
294 |
|
|
|
295 |
|
|
//--------------------------------------------------------------------------
|
296 |
|
|
// Interrupt vector translation.
|
297 |
|
|
|
298 |
|
|
#if !defined(HAL_TRANSLATE_VECTOR) && !defined(CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN)
|
299 |
|
|
|
300 |
|
|
#define HAL_TRANSLATE_VECTOR(_vector_,_index_) \
|
301 |
|
|
_index_ = (((_vector_)<=CYGNUM_HAL_INTERRUPT_SYSTEM_ERROR) ? \
|
302 |
|
|
(_vector_) : \
|
303 |
|
|
(((_vector_)>>2)+CYGNUM_HAL_INTERRUPT_RESERVED_3))
|
304 |
|
|
|
305 |
|
|
#endif
|
306 |
|
|
|
307 |
|
|
//--------------------------------------------------------------------------
|
308 |
|
|
// MN10300 specific version of HAL_INTERRUPT_CONFIGURE
|
309 |
|
|
|
310 |
|
|
#define HAL_INTERRUPT_CONFIGURE( _vector_, _level_, _up_ ) \
|
311 |
|
|
CYG_MACRO_START \
|
312 |
|
|
if( _vector_ >= CYGNUM_HAL_INTERRUPT_EXTERNAL_0 ) \
|
313 |
|
|
{ \
|
314 |
|
|
cyg_uint32 _v_ = _vector_; \
|
315 |
|
|
cyg_uint16 _val_ = 0; \
|
316 |
|
|
cyg_uint16 _reg_; \
|
317 |
|
|
\
|
318 |
|
|
/* adjust vector to bit offset in EXTMD */ \
|
319 |
|
|
_v_ -= CYGNUM_HAL_INTERRUPT_EXTERNAL_0; \
|
320 |
|
|
_v_ >>= 1; \
|
321 |
|
|
\
|
322 |
|
|
/* set bits according to requirements */ \
|
323 |
|
|
if( _up_ ) _val_ |= 1; \
|
324 |
|
|
if( !(_level_) ) _val_ |= 2; \
|
325 |
|
|
\
|
326 |
|
|
/* get EXTMD */ \
|
327 |
|
|
_reg_ = mn10300_interrupt_control[0x180>>1]; \
|
328 |
|
|
\
|
329 |
|
|
/* clear old value and set new */ \
|
330 |
|
|
_reg_ &= ~(3<<_v_); \
|
331 |
|
|
_reg_ |= _val_<<_v_; \
|
332 |
|
|
\
|
333 |
|
|
/* restore EXTMD */ \
|
334 |
|
|
mn10300_interrupt_control[0x180>>1] = _reg_; \
|
335 |
|
|
} \
|
336 |
|
|
CYG_MACRO_END
|
337 |
|
|
|
338 |
|
|
#define HAL_INTERRUPT_CONFIGURE_DEFINED
|
339 |
|
|
|
340 |
|
|
//--------------------------------------------------------------------------
|
341 |
|
|
// Timer control registers.
|
342 |
|
|
// On the mn103002 we use timers 4 and 5
|
343 |
|
|
|
344 |
|
|
#define TIMER4_CR 0x340010a0
|
345 |
|
|
#define TIMER4_BR 0x34001090
|
346 |
|
|
#define TIMER4_MD 0x34001080
|
347 |
|
|
|
348 |
|
|
#define TIMER5_CR 0x340010a2
|
349 |
|
|
#define TIMER5_BR 0x34001092
|
350 |
|
|
#define TIMER5_MD 0x34001082
|
351 |
|
|
|
352 |
|
|
#define TIMER_CR TIMER5_CR
|
353 |
|
|
#define TIMER_BR TIMER5_BR
|
354 |
|
|
#define TIMER_MD TIMER5_MD
|
355 |
|
|
|
356 |
|
|
#define TIMER0_MD 0x34001000
|
357 |
|
|
#define TIMER0_BR 0x34001010
|
358 |
|
|
#define TIMER0_CR 0x34001020
|
359 |
|
|
|
360 |
|
|
//--------------------------------------------------------------------------
|
361 |
|
|
// Clock control.
|
362 |
|
|
|
363 |
|
|
#define HAL_CLOCK_INITIALIZE( _period_ ) \
|
364 |
|
|
{ \
|
365 |
|
|
volatile cyg_uint16 *timer4_br = (cyg_uint16 *)TIMER4_BR; \
|
366 |
|
|
volatile cyg_uint8 *timer4_md = (cyg_uint8 *)TIMER4_MD; \
|
367 |
|
|
volatile cyg_uint16 *timer5_br = (cyg_uint16 *)TIMER5_BR; \
|
368 |
|
|
volatile cyg_uint8 *timer5_md = (cyg_uint8 *)TIMER5_MD; \
|
369 |
|
|
\
|
370 |
|
|
/* Set timers 4 and 5 into cascade mode */ \
|
371 |
|
|
\
|
372 |
|
|
*timer5_br = (_period_)>>16; \
|
373 |
|
|
\
|
374 |
|
|
*timer5_md = 0x40; \
|
375 |
|
|
*timer5_md = 0x83; \
|
376 |
|
|
\
|
377 |
|
|
*timer4_br = (_period_)&0x0000FFFF; \
|
378 |
|
|
\
|
379 |
|
|
*timer4_md = 0x40; \
|
380 |
|
|
*timer4_md = 0x80; \
|
381 |
|
|
}
|
382 |
|
|
|
383 |
|
|
#define HAL_CLOCK_RESET( _vector_, _period_ )
|
384 |
|
|
|
385 |
|
|
#define HAL_CLOCK_READ( _pvalue_ ) \
|
386 |
|
|
{ \
|
387 |
|
|
volatile cyg_uint16 *timer4_cr = (cyg_uint16 *)TIMER4_CR; \
|
388 |
|
|
volatile cyg_uint16 *timer5_cr = (cyg_uint16 *)TIMER5_CR; \
|
389 |
|
|
\
|
390 |
|
|
cyg_uint16 t5; \
|
391 |
|
|
cyg_uint16 t4; \
|
392 |
|
|
\
|
393 |
|
|
/* Loop reading the two timers until we can read t5 twice */ \
|
394 |
|
|
/* with the same value. This avoids getting silly times if */ \
|
395 |
|
|
/* the timers carry between reading the two regs. */ \
|
396 |
|
|
do { \
|
397 |
|
|
t5 = *timer5_cr; \
|
398 |
|
|
t4 = *timer4_cr; \
|
399 |
|
|
} while( t5 != *timer5_cr ); \
|
400 |
|
|
\
|
401 |
|
|
*(_pvalue_) = CYGNUM_KERNEL_COUNTERS_RTC_PERIOD - ((t5<<16) + t4); \
|
402 |
|
|
}
|
403 |
|
|
|
404 |
|
|
// FIXME: above line should not use CYGNUM_KERNEL_COUNTERS_RTC_PERIOD since
|
405 |
|
|
// this means the HAL gets configured by kernel options even when the
|
406 |
|
|
// kernel is disabled!
|
407 |
|
|
|
408 |
|
|
|
409 |
|
|
//--------------------------------------------------------------------------
|
410 |
|
|
#endif // ifndef CYGONCE_HAL_VAR_INTR_H
|
411 |
|
|
// End of var_intr.h
|