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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [h8300/] [h8s/] [current/] [include/] [var_intr.h] - Blame information for rev 817

Go to most recent revision | 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
//      H8S 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):    yoshinori sato
46
// Contributors: yoshinori sato
47
// Date:         2003-01-01
48
// Purpose:      H8S Interrupt Support
49
// Description:  The macros defined here provide the HAL APIs for handling
50
//               interrupts and the clock for H8/300H variants of the H8/300
51
//               architecture.
52
//              
53
// Usage:
54
//              #include <cyg/hal/var_intr.h>
55
//              ...
56
//              
57
//
58
//####DESCRIPTIONEND####
59
//
60
//==========================================================================
61
 
62
#include <pkgconf/hal.h>
63
 
64
#include <cyg/infra/cyg_type.h>
65
 
66
#include <cyg/hal/plf_intr.h>
67
#include <cyg/hal/var_arch.h>
68
 
69
//--------------------------------------------------------------------------
70
// Interrupt vectors.
71
 
72
// The level-specific hardware vectors
73
// These correspond to VSRs and are the values to use for HAL_VSR_GET/SET
74
#define CYGNUM_HAL_VECTOR_RESET_P              0
75
#define CYGNUM_HAL_VECTOR_RESET_M              1
76
#define CYGNUM_HAL_VECTOR_RSV2                 2
77
#define CYGNUM_HAL_VECTOR_RSV3                 3
78
#define CYGNUM_HAL_VECTOR_RSV4                 4
79
#define CYGNUM_HAL_VECTOR_TRACE                5
80
#define CYGNUM_HAL_VECTOR_DIRECT               6
81
#define CYGNUM_HAL_VECTOR_NMI                  7
82
#define CYGNUM_HAL_VECTOR_TRAP0                8
83
#define CYGNUM_HAL_VECTOR_TRAP1                9
84
#define CYGNUM_HAL_VECTOR_TRAP2                10
85
#define CYGNUM_HAL_VECTOR_TRAP3                11
86
 
87
#define CYGNUM_HAL_VSR_MIN                     0
88
#define CYGNUM_HAL_VSR_MAX                     11
89
#define CYGNUM_HAL_VSR_COUNT                   12
90
 
91
// Exception numbers. These are the values used when passed out to an
92
// external exception handler using cyg_hal_deliver_exception()
93
 
94
#define CYGNUM_HAL_EXCEPTION_NMI               CYGNUM_HAL_VECTOR_NMI
95
 
96
#if 0
97
#define CYGNUM_HAL_EXCEPTION_DATA_ACCESS       0
98
#endif
99
 
100
#define CYGNUM_HAL_EXCEPTION_MIN               CYGNUM_HAL_VSR_MIN
101
#define CYGNUM_HAL_EXCEPTION_MAX               CYGNUM_HAL_VSR_MAX
102
#define CYGNUM_HAL_EXCEPTION_COUNT             CYGNUM_HAL_VSR_COUNT
103
 
104
// The decoded interrupts
105
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_0        16
106
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_1        17
107
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_2        18
108
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_3        19
109
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_4        20
110
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_5        21
111
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_6        22
112
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_7        23
113
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_8        24
114
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_9        25
115
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_10       26
116
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_11       27
117
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_12       28
118
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_13       29
119
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_14       30
120
#define CYGNUM_HAL_INTERRUPT_EXTERNAL_15       31
121
 
122
#define CYGNUM_HAL_INTERRUPT_DTC               32
123
#define CYGNUM_HAL_INTERRUPT_WDT               33
124
#define CYGNUM_HAL_INTERRUPT_RSV34             34
125
#define CYGNUM_HAL_INTERRUPT_RFSHCMI           35
126
#define CYGNUM_HAL_INTERRUPT_RSV36             36
127
#define CYGNUM_HAL_INTERRUPT_RSV37             37
128
#define CYGNUM_HAL_INTERRUPT_ADI               38
129
#define CYGNUM_HAL_INTERRUPT_RSV39             39
130
 
131
#define CYGNUM_HAL_INTERRUPT_TGI0A             40
132
#define CYGNUM_HAL_INTERRUPT_TGI0B             41
133
#define CYGNUM_HAL_INTERRUPT_TGI0C             42
134
#define CYGNUM_HAL_INTERRUPT_TGI0D             43
135
#define CYGNUM_HAL_INTERRUPT_TGI0V             44
136
#define CYGNUM_HAL_INTERRUPT_RSV45             45
137
#define CYGNUM_HAL_INTERRUPT_RSV46             46
138
#define CYGNUM_HAL_INTERRUPT_RSV47             47
139
 
140
#define CYGNUM_HAL_INTERRUPT_TGI1A             48
141
#define CYGNUM_HAL_INTERRUPT_TGI1B             49
142
#define CYGNUM_HAL_INTERRUPT_TGI1V             50
143
#define CYGNUM_HAL_INTERRUPT_TGI1U             51
144
 
