]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/hal/sparc/arch/v2_0/src/hal_intr.c
Initial revision
[karo-tx-redboot.git] / packages / hal / sparc / arch / v2_0 / src / hal_intr.c
1 //==========================================================================
2 //
3 //      hal_intr.c
4 //
5 //      SPARC Architecture specific interrupt dispatch tables
6 //
7 //==========================================================================
8 //####ECOSGPLCOPYRIGHTBEGIN####
9 // -------------------------------------------
10 // This file is part of eCos, the Embedded Configurable Operating System.
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
12 //
13 // eCos is free software; you can redistribute it and/or modify it under
14 // the terms of the GNU General Public License as published by the Free
15 // Software Foundation; either version 2 or (at your option) any later version.
16 //
17 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20 // for more details.
21 //
22 // You should have received a copy of the GNU General Public License along
23 // with eCos; if not, write to the Free Software Foundation, Inc.,
24 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25 //
26 // As a special exception, if other files instantiate templates or use macros
27 // or inline functions from this file, or you compile this file and link it
28 // with other works to produce a work based on this file, this file does not
29 // by itself cause the resulting work to be covered by the GNU General Public
30 // License. However the source code for this file must still be made available
31 // in accordance with section (3) of the GNU General Public License.
32 //
33 // This exception does not invalidate any other reasons why a work based on
34 // this file might be covered by the GNU General Public License.
35 //
36 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37 // at http://sources.redhat.com/ecos/ecos-license/
38 // -------------------------------------------
39 //####ECOSGPLCOPYRIGHTEND####
40 //==========================================================================
41 //#####DESCRIPTIONBEGIN####
42 //
43 // Author(s):    hmt
44 // Contributors: hmt
45 // Date:         1999-02-20
46 // Purpose:      Interrupt handler tables for SPARC.
47 //              
48 //####DESCRIPTIONEND####
49 //
50 //==========================================================================
51
52
53 #include <cyg/hal/hal_intr.h>
54 #include <cyg/hal/hal_arch.h>
55
56 #include <cyg/infra/cyg_ass.h> // for CYG_FAIL() below
57
58 // ------------------------------------------------------------------------
59 // First level C default interrupt handler.
60
61 //static int count = 0;
62
63 cyg_uint32 hal_default_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data)
64 {
65     return 0; // 0x1def0000 + vector + (count += 0x0100);
66 }
67
68 // ------------------------------------------------------------------------
69 // First level C exception handler.
70
71 externC void __handle_exception (void);
72
73 externC HAL_SavedRegisters *_hal_registers;
74
75 void cyg_hal_exception_handler(CYG_ADDRWORD vector, CYG_ADDRWORD data,
76                                CYG_ADDRWORD stackpointer )
77 {
78 #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
79     // Set the pointer to the registers of the current exception
80     // context. At entry the GDB stub will expand the
81     // HAL_SavedRegisters structure into a (bigger) register array.
82     _hal_registers = (HAL_SavedRegisters *)stackpointer;
83
84     __handle_exception();
85
86 #elif defined(CYGFUN_HAL_COMMON_KERNEL_SUPPORT) && \
87       defined(CYGPKG_HAL_EXCEPTIONS)
88     // We should decode the vector and pass a more appropriate
89     // value as the second argument. For now we simply pass a
90     // pointer to the saved registers. We should also divert
91     // breakpoint and other debug vectors into the debug stubs.
92
93     cyg_hal_deliver_exception( vector, stackpointer );
94
95 #else
96     CYG_FAIL("Exception!!!");
97 #endif    
98     return;
99 }
100
101 // ISR tables
102 volatile
103 CYG_ADDRESS    hal_interrupt_handlers[CYGNUM_HAL_VSR_COUNT] = {
104     (CYG_ADDRESS)hal_default_isr,
105     (CYG_ADDRESS)hal_default_isr,
106     (CYG_ADDRESS)hal_default_isr,
107     (CYG_ADDRESS)hal_default_isr,
108
109     (CYG_ADDRESS)hal_default_isr,
110     (CYG_ADDRESS)hal_default_isr,
111     (CYG_ADDRESS)hal_default_isr,
112     (CYG_ADDRESS)hal_default_isr,
113
114     (CYG_ADDRESS)hal_default_isr,
115     (CYG_ADDRESS)hal_default_isr,
116     (CYG_ADDRESS)hal_default_isr,
117     (CYG_ADDRESS)hal_default_isr,
118
119     (CYG_ADDRESS)hal_default_isr,
120     (CYG_ADDRESS)hal_default_isr,
121     (CYG_ADDRESS)hal_default_isr,
122     (CYG_ADDRESS)hal_default_isr,  /* 16 of these */
123
124     (CYG_ADDRESS)cyg_hal_exception_handler,
125     (CYG_ADDRESS)cyg_hal_exception_handler,
126     (CYG_ADDRESS)cyg_hal_exception_handler,
127     (CYG_ADDRESS)cyg_hal_exception_handler,
128     (CYG_ADDRESS)cyg_hal_exception_handler,
129
130     (CYG_ADDRESS)cyg_hal_exception_handler,
131     (CYG_ADDRESS)cyg_hal_exception_handler,
132     (CYG_ADDRESS)cyg_hal_exception_handler,
133     (CYG_ADDRESS)cyg_hal_exception_handler,
134     (CYG_ADDRESS)cyg_hal_exception_handler,
135
136     (CYG_ADDRESS)cyg_hal_exception_handler, /* 11 of these */
137 };
138
139 volatile
140 CYG_ADDRWORD   hal_interrupt_data[CYGNUM_HAL_VSR_COUNT] = {
141  0x11da1a00, 0x11da1a01, 0x11da1a02, 0x11da1a03,
142  0x11da1a04, 0x11da1a05, 0x11da1a06, 0x11da1a07,
143  0x11da1a08, 0x11da1a09, 0x11da1a0a, 0x11da1a0b,
144  0x11da1a0c, 0x11da1a0d, 0x11da1a0e, 0x11da1a0f,
145  0xeeda1a00, 0xeeda1a01, 0xeeda1a02, 0xeeda1a03, 0xeeda1a04,
146  0xeeda1a05, 0xeeda1a06, 0xeeda1a07, 0xeeda1a08, 0xeeda1a09,
147  0xeeda1a0A
148 };
149
150 volatile
151 CYG_ADDRESS    hal_interrupt_objects[CYGNUM_HAL_VSR_COUNT] = {
152     0,    0,    0,    0,
153     0,    0,    0,    0,
154     0,    0,    0,    0,
155     0,    0,    0,    0,
156
157     0,    0,    0,    0,    0,
158     0,    0,    0,    0,    0,
159     0,
160 };
161
162 // EOF hal_intr.c