OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [mn10300/] [am33/] [current/] [include/] [var_intr.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#ifndef CYGONCE_HAL_VAR_INTR_H
2
#define CYGONCE_HAL_VAR_INTR_H
3
 
4
//==========================================================================
5
//
6
//      var_intr.h
7
//
8
//      AM33 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 Free Software Foundation, 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      
19
// version.                                                                 
20
//
21
// eCos is distributed in the hope that it will be useful, but WITHOUT      
22
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
23
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
24
// for more details.                                                        
25
//
26
// You should have received a copy of the GNU General Public License        
27
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
28
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
29
//
30
// As a special exception, if other files instantiate templates or use      
31
// macros or inline functions from this file, or you compile this file      
32
// and link it with other works to produce a work based on this file,       
33
// this file does not by itself cause the resulting work to be covered by   
34
// the GNU General Public License. However the source code for this file    
35
// must still be made available in accordance with section (3) of the GNU   
36
// General Public License v2.                                               
37
//
38
// This exception does not invalidate any other reasons why a work based    
39
// on this file might be covered by the GNU General Public License.         
40
// -------------------------------------------                              
41
// ####ECOSGPLCOPYRIGHTEND####                                              
42
//==========================================================================
43
//#####DESCRIPTIONBEGIN####
44
//
45
// Author(s):    nickg
46
// Contributors: nickg, jskov,
47
//               gthomas, jlarmour, dmoseley
48
// Date:         1999-02-16
49
// Purpose:      VR4300 Interrupt support
50
// Description:  The macros defined here provide the HAL APIs for handling
51
//               interrupts and the clock for AM33 variants of the MN10300
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
 
71
// The MN10300 has a somewhat complex interrupt structure. Besides the
72
// reset and NMI vectors there are seven maskable interrupt vectors
73
// which must point to code in the 64k starting at 0x40000000. There
74
// are also 25 Interrupt control groups, each of which can have 4
75
// interrupt lines attached, for a theoretical total of 100 interrupts
76
// (!). Some of these are dedicated to specific devices, other to
77
// external pins, and others are not connected to anything, resulting
78
// in only 45 that can actually be delivered. Each control group may
79
// be assigned one of seven interrupt levels, and is delivered to the
80
// corresponding vector. Software can then use a register to determine
81
// the delivering group and detect from there which interrupt has been
82
// delivered.
83
//
84
// The approach we will adopt at present is for the code attached to
85
// each vector to save state and jump via a table to a VSR. The
86
// default VSR will fully decode the delivered interrupt into a table
87
// of isr/data/object entries. VSR replacement will operate on the
88
// first level indirection table rather than the hardware
89
// vectors. This is the fastest mechanism, however it needs 100*3*4 +
90
// 7*4 = 1228 bytes for the tables.
91
// 
92
 
93
//--------------------------------------------------------------------------
94
// Interrupt vectors.
95
 
96
// The level-specific hardware vectors
97
// These correspond to VSRs and are the values to use for HAL_VSR_GET/SET
98
#define CYGNUM_HAL_VECTOR_0                     0
99
#define CYGNUM_HAL_VECTOR_1                     1
100
#define CYGNUM_HAL_VECTOR_2                     2
101
#define CYGNUM_HAL_VECTOR_3                     3
102
#define CYGNUM_HAL_VECTOR_4                     4
103
#define CYGNUM_HAL_VECTOR_5                     5
104
#define CYGNUM_HAL_VECTOR_6                     6
105
#define CYGNUM_HAL_VECTOR_NMI_ENTRY             7
106
#define CYGNUM_HAL_VECTOR_TRAP                  8
107
#define CYGNUM_HAL_VECTOR_NMI                   9
108
#define CYGNUM_HAL_VECTOR_WATCHDOG              10
109
#define CYGNUM_HAL_VECTOR_SYSTEM_ERROR          11
110
#define CYGNUM_HAL_VECTOR_JTAG                  12
111
#define CYGNUM_HAL_VECTOR_ISTEP                 13
112
#define CYGNUM_HAL_VECTOR_MISSA                 14
113
#define CYGNUM_HAL_VECTOR_UNIMP                 15
114
#define CYGNUM_HAL_VECTOR_PIEXE                 16
115
#define CYGNUM_HAL_VECTOR_MEMERR                17
116
#define CYGNUM_HAL_VECTOR_IBREAK                18
117
#define CYGNUM_HAL_VECTOR_DBSRL                 19
118
#define CYGNUM_HAL_VECTOR_PERIDB                20
119
#define CYGNUM_HAL_VECTOR_EXUNIMP               21
120
#define CYGNUM_HAL_VECTOR_OBREAK                22
121
#define CYGNUM_HAL_VECTOR_PRIV                  23
122
#define CYGNUM_HAL_VECTOR_BUSERR                24
123
#define CYGNUM_HAL_VECTOR_DBFLT                 25
124
#define CYGNUM_HAL_VECTOR_UNUSED_1              26
125
#define CYGNUM_HAL_VECTOR_UNUSED_2              27
126
 
127
 
128
#define CYGNUM_HAL_VSR_MIN                      0
129
#define CYGNUM_HAL_VSR_MAX                      27
130
#define CYGNUM_HAL_VSR_COUNT                    28
131
 
132
// Exception numbers. These are the values used when passed out to an
133
// external exception handler using cyg_hal_deliver_exception()
134
 
135
#define CYGNUM_HAL_EXCEPTION_NMI               CYGNUM_HAL_VECTOR_NMI
136
#define CYGNUM_HAL_EXCEPTION_WATCHDOG          CYGNUM_HAL_VECTOR_WATCHDOG
137
#define CYGNUM_HAL_EXCEPTION_SYSTEM_ERROR      CYGNUM_HAL_VECTOR_SYSTEM_ERROR
138
#define CYGNUM_HAL_EXCEPTION_TRAP              CYGNUM_HAL_VECTOR_TRAP
139
#define CYGNUM_HAL_EXCEPTION_JTAG              CYGNUM_HAL_VECTOR_JTAG
140
#define CYGNUM_HAL_EXCEPTION_ISTEP             CYGNUM_HAL_VECTOR_ISTEP
141
#define CYGNUM_HAL_EXCEPTION_MISSA             CYGNUM_HAL_VECTOR_MISSA
142
#define CYGNUM_HAL_EXCEPTION_UNIMP             CYGNUM_HAL_VECTOR_UNIMP
143
#define CYGNUM_HAL_EXCEPTION_PIEXE             CYGNUM_HAL_VECTOR_PIEXE
144
#define CYGNUM_HAL_EXCEPTION_MEMERR            CYGNUM_HAL_VECTOR_MEMERR
145
#define CYGNUM_HAL_EXCEPTION_IBREAK            CYGNUM_HAL_VECTOR_IBREAK
146
#define CYGNUM_HAL_EXCEPTION_DBSRL             CYGNUM_HAL_VECTOR_DBSRL
147
#define CYGNUM_HAL_EXCEPTION_PERIDB            CYGNUM_HAL_VECTOR_PERIDB
148
#define CYGNUM_HAL_EXCEPTION_EXUNIMP           CYGNUM_HAL_VECTOR_EXUNIMP
149
#define CYGNUM_HAL_EXCEPTION_OBREAK            CYGNUM_HAL_VECTOR_OBREAK
150
#define CYGNUM_HAL_EXCEPTION_PRIV              CYGNUM_HAL_VECTOR_PRIV
151
#define CYGNUM_HAL_EXCEPTION_BUSERR            CYGNUM_HAL_VECTOR_BUSERR
152
#define CYGNUM_HAL_EXCEPTION_DBLFLT            CYGNUM_HAL_VECTOR_DBLFLT
153
 
154
 
155
#define CYGNUM_HAL_EXCEPTION_MIN               CYGNUM_HAL_VSR_MIN
156
#define CYGNUM_HAL_EXCEPTION_MAX               CYGNUM_HAL_VSR_MAX
157
#define CYGNUM_HAL_EXCEPTION_COUNT             CYGNUM_HAL_VSR_COUNT
158
 
159
#define CYGNUM_HAL_EXCEPTION_INTERRUPT         CYGNUM_HAL_EXCEPTION_SYSTEM_ERROR
160
#define CYGNUM_HAL_VECTOR_BREAKPOINT           CYGNUM_HAL_EXCEPTION_SYSTEM_ERROR
161
 
162
// Canonical names for various exceptions. These are used
163
// by generic exception handling code to make sense of
164
// excptions that have been delivered.
165
 
166
#define CYGNUM_HAL_EXCEPTION_DATA_ACCESS       \
167
          CYGNUM_HAL_EXCEPTION_BUSERR
168
#define CYGNUM_HAL_EXCEPTION_DATA_UNALIGNED_ACCESS \
169
          CYGNUM_HAL_EXCEPTION_MISSA
170
#define CYGNUM_HAL_EXCEPTION_ILLEGAL_INSTRUCTION \
171
          CYGNUM_HAL_EXCEPTION_UNIMP
172
 
173
 
174
// The decoded interrupts
175
 
176
#define CYGNUM_HAL_INTERRUPT_NMIRQ                0
177
#define CYGNUM_HAL_INTERRUPT_WATCHDOG             1
178
#define CYGNUM_HAL_INTERRUPT_SYSTEM_ERROR         2
179
#define CYGNUM_HAL_INTERRUPT_RESERVED_3           3
180
 
181
#define CYGNUM_HAL_INTERRUPT_RESERVED_4           4
182
#define CYGNUM_HAL_INTERRUPT_RESERVED_5           5
183
#define CYGNUM_HAL_INTERRUPT_RESERVED_6           6
184
#define CYGNUM_HAL_INTERRUPT_RESERVED_7           7
185
 
186
#define CYGNUM_HAL_INTERRUPT_TIMER_0              8
187
#define CYGNUM_HAL_INTERRUPT_RESERVED_9           9
188
#define CYGNUM_HAL_INTERRUPT_RESERVED_10          10
189
#define CYGNUM_HAL_INTERRUPT_RESERVED_11          11
190
 
191
#define CYGNUM_HAL_INTERRUPT_TIMER_1              12
192
#define CYGNUM_HAL_INTERRUPT_RESERVED_13          13
193
#define CYGNUM_HAL_INTERRUPT_RESERVED_14          14
194
#define CYGNUM_HAL_INTERRUPT_RESERVED_15          15
195
 
196
#define CYGNUM_HAL_INTERRUPT_TIMER_2              16
197
#define CYGNUM_HAL_INTERRUPT_RESERVED_17          17
198
#define CYGNUM_HAL_INTERRUPT_RESERVED_18          18
199
#define CYGNUM_HAL_INTERRUPT_RESERVED_19          19
200
 
201
#define CYGNUM_HAL_INTERRUPT_TIMER_3              20
202
#define CYGNUM_HAL_INTERRUPT_RESERVED_21          21
203
#define CYGNUM_HAL_INTERRUPT_RESERVED_22          22
204
#define CYGNUM_HAL_INTERRUPT_RESERVED_23          23
205
 
206
#define CYGNUM_HAL_INTERRUPT_TIMER_4              24
207
#define CYGNUM_HAL_INTERRUPT_RESERVED_25          25
208
#define CYGNUM_HAL_INTERRUPT_RESERVED_26          26
209
#define CYGNUM_HAL_INTERRUPT_RESERVED_27          27
210
 
211
#define CYGNUM_HAL_INTERRUPT_TIMER_5              28
212
#define CYGNUM_HAL_INTERRUPT_RESERVED_29          29
213
#define CYGNUM_HAL_INTERRUPT_RESERVED_30          30
214
#define CYGNUM_HAL_INTERRUPT_RESERVED_31          31
215
 
216
#define CYGNUM_HAL_INTERRUPT_TIMER_6              32
217
#define CYGNUM_HAL_INTERRUPT_RESERVED_33          33
218
#define CYGNUM_HAL_INTERRUPT_RESERVED_34          34
219
#define CYGNUM_HAL_INTERRUPT_RESERVED_35          35
220
 
221
#define CYGNUM_HAL_INTERRUPT_TIMER_6_COMPARE_A    36
222
#define CYGNUM_HAL_INTERRUPT_RESERVED_37          37
223
#define CYGNUM_HAL_INTERRUPT_RESERVED_38          38
224
#define CYGNUM_HAL_INTERRUPT_RESERVED_39          39
225
 
226
#define CYGNUM_HAL_INTERRUPT_TIMER_6_COMPARE_B    40
227
#define CYGNUM_HAL_INTERRUPT_RESERVED_41          41
228
#define CYGNUM_HAL_INTERRUPT_RESERVED_42          42
229
#define CYGNUM_HAL_INTERRUPT_RESERVED_43          43
230
 
231
#define CYGNUM_HAL_INTERRUPT_TIMER_7              44
232
#define CYGNUM_HAL_INTERRUPT_RESERVED_45          45
233
#define CYGNUM_HAL_INTERRUPT_RESERVED_46          46
234
#define CYGNUM_HAL_INTERRUPT_RESERVED_47          47
235
 
236
#define CYGNUM_HAL_INTERRUPT_TIMER_8              48
237
#define CYGNUM_HAL_INTERRUPT_RESERVED_49          49
238
#define CYGNUM_HAL_INTERRUPT_RESERVED_50          50
239
#define CYGNUM_HAL_INTERRUPT_RESERVED_51          51
240
 
241
#define CYGNUM_HAL_INTERRUPT_TIMER_9              52
242
#define CYGNUM_HAL_INTERRUPT_RESERVED_53          53
243
#define CYGNUM_HAL_INTERRUPT_RESERVED_54          54
244
#define CYGNUM_HAL_INTERRUPT_RESERVED_55          55
245
 
246
#define CYGNUM_HAL_INTERRUPT_TIMER_10             56
247
#define CYGNUM_HAL_INTERRUPT_RESERVED_57          57
248
#define CYGNUM_HAL_INTERRUPT_RESERVED_58          58
249
#define CYGNUM_HAL_INTERRUPT_RESERVED_59          59
250
 
251
#define CYGNUM_HAL_INTERRUPT_TIMER_11             60
252
#define CYGNUM_HAL_INTERRUPT_RESERVED_61          61
253
#define CYGNUM_HAL_INTERRUPT_RESERVED_62          62
254
#define CYGNUM_HAL_INTERRUPT_RESERVED_63          63
255
 
256
#define CYGNUM_HAL_INTERRUPT_DMA0                 64
257
#define CYGNUM_HAL_INTERRUPT_RESERVED_65          65
258
#define CYGNUM_HAL_INTERRUPT_RESERVED_66          66
259
#define CYGNUM_HAL_INTERRUPT_RESERVED_67          67
260
 
261
#define CYGNUM_HAL_INTERRUPT_DMA1                 68
262
#define CYGNUM_HAL_INTERRUPT_RESERVED_69          69
263
#define CYGNUM_HAL_INTERRUPT_RESERVED_70          70
264
#define CYGNUM_HAL_INTERRUPT_RESERVED_71          71
265
 
266
#define CYGNUM_HAL_INTERRUPT_DMA2                 72
267
#define CYGNUM_HAL_INTERRUPT_RESERVED_73          73
268
#define CYGNUM_HAL_INTERRUPT_RESERVED_74          74
269
#define CYGNUM_HAL_INTERRUPT_RESERVED_75          75
270
 
271
#define CYGNUM_HAL_INTERRUPT_DMA3                 76
272
#define CYGNUM_HAL_INTERRUPT_RESERVED_77          77
273
#define CYGNUM_HAL_INTERRUPT_RESERVED_78          78
274
#define CYGNUM_HAL_INTERRUPT_RESERVED_79          79
275
 
276
#define CYGNUM_HAL_INTERRUPT_SERIAL_0_RX          80
277
#define CYGNUM_HAL_INTERRUPT_RESERVED_81          81
278
#define CYGNUM_HAL_INTERRUPT_RESERVED_82          82
279
#define CYGNUM_HAL_INTERRUPT_RESERVED_83          83
280
 
281
#define CYGNUM_HAL_INTERRUPT_SERIAL_0_TX          84
282
#define CYGNUM_HAL_INTERRUPT_RESERVED_85          85
283
#define CYGNUM_HAL_INTERRUPT_RESERVED_86          86
284
#define CYGNUM_HAL_INTERRUPT_RESERVED_87          87
285
 
286
#define CYGNUM_HAL_INTERRUPT_SERIAL_1_RX          88
287
#define CYGNUM_HAL_INTERRUPT_RESERVED_89          89
288
#define CYGNUM_HAL_INTERRUPT_RESERVED_90          90
289
#define CYGNUM_HAL_INTERRUPT_RESERVED_91          91
290
 
291
#define CYGNUM_HAL_INTERRUPT_SERIAL_1_TX          92
292
#define CYGNUM_HAL_INTERRUPT_RESERVED_93          93
293
#define CYGNUM_HAL_INTERRUPT_RESERVED_94          94
294
#define CYGNUM_HAL_INTERRUPT_RESERVED_95          95
295
 
296
#define CYGNUM_HAL_INTERRUPT_SERIAL_2_RX          96
297
#define CYGNUM_HAL_INTERRUPT_RESERVED_97          97
298
#define CYGNUM_HAL_INTERRUPT_RESERVED_98          98
299
#define CYGNUM_HAL_INTERRUPT_RESERVED_99          99
300
 
301
#define CYGNUM_HAL_INTERRUPT_SERIAL_2_TX          100
302
#define CYGNUM_HAL_INTERRUPT_RESERVED_101         101
303
#define CYGNUM_HAL_INTERRUPT_RESERVED_102         102
304
#define CYGNUM_HAL_INTERRUPT_RESERVED_103         103
305
 
306
#define CYGNUM_HAL_INTERRUPT_RESERVED_104         104
307
#define CYGNUM_HAL_INTERRUPT_RESERVED_105         105
308
#define CYGNUM_HAL_INTERRUPT_RESERVED_106         106
309
#define CYGNUM_HAL_INTERRUPT_RESERVED_107         107
310
 
311
#define CYGNUM_HAL_INTERRUPT_TD                   108
312
#define CYGNUM_HAL_INTERRUPT_RESERVED_109         109
313
#define CYGNUM_HAL_INTERRUPT_RESERVED_110         110
314
#define CYGNUM_HAL_INTERRUPT_RESERVED_111         111
315
 
316
#define CYGNUM_HAL_INTERRUPT_AV                   112
317
#define CYGNUM_HAL_INTERRUPT_RESERVED_113         113
318
#define CYGNUM_HAL_INTERRUPT_RESERVED_114         114
319
#define CYGNUM_HAL_INTERRUPT_RESERVED_115         115
320
 
321
#define CYGNUM_HAL_INTERRUPT_TD_DMA               116
322
#define CYGNUM_HAL_INTERRUPT_RESERVED_117         117
323
#define CYGNUM_HAL_INTERRUPT_RESERVED_118         118
324
#define CYGNUM_HAL_INTERRUPT_RESERVED_119         119
325
 
326
#define CYGNUM_HAL_INTERRUPT_IC_IF_0              120
327
#define CYGNUM_HAL_INTERRUPT_RESERVED_121         121
328
#define CYGNUM_HAL_INTERRUPT_RESERVED_122         122
329
#define CYGNUM_HAL_INTERRUPT_RESERVED_123         123
330
 
331
#define CYGNUM_HAL_INTERRUPT_IC_IF_1              124
332
#define CYGNUM_HAL_INTERRUPT_RESERVED_125         125
333
#define CYGNUM_HAL_INTERRUPT_RESERVED_126         126
334
#define CYGNUM_HAL_INTERRUPT_RESERVED_127         127
335
 
336
#define CYGNUM_HAL_INTERRUPT_I2C_0                128
337
#define CYGNUM_HAL_INTERRUPT_RESERVED_129       129
338
#define CYGNUM_HAL_INTERRUPT_RESERVED_130       130
339
#define CYGNUM_HAL_INTERRUPT_RESERVED_131       131
340
 
341
#define CYGNUM_HAL_INTERRUPT_I2C_1              132
342
#define CYGNUM_HAL_INTERRUPT_RESERVED_133       133
343
#define CYGNUM_HAL_INTERRUPT_RESERVED_134       134
344
#define CYGNUM_HAL_INTERRUPT_RESERVED_135       135
345
 
346
#define CYGNUM_HAL_INTERRUPT_KEY                136
347
#define CYGNUM_HAL_INTERRUPT_RESERVED_137       137
348
#define CYGNUM_HAL_INTERRUPT_RESERVED_138       138
349
#define CYGNUM_HAL_INTERRUPT_RESERVED_139       139
350
 
351
#define CYGNUM_HAL_INTERRUPT_IR_INPUT_0         140
352
#define CYGNUM_HAL_INTERRUPT_RESERVED_141       141
353
#define CYGNUM_HAL_INTERRUPT_RESERVED_142       142
354
#define CYGNUM_HAL_INTERRUPT_RESERVED_143       143
355
 
356
#define CYGNUM_HAL_INTERRUPT_IR_INPUT_1         144
357
#define CYGNUM_HAL_INTERRUPT_RESERVED_145       145
358
#define CYGNUM_HAL_INTERRUPT_RESERVED_146       146
359
#define CYGNUM_HAL_INTERRUPT_RESERVED_147       147
360
 
361
#define CYGNUM_HAL_INTERRUPT_IR_OUTPUT          148
362
#define CYGNUM_HAL_INTERRUPT_RESERVED_149       149
363
#define CYGNUM_HAL_INTERRUPT_RESERVED_150       150
364
#define CYGNUM_HAL_INTERRUPT_RESERVED_151       151
365
 
366
#define CYGNUM_HAL_INTERRUPT_ICAM_0             152
367
#define CYGNUM_HAL_INTERRUPT_RESERVED_153       153
368
#define CYGNUM_HAL_INTERRUPT_RESERVED_154       154
369
#define CYGNUM_HAL_INTERRUPT_RESERVED_155       155
370
 
371
#define CYGNUM_HAL_INTERRUPT_ICAM_1             156
372
#define CYGNUM_HAL_INTERRUPT_RESERVED_157       157
373
#define CYGNUM_HAL_INTERRUPT_RESERVED_158       158
374
#define CYGNUM_HAL_INTERRUPT_RESERVED_159       159
375
 
376
#define CYGNUM_HAL_INTERRUPT_AFE                160
377
#define CYGNUM_HAL_INTERRUPT_RESERVED_161       161
378
#define CYGNUM_HAL_INTERRUPT_RESERVED_162       162
379
#define CYGNUM_HAL_INTERRUPT_RESERVED_163       163
380
 
381
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_0         164
382
#define CYGNUM_HAL_INTERRUPT_RESERVED_165       165
383
#define CYGNUM_HAL_INTERRUPT_RESERVED_166       166
384
#define CYGNUM_HAL_INTERRUPT_RESERVED_167       167
385
 
386
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_1         168
387
#define CYGNUM_HAL_INTERRUPT_RESERVED_169       169
388
#define CYGNUM_HAL_INTERRUPT_RESERVED_170       170
389
#define CYGNUM_HAL_INTERRUPT_RESERVED_171       171
390
 
391
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_2         172
392
#define CYGNUM_HAL_INTERRUPT_RESERVED_173       173
393
#define CYGNUM_HAL_INTERRUPT_RESERVED_174       174
394
#define CYGNUM_HAL_INTERRUPT_RESERVED_175       175
395
 
396
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_3         176
397
#define CYGNUM_HAL_INTERRUPT_RESERVED_177       177
398
#define CYGNUM_HAL_INTERRUPT_RESERVED_178       178
399
#define CYGNUM_HAL_INTERRUPT_RESERVED_179       179
400
 
401
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_4         180
402
#define CYGNUM_HAL_INTERRUPT_RESERVED_181       181
403
#define CYGNUM_HAL_INTERRUPT_RESERVED_182       182
404
#define CYGNUM_HAL_INTERRUPT_RESERVED_183       183
405
 
406
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_5         184
407
#define CYGNUM_HAL_INTERRUPT_RESERVED_185       185
408
#define CYGNUM_HAL_INTERRUPT_RESERVED_186       186
409
#define CYGNUM_HAL_INTERRUPT_RESERVED_187       187
410
 
411
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_6         188
412
#define CYGNUM_HAL_INTERRUPT_RESERVED_189       189
413
#define CYGNUM_HAL_INTERRUPT_RESERVED_190       190
414
#define CYGNUM_HAL_INTERRUPT_RESERVED_191       191
415
 
416
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_7         192
417
#define CYGNUM_HAL_INTERRUPT_RESERVED_193       193
418
#define CYGNUM_HAL_INTERRUPT_RESERVED_194       194
419
#define CYGNUM_HAL_INTERRUPT_RESERVED_195       195
420
 
421
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_8         196
422
#define CYGNUM_HAL_INTERRUPT_RESERVED_197       197
423
#define CYGNUM_HAL_INTERRUPT_RESERVED_198       198
424
#define CYGNUM_HAL_INTERRUPT_RESERVED_199       199
425
 
426
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_9         200
427
#define CYGNUM_HAL_INTERRUPT_RESERVED_201       201
428
#define CYGNUM_HAL_INTERRUPT_RESERVED_202       202
429
#define CYGNUM_HAL_INTERRUPT_RESERVED_203       203
430
 
431
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_10        204
432
#define CYGNUM_HAL_INTERRUPT_RESERVED_205       205
433
#define CYGNUM_HAL_INTERRUPT_RESERVED_206       206
434
#define CYGNUM_HAL_INTERRUPT_RESERVED_207       207
435
 
436
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_11        208
437
#define CYGNUM_HAL_INTERRUPT_RESERVED_209       209
438
#define CYGNUM_HAL_INTERRUPT_RESERVED_210       210
439
#define CYGNUM_HAL_INTERRUPT_RESERVED_211       211
440
 
441
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_12        212
442
#define CYGNUM_HAL_INTERRUPT_RESERVED_213       213
443
#define CYGNUM_HAL_INTERRUPT_RESERVED_214       214
444
#define CYGNUM_HAL_INTERRUPT_RESERVED_215       215
445
 
446
 
447
#define CYGNUM_HAL_ISR_MIN                     0
448
#define CYGNUM_HAL_ISR_MAX                     215
449
 
450
#define CYGNUM_HAL_ISR_COUNT                   (3+((CYGNUM_HAL_ISR_MAX+1)/4))
451
 
452
// The vector used by the Real time clock
453
 
454
#define CYGNUM_HAL_INTERRUPT_RTC                CYGNUM_HAL_INTERRUPT_TIMER_5
455
 
456
//--------------------------------------------------------------------------
457
// Interrupt vector translation.
458
 
459
#if !defined(HAL_TRANSLATE_VECTOR) && !defined(CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN)
460
 
461
#define HAL_TRANSLATE_VECTOR(_vector_,_index_)                             \
462
              _index_ = (((_vector_)<=CYGNUM_HAL_INTERRUPT_SYSTEM_ERROR) ? \
463
                         (_vector_) :                                      \
464
                         (((_vector_)>>2)+CYGNUM_HAL_INTERRUPT_RESERVED_3))
465
 
466
#endif
467
 
468
//--------------------------------------------------------------------------
469
// AM33 specific version of HAL_INTERRUPT_CONFIGURE
470
 
471
#define HAL_INTERRUPT_CONFIGURE( _vector_, _level_, _up_ )                    \
472
CYG_MACRO_START                                                               \
473
    if( (_vector_) >= CYGNUM_HAL_INTERRUPT_EXTERNAL_0 )                       \
474
    {                                                                         \
475
        cyg_uint32 _v_ = _vector_;                                            \
476
        cyg_uint16 _val_ = 0;                                                 \
477
        cyg_uint32 _reg_;                                                     \
478
                                                                              \
479
        /* adjust vector to bit offset in EXTMD */                            \
480
        _v_ -= CYGNUM_HAL_INTERRUPT_EXTERNAL_0;                               \
481
        _v_ >>= 1;                                                            \
482
                                                                              \
483
        /* set bits according to requirements */                              \
484
        if( _up_ ) _val_ |= 1;                                                \
485
        if( !(_level_) ) _val_ |= 2;                                          \
486
                                                                              \
487
        /* get EXTMD */                                                       \
488
        _reg_ = *(volatile cyg_uint32 *)&mn10300_interrupt_control[0x200>>1]; \
489
                                                                              \
490
        /* clear old value and set new */                                     \
491
        _reg_ &= ~(3<<_v_);                                                   \
492
        _reg_ |= _val_<<_v_;                                                  \
493
                                                                              \
494
        /* restore EXTMD */                                                   \
495
        *(volatile cyg_uint32 *)&mn10300_interrupt_control[0x200>>1] = _reg_; \
496
    }                                                                         \
497
CYG_MACRO_END
498
 
499
#define HAL_INTERRUPT_CONFIGURE_DEFINED
500
 
501
//--------------------------------------------------------------------------
502
// Timer control registers.
503
// On the AM33 we use timers 4 and 5
504
 
505
#define TIMER4_CR        0xd40030a0
506
#define TIMER4_BR        0xd4003090
507
#define TIMER4_MD        0xd4003080
508
 
509
#define TIMER5_CR        0xd40030a2
510
#define TIMER5_BR        0xd4003092
511
#define TIMER5_MD        0xd4003082
512
 
513
//--------------------------------------------------------------------------
514
// Clock control.
515
extern cyg_uint32 __hal_period__;
516
 
517
#define HAL_CLOCK_INITIALIZE( _period_ )                                \
518
{                                                                       \
519
    volatile cyg_uint16 *timer4_br      = (cyg_uint16 *)TIMER4_BR;      \
520
    volatile cyg_uint8 *timer4_md       = (cyg_uint8 *)TIMER4_MD;       \
521
    volatile cyg_uint16 *timer5_br      = (cyg_uint16 *)TIMER5_BR;      \
522
    volatile cyg_uint8 *timer5_md       = (cyg_uint8 *)TIMER5_MD;       \
523
                                                                        \
524
    /* Set timers 4 and 5 into cascade mode */                          \
525
                                                                        \
526
    *timer5_br = (_period_)>>16;                                        \
527
                                                                        \
528
    *timer5_md = 0x40;                                                  \
529
    *timer5_md = 0x83;                                                  \
530
                                                                        \
531
    *timer4_br = (_period_)&0x0000FFFF;                                 \
532
                                                                        \
533
    *timer4_md = 0x40;                                                  \
534
    *timer4_md = 0x80;                                                  \
535
                                                                        \
536
    __hal_period__ = _period_;                                          \
537
}
538
 
539
#define HAL_CLOCK_RESET( _vector_, _period_ )
540
 
541
#define HAL_CLOCK_READ( _pvalue_ )                                      \
542
{                                                                       \
543
    volatile cyg_uint16 *timer4_cr = (cyg_uint16 *)TIMER4_CR;           \
544
    volatile cyg_uint16 *timer5_cr = (cyg_uint16 *)TIMER5_CR;           \
545
                                                                        \
546
    cyg_uint16 t5;                                                      \
547
    cyg_uint16 t4;                                                      \
548
                                                                        \
549
    /* Loop reading the two timers until we can read t5 twice   */      \
550
    /* with the same value. This avoids getting silly times if  */      \
551
    /* the timers carry between reading the two regs.           */      \
552
    do {                                                                \
553
        t5 = *timer5_cr;                                                \
554
        t4 = *timer4_cr;                                                \
555
    } while( t5 != *timer5_cr );                                        \
556
                                                                        \
557
    *(_pvalue_) = __hal_period__ - ((t5<<16) + t4);                     \
558
}
559
 
560
externC void hal_delay_us(cyg_int32 usecs);
561
 
562
#define HAL_DELAY_US(n)          hal_delay_us(n);
563
 
564
 
565
//--------------------------------------------------------------------------
566
#endif // ifndef CYGONCE_HAL_VAR_INTR_H
567
// End of var_intr.h

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.