145
#define CYGNUM_HAL_INTERRUPT_TGI2A             52
146
#define CYGNUM_HAL_INTERRUPT_TGI2B             53
147
#define CYGNUM_HAL_INTERRUPT_TGI2V             54
148
#define CYGNUM_HAL_INTERRUPT_TGI2U             55
149
 
150
#define CYGNUM_HAL_INTERRUPT_TGI3A             56
151
#define CYGNUM_HAL_INTERRUPT_TGI3B             57
152
#define CYGNUM_HAL_INTERRUPT_TGI3C             58
153
#define CYGNUM_HAL_INTERRUPT_TGI3D             59
154
#define CYGNUM_HAL_INTERRUPT_TGI3V             60
155
#define CYGNUM_HAL_INTERRUPT_RSV61             61
156
#define CYGNUM_HAL_INTERRUPT_RSV62             62
157
#define CYGNUM_HAL_INTERRUPT_RSV63             63
158
 
159
#define CYGNUM_HAL_INTERRUPT_TGI4A             64
160
#define CYGNUM_HAL_INTERRUPT_TGI4B             65
161
#define CYGNUM_HAL_INTERRUPT_TGI4V             66
162
#define CYGNUM_HAL_INTERRUPT_TGI4U             67
163
 
164
#define CYGNUM_HAL_INTERRUPT_TGI5A             68
165
#define CYGNUM_HAL_INTERRUPT_TGI5B             69
166
#define CYGNUM_HAL_INTERRUPT_TGI5V             70
167
#define CYGNUM_HAL_INTERRUPT_TGI5U             71
168
 
169
#define CYGNUM_HAL_INTERRUPT_CMIA0             72
170
#define CYGNUM_HAL_INTERRUPT_CMIB0             73
171
#define CYGNUM_HAL_INTERRUPT_OVI0              74
172
#define CYGNUM_HAL_INTERRUPT_RSV75             75
173
 
174
#define CYGNUM_HAL_INTERRUPT_CMIA1             76
175
#define CYGNUM_HAL_INTERRUPT_CMIB1             77
176
#define CYGNUM_HAL_INTERRUPT_OVI1              78
177
#define CYGNUM_HAL_INTERRUPT_RSV79             79
178
 
179
#define CYGNUM_HAL_INTERRUPT_DEND0A            80
180
#define CYGNUM_HAL_INTERRUPT_DEND0B            81
181
#define CYGNUM_HAL_INTERRUPT_DEND1A            82
182
#define CYGNUM_HAL_INTERRUPT_DEND1B            83
183
 
184
#define CYGNUM_HAL_INTERRUPT_EXDEND0           84
185
#define CYGNUM_HAL_INTERRUPT_EXDEND1           85
186
#define CYGNUM_HAL_INTERRUPT_EXDEND2           86
187
#define CYGNUM_HAL_INTERRUPT_EXDEND3           87
188
 
189
#define CYGNUM_HAL_INTERRUPT_ERI0              88
190
#define CYGNUM_HAL_INTERRUPT_RXI0              89
191
#define CYGNUM_HAL_INTERRUPT_TXI0              90
192
#define CYGNUM_HAL_INTERRUPT_TEI0              91
193
 
194
#define CYGNUM_HAL_INTERRUPT_ERI1              92
195
#define CYGNUM_HAL_INTERRUPT_RXI1              93
196
#define CYGNUM_HAL_INTERRUPT_TXI1              94
197
#define CYGNUM_HAL_INTERRUPT_TEI1              95
198
 
199
#define CYGNUM_HAL_INTERRUPT_ERI2              96
200
#define CYGNUM_HAL_INTERRUPT_RXI2              97
201
#define CYGNUM_HAL_INTERRUPT_TXI2              98
202
#define CYGNUM_HAL_INTERRUPT_TEI2              99
203
 
204
#define CYGNUM_HAL_INTERRUPT_RSV100            100
205
#define CYGNUM_HAL_INTERRUPT_RSV101            101
206
#define CYGNUM_HAL_INTERRUPT_RSV102            102
207
#define CYGNUM_HAL_INTERRUPT_RSV103            103
208
#define CYGNUM_HAL_INTERRUPT_RSV104            104
209
#define CYGNUM_HAL_INTERRUPT_RSV105            105
210
#define CYGNUM_HAL_INTERRUPT_RSV106            106
211
#define CYGNUM_HAL_INTERRUPT_RSV107            107
212
#define CYGNUM_HAL_INTERRUPT_RSV108            108
213
#define CYGNUM_HAL_INTERRUPT_RSV109            109
214
#define CYGNUM_HAL_INTERRUPT_RSV110            110
215
#define CYGNUM_HAL_INTERRUPT_RSV111            111
216
#define CYGNUM_HAL_INTERRUPT_RSV112            112
217
#define CYGNUM_HAL_INTERRUPT_RSV113            113
218
#define CYGNUM_HAL_INTERRUPT_RSV114            114
219
#define CYGNUM_HAL_INTERRUPT_RSV115            115
220
#define CYGNUM_HAL_INTERRUPT_RSV116            116
221
#define CYGNUM_HAL_INTERRUPT_RSV117            117
222
#define CYGNUM_HAL_INTERRUPT_RSV118            118
223
#define CYGNUM_HAL_INTERRUPT_RSV119            119
224
#define CYGNUM_HAL_INTERRUPT_RSV120            120
225
#define CYGNUM_HAL_INTERRUPT_RSV121            121
226
#define CYGNUM_HAL_INTERRUPT_RSV122            122
227
#define CYGNUM_HAL_INTERRUPT_RSV123            123
228
#define CYGNUM_HAL_INTERRUPT_RSV124            124
229
#define CYGNUM_HAL_INTERRUPT_RSV125            125
230
#define CYGNUM_HAL_INTERRUPT_RSV126            126
231
#define CYGNUM_HAL_INTERRUPT_RSV127            127
232
 
