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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [mips/] [idt79s334a/] [v2_0/] [include/] [plf_intr.h] - Blame information for rev 565

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
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
//      RefIDT 79S344A 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):    tmichals
47
// Contributors: 
48
//              
49
// Date:         2002-09-20
50
// Purpose:      Define Interrupt support
51
// Description:  The macros defined here provide the HAL APIs for handling
52
//               interrupts and the clock for the IDT79S334A 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
#include <cyg/infra/cyg_type.h>
65
#include <cyg/hal/plf_io.h>
66
 
67
#define HAL_PLATFORM_RESET()            CYG_EMPTY_STATEMENT
68
 
69
#define HAL_PLATFORM_RESET_ENTRY        0xbfc00000
70
 
71
 
72
//--------------------------------------------------------------------------
73
// Interrupt vectors.
74
 
75
#ifndef CYGHWR_HAL_INTERRUPT_VECTORS_DEFINED
76
// the default for all MIPS variants is to use the 6 bits
77
// in the cause register.
78
 
79
#define CYGNUM_HAL_INTERRUPT_0                0
80
#define CYGNUM_HAL_INTERRUPT_1                1
81
#define CYGNUM_HAL_INTERRUPT_2                2
82
#define CYGNUM_HAL_INTERRUPT_3                3
83
#define CYGNUM_HAL_INTERRUPT_4                4
84
#define CYGNUM_HAL_INTERRUPT_5                5
85
 
86
// Min/Max ISR numbers and how many there are
87
#define CYGNUM_HAL_ISR_MIN                     0
88
#define CYGNUM_HAL_ISR_MAX                     30
89
#define CYGNUM_HAL_ISR_COUNT                   31
90
 
91
// The vector used by the Real time clock. The default here is to use
92
// interrupt 5, which is connected to the counter/comparator registers
93
// in many MIPS variants.
94
 
95
#define CYGNUM_HAL_PCI_A      CYGNUM_HAL_INTERRUPT_1
96
#define CYGNUM_HAL_PCI_B      CYGNUM_HAL_INTERRUPT_2
97
#define CYGNUM_HAL_PCI_C      CYGNUM_HAL_INTERRUPT_4
98
#define CYGNUM_EXPANSION          CYGNUM_HAL_INTERRUPT_3
99
 
100
 
101
#ifndef CYGNUM_HAL_INTERRUPT_RTC
102
#define CYGNUM_HAL_INTERRUPT_RTC            CYGNUM_HAL_INTERRUPT_5
103
#endif
104
 
105
/* please NOTE that slot D is taken for RTC */
106
#define CYGNUM_LAST_IDT_INTERRUPT       20
107
 
108
#define CYGNUM_HAL_INTERRUPT_SIO_0 25
109
#define CYGNUM_HAL_INTERRUPT_SIO_1 26
110
 
111
#define CYGNUM_HAL_PCI_A      CYGNUM_HAL_INTERRUPT_1
112
#define CYGNUM_HAL_PCI_B      CYGNUM_HAL_INTERRUPT_2
113
#define CYGNUM_HAL_PCI_C      CYGNUM_HAL_INTERRUPT_4
114
#define CYGNUM_EXPANSION          CYGNUM_HAL_INTERRUPT_3
115
 
116
 
117
#define CYGHWR_HAL_INTERRUPT_VECTORS_DEFINED
118
 
119
#endif
120
 
121
 
122
 
123
//--------------------------------------------------------------------------
124
// Interrupt controller access
125
// The default code here simply uses the fields present in the CP0 status
126
// and cause registers to implement this functionality.
127
// Beware of nops in this code. They fill delay slots and avoid CP0 hazards
128
// that might otherwise cause following code to run in the wrong state or
129
// cause a resource conflict.
130
 
131
#ifndef CYGHWR_HAL_INTERRUPT_CONTROLLER_ACCESS_DEFINED
132
 
133
#define HAL_INTERRUPT_MASK_CPU( _vector_ )          \
134
CYG_MACRO_START                                 \
135
    asm volatile (                              \
136
        "mfc0   $3,$12\n"                       \
137
        "la     $2,0x00000400\n"                \
138
        "sllv   $2,$2,%0\n"                     \
139
        "nor    $2,$2,$0\n"                     \
140
        "and    $3,$3,$2\n"                     \
141
        "mtc0   $3,$12\n"                       \
142
        "nop; nop; nop\n"                       \
143
        :                                       \
144
        : "r"(_vector_)                         \
145
        : "$2", "$3"                            \
146
        );                                      \
147
CYG_MACRO_END
148
 
149
#define HAL_INTERRUPT_UNMASK_CPU( _vector_ )        \
150
CYG_MACRO_START                                 \
151
    asm volatile (                              \
152
        "mfc0   $3,$12\n"                       \
153
        "la     $2,0x00000400\n"                \
154
        "sllv   $2,$2,%0\n"                     \
155
        "or     $3,$3,$2\n"                     \
156
        "mtc0   $3,$12\n"                       \
157
        "nop; nop; nop\n"                       \
158
        :                                       \
159
        : "r"(_vector_)                         \
160
        : "$2", "$3"                            \
161
        );                                      \
162
CYG_MACRO_END
163
 
164
#define HAL_INTERRUPT_ACKNOWLEDGE_CPU( _vector_ )   \
165
CYG_MACRO_START                                 \
166
    asm volatile (                              \
167
        "mfc0   $3,$13\n"                       \
168
        "la     $2,0x00000400\n"                \
169
        "sllv   $2,$2,%0\n"                     \
170
        "nor    $2,$2,$0\n"                     \
171
        "and    $3,$3,$2\n"                     \
172
        "mtc0   $3,$13\n"                       \
173
        "nop; nop; nop\n"                       \
174
        :                                       \
175
        : "r"(_vector_)                         \
176
        : "$2", "$3"                            \
177
        );                                      \
178
CYG_MACRO_END
179
 
180
#define HAL_INTERRUPT_CONFIGURE( _vector_, _level_, _up_ )
181
 
182
#define HAL_INTERRUPT_SET_LEVEL( _vector_, _level_ )
183
 
184
 
185
externC void cyg_hal_interrupt_mask(cyg_uint32 vector);
186
externC void cyg_hal_interrupt_unmask(cyg_uint32 vector);
187
externC void cyg_hal_interrupt_acknowledge(cyg_uint32 vector);
188
 
189
#define HAL_INTERRUPT_MASK( _vector_ )          \
190
CYG_MACRO_START                                 \
191
        cyg_hal_interrupt_mask ( (_vector_) );          \
192
CYG_MACRO_END
193
 
194
#define HAL_INTERRUPT_UNMASK( _vector_ )                  \
195
    CYG_MACRO_START                                       \
196
        cyg_hal_interrupt_unmask ( (_vector_) );          \
197
    CYG_MACRO_END
198
 
199
#define HAL_INTERRUPT_ACKNOWLEDGE( _vector_ )             \
200
    CYG_MACRO_START                                       \
201
        cyg_hal_interrupt_acknowledge ( (_vector_) );     \
202
    CYG_MACRO_END
203
 
204
#define CYGHWR_HAL_INTERRUPT_CONTROLLER_ACCESS_DEFINED
205
 
206
#endif
207
 
208
 
209
#endif /* ifndef CYGONCE_HAL_PLF_INTR_H */
210
//--------------------------------------------------------------------------
211
// End of plf_intr.h

powered by: WebSVN 2.1.0

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