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 |
|
|
// NEC V850 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, gthomas, jlarmour
|
48 |
|
|
// Date: 2001-03-21
|
49 |
|
|
// Purpose: NEC V850 Interrupt support
|
50 |
|
|
// Description: The macros defined here provide the HAL APIs for handling
|
51 |
|
|
// interrupts and the clock for variants of the NEC V85x
|
52 |
|
|
// architecture.
|
53 |
|
|
//
|
54 |
|
|
// Usage:
|
55 |
|
|
// #include <cyg/hal/var_intr.h>
|
56 |
|
|
// ...
|
57 |
|
|
//
|
58 |
|
|
//
|
59 |
|
|
//####DESCRIPTIONEND####
|
60 |
|
|
//
|
61 |
|
|
//==========================================================================
|
62 |
|
|
|
63 |
|
|
#include <pkgconf/hal.h>
|
64 |
|
|
|
65 |
|
|
#include <cyg/infra/cyg_type.h>
|
66 |
|
|
|
67 |
|
|
#include <cyg/hal/plf_intr.h>
|
68 |
|
|
|
69 |
|
|
//--------------------------------------------------------------------------
|
70 |
|
|
// NEC V850/SA1 (70301x) and V850/SB1 (70303x) vectors.
|
71 |
|
|
|
72 |
|
|
// These are the exception codes presented in the Cause register and
|
73 |
|
|
// correspond to VSRs. These values are the ones to use for HAL_VSR_GET/SET
|
74 |
|
|
|
75 |
|
|
#define CYGNUM_HAL_VECTOR_RESET 0x00
|
76 |
|
|
#define CYGNUM_HAL_VECTOR_NMI 0x01
|
77 |
|
|
#define CYGNUM_HAL_VECTOR_INTWDT 0x02 // watchdog timer NMI
|
78 |
|
|
#define CYGNUM_HAL_VECTOR_TRAP00 0x04
|
79 |
|
|
#define CYGNUM_HAL_VECTOR_TRAP10 0x05
|
80 |
|
|
#define CYGNUM_HAL_VECTOR_ILGOP 0x06 // illegal opcode
|
81 |
|
|
#define CYGNUM_HAL_VECTOR_INTWDTM 0x08 // watchdog timer maskable
|
82 |
|
|
#define CYGNUM_HAL_VECTOR_INTP0 0x09
|
83 |
|
|
#define CYGNUM_HAL_VECTOR_INTP1 0x0A
|
84 |
|
|
#define CYGNUM_HAL_VECTOR_INTP2 0x0B
|
85 |
|
|
#define CYGNUM_HAL_VECTOR_INTP3 0x0C
|
86 |
|
|
#define CYGNUM_HAL_VECTOR_INTP4 0x0D
|
87 |
|
|
#define CYGNUM_HAL_VECTOR_INTP5 0x0E
|
88 |
|
|
#define CYGNUM_HAL_VECTOR_INTP6 0x0F
|
89 |
|
|
|
90 |
|
|
#if CYGINT_HAL_V850_VARIANT_SA1
|
91 |
|
|
#define CYGNUM_HAL_VECTOR_INTWTNI 0x10
|
92 |
|
|
#define CYGNUM_HAL_VECTOR_INTTM00 0x11
|
93 |
|
|
#define CYGNUM_HAL_VECTOR_INTTM01 0x12
|
94 |
|
|
#define CYGNUM_HAL_VECTOR_INTTM10 0x13
|
95 |
|
|
#define CYGNUM_HAL_VECTOR_INTTM11 0x14
|
96 |
|
|
#define CYGNUM_HAL_VECTOR_INTTM2 0x15
|
97 |
|
|
#define CYGNUM_HAL_VECTOR_INTTM3 0x16
|
98 |
|
|
#define CYGNUM_HAL_VECTOR_INTTM4 0x17
|
99 |
|
|
#define CYGNUM_HAL_VECTOR_INTTM5 0x18
|
100 |
|
|
#define CYGNUM_HAL_VECTOR_INTIIC0 0x19
|
101 |
|
|
#define CYGNUM_HAL_VECTOR_INTCSI0 0x19
|
102 |
|
|
#define CYGNUM_HAL_VECTOR_INTSER0 0x1A
|
103 |
|
|
#define CYGNUM_HAL_VECTOR_INTSR0 0x1B
|
104 |
|
|
#define CYGNUM_HAL_VECTOR_INTCSI1 0x1B
|
105 |
|
|
#define CYGNUM_HAL_VECTOR_INTST0 0x1C
|
106 |
|
|
#define CYGNUM_HAL_VECTOR_INTCSI2 0x1D
|
107 |
|
|
#define CYGNUM_HAL_VECTOR_INTSER1 0x1E
|
108 |
|
|
#define CYGNUM_HAL_VECTOR_INTSR1 0x1F
|
109 |
|
|
#define CYGNUM_HAL_VECTOR_INTST1 0x20
|
110 |
|
|
#define CYGNUM_HAL_VECTOR_INTAD 0x21
|
111 |
|
|
#define CYGNUM_HAL_VECTOR_INTDMA0 0x22
|
112 |
|
|
#define CYGNUM_HAL_VECTOR_INTDMA1 0x23
|
113 |
|
|
#define CYGNUM_HAL_VECTOR_INTDMA2 0x24
|
114 |
|
|
#define CYGNUM_HAL_VECTOR_INTWTN 0x25
|
115 |
|
|
|
116 |
|
|
#define CYGNUM_HAL_VSR_MIN 0
|
117 |
|
|
#define CYGNUM_HAL_VSR_MAX 0x25
|
118 |
|
|
#define CYGNUM_HAL_VSR_COUNT 0x26
|
119 |
|
|
|
120 |
|
|
#elif CYGINT_HAL_V850_VARIANT_SB1
|
121 |
|
|
|
122 |
|
|
#define CYGNUM_HAL_VECTOR_INTWTNI 0x14
|
123 |
|
|
#define CYGNUM_HAL_VECTOR_INTTM00 0x15
|
124 |
|
|
#define CYGNUM_HAL_VECTOR_INTTM01 0x16
|
125 |
|
|
#define CYGNUM_HAL_VECTOR_INTTM10 0x17
|
126 |
|
|
#define CYGNUM_HAL_VECTOR_INTTM11 0x18
|
127 |
|
|
#define CYGNUM_HAL_VECTOR_INTTM2 0x19
|
128 |
|
|
#define CYGNUM_HAL_VECTOR_INTTM3 0x1A
|
129 |
|
|
#define CYGNUM_HAL_VECTOR_INTTM4 0x1B
|
130 |
|
|
#define CYGNUM_HAL_VECTOR_INTTM5 0x1C
|
131 |
|
|
#define CYGNUM_HAL_VECTOR_INTTM6 0x1D
|
132 |
|
|
#define CYGNUM_HAL_VECTOR_INTTM7 0x1E
|
133 |
|
|
#define CYGNUM_HAL_VECTOR_INTIIC0 0x1F
|
134 |
|
|
#define CYGNUM_HAL_VECTOR_INTCSI0 0x1F
|
135 |
|
|
#define CYGNUM_HAL_VECTOR_INTSER0 0x20
|
136 |
|
|
#define CYGNUM_HAL_VECTOR_INTSR0 0x21
|
137 |
|
|
#define CYGNUM_HAL_VECTOR_INTCSI1 0x21
|
138 |
|
|
#define CYGNUM_HAL_VECTOR_INTST0 0x22
|
139 |
|
|
#define CYGNUM_HAL_VECTOR_INTCSI2 0x23
|
140 |
|
|
#define CYGNUM_HAL_VECTOR_INTIIC1 0x24
|
141 |
|
|
#define CYGNUM_HAL_VECTOR_INTSER1 0x25
|
142 |
|
|
#define CYGNUM_HAL_VECTOR_INTSR1 0x26
|
143 |
|
|
#define CYGNUM_HAL_VECTOR_INTCSI3 0x26
|
144 |
|
|
#define CYGNUM_HAL_VECTOR_INTST1 0x27
|
145 |
|
|
#define CYGNUM_HAL_VECTOR_INTCSI4 0x28
|
146 |
|
|
#ifdef __SB2
|
147 |
|
|
#define CYGNUM_HAL_VECTOR_INTIE1 0x29
|
148 |
|
|
#define CYGNUM_HAL_VECTOR_INTIE2 0x2A
|
149 |
|
|
#endif
|
150 |
|
|
#define CYGNUM_HAL_VECTOR_INTAD 0x2B
|
151 |
|
|
#define CYGNUM_HAL_VECTOR_INTDMA0 0x2C
|
152 |
|
|
#define CYGNUM_HAL_VECTOR_INTDMA1 0x2D
|
153 |
|
|
#define CYGNUM_HAL_VECTOR_INTDMA2 0x2E
|
154 |
|
|
#define CYGNUM_HAL_VECTOR_INTDMA3 0x2F
|
155 |
|
|
#define CYGNUM_HAL_VECTOR_INTDMA4 0x30
|
156 |
|
|
#define CYGNUM_HAL_VECTOR_INTDMA5 0x31
|
157 |
|
|
#define CYGNUM_HAL_VECTOR_INTWTN 0x32
|
158 |
|
|
#define CYGNUM_HAL_VECTOR_INTKR 0x33
|
159 |
|
|
|
160 |
|
|
|
161 |
|
|
#define CYGNUM_HAL_VSR_MIN 0
|
162 |
|
|
#define CYGNUM_HAL_VSR_MAX 0x33
|
163 |
|
|
#define CYGNUM_HAL_VSR_COUNT ((CYGNUM_HAL_VSR_MAX-CYGNUM_HAL_VSR_MIN)+1)
|
164 |
|
|
|
165 |
|
|
#else
|
166 |
|
|
# error No v850 variant implemented!
|
167 |
|
|
#endif
|
168 |
|
|
|
169 |
|
|
// Min/Max exception numbers and how many there are
|
170 |
|
|
#define CYGNUM_HAL_EXCEPTION_MIN 0
|
171 |
|
|
#define CYGNUM_HAL_EXCEPTION_MAX 7
|
172 |
|
|
#define CYGNUM_HAL_EXCEPTION_COUNT ((CYGNUM_HAL_EXCEPTION_MAX-CYGNUM_HAL_EXCEPTION_MIN)+1)
|
173 |
|
|
|
174 |
|
|
// Min/Max ISR numbers and how many there are
|
175 |
|
|
#define CYGNUM_HAL_ISR_MIN 0x08
|
176 |
|
|
#define CYGNUM_HAL_ISR_MAX CYGNUM_HAL_VSR_MAX
|
177 |
|
|
#define CYGNUM_HAL_ISR_COUNT ((CYGNUM_HAL_ISR_MAX-CYGNUM_HAL_ISR_MIN)+1)
|
178 |
|
|
|
179 |
|
|
// The vector used by the Real time clock.
|
180 |
|
|
#define CYGNUM_HAL_INTERRUPT_RTC CYGNUM_HAL_VECTOR_INTTM10
|
181 |
|
|
|
182 |
|
|
// Mapping from interrupt numbers to hardware registers
|
183 |
|
|
#if CYGINT_HAL_V850_VARIANT_SA1
|
184 |
|
|
#define CYG_HAL_V85X_INTERRUPT_CONTROL_REGISTERS \
|
185 |
|
|
(volatile unsigned char *)V850_REG_WDTIC, \
|
186 |
|
|
(volatile unsigned char *)V850_REG_PIC0, \
|
187 |
|
|
(volatile unsigned char *)V850_REG_PIC1, \
|
188 |
|
|
(volatile unsigned char *)V850_REG_PIC2, \
|
189 |
|
|
(volatile unsigned char *)V850_REG_PIC3, \
|
190 |
|
|
(volatile unsigned char *)V850_REG_PIC4, \
|
191 |
|
|
(volatile unsigned char *)V850_REG_PIC5, \
|
192 |
|
|
(volatile unsigned char *)V850_REG_PIC6, \
|
193 |
|
|
(volatile unsigned char *)V850_REG_WTNIIC, \
|
194 |
|
|
(volatile unsigned char *)V850_REG_TMIC00, \
|
195 |
|
|
(volatile unsigned char *)V850_REG_TMIC01, \
|
196 |
|
|
(volatile unsigned char *)V850_REG_TMIC10, \
|
197 |
|
|
(volatile unsigned char *)V850_REG_TMIC11, \
|
198 |
|
|
(volatile unsigned char *)V850_REG_TMIC2, \
|
199 |
|
|
(volatile unsigned char *)V850_REG_TMIC3, \
|
200 |
|
|
(volatile unsigned char *)V850_REG_TMIC4, \
|
201 |
|
|
(volatile unsigned char *)V850_REG_TMIC5, \
|
202 |
|
|
(volatile unsigned char *)V850_REG_CSIC0, \
|
203 |
|
|
(volatile unsigned char *)V850_REG_SERIC0, \
|
204 |
|
|
(volatile unsigned char *)V850_REG_CSIC1, \
|
205 |
|
|
(volatile unsigned char *)V850_REG_STIC0, \
|
206 |
|
|
(volatile unsigned char *)V850_REG_CSIC2, \
|
207 |
|
|
(volatile unsigned char *)V850_REG_SERIC1, \
|
208 |
|
|
(volatile unsigned char *)V850_REG_SRIC1, \
|
209 |
|
|
(volatile unsigned char *)V850_REG_STIC1, \
|
210 |
|
|
(volatile unsigned char *)V850_REG_ADIC, \
|
211 |
|
|
(volatile unsigned char *)V850_REG_DMAIC0, \
|
212 |
|
|
(volatile unsigned char *)V850_REG_DMAIC1, \
|
213 |
|
|
(volatile unsigned char *)V850_REG_DMAIC2, \
|
214 |
|
|
(volatile unsigned char *)V850_REG_WTNIC
|
215 |
|
|
|
216 |
|
|
#elif CYGINT_HAL_V850_VARIANT_SB1
|
217 |
|
|
#define CYG_HAL_V85X_INTERRUPT_CONTROL_REGISTERS \
|
218 |
|
|
(volatile unsigned char *)V850_REG_WDTIC, \
|
219 |
|
|
(volatile unsigned char *)V850_REG_PIC0, \
|
220 |
|
|
(volatile unsigned char *)V850_REG_PIC1, \
|
221 |
|
|
(volatile unsigned char *)V850_REG_PIC2, \
|
222 |
|
|
(volatile unsigned char *)V850_REG_PIC3, \
|
223 |
|
|
(volatile unsigned char *)V850_REG_PIC4, \
|
224 |
|
|
(volatile unsigned char *)V850_REG_PIC5, \
|
225 |
|
|
(volatile unsigned char *)V850_REG_PIC6, \
|
226 |
|
|
NULL, \
|
227 |
|
|
NULL, \
|
228 |
|
|
NULL, \
|
229 |
|
|
NULL, \
|
230 |
|
|
(volatile unsigned char *)V850_REG_WTNIIC, \
|
231 |
|
|
(volatile unsigned char *)V850_REG_TMIC00, \
|
232 |
|
|
(volatile unsigned char *)V850_REG_TMIC01, \
|
233 |
|
|
(volatile unsigned char *)V850_REG_TMIC10, \
|
234 |
|
|
(volatile unsigned char *)V850_REG_TMIC11, \
|
235 |
|
|
(volatile unsigned char *)V850_REG_TMIC2, \
|
236 |
|
|
(volatile unsigned char *)V850_REG_TMIC3, \
|
237 |
|
|
(volatile unsigned char *)V850_REG_TMIC4, \
|
238 |
|
|
(volatile unsigned char *)V850_REG_TMIC5, \
|
239 |
|
|
(volatile unsigned char *)V850_REG_TMIC6, \
|
240 |
|
|
(volatile unsigned char *)V850_REG_TMIC7, \
|
241 |
|
|
(volatile unsigned char *)V850_REG_CSIC0, \
|
242 |
|
|
(volatile unsigned char *)V850_REG_SERIC0, \
|
243 |
|
|
(volatile unsigned char *)V850_REG_CSIC1, \
|
244 |
|
|
(volatile unsigned char *)V850_REG_STIC0, \
|
245 |
|
|
(volatile unsigned char *)V850_REG_CSIC2, \
|
246 |
|
|
(volatile unsigned char *)V850_REG_IICIC1, \
|
247 |
|
|
(volatile unsigned char *)V850_REG_SERIC1, \
|
248 |
|
|
(volatile unsigned char *)V850_REG_CSIC3, \
|
249 |
|
|
(volatile unsigned char *)V850_REG_STIC1, \
|
250 |
|
|
(volatile unsigned char *)V850_REG_CSIC4, \
|
251 |
|
|
(volatile unsigned char *)V850_REG_IEBIC1, \
|
252 |
|
|
(volatile unsigned char *)V850_REG_IEBIC2, \
|
253 |
|
|
(volatile unsigned char *)V850_REG_ADIC, \
|
254 |
|
|
(volatile unsigned char *)V850_REG_DMAIC0, \
|
255 |
|
|
(volatile unsigned char *)V850_REG_DMAIC1, \
|
256 |
|
|
(volatile unsigned char *)V850_REG_DMAIC2, \
|
257 |
|
|
(volatile unsigned char *)V850_REG_DMAIC3, \
|
258 |
|
|
(volatile unsigned char *)V850_REG_DMAIC4, \
|
259 |
|
|
(volatile unsigned char *)V850_REG_DMAIC5, \
|
260 |
|
|
(volatile unsigned char *)V850_REG_WTNIC, \
|
261 |
|
|
(volatile unsigned char *)V850_REG_KRIC
|
262 |
|
|
|
263 |
|
|
#endif // elif CYGINT_HAL_V850_VARIANT_SB1
|
264 |
|
|
|
265 |
|
|
//--------------------------------------------------------------------------
|
266 |
|
|
// Clock control
|
267 |
|
|
|
268 |
|
|
// This is handled by the default code
|
269 |
|
|
|
270 |
|
|
//--------------------------------------------------------------------------
|
271 |
|
|
#endif // ifndef CYGONCE_HAL_VAR_INTR_H
|
272 |
|
|
// End of var_intr.h
|