Mercurial > ecos
annotate packages/hal/arm/arch/current/src/hal_misc.c @ 3292:7f8e529b4d82 default tip
Fix FREESCALE_EDMA_NBYTES_MLOFFYES_MLOFF() so it works with negative offsets.
| author | vae |
|---|---|
| date | Wed, 29 Apr 2015 23:31:48 +0000 |
| parents | 74dbf4c3f2e1 |
| children |
| rev | line source |
|---|---|
| 2 | 1 /*========================================================================== |
| 2 // | |
| 3 // hal_misc.c | |
| 4 // | |
| 5 // HAL miscellaneous functions | |
| 6 // | |
| 7 //========================================================================== | |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
8 // ####ECOSGPLCOPYRIGHTBEGIN#### |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
9 // ------------------------------------------- |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
10 // This file is part of eCos, the Embedded Configurable Operating System. |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2008 Free Software Foundation, Inc. |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
194
diff
changeset
|
12 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
13 // eCos is free software; you can redistribute it and/or modify it under |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
14 // the terms of the GNU General Public License as published by the Free |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
15 // Software Foundation; either version 2 or (at your option) any later |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
16 // version. |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
194
diff
changeset
|
17 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
18 // eCos is distributed in the hope that it will be useful, but WITHOUT |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
19 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
20 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
21 // for more details. |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
194
diff
changeset
|
22 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
23 // You should have received a copy of the GNU General Public License |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
24 // along with eCos; if not, write to the Free Software Foundation, Inc., |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
25 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
194
diff
changeset
|
26 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
27 // As a special exception, if other files instantiate templates or use |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
28 // macros or inline functions from this file, or you compile this file |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
29 // and link it with other works to produce a work based on this file, |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
30 // this file does not by itself cause the resulting work to be covered by |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
31 // the GNU General Public License. However the source code for this file |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
32 // must still be made available in accordance with section (3) of the GNU |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
33 // General Public License v2. |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
194
diff
changeset
|
34 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
35 // This exception does not invalidate any other reasons why a work based |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
36 // on this file might be covered by the GNU General Public License. |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
37 // ------------------------------------------- |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
2594
diff
changeset
|
38 // ####ECOSGPLCOPYRIGHTEND#### |
| 2 | 39 //========================================================================== |
| 40 //#####DESCRIPTIONBEGIN#### | |
| 41 // | |
| 42 // Author(s): nickg, gthomas | |
| 43 // Contributors: nickg, gthomas | |
| 44 // Date: 1999-02-20 | |
| 45 // Purpose: HAL miscellaneous functions | |
| 46 // Description: This file contains miscellaneous functions provided by the | |
| 47 // HAL. | |
| 48 // | |
| 49 //####DESCRIPTIONEND#### | |
| 50 // | |
| 51 //=========================================================================*/ | |
| 52 | |
| 53 #include <pkgconf/hal.h> | |
| 54 #include <pkgconf/hal_arm.h> | |
| 55 #ifdef CYGPKG_KERNEL | |
| 56 #include <pkgconf/kernel.h> | |
| 57 #endif | |
|
50
a0774359f013
Merge from eCos master repository on 1999-11-02-17:02:15-GMT
jlarmour
parents:
38
diff
changeset
|
58 #ifdef CYGPKG_CYGMON |
|
a0774359f013
Merge from eCos master repository on 1999-11-02-17:02:15-GMT
jlarmour
parents:
38
diff
changeset
|
59 #include <pkgconf/cygmon.h> |
|
a0774359f013
Merge from eCos master repository on 1999-11-02-17:02:15-GMT
jlarmour
parents:
38
diff
changeset
|
60 #endif |
| 2 | 61 |
|
2594
4ca9d5dac8b0
* src/arm.ld: Discard C++ EH-related sections when we can't
jlarmour
parents:
2429
diff
changeset
|
62 #include <cyg/infra/diag.h> |
| 2 | 63 #include <cyg/infra/cyg_type.h> |
| 64 #include <cyg/infra/cyg_trac.h> // tracing macros | |
| 65 #include <cyg/infra/cyg_ass.h> // assertion macros | |
| 66 | |
| 67 #include <cyg/hal/hal_arch.h> // HAL header | |
| 68 #include <cyg/hal/hal_intr.h> // HAL header | |
| 69 | |
| 70 /*------------------------------------------------------------------------*/ | |
| 71 /* First level C exception handler. */ | |
| 72 | |
| 73 externC void __handle_exception (void); | |
| 74 | |
| 75 externC HAL_SavedRegisters *_hal_registers; | |
|
171
42f843b391aa
Merge from eCos master repository on 2001-07-18-03:13:25-BST
jlarmour
parents:
152
diff
changeset
|
76 #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS |
|
1649
0a6e548604cc
* src/hal_misc.c: __mem_fault_handler: Only do this if we have
asl
parents:
1073
diff
changeset
|
77 externC void* volatile __mem_fault_handler; |
|
171
42f843b391aa
Merge from eCos master repository on 2001-07-18-03:13:25-BST
jlarmour
parents:
152
diff
changeset
|
78 #endif |
|
1649
0a6e548604cc
* src/hal_misc.c: __mem_fault_handler: Only do this if we have
asl
parents:
1073
diff
changeset
|
79 |
| 2 | 80 |
| 81 #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS | |
| 82 /* Force exception handling into the GDB stubs. This is done by taking over | |
| 83 the exception vectors while executing in the stubs. This allows for the | |
| 84 debugged program to handle exceptions itself, except while the GDB | |
| 85 processing is underway. The only vector that can't be handled this way | |
| 86 is the illegal instruction vector which is used for breakpoint/single-step | |
| 87 and must be maintained by the stubs at all times. | |
|
38
e7ba79f6d3a8
Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents:
28
diff
changeset
|
88 Note: the interrupt vectors are _not_ preempted as the stubs probably can't |
|
e7ba79f6d3a8
Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents:
28
diff
changeset
|
89 handle them properly. |
| 2 | 90 */ |
| 91 | |
| 92 #define ARM_VECTORS 8 | |
| 93 extern unsigned long vectors[]; // exception vectors as defined by the stubs | |
|
110
84e4bde58b26
Merge from eCos master repository on 2000-07-14-22:00:02-BST
jlarmour
parents:
103
diff
changeset
|
94 |
|
84e4bde58b26
Merge from eCos master repository on 2000-07-14-22:00:02-BST
jlarmour
parents:
103
diff
changeset
|
95 #if !defined(CYGPKG_CYGMON) |
| 2 | 96 static unsigned long *hardware_vectors = (unsigned long *)0x20; |
| 97 static unsigned long hold_vectors[ARM_VECTORS]; | |
| 98 static int exception_level; | |
| 99 | |
| 100 static void | |
| 101 __take_over_debug_traps(void) | |
| 102 { | |
|
38
e7ba79f6d3a8
Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents:
28
diff
changeset
|
103 hold_vectors[CYGNUM_HAL_VECTOR_ABORT_PREFETCH] = hardware_vectors[CYGNUM_HAL_VECTOR_ABORT_PREFETCH]; |
|
e7ba79f6d3a8
Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents:
28
diff
changeset
|
104 hardware_vectors[CYGNUM_HAL_VECTOR_ABORT_PREFETCH] = vectors[CYGNUM_HAL_VECTOR_ABORT_PREFETCH]; |
|
e7ba79f6d3a8
Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents:
28
diff
changeset
|
105 hold_vectors[CYGNUM_HAL_VECTOR_ABORT_DATA] = hardware_vectors[CYGNUM_HAL_VECTOR_ABORT_DATA]; |
|
e7ba79f6d3a8
Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents:
28
diff
changeset
|
106 hardware_vectors[CYGNUM_HAL_VECTOR_ABORT_DATA] = vectors[CYGNUM_HAL_VECTOR_ABORT_DATA]; |
| 2 | 107 } |
| 108 | |
| 109 static void | |
| 110 __restore_debug_traps(void) | |
| 111 { | |
|
38
e7ba79f6d3a8
Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents:
28
diff
changeset
|
112 hardware_vectors[CYGNUM_HAL_VECTOR_ABORT_PREFETCH] = hold_vectors[CYGNUM_HAL_VECTOR_ABORT_PREFETCH]; |
|
e7ba79f6d3a8
Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents:
28
diff
changeset
|
113 hardware_vectors[CYGNUM_HAL_VECTOR_ABORT_DATA] = hold_vectors[CYGNUM_HAL_VECTOR_ABORT_DATA]; |
| 2 | 114 } |
|
110
84e4bde58b26
Merge from eCos master repository on 2000-07-14-22:00:02-BST
jlarmour
parents:
103
diff
changeset
|
115 #endif // !CYGPKG_CYGMON |
| 2 | 116 #endif |
| 117 | |
| 118 void | |
| 119 exception_handler(HAL_SavedRegisters *regs) | |
| 120 { | |
|
171
42f843b391aa
Merge from eCos master repository on 2001-07-18-03:13:25-BST
jlarmour
parents:
152
diff
changeset
|
121 // Special case handler for code which has chosen to take care |
|
42f843b391aa
Merge from eCos master repository on 2001-07-18-03:13:25-BST
jlarmour
parents:
152
diff
changeset
|
122 // of data exceptions (i.e. code which expects them to happen) |
|
42f843b391aa
Merge from eCos master repository on 2001-07-18-03:13:25-BST
jlarmour
parents:
152
diff
changeset
|
123 // This is common in discovery code, e.g. checking for a particular |
|
42f843b391aa
Merge from eCos master repository on 2001-07-18-03:13:25-BST
jlarmour
parents:
152
diff
changeset
|
124 // device which may generate an exception when probing if the |
|
42f843b391aa
Merge from eCos master repository on 2001-07-18-03:13:25-BST
jlarmour
parents:
152
diff
changeset
|
125 // device is not present |
|
1649
0a6e548604cc
* src/hal_misc.c: __mem_fault_handler: Only do this if we have
asl
parents:
1073
diff
changeset
|
126 #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS |
| 2 | 127 if (__mem_fault_handler && |
| 128 regs->vector == CYGNUM_HAL_EXCEPTION_DATA_ACCESS) { | |
| 129 regs->pc = (unsigned long)__mem_fault_handler; | |
| 130 return; // Caught an exception inside stubs | |
| 131 } | |
|
1649
0a6e548604cc
* src/hal_misc.c: __mem_fault_handler: Only do this if we have
asl
parents:
1073
diff
changeset
|
132 #endif |
| 2 | 133 |
|
171
42f843b391aa
Merge from eCos master repository on 2001-07-18-03:13:25-BST
jlarmour
parents:
152
diff
changeset
|
134 #if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) && !defined(CYGPKG_CYGMON) |
| 2 | 135 if (++exception_level == 1) __take_over_debug_traps(); |
| 136 | |
| 137 _hal_registers = regs; | |
| 138 __handle_exception(); | |
| 139 | |
|
38
e7ba79f6d3a8
Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents:
28
diff
changeset
|
140 if (--exception_level == 0) __restore_debug_traps(); |
|
e7ba79f6d3a8
Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents:
28
diff
changeset
|
141 |
|
e7ba79f6d3a8
Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents:
28
diff
changeset
|
142 #elif defined(CYGPKG_KERNEL_EXCEPTIONS) |
|
e7ba79f6d3a8
Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents:
28
diff
changeset
|
143 |
| 2 | 144 // We should decode the vector and pass a more appropriate |
| 145 // value as the second argument. For now we simply pass a | |
| 146 // pointer to the saved registers. We should also divert | |
| 147 // breakpoint and other debug vectors into the debug stubs. | |
| 148 | |
| 149 cyg_hal_deliver_exception( regs->vector, (CYG_ADDRWORD)regs ); | |
| 150 | |
| 151 #else | |
| 152 | |
| 153 CYG_FAIL("Exception!!!"); | |
| 154 | |
| 155 #endif | |
| 156 | |
| 157 return; | |
| 158 } | |
| 159 | |
|
152
f935b880e96c
Merge from eCos master repository on 2001-02-14-01:27:14-GMT
jlarmour
parents:
151
diff
changeset
|
160 void hal_spurious_IRQ(HAL_SavedRegisters *regs) CYGBLD_ATTRIB_WEAK; |
|
f935b880e96c
Merge from eCos master repository on 2001-02-14-01:27:14-GMT
jlarmour
parents:
151
diff
changeset
|
161 void |
|
f935b880e96c
Merge from eCos master repository on 2001-02-14-01:27:14-GMT
jlarmour
parents:
151
diff
changeset
|
162 hal_spurious_IRQ(HAL_SavedRegisters *regs) |
|
f935b880e96c
Merge from eCos master repository on 2001-02-14-01:27:14-GMT
jlarmour
parents:
151
diff
changeset
|
163 { |
|
f935b880e96c
Merge from eCos master repository on 2001-02-14-01:27:14-GMT
jlarmour
parents:
151
diff
changeset
|
164 #if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) |
|
f935b880e96c
Merge from eCos master repository on 2001-02-14-01:27:14-GMT
jlarmour
parents:
151
diff
changeset
|
165 exception_handler(regs); |
|
f935b880e96c
Merge from eCos master repository on 2001-02-14-01:27:14-GMT
jlarmour
parents:
151
diff
changeset
|
166 #else |
|
f935b880e96c
Merge from eCos master repository on 2001-02-14-01:27:14-GMT
jlarmour
parents:
151
diff
changeset
|
167 CYG_FAIL("Spurious interrupt!!"); |
|
f935b880e96c
Merge from eCos master repository on 2001-02-14-01:27:14-GMT
jlarmour
parents:
151
diff
changeset
|
168 #endif |
|
f935b880e96c
Merge from eCos master repository on 2001-02-14-01:27:14-GMT
jlarmour
parents:
151
diff
changeset
|
169 } |
|
f935b880e96c
Merge from eCos master repository on 2001-02-14-01:27:14-GMT
jlarmour
parents:
151
diff
changeset
|
170 |
| 2 | 171 /*------------------------------------------------------------------------*/ |
| 172 /* C++ support - run initial constructors */ | |
| 173 | |
| 174 #ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG | |
| 175 cyg_bool cyg_hal_stop_constructors; | |
| 176 #endif | |
| 177 | |
| 178 typedef void (*pfunc) (void); | |
|
2594
4ca9d5dac8b0
* src/arm.ld: Discard C++ EH-related sections when we can't
jlarmour
parents:
2429
diff
changeset
|
179 |
|
4ca9d5dac8b0
* src/arm.ld: Discard C++ EH-related sections when we can't
jlarmour
parents:
2429
diff
changeset
|
180 // EABI uses different symbols, and constructors are in opposite order. |
|
4ca9d5dac8b0
* src/arm.ld: Discard C++ EH-related sections when we can't
jlarmour
parents:
2429
diff
changeset
|
181 #ifdef CYGBLD_HAL_ARM_EABI |
|
4ca9d5dac8b0
* src/arm.ld: Discard C++ EH-related sections when we can't
jlarmour
parents:
2429
diff
changeset
|
182 extern pfunc __init_array_start__[]; |
|
4ca9d5dac8b0
* src/arm.ld: Discard C++ EH-related sections when we can't
jlarmour
parents:
2429
diff
changeset
|
183 extern pfunc __init_array_end__[]; |
|
4ca9d5dac8b0
* src/arm.ld: Discard C++ EH-related sections when we can't
jlarmour
parents:
2429
diff
changeset
|
184 #define CONSTRUCTORS_START (__init_array_start__[0]) |
|
4ca9d5dac8b0
* src/arm.ld: Discard C++ EH-related sections when we can't
jlarmour
parents:
2429
diff
changeset
|
185 #define CONSTRUCTORS_END (__init_array_end__) |
|
4ca9d5dac8b0
* src/arm.ld: Discard C++ EH-related sections when we can't
jlarmour
parents:
2429
diff
changeset
|
186 #define NEXT_CONSTRUCTOR(c) ((c)++) |
|
4ca9d5dac8b0
* src/arm.ld: Discard C++ EH-related sections when we can't
jlarmour
parents:
2429
diff
changeset
|
187 #else |
| 2 | 188 extern pfunc __CTOR_LIST__[]; |
| 189 extern pfunc __CTOR_END__[]; | |
|
2594
4ca9d5dac8b0
* src/arm.ld: Discard C++ EH-related sections when we can't
jlarmour
parents:
2429
diff
changeset
|
190 #define CONSTRUCTORS_START (__CTOR_END__[-1]) |
|
4ca9d5dac8b0
* src/arm.ld: Discard C++ EH-related sections when we can't
jlarmour
parents:
2429
diff
changeset
|
191 #define CONSTRUCTORS_END (&__CTOR_LIST__[-1]) |
|
4ca9d5dac8b0
* src/arm.ld: Discard C++ EH-related sections when we can't
jlarmour
parents:
2429
diff
changeset
|
192 #define NEXT_CONSTRUCTOR(c) ((c)--) |
|
4ca9d5dac8b0
* src/arm.ld: Discard C++ EH-related sections when we can't
jlarmour
parents:
2429
diff
changeset
|
193 #endif |
| 2 | 194 |
| 195 void | |
| 196 cyg_hal_invoke_constructors (void) | |
| 197 { | |
| 198 #ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG | |
|
2594
4ca9d5dac8b0
* src/arm.ld: Discard C++ EH-related sections when we can't
jlarmour
parents:
2429
diff
changeset
|
199 static pfunc *p = &CONSTRUCTORS_START; |
| 2 | 200 |
| 201 cyg_hal_stop_constructors = 0; | |
|
2594
4ca9d5dac8b0
* src/arm.ld: Discard C++ EH-related sections when we can't
jlarmour
parents:
2429
diff
changeset
|
202 for (; p != CONSTRUCTORS_END; NEXT_CONSTRUCTOR(p)) { |
|
4ca9d5dac8b0
* src/arm.ld: Discard C++ EH-related sections when we can't
jlarmour
parents:
2429
diff
changeset
|
203 (*p)(); |
| 2 | 204 if (cyg_hal_stop_constructors) { |
|
2594
4ca9d5dac8b0
* src/arm.ld: Discard C++ EH-related sections when we can't
jlarmour
parents:
2429
diff
changeset
|
205 NEXT_CONSTRUCTOR(p); |
| 2 | 206 break; |
| 207 } | |
| 208 } | |
| 209 #else | |
| 210 pfunc *p; | |
| 211 | |
|
2594
4ca9d5dac8b0
* src/arm.ld: Discard C++ EH-related sections when we can't
jlarmour
parents:
2429
diff
changeset
|
212 for (p = &CONSTRUCTORS_START; p != CONSTRUCTORS_END; NEXT_CONSTRUCTOR(p)) |
|
4ca9d5dac8b0
* src/arm.ld: Discard C++ EH-related sections when we can't
jlarmour
parents:
2429
diff
changeset
|
213 (*p)(); |
| 2 | 214 #endif |
| 215 } | |
| 216 | |
| 217 /*------------------------------------------------------------------------*/ | |
|
110
84e4bde58b26
Merge from eCos master repository on 2000-07-14-22:00:02-BST
jlarmour
parents:
103
diff
changeset
|
218 /* Architecture default ISR */ |
| 2 | 219 |
|
103
95f3e12a6327
Merge from eCos master repository on 2000-06-23-16:41:10-BST
jlarmour
parents:
76
diff
changeset
|
220 externC cyg_uint32 |
|
95f3e12a6327
Merge from eCos master repository on 2000-06-23-16:41:10-BST
jlarmour
parents:
76
diff
changeset
|
221 hal_arch_default_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data) |
|
95f3e12a6327
Merge from eCos master repository on 2000-06-23-16:41:10-BST
jlarmour
parents:
76
diff
changeset
|
222 { |
|
95f3e12a6327
Merge from eCos master repository on 2000-06-23-16:41:10-BST
jlarmour
parents:
76
diff
changeset
|
223 CYG_TRACE1(true, "Interrupt: %d", vector); |
|
95f3e12a6327
Merge from eCos master repository on 2000-06-23-16:41:10-BST
jlarmour
parents:
76
diff
changeset
|
224 |
|
95f3e12a6327
Merge from eCos master repository on 2000-06-23-16:41:10-BST
jlarmour
parents:
76
diff
changeset
|
225 CYG_FAIL("Spurious Interrupt!!!"); |
|
95f3e12a6327
Merge from eCos master repository on 2000-06-23-16:41:10-BST
jlarmour
parents:
76
diff
changeset
|
226 return 0; |
|
95f3e12a6327
Merge from eCos master repository on 2000-06-23-16:41:10-BST
jlarmour
parents:
76
diff
changeset
|
227 } |
| 2 | 228 |
| 229 /*-------------------------------------------------------------------------*/ | |
| 230 /* Misc functions */ | |
| 231 | |
| 232 #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS | |
| 233 /* This function will generate a breakpoint exception. It is used at the | |
| 234 beginning of a program to sync up with a debugger and can be used | |
| 235 otherwise as a quick means to stop program execution and "break" into | |
| 236 the debugger. */ | |
| 237 | |
| 238 void | |
| 239 breakpoint(void) | |
| 240 { | |
|
115
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
110
diff
changeset
|
241 HAL_BREAKPOINT(_breakinst); |
| 2 | 242 } |
| 243 | |
| 244 | |
| 245 /* This function returns the opcode for a 'trap' instruction. */ | |
| 246 | |
| 247 unsigned long | |
| 248 __break_opcode (void) | |
| 249 { | |
| 250 return HAL_BREAKINST; | |
| 251 } | |
| 252 #endif | |
| 253 | |
| 254 int | |
| 255 hal_lsbindex(int mask) | |
| 256 { | |
| 257 int i; | |
| 258 for (i = 0; i < 32; i++) { | |
| 259 if (mask & (1<<i)) return (i); | |
| 260 } | |
| 261 return (-1); | |
| 262 } | |
| 263 | |
| 264 int | |
| 265 hal_msbindex(int mask) | |
| 266 { | |
| 267 int i; | |
|
194
feb0fcf83327
Merge from eCos master repository on 2001-10-26-06:43:03-BST
jlarmour
parents:
171
diff
changeset
|
268 for (i = 31; i >= 0; i--) { |
| 2 | 269 if (mask & (1<<i)) return (i); |
| 270 } | |
| 271 return (-1); | |
| 272 } | |
| 273 | |
| 274 #ifdef CYGHWR_HAL_ARM_DUMP_EXCEPTIONS | |
| 275 void | |
| 276 dump_frame(unsigned char *frame) | |
| 277 { | |
| 278 HAL_SavedRegisters *rp = (HAL_SavedRegisters *)frame; | |
| 279 int i; | |
|
76
435cced73e2f
eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
jlarmour
parents:
66
diff
changeset
|
280 diag_dump_buf(frame, 128); |
| 2 | 281 diag_printf("Registers:\n"); |
| 282 for (i = 0; i <= 10; i++) { | |
| 283 if ((i == 0) || (i == 6)) diag_printf("R%d: ", i); | |
| 284 diag_printf("%08X ", rp->d[i]); | |
| 285 if ((i == 5) || (i == 10)) diag_printf("\n"); | |
| 286 } | |
| 287 diag_printf("FP: %08X, SP: %08X, LR: %08X, PC: %08X, PSR: %08X\n", | |
| 288 rp->fp, rp->sp, rp->lr, rp->pc, rp->cpsr); | |
| 289 } | |
| 290 #endif | |
| 291 | |
| 292 #if 0 | |
| 293 void | |
| 294 show_frame_in(HAL_SavedRegisters *frame) | |
| 295 { | |
| 296 int old; | |
| 297 HAL_DISABLE_INTERRUPTS(old); | |
| 298 diag_printf("[IN] IRQ Frame:\n"); | |
| 299 dump_frame((unsigned char *)frame); | |
| 300 HAL_RESTORE_INTERRUPTS(old); | |
| 301 } | |
| 302 | |
| 303 void | |
| 304 show_frame_out(HAL_SavedRegisters *frame) | |
| 305 { | |
| 306 int old; | |
| 307 HAL_DISABLE_INTERRUPTS(old); | |
| 308 diag_printf("[OUT] IRQ Frame:\n"); | |
| 309 dump_frame((unsigned char *)frame); | |
| 310 HAL_RESTORE_INTERRUPTS(old); | |
| 311 } | |
| 312 #endif | |
| 313 | |
| 314 #ifdef CYGHWR_HAL_ARM_DUMP_EXCEPTIONS | |
| 315 // Debug routines | |
|
20
5f5102441818
Merge from eCos master repository on 1999-07-02-23:17:07-BST
jlarmour
parents:
2
diff
changeset
|
316 void cyg_hal_report_undefined_instruction(HAL_SavedRegisters *frame) |
| 2 | 317 { |
| 318 int old; | |
| 319 HAL_DISABLE_INTERRUPTS(old); | |
| 320 diag_printf("[UNDEFINED INSTRUCTION] Frame:\n"); | |
| 321 dump_frame((unsigned char *)frame); | |
| 322 HAL_RESTORE_INTERRUPTS(old); | |
| 323 } | |
| 324 | |
|
20
5f5102441818
Merge from eCos master repository on 1999-07-02-23:17:07-BST
jlarmour
parents:
2
diff
changeset
|
325 void cyg_hal_report_software_interrupt(HAL_SavedRegisters *frame) |
| 2 | 326 { |
| 327 int old; | |
| 328 HAL_DISABLE_INTERRUPTS(old); | |
| 329 diag_printf("[SOFTWARE INTERRUPT] Frame:\n"); | |
| 330 dump_frame((unsigned char *)frame); | |
| 331 HAL_RESTORE_INTERRUPTS(old); | |
| 332 } | |
| 333 | |
|
20
5f5102441818
Merge from eCos master repository on 1999-07-02-23:17:07-BST
jlarmour
parents:
2
diff
changeset
|
334 void cyg_hal_report_abort_prefetch(HAL_SavedRegisters *frame) |
| 2 | 335 { |
| 336 int old; | |
| 337 HAL_DISABLE_INTERRUPTS(old); | |
| 338 diag_printf("[ABORT PREFETCH] Frame:\n"); | |
| 339 dump_frame((unsigned char *)frame); | |
| 340 HAL_RESTORE_INTERRUPTS(old); | |
| 341 } | |
| 342 | |
|
20
5f5102441818
Merge from eCos master repository on 1999-07-02-23:17:07-BST
jlarmour
parents:
2
diff
changeset
|
343 void cyg_hal_report_abort_data(HAL_SavedRegisters *frame) |
| 2 | 344 { |
| 345 int old; | |
| 346 HAL_DISABLE_INTERRUPTS(old); | |
| 347 diag_printf("[ABORT DATA] Frame:\n"); | |
| 348 dump_frame((unsigned char *)frame); | |
| 349 HAL_RESTORE_INTERRUPTS(old); | |
| 350 } | |
| 351 | |
|
20
5f5102441818
Merge from eCos master repository on 1999-07-02-23:17:07-BST
jlarmour
parents:
2
diff
changeset
|
352 void cyg_hal_report_exception_handler_returned(HAL_SavedRegisters *frame) |
| 2 | 353 { |
| 354 int old; | |
| 355 HAL_DISABLE_INTERRUPTS(old); | |
| 356 diag_printf("Exception handler returned!\n"); | |
| 357 dump_frame((unsigned char *)frame); | |
| 358 HAL_RESTORE_INTERRUPTS(old); | |
| 359 } | |
| 360 #endif | |
| 361 | |
| 362 /*------------------------------------------------------------------------*/ | |
| 363 // EOF hal_misc.c |
