Mercurial > ecos-v3_0-branch
annotate packages/hal/sparclite/arch/current/src/hal_boot.c @ 66:bf00f99aec69 ecos-sw-2000-02-02
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
| author | jlarmour |
|---|---|
| date | Wed, 02 Feb 2000 19:57:02 +0000 |
| parents | c38311975d4f |
| children | da3908c9cd10 |
| rev | line source |
|---|---|
| 2 | 1 //========================================================================== |
| 2 // | |
| 3 // hal_boot.c | |
| 4 // | |
| 5 // SPARClite Architecture specific interrupt dispatch tables | |
| 6 // | |
| 7 //========================================================================== | |
| 8 //####COPYRIGHTBEGIN#### | |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
12
diff
changeset
|
9 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
12
diff
changeset
|
10 // ------------------------------------------- |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
12
diff
changeset
|
11 // The contents of this file are subject to the Red Hat eCos Public License |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
12 // Version 1.1 (the "License"); you may not use this file except in |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
12
diff
changeset
|
13 // compliance with the License. You may obtain a copy of the License at |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
14 // http://www.redhat.com/ |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
12
diff
changeset
|
15 // |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
16 // Software distributed under the License is distributed on an "AS IS" |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
12
diff
changeset
|
17 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
12
diff
changeset
|
18 // License for the specific language governing rights and limitations under |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
12
diff
changeset
|
19 // the License. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
12
diff
changeset
|
20 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
12
diff
changeset
|
21 // The Original Code is eCos - Embedded Configurable Operating System, |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
12
diff
changeset
|
22 // released September 30, 1998. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
12
diff
changeset
|
23 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
12
diff
changeset
|
24 // The Initial Developer of the Original Code is Red Hat. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
12
diff
changeset
|
25 // Portions created by Red Hat are |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
12
diff
changeset
|
26 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
12
diff
changeset
|
27 // All Rights Reserved. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
12
diff
changeset
|
28 // ------------------------------------------- |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
12
diff
changeset
|
29 // |
| 2 | 30 //####COPYRIGHTEND#### |
| 31 //========================================================================== | |
| 32 //#####DESCRIPTIONBEGIN#### | |
| 33 // | |
| 34 // Author(s): hmt | |
| 35 // Contributors: hmt | |
| 36 // Date: 1998-12-10 | |
| 37 // Purpose: Interrupt handler tables for SPARClite. | |
| 38 // | |
| 39 //####DESCRIPTIONEND#### | |
| 40 // | |
| 41 //========================================================================== | |
| 42 | |
| 43 #include <pkgconf/hal.h> | |
| 44 #include <cyg/infra/cyg_type.h> | |
| 45 | |
| 46 /*------------------------------------------------------------------------*/ | |
| 47 /* calling this is our raison d'etre: */ | |
| 48 extern void cyg_start( void ); | |
| 49 | |
| 50 /*------------------------------------------------------------------------*/ | |
| 51 /* data copy and bss zero functions */ | |
| 52 | |
| 53 typedef void (CYG_ROM_ADDRESS)(void); | |
| 54 | |
| 55 #ifdef CYG_HAL_STARTUP_ROM | |
| 56 void hal_copy_data(void) | |
| 57 { | |
| 58 extern char __ram_data_start; | |
| 59 extern char __ram_data_end; | |
| 60 extern CYG_ROM_ADDRESS __rom_data_start; | |
| 61 long *p = (long *)&__ram_data_start; | |
| 62 long *q = (long *)&__rom_data_start; | |
| 63 | |
| 64 while( p <= (long *)&__ram_data_end ) | |
| 65 *p++ = *q++; | |
| 66 } | |
| 67 #endif | |
| 68 | |
| 69 void hal_zero_bss(void) | |
| 70 { | |
| 71 extern CYG_ROM_ADDRESS __bss_start; | |
| 72 extern CYG_ROM_ADDRESS __bss_end; | |
| 73 | |
| 74 register long long zero = 0; | |
| 75 register long long *end = (long long *)&__bss_end; | |
| 76 register long long *p = (long long *)&__bss_start; | |
| 77 | |
| 78 while( p <= end ) | |
| 79 *p++ = zero; | |
| 80 } | |
| 81 | |
| 82 #ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG | |
| 83 cyg_bool cyg_hal_stop_constructors; | |
| 84 #endif | |
| 85 | |
| 86 void | |
| 87 cyg_hal_invoke_constructors (void) | |
| 88 { | |
| 89 typedef void (*pfunc) (void); | |
| 90 extern pfunc __CTOR_LIST__[]; | |
| 91 extern pfunc __CTOR_END__[]; | |
| 92 | |
| 93 #ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG | |
| 94 static pfunc *p = &__CTOR_END__[-1]; | |
| 95 | |
| 96 cyg_hal_stop_constructors = 0; | |
| 97 for (; p >= __CTOR_LIST__; p--) { | |
| 98 (*p) (); | |
| 99 if (cyg_hal_stop_constructors) { | |
| 100 p--; | |
| 101 break; | |
| 102 } | |
| 103 } | |
| 104 #else | |
| 105 pfunc *p; | |
| 106 | |
| 107 for (p = &__CTOR_END__[-1]; p >= __CTOR_LIST__; p--) | |
| 108 (*p) (); | |
| 109 #endif | |
| 110 } | |
| 111 | |
|
12
4cc3eff958ab
Merge from eCos master repository on 1999-06-04-22:24:56-BST
jlarmour
parents:
2
diff
changeset
|
112 // Override any __gccmain the compiler might generate. We don't want |
| 2 | 113 // constructors to be called twice. |
|
12
4cc3eff958ab
Merge from eCos master repository on 1999-06-04-22:24:56-BST
jlarmour
parents:
2
diff
changeset
|
114 void __gccmain(void) {} |
| 2 | 115 |
| 116 /*------------------------------------------------------------------------*/ | |
| 117 /* CYG_HAL_START - pre-main-entrypoint */ | |
| 118 | |
| 119 #ifdef CYG_HAL_SPARCLITE_SLEB | |
| 120 #define SLEB_LED (*(volatile char *)(0x02000003)) | |
| 121 #define LED( _x_ ) SLEB_LED = (char)(0xff & ~(_x_)) | |
| 122 #else | |
| 123 #define LED( _x_ ) CYG_EMPTY_STATEMENT | |
| 124 #endif | |
| 125 | |
| 126 extern void hal_board_prestart( void ); | |
| 127 extern void hal_board_poststart( void ); | |
| 128 | |
| 129 // This is called with traps enabled, but interrupts masked out: | |
| 130 // Be sure to enable them in hal_board_poststart() at the latest. | |
| 131 | |
| 132 void cyg_hal_start( void ) | |
| 133 { | |
| 134 /* Board specific prestart that's best done in C */ | |
| 135 hal_board_prestart(); | |
| 136 | |
| 137 LED( 0xd0 ); | |
| 138 | |
| 139 #ifdef CYG_HAL_STARTUP_ROM | |
| 140 /* Copy data from ROM to RAM */ | |
| 141 hal_copy_data(); | |
| 142 #endif | |
| 143 | |
| 144 LED( 0xd4 ); | |
| 145 | |
| 146 /* Zero BSS */ | |
| 147 hal_zero_bss(); | |
| 148 | |
| 149 LED( 0xd8 ); | |
| 150 | |
| 151 /* Call constructors */ | |
| 152 cyg_hal_invoke_constructors(); | |
| 153 | |
| 154 LED( 0xdc ); | |
| 155 | |
| 156 /* Board specific late startup that's best done in C */ | |
| 157 hal_board_poststart(); | |
| 158 | |
| 159 LED( 0xf8 ); | |
| 160 | |
| 161 /* Call cyg_start */ | |
| 162 cyg_start(); /* does not return */ | |
| 163 } | |
| 164 | |
| 165 // EOF hal_boot.c |