233
 
234
#define CYGNUM_HAL_ISR_MIN                     16
235
#define CYGNUM_HAL_ISR_MAX                     127
236
 
237
#define CYGNUM_HAL_ISR_COUNT                   (3+((CYGNUM_HAL_ISR_MAX+1)/4))
238
 
239
// The vector used by the Real time clock
240
 
241
#define CYGNUM_HAL_INTERRUPT_RTC                CYGNUM_HAL_INTERRUPT_CMIA1
242
 
243
//--------------------------------------------------------------------------
244
// Interrupt vector translation.
245
 
246
#if !defined(HAL_TRANSLATE_VECTOR) && !defined(CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN)
247
 
248
#define HAL_TRANSLATE_VECTOR(_vector_,_index_)                             \
249
              _index_ = (_vector_)
250
 
251
#endif
252
 
253
//--------------------------------------------------------------------------
254
// H8/300H specific version of HAL_INTERRUPT_CONFIGURE
255
 
256
#define HAL_INTERRUPT_CONFIGURE( _vector_, _level_, _up_ )                \
257
        hal_interrupt_configure( _vector_, _level_, _up_ )
258
 
259
externC void hal_interrupt_configure(int vector,int level,int up);
260
 
261
#define HAL_INTERRUPT_CONFIGURE_DEFINED
262
 
263
//--------------------------------------------------------------------------
264
// Interrupt control macros
265
 
266
#define HAL_DISABLE_INTERRUPTS(_old_)   \
267
        asm volatile (                  \
268
            "sub.l er0,er0\n\t"         \
269
            "stc exr,r0l\n\t"           \
270
            "orc #0x7,exr\n\t"          \
271
            "and.b #0x07,r0l\n\t"       \
272
            "mov.l er0,%0"              \
273
            : "=r"(_old_)               \
274
            :                           \
275
            : "er0"                     \
276
            );
277
 
278
#define HAL_ENABLE_INTERRUPTS()         \
279
        asm volatile (                  \
280
            "andc #0xf8,exr"            \
281
            );
282
 
283
#define HAL_RESTORE_INTERRUPTS(_old_)   \
284
        asm volatile (                  \
285
            "mov.l %0,er0\n\t"          \
286
            "and.b #0x07,r0l\n\t"       \
287
            "stc exr,r0h\n\t"           \
288
            "and.b #0xf8,r0h\n\t"       \
289
            "or.b r0h,r0l\n\t"          \
290
            "ldc r0l,exr"               \
291
            :                           \
292
            : "r"(_old_)                \
293
            : "er0"                     \
294
            );
295
 
296
#define HAL_QUERY_INTERRUPTS(_old_)     \
297
        asm volatile (                  \
298
            "sub.l er0,er0\n\t"         \
299
            "stc exr,r0l\n\t"           \
300
            "and.b #0x07,r0l\n\t"       \
301
            "mov.l er0,%0"              \
302
            : "=r"(_old_)               \
303
            );
304
 
305
//--------------------------------------------------------------------------
306
// Clock control.
307
 
308
externC void hal_clock_initialize(cyg_uint32 period);
309
externC void hal_clock_reset(cyg_uint32 vector,cyg_uint32 period);
310
externC void hal_clock_read(cyg_uint32 *pvalue);
311
 
312
#define HAL_CLOCK_INITIALIZE( _period_ ) \
313
        hal_clock_initialize( _period_ )
314
 
315
#define HAL_CLOCK_RESET( _vector_, _period_ ) \
316
        hal_clock_reset( _vector_, _period_ )
317
 
318
#define HAL_CLOCK_READ( _pvalue_ ) \
319
        hal_clock_read( _pvalue_ )
320
 
321
// FIXME: above line should not use CYGNUM_KERNEL_COUNTERS_RTC_PERIOD since
322
// this means the HAL gets configured by kernel options even when the
323
// kernel is disabled!
324
 
325
 
326
//--------------------------------------------------------------------------
327
#endif // ifndef CYGONCE_HAL_VAR_INTR_H
328
// 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